123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- ---@class KLTradeSalesItem:UIKmlLuaPanelBase
- ---@field view KLTradeSalesItemView
- ---@field goodsItem KLTradeGoodsItem
- ---@field goods boolean
- ---@field goodsInfo
- local KLTradeSalesItem = class(UIKmlLuaPanelBase)
- local this = KLTradeSalesItem
- ---创建时调用一次
- function this:Init()
- end
- ---注册UI事件和服务器消息
- function this:RegistEvents()
- end
- function this:UpdateUI(data)
- if table.count(data) > 0 then
- GUI:setVisible(self.view.null_panel, false)
- GUI:setVisible(self.view.have_panel, true)
- self.goods = true
- if not self.goodsItem then
- self.goodsItem = GUI:UIPanel_Open("dev/outui/Trade/Item/KLTradeGoods/KLTradeGoodsItem", self.view.have_panel, self, nil, true)
- end
- GUI:setContentSize(self.goodsItem.view.KLTradeGoodsItem,200,195)
- GUI:setContentSize(self.goodsItem.view.btn_goods_item, 200, 195)
- self.goodsInfo = data
- self.goodsItem:UpdateData(data)
- GUI:AddOnClickEvent(self.goodsItem.view.btn_goods_item, self, self.Click)
- self.tickTimer = SL:Schedule(self.tickTimer, 0, 1, -1, function()
- return self.goodsItem:Tick()
- end)
- end
- end
- function this:Remove()
- if self.tickTimer then
- SL:UnSchedule(self.tickTimer)
- self.tickTimer = nil
- end
- self.goods = false
- self.goodsInfo = {}
- GUI:setVisible(self.view.null_panel, true)
- GUI:setVisible(self.view.have_panel, false)
- end
- function this:IsGoods()
- return self.goods
- end
- function this:Click()
- SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_TRADE_GOODS_INFO, {self.goodsInfo.itemid, self.goodsInfo.ownid })
- GUI:UIPanel_Open("dev/outui/Trade/Panel/KLTradeRemove/KLTradeRemovePanel", _, _, { cfgId = self.goodsInfo.itemcfgid, id = self.goodsInfo.itemid, type = self.goodsInfo.cointype, price = self.goodsInfo.unitPrice })
- end
- ---创建或者刷新界面数据时调用
- function this:Refresh()
- self.goods = false
- self.goodsItem = nil
- end
- function this:Close()
- if self.tickTimer then
- SL:UnSchedule(self.tickTimer)
- self.tickTimer = nil
- end
- if self.goodsItem then
- end
- self.goodsItem = GUI:UIPanel_Close("dev/outui/Trade/Item/KLTradeGoods/KLTradeGoodsItem", self.goodsItem)
- end
- return this
|