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

1431 lines
63 KiB
Lua
Raw Normal View History

2020-08-25 15:46:38 +08:00

require("Base/BasePanel")
2020-05-09 13:31:21 +08:00
require("Modules/Main/View/MainPlayerView")
MainPanel = Inherit(BasePanel)
local this = MainPanel
2021-03-17 10:38:07 +08:00
local endTime = 0
2020-09-23 20:27:29 +08:00
local GlobalActConfig = ConfigManager.GetConfig(ConfigName.GlobalActivity)
2021-03-17 10:38:07 +08:00
local ActGroupsConfig = ConfigManager.GetConfig(ConfigName.ActivityGroups)
2020-05-09 13:31:21 +08:00
--示意图轮回放
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
2020-09-23 20:27:29 +08:00
local isFirstOpen = 0
2020-05-09 13:31:21 +08:00
--local isCanDragMsg = true
local supremHadSet = false
2020-06-03 19:09:01 +08:00
local isUpperMonthCardTimeShow = true
2021-03-17 10:38:07 +08:00
local activitys = {}
local activityTabs = {}
2021-03-17 11:07:47 +08:00
2020-05-09 13:31:21 +08:00
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 },
}
2020-09-23 20:27:29 +08:00
2020-05-09 13:31:21 +08:00
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
2021-03-17 10:38:07 +08:00
2020-09-23 20:27:29 +08:00
local isRefeshIcon = true
2021-03-22 13:47:59 +08:00
local curNPCList = {}
2020-05-09 13:31:21 +08:00
--初始化组件(用于子类重写)
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")
---------------topLeftPart----------------
-- 七日登陆奖励预览入口
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)"))
2021-03-31 15:52:11 +08:00
--十五日登录
this.fgBtn=Util.GetGameObject(self.gameObject,"LeftUp/FifteenDayGift")
2020-05-09 13:31:21 +08:00
---------------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")
2020-06-18 20:39:29 +08:00
-- 排行
this.btnRank = Util.GetGameObject(self.gameObject, "LeftDown/btnRoot/btnRank")
this.rankRed = Util.GetGameObject(this.btnRank, "redPoint")
2020-08-11 16:31:17 +08:00
-- 无尽
this.btnEndLess = Util.GetGameObject(self.gameObject, "LeftDown/btnRoot/btnEndLess")
2020-08-22 17:05:37 +08:00
this.btnEndLess:SetActive(false)
2020-05-09 13:31:21 +08:00
2020-11-27 17:59:25 +08:00
--鸿蒙
this.btnHongMeng=Util.GetGameObject(self.gameObject,"RightDown/btnHongMeng")
2020-12-18 13:39:35 +08:00
this.HongMengRedPoint = Util.GetGameObject(this.btnHongMeng,"redPoint")
2020-05-09 13:31:21 +08:00
-------------------场景中的按钮------------------------
-- 按钮
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")
2020-06-13 11:47:13 +08:00
-- this.btnGonghui:SetActive(false)
2020-06-18 20:39:29 +08:00
this.btnFenjie = Util.GetGameObject(this.gameObject, "scene/layer7/btnFenjie")
2020-05-09 13:31:21 +08:00
--this.btnTujian = Util.GetGameObject(this.gameObject, "scene/layer7/btnTujian")
this.btnShangdian = Util.GetGameObject(this.gameObject, "scene/layer7/btnShangdian")
2020-06-18 20:39:29 +08:00
this.btnEquipCompound = Util.GetGameObject(this.gameObject, "scene/layer3/btnEquipCompound")
-- this.btnPaihangbang = Util.GetGameObject(this.gameObject, "scene/layer4/btnPaihangbang")
2020-05-09 13:31:21 +08:00
-- this.btnGuanxing = Util.GetGameObject(this.gameObject, "scene/layer4/btnGuanxing")
this.btnRecruit = Util.GetGameObject(this.gameObject, "scene/layer6/btnRecruit")
2020-06-18 20:39:29 +08:00
this.btnElementDrawCard = Util.GetGameObject(this.gameObject, "scene/layer4/btnElementDrawCard")
2020-05-09 13:31:21 +08:00
this.btnSecretBox = Util.GetGameObject(this.gameObject, "scene/layer4/btnSecretBox")
this.btnYiYao = Util.GetGameObject(this.gameObject, "scene/layer4/btnYiYao")
this.btnPokemon = Util.GetGameObject(this.gameObject, "scene/layer6/btnPokemon")
2020-05-09 13:31:21 +08:00
-- this.btnTianFu = Util.GetGameObject(this.gameObject, "scene/layer6/btnTianFu")
this.btnWaiDi = Util.GetGameObject(this.gameObject, "scene/layer4/btnWaiDi")
2020-06-18 20:39:29 +08:00
this.btnColorfulWorld = Util.GetGameObject(this.gameObject, "scene/layer6/btnColorfulWorld")
2020-05-09 13:31:21 +08:00
this.btnWaiDi:SetActive(false)
2020-08-27 10:52:35 +08:00
this.btnCompoundHero = Util.GetGameObject(this.gameObject, "scene/layer3/btnCompoundHero")
2021-03-30 18:18:16 +08:00
this.btnTianShuMiJuan = Util.GetGameObject(this.gameObject, "scene/layer7/btnTianShuMiJuan")
2020-05-09 13:31:21 +08:00
this.operateIcon = {
2020-06-18 20:39:29 +08:00
[FUNCTION_OPEN_TYPE.SHOP] = this:AddFuncItem(this.btnShangdian, 50),
[FUNCTION_OPEN_TYPE.HERO_RESOLVE] = this:AddFuncItem(this.btnFenjie, -200),
2020-05-09 13:31:21 +08:00
[FUNCTION_OPEN_TYPE.ARENA] = this:AddFuncItem(this.btnJingjichang, -200),
2020-11-02 18:16:28 +08:00
[FUNCTION_OPEN_TYPE.ENDLESS] = this:AddFuncItem(this.btnColorfulWorld, -1500),
2020-06-18 20:39:29 +08:00
[FUNCTION_OPEN_TYPE.COMPOUND] = this:AddFuncItem(this.btnEquipCompound, -200),
2020-05-09 13:31:21 +08:00
[FUNCTION_OPEN_TYPE.RECURITY] = this:AddFuncItem(this.btnRecruit, -56),
2020-06-18 20:39:29 +08:00
[FUNCTION_OPEN_TYPE.ELEMENT_RECURITY] = this:AddFuncItem(this.btnElementDrawCard, 0),
2020-08-05 16:30:02 +08:00
[FUNCTION_OPEN_TYPE.COMPOUND_HERO] = this:AddFuncItem(this.btnCompoundHero, 0),--神将合成、置换
[FUNCTION_OPEN_TYPE.POKEMON] = this:AddFuncItem(this.btnPokemon, -1200),--神将合成、置换
2021-03-23 15:37:39 +08:00
[FUNCTION_OPEN_TYPE.tianshumijuan] = this:AddFuncItem(this.btnTianShuMiJuan, 0),
2020-05-09 13:31:21 +08:00
}
this.operateNewText = {
[FUNCTION_OPEN_TYPE.SHOP] = this:InsertNewText(this.btnShangdian),
[FUNCTION_OPEN_TYPE.HERO_RESOLVE] = this:InsertNewText(this.btnFenjie),
[FUNCTION_OPEN_TYPE.ARENA] = this:InsertNewText(this.btnJingjichang),
[FUNCTION_OPEN_TYPE.ENDLESS] = this:InsertNewText(this.btnColorfulWorld),
2020-06-18 20:39:29 +08:00
[FUNCTION_OPEN_TYPE.COMPOUND] = this:InsertNewText(this.btnEquipCompound),
2020-05-09 13:31:21 +08:00
[FUNCTION_OPEN_TYPE.RECURITY] = this:InsertNewText(this.btnRecruit),
[FUNCTION_OPEN_TYPE.ELEMENT_RECURITY] = this:InsertNewText(this.btnElementDrawCard),
2020-08-05 16:30:02 +08:00
[FUNCTION_OPEN_TYPE.COMPOUND_HERO] = this:InsertNewText(this.btnCompoundHero),--神将合成、置换
[FUNCTION_OPEN_TYPE.POKEMON] = this:InsertNewText(this.btnPokemon),--神将合成、置换
2021-03-23 16:02:22 +08:00
[FUNCTION_OPEN_TYPE.tianshumijuan] = this:InsertNewText(this.btnTianShuMiJuan),
2020-05-09 13:31:21 +08:00
}
-- 红点
this.rpShangdian = Util.GetGameObject(this.btnShangdian, "redPoint")
this.rpJingjichang = Util.GetGameObject(this.btnJingjichang, "redPoint")
this.rpExpedition = Util.GetGameObject(this.btnExpedition, "redPoint")
this.rpRecruit = Util.GetGameObject(this.btnRecruit, "redPoint")
this.rpElementDrawCard = Util.GetGameObject(this.btnElementDrawCard, "redPoint")
this.rpSecretBox = Util.GetGameObject(this.btnSecretBox, "redPoint")
this.rpYiYao = Util.GetGameObject(this.btnYiYao, "redPoint")
this.rpAlien = Util.GetGameObject(this.btnWaiDi, "redPoint")
2020-06-18 20:39:29 +08:00
this.rpColorfulWorld = Util.GetGameObject(this.btnColorfulWorld, "redPoint")
2020-08-05 16:30:02 +08:00
this.rpCompoundHero = Util.GetGameObject(this.btnCompoundHero, "redPoint")--神将合成、置换
this.rpPokemon = Util.GetGameObject(this.btnPokemon, "redPoint")--灵兽
2021-03-23 15:37:39 +08:00
this.rpbtnTianShuMiJuan = Util.GetGameObject(this.btnTianShuMiJuan, "redPoint")--灵兽
2020-05-09 13:31:21 +08:00
if not this.playerInfoView then
this.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, this.transform)
this.playerInfoView:SetPrivilegeShow(true)
end
2020-05-09 13:31:21 +08:00
this.BtView = SubUIManager.Open(SubUIConfig.BtView, self.transform)
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.transform)
2021-03-17 10:38:07 +08:00
2020-05-09 13:31:21 +08:00
this.ChatTipView = SubUIManager.Open(SubUIConfig.ChatTipView, self.transform, 1)
----==================== npc按钮 ========================
-- 云游商人
this.yunyou = Util.GetGameObject(this.npcRoot, "npcYunyou")
this.btnYunyou = Util.GetGameObject(this.yunyou, "button")
this.timeYunyou = Util.GetGameObject(this.btnYunyou, "time"):GetComponent("Text")
this.rpYunyou = Util.GetGameObject(this.btnYunyou, "redPoint")
poolManager:LoadLive("live2d_r_MapEffect_NewEvent_014", Util.GetTransform(this.yunyou, "liveRoot"), Vector3.one, Vector3.zero)
-- 精英怪
this.jingying = Util.GetGameObject(this.npcRoot, "npcJingying")
this.btnJingying = Util.GetGameObject(this.jingying, "button")
this.eliteMonsterTimeText = Util.GetGameObject(this.btnJingying, "time"):GetComponent("Text")
this.rpJingying = Util.GetGameObject(this.btnJingying, "redPoint")
poolManager:LoadLive("live2d_r_Map_NewEvent_015", Util.GetTransform(this.jingying, "liveRoot"), Vector3.one, Vector3.zero)
-- 外敌
this.alienNPC = Util.GetGameObject(this.npcRoot, "npcAlien")
this.btnAlienNPC = Util.GetGameObject(this.alienNPC, "button")
this.timeAlienNPC = Util.GetGameObject(this.alienNPC, "time"):GetComponent("Text")
this.rpAlienNPC = Util.GetGameObject(this.alienNPC, "redPoint")
moveTranList = {}
for i = 1, #moveSceneList do
table.insert(moveTranList, Util.GetGameObject(self.gameObject, "scene/layer" .. i):GetComponent("RectTransform"))
end
this.btnClickMove = Util.GetGameObject(this.bg, "btnClickMove")
2021-02-20 21:22:05 +08:00
2020-05-09 13:31:21 +08:00
this.btnFunHide[FUNCTION_OPEN_TYPE.DAILY_TASK] = this.btnDailyMission
this.btnFunHide[FUNCTION_OPEN_TYPE.PRAY] = this.paryGift
this.btnFunHide[FUNCTION_OPEN_TYPE.EMAIL] = this.btnYouJian
this.btnFunHide[FUNCTION_OPEN_TYPE.GOODFRIEND] = this.btnFriend
2020-06-18 20:39:29 +08:00
this.btnFunHide[FUNCTION_OPEN_TYPE.ALLRANKING] = this.btnRank
2020-12-18 16:31:28 +08:00
this.btnFunHide[FUNCTION_OPEN_TYPE.HongMengZhen] = this.btnHongMeng
this.btnFunHide[FUNCTION_OPEN_TYPE.POKEMON] = this.btnPokemon
2021-03-23 15:37:39 +08:00
this.btnFunHide[FUNCTION_OPEN_TYPE.tianshumijuan] = this.btnTianShuMiJuan
2020-05-09 13:31:21 +08:00
this.animRoot = Util.GetGameObject(self.gameObject, "scene")
2020-09-23 20:27:29 +08:00
--挑战关卡快速升级提示
this.battleUpLvTip = Util.GetGameObject(self.gameObject, "LeftDown/battleUpLvTip")
2021-03-02 16:53:12 +08:00
Util.GetGameObject(self.gameObject, "LeftDown/battleUpLvTip/Text"):GetComponent("Text").text = Language[10610]
2021-03-17 11:07:47 +08:00
2021-03-23 09:54:11 +08:00
this.activityTabPrefab = Util.GetGameObject(self.gameObject, "RightUp/activityTabPrefab")
2021-03-17 11:07:47 +08:00
this.RightUp = Util.GetGameObject(self.gameObject, "RightUp")
this.RightUp.transform.localScale = Vector3.one * UIManager.adapterScale
2020-05-09 13:31:21 +08:00
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, -1600, 150), av2.y)
if v2.x + av2.x < -1600 or v2.x + av2.x > 150 then
2020-05-09 13:31:21 +08:00
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
2021-03-22 13:47:59 +08:00
curNPCList = {}
PlayerManager.GetMainPlayerNPCData(function(NPCList)
for i = 1, #NPCList do
2021-03-29 16:45:04 +08:00
local view = MainPlayerView.New(false, this.btnClickMove, rect, Vector2.New(math.random(rect.xMin, rect.xMax), math.random(rect.yMin, rect.yMax)),NPCList[i])
view.NameText.text = NPCList[i].userName or NPCList[i].name
view:SetAutoMove()
2021-03-22 13:47:59 +08:00
view.leader.transform.name = "MainPlayerView"..i
table.insert(curNPCList,view)
end
end)
--实例化自己
this:OnChangeTitleOrRideOrSkin(rect)
2020-05-09 13:31:21 +08:00
--八日登陆礼预览
Util.AddClick(this.sgBtn,function()
--UIManager.OpenPanel(UIName.PassGiftPopup,true)ActivityTypeDef.SevenDayRegister
--JumpManager.GoJump(15001)
UIManager.OpenPanel(UIName.EightDayGiftPanel)
end)
2021-03-31 15:52:11 +08:00
--十五日登录奖励
Util.AddClick(this.fgBtn,function()
UIManager.OpenPanel(UIName.FifteenDayGiftPanel)
end)
2020-05-09 13:31:21 +08:00
--日常任务
Util.AddClick(this.btnDailyMission, function()
2020-06-13 11:47:13 +08:00
UIManager.OpenPanel(UIName.MissionDailyPanel)
2020-05-09 13:31:21 +08:00
end)
--邮件
Util.AddClick(this.btnYouJian, function()
UIManager.OpenPanel(UIName.MailMainPanel)
end)
-- 精英怪
Util.AddClick(this.btnJingying, function()
if not EliteMonsterManager.HasEliteMonster() then
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip(Language[10529])
2020-05-09 13:31:21 +08:00
return
end
UIManager.OpenPanel(UIName.EliteMonsterPanel, 1)
end)
2021-03-17 10:38:07 +08:00
2020-05-09 13:31:21 +08:00
Util.AddClick(this.paryGift, function()
UIManager.OpenPanel(UIName.PrayMainPanel)
end)
--群英招募
Util.AddClick(this.btnRecruit, function()
--UIManager.OpenPanel(UIName.RecruitPanel)
this.FunctionClickEvent(FUNCTION_OPEN_TYPE.RECURITY, function ()
UIManager.OpenPanel(UIName.RecruitPanel)
end)
this.ScenceBtnClick(FUNCTION_OPEN_TYPE.RECURITY)
end)
--元素招募
Util.AddClick(this.btnElementDrawCard, function()
this.FunctionClickEvent(FUNCTION_OPEN_TYPE.ELEMENT_RECURITY, function ()
UIManager.OpenPanel(UIName.ElementDrawCardPanel)
end)
this.ScenceBtnClick(FUNCTION_OPEN_TYPE.ELEMENT_RECURITY)
end)
--秘盒
Util.AddClick(this.btnSecretBox, function()
this.FunctionClickEvent(FUNCTION_OPEN_TYPE.SECRETBOX, function ()
UIManager.OpenPanel(UIName.SecretBoxPanel)
end)
this.ScenceBtnClick(FUNCTION_OPEN_TYPE.SECRETBOX)
end)
-- 给他一个点击事件吧,不然说个不停
Util.AddClick(this.btnYunyou, function()
UIManager.OpenPanel(UIName.MainShopPanel, SHOP_TYPE.ROAM_SHOP)
end)
-- 打开怪兽来袭界面t
Util.AddClick(this.btnMonster, function()
JumpManager.GoJump(1011)
this.ScenceBtnClick(FUNCTION_OPEN_TYPE.MONSTER_COMING)
end)
2021-03-17 10:38:07 +08:00
2020-05-09 13:31:21 +08:00
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)
2020-06-18 20:39:29 +08:00
Util.AddClick(this.btnColorfulWorld, function()
2020-08-22 17:05:37 +08:00
if ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.ENDLESS) then
2020-07-28 20:51:28 +08:00
PlayerManager.carbonType = 2
UIManager.OpenPanel(UIName.CarbonTypePanelV2)
2020-07-23 16:01:26 +08:00
else
2020-08-22 17:05:37 +08:00
local config = ConfigManager.GetConfigData(ConfigName.GlobalSystemConfig,FUNCTION_OPEN_TYPE.ENDLESS)
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip(string.format(Language[10279],config.OpenRules[2]))
2020-07-23 16:01:26 +08:00
end
this.ScenceBtnClick(FUNCTION_OPEN_TYPE.ENDLESS)
2020-05-09 13:31:21 +08:00
end)
Util.AddClick(this.btnFenjie, function()
JumpManager.GoJump(24001)
this.ScenceBtnClick(FUNCTION_OPEN_TYPE.HERO_RESOLVE)
end)
2021-03-17 10:38:07 +08:00
2020-05-09 13:31:21 +08:00
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
2020-06-19 20:19:35 +08:00
this.ScenceBtnClick(FUNCTION_OPEN_TYPE.COMPOUND)
2020-05-09 13:31:21 +08:00
end)
2020-06-18 20:39:29 +08:00
Util.AddClick(this.btnRank, function()
2020-05-09 13:31:21 +08:00
if (ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.ALLRANKING)) then
2020-06-08 13:57:30 +08:00
local types = {}
local activiteIds = {}
for i = 1, #rankKingList do
2020-07-20 16:38:26 +08:00
if rankKingList[i].isRankingMainPanelShow then
table.insert(types,rankKingList[i].rankType)
table.insert(activiteIds,rankKingList[i].activiteId)
end
2020-06-08 13:57:30 +08:00
end
NetManager.RankFirstRequest(types,activiteIds,function (msg)
UIManager.OpenPanel(UIName.RankingListMainPanel,msg)
end)
2020-05-09 13:31:21 +08:00
else
local tip = ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.ALLRANKING)
PopupTipPanel.ShowTip(tip)
end
this.ScenceBtnClick(FUNCTION_OPEN_TYPE.ALLRANKING)
end)
2020-08-11 16:31:17 +08:00
2020-05-09 13:31:21 +08:00
-- 好友
Util.AddClick(this.btnFriend, function()
UIManager.OpenPanel(UIName.GoodFriendMainPanel)
end)
-- 外敌(NPC按钮)
Util.AddClick(this.btnAlienNPC, function()
this.FunctionClickEvent(FUNCTION_OPEN_TYPE.FIGHT_ALIEN, function ()
-- 外敌展示界面
local list = AdventureManager.GetAdventureEnemyList()
if not list or #list <= 0 or GetTimeStamp() > list[1].levelTime then
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip(Language[10701])
2020-05-09 13:31:21 +08:00
return
end
UIManager.OpenPanel(UIName.MonsterShowPanel, list[1].bossGroupId, function()
UIManager.OpenPanel(UIName.FormationPanel, FORMATION_TYPE.ADVENTURE_BOSS, list[1])
end, function()end, true, 4)
end)
end)
-- 场景中的外敌
Util.AddClick(this.btnWaiDi, function ()
this.FunctionClickEvent(FUNCTION_OPEN_TYPE.FIGHT_ALIEN, function ()
UIManager.OpenPanel(UIName.AlienMainPanel)
end)
this.ScenceBtnClick(FUNCTION_OPEN_TYPE.FIGHT_ALIEN)
end)
-- 异妖
Util.AddClick(this.btnYiYao, function ()
this.FunctionClickEvent(FUNCTION_OPEN_TYPE.DIFFER_DEMONS, function ()
UIManager.OpenPanel(UIName.DiffMonsterPanel)
end)
this.ScenceBtnClick(FUNCTION_OPEN_TYPE.DIFFER_DEMONS)
end)
Util.AddClick(this.btnPokemon, function ()
this.FunctionClickEvent(FUNCTION_OPEN_TYPE.POKEMON, function ()
UIManager.OpenPanel(UIName.PokemonMainPanel)
end)
this.ScenceBtnClick(FUNCTION_OPEN_TYPE.POKEMON)
end)
2020-08-05 15:36:22 +08:00
--神将合成、神将置换
2020-08-05 16:30:02 +08:00
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
2020-09-23 20:27:29 +08:00
end)
2021-01-15 17:50:43 +08:00
2020-11-27 17:59:25 +08:00
Util.AddClick(this.btnHongMeng,function()
2021-01-06 11:16:10 +08:00
NetManager.HongMengInfoResponse(function ()
2020-12-21 10:08:30 +08:00
-- body
2021-03-04 15:16:23 +08:00
print(Language[12211]..HarmonyManager:HongMengTowerUpLimit())
2021-01-06 11:16:10 +08:00
if HarmonyManager:HongMengTowerUpLimit() > 0 then
-- body
UIManager.OpenPanel(UIName.HongMengEnvoyPanel)
2021-01-06 10:03:38 +08:00
else
UIManager.OpenPanel(UIName.HongMengPanel)
end
2021-01-06 11:16:10 +08:00
end)
2021-01-20 18:27:23 +08:00
end)
2021-03-23 15:37:39 +08:00
Util.AddClick(this.btnTianShuMiJuan,function()
UIManager.OpenPanel(UIName.TianShuMiJuan,1)
2021-03-25 10:42:42 +08:00
this.ScenceBtnClick(FUNCTION_OPEN_TYPE.tianshumijuan)
2021-03-23 15:37:39 +08:00
end)
2020-05-09 13:31:21 +08:00
this.BindRedPoint()
end
--点击时检测功能
function this.FunctionClickEvent(funcId, callback)
if not funcId or funcId == 0 or not callback then return end
local isOpen = ActTimeCtrlManager.SingleFuncState(funcId)
if isOpen then
if callback then callback() end
else
PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(funcId))
end
end
-- 所有按钮的额外点击事件
function this.ScenceBtnClick(funcId)
if ActTimeCtrlManager.IsQualifiled(funcId) then
if funcId == FUNCTION_OPEN_TYPE.GUILD then
this.operateNewText[FUNCTION_OPEN_TYPE.GUILD]:SetActive(false)
this.BtView:CheckMainCityNew()
end
end
FunctionOpenMananger.CleadNewText(funcId)
end
-- 设置图标动画
function this.SetAnim()
local isOpen = FunctionOpenMananger.GetRootState(PanelTypeView.MainCity)
if isOpen then
PlayUIAnim(this.animRoot)
else
PlayUIAnimBack(this.animRoot)
end
end
-- 绑定红点
function this.BindRedPoint()
BindRedPointObject(RedPointType.Mail, this.mailRedPoint)
2020-06-03 19:09:01 +08:00
BindRedPointObject(RedPointType.DailyTaskMain, this.DailyRedPoint)
2020-05-09 13:31:21 +08:00
BindRedPointObject(RedPointType.Shop, this.rpShangdian)
BindRedPointObject(RedPointType.Shop_Roam_Check, this.rpYunyou)
BindRedPointObject(RedPointType.Arena, this.rpJingjichang)
BindRedPointObject(RedPointType.Friend, this.friendRed)
2020-06-30 18:59:44 +08:00
BindRedPointObject(RedPointType.RankingSort, this.rankRed)
2020-05-09 13:31:21 +08:00
BindRedPointObject(RedPointType.Recruit, this.rpRecruit)
BindRedPointObject(RedPointType.SecretBox, this.rpSecretBox)
BindRedPointObject(RedPointType.Alien, this.rpAlien)
BindRedPointObject(RedPointType.DiffMonster, this.rpYiYao)
2020-08-13 14:43:44 +08:00
BindRedPointObject(RedPointType.Vientiane, this.rpColorfulWorld)
BindRedPointObject(RedPointType.PokemonMainCity, this.rpPokemon)
2020-12-18 13:39:35 +08:00
BindRedPointObject(RedPointType.HongMeng,this.HongMengRedPoint)
2021-03-23 16:52:19 +08:00
BindRedPointObject(RedPointType.TianShuMiJuan,this.rpbtnTianShuMiJuan)
2020-05-09 13:31:21 +08:00
end
-- 绑定红点
function this.ClearRedPoint()
ClearRedPointObject(RedPointType.Mail, this.mailRedPoint)
2020-06-03 19:09:01 +08:00
ClearRedPointObject(RedPointType.DailyTaskMain, this.DailyRedPoint)
2020-05-09 13:31:21 +08:00
ClearRedPointObject(RedPointType.Shop, this.rpShangdian)
ClearRedPointObject(RedPointType.Shop_Roam_Check, this.rpYunyou)
ClearRedPointObject(RedPointType.Arena, this.rpJingjichang)
ClearRedPointObject(RedPointType.Friend, this.friendRed)
2020-06-30 18:59:44 +08:00
ClearRedPointObject(RedPointType.RankingSort, this.rankRed)
2020-05-09 13:31:21 +08:00
ClearRedPointObject(RedPointType.Recruit, this.rpRecruit)
ClearRedPointObject(RedPointType.SecretBox, this.rpSecretBox)
ClearRedPointObject(RedPointType.Alien, this.rpAlien)
ClearRedPointObject(RedPointType.DiffMonster, this.rpYiYao)
2020-08-13 14:43:44 +08:00
ClearRedPointObject(RedPointType.Vientiane, this.rpColorfulWorld)
ClearRedPointObject(RedPointType.PokemonMainCity, this.rpPokemon)
2021-03-23 16:52:19 +08:00
ClearRedPointObject(RedPointType.TianShuMiJuan,this.rpbtnTianShuMiJuan)
2020-05-09 13:31:21 +08:00
end
--添加事件监听(用于子类重写)
function this:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Player.OnChangeName, this.RefreshChangeName)
Game.GlobalEvent:AddEvent(GameEvent.FunctionCtrl.OnFunctionOpen, this.InitFuncShow)
Game.GlobalEvent:AddEvent(GameEvent.FunctionCtrl.OnFunctionClose, this.InitFuncShow)
Game.GlobalEvent:AddEvent(GameEvent.Activity.OnActivityOpenOrClose, this.RefreshActivityBtn)
Game.GlobalEvent:AddEvent(GameEvent.Activity.OnPatFaceRedRefresh, this.RefreshShowPatPaceActivity)
Game.GlobalEvent:AddEvent(GameEvent.Adventure.OnEnemyListChanged, this.OnAlienListChanged)
2020-05-15 16:52:35 +08:00
Game.GlobalEvent:AddEvent(GameEvent.EightDay.GetRewardSuccess, this.RefreshEightGiftPreview)
Game.GlobalEvent:AddEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, this.RefreshEightGiftPreview)
2020-05-25 19:16:23 +08:00
Game.GlobalEvent:AddEvent(GameEvent.FindFairy.RefreshBuyOpenState, this.RefreshGiftBtnShow)
Game.GlobalEvent:AddEvent(GameEvent.Player.OnShowBattleUpLvTip, this.RefreshBattleUpLvTip)
2020-05-09 13:31:21 +08:00
end
--移除事件监听(用于子类重写)
function this:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnChangeName, this.RefreshChangeName)
Game.GlobalEvent:RemoveEvent(GameEvent.FunctionCtrl.OnFunctionOpen, this.InitFuncShow)
Game.GlobalEvent:RemoveEvent(GameEvent.FunctionCtrl.OnFunctionClose, this.InitFuncShow)
Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnActivityOpenOrClose, this.RefreshActivityBtn)
Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnPatFaceRedRefresh, this.RefreshShowPatPaceActivity)
Game.GlobalEvent:RemoveEvent(GameEvent.Adventure.OnEnemyListChanged, this.OnAlienListChanged)
2020-05-15 16:52:35 +08:00
Game.GlobalEvent:RemoveEvent(GameEvent.EightDay.GetRewardSuccess, this.RefreshEightGiftPreview)
Game.GlobalEvent:RemoveEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, this.RefreshEightGiftPreview)
2020-05-25 19:16:23 +08:00
Game.GlobalEvent:RemoveEvent(GameEvent.FindFairy.RefreshBuyOpenState, this.RefreshGiftBtnShow)
Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnShowBattleUpLvTip, this.RefreshBattleUpLvTip)
2020-05-09 13:31:21 +08:00
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)
orginLayer = self.sortingOrder
2020-06-08 13:57:30 +08:00
this.BtView:SetOrderStatus({ sortOrder = self.sortingOrder })
if this.playerInfoView then
this.playerInfoView:SetLayer(self.sortingOrder)
2020-09-25 21:19:01 +08:00
end
2020-05-09 13:31:21 +08:00
end
2021-03-17 10:38:07 +08:00
function this:OnOpen()
activitys = DynamicActivityManager.GetActivityTableDataByPageInde(0)
this.CreatActivity()
end
function this.CreatActivity()
for k,v in ipairs(activitys) do
if not activityTabs[k] then
2021-03-17 11:07:47 +08:00
activityTabs[k] = {}
activityTabs[k].go = newObjToParent(this.activityTabPrefab,this.RightUp)
2021-03-17 20:43:47 +08:00
activityTabs[k].go.gameObject.name = "tab"..v.Id
2021-03-17 11:07:47 +08:00
activityTabs[k].img = Util.GetGameObject(activityTabs[k].go, "icon"):GetComponent("Image")
activityTabs[k].timeImg = Util.GetGameObject(activityTabs[k].go, "Image_1")
activityTabs[k].timeText = Util.GetGameObject(activityTabs[k].timeImg, "time"):GetComponent("Text")
activityTabs[k].redpot = Util.GetGameObject(activityTabs[k].go, "redPoint")
2021-03-17 10:38:07 +08:00
end
2021-03-17 11:07:47 +08:00
activityTabs[k].go.gameObject:SetActive(false)
2021-03-17 10:38:07 +08:00
if v.ShowTime == 0 then
2021-03-17 11:07:47 +08:00
activityTabs[k].timeImg.gameObject:SetActive(false)
2021-03-17 10:38:07 +08:00
else
2021-03-17 11:07:47 +08:00
activityTabs[k].timeImg.gameObject:SetActive(true)
2021-03-17 10:38:07 +08:00
end
if v.RpType > 0 then
--绑定新的红点
2021-03-17 11:07:47 +08:00
BindRedPointObject(v.RpType,activityTabs[k].redpot)
2021-03-17 10:38:07 +08:00
end
2021-03-22 11:09:49 +08:00
if v.ActiveType > 0 then
local activityId = ActivityGiftManager.IsActivityTypeOpen(v.ActiveType)
if activityId and activityId > 0 and ActivityGiftManager.IsQualifiled(v.ActiveType) and v.ActiveType ~= 42 then
local tempConfig = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.ActivityGroups,"ActId",activityId,"PageType",0)
2021-03-17 10:38:07 +08:00
if tempConfig then
2021-03-22 11:09:49 +08:00
activityTabs[k].img.sprite = Util.LoadSprite(tempConfig.Icon[1])
2021-03-17 10:38:07 +08:00
else
2021-03-22 11:09:49 +08:00
activityTabs[k].img.sprite = Util.LoadSprite(v.Icon[1])
2021-03-17 10:38:07 +08:00
end
else
2021-03-22 11:09:49 +08:00
activityTabs[k].img.sprite = Util.LoadSprite(v.Icon[1])
2021-03-17 10:38:07 +08:00
end
else
2021-03-22 11:09:49 +08:00
activityTabs[k].img.sprite = Util.LoadSprite(v.Icon[1])
2021-03-17 10:38:07 +08:00
end
2021-03-22 11:09:49 +08:00
--开发用
-- LogGreen("v.ActiveType:"..v.ActiveType)
-- if v.ActiveType == 62 then
-- local activityId = ActivityGiftManager.IsActivityTypeOpen(v.ActiveType)
-- LogRed("activityId:"..tostring(activityId))
-- LogRed("IsQualifiled:"..tostring(ActivityGiftManager.IsQualifiled(v.ActiveType)))
-- local tempConfig = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.ActivityGroups,"ActId",activityId,"PageType",0)
-- local imageName = ""
-- if activityId and activityId > 0 and tempConfig then
-- imageName = tempConfig.Icon[1]
-- else
-- imageName = v.Icon[1]
-- end
-- LogRed("imageName:"..tostring(imageName))
-- end
2021-03-17 11:07:47 +08:00
activityTabs[k].img:SetNativeSize()
Util.AddOnceClick(activityTabs[k].go,function()
2021-03-17 10:38:07 +08:00
if v.ActiveType > 0 then
this:TabBtnAction(v.ActiveType,1,v)
elseif v.FunType > 0 then
this:TabBtnAction(v.FunType,2,v)
else
this:TabBtnAction(v.ActId,0,v)
end
end)
end
end
function this:TabBtnAction(id,actType,data)
if actType == 1 then
if id == ActivityTypeDef.FirstRecharge then
UIManager.OpenPanel(UIName.FirstRechargePanel)
elseif id == ActivityTypeDef.SevenDayCarnival then
UIManager.OpenPanel(UIName.SevenDayCarnivalPanelV2,SevenDayCarnivalManager.GetPriorityDayNumber())
elseif id == ActivityTypeDef.WarPowerSort then
UIManager.OpenPanel(UIName.WarPowerSortPanel)
elseif id == ActivityTypeDef.DailyRecharge then
UIManager.OpenPanel(UIName.DailyRechargePanel)
elseif id == ActivityTypeDef.Pray then
UIManager.OpenPanel(UIName.PrayMainPanel)
elseif id == ActivityTypeDef.DemonSlayer then
UIManager.OpenPanel(UIName.DemonSlayerPanel)
elseif id == ActivityTypeDef.TreasureOfSomeBody then
UIManager.OpenPanel(UIName.MissionDailyPanel,2,1)
elseif id == ActivityTypeDef.TreasureStore then
UIManager.OpenPanel(UIName.TreasureStorePopup)
elseif id == ActivityTypeDef.DynamicAct then
local dynamicAct = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.DynamicAct)
local curindex = 1
if dynamicAct then
curindex = GlobalActConfig[dynamicAct].ShowArt
end
-- LogBlue("当前选中页签0"..curindex)
UIManager.OpenPanel(UIName.DynamicActivityPanel)
elseif id == ActivityTypeDef.SupremeHero then
UIManager.OpenPanel(UIName.SupremeHeroPopup)
elseif id == ActivityTypeDef.NiuZhuan then
UIManager.OpenPanel(UIName.NiuZhuanQianKunPanel)
2021-03-22 11:09:49 +08:00
elseif id == ActivityTypeDef.NiuQi then
UIManager.OpenPanel(UIName.NiuQiChongTianPanel)
2021-03-29 09:52:53 +08:00
elseif id == ActivityTypeDef.FuXingGaoZhao then
UIManager.OpenPanel(UIName.FuXingGaoZhaoPanel)
2021-03-17 10:38:07 +08:00
end
elseif actType == 2 then
if id == FUNCTION_OPEN_TYPE.SERVER_START_GIFT then
UIManager.OpenPanel(UIName.CourtesyDressPanel)
elseif id == 36 then
UIManager.OpenPanel(UIName.ActivityMainPanel,id)
2021-03-17 10:38:07 +08:00
elseif id == FUNCTION_OPEN_TYPE.EXPERT then
UIManager.OpenPanel(UIName.ExpertPanel)
elseif id == 40 then
2021-03-30 10:48:34 +08:00
UIManager.OpenPanel(UIName.ActivityMainPanel,id)
2021-03-17 10:38:07 +08:00
elseif id == FUNCTION_OPEN_TYPE.LUCKYTURN then
UIManager.OpenPanel(UIName.LuckyTurnTablePanel)
elseif id == FUNCTION_OPEN_TYPE.Achiecement then
UIManager.OpenPanel(UIName.AchievementPanel)
elseif id == 72 then
JumpManager.GoJump(75001)
elseif id == FUNCTION_OPEN_TYPE.ARENA then
UIManager.OpenPanel(UIName.ArenaTopMatchPanel)
end
else
if id == 666 then
UIManager.OpenPanel(UIName.UpGradePackagePanel)
elseif id == 668 then
2021-03-30 20:17:26 +08:00
UIManager.OpenPanel(UIName.ActivityMainPanel,id)
2021-03-17 10:38:07 +08:00
elseif id == 667 then
UIManager.OpenPanel(UIName.TimeLimitSkinPanel)
end
end
end
2020-05-09 13:31:21 +08:00
--界面打开时调用(用于子类重写)
function this:OnShow()
-- 音效
if isFirstOpen >= 2 then
-- PlaySoundWithoutClick(SoundConfig.Sound_interface)
end
isFirstOpen = isFirstOpen + 1
2020-09-23 20:27:29 +08:00
isRefeshIcon = true
2020-05-09 13:31:21 +08:00
timePressStarted = Time.realtimeSinceStartup
SoundManager.PlayMusic(SoundConfig.BGM_Main)
--刷新主城npc
this:OnChangeTitleOrRideOrSkin()
2020-05-09 13:31:21 +08:00
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()
2020-05-25 19:16:23 +08:00
this.RefreshGiftBtnShow()
-- 刷新一次编队战斗力
FormationManager.RefreshMainFormationPower()
2020-05-09 13:31:21 +08:00
-- 主界面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
2020-08-22 15:31:14 +08:00
if FirstRechargeManager.IsShowFirstChatge() then
2020-07-17 13:56:30 +08:00
FirstRechargeManager.PlayerPrefsSetStrItemId(1)
2020-08-22 15:31:14 +08:00
--发送埋点数据
CustomEventManager.SendCustomEvents(FBSDKCustomEventType.FirstRecharge,0)
2020-07-17 13:56:30 +08:00
UIManager.OpenPanel(UIName.FirstRechargePanel,nil,function()
AdventureManager.GetIsMaxTime()
end)
else
AdventureManager.GetIsMaxTime()
end
2020-05-09 13:31:21 +08:00
end
--主城调了两边 所以做特殊判断
if not UIManager.IsOpen(UIName.PatFacePanel) then
this.RefreshShowPatPaceActivity()
end
2020-07-17 13:56:30 +08:00
2020-05-09 13:31:21 +08:00
-- 设置主城小人名字
if self.playerView then
self.playerView:SetName()
end
-- 检测公会tip
GuildManager.CheckGuildTip()
2020-06-30 18:59:44 +08:00
CheckRedPointStatus(RedPointType.RankingSort)
if PlayerManager.IsGetFiveStarHero then --and OperatingManager.IsShowFiveStarPatch then
2020-08-22 19:40:14 +08:00
Game.GlobalEvent:DispatchEvent(GameEvent.PatFace.PatFaceSend, FacePanelType.GrowGift, 5)
PlayerManager.IsGetFiveStarHero = false
end
PlayerManager.StarBattleUpLvTipTime(1)
this.battleUpLvTip:SetActive(false)
--检测灵兽红点
PokemonManager.CheckRedPointStatusPokemonMainCityRed()
--检测鸿蒙碑红点
HarmonyManager.CheckRedPoinStatusUpTowerMainCityRed()
2020-05-09 13:31:21 +08:00
2021-03-22 13:47:59 +08:00
FixedUpdateBeat:Add(this.OnUpdate, self)--长按方法注册
end
2020-05-09 13:31:21 +08:00
2021-03-22 13:47:59 +08:00
--
function this.OnUpdate()
--主城人物层级处理
this.OnMainPlayerNPCRefresh()
end
2020-05-09 13:31:21 +08:00
-- 刷新功能显示
function this.InitFuncShow(funcType)
-- 需要显示隐藏的功能检测
if funcType then
if this.btnFunHide[funcType] then
ActTimeCtrlManager.SetFuncLockState(this.btnFunHide[funcType], funcType, false)
return
end
else
for i, v in pairs(this.btnFunHide) do
ActTimeCtrlManager.SetFuncLockState(v, i, false)
end
end
2021-03-17 10:38:07 +08:00
--(百宝斋,点将台,锻器阁,化虚坛,竞技场,四元阵,灵兽山,送神祠,万象境)
2020-05-09 13:31:21 +08:00
if funcType then
if this.operateIcon[funcType] then
local isOpen = ActTimeCtrlManager.SingleFuncState(funcType)
2020-09-23 20:27:29 +08:00
if funcType == FUNCTION_OPEN_TYPE.ENDLESS then
2020-08-13 14:43:44 +08:00
isOpen = ActTimeCtrlManager.IsQualifiled(funcType)
end
2020-05-09 13:31:21 +08:00
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)
2020-09-23 20:27:29 +08:00
if i == FUNCTION_OPEN_TYPE.ENDLESS then
2020-08-13 14:43:44 +08:00
isOpen = ActTimeCtrlManager.IsQualifiled(i)
end
2020-05-09 13:31:21 +08:00
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
2021-03-17 10:38:07 +08:00
for k,v in pairs(activitys) do
2021-03-24 09:48:35 +08:00
local ishow = DynamicActivityManager.IsQualifiled(v.Id)
if ishow then
if v.ActId == 666 then
local giftList = {}
giftList = OperatingManager.GetInfoList()
if #giftList > 0 then
local time = giftList[1].endTime - GetTimeStamp()
if time < 1 then
OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, giftList[1].goodsId)
activityTabs[k].go.gameObject:SetActive(false)
2021-03-17 10:38:07 +08:00
else
2021-03-24 09:48:35 +08:00
activityTabs[k].go.gameObject:SetActive(true)
2021-03-17 11:07:47 +08:00
activityTabs[k].timeText.text = TimeToHMS(time)
2021-03-24 09:48:35 +08:00
end
2021-03-17 10:38:07 +08:00
else
2021-03-24 09:48:35 +08:00
activityTabs[k].go.gameObject:SetActive(false)
end
elseif v.ActId == 668 then
-- 加入对月卡的判断
local isMonthCardActive = OperatingManager.IsMonthCardActive()
2021-03-24 09:48:35 +08:00
local isOpen_128 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_128)
local isOpen_328 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_328)
activityTabs[k].go.gameObject:SetActive(isMonthCardActive and (isOpen_128 or isOpen_328))
if isMonthCardActive then
local cardType = nil
if isOpen_328 then
cardType = GoodsTypeDef.MONTHCARD_328
end
if not cardType and isOpen_128 then
cardType = GoodsTypeDef.MONTHCARD_128
end
if cardType then
local data = OperatingManager.GetGiftGoodsInfo(cardType)
if data then
local time = data.endTime - PlayerManager.serverTime
if time < 1 then
activityTabs[k].go.gameObject:SetActive(false)
2021-03-24 09:48:35 +08:00
else
activityTabs[k].go.gameObject:SetActive(true)
if time >= 86400 then
activityTabs[k].timeText.text = TimeToDH(time)
else
activityTabs[k].timeText.text = TimeToHMS(time)
end
2021-03-24 09:48:35 +08:00
end
2021-03-17 10:38:07 +08:00
end
2021-03-24 09:48:35 +08:00
end
2021-03-17 10:38:07 +08:00
end
2021-03-24 09:48:35 +08:00
elseif v.ActId == 667 then
local limitSkinGift = OperatingManager.GetTimeLimitSkinInfoList()
if not limitSkinGift then
2021-03-17 11:55:02 +08:00
activityTabs[k].go.gameObject:SetActive(false)
2021-03-24 09:48:35 +08:00
else
local time = limitSkinGift.endTime - GetTimeStamp()
if time > 0 then
activityTabs[k].go.gameObject:SetActive(true)
activityTabs[k].timeText.text = TimeToFelaxible(time)
2021-03-24 09:48:35 +08:00
local canGet = BagManager.GetTotalItemNum(1221) > 0 and BagManager.GetTotalItemNum(1222) > 0 and
BagManager.GetTotalItemNum(1223) > 0 and BagManager.GetTotalItemNum(1224) > 0
activityTabs[k].redpot:SetActive(canGet)
else
activityTabs[k].go.gameObject:SetActive(false)
end
2021-03-17 11:55:02 +08:00
end
2021-03-29 09:52:53 +08:00
elseif v.ActId == 6301 then
2021-03-30 10:27:18 +08:00
local ActData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.FuXingGaoZhao)
if ActData then
2021-03-30 16:24:28 +08:00
activityTabs[k].timeText.transform.parent.gameObject:SetActive(ActData.value == 0)
2021-03-30 10:27:18 +08:00
activityTabs[k].go.gameObject:SetActive(ActData.value ~= 2)
2021-03-30 16:24:28 +08:00
if ActData.value == 0 then
local data = string.split(ConfigManager.GetConfigDataByKey(ConfigName.SpecialConfig,"Id",109).Value,"#")
local time = ActData.startTime + tonumber(data[1])*86400 - GetTimeStamp()
activityTabs[k].timeText.text = TimeToFelaxible(time)
2021-03-30 22:42:17 +08:00
if time <= 0 then
activityTabs[k].go.gameObject:SetActive(false)
end
2021-03-30 16:24:28 +08:00
end
2021-03-30 10:27:18 +08:00
else
activityTabs[k].go.gameObject:SetActive(false)
end
2021-03-24 09:48:35 +08:00
elseif v.ShowTime == 1 and activityTabs[k].go.gameObject.activeSelf then
if v.ActiveType > 0 then
local QingLong = ActivityGiftManager.IsActivityTypeOpen(v.ActiveType)
if QingLong and QingLong > 0 and ActivityGiftManager.IsQualifiled(v.ActiveType) then
if v.ActiveType == 42 then
if ActivityGiftManager.GetRewardState(42)~=3 then
local endTime = ActivityGiftManager.GetTaskEndTime(ActivityTypeDef.SupremeHero)
if endTime - PlayerManager.serverTime > 0 then
local time = endTime - PlayerManager.serverTime
if time>= 86400 then
activityTabs[k].timeText.text = TimeToDH(time)
else
activityTabs[k].timeText.text = TimeToHMS(time)
end
2021-03-17 10:38:07 +08:00
else
2021-03-24 09:48:35 +08:00
activityTabs[k].go.gameObject:SetActive(false)
2021-03-17 10:38:07 +08:00
end
else
2021-03-24 09:48:35 +08:00
activityTabs[k].go.gameObject:SetActive(false)
supremHadSet = true
2021-03-17 10:38:07 +08:00
end
2021-03-24 09:48:35 +08:00
elseif v.FunType and v.FunType == 41 then
activityTabs[k].go.gameObject:SetActive(DailyRechargeManager.GetDailyRechargeExist())
2021-03-17 10:38:07 +08:00
else
2021-03-24 09:48:35 +08:00
local info = ActivityGiftManager.GetActivityTypeInfo(v.ActiveType)
local extraTime = 0
if ConfigManager.GetConfigDataByKey(ConfigName.GlobalActivity,"Type",v.ActiveType).GapTime and ConfigManager.GetConfigDataByKey(ConfigName.GlobalActivity,"Type",v.ActiveType).GapTime > 0 then
extraTime = ConfigManager.GetConfigDataByKey(ConfigName.GlobalActivity,"Type",v.ActiveType).GapTime*86400
end
local tempTime = info.endTime - GetTimeStamp() - extraTime
if tempTime > 86400 then
activityTabs[k].timeText.text = TimeToDH(tempTime)
elseif tempTime > 0 then
activityTabs[k].timeText.text = TimeToHMS(tempTime)
else
activityTabs[k].go.gameObject:SetActive(false)
end
2021-03-17 10:38:07 +08:00
end
else
2021-03-24 09:48:35 +08:00
activityTabs[k].go.gameObject:SetActive(false)
end
elseif v.FunType == FUNCTION_OPEN_TYPE.ARENA then
local isOpen = ActTimeCtrlManager.SingleFuncState(v.FunType)
local baseInfo = ArenaTopMatchManager.GetBaseData()
if not isOpen or not baseInfo or not baseInfo.battleStage or baseInfo.battleStage == TOP_MATCH_STAGE.OVER then
activityTabs[k].go.gameObject:SetActive(false)
elseif baseInfo.battleStage == TOP_MATCH_STAGE.CLOSE then
local startTime = ArenaTopMatchManager.GetTopMatchTime()
local tempTime = startTime - PlayerManager.serverTime
-- 当日五点开始显示
if tempTime > 0 and tempTime < 16 * 60 * 60 then
activityTabs[k].go.gameObject:SetActive(true)
activityTabs[k].timeText.text = "距开始\n"..TimeToHMS(tempTime)
2021-03-17 10:38:07 +08:00
else
2021-03-17 11:07:47 +08:00
activityTabs[k].go.gameObject:SetActive(false)
2021-03-17 10:38:07 +08:00
end
else
2021-03-24 09:48:35 +08:00
activityTabs[k].go.gameObject:SetActive(true)
activityTabs[k].timeText.text = "鏖战中"
end
elseif v.FunType == 72 then
local status = DeathPosManager.GetStatus()
local endTime = DeathPosManager.GetOverTime()
if not status or status == DeathPosStatus.Close or status == DeathPosStatus.Belated or status == DeathPosStatus.Reward then
2021-03-17 11:07:47 +08:00
activityTabs[k].go.gameObject:SetActive(false)
2021-03-24 09:48:35 +08:00
else
if endTime then
local tempTime = endTime - PlayerManager.serverTime
if tempTime and tempTime > 0 then
activityTabs[k].timeText.text = "距闯阵结束\n"..TimeToHMS(tempTime)
activityTabs[k].go.gameObject:SetActive(true)
else
activityTabs[k].go.gameObject:SetActive(false)
end
2021-03-17 10:38:07 +08:00
else
2021-03-17 11:07:47 +08:00
activityTabs[k].go.gameObject:SetActive(false)
2021-03-17 10:38:07 +08:00
end
end
2021-03-24 09:48:35 +08:00
else
activityTabs[k].go.gameObject:SetActive(false)
2020-09-24 17:07:12 +08:00
end
end
end
2021-03-17 10:38:07 +08:00
end
2020-06-18 20:39:29 +08:00
end
2020-05-09 13:31:21 +08:00
--界面关闭时调用(用于子类重写)
function this:OnClose()
PlayerManager.StopBattleUpLvTipTime()
2020-05-09 13:31:21 +08:00
this.ChatTipView:StopCheck()
PatFaceManager.isLogin = false
2021-03-22 13:47:59 +08:00
FixedUpdateBeat:Remove(this.OnUpdate, self)
2020-05-09 13:31:21 +08:00
end
--界面销毁时调用(用于子类重写)
function this:OnDestroy()
2021-03-17 10:38:07 +08:00
for k,v in ipairs(activitys) do
if v.RpType > 0 then
2021-03-17 11:07:47 +08:00
ClearRedPointObject(v.RpType,activityTabs[k].redpot)
activityTabs[k].go.gameObject:SetActive(false)
2021-03-17 10:38:07 +08:00
end
end
activitys = {}
activityTabs = {}
2020-05-09 13:31:21 +08:00
SubUIManager.Close(this.UpView)
SubUIManager.Close(this.BtView)
SubUIManager.Close(this.ChatTipView)
SubUIManager.Close(this.playerInfoView)
this.playerInfoView = nil
2020-05-09 13:31:21 +08:00
-- 清楚红点
this.ClearRedPoint()
-- 计时器
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
2020-05-25 19:16:23 +08:00
-- 刷新一些购买活动的按钮限时
function this.RefreshGiftBtnShow()
2021-03-17 10:38:07 +08:00
for k,v in pairs(activitys) do
2021-03-24 09:48:35 +08:00
local ishow = DynamicActivityManager.IsQualifiled(v.Id)
if v.ActId == 668 and ishow then
-- 加入对月卡的判断
local isMonthCardActive = OperatingManager.IsMonthCardActive()
2021-03-17 10:38:07 +08:00
local isOpen_128 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_128)
local isOpen_328 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_328)
activityTabs[k].go.gameObject:SetActive(isMonthCardActive and (isOpen_128 or isOpen_328))
2021-03-17 10:38:07 +08:00
end
end
2020-05-25 19:16:23 +08:00
end
2020-05-09 13:31:21 +08:00
--后台推送
function this.RefreshActivityBtn(context)
2021-03-17 10:38:07 +08:00
LogGreen("context.type1 " .. context.type .. " " .. context.status)
for k,v in ipairs(activitys) do
2021-03-29 20:20:02 +08:00
if v.ActiveType > 0 and v.ActiveType == context.type then
local activityId = ActivityGiftManager.IsActivityTypeOpen(v.ActiveType)
2021-03-17 10:38:07 +08:00
if activityId and activityId > 0 and ActivityGiftManager.IsQualifiled(v.ActiveType) then
2021-03-29 20:20:02 +08:00
if v.FunType and v.FunType == 41 then
activityTabs[k].go.gameObject:SetActive(DailyRechargeManager.GetDailyRechargeExist())
else
activityTabs[k].go.gameObject:SetActive(context.status == 1)
end
2021-03-17 10:38:07 +08:00
else
2021-03-17 11:07:47 +08:00
activityTabs[k].go.gameObject:SetActive(false)
2020-05-09 13:31:21 +08:00
end
2021-03-17 10:38:07 +08:00
elseif v.FunType > 0 and v.FunType == context.type then
if ActTimeCtrlManager.SingleFuncState(v.FunType) then
2021-03-29 20:20:02 +08:00
if v.FunType and v.FunType == 41 then
activityTabs[k].go.gameObject:SetActive(DailyRechargeManager.GetDailyRechargeExist())
else
activityTabs[k].go.gameObject:SetActive(context.status == 1)
end
2021-03-17 10:38:07 +08:00
else
2021-03-17 11:07:47 +08:00
activityTabs[k].go.gameObject:SetActive(false)
2021-03-17 10:38:07 +08:00
end
2020-05-09 13:31:21 +08:00
end
end
2020-09-23 20:27:29 +08:00
isRefeshIcon = true
2020-05-09 13:31:21 +08:00
end
--客户端自己Show刷新
function this.RefreshActivityShow()
2020-05-15 16:52:35 +08:00
--八日登陆
this.RefreshEightGiftPreview()
2021-03-23 20:28:31 +08:00
for k,v in ipairs(activitys) do
local ishow = DynamicActivityManager.IsQualifiled(v.Id)
if ishow then
if v.ActiveType < 1 and v.FunType < 1 then
if v.ActId == 666 then
--限时折扣
local giftList = {}
giftList = OperatingManager.GetInfoList()
if #giftList > 0 then
local time = giftList[1].endTime - GetTimeStamp()
2021-03-17 10:38:07 +08:00
if time < 1 then
2021-03-23 20:28:31 +08:00
OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, giftList[1].goodsId)
2021-03-17 11:07:47 +08:00
activityTabs[k].go.gameObject:SetActive(false)
2021-03-17 10:38:07 +08:00
else
2021-03-17 11:07:47 +08:00
activityTabs[k].go.gameObject:SetActive(true)
2021-03-23 20:28:31 +08:00
end
else
activityTabs[k].go.gameObject:SetActive(false)
2021-03-17 10:38:07 +08:00
end
2021-03-23 20:28:31 +08:00
elseif v.ActId == 668 then
--超值基金
-- 加入对月卡的判断
local isMonthCardActive = OperatingManager.IsMonthCardActive()
2021-03-23 20:28:31 +08:00
local isOpen_128 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_128)
local isOpen_328 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_328)
activityTabs[k].go.gameObject:SetActive(isMonthCardActive and (isOpen_128 or isOpen_328))
if isMonthCardActive then
local cardType = nil
if isOpen_328 then
cardType = GoodsTypeDef.MONTHCARD_328
2021-03-23 20:28:31 +08:00
end
if not cardType and isOpen_128 then
cardType = GoodsTypeDef.MONTHCARD_328
2021-03-23 20:28:31 +08:00
end
if cardType then
local data = OperatingManager.GetGiftGoodsInfo(cardType)
if data then
local time = data.endTime - PlayerManager.serverTime
if time < 1 then
activityTabs[k].go.gameObject:SetActive(false)
else
activityTabs[k].go.gameObject:SetActive(true)
end
end
end
end
2021-03-23 20:28:31 +08:00
end
elseif v.ActiveType > 0 then
local activityId = ActivityGiftManager.IsActivityTypeOpen(v.ActiveType)
if activityId and activityId > 0 and ActivityGiftManager.IsQualifiled(v.ActiveType) then
if v.ActiveType == 42 then
if ActivityGiftManager.GetRewardState(42) ~= 3 then
local endTime = ActivityGiftManager.GetTaskEndTime(ActivityTypeDef.SupremeHero)
if endTime - PlayerManager.serverTime > 0 then
activityTabs[k].go.gameObject:SetActive(true)
else
activityTabs[k].go.gameObject:SetActive(false)
end
2021-03-17 10:38:07 +08:00
else
2021-03-23 20:28:31 +08:00
activityTabs[k].go.gameObject:SetActive(false)
2021-03-17 10:38:07 +08:00
end
elseif v.FunType and v.FunType == 41 then
activityTabs[k].go.gameObject:SetActive(DailyRechargeManager.GetDailyRechargeExist())
2021-03-17 10:38:07 +08:00
else
2021-03-23 20:28:31 +08:00
activityTabs[k].go.gameObject:SetActive(true)
2021-03-29 20:20:02 +08:00
end
2021-03-17 10:38:07 +08:00
else
2021-03-23 20:28:31 +08:00
activityTabs[k].go.gameObject:SetActive(false)
end
elseif v.FunType > 0 then
if ActTimeCtrlManager.SingleFuncState(v.FunType) then
activityTabs[k].go.gameObject:SetActive(true)
else
activityTabs[k].go.gameObject:SetActive(false)
end
2021-03-17 10:38:07 +08:00
else
2021-03-23 20:28:31 +08:00
activityTabs[k].go.gameObject:SetActive(false)
2021-03-17 10:38:07 +08:00
end
else
2021-03-23 20:28:31 +08:00
activityTabs[k].go.gameObject:SetActive(false)
2021-03-17 10:38:07 +08:00
end
2021-03-23 20:28:31 +08:00
2020-05-09 13:31:21 +08:00
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("结束了!!!")
2020-05-09 13:31:21 +08:00
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
2020-05-15 16:52:35 +08:00
--八日登录奖励预览
function this.RefreshEightGiftPreview()
2020-06-18 20:39:29 +08:00
local state = false
local getRewardState = ActivityGiftManager.sevenDayGetRewardState
for i, v in pairs(getRewardState) do
if (v == 0) then
state = true
2020-05-15 16:52:35 +08:00
end
2020-06-18 20:39:29 +08:00
end
if ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.EightDayGift) and state then
this.RefreshSevenGiftPreview()
this.sgBtn:SetActive(true)
2020-05-15 16:52:35 +08:00
else
this.sgBtn:SetActive(false)
end
end
2020-05-09 13:31:21 +08:00
-- 七日登陆奖励预览
function this.RefreshSevenGiftPreview()
--判断今日是否有可领取
local isHaveGift = ActivityGiftManager.CheckSevenDayRed()
local curDay = math.ceil((CalculateSecondsNowTo_N_OClock(0) + GetTimeStamp() - PlayerManager.userCreateTime)/86400)
2020-05-09 13:31:21 +08:00
local itemId=0
if isHaveGift then
local haveGiftList=nil
for j = 1, #ActivityGiftManager.sevenDayGetRewardState do
2020-06-23 18:36:24 +08:00
if ActivityGiftManager.sevenDayGetRewardState[j]==0 and j<=curDay then
2020-05-09 13:31:21 +08:00
if haveGiftList==nil then
2020-06-18 20:39:29 +08:00
haveGiftList=ConfigManager.GetConfigDataByDoubleKey(ConfigName.ActivityRewardConfig,"ActivityId",56,"Sort",j)
2020-05-09 13:31:21 +08:00
end
end
end
itemId=haveGiftList.Reward[1][1]
2020-05-25 19:16:23 +08:00
local Gift = ConfigManager.GetConfigDataByKey(ConfigName.ItemConfig,"Id",itemId)
2021-01-26 17:08:39 +08:00
this.sgType.text=GetLanguageStrById(Gift.Name)
2021-03-02 16:53:12 +08:00
this.sgInfo.text=Language[11214]
2020-05-09 13:31:21 +08:00
this.sgEffect[1].gameObject:SetActive(false)
this.sgEffect[2].gameObject:SetActive(true)
else
2020-05-15 16:52:35 +08:00
if (ActivityGiftManager.canRewardDay+1)>=9 then
2020-05-09 13:31:21 +08:00
return
end
for i, v in pairs(ActivityGiftManager.sevenDayData) do
2020-06-23 18:36:24 +08:00
if v.Id==curDay+1 then
2020-05-09 13:31:21 +08:00
itemId= v.Reward[1][1]
2020-05-25 19:16:23 +08:00
local Gift = ConfigManager.GetConfigDataByKey(ConfigName.ItemConfig,"Id",itemId)
2021-01-26 17:08:39 +08:00
this.sgType.text=GetLanguageStrById(Gift.Name)
2020-05-09 13:31:21 +08:00
break
end
end
2021-03-02 16:53:12 +08:00
this.sgInfo.text=Language[11215]
2020-05-09 13:31:21 +08:00
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
2021-03-17 10:38:07 +08:00
function this.RefreshBattleUpLvTip()
2020-09-27 16:52:40 +08:00
this.battleUpLvTip:GetComponent("Canvas").sortingOrder = orginLayer + 10
this.battleUpLvTip:SetActive(true)
end
2021-03-22 13:47:59 +08:00
local roleRefreshNum = 0
function this.OnMainPlayerNPCRefresh()
if roleRefreshNum < 60 then
roleRefreshNum = roleRefreshNum + 1
elseif roleRefreshNum >= 60 and PlayerManager.MainPanelRoleMonveState then
roleRefreshNum = 0
-- LogRed("PlayerManager.MainPanelRoleMonveState "..tostring(PlayerManager.MainPanelRoleMonveState))
if curNPCList and #curNPCList > 0 then
table.sort(curNPCList,function(a,b)
return a.leader.transform.localPosition.y > b.leader.transform.localPosition.y
end)
for i = 1, #curNPCList do
if curNPCList[i] then
curNPCList[i].leader.transform:SetSiblingIndex(i)
end
end
PlayerManager.MainPanelRoleMonveState = false
end
end
end
function this:OnChangeTitleOrRideOrSkin()
local curisRefreshMainPanelNpc = PlayerManager.GetisRefreshMainPanelNpc()
2021-03-30 10:28:03 +08:00
-- LogBlue("sssssssssssssssssssssssssssssssssssss "..tostring(curisRefreshMainPanelNpc))
if not curisRefreshMainPanelNpc then return end
local btnClickMoveTran = this.btnClickMove:GetComponent("RectTransform")
local rect = btnClickMoveTran.rect
if self.playerView then
for key, value in pairs(curNPCList) do
if value == self.playerView then
2021-03-30 10:28:03 +08:00
-- LogBlue("移除旧的 self.playerView")
table.remove(curNPCList,key)
end
end
2021-03-30 10:28:03 +08:00
-- LogBlue(":OnClose() :OnClose()")
2021-03-29 16:45:04 +08:00
if self.playerView.NpcGO then
self.playerView.NpcGO:OnClose()
end
if self.playerView then
poolManager:UnLoadAsset("UI_MainPlayer",self.playerView.leader, PoolManager.AssetType.GameObject)
self.playerView = nil
end
end
self.playerView = MainPlayerView.New(true, this.btnClickMove, rect, Vector2.New(-1210, 0))
table.insert(curNPCList,self.playerView)
--角色点击行走
self.trigger.onPointerClick = self.trigger.onPointerClick + function(p, d)
local x, v2 = RectTransformUtility.ScreenPointToLocalPointInRectangle(btnClickMoveTran, Input.mousePosition, UIManager.camera, nil)
if not self.moveTween.enabled then
local b1 = v2.x < rect.xMax and v2.x > rect.xMin and v2.y < rect.yMax and v2.y > rect.yMin
if b1 then
self.playerView:SetRolePos(v2)
end
end
end
PlayerManager.SetisRefreshMainPanelNpc(false)
end
2020-06-23 18:36:24 +08:00
return MainPanel