miduo_client/Assets/ManagedResources/~Lua/Modules/Main/MainPanel.lua

1811 lines
77 KiB
Lua

require("Base/BasePanel")
require("Modules/Main/View/MainPlayerView")
MainPanel = Inherit(BasePanel)
local this = MainPanel
--local isPassChapter = {}
local endTime = 0
-- local GHZ_STAGE_IMAGE ={
-- [GUILD_FIGHT_STAGE.DEFEND] = "r_zjm_zhanbz",
-- [GUILD_FIGHT_STAGE.MATCHING] = "r_zjm_zhanpzz",
-- [GUILD_FIGHT_STAGE.COUNTING] = "r_zjm_zhanjjz",
-- }
--示意图轮回放
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 isCanDragMsg = true
local supremHadSet = false
local isUpperMonthCardTimeShow = true
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
--初始化组件(用于子类重写)
function this:InitComponent()
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")
this.heroTeamPowerBtn = Util.GetGameObject(self.gameObject, "LeftUp/powerBtn")
this.heroTeamPower = Util.GetGameObject(self.gameObject, "LeftUp/powerBtn/value"):GetComponent("Text")
---------------topLeftPart----------------
--headBox
this.level = Util.GetGameObject(self.gameObject, "LeftUp/headBox/lvFrame/lv"):GetComponent("Text")
this.playName = Util.GetGameObject(self.gameObject, "LeftUp/headBox/name"):GetComponent("Text")
this.expSliderValue = Util.GetGameObject(self.gameObject, "LeftUp/headBox/exp"):GetComponent("Slider")
this.expSliderValue.transform.localScale = Vector3.New(UIManager.adapterScale, 1, 1)
this.headBox = Util.GetGameObject(self.gameObject, "LeftUp/headBox")
this.headPos = Util.GetGameObject(self.gameObject, "LeftUp/headBox/headpos")
this.headRedpot = Util.GetGameObject(self.gameObject, "LeftUp/headBox/redpot")
-- 七日登陆奖励预览入口
this.sgBtn=Util.GetGameObject(self.gameObject,"LeftUp/sevenGift")
this.sgRoot=Util.GetGameObject(this.sgBtn,"root")
this.sgItemView = SubUIManager.Open(SubUIConfig.ItemView,this.sgRoot.transform)
this.sgType=Util.GetGameObject(this.sgBtn,"type"):GetComponent("Text")
this.sgName=Util.GetGameObject(this.sgBtn,"name"):GetComponent("Text")
this.sgInfo=Util.GetGameObject(this.sgBtn,"info"):GetComponent("Text")
this.sgEffect={}
for i = 1, 2 do
this.sgEffect[i]=Util.GetGameObject(this.sgBtn,"effect/effect"..i)
end
effectAdapte(Util.GetGameObject(this.sgEffect[2], "ziti mask (1)"))
-- 一堆的小活动
this.rightUpRoot = Util.GetGameObject(self.gameObject, "RightUp")
this.rightUpRoot.transform.localScale = Vector3.one * UIManager.adapterScale
-- 充值
this.rechargeBtn = Util.GetGameObject(self.gameObject, "RightUp/recharge")
this.rechargeRedPoint = Util.GetGameObject(this.rechargeBtn, "redPoint")
-- 福利
this.packageGiftBtn = Util.GetGameObject(self.gameObject, "RightUp/packageGift")
this.packageGiftRedPoint = Util.GetGameObject(this.packageGiftBtn, "redPoint")
-- 首充
this.firstRechargeBtn = Util.GetGameObject(self.gameObject, "RightUp/firstRecharge")
this.firstRechargeRedPoint = Util.GetGameObject(this.firstRechargeBtn, "redPoint")
-- 七日狂欢
this.sevenDayCarnivalBtn = Util.GetGameObject(self.gameObject, "RightUp/sevenDay")
this.SevenDayStage1 = Util.GetGameObject(self.sevenDayCarnivalBtn, "stage1")
this.SevenDayStage2 = Util.GetGameObject(self.sevenDayCarnivalBtn, "stage2")
this.sevenDayCarnivalRedPoint = Util.GetGameObject(this.sevenDayCarnivalBtn, "redPoint")
-- 每日首充
this.dailyRechargeBtn = Util.GetGameObject(self.transform, "RightUp/dailyRecharge")
this.dailyRechargeRedPoint = Util.GetGameObject(this.dailyRechargeBtn, "redPoint")
--月基金
this.upperMonthCardBtn=Util.GetGameObject(self.transform,"RightUp/upperMonthCardBtn")
this.upperMonthCardRedPoint = Util.GetGameObject(this.upperMonthCardBtn, "redPoint")
this.upperMonthCardTimeBg = Util.GetGameObject(this.upperMonthCardBtn, "Image_1")
this.upperMonthCardTime = Util.GetGameObject(this.upperMonthCardBtn, "time"):GetComponent("Text")
--限时折扣
this.upGradePackageBtn = Util.GetGameObject(self.transform,"RightUp/upGradePackageBtn")
this.upGradePackageTime = Util.GetGameObject(this.upGradePackageBtn, "time"):GetComponent("Text")
--百宝商会
this.treasureStoreBtn=Util.GetGameObject(self.transform,"RightUp/treasureStoreBtn")
this.treasureStoreRedPoint=Util.GetGameObject(this.treasureStoreBtn,"redPoint")
---- 招财猫
--this.luckyCatBtn = Util.GetGameObject(self.gameObject, "RightUp/luckyCat")
--this.luckyCatRedPoint = Util.GetGameObject(self.gameObject, "RightUp/luckyCat/redPoint")
-- 开服有礼
this.courtesyDress = Util.GetGameObject(self.gameObject, "RightUp/sevenDayGift")
--开服有礼红点
this.courtesyDressRedPoint = Util.GetGameObject(this.courtesyDress, "sevenDayRedPoint")
-- 云梦祈福
this.paryGift = Util.GetGameObject(self.gameObject, "RightUp/paryGift")
this.paryGiftTime = Util.GetGameObject(self.gameObject, "RightUp/paryGift/time"):GetComponent("Text")
-- 战力排行
this.warPowerSort = Util.GetGameObject(self.gameObject, "RightUp/warPowerSort")
this.warPowerSortRedPoint = Util.GetGameObject(this.warPowerSort, "chapterRedPoint")
-- 限时活动
this.expert = Util.GetGameObject(self.gameObject, "RightUp/expert")
this.expertRedPoint = Util.GetGameObject(this.expert, "chapterRedPoint")
-- 孙龙宝藏
this.treasureOfSl = Util.GetGameObject(self.gameObject, "RightUp/treasureOfSl")
this.treasureOfSlRedPoint = Util.GetGameObject(this.treasureOfSl, "redPoint")
this.treasureOfSlText = Util.GetGameObject(this.treasureOfSl, "time"):GetComponent("Text")
-- 问卷
this.questionnaireBtn = Util.GetGameObject(self.gameObject, "RightUp/questionnaire")
--东海寻仙
this.findFairyBtn=Util.GetGameObject(self.gameObject,"RightUp/findFairy")
this.findFairyRedPoint = Util.GetGameObject(this.findFairyBtn, "redPoint")
--幸运转盘
this.luckyTurnBtn=Util.GetGameObject(self.gameObject,"RightUp/luckyTurn")
this.luckyTurnRedPoint=Util.GetGameObject(this.luckyTurnBtn,"redPoint")
-- 十绝阵
this.isDeathPosShow = nil
this.deathPosBtn = Util.GetGameObject(self.gameObject,"RightUp/deathPos")
this.deathPosTime = Util.GetGameObject(self.gameObject,"RightUp/deathPos/time"):GetComponent("Text")
-- 巅峰赛
this.isTopMatchShow = nil
this.topMatchBtn=Util.GetGameObject(self.gameObject,"RightUp/topMatch")
this.topMatchTime = Util.GetGameObject(self.gameObject,"RightUp/topMatch/time"):GetComponent("Text")
--远征
--this.expeditionBtn=Util.GetGameObject(self.gameObject,"RightUp/expedition")
--this.expeditionRedPoint=Util.GetGameObject(this.expeditionBtn,"redPoint")
--成就
this.AchievementBtn=Util.GetGameObject(self.gameObject,"RightUp/Achievement")
this.AchievementBtn:SetActive(false)
--this.AchievementRedPoint=Util.GetGameObject(this.AchievementBtn,"redPoint")
-- 特权
this.vipPrivilegeBtn = Util.GetGameObject(self.gameObject, "LeftUp/vipPrivilege/vipPrivilegeBtn")
this.vipLevelText = Util.GetGameObject(this.vipPrivilegeBtn, "bg/vip"):GetComponent("Image")
this.vipRedPoint = Util.GetGameObject(self.gameObject, "LeftUp/vipPrivilege/redPoint")
screenAdapte(this.vipPrivilegeBtn)
---------------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.btnSet = Util.GetGameObject(self.gameObject, "LeftDown/btnRoot/btnSetting")
--this.setRed = Util.GetGameObject(this.btnSet, "redPoint")
-------------------场景中的按钮------------------------
-- 按钮
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.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.operateIcon = {
[FUNCTION_OPEN_TYPE.SHOP] = this:AddFuncItem(this.btnShangdian, 50),
-- [FUNCTION_OPEN_TYPE.ALLRANKING] = this:AddFuncItem(this.btnPaihangbang, -2715),
-- [FUNCTION_OPEN_TYPE.ASPECT_STAR] = this:AddFuncItem(this.btnGuanxing, -2715),
[FUNCTION_OPEN_TYPE.HERO_RESOLVE] = this:AddFuncItem(this.btnFenjie, -200),
--[FUNCTION_OPEN_TYPE.HAND_BOOK] = this:AddFuncItem(this.btnTujian,-2715),
[FUNCTION_OPEN_TYPE.ARENA] = this:AddFuncItem(this.btnJingjichang, -200),
[FUNCTION_OPEN_TYPE.ENDLESS] = this:AddFuncItem(this.btnColorfulWorld, -1000),
-- [FUNCTION_OPEN_TYPE.MONSTER_COMING] = this:AddFuncItem(this.btnMonster, -110),
-- [FUNCTION_OPEN_TYPE.EXPEDITION] = this:AddFuncItem(this.btnExpedition, -110),
[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.SECRETBOX] = this:AddFuncItem(this.btnSecretBox, 0),
-- [FUNCTION_OPEN_TYPE.TALENT_TREE] = this:AddFuncItem(this.btnTianFu, -1179),
-- [FUNCTION_OPEN_TYPE.DIFFER_DEMONS] = this:AddFuncItem(this.btnYiYao, 0),
-- [FUNCTION_OPEN_TYPE.FIGHT_ALIEN] = this:AddFuncItem(this.btnWaiDi, 0),
[FUNCTION_OPEN_TYPE.COMPOUND_HERO] = this:AddFuncItem(this.btnCompoundHero, 0),--神将合成、置换
}
this.operateNewText = {
[FUNCTION_OPEN_TYPE.SHOP] = this:InsertNewText(this.btnShangdian),
-- [FUNCTION_OPEN_TYPE.ALLRANKING] = this:InsertNewText(this.btnPaihangbang),
-- [FUNCTION_OPEN_TYPE.ASPECT_STAR] = this:InsertNewText(this.btnGuanxing),
[FUNCTION_OPEN_TYPE.HERO_RESOLVE] = this:InsertNewText(this.btnFenjie),
--[FUNCTION_OPEN_TYPE.HAND_BOOK] = this:InsertNewText(this.btnTujian),
[FUNCTION_OPEN_TYPE.ARENA] = this:InsertNewText(this.btnJingjichang),
[FUNCTION_OPEN_TYPE.ENDLESS] = this:InsertNewText(this.btnColorfulWorld),
-- [FUNCTION_OPEN_TYPE.MONSTER_COMING] = this:InsertNewText(this.btnMonster),
--[FUNCTION_OPEN_TYPE.EXPEDITION] = this:InsertNewText(this.btnExpedition),
[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.SECRETBOX] = this:InsertNewText(this.btnSecretBox),
-- [FUNCTION_OPEN_TYPE.TALENT_TREE] = this:InsertNewText(this.btnTianFu),
-- [FUNCTION_OPEN_TYPE.DIFFER_DEMONS] = this:InsertNewText(this.btnYiYao),
-- [FUNCTION_OPEN_TYPE.FIGHT_ALIEN] = this:InsertNewText(this.btnWaiDi),
[FUNCTION_OPEN_TYPE.COMPOUND_HERO] = this:InsertNewText(this.btnCompoundHero),--神将合成、置换
}
-- 红点
this.rpShangdian = Util.GetGameObject(this.btnShangdian, "redPoint")
this.rpJingjichang = Util.GetGameObject(this.btnJingjichang, "redPoint")
this.rpExpedition = Util.GetGameObject(this.btnExpedition, "redPoint")
--this.rpMijing = Util.GetGameObject(this.btnMijing, "redPoint")
--this.rpGuShi = Util.GetGameObject(this.btnGuShi, "redPoint") -- 暂时没用的
--this.rpMonster = Util.GetGameObject(this.btnMonster, "redPoint")
--this.rpZhaomu = Util.GetGameObject(this.btnZhaomu, "redPoint")
-- this.rpGonghui = Util.GetGameObject(this.btnGonghui, "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.rpTianFu = Util.GetGameObject(this.btnTianFu, "redPoint")
--this.rpXuezhandaodi = Util.GetGameObject(this.btnXuezhandaodi, "redPoint")
--this.rpFenjie = Util.GetGameObject(this.btnFenjie, "redPoint")
--this.rpTujian = Util.GetGameObject(this.btnTujian, "redPoint")
--this.rpPaihangbang = Util.GetGameObject(this.btnPaihangbang, "redPoint")
--this.rpGuanxing = Util.GetGameObject(this.btnGuanxing, "redPoint")
this.rpAlien = Util.GetGameObject(this.btnWaiDi, "redPoint")
this.rpColorfulWorld = Util.GetGameObject(this.btnColorfulWorld, "redPoint")
this.rpCompoundHero = Util.GetGameObject(this.btnCompoundHero, "redPoint")--神将合成、置换
this.BtView = SubUIManager.Open(SubUIConfig.BtView, self.transform)
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.transform)
-- this.HorseRaceLampView = SubUIManager.Open(SubUIConfig.HorseRaceLampView, self.transform)
this.ChatTipView = SubUIManager.Open(SubUIConfig.ChatTipView, self.transform, 1)
--this.RefreshChangeName()
----==================== 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.gonghuizhan = Util.GetGameObject(this.npcRoot, "npcGonghuizhan")
--this.btnGonghuizhan = Util.GetGameObject(this.gonghuizhan, "button")
--this.timeGonghuizhan = Util.GetGameObject(this.gonghuizhan, "time"):GetComponent("Text")
--this.rpGonghuizhan = Util.GetGameObject(this.btnGonghuizhan, "redPoint")
--poolManager:LoadLive("live2d_r_Map_NewEvent_015", Util.GetTransform(this.gonghuizhan, "liveRoot"), Vector3.one, Vector3.zero)
-- this.GHZStageImage = Util.GetGameObject(this.btnGonghui, "stageEffect/Image"):GetComponent("Image")
-- this.GHZStageAttackEffect = Util.GetGameObject(this.btnGonghui, "stageEffect/fight")
-- this.isGHZShow = false
-- this.GHZ_Stage = nil
-- 外敌
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")
--poolManager:LoadLive("live2d_r_Map_NewEvent_015", Util.GetTransform(this.alienNPC, "liveRoot"), Vector3.one, Vector3.zero)
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.mainTask = Util.GetGameObject(self.gameObject, "RightDown/mainTask")
this.titleText = Util.GetGameObject(self.gameObject, "RightDown/mainTask/progressLayout/titleText"):GetComponent("Text")
this.progressText = Util.GetGameObject(self.gameObject, "RightDown/mainTask/progressLayout/progressText"):GetComponent("Text")
this.getRewardButton = Util.GetGameObject(self.gameObject, "RightDown/mainTask/getRewardButton")
this.mainTaskGRewardImage = Util.GetGameObject(self.gameObject, "RightDown/mainTask/getRewardButton/getRewardImage")
this.mainTaskJumpImage = Util.GetGameObject(self.gameObject, "RightDown/mainTask/getRewardButton/jumpImage")
this.mainTask:SetActive(false)-- 删除
this.GuideEffectGo = poolManager:LoadAsset("GuideEffect", PoolManager.AssetType.GameObject)
this.GuideEffectGo.transform:SetParent(this.mainTaskGRewardImage.transform)
this.GuideEffectGo.transform.localPosition = Vector3.zero
this.GuideEffectGo.transform.localScale = Vector3.one
Util.GetGameObject(this.GuideEffectGo, "GameObject"):SetActive(false)
this.GuideJumpEffectGo = poolManager:LoadAsset("GuideEffect", PoolManager.AssetType.GameObject)
this.GuideJumpEffectGo.transform:SetParent(this.mainTaskJumpImage.transform)
this.GuideJumpEffectGo.transform.localPosition = Vector3.zero
this.GuideJumpEffectGo.transform.localScale = Vector3.one
Util.GetGameObject(this.GuideJumpEffectGo, "GameObject"):SetActive(false)
this.GuideJumpEffectGo:SetActive(false)
this.btnFunHide[FUNCTION_OPEN_TYPE.DAILY_TASK] = this.btnDailyMission
this.btnFunHide[FUNCTION_OPEN_TYPE.PRAY] = this.paryGift
this.btnFunHide[FUNCTION_OPEN_TYPE.SUNLONG] = this.treasureOfSl
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.btnFunGray[FUNCTION_OPEN_TYPE.NORMALCARBON] = this.btnFuBen
--this.btnFunGray[FUNCTION_OPEN_TYPE.MONSTER_COMING] = this.btnMonster
--this.btnFunGray[FUNCTION_OPEN_TYPE.ADVENTURE] = this.btnMijing
--this.btnFunGray[FUNCTION_OPEN_TYPE.RECURITY] = this.btnZhaomu
--this.btnFunGray[FUNCTION_OPEN_TYPE.ARENA] = this.btnJingjichang
--this.btnFunGray[FUNCTION_OPEN_TYPE.GUILD] = this.btnGonghui
--this.btnFunGray[FUNCTION_OPEN_TYPE.BLOODY_BATTLE] = this.btnXuezhandaodi
--this.btnFunGray[FUNCTION_OPEN_TYPE.HERO_RESOLVE] = this.btnFenjie
--this.btnFunGray[FUNCTION_OPEN_TYPE.HAND_BOOK] = this.btnTujian
--this.btnFunGray[FUNCTION_OPEN_TYPE.SHOP] = this.btnShangdian
--this.btnFunGray[FUNCTION_OPEN_TYPE.ALLRANKING] = this.btnPaihangbang
--this.btnFunGray[FUNCTION_OPEN_TYPE.ASPECT_STAR] = this.btnGuanxing
--this.btnFunGray[FUNCTION_OPEN_TYPE.RECURITY] = this.btnRecruit
--this.btnFunGray[FUNCTION_OPEN_TYPE.ELEMENT_RECURITY] = this.btnElementDrawCard
--this.btnFunGray[FUNCTION_OPEN_TYPE.SECRETBOX] = this.btnSecretBox
-- 隱藏秘境
--this.btnMijing:SetActive(false)
--跑马灯
--this.horseRaceLamp = Util.GetGameObject(self.gameObject, "horseRaceLamp")
--this.titleInfo = Util.GetGameObject(self.gameObject, "horseRaceLamp/bgImage/mask/titleInfo")
--this.horseMask = Util.GetGameObject(self.gameObject, "horseRaceLamp/bgImage/mask")
this.animRoot = Util.GetGameObject(self.gameObject, "scene")
this.btnSupreme = Util.GetGameObject(self.gameObject, "RightUp/supreme")
this.supremeRedPoint = Util.GetGameObject(this.btnSupreme, "redPoint")
this.supremeTime = Util.GetGameObject(this.btnSupreme, "time"):GetComponent("Text")
this.btnUpGradePackage = Util.GetGameObject(self.gameObject, "RightUp/upGradePackageBtn")--升级限时礼包
this.btnDynamicActivity = Util.GetGameObject(self.gameObject, "RightUp/dynamicActivity")
this.DynamicActivityRedPoint = Util.GetGameObject(this.btnDynamicActivity, "redPoint")
this.DynamicActivityTime = Util.GetGameObject(this.btnDynamicActivity, "time"):GetComponent("Text")--
this.battleUpLvTip = Util.GetGameObject(self.gameObject, "LeftDown/battleUpLvTip")
Util.GetGameObject(self.gameObject, "LeftDown/battleUpLvTip/Text"):GetComponent("Text").text = Language[12390]
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()
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, -1000, 50), av2.y)
if v2.x + av2.x < -1000 or v2.x + av2.x > 50 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
self.playerView = MainPlayerView.New(true, this.btnClickMove, rect, Vector2.New(-1210, 0))
--角色点击行走
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
--GM工具
Util.AddClick(this.headBox, function()
if AppConst.isOpenGM then
UIManager.OpenPanel(UIName.GMPanel)
else
UIManager.OpenPanel(UIName.SettingPanel)
end
end)
Util.AddClick(this.questionnaireBtn, function()
QuestionnaireManager.OpenQuestionnairePanel()
end)
-- 充值按钮
Util.AddClick(this.rechargeBtn, function()
-- if not ShopManager.IsActive(SHOP_TYPE.SOUL_STONE_SHOP) then
-- PopupTipPanel.ShowTip("商店暂未开放")
-- return
-- end
-- UIManager.OpenPanel(UIName.MainShopPanel, SHOP_TYPE.SOUL_STONE_SHOP)
UIManager.OpenPanel(UIName.MainRechargePanel)
end)
--礼包
Util.AddClick(this.packageGiftBtn, function()
UIManager.OpenPanel(UIName.OperatingPanel)
end)
--特权
Util.AddClick(this.vipPrivilegeBtn, function()
UIManager.OpenPanel(UIName.VipPanelV2)
end)
--首充
Util.AddClick(this.firstRechargeBtn, function()
UIManager.OpenPanel(UIName.FirstRechargePanel)
end)
--七日狂欢
Util.AddClick(this.sevenDayCarnivalBtn, function()
UIManager.OpenPanel(UIName.SevenDayCarnivalPanelV2,SevenDayCarnivalManager.GetPriorityDayNumber())
end)
--每日首充
Util.AddClick(this.dailyRechargeBtn, function()
UIManager.OpenPanel(UIName.DailyRechargePanel)
end)
--超值基金
Util.AddClick(this.upperMonthCardBtn,function()
UIManager.OpenPanel(UIName.OperatingPanel,{tabIndex =7,extraParam =2,showType=2})
end)
-- 百宝商会
Util.AddClick(this.treasureStoreBtn,function()
UIManager.OpenPanel(UIName.TreasureStorePopup)
end)
--八日登陆礼预览
Util.AddClick(this.sgBtn,function()
--UIManager.OpenPanel(UIName.PassGiftPopup,true)ActivityTypeDef.SevenDayRegister
--JumpManager.GoJump(15001)
UIManager.OpenPanel(UIName.EightDayGiftPanel)
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[10474])
return
end
UIManager.OpenPanel(UIName.EliteMonsterPanel, 1)
end)
----打开招财猫
--Util.AddClick(this.luckyCatBtn, function()
-- UIManager.OpenPanel(UIName.LuckyCatPanel)
--end)
-- 打开开服有礼
Util.AddClick(this.courtesyDress, function()
UIManager.OpenPanel(UIName.CourtesyDressPanel)
end)
Util.AddClick(this.paryGift, function()
UIManager.OpenPanel(UIName.PrayMainPanel)
end)
Util.AddClick(this.warPowerSort, function()
UIManager.OpenPanel(UIName.WarPowerSortPanel)
end)
Util.AddClick(this.expert, function()
UIManager.OpenPanel(UIName.ExpertPanel)
end)
--戒灵秘宝
Util.AddClick(this.treasureOfSl, function()
UIManager.OpenPanel(UIName.MissionDailyPanel,2,1)
end)
-- --天宫秘宝
-- Util.AddClick(this.treasureOfSl, function()
-- local page, extra = TreasureOfHeavenManagerV2.GetTreasureRedPointShow()
-- UIManager.OpenPanel(UIName.TreasureOfHeavenPanel, {
-- tabIndex = page,
-- extraParam = extra
-- })
-- end)
--东海寻仙
Util.AddClick(this.findFairyBtn,function()
UIManager.OpenPanel(UIName.FindFairyPanel)
end)
--幸运转盘
Util.AddClick(this.luckyTurnBtn,function()
UIManager.OpenPanel(UIName.LuckyTurnTablePanel)
end)
--成就
--Util.AddClick(this.AchievementBtn,function()
-- UIManager.OpenPanel(UIName.AchievementPanel)
--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.btnZhaomu, function()
-- if (RecruitManager.CheckRecuritRedPoint() or SecretBoxManager.CheckSecretRedPoint()) then
-- if (RecruitManager.CheckRecuritRedPoint()) then
-- JumpManager.GoJump(1023)
-- else
-- if(ActTimeCtrlManager.SingleFuncState(21)) then
-- if (SecretBoxManager.CheckSecretRedPoint()) then
-- JumpManager.GoJump(21001)
-- end
-- else
-- JumpManager.GoJump(1023)
-- end
-- end
-- else
-- JumpManager.GoJump(1023)
-- end
--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.CarbonTypePanelV2)
else
local config = ConfigManager.GetConfigData(ConfigName.GlobalSystemConfig,FUNCTION_OPEN_TYPE.ENDLESS)
PopupTipPanel.ShowTip(string.format(Language[12297],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.btnTujian, function()
-- UIManager.OpenPanel(UIName.HandBookMainPanel)
-- this.ScenceBtnClick(FUNCTION_OPEN_TYPE.HAND_BOOK)
--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.btnEndLess, function()
-- MapManager.curCarbonType = CarBonTypeId.ENDLESS
-- UIManager.OpenPanel(UIName.EndLessCarbonPanel)
-- end)
-- Util.AddClick(this.btnGuanxing, function()
-- JumpManager.GoJump(1024)
-- this.ScenceBtnClick(FUNCTION_OPEN_TYPE.ASPECT_STAR)
-- end)
-- 好友
Util.AddClick(this.btnFriend, function()
UIManager.OpenPanel(UIName.GoodFriendMainPanel)
end)
--Util.AddClick(this.btnSet, function()
-- UIManager.OpenPanel(UIName.SettingPanel)
--end)
--Util.AddClick(this.btnGonghuizhan, function()
-- if PlayerManager.familyId == 0 then
-- PopupTipPanel.ShowTip("尚未加入公会")
-- return
-- end
-- if not GuildFightManager.IsInGuildFight() then
-- PopupTipPanel.ShowTip("公会战未开始")
-- return
-- end
-- JumpManager.GoJump(4001)
--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[10703])
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.btnTianFu, function ()
-- this.FunctionClickEvent(FUNCTION_OPEN_TYPE.TALENT_TREE, function ()
-- UIManager.OpenPanel(UIName.WorkShowTechnologPanel, 1)
-- end)
-- this.ScenceBtnClick(FUNCTION_OPEN_TYPE.TALENT_TREE)
-- 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.btnSupreme, function ()
UIManager.OpenPanel(UIName.SupremeHeroPopup)
end)
--成长礼包
Util.AddClick(this.btnUpGradePackage, function ()
UIManager.OpenPanel(UIName.UpGradePackagePanel)
end)
--破阵诛仙、限时召唤、乾坤宝盒
Util.AddClick(this.btnDynamicActivity, function ()
if ActivityGiftManager.GetActivityOpenStatus(ActivityTypeDef.FindFairy) then
UIManager.OpenPanel(UIName.DynamicActivityPanel)
else
this.btnDynamicActivity.gameObject:SetActive(false)
end
end)
--神将合成、神将置换
Util.AddClick(this.btnCompoundHero, function()
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.COMPOUND_HERO) then
JumpManager.GoJump(750001)
this.ScenceBtnClick(FUNCTION_OPEN_TYPE.COMPOUND_HERO)
else
PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.COMPOUND_HERO))
end
-- UIManager.OpenPanel(UIName.CompoundHeroPanel)--开发用,之后删除 释放上面
end)
-- 十绝阵
Util.AddClick(this.deathPosBtn, function()
JumpManager.GoJump(75001)
end)
-- 巅峰
Util.AddClick(this.topMatchBtn, function()
UIManager.OpenPanel(UIName.ArenaTopMatchPanel)
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.Recharge, this.rechargeRedPoint)
BindRedPointObject(RedPointType.Operating, this.packageGiftRedPoint)
BindRedPointObject(RedPointType.VipPrivilege, this.vipRedPoint)
BindRedPointObject(RedPointType.FirstRecharge, this.firstRechargeRedPoint)
BindRedPointObject(RedPointType.Mail, this.mailRedPoint)
BindRedPointObject(RedPointType.DailyTaskMain, this.DailyRedPoint)
BindRedPointObject(RedPointType.Shop, this.rpShangdian)
BindRedPointObject(RedPointType.Shop_Roam_Check, this.rpYunyou)
BindRedPointObject(RedPointType.TreasureOfSl, this.treasureOfSlRedPoint)
BindRedPointObject(RedPointType.Expert, this.expertRedPoint)
BindRedPointObject(RedPointType.WarPowerSort, this.warPowerSortRedPoint)
BindRedPointObject(RedPointType.SevenDayCarnival, this.sevenDayCarnivalRedPoint)
BindRedPointObject(RedPointType.DailyRecharge, this.dailyRechargeRedPoint)
BindRedPointObject(RedPointType.CourtesyDress, this.courtesyDressRedPoint)
--BindRedPointObject(RedPointType.LuckyCat, this.luckyCatRedPoint)
--BindRedPointObject(RedPointType.SecretTer, this.rpMijing)
BindRedPointObject(RedPointType.Arena, this.rpJingjichang)
BindRedPointObject(RedPointType.Friend, this.friendRed)
BindRedPointObject(RedPointType.RankingSort, this.rankRed)
--BindRedPointObject(RedPointType.Setting, this.setRed)
BindRedPointObject(RedPointType.Setting, this.headRedpot)
--BindRedPointObject(RedPointType.Recruit, this.rpZhaomu)
-- BindRedPointObject(RedPointType.Guild, this.rpGonghui)
BindRedPointObject(RedPointType.Recruit, this.rpRecruit)
BindRedPointObject(RedPointType.SecretBox, this.rpSecretBox)
BindRedPointObject(RedPointType.Alien, this.rpAlien)
BindRedPointObject(RedPointType.DiffMonster, this.rpYiYao)
BindRedPointObject(RedPointType.SupremeHero, this.supremeRedPoint)
BindRedPointObject(RedPointType.LuckyTurn, this.luckyTurnRedPoint)
BindRedPointObject(RedPointType.FindFairy, this.findFairyRedPoint)
--BindRedPointObject(RedPointType.Achievement_Main, this.AchievementRedPoint)
BindRedPointObject(RedPointType.Vientiane, this.rpColorfulWorld)
BindRedPointObject(RedPointType.DynamicActivity, this.DynamicActivityRedPoint)
end
-- 绑定红点
function this.ClearRedPoint()
-- 绑定红点
ClearRedPointObject(RedPointType.Recharge, this.rechargeRedPoint)
ClearRedPointObject(RedPointType.Operating, this.packageGiftRedPoint)
ClearRedPointObject(RedPointType.VipPrivilege, this.vipRedPoint)
ClearRedPointObject(RedPointType.FirstRecharge, this.firstRechargeRedPoint)
ClearRedPointObject(RedPointType.Mail, this.mailRedPoint)
ClearRedPointObject(RedPointType.DailyTaskMain, this.DailyRedPoint)
ClearRedPointObject(RedPointType.Shop, this.rpShangdian)
ClearRedPointObject(RedPointType.Shop_Roam_Check, this.rpYunyou)
ClearRedPointObject(RedPointType.TreasureOfSl, this.treasureOfSlRedPoint)
ClearRedPointObject(RedPointType.Expert, this.expertRedPoint)
ClearRedPointObject(RedPointType.WarPowerSort, this.warPowerSortRedPoint)
ClearRedPointObject(RedPointType.SevenDayCarnival, this.sevenDayCarnivalRedPoint)
ClearRedPointObject(RedPointType.DailyRecharge, this.dailyRechargeRedPoint)
ClearRedPointObject(RedPointType.CourtesyDress, this.courtesyDressRedPoint)
--ClearRedPointObject(RedPointType.LuckyCat, this.luckyCatRedPoint)
--ClearRedPointObject(RedPointType.SecretTer, this.rpMijing)
ClearRedPointObject(RedPointType.Arena, this.rpJingjichang)
ClearRedPointObject(RedPointType.Friend, this.friendRed)
ClearRedPointObject(RedPointType.RankingSort, this.rankRed)
--ClearRedPointObject(RedPointType.Setting, this.setRed)
ClearRedPointObject(RedPointType.Setting, this.headRedpot)
--ClearRedPointObject(RedPointType.Recruit, this.rpZhaomu)
-- ClearRedPointObject(RedPointType.Guild, this.rpGonghui)
ClearRedPointObject(RedPointType.Recruit, this.rpRecruit)
ClearRedPointObject(RedPointType.SecretBox, this.rpSecretBox)
ClearRedPointObject(RedPointType.Alien, this.rpAlien)
ClearRedPointObject(RedPointType.DiffMonster, this.rpYiYao)
ClearRedPointObject(RedPointType.SupremeHero, this.supremeRedPoint)
ClearRedPointObject(RedPointType.LuckyTurn, this.luckyTurnRedPoint)
ClearRedPointObject(RedPointType.FindFairy, this.findFairyRedPoint)
--ClearRedPointObject(RedPointType.Achievement_Main, this.AchievementRedPoint)
ClearRedPointObject(RedPointType.Vientiane, this.rpColorfulWorld)
ClearRedPointObject(RedPointType.DynamicActivity, this.DynamicActivityRedPoint)
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.Questionnaire.OnQuestionnaireChange, this.OnQuestionnaireCallBack)
Game.GlobalEvent:AddEvent(GameEvent.Adventure.OnEnemyListChanged, this.OnAlienListChanged)
Game.GlobalEvent:AddEvent(GameEvent.Player.OnPlayerLvChange, this.RefreshPlayerInfoShow)
Game.GlobalEvent:AddEvent(GameEvent.EightDay.GetRewardSuccess, this.RefreshEightGiftPreview)
Game.GlobalEvent:AddEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, this.RefreshEightGiftPreview)
Game.GlobalEvent:AddEvent(GameEvent.FindFairy.RefreshBuyOpenState, this.RefreshGiftBtnShow)
Game.GlobalEvent:AddEvent(GameEvent.Player.OnShowBattleUpLvTip, this.RefreshBattleUpLvTip)
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.Questionnaire.OnQuestionnaireChange, this.OnQuestionnaireCallBack)
Game.GlobalEvent:RemoveEvent(GameEvent.Adventure.OnEnemyListChanged, this.OnAlienListChanged)
Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnPlayerLvChange, this.RefreshPlayerInfoShow)
Game.GlobalEvent:RemoveEvent(GameEvent.EightDay.GetRewardSuccess, this.RefreshEightGiftPreview)
Game.GlobalEvent:RemoveEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, this.RefreshEightGiftPreview)
Game.GlobalEvent:RemoveEvent(GameEvent.FindFairy.RefreshBuyOpenState, this.RefreshGiftBtnShow)
Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnShowBattleUpLvTip, this.RefreshBattleUpLvTip)
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.vipPrivilegeBtn, self.sortingOrder - orginLayer)
if orginLayer < 100 then
Util.AddParticleSortLayer(self.GuideEffectGo, self.sortingOrder)
Util.AddParticleSortLayer(self.GuideJumpEffectGo, self.sortingOrder)
else
Util.AddParticleSortLayer(self.GuideEffectGo, self.sortingOrder - orginLayer)
Util.AddParticleSortLayer(self.GuideJumpEffectGo, self.sortingOrder - orginLayer)
end
orginLayer = self.sortingOrder
this.BtView:SetOrderStatus({ sortOrder = self.sortingOrder })
end
--界面打开时调用(用于子类重写)
function this:OnShow()
this.vipLevelText.sprite = VipManager.SetVipLevelImg()
timePressStarted = Time.realtimeSinceStartup
SoundManager.PlayMusic(SoundConfig.BGM_Main)
this.level.text = PlayerManager.level
this.expSliderValue.value = PlayerManager.exp / PlayerManager.userLevelData[PlayerManager.level].Exp
this.playName.text = PlayerManager.nickName
this.heroTeamPower.text = FormationManager.GetFormationPower(FormationManager.curFormationIndex)
if not this.playerHead then
this.playerHead = SubUIManager.Open(SubUIConfig.PlayerHeadView, this.headPos.transform)
end
this.playerHead:SetHead(PlayerManager.head)
this.playerHead:SetFrame(PlayerManager.frame)
this.playerHead:SetScale(Vector3.one * 0.9)
this.playerHead:SetPosition(Vector3.New(-5, 0, 0))
Log(string.format("---------------------%s", BagManager.GetItemCountById(14)))
this.UpView:OnOpen({ showType = UpViewOpenType.ShowRight, panelType = PanelType.Main })
this.BtView:OnOpen({ sortOrder = self.sortingOrder, panelType = PanelTypeView.MainCity })
-- 刷新功能显示
this.InitFuncShow()
this.RefreshActivityShow()
this.RefreshFuncNewText()
this.RefreshGiftBtnShow()
-- 主界面time创建
endTime = ActivityGiftManager.GetTaskEndTime(ActivityTypeDef.SupremeHero)
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
--主城调了两边 所以做特殊判断
if not UIManager.IsOpen(UIName.PatFacePanel) then
this.RefreshShowPatPaceActivity()
end
-- 设置主城小人名字
if self.playerView then
self.playerView:SetName()
end
-- 检测公会tip
GuildManager.CheckGuildTip()
--远征主城红点
--Log("ExpeditionManager.GetNodeBoxnIsShowRedPoint() "..tostring(ExpeditionManager.GetNodeBoxnIsShowRedPoint() ))
--Log(" ExpeditionManager.GetActivityIsShowRedPoint(false) "..tostring( ExpeditionManager.GetActivityIsShowRedPoint(false)))
--this.rpExpedition:SetActive(ExpeditionManager.GetNodeBoxnIsShowRedPoint() or ExpeditionManager.GetActivityIsShowRedPoint(false))
--this.horseRaceLamp:SetActive(false)
--if UIManager.IsOpen(UIName.RewardItemSingleShowPopup) then
-- UIManager.ClosePanel(UIName.RewardItemSingleShowPopup)
--end
CheckRedPointStatus(RedPointType.RankingSort)
if PlayerManager.IsGetFiveStarHero and OperatingManager.IsShowFiveStarPatch then
Game.GlobalEvent:DispatchEvent(GameEvent.PatFace.PatFaceSend, FacePanelType.GrowGift, 5)
PlayerManager.IsGetFiveStarHero = false
end
PlayerManager.StarBattleUpLvTipTime(1)
this.battleUpLvTip:SetActive(false)
end
-- 刷新玩家基础信息显示
function this.RefreshPlayerInfoShow()
this.vipLevelText.sprite = VipManager.SetVipLevelImg()
this.level.text = PlayerManager.level
this.expSliderValue.value = PlayerManager.exp / PlayerManager.userLevelData[PlayerManager.level].Exp
this.playName.text = PlayerManager.nickName
this.heroTeamPower.text = FormationManager.GetFormationPower(FormationManager.curFormationIndex)
end
local isCanShowMainTaskJumpEffect = true
function this:Update()
if curMianTaskData and curMianTaskData.state == 0 then
if isCanShowMainTaskJumpEffect then
if Time.realtimeSinceStartup - timePressStarted > 5 then
isCanShowMainTaskJumpEffect = false
this.GuideJumpEffectGo:SetActive(true)
end
end
if Input.GetMouseButtonDown(0) then
timePressStarted = Time.realtimeSinceStartup
isCanShowMainTaskJumpEffect = true
this.GuideJumpEffectGo:SetActive(false)
end
end
-- if Input.GetMouseButtonDown(1) then
-- if ActTimeCtrlManager.SingleFuncState(30) then
-- CarbonManager.difficulty = 2
-- local trialDataConfig = ConfigManager.GetConfig(ConfigName.TrialConfig)
-- if MapTrialManager.curTowerLevel>10000 then
-- MapManager.curMapId = MapTrialManager.GetSurprisedLevelMapId()
-- else
-- MapManager.curMapId = trialDataConfig[MapTrialManager.curTowerLevel].MapId
-- end
-- NetManager.MapInfoRequest(MapManager.curCarbonType, function(msg)
-- MapManager.isReloadEnter = false
-- MapTrialManager.firstEnter = true
-- MapManager.SetViewSize(20)--设置视野范围(明雷形式)
-- MapManager.curAreaId =FormationTypeDef.FORMATION_DREAMLAND
-- MapManager.trialHeroInfo=msg.infos
-- SwitchPanel.OpenPanel(UIName.MapPanel)
-- end)
-- -- local curMapId = trialDataConfig[MapTrialManager.curTowerLevel].MapId
-- -- UIManager.OpenPanel(UIName.FormationPanelV2, FORMATION_TYPE.CARBON, curMapId)
-- -- UIManager.OpenPanel(UIName.TrialCarbonPanel)
-- -- RedPointManager.PlayerPrefsSetStr(PlayerManager.uid .. "Trial", 1)
-- -- CheckRedPointStatus(RedPointType.EpicExplore_OpenCarbon)
-- -- this.RefreshOpenText(CARBON_TYPE.TRIAL, FUNCTION_OPEN_TYPE.TRIAL)
-- -- FunctionOpenMananger.CleadNewText(FUNCTION_OPEN_TYPE.TRIAL)
-- -- LogBlue(Language[11163])
-- else
-- PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.TRIAL))
-- end
-- end
end
-- 刷新功能显示
function this.InitFuncShow(funcType)
--判断开服有礼是否全部领完
if not funcType or funcType == FUNCTION_OPEN_TYPE.SERVER_START_GIFT then
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.SERVER_START_GIFT) then
if not ActivityGiftManager.onlineOpen and not ActivityGiftManager.sevenDayOpen and not ActivityGiftManager.chapterOpen then
this.courtesyDress:SetActive(false)
else
this.courtesyDress:SetActive(true)
end
else
this.courtesyDress:SetActive(false)
end
if funcType == FUNCTION_OPEN_TYPE.SERVER_START_GIFT then
return
end
end
-- 公会战显示
-- if not funcType or funcType == FUNCTION_OPEN_TYPE.GUILD then
-- this.RefreshGuildFightShow()
-- end
-- 外敌npc显示
--if not funcType or funcType == FUNCTION_OPEN_TYPE.FIGHT_ALIEN then
-- local isAlienActive = ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.FIGHT_ALIEN)
-- if isAlienActive then
-- local list = AdventureManager.GetAdventureEnemyList()
-- if not list or #list <= 0 or GetTimeStamp() > list[1].levelTime then
-- this.alienNPC:SetActive(false)
-- else
-- this.alienNPC:SetActive(false) -- todo: 美术说暂时没有资源,策划说暂时隐藏,程序这里不让他显示
-- this.timeAlienNPC.text = TimeToHMS(list[1].levelTime - GetTimeStamp())
-- end
-- else
-- this.alienNPC:SetActive(false)
-- end
--end
-- 需要显示隐藏的功能检测
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.TRIAL 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.TRIAL 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()
-- 如果逮到一个云游商人
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.RefreshGuildFightShow()
--local isShow = PlayerManager.familyId ~= 0 and GuildFightManager.IsInGuildFight()
--if this.isGHZShow ~= isShow then
-- this.RefreshGuildFightShow()
--end
-- 刷新外敌次数刷新时间
--if this.alienNPC.activeSelf then
-- local list = AdventureManager.GetAdventureEnemyList()
-- if not list or #list == 0 then
-- this.alienNPC:SetActive(false)
-- else
-- local curTimeStamp = GetTimeStamp()
-- local remainTime = list[1].levelTime - curTimeStamp
-- if remainTime <= 0 then
-- this.alienNPC:SetActive(false)
-- else
-- this.timeAlienNPC.text = TimeToHMS(remainTime)
-- end
-- end
--end
-- 显示活动倒计时
local isOpen = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.SupremeHero)
if isOpen and isOpen > 0 and ActivityGiftManager.GetRewardState(42)~=3 then --活动开启并且未领取完毕
if endTime - PlayerManager.serverTime > 0 then
-- 第一次解锁
if supremHadSet then
this.btnSupreme:SetActive(true)
end
local time = endTime - PlayerManager.serverTime
if time>= 86400 then
this.supremeTime.text = TimeToDH(time)
else
this.supremeTime.text = TimeToHMS(time)
end
supremHadSet = false
else
this.btnSupreme:SetActive(false)
end
else
if not supremHadSet then
this.btnSupreme:SetActive(false)
end
supremHadSet = true
end
-- 超值基金
local isOpen_128 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_128)
local isOpen_328 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_328)
local cardType = nil
if isOpen_328 then
cardType = GoodsTypeDef.MONTHCARD_328
end
if not cardType and isOpen_128 then
cardType = GoodsTypeDef.MONTHCARD_328
end
local isShow = false
if cardType then
local data = OperatingManager.GetGiftGoodsInfo(cardType)
if data then
local time = data.endTime - PlayerManager.serverTime
if time>= 86400 then
this.upperMonthCardTime.text = TimeToDH(time)
else
this.upperMonthCardTime.text = TimeToHMS(time)
end
isShow = true
end
end
if isUpperMonthCardTimeShow ~= isShow then
this.upperMonthCardTimeBg:SetActive(isShow)
this.upperMonthCardTime.gameObject:SetActive(isShow)
isUpperMonthCardTimeShow = isShow
end
--限时折扣
local giftList = {}
giftList = this:GetInfoList()
if #giftList > 0 then
this.upGradePackageBtn:SetActive(true)
this.upGradePackageTime.text = TimeToHMS(giftList[1].endTime-GetTimeStamp())
if giftList[1].endTime-GetTimeStamp() < 1 then
OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, giftList[1].goodsId)
end
else
this.upGradePackageBtn:SetActive(false)
end
--轮转活动,乾坤宝盒
local dynamicAct = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FindFairy)
if dynamicAct then
local info = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.FindFairy)
local tempTime = info.endTime - PlayerManager.serverTime
if tempTime>= 86400 then
this.DynamicActivityTime.text = TimeToDH(tempTime)
else
this.DynamicActivityTime.text = TimeToHMS(tempTime)
end
else
this.btnDynamicActivity.gameObject:SetActive(false)
end
--青龙秘宝
local QingLong = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.TreasureOfSomeBody)
if QingLong then
local info = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.TreasureOfSomeBody)
local tempTime = info.endTime - PlayerManager.serverTime
if tempTime>= 86400 then
this.treasureOfSlText.text = TimeToDH(tempTime)
else
this.treasureOfSlText.text = TimeToHMS(tempTime)
end
else
this.treasureOfSl.gameObject:SetActive(false)
end
--云梦祈福
local YunMeng = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.Pray)
if YunMeng then
local info = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.Pray)
local tempTime = info.endTime - PlayerManager.serverTime
if tempTime>= 86400 then
this.paryGiftTime.text = TimeToDH(tempTime)
else
this.paryGiftTime.text = TimeToHMS(tempTime)
end
end
-- 巅峰赛
local function SetTopMatchActive(isActive)
if isActive ~= this.isTopMatchShow then
this.isTopMatchShow = isActive
this.topMatchBtn:SetActive(isActive)
end
end
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
SetTopMatchActive(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
SetTopMatchActive(true)
this.topMatchTime.text = "距开始\n"..TimeToHMS(tempTime)
else
SetTopMatchActive(false)
end
else
SetTopMatchActive(true)
this.topMatchTime.text = "鏖战中"
end
-- 十绝阵
local function SetDeathPosActive(isActive)
if isActive ~= this.isDeathPosShow then
this.isDeathPosShow = isActive
this.deathPosBtn:SetActive(isActive)
end
end
local status = DeathPosManager.GetStatus()
local endTime = DeathPosManager.GetOverTime()
if not status or status == DeathPosStatus.Close or status == DeathPosStatus.Belated then
SetDeathPosActive(false)
-- elseif baseInfo.battleStage == TOP_MATCH_STAGE.CLOSE then
-- SetTopMatchActive(true)
-- local tempTime = this.baseInfo.endTime - PlayerManager.serverTime
-- this.topMatchTime.text = "距开始"..TimeToHMS(tempTime)
else
if endTime then
SetDeathPosActive(true)
local tempTime = endTime - PlayerManager.serverTime
this.deathPosTime.text = "距闯阵结束\n"..TimeToHMS(tempTime)
else
SetDeathPosActive(false)
end
end
end
--为限时折扣写的
function this:GetInfoList()
local giftList={}
local infoList = OperatingManager.GetGiftGoodsInfoList(GoodsTypeDef.DirectPurchaseGift)--拿取所有类型5礼包信息(包含需要的礼包)
local infoList2 = ConfigManager.GetAllConfigsDataByKey(ConfigName.RechargeCommodityConfig,"ShowType",21)
for index, value in pairs(infoList) do
for i = 1, #infoList2 do
if infoList2[i].Id == value.goodsId and value.dynamicBuyTimes > 0 then
table.insert(giftList,value)
end
end
end
infoList2 = ConfigManager.GetAllConfigsDataByKey(ConfigName.RechargeCommodityConfig,"ShowType",8)
for index, value in pairs(infoList) do
for i = 1, #infoList2 do
if infoList2[i].Id == value.goodsId and value.dynamicBuyTimes > 0 then
table.insert(giftList,value)
end
end
end
return giftList
end
-- function this:OnCloseBefore(action)
-- PlayUIAnimBacks(this.gameObject, action)
-- end
--界面关闭时调用(用于子类重写)
function this:OnClose()
-- 关闭定时刷新数据
PlayerManager.StopBattleUpLvTipTime()
this.ChatTipView:StopCheck()
PatFaceManager.isLogin = false
--if patFaceCallList then
-- patFaceCallList:Clear()
--end
end
--界面销毁时调用(用于子类重写)
function this:OnDestroy()
SubUIManager.Close(this.UpView)
SubUIManager.Close(this.BtView)
-- SubUIManager.Close(this.HorseRaceLampView)
SubUIManager.Close(this.ChatTipView)
-- 清楚红点
this.ClearRedPoint()
-- 头像回收
if this.playerHead then
this.playerHead:Recycle()
this.playerHead = nil
end
-- 计时器
if this._TimeCounter then
this._TimeCounter:Stop()
this._TimeCounter = nil
end
if this.timer then
this.timer:Stop()
this.timer = nil
end
end
--更改姓名刷新
function this.RefreshChangeName()
if (NameManager.GetRoleName() ~= "") then
PlayerManager.nickName = NameManager.GetRoleName()
end
end
-- 刷新一些购买活动的按钮限时
function this.RefreshGiftBtnShow()
local isOpen_128 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_128)
local isOpen_328 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_328)
this.upperMonthCardBtn:SetActive(isOpen_128 or isOpen_328)
-- local isOpen_upgrade = OperatingManager.IsBaseOpen(GoodsTypeDef.UpgradePackage)
-- this.upGradePackageBtn:SetActive(isOpen_upgrade)
end
--后台推送
function this.RefreshActivityBtn(context)
Log("context.type1 " .. context.type .. " " .. context.status)
if context.type == ActivityTypeDef.TreasureOfSomeBody then
if ActTimeCtrlManager.IsQualifiled(35) then
this.treasureOfSl:SetActive(context.status == 1)
end
elseif context.type == ActivityTypeDef.Pray then
this.paryGift:SetActive(context.status == 1)
elseif context.type == ActivityTypeDef.WarPowerSort then
if ActTimeCtrlManager.IsQualifiled(43) then
Log("context.type1 " .. context.type .. " " .. context.status)
this.warPowerSort:SetActive(context.status == 1)
end
elseif context.type == ActivityTypeDef.SevenDayCarnival then
if ActTimeCtrlManager.IsQualifiled(39) then
this.sevenDayCarnivalBtn:SetActive(context.status == 1)
if this.sevenDayCarnivalBtn.activeSelf then
this.SetSevenDayCarnivalName()
end
end
elseif context.type == ActivityTypeDef.FirstRecharge then
if ActTimeCtrlManager.IsQualifiled(38) then
this.firstRechargeBtn:SetActive(context.status == 1)
--if not this.firstRechargeBtn.activeSelf then
if ActTimeCtrlManager.IsQualifiled(41) then
this.dailyRechargeBtn:SetActive(DailyRechargeManager.GetDailyRechargeExist())
end
--end
end
elseif context.type == ActivityTypeDef.DailyRecharge then
if ActTimeCtrlManager.IsQualifiled(41) then
--if not this.firstRechargeBtn.activeSelf then
this.dailyRechargeBtn:SetActive(context.status == 1)
--end
end
--elseif context.type == ActivityTypeDef.LuckyCat then
-- this.luckyCatBtn:SetActive(context.status == 1)
-- if(context.status == 1) then
-- LuckyCatManager.isOpenLuckyCat=true
-- else
-- LuckyCatManager.isOpenLuckyCat=false
-- end
elseif context.type == ActivityTypeDef.SupremeHero then
if ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.SupremeHero) then
this.btnSupreme:SetActive(ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.SupremeHero) > 0 and ActivityGiftManager.GetRewardState(42)~=3)
end
elseif context.type==ActivityTypeDef.FindFairy then
this.findFairyBtn:SetActive(false)--not not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FindFairy))
end
if ActTimeCtrlManager.IsQualifiled(42) then
this.expert:SetActive(ActivityGiftManager.GetExpertActiveisOpen() > 0)
end
end
--客户端自己Show刷新
function this.RefreshActivityShow()
if ActTimeCtrlManager.IsQualifiled(35) then
this.treasureOfSl:SetActive(not not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.TreasureOfSomeBody))
else
this.treasureOfSl:SetActive(false)
end
if ActTimeCtrlManager.IsQualifiled(39) then
this.sevenDayCarnivalBtn:SetActive(not not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.SevenDayCarnival))
if this.sevenDayCarnivalBtn.activeSelf then
this.SetSevenDayCarnivalName()
end
else
this.sevenDayCarnivalBtn:SetActive(false)
end
if ActTimeCtrlManager.IsQualifiled(38) then
this.firstRechargeBtn:SetActive(FirstRechargeManager.GetFirstRechargeExist())
else
this.firstRechargeBtn:SetActive(false)
end
if ActTimeCtrlManager.IsQualifiled(41) then
--if not this.firstRechargeBtn.activeSelf then
this.dailyRechargeBtn:SetActive(DailyRechargeManager.GetDailyRechargeExist())
--else
-- this.dailyRechargeBtn:SetActive(false)
--end
else
this.dailyRechargeBtn:SetActive(false)
end
if ActTimeCtrlManager.IsQualifiled(42) then
this.expert:SetActive(ActivityGiftManager.GetExpertActiveisOpen() > 0)
else
this.expert:SetActive(false)
end
if ActTimeCtrlManager.IsQualifiled(43) then
this.warPowerSort:SetActive(not not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.WarPowerSort))
else
this.warPowerSort:SetActive(false)
end
--八日登陆
this.RefreshEightGiftPreview()
--东海寻仙
this.findFairyBtn:SetActive(false)--not not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FindFairy))
--幸运转盘
this.luckyTurnBtn:SetActive(ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.LUCKYTURN))
--this.AchievementBtn:SetActive(ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.Achiecement))
--远征
--this.expeditionBtn:SetActive(ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.EXPEDITION))
this.paryGift:SetActive(not not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.Pray))
--this.luckyCatBtn:SetActive(not not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.LuckyCat))
this.rechargeBtn:SetActive(ActTimeCtrlManager.IsQualifiled(36)) --ActTimeCtrlManager.IsQualifiled(36))
this.packageGiftBtn:SetActive(ActTimeCtrlManager.IsQualifiled(40))
this.questionnaireBtn:SetActive(QuestionnaireManager.GetQuestionState() == 0)
--轮转活动 限时召唤 乾坤宝盒
this.btnDynamicActivity:SetActive(not not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FindFairy))
end
function this.SetSevenDayCarnivalName()
if this.sevenDayCarnivalBtn.activeSelf then
local activityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.SevenDayCarnival)
this.SevenDayStage1:SetActive(activityId == 10)
this.SevenDayStage2:SetActive(activityId ~= 10)
end
end
function this.OnQuestionnaireCallBack()
this.questionnaireBtn:SetActive(QuestionnaireManager.GetQuestionState() == 0)
end
function this.RefreshShowPatPaceActivity()
local patFaceAllData = PatFaceManager.GetPatFaceAllDataTabs()
if patFaceAllData and not GuideManager.IsFunctionGuideExist() then
Log("#patFaceAllData " .. #patFaceAllData)
if #patFaceAllData > 0 then
this.patFaceCallList:Clear()
this.patFaceCallList:Push(function()
Log(Language[10583])
Game.GlobalEvent:DispatchEvent(GameEvent.PatFace.PatFaceSendFinish)
AdventureManager.GetIsMaxTime()
end)
for i = #patFaceAllData, 1, -1 do
this.patFaceCallList:Push(function()
PatFaceManager.SetisFirstLogVal(1, { patFaceAllData[i] })
UIManager.OpenPanel(UIName.PatFacePanel, patFaceAllData[i], function()
local time2 = Timer.New(function()
this.patFaceCallList:Pop()()
end, 0.5)
time2:Start()
end)
end)
end
this.patFaceCallList:Pop()()
else
Game.GlobalEvent:DispatchEvent(GameEvent.PatFace.PatFaceSendFinish)
end
end
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
end
-- 七日登陆奖励预览
function this.RefreshSevenGiftPreview()
--判断今日是否有可领取
local isHaveGift = ActivityGiftManager.CheckSevenDayRed()
local curDay = math.ceil((CalculateSecondsNowTo_N_OClock(24) + 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=Gift.Name
this.sgInfo.text=Language[11164]
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=Gift.Name
break
end
end
this.sgInfo.text=Language[11165]
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.RefreshBattleUpLvTip()
this.battleUpLvTip:SetActive(true)
end
-- 刷新公会战图标显示
-- function this.RefreshGuildFightShow()
-- local isActive = ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.GUILD)
-- local isInGuild = PlayerManager.familyId ~= 0
-- local isInFight = GuildFightManager.IsInGuildFight()
-- local isShow = isActive and isInFight and isInGuild
-- if not isShow then
-- if not this.isGHZShow then return end
-- this.GHZStageAttackEffect:SetActive(false)
-- this.GHZStageImage.gameObject:SetActive(false)
-- this.isGHZShow = false
-- this.GHZ_Stage = nil
-- else
-- local curStage = GuildFightManager.GetCurFightStage()
-- if this.GHZ_Stage ~= curStage then
-- if curStage == GUILD_FIGHT_STAGE.ATTACK then
-- this.GHZStageAttackEffect:SetActive(true)
-- this.GHZStageImage.gameObject:SetActive(false)
-- else
-- this.GHZStageAttackEffect:SetActive(false)
-- local imgName = GHZ_STAGE_IMAGE[curStage]
-- if not imgName then
-- this.GHZStageImage.gameObject:SetActive(false)
-- else
-- this.GHZStageImage.gameObject:SetActive(true)
-- this.GHZStageImage.sprite = Util.LoadSprite(imgName)
-- end
-- end
-- this.GHZ_Stage = curStage
-- end
-- this.isGHZShow = true
-- end
-- end
return MainPanel