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

1498 lines
63 KiB
Lua
Raw Normal View History

2020-05-09 13:31:21 +08:00
 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 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.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.rechargeBtn = Util.GetGameObject(self.gameObject, "RightUp/recharge")
-- 福利
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.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.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.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.expeditionBtn=Util.GetGameObject(self.gameObject,"RightUp/expedition")
--this.expeditionRedPoint=Util.GetGameObject(this.expeditionBtn,"redPoint")
--成就
this.AchievementBtn=Util.GetGameObject(self.gameObject,"RightUp/Achievement")
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.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 = Util.GetGameObject(this.gameObject, "scene/layer3/btnGonghui")
this.btnFenjie = Util.GetGameObject(this.gameObject, "scene/layer6/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/layer7/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/layer7/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.btnWaiDi:SetActive(false)
this.operateIcon = {
[FUNCTION_OPEN_TYPE.SHOP] = this:AddFuncItem(this.btnShangdian, 120),
[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, -2040),
--[FUNCTION_OPEN_TYPE.HAND_BOOK] = this:AddFuncItem(this.btnTujian,-2715),
[FUNCTION_OPEN_TYPE.ARENA] = this:AddFuncItem(this.btnJingjichang, -200),
[FUNCTION_OPEN_TYPE.GUILD] = this:AddFuncItem(this.btnGonghui, -144),
[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, -110),
[FUNCTION_OPEN_TYPE.RECURITY] = this:AddFuncItem(this.btnRecruit, -56),
[FUNCTION_OPEN_TYPE.ELEMENT_RECURITY] = this:AddFuncItem(this.btnElementDrawCard, -1177),
[FUNCTION_OPEN_TYPE.SECRETBOX] = this:AddFuncItem(this.btnSecretBox, -1827),
-- [FUNCTION_OPEN_TYPE.TALENT_TREE] = this:AddFuncItem(this.btnTianFu, -1179),
[FUNCTION_OPEN_TYPE.DIFFER_DEMONS] = this:AddFuncItem(this.btnYiYao, -670),
[FUNCTION_OPEN_TYPE.FIGHT_ALIEN] = this:AddFuncItem(this.btnWaiDi, -2715),
}
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.GUILD] = this:InsertNewText(this.btnGonghui),
[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),
}
-- 红点
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.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.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.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.btnGrowGift = Util.GetGameObject(self.gameObject, "RightUp/growGift")
this.btnGrowGift:SetActive(false)
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, -2715, 185), av2.y)
if v2.x + av2.x < -2715 or v2.x + av2.x > 185 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)
end)
--礼包
Util.AddClick(this.packageGiftBtn, function()
UIManager.OpenPanel(UIName.OperatingPanel,{tabIndex =1,extraParam =2,showType=1})
end)
--特权
Util.AddClick(this.vipPrivilegeBtn, function()
UIManager.OpenPanel(UIName.VipPanel)
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("怪物已经逃跑啦!")
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()
local page, extra = TreasureOfSomebodyManagerV2.GetTreasureRedPointShow()
UIManager.OpenPanel(UIName.TreasureOfSomebodyPanelV2, {
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.expeditionBtn,function()
-- UIManager.OpenPanel(UIName.ExpeditionMainPanel,false)
--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.btnExpedition, function()
if ActTimeCtrlManager.SingleFuncState(JumpType.Expedition) then
if #ExpeditionManager.nodeInfo <= 0 then
NetManager.GetExpeditionRequest(function()
JumpManager.GoJump(64001)
end)
else
JumpManager.GoJump(64001)
end
else
JumpManager.GoJump(64001)
end
--this.ScenceBtnClick(FUNCTION_OPEN_TYPE.EXPEDITION)
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.btnGonghui, function()
JumpManager.GoJump(4001)
this.ScenceBtnClick(FUNCTION_OPEN_TYPE.GUILD)
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
end)
Util.AddClick(this.btnPaihangbang, function()
if (ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.ALLRANKING)) then
UIManager.OpenPanel(UIName.RankingListPanel)
else
local tip = ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.ALLRANKING)
PopupTipPanel.ShowTip(tip)
end
this.ScenceBtnClick(FUNCTION_OPEN_TYPE.ALLRANKING)
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("外敌已被击杀或逃跑!")
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)
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.Operating, this.packageGiftRedPoint)
BindRedPointObject(RedPointType.VipPrivilege, this.vipRedPoint)
BindRedPointObject(RedPointType.FirstRecharge, this.firstRechargeRedPoint)
BindRedPointObject(RedPointType.Mail, this.mailRedPoint)
BindRedPointObject(RedPointType.DailyTask, 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.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)
end
-- 绑定红点
function this.ClearRedPoint()
-- 绑定红点
ClearRedPointObject(RedPointType.Operating, this.packageGiftRedPoint)
ClearRedPointObject(RedPointType.VipPrivilege, this.vipRedPoint)
ClearRedPointObject(RedPointType.FirstRecharge, this.firstRechargeRedPoint)
ClearRedPointObject(RedPointType.Mail, this.mailRedPoint)
ClearRedPointObject(RedPointType.DailyTask, 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.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)
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.MissionDaily.OnMissionDailyChanged, this.RefreshMainTaskShow)
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)
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.MissionDaily.OnMissionDailyChanged, this.RefreshMainTaskShow)
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)
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
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()
-- 主界面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()
--显示主线
this.RefreshMainTaskShow()
-- 刷新拍脸
local patFaceAllData = PatFaceManager.GetPatFaceAllDataTabs()
if patFaceAllData and #patFaceAllData <= 0 and not UIManager.IsOpen(UIName.PatFacePanel) then
AdventureManager.GetIsMaxTime()
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
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
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)
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)
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()~=3 then --活动开启并且未领取完毕
if endTime - PlayerManager.serverTime >= 0 then
-- 第一次解锁
if supremHadSet then
this.btnSupreme:SetActive(true)
end
this.supremeTime.text = TimeToHMS((endTime - PlayerManager.serverTime))
supremHadSet = false
else
this.btnSupreme:SetActive(false)
end
else
if not supremHadSet then
this.btnSupreme:SetActive(false)
end
supremHadSet = true
end
end
-- function this:OnCloseBefore(action)
-- PlayUIAnimBacks(this.gameObject, action)
-- end
--界面关闭时调用(用于子类重写)
function this:OnClose()
-- 关闭定时刷新数据
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.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()~=3)
end
elseif context.type==ActivityTypeDef.FindFairy then
this.findFairyBtn:SetActive(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
--七日登录奖励预览
if ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.EXPERT) and (ActivityGiftManager.canRewardDay+1<=8)
and ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.SevenDayRegister) then
this.RefreshSevenGiftPreview()
this.sgBtn:SetActive(ActivityGiftManager.canRewardDay<=7)
if ActivityGiftManager.canRewardDay==7 and not ActivityGiftManager.CheckSevenDayRed() then
this.sgBtn:SetActive(false)
end
else
this.sgBtn:SetActive(false)
end
--东海寻仙
this.findFairyBtn:SetActive(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(false)--ActTimeCtrlManager.IsQualifiled(36))
this.packageGiftBtn:SetActive(ActTimeCtrlManager.IsQualifiled(40))
this.questionnaireBtn:SetActive(QuestionnaireManager.GetQuestionState() == 0)
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.RefreshMainTaskShow()
curMianTaskData = TaskManager.GetMianTaskCurActiveTaskData()
if curMianTaskData then
local curSConFigData = ConfigManager.GetConfigData(ConfigName.BeginnerTask, curMianTaskData.missionId)
if curSConFigData then
this.titleText.text = curSConFigData.Show .. " "
this.progressText.text = "(" .. curMianTaskData.progress .. "/" .. curSConFigData.TaskValue[2][1] .. ")"
if curMianTaskData.state == 0 then
this.mainTaskGRewardImage:SetActive(false)
this.mainTaskJumpImage:SetActive(true)
elseif curMianTaskData.state == 1 then
this.mainTaskGRewardImage:SetActive(true)
this.mainTaskJumpImage:SetActive(false)
elseif curMianTaskData.state == 2 then
this.mainTaskGRewardImage:SetActive(false)
this.mainTaskJumpImage:SetActive(true)
end
Util.AddOnceClick(this.getRewardButton, function()
if curMianTaskData.state == 0 then
JumpManager.GoJump(curSConFigData.Jump[1])
elseif curMianTaskData.state == 1 then
NetManager.TakeMissionRewardRequest(TaskTypeDef.MainTask, curMianTaskData.missionId, function(msg)
UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1, function()
this.RefreshMainTaskShow()
end)
end)
elseif curMianTaskData.state == 2 then
PopupTipPanel.ShowTip("已领取!")
this.RefreshMainTaskShow()
end
end)
this.mainTask:SetActive(true)
end
else
this.mainTask:SetActive(false)
end
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("结束了!!!")
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.RefreshSevenGiftPreview()
--判断今日是否有可领取
local isHaveGift = ActivityGiftManager.CheckSevenDayRed()
local itemId=0
if isHaveGift then
local haveGiftList=nil
for j = 1, #ActivityGiftManager.sevenDayGetRewardState do
if ActivityGiftManager.sevenDayGetRewardState[j]==0 and j<=ActivityGiftManager.canRewardDay then
if haveGiftList==nil then
haveGiftList=ConfigManager.GetConfigDataByDoubleKey(ConfigName.ActivityRewardConfig,"ActivityId",2,"Sort",j)
end
end
end
itemId=haveGiftList.Reward[1][1]
this.sgType.text=haveGiftList.ContentsShow
this.sgInfo.text="今日可领"
this.sgEffect[1].gameObject:SetActive(false)
this.sgEffect[2].gameObject:SetActive(true)
else
if (ActivityGiftManager.canRewardDay+1)>=8 then
return
end
for i, v in pairs(ActivityGiftManager.sevenDayData) do
if v.Id==ActivityGiftManager.canRewardDay+1 then
itemId= v.Reward[1][1]
this.sgType.text=v.ContentsShow
break
end
end
this.sgInfo.text="明日可领"
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.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