11
This commit is contained in:
@@ -11,6 +11,7 @@ class LenheartNewUI_CollectionBox_BaseButton extends LenheartNewUI_CommonUi {
|
||||
Path = null;
|
||||
Idx = null;
|
||||
SetFlag = null;
|
||||
SetIndex = null;
|
||||
|
||||
|
||||
constructor(X, Y, W, H, Path, Idx) {
|
||||
@@ -65,7 +66,7 @@ class CollectionBoxC extends LenheartNewUI_Windows {
|
||||
// NoWindow = true;
|
||||
|
||||
//是否可见
|
||||
// Visible = false;
|
||||
Visible = false;
|
||||
|
||||
//盒子按钮集合
|
||||
BoxButton = null;
|
||||
@@ -76,16 +77,45 @@ class CollectionBoxC extends LenheartNewUI_Windows {
|
||||
//当前页面
|
||||
Page = null;
|
||||
|
||||
//
|
||||
//滚轮偏移
|
||||
ScrollPos = 0;
|
||||
|
||||
//页面滚轮偏移
|
||||
PageScrollPos = 0;
|
||||
|
||||
//悬停的宝珠
|
||||
HoverItem = null;
|
||||
|
||||
//镶嵌成功音效包
|
||||
function AudioCallBack(Chunk) {
|
||||
local Jso = Json.Decode(Chunk);
|
||||
local Type = Jso.Type;
|
||||
local obj = sq_getMyCharacter();
|
||||
|
||||
switch (Type) {
|
||||
case 1:
|
||||
obj.sq_PlaySound("TRADE_OK");
|
||||
break;
|
||||
case 2:
|
||||
obj.sq_PlaySound("ICON_DROP_TO_QUICKSLOT");
|
||||
break;
|
||||
case 3:
|
||||
obj.sq_PlaySound("GAMBLE_RESULT_GOOD");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//基础配置包
|
||||
function GetInfoCallBack(Chunk) {
|
||||
Info = Json.Decode(Chunk).info;
|
||||
local Jso = Json.Decode(Chunk);
|
||||
local ZlibStrBuf = Json.Decode(L_sq_Dezlib(Jso.ZipS));
|
||||
Info = ZlibStrBuf.info;
|
||||
foreach(Key, Aobj in Info) {
|
||||
if (!Page) Page = Key;
|
||||
local StrBuf1 = L_sq_GetStringDrawArray(Aobj.attribute.Atts, 300);
|
||||
Aobj.attribute.AttsS <- StrBuf1[0] + "...";
|
||||
Aobj.attribute.Atts <- StrBuf1;
|
||||
local StrBuf1 = L_sq_GetStringDrawArray(Aobj.attS, 300);
|
||||
Aobj.AttsS <- StrBuf1[0] + "...";
|
||||
Aobj.attS <- StrBuf1;
|
||||
}
|
||||
|
||||
InitBoxButton();
|
||||
@@ -98,11 +128,6 @@ class CollectionBoxC extends LenheartNewUI_Windows {
|
||||
};
|
||||
SendPackEx(T);
|
||||
}
|
||||
//收集箱收集信息
|
||||
function GetCollectInfoCallBack(Chunk) {
|
||||
|
||||
// Info = Json.Decode(Chunk).info;
|
||||
}
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
Childrens = [];
|
||||
@@ -113,9 +138,10 @@ class CollectionBoxC extends LenheartNewUI_Windows {
|
||||
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
|
||||
Pack_Control.rawset(20077028, GetInfoCallBack.bindenv(this));
|
||||
Pack_Control.rawset(20077010, AudioCallBack.bindenv(this));
|
||||
|
||||
Pack_Control.rawset(20077004, GetCollectInfoCallBack.bindenv(this));
|
||||
GetCollectInfo();
|
||||
|
||||
}
|
||||
|
||||
//初始化按钮
|
||||
@@ -135,12 +161,15 @@ class CollectionBoxC extends LenheartNewUI_Windows {
|
||||
//关闭按钮
|
||||
local ButtonBuf = LenheartNewUI_CollectionBox_BaseButton(8, 95 + (RealPos * 72), 102, 70, InfoObj.img, 1);
|
||||
ButtonBuf.SetFlag = Pos;
|
||||
ButtonBuf.SetIndex = RealPos;
|
||||
ButtonBuf.OnClick = function(ButtonObj) {
|
||||
Page = ButtonObj.SetFlag;
|
||||
}.bindenv(this);
|
||||
ButtonBuf.SetCallBackFunc(function(ButtonObj) {
|
||||
|
||||
});
|
||||
ButtonObj.Localtion_Y = 95 + ((ButtonObj.SetIndex - ScrollPos) * 72);
|
||||
if (ButtonObj.Localtion_Y< 95 || ButtonObj.Localtion_Y > 311) ButtonObj.Localtion_X = -9000;
|
||||
else ButtonObj.Localtion_X = 8;
|
||||
}.bindenv(this));
|
||||
Childrens.append(ButtonBuf);
|
||||
RealPos++;
|
||||
}
|
||||
@@ -164,17 +193,43 @@ class CollectionBoxC extends LenheartNewUI_Windows {
|
||||
L_sq_DrawImg("interface2/collectbox/collectboxbtn.img", 0, X, Y);
|
||||
//背景
|
||||
L_sq_DrawImg(Info[Page].img, 0, X + 7, Y + 26);
|
||||
//绘制窗口名称
|
||||
L_sq_DrawCode("我的收集箱", X + 160, Y + 8, sq_RGBA(255, 177, 0, 250), 0, 1);
|
||||
//绘制收集箱名称
|
||||
L_sq_DrawCode(Info[Page].name, X + 208 - LenheartTextClass.GetStringLength(Info[Page].name) / 2, Y + 40, sq_RGBA(255, 177, 0, 250), 0, 1);
|
||||
//绘制收集箱信息缩略
|
||||
L_sq_DrawCode(Info[Page].attribute.AttsS, X + 228 - LenheartTextClass.GetStringLength(Info[Page].attribute.AttsS) / 2, Y + 40 + 20, sq_RGBA(255, 242, 0, 250), 0, 1);
|
||||
L_sq_DrawCode(Info[Page].AttsS, X + 228 - LenheartTextClass.GetStringLength(Info[Page].AttsS) / 2, Y + 40 + 20, sq_RGBA(255, 242, 0, 250), 0, 1);
|
||||
|
||||
|
||||
HoverItem = null;
|
||||
setClip(X + 95, Y + 95, X + 348, Y + 375); //开始裁切
|
||||
//绘制宝珠
|
||||
foreach(pos, value in Info[Page].itemIds) {
|
||||
//绘制格子
|
||||
L_sq_DrawImg(Info[Page].img, 5, X + value.x, Y + value.y + PageScrollPos);
|
||||
//绘制宝珠
|
||||
DrawItemEx(X + value.x + Info[Page].Xp, Y + value.y + Info[Page].Yp + PageScrollPos, value.id, 1);
|
||||
//判断是否拥有
|
||||
if (!value.isTure) {
|
||||
//遮挡
|
||||
L_sq_DrawImg("interface/windowcommon.img", 157, X + value.x + Info[Page].Xp, Y + value.y + Info[Page].Yp + PageScrollPos);
|
||||
L_sq_DrawImg("interface/windowcommon.img", 157, X + value.x + Info[Page].Xp, Y + value.y + Info[Page].Yp + PageScrollPos);
|
||||
L_sq_DrawImg("interface/windowcommon.img", 157, X + value.x + Info[Page].Xp, Y + value.y + Info[Page].Yp + PageScrollPos);
|
||||
}
|
||||
|
||||
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X + value.x + Info[Page].Xp, Y + value.y + Info[Page].Yp + PageScrollPos, 29, 29)) {
|
||||
HoverItem = value;
|
||||
}
|
||||
}
|
||||
releaseClip(); //裁切结束
|
||||
}
|
||||
|
||||
|
||||
function TopShow(obj) {
|
||||
if (!Info) return;
|
||||
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X + 86, Y + 53, 272, 15)) {
|
||||
local StrArr = Info[Page].attribute.Atts;
|
||||
local Str = Info[Page].attribute.AttsS;
|
||||
local StrArr = Info[Page].attS;
|
||||
local Str = Info[Page].AttsS;
|
||||
L_sq_DrawWindow(IMouse.GetXPos() - 140 + LenheartTextClass.GetStringLength(Str) / 2, IMouse.GetYPos() - 36, 0 + LenheartTextClass.GetStringLength(Str), 0 + (14 * StrArr.len()), "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13);
|
||||
|
||||
local Xpos = LenheartTextClass.GetStringLength(Str) / 2;
|
||||
@@ -184,6 +239,23 @@ class CollectionBoxC extends LenheartNewUI_Windows {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//override
|
||||
function DrawItemInfo() {
|
||||
if (MousePosFlag != 2) return;
|
||||
if (ItemInfoDrawS) {
|
||||
if (!ItemObject) {
|
||||
local ItemId = ItemInfoDrawS.ItemId;
|
||||
if (Rindro_ItemInfoObject.rawin(ItemId)) {
|
||||
ItemObject = ItemInfoClass(Rindro_ItemInfoObject[ItemId]);
|
||||
}
|
||||
}
|
||||
ItemObject.Show(ItemInfoDrawS.X, ItemInfoDrawS.Y - ItemObject.PageLength);
|
||||
} else {
|
||||
ItemObject = null;
|
||||
}
|
||||
}
|
||||
|
||||
function Show(obj) {
|
||||
DrawMain(obj);
|
||||
LenheartNewUI_Windows.Show(obj);
|
||||
@@ -192,6 +264,83 @@ class CollectionBoxC extends LenheartNewUI_Windows {
|
||||
//逻辑入口
|
||||
function Proc(obj) {
|
||||
LenheartNewUI_Windows.SyncPos(X, Y);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//鼠标位置Flag
|
||||
MousePosFlag = 0;
|
||||
|
||||
//override
|
||||
function OnMouseProc(Flag, MousePos_X, MousePos_Y) {
|
||||
//调用原生方法
|
||||
LenheartNewUI_Windows.OnMouseProc(Flag, MousePos_X, MousePos_Y);
|
||||
|
||||
MousePos_X -= X;
|
||||
MousePos_Y -= Y;
|
||||
//鼠标在栏目窗口内
|
||||
if (MousePos_X >= 8 && MousePos_Y >= 95 && MousePos_X <= 110 && MousePos_Y <= 375) {
|
||||
MousePosFlag = 1;
|
||||
}
|
||||
//鼠标在宝珠窗口内
|
||||
else if (MousePos_X > 95 && MousePos_Y >= 95 && MousePos_X <= 348 && MousePos_Y <= 375) {
|
||||
MousePosFlag = 2;
|
||||
} else MousePosFlag = 0;
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标滚轮事件回调
|
||||
function OnMouseWheel(Flag, MousePos_X, MousePos_Y) {
|
||||
MousePos_X -= X;
|
||||
MousePos_Y -= Y;
|
||||
|
||||
//左侧栏目的滚动逻辑
|
||||
if (MousePosFlag == 1) {
|
||||
if (Flag) {
|
||||
if (ScrollPos > 0) ScrollPos -= 1;
|
||||
}
|
||||
if (!Flag) {
|
||||
if (ScrollPos<(Info.len() - 4)) ScrollPos += 1;
|
||||
}
|
||||
}
|
||||
//左侧栏目的滚动逻辑
|
||||
if (MousePosFlag == 2) {
|
||||
if (Flag) {
|
||||
if (PageScrollPos< 0) PageScrollPos += 47;
|
||||
}
|
||||
if (!Flag) {
|
||||
if (PageScrollPos > (0 - Info[Page].gl)) PageScrollPos -= 47;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//调用原生方法
|
||||
LenheartNewUI_Windows.OnMouseWheel(Flag, MousePos_X, MousePos_Y);
|
||||
}
|
||||
|
||||
|
||||
//override
|
||||
//鼠标左键弹起回调
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||
//调用原生方法
|
||||
LenheartNewUI_Windows.OnMouseLbUp(MousePos_X, MousePos_Y);
|
||||
|
||||
if (HoverItem) {
|
||||
local RealOp = 20077005;
|
||||
if (HoverItem.isTure) RealOp = 20077009;
|
||||
local T = {
|
||||
op = RealOp,
|
||||
boxId = Info[Page].id,
|
||||
itemId = HoverItem.id
|
||||
}
|
||||
SendPackEx(T);
|
||||
}
|
||||
}
|
||||
|
||||
function OpenCallBack() {
|
||||
GetCollectInfo();
|
||||
this.Visible = true;
|
||||
ResetFocus();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -201,7 +350,9 @@ function Lenheart_CollectionBox_Fun(obj) {
|
||||
local RootTab = getroottable();
|
||||
if (!RootTab.rawin("CollectionBox_Obj")) {
|
||||
RootTab.rawset("CollectionBox_Obj", true);
|
||||
LenheartNewUI_CreateWindow(CollectionBoxC, "收集箱", ((getroottable().Rindro_Scr_Width - 376) / 2).tointeger(), 64, 376, 384, 28);
|
||||
local Winobj = LenheartNewUI_CreateWindow(CollectionBoxC, "收集箱窗口", ((getroottable().Rindro_Scr_Width - 376) / 2).tointeger(), 64, 376, 384, 28);
|
||||
|
||||
EventList_Obj.AddEvent("收集箱", 73, Winobj, "interface2/hud/information_button/information_button_cn.img");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user