111
This commit is contained in:
@@ -114,6 +114,15 @@ class KeyPressNB {
|
||||
//基础工具类
|
||||
class Rindro_BaseToolClass {
|
||||
|
||||
function IsNumber(value) {
|
||||
try {
|
||||
local Buffer = value.tointeger();
|
||||
return true;
|
||||
} catch (exception) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function GetItemNameById(ItemId) {
|
||||
local ItemObject = L_sq_GetItem(ItemId);
|
||||
local NamePointer = L_sq_RA(ItemObject + 0x20);
|
||||
@@ -198,6 +207,42 @@ class Rindro_BaseToolClass {
|
||||
return null;
|
||||
}
|
||||
|
||||
function DrawTriptych(X, Y, Width, Img, StartIndex) {
|
||||
//如果没有载入img就载入
|
||||
if (!Rindro_Image_GlobalMap.rawin(Img)) {
|
||||
Rindro_Image_GlobalMap[Img] <- Rindro_Image(Img);
|
||||
}
|
||||
Rindro_Image_GlobalMap[Img].DrawPng(StartIndex, X, Y);
|
||||
//获取第一张图片的宽
|
||||
local FirstW = Rindro_Image_GlobalMap[Img].GetPng(StartIndex).GetWidth();
|
||||
//获取中间的图片宽
|
||||
local MiddleW = Rindro_Image_GlobalMap[Img].GetPng(StartIndex + 1).GetWidth();
|
||||
//获得最后一张图片的宽
|
||||
local LastW = Rindro_Image_GlobalMap[Img].GetPng(StartIndex + 2).GetWidth();
|
||||
//绘制中间
|
||||
Rindro_Image_GlobalMap[Img].DrawExPng(StartIndex + 1, X + FirstW, Y, 0, sq_RGBA(255, 255, 255, 250), (Width - LastW - FirstW).tofloat() / MiddleW, 1.0);
|
||||
//绘制最后一张
|
||||
Rindro_Image_GlobalMap[Img].DrawPng(StartIndex + 2, X + Width - LastW, Y);
|
||||
}
|
||||
|
||||
function DrawTriptychDetail(X, Y, Width, Img, Fi, Mi, La) {
|
||||
//如果没有载入img就载入
|
||||
if (!Rindro_Image_GlobalMap.rawin(Img)) {
|
||||
Rindro_Image_GlobalMap[Img] <- Rindro_Image(Img);
|
||||
}
|
||||
Rindro_Image_GlobalMap[Img].DrawPng(Fi, X, Y);
|
||||
//获取第一张图片的宽
|
||||
local FirstW = Rindro_Image_GlobalMap[Img].GetPng(Fi).GetWidth();
|
||||
//获取中间的图片宽
|
||||
local MiddleW = Rindro_Image_GlobalMap[Img].GetPng(Mi).GetWidth();
|
||||
//获得最后一张图片的宽
|
||||
local LastW = Rindro_Image_GlobalMap[Img].GetPng(La).GetWidth();
|
||||
//绘制中间
|
||||
Rindro_Image_GlobalMap[Img].DrawExPng(Mi, X + FirstW, Y, 0, sq_RGBA(255, 255, 255, 250), (Width - LastW - FirstW).tofloat() / MiddleW, 1.0);
|
||||
//绘制最后一张
|
||||
Rindro_Image_GlobalMap[Img].DrawPng(La, X + Width - LastW, Y);
|
||||
}
|
||||
|
||||
function DrawNineBox(X, Y, Width, Height, Img, StartIndex) {
|
||||
//如果没有载入img就载入
|
||||
if (!Rindro_Image_GlobalMap.rawin(Img)) {
|
||||
@@ -240,6 +285,8 @@ class Rindro_BaseToolClass {
|
||||
//绘制右下角
|
||||
Rindro_Image_GlobalMap[Img].DrawPng(StartIndex + 8, X + Width - LeftTopW, Y + Height - LeftTopH);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//获取文字绘制长度
|
||||
class LenheartTextClass {
|
||||
@@ -395,4 +442,70 @@ class longlong {
|
||||
return RetStr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//任务队列
|
||||
class QuestQueue {
|
||||
//队列
|
||||
Queue = null;
|
||||
|
||||
constructor() {
|
||||
Queue = {};
|
||||
}
|
||||
|
||||
//添加任务
|
||||
function AddQuest(QuestName, QuestLogic, ...) {
|
||||
local args = null;
|
||||
if (vargc > 0) {
|
||||
args = [];
|
||||
for (local i = 0; i< vargc; i++) {
|
||||
args.append(vargv[i]);
|
||||
}
|
||||
}
|
||||
Queue[QuestName] <- {
|
||||
Logic = QuestLogic,
|
||||
InseartTime = Clock(),
|
||||
arg = args
|
||||
};
|
||||
}
|
||||
|
||||
//移除任务
|
||||
function RemoveQuest(QuestName) {
|
||||
if (Queue) {
|
||||
Queue.rawdelete(QuestName);
|
||||
}
|
||||
}
|
||||
|
||||
//执行任务
|
||||
function Run() {
|
||||
if (Queue) {
|
||||
local NowTime = Clock();
|
||||
foreach(QuestName, QuestInfo in Queue) {
|
||||
if (QuestInfo.arg && QuestInfo.arg.len() > 0) {
|
||||
local Arr = [];
|
||||
Arr.append(getroottable());
|
||||
Arr.append(QuestName);
|
||||
Arr.append(NowTime);
|
||||
foreach(value in QuestInfo.arg) {
|
||||
Arr.append(value);
|
||||
}
|
||||
QuestInfo.Logic.acall(Arr);
|
||||
// QuestInfo.Logic(QuestName, NowTime - QuestInfo.InseartTime, QuestInfo.arg);
|
||||
} else QuestInfo.Logic(QuestName, NowTime - QuestInfo.InseartTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//示例
|
||||
|
||||
/*
|
||||
Obj.AddQuest("测试任务",function (Name,Time)
|
||||
{
|
||||
print(Time);
|
||||
if(Time >= 2000)Obj.RemoveQuest(Name);
|
||||
}.bindenv(this));
|
||||
*/
|
||||
}
|
||||
Reference in New Issue
Block a user