local Unlock_Controller = {} local private = {} local EventSystem = require('Event/EventSystem') function Unlock_Controller.OnStartup() EventSystem.Regist(EventID.TeamRankUpdate, Unlock_Controller.Update) EventSystem.Regist(EventID.TeamLevelUpdate, Unlock_Controller.Update) EventSystem.Regist(EventID.UI_HeroShow_UpdateHeroShow, Unlock_Controller.Update) end function Unlock_Controller.CheckIfFuncUnlock(functionType, viewClass, isCloseAndBack) if not MDL.Unlock.IsUnlock(functionType) then viewClass:CloseView(isCloseAndBack) return false end return true end function Unlock_Controller.JudgeUnlockByParameterTable(unlockTable) local type = unlockTable.UnlockCondition local param = unlockTable.UnlockConditionParam local des = unlockTable.UnlockDes return MDL.Unlock.IsComplete(type, param, des) end function Unlock_Controller.JudgeIfSatisfiedUnlockTable(unlockTableList) local unlockText = nil local ifUnlock = true for i, v in ipairs(unlockTableList) do local ifUnlock, unlockText = Unlock_Controller.JudgeUnlockByParameterTable(v) if not ifUnlock then return ifUnlock, unlockText end end return ifUnlock, unlockText end function Unlock_Controller.GetUnlockLevelByParameterTable(unlockTableList) local unlockLevel = 0 for i, v in ipairs(unlockTableList) do if v.UnlockCondition == LuaConst.UnlockConditionType.TeamLevel then unlockLevel = tonumber(v.UnlockConditionParam) break end end return unlockLevel end function Unlock_Controller.GetFuncNameById(funcId) if funcId == MDL.Unlock.FunctionType.HeroMatch1v1 then return Const_IDS.IDS_HeroMatch1v1_Title elseif funcId == MDL.Unlock.FunctionType.HeroMatch3v3 then return Const_IDS.IDS_HeroMatch3v3_Title elseif funcId == MDL.Unlock.FunctionType.FairSoloTournament then return Const_IDS.IDS_FairTournament_Name elseif funcId == MDL.Unlock.FunctionType.TeamFairChampionship then return Const_IDS.IDS_TeamFairTournamen_Name end end return Unlock_Controller