---@class KLStrengthenItem:UIKmlLuaPanelBase ---@field view KLStrengthenItemView local KLStrengthenItem = class(UIKmlLuaPanelBase) local this =KLStrengthenItem ---创建时调用一次 function this:Init() end ---创建或者刷新界面数据时调用 function this:Refresh() end function this:UpdateUI(data,ranking_id) self.data = data self.ranking_id = ranking_id local fist_state,second_state,third_state = InfoManager.openServerInfo:GetRankNameBytaskType(data.strengtLv,2) local fist_name,second_name,third_name = InfoManager.openServerInfo:GetRankNameBytaskType(data.strengtLv,1) self.first_state = fist_state ---0 正常 1 可领取 2 已领取 self.second_state = second_state self.third_state = third_state GUI:Text_setString(self.view.text75, "+"..data.strengtLv) GUI:Text_setString(self.view.text76, fist_name) GUI:Text_setString(self.view.text77, second_name) GUI:Text_setString(self.view.text78, third_name) self:SetEquipItemIcon(self.view.fist_item,true,data.first_item) self:SetEquipItemIcon(self.view.second_item,true,data.second_item) self:SetEquipItemIcon(self.view.third_item,true,data.third_item) ---已领取状态 GUI:setVisible(self.view.ReciveImg1_,fist_state == 2) GUI:setVisible(self.view.ReciveImg2_,second_state == 2) GUI:setVisible(self.view.ReciveImg3_,third_state == 2) ---可领取状态 GUI:setVisible(self.view.HighlightImg1_,fist_state == 1) GUI:setVisible(self.view.HighlightImg2_,second_state == 1) GUI:setVisible(self.view.HighlightImg3_,third_state == 1) end ---单个奖励道具 function this:SetEquipItemIcon(viewItem,show,item) GUI:setVisible(viewItem,show) if show then local count = ""..SL:GetSimpleNumber(tonumber(item[2]),0).."" GUI:Item_setItemId(viewItem,item[1]) GUI:Item_UpdataData(viewItem,{itemcustomcount = count}) end end ---注册UI事件和服务器消息 function this:RegistEvents() GUI:AddOnClickEvent(self.view.fist_item,self,self.First_itemClick) GUI:AddOnClickEvent(self.view.second_item,self,self.Second_itemClick) GUI:AddOnClickEvent(self.view.third_item,self,self.Third_itemClick) end function this:First_itemClick() if self.first_state < 2 then local iscanget = self.first_state == 1 if iscanget then ---可领取奖励,不用弹提示 SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_OPEN_SERVER_ACT_RANK_REWARD,{goalValue = self.data.strengtLv,rankType = self.ranking_id }) else SL:OpenTips(nil,self.data.first_item[1]) end end end function this:Second_itemClick() if self.second_state < 2 then local iscanget = self.second_state == 1 if iscanget then ---可领取奖励,不用弹提示 SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_OPEN_SERVER_ACT_RANK_REWARD,{goalValue = self.data.strengtLv,rankType = self.ranking_id }) else SL:OpenTips(nil,self.data.second_item[1]) end end end function this:Third_itemClick() if self.third_state < 2 then local iscanget = self.third_state == 1 if iscanget then ---可领取奖励,不用弹提示 SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_OPEN_SERVER_ACT_RANK_REWARD,{goalValue = self.data.strengtLv,rankType = self.ranking_id }) else SL:OpenTips(nil,self.data.third_item[1]) end end end function this:Close() end return this