KLCodePanel.lua 978 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. ---@class KLCodePanel:UIKmlLuaPanelBase
  2. ---@field view KLCodePanelView
  3. local KLCodePanel = class(UIKmlLuaPanelBase)
  4. local this =KLCodePanel
  5. ---创建时调用一次
  6. function this:Init()
  7. end
  8. ---创建或者刷新界面数据时调用
  9. function this:Refresh()
  10. end
  11. ---注册UI事件和服务器消息
  12. function this:RegistEvents()
  13. GUI:Input_SetOnEndEdit(self.view.CodeInput,self,self.InputOnValueChange)
  14. GUI:AddOnClickEvent(self.view.exchangeBtn,self,self.ExchangeOnClick)
  15. end
  16. function this:InputOnValueChange(control,_,data)
  17. self.code = data[1]
  18. end
  19. function this:ExchangeOnClick()
  20. if not self.code and not string.isNullOrEmpty(self.code) then
  21. SL:MessageTip({"请输入兑换码",1,NoticeType.NoticeMid})
  22. return
  23. end
  24. local code = GUI:Text_getString(self.view.CodeInput)
  25. SL:ReqCdKeyMessage(code)
  26. SL:SetMetaValue(EMetaVarSetKey.SET_HOOK_ATUO_RELEASE_SKILL,1011001)
  27. end
  28. function this:Close()
  29. self.code = nil
  30. end
  31. return this