---@class KLTradeBagPanel:UIKmlLuaPanelBase ---@field view KLTradeBagPanelView local KLTradeBagPanel = class(UIKmlLuaPanelBase) local this = KLTradeBagPanel ---创建时调用一次 function this:Init() self:InitData(self.args) local bag_info = string.split(SL:GetConfig("cfg_global", 6).value, '#') self.maxHor = tonumber(bag_info[1]) + 20 self.maxVet = tonumber(bag_info[2]) --Stall if not self.bagTileScrollView then GUI:UIPanel_Open("dev/ui/Common/Item/KLUIBagTileScrollView/KLUIBagTileScrollViewItem", self.view.root, self, { itemList = self.args.itemList, id = EBagShowType.TradeLine, forbidCount = 0, hor = self.maxHor, vet = self.maxVet, canDrag = false, itemClick = self.args and self.args.itemClick, callBackUI = self.args and self.args.callBackUI }, false, function(bagTileScrollView) ---@type KLUIBagTileScrollViewItem self.bagTileScrollView = bagTileScrollView local x = self.x local y = self.y GUI:setContentSize(self.bagTileScrollView.view.BagTileScrollViewPrefab, 360, 400) GUI:setPosition(self.bagTileScrollView.view.BagTileScrollViewPrefab, 35, 0) GUI:setContentSize(self.bagTileScrollView.view.prefabBagTileScrollView_, 360, 400) GUI:setPosition(self.view.root, x, y) if self.args and self.args.itemList then self.bagTileScrollView:ClearBagItem() self.bagTileScrollView:RefreshItemByItem(self.args.itemList) end end) 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() end function this:RefreshItem(itemlist) if self.bagTileScrollView and itemlist then self.bagTileScrollView:ClearBagItem() self.bagTileScrollView:RefreshItemByItem(itemlist, function() self.bagTileScrollView:RefreshInfo() end, self) end end ---注册UI事件和服务器消息 function this:RegistEvents() --GUI:AddOnClickEvent(self.view.closeBtn, self, self.ClosePanel) end function this:ClosePanel() end function this:Close() GUI:UIPanel_Close("dev/ui/Common/Item/KLUIBagTileScrollView/KLUIBagTileScrollViewItem") end return this