require("Base/BasePanel") require("Modules/Main/View/MainPlayerView") local floor = math.floor MainPanel = Inherit(BasePanel) local this = MainPanel local endTime = 0 local LoginRoot_Channel = ServerConfigManager.GetVersionInfo("channel") local GlobalActConfig = ConfigManager.GetConfig(ConfigName.GlobalActivity) local ActGroupsConfig = ConfigManager.GetConfig(ConfigName.ActivityGroups) local shopItemConfig = ConfigManager.GetConfig(ConfigName.StoreConfig) local GlobalSysConfig = ConfigManager.GetConfig(ConfigName.GlobalSystemConfig) --示意图轮回放 local imageList = {} -- 主界面需要隐藏的功能 this.btnFunHide = {} this.btnFunGray = {} this.runHorseData = {} this.operateIcon = {} this.multiple = 0 --显示信息次数 this.isOpen = false this.SystemInfo = "" local orginLayer this.patFaceCallList = Stack.New() local timePressStarted local curMianTaskData = {} local canGetMsg = true local moveTranList local isFirstOpen = 0 --local isCanDragMsg = true local supremHadSet = false local isUpperMonthCardTimeShow = true local activitys = {} local activityTabs = {} local activeSelfTabs = {} local moveSceneList = { [1] = 0, [2] = 0.02, [3] = 0.05, [4] = 0.432, [5] = 0.5, [6] = 0.65, [7] = 0.84, } local lightList = { [1] = { -475, 185 }, [2] = { -1367, -950 }, [3] = { -2447, -2397 }, } function this:AddFuncItem(btnGO, pos) return {go = btnGO, open = Util.GetGameObject(btnGO, "open"), lock = Util.GetGameObject(btnGO, "lock"), pos = pos} end function this:InsertNewText(btn) local xinText = Util.GetGameObject(btn, "new") return xinText end local isRefeshIcon = true local curNPCList = {} local addUpDateNum = 0--UpDate计数器 --初始化组件(用于子类重写) function this:InitComponent() this.spLoader = SpriteLoader.New() orginLayer = 0 self.bg = Util.GetGameObject(self.gameObject, "bg") self.sceneTran = Util.GetGameObject(self.gameObject, "scene"):GetComponent("RectTransform") self.lightEffect = Util.GetGameObject(self.gameObject, "scene/effect") self.lightEffectActive = false self.bgTran = Util.GetGameObject(self.gameObject, "bg"):GetComponent("RectTransform") self.mountainTran = Util.GetGameObject(self.gameObject, "front"):GetComponent("RectTransform") this.npcRoot = Util.GetGameObject(self.gameObject, "bg/npcRoot") this.decorateRoot = Util.GetGameObject(self.gameObject, "bg/decorate") self.ctrl = Util.GetGameObject(self.gameObject, "scene/ctrl") ---------------topLeftPart---------------- -- 七日登陆奖励预览入口 this.sgBtn=Util.GetGameObject(self.gameObject,"LeftUp/GameObject/seven") this.sgRoot=Util.GetGameObject(this.sgBtn,"sevenGift/root") this.sgItemView = SubUIManager.Open(SubUIConfig.ItemView,this.sgRoot.transform) this.sgType=Util.GetGameObject(this.sgBtn,"sevenGift/type"):GetComponent("Text") this.sgName=Util.GetGameObject(this.sgBtn,"sevenGift/name"):GetComponent("Text") this.sgInfo=Util.GetGameObject(this.sgBtn,"sevenGift/info"):GetComponent("Text") this.sgEffect={} for i = 1, 2 do this.sgEffect[i]=Util.GetGameObject(this.sgBtn,"sevenGift/effect/effect"..i) end effectAdapte(Util.GetGameObject(this.sgEffect[2], "ziti mask (1)")) --十五日登录 this.fgBtn=Util.GetGameObject(self.gameObject,"LeftUp/GameObject/FifteenDayGift") this.rpFifteenDayGift = Util.GetGameObject(this.fgBtn,"redPoint") this.rpFifteenDayEffect = Util.GetGameObject(this.fgBtn,"UI_Effect_DengLu15Day_YuanKuang") --逐胜之巅 this.zhuShengBtn=Util.GetGameObject(self.gameObject,"LeftUp/GameObject/ZhuSheng") this.zhuShengTime = Util.GetGameObject(this.zhuShengBtn,"Image_1/time"):GetComponent("Text") this.FestevaBtn=Util.GetGameObject(self.gameObject,"LeftUp/GameObject/FestevaBtn") this.FestevaBtnRed=Util.GetGameObject(this.FestevaBtn,"redPoint") ---------------topRightPart---------------- -- 邮件 this.btnYouJian = Util.GetGameObject(self.gameObject, "LeftDown/btnRoot/btnYouJian") this.mailRedPoint = Util.GetGameObject(this.btnYouJian, "redPoint") -- 日常 this.btnDailyMission = Util.GetGameObject(self.gameObject, "LeftDown/btnRoot/btnDailyMission") this.DailyRedPoint = Util.GetGameObject(this.btnDailyMission, "redPoint") -- 好友 this.btnFriend = Util.GetGameObject(self.gameObject, "LeftDown/btnRoot/btnfriend") this.friendRed = Util.GetGameObject(this.btnFriend, "redPoint") -- 排行 this.btnRank = Util.GetGameObject(self.gameObject, "LeftDown/btnRoot/btnRank") this.rankRed = Util.GetGameObject(this.btnRank, "redPoint") -- 无尽 this.btnEndLess = Util.GetGameObject(self.gameObject, "LeftDown/btnRoot/btnEndLess") this.btnEndLess:SetActive(false) -- 探索 this.btnExplore = Util.GetGameObject(self.gameObject, "bg/btnExplore") this.btnExplore.gameObject:SetActive(true) this.btnExploreRed = Util.GetGameObject(this.btnExplore, "redPoint") --鸿蒙 this.btnHongMeng=Util.GetGameObject(self.gameObject,"RightDown/btnHongMeng") this.HongMengRedPoint = Util.GetGameObject(this.btnHongMeng,"redPoint") --六星前往 this.btnSixStarGo=Util.GetGameObject(self.gameObject,"LeftUp/GameObject/GameObject/sixStarHero") --15日登陆活动预告 this.fifteenTip=Util.GetGameObject(self.gameObject,"fifteenTip") this.fifteenTipTxt=Util.GetGameObject(self.gameObject,"fifteenTip/Text"):GetComponent("Text") -------------------场景中的按钮------------------------ -- 按钮 this.btnMonster = Util.GetGameObject(this.gameObject, "scene/layer2/btnShouchaolaixi") this.btnExpedition = Util.GetGameObject(this.gameObject, "scene/layer2/btnexpedition") this.btnJingjichang = Util.GetGameObject(this.gameObject, "scene/layer4/btnJingjichang") -- this.btnGonghui:SetActive(false) this.btnFenjie = Util.GetGameObject(this.gameObject, "scene/layer7/btnFenjie") --this.btnTujian = Util.GetGameObject(this.gameObject, "scene/layer7/btnTujian") this.btnShangdian = Util.GetGameObject(this.gameObject, "scene/layer7/btnShangdian") this.btnEquipCompound = Util.GetGameObject(this.gameObject, "scene/layer3/btnEquipCompound") -- this.btnPaihangbang = Util.GetGameObject(this.gameObject, "scene/layer4/btnPaihangbang") -- this.btnGuanxing = Util.GetGameObject(this.gameObject, "scene/layer4/btnGuanxing") this.btnRecruit = Util.GetGameObject(this.gameObject, "scene/layer6/btnRecruit") this.btnElementDrawCard = Util.GetGameObject(this.gameObject, "scene/layer4/btnElementDrawCard") this.btnElementDrawCard.gameObject:SetActive(false) this.btnSecretBox = Util.GetGameObject(this.gameObject, "scene/layer4/btnSecretBox") this.btnYiYao = Util.GetGameObject(this.gameObject, "scene/layer4/btnYiYao") this.btnPokemon = Util.GetGameObject(this.gameObject, "scene/layer6/btnPokemon") -- this.btnTianFu = Util.GetGameObject(this.gameObject, "scene/layer6/btnTianFu") this.btnWaiDi = Util.GetGameObject(this.gameObject, "scene/layer4/btnWaiDi") this.btnWaiDi:SetActive(false) --家园 this.btnHomeLand = Util.GetGameObject(this.gameObject, "scene/layer4/btnHomeLand") this.btnHomeLand:SetActive(true) --跨服 this.btnJumpServer = Util.GetGameObject(this.gameObject, "scene/layer4/btnJumpServer") this.btnCompoundHero = Util.GetGameObject(this.gameObject, "scene/layer3/btnCompoundHero") this.btnTianShuMiJuan = Util.GetGameObject(this.gameObject, "scene/layer6/btnTianShuMiJuan") this.btnXingYunTanBao = Util.GetGameObject(this.gameObject, "bg/btnXingYunTanBao") this.operateIcon = { [FUNCTION_OPEN_TYPE.SHOP] = this:AddFuncItem(this.btnShangdian, 50), [FUNCTION_OPEN_TYPE.HERO_RESOLVE] = this:AddFuncItem(this.btnFenjie, -1100), [FUNCTION_OPEN_TYPE.ARENA] = this:AddFuncItem(this.btnJingjichang, -200), [FUNCTION_OPEN_TYPE.HOMELAND] = this:AddFuncItem(this.btnHomeLand, -200), [FUNCTION_OPEN_TYPE.COMPOUND] = this:AddFuncItem(this.btnEquipCompound, -200), [FUNCTION_OPEN_TYPE.RECURITY] = this:AddFuncItem(this.btnRecruit, -56), --[FUNCTION_OPEN_TYPE.ELEMENT_RECURITY] = this:AddFuncItem(this.btnElementDrawCard, 0), [FUNCTION_OPEN_TYPE.COMPOUND_HERO] = this:AddFuncItem(this.btnCompoundHero, 0),--神将合成、置换 [FUNCTION_OPEN_TYPE.POKEMON] = this:AddFuncItem(this.btnPokemon, -1200),--神将合成、置换 [FUNCTION_OPEN_TYPE.tianshumijuan] = this:AddFuncItem(this.btnTianShuMiJuan, -600), [FUNCTION_OPEN_TYPE.LUCKYTURN] = this:AddFuncItem(this.btnXingYunTanBao, 0),--幸运探宝 [FUNCTION_OPEN_TYPE.JumpServer] = this:AddFuncItem(this.btnJumpServer, 0),--跨服 [FUNCTION_OPEN_TYPE.Explore] = this:AddFuncItem(this.btnExplore, 0),--探索 } this.operateNewText = { [FUNCTION_OPEN_TYPE.SHOP] = this:InsertNewText(this.btnShangdian), [FUNCTION_OPEN_TYPE.HERO_RESOLVE] = this:InsertNewText(this.btnFenjie), [FUNCTION_OPEN_TYPE.ARENA] = this:InsertNewText(this.btnJingjichang), [FUNCTION_OPEN_TYPE.HOMELAND] = this:InsertNewText(this.btnHomeLand), [FUNCTION_OPEN_TYPE.COMPOUND] = this:InsertNewText(this.btnEquipCompound), [FUNCTION_OPEN_TYPE.RECURITY] = this:InsertNewText(this.btnRecruit), --[FUNCTION_OPEN_TYPE.ELEMENT_RECURITY] = this:InsertNewText(this.btnElementDrawCard), [FUNCTION_OPEN_TYPE.COMPOUND_HERO] = this:InsertNewText(this.btnCompoundHero),--神将合成、置换 [FUNCTION_OPEN_TYPE.POKEMON] = this:InsertNewText(this.btnPokemon),--神将合成、置换 [FUNCTION_OPEN_TYPE.tianshumijuan] = this:InsertNewText(this.btnTianShuMiJuan), [FUNCTION_OPEN_TYPE.LUCKYTURN] = this:InsertNewText(this.btnXingYunTanBao),--幸运探宝 [FUNCTION_OPEN_TYPE.JumpServer] = this:InsertNewText(this.btnJumpServer),--跨服 } -- 红点 this.rpShangdian = Util.GetGameObject(this.btnShangdian, "redPoint") this.rpJingjichang = Util.GetGameObject(this.btnJingjichang, "redPoint") this.rpExpedition = Util.GetGameObject(this.btnExpedition, "redPoint") this.rpRecruit = Util.GetGameObject(this.btnRecruit, "redPoint") this.rpElementDrawCard = Util.GetGameObject(this.btnElementDrawCard, "redPoint") this.rpSecretBox = Util.GetGameObject(this.btnSecretBox, "redPoint") this.rpYiYao = Util.GetGameObject(this.btnYiYao, "redPoint") this.rpAlien = Util.GetGameObject(this.btnWaiDi, "redPoint") this.rpbtnHomeLand = Util.GetGameObject(this.btnHomeLand, "redPoint")--家园 this.rpCompoundHero = Util.GetGameObject(this.btnCompoundHero, "redPoint")--神将合成、置换 this.rpPokemon = Util.GetGameObject(this.btnPokemon, "redPoint")--灵兽 this.rpbtnTianShuMiJuan = Util.GetGameObject(this.btnTianShuMiJuan, "redPoint")--灵兽 this.rpbtnXingYunTanBao = Util.GetGameObject(this.btnXingYunTanBao, "redPoint")--幸运探宝 this.rpJumpServer = Util.GetGameObject(this.btnJumpServer, "redPoint")--跨服 if not this.playerInfoView then this.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, this.transform) this.playerInfoView:SetPrivilegeShow(true) end this.BtView = SubUIManager.Open(SubUIConfig.BtView, self.transform) this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.transform) this.ChatTipView = SubUIManager.Open(SubUIConfig.ChatTipView, self.transform, 1) ----==================== npc按钮 ======================== -- 云游商人 this.yunyou = Util.GetGameObject(this.npcRoot, "npcYunyou") this.btnYunyou = Util.GetGameObject(this.yunyou, "button") this.timeYunyou = Util.GetGameObject(this.btnYunyou, "time"):GetComponent("Text") this.rpYunyou = Util.GetGameObject(this.btnYunyou, "redPoint") poolManager:LoadLive("live2d_r_MapEffect_NewEvent_014", Util.GetTransform(this.yunyou, "liveRoot"), Vector3.one, Vector3.zero) -- 精英怪 this.jingying = Util.GetGameObject(this.npcRoot, "npcJingying") this.btnJingying = Util.GetGameObject(this.jingying, "button") this.eliteMonsterTimeText = Util.GetGameObject(this.btnJingying, "time"):GetComponent("Text") this.rpJingying = Util.GetGameObject(this.btnJingying, "redPoint") poolManager:LoadLive("live2d_r_Map_NewEvent_015", Util.GetTransform(this.jingying, "liveRoot"), Vector3.one, Vector3.zero) -- 外敌 this.alienNPC = Util.GetGameObject(this.npcRoot, "npcAlien") this.btnAlienNPC = Util.GetGameObject(this.alienNPC, "button") this.timeAlienNPC = Util.GetGameObject(this.alienNPC, "time"):GetComponent("Text") this.rpAlienNPC = Util.GetGameObject(this.alienNPC, "redPoint") moveTranList = {} for i = 1, #moveSceneList do table.insert(moveTranList, Util.GetGameObject(self.gameObject, "scene/layer" .. i):GetComponent("RectTransform")) end this.btnClickMove = Util.GetGameObject(this.bg, "btnClickMove") this.btnFunHide[FUNCTION_OPEN_TYPE.DAILY_TASK] = this.btnDailyMission this.btnFunHide[FUNCTION_OPEN_TYPE.PRAY] = this.paryGift this.btnFunHide[FUNCTION_OPEN_TYPE.EMAIL] = this.btnYouJian this.btnFunHide[FUNCTION_OPEN_TYPE.GOODFRIEND] = this.btnFriend this.btnFunHide[FUNCTION_OPEN_TYPE.ALLRANKING] = this.btnRank this.btnFunHide[FUNCTION_OPEN_TYPE.HongMengZhen] = this.btnHongMeng this.btnFunHide[FUNCTION_OPEN_TYPE.POKEMON] = this.btnPokemon this.btnFunHide[FUNCTION_OPEN_TYPE.tianshumijuan] = this.btnTianShuMiJuan this.btnFunHide[FUNCTION_OPEN_TYPE.LUCKYTURN] = this.btnXingYunTanBao this.animRoot = Util.GetGameObject(self.gameObject, "scene") --挑战关卡快速升级提示 this.battleUpLvTip = Util.GetGameObject(self.gameObject, "LeftDown/battleUpLvTip") Util.GetGameObject(self.gameObject, "LeftDown/battleUpLvTip/Text"):GetComponent("Text").text = Language[10610] this.activityTabPrefab = Util.GetGameObject(self.gameObject, "RightUp/activityTabPrefab") this.RightUp = Util.GetGameObject(self.gameObject, "RightUp") this.RightUp.transform.localScale = Vector3.one * UIManager.adapterScale this.RightUp2 = Util.GetGameObject(self.gameObject, "RightUp2") this.RightUp2.transform.localScale = Vector3.one * UIManager.adapterScale this.rpRightUp2 = Util.GetGameObject(this.RightUp2, "BG/redPoint") this.RightUp2Grid = Util.GetGameObject(self.gameObject, "RightUp2/Ract2D/Grid") this.RightUp2bgSize = Util.GetGameObject(this.RightUp2,"BG"):GetComponent("RectTransform") this.RightUp2btn = Util.GetGameObject(this.RightUp2,"BG/Button") this.RightUp2btnImg = Util.GetGameObject(this.RightUp2,"BG/Button"):GetComponent("RectTransform") this.RightUp2rectSize = Util.GetGameObject(this.RightUp2,"Ract2D"):GetComponent("RectTransform") this.RightUp2gridSize = this.RightUp2Grid:GetComponent("RectTransform") this.jiantouObj=Util.GetGameObject(self.gameObject, "jiantouObj") this.taiChuMiJuanBtn = Util.GetGameObject(self.gameObject, "taichumijuan") this.taichumijuanRed=Util.GetGameObject(this.taiChuMiJuanBtn, "redPoint") -- 提审服,喜扑,动游关闭太初密卷显示 if SERVER_VERSION == 1 or LoginRoot_Channel == "XP" or LoginRoot_Channel == "DY" then this.taiChuMiJuanBtn:SetActive(false) end end function this:SetPosFunc(v2) self.bgTran.anchoredPosition = v2 for i = 1, #moveSceneList do moveTranList[i].anchoredPosition = Vector2.New(v2.x * moveSceneList[i], v2.y) end local isShowLight = false for i = 1, #lightList do if v2.x >= lightList[i][1] and v2.x <= lightList[i][2] then isShowLight = true break end end if self.lightEffectActive ~= isShowLight then self.lightEffect:SetActive(isShowLight) self.lightEffectActive = isShowLight end self.mountainTran.anchoredPosition = Vector2.New(v2.x * 1.2, v2.y) end --绑定事件(用于子类重写) function this:BindEvent() Util.AddOnceClick(this.taiChuMiJuanBtn,function() NetManager.TaiChuSecretvolumeRequest(function(msg) local data = {} if not msg or not msg.secretvolume or #msg.secretvolume < 1 then UIManager.OpenPanel(UIName.taiChuMiJuan,data) return end coroutine.start(function() for k,v in ipairs(msg.secretvolume) do local isContinue = DynamicActivityManager.GetATaiChuMiJuanData(v) while(not DynamicActivityManager.GetwwwProgress()) do coroutine.wait(0.01) end isContinue = DynamicActivityManager.GetATaiChuMiJuanData(v) table.insert(data,isContinue) end table.sort(data,function(a,b) return a.id < b.id end) PlayerPrefs.SetString("TaiChu"..PlayerManager.uid,TimeStampToDateStr2(GetTimeStamp())) CheckRedPointStatus(RedPointType.TaiChuMiJuan) UIManager.OpenPanel(UIName.taiChuMiJuan,data) end) end) ----------------------------------------------------------- 测试数据 -- local data = {} -- local datas = {[1] = {id = 1,strategyLink = "https://pc.yiyouliao.com/msn/article.html?recId=eed09eaec41c4d18abc08ddbb3452fdc_s&infoId=II003LYBG9XPE7A",windowLink = "https://img-nos.yiyouliao.com/inforec-20210811-e1fd1cf39f6abfc1cdb35be92b6bc3d0.jpg?time=1628668135&signature=89DFF74746F289F5ED404A0BC627387A"}, -- [2] = {id = 2,strategyLink = "https://pc.yiyouliao.com/msn/article.html?recId=b5f830ada8a04ab2bac07efa621ba453_s&infoId=IT00TLAILJ9X7KZ",windowLink = "https://img-nos.yiyouliao.com/inforec-20210811-8e07612db47c17ec56fbba613d31cc7b.jpg?time=1628668250&signature=CA7856DD83E45651B5E2274D76D8BF48"}, -- [3] = {id = 3,strategyLink = "https://mini.eastday.com/nsa/210811133830637498814.html?qid=02034",windowLink = "https://lupic.cdn.bcebos.com/20191203/3016121736_23.jpg"}, -- [4] = {id = 4,strategyLink = "https://pc.yiyouliao.com/msn/article.html?recId=b5f830ada8a04ab2bac07efa621ba453_s&infoId=IT003LL8LJF1X9E",windowLink = "https://lupic.cdn.bcebos.com/20210629/938550_23.jpg"}, -- [5] = {id = 5,strategyLink = "https://mini.eastday.com/nsa/n210811082523736.html?qid=04232",windowLink = "https://img-nos.yiyouliao.com/inforec-20210811-361d4790c345bae2c5a5e1706c2b550b.jpg?time=1628668377&signature=B1350B327A0806326DD29054B83B071E"}, -- [6] = {id = 6,strategyLink = "http://ex.chinadaily.com.cn/exchange/partners/82/rss/channel/cn/columns/sz8srm/stories/WS6111cd6fa3101e7ce975deae.html",windowLink = "http://cn.chinadaily.com.cn/image/2018/j-2.jpg"}, -- [7] = {id = 7,strategyLink = "https://pc.yiyouliao.com/msn/article.html?recId=bdba7a24fe304b598695dbd25219f8e4_s&infoId=II003JLZ9IT187M",windowLink = "https://img-nos.yiyouliao.com/inforec-20210811-9987eceb8e5181eadb24778c05d9195b.jpg?time=1628668882&signature=842592897E6CE7C3DB594FAFC515B22E"}, -- [8] = {id = 8,strategyLink = "https://mini.eastday.com/nsa/210811065335765353208.html?qid=02034",windowLink = "https://dfzximg01.dftoutiao.com/minimodify/20210810/640x427_611230bb2fc8e.png"}, -- [9] = {id = 9,strategyLink = "https://pc.yiyouliao.com/msn/article.html?recId=ef71759530174eb7a644f43a1c82fc41_s&infoId=IC003K1PNC70DBQ",windowLink = "https://img-nos.yiyouliao.com/inforec-20210811-da593f41724ecf38354bb712398cfca6.jpg?time=1628672089&signature=6EABA2FF759B313F41F158D7AD8FDF6A"}, -- } -- coroutine.start(function() -- for k,v in ipairs(datas) do -- local isContinue = DynamicActivityManager.GetATaiChuMiJuanData(v) -- local time = 0 -- while(not DynamicActivityManager.GetwwwProgress()) do -- coroutine.wait(0.01) -- time = time + 0.01 -- end -- isContinue = DynamicActivityManager.GetATaiChuMiJuanData(v) -- table.insert(data,isContinue) -- end -- table.sort(data,function(a,b) -- return a.id < b.id -- end) -- UIManager.OpenPanel(UIName.taiChuMiJuan,data) -- end) end) Util.AddOnceClick(this.btnEndLess,function() StoryMapManager.InitData(1) end) self.trigger = Util.GetEventTriggerListener(self.ctrl) self.moveTween = self.bg:GetComponent(typeof(UITweenSpring)) if not self.moveTween then self.moveTween = self.bg:AddComponent(typeof(UITweenSpring)) end self.moveTween.enabled = false local setPosFunc = function(v2) local av2 = self.bgTran.anchoredPosition local dv2 = Vector2.New(math.clamp(v2.x + av2.x, -1600, 150), av2.y) if v2.x + av2.x < -1600 or v2.x + av2.x > 150 then self.moveTween:Rebound(1, 0.1) end this:SetPosFunc(dv2) end self.moveTween.OnUpdate = setPosFunc self.moveTween.MomentumAmount = 1 self.moveTween.Strength = 1 self.trigger.onBeginDrag = self.trigger.onBeginDrag + function(p, d) self.moveTween.enabled = true self.moveTween.Momentum = Vector3.zero self.moveTween.IsUseCallBack = false end self.trigger.onDrag = self.trigger.onDrag + function(p, d) self.moveTween:LerpMomentum(d.delta) setPosFunc(d.delta) end self.trigger.onEndDrag = self.trigger.onEndDrag + function(p, d) self.moveTween.IsUseCallBack = true setPosFunc(d.delta) end local btnClickMoveTran = this.btnClickMove:GetComponent("RectTransform") local rect = btnClickMoveTran.rect math.randomseed(os.time()) -- for i = 1, 10 do -- local view = MainPlayerView.New(false, this.btnClickMove, rect, Vector2.New(math.random(rect.xMin, rect.xMax), math.random(rect.yMin, rect.yMax))) -- view.NameText.text = NameManager.GetLocalRandomName() -- view:SetAutoMove() -- end curNPCList = {} PlayerManager.GetMainPlayerNPCData(function(NPCList) for i = 1, #NPCList do local view = MainPlayerView.New(false, this.btnClickMove, rect, Vector2.New(math.random(rect.xMin, rect.xMax), math.random(rect.yMin, rect.yMax)),NPCList[i],this.sortingOrder) view.NameText.text = NPCList[i].userName or NPCList[i].name -- LogYellow("username:"..tostring( NPCList[i].userName).." name:"..tostring(NPCList[i].name).." lv:"..tostring(NPCList[i].lv).." level:"..tostring(NPCList[i].level).." practiceLevel:"..tostring(NPCList[i].practiceLevel)) local _lv = NPCList[i].lv or NPCList[i].level or NPCList[i].userLevel if _lv and _lv >= GlobalSysConfig[108].OpenRules[2] then view.ImprintImg2:SetActive(true) PracticeManager.SetPracticeIcon(view.ImprintImg2,NPCList[i].practiceLevel) end view:SetAutoMove() view.leader.transform.name = "MainPlayerView"..i table.insert(curNPCList,view) end end) --实例化自己 this:OnChangeTitleOrRideOrSkin(rect) --八日登陆礼预览 Util.AddClick(Util.GetGameObject(this.sgBtn,"sevenGift"),function() --UIManager.OpenPanel(UIName.PassGiftPopup,true)ActivityTypeDef.SevenDayRegister --JumpManager.GoJump(15001) UIManager.OpenPanel(UIName.EightDayGiftPanel) end) --八日登陆礼预览 Util.AddClick(this.FestevaBtn,function() --UIManager.OpenPanel(UIName.PassGiftPopup,true)ActivityTypeDef.SevenDayRegister --JumpManager.GoJump(15001) UIManager.OpenPanel(UIName.FestevalPanel) end) --十五日登录奖励 Util.AddClick(this.fgBtn,function() UIManager.OpenPanel(UIName.FifteenDayGiftPanel) end) --逐胜之巅 Util.AddClick(this.zhuShengBtn,function () UIManager.OpenPanel(UIName.ArenaTopMatchPanel) end) --六星前往 Util.AddClick(this.btnSixStarGo,function() --PlayerManager.isSixStarJump=true local shopId = {} local shopData = ShopManager.GetShopDataByType(SHOP_TYPE.VIP_GIFT).storeItem for i = 1, #shopData do local shopItemData = shopItemConfig[shopData[i].id] local shows = shopItemData.Goods for j = 1,#shows do if shows[j][1] == 11026 then table.insert(shopId,shopItemData.Id) end end end DynamicActivityManager.SetSelectIndex(DataType.Shop,shopId) JumpManager.GoJump(36011) end) --逐胜之巅 Util.AddClick(this.fifteenTip,function () UIManager.OpenPanel(UIName.FifteenDayGiftPanel) end) --日常任务 Util.AddClick(this.btnDailyMission, function() UIManager.OpenPanel(UIName.MissionDailyPanel) end) --邮件 Util.AddClick(this.btnYouJian, function() UIManager.OpenPanel(UIName.MailMainPanel) end) -- 精英怪 Util.AddClick(this.btnJingying, function() if not EliteMonsterManager.HasEliteMonster() then PopupTipPanel.ShowTip(Language[10529]) return end UIManager.OpenPanel(UIName.EliteMonsterPanel, 1) end) -- Util.AddClick(this.paryGift, function() -- UIManager.OpenPanel(UIName.PrayMainPanel) -- end) --群英招募 Util.AddClick(this.btnRecruit, function() --UIManager.OpenPanel(UIName.RecruitPanel) this.FunctionClickEvent(FUNCTION_OPEN_TYPE.RECURITY, function () UIManager.OpenPanel(UIName.RecruitMainPanel) end) this.ScenceBtnClick(FUNCTION_OPEN_TYPE.RECURITY) end) -- --元素招募 -- Util.AddClick(this.btnElementDrawCard, function() -- this.FunctionClickEvent(FUNCTION_OPEN_TYPE.ELEMENT_RECURITY, function () -- UIManager.OpenPanel(UIName.RecruitMainPanel,TableRecruitType.Siyuanzhen) -- end) -- this.ScenceBtnClick(FUNCTION_OPEN_TYPE.ELEMENT_RECURITY) -- end) --秘盒 Util.AddClick(this.btnSecretBox, function() this.FunctionClickEvent(FUNCTION_OPEN_TYPE.SECRETBOX, function () UIManager.OpenPanel(UIName.SecretBoxPanel) end) this.ScenceBtnClick(FUNCTION_OPEN_TYPE.SECRETBOX) end) -- 给他一个点击事件吧,不然说个不停 Util.AddClick(this.btnYunyou, function() UIManager.OpenPanel(UIName.MainShopPanel, SHOP_TYPE.ROAM_SHOP) end) -- 打开怪兽来袭界面t Util.AddClick(this.btnMonster, function() JumpManager.GoJump(1011) this.ScenceBtnClick(FUNCTION_OPEN_TYPE.MONSTER_COMING) end) Util.AddClick(this.btnJingjichang, function() -- JumpManager.GoJump(8001) if (ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.ARENA)) then UIManager.OpenPanel(UIName.ArenaTypePanel) else local tip = ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.ARENA) PopupTipPanel.ShowTip(tip) end this.ScenceBtnClick(FUNCTION_OPEN_TYPE.ARENA) end) Util.AddClick(this.btnHomeLand, function() JumpManager.GoJump(40059) this.ScenceBtnClick(FUNCTION_OPEN_TYPE.HOMELAND) -- if ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.ENDLESS) then -- PlayerManager.carbonType = 2 -- UIManager.OpenPanel(UIName.CarbonTypePanelV2) -- else -- local config = ConfigManager.GetConfigData(ConfigName.GlobalSystemConfig,FUNCTION_OPEN_TYPE.ENDLESS) -- PopupTipPanel.ShowTip(string.format(Language[10279],config.OpenRules[2])) -- end end) Util.AddClick(this.btnJumpServer, function()--跨服 if ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.JumpServer) then UIManager.OpenPanel(UIName.JumpServerPanel) else local tip = ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.JumpServer) PopupTipPanel.ShowTip(tip) end this.ScenceBtnClick(FUNCTION_OPEN_TYPE.JumpServer) end) Util.AddClick(this.btnFenjie, function() JumpManager.GoJump(24001) this.ScenceBtnClick(FUNCTION_OPEN_TYPE.HERO_RESOLVE) end) Util.AddClick(this.btnShangdian, function() JumpManager.GoJump(20003) this.ScenceBtnClick(FUNCTION_OPEN_TYPE.SHOP) end) Util.AddClick(this.btnEquipCompound, function() --JumpManager.GoJump(20003) --this.ScenceBtnClick(FUNCTION_OPEN_TYPE.SHOP) if ActTimeCtrlManager.IsQualifiled(66) then UIManager.OpenPanel(UIName.CompoundPanel) end this.ScenceBtnClick(FUNCTION_OPEN_TYPE.COMPOUND) end) Util.AddClick(this.btnRank, function() if (ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.ALLRANKING)) then local types = {} local activiteIds = {} for i = 1, #rankKingList do if rankKingList[i].isRankingMainPanelShow == 1 or rankKingList[i].isRankingMainPanelShow == 2 then table.insert(types,rankKingList[i].rankType) table.insert(activiteIds,rankKingList[i].activiteId) end end NetManager.RankFirstRequest(types,activiteIds,function (msg) UIManager.OpenPanel(UIName.RankingListMainPanel,msg) end) else local tip = ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.ALLRANKING) PopupTipPanel.ShowTip(tip) end this.ScenceBtnClick(FUNCTION_OPEN_TYPE.ALLRANKING) end) -- 好友 Util.AddClick(this.btnFriend, function() UIManager.OpenPanel(UIName.GoodFriendMainPanel) end) -- 外敌(NPC按钮) Util.AddClick(this.btnAlienNPC, function() this.FunctionClickEvent(FUNCTION_OPEN_TYPE.FIGHT_ALIEN, function () -- 外敌展示界面 local list = AdventureManager.GetAdventureEnemyList() if not list or #list <= 0 or GetTimeStamp() > list[1].levelTime then PopupTipPanel.ShowTip(Language[10701]) return end UIManager.OpenPanel(UIName.MonsterShowPanel, list[1].bossGroupId, function() UIManager.OpenPanel(UIName.FormationPanel, FORMATION_TYPE.ADVENTURE_BOSS, list[1]) end, function()end, true, 4) end) end) -- 场景中的外敌 Util.AddClick(this.btnWaiDi, function () this.FunctionClickEvent(FUNCTION_OPEN_TYPE.FIGHT_ALIEN, function () UIManager.OpenPanel(UIName.AlienMainPanel) end) this.ScenceBtnClick(FUNCTION_OPEN_TYPE.FIGHT_ALIEN) end) -- 异妖 Util.AddClick(this.btnYiYao, function () this.FunctionClickEvent(FUNCTION_OPEN_TYPE.DIFFER_DEMONS, function () UIManager.OpenPanel(UIName.DiffMonsterPanel) end) this.ScenceBtnClick(FUNCTION_OPEN_TYPE.DIFFER_DEMONS) end) Util.AddClick(this.btnPokemon, function () this.FunctionClickEvent(FUNCTION_OPEN_TYPE.POKEMON, function () UIManager.OpenPanel(UIName.PokemonMainPanel) end) this.ScenceBtnClick(FUNCTION_OPEN_TYPE.POKEMON) end) --神将合成、神将置换 Util.AddClick(this.btnCompoundHero, function() if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.COMPOUND_HERO) then JumpManager.GoJump(750000) this.ScenceBtnClick(FUNCTION_OPEN_TYPE.COMPOUND_HERO) else PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.COMPOUND_HERO)) end end) Util.AddClick(this.btnHongMeng,function() NetManager.HongMengInfoResponse(function () if HarmonyManager:HongMengTowerUpLimit() > 0 then UIManager.OpenPanel(UIName.HongMengEnvoyPanel) else UIManager.OpenPanel(UIName.HongMengPanel) end end) end) Util.AddClick(this.btnTianShuMiJuan,function() UIManager.OpenPanel(UIName.TianShuMiJuan,1) this.ScenceBtnClick(FUNCTION_OPEN_TYPE.tianshumijuan) end) Util.AddClick(this.btnXingYunTanBao,function() -- UIManager.OpenPanel(UIName.LuckyTurnTablePanel) -- this.ScenceBtnClick(FUNCTION_OPEN_TYPE.LUCKYTURN) JumpManager.GoJump(1027) this.ScenceBtnClick(FUNCTION_OPEN_TYPE.LUCKYTURN) end) Util.AddClick(this.btnExplore,function() if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.Explore) then UIManager.OpenPanel(UIName.ExploreMainPanel) else PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.Explore)) end end) this.BindRedPoint() end --点击时检测功能 function this.FunctionClickEvent(funcId, callback) if not funcId or funcId == 0 or not callback then return end local isOpen = ActTimeCtrlManager.SingleFuncState(funcId) if isOpen then if callback then callback() end else PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(funcId)) end end -- 所有按钮的额外点击事件 function this.ScenceBtnClick(funcId) if ActTimeCtrlManager.IsQualifiled(funcId) then if funcId == FUNCTION_OPEN_TYPE.GUILD then this.operateNewText[FUNCTION_OPEN_TYPE.GUILD]:SetActive(false) this.BtView:CheckMainCityNew() end end FunctionOpenMananger.CleadNewText(funcId) end -- 设置图标动画 function this.SetAnim() local isOpen = FunctionOpenMananger.GetRootState(PanelTypeView.MainCity) if isOpen then PlayUIAnim(this.animRoot) else PlayUIAnimBack(this.animRoot) end end -- 绑定红点 function this.BindRedPoint() BindRedPointObject(RedPointType.Mail, this.mailRedPoint) BindRedPointObject(RedPointType.DailyTaskMain, this.DailyRedPoint) BindRedPointObject(RedPointType.Shop, this.rpShangdian) BindRedPointObject(RedPointType.Shop_Roam_Check, this.rpYunyou) BindRedPointObject(RedPointType.Arena, this.rpJingjichang) BindRedPointObject(RedPointType.Friend, this.friendRed) BindRedPointObject(RedPointType.RankingSort, this.rankRed) BindRedPointObject(RedPointType.Recruit, this.rpRecruit) BindRedPointObject(RedPointType.SecretBox, this.rpSecretBox) BindRedPointObject(RedPointType.Alien, this.rpAlien) BindRedPointObject(RedPointType.DiffMonster, this.rpYiYao) -- BindRedPointObject(RedPointType.Vientiane, this.rpColorfulWorld) BindRedPointObject(RedPointType.HomeLand, this.rpbtnHomeLand) BindRedPointObject(RedPointType.PokemonMainCity, this.rpPokemon) BindRedPointObject(RedPointType.HongMeng,this.HongMengRedPoint) BindRedPointObject(RedPointType.TianShuMiJuan,this.rpbtnTianShuMiJuan) BindRedPointObject(RedPointType.LuckyTurn,this.rpbtnXingYunTanBao) BindRedPointObject(RedPointType.FifteenDayGift,this.rpFifteenDayGift) BindRedPointObject(RedPointType.Huaxutan,this.rpCompoundHero) BindRedPointObject(RedPointType.RightUp2,this.rpRightUp2) BindRedPointObject(RedPointType.JumpServer_MainCity, this.rpJumpServer) BindRedPointObject(RedPointType.TaiChuMiJuan, this.taichumijuanRed) BindRedPointObject(RedPointType.ExploreFunc, this.btnExploreRed) BindRedPointObject(RedPointType.FestevalRed, this.FestevaBtnRed) end -- 绑定红点 function this.ClearRedPoint() ClearRedPointObject(RedPointType.Mail, this.mailRedPoint) ClearRedPointObject(RedPointType.DailyTaskMain, this.DailyRedPoint) ClearRedPointObject(RedPointType.Shop, this.rpShangdian) ClearRedPointObject(RedPointType.Shop_Roam_Check, this.rpYunyou) ClearRedPointObject(RedPointType.Arena, this.rpJingjichang) ClearRedPointObject(RedPointType.Friend, this.friendRed) ClearRedPointObject(RedPointType.RankingSort, this.rankRed) ClearRedPointObject(RedPointType.Recruit, this.rpRecruit) ClearRedPointObject(RedPointType.SecretBox, this.rpSecretBox) ClearRedPointObject(RedPointType.Alien, this.rpAlien) ClearRedPointObject(RedPointType.DiffMonster, this.rpYiYao) -- ClearRedPointObject(RedPointType.Vientiane, this.rpColorfulWorld) ClearRedPointObject(RedPointType.HomeLand, this.rpbtnHomeLand) ClearRedPointObject(RedPointType.PokemonMainCity, this.rpPokemon) ClearRedPointObject(RedPointType.HongMeng,this.HongMengRedPoint) ClearRedPointObject(RedPointType.TianShuMiJuan,this.rpbtnTianShuMiJuan) ClearRedPointObject(RedPointType.LuckyTurn,this.rpbtnXingYunTanBao) ClearRedPointObject(RedPointType.FifteenDayGift,this.rpFifteenDayGift) ClearRedPointObject(RedPointType.Huaxutan,this.rpCompoundHero) ClearRedPointObject(RedPointType.RightUp2,this.rpRightUp2) ClearRedPointObject(RedPointType.JumpServer_MainCity, this.rpJumpServer) ClearRedPointObject(RedPointType.TaiChuMiJuan, this.taichumijuanRed) ClearRedPointObject(RedPointType.ExploreFunc, this.btnExploreRed) ClearRedPointObject(RedPointType.FestevalRed, this.FestevaBtnRed) end --添加事件监听(用于子类重写) function this:AddListener() Game.GlobalEvent:AddEvent(GameEvent.Player.OnChangeName, this.RefreshChangeName) Game.GlobalEvent:AddEvent(GameEvent.FunctionCtrl.OnFunctionOpen, this.InitFuncShow) Game.GlobalEvent:AddEvent(GameEvent.FunctionCtrl.OnFunctionClose, this.InitFuncShow) Game.GlobalEvent:AddEvent(GameEvent.Activity.OnActivityOpenOrClose, this.RefreshActivityBtn) Game.GlobalEvent:AddEvent(GameEvent.Activity.OnPatFaceRedRefresh, this.RefreshShowPatPaceActivity) Game.GlobalEvent:AddEvent(GameEvent.Adventure.OnEnemyListChanged, this.OnAlienListChanged) Game.GlobalEvent:AddEvent(GameEvent.EightDay.GetRewardSuccess, this.RefreshEightGiftPreview) Game.GlobalEvent:AddEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, this.RefreshEightGiftPreview) Game.GlobalEvent:AddEvent(GameEvent.EightDay.FifteenDayGift, this.RefreshEightGiftPreview) Game.GlobalEvent:AddEvent(GameEvent.Activity.OnActivityProgressStateChange, this.RefreshGiftBtnShow) Game.GlobalEvent:AddEvent(GameEvent.Player.OnShowBattleUpLvTip, this.RefreshBattleUpLvTip) Game.GlobalEvent:AddEvent(GameEvent.Player.OnPlayerGetSuperManReward, this.GetSuperManReward) Game.GlobalEvent:AddEvent(GameEvent.PatFace.RefreshRightUp, this.SetRightBarSize)--刷新右上伸缩条 end --移除事件监听(用于子类重写) function this:RemoveListener() Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnChangeName, this.RefreshChangeName) Game.GlobalEvent:RemoveEvent(GameEvent.FunctionCtrl.OnFunctionOpen, this.InitFuncShow) Game.GlobalEvent:RemoveEvent(GameEvent.FunctionCtrl.OnFunctionClose, this.InitFuncShow) Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnActivityOpenOrClose, this.RefreshActivityBtn) Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnPatFaceRedRefresh, this.RefreshShowPatPaceActivity) Game.GlobalEvent:RemoveEvent(GameEvent.Adventure.OnEnemyListChanged, this.OnAlienListChanged) Game.GlobalEvent:RemoveEvent(GameEvent.EightDay.GetRewardSuccess, this.RefreshEightGiftPreview) Game.GlobalEvent:RemoveEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, this.RefreshEightGiftPreview) Game.GlobalEvent:RemoveEvent(GameEvent.EightDay.FifteenDayGift, this.RefreshEightGiftPreview) Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnActivityProgressStateChange, this.RefreshGiftBtnShow) Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnShowBattleUpLvTip, this.RefreshBattleUpLvTip) Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnPlayerGetSuperManReward, this.GetSuperManReward) Game.GlobalEvent:RemoveEvent(GameEvent.PatFace.RefreshRightUp, this.SetRightBarSize)--刷新右上伸缩条 end function this.GetSuperManReward() this.CheckSixStarGoShow() end function this:OnSortingOrderChange() self.sceneTran.gameObject:GetComponent("Canvas").sortingOrder = self.sortingOrder - 4 Util.GetGameObject(self.sceneTran.gameObject, "layer7"):GetComponent("Canvas").sortingOrder = self.sortingOrder - 3 this.npcRoot:GetComponent("Canvas").sortingOrder = self.sortingOrder - 2 this.decorateRoot:GetComponent("Canvas").sortingOrder = self.sortingOrder - 1 -- Util.AddParticleSortLayer(this.btnClickMove, self.sortingOrder - orginLayer) Util.AddParticleSortLayer(this.sceneTran.gameObject, self.sortingOrder - orginLayer) Util.AddParticleSortLayer(this.mountainTran.gameObject, self.sortingOrder - orginLayer) Util.AddParticleSortLayer(Util.GetGameObject(this.decorateRoot, "effect"), self.sortingOrder - orginLayer) Util.AddParticleSortLayer(this.sgEffect[1], self.sortingOrder - orginLayer) Util.AddParticleSortLayer(this.sgEffect[2], self.sortingOrder - orginLayer) Util.AddParticleSortLayer(this.rpFifteenDayEffect, self.sortingOrder - orginLayer) orginLayer = self.sortingOrder this.BtView:SetOrderStatus({ sortOrder = self.sortingOrder }) -- 设置提示框层级 this.battleUpLvTip:GetComponent("Canvas").sortingOrder = orginLayer + 10 if this.playerInfoView then this.playerInfoView:SetLayer(self.sortingOrder) end if curNPCList then for _, mpv in pairs(curNPCList) do if mpv.OnSortingOrderChange then mpv:OnSortingOrderChange(self.sortingOrder) end end end end function this:OnOpen() activitys = DynamicActivityManager.GetActivityTableDataByPageInde(0) this.CreatActivity() end --检测六星前往活动是否显示 function this.CheckSixStarGoShow() local time=PlayerPrefs.GetString(PlayerManager.uid..PlayerManager.serverInfo.server_id.."supermeMan",0) if time and time~=0 and time~=666 and GetTimeStamp()-time< 259200 then this.btnSixStarGo:SetActive(true) else this.btnSixStarGo:SetActive(false) end end --检测15日登陆活动预告是否显示 function this.FifteenNoticeShow() local id = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FifteenDayGiftNotice) if id and id > 0 then this.fifteenTip.gameObject:SetActive(true) local activityData=ActivityGiftManager.GetActivityInfoByType(id) if activityData then --local day=()/86400 local day=floor((activityData.endTime - GetTimeStamp())/86400) day=day+1 this.fifteenTipTxt.text=day.."天后开启" end else this.fifteenTip.gameObject:SetActive(false) end end function this.CreatActivity() for k,v in ipairs(activitys) do if not activityTabs[k] then activityTabs[k] = {} local root = this.RightUp if v.ListType == -1 then root = this.RightUp2Grid end activityTabs[k].go = newObjToParent(this.activityTabPrefab,root) activityTabs[k].img = Util.GetGameObject(activityTabs[k].go, "icon"):GetComponent("Image") activityTabs[k].timeImg = Util.GetGameObject(activityTabs[k].go, "Image_1") activityTabs[k].timeText = Util.GetGameObject(activityTabs[k].timeImg, "time"):GetComponent("Text") activityTabs[k].redpot = Util.GetGameObject(activityTabs[k].go, "redPoint") end activityTabs[k].go.gameObject.name = "tab"..v.Id activityTabs[k].go.gameObject:SetActive(false) if v.ShowTime == 0 or v.FunType == 94 then--特殊判断FunType == 94 超值基金 activityTabs[k].timeImg.gameObject:SetActive(false) else activityTabs[k].timeImg.gameObject:SetActive(true) end -- if v.RpType > 0 then -- --绑定新的红点 -- BindRedPointObject(v.RpType,activityTabs[k].redpot) -- end if v.ActiveType > 0 then local activityId = ActivityGiftManager.IsActivityTypeOpen(v.ActiveType) if activityId and activityId > 0 and ActivityGiftManager.IsQualifiled(v.ActiveType) and v.ActiveType ~= 42 then local tempConfig = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.ActivityGroups,"ActId",GlobalActConfig[activityId].ShowArt,"PageType",0,"ActiveType",v.ActiveType) if not tempConfig then tempConfig = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.ActivityGroups,"ActId",activityId,"PageType",0,"ActiveType",v.ActiveType) end if tempConfig then activityTabs[k].img.sprite = this.spLoader:LoadSprite(tempConfig.Icon[1]) else activityTabs[k].img.sprite = this.spLoader:LoadSprite(v.Icon[1]) end else activityTabs[k].img.sprite = this.spLoader:LoadSprite(v.Icon[1]) end else activityTabs[k].img.sprite = this.spLoader:LoadSprite(v.Icon[1]) end activityTabs[k].img:SetNativeSize() Util.AddOnceClick(activityTabs[k].go,function() if v.ActiveType > 0 then this:TabBtnAction(v.ActiveType,1,v) elseif v.FunType > 0 then this:TabBtnAction(v.FunType,2,v) else this:TabBtnAction(v.ActId,0,v) end end) end Game.GlobalEvent:DispatchEvent(GameEvent.PatFace.RefreshRightUp) end function this.RefreshLayer(showTab,k,v) if showTab then activityTabs[k].go.gameObject:SetActive(true) if v.ListType == -1 or activeSelfTabs[v.Sort] then return end activeSelfTabs[v.Sort] = {} activeSelfTabs[v.Sort].tab = activityTabs[k] activeSelfTabs[v.Sort].data = v else activityTabs[k].go.gameObject:SetActive(false) if not activeSelfTabs[v.Sort] then return end activeSelfTabs[v.Sort] = nil end local tempTabs = {} for k,v in pairs(activeSelfTabs) do table.insert(tempTabs,v) end table.sort(tempTabs,function(a,b) if a.data.ListType == b.data.ListType then return a.data.Sort < b.data.Sort else return a.data.ListType < b.data.ListType end end) for k,v in ipairs(tempTabs) do if v.data.ListType == 0 then v.tab.go.transform:SetSiblingIndex(k - 1) else v.tab.go.transform:SetSiblingIndex(v.data.ListType - 1) end end end local ySet = {[1] = 361 ,[2] = 512,[3] = 663,[4] = 814,[5] = 965 } --设置右侧条 function this.SetRightBarSize() this.RightUp2:SetActive(PlayerManager.level >= 5 and SERVER_VERSION == 0) local str = PlayerPrefs.GetInt(PlayerManager.uid.."MainRightBarSetting") if not str or str == 0 then this.RightUp2bgSize.sizeDelta = Vector3.New(180,320,0) this.RightUp2rectSize.sizeDelta = Vector3.New(180,220,0) this.RightUp2btnImg.rotation = Quaternion.Euler(Vector3.New(0,0,-90)) else local num = 0 for i = 1, this.RightUp2Grid.transform.childCount do if this.RightUp2Grid.transform:GetChild(i - 1).gameObject.activeInHierarchy then num = num + 1 end end local y = ySet[num] this.RightUp2bgSize.sizeDelta =Vector3.New(180,y,0) this.RightUp2rectSize.sizeDelta = Vector3.New(180,y,0) this.RightUp2btnImg.rotation = Quaternion.Euler(Vector3.New(0,0,90)) end Util.AddOnceClick(this.RightUp2btn.gameObject,function() local str2 = PlayerPrefs.GetInt(PlayerManager.uid.."MainRightBarSetting") if str2 == 0 then PlayerPrefs.SetInt(PlayerManager.uid.."MainRightBarSetting",1) --按钮旋转 DoTween.To(DG.Tweening.Core.DOGetter_float( function () return -90 end), DG.Tweening.Core.DOSetter_float(function (t) this.RightUp2btnImg.rotation = Quaternion.Euler(Vector3.New(0,0,t)) end), 90, 0.3):SetEase(Ease.Linear) --底图拉伸 DoTween.To(DG.Tweening.Core.DOGetter_float( function () return 220 end), DG.Tweening.Core.DOSetter_float(function (t) this.RightUp2rectSize.sizeDelta = Vector3.New(180,t,0) this.RightUp2bgSize.sizeDelta = Vector3.New(180,t + 100,0) end), this.RightUp2gridSize.sizeDelta.y, 0.3):SetEase(Ease.Linear) else PlayerPrefs.SetInt(PlayerManager.uid.."MainRightBarSetting",0) --按钮旋转 DoTween.To(DG.Tweening.Core.DOGetter_float( function () return 90 end), DG.Tweening.Core.DOSetter_float(function (t) this.RightUp2btnImg.rotation = Quaternion.Euler(Vector3.New(0,0,t)) end), -90, 0.3):SetEase(Ease.Linear) --底图拉伸 DoTween.To(DG.Tweening.Core.DOGetter_float( function () return this.RightUp2gridSize.sizeDelta.y end), DG.Tweening.Core.DOSetter_float(function (t) this.RightUp2rectSize.sizeDelta = Vector3.New(180,t,0) this.RightUp2bgSize.sizeDelta = Vector3.New(180,t + 100,0) end), 220, 0.3):SetEase(Ease.Linear) end end) end function this:TabBtnAction(id,actType,data) if actType == 1 then if id == ActivityTypeDef.FirstRecharge then UIManager.OpenPanel(UIName.FirstRechargePanel) elseif id == ActivityTypeDef.SevenDayCarnival then UIManager.OpenPanel(UIName.SevenDayCarnivalPanelV2,SevenDayCarnivalManager.GetPriorityDayNumber()) elseif id == ActivityTypeDef.WarPowerSort then UIManager.OpenPanel(UIName.WarPowerSortPanel) elseif id == ActivityTypeDef.DailyRecharge then UIManager.OpenPanel(UIName.DailyRechargePanel,id) elseif id == ActivityTypeDef.DemonSlayer then UIManager.OpenPanel(UIName.DemonSlayerPanel) elseif id == ActivityTypeDef.DemonSlayerNew then UIManager.OpenPanel(UIName.DemonSlayerNewPanel) elseif id == ActivityTypeDef.TreasureOfSomeBody then UIManager.OpenPanel(UIName.MissionDailyPanel,2,1) elseif id == ActivityTypeDef.TreasureStore then UIManager.OpenPanel(UIName.TreasureStorePopup) elseif id == ActivityTypeDef.TreasureStoreSeason2 then UIManager.OpenPanel(UIName.TreasureStoreSeason2) elseif id == ActivityTypeDef.DynamicAct then -- local dynamicAct = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.DynamicAct) -- local curindex = 1 -- if dynamicAct then -- curindex = GlobalActConfig[dynamicAct].ShowArt -- end -- -- LogBlue("当前选中页签0:"..curindex) -- UIManager.OpenPanel(UIName.DynamicActivityPanel) UIManager.OpenPanel(UIName.ActivityMainPanel,id) elseif id == ActivityTypeDef.SupremeHero then local actId = ActivityGiftManager.IsActivityTypeOpen(id) if actId == 42 then UIManager.OpenPanel(UIName.SupremeHeroPopup) else UIManager.OpenPanel(UIName.SupremeHeroPopupNew) end elseif id == ActivityTypeDef.NiuZhuan then UIManager.OpenPanel(UIName.NiuZhuanQianKunPanel) -- elseif id == ActivityTypeDef.NiuQi then -- UIManager.OpenPanel(UIName.NiuQiChongTianPanel) -- elseif id == ActivityTypeDef.FuXingGaoZhao then -- UIManager.OpenPanel(UIName.FuXingGaoZhaoPanel) elseif id == ActivityTypeDef.TaSuiLingXiao then UIManager.OpenPanel(UIName.TaSuiLingXiaoPanel) elseif id == ActivityTypeDef.lingLongBaoJing then UIManager.OpenPanel(UIName.ActivityMainPanel,id) elseif id == ActivityTypeDef.SurpriseBox then UIManager.OpenPanel(UIName.SurpriseBoxPanel) elseif id == ActivityTypeDef.ChaoFanRuSheng then UIManager.OpenPanel(UIName.ActivityMainPanel,id) elseif id == ActivityTypeDef.UpStarGift then UIManager.OpenPanel(UIName.ActivityMainPanel,id) elseif id == ActivityTypeDef.TeHuiShenZhuang then -- UIManager.OpenPanel(UIName.TeHuiShenZhuangPanel) UIManager.OpenPanel(UIName.ContinuePackagePanel,8601) elseif id == ActivityTypeDef.ShanHeShiLian then--山河试炼 UIManager.OpenPanel(UIName.FightLevelTrialPanel) elseif id == 78 then UIManager.OpenPanel(UIName.ActivityMainPanel,id) elseif id == ActivityTypeDef.lingLongBaoJing then UIManager.OpenPanel(UIName.ActivityMainPanel,id) elseif id == ActivityTypeDef.ContinuityRecharge then UIManager.OpenPanel(UIName.ActivityMainPanel,20014) elseif id == ActivityTypeDef.YuJianXing then --检查当前活动是否开启 local id = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.YuJianXing) NetManager.RidingSwardActivityRequest(id.activityId,function() if YuJianXingManager.curState ~= 0 then SwitchPanel.OpenPanel(UIName.YuJianXingPanel,nil,id) end end) elseif id == ActivityTypeDef.jingjishilian then UIManager.OpenPanel(UIName.ArenaTrialPanel) elseif id == ActivityTypeDef.chaozhifanli then UIManager.OpenPanel(UIName.PremiumRebatePanel) local day = TimeToD(GetTimeStamp()) PlayerPrefs.SetInt("chaozhifanli"..PlayerManager.uid,day) CheckRedPointStatus(RedPointType.chaozhifanli) elseif id == ActivityTypeDef.yunmenghaoli then UIManager.OpenPanel(UIName.DailyRechargePanel,id) elseif id == ActivityTypeDef.zhongzhichengcheng then UIManager.OpenPanel(UIName.ActivityMainPanel,id) end elseif actType == 2 then if id == FUNCTION_OPEN_TYPE.SERVER_START_GIFT then UIManager.OpenPanel(UIName.CourtesyDressPanel) elseif id == 36 then UIManager.OpenPanel(UIName.ActivityMainPanel,id) elseif id == FUNCTION_OPEN_TYPE.EXPERT then -- UIManager.OpenPanel(UIName.ExpertPanel) UIManager.OpenPanel(UIName.ActivityMainPanel,id) elseif id == 40 then UIManager.OpenPanel(UIName.ActivityMainPanel,id) elseif id == FUNCTION_OPEN_TYPE.LUCKYTURN then UIManager.OpenPanel(UIName.LuckyTurnTablePanel) elseif id == FUNCTION_OPEN_TYPE.Achiecement then UIManager.OpenPanel(UIName.AchievementPanel) elseif id == 72 then JumpManager.GoJump(75001) -- elseif id == FUNCTION_OPEN_TYPE.ARENA then -- UIManager.OpenPanel(UIName.ArenaTopMatchPanel) elseif id == 93 then UIManager.OpenPanel(UIName.UpGradePackagePanel) elseif id == 95 then UIManager.OpenPanel(UIName.TimeLimitSkinPanel) elseif id == FUNCTION_OPEN_TYPE.ChouJiangRukou then UIManager.OpenPanel(UIName.ActivityMainPanel,id) end else end end --界面打开时调用(用于子类重写) function this:OnShow() -- 音效 if isFirstOpen >= 2 then -- PlaySoundWithoutClick(SoundConfig.Sound_interface) end isFirstOpen = isFirstOpen + 1 isRefeshIcon = true timePressStarted = Time.realtimeSinceStartup SoundManager.PlayMusic(SoundConfig.BGM_Main) --刷新主城npc this:OnChangeTitleOrRideOrSkin() --检测主城六星入口是否显示 this.CheckSixStarGoShow() this.UpView:OnOpen({ showType = UpViewOpenType.ShowRight, panelType = PanelType.Main }) this.BtView:OnOpen(self, { sortOrder = self.sortingOrder, panelType = PanelTypeView.MainCity }) -- 刷新功能显示 this.InitFuncShow() this.RefreshActivityShow() this.RefreshFuncNewText() this.RefreshGiftBtnShow() -- 刷新一次编队战斗力 FormationManager.RefreshMainFormationPower() this.TimeFormat() if not this._TimeCounter then this._TimeCounter = Timer.New(this.TimeFormat, 1, -1, true) this._TimeCounter:Start() end -- if (AdventureManager.drop ~= nil and AdventureManager.offlineTime ~= 0) then if AdventureManager.isFirstEnterGetReward and #AdventureManager.drop.itemlist > 0 then UIManager.OpenPanel(UIName.AdventureProgressPopup) AdventureManager.isFirstEnterGetReward = false end end -- 开始定时刷新聊天数据 this.ChatTipView:StartCheck() -- 刷新拍脸 local patFaceAllData = PatFaceManager.GetPatFaceAllDataTabs() if patFaceAllData and #patFaceAllData <= 0 and not UIManager.IsOpen(UIName.PatFacePanel) then if FirstRechargeManager.IsShowFirstChatge() then FirstRechargeManager.PlayerPrefsSetStrItemId(1) --发送埋点数据 CustomEventManager.SendCustomEvents(FBSDKCustomEventType.FirstRecharge,0) UIManager.OpenPanel(UIName.FirstRechargePanel,nil,function() AdventureManager.GetIsMaxTime() end) else AdventureManager.GetIsMaxTime() end end this.RefreshShowPatPaceActivity() -- 设置主城小人名字 if self.playerView then self.playerView:SetName() end -- 检测公会tip GuildManager.CheckGuildTip() CheckRedPointStatus(RedPointType.RankingSort) if PlayerManager.IsGetFiveStarHero then --and OperatingManager.IsShowFiveStarPatch then Game.GlobalEvent:DispatchEvent(GameEvent.PatFace.PatFaceSend, FacePanelType.GrowGift, 5) PlayerManager.IsGetFiveStarHero = false end PlayerManager.StarBattleUpLvTipTime(1) this.battleUpLvTip:SetActive(false) --检测灵兽红点 PokemonManager.CheckRedPointStatusPokemonMainCityRed() --检测跨服天梯 JumpServerManager.CheckJumpServerhightLadderMainCityRedPoint() --检测鸿蒙碑红点 HarmonyManager.CheckRedPoinStatusUpTowerMainCityRed() --山河试炼红点 CheckRedPointStatus(RedPointType.FightLevelTrial) if addUpDateNum <= 0 then FixedUpdateBeat:Add(this.OnUpdate, self)--长按方法注册 addUpDateNum = addUpDateNum + 1 end YuJianXingManager.MakeRequest() -- Timer.New(function() -- if DynamicActivityManager.isopenJingjishilian and ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.jingjishilian) and ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.jingjishilian)> 0 then -- UIManager.OpenPanel(UIName.JingjishiLianPatface) -- DynamicActivityManager.isopenJingjishilian = false -- end -- end,0.5):Start() end -- function this.OnUpdate() --主城人物层级处理 this.OnMainPlayerNPCRefresh() this.CheckScreenRightRedPoint() end --检测屏幕右侧红点 local pos1=nil local pos2=nil function this.CheckScreenRightRedPoint() if UIManager.camera ==nil then return end if not this.btnPokemon then return end if not this.btnHomeLand then return end if not this.btnPokemon.gameObject then return end if not this.btnHomeLand.gameObject then return end if not this.btnPokemon.gameObject.transform then return end if not this.btnHomeLand.gameObject.transform then return end pos1=RectTransformUtility.WorldToScreenPoint(UIManager.camera,this.btnPokemon.transform.position) pos2=RectTransformUtility.WorldToScreenPoint(UIManager.camera,this.btnHomeLand.transform.position) if (pos1.x>Screen.width and RedpotManager.GetRedPointStatus(RedPointType.PokemonMainCity)==RedPointStatus.Show) then--or (pos2.x>Screen.width and RedpotManager.GetRedPointStatus(RedPointType.Vientiane)==RedPointStatus.Show) then this.jiantouObj:SetActive(true) else this.jiantouObj:SetActive(false) end end -- 刷新功能显示 function this.InitFuncShow(funcType) -- 需要显示隐藏的功能检测 if funcType then if this.btnFunHide[funcType] then ActTimeCtrlManager.SetFuncLockState(this.btnFunHide[funcType], funcType, false) return end else for i, v in pairs(this.btnFunHide) do ActTimeCtrlManager.SetFuncLockState(v, i, false) end end if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.Explore) then Util.SetGray(this.btnExplore,false) else Util.SetGray(this.btnExplore,true) end --(百宝斋,点将台,锻器阁,化虚坛,竞技场,四元阵,灵兽山,送神祠,万象境) if funcType then if funcType ~= FUNCTION_OPEN_TYPE.Explore then if this.operateIcon[funcType] then local isOpen = ActTimeCtrlManager.SingleFuncState(funcType) if funcType == FUNCTION_OPEN_TYPE.ENDLESS then isOpen = ActTimeCtrlManager.IsQualifiled(funcType) end Util.SetColor(this.operateIcon[funcType].lock, Color.New(1, 1, 1, 0.59)) this.operateIcon[funcType].lock:SetActive(not isOpen) this.operateIcon[funcType].open:SetActive(isOpen) return end else this.operateIcon[funcType].lock:SetActive(false) this.operateIcon[funcType].open:SetActive(false) return end else for i, v in pairs(this.operateIcon) do if i ~= FUNCTION_OPEN_TYPE.Explore then local isOpen = ActTimeCtrlManager.SingleFuncState(i) if i == FUNCTION_OPEN_TYPE.ENDLESS then isOpen = ActTimeCtrlManager.IsQualifiled(i) end v.lock:SetActive(not isOpen) Util.SetColor(v.lock, Color.New(1, 1, 1, 0.59)) v.open:SetActive(isOpen) else v.lock:SetActive(false) v.open:SetActive(false) end end end -- 精英怪按钮显隐设置 this.jingying:SetActive(EliteMonsterManager.HasEliteMonster()) this.yunyou:SetActive(ShopManager.IsActive(SHOP_TYPE.ROAM_SHOP)) this.RefreshFuncNewText() this.SetAnim() end function this.RefreshFuncNewText() for i, v in pairs(this.operateNewText) do --Log("当前ID是 === " .. i) v:SetActive(FunctionOpenMananger.GetModuleOpen(i)) end end -- 时间格式化 function this.TimeFormat() -- 如果逮到一个云游商人 local isRoamActive = ShopManager.IsActive(SHOP_TYPE.ROAM_SHOP) this.yunyou:SetActive(isRoamActive) if isRoamActive then local closeTime = ShopManager.GetShopCloseTime(SHOP_TYPE.ROAM_SHOP) if closeTime >= 0 then this.timeYunyou.text = TimeToMS(closeTime) end end -- 刷新精英怪 if this.jingying.activeSelf then local leftTime = EliteMonsterManager.GetLeftTime() this.eliteMonsterTimeText.text = TimeToMS(leftTime) if leftTime <= 0 then this.jingying:SetActive(false) end end --逐胜之巅 this.ZhuShengZhiDianBtn() for k,v in pairs(activitys) do local showTab = activityTabs[k].go.gameObject.activeSelf local ishow = DynamicActivityManager.IsQualifiled(v.Id) if ishow then if v.ActId == 666 then local giftList = {} giftList = OperatingManager.GetInfoList(v.ShopData) if #giftList > 0 then local time = giftList[1].endTime - GetTimeStamp() if time < 1 then OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, giftList[1].goodsId) showTab = false else showTab = true activityTabs[k].timeText.text = TimeToHMS(time) end else showTab = false end elseif v.ActId == 667 then local limitSkinGift = OperatingManager.GetTimeLimitSkinInfoList() if not limitSkinGift then showTab = false else local time = limitSkinGift.endTime - GetTimeStamp() if time > 0 then showTab = true activityTabs[k].timeText.text = TimeToFelaxible(time) local canGet = BagManager.GetTotalItemNum(1221) > 0 and BagManager.GetTotalItemNum(1222) > 0 and BagManager.GetTotalItemNum(1223) > 0 and BagManager.GetTotalItemNum(1224) > 0 activityTabs[k].redpot:SetActive(canGet) else showTab = false end end elseif v.ActId == 6301 then local ActData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.FuXingGaoZhao) if ActData then activityTabs[k].timeText.transform.parent.gameObject:SetActive(ActData.value == 0) showTab = ActData.value ~= 2 if ActData.value == 0 then local data = string.split(ConfigManager.GetConfigDataByKey(ConfigName.SpecialConfig,"Id",109).Value,"#") local time = ActData.startTime + tonumber(data[1])*86400 - GetTimeStamp() activityTabs[k].timeText.text = TimeToFelaxible(time) if time <= 0 then showTab = false end end else showTab = false end elseif v.ActId == 668 then local actInfo = ActivityGiftManager.GetActivityInfoByType(v.ActiveType) if actInfo and actInfo.value > 0 and (OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_128) or OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_328)) then showTab = true -- elseif OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_128) or OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_328) then -- showTab = true else showTab = false end elseif v.ShowTime == 1 and activityTabs[k].go.gameObject.activeSelf then if v.ActiveType > 0 then local QingLong = ActivityGiftManager.IsActivityTypeOpen(v.ActiveType) if QingLong and QingLong > 0 and ActivityGiftManager.IsQualifiled(v.ActiveType) then if v.ActiveType == 42 then if ActivityGiftManager.CheckSupremeMission(1,true) and ActivityGiftManager.CheckSupremeMission(2,true) and ActivityGiftManager.CheckSupremeMission(3,true) then showTab = false else local endTime = ActivityGiftManager.GetTaskEndTime(ActivityTypeDef.SupremeHero) if endTime - PlayerManager.serverTime > 0 then local time = endTime - PlayerManager.serverTime if time>= 86400 then activityTabs[k].timeText.text = TimeToDH(time) else activityTabs[k].timeText.text = TimeToHMS(time) end else showTab = false end end elseif v.ActiveType == ActivityTypeDef.TreasureStore then local endTime = CalculateSecondsNowTo_N_OClock(24) if endTime > 0 then if endTime >= 86400 then activityTabs[k].timeText.text = TimeToDH(endTime) else activityTabs[k].timeText.text = TimeToHMS(endTime) end else showTab = false end elseif v.FunType and v.FunType == 41 then showTab = DailyRechargeManager.GetDailyRechargeExist() else local info = ActivityGiftManager.GetActivityTypeInfo(v.ActiveType) local extraTime = 0 if ConfigManager.GetConfigDataByKey(ConfigName.GlobalActivity,"Type",v.ActiveType).GapTime and ConfigManager.GetConfigDataByKey(ConfigName.GlobalActivity,"Type",v.ActiveType).GapTime > 0 then extraTime = ConfigManager.GetConfigDataByKey(ConfigName.GlobalActivity,"Type",v.ActiveType).GapTime*86400 end local tempTime = info.endTime - GetTimeStamp() if tempTime - extraTime > 0 then activityTabs[k].timeText.text = TimeToFelaxible(tempTime - extraTime) elseif tempTime > 0 and tempTime < extraTime then activityTabs[k].timeText.text = TimeToFelaxible(tempTime) else showTab = false end end else showTab = false end -- elseif v.FunType == FUNCTION_OPEN_TYPE.ARENA then -- local isOpen = ActTimeCtrlManager.SingleFuncState(v.FunType) -- local baseInfo = ArenaTopMatchManager.GetBaseData() -- if not isOpen or not baseInfo or not baseInfo.battleStage or baseInfo.battleStage == TOP_MATCH_STAGE.OVER then -- showTab = false -- elseif baseInfo.battleStage == TOP_MATCH_STAGE.CLOSE then -- local startTime = ArenaTopMatchManager.GetTopMatchTime() -- local tempTime = startTime - PlayerManager.serverTime -- -- 当日五点开始显示 -- if tempTime > 0 and tempTime < 16 * 60 * 60 then -- showTab = true -- activityTabs[k].timeText.text = Language[11211]..TimeToHMS(tempTime) -- else -- showTab = false -- end -- else -- showTab = true -- activityTabs[k].timeText.text = Language[11212] -- end elseif v.FunType == 72 then local status = DeathPosManager.GetStatus() local endTime = DeathPosManager.GetOverTime() if not status or status == DeathPosStatus.Close or status == DeathPosStatus.Belated or status == DeathPosStatus.Reward then showTab = false else if endTime then local tempTime = endTime - PlayerManager.serverTime if tempTime and tempTime > 0 then activityTabs[k].timeText.text = Language[11213]..TimeToHMS(tempTime) activityTabs[k].timeImg:GetComponent("RectTransform").sizeDelta = Vector2.New(160, 60) showTab = true else showTab = false end else showTab = false end end else showTab = false end end else showTab = false end this.RefreshLayer(showTab,k,v) end -- 竖条显示放在按钮显示之后 this.SetRightBarSize() end --界面关闭时调用(用于子类重写) function this:OnClose() PlayerManager.StopBattleUpLvTipTime() this.ChatTipView:StopCheck() PatFaceManager.isLogin = false FixedUpdateBeat:Remove(this.OnUpdate, self) addUpDateNum = addUpDateNum - 1 -- 关闭界面时,关闭竖条显示 PlayerPrefs.SetInt(PlayerManager.uid.."MainRightBarSetting", 0) for k,v in ipairs(activitys) do if v.RpType > 0 then ClearRedPointObject(v.RpType,activityTabs[k].redpot) -- showTab = false) end end end --界面销毁时调用(用于子类重写) function this:OnDestroy() this.spLoader:Destroy() activityTabs = {} activitys = {} activeSelfTabs = {} SubUIManager.Close(this.UpView) SubUIManager.Close(this.BtView) SubUIManager.Close(this.ChatTipView) SubUIManager.Close(this.playerInfoView) this.playerInfoView = nil -- 清楚红点 this.ClearRedPoint() -- 计时器 if this._TimeCounter then this._TimeCounter:Stop() this._TimeCounter = nil end if this.timer then this.timer:Stop() this.timer = nil end -- 回收主城小人 for _, mpv in pairs(curNPCList) do mpv:Dispose() end curNPCList = {} self.playerView = nil end --更改姓名刷新 function this.RefreshChangeName() if (NameManager.GetRoleName() ~= "") then PlayerManager.nickName = NameManager.GetRoleName() end end -- 刷新一些购买活动的按钮限时 function this.RefreshGiftBtnShow() for k,v in pairs(activitys) do local ishow = DynamicActivityManager.IsQualifiled(v.Id) if v.ActiveType == 78 and ishow then local showTab = activityTabs[k].go.gameObject.activeSelf local actInfo = ActivityGiftManager.GetActivityInfoByType(v.ActiveType) if actInfo and actInfo.value > 0 and (OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_128) or OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_328)) then showTab = true -- elseif OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_128) or OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_328) then -- showTab = true else showTab = false end this.RefreshLayer(showTab,k,v) break end end end --后台推送 function this.RefreshActivityBtn(context) --LogGreen("context.type1 " .. context.type .. " " .. context.status) for k,v in ipairs(activitys) do local showTab = activityTabs[k].go.gameObject.activeSelf local ishow = DynamicActivityManager.IsQualifiled(v.Id) if ishow then if v.ActiveType > 0 and v.ActiveType == context.type then local activityId = ActivityGiftManager.IsActivityTypeOpen(v.ActiveType) if activityId and activityId > 0 and ActivityGiftManager.IsQualifiled(v.ActiveType) then if v.FunType and v.FunType == 41 then showTab = DailyRechargeManager.GetDailyRechargeExist() elseif v.ActiveType == ActivityTypeDef.yunmenghaoli then showTab = DailyRechargeManager.GetyunmengyouliExist() elseif v.ActiveType == 20000 then local tempConfig = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.ActivityGroups,"ActId",GlobalActConfig[activityId].ShowArt,"PageType",0,"ActiveType",v.ActiveType) if not tempConfig then tempConfig = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.ActivityGroups,"ActId",activityId,"PageType",0,"ActiveType",v.ActiveType) end if tempConfig then activityTabs[k].img.sprite = this.spLoader:LoadSprite(tempConfig.Icon[1]) end showTab = context.status == 1 elseif v.ActiveType == 78 then local actInfo = ActivityGiftManager.GetActivityInfoByType(v.ActiveType) if actInfo and actInfo.value > 0 and (OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_128) or OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_328)) then showTab = true -- elseif OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_128) or OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_328) then -- showTab = true else showTab = false end else showTab = context.status == 1 end else showTab = false end elseif v.FunType > 0 and v.FunType == context.type then if ActTimeCtrlManager.SingleFuncState(v.FunType) then if v.FunType and v.FunType == 41 then showTab = DailyRechargeManager.GetDailyRechargeExist() else showTab = context.status == 1 end else showTab = false end end else showTab = false end this.RefreshLayer(showTab,k,v) end isRefeshIcon = true end --客户端自己Show刷新 function this.RefreshActivityShow() --八日十五日登陆 this.RefreshEightGiftPreview() for k,v in ipairs(activitys) do local showTab = activityTabs[k].go.gameObject.activeSelf local ishow = DynamicActivityManager.IsQualifiled(v.Id) if ishow then if v.RpType > 0 then --绑定新的红点 BindRedPointObject(v.RpType,activityTabs[k].redpot) end if v.ActiveType < 1 and v.FunType < 1 then if v.ActId == 666 then --限时折扣 local giftList = {} giftList = OperatingManager.GetInfoList(v.ShopData) if #giftList > 0 then local time = giftList[1].endTime - GetTimeStamp() if time < 1 then OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, giftList[1].goodsId) showTab = false else showTab = true end else showTab = false end end elseif v.ActiveType > 0 then local activityId = ActivityGiftManager.IsActivityTypeOpen(v.ActiveType) if activityId and activityId > 0 and ActivityGiftManager.IsQualifiled(v.ActiveType) then if v.ActiveType == 42 then if ActivityGiftManager.CheckSupremeMission(1,true) and ActivityGiftManager.CheckSupremeMission(2,true) and ActivityGiftManager.CheckSupremeMission(3,true) then showTab = false else local endTime = ActivityGiftManager.GetTaskEndTime(ActivityTypeDef.SupremeHero) if endTime - PlayerManager.serverTime > 0 then showTab = true else showTab = false end end elseif v.FunType and v.FunType == 41 then showTab = DailyRechargeManager.GetDailyRechargeExist() elseif v.ActiveType == 78 then showTab = ActivityGiftManager.GetActivityValueInfo(v.ActiveType, activityId) > 0 or OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_128) or OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_328) else showTab = true end else showTab = false end elseif v.FunType > 0 then if ActTimeCtrlManager.SingleFuncState(v.FunType) then showTab = true else showTab = false end else showTab = false end else showTab = false end this.RefreshLayer(showTab,k,v) end end function this.RefreshShowPatPaceActivity() PatFaceManager.RefreshPatface() end -- 外敌数据变化检测主界面npc显示状态 function this.OnAlienListChanged() this.InitFuncShow(FUNCTION_OPEN_TYPE.FIGHT_ALIEN) end --八日十五日登录奖励预览 function this.RefreshEightGiftPreview() --八日 local state = false local getRewardState = ActivityGiftManager.sevenDayGetRewardState for i, v in pairs(getRewardState) do if (v == 0) then state = true end end if ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.EightDayGift) and state then this.RefreshSevenGiftPreview() this.sgBtn:SetActive(true) else this.sgBtn:SetActive(false) end this.FifteenNoticeShow() --十五日 if ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FifteenDayGift) then FifteenDayGiftManager.InitRewardData() local bool = FifteenDayGiftManager.CheckRedPoint() local IsGetAllReward = FifteenDayGiftManager.IsGetAllReward() if bool or not IsGetAllReward then this.fgBtn:SetActive(true) this.rpFifteenDayEffect:SetActive(true) CheckRedPointStatus(RedPointType.FifteenDayGift_1) else this.fgBtn:SetActive(false) this.rpFifteenDayEffect:SetActive(false) end else this.fgBtn:SetActive(false) this.rpFifteenDayEffect:SetActive(false) end if ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.qiandaohaoli) then this.FestevaBtn:SetActive(true) else this.FestevaBtn:SetActive(false) end end -- 八日登陆奖励预览 function this.RefreshSevenGiftPreview() --判断今日是否有可领取 local isHaveGift = ActivityGiftManager.CheckSevenDayRed() local curDay = math.ceil((CalculateSecondsNowTo_N_OClock(0) + GetTimeStamp() - PlayerManager.userCreateTime)/86400) local itemId=0 if isHaveGift then local haveGiftList=nil for j = 1, #ActivityGiftManager.sevenDayGetRewardState do if ActivityGiftManager.sevenDayGetRewardState[j]==0 and j<=curDay then if haveGiftList==nil then haveGiftList=ConfigManager.GetConfigDataByDoubleKey(ConfigName.ActivityRewardConfig,"ActivityId",56,"Sort",j) end end end itemId=haveGiftList.Reward[1][1] local Gift = ConfigManager.GetConfigDataByKey(ConfigName.ItemConfig,"Id",itemId) this.sgType.text=GetLanguageStrById(Gift.Name) this.sgInfo.text=Language[11214] this.sgEffect[1].gameObject:SetActive(false) this.sgEffect[2].gameObject:SetActive(true) else if (ActivityGiftManager.canRewardDay+1)>=9 then return end for i, v in pairs(ActivityGiftManager.sevenDayData) do if v.Id==curDay+1 then itemId= v.Reward[1][1] local Gift = ConfigManager.GetConfigDataByKey(ConfigName.ItemConfig,"Id",itemId) this.sgType.text=GetLanguageStrById(Gift.Name) break end end this.sgInfo.text=Language[11215] this.sgEffect[1].gameObject:SetActive(true) this.sgEffect[2].gameObject:SetActive(false) end this.sgItemView:OnOpen(false,{itemId,0},0.73) this.sgName.text=ConfigManager.GetConfigData(ConfigName.ItemConfig,itemId).Name end --逐胜之巅 function this.ZhuShengZhiDianBtn() local isOpen = ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.TOP_MATCH) local baseInfo = ArenaTopMatchManager.GetBaseData() if not isOpen or not baseInfo or not baseInfo.battleStage or baseInfo.battleStage == TOP_MATCH_STAGE.OVER then this.zhuShengBtn:SetActive(false) elseif baseInfo.battleStage == TOP_MATCH_STAGE.CLOSE then local tempTime = ArenaTopMatchManager.GetTopMatchTime() - PlayerManager.serverTime -- 当日五点开始显示 if tempTime > 0 and tempTime < 16 * 60 * 60 then this.zhuShengBtn:SetActive(true) this.zhuShengTime.text = Language[11211]..TimeToHMS(tempTime) else this.zhuShengBtn:SetActive(false) end else this.zhuShengBtn:SetActive(true) this.zhuShengTime.text = Language[11212] end end function this.RefreshBattleUpLvTip() this.battleUpLvTip:SetActive(true) end local roleRefreshNum = 0 function this.OnMainPlayerNPCRefresh() if roleRefreshNum < 20 then roleRefreshNum = roleRefreshNum + 1 elseif roleRefreshNum >= 20 and PlayerManager.MainPanelRoleMonveState then roleRefreshNum = 0 if curNPCList and #curNPCList > 0 then table.sort(curNPCList,function(a,b) return a.leader.transform.localPosition.y > b.leader.transform.localPosition.y end) for i = 1, #curNPCList do if curNPCList[i] then curNPCList[i].leader.transform:SetSiblingIndex(i) end end PlayerManager.MainPanelRoleMonveState = false end end 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 if self.playerView then for key, value in pairs(curNPCList) do if value == self.playerView then -- LogBlue("移除旧的 self.playerView") table.remove(curNPCList,key) end end -- LogBlue(":OnClose() :OnClose()") if self.playerView.NpcGO then self.playerView.NpcGO:OnClose() end if self.playerView then poolManager:UnLoadAsset("UI_MainPlayer",self.playerView.leader, PoolManager.AssetType.GameObject) self.playerView = nil end end self.playerView = MainPlayerView.New(true, this.btnClickMove, rect, Vector2.New(-1210, 0),nil,self.sortingOrder) table.insert(curNPCList,self.playerView) --角色点击行走 self.trigger.onPointerClick = self.trigger.onPointerClick + function(p, d) local x, v2 = RectTransformUtility.ScreenPointToLocalPointInRectangle(btnClickMoveTran, Input.mousePosition, UIManager.camera, nil) if not self.moveTween.enabled then local b1 = v2.x < rect.xMax and v2.x > rect.xMin and v2.y < rect.yMax and v2.y > rect.yMin if b1 then self.playerView:SetRolePos(v2) end end end PlayerManager.SetisRefreshMainPanelNpc(true) end return MainPanel