613 lines
20 KiB
Plaintext
613 lines
20 KiB
Plaintext
/*
|
|
文件名:CollectBox.nut
|
|
路径:Plugins/CollectBox/CollectBox.nut
|
|
创建日期:2023-05-12 16:09
|
|
文件用途:
|
|
*/
|
|
|
|
//HudPro按钮类
|
|
class CollectBoxPro extends BasicsDrawTool // obj -- 按钮名称 -- X坐标 -- Y坐标 -- Ani调用路径 -- 宽度 -- 高度
|
|
{
|
|
obj = null; //Obj对象
|
|
State = 0; //按钮状态
|
|
ClickEnble = false; //点击效果
|
|
ButtonDynamic = false; //动态按钮效果
|
|
BaseFrame = null;
|
|
|
|
CustomClickEnble = false; //自定义点击效果
|
|
CustomClickAnifile = null; //自定义点击效果Ani路径
|
|
CustomButtonName = null; //自定义点击效果名称
|
|
CustomClickFrame = null; //自定义点击效果Ani编号
|
|
CustomClickx = null; //自定义点击效果X坐标
|
|
CustomClicky = null; //自定义点击效果Y坐标
|
|
|
|
|
|
RectEnble = false; //悬停效果
|
|
RectButtonName = null; //悬停名称
|
|
RectBaseAnifile = null; //悬停Ani路径
|
|
RectFrame = null; //非动态按钮的悬停调用Ani编号
|
|
Rectx = null; //悬停X坐标
|
|
Recty = null; //悬停Y坐标
|
|
|
|
|
|
ButtonName = null; //按钮名称
|
|
x = null; //X坐标
|
|
y = null; //Y坐标
|
|
BaseAnifile = null; //调用Ani路径
|
|
width = null; //可点击宽度
|
|
length = null; //可点击高度
|
|
|
|
Mobj = null; //鼠标对象
|
|
|
|
Overturn = false; //翻转
|
|
|
|
|
|
//构造函数
|
|
constructor(gButtonName, gX, gY, gAnifile, gWidth, gLength, gBaseFrame) {
|
|
ButtonName = gButtonName;
|
|
x = gX;
|
|
y = gY;
|
|
BaseAnifile = gAnifile;
|
|
width = gWidth;
|
|
length = gLength;
|
|
BaseFrame = gBaseFrame;
|
|
if (getroottable().rawin("MouseObject")) Mobj = getroottable()["MouseObject"];
|
|
}
|
|
//绘制按钮
|
|
function Show() {
|
|
if (ClickEnble) //是否开启点击效果
|
|
{
|
|
if (isLBDown() && State == 0) //按下左键并且按钮处于弹起状态
|
|
{
|
|
State = 1; //按键进入按下状态
|
|
++y;
|
|
}
|
|
if (!isLBDown() && State == 1) //按下左键并且按钮处于弹起状态
|
|
{
|
|
State = 0; //按键进入弹起状态
|
|
--y;
|
|
}
|
|
}
|
|
|
|
local Xr = 1.0
|
|
local Xoffset = 0;
|
|
|
|
if (Overturn) {
|
|
Xr = -1.0;
|
|
Xoffset = width;
|
|
}
|
|
//L_sq_DrawImg("common/etc/combo.img", 0, 100, 100, 0, sq_RGBA(255, 255, 255, 250), 1.0, 1.0);
|
|
|
|
if (CustomClickEnble) //是否开启自定义点击效果
|
|
{
|
|
if (isLBDown()) //按下左键并且按钮处于弹起状态
|
|
{
|
|
if (!ButtonDynamic) L_sq_DrawImg(CustomClickAnifile, CustomClickFrame, CustomClickx + Xoffset, CustomClicky, 0, sq_RGBA(255, 255, 255, 250), Xr, 1.0);
|
|
else T_DrawDynamicAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomButtonName);
|
|
}
|
|
}
|
|
|
|
if (RectEnble) //开启悬停效果时
|
|
{
|
|
if ((isInRect() && !isLBDown()) || (isInRect() && !CustomClickEnble)) //如果鼠标悬停的时候 并且没有点击的时候
|
|
{
|
|
//IMouse.SetMouseTask(44);
|
|
if (!ButtonDynamic) L_sq_DrawImg(RectBaseAnifile, RectFrame, Rectx + Xoffset, Recty, 0, sq_RGBA(255, 255, 255, 250), Xr, 1.0);
|
|
else T_DrawDynamicAni(obj, RectBaseAnifile, Rectx, Recty, RectButtonName);
|
|
}
|
|
}
|
|
if (!isInRect()) //如果鼠标没有悬停的时候
|
|
{
|
|
//IMouse.SetMouseTask(0);
|
|
if (!ButtonDynamic) L_sq_DrawImg(BaseAnifile, BaseFrame, x + Xoffset, y, 0, sq_RGBA(255, 255, 255, 250), Xr, 1.0);
|
|
else T_DrawDynamicAni(obj, BaseAnifile, x, y, ButtonName);
|
|
}
|
|
}
|
|
|
|
//设置自定义点击效果
|
|
function SetCustomClickEnble(bool, gButtonName, gX, gY, gAnifile, gFrame) {
|
|
CustomClickEnble = bool; //自定义点击效果
|
|
CustomClickAnifile = gAnifile; //自定义点击效果Ani路径
|
|
CustomButtonName = gButtonName; //自定义点击效果名称
|
|
CustomClickFrame = gFrame; //自定义点击效果Ani编号
|
|
CustomClickx = gX; //自定义点击效果X坐标
|
|
CustomClicky = gY; //自定义点击效果Y坐标
|
|
}
|
|
|
|
//设置悬停效果
|
|
function SetRectEnble(bool, gButtonName, gX, gY, gAnifile, gFrame) {
|
|
RectEnble = bool; //悬停效果
|
|
RectButtonName = gButtonName; //悬停名称
|
|
RectBaseAnifile = gAnifile; //悬停Ani路径
|
|
RectFrame = gFrame; //非动态按钮的悬停调用Ani编号
|
|
Rectx = gX; //悬停X坐标
|
|
Recty = gY; //悬停Y坐标
|
|
}
|
|
|
|
//设置动态按钮
|
|
function SetClickEnble(bool) {
|
|
ButtonDynamic = bool;
|
|
}
|
|
|
|
//设置点击效果
|
|
function SetClickEnble(bool) {
|
|
ClickEnble = bool;
|
|
}
|
|
|
|
//悬停状态
|
|
function isInRect() {
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 5, 5, x, y, width, length)) return true;
|
|
else return false;
|
|
}
|
|
//左键按下状态
|
|
function isLBDown() {
|
|
if (isInRect() && Mobj.Lb == 1) return true;
|
|
else return false;
|
|
}
|
|
//左键弹起状态
|
|
function isLBUp() {
|
|
if (isInRect() && Mobj.Lb == 0) return true;
|
|
else return false;
|
|
}
|
|
|
|
//左键单击状态
|
|
function isLBActive() {
|
|
if (isInRect() && Mobj.LbEvent) return true;
|
|
else return false;
|
|
}
|
|
}
|
|
|
|
class CollectBoxWindow extends BasicsDrawTool {
|
|
//宽度
|
|
Width = null;
|
|
//高度
|
|
Height = null;
|
|
//标题高度
|
|
TitleH = null;
|
|
|
|
//X坐标
|
|
X = null;
|
|
B_X = null;
|
|
//Y坐标
|
|
Y = null;
|
|
B_Y = null;
|
|
|
|
YMouseSw = true;
|
|
DeBugMode = false;
|
|
|
|
Mobj = null;
|
|
M_Xpos = null;
|
|
M_Ypos = null;
|
|
|
|
|
|
constructor(gX, gY, gWidth, gHeight, gTitleH) {
|
|
//宽度
|
|
Width = gWidth;
|
|
//高度
|
|
Height = gHeight;
|
|
//标题高度
|
|
TitleH = gTitleH;
|
|
|
|
//X坐标
|
|
X = gX;
|
|
//Y坐标
|
|
Y = gY;
|
|
|
|
if (getroottable().rawin("MouseObject")) Mobj = getroottable()["MouseObject"];
|
|
}
|
|
|
|
//设定鼠标逻辑
|
|
function LockMouse() {
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, Width, Height)) {
|
|
IMouse.LockMouseClick();
|
|
YMouseSw = false;
|
|
} else {
|
|
if (YMouseSw == false && sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, 0, 0, 800, 600)) {
|
|
IMouse.ReleaseMouseClick();
|
|
YMouseSw = true;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
//设定窗口拖动逻辑
|
|
function MoveWindow() {
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, Width, TitleH)) {
|
|
|
|
if (Mobj.Lb == 1) {
|
|
if (!M_Xpos) M_Xpos = IMouse.GetXPos(); //原始鼠标位置数据
|
|
if (!M_Ypos) M_Ypos = IMouse.GetYPos();
|
|
if (!B_X) B_X = X; //原始窗口位置
|
|
if (!B_Y) B_Y = Y;
|
|
|
|
X = B_X - (M_Xpos - IMouse.GetXPos());
|
|
Y = B_Y - (M_Ypos - IMouse.GetYPos());
|
|
|
|
} else if (Mobj.Lb == 0) {
|
|
M_Xpos = null;
|
|
M_Ypos = null;
|
|
B_X = null;
|
|
B_Y = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
function Show(obj) {
|
|
if (DeBugMode) sq_DrawBox(X, Y, Width, Height, 0xffffffff);
|
|
|
|
//设定鼠标逻辑
|
|
LockMouse();
|
|
|
|
//设定窗口拖动逻辑
|
|
MoveWindow();
|
|
|
|
}
|
|
}
|
|
|
|
class CollectBoxC extends BasicsDrawTool {
|
|
WindowObj = null; //窗口对象
|
|
Mobj = null; //鼠标对象
|
|
MainState = false; //主状态
|
|
X = 211;
|
|
Y = 106;
|
|
|
|
//收集箱类型组
|
|
CollectBoxTypeArr = null;
|
|
//收集箱类型展示滚动控件
|
|
Scobj = null;
|
|
//收集箱类型
|
|
PageSlot = 0;
|
|
|
|
|
|
//总配置信息
|
|
|
|
GlobaInfo = null;
|
|
|
|
//道具信息
|
|
ItemInfoArr = null;
|
|
//箱子信息
|
|
BoxInfoArr = null;
|
|
|
|
//玩家当前箱子信息
|
|
PlayerBoxInfo = null;
|
|
|
|
//当前绘制道具信息
|
|
NowDrawItemInfo = null;
|
|
NowDrawItemInfoObject = null;
|
|
//当前绘制收集箱属性信息
|
|
NowDrawBoxSw = false;
|
|
|
|
//当前滚轮值
|
|
NowWheel = 0;
|
|
MaxWheel = null;
|
|
|
|
//获取基础信息回调包
|
|
function GetBaseInfoCallBack(Chunk) {
|
|
// Sout("收到包内容: %L", Chunk);
|
|
local Jso = Json.Decode(Chunk);
|
|
|
|
|
|
local StrBuf1 = L_sq_GetStringDrawArray(Jso.Message.collecText, 300);
|
|
local StrBuf2 = L_sq_GetStringDrawArray(Jso.Message.collecText, 356);
|
|
local T = {
|
|
ballLst = Jso.Message.ballLst,
|
|
collecImgName = Jso.Message.collecImgName,
|
|
collecName = Jso.Message.collecName,
|
|
collecStatus = Jso.Message.collecStatus,
|
|
// collecTextS = StrBuf1[0] + "......",
|
|
// collecTextM = StrBuf2,
|
|
collecValue = Jso.Message.collecValue,
|
|
collecTitle = Jso.Message.collecTitle,
|
|
location = Jso.Message.location,
|
|
itemlocationoffset = Jso.Message.itemlocationoffset,
|
|
collecID = Jso.Message.collecID,
|
|
}
|
|
BoxInfoArr.append(T);
|
|
|
|
foreach(Value in Jso.Message.pvfFileLabels) {
|
|
if (Value.Name2.len() == 0)
|
|
Value.Name2 = "Yosin-Team";
|
|
if (Value.Explain.len() == 0)
|
|
Value.Explain = " " + Jso.Message.collecName + "收集箱,所需宝珠之一。";
|
|
ItemInfoArr.rawset(Value.Id, Value);
|
|
}
|
|
|
|
MaxWheel.rawset(Jso.Message.collecID, Jso.Message.maxDownPull);
|
|
}
|
|
|
|
//获取玩家收集箱信息
|
|
function GetPlayerBoxInfo(BoxId) {
|
|
local Pack = {
|
|
op = 40001001,
|
|
CollectionID = BoxId,
|
|
}
|
|
SendPack(Pack);
|
|
}
|
|
|
|
//获取玩家收集箱信息回调
|
|
function GetPlayerBoxInfoCallBack(Chunk) {
|
|
|
|
// Sout("收到包内容: %L", Chunk);
|
|
local Jso = Json.Decode(Chunk);
|
|
|
|
local StrBuf1 = L_sq_GetStringDrawArray(Jso.Message, 300);
|
|
local StrBuf2 = L_sq_GetStringDrawArray(Jso.Message, 356);
|
|
if (BoxInfoArr) {
|
|
BoxInfoArr[Jso.CollecID].collecTextS <- StrBuf1[0] + "......";
|
|
BoxInfoArr[Jso.CollecID].collecTextM <- StrBuf2;
|
|
}
|
|
|
|
PlayerBoxInfo = {};
|
|
foreach(Value in Jso.List) {
|
|
PlayerBoxInfo.rawset(Value, true);
|
|
}
|
|
|
|
local ab = {};
|
|
foreach(pos, value in Jso.attribute) {
|
|
ab.rawset(pos, value / 100);
|
|
}
|
|
|
|
if ("LenheartAttributesTable" in getroottable()) {
|
|
local T = getroottable()["LenheartAttributesTable"];
|
|
T.rawset("LenheartCollectBoxAb", ab);
|
|
} else {
|
|
local T = {};
|
|
T.rawset("LenheartCollectBoxAb", ab);
|
|
getroottable().rawset("LenheartAttributesTable", T);
|
|
}
|
|
}
|
|
|
|
MosaicItem = false;
|
|
|
|
function GetPlayerItemCountCallBack(Chunk) {
|
|
local Jso = Json.Decode(Chunk);
|
|
if (Jso.Slot != -1) {
|
|
if (!MosaicItem) {
|
|
MosaicItem = true;
|
|
|
|
} else {
|
|
MosaicItem = false;
|
|
local T = {
|
|
op = 40001003,
|
|
CollectionID = 1,
|
|
BallID = Jso.itemid,
|
|
CollectionID = Jso.Boxid,
|
|
}
|
|
SendPack(T);
|
|
local W = {
|
|
op = 2023100806,
|
|
itemid = Jso.itemid,
|
|
itemcount = 1,
|
|
}
|
|
SendPack(W);
|
|
}
|
|
}
|
|
}
|
|
|
|
//获取基础信息
|
|
function GetBaseInfo() {
|
|
local T = {
|
|
op = 40001005,
|
|
}
|
|
SendPack(T);
|
|
}
|
|
|
|
constructor() {
|
|
if (getroottable().rawin("MouseObject")) Mobj = getroottable()["MouseObject"];
|
|
|
|
Pack_Control.rawset(40001006, GetBaseInfoCallBack.bindenv(this));
|
|
|
|
Pack_Control.rawset(40001002, GetPlayerBoxInfoCallBack.bindenv(this));
|
|
|
|
Pack_Control.rawset(40001012, GetPlayerItemCountCallBack.bindenv(this));
|
|
|
|
GetBaseInfo();
|
|
|
|
GlobaInfo = {};
|
|
ItemInfoArr = {};
|
|
BoxInfoArr = [];
|
|
MaxWheel = {};
|
|
|
|
GetPlayerBoxInfo(0);
|
|
}
|
|
|
|
//绘制主界面
|
|
function DrawMain(obj) {
|
|
if (!Scobj) return;
|
|
//绘制背景框
|
|
L_sq_DrawImg("interface2/collectbox/collectboxbtn.img", 0, X, Y);
|
|
//绘制宝珠收集箱类型
|
|
L_sq_DrawImg(BoxInfoArr[PageSlot].collecImgName, 0, X + 7, Y + 26);
|
|
//绘制收集箱名称
|
|
L_sq_DrawCode(BoxInfoArr[PageSlot].collecTitle, X + 208 - LenheartTextClass.GetStringLength(BoxInfoArr[PageSlot].collecTitle) / 2, Y + 40, sq_RGBA(255, 177, 0, 250), 0, 1);
|
|
|
|
//绘制收集箱信息缩略
|
|
if ("collecTextS" in BoxInfoArr[PageSlot]) L_sq_DrawCode(BoxInfoArr[PageSlot].collecTextS, X + 228 - LenheartTextClass.GetStringLength(BoxInfoArr[PageSlot].collecTextS) / 2, Y + 40 + 20, sq_RGBA(255, 242, 0, 250), 0, 1);
|
|
//绘制详细信息书本
|
|
L_sq_DrawImg("interface/windowcommon.img", 262, X + 208 + 132, Y + 35);
|
|
NowDrawBoxSw = sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X + 208 + 132, Y + 35, 22, 22);
|
|
|
|
|
|
|
|
local Count = 4;
|
|
if (BoxInfoArr.len()< 4) Count = BoxInfoArr.len();
|
|
|
|
for (local i = 0; i< Count; i++) {
|
|
local FocusT = Scobj.FocusList[i];
|
|
local Pos = i;
|
|
local Vo = FocusT;
|
|
// foreach(Pos, Vo in Scobj.FocusList) {
|
|
//print(FocusT[Pos]);
|
|
local Btn = CollectBoxPro("CollectBoxButton" + FocusT[0], X + 8, Y + 95 + (i * 72), FocusT[0].collecImgName, 102, 70, 1);
|
|
Btn.SetRectEnble(true, "CollectBoxButtonr" + FocusT[0], X + 8, Y + 95 + (i * 72), FocusT[0].collecImgName, 2);
|
|
Btn.SetCustomClickEnble(true, "CollectBoxButtonc" + FocusT[0], X + 8, Y + 95 + (i * 72), FocusT[0].collecImgName, 3);
|
|
Btn.Show();
|
|
if (Btn.isLBActive()) {
|
|
PageSlot = FocusT[0].collecID;
|
|
GetPlayerBoxInfo(FocusT[0].collecID);
|
|
NowWheel = 0;
|
|
}
|
|
// }
|
|
}
|
|
|
|
local NowDrawItemSw = false;
|
|
foreach(Pos, Value in BoxInfoArr[PageSlot].ballLst) {
|
|
setClip(X + 110, Y + 96, X + 256 + 110, Y + 283 + 96); //开始裁切
|
|
//绘制宝珠槽
|
|
L_sq_DrawImg(BoxInfoArr[PageSlot].collecImgName, 5, X + BoxInfoArr[PageSlot].location[(Pos * 2)], Y + BoxInfoArr[PageSlot].location[((Pos * 2) + 1)] + NowWheel);
|
|
//绘制宝珠
|
|
L_Sq_DrawItem(X + BoxInfoArr[PageSlot].location[(Pos * 2)] + BoxInfoArr[PageSlot].itemlocationoffset[0], Y + BoxInfoArr[PageSlot].location[((Pos * 2) + 1)] + BoxInfoArr[PageSlot].itemlocationoffset[1] + NowWheel, Value, 1, 0, 0, 0);
|
|
|
|
if (PlayerBoxInfo && !PlayerBoxInfo.rawin(Value)) {
|
|
L_sq_DrawImg("interface/windowcommon.img", 157, X + BoxInfoArr[PageSlot].location[(Pos * 2)] + BoxInfoArr[PageSlot].itemlocationoffset[0], Y + BoxInfoArr[PageSlot].location[((Pos * 2) + 1)] + BoxInfoArr[PageSlot].itemlocationoffset[1] + NowWheel);
|
|
L_sq_DrawImg("interface/windowcommon.img", 157, X + BoxInfoArr[PageSlot].location[(Pos * 2)] + BoxInfoArr[PageSlot].itemlocationoffset[0], Y + BoxInfoArr[PageSlot].location[((Pos * 2) + 1)] + BoxInfoArr[PageSlot].itemlocationoffset[1] + NowWheel);
|
|
}
|
|
releaseClip(); //裁切结束
|
|
|
|
if (IMouse.GetXPos() >= X + 108 && IMouse.GetXPos() <= X + 108 + 254 && IMouse.GetYPos() >= Y + 90 && IMouse.GetYPos() <= Y + 90 + 285) {
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X + BoxInfoArr[PageSlot].location[(Pos * 2)] + BoxInfoArr[PageSlot].itemlocationoffset[0], Y + BoxInfoArr[PageSlot].location[((Pos * 2) + 1)] + BoxInfoArr[PageSlot].itemlocationoffset[1] + NowWheel, 24, 24)) {
|
|
// ItemDrawState = true;
|
|
NowDrawItemInfo = {};
|
|
NowDrawItemInfo.x <- (X + 32 + BoxInfoArr[PageSlot].location[(Pos * 2)]);
|
|
NowDrawItemInfo.y <- (Y + 18 + BoxInfoArr[PageSlot].location[((Pos * 2) + 1)] + NowWheel);
|
|
NowDrawItemInfo.itemid <- Value;
|
|
NowDrawItemSw = true;
|
|
if (!PlayerBoxInfo.rawin(Value)) {
|
|
if (getroottable()["MouseObject"].LbEvent) {
|
|
local T = {
|
|
op = 2023100802,
|
|
realop = 40001012,
|
|
itemid = Value
|
|
Boxid = PageSlot,
|
|
}
|
|
SendPack(T);
|
|
}
|
|
}
|
|
L_sq_WA(0x1b46898, 12);
|
|
} else {
|
|
|
|
// ItemDrawState = false;
|
|
}
|
|
}
|
|
}
|
|
if (!NowDrawItemSw) {
|
|
NowDrawItemInfo = null;
|
|
NowDrawItemInfoObject = null;
|
|
MosaicItem = false;
|
|
}
|
|
}
|
|
|
|
function DrawItemInfo(obj) {
|
|
if (NowDrawItemInfo) {
|
|
if (!NowDrawItemInfoObject) {
|
|
NowDrawItemInfoObject = ItemInfoClass(ItemInfoArr[NowDrawItemInfo.itemid]);
|
|
}
|
|
NowDrawItemInfoObject.Show(NowDrawItemInfo.x + 20 - (211 / 2), NowDrawItemInfo.y - NowDrawItemInfoObject.PageLength);
|
|
}
|
|
}
|
|
|
|
|
|
function DrawBoxAbInfo(obj) {
|
|
if (NowDrawBoxSw) {
|
|
L_sq_DrawWindow(X + 208 + 132 - 258, Y + 35, 258, BoxInfoArr[PageSlot].collecTextM.len() * 16, "interface2/popup/popup.img", 134, 6, 12, 6, 13);
|
|
foreach(Pos, Value in BoxInfoArr[PageSlot].collecTextM) {
|
|
L_sq_DrawCode(Value, X + 208 + 132 - 258 + 7, Y + 35 + (Pos * 16) + 7, sq_RGBA(255, 242, 0, 250), 0, 1);
|
|
}
|
|
}
|
|
if (MosaicItem) {
|
|
L_sq_DrawWindow(IMouse.GetXPos() + 20, IMouse.GetYPos() + 20, 219, 16, "interface2/popup/popup.img", 134, 6, 12, 6, 13);
|
|
|
|
L_sq_DrawCode("注意:镶嵌不可恢复,确认镶嵌请再次点击。", IMouse.GetXPos() + 20 + 7, IMouse.GetYPos() + 20 + 7, sq_RGBA(255, 242, 0, 250), 0, 1);
|
|
}
|
|
}
|
|
|
|
//开启界面回调
|
|
function OpenClassCallBack() {
|
|
|
|
L_NewWindows("Lenheart", 170, 0x65535);
|
|
local W = sq_GetPopupWindowMainCotrol(170);
|
|
W.SetVisible(false);
|
|
W.SetEnable(false);
|
|
|
|
|
|
if (BoxInfoArr.len() > 0) {
|
|
if (BoxInfoArr.len()< 4) Scobj = ScrollControl(BoxInfoArr, 1, BoxInfoArr.len());
|
|
else Scobj = ScrollControl(BoxInfoArr, 1, 4);
|
|
}
|
|
|
|
}
|
|
|
|
//绘制入口
|
|
function Draw(obj) {
|
|
if (MainState) {
|
|
if (WindowObj) {
|
|
|
|
WindowObj.Show(obj);
|
|
X = WindowObj.X;
|
|
Y = WindowObj.Y;
|
|
|
|
DrawMain(obj);
|
|
DrawItemInfo(obj);
|
|
DrawBoxAbInfo(obj);
|
|
} else {
|
|
WindowObj = LenheartWindow(X, Y, 378, 387, 28); //坐标 大小 标题栏高度
|
|
// WindowObj.DeBugMode = true;
|
|
}
|
|
} else {
|
|
if (WindowObj && WindowObj.YMouseSw == false) {
|
|
IMouse.ReleaseMouseClick();
|
|
WindowObj.YMouseSw = true;
|
|
WindowObj = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
//逻辑入口
|
|
function Proc(obj) {
|
|
if (MainState) {
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y + 90, 105, 285)) {
|
|
if (IMouse.IsWheelUp()) {
|
|
Scobj.M();
|
|
}
|
|
if (IMouse.IsWheelDown()) {
|
|
Scobj.A();
|
|
}
|
|
}
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X + 108, Y + 90, 254, 285)) {
|
|
if (IMouse.IsWheelUp()) {
|
|
if (NowWheel<(0)) NowWheel += 15;
|
|
}
|
|
if (IMouse.IsWheelDown()) {
|
|
if (NowWheel > (MaxWheel[PageSlot])) NowWheel -= 15;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
if (KeyPressNB.isKeyPress(48, "CollectBoxCloseKey")) {
|
|
MainState = false;
|
|
MosaicItem = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
function CollectBox(obj) {
|
|
local RootTab = getroottable();
|
|
if (!RootTab.rawin("CollectBoxCObj")) {
|
|
local Cobj = CollectBoxC();
|
|
RootTab.rawset("CollectBoxCObj", Cobj);
|
|
EventIcon("宝珠收集箱", 119, 119, Cobj);
|
|
} else {
|
|
RootTab["CollectBoxCObj"].Proc(obj);
|
|
RootTab["CollectBoxCObj"].Draw(obj);
|
|
}
|
|
}
|
|
|
|
|
|
if (getroottable().rawin("LenheartFuncTab")) {
|
|
getroottable()["LenheartFuncTab"].rawset("CollectBoxFunc", CollectBox);
|
|
} else {
|
|
local T = {};
|
|
T.rawset("CollectBoxFunc", CollectBox);
|
|
getroottable().rawset("LenheartFuncTab", T);
|
|
} |