KLGodCountryPanel.lua 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. ---@class KLGodCountryPanel:UIKmlLuaPanelBase
  2. ---@field view KLGodCountryPanelView
  3. local KLGodCountryPanel = class(UIKmlLuaPanelBase)
  4. local this = KLGodCountryPanel
  5. ---创建时调用一次
  6. function this:Init()
  7. local mapid = SL:GetConfig("cfg_activity_rule",20001).mapid[1]
  8. local message = ""
  9. self.level_lock = false
  10. self.strength_lock = false
  11. self.append_lock = false
  12. self.open_level = 0
  13. local tab = SL:GetConfig("cfg_map_info",mapid)
  14. if tab.condition and #tab.condition > 0 then
  15. local condition = tab.condition
  16. local level = condition[1]
  17. local strength_level = condition[2]
  18. local append_level = condition[3]
  19. local player_level = SL:GetMetaValue("LEVEL")
  20. local all_strength_level = EquipFunc.GetAllStrengthLevel()
  21. local all_append_level = EquipFunc.GetAllAppendLevel()
  22. if player_level < level then
  23. message = message .. "等级" .. level .. "级"
  24. self.level_lock = true
  25. self.open_level = level
  26. end
  27. if all_strength_level < strength_level then
  28. if not string.isNullOrEmpty(message) then
  29. message = message .. ","
  30. end
  31. message = message .. "强化总等级" .. strength_level
  32. self.strength_lock = true
  33. end
  34. if all_append_level < append_level then
  35. if not string.isNullOrEmpty(message) then
  36. message = message .. ","
  37. end
  38. message = message .. "追加总等级" .. append_level
  39. self.append_lock = true
  40. end
  41. if not string.isNullOrEmpty(message) then
  42. message = message .. "可进入"
  43. end
  44. end
  45. GUI:Text_setString(self.view.tishi,message)
  46. -- SL:LogTable(condition,true)
  47. end
  48. ---注册UI事件和服务器消息
  49. function this:RegistEvents()
  50. GUI:AddOnClickEvent(self.view.join_btn,self,self.JoinOnclick)
  51. end
  52. function this:JoinOnclick()
  53. if self.level_lock then
  54. SL:TipMessage( self.open_level.."级开启,无法进入", 1, NoticeType.NoticeMid )
  55. return
  56. end
  57. if self.strength_lock then
  58. SL:TipMessage( SL:GetConfig('cfg_string',257).text,1, NoticeType.NoticeMid )--"全身强化等级不足,无法进入",
  59. return
  60. end
  61. if self.append_lock then
  62. SL:TipMessage(SL:GetConfig('cfg_string',257).text, 1, NoticeType.NoticeMid )--"全身追加等级不足,无法进入",
  63. return
  64. end
  65. -- if not self:IsHavePrivilege() then
  66. -- SL:TipMessage({ SL:GetConfig('cfg_string',258).text, 1, NoticeType.NoticeLeftBottom })--"<color=#426ECC>月卡时间不足,无法使用地图传送功能</color>",
  67. -- return
  68. -- end
  69. GUI:UIPanel_Close("dev/outui/CrossServer/Panel/KLCrossServerMain/KLCrossServerPanel")
  70. GUI:UIPanel_Close("dev/outui/CrossServer/Panel/KLGodCountry/KLGodCountryPanel")
  71. SL.ShowMainPanel()
  72. SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_GOTO_CROSS_MAP,{})
  73. end
  74. function this:IsHavePrivilege()
  75. if InfoManager.monthCardInfo.IsGetMonthCard or InfoManager.monthCardInfo.IsGetDailyCard then
  76. --有月卡或是日卡
  77. return true
  78. end
  79. return false
  80. end
  81. function this:Close()
  82. end
  83. return this