---@class KLBigMapTransferItemItem:UIKmlLuaPanelBase ---@field view KLBigMapTransferItemItemView local KLBigMapTransferItemItem = class(UIKmlLuaPanelBase) local this =KLBigMapTransferItemItem ---创建时调用一次 function this:Init() self.hight = GUI:GetControlHeight(self.view.ButtonCommon) end ---创建或者刷新界面数据时调用 function this:Refresh() end ---@param itemData MapMoveListItemData function this:RefreshUI(itemData,clickCallback) local mapMoveTbl = itemData.data self.clickCallback = clickCallback self.itemData = itemData self.mapMoveTbl = mapMoveTbl GUI:Text_setString(self.view.Label, itemData.isGroup and mapMoveTbl.groupName or mapMoveTbl.mapName) --GUI:Text_setTextAlignment(self.view.Label,itemData.isRoot and "01" or "11") GUI:Text_setString(self.view.TextLevel, itemData.isRoot and mapMoveTbl.level .. "级" or "") self.conditionCheck = mapMoveTbl.level <= SL:MeData_GetLevel() GUI:Text_setTextColor(self.view.TextLevel,self.conditionCheck and "#DCE1E5" or "#ED2E2E") self.equipConditionCheck,_,self.conditionInfo = SL:CheckCalculateConditionGroup(mapMoveTbl.conditions) self.isGoldmap = SL:GetConfig("cfg_map_info",self.mapMoveTbl.mapID).goldmap == 1 GUI:setVisible(self.view.ImgVip,false) local width = GUI:GetControlWidth(self.view.ButtonCommon) GUI:setContentSize(self.view.ButtonCommon,width,self.hight) if self.isGoldmap then if itemData.isRoot then GUI:Image_loadTexture(self.view.ButtonCommon,"Bg_map_btn_big","Atlas/UIMapPanel.spriteatlas") else GUI:Image_loadTexture(self.view.ButtonCommon,"bg_gold","Atlas/KLMapPanel.spriteatlas") GUI:setVisible(self.view.ImgVip,true) GUI:setContentSize(self.view.ButtonCommon,width,30) end else GUI:Image_loadTexture(self.view.ButtonCommon,itemData.isRoot and "Bg_map_btn_big" or "Bg_map_btn_small","Atlas/UIMapPanel.spriteatlas") end GUI:SetID(self.view.ButtonCommon,(itemData.isGroup and"btn_transfer_group_" or "btn_transfer_") .. itemData.data.id) end ---注册UI事件和服务器消息 function this:RegistEvents() GUI:AddOnClickEvent(self.view.ButtonCommon,self,self.ButtonCommonOnClick) end function this:ButtonCommonOnClick() if self.itemData.isGroup then self:ExpandGroup() else self:MapMove() end end function this:ExpandGroup() self.itemData.groupExpand = not self.itemData.groupExpand self.clickCallback() end function this:MapMove() GUI:UIPanel_Close("dev/ui/Map/Panel/KLBigMap/KLBigMapPanel") SL:HideBigMap() SL.ShowMainPanel() if InfoManager.redNameInfo:IsLimitTransferById(SL:GetMetaValue("MAIN_ACTOR_ID")) then SL:TipMessage(SL:GetConfig('cfg_string',262).text,1,NoticeType.NoticeMid)--pk值较高,无法传送 return end if self.isGoldmap then if not self.itemData.isRoot and InfoManager.newVipInfo.vipLevel <= 0 then SL:CommonTipsMessage({ stringTblID=228, ui = self, sureBtnText = "确定", cancelBtnText = "取消", callback = function() SL.HideMainPanel() GUI:UIPanel_Open("dev/outui/VIP/Panel/KLNewVIPMain/KLNewVIPMainPanel") end }) return end end if self.conditionCheck and self.equipConditionCheck then SL:showTransferAnimation() SL:ScheduleOnce(0.8, function() SL:MapTransfer(nil, 1, self.mapMoveTbl.id) end) else if not self.conditionCheck then SL:TipMessage( string.format("等级不满足,%s等级后开启", self.mapMoveTbl.level), 1, NoticeType.NoticeMid ) return end if not self.equipConditionCheck then if #self.conditionInfo.childs > 0 then SL:TipMessage( self.conditionInfo.childs[1].errorMsg, 1, NoticeType.NoticeMid ) end return end end end function this:Close() end return this