require("Base/BasePanel") require("Modules/Main/View/MainPlayerView") MainPanel = Inherit(BasePanel) local this = MainPanel local endTime = 0 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 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 = {} --初始化组件(用于子类重写) 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") ---------------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.btnHongMeng=Util.GetGameObject(self.gameObject,"RightDown/btnHongMeng") this.HongMengRedPoint = Util.GetGameObject(this.btnHongMeng,"redPoint") --六星前往 this.btnSixStarGo=Util.GetGameObject(self.gameObject,"LeftUp/GameObject/GameObject/sixStarHero") -------------------场景中的按钮------------------------ -- 按钮 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.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.btnColorfulWorld = Util.GetGameObject(this.gameObject, "scene/layer6/btnColorfulWorld") this.btnWaiDi:SetActive(false) 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.ENDLESS] = this:AddFuncItem(this.btnColorfulWorld, -1500), [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, 0), [FUNCTION_OPEN_TYPE.LUCKYTURN] = this:AddFuncItem(this.btnXingYunTanBao, 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.ENDLESS] = this:InsertNewText(this.btnColorfulWorld), [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),--幸运探宝 } -- 红点 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.rpColorfulWorld = Util.GetGameObject(this.btnColorfulWorld, "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")--幸运探宝 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") 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.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.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.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.RecruitPanel) end) this.ScenceBtnClick(FUNCTION_OPEN_TYPE.RECURITY) end) --元素招募 Util.AddClick(this.btnElementDrawCard, function() this.FunctionClickEvent(FUNCTION_OPEN_TYPE.ELEMENT_RECURITY, function () UIManager.OpenPanel(UIName.ElementDrawCardPanel) 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.btnColorfulWorld, function() if ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.ENDLESS) then -- PlayerManager.carbonType = 2 UIManager.OpenPanel(UIName.CarbonsPanel) else local config = ConfigManager.GetConfigData(ConfigName.GlobalSystemConfig,FUNCTION_OPEN_TYPE.ENDLESS) PopupTipPanel.ShowTip(string.format(Language[10279],config.OpenRules[2])) end this.ScenceBtnClick(FUNCTION_OPEN_TYPE.ENDLESS) 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 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 () -- body -- print(Language[12211]..HarmonyManager:HongMengTowerUpLimit()) if HarmonyManager:HongMengTowerUpLimit() > 0 then -- body 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) 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.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) 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.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) 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.FindFairy.RefreshBuyOpenState, 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.FindFairy.RefreshBuyOpenState, 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() FixedUpdateBeat:Add(this.OnUpdate, self)--长按方法注册 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 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 local ySet = {[1] = 361 ,[2] = 512,[3] = 663,[4] = 814,[5] = 965 } --设置右侧条 function this.SetRightBarSize() this.RightUp2:SetActive(PlayerManager.level >= 5) 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) elseif id == ActivityTypeDef.Pray then UIManager.OpenPanel(UIName.PrayMainPanel) elseif id == ActivityTypeDef.DemonSlayer then UIManager.OpenPanel(UIName.DemonSlayerPanel) elseif id == ActivityTypeDef.TreasureOfSomeBody then UIManager.OpenPanel(UIName.MissionDailyPanel,2,1) elseif id == ActivityTypeDef.TreasureStore then UIManager.OpenPanel(UIName.TreasureStorePopup) 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 UIManager.OpenPanel(UIName.SupremeHeroPopup) 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.SurpriseBox then UIManager.OpenPanel(UIName.SurpriseBoxPanel) elseif id == ActivityTypeDef.ChaoFanRuSheng then UIManager.OpenPanel(UIName.ActivityMainPanel,id) elseif id == ActivityTypeDef.TeHuiShenZhuang then UIManager.OpenPanel(UIName.TeHuiShenZhuangPanel) 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 == 94 then UIManager.OpenPanel(UIName.ActivityMainPanel,668) elseif id == 95 then UIManager.OpenPanel(UIName.TimeLimitSkinPanel) 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() --检测鸿蒙碑红点 HarmonyManager.CheckRedPoinStatusUpTowerMainCityRed() 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.btnColorfulWorld then return end if not this.btnPokemon.gameObject then return end if not this.btnColorfulWorld.gameObject then return end if not this.btnPokemon.gameObject.transform then return end if not this.btnColorfulWorld.gameObject.transform then return end pos1=RectTransformUtility.WorldToScreenPoint(UIManager.camera,this.btnPokemon.transform.position) pos2=RectTransformUtility.WorldToScreenPoint(UIManager.camera,this.btnColorfulWorld.transform.position) if (pos1.x>Screen.width and RedpotManager.GetRedPointStatus(RedPointType.PokemonMainCity)==RedPointStatus.Show) 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 funcType 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 for i, v in pairs(this.operateIcon) do 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) 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() -- 如果逮到一个云游商人 this.SetRightBarSize() 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 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) activityTabs[k].go.gameObject:SetActive(false) else activityTabs[k].go.gameObject:SetActive(true) activityTabs[k].timeText.text = TimeToHMS(time) end else activityTabs[k].go.gameObject:SetActive(false) end elseif v.ActId == 668 then -- 加入对月卡的判断 -- local isMonthCardActive = OperatingManager.IsMonthCardActive() local isOpen_128 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_128) local isOpen_328 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_328) activityTabs[k].go.gameObject:SetActive( (isOpen_128 or isOpen_328))--isMonthCardActive and -- if isMonthCardActive then local cardType = nil if isOpen_328 then cardType = GoodsTypeDef.MONTHCARD_328 end if not cardType and isOpen_128 then cardType = GoodsTypeDef.MONTHCARD_128 end if cardType then local data = OperatingManager.GetGiftGoodsInfo(cardType) if data then local time = data.endTime - PlayerManager.serverTime if time < 1 then activityTabs[k].go.gameObject:SetActive(false) else activityTabs[k].go.gameObject:SetActive(true) if OperatingManager.GetGoodsBuyTime(GoodsTypeDef.MONTHCARD_128) > 0 and OperatingManager.GetGoodsBuyTime(GoodsTypeDef.MONTHCARD_328) > 0 then activityTabs[k].timeImg.gameObject:SetActive(false) elseif time >= 86400 then activityTabs[k].timeText.text = TimeToDH(time) else activityTabs[k].timeText.text = TimeToHMS(time) end end end end -- end elseif v.ActId == 667 then local limitSkinGift = OperatingManager.GetTimeLimitSkinInfoList() if not limitSkinGift then activityTabs[k].go.gameObject:SetActive(false) else local time = limitSkinGift.endTime - GetTimeStamp() if time > 0 then activityTabs[k].go.gameObject:SetActive(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 activityTabs[k].go.gameObject:SetActive(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) activityTabs[k].go.gameObject:SetActive(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 activityTabs[k].go.gameObject:SetActive(false) end end else activityTabs[k].go.gameObject:SetActive(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.GetRewardState(42)~=3 then 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 activityTabs[k].go.gameObject:SetActive(false) end else activityTabs[k].go.gameObject:SetActive(false) supremHadSet = true 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 activityTabs[k].go.gameObject:SetActive(false) end elseif v.FunType and v.FunType == 41 then activityTabs[k].go.gameObject:SetActive(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 activityTabs[k].go.gameObject:SetActive(false) end end else activityTabs[k].go.gameObject:SetActive(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 -- activityTabs[k].go.gameObject:SetActive(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 -- activityTabs[k].go.gameObject:SetActive(true) -- activityTabs[k].timeText.text = Language[11211]..TimeToHMS(tempTime) -- else -- activityTabs[k].go.gameObject:SetActive(false) -- end -- else -- activityTabs[k].go.gameObject:SetActive(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 activityTabs[k].go.gameObject:SetActive(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].go.gameObject:SetActive(true) else activityTabs[k].go.gameObject:SetActive(false) end else activityTabs[k].go.gameObject:SetActive(false) end end else activityTabs[k].go.gameObject:SetActive(false) end end else activityTabs[k].go.gameObject:SetActive(false) end end end --界面关闭时调用(用于子类重写) function this:OnClose() PlayerManager.StopBattleUpLvTipTime() this.ChatTipView:StopCheck() PatFaceManager.isLogin = false FixedUpdateBeat:Remove(this.OnUpdate, self) PlayerPrefs.SetInt(PlayerManager.uid.."MainRightBarSetting",0) for k,v in ipairs(activitys) do if v.RpType > 0 then ClearRedPointObject(v.RpType,activityTabs[k].redpot) -- activityTabs[k].go.gameObject:SetActive(false) end end end --界面销毁时调用(用于子类重写) function this:OnDestroy() this.spLoader:Destroy() activityTabs = {} activitys = {} 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.ActId == 668 and ishow then -- 加入对月卡的判断 -- local isMonthCardActive = OperatingManager.IsMonthCardActive() local isOpen_128 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_128) local isOpen_328 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_328) activityTabs[k].go.gameObject:SetActive( (isOpen_128 or isOpen_328))--isMonthCardActive and end end end --后台推送 function this.RefreshActivityBtn(context) --LogGreen("context.type1 " .. context.type .. " " .. context.status) for k,v in ipairs(activitys) do 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 activityTabs[k].go.gameObject:SetActive(DailyRechargeManager.GetDailyRechargeExist()) 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 activityTabs[k].go.gameObject:SetActive(context.status == 1) else activityTabs[k].go.gameObject:SetActive(context.status == 1) end else activityTabs[k].go.gameObject:SetActive(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 activityTabs[k].go.gameObject:SetActive(DailyRechargeManager.GetDailyRechargeExist()) else activityTabs[k].go.gameObject:SetActive(context.status == 1) end else activityTabs[k].go.gameObject:SetActive(false) end end else activityTabs[k].go.gameObject:SetActive(false) end end isRefeshIcon = true end --客户端自己Show刷新 function this.RefreshActivityShow() --八日十五日登陆 this.RefreshEightGiftPreview() for k,v in ipairs(activitys) do 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) activityTabs[k].go.gameObject:SetActive(false) else activityTabs[k].go.gameObject:SetActive(true) end else activityTabs[k].go.gameObject:SetActive(false) end elseif v.ActId == 668 then --超值基金 -- 加入对月卡的判断 -- local isMonthCardActive = OperatingManager.IsMonthCardActive() local isOpen_128 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_128) local isOpen_328 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_328) activityTabs[k].go.gameObject:SetActive( (isOpen_128 or isOpen_328))--isMonthCardActive and -- if isMonthCardActive then local cardType = nil if isOpen_328 then cardType = GoodsTypeDef.MONTHCARD_328 end if not cardType and isOpen_128 then cardType = GoodsTypeDef.MONTHCARD_328 end if cardType then local data = OperatingManager.GetGiftGoodsInfo(cardType) if data then local time = data.endTime - PlayerManager.serverTime if time < 1 then activityTabs[k].go.gameObject:SetActive(false) else activityTabs[k].go.gameObject:SetActive(true) end end end -- 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.GetRewardState(42) ~= 3 then local endTime = ActivityGiftManager.GetTaskEndTime(ActivityTypeDef.SupremeHero) if endTime - PlayerManager.serverTime > 0 then activityTabs[k].go.gameObject:SetActive(true) else activityTabs[k].go.gameObject:SetActive(false) end else activityTabs[k].go.gameObject:SetActive(false) end elseif v.FunType and v.FunType == 41 then activityTabs[k].go.gameObject:SetActive(DailyRechargeManager.GetDailyRechargeExist()) else activityTabs[k].go.gameObject:SetActive(true) end else activityTabs[k].go.gameObject:SetActive(false) end elseif v.FunType > 0 then if ActTimeCtrlManager.SingleFuncState(v.FunType) then activityTabs[k].go.gameObject:SetActive(true) else activityTabs[k].go.gameObject:SetActive(false) end else activityTabs[k].go.gameObject:SetActive(false) end else activityTabs[k].go.gameObject:SetActive(false) end 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 --十五日 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 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.ARENA) 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 -- LogRed("PlayerManager.MainPanelRoleMonveState "..tostring(PlayerManager.MainPanelRoleMonveState)) 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