12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- ---@class UIHookInfo
- UIHookInfo = class()
- local this = UIHookInfo
- function this:ctor()
- end
- function this:Reset()
- self.newMap = false
- self.hookReward = false
- self.checkOpen = false
- self.selectHookPointMapItem = nil
- end
- function this:Init()
- self:InitData()
- self:RegistMessages()
- end
- function this:InitData()
- this.mapLvs = {}
- local tbl = SL:GetConfigTable("cfg_hanguppoints")
- ---@param v cfg_hanguppoints_column
- for _, v in pairs(tbl) do
- if not this.mapLvs[v.mapMoveID] then
- ---@type cfg_mapMove_column
- local cfg = SL:GetConfig("cfg_mapMove", v.mapMoveID)
- this.mapLvs[v.mapMoveID] = cfg.level
- end
- end
- self.newMap = false
- self.hookReward = false
- self.selectHookPointMapItem = nil
- end
- function this:RegistMessages()
- SL:AddRedDotConditionFunc("checkHookNewMapAndReward",self.checkHookNewMapAndReward)
- SL:AddRedDotConditionFunc("checkHookReward",self.checkHookReward)
- SL:RegisterLUAEvent(LUA_EVENT_LEVELCHANGE, self.LUA_EVENT_LEVELCHANGE)
- SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_OFFLINE_ON_HOOK_INFO, self.RES_OFFLINE_ON_HOOK_INFO)
- SL:RegisterLUAEvent(LUA_EVENT_ROLE_LOGIN, self.LUA_EVENT_ROLE_LOGIN)
- SL:RegisterLUAEvent(LUA_EVENT_ENTRY_MAP_LOADING_PANEL_CLOSE, self.LUA_EVENT_ENTER_MAP)
- end
- function this.LUA_EVENT_ROLE_LOGIN()
- this.checkOpen = true
- SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_OFFLINE_ON_HOOK_INFO)
- end
- function this.LUA_EVENT_ENTER_MAP()
- if this.checkOpen then
- local tbl = SL:GetConfig("cfg_global", 6002)
- local needLv = tonumber(tbl.value)
- local myLv = SL:GetMetaValue(EMetaVarGetKey.LEVEL)
- if tonumber(myLv) >= needLv then
- GUI:UIPanel_Open("dev/outui/Hook/Panel/KLOnHook/KLOnHookPanel", _, _, "HookInfoToggle")
- SL.HideMainPanel()
- end
- end
- this.checkOpen = false
- end
- function this.checkHookNewMapAndReward()
- if this.newMap then
- return true
- end
- return this.checkHookReward()
- end
- function this.checkHookReward()
- return this.hookReward
- end
- function this.LUA_EVENT_LEVELCHANGE(_, level, old)
- for _, v in pairs(this.mapLvs) do
- if old < v and level >= v then
- this.newMap = true
- SL:RefreshPanelALLRedPoint("KLUISystemTopPanel")
- break
- end
- end
- end
- function this.RES_OFFLINE_ON_HOOK_INFO(id, message)
- this.hookReward = message.fightExp + message.freeExp > 0 and message.receiveExp == false
- SL:RefreshPanelALLRedPoint("KLOnHookPanel")
- SL:RefreshPanelALLRedPoint("KLUISystemTopPanel")
- end
- function this:SetNewMapRedClicked()
- this.newMap = false
- SL:RefreshPanelALLRedPoint("KLUISystemTopPanel")
- end
- function this:SetReceiveReward()
- self.receiveReward = true
- end
|