123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- ---@class KLTurnTableGetAwardItem:UIKmlLuaPanelBase
- ---@field view KLTurnTableGetAwardItemView
- local KLTurnTableGetAwardItem = class(UIKmlLuaPanelBase)
- local this =KLTurnTableGetAwardItem
- ---创建时调用一次
- function this:Init()
- self.ItemList = nil
- end
- ---注册UI事件和服务器消息
- function this:RegistEvents()
- GUI:AddOnClickEvent(self.view.GetButton, self, self.GetButtonOnclick)
- end
- function this:GetButtonOnclick()
- if self.state and self.state == 2 then-- 可领取
- SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_RECEIVE_TURNTABLE_RAFFLE_REWARD,{turntableExtId = self.data.id,id = self.groupId})
- end
- end
- ---界面显示时调用一次
- function this:Show()
- end
- ---创建或者刷新界面数据时调用
- function this:Refresh()
- end
- function this:UpDataUI(data,index,totalCount,received,groupId)
- self.groupId = groupId
- self.index = index
- self.data = data
- self.state =0
- self.careerId = SL:GetMetaValue(EMetaVarGetKey.JOB)
- if self.data then
- for i, v in pairs(self.data.reward) do
- if v[1] == self.careerId then
- self:ShowCoustIcon(v)
- end
- end
- end
- if self.data.num > totalCount then
- self.state = 1
- else
- self.state = 2
- if next(received) then
- for _,v in pairs(received) do
- if tonumber(v) == self.data.id then
- self.state = 3
- end
- end
- end
- end
- if self.state == 1 then---未达到条件
- GUI:SetActive(self.view.GetButton,false)
- GUI:SetActive(self.view.RedDot,false)
- GUI:SetActive(self.view.HaveGet,false)
- GUI:SetActive(self.view.CountText,true)
- GUI:Text_setString(self.view.CountText,"累计".. self.data.num.."抽可领取")
- elseif self.state == 2 then-- 可领取
- GUI:SetActive(self.view.GetButton,true)
- GUI:SetActive(self.view.RedDot,true)
- GUI:SetActive(self.view.HaveGet,false)
- GUI:SetActive(self.view.CountText,false)
- GUI:Image_loadTexture(self.view.GetButton,"btn_common1","Atlas/Common.spriteatlas")
- GUI:Text_setString(self.view.GetButton,"领取")
- elseif self.state == 3 then--- 已领取
- GUI:SetActive(self.view.GetButton,true)
- GUI:SetActive(self.view.RedDot,false)
- GUI:SetActive(self.view.HaveGet,true)
- GUI:SetActive(self.view.CountText,false)
- GUI:Image_loadTexture(self.view.GetButton,"btn_common8","Atlas/Common.spriteatlas")
- GUI:Text_setString(self.view.GetButton,"已领取")
- end
- end
- ---@param v table @例:{1,800502016,1}
- function this:ShowCoustIcon(v)
- local data = {
- itemid = v[2],
- mfixsize = "80,80",
- tips = "1",
- width = "80",
- height = "80",
- bgtype = "0"
- }
- if self.ItemList then
- GUI:Item_UpdataData(self.ItemList, data)
- else
- self.ItemList = GUI:Item_Create(self.view.Icon, data)
- end
- GUI:AddOnClickEvent(self.ItemList, self, function()
- SL:OpenTips(nil, data.itemid)
- end)
- end
- function this:Hide()
- end
- function this:Close()
- end
- return this
|