/* 文件名:FightSign.nut 路径:Project/FightSign/FightSign.nut 创建日期:2024-08-11 09:46 文件用途:刷图签到 */ class FightSignC extends LenheartNewUI_Windows { //调试模式 // DeBugMode = true; //不是窗口 // NoWindow = true; //是否可见 Visible = false; //普通奖励 CommonReward = null; //累计奖励 ExReward = null; //信息 Info = null; //获取信息回调 function GetConfigCallBack(Chunk) { local Jso = Json.Decode(Chunk); CommonReward = Jso.re1; ExReward = Jso.re2; } //获取配置回调 function GetMyInfoCallBack(Chunk) { local Jso = Json.Decode(Chunk); Info = Jso.info; } //获取信息 function GetInfo() { local T = { op = 20066001 } SendPackEx(T); } constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { Childrens = []; //注册控件 RegisterWidget(); LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); Pack_Control.rawset(20066002, GetMyInfoCallBack.bindenv(this)); Pack_Control.rawset(20066004, GetConfigCallBack.bindenv(this)); GetInfo(); } function RegisterWidget() { //关闭按钮 local CloseButton = LenheartNewUI_BaseButton(580, 2, 11, 12, "interface/lenheartwindowcommon.img", 276); CloseButton.OnClick = function() { this.Visible = false; }.bindenv(this); Childrens.append(CloseButton); //领取奖励按钮 local ReceiveButton = LenheartNewUI_BaseButton(426, 422, 140, 40, "interface2/event/chn_daily_attendance/main.img", 5); ReceiveButton.OnClick = function() { local T = { op = 20066003 } SendPackEx(T); }.bindenv(this); ReceiveButton.SetCallBackFunc(function(Window) { if (!Info) return; if (Info.NowClearanceCount >= 2 && Info.TodayState == 0) { Window.State = 0; } else { Window.State = 8; } }.bindenv(this)) Childrens.append(ReceiveButton); } //绘制主界面 function DrawMain(obj) { if (!CommonReward || !ExReward) return; //绘制窗口底 L_sq_DrawWindow(X + 2, Y + 6, 580, 440, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); L_sq_DrawWindow(X + 16, Y + 20, 570, 462, "interface/windowcommon.img", 204, 4, 14, 4, 14); //绘制标题栏 L_sq_DrawImg("onlineevent/main.img", 0, X - 1, Y); //绘制地图背景 L_sq_DrawImg("interface2/event/chn_daily_attendance/main.img", 0, X + 24, Y + 28); //绘制通关次数 L_sq_DrawImg("interface2/event/chn_daily_attendance/main.img", 2 + Info.NowClearanceCount, X + 188, Y + 129); L_sq_DrawImg("interface2/event/chn_daily_attendance/main.img", 4, X + 220, Y + 129); //普通签到 foreach(Pos, ItemObj in CommonReward) { // if (OnlineTime <= ItemObj.time) NextRewardTime = ItemObj.time; //绘制物品 DrawItemBase(X + 42 + ((Pos % 7) * 55) + 4, Y + 182 + ((Pos / 7) * 65), ItemObj.itemid, ItemObj.itemnum); if (Pos< Info.RewardDayCount) L_sq_DrawImg("interface2/event/chn_daily_attendance/main.img", 1, X + 33 + ((Pos % 7) * 55) + 4, Y + 175 + ((Pos / 7) * 65)); } //累计签到 foreach(Pos, ItemObj in ExReward) { DrawItemBase(X + 481, Y + 194 + (Pos * 72), ItemObj.itemid, ItemObj.itemnum); //绘制已在线时间 L_sq_DrawCode(ItemObj.Day.tostring(), X + 512 - LenheartTextClass.GetStringLength(ItemObj.Day.tostring()) / 2, Y + 171 + (Pos * 72), sq_RGBA(255, 177, 0, 250), 1, 1); } } function Show(obj) { DrawMain(obj); LenheartNewUI_Windows.Show(obj); } //逻辑入口 function Proc(obj) { LenheartNewUI_Windows.SyncPos(X, Y); } function OpenCallBack() { Visible = true; ResetFocus(); GetInfo(); } } getroottable().rawdelete("FightSign_Obj"); function Lenheart_FightSign_Fun(obj) { local RootTab = getroottable(); if (!RootTab.rawin("FightSign_Obj")) { RootTab.rawset("FightSign_Obj", true); local Win = LenheartNewUI_CreateWindow(FightSignC, "每日签到窗口", ((getroottable().Rindro_Scr_Width - 600) / 2).tointeger(), 40, 600, 494, 20); EventList_Obj.AddEvent("每日签到", 91, Win); } } getroottable()["LenheartFuncTab"].rawset("FightSignFuncN", Lenheart_FightSign_Fun);