123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- ---@class KLFundRewardItemItem:UIKmlLuaPanelBase
- ---@field view KLFundRewardItemItemView
- local KLFundRewardItemItem = class(UIKmlLuaPanelBase)
- local this =KLFundRewardItemItem
- ---创建时调用一次
- function this:Init()
- GUI:OSAScrollView_Initialized(self.view.osa_reward_list,nil,self.RewardItemUpdateFun,self)
- end
- ---@param item UIKmlLuaControl
- function this:RewardItemUpdateFun(item,index)
- local reward = self.rewardList[index+1]
- local id = reward[1]
- local count = reward[2]
- GUI:Item_setItemId(item,tostring(id))
- GUI:Item_setItemCount(item,tostring(count))
-
- local btnTip = GUI:GetChildById(item,"btn_tip")
- GUI:AddOnClickEvent(btnTip,self,self.OnClickBtnTip,id)
- end
- function this:OnClickBtnTip(_,id)
- SL:OpenTips("",id)
- end
- ---注册UI事件和服务器消息
- function this:RegistEvents()
- GUI:AddOnClickEvent(self.view.btn_get,self,self.OnClickBtnGet)
- end
- function this:OnClickBtnGet()
- local getReward = {}
- getReward.type = 10
- getReward.action="reward"
- getReward.id=self.data.id
- SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_RECHARGE_ACTION,getReward)
- end
- ---界面显示时调用一次
- function this:Show()
- end
- ---创建或者刷新界面数据时调用
- function this:Refresh()
- end
- function this:Close()
- end
- ---@param data cfg_InvestmentFunds_column
- function this:SetData(data)
- self.data = data
-
- self.rewardList = data.Rewards
- local info = InfoManager.dailyAddRechargeInfo.investFundInfo
- local buyDay = info.buyDay
- local haveBought = buyDay > 0
- local canGet = buyDay >= data.day
- local haveGot = table.contains(info.rewards,data.id)
- GUI:setVisible(self.view.text_wait,not haveBought or not canGet)
- if not haveBought then
- GUI:Text_setString(self.view.text_wait,"未购买")
- elseif not canGet then
- GUI:Text_setString(self.view.text_wait,"未到期")
- end
- GUI:setVisible(self.view.img_got,haveGot)
- GUI:setVisible(self.view.btn_get,not haveGot and canGet)
-
- GUI:OSAScrollView_RefreshList(self.view.osa_reward_list,#self.rewardList)
-
- GUI:Text_setString(self.view.text_day,"d" .. data.day .. "t")
- end
- return this
|