diff --git a/Assets/ManagedResources/~Lua/Modules/Main/MainPanel.lua b/Assets/ManagedResources/~Lua/Modules/Main/MainPanel.lua index a4510ae916..b489827bbe 100644 --- a/Assets/ManagedResources/~Lua/Modules/Main/MainPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Main/MainPanel.lua @@ -223,6 +223,11 @@ function this:InitComponent() this.btnJumpServer:SetActive(false) this.btnCompoundHero = Util.GetGameObject(this.gameObject, "scene/layer3/btnCompoundHero") this.btnTianShuMiJuan = Util.GetGameObject(self.gameObject, "RightDown/btnTianShuMiJuan") + --新功能提示 + this.levelOpenTips = Util.GetGameObject(self.gameObject, "levelOpen") + this.levelOpenTipsText = Util.GetGameObject(self.gameObject, "levelOpen/Text"):GetComponent("Text") + this.timeOpenTips = Util.GetGameObject(self.gameObject, "timeOpen") + this.timeOpenTipsText = Util.GetGameObject(self.gameObject, "timeOpen/Text"):GetComponent("Text") --this.btnTianShuMiJuan:SetActive(false) this.btnXingYunTanBao = Util.GetGameObject(this.gameObject, "bg/btnXingYunTanBao") this.operateIcon = { @@ -1461,6 +1466,13 @@ function this:OnShow() isRefeshIcon = true timePressStarted = Time.realtimeSinceStartup SoundManager.PlayMusic(SoundConfig.BGM_Main) + this:CheckNextFunctionOpen() + if this.levelOpen then + this.levelOpenTips:SetActive(true) + this.levelOpenTipsText.text = this.levelOpen[1].." "..this.levelOpen[2].."级开启" + else + this.levelOpenTips:SetActive(false) + end --刷新主城npc this:OnChangeTitleOrRideOrSkin() --检测主城六星入口是否显示 @@ -1584,6 +1596,12 @@ function this.OnUpdate() end local date = os.date("!*t", GetTimeStamp() + 25200) this.utcTimeText.text = string.format(" %02d:%02d", date.hour, date.min) .. "(UTC+7)" + if this.timeOpen then + this.timeOpenTips:SetActive(true) + this.timeOpenTipsText.text = this.timeOpen[1].." "..GetLeftTimeStrByDeltaTime2(this.timeOpen[2]).."后开启" + else + this.timeOpenTips:SetActive(false) + end end --检测屏幕右侧红点 @@ -2252,7 +2270,6 @@ end function this:OnChangeTitleOrRideOrSkin() local curisRefreshMainPanelNpc = PlayerManager.GetisRefreshMainPanelNpc() - -- LogBlue("sssssssssssssssssssssssssssssssssssss "..tostring(curisRefreshMainPanelNpc)) if not curisRefreshMainPanelNpc then return end local btnClickMoveTran = this.btnClickMove:GetComponent("RectTransform") local rect = btnClickMoveTran.rect @@ -2287,5 +2304,50 @@ function this:OnChangeTitleOrRideOrSkin() end PlayerManager.SetisRefreshMainPanelNpc(true) end - +function this:CheckNextFunctionOpen() + this.timeOpen = nil + this.levelOpen = nil + -- 当前玩家等级 + local playerLv = 0 + local curOpenTime = 0 + local curTime = GetTimeStamp() + for i, v in ConfigPairs(GlobalSysConfig) do + local data = v + if data.IsOpen == 1 and data.MainPanelShow == 1 then + --1#创角 + --2#开服 + if data.IfOpen then + local type = data.IfOpen[1] + local dayNum = data.IfOpen[2] + if type == 1 then + local openTime = PlayerManager.userCreateTime + dayNum * 24 * 60 * 60 + if curTime < openTime and (curOpenTime > openTime or curOpenTime == 0) then + curOpenTime = openTime + this.timeOpen = {v.Name,curOpenTime - curTime} + end + elseif type == 2 then + local openTime = PlayerManager.GetServerOpenTime() + dayNum * 24 * 60 * 60 + if curTime < openTime and (curOpenTime > openTime or curOpenTime == 0) then + curOpenTime = openTime + this.timeOpen = {v.Name,curOpenTime - curTime} + end + end + else + --开启规则 + --1关卡开启 + --2玩家等级开启 + --3鸿蒙阵神将等级 + --4购买礼包开启 + --6修行等级 + local openRule = data.OpenRules + if openRule then + if openRule[1] == 2 and PlayerManager.level < openRule[2] and (playerLv > openRule[2] or playerLv == 0)then + playerLv = openRule[2] + this.levelOpen = {v.Name,openRule[2]} + end + end + end + end + end +end return MainPanel