KLTradeRemovePanel.lua 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. ---@class KLTradeRemovePanel:UIKmlLuaPanelBase
  2. ---@field view KLTradeRemovePanelView
  3. local KLTradeRemovePanel = class(UIKmlLuaPanelBase)
  4. local this = KLTradeRemovePanel
  5. ---创建时调用一次
  6. function this:Init()
  7. SL:OpenTips(_, self.args.cfgId, self.args.id)
  8. end
  9. ---注册UI事件和服务器消息
  10. function this:RegistEvents()
  11. GUI:AddOnClickEvent(self.view.btn_close, self, self.ClosePanel)
  12. GUI:AddOnClickEvent(self.view.btn, self, self.BtnClick)
  13. end
  14. function this:ClosePanel()
  15. GUI:UIPanel_Close("dev/outui/Trade/Panel/KLTradeRemove/KLTradeRemovePanel")
  16. GUI:UIPanel_Close("dev/ui/Tips/Panel/KLUIEquipTips/KLUIEquipTipsPanel")
  17. GUI:UIPanel_Close("dev/ui/Tips/Panel/KLIUItemTips/KLUIItemTipsPanel")
  18. GUI:UIPanel_Close("dev/ui/Tips/Panel/KLUIEquipTipsComparsion/KLUIEquipTipsComparsionPanel")
  19. end
  20. ---创建或者刷新界面数据时调用
  21. function this:Refresh()
  22. --local src = self:GetCoinIcon(tonumber(self.args.type))
  23. local tbl = SL:GetConfig("cfg_stall", self.args.cfgId, "id")
  24. GUI:Image_loadTexture(self.view.img_coin_unit, tostring(tbl.money), "Atlas/UIBagPanel.spriteatlas")
  25. if tbl.money == 30030305 then
  26. GUI:Text_setString(self.view.txt_price_unit, tostring(self.args.price).."天")
  27. else
  28. GUI:Text_setString(self.view.txt_price_unit, tostring(self.args.price))
  29. end
  30. end
  31. function this:BtnClick()
  32. local data = { self.args.cfgId, self.args.id }
  33. SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_TRADE_OFF_GOODS, data)
  34. self:ClosePanel()
  35. end
  36. function this:GetCoinIcon(coinType)
  37. if coinType == 10010001 then
  38. return "img_bag_01"
  39. elseif coinType == 10020001 then
  40. return "img_bag_02"
  41. elseif coinType == 10030001 then
  42. return "img_bag_03"
  43. elseif coinType == 10040001 then
  44. return "img_bag_04"
  45. end
  46. end
  47. function this:Close()
  48. end
  49. return this