---@class KLBossKillItem:UIKmlLuaPanelBase ---@field view KLBossKillItemView local KLBossKillItem = class(UIKmlLuaPanelBase) local this =KLBossKillItem ---创建时调用一次 function this:Init() self.DecomposeGetItem = {} end ---创建或者刷新界面数据时调用 function this:Refresh() end function this:UpdateUI(data) self.data= data ---奖励领取状态:0 正常 1 可领取 2 已领取 self.state = InfoManager.openServerInfo:GetNomStateByBossInfo(data.boss_group,data.boss_id) local hurt_state,kill_state = InfoManager.openServerInfo:GetSerStateOrNameByBossInfo(data.boss_group,data.boss_id) local hurt_name,kill_name = InfoManager.openServerInfo:GetSerStateOrNameByBossInfo(data.boss_group,data.boss_id,2) local personal_count = InfoManager.openServerInfo:GetSerStateOrNameByBossInfo(data.boss_group,data.boss_id,3) local left_count = data.cond_count - personal_count if self.state == 1 then left_count = left_count + 1 end local noget = left_count <= 0 and self.state == 0 --不可领取 self.hurt_state = hurt_state self.kill_state = kill_state GUI:Text_setString(self.view.text666, "剩余:"..left_count) ---剩余次数 GUI:Text_setString(self.view.text21, data.boss_name) ---boss 名称 GUI:Text_setString(self.view.text22, hurt_name) ---伤害第一玩家name GUI:Text_setString(self.view.text23, kill_name) ---致命第一玩家name ---伤害第一奖励 self:SetEquipItemIcon(self.view.RewardHurtItem,true,data.hurt_item) GUI:setVisible(self.view.RewardImg1,hurt_state==2) GUI:setVisible(self.view.img4,hurt_state==1) ---致命第一奖励 self:SetEquipItemIcon(self.view.RewardKillItem,true,data.kill_item) GUI:setVisible(self.view.RewardImg2,kill_state == 2) GUI:setVisible(self.view.img11,kill_state == 1) self.perewardInfos = data.personal_item if table.count(self.perewardInfos) > 0 then self:SetpersonalItemIcon(true,self.perewardInfos) end ---按钮状态text_attach if self.state == 0 then GUI:Text_setString(self.view.button29, "前 往") else GUI:Text_setString(self.view.button29, "领取奖励") end GUI:setVisible(self.view.img33, noget) GUI:setVisible(self.view.text666,left_count > 0) GUI:setVisible(self.view.button29, not noget and self.state ~= 2 ) GUI:setVisible(self.view.light_btn29, not noget and self.state == 1 ) GUI:setVisible(self.view.RewardImg3,self.state == 2 ) 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 ---多个奖励道具 function this:SetpersonalItemIcon(show) GUI:DataListInitData(self.view.Personalrewards, function() return table.count(self.perewardInfos) end, function(realIndex) return self:DataListItemGetFunc(realIndex) end, function(realIndex, kmlcontrol) return self:DataListItemInitFunc(realIndex, kmlcontrol) end, function(realIndex, kmlcontrol) return self:DataListItemUpdateFunc(realIndex, kmlcontrol) end) GUI:DataListUpdateData(self.view.Personalrewards) end function this:DataListItemGetFunc(realIndex) end function this:DataListItemInitFunc(realIndex, kmlcontrol) end function this:DataListItemUpdateFunc(realIndex, kmlcontrol) local data = self.perewardInfos[realIndex+1] local item = self.view.Personalrewards:GetChildControl(realIndex, "Personalitem") local count = ""..SL:GetSimpleNumber(tonumber(data[2]),0).."" GUI:Item_UpdataData(item, { itemid = data[1], itemcustomcount = count }) end ---注册UI事件和服务器消息 function this:RegistEvents() GUI:AddOnClickEvent(self.view.button29, self, self.OnClickButton) GUI:AddOnClickEvent(self.view.RewardHurtItem,self,self.Hurt_itemClick) GUI:AddOnClickEvent(self.view.RewardKillItem,self,self.Kill_itemClick) end function this:Hurt_itemClick() if self.hurt_state < 2 then local iscanget = self.hurt_state == 1 if iscanget then ---可领取奖励,不用弹提示 SL:SendLuaNetMsg(LuaMessageIdToSever.RECEIVE_GLOBAL_FIRST_KILL_AWARD,{ group = self.data.boss_group ,configId = self.data.boss_id,type = 2}) else SL:OpenTips(nil,self.data.hurt_item[1]) end end end function this:Kill_itemClick() if self.kill_state < 2 then local iscanget = self.kill_state ==1 if iscanget then ---可领取奖励,不用弹提示 SL:SendLuaNetMsg(LuaMessageIdToSever.RECEIVE_GLOBAL_FIRST_KILL_AWARD,{ group = self.data.boss_group ,configId = self.data.boss_id ,type = 1}) else SL:OpenTips(nil,self.data.kill_item[1]) end end end function this:OnClickButton() if self.state == 0 then --跳转 if self.data.boss_type and self.data.boss_type.monsterType and self.data.boss_type.monsterType> 0 then SL.HideMainPanel() GUI:UIPanel_Close("dev/outui/ServerActivity/Panel/KLOpenServer/KLOpenServerPanel") GUI:UIPanel_Open("dev/outui/ChallengeBoss/Panel/KLChallengeBoss/KLChallengeBossPanel",nil, nil,{monsterId = self.data.boss_id,monsterType = self.data.boss_type.monsterType }) end else --领取个人奖励 SL:SendLuaNetMsg(LuaMessageIdToSever.RECEIVE_PERSONAL_FIRST_KILL_AWARD,{ group = self.data.boss_group ,configId = self.data.boss_id }) end end function this:Close() end return this