---@class KLStrengthBagPanel:UIKmlLuaPanelBase ---@field view KLStrengthBagPanelView local KLStrengthBagPanel = class(UIKmlLuaPanelBase) local this =KLStrengthBagPanel ---创建时调用一次 function this:Init() self:InitData(self.args) local bag_info = SL:GetConfig('cfg_global',6).value self.maxHor = tonumber(bag_info[1]) self.maxVet = tonumber(bag_info[2]) EquipFunc:ReplaceEquipBagButton({self.view.person_shop_btn,self.view.storage_btn,self.view.recycle_btn,self.view.tidy_btn}) ---@type KLUIBagTileScrollViewItem GUI:UIPanel_Open("dev/ui/Common/Item/KLUIBagTileScrollView/KLUIBagTileScrollViewItem", self.view.root,self, {itemList=SL:GetMetaValue("BAG_DATA")[1], id=E_BagTileScrollViewType.Strength, hor = tonumber(bag_info[1]), vet=tonumber(bag_info[2]), canDrag=false,itemClick=(self.args and self.args.itemClickCallBack), callBackUI=self.args.callBackUI},nil,function(bag) self.bagTileScrollView = bag end) end ---初始化数据 function this:InitData(data) self.x=(data and data.x)or 0 self.y=(data and data.y)or 0 end ---创建或者刷新界面数据时调用 function this:Refresh() local x = self.x local y = self.y GUI:setPosition(self.view.root, x, y) end ---注册UI事件和服务器消息 function this:RegistEvents() GUI:AddOnClickEvent(self.view.closeBtn, self, self.closeBtn ) SL:RegisterLUAEvent(Event.BagInfo_Change, self.BagInfo_Change, self) GUI:AddOnClickEvent(self.view.person_shop_btn, self, self.personBtn) GUI:AddOnClickEvent(self.view.storage_btn, self, self.personBtn) GUI:AddOnClickEvent(self.view.recycle_btn, self, self.personBtn) GUI:AddOnClickEvent(self.view.tidy_btn, self, self.personBtn) end function this:personBtn() SL:MessageTip({id=502}) end function this:closeBtn() GUI:UIPanel_Close("dev/ui/UIForgeGroup/Panel/KLUIForgeGroup/KLUIForgeGroupPanel") GUI:UIPanel_Close("dev/outui/Equip/Panel/KLEquipStrengthUI/KLEquipStrengthUIPanel") GUI:UIPanel_Close("dev/outui/Equip/Panel/KLEquipAppendUI/KLEquipAppendUIPanel") GUI:UIPanel_Close("dev/outui/Bag/Panel/KLStrengthBag/KLStrengthBagPanel") end function this:Close() end ---@param eventData {index:number,item:CommonProtos.Item}[] function this:BagInfo_Change(eventId, eventData) self.bagTileScrollView:Item_Change(eventData) end return this