1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- ---@class KLOpenServiceWingTaskItem:UIKmlLuaPanelBase
- ---@field view KLOpenServiceWingTaskItemView
- local KLOpenServiceWingTaskItem = class(UIKmlLuaPanelBase)
- local this = KLOpenServiceWingTaskItem
- ---创建时调用一次
- function this:Init()
- end
- ---注册UI事件和服务器消息
- function this:RegistEvents()
- GUI:AddOnClickEvent(self.view.GoBT,self,self.GoBTOnClick)
- end
- function this:GoBTOnClick()
- if self.taskInfo.state == E_ChapterState.ACCPT then
- local inst = SL:GetConfig('cfg_task_target', self.taskInfo.target_id).instruction
- self:ClosePanel()
- SL:ShortcutDO(inst[1])
- elseif self.taskInfo.state == E_ChapterState.FINISH then
- SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_SUBMIT_WINGS_TASK,self.taskInfo.task_id)
- end
- end
- function this:ClosePanel()
- GUI:UIPanel_Close("dev/outui/MainActivity/Panel/KLMainActivity/KLMainActivityPanel")
- end
- ---界面显示时调用一次
- function this:Show()
- end
- ---创建或者刷新界面数据时调用
- function this:Refresh()
- end
- function this:RefreshItem(data)
- self.taskInfo = data
- local cfg = SL:GetConfig("cfg_wingstask", data.task_id)
- GUI:Item_setItemId(self.view.ItemPoint, cfg.rewardItem[1])
- GUI:Item_setItemCount(self.view.ItemPoint, cfg.rewardItem[2])
- GUI:AddOnClickEvent(self.view.ItemPoint, self, function()
- SL:OpenTips(nil, cfg.rewardItem[1])
- end)
- GUI:Text_setString(self.view.TaskDes, cfg.text)
- GUI:setVisible(self.view.GoBT, data.state ~= E_ChapterState.REWARD)
- GUI:setVisible(self.view.IsGet, data.state == E_ChapterState.REWARD)
- if data.goal_count < data.max_count then
- GUI:Text_setString(self.view.CountText, string.format('<color="#9b1818">%d</color>/%d', data.goal_count, data.max_count))
- else
- GUI:Text_setString(self.view.CountText, string.format('<color="#2a8430">%d</color>/%d', data.goal_count, data.max_count))
- end
- if data.state == 1 then
- GUI:Text_setString(self.view.GoBT, "前往")
- elseif data.state == 2 then
- GUI:Text_setString(self.view.GoBT, "领取")
- end
- end
- function this:Close()
- end
- return this
|