Update - 1.9.0.107
EN: 1.9.0.107 CN: 1.9.0.108 JP: 1.9.0.112 KR: 1.9.0.112
This commit is contained in:
@@ -69,6 +69,9 @@ function ActivityLevelsInstanceLevel:OnEvent_AdventureModuleEnter()
|
||||
end
|
||||
end
|
||||
function ActivityLevelsInstanceLevel:OnEvent_SendMsgFinishBattle()
|
||||
if self.isSettlement then
|
||||
return
|
||||
end
|
||||
local mapCfg = ConfigTable.GetData("ActivityLevelsLevel", self.nLevelId)
|
||||
if self.curFloorIdx < #mapCfg.FloorId then
|
||||
local GetBuildCallback = function(mapBuildData)
|
||||
@@ -90,13 +93,17 @@ function ActivityLevelsInstanceLevel:OnEvent_SendMsgFinishBattle()
|
||||
self.mapActorInfo[nTid] = stActorInfo
|
||||
end
|
||||
PlayerData.nCurGameType = AllEnum.WorldMapNodeType.ActivityLevels
|
||||
local function levelEndCallback()
|
||||
EventManager.Remove("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
|
||||
self:OnEvent_AdventureModuleEnter()
|
||||
end
|
||||
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
|
||||
local mapParams = {
|
||||
tostring(self.curFloorIdx),
|
||||
tostring(self.levelTotalTime)
|
||||
}
|
||||
CS.AdventureModuleHelper.EnterActivityLevelsInstance(self.nLevelId, self.tbCharId, mapParams)
|
||||
CS.AdventureModuleHelper.LevelStateChanged(false)
|
||||
self:OnEvent_AdventureModuleEnter()
|
||||
end
|
||||
PlayerData.Build:GetBuildDetailData(GetBuildCallback, self.nBuildId)
|
||||
return
|
||||
|
||||
@@ -4,6 +4,7 @@ local PB = require("pb")
|
||||
local AdventureModuleHelper = CS.AdventureModuleHelper
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local JointDrillContext = require("Game.UI.JointDrill.JointDrillContext")
|
||||
local mapEventConfig = {
|
||||
LoadLevelRefresh = "OnEvent_LoadLevelRefresh",
|
||||
AdventureModuleEnter = "OnEvent_AdventureModuleEnter",
|
||||
@@ -424,7 +425,7 @@ function JointDrillLevelData_1:JointDrillSuccess(netMsg)
|
||||
}
|
||||
local bSimulate = self.parent:GetBattleSimulate()
|
||||
local nBattleCount = self.parent:GetJointDrillBattleCount()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillResult_1, nResultType, self.nCurLevel, 0, self.nLevelId, {}, mapScore, netMsg.Items or {}, netMsg.Change or {}, netMsg.Old, netMsg.New, bSimulate, nBattleCount, self.tbCharDamage)
|
||||
EventManager.Hit(EventId.OpenPanel, JointDrillContext.GetPanelId(self.parent.nActId, "Result"), nResultType, self.nCurLevel, 0, self.nLevelId, {}, mapScore, netMsg.Items or {}, netMsg.Change or {}, netMsg.Old, netMsg.New, bSimulate, nBattleCount, self.tbCharDamage)
|
||||
self.parent:ChallengeEnd()
|
||||
end
|
||||
EventManager.Add("SettlementPerformLoadFinish", self, openBattleResultPanel)
|
||||
@@ -494,7 +495,7 @@ function JointDrillLevelData_1:JointDrillFail(nResultType, netMsg)
|
||||
mapReward = netMsg.Items or {}
|
||||
mapChange = netMsg.Change or {}
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillResult_1, nResultType, self.nCurLevel, self.nGameTime, self.nLevelId, bossInfo, mapScore, mapReward, mapChange, nOld, nNew, bSimulate, nBattleCount, self.tbCharDamage)
|
||||
EventManager.Hit(EventId.OpenPanel, JointDrillContext.GetPanelId(self.parent.nActId, "Result"), nResultType, self.nCurLevel, self.nGameTime, self.nLevelId, bossInfo, mapScore, mapReward, mapChange, nOld, nNew, bSimulate, nBattleCount, self.tbCharDamage)
|
||||
self.parent:LevelEnd(nResultType)
|
||||
end
|
||||
function JointDrillLevelData_1:SyncGameTime(nTime)
|
||||
@@ -693,7 +694,7 @@ function JointDrillLevelData_1:OnEvent_JointDrill_StopTime()
|
||||
end
|
||||
function JointDrillLevelData_1:OnEvent_JointDrillChallengeFinishError()
|
||||
self:JointDrillFail(AllEnum.JointDrillResultType.ChallengeEnd)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.JointDrillBuildList_1)
|
||||
EventManager.Hit(EventId.ClosePanel, JointDrillContext.GetPanelId(self.parent.nActId, "BuildList"))
|
||||
self.parent:ChallengeEnd()
|
||||
end
|
||||
function JointDrillLevelData_1:OnEvent_UploadDodgeEvent(padMode)
|
||||
|
||||
@@ -2,6 +2,7 @@ local JointDrillLevelData_2 = class("JointDrillLevelData_2")
|
||||
local AdventureModuleHelper = CS.AdventureModuleHelper
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ModuleManager = require("GameCore.Module.ModuleManager")
|
||||
local JointDrillContext = require("Game.UI.JointDrill.JointDrillContext")
|
||||
local mapEventConfig = {
|
||||
LoadLevelRefresh = "OnEvent_LoadLevelRefresh",
|
||||
AdventureModuleEnter = "OnEvent_AdventureModuleEnter",
|
||||
@@ -185,7 +186,7 @@ function JointDrillLevelData_2:JointDrillSuccess(netMsg)
|
||||
}
|
||||
local bSimulate = self.parent:GetBattleSimulate()
|
||||
local nBattleCount = self.parent:GetJointDrillBattleCount()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillResult_2, nResultType, self.nCurLevel, 0, self.nLevelId, {}, mapScore, netMsg.Items or {}, netMsg.Change or {}, netMsg.Old, netMsg.New, bSimulate, nBattleCount, self.tbCharDamage)
|
||||
EventManager.Hit(EventId.OpenPanel, JointDrillContext.GetPanelId(self.parent.nActId, "Result"), nResultType, self.nCurLevel, 0, self.nLevelId, {}, mapScore, netMsg.Items or {}, netMsg.Change or {}, netMsg.Old, netMsg.New, bSimulate, nBattleCount, self.tbCharDamage)
|
||||
self.parent:ChallengeEnd()
|
||||
end
|
||||
EventManager.Add("SettlementPerformLoadFinish", self, openBattleResultPanel)
|
||||
@@ -261,7 +262,7 @@ function JointDrillLevelData_2:JointDrillFail(nResultType, netMsg, nLevel)
|
||||
mapReward = netMsg.Items or {}
|
||||
mapChange = netMsg.Change or {}
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillResult_2, nResultType, self.nCurLevel, self.nGameTime, self.nLevelId, bossInfo, mapScore, mapReward, mapChange, nOld, nNew, bSimulate, nBattleCount, self.tbCharDamage)
|
||||
EventManager.Hit(EventId.OpenPanel, JointDrillContext.GetPanelId(self.parent.nActId, "Result"), nResultType, self.nCurLevel, self.nGameTime, self.nLevelId, bossInfo, mapScore, mapReward, mapChange, nOld, nNew, bSimulate, nBattleCount, self.tbCharDamage)
|
||||
self.parent:LevelEnd(nResultType)
|
||||
end
|
||||
function JointDrillLevelData_2:JointDrillTimeOut()
|
||||
@@ -468,7 +469,7 @@ function JointDrillLevelData_2:OnEvent_JointDrillChallengeFinishError()
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self.parent:SetResetLevelSelect(true)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.JointDrillBuildList_2)
|
||||
EventManager.Hit(EventId.ClosePanel, JointDrillContext.GetPanelId(self.parent.nActId, "BuildList"))
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
self.parent:ChallengeEnd()
|
||||
|
||||
@@ -548,6 +548,23 @@ GameEnum.questType = {
|
||||
Achieve = 6
|
||||
}
|
||||
GameEnum.fateCardActiveAction = {RoomExit = 0, BattleEnd = 1}
|
||||
GameEnum.instanceType = {
|
||||
None = 0,
|
||||
Story = 1,
|
||||
StarTower = 2,
|
||||
VampireSurvivor = 3,
|
||||
RegionBoss = 4,
|
||||
DailyInstance = 5,
|
||||
WeekBoss = 6,
|
||||
SkillInstance = 7,
|
||||
CharGemInstance = 8,
|
||||
TravelerDue = 9
|
||||
}
|
||||
GameEnum.activityDoubleRewardType = {
|
||||
None = 0,
|
||||
Double = 1,
|
||||
Triple = 2
|
||||
}
|
||||
GameEnum.achievementCond = {
|
||||
AchievementSpecific = 1,
|
||||
AchievementTotal = 2,
|
||||
@@ -1827,7 +1844,8 @@ GameEnum.activityType = {
|
||||
Story = 17,
|
||||
PenguinCard = 18,
|
||||
ThrowGift = 19,
|
||||
GoldenSpy = 20
|
||||
GoldenSpy = 20,
|
||||
Double = 21
|
||||
}
|
||||
GameEnum.activityOpenType = {
|
||||
None = 0,
|
||||
@@ -2501,7 +2519,11 @@ GameEnum.activityThemeType = {
|
||||
Spring_10104 = 7,
|
||||
WinterNight_10105 = 8,
|
||||
Postal_10106 = 9,
|
||||
SoloDance_20102 = 10
|
||||
SoloDance_20102 = 10,
|
||||
Viewfinder_10107 = 11,
|
||||
BreakOut_30102 = 12,
|
||||
Swim_11100 = 13,
|
||||
Tech_10108 = 14
|
||||
}
|
||||
GameEnum.ActivityLevelType = {
|
||||
Explore = 1,
|
||||
@@ -2657,7 +2679,8 @@ GameEnum.PenguinCardTriggerPhase = {
|
||||
AfterUpgrade = 6,
|
||||
FatalDamage = 7,
|
||||
PenguinCardChange = 8,
|
||||
FlipEnd = 9
|
||||
FlipEnd = 9,
|
||||
ManualRoll = 10
|
||||
}
|
||||
GameEnum.PenguinCardTriggerType = {
|
||||
None = 1,
|
||||
@@ -2694,7 +2717,9 @@ GameEnum.PenguinCardEffectType = {
|
||||
UpgradeDiscount = 6,
|
||||
AddRound = 7,
|
||||
BlockFatalDamage = 8,
|
||||
UpgradeRebate = 9
|
||||
UpgradeRebate = 9,
|
||||
AddCardRollCount = 10,
|
||||
RollSpecificCard = 11
|
||||
}
|
||||
GameEnum.PenguinCardQuestType = {
|
||||
Score = 1,
|
||||
|
||||
@@ -784,6 +784,7 @@ GameTableDefine.CommonTable = {
|
||||
Lang = {"Desc"}
|
||||
},
|
||||
PenguinCardQuestWeight = {Key = true},
|
||||
PenguinCardTendency = {Key = true},
|
||||
PenguinCardWeight = {Key = true},
|
||||
PeriodicQuest = {
|
||||
Key = true,
|
||||
|
||||
@@ -376,10 +376,11 @@ function GoldenSpyCompanionItem:_CheckVision()
|
||||
local tbRemoveItems = {}
|
||||
for _, item in ipairs(tempItems) do
|
||||
if item.Ctrl ~= self then
|
||||
local removeItem
|
||||
local hitArea = item.Ctrl:GetHitArea()
|
||||
if hitArea and self:_HitAreaInSector(hitArea, vx, vy, forwardAngle, halfAngle, radius) then
|
||||
if item.Ctrl == self.floorCtrl.catchedItem then
|
||||
goto lbl_228
|
||||
goto lbl_229
|
||||
end
|
||||
if item.Ctrl:GetItemCfg().ItemType == GameEnum.GoldenSpyItem.Boom then
|
||||
item.Ctrl:Boom(nil)
|
||||
@@ -423,7 +424,7 @@ function GoldenSpyCompanionItem:_CheckVision()
|
||||
end
|
||||
tbRemoveItems = {}
|
||||
end
|
||||
::lbl_228::
|
||||
::lbl_229::
|
||||
end
|
||||
end
|
||||
function GoldenSpyCompanionItem:_StartVisionCheck()
|
||||
|
||||
@@ -242,6 +242,7 @@ function GoldenSpyFloorCtrl:Shoot(nSpeed, nRadius, nFactor, onRetractComplete, o
|
||||
end
|
||||
function GoldenSpyFloorCtrl:RemoveItem(itemCtrl)
|
||||
local bDelSuccess = false
|
||||
local itemId = itemCtrl:GetItemCfg().Id
|
||||
for i = #self.tbItem, 1, -1 do
|
||||
if self.tbItem[i].Ctrl == itemCtrl then
|
||||
table.insert(self.tbNeedRemoveItem, self.tbItem[i])
|
||||
@@ -251,7 +252,7 @@ function GoldenSpyFloorCtrl:RemoveItem(itemCtrl)
|
||||
end
|
||||
end
|
||||
if bDelSuccess then
|
||||
self.levelCtrl.GoldenSpyFloorData:DeleteItem(itemCtrl:GetItemCfg().Id)
|
||||
self.levelCtrl.GoldenSpyFloorData:DeleteItem(itemId)
|
||||
end
|
||||
end
|
||||
function GoldenSpyFloorCtrl:DropItem()
|
||||
|
||||
@@ -581,6 +581,7 @@ function GoldenSpyLevelCtrl:ShowBuffSelect(tbBuff, callback)
|
||||
local tbShowItem = {}
|
||||
local tbItems = self.GoldenSpyFloorData:GetItems()
|
||||
local tbHasBuff = self.GoldenSpyLevelData:GetBuffData()
|
||||
local curFloor = self.GoldenSpyLevelData:GetCurFloor()
|
||||
for _, v in pairs(tbItems) do
|
||||
local itemCfg = ConfigTable.GetData("GoldenSpyItem", v.itemId)
|
||||
if itemCfg ~= nil and itemCfg.ShowValue ~= false then
|
||||
@@ -686,7 +687,7 @@ function GoldenSpyLevelCtrl:SubTime(nTime)
|
||||
if not self.bChangeTime then
|
||||
self._mapNode.imgWarning.gameObject:SetActive(true)
|
||||
self.bChangeTime = true
|
||||
local subtimeTimer = self:AddTimer(1, 0.8, function()
|
||||
local subtimeTimer = self:AddTimer(1, 0.4, function()
|
||||
self._mapNode.imgWarning.gameObject:SetActive(false)
|
||||
self.bChangeTime = false
|
||||
end, true, true, true)
|
||||
@@ -1075,8 +1076,8 @@ function GoldenSpyLevelCtrl:OnBtnClick_Frozen()
|
||||
end, true, true, true)
|
||||
table.insert(self.tbTimer, timer)
|
||||
local img_frozenCD = self._mapNode.img_frozenCD
|
||||
img_frozenCD.gameObject:SetActive(true)
|
||||
img_frozenCD.fillAmount = 1
|
||||
img_frozenCD.gameObject:SetActive(true)
|
||||
self.FrozenTweener = DOTween.To(function()
|
||||
return img_frozenCD.fillAmount
|
||||
end, function(value)
|
||||
@@ -1090,28 +1091,14 @@ function GoldenSpyLevelCtrl:OnBtnClick_ToolBox()
|
||||
local tbShowItem = {}
|
||||
local tbItems = self.GoldenSpyFloorData:GetItems()
|
||||
local tbHasBuff = self.GoldenSpyLevelData:GetBuffData()
|
||||
local curFloor = self.GoldenSpyLevelData:GetCurFloor()
|
||||
for _, v in pairs(tbItems) do
|
||||
local itemCfg = ConfigTable.GetData("GoldenSpyItem", v.itemId)
|
||||
if itemCfg ~= nil and itemCfg.ShowValue ~= false then
|
||||
local nScore = itemCfg.Score
|
||||
for _, n in ipairs(tbHasBuff) do
|
||||
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", n.buffId)
|
||||
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore then
|
||||
if buffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
|
||||
if n.bActive and table.indexof(n.tbActiveFloor, curFloor) > 0 and buffCfg.Params[1] == itemCfg.ItemType then
|
||||
nScore = nScore + buffCfg.Params[2]
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.DelayBuff then
|
||||
if n.bActive and table.indexof(n.tbActiveFloor, curFloor) > 0 and buffCfg.Params[1] == itemCfg.ItemType then
|
||||
nScore = nScore + buffCfg.Params[2]
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.PermanentBuff then
|
||||
if n.bActive and buffCfg.Params[1] == itemCfg.ItemType then
|
||||
nScore = nScore + buffCfg.Params[2]
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.SkillCountBuff then
|
||||
end
|
||||
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore and buffCfg.Params[1] == itemCfg.ItemType then
|
||||
nScore = nScore + buffCfg.Params[2]
|
||||
end
|
||||
end
|
||||
local itemData = {
|
||||
|
||||
@@ -306,12 +306,12 @@ function GoldenSpyLevelData:AddBuff(nBuffId)
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.SkillCountBuff then
|
||||
buffEntity.bActive = true
|
||||
if buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddSkillUseCount then
|
||||
self.tbSkillData[buffCfg.Params[1]] = self.tbSkillData[buffCfg.Params[1]] + buffCfg.Params[2]
|
||||
self.tbSkillData[buffCfg.Params[1]] = (self.tbSkillData[buffCfg.Params[1]] or 0) + buffCfg.Params[2]
|
||||
EventManager.Hit("GoldenSpy_UpdateSkillCount", buffCfg.Params[1], self.tbSkillData[buffCfg.Params[1]])
|
||||
end
|
||||
end
|
||||
table.insert(self.tbBuff, buffEntity)
|
||||
if self.taskData ~= nil and self.taskData.nScore > 0 and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddExScoreFactor then
|
||||
if self.taskData ~= nil and 0 < self.taskData.nScore and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddExScoreFactor then
|
||||
if buffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
|
||||
if buffEntity.bActive and 0 < table.indexof(buffEntity.tbActiveFloor, self.nCurFloor) then
|
||||
self.taskData.nScore = self.taskData.nScore * (1 + buffCfg.Params[1] / 100.0)
|
||||
|
||||
@@ -29,22 +29,26 @@ GoldenSpyPauseCtrl._mapNodeConfig = {
|
||||
btn_exit = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Exit",
|
||||
sAction = "Giveup"
|
||||
sAction = "Giveup",
|
||||
sActionIconType = "Dark"
|
||||
},
|
||||
btn_restart = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Restart",
|
||||
sAction = "Retry"
|
||||
sAction = "Retry",
|
||||
sActionIconType = "Dark"
|
||||
},
|
||||
btn_continue = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Continue",
|
||||
sAction = "Back"
|
||||
sAction = "Back",
|
||||
sActionIconType = "Dark"
|
||||
},
|
||||
btn_dic = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_OpenDic",
|
||||
sAction = "Depot"
|
||||
sAction = "Depot",
|
||||
sActionIconType = "Dark"
|
||||
}
|
||||
}
|
||||
GoldenSpyPauseCtrl._mapEventConfig = {}
|
||||
|
||||
@@ -43,7 +43,7 @@ function GoldenSpySafeBoxItem:OnSkill_Boom(callback)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
if self.gameObject ~= nil then
|
||||
if self.gameObject then
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -140,7 +140,7 @@ function JointDrillActCtrl:OnBtnClick_Start()
|
||||
return
|
||||
end
|
||||
EventManager.Hit("PlayJointDrillActAnim", "JointDrill_Act_01_out", function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillLevelSelect_1, self.actData.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillLevelSelect_510001, self.actData.nActId)
|
||||
end)
|
||||
end
|
||||
function JointDrillActCtrl:OnBtnClick_Detail()
|
||||
|
||||
@@ -140,7 +140,7 @@ function JointDrillActCtrl:OnBtnClick_Start()
|
||||
return
|
||||
end
|
||||
EventManager.Hit("PlayJointDrillActAnim", "JointDrill_Act_01_out", function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillLevelSelect_2, self.actData.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillLevelSelect_510003, self.actData.nActId)
|
||||
end)
|
||||
end
|
||||
function JointDrillActCtrl:OnBtnClick_Detail()
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
local JointDrillActCtrl = class("JointDrillActCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
JointDrillActCtrl._mapNodeConfig = {
|
||||
btnDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txtDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Detail"
|
||||
},
|
||||
btnWaitStart = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnEvent_WaitStart"
|
||||
},
|
||||
txtBtnWaitStart = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Act_Wait_Start"
|
||||
},
|
||||
imgBtnMask = {},
|
||||
btnStart = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Start"
|
||||
},
|
||||
txtBtnStart = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Act_Goto"
|
||||
},
|
||||
txtActDesc = {sComponentName = "TMP_Text"},
|
||||
txtActTime = {sComponentName = "TMP_Text"},
|
||||
txtFuncLock = {sComponentName = "TMP_Text"},
|
||||
txtBeta = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Beta_Tip"
|
||||
},
|
||||
goCommon = {
|
||||
sNodeName = "---Common---"
|
||||
}
|
||||
}
|
||||
JointDrillActCtrl._mapEventConfig = {
|
||||
PlayJointDrillActAnim = "OnEvent_PlayAnim"
|
||||
}
|
||||
function JointDrillActCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self.mapActCfg = self.actData:GetJointDrillActCfg()
|
||||
if self.mapActCfg == nil then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActDesc, self.mapActCfg.DescText)
|
||||
self:StartActTimer()
|
||||
local bPlayCond, sTips = self.actData:CheckActJumpCond()
|
||||
self._mapNode.txtFuncLock.gameObject:SetActive(not bPlayCond)
|
||||
if not bPlayCond then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtFuncLock, sTips)
|
||||
end
|
||||
end
|
||||
function JointDrillActCtrl:GetTimeStr(nRemainTime)
|
||||
local sTimeStr = ""
|
||||
if nRemainTime <= 60 then
|
||||
local sec = math.floor(nRemainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < nRemainTime and nRemainTime <= 3600 then
|
||||
local min = math.floor(nRemainTime / 60)
|
||||
local sec = math.floor(nRemainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < nRemainTime and nRemainTime <= 86400 then
|
||||
local hour = math.floor(nRemainTime / 3600)
|
||||
local min = math.floor((nRemainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < nRemainTime then
|
||||
local day = math.floor(nRemainTime / 86400)
|
||||
local hour = math.floor((nRemainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
return sTimeStr
|
||||
end
|
||||
function JointDrillActCtrl:StartActTimer()
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel()
|
||||
self.timer = nil
|
||||
end
|
||||
local nOpenTime = self.actData:GetActOpenTime()
|
||||
local nCloseTime = self.actData:GetActEndTime()
|
||||
local nStartTime = nOpenTime + self.mapActCfg.DrillStartTime
|
||||
local nEndTime = nStartTime + self.mapActCfg.DrillDurationTime
|
||||
local nStatus = 0
|
||||
local refreshTime = function()
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
local sTime = ""
|
||||
local nRemainTime = 0
|
||||
if nCurTime < nStartTime then
|
||||
nStatus = AllEnum.JointDrillActStatus.WaitStart
|
||||
nRemainTime = math.max(nStartTime - nCurTime, 0)
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Act_Wait_Start_Time"), self:GetTimeStr(nRemainTime))
|
||||
elseif nCurTime >= nStartTime and nCurTime < nEndTime then
|
||||
nStatus = AllEnum.JointDrillActStatus.Start
|
||||
nRemainTime = math.max(nEndTime - nCurTime, 0)
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Act_Start_Time"), self:GetTimeStr(nRemainTime))
|
||||
else
|
||||
nStatus = AllEnum.JointDrillActStatus.WaitClose
|
||||
nRemainTime = math.max(nCloseTime - nCurTime, 0)
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Act_Wait_Close_Time"), self:GetTimeStr(nRemainTime))
|
||||
end
|
||||
if nRemainTime <= 0 and self.timer ~= nil then
|
||||
self.timer:Cancel()
|
||||
self.timer = nil
|
||||
end
|
||||
self._mapNode.btnStart.gameObject:SetActive(nStatus ~= AllEnum.JointDrillActStatus.WaitStart)
|
||||
self._mapNode.btnWaitStart.gameObject:SetActive(nStatus == AllEnum.JointDrillActStatus.WaitStart)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActTime, sTime)
|
||||
end
|
||||
refreshTime()
|
||||
self.timer = self:AddTimer(0, 1, refreshTime, true, true, true)
|
||||
end
|
||||
function JointDrillActCtrl:ClearActivity()
|
||||
end
|
||||
function JointDrillActCtrl:OnEvent_WaitStart()
|
||||
local bPlayCond = self.actData:CheckActJumpCond(true)
|
||||
if not bPlayCond then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("JointDrill_Act_Wait_Start_Tip"))
|
||||
end
|
||||
function JointDrillActCtrl:OnBtnClick_Start()
|
||||
local bPlayCond = self.actData:CheckActJumpCond(true)
|
||||
if not bPlayCond then
|
||||
return
|
||||
end
|
||||
EventManager.Hit("PlayJointDrillActAnim", "JointDrill_Act_01_out", function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillLevelSelect_510005, self.actData.nActId)
|
||||
end)
|
||||
end
|
||||
function JointDrillActCtrl:OnBtnClick_Detail()
|
||||
if self.mapActCfg == nil then
|
||||
return
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = self.mapActCfg.DetailDesc,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function JointDrillActCtrl:OnEvent_PlayAnim(sAnim, callback)
|
||||
if self.animRoot ~= nil then
|
||||
local nAnimTime = NovaAPI.GetAnimClipLength(self.animRoot, {sAnim})
|
||||
self.animRoot:Play(sAnim, 0, 0)
|
||||
self:AddTimer(1, nAnimTime, function()
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end, true, true, true)
|
||||
elseif callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function JointDrillActCtrl:OnEnable()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function JointDrillActCtrl:OnDisable()
|
||||
end
|
||||
return JointDrillActCtrl
|
||||
@@ -1,7 +1,6 @@
|
||||
local LoginRewardPopUpCtrl_01 = class("LoginRewardPopUpCtrl_01", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
LoginRewardPopUpCtrl_01._mapNodeConfig = {
|
||||
imgActivity = {sComponentName = "Image"},
|
||||
goActTime = {},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"},
|
||||
btnActivity = {
|
||||
|
||||
@@ -51,7 +51,8 @@ LoginSpRewardCtrl_Lsv._mapNodeConfig = {
|
||||
LoginSpRewardCtrl_Lsv._mapEventConfig = {
|
||||
ClickLoginRewardTips = "OnEvent_ClickLoginRewardTips",
|
||||
[EventId.ShowBubbleVoiceText] = "OnEvent_ShowBubbleVoiceText",
|
||||
ActivityListChangeTab = "OnEvent_ActivityListChangeTab"
|
||||
ActivityListChangeTab = "OnEvent_ActivityListChangeTab",
|
||||
[EventId.ClosePanel] = "OnEvent_ClosePanel"
|
||||
}
|
||||
function LoginSpRewardCtrl_Lsv:RefreshRemainTime()
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
@@ -306,4 +307,10 @@ function LoginSpRewardCtrl_Lsv:OnEvent_ActivityListChangeTab(nId)
|
||||
PlayerVoiceData:StopCharVoice()
|
||||
end
|
||||
end
|
||||
function LoginSpRewardCtrl_Lsv:OnEvent_ClosePanel(nPanelId)
|
||||
if nPanelId == PanelId.DiscSample then
|
||||
self.bPlayVoice = false
|
||||
self:PlayVoice()
|
||||
end
|
||||
end
|
||||
return LoginSpRewardCtrl_Lsv
|
||||
|
||||
+40
-25
@@ -1,7 +1,7 @@
|
||||
local MiningGameCtrl = class("MiningGameCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local listPrefabPath = "UI/Play_Mining_400007/GridCell/"
|
||||
local assetPath = "UI/Play_Mining_400007/SpriteAtlas/Sprite/"
|
||||
local listPrefabPath = "UI_Activity/_400011/GridCell/"
|
||||
local assetPath = "UI_Activity/_400011/SpriteAtlas/Sprite/"
|
||||
local signal_typeA = "zs_mining_signal_01"
|
||||
local signal_typeB = "zs_mining_signal_02"
|
||||
local signal_typeC = "zs_mining_signal_03"
|
||||
@@ -89,7 +89,7 @@ function MiningGameCtrl:Awake()
|
||||
self.miningData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
if self.miningData:GetIsFirstIn() then
|
||||
local cb = function()
|
||||
local DicConfig = ConfigTable.GetData("TopBar", "MiningGame_400007")
|
||||
local DicConfig = ConfigTable.GetData("TopBar", "MiningGame_400011")
|
||||
if DicConfig ~= nil then
|
||||
local dicId = DicConfig.EntryId
|
||||
if dicId ~= 0 then
|
||||
@@ -101,17 +101,6 @@ function MiningGameCtrl:Awake()
|
||||
self:AddTimer(1, 0.9, cb, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 1.1)
|
||||
end
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
|
||||
if bInActGroup then
|
||||
local actGroupId = ConfigTable.GetData("Activity", self.nActId).MidGroupId
|
||||
local actGroupData = PlayerData.Activity:GetActivityGroupDataById(actGroupId)
|
||||
local taskActId = actGroupData:GetActivityDataByIndex(AllEnum.ActivityThemeFuncIndex.Task).ActivityId
|
||||
local taskActData = PlayerData.Activity:GetActivityDataById(taskActId)
|
||||
if taskActData ~= nil and taskActData:CheckActivityOpen() then
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task, {nActGroupId, taskActId}, self._mapNode.reward_reddot)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
function MiningGameCtrl:OnEnable()
|
||||
if self.miningData:CheckActivityOpen() then
|
||||
@@ -121,11 +110,27 @@ function MiningGameCtrl:OnEnable()
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_MiningEnd"))
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.MiningGame)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.MiningGame_400011)
|
||||
NovaAPI.InputEnable()
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
|
||||
if bInActGroup then
|
||||
local mapActivityData = ConfigTable.GetData("Activity", self.nActId)
|
||||
local actGroupId = mapActivityData.MidGroupId
|
||||
local actGroupData = PlayerData.Activity:GetActivityGroupDataById(actGroupId)
|
||||
local taskActId = actGroupData:GetActivityDataByIndex(AllEnum.ActivityThemeFuncIndex.Task).ActivityId
|
||||
local taskActData = PlayerData.Activity:GetActivityDataById(taskActId)
|
||||
if taskActData ~= nil and taskActData:CheckActivityOpen() then
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task_Group, {
|
||||
nActGroupId,
|
||||
taskActId,
|
||||
mapActivityData.MiniGameRedDot
|
||||
}, self._mapNode.reward_reddot)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
function MiningGameCtrl:OnDisable(...)
|
||||
if self.gridListCtrl ~= nil then
|
||||
@@ -135,12 +140,17 @@ function MiningGameCtrl:OnDisable(...)
|
||||
end
|
||||
function MiningGameCtrl:OnDestroy()
|
||||
if PlayerData.Activity:IsActivityInActivityGroup(self.nActId) then
|
||||
local actGroupId = ConfigTable.GetData("Activity", self.nActId).MidGroupId
|
||||
local mapActivityData = ConfigTable.GetData("Activity", self.nActId)
|
||||
local actGroupId = mapActivityData.MidGroupId
|
||||
local actGroupData = PlayerData.Activity:GetActivityGroupDataById(actGroupId)
|
||||
local taskActId = actGroupData:GetActivityDataByIndex(AllEnum.ActivityThemeFuncIndex.Task).ActivityId
|
||||
local taskActData = PlayerData.Activity:GetActivityDataById(taskActId)
|
||||
if taskActData ~= nil and taskActData:CheckActivityOpen() then
|
||||
RedDotManager.UnRegisterNode(RedDotDefine.Activity_Group_Task, taskActId, self._mapNode.reward_reddot)
|
||||
RedDotManager.UnRegisterNode(RedDotDefine.Activity_Group_Task_Group, {
|
||||
actGroupId,
|
||||
taskActId,
|
||||
mapActivityData.MiniGameRedDot
|
||||
}, self._mapNode.reward_reddot)
|
||||
return
|
||||
end
|
||||
end
|
||||
@@ -159,14 +169,14 @@ function MiningGameCtrl:UpdateLevelData()
|
||||
local goCell = self:CreatePrefabInstance(prefabPath, self._mapNode.cellPos[i].transform)
|
||||
goCell.name = "cell" .. i
|
||||
end
|
||||
self.gridListCtrl = self:BindCtrlByNode(self._mapNode.GirdListPrefab, "Game.UI.Play_Mining.400007.MiningGridListCtrl")
|
||||
self.gridListCtrl = self:BindCtrlByNode(self._mapNode.GirdListPrefab, "Game.UI.Activity.Mining.400011.MiningGridListCtrl")
|
||||
self.gridListCtrl:SetData(self.nActId)
|
||||
end
|
||||
self:UpdateSupData()
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_level, orderedFormat(ConfigTable.GetUIText("MiningGame_Level"), self.miningData:GetLevel()))
|
||||
self:InitRewardList()
|
||||
self.tbRewardDataList = self.miningData:GetCurLevelRewardData()
|
||||
self:UpdataRewardList()
|
||||
self:UpdateRewardList()
|
||||
local tbCellData = self.miningData:GetCellData()
|
||||
local funcCallback = function(nId)
|
||||
self:KnockCallback(nId)
|
||||
@@ -214,7 +224,7 @@ function MiningGameCtrl:InitRewardList()
|
||||
go:SetActive(false)
|
||||
end
|
||||
end
|
||||
function MiningGameCtrl:UpdataRewardList()
|
||||
function MiningGameCtrl:UpdateRewardList()
|
||||
for i = 1, math.min(#self.tbRewardDataList, 3) do
|
||||
local rewardData = self.tbRewardDataList[i]
|
||||
local rewardConfig = ConfigTable.GetData("MiningTreasure", rewardData.nId)
|
||||
@@ -273,19 +283,24 @@ function MiningGameCtrl:CheckPassAllLevel()
|
||||
self._mapNode.GirdListPrefab:SetActive(not bPassAllLevel)
|
||||
end
|
||||
function MiningGameCtrl:OnBtnClick_OpenGuidePanel()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.MiningGameGuidePanel_400007, self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.MiningGameGuidePanel_400011, self.nActId)
|
||||
end
|
||||
function MiningGameCtrl:OnBtnClick_OpenTask()
|
||||
if PlayerData.Activity:IsActivityInActivityGroup(self.nActId) then
|
||||
local actGroupId = ConfigTable.GetData("Activity", self.nActId).MidGroupId
|
||||
local mapActivityData = ConfigTable.GetData("Activity", self.nActId)
|
||||
local actGroupId = mapActivityData.MidGroupId
|
||||
local actGroupData = PlayerData.Activity:GetActivityGroupDataById(actGroupId)
|
||||
local taskActId = actGroupData:GetActivityDataByIndex(AllEnum.ActivityThemeFuncIndex.Task).ActivityId
|
||||
local taskActData = PlayerData.Activity:GetActivityDataById(taskActId)
|
||||
if taskActData ~= nil and taskActData:CheckActivityOpen() then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Task_10106, taskActId, GameEnum.ActivityTaskTabType.Tab4)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Task_11100, taskActId, GameEnum.ActivityTaskTabType.Tab4)
|
||||
return
|
||||
end
|
||||
RedDotManager.UnRegisterNode(RedDotDefine.Activity_Group_Task, taskActId, self._mapNode.reward_reddot)
|
||||
RedDotManager.UnRegisterNode(RedDotDefine.Activity_Group_Task_Group, {
|
||||
actGroupId,
|
||||
taskActId,
|
||||
mapActivityData.MiniGameRedDot
|
||||
}, self._mapNode.reward_reddot)
|
||||
self._mapNode.reward_reddot:SetActive(false)
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
|
||||
end
|
||||
@@ -332,8 +347,8 @@ function MiningGameCtrl:OnEvent_UpdateRewardStatus(nId)
|
||||
if self.passAnimCb ~= nil then
|
||||
self.passAnimCb()
|
||||
self.bInPassAnim = false
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
end
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
end, true, true, true)
|
||||
end
|
||||
function MiningGameCtrl:OnEvent_MiningKnockResult(tbSkillData)
|
||||
+2
-2
@@ -42,7 +42,7 @@ function MiningGameGuideCtrl:Awake()
|
||||
end
|
||||
self.miningData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
local idList = self.miningData:GetDicGroupId()
|
||||
self.cardPrefabPath = "UI/Play_Mining/CardCell.prefab"
|
||||
self.cardPrefabPath = "UI_Activity/_400011/CardCell.prefab"
|
||||
self.CardCtrl = {}
|
||||
self:InitList(idList)
|
||||
end
|
||||
@@ -68,7 +68,7 @@ function MiningGameGuideCtrl:InitList(list)
|
||||
end
|
||||
if go ~= nil then
|
||||
go.name = config.Id
|
||||
local ctrl = self:BindCtrlByNode(go, "Game.UI.Play_Mining.MiningGameGuideCardCtrl")
|
||||
local ctrl = self:BindCtrlByNode(go, "Game.UI.Activity.Mining.400011.MiningGameGuideCardCtrl")
|
||||
ctrl:SetData(config.Id)
|
||||
table.insert(self.CardCtrl, ctrl)
|
||||
end
|
||||
+3
-2
@@ -1,8 +1,9 @@
|
||||
local MiningGameGuidePanel = class("MiningGameGuidePanel", BasePanel)
|
||||
MiningGameGuidePanel._sUIResRootPath = "UI_Activity/"
|
||||
MiningGameGuidePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Play_Mining_400003/MiningGameGuidePanel.prefab",
|
||||
sCtrlName = "Game.UI.Play_Mining.400003.MiningGameGuideCtrl"
|
||||
sPrefabPath = "_400011/MiningGameGuidePanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.Mining.400011.MiningGameGuideCtrl"
|
||||
}
|
||||
}
|
||||
function MiningGameGuidePanel:Awake()
|
||||
+3
-2
@@ -1,10 +1,11 @@
|
||||
local MiningGamePanel = class("MiningGamePanel", BasePanel)
|
||||
MiningGamePanel._bIsMainPanel = true
|
||||
MiningGamePanel._bAddToBackHistory = true
|
||||
MiningGamePanel._sUIResRootPath = "UI_Activity/"
|
||||
MiningGamePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Play_Mining_400003/MiningGamePanel.prefab",
|
||||
sCtrlName = "Game.UI.Play_Mining.400003.MiningGameCtrl"
|
||||
sPrefabPath = "_400011/MiningGamePanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.Mining.400011.MiningGameCtrl"
|
||||
}
|
||||
}
|
||||
function MiningGamePanel:Awake()
|
||||
+1
-1
@@ -63,7 +63,7 @@ function MiningGameQuestCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local nInstanceId = goGrid:GetInstanceID()
|
||||
if not self.tbGridCtrl[nInstanceId] then
|
||||
self.tbGridCtrl[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.Play_Mining.MiningQuestCellCtrl")
|
||||
self.tbGridCtrl[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.Activity.Mining.400011.MiningQuestCellCtrl")
|
||||
end
|
||||
self.tbGridCtrl[nInstanceId]:SetData(self.nActId, self.tbQuestList[nIndex])
|
||||
end
|
||||
+3
-2
@@ -1,9 +1,10 @@
|
||||
local MiningGameQuestPanel = class("MiningGamePanel", BasePanel)
|
||||
MiningGameQuestPanel._bIsMainPanel = true
|
||||
MiningGameQuestPanel._sUIResRootPath = "UI_Activity/"
|
||||
MiningGameQuestPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Activity/Play_Mining_400003/MiningGameQuestPanel.prefab",
|
||||
sCtrlName = "Game.UI.Play_Mining.400003.MiningGameQuestCtrl"
|
||||
sPrefabPath = "_400011/MiningGameQuestPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.Mining.400011.MiningGameQuestCtrl"
|
||||
}
|
||||
}
|
||||
function MiningGameQuestPanel:Awake()
|
||||
+14
-19
@@ -4,19 +4,19 @@ MiningGridCellCtrl._mapNodeConfig = {
|
||||
image_SuperHard = {sComponentName = "Image"},
|
||||
btn_SuperHard = {
|
||||
sNodeName = "image_SuperHard",
|
||||
sComponentName = "Button"
|
||||
sComponentName = "UIButton"
|
||||
},
|
||||
image_Hard = {sComponentName = "Image"},
|
||||
btn_Hard = {sNodeName = "image_Hard", sComponentName = "Button"},
|
||||
btn_Hard = {sNodeName = "image_Hard", sComponentName = "UIButton"},
|
||||
image_Normal = {sComponentName = "Image"},
|
||||
btn_Normal = {
|
||||
sNodeName = "image_Normal",
|
||||
sComponentName = "Button"
|
||||
sComponentName = "UIButton"
|
||||
},
|
||||
image_Fragile = {sComponentName = "Image"},
|
||||
btn_Fragile = {
|
||||
sNodeName = "image_Fragile",
|
||||
sComponentName = "Button"
|
||||
sComponentName = "UIButton"
|
||||
},
|
||||
effect = {},
|
||||
effect_Spade = {},
|
||||
@@ -43,16 +43,15 @@ function MiningGridCellCtrl:Awake(...)
|
||||
self._mapNode.image_Hard.alphaHitTestMinimumThreshold = 0.1
|
||||
self._mapNode.image_Normal.alphaHitTestMinimumThreshold = 0.1
|
||||
self._mapNode.image_Fragile.alphaHitTestMinimumThreshold = 0.1
|
||||
for k, v in pairs(self._mapNode.effect:GetComponentInChildren(typeof(CS.UnityEngine.Transform))) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
for k, v in pairs(self._mapNode.effect_OnHit:GetComponentInChildren(typeof(CS.UnityEngine.Transform))) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
self:SetChildActive(self._mapNode.effect, false)
|
||||
self:SetChildActive(self._mapNode.effect_OnHit, false)
|
||||
end
|
||||
function MiningGridCellCtrl:OnDestroy()
|
||||
self:ClearButtonListener()
|
||||
self:ClearTimer()
|
||||
function MiningGridCellCtrl:SetChildActive(go, bActive)
|
||||
local nChildCount = go.transform.childCount
|
||||
for i = 1, nChildCount do
|
||||
local child = go.transform:GetChild(i - 1)
|
||||
child.gameObject:SetActive(bActive)
|
||||
end
|
||||
end
|
||||
function MiningGridCellCtrl:SetData(nId, nStatus, bMark, btnCallback, nIndex)
|
||||
self:Init()
|
||||
@@ -74,12 +73,8 @@ function MiningGridCellCtrl:UpdateData(nStatus, nEffectType, bPlayCellInAnim)
|
||||
self:UpdateImage(nStatus, bPlayCellInAnim)
|
||||
self:ClearButtonListener()
|
||||
self:ClearTimer()
|
||||
for k, v in pairs(self._mapNode.effect:GetComponentInChildren(typeof(CS.UnityEngine.Transform))) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
for k, v in pairs(self._mapNode.effect_OnHit:GetComponentInChildren(typeof(CS.UnityEngine.Transform))) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
self:SetChildActive(self._mapNode.effect, false)
|
||||
self:SetChildActive(self._mapNode.effect_OnHit, false)
|
||||
if nEffectType == GameEnum.miningSupportEffect.TreasureMarkerOnGridDestroyed then
|
||||
self.bMark = true
|
||||
end
|
||||
+2
-2
@@ -13,7 +13,7 @@ local ColumnCount = {
|
||||
MiningGridListCtrl._mapNodeConfig = {
|
||||
cell = {
|
||||
nCount = 21,
|
||||
sCtrlName = "Game.UI.Play_Mining_400002.MiningGridCellCtrl"
|
||||
sCtrlName = "Game.UI.Activity.Mining.400011.MiningGridCellCtrl"
|
||||
},
|
||||
reward_Go = {nCount = 3},
|
||||
reward = {nCount = 3, sComponentName = "Image"}
|
||||
@@ -32,7 +32,7 @@ function MiningGridListCtrl:InitGridCell(data, callback)
|
||||
local funcCallback = function(nId)
|
||||
self:Knock(nId)
|
||||
end
|
||||
self._mapNode.cell[data.nIndex]:SetData(data.nId, data.nStatus, data.bMark, funcCallback)
|
||||
self._mapNode.cell[data.nIndex]:SetData(data.nId, data.nStatus, data.bMark, funcCallback, data.nIndex)
|
||||
end
|
||||
function MiningGridListCtrl:HideReward()
|
||||
for _, go in pairs(self._mapNode.reward_Go) do
|
||||
+1
-1
@@ -51,7 +51,7 @@ function MiningStoryCtrl:OnGridRefresh(gridGo, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local nInstanceId = gridGo:GetInstanceID()
|
||||
if not self.tbGridCtrl[nInstanceId] then
|
||||
self.tbGridCtrl[nInstanceId] = self:BindCtrlByNode(gridGo, "Game.UI.Play_Mining.400007.MiningStoryCellCtrl")
|
||||
self.tbGridCtrl[nInstanceId] = self:BindCtrlByNode(gridGo, "Game.Activity.Mining.400011.MiningStoryCellCtrl")
|
||||
end
|
||||
local data = self.tbStoryList[nIndex]
|
||||
self.tbGridCtrl[nInstanceId]:SetData(data.id, nIndex, data.bIsLock, data.bIsRead)
|
||||
+3
-2
@@ -1,9 +1,10 @@
|
||||
local MiningStoryPanel = class("MiningStoryPanel", BasePanel)
|
||||
MiningStoryPanel._bIsMainPanel = false
|
||||
MiningStoryPanel._sUIResRootPath = "UI_Activity/"
|
||||
MiningStoryPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Activity/Play_Mining_400003/MiningStoryPanel.prefab",
|
||||
sCtrlName = "Game.UI.Play_Mining.400003.MiningStoryCtrl"
|
||||
sPrefabPath = "_400011/MiningStoryPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.Mining.400011.MiningStoryCtrl"
|
||||
}
|
||||
}
|
||||
function MiningStoryPanel:Awake()
|
||||
@@ -27,6 +27,7 @@ end
|
||||
function ThrowGiftItemSelectCtrl:FadeOut()
|
||||
end
|
||||
function ThrowGiftItemSelectCtrl:OnEnable()
|
||||
self.animator = self.gameObject:GetComponent("Animator")
|
||||
self.bSelected = false
|
||||
self.curIdx = 0
|
||||
self.tbOriginPos = {}
|
||||
@@ -48,10 +49,9 @@ end
|
||||
function ThrowGiftItemSelectCtrl:OnRelease()
|
||||
end
|
||||
function ThrowGiftItemSelectCtrl:Refresh(tbItem)
|
||||
self.animator:Play("rtItemSelect_in")
|
||||
self._mapNode.btnItemSelectCtrl[1]:Refresh(tbItem[1])
|
||||
self._mapNode.btnItemSelectCtrl[2]:Refresh(tbItem[2])
|
||||
self._mapNode.btnItemSelectCtrl[1]:SetSelect(false)
|
||||
self._mapNode.btnItemSelectCtrl[2]:SetSelect(false)
|
||||
self._mapNode.btnItemSelectCtrl[1].gameObject.transform.position = self.tbOriginPos[1]
|
||||
self._mapNode.btnItemSelectCtrl[2].gameObject.transform.position = self.tbOriginPos[2]
|
||||
self._mapNode.btnItemSelectCtrl[1].gameObject.transform.localEulerAngles = Vector3(0, 0, 0)
|
||||
@@ -82,9 +82,9 @@ function ThrowGiftItemSelectCtrl:ResetSelect(tbUI)
|
||||
local nSelect = 1
|
||||
GamepadUIManager.ClearSelectedUI()
|
||||
GamepadUIManager.SetSelectedUI(self._mapNode.btnItemSelect[nSelect].gameObject)
|
||||
if GamepadUIManager.GetCurUIType() == AllEnum.GamepadUIType.Mouse then
|
||||
self:OnBtnClick_Item(self._mapNode.btnItemSelect[nSelect].gameObject, nSelect)
|
||||
end
|
||||
self.curIdx = nSelect
|
||||
self._mapNode.btnItemSelectCtrl[nSelect]:SetSelect(true)
|
||||
self._mapNode.btnItemSelectCtrl[nSelect == 2 and 1 or 2]:SetDefault()
|
||||
end
|
||||
end, true, true, true)
|
||||
end
|
||||
@@ -114,12 +114,16 @@ function ThrowGiftItemSelectCtrl:OnEvent_ThrowGiftItemSelectConfirmClick()
|
||||
return
|
||||
end
|
||||
self.bSelected = true
|
||||
self._mapNode.btnItemSelectCtrl[self.curIdx]:PlaySelectAnim()
|
||||
table.insert(self.tbResultIdx, self.curIdx)
|
||||
if self.nCurItemsIdx < #self.tbItems then
|
||||
self._mapNode.btnItemSelectCtrl[1]:SetDefault()
|
||||
self._mapNode.btnItemSelectCtrl[2]:SetDefault()
|
||||
self.nCurItemsIdx = self.nCurItemsIdx + 1
|
||||
self.curIdx = 0
|
||||
self:Refresh(self.tbItems[self.nCurItemsIdx])
|
||||
self.bSelected = false
|
||||
else
|
||||
self._mapNode.btnItemSelectCtrl[self.curIdx]:PlaySelectAnim()
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_intensify_ok")
|
||||
local endPos = self._mapNode.rtPos[self.curPosIdx].transform.position
|
||||
local beginPos = self._mapNode.btnItemSelectCtrl[self.curIdx].gameObject.transform.position
|
||||
@@ -140,6 +144,9 @@ function ThrowGiftItemSelectCtrl:OnEvent_ThrowGiftItemSelectConfirmClick()
|
||||
self._mapNode.btnItemSelectCtrl[self.curIdx].gameObject.transform.localEulerAngles = Vector3(0, 0, angleZ)
|
||||
self._mapNode.btnItemSelectCtrl[self.curIdx].gameObject.transform.position = Vector3(x, y, z)
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
if self == nil or self.gameObject == nil or not self.gameObject then
|
||||
return
|
||||
end
|
||||
end
|
||||
if self.callback ~= nil and type(self.callback) == "function" then
|
||||
self.callback(self.tbResultIdx)
|
||||
|
||||
@@ -37,7 +37,7 @@ end
|
||||
function ThrowGiftItemSelectGridCtrl:OnRelease()
|
||||
end
|
||||
function ThrowGiftItemSelectGridCtrl:Refresh(nItemId)
|
||||
self._mapNode.AnimRoot:Play("New State")
|
||||
self:SetDefault()
|
||||
local mapItemCfgData = ConfigTable.GetData("ThrowGiftItem", nItemId)
|
||||
if mapItemCfgData == nil then
|
||||
self.gameObject:SetActive(false)
|
||||
@@ -59,6 +59,11 @@ function ThrowGiftItemSelectGridCtrl:SetSelect(bSelect)
|
||||
end
|
||||
self._mapNode.imgBgSelect:SetActive(bSelect)
|
||||
end
|
||||
function ThrowGiftItemSelectGridCtrl:SetDefault()
|
||||
self._mapNode.AnimRoot:Play("default")
|
||||
self._mapNode.btnConfirm.interactable = false
|
||||
self._mapNode.imgBgSelect:SetActive(false)
|
||||
end
|
||||
function ThrowGiftItemSelectGridCtrl:PlaySelectAnim()
|
||||
self.animator:Play("btnItemSelectCard_out")
|
||||
end
|
||||
|
||||
@@ -82,7 +82,7 @@ function ThrowGiftCtrl:Awake()
|
||||
self._mapNode.rtItem[1]:SetAction(1)
|
||||
self._mapNode.rtItem[2]:SetAction(2)
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
GamepadUIManager.AddGamepadUINode("ThrowGiftPanel", self.tbGamepadUINode)
|
||||
GamepadUIManager.AddGamepadUINode(self._panel.sGamepadPanelName, self.tbGamepadUINode)
|
||||
end
|
||||
function ThrowGiftCtrl:FadeIn()
|
||||
end
|
||||
@@ -167,7 +167,7 @@ function ThrowGiftCtrl:OnEnable()
|
||||
self:AddTimer(1, 1.7, waitAnim, true, true, true)
|
||||
end
|
||||
self:AddTimer(1, 1.3, waitTransion, true, true, true)
|
||||
self:SetTarget(0, self.mapLevelCfgData.throwGiftLevelParams)
|
||||
self:SetTarget(0)
|
||||
end
|
||||
function ThrowGiftCtrl:OnDisable()
|
||||
end
|
||||
@@ -228,7 +228,7 @@ function ThrowGiftCtrl:OpenItemSelect(tbItems, selectCallback)
|
||||
self._mapNode.rtItem[2]:PlayAnim(3)
|
||||
end
|
||||
end
|
||||
self._mapNode.rtItemSelect:OpenPanel(tbItem, callback, pos)
|
||||
self._mapNode.rtItemSelect:OpenPanel(tbItems, callback, pos)
|
||||
end
|
||||
function ThrowGiftCtrl:OpenSettle(bWin, nScore, nGift, nPenguin, bShowPenguin, changeInfo)
|
||||
self.mapRecordLevelData = {}
|
||||
@@ -240,7 +240,7 @@ function ThrowGiftCtrl:OpenSettle(bWin, nScore, nGift, nPenguin, bShowPenguin, c
|
||||
end
|
||||
local bShowNextLevel = false
|
||||
local nNextLevelId = self.nLevelId + 1
|
||||
local mapNextCfgData = ConfigTable.GetData("ThrowGiftLevel", self.nLevelId, false)
|
||||
local mapNextCfgData = ConfigTable.GetData("ThrowGiftLevel", nNextLevelId, false)
|
||||
if mapNextCfgData ~= nil then
|
||||
bShowNextLevel = self:GetLevelUnlock(nNextLevelId)
|
||||
end
|
||||
@@ -340,9 +340,12 @@ function ThrowGiftCtrl:ChangeLevel(nLevelId)
|
||||
self:AddTimer(1, 1.3, waitTransion, true, true, true)
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, 37, callback)
|
||||
EventManager.Hit(EventId.SetTransition, self._panel.nTransition, callback)
|
||||
end
|
||||
function ThrowGiftCtrl:GetLevelUnlock(nLevelId)
|
||||
if self.actData == nil then
|
||||
return true
|
||||
end
|
||||
local mapLevelCfgData = ConfigTable.GetData("ThrowGiftLevel", nLevelId)
|
||||
if mapLevelCfgData == nil then
|
||||
return false
|
||||
@@ -409,7 +412,7 @@ function ThrowGiftCtrl:OnEvent_ThrowGift_Exit()
|
||||
self._mapNode.PausePanel:Close()
|
||||
end
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_all_stop")
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ThrowGiftLevelPanel)
|
||||
EventManager.Hit(EventId.ClosePanel, self._panel.nLevelPanelId)
|
||||
end
|
||||
function ThrowGiftCtrl:OnEvent_ThrowGift_Giveup()
|
||||
if self.levelCtrl ~= nil then
|
||||
@@ -468,7 +471,7 @@ end
|
||||
function ThrowGiftCtrl:OnEvent_ThrowGift_NextLevel()
|
||||
local bShowNextLevel = false
|
||||
local nNextLevelId = self.nLevelId + 1
|
||||
local mapNextCfgData = ConfigTable.GetData("ThrowGiftLevel", self.nLevelId, false)
|
||||
local mapNextCfgData = ConfigTable.GetData("ThrowGiftLevel", nNextLevelId, false)
|
||||
if mapNextCfgData ~= nil then
|
||||
bShowNextLevel = self:GetLevelUnlock(nNextLevelId)
|
||||
end
|
||||
|
||||
@@ -27,7 +27,15 @@ ThrowGiftItemDicCtrl._mapNodeConfig = {
|
||||
AnimRootItemInfo = {sComponentName = "Animator"},
|
||||
imgItemIconInfo = {sComponentName = "Image"},
|
||||
TMPItemNameInfo = {sComponentName = "TMP_Text"},
|
||||
TMPItemDescInfo = {sComponentName = "TMP_Text"}
|
||||
TMPItemDescInfo = {sComponentName = "TMP_Text"},
|
||||
btnRight = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Right"
|
||||
},
|
||||
btnLeft = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Left"
|
||||
}
|
||||
}
|
||||
ThrowGiftItemDicCtrl._mapEventConfig = {}
|
||||
ThrowGiftItemDicCtrl._mapRedDotConfig = {}
|
||||
@@ -39,6 +47,8 @@ function ThrowGiftItemDicCtrl:FadeOut()
|
||||
end
|
||||
function ThrowGiftItemDicCtrl:OnEnable()
|
||||
self.nActivityId = 0
|
||||
self.nPage = 1
|
||||
self.nTotalPage = 1
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActivityId = param[1]
|
||||
@@ -58,14 +68,18 @@ function ThrowGiftItemDicCtrl:OnEnable()
|
||||
return a.Id < b.Id
|
||||
end
|
||||
table.sort(self.tbItem, sort)
|
||||
for i = 1, 8 do
|
||||
if self.tbItem[i] ~= nil then
|
||||
self._mapNode.btnItem[i].gameObject:SetActive(true)
|
||||
self._mapNode.btnItemCtrl[i]:SetItem(self.tbItem[i].Id, self.mapRecordItemData[self.tbItem[i].Id] ~= nil and 0 < self.mapRecordItemData[self.tbItem[i].Id])
|
||||
else
|
||||
self._mapNode.btnItem[i].gameObject:SetActive(false)
|
||||
end
|
||||
if 0 < #self.tbItem then
|
||||
self.nTotalPage = math.ceil(#self.tbItem / 8)
|
||||
end
|
||||
if 1 >= self.nTotalPage then
|
||||
self._mapNode.btnRight.gameObject:SetActive(false)
|
||||
self._mapNode.btnLeft.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.btnRight.gameObject:SetActive(true)
|
||||
self._mapNode.btnLeft.gameObject:SetActive(true)
|
||||
end
|
||||
end
|
||||
function ThrowGiftItemDicCtrl:RefreshPanel()
|
||||
end
|
||||
function ThrowGiftItemDicCtrl:OnDisable()
|
||||
end
|
||||
@@ -75,8 +89,22 @@ function ThrowGiftItemDicCtrl:OnRelease()
|
||||
end
|
||||
function ThrowGiftItemDicCtrl:OpenPanel()
|
||||
self.gameObject:SetActive(true)
|
||||
self:RefreshItems(self.nPage)
|
||||
end
|
||||
function ThrowGiftItemDicCtrl:RefreshItems(nPage)
|
||||
self.nPage = nPage
|
||||
for i = 1, 8 do
|
||||
local nItemIdx = i + (self.nPage - 1) * 8
|
||||
if self.tbItem[nItemIdx] ~= nil then
|
||||
self._mapNode.btnItem[i].gameObject:SetActive(true)
|
||||
self._mapNode.btnItemCtrl[i]:SetItem(self.tbItem[nItemIdx].Id, self.mapRecordItemData[self.tbItem[nItemIdx].Id] ~= nil and self.mapRecordItemData[self.tbItem[nItemIdx].Id] > 0)
|
||||
else
|
||||
self._mapNode.btnItem[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ThrowGiftItemDicCtrl:OnBtnClick_Item(btn, nIdx)
|
||||
local nIdx = nIdx + (self.nPage - 1) * 8
|
||||
local mapConfig = self.tbItem[nIdx]
|
||||
if mapConfig == nil then
|
||||
return
|
||||
@@ -102,4 +130,18 @@ function ThrowGiftItemDicCtrl:OnBtnClick_Close(btn)
|
||||
end
|
||||
self:AddTimer(1, 0.2, wait, true, true, true)
|
||||
end
|
||||
function ThrowGiftItemDicCtrl:OnBtnClick_Right(btn)
|
||||
local nPage = self.nPage + 1
|
||||
if nPage > self.nTotalPage then
|
||||
nPage = 1
|
||||
end
|
||||
self:RefreshItems(nPage)
|
||||
end
|
||||
function ThrowGiftItemDicCtrl:OnBtnClick_Left(btn)
|
||||
local nPage = self.nPage - 1
|
||||
if nPage < 1 then
|
||||
nPage = self.nTotalPage
|
||||
end
|
||||
self:RefreshItems(nPage)
|
||||
end
|
||||
return ThrowGiftItemDicCtrl
|
||||
|
||||
@@ -90,6 +90,6 @@ end
|
||||
function ThrowGiftItemUseBtnCtrl:SetAction(nIdx)
|
||||
self._mapNodeConfig.btnItem1.sAction = "ThrowGiftItem" .. nIdx
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
GamepadUIManager.AddGamepadUINode("ThrowGiftPanel", self.tbGamepadUINode)
|
||||
GamepadUIManager.AddGamepadUINode(self._panel.sGamepadPanelName, self.tbGamepadUINode)
|
||||
end
|
||||
return ThrowGiftItemUseBtnCtrl
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
local ThrowGiftLevelTrackLineCtrl = class("ThrowGiftLevelTrackLineCtrl", BaseCtrl)
|
||||
local ThrowGiftLevelGuideTrackLineCtrl = class("ThrowGiftLevelGuideTrackLineCtrl", BaseCtrl)
|
||||
local nHeight = 210
|
||||
local ConfigData = require("GameCore.Data.ConfigData")
|
||||
ThrowGiftLevelTrackLineCtrl._mapNodeConfig = {
|
||||
ThrowGiftLevelGuideTrackLineCtrl._mapNodeConfig = {
|
||||
TemplateDot = {},
|
||||
rtPool = {sComponentName = "Transform"}
|
||||
}
|
||||
ThrowGiftLevelTrackLineCtrl._mapEventConfig = {}
|
||||
ThrowGiftLevelTrackLineCtrl._mapRedDotConfig = {}
|
||||
function ThrowGiftLevelTrackLineCtrl:Awake()
|
||||
ThrowGiftLevelGuideTrackLineCtrl._mapEventConfig = {}
|
||||
ThrowGiftLevelGuideTrackLineCtrl._mapRedDotConfig = {}
|
||||
function ThrowGiftLevelGuideTrackLineCtrl:Awake()
|
||||
self.tbCurDot = {}
|
||||
self.tbPool = {}
|
||||
self.nPrevTimer = 0
|
||||
self.bActive = false
|
||||
end
|
||||
function ThrowGiftLevelTrackLineCtrl:FadeIn()
|
||||
function ThrowGiftLevelGuideTrackLineCtrl:FadeIn()
|
||||
end
|
||||
function ThrowGiftLevelTrackLineCtrl:FadeOut()
|
||||
function ThrowGiftLevelGuideTrackLineCtrl:FadeOut()
|
||||
end
|
||||
function ThrowGiftLevelTrackLineCtrl:OnEnable()
|
||||
function ThrowGiftLevelGuideTrackLineCtrl:OnEnable()
|
||||
self._mapNode.TemplateDot:SetActive(false)
|
||||
end
|
||||
function ThrowGiftLevelTrackLineCtrl:OnDisable()
|
||||
function ThrowGiftLevelGuideTrackLineCtrl:OnDisable()
|
||||
self:DestroyAll()
|
||||
end
|
||||
function ThrowGiftLevelTrackLineCtrl:OnDestroy()
|
||||
function ThrowGiftLevelGuideTrackLineCtrl:OnDestroy()
|
||||
end
|
||||
function ThrowGiftLevelTrackLineCtrl:OnRelease()
|
||||
function ThrowGiftLevelGuideTrackLineCtrl:OnRelease()
|
||||
end
|
||||
function ThrowGiftLevelTrackLineCtrl:DestroyAll()
|
||||
function ThrowGiftLevelGuideTrackLineCtrl:DestroyAll()
|
||||
for _, tbDot in ipairs(self.tbCurDot) do
|
||||
destroy(tbDot[1].gameObject)
|
||||
end
|
||||
@@ -37,7 +37,7 @@ function ThrowGiftLevelTrackLineCtrl:DestroyAll()
|
||||
self.tbCurDot = {}
|
||||
self.tbPool = {}
|
||||
end
|
||||
function ThrowGiftLevelTrackLineCtrl:Reset()
|
||||
function ThrowGiftLevelGuideTrackLineCtrl:Reset()
|
||||
for _, tbDot in ipairs(self.tbCurDot) do
|
||||
table.insert(self.tbPool, tbDot[1])
|
||||
tbDot[1]:SetParent(self._mapNode.rtPool)
|
||||
@@ -45,7 +45,7 @@ function ThrowGiftLevelTrackLineCtrl:Reset()
|
||||
self.tbCurDot = {}
|
||||
self.nPrevTimer = 0
|
||||
end
|
||||
function ThrowGiftLevelTrackLineCtrl:GetDot()
|
||||
function ThrowGiftLevelGuideTrackLineCtrl:GetDot()
|
||||
if #self.tbPool > 0 then
|
||||
local rtDot = table.remove(self.tbPool)
|
||||
rtDot:SetParent(self.gameObject.transform)
|
||||
@@ -60,12 +60,12 @@ function ThrowGiftLevelTrackLineCtrl:GetDot()
|
||||
table.insert(self.tbCurDot, {rtDot, goOn})
|
||||
return rtDot
|
||||
end
|
||||
function ThrowGiftLevelTrackLineCtrl:AddDot(v2Pos, nAngle)
|
||||
function ThrowGiftLevelGuideTrackLineCtrl:AddDot(v2Pos, nAngle)
|
||||
local rtDot = self:GetDot()
|
||||
rtDot.anchoredPosition = v2Pos
|
||||
rtDot.localEulerAngles = Vector3(0, 0, nAngle - 90)
|
||||
end
|
||||
function ThrowGiftLevelTrackLineCtrl:SetLineActive(nAngle, nSpeed)
|
||||
function ThrowGiftLevelGuideTrackLineCtrl:SetLineActive(nAngle, nSpeed)
|
||||
local nConfigAngle = self.mapData.Angle
|
||||
local nConfigSpeed = self.mapData.Speed
|
||||
local nSpeedRangeMax = nConfigSpeed + self.mapData.SpeedThreshold
|
||||
@@ -80,7 +80,7 @@ function ThrowGiftLevelTrackLineCtrl:SetLineActive(nAngle, nSpeed)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ThrowGiftLevelTrackLineCtrl:InitLine(mapData, v2Pos, nAG, nMaxSpeed)
|
||||
function ThrowGiftLevelGuideTrackLineCtrl:InitLine(mapData, v2Pos, nAG, nMaxSpeed)
|
||||
if mapData == nil then
|
||||
return
|
||||
end
|
||||
@@ -104,4 +104,4 @@ function ThrowGiftLevelTrackLineCtrl:InitLine(mapData, v2Pos, nAG, nMaxSpeed)
|
||||
self:AddDot(Vector2(nBenginingX + dotx, nBenginingY + dotY), nFlyAngle)
|
||||
end
|
||||
end
|
||||
return ThrowGiftLevelTrackLineCtrl
|
||||
return ThrowGiftLevelGuideTrackLineCtrl
|
||||
|
||||
@@ -29,6 +29,11 @@ ThrowGiftLevelInfoGridCtrl._mapNodeConfig = {
|
||||
nCount = 2,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
btnReward = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Reward"
|
||||
},
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Go"
|
||||
@@ -101,8 +106,20 @@ end
|
||||
function ThrowGiftLevelInfoGridCtrl:OnBtnClick_Go()
|
||||
EventManager.Hit("ThrowGiftStartBtnClick")
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ThrowGiftLevelPanel, self.nLevelId, self.nOpenTime)
|
||||
EventManager.Hit(EventId.OpenPanel, self._panel.nLevelPanelId, self.nLevelId, self.nOpenTime)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, 37, callback)
|
||||
EventManager.Hit(EventId.SetTransition, self._panel.nTransition, callback)
|
||||
end
|
||||
function ThrowGiftLevelInfoGridCtrl:OnBtnClick_Reward(goBtn, nIdx)
|
||||
local mapLevelCfgData = ConfigTable.GetData("ThrowGiftLevel", self.nLevelId)
|
||||
if mapLevelCfgData == nil then
|
||||
return
|
||||
end
|
||||
local nItemId = nIdx == 1 and mapLevelCfgData.FirstCompleteReward1Tid or mapLevelCfgData.FirstCompleteReward2Tid
|
||||
local rtItem = nIdx == 1 and self._mapNode.rtItemReward[1].gameObject.transform or self._mapNode.rtItemReward[2].gameObject.transform
|
||||
if nItemId == 0 then
|
||||
return
|
||||
end
|
||||
UTILS.ClickItemGridWithTips(nItemId, rtItem, true, true, false)
|
||||
end
|
||||
return ThrowGiftLevelInfoGridCtrl
|
||||
|
||||
@@ -151,6 +151,10 @@ function ThrowGiftLevelSelectCtrl:OnEnable()
|
||||
end
|
||||
end
|
||||
function ThrowGiftLevelSelectCtrl:OnDisable()
|
||||
if self._switchAnimTimer ~= nil then
|
||||
self._switchAnimTimer:Cancel()
|
||||
self._switchAnimTimer = nil
|
||||
end
|
||||
end
|
||||
function ThrowGiftLevelSelectCtrl:OnDestroy()
|
||||
end
|
||||
@@ -199,7 +203,7 @@ function ThrowGiftLevelSelectCtrl:RefreshLevelInfoGrid()
|
||||
tbNewLevel = self.actData:GetNewLevels()
|
||||
end
|
||||
for _, nLevelId in ipairs(tbNewLevel) do
|
||||
if nLevelId > tbCurGroup[2].Id then
|
||||
if tbCurGroup[2] ~= nil and nLevelId > tbCurGroup[2].Id then
|
||||
bShowBottomNew = true
|
||||
break
|
||||
end
|
||||
@@ -271,6 +275,9 @@ function ThrowGiftLevelSelectCtrl:GetLevelPass(nLevelId)
|
||||
return false
|
||||
end
|
||||
function ThrowGiftLevelSelectCtrl:GetLevelUnlock(nLevelId)
|
||||
if self.actData == nil then
|
||||
return true
|
||||
end
|
||||
local mapLevelCfgData = ConfigTable.GetData("ThrowGiftLevel", nLevelId)
|
||||
if mapLevelCfgData == nil then
|
||||
return false, 0
|
||||
@@ -431,7 +438,7 @@ function ThrowGiftLevelSelectCtrl:OnBtnClick_Target()
|
||||
if mapGroupData ~= nil then
|
||||
local actData = mapGroupData:GetActivityDataByIndex(AllEnum.ActivityThemeFuncIndex.Task)
|
||||
if actData ~= nil then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Task_10105, actData.ActivityId, 4)
|
||||
EventManager.Hit(EventId.OpenPanel, self._panel.nQuestPanelId, actData.ActivityId, 4)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,6 +7,9 @@ ThrowGiftLevelSelectPanel._tbDefine = {
|
||||
}
|
||||
}
|
||||
function ThrowGiftLevelSelectPanel:Awake()
|
||||
self.nTransition = 37
|
||||
self.nLevelPanelId = PanelId.ThrowGiftLevelPanel
|
||||
self.nQuestPanelId = PanelId.Task_10105
|
||||
end
|
||||
function ThrowGiftLevelSelectPanel:OnEnable()
|
||||
end
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
local ThrowGiftLevelSelectPanel_400009 = class("ThrowGiftLevelSelectPanel_400009", BasePanel)
|
||||
ThrowGiftLevelSelectPanel_400009._sUIResRootPath = "UI_Activity/"
|
||||
ThrowGiftLevelSelectPanel_400009._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_400009/ThrowGiftsLevelSelectPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.ThrowGifts.ThrowGiftLevelSelectCtrl"
|
||||
}
|
||||
}
|
||||
function ThrowGiftLevelSelectPanel_400009:Awake()
|
||||
self.nTransition = 45
|
||||
self.nLevelPanelId = PanelId.ThrowGiftLevelPanel_400009
|
||||
self.nQuestPanelId = PanelId.Task_10107
|
||||
end
|
||||
function ThrowGiftLevelSelectPanel_400009:OnEnable()
|
||||
end
|
||||
function ThrowGiftLevelSelectPanel_400009:OnAfterEnter()
|
||||
end
|
||||
function ThrowGiftLevelSelectPanel_400009:OnDisable()
|
||||
end
|
||||
function ThrowGiftLevelSelectPanel_400009:OnDestroy()
|
||||
end
|
||||
function ThrowGiftLevelSelectPanel_400009:OnRelease()
|
||||
end
|
||||
return ThrowGiftLevelSelectPanel_400009
|
||||
@@ -8,6 +8,10 @@ ThrowGiftPanel._tbDefine = {
|
||||
}
|
||||
}
|
||||
function ThrowGiftPanel:Awake()
|
||||
self.nLevelPanelId = PanelId.ThrowGiftLevelPanel
|
||||
self.sGamepadPanelName = "ThrowGiftPanel"
|
||||
self.nTransition = 37
|
||||
self._rootPath = "UI_Activity/_400005/GoalPerfab/Goal%s.prefab"
|
||||
GamepadUIManager.EnterAdventure(true)
|
||||
GamepadUIManager.EnableGamepadUI("ThrowGiftPanel", {}, nil, true)
|
||||
end
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
local ThrowGiftPanel_400009 = class("ThrowGiftPanel_400009", BasePanel)
|
||||
ThrowGiftPanel_400009._sUIResRootPath = "UI_Activity/"
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
ThrowGiftPanel_400009._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_400009/ThrowGiftsPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.ThrowGifts.ThrowGiftCtrl"
|
||||
}
|
||||
}
|
||||
function ThrowGiftPanel_400009:Awake()
|
||||
self.nLevelPanelId = PanelId.ThrowGiftLevelPanel_400009
|
||||
self.sGamepadPanelName = "ThrowGiftPanel_400009"
|
||||
self.nTransition = 45
|
||||
self._rootPath = "UI_Activity/_400009/GoalPerfab/Goal%s.prefab"
|
||||
GamepadUIManager.EnterAdventure(true)
|
||||
GamepadUIManager.EnableGamepadUI(self.sGamepadPanelName, {}, nil, true)
|
||||
end
|
||||
function ThrowGiftPanel_400009:OnEnable()
|
||||
end
|
||||
function ThrowGiftPanel_400009:OnAfterEnter()
|
||||
end
|
||||
function ThrowGiftPanel_400009:OnDisable()
|
||||
end
|
||||
function ThrowGiftPanel_400009:OnDestroy()
|
||||
GamepadUIManager.DisableGamepadUI(self.sGamepadPanelName)
|
||||
GamepadUIManager.QuitAdventure()
|
||||
end
|
||||
function ThrowGiftPanel_400009:OnRelease()
|
||||
end
|
||||
return ThrowGiftPanel_400009
|
||||
@@ -24,17 +24,20 @@ ThrowGiftPauseCtrl._mapNodeConfig = {
|
||||
btn_exit = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Exit",
|
||||
sAction = "Giveup"
|
||||
sAction = "Giveup",
|
||||
sActionIconType = "Dark"
|
||||
},
|
||||
btn_restart = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Restart",
|
||||
sAction = "Retry"
|
||||
sAction = "Retry",
|
||||
sActionIconType = "Dark"
|
||||
},
|
||||
btn_continue = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Continue",
|
||||
sAction = "Back"
|
||||
sAction = "Back",
|
||||
sActionIconType = "Dark"
|
||||
},
|
||||
txt_dic = {
|
||||
nCount = 2,
|
||||
@@ -44,7 +47,8 @@ ThrowGiftPauseCtrl._mapNodeConfig = {
|
||||
btn_dic = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Dic",
|
||||
sAction = "Depot"
|
||||
sAction = "Depot",
|
||||
sActionIconType = "Dark"
|
||||
}
|
||||
}
|
||||
ThrowGiftPauseCtrl._mapEventConfig = {}
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
local ThrowGiftSettleCtrl = class("ThrowGiftSettleCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
ThrowGiftSettleCtrl._mapNodeConfig = {
|
||||
btnConfirm1 = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Confirm1"
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Confirm1",
|
||||
sAction = "ThrowGiftSettleConfirm1",
|
||||
sActionIconType = "Dark"
|
||||
},
|
||||
btnConfirm2 = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Confirm2"
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Confirm2",
|
||||
sAction = "ThrowGiftSettleConfirm2",
|
||||
sActionIconType = "Dark"
|
||||
},
|
||||
txtBtnClose = {
|
||||
sComponentName = "TMP_Text",
|
||||
@@ -42,6 +47,8 @@ ThrowGiftSettleCtrl._mapNodeConfig = {
|
||||
ThrowGiftSettleCtrl._mapEventConfig = {}
|
||||
ThrowGiftSettleCtrl._mapRedDotConfig = {}
|
||||
function ThrowGiftSettleCtrl:Awake()
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
GamepadUIManager.AddGamepadUINode("ThrowGiftSettle", self.tbGamepadUINode)
|
||||
end
|
||||
function ThrowGiftSettleCtrl:FadeIn()
|
||||
end
|
||||
@@ -59,6 +66,7 @@ function ThrowGiftSettleCtrl:OnRelease()
|
||||
end
|
||||
function ThrowGiftSettleCtrl:ShowSettle(bWin, nScore, nGift, nPenguin, bShowPenguin, bNextUnlock, changeInfo, nLevelId)
|
||||
self.bWin = bWin
|
||||
GamepadUIManager.EnableGamepadUI("ThrowGiftSettle", self.tbGamepadUINode)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBtnConfirm, self.bWin and ConfigTable.GetUIText("ThrowGift_Settle_NextLevel") or ConfigTable.GetUIText("ThrowGift_Settle_Restart"))
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
@@ -89,6 +97,9 @@ function ThrowGiftSettleCtrl:ShowSettle(bWin, nScore, nGift, nPenguin, bShowPeng
|
||||
end
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
|
||||
local timerCb = function()
|
||||
if self == nil or not self.gameObject then
|
||||
return
|
||||
end
|
||||
if changeInfo ~= nil and #changeInfo.Props > 0 then
|
||||
local mapLevelData = ConfigTable.GetData("ThrowGiftLevel", nLevelId)
|
||||
local i = 1
|
||||
@@ -107,10 +118,12 @@ function ThrowGiftSettleCtrl:ShowSettle(bWin, nScore, nGift, nPenguin, bShowPeng
|
||||
end
|
||||
function ThrowGiftSettleCtrl:OnBtnClick_Confirm1()
|
||||
self.gameObject:SetActive(false)
|
||||
GamepadUIManager.DisableGamepadUI("ThrowGiftSettle")
|
||||
EventManager.Hit("ThrowGiftSettle_Exit")
|
||||
end
|
||||
function ThrowGiftSettleCtrl:OnBtnClick_Confirm2()
|
||||
self.gameObject:SetActive(false)
|
||||
GamepadUIManager.DisableGamepadUI("ThrowGiftSettle")
|
||||
if self.bWin then
|
||||
EventManager.Hit("ThrowGiftSettle_NextLevel")
|
||||
else
|
||||
|
||||
@@ -2,6 +2,8 @@ local ThrowGiftsLevelCtrl = class("ThrowGiftsLevelCtrl", BaseCtrl)
|
||||
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
|
||||
local ResTypeAny = GameResourceLoader.ResType.Any
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local nMarkWidth = 36
|
||||
local nMarkHeight = 56
|
||||
ThrowGiftsLevelCtrl._mapNodeConfig = {
|
||||
Scene = {sComponentName = "Transform"},
|
||||
rtScene = {
|
||||
@@ -50,11 +52,14 @@ ThrowGiftsLevelCtrl._mapNodeConfig = {
|
||||
imgInfinite = {},
|
||||
penguinRoot = {},
|
||||
rtTemplateGuideTrack = {},
|
||||
goBeginningMark = {},
|
||||
rtBeginningMark = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
rtDebug = {}
|
||||
}
|
||||
ThrowGiftsLevelCtrl._mapEventConfig = {}
|
||||
ThrowGiftsLevelCtrl._mapRedDotConfig = {}
|
||||
local rootPath = "UI_Activity/_400005/GoalPerfab/Goal%s.prefab"
|
||||
function ThrowGiftsLevelCtrl:Awake()
|
||||
self.bDebugMode = false
|
||||
self.curGiftPenguin = nil
|
||||
@@ -71,6 +76,7 @@ function ThrowGiftsLevelCtrl:Awake()
|
||||
self.curPenguinType = 1
|
||||
self.nNextPenguinType = 1
|
||||
self.curPenguinSpecialType = 0
|
||||
self.defaultPenguinSpecialType = 0
|
||||
self.nLevelTime = -1
|
||||
self.nLevelScore = 0
|
||||
self.nTotalThrowGiftCount = 0
|
||||
@@ -115,12 +121,22 @@ end
|
||||
function ThrowGiftsLevelCtrl:FadeOut()
|
||||
end
|
||||
function ThrowGiftsLevelCtrl:OnEnable()
|
||||
self.rootPath = self._panel._rootPath
|
||||
EventManager.Hit("ThrowGiftSetSpeacialFunc", self)
|
||||
self._mapNode.BeginningPenguinRoot.gameObject:SetActive(false)
|
||||
self._mapNode.penguinRoot:SetActive(false)
|
||||
self._mapNode.rtBottleAnim:Play("rtBottle_Empty")
|
||||
self._mapNode.goBeginningMark:SetActive(false)
|
||||
end
|
||||
function ThrowGiftsLevelCtrl:OnDisable()
|
||||
if self.beginningTweener ~= nil then
|
||||
self.beginningTweener:Kill()
|
||||
self.beginningTweener = nil
|
||||
end
|
||||
if self.mapUpdateTimer ~= nil then
|
||||
self.mapUpdateTimer:Cancel()
|
||||
self.mapUpdateTimer = nil
|
||||
end
|
||||
self:ClearTrackLine()
|
||||
if self.tbGuideTrackCtrl ~= nil and #self.tbGuideTrackCtrl ~= 0 then
|
||||
self:ClearGuideLine()
|
||||
@@ -160,11 +176,12 @@ function ThrowGiftsLevelCtrl:SetLevel(parent, nLevelId, mapActData)
|
||||
if mapFloorCfgData == nil then
|
||||
return
|
||||
end
|
||||
self.defaultPenguinSpecialType = self.mapLevelCfgData.DefaultPenguinItemId
|
||||
self.maxVelocity = mapFloorCfgData.SpeedMax
|
||||
self.minVelovity = mapFloorCfgData.SpeedMin
|
||||
self.nAngleMin = mapFloorCfgData.AngelMin
|
||||
self.nAG = mapFloorCfgData.Gravity
|
||||
if self.mapLevelCfgData.Difficulty == GameEnum.ThrowGiftDifficulty.Blind then
|
||||
if self.mapLevelCfgData.FlightPath == true then
|
||||
self._mapNode.rtBlindLevelTrack.gameObject:SetActive(true)
|
||||
end
|
||||
self.mapFloorCfgData = mapFloorCfgData
|
||||
@@ -194,8 +211,8 @@ function ThrowGiftsLevelCtrl:SetLevel(parent, nLevelId, mapActData)
|
||||
}
|
||||
end
|
||||
self._mapNode.rtDebug:SetActive(self.bDebugMode)
|
||||
local nChildCount = self._mapNode.rtObstacleRoot.childCount
|
||||
for i = 0, nChildCount - 1 do
|
||||
local nStaticChildCount = self._mapNode.rtObstacleRoot.childCount
|
||||
for i = 0, nStaticChildCount - 1 do
|
||||
local goObstacle = self._mapNode.rtObstacleRoot:GetChild(i)
|
||||
if goObstacle ~= nil then
|
||||
local rtObstacle = goObstacle:GetComponent("RectTransform")
|
||||
@@ -206,8 +223,8 @@ function ThrowGiftsLevelCtrl:SetLevel(parent, nLevelId, mapActData)
|
||||
end
|
||||
end
|
||||
end
|
||||
local nChildCount = self._mapNode.rtSpecialObstacleRoot.childCount
|
||||
for i = 0, nChildCount - 1 do
|
||||
local nSpecialChildCount = self._mapNode.rtSpecialObstacleRoot.childCount
|
||||
for i = 0, nSpecialChildCount - 1 do
|
||||
local goObstacle = self._mapNode.rtSpecialObstacleRoot:GetChild(i)
|
||||
if goObstacle ~= nil then
|
||||
local rtObstacle = goObstacle:GetComponent("RectTransform")
|
||||
@@ -333,12 +350,14 @@ function ThrowGiftsLevelCtrl:FlyOver(nDelayTime, tbHitGoalId)
|
||||
self._mapNode.rtBottleAnim:Play("rtBottle_in")
|
||||
self._mapNode.BeginningPenguinRoot:Play("penguinRoot_jump")
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_shylock_jump")
|
||||
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.curPenguinType, self.curPenguinSpecialType)
|
||||
self:SetPenguinType(self._mapNode.rtBottle:Find("AnimRoot/penguinRoot"), self.curPenguinType, self.curPenguinSpecialType)
|
||||
local nSpecialType = self.curPenguinSpecialType == 0 and self.defaultPenguinSpecialType or self.curPenguinSpecialType
|
||||
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.curPenguinType, nSpecialType)
|
||||
self:SetPenguinType(self._mapNode.rtBottle:Find("AnimRoot/penguinRoot"), self.curPenguinType, nSpecialType)
|
||||
self:SetBeginningAngle(0, 0)
|
||||
local wait = function()
|
||||
self._mapNode.imgBeginningHint:SetActive(true)
|
||||
self:SetPenguinType(self._mapNode.rtPenguinBeginningHint, self.curPenguinType, self.curPenguinSpecialType)
|
||||
local nCurSpecialType = self.curPenguinSpecialType == 0 and self.defaultPenguinSpecialType or self.curPenguinSpecialType
|
||||
self:SetPenguinType(self._mapNode.rtPenguinBeginningHint, self.curPenguinType, nCurSpecialType)
|
||||
if self.nTotalPenguinCount ~= 0 then
|
||||
self._mapNode.BeginningPenguinRoot.gameObject:SetActive(true)
|
||||
self._mapNode.BeginningPenguinRoot:Play("penguinRoot_in")
|
||||
@@ -353,14 +372,14 @@ function ThrowGiftsLevelCtrl:FlyOver(nDelayTime, tbHitGoalId)
|
||||
else
|
||||
self.nNextPenguinType = self.mapFloorCfgData.InitialGiftSort[self.curPenguinIdx]
|
||||
end
|
||||
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.nNextPenguinType, 0)
|
||||
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.nNextPenguinType, self.defaultPenguinSpecialType)
|
||||
else
|
||||
self._mapNode.BeginningPenguinRoot.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
local waitAnimEnd = function()
|
||||
self.nLevelType = 1
|
||||
if self.mapLevelCfgData.Difficulty == GameEnum.ThrowGiftDifficulty.Blind then
|
||||
if self.mapLevelCfgData.SwitchArrow == true then
|
||||
self.parent:SetViewBtn(1)
|
||||
end
|
||||
end
|
||||
@@ -505,12 +524,16 @@ function ThrowGiftsLevelCtrl:ActiveItem(nItemId)
|
||||
self.parent:AddTimeAnim()
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_prop_overtime")
|
||||
end
|
||||
elseif 106 <= nItemId and nItemId <= 108 then
|
||||
elseif 106 <= nItemId and nItemId <= 110 then
|
||||
self.curPenguinSpecialType = nItemId
|
||||
self._mapNode.rtPenguinBeginningHintAnim:Play("imgBeginningHint_in")
|
||||
if not self.bFlying and self.nLevelType == 1 or self.nLevelType == 3 then
|
||||
if not self.bFlying and (self.nLevelType == 1 or self.nLevelType == 3) then
|
||||
if nItemId == 108 then
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_prop_anteena")
|
||||
elseif nItemId == 109 then
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_prop_spring")
|
||||
elseif nItemId == 110 then
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_prop_magic")
|
||||
else
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_prop_gear")
|
||||
end
|
||||
@@ -518,15 +541,26 @@ function ThrowGiftsLevelCtrl:ActiveItem(nItemId)
|
||||
self:SetPenguinType(self._mapNode.rtPenguinBeginningHint, self.curPenguinType, nItemId)
|
||||
self._mapNode.rtBottleAnim:Play("rtBottle_switch")
|
||||
self._mapNode.rtPenguinBeginningHintAnim:Play("imgBeginningHint_in")
|
||||
else
|
||||
self:SetPenguinType(self._mapNode.rtPenguinBeginningHint, self.curPenguinType, nItemId)
|
||||
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.curPenguinType, nItemId)
|
||||
self:SetPenguinType(self._mapNode.rtBottle:Find("AnimRoot/penguinRoot"), self.curPenguinType, nItemId)
|
||||
end
|
||||
else
|
||||
self.mapCurActiveState[nItemId] = 16
|
||||
self.parent:SetFx(self.mapCurActiveState)
|
||||
if nItemId == 105 then
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_prop_power")
|
||||
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.nNextPenguinType, 0)
|
||||
self:SetPenguinType(self._mapNode.rtBottle:Find("AnimRoot/penguinRoot"), self.curPenguinType, self.curPenguinSpecialType)
|
||||
self:SetPenguinType(self._mapNode.rtPenguinBeginningHint, self.curPenguinType, self.curPenguinSpecialType)
|
||||
local nSpecialType = self.curPenguinSpecialType == 0 and self.defaultPenguinSpecialType or self.curPenguinSpecialType
|
||||
if not self.bFlying and (self.nLevelType == 1 or self.nLevelType == 3) then
|
||||
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.nNextPenguinType, self.defaultPenguinSpecialType)
|
||||
self:SetPenguinType(self._mapNode.rtBottle:Find("AnimRoot/penguinRoot"), self.curPenguinType, nSpecialType)
|
||||
self:SetPenguinType(self._mapNode.rtPenguinBeginningHint, self.curPenguinType, nSpecialType)
|
||||
else
|
||||
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.nNextPenguinType, nSpecialType)
|
||||
self:SetPenguinType(self._mapNode.rtBottle:Find("AnimRoot/penguinRoot"), self.curPenguinType, nSpecialType)
|
||||
self:SetPenguinType(self._mapNode.rtPenguinBeginningHint, self.curPenguinType, nSpecialType)
|
||||
end
|
||||
elseif nItemId == 102 then
|
||||
self._mapNode.imgInfinite:SetActive(true)
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_prop_infinite")
|
||||
@@ -568,8 +602,9 @@ function ThrowGiftsLevelCtrl:LevelStart()
|
||||
self._mapNode.rtBottleAnim:Play("rtBottle_in")
|
||||
self._mapNode.BeginningPenguinRoot:Play("penguinRoot_jump")
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_shylock_jump")
|
||||
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.curPenguinType, self.curPenguinSpecialType)
|
||||
self:SetPenguinType(self._mapNode.rtBottle:Find("AnimRoot/penguinRoot"), self.curPenguinType, self.curPenguinSpecialType)
|
||||
local nSpecialType = self.curPenguinSpecialType == 0 and self.defaultPenguinSpecialType or self.curPenguinSpecialType
|
||||
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.curPenguinType, nSpecialType)
|
||||
self:SetPenguinType(self._mapNode.rtBottle:Find("AnimRoot/penguinRoot"), self.curPenguinType, nSpecialType)
|
||||
self:SetBeginningAngle(0, 0)
|
||||
local wait = function()
|
||||
if self.nTotalPenguinCount ~= 0 then
|
||||
@@ -586,14 +621,14 @@ function ThrowGiftsLevelCtrl:LevelStart()
|
||||
else
|
||||
self.nNextPenguinType = self.mapFloorCfgData.InitialGiftSort[self.curPenguinIdx]
|
||||
end
|
||||
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.nNextPenguinType, 0)
|
||||
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.nNextPenguinType, nSpecialType)
|
||||
else
|
||||
self._mapNode.BeginningPenguinRoot.gameObject:SetActive(false)
|
||||
end
|
||||
self._mapNode.imgBeginningHint:SetActive(true)
|
||||
self:SetPenguinType(self._mapNode.rtPenguinBeginningHint, self.curPenguinType, self.curPenguinSpecialType)
|
||||
self:SetPenguinType(self._mapNode.rtPenguinBeginningHint, self.curPenguinType, nSpecialType)
|
||||
self.nLevelType = 1
|
||||
if self.mapLevelCfgData.Difficulty == GameEnum.ThrowGiftDifficulty.Blind then
|
||||
if self.mapLevelCfgData.SwitchArrow == true then
|
||||
self.parent:SetViewBtn(1)
|
||||
end
|
||||
end
|
||||
@@ -614,7 +649,7 @@ function ThrowGiftsLevelCtrl:LevelStart()
|
||||
GuideCallback()
|
||||
end
|
||||
end
|
||||
if self.mapLevelCfgData.Difficulty == GameEnum.ThrowGiftDifficulty.Blind then
|
||||
if self.mapLevelCfgData.SwitchArrow == true then
|
||||
self.nLevelType = 3
|
||||
local maxScenePosX = -math.abs((1 - self.scenePivot[1]) * self.sceneSize[1])
|
||||
self.beginningTweener = DOTween.To(function()
|
||||
@@ -661,7 +696,7 @@ function ThrowGiftsLevelCtrl:ChangeView(bShow)
|
||||
local rtScenePos = self._mapNode.rtScene.anchoredPosition
|
||||
self._mapNode.rtScene.anchoredPosition = Vector2(posX, rtScenePos.y)
|
||||
end, 3, 0.5):OnComplete(function()
|
||||
if self.mapLevelCfgData.Difficulty == GameEnum.ThrowGiftDifficulty.Blind then
|
||||
if self.mapLevelCfgData.SwitchArrow == true then
|
||||
self.parent:SetViewBtn(1)
|
||||
end
|
||||
self.nLevelType = 1
|
||||
@@ -946,8 +981,9 @@ function ThrowGiftsLevelCtrl:OnUpdate()
|
||||
nAfterY = nYMin
|
||||
mapConfig.VyDir = -mapConfig.VyDir
|
||||
end
|
||||
mapAciveGoal.OffsetX = nAfterX - rtSpawnPoint.anchoredPosition.x
|
||||
mapAciveGoal.OffsetY = nAfterY - rtSpawnPoint.anchoredPosition.y
|
||||
mapAciveGoal.OffsetX = nAfterX - mapAciveGoal.initialPosX
|
||||
mapAciveGoal.OffsetY = nAfterY - mapAciveGoal.initialPosY
|
||||
mapAciveGoal.rtGoal.anchoredPosition = Vector2(nAfterX, nAfterY)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -957,20 +993,29 @@ function ThrowGiftsLevelCtrl:OnUpdate()
|
||||
if self.curGiftPenguin == nil then
|
||||
return
|
||||
end
|
||||
local nCurPosX, nCurPosY
|
||||
local nCurPosX, nCurPosY, tbCachedGoalId
|
||||
if self.curGiftPenguin.nSpecialType == 106 then
|
||||
nCurPosX, nCurPosY = self:NavigationPenguinUpdate(nDeltaTime)
|
||||
elseif self.curGiftPenguin.nSpecialType == 107 then
|
||||
nCurPosX, nCurPosY = self:HelmetPenguinUpdate(nDeltaTime)
|
||||
elseif self.curGiftPenguin.nSpecialType == 108 then
|
||||
nCurPosX, nCurPosY = self:AntennaPenguinUpdate(nDeltaTime)
|
||||
elseif self.curGiftPenguin.nSpecialType == 109 then
|
||||
nCurPosX, nCurPosY = self:BouncePenguinUpdate(nDeltaTime)
|
||||
elseif self.curGiftPenguin.nSpecialType == 110 then
|
||||
nCurPosX, nCurPosY = self:SplitPenguinUpdate(nDeltaTime)
|
||||
nCurPosX, nCurPosY, tbCachedGoalId = self:SplitPenguinUpdate(nDeltaTime)
|
||||
else
|
||||
nCurPosX, nCurPosY = self:NormalPenguinUpdate(nDeltaTime)
|
||||
end
|
||||
if not self.bFlying then
|
||||
self:FlyOver(0.5)
|
||||
local tbHitGoalId = {}
|
||||
if tbCachedGoalId ~= nil and 0 < #tbCachedGoalId then
|
||||
for _, tbResult in ipairs(tbCachedGoalId) do
|
||||
self:HitGoal(tbResult[2], tbResult[1])
|
||||
table.insert(tbHitGoalId, tbResult[1])
|
||||
end
|
||||
end
|
||||
self:FlyOver(0.5, tbHitGoalId)
|
||||
return
|
||||
end
|
||||
local tbHitGoalId = {}
|
||||
@@ -987,6 +1032,12 @@ function ThrowGiftsLevelCtrl:OnUpdate()
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif self.curGiftPenguin.nSpecialType == 109 then
|
||||
local hitGoalId, hitPos = self:BouncePenguinGoalCheck(nCurPosX, nCurPosY)
|
||||
if 0 < hitGoalId then
|
||||
self:HitGoal(hitPos, hitGoalId)
|
||||
table.insert(tbHitGoalId, hitGoalId)
|
||||
end
|
||||
else
|
||||
local hitGoalId, hitPos = self:NormalGoalCheck(nCurPosX, nCurPosY)
|
||||
if 0 < hitGoalId then
|
||||
@@ -1013,7 +1064,7 @@ end
|
||||
function ThrowGiftsLevelCtrl:NormalGoalCheck(nCurPosX, nCurPosY)
|
||||
local nSumX = nCurPosX - self.curGiftPenguin.mapStartPos.x
|
||||
local nSumY = nCurPosY - self.curGiftPenguin.mapStartPos.y
|
||||
if self.mapLevelCfgData.Difficulty == GameEnum.ThrowGiftDifficulty.Blind and self.nFlyingTime - self._mapNode.rtBlindLevelTrack.nPrevTimer >= self.nLinePointInterval * 2 then
|
||||
if self.mapLevelCfgData.FlightPath == true and self.nFlyingTime - self._mapNode.rtBlindLevelTrack.nPrevTimer >= self.nLinePointInterval * 2 then
|
||||
self._mapNode.rtBlindLevelTrack.nPrevTimer = self.nFlyingTime
|
||||
self._mapNode.rtBlindLevelTrack:AddDot(Vector2(nCurPosX, nCurPosY))
|
||||
end
|
||||
@@ -1052,7 +1103,6 @@ function ThrowGiftsLevelCtrl:NormalGoalCheck(nCurPosX, nCurPosY)
|
||||
return hitGoalId, hitPos
|
||||
end
|
||||
function ThrowGiftsLevelCtrl:SplitPenguinGoalCheck()
|
||||
local bHasSubPenguin = false
|
||||
local tbCurHit = {}
|
||||
for _, mapSubPenguin in ipairs(self.curGiftPenguin.tbSubPenguin) do
|
||||
if mapSubPenguin.bFlying then
|
||||
@@ -1070,7 +1120,7 @@ function ThrowGiftsLevelCtrl:SplitPenguinGoalCheck()
|
||||
hitGoalId = nId
|
||||
mapSubPenguin.bFlying = false
|
||||
table.insert(tbCurHit, {hitGoalId, hitPos})
|
||||
table.insert(self.curGiftPenguin.tbCacheSubPenguinGoal, {hitPos, hitGoalId})
|
||||
table.insert(self.curGiftPenguin.tbCacheSubPenguinGoal, {hitGoalId, hitPos})
|
||||
break
|
||||
end
|
||||
local bHitObstacle = self:CheckCollision(mapSubPenguin.tbBounds, mapAciveGoal.tbBoundsObstacle, nSumX, nSumY, mapAciveGoal.OffsetX, mapAciveGoal.OffsetY)
|
||||
@@ -1079,15 +1129,103 @@ function ThrowGiftsLevelCtrl:SplitPenguinGoalCheck()
|
||||
mapSubPenguin.bFlying = false
|
||||
break
|
||||
end
|
||||
if mapSubPenguin.bFlying then
|
||||
bHasSubPenguin = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if self.mapLevelCfgData.FlightPath == true and self.nFlyingTime - self._mapNode.rtBlindLevelTrack.nPrevTimer >= self.nLinePointInterval * 2 then
|
||||
self._mapNode.rtBlindLevelTrack.nPrevTimer = self.nFlyingTime
|
||||
for _, mapSubPenguin in ipairs(self.curGiftPenguin.tbSubPenguin) do
|
||||
if mapSubPenguin.bFlying then
|
||||
self._mapNode.rtBlindLevelTrack:AddDot(Vector2(mapSubPenguin.curPosX, mapSubPenguin.curPosY))
|
||||
end
|
||||
end
|
||||
end
|
||||
local bHasSubPenguin = false
|
||||
for _, mapSubPenguin in ipairs(self.curGiftPenguin.tbSubPenguin) do
|
||||
if mapSubPenguin.bFlying then
|
||||
bHasSubPenguin = true
|
||||
end
|
||||
end
|
||||
self.bFlying = bHasSubPenguin
|
||||
if not self.bFlying then
|
||||
self.curGiftPenguin = nil
|
||||
end
|
||||
return tbCurHit
|
||||
end
|
||||
function ThrowGiftsLevelCtrl:BouncePenguinGoalCheck(nCurPosX, nCurPosY)
|
||||
local nSumX = nCurPosX - self.curGiftPenguin.mapStartPos.x
|
||||
local nSumY = nCurPosY - self.curGiftPenguin.mapStartPos.y
|
||||
if self.mapLevelCfgData.FlightPath == true and self.nFlyingTime - self._mapNode.rtBlindLevelTrack.nPrevTimer >= self.nLinePointInterval * 2 then
|
||||
self._mapNode.rtBlindLevelTrack.nPrevTimer = self.nFlyingTime
|
||||
self._mapNode.rtBlindLevelTrack:AddDot(Vector2(nCurPosX, nCurPosY))
|
||||
end
|
||||
local hitGoalId = 0
|
||||
local hitPos
|
||||
local curVy = self.curGiftPenguin.nVelocityY
|
||||
for nId, mapAciveGoal in pairs(self.activeGoal) do
|
||||
local GoalParentPos = mapAciveGoal.rtGoal.anchoredPosition
|
||||
local bHitGoal, bestNX, bestNY, minDepth = self:CheckCollision(self.curGiftPenguin.tbBounds, mapAciveGoal.tbBoundsHitArea, nSumX, nSumY, mapAciveGoal.OffsetX, mapAciveGoal.OffsetY)
|
||||
if bHitGoal then
|
||||
if 0 < curVy then
|
||||
if self.curGiftPenguin.nHitCount < 3 then
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_spring")
|
||||
self.curGiftPenguin.nHitCount = self.curGiftPenguin.nHitCount + 1
|
||||
nCurPosX = nCurPosX + bestNX * minDepth
|
||||
nCurPosY = nCurPosY + bestNY * minDepth
|
||||
nSumX = nSumX + bestNX * minDepth
|
||||
nSumY = nSumY + bestNY * minDepth
|
||||
self.curGiftPenguin.curPosX = nCurPosX
|
||||
self.curGiftPenguin.curPosY = nCurPosY
|
||||
self.curGiftPenguin.goGiftPenguin.anchoredPosition = Vector2(nCurPosX, nCurPosY)
|
||||
self.curGiftPenguin.mapStartPos = self.curGiftPenguin.goGiftPenguin.anchoredPosition
|
||||
local vxAfter, vyAfter = self.ReflectVelocity(self.curGiftPenguin.nVelocityX, curVy, bestNX, bestNY, 1)
|
||||
self.curGiftPenguin.nHitTime = self.nFlyingTime
|
||||
self.curGiftPenguin.nVelocityX = vxAfter
|
||||
self.curGiftPenguin.nVelocityY = vyAfter
|
||||
self.curGiftPenguin.tbBounds = self:GetLocalSpaceRect(self.curGiftPenguin.goGiftPenguin, self.curGiftPenguin.goGiftPenguin.parent)
|
||||
break
|
||||
else
|
||||
self:DestroyPenguin()
|
||||
self.bFlying = false
|
||||
break
|
||||
end
|
||||
else
|
||||
print("hit goal!")
|
||||
hitPos = Vector2(nCurPosX, nCurPosY)
|
||||
destroy(self.curGiftPenguin.goGiftPenguin.gameObject)
|
||||
hitGoalId = nId
|
||||
self.curGiftPenguin = nil
|
||||
self.bFlying = false
|
||||
break
|
||||
end
|
||||
end
|
||||
local bHitObstacle, bestNXObstacle, bestNYObstacle, minDepthObstacle = self:CheckCollision(self.curGiftPenguin.tbBounds, mapAciveGoal.tbBoundsObstacle, nSumX, nSumY, mapAciveGoal.OffsetX, mapAciveGoal.OffsetY)
|
||||
if bHitObstacle then
|
||||
if self.curGiftPenguin.nHitCount < 3 then
|
||||
self.curGiftPenguin.nHitCount = self.curGiftPenguin.nHitCount + 1
|
||||
nCurPosX = nCurPosX + bestNXObstacle * minDepthObstacle
|
||||
nCurPosY = nCurPosY + bestNYObstacle * minDepthObstacle
|
||||
nSumX = nSumX + bestNXObstacle * minDepthObstacle
|
||||
nSumY = nSumY + bestNYObstacle * minDepthObstacle
|
||||
self.curGiftPenguin.curPosX = nCurPosX
|
||||
self.curGiftPenguin.curPosY = nCurPosY
|
||||
self.curGiftPenguin.goGiftPenguin.anchoredPosition = Vector2(nCurPosX, nCurPosY)
|
||||
self.curGiftPenguin.mapStartPos = self.curGiftPenguin.goGiftPenguin.anchoredPosition
|
||||
local vxAfter, vyAfter = self.ReflectVelocity(self.curGiftPenguin.nVelocityX, curVy, bestNXObstacle, bestNYObstacle, 1)
|
||||
self.curGiftPenguin.nHitTime = self.nFlyingTime
|
||||
self.curGiftPenguin.nVelocityX = vxAfter
|
||||
self.curGiftPenguin.nVelocityY = vyAfter
|
||||
self.curGiftPenguin.tbBounds = self:GetLocalSpaceRect(self.curGiftPenguin.goGiftPenguin, self.curGiftPenguin.goGiftPenguin.parent)
|
||||
break
|
||||
else
|
||||
self:DestroyPenguin()
|
||||
self.bFlying = false
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
return hitGoalId, hitPos
|
||||
end
|
||||
function ThrowGiftsLevelCtrl:NormalPenguinUpdate(nDeltaTime)
|
||||
self.nFlyingTime = self.nFlyingTime + nDeltaTime
|
||||
local nCurPosX = self.curGiftPenguin.curPosX + nDeltaTime * self.curGiftPenguin.nVelocityX
|
||||
@@ -1165,6 +1303,7 @@ function ThrowGiftsLevelCtrl:BouncePenguinUpdate(nDeltaTime)
|
||||
local bHit, bestNX, bestNY, minDepth = self:CheckCollision(self.curGiftPenguin.tbBounds, tbBounds, nSumX, nSumY, 0, 0)
|
||||
if bHit then
|
||||
if self.curGiftPenguin.nHitCount < 3 then
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_spring")
|
||||
self.curGiftPenguin.nHitCount = self.curGiftPenguin.nHitCount + 1
|
||||
nCurPosX = nCurPosX + bestNX * minDepth
|
||||
nCurPosY = nCurPosY + bestNY * minDepth
|
||||
@@ -1349,7 +1488,8 @@ function ThrowGiftsLevelCtrl:NavigationPenguinUpdate(nDeltaTime)
|
||||
nCurPosY = self.curGiftPenguin.curPosY + nDeltaTime * self.curGiftPenguin.nVelocityY - 0.5 * self.nAG * nDeltaTime * nDeltaTime
|
||||
else
|
||||
nCurPosY = self.curGiftPenguin.curPosY
|
||||
nCurPosX = self.curGiftPenguin.curPosX + nDeltaTime * self.curGiftPenguin.nVelocityX
|
||||
local nVelocityX = self.curGiftPenguin.nVelocityX < 600 and 600 or self.curGiftPenguin.nVelocityX
|
||||
nCurPosX = self.curGiftPenguin.curPosX + nDeltaTime * nVelocityX
|
||||
self.curGiftPenguin.nVelocityY = 0
|
||||
end
|
||||
local checkGoal = checkGetGoal(nCurPosX, nCurPosY)
|
||||
@@ -1428,6 +1568,7 @@ function ThrowGiftsLevelCtrl:NavigationPenguinUpdate(nDeltaTime)
|
||||
end
|
||||
function ThrowGiftsLevelCtrl:SplitPenguinUpdate(nDeltaTime)
|
||||
local nCurPosX, nCurPosY = 0, 0
|
||||
local tbCachedGoalId = {}
|
||||
local Split = function(mapPenguin, nAngle, nVelocity, initPos)
|
||||
mapPenguin.bSplit = true
|
||||
local goPenguin = instantiate(self._mapNode.templateBullet, self._mapNode.rtPenguinRoot)
|
||||
@@ -1454,9 +1595,6 @@ function ThrowGiftsLevelCtrl:SplitPenguinUpdate(nDeltaTime)
|
||||
imgFx.gameObject:SetActive(self.mapCurActiveState[105] ~= nil)
|
||||
rtPenguin.anchoredPosition = initPos
|
||||
goPenguin:SetActive(true)
|
||||
if self.mapLevelCfgData.Difficulty == GameEnum.ThrowGiftDifficulty.Blind then
|
||||
self._mapNode.rtBlindLevelTrack:Reset()
|
||||
end
|
||||
local mapGiftPenguin = {
|
||||
goGiftPenguin = rtPenguin,
|
||||
nState = 0,
|
||||
@@ -1476,9 +1614,9 @@ function ThrowGiftsLevelCtrl:SplitPenguinUpdate(nDeltaTime)
|
||||
end
|
||||
if self.curGiftPenguin.bSplit then
|
||||
local bHasSubPenguin = false
|
||||
self.nFlyingTime = self.nFlyingTime + nDeltaTime
|
||||
for _, mapSubPenguin in ipairs(self.curGiftPenguin.tbSubPenguin) do
|
||||
if mapSubPenguin.bFlying then
|
||||
self.nFlyingTime = self.nFlyingTime + nDeltaTime
|
||||
nCurPosX = mapSubPenguin.curPosX + nDeltaTime * mapSubPenguin.nVelocityX
|
||||
nCurPosY = mapSubPenguin.curPosY + nDeltaTime * mapSubPenguin.nVelocityY - 0.5 * self.nAG * nDeltaTime * nDeltaTime
|
||||
mapSubPenguin.nVelocityY = mapSubPenguin.nVelocityY - self.nAG * nDeltaTime
|
||||
@@ -1537,6 +1675,7 @@ function ThrowGiftsLevelCtrl:SplitPenguinUpdate(nDeltaTime)
|
||||
end
|
||||
self.bFlying = bHasSubPenguin
|
||||
if not self.bFlying then
|
||||
tbCachedGoalId = clone(self.curGiftPenguin.tbCacheSubPenguinGoal)
|
||||
self.curGiftPenguin = nil
|
||||
end
|
||||
else
|
||||
@@ -1563,7 +1702,7 @@ function ThrowGiftsLevelCtrl:SplitPenguinUpdate(nDeltaTime)
|
||||
end
|
||||
end
|
||||
if not self.bFlying then
|
||||
return
|
||||
return 0, 0, tbCachedGoalId
|
||||
end
|
||||
if nCurPosX > 0.5 * self.sceneSize[1] or nCurPosX < -0.5 * self.sceneSize[1] or nCurPosY > 0.5 * self.sceneSize[2] or nCurPosY < -0.5 * self.sceneSize[2] then
|
||||
print("hit border")
|
||||
@@ -1571,7 +1710,7 @@ function ThrowGiftsLevelCtrl:SplitPenguinUpdate(nDeltaTime)
|
||||
self.bFlying = false
|
||||
end
|
||||
if not self.bFlying then
|
||||
return
|
||||
return 0, 0, {}
|
||||
end
|
||||
local tbHittedObs = {}
|
||||
for _, nSpecialId in ipairs(self.tbExObstacleCur) do
|
||||
@@ -1604,16 +1743,20 @@ function ThrowGiftsLevelCtrl:SplitPenguinUpdate(nDeltaTime)
|
||||
local mapSubPenguin = Split(self.curGiftPenguin, nFlyAngle + 20 * i, nCurVelocity, initPos)
|
||||
table.insert(self.curGiftPenguin.tbSubPenguin, mapSubPenguin)
|
||||
end
|
||||
self:DestroySubPenguin(self.curGiftPenguin)
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_split")
|
||||
self:DestroySubPenguin(self.curGiftPenguin, true)
|
||||
end
|
||||
end
|
||||
return nCurPosX, nCurPosY
|
||||
return nCurPosX, nCurPosY, tbCachedGoalId
|
||||
end
|
||||
function ThrowGiftsLevelCtrl:SetBeginningAngle(nAngle, nVelocity)
|
||||
local fixedAngle = nAngle == 0 and 0 or nAngle - 90
|
||||
self._mapNode.rtBottle.localEulerAngles = Vector3(0, 0, fixedAngle)
|
||||
self._mapNode.goBeginningMark.transform.localEulerAngles = Vector3(0, 0, fixedAngle)
|
||||
local sumScale = nVelocity / self.maxVelocity * 0.2
|
||||
local sumHeight = nVelocity / self.maxVelocity * 3
|
||||
self._mapNode.rtBottle.localScale = Vector3(1 + sumScale, 1 - sumScale, 1)
|
||||
self._mapNode.rtBeginningMark.sizeDelta = Vector2(nMarkWidth, nMarkHeight * (1 + sumHeight))
|
||||
end
|
||||
function ThrowGiftsLevelCtrl:SetBeginningLine(nAngle, nVelocity)
|
||||
if self.curPenguinSpecialType == 106 then
|
||||
@@ -1698,6 +1841,7 @@ function ThrowGiftsLevelCtrl:HitSpecialObstacle(nSpecialId)
|
||||
elseif mapOriginConfig.mapConfig.Type == GameEnum.SpecialObstacleType.WindForce then
|
||||
nType = 1
|
||||
Param.WindForce = mapOriginConfig.mapConfig.Param[1] * 10
|
||||
Param.nAngle = mapOriginConfig.gameObject.transform.localEulerAngles.z
|
||||
return true, nType, Param, false
|
||||
elseif mapOriginConfig.mapConfig.Type == GameEnum.SpecialObstacleType.Portal then
|
||||
nType = 2
|
||||
@@ -1712,8 +1856,13 @@ function ThrowGiftsLevelCtrl:SpecialObstacleFunc(mapPenguin, nDeltaTime, nType,
|
||||
return
|
||||
end
|
||||
if nType == 1 then
|
||||
mapPenguin.nVelocityX = mapPenguin.nVelocityX - Param.WindForce * nDeltaTime
|
||||
local nAcceleration = Param.WindForce * nDeltaTime
|
||||
local nAccelerationX = nAcceleration * math.cos(math.rad(Param.nAngle))
|
||||
local nAccelerationY = nAcceleration * math.sin(math.rad(Param.nAngle))
|
||||
mapPenguin.nVelocityX = mapPenguin.nVelocityX + nAccelerationX
|
||||
mapPenguin.nVelocityY = mapPenguin.nVelocityY + nAccelerationY
|
||||
elseif nType == 2 then
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_portals")
|
||||
local nExitId = Param.Exit
|
||||
local mapExitConfig
|
||||
for nInstanceId, mapObstacle in pairs(self.mapExObstacleOrigin) do
|
||||
@@ -1753,6 +1902,8 @@ function ThrowGiftsLevelCtrl:SetPenguinType(rtPenguinRoot, nType, nSpecialType)
|
||||
local rtGoggles = rtPenguinRoot:Find("penguin_goggles")
|
||||
local rtAntenna = rtPenguinRoot:Find("penguin_antenna")
|
||||
local rtHelmet = rtPenguinRoot:Find("penguin_helmet")
|
||||
local rtSplit = rtPenguinRoot:Find("Penguin_split")
|
||||
local rtSpring = rtPenguinRoot:Find("Penguin_spring")
|
||||
local imgFx = rtPenguinRoot:Find("imgFx")
|
||||
rtRed.gameObject:SetActive(nType == 2)
|
||||
rtYellow.gameObject:SetActive(nType == 3)
|
||||
@@ -1760,9 +1911,16 @@ function ThrowGiftsLevelCtrl:SetPenguinType(rtPenguinRoot, nType, nSpecialType)
|
||||
rtGoggles.gameObject:SetActive(nSpecialType == 106)
|
||||
rtAntenna.gameObject:SetActive(nSpecialType == 108)
|
||||
rtHelmet.gameObject:SetActive(nSpecialType == 107)
|
||||
if rtSplit ~= nil then
|
||||
rtSplit.gameObject:SetActive(nSpecialType == 110)
|
||||
rtSpring.gameObject:SetActive(nSpecialType == 109)
|
||||
end
|
||||
imgFx.gameObject:SetActive(self.mapCurActiveState[105] ~= nil)
|
||||
end
|
||||
function ThrowGiftsLevelCtrl:CreateGoal(nSpawnPointId, mapConfig)
|
||||
if self.activeGoal[nSpawnPointId] ~= nil then
|
||||
return
|
||||
end
|
||||
local pointOriginPosX = mapConfig.rtPoint.anchoredPosition.x
|
||||
local pointOriginPosY = mapConfig.rtPoint.anchoredPosition.y
|
||||
local randomX = math.random(-mapConfig.mapConfig.SpawnRangeTypeX, mapConfig.mapConfig.SpawnRangeTypeX)
|
||||
@@ -1777,20 +1935,10 @@ function ThrowGiftsLevelCtrl:CreateGoal(nSpawnPointId, mapConfig)
|
||||
nType = mapConfig.mapConfig.GoalType[mapConfig.nCurGoalIdx]
|
||||
mapConfig.nCurGoalIdx = mapConfig.nCurGoalIdx + 1
|
||||
end
|
||||
local sPath = string.format(rootPath, nType)
|
||||
local sPath = string.format(self.rootPath, nType)
|
||||
local goGoalPerfab = GameResourceLoader.LoadAsset(ResTypeAny, Settings.AB_ROOT_PATH .. sPath, typeof(Object))
|
||||
if goGoalPerfab ~= nil then
|
||||
local goGoal = instantiate(goGoalPerfab, self._mapNode.rtGoalRoot)
|
||||
if self.activeGoal[nSpawnPointId] ~= nil then
|
||||
destroy(self.activeGoal[nSpawnPointId].rtGoal.gameObject)
|
||||
self.activeGoal[nSpawnPointId].rtGoal = nil
|
||||
self.activeGoal[nSpawnPointId].rtHitArea = nil
|
||||
self.activeGoal[nSpawnPointId].rtObstacle = nil
|
||||
self.activeGoal[nSpawnPointId].nType = 0
|
||||
self.activeGoal[nSpawnPointId].TMPScore = nil
|
||||
self.activeGoal[nSpawnPointId].OffsetX = 0
|
||||
self.activeGoal[nSpawnPointId].OffsetY = 0
|
||||
end
|
||||
self.activeGoal[nSpawnPointId] = {}
|
||||
local rtGoal = goGoal:GetComponent("RectTransform")
|
||||
rtGoal.anchoredPosition = Vector2(pointOriginPosX + randomX, pointOriginPosY + randomY)
|
||||
@@ -1813,6 +1961,8 @@ function ThrowGiftsLevelCtrl:CreateGoal(nSpawnPointId, mapConfig)
|
||||
self.activeGoal[nSpawnPointId].tbBoundsObstacle = self:GetLocalSpaceRect(rtCompObstacle, rtGoal.parent)
|
||||
self.activeGoal[nSpawnPointId].OffsetX = 0
|
||||
self.activeGoal[nSpawnPointId].OffsetY = 0
|
||||
self.activeGoal[nSpawnPointId].initialPosX = pointOriginPosX + randomX
|
||||
self.activeGoal[nSpawnPointId].initialPosY = pointOriginPosY + randomY
|
||||
local TMPNode
|
||||
local rtTMPScore = rtGoal:Find("AnimRoot/TMPLevelScoreAdd")
|
||||
if rtTMPScore ~= nil then
|
||||
@@ -1833,6 +1983,8 @@ function ThrowGiftsLevelCtrl:CreateThrowPenguin(nAngle, nVelocity, initPos, nTyp
|
||||
local rtGoggles = goImgRoot:Find("penguin_goggles")
|
||||
local rtAntenna = goImgRoot:Find("penguin_antenna")
|
||||
local rtHelmet = goImgRoot:Find("penguin_helmet")
|
||||
local rtSplit = goImgRoot:Find("Penguin_split")
|
||||
local rtSpring = goImgRoot:Find("Penguin_spring")
|
||||
local rtImgRoot
|
||||
if goImgRoot ~= nil then
|
||||
rtImgRoot = goImgRoot:GetComponent("RectTransform")
|
||||
@@ -1843,10 +1995,12 @@ function ThrowGiftsLevelCtrl:CreateThrowPenguin(nAngle, nVelocity, initPos, nTyp
|
||||
rtGoggles.gameObject:SetActive(nSpecialType == 106)
|
||||
rtAntenna.gameObject:SetActive(nSpecialType == 108)
|
||||
rtHelmet.gameObject:SetActive(nSpecialType == 107)
|
||||
rtSplit.gameObject:SetActive(nSpecialType == 110)
|
||||
rtSpring.gameObject:SetActive(nSpecialType == 109)
|
||||
imgFx.gameObject:SetActive(self.mapCurActiveState[105] ~= nil)
|
||||
rtPenguin.anchoredPosition = initPos
|
||||
goPenguin:SetActive(true)
|
||||
if self.mapLevelCfgData.Difficulty == GameEnum.ThrowGiftDifficulty.Blind then
|
||||
if self.mapLevelCfgData.FlightPath == true then
|
||||
self._mapNode.rtBlindLevelTrack:Reset()
|
||||
end
|
||||
local mapGiftPenguin = {
|
||||
@@ -1983,8 +2137,10 @@ function ThrowGiftsLevelCtrl:DestroyPenguin()
|
||||
imgSmoke.gameObject:SetActive(true)
|
||||
self:AddTimer(1, 0.5, wait, true, true, true)
|
||||
end
|
||||
function ThrowGiftsLevelCtrl:DestroySubPenguin(mapSubPenguin)
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_out")
|
||||
function ThrowGiftsLevelCtrl:DestroySubPenguin(mapSubPenguin, bMainPenguin)
|
||||
if bMainPenguin ~= true then
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_out")
|
||||
end
|
||||
local tempPenguin = mapSubPenguin.goGiftPenguin.gameObject.transform
|
||||
local wait = function()
|
||||
destroy(tempPenguin.gameObject)
|
||||
@@ -2035,6 +2191,7 @@ function ThrowGiftsLevelCtrl:OnDrag_Beginning(mDrag)
|
||||
nVelocity = self.minVelovity
|
||||
end
|
||||
self.nCurVelocity = nVelocity
|
||||
self._mapNode.goBeginningMark:SetActive(true)
|
||||
self:SetBeginningAngle(nAngle, nVelocity)
|
||||
self:SetBeginningLine(nAngle, nVelocity)
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_pre_lp")
|
||||
@@ -2074,11 +2231,13 @@ function ThrowGiftsLevelCtrl:OnDrag_Beginning(mDrag)
|
||||
end
|
||||
end
|
||||
elseif mDrag.DragEventType == AllEnum.UIDragType.DragEnd then
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_pre_lp_stop")
|
||||
self._mapNode.goBeginningMark:SetActive(false)
|
||||
if self.curDragBeginPos == nil then
|
||||
return
|
||||
end
|
||||
if self.nCurVelocity == 0 then
|
||||
if self.mapLevelCfgData.Difficulty == GameEnum.ThrowGiftDifficulty.Blind then
|
||||
if self.mapLevelCfgData.SwitchArrow == true then
|
||||
self.parent:SetViewBtn(1)
|
||||
end
|
||||
self.curDragBeginPos = nil
|
||||
@@ -2095,13 +2254,13 @@ function ThrowGiftsLevelCtrl:OnDrag_Beginning(mDrag)
|
||||
self.nCurAngle = 0
|
||||
self.nCurVelocity = 0
|
||||
self._mapNode.rtBottleAnim:Play("rtBottle_out")
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_pre_lp_stop")
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_fire")
|
||||
local wait = function()
|
||||
local worldPos = self._mapNode.rtBeginningPos:TransformPoint(Vector3.zero)
|
||||
local sumPos = self._mapNode.rtBeginning:InverseTransformPoint(worldPos)
|
||||
local beginningPos = self._mapNode.rtBeginning.anchoredPosition
|
||||
local mapGiftPenguin = self:CreateThrowPenguin(nStartAngle, nStartVelocity, Vector2(beginningPos.x + sumPos.x, beginningPos.y + sumPos.y), self.curPenguinType, self.curPenguinSpecialType)
|
||||
local nSpecialType = self.curPenguinSpecialType == 0 and self.defaultPenguinSpecialType or self.curPenguinSpecialType
|
||||
local mapGiftPenguin = self:CreateThrowPenguin(nStartAngle, nStartVelocity, Vector2(beginningPos.x + sumPos.x, beginningPos.y + sumPos.y), self.curPenguinType, nSpecialType)
|
||||
self.curPenguinSpecialType = 0
|
||||
self.curGiftPenguin = mapGiftPenguin
|
||||
if 0 < self.nTotalPenguinCount and self.mapCurActiveState[102] == nil then
|
||||
|
||||
@@ -135,7 +135,7 @@ end
|
||||
function ActivityTowerDefenseCtrl:OnGridBtnClick(go, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local itemId = self.tbReward[nDataIndex]
|
||||
UTILS.ClickItemGridWithTips(itemId, go.transform:Find("btnGrid"), true, false, false)
|
||||
UTILS.ClickItemGridWithTips(itemId, go.transform:Find("btnGrid"), true, true, false)
|
||||
end
|
||||
function ActivityTowerDefenseCtrl:InitQuest()
|
||||
local allCount = self.actData:GetAllQuestCount()
|
||||
|
||||
@@ -49,7 +49,7 @@ function ActivityListCtrl:InitActivityList(nCurActId)
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
for k, v in pairs(tbActList) do
|
||||
for k, v in ipairs(tbActList) do
|
||||
if not v.actCfg.HideFromActivityList then
|
||||
table.insert(self.tbActList, {
|
||||
nType = AllEnum.ActivityMainType.Activity,
|
||||
@@ -57,7 +57,7 @@ function ActivityListCtrl:InitActivityList(nCurActId)
|
||||
})
|
||||
end
|
||||
end
|
||||
for k, v in pairs(tbActGroupList) do
|
||||
for k, v in ipairs(tbActGroupList) do
|
||||
table.insert(self.tbActList, {
|
||||
nType = AllEnum.ActivityMainType.ActivityGroup,
|
||||
actData = v
|
||||
@@ -234,7 +234,13 @@ function ActivityListCtrl:AddCookieActivityCtrl(actData)
|
||||
local actCtrl = self.tbActCtrlObj[actData:GetActId()]
|
||||
if nil == actCtrl then
|
||||
local mapActCfg = actData:GetCookieControlCfg()
|
||||
if mapActCfg == nil then
|
||||
return
|
||||
end
|
||||
local sFolder = sActTypePath[GameEnum.activityType.Cookie]
|
||||
if sFolder == nil then
|
||||
return
|
||||
end
|
||||
local sPrefabPath = string.format(sEntranceFolder_old, sFolder, mapActCfg.UIAssets)
|
||||
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.rtContent)
|
||||
local sCtrlPath = string.format("Game.UI.Activity.%s.%s", sFolder, mapActCfg.CtrlName)
|
||||
@@ -345,10 +351,6 @@ function ActivityListCtrl:AddBdConvertActivityCtrl(actData)
|
||||
local actCtrl = self.tbActCtrlObj[actData:GetActId()]
|
||||
if nil == actCtrl then
|
||||
local BdConvertActCfg = actData:GetActConfig()
|
||||
local sFolder = "_" .. actData:GetActId()
|
||||
if sFolder == nil then
|
||||
return
|
||||
end
|
||||
local sPrefabPath = string.format(sEntranceFolder, BdConvertActCfg.UIAssets)
|
||||
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.rtContent)
|
||||
local sCtrlPath = string.format("Game.UI.Activity.%s.%s", "BdConvert", BdConvertActCfg.CtrlName)
|
||||
|
||||
@@ -6,7 +6,6 @@ ActivityListPanel._tbDefine = {
|
||||
}
|
||||
}
|
||||
function ActivityListPanel:Awake()
|
||||
self.nSelectGroup = nil
|
||||
end
|
||||
function ActivityListPanel:OnEnable()
|
||||
end
|
||||
@@ -15,7 +14,6 @@ end
|
||||
function ActivityListPanel:OnDisable()
|
||||
end
|
||||
function ActivityListPanel:OnDestroy()
|
||||
self.nSelectGroup = nil
|
||||
end
|
||||
function ActivityListPanel:OnRelease()
|
||||
end
|
||||
|
||||
@@ -35,37 +35,37 @@ function ActivityPopUpCtrl:ShowPopUp()
|
||||
self.popUpIndex = self.popUpIndex + 1
|
||||
self.nCurActId = table.remove(self.tbPopUpAct, 1)
|
||||
local popUpCfg = PlayerData.PopUp:GetPopUpConfigData(self.nCurActId)
|
||||
self.curType = popUpCfg.PopUpType
|
||||
if popUpCfg ~= nil then
|
||||
if self.tbPopUpCtrlObj ~= nil then
|
||||
if self.tbPopUpCtrlObj.go ~= nil then
|
||||
destroy(self.tbPopUpCtrlObj.go)
|
||||
end
|
||||
if self.tbPopUpCtrlObj.ctrl ~= nil then
|
||||
self:UnbindCtrlByNode(self.tbPopUpCtrlObj.ctrl)
|
||||
end
|
||||
self.tbPopUpCtrlObj = {}
|
||||
end
|
||||
local sPrefabPath = string.format("%s.prefab", popUpCfg.PopUpRes)
|
||||
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.PopUpRoot)
|
||||
local ctrlName = popUpCfg.ScriptName
|
||||
local sCtrlPath = string.format("Game.UI.%s", ctrlName)
|
||||
local popupCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
|
||||
local callback = function()
|
||||
self:OnBtnClick_Close()
|
||||
end
|
||||
popupCtrl:ShowPopUp(self.nCurActId, callback, self.popUpIndex)
|
||||
self.tbPopUpCtrlObj = {go = goObj, ctrl = popupCtrl}
|
||||
local saveTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
if popUpCfg ~= nil then
|
||||
if popUpCfg.PopRefreshType == GameEnum.PopRefreshType.WeeklyFirst then
|
||||
saveTime = GetNextWeekRefreshTime()
|
||||
end
|
||||
LocalData.SetPlayerLocalData("Act_PopUp" .. self.nCurActId, saveTime)
|
||||
self._mapNode.btnGoto.gameObject:SetActive(popUpCfg.PopJumpType ~= GameEnum.PopJumpType.None)
|
||||
PlayerData.PopUp:ReleaseCachedPopUpData(popUpCfg.Id)
|
||||
end
|
||||
if popUpCfg == nil then
|
||||
self:ShowPopUp()
|
||||
return
|
||||
end
|
||||
self.curType = popUpCfg.PopUpType
|
||||
if self.tbPopUpCtrlObj ~= nil then
|
||||
if self.tbPopUpCtrlObj.go ~= nil then
|
||||
destroy(self.tbPopUpCtrlObj.go)
|
||||
end
|
||||
if self.tbPopUpCtrlObj.ctrl ~= nil then
|
||||
self:UnbindCtrlByNode(self.tbPopUpCtrlObj.ctrl)
|
||||
end
|
||||
self.tbPopUpCtrlObj = {}
|
||||
end
|
||||
local sPrefabPath = string.format("%s.prefab", popUpCfg.PopUpRes)
|
||||
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.PopUpRoot)
|
||||
local ctrlName = popUpCfg.ScriptName
|
||||
local sCtrlPath = string.format("Game.UI.%s", ctrlName)
|
||||
local popupCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
|
||||
local callback = function()
|
||||
self:OnBtnClick_Close()
|
||||
end
|
||||
popupCtrl:ShowPopUp(self.nCurActId, callback, self.popUpIndex)
|
||||
self.tbPopUpCtrlObj = {go = goObj, ctrl = popupCtrl}
|
||||
local saveTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
if popUpCfg.PopRefreshType == GameEnum.PopRefreshType.WeeklyFirst then
|
||||
saveTime = GetNextWeekRefreshTime()
|
||||
end
|
||||
LocalData.SetPlayerLocalData("Act_PopUp" .. self.nCurActId, saveTime)
|
||||
self._mapNode.btnGoto.gameObject:SetActive(popUpCfg.PopJumpType ~= GameEnum.PopJumpType.None)
|
||||
PlayerData.PopUp:ReleaseCachedPopUpData(popUpCfg.Id)
|
||||
end
|
||||
function ActivityPopUpCtrl:IsPopUpType()
|
||||
return self.curType == GameEnum.PopUpType.ActivityGroup or self.curType == GameEnum.PopUpType.Activity or self.curType == GameEnum.PopUpType.OwnPopUP
|
||||
@@ -85,7 +85,7 @@ function ActivityPopUpCtrl:OnEnable()
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForSeconds(0.1))
|
||||
self._mapNode.PopUpRoot.gameObject:SetActive(self:IsPopUpType())
|
||||
if self.tbPopUpCtrlObj.ctrl ~= nil and self.tbPopUpCtrlObj.ctrl.PlayOpenAnim ~= nil then
|
||||
if self.tbPopUpCtrlObj ~= nil and self.tbPopUpCtrlObj.ctrl ~= nil and self.tbPopUpCtrlObj.ctrl.PlayOpenAnim ~= nil then
|
||||
self.tbPopUpCtrlObj.ctrl:PlayOpenAnim()
|
||||
end
|
||||
end
|
||||
|
||||
+11
-11
@@ -1,8 +1,8 @@
|
||||
local ActivityBreakOut_30101PopUpCtrl = class("ActivityBreakOut_30101PopUpCtrl", BaseCtrl)
|
||||
local ActivityBreakOutPopUpCtrl = class("ActivityBreakOutPopUpCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivityBreakOut_30101PopUpCtrl._mapNodeConfig = {
|
||||
ActivityBreakOutPopUpCtrl._mapNodeConfig = {
|
||||
goContent = {
|
||||
sNodeName = "---Common---"
|
||||
},
|
||||
@@ -31,8 +31,8 @@ ActivityBreakOut_30101PopUpCtrl._mapNodeConfig = {
|
||||
sLanguageId = "Activity_DontShow_PopUp_Again"
|
||||
}
|
||||
}
|
||||
ActivityBreakOut_30101PopUpCtrl._mapEventConfig = {}
|
||||
function ActivityBreakOut_30101PopUpCtrl:ShowPopUp(actId, callback, index)
|
||||
ActivityBreakOutPopUpCtrl._mapEventConfig = {}
|
||||
function ActivityBreakOutPopUpCtrl:ShowPopUp(actId, callback, index)
|
||||
self.popUpIndex = index
|
||||
self.dontShowAgain = false
|
||||
self.nCurActId = actId
|
||||
@@ -50,12 +50,12 @@ function ActivityBreakOut_30101PopUpCtrl:ShowPopUp(actId, callback, index)
|
||||
self.anim = self.gameObject:GetComponent("Animator")
|
||||
self:PlayOpenAnim()
|
||||
end
|
||||
function ActivityBreakOut_30101PopUpCtrl:PlayOpenAnim()
|
||||
function ActivityBreakOutPopUpCtrl:PlayOpenAnim()
|
||||
if self.anim then
|
||||
self.anim:Play("open", 0, 0)
|
||||
end
|
||||
end
|
||||
function ActivityBreakOut_30101PopUpCtrl:RefreshDate()
|
||||
function ActivityBreakOutPopUpCtrl:RefreshDate()
|
||||
local nOpenMonth = tonumber(os.date("%m", self.nOpenTime))
|
||||
local nOpenDay = tonumber(os.date("%d", self.nOpenTime))
|
||||
local nEndMonth = tonumber(os.date("%m", self.nEndTime))
|
||||
@@ -65,7 +65,7 @@ function ActivityBreakOut_30101PopUpCtrl:RefreshDate()
|
||||
local dateStr = string.format("%s/%s ~ %s/%s", nOpenMonth, strOpenDay, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
|
||||
end
|
||||
function ActivityBreakOut_30101PopUpCtrl:RefreshTimeout()
|
||||
function ActivityBreakOutPopUpCtrl:RefreshTimeout()
|
||||
local endTime = self.nEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
@@ -107,13 +107,13 @@ function ActivityBreakOut_30101PopUpCtrl:RefreshTimeout()
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
|
||||
end
|
||||
function ActivityBreakOut_30101PopUpCtrl:OnBtnClick_DontShowAgain()
|
||||
function ActivityBreakOutPopUpCtrl:OnBtnClick_DontShowAgain()
|
||||
self.dontShowAgain = not self.dontShowAgain
|
||||
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
|
||||
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
|
||||
LocalData.SetPlayerLocalData("Act_PopUp_DontShow" .. self.nCurActId, self.dontShowAgain)
|
||||
end
|
||||
function ActivityBreakOut_30101PopUpCtrl:OnBtnClick_Close()
|
||||
function ActivityBreakOutPopUpCtrl:OnBtnClick_Close()
|
||||
if self.callback ~= nil then
|
||||
if self.anim then
|
||||
self.anim:Play("close")
|
||||
@@ -125,7 +125,7 @@ function ActivityBreakOut_30101PopUpCtrl:OnBtnClick_Close()
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityBreakOut_30101PopUpCtrl:OnBtnClick_Goto()
|
||||
function ActivityBreakOutPopUpCtrl:OnBtnClick_Goto()
|
||||
if nil ~= self.nCurActId then
|
||||
PopUpManager.InterruptPopUp(self.popUpIndex)
|
||||
PlayerData.Activity:SendActivityDetailMsg()
|
||||
@@ -153,4 +153,4 @@ function ActivityBreakOut_30101PopUpCtrl:OnBtnClick_Goto()
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
return ActivityBreakOut_30101PopUpCtrl
|
||||
return ActivityBreakOutPopUpCtrl
|
||||
@@ -0,0 +1,161 @@
|
||||
local ActivityJointDrill_510003PopUpCtrl = class("ActivityJointDrill_510003PopUpCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivityJointDrill_510003PopUpCtrl._mapNodeConfig = {
|
||||
goContent = {
|
||||
sNodeName = "---Common---"
|
||||
},
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Goto"
|
||||
},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_PopUp_Goto_1"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtDate = {sComponentName = "TMP_Text"},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
btnDontShow = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_DontShowAgain"
|
||||
},
|
||||
imgDontShow1 = {},
|
||||
imgDontShow2 = {},
|
||||
txtDontShow = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_DontShow_PopUp_Again"
|
||||
},
|
||||
txtBeta = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Beta_Tip"
|
||||
}
|
||||
}
|
||||
ActivityJointDrill_510003PopUpCtrl._mapEventConfig = {}
|
||||
function ActivityJointDrill_510003PopUpCtrl:ShowPopUp(actId, callback, index)
|
||||
self.popUpIndex = index
|
||||
self.dontShowAgain = false
|
||||
self.nCurActId = actId
|
||||
self.callback = callback
|
||||
self.actCfg = ConfigTable.GetData("Activity", self.nCurActId)
|
||||
local actData = PlayerData.Activity:GetActivityDataById(self.nCurActId)
|
||||
if actData == nil then
|
||||
return
|
||||
end
|
||||
self.nOpenTime = actData:GetChallengeStartTime()
|
||||
self.nEndTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actCfg.EndTime)
|
||||
self:RefreshTimeout()
|
||||
self:RefreshDate()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshTimeout", true, true, true)
|
||||
end
|
||||
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
|
||||
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
|
||||
self.anim = self.gameObject:GetComponent("Animator")
|
||||
self:PlayOpenAnim()
|
||||
end
|
||||
function ActivityJointDrill_510003PopUpCtrl:PlayOpenAnim()
|
||||
if self.anim then
|
||||
self.anim:Play("open", 0, 0)
|
||||
end
|
||||
end
|
||||
function ActivityJointDrill_510003PopUpCtrl:RefreshDate()
|
||||
local nOpenMonth = tonumber(os.date("%m", self.nOpenTime))
|
||||
local nOpenDay = tonumber(os.date("%d", self.nOpenTime))
|
||||
local nEndMonth = tonumber(os.date("%m", self.nEndTime))
|
||||
local nEndDay = tonumber(os.date("%d", self.nEndTime))
|
||||
local strOpenDay = string.format("%d", nOpenDay)
|
||||
local strEndDay = string.format("%d", nEndDay)
|
||||
local dateStr = string.format("%s/%s ~ %s/%s", nOpenMonth, strOpenDay, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
|
||||
end
|
||||
function ActivityJointDrill_510003PopUpCtrl:RefreshTimeout()
|
||||
local endTime = self.nEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
if self.remainTimer ~= nil then
|
||||
self.remainTimer:Cancel()
|
||||
self.remainTimer = nil
|
||||
end
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
|
||||
end
|
||||
function ActivityJointDrill_510003PopUpCtrl:ClosePopUp(callback)
|
||||
if self.anim ~= nil then
|
||||
self.anim:Play("close", 0, 0)
|
||||
self:AddTimer(1, 0.1, function()
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.1)
|
||||
elseif callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function ActivityJointDrill_510003PopUpCtrl:OnBtnClick_DontShowAgain()
|
||||
self.dontShowAgain = not self.dontShowAgain
|
||||
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
|
||||
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
|
||||
LocalData.SetPlayerLocalData("Act_PopUp_DontShow" .. self.nCurActId, self.dontShowAgain)
|
||||
end
|
||||
function ActivityJointDrill_510003PopUpCtrl:OnBtnClick_Close()
|
||||
self:ClosePopUp(self.callback)
|
||||
end
|
||||
function ActivityJointDrill_510003PopUpCtrl:OnBtnClick_Goto()
|
||||
local callback = function()
|
||||
if nil ~= self.nCurActId then
|
||||
PopUpManager.InterruptPopUp(self.popUpIndex)
|
||||
PlayerData.Activity:SendActivityDetailMsg()
|
||||
local endTime = self.nEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime <= 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Invalid_Tip_3"))
|
||||
if self.callback ~= nil then
|
||||
self.callback()
|
||||
end
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityPopUp)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ActivityList, self.nCurActId)
|
||||
end
|
||||
end
|
||||
self:ClosePopUp(callback)
|
||||
end
|
||||
return ActivityJointDrill_510003PopUpCtrl
|
||||
@@ -0,0 +1,157 @@
|
||||
local ActivitySwim_11100PopUpCtrl = class("ActivitySwim_11100PopUpCtrl", BaseCtrl)
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivitySwim_11100PopUpCtrl._mapNodeConfig = {
|
||||
goContent = {
|
||||
sNodeName = "---Common---"
|
||||
},
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Goto"
|
||||
},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_PopUp_Goto"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtDate = {sComponentName = "TMP_Text"},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
btnDontShow = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_DontShowAgain"
|
||||
},
|
||||
imgDontShow1 = {},
|
||||
imgDontShow2 = {},
|
||||
txtDontShow = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_DontShow_PopUp_Again"
|
||||
}
|
||||
}
|
||||
ActivitySwim_11100PopUpCtrl._mapEventConfig = {}
|
||||
function ActivitySwim_11100PopUpCtrl:ShowPopUp(actId, callback, index)
|
||||
self.popUpIndex = index
|
||||
self.dontShowAgain = false
|
||||
self.nCurActId = actId
|
||||
self.callback = callback
|
||||
self.actGroupCfg = ConfigTable.GetData("ActivityGroup", self.nCurActId)
|
||||
self.nOpenTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actGroupCfg.StartTime)
|
||||
self.nEndTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actGroupCfg.EndTime)
|
||||
self:RefreshTimeout()
|
||||
self:RefreshDate()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshTimeout", true, true, true)
|
||||
end
|
||||
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
|
||||
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
|
||||
self.anim = self.gameObject:GetComponent("Animator")
|
||||
self:PlayOpenAnim()
|
||||
end
|
||||
function ActivitySwim_11100PopUpCtrl:PlayOpenAnim()
|
||||
if self.anim then
|
||||
self.anim:Play("open", 0, 0)
|
||||
end
|
||||
end
|
||||
function ActivitySwim_11100PopUpCtrl:RefreshDate()
|
||||
local nOpenMonth = tonumber(os.date("%m", self.nOpenTime))
|
||||
local nOpenDay = tonumber(os.date("%d", self.nOpenTime))
|
||||
local nOpenYear = tonumber(os.date("%Y", self.nOpenTime))
|
||||
local nEndMonth = tonumber(os.date("%m", self.nEndTime))
|
||||
local nEndDay = tonumber(os.date("%d", self.nEndTime))
|
||||
local nEndYear = tonumber(os.date("%Y", self.nEndTime))
|
||||
local strOpenDay = string.format("%d", nOpenDay)
|
||||
local strEndDay = string.format("%d", nEndDay)
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
|
||||
end
|
||||
function ActivitySwim_11100PopUpCtrl:RefreshTimeout()
|
||||
local endTime = self.nEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
if self.remainTimer ~= nil then
|
||||
self.remainTimer:Cancel()
|
||||
self.remainTimer = nil
|
||||
end
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
|
||||
end
|
||||
function ActivitySwim_11100PopUpCtrl:OnBtnClick_DontShowAgain()
|
||||
self.dontShowAgain = not self.dontShowAgain
|
||||
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
|
||||
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
|
||||
LocalData.SetPlayerLocalData("Act_PopUp_DontShow" .. self.nCurActId, self.dontShowAgain)
|
||||
end
|
||||
function ActivitySwim_11100PopUpCtrl:OnBtnClick_Close()
|
||||
if self.callback ~= nil then
|
||||
if self.anim then
|
||||
self.anim:Play("close")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self.callback()
|
||||
end, true, true, true)
|
||||
else
|
||||
self.callback()
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivitySwim_11100PopUpCtrl:OnBtnClick_Goto()
|
||||
if nil ~= self.nCurActId then
|
||||
PopUpManager.InterruptPopUp(self.popUpIndex)
|
||||
PlayerData.Activity:SendActivityDetailMsg()
|
||||
self.anim:Play("close")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
local endTime = self.nEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime <= 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Invalid_Tip_3"))
|
||||
if self.callback ~= nil then
|
||||
self.callback()
|
||||
end
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityPopUp)
|
||||
if self.actGroupCfg.TransitionId ~= nil and 0 < self.actGroupCfg.TransitionId then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, self.actGroupCfg.PanelId, self.actGroupCfg.Id)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, self.actGroupCfg.TransitionId, callback)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, self.actGroupCfg.PanelId, self.actGroupCfg.Id)
|
||||
end
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
return ActivitySwim_11100PopUpCtrl
|
||||
@@ -0,0 +1,164 @@
|
||||
local ActivityTech_10108PopUpCtrl = class("ActivityTech_10108PopUpCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivityTech_10108PopUpCtrl._mapNodeConfig = {
|
||||
goContent = {
|
||||
sNodeName = "---Common---"
|
||||
},
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Goto"
|
||||
},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_PopUp_Goto"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnCloseFullscreen = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtDate = {sComponentName = "TMP_Text"},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
btnDontShow = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_DontShowAgain"
|
||||
},
|
||||
imgDontShow1 = {},
|
||||
imgDontShow2 = {},
|
||||
txtDontShow = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_DontShow_PopUp_Again"
|
||||
}
|
||||
}
|
||||
ActivityTech_10108PopUpCtrl._mapEventConfig = {}
|
||||
function ActivityTech_10108PopUpCtrl:ShowPopUp(actId, callback, index)
|
||||
self.popUpIndex = index
|
||||
self.dontShowAgain = false
|
||||
self.nCurActId = actId
|
||||
self.callback = callback
|
||||
self.actGroupCfg = ConfigTable.GetData("ActivityGroup", self.nCurActId)
|
||||
self.nOpenTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actGroupCfg.StartTime)
|
||||
self.nEndTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actGroupCfg.EndTime)
|
||||
self:RefreshTimeout()
|
||||
self:RefreshDate()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshTimeout", true, true, true)
|
||||
end
|
||||
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
|
||||
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
|
||||
self.anim = self.gameObject:GetComponent("Animator")
|
||||
self:PlayOpenAnim()
|
||||
end
|
||||
function ActivityTech_10108PopUpCtrl:PlayOpenAnim()
|
||||
if self.anim then
|
||||
self.anim:Play("open", 0, 0)
|
||||
end
|
||||
end
|
||||
function ActivityTech_10108PopUpCtrl:RefreshDate()
|
||||
local nOpenYear = tostring(os.date("%Y", self.nOpenTime))
|
||||
local nOpenMonth = tostring(os.date("%m", self.nOpenTime))
|
||||
local nOpenDay = tonumber(os.date("%d", self.nOpenTime))
|
||||
local nEndYear = tostring(os.date("%Y", self.nEndTime))
|
||||
local nEndMonth = tostring(os.date("%m", self.nEndTime))
|
||||
local nEndDay = tonumber(os.date("%d", self.nEndTime))
|
||||
local strOpenDay = string.format("%02d", nOpenDay)
|
||||
local strEndDay = string.format("%02d", nEndDay)
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
|
||||
end
|
||||
function ActivityTech_10108PopUpCtrl:RefreshTimeout()
|
||||
local endTime = self.nEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
if self.remainTimer ~= nil then
|
||||
self.remainTimer:Cancel()
|
||||
self.remainTimer = nil
|
||||
end
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
|
||||
end
|
||||
function ActivityTech_10108PopUpCtrl:OnBtnClick_DontShowAgain()
|
||||
self.dontShowAgain = not self.dontShowAgain
|
||||
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
|
||||
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
|
||||
LocalData.SetPlayerLocalData("Act_PopUp_DontShow" .. self.nCurActId, self.dontShowAgain)
|
||||
end
|
||||
function ActivityTech_10108PopUpCtrl:OnBtnClick_Close()
|
||||
if self.callback ~= nil then
|
||||
if self.anim then
|
||||
self.anim:Play("close")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self.callback()
|
||||
end, true, true, true)
|
||||
else
|
||||
self.callback()
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityTech_10108PopUpCtrl:OnBtnClick_Goto()
|
||||
if nil ~= self.nCurActId then
|
||||
PopUpManager.InterruptPopUp(self.popUpIndex)
|
||||
PlayerData.Activity:SendActivityDetailMsg()
|
||||
if self.anim then
|
||||
self.anim:Play("close")
|
||||
end
|
||||
self:AddTimer(1, 0.2, function()
|
||||
local endTime = self.nEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime <= 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Invalid_Tip_3"))
|
||||
if self.callback ~= nil then
|
||||
self.callback()
|
||||
end
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityPopUp)
|
||||
if self.actGroupCfg.TransitionId ~= nil and 0 < self.actGroupCfg.TransitionId then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, self.actGroupCfg.PanelId, self.actGroupCfg.Id)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, self.actGroupCfg.TransitionId, callback)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, self.actGroupCfg.PanelId, self.actGroupCfg.Id)
|
||||
end
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
return ActivityTech_10108PopUpCtrl
|
||||
@@ -0,0 +1,164 @@
|
||||
local ActivityViewfinder_10107PopUpCtrl = class("ActivityViewfinder_10107PopUpCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivityViewfinder_10107PopUpCtrl._mapNodeConfig = {
|
||||
goContent = {
|
||||
sNodeName = "---Common---"
|
||||
},
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Goto"
|
||||
},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_PopUp_Goto"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnCloseFullscreen = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtDate = {sComponentName = "TMP_Text"},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
btnDontShow = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_DontShowAgain"
|
||||
},
|
||||
imgDontShow1 = {},
|
||||
imgDontShow2 = {},
|
||||
txtDontShow = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_DontShow_PopUp_Again"
|
||||
}
|
||||
}
|
||||
ActivityViewfinder_10107PopUpCtrl._mapEventConfig = {}
|
||||
function ActivityViewfinder_10107PopUpCtrl:ShowPopUp(actId, callback, index)
|
||||
self.popUpIndex = index
|
||||
self.dontShowAgain = false
|
||||
self.nCurActId = actId
|
||||
self.callback = callback
|
||||
self.actGroupCfg = ConfigTable.GetData("ActivityGroup", self.nCurActId)
|
||||
self.nOpenTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actGroupCfg.StartTime)
|
||||
self.nEndTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actGroupCfg.EndTime)
|
||||
self:RefreshTimeout()
|
||||
self:RefreshDate()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshTimeout", true, true, true)
|
||||
end
|
||||
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
|
||||
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
|
||||
self.anim = self.gameObject:GetComponent("Animator")
|
||||
self:PlayOpenAnim()
|
||||
end
|
||||
function ActivityViewfinder_10107PopUpCtrl:PlayOpenAnim()
|
||||
if self.anim then
|
||||
self.anim:Play("open", 0, 0)
|
||||
end
|
||||
end
|
||||
function ActivityViewfinder_10107PopUpCtrl:RefreshDate()
|
||||
local nOpenYear = tostring(os.date("%Y", self.nOpenTime))
|
||||
local nOpenMonth = tostring(os.date("%m", self.nOpenTime))
|
||||
local nOpenDay = tonumber(os.date("%d", self.nOpenTime))
|
||||
local nEndYear = tostring(os.date("%Y", self.nEndTime))
|
||||
local nEndMonth = tostring(os.date("%m", self.nEndTime))
|
||||
local nEndDay = tonumber(os.date("%d", self.nEndTime))
|
||||
local strOpenDay = string.format("%02d", nOpenDay)
|
||||
local strEndDay = string.format("%02d", nEndDay)
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
|
||||
end
|
||||
function ActivityViewfinder_10107PopUpCtrl:RefreshTimeout()
|
||||
local endTime = self.nEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
if self.remainTimer ~= nil then
|
||||
self.remainTimer:Cancel()
|
||||
self.remainTimer = nil
|
||||
end
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
|
||||
end
|
||||
function ActivityViewfinder_10107PopUpCtrl:OnBtnClick_DontShowAgain()
|
||||
self.dontShowAgain = not self.dontShowAgain
|
||||
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
|
||||
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
|
||||
LocalData.SetPlayerLocalData("Act_PopUp_DontShow" .. self.nCurActId, self.dontShowAgain)
|
||||
end
|
||||
function ActivityViewfinder_10107PopUpCtrl:OnBtnClick_Close()
|
||||
if self.callback ~= nil then
|
||||
if self.anim then
|
||||
self.anim:Play("close")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self.callback()
|
||||
end, true, true, true)
|
||||
else
|
||||
self.callback()
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityViewfinder_10107PopUpCtrl:OnBtnClick_Goto()
|
||||
if nil ~= self.nCurActId then
|
||||
PopUpManager.InterruptPopUp(self.popUpIndex)
|
||||
PlayerData.Activity:SendActivityDetailMsg()
|
||||
if self.anim then
|
||||
self.anim:Play("close")
|
||||
end
|
||||
self:AddTimer(1, 0.2, function()
|
||||
local endTime = self.nEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime <= 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Invalid_Tip_3"))
|
||||
if self.callback ~= nil then
|
||||
self.callback()
|
||||
end
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityPopUp)
|
||||
if self.actGroupCfg.TransitionId ~= nil and 0 < self.actGroupCfg.TransitionId then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, self.actGroupCfg.PanelId, self.actGroupCfg.Id)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, self.actGroupCfg.TransitionId, callback)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, self.actGroupCfg.PanelId, self.actGroupCfg.Id)
|
||||
end
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
return ActivityViewfinder_10107PopUpCtrl
|
||||
@@ -145,7 +145,7 @@ function ActivityOurRegimentCtrl:BtnRewardGridClick(goGrid, gridIndex)
|
||||
end
|
||||
function ActivityOurRegimentCtrl:OnBtnClick_Go()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
if actGroupCfg ~= nil and actGroupCfg ~= nil then
|
||||
if actGroupCfg ~= nil then
|
||||
if actGroupCfg.TransitionId ~= nil and actGroupCfg.TransitionId > 0 then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.OurRegimentThemePanel, actGroupCfg.Id)
|
||||
|
||||
@@ -198,10 +198,10 @@ end
|
||||
function OurRegimentThemeCtrl:RefreshTime()
|
||||
local bOpen = self.OurRegimentThemeData:CheckActivityGroupOpen()
|
||||
if bOpen then
|
||||
self:RefreshRemainTime(self.OurRegimentThemeData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
RefreshRemainTime(self.OurRegimentThemeData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(self.OurRegimentThemeData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
local remainTime = RefreshRemainTime(self.OurRegimentThemeData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
@@ -217,41 +217,6 @@ function OurRegimentThemeCtrl:RefreshTime()
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityDate, dateStr)
|
||||
end
|
||||
function OurRegimentThemeCtrl:RefreshRemainTime(endTime, txtComp)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(txtComp, sTimeStr)
|
||||
return remainTime
|
||||
end
|
||||
function OurRegimentThemeCtrl:RefreshRemainOpenTime(openTime)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
@@ -327,7 +292,7 @@ function OurRegimentThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTr
|
||||
end
|
||||
else
|
||||
imgTrans:SetActive(false)
|
||||
TimerManager.Remove(timer)
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
refreshFunc(actData)
|
||||
@@ -346,12 +311,12 @@ function OurRegimentThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTr
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
if timer == nil and bShowCountDown then
|
||||
self:RefreshRemainTime(endTime, txtTrans)
|
||||
RefreshRemainTime(endTime, txtTrans)
|
||||
do
|
||||
local fcTimer = function()
|
||||
local remainTime = self:RefreshRemainTime(endTime, txtTrans)
|
||||
local remainTime = RefreshRemainTime(endTime, txtTrans)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(timer)
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
refreshFunc(actData)
|
||||
end
|
||||
|
||||
@@ -197,10 +197,10 @@ end
|
||||
function DreamThemeCtrl:RefreshTime()
|
||||
local bOpen = self.DreamThemeData:CheckActivityGroupOpen()
|
||||
if bOpen then
|
||||
self:RefreshRemainTime(self.DreamThemeData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
RefreshRemainTime(self.DreamThemeData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(self.DreamThemeData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
local remainTime = RefreshRemainTime(self.DreamThemeData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
@@ -216,41 +216,6 @@ function DreamThemeCtrl:RefreshTime()
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityDate, dateStr)
|
||||
end
|
||||
function DreamThemeCtrl:RefreshRemainTime(endTime, txtComp)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(txtComp, sTimeStr)
|
||||
return remainTime
|
||||
end
|
||||
function DreamThemeCtrl:RefreshRemainOpenTime(openTime)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
@@ -326,7 +291,7 @@ function DreamThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans, r
|
||||
end
|
||||
else
|
||||
imgTrans:SetActive(false)
|
||||
TimerManager.Remove(timer)
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
refreshFunc(actData)
|
||||
@@ -345,12 +310,12 @@ function DreamThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans, r
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
if timer == nil and bShowCountDown then
|
||||
self:RefreshRemainTime(endTime, txtTrans)
|
||||
RefreshRemainTime(endTime, txtTrans)
|
||||
do
|
||||
local fcTimer = function()
|
||||
local remainTime = self:RefreshRemainTime(endTime, txtTrans)
|
||||
local remainTime = RefreshRemainTime(endTime, txtTrans)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(timer)
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
refreshFunc(actData)
|
||||
end
|
||||
|
||||
@@ -205,10 +205,10 @@ end
|
||||
function MiracleThemeCtrl:RefreshTime()
|
||||
local bOpen = self.MiracleThemeData:CheckActivityGroupOpen()
|
||||
if bOpen then
|
||||
self:RefreshRemainTime(self.MiracleThemeData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
RefreshRemainTime(self.MiracleThemeData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(self.MiracleThemeData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
local remainTime = RefreshRemainTime(self.MiracleThemeData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
@@ -224,41 +224,6 @@ function MiracleThemeCtrl:RefreshTime()
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityDate, dateStr)
|
||||
end
|
||||
function MiracleThemeCtrl:RefreshRemainTime(endTime, txtComp)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(txtComp, sTimeStr)
|
||||
return remainTime
|
||||
end
|
||||
function MiracleThemeCtrl:RefreshRemainOpenTime(openTime)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
@@ -334,7 +299,7 @@ function MiracleThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans,
|
||||
end
|
||||
else
|
||||
imgTrans:SetActive(false)
|
||||
TimerManager.Remove(timer)
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
refreshFunc(actData)
|
||||
@@ -353,12 +318,12 @@ function MiracleThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans,
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
if timer == nil and bShowCountDown then
|
||||
self:RefreshRemainTime(endTime, txtTrans)
|
||||
RefreshRemainTime(endTime, txtTrans)
|
||||
do
|
||||
local fcTimer = function()
|
||||
local remainTime = self:RefreshRemainTime(endTime, txtTrans)
|
||||
local remainTime = RefreshRemainTime(endTime, txtTrans)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(timer)
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
refreshFunc(actData)
|
||||
end
|
||||
|
||||
@@ -228,10 +228,10 @@ end
|
||||
function SpringFestivalThemeCtrl:RefreshTime()
|
||||
local bOpen = self.SpringFestivalData:CheckActivityGroupOpen()
|
||||
if bOpen then
|
||||
self:RefreshRemainTime(self.SpringFestivalData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
RefreshRemainTime(self.SpringFestivalData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(self.SpringFestivalData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
local remainTime = RefreshRemainTime(self.SpringFestivalData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
@@ -247,41 +247,6 @@ function SpringFestivalThemeCtrl:RefreshTime()
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityDate, dateStr)
|
||||
end
|
||||
function SpringFestivalThemeCtrl:RefreshRemainTime(endTime, txtComp)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(txtComp, sTimeStr)
|
||||
return remainTime
|
||||
end
|
||||
function SpringFestivalThemeCtrl:RefreshRemainOpenTime(openTime)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
@@ -359,7 +324,7 @@ function SpringFestivalThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, im
|
||||
end
|
||||
else
|
||||
imgTrans:SetActive(false)
|
||||
TimerManager.Remove(timer)
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
refreshFunc(actData)
|
||||
@@ -378,12 +343,12 @@ function SpringFestivalThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, im
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
if timer == nil and bShowCountDown then
|
||||
self:RefreshRemainTime(endTime, txtTrans)
|
||||
RefreshRemainTime(endTime, txtTrans)
|
||||
do
|
||||
local fcTimer = function()
|
||||
local remainTime = self:RefreshRemainTime(endTime, txtTrans)
|
||||
local remainTime = RefreshRemainTime(endTime, txtTrans)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(timer)
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
refreshFunc(actData)
|
||||
end
|
||||
|
||||
@@ -233,10 +233,10 @@ end
|
||||
function WinterNightThemeCtrl:RefreshTime()
|
||||
local bOpen = self.WinterNightData:CheckActivityGroupOpen()
|
||||
if bOpen then
|
||||
self:RefreshRemainTime(self.WinterNightData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
RefreshRemainTime(self.WinterNightData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(self.WinterNightData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
local remainTime = RefreshRemainTime(self.WinterNightData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
@@ -252,41 +252,6 @@ function WinterNightThemeCtrl:RefreshTime()
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityDate, dateStr)
|
||||
end
|
||||
function WinterNightThemeCtrl:RefreshRemainTime(endTime, txtComp)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(txtComp, sTimeStr)
|
||||
return remainTime
|
||||
end
|
||||
function WinterNightThemeCtrl:RefreshRemainOpenTime(openTime)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
@@ -364,7 +329,7 @@ function WinterNightThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTr
|
||||
end
|
||||
else
|
||||
imgTrans:SetActive(false)
|
||||
TimerManager.Remove(timer)
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
refreshFunc(actData)
|
||||
@@ -383,12 +348,12 @@ function WinterNightThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTr
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
if timer == nil and bShowCountDown then
|
||||
self:RefreshRemainTime(endTime, txtTrans)
|
||||
RefreshRemainTime(endTime, txtTrans)
|
||||
do
|
||||
local fcTimer = function()
|
||||
local remainTime = self:RefreshRemainTime(endTime, txtTrans)
|
||||
local remainTime = RefreshRemainTime(endTime, txtTrans)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(timer)
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
refreshFunc(actData)
|
||||
end
|
||||
|
||||
@@ -234,10 +234,10 @@ end
|
||||
function PostalThemeCtrl:RefreshTime()
|
||||
local bOpen = self.PostalData:CheckActivityGroupOpen()
|
||||
if bOpen then
|
||||
self:RefreshRemainTime(self.PostalData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
RefreshRemainTime(self.PostalData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(self.PostalData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
local remainTime = RefreshRemainTime(self.PostalData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
@@ -253,41 +253,6 @@ function PostalThemeCtrl:RefreshTime()
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityDate, dateStr)
|
||||
end
|
||||
function PostalThemeCtrl:RefreshRemainTime(endTime, txtComp)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(txtComp, sTimeStr)
|
||||
return remainTime
|
||||
end
|
||||
function PostalThemeCtrl:RefreshRemainOpenTime(openTime)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
@@ -365,7 +330,7 @@ function PostalThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans,
|
||||
end
|
||||
else
|
||||
imgTrans:SetActive(false)
|
||||
TimerManager.Remove(timer)
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
refreshFunc(actData)
|
||||
@@ -384,12 +349,12 @@ function PostalThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans,
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
if timer == nil and bShowCountDown then
|
||||
self:RefreshRemainTime(endTime, txtTrans)
|
||||
RefreshRemainTime(endTime, txtTrans)
|
||||
do
|
||||
local fcTimer = function()
|
||||
local remainTime = self:RefreshRemainTime(endTime, txtTrans)
|
||||
local remainTime = RefreshRemainTime(endTime, txtTrans)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(timer)
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
refreshFunc(actData)
|
||||
end
|
||||
|
||||
@@ -14,9 +14,11 @@ local mapToggle = {
|
||||
}
|
||||
local colorSelect = Color(1.0, 0.9882352941176471, 0.9568627450980393, 1)
|
||||
local colorUnSelect = Color(0.4, 0.13333333333333333, 0.15294117647058825, 1)
|
||||
local colorSelectLock = Color(0.9529411764705882, 0.8588235294117647, 0.7215686274509804, 1)
|
||||
local colorUnSelectLock = Color(0.4, 0.13333333333333333, 0.15294117647058825, 1)
|
||||
local colorSelectLock = Color(0.11764705882352941, 0.12549019607843137, 0.17254901960784313, 1)
|
||||
local colorUnSelectLock = Color(0.4823529411764706, 0.5333333333333333, 0.6509803921568628, 1)
|
||||
local timeUnLockColor = "fff7ca"
|
||||
local colorLockSelectImage = Color(0.4823529411764706, 0.5333333333333333, 0.6509803921568628, 1)
|
||||
local colorLockUnSelectImage = Color(0.11764705882352941, 0.12549019607843137, 0.17254901960784313, 1)
|
||||
local colorConditionsUnLock = Color(0.5607843137254902, 0.6666666666666666, 0.8745098039215686, 1)
|
||||
local colorConditionsLock = Color(1.0, 0.996078431372549, 0.9450980392156862, 1)
|
||||
local lvIndexTitle = "{0}-{1}"
|
||||
@@ -174,6 +176,15 @@ ActivityLevelsSelectCtrl._mapNodeConfig = {
|
||||
ListConditionsObj = {
|
||||
sNodeName = "Conditions_",
|
||||
nCount = 2
|
||||
},
|
||||
rtBossCanvas = {sNodeName = "rtBoss", sComponentName = "Canvas"},
|
||||
topBarCanvas = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sComponentName = "Canvas"
|
||||
},
|
||||
goEnemyInfoCanvas = {
|
||||
sNodeName = "goEnemyInfo",
|
||||
sComponentName = "Canvas"
|
||||
}
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapEventConfig = {
|
||||
@@ -210,6 +221,12 @@ function ActivityLevelsSelectCtrl:OnEnable()
|
||||
self._mapNode.rtTogglesTmp.localPosition = self._mapNode.rt_ToggleTrans.localPosition
|
||||
end
|
||||
self._mapNode.rtToggles.onValueChanged:AddListener(self.onScrollValueChanged)
|
||||
NovaAPI.SetCanvasSortingName(self._mapNode.rtBossCanvas, AllEnum.SortingLayerName.UI)
|
||||
NovaAPI.SetCanvasSortingOrder(self._mapNode.rtBossCanvas, self._nSortingOrder + 2)
|
||||
NovaAPI.SetCanvasSortingName(self._mapNode.topBarCanvas, AllEnum.SortingLayerName.UI)
|
||||
NovaAPI.SetCanvasSortingOrder(self._mapNode.topBarCanvas, self._nSortingOrder + 3)
|
||||
NovaAPI.SetCanvasSortingName(self._mapNode.goEnemyInfoCanvas, AllEnum.SortingLayerName.UI)
|
||||
NovaAPI.SetCanvasSortingOrder(self._mapNode.goEnemyInfoCanvas, self._nSortingOrder + 4)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnDisable()
|
||||
self.timeTab = {}
|
||||
@@ -244,7 +261,7 @@ end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogTypeCount()
|
||||
self._mapNode.togTypeExploreCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_Explore"))
|
||||
self._mapNode.togTypeAdventureCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_Adventure"))
|
||||
self._mapNode.togTypeHardCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_HardCommon"))
|
||||
self._mapNode.togTypeHardCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_Hard"))
|
||||
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Adventure)
|
||||
self._mapNode.togTypeHardCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.HARD)
|
||||
@@ -367,15 +384,33 @@ function ActivityLevelsSelectCtrl:RefreshTogList(nType, nDifficulty)
|
||||
self.SelectObj = nil
|
||||
local tabLevelInfo, tabLevelInfoDifficulty
|
||||
self.currentTypeLvCount = 0
|
||||
local isOpenAdventure = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
|
||||
local isOpenHard = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.HARD, self.firstHardLevel)
|
||||
local tmpImageAdventure = self._mapNode.lockAdventure.gameObject.transform:Find("Image"):GetComponent("Image")
|
||||
local tmpImageHard = self._mapNode.lockHard.gameObject.transform:Find("Image"):GetComponent("Image")
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
tabLevelInfo = self.activityLevelsData.levelTabExplore
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabExploreDifficulty
|
||||
NovaAPI.SetImageColor(tmpImageAdventure, colorLockUnSelectImage)
|
||||
NovaAPI.SetImageColor(tmpImageHard, colorLockUnSelectImage)
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
tabLevelInfo = self.activityLevelsData.levelTabAdventure
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabAdventureDifficulty
|
||||
if isOpenAdventure then
|
||||
NovaAPI.SetImageColor(tmpImageAdventure, colorLockUnSelectImage)
|
||||
else
|
||||
NovaAPI.SetImageColor(tmpImageAdventure, colorLockSelectImage)
|
||||
end
|
||||
NovaAPI.SetImageColor(tmpImageHard, colorLockUnSelectImage)
|
||||
else
|
||||
tabLevelInfo = self.activityLevelsData.levelTabHard
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabHardDifficulty
|
||||
NovaAPI.SetImageColor(tmpImageAdventure, colorLockUnSelectImage)
|
||||
if isOpenHard then
|
||||
NovaAPI.SetImageColor(tmpImageHard, colorLockUnSelectImage)
|
||||
else
|
||||
NovaAPI.SetImageColor(tmpImageHard, colorLockSelectImage)
|
||||
end
|
||||
end
|
||||
self.currentTypeLvCount = #tabLevelInfoDifficulty
|
||||
self._mapNode.rtToggles.gameObject:SetActive(true)
|
||||
@@ -409,10 +444,12 @@ function ActivityLevelsSelectCtrl:RefreshTogList(nType, nDifficulty)
|
||||
local wait = function()
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rt_ToggleTrans.gameObject:GetComponent("RectTransform"))
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
if i <= 3 then
|
||||
if i < 3 then
|
||||
self._mapNode.rt_ToggleTrans.localPosition = Vector3(0, self._mapNode.rt_ToggleTrans.localPosition.y, 0)
|
||||
elseif 10 < i then
|
||||
self._mapNode.rt_ToggleTrans.localPosition = Vector3(-4030, self._mapNode.rt_ToggleTrans.localPosition.y, 0)
|
||||
else
|
||||
self._mapNode.rt_ToggleTrans.localPosition = Vector3(-400, self._mapNode.rt_ToggleTrans.localPosition.y, 0)
|
||||
self._mapNode.rt_ToggleTrans.localPosition = Vector3(-450 * (i - 2), self._mapNode.rt_ToggleTrans.localPosition.y, 0)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
@@ -734,5 +771,6 @@ end
|
||||
function ActivityLevelsSelectCtrl:OnEvent_UpdateEnergy()
|
||||
local nHas = PlayerData.Base:GetCurEnergy()
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCount, nHas.nEnergy < self.curRequireEnergy and Red_Unable or Blue_Normal)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCountRaidUnlock, nHas.nEnergy < self.curRequireEnergy and Red_Unable or Blue_Normal)
|
||||
end
|
||||
return ActivityLevelsSelectCtrl
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
local ActivityViewfinderCtrl = class("ActivityViewfinderCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivityViewfinderCtrl._mapNodeConfig = {
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Go"
|
||||
},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
svReward = {
|
||||
sNodeName = "PreviewUpgradeMaterial",
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
txtAdvanceMat = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MessageBox_Reward"
|
||||
},
|
||||
txtDate = {sComponentName = "TMP_Text"},
|
||||
imgLock = {},
|
||||
txtLock = {sComponentName = "TMP_Text"},
|
||||
imgEnd = {},
|
||||
txtActivityEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgRemaineTime = {},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_TowerAllOpen_Go"
|
||||
},
|
||||
txtBtnActDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Detail"
|
||||
},
|
||||
btnActDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
}
|
||||
}
|
||||
function ActivityViewfinderCtrl:Awake()
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityViewfinderCtrl:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivityViewfinderCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self:RefreshLockState()
|
||||
self:RefreshDate()
|
||||
self:RefreshTimeout()
|
||||
self:RefreshReward()
|
||||
end
|
||||
function ActivityViewfinderCtrl:UnInit()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivityViewfinderCtrl:UnbindCtrl()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityViewfinderCtrl:RefreshLockState()
|
||||
local IsUnlock, txtLock = self.actData:IsUnlock()
|
||||
self._mapNode.imgLock.gameObject:SetActive(not IsUnlock)
|
||||
self._mapNode.btnGo.gameObject:SetActive(IsUnlock)
|
||||
if not IsUnlock then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLock, txtLock)
|
||||
end
|
||||
end
|
||||
function ActivityViewfinderCtrl:RefreshTimeout()
|
||||
local endTime = self.actData:GetActGroupEndTime()
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
self._mapNode.imgRemaineTime:SetActive(0 < remainTime)
|
||||
self._mapNode.imgEnd:SetActive(remainTime <= 0)
|
||||
if remainTime < 0 and self.remainTimer ~= nil then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
|
||||
end
|
||||
function ActivityViewfinderCtrl:RefreshDate()
|
||||
local nOpenMonth, nOpenDay, nEndMonth, nEndDay, nOpenYear, nEndYear = self.actData:GetActGroupDate()
|
||||
local strOpenDay = string.format("%d", nOpenDay)
|
||||
local strEndDay = string.format("%d", nEndDay)
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
|
||||
end
|
||||
function ActivityViewfinderCtrl:RefreshReward()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
local rewardData = actGroupCfg.RewardsShow
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self._mapNode.svReward:Init(#rewardData, self, self.RefreshRewardGridItem, self.BtnRewardGridClick)
|
||||
end
|
||||
function ActivityViewfinderCtrl:RefreshRewardGridItem(go, index)
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
local rewardData = actGroupCfg.RewardsShow
|
||||
local rewardId = rewardData[index + 1]
|
||||
local nInstanceID = go:GetInstanceID()
|
||||
if not self.tbGridCtrl[nInstanceID] then
|
||||
self.tbGridCtrl[nInstanceID] = self:BindCtrlByNode(go, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
self.tbGridCtrl[nInstanceID]:SetItem(rewardId)
|
||||
end
|
||||
function ActivityViewfinderCtrl:BtnRewardGridClick(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
local rewardData = actGroupCfg.RewardsShow
|
||||
local item = goGrid.transform:Find("AnimRoot/item")
|
||||
UTILS.ClickItemGridWithTips(rewardData[nIndex], item.transform, true, true, false)
|
||||
end
|
||||
function ActivityViewfinderCtrl:OnBtnClick_Go()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
if actGroupCfg ~= nil and actGroupCfg ~= nil then
|
||||
if actGroupCfg.TransitionId ~= nil and actGroupCfg.TransitionId > 0 then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Main_10107, actGroupCfg.Id, true)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, actGroupCfg.TransitionId, callback)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Main_10107, actGroupCfg.Id, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityViewfinderCtrl:OnBtnClick_Detail()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
if actGroupCfg == nil then
|
||||
return
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = actGroupCfg.DesText,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function ActivityViewfinderCtrl:ClearActivity()
|
||||
end
|
||||
return ActivityViewfinderCtrl
|
||||
@@ -0,0 +1,134 @@
|
||||
local ActivityShopGoodsItemCtrl = class("ActivityShopGoodsItemCtrl", BaseCtrl)
|
||||
ActivityShopGoodsItemCtrl._mapNodeConfig = {
|
||||
imgRare = {sComponentName = "Image"},
|
||||
imgLeft = {},
|
||||
txtLeft = {sComponentName = "TMP_Text"},
|
||||
imgTime = {},
|
||||
txtLeftTime = {sComponentName = "TMP_Text"},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgElement = {sComponentName = "Image"},
|
||||
goStar = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
|
||||
},
|
||||
imgExpire = {sComponentName = "Image"},
|
||||
txtCount = {sComponentName = "TMP_Text"},
|
||||
imgCoin = {sComponentName = "Image"},
|
||||
txtPrice = {sComponentName = "TMP_Text"},
|
||||
imgMask = {},
|
||||
goRestock = {},
|
||||
txtRestock = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Mall_Package_SoldOut"
|
||||
},
|
||||
goCondition = {},
|
||||
txtCondition = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
ActivityShopGoodsItemCtrl._mapEventConfig = {}
|
||||
function ActivityShopGoodsItemCtrl:Refresh(mapData, nCurrencyItemId)
|
||||
self.mapData = mapData
|
||||
self.mapGoodsCfg = ConfigTable.GetData("ActivityGoods", mapData.nId)
|
||||
if not self.mapGoodsCfg then
|
||||
return
|
||||
end
|
||||
self:RefreshInfo()
|
||||
self:RefreshPrice(nCurrencyItemId)
|
||||
self:RefreshTime()
|
||||
self:RefreshLimit()
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:RefreshInfo()
|
||||
local mapItemCfg = ConfigTable.GetData_Item(self.mapGoodsCfg.ItemId)
|
||||
if not mapItemCfg then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, self.mapGoodsCfg.Name)
|
||||
if mapItemCfg.Type == GameEnum.itemType.Disc then
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapItemCfg.Icon .. AllEnum.OutfitIconSurfix.Item)
|
||||
self._mapNode.imgElement.gameObject:SetActive(true)
|
||||
self._mapNode.goStar.gameObject:SetActive(true)
|
||||
local mapDiscCfgData = ConfigTable.GetData("Disc", self.mapGoodsCfg.ItemId)
|
||||
if mapDiscCfgData then
|
||||
self:SetAtlasSprite(self._mapNode.imgElement, "12_rare", AllEnum.Star_Element[mapDiscCfgData.EET].icon)
|
||||
end
|
||||
local nStar = 6 - mapItemCfg.Rarity
|
||||
self._mapNode.goStar:SetStar(nStar, nStar)
|
||||
else
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapItemCfg.Icon)
|
||||
self._mapNode.imgElement.gameObject:SetActive(false)
|
||||
self._mapNode.goStar.gameObject:SetActive(false)
|
||||
end
|
||||
self._mapNode.imgExpire.gameObject:SetActive(mapItemCfg.ExpireType > 0)
|
||||
local sPath = "db_viewfinder_shop_" .. AllEnum.FrameColor_New[mapItemCfg.Rarity]
|
||||
self:SetActivityAtlasSprite_New(self._mapNode.imgRare, "10107/SpriteAtlas/1010704", sPath)
|
||||
local bLimit = 0 < self.mapData.nMaximumLimit
|
||||
if bLimit then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLeft, orderedFormat(ConfigTable.GetUIText("Shop_Left"), self.mapData.nMaximumLimit - self.mapData.nBoughtCount))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLeft, orderedFormat(ConfigTable.GetUIText("Shop_Left"), ConfigTable.GetUIText("Shop_Unlimited")))
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCount, orderedFormat(ConfigTable.GetUIText("Shop_GoodsItem_Count"), self.mapGoodsCfg.ItemQuantity))
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:RefreshPrice(nCurrencyItemId)
|
||||
self:SetSprite_Coin(self._mapNode.imgCoin, nCurrencyItemId)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPrice, self.mapGoodsCfg.Price)
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:RefreshTime()
|
||||
local bTime = self.mapData.bPurchasTime and self.mapData.nNextRefreshTime > 0
|
||||
self._mapNode.imgTime:SetActive(bTime)
|
||||
if not bTime then
|
||||
return
|
||||
end
|
||||
local sTime = ""
|
||||
local nRemaining = self.mapData.nNextRefreshTime - CS.ClientManager.Instance.serverTimeStamp
|
||||
if nRemaining <= 3600 and 0 < nRemaining then
|
||||
sTime = ConfigTable.GetUIText("Shop_WithinHour")
|
||||
elseif 3600 < nRemaining and nRemaining <= 86400 then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("Shop_Hour"), math.floor(nRemaining / 3600))
|
||||
elseif 86400 < nRemaining then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("Shop_Day"), math.floor(nRemaining / 86400))
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLeftTime, sTime)
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:RefreshLimit()
|
||||
local bMask = not self.mapData.bPurchasable or not self.mapData.bPurchasTime or self.mapData.bSoldOut
|
||||
self._mapNode.imgMask:SetActive(bMask)
|
||||
if self.mapData.bSoldOut then
|
||||
self._mapNode.goRestock:SetActive(true)
|
||||
self._mapNode.goCondition:SetActive(false)
|
||||
return
|
||||
end
|
||||
self._mapNode.goRestock:SetActive(false)
|
||||
self._mapNode.goCondition:SetActive(true)
|
||||
if self.mapData.nUnlockPurchaseTime > 0 and self.mapData.nUnlockPurchaseTime == self.mapData.nNextRefreshTime then
|
||||
local sTime = ""
|
||||
local nRemaining = self.mapData.nNextRefreshTime - CS.ClientManager.Instance.serverTimeStamp
|
||||
if nRemaining <= 3600 and 0 < nRemaining then
|
||||
sTime = ConfigTable.GetUIText("Shop_WithinHourUnLock")
|
||||
elseif 3600 < nRemaining and nRemaining <= 86400 then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("Shop_HourUnLock"), math.floor(nRemaining / 3600))
|
||||
elseif 86400 < nRemaining then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("Shop_DayUnLock"), math.floor(nRemaining / 86400))
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCondition, sTime)
|
||||
return
|
||||
end
|
||||
if not self.mapData.bPurchasable then
|
||||
local sCond = ""
|
||||
if self.mapData.nPurchaseCondType == GameEnum.shopCond.WorldClassSpecific then
|
||||
sCond = orderedFormat(ConfigTable.GetUIText("Shop_Cond_WorldClass"), self.mapData.tbPurchaseCondParams[1])
|
||||
elseif self.mapData.nPurchaseCondType == GameEnum.shopCond.ShopPreGoodsSellOut or self.mapData.nPurchaseCondType == GameEnum.shopCond.ActivityShopPreGoodsSellOut then
|
||||
sCond = ConfigTable.GetUIText("Shop_Cond_PreGoodsSellOut")
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCondition, sCond)
|
||||
return
|
||||
end
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:Awake()
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:OnEnable()
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:OnDisable()
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:OnDestroy()
|
||||
end
|
||||
return ActivityShopGoodsItemCtrl
|
||||
@@ -0,0 +1,24 @@
|
||||
local ActivityShopPanel = class("ActivityShopPanel", BasePanel)
|
||||
ActivityShopPanel._sUIResRootPath = "UI_Activity/"
|
||||
ActivityShopPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10107/Shop/ActivityShopPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.ShopCommon.ActivityShopCtrl"
|
||||
}
|
||||
}
|
||||
function ActivityShopPanel:Awake()
|
||||
self.nDefaultId = nil
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.nActId = tbParam[1]
|
||||
self.nDefaultId = tbParam[2]
|
||||
end
|
||||
self.actShopData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
end
|
||||
function ActivityShopPanel:OnEnable()
|
||||
end
|
||||
function ActivityShopPanel:OnDisable()
|
||||
end
|
||||
function ActivityShopPanel:OnDestroy()
|
||||
end
|
||||
return ActivityShopPanel
|
||||
@@ -0,0 +1,385 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ViewfinderStoryCtrl = class("ViewfinderStoryCtrl", BaseCtrl)
|
||||
local ActivityAvgData = PlayerData.ActivityAvg
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
ViewfinderStoryCtrl._mapNodeConfig = {
|
||||
svStory = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
ctlAvgRoot = {
|
||||
sNodeName = "goAvgInfoRoot",
|
||||
sCtrlName = "Game.UI.ActivityTheme.ActivityAvgInfoExCtrl"
|
||||
},
|
||||
t_fullscreen_blur_black = {},
|
||||
btnsnapshot = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtn_ClickCloseLevelInfoPanel"
|
||||
},
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
goChapterComplete = {},
|
||||
snapshot_complete = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickCloseCompete"
|
||||
},
|
||||
ctlgoEnemyInfo = {
|
||||
sNodeName = "goEnemyInfo",
|
||||
sCtrlName = "Game.UI.MainlineEx.MainlineMonsterInfoCtrl"
|
||||
}
|
||||
}
|
||||
ViewfinderStoryCtrl._mapEventConfig = {
|
||||
Story_Done = "OnEvent_Story_Done",
|
||||
SelectMainlineBattle = "OnEvent_SelectMainlineBattle",
|
||||
Story_RewardClosed = "OnEvent_Activity_Story_RewardClosed",
|
||||
StoryDialog_DialogEnd = "OnEvent_StoryDialog_DialogEnd"
|
||||
}
|
||||
local UnlockConditionPriority = {
|
||||
[1] = "MustStoryIds",
|
||||
[2] = "OneofStoryIds",
|
||||
[3] = "MustEvIds",
|
||||
[4] = "OneofEvIds",
|
||||
[5] = "WorldLevel",
|
||||
[6] = "MustAchievementIds",
|
||||
[7] = "MustActivityLevel"
|
||||
}
|
||||
local BRANCH_GRID_INDEX = 0
|
||||
local BRANCH_COUNT = 0
|
||||
function ViewfinderStoryCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.storyNodePos = {-187.2, -270.5}
|
||||
self.tbGridTimer = {}
|
||||
self.tbPlayedAnim = {}
|
||||
self.nScrollTime = 0.5
|
||||
self.bInit = false
|
||||
end
|
||||
function ViewfinderStoryCtrl:OnEnable()
|
||||
self:RefreshPanel()
|
||||
end
|
||||
function ViewfinderStoryCtrl:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
function ViewfinderStoryCtrl:OnDisable()
|
||||
end
|
||||
function ViewfinderStoryCtrl:RefreshPanel()
|
||||
self:RefreshStoryList()
|
||||
end
|
||||
function ViewfinderStoryCtrl:RefreshStoryList()
|
||||
self.tbPlayedAnim = {}
|
||||
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
|
||||
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
|
||||
return
|
||||
end
|
||||
local recentStoryId = ActivityAvgData:GetRecentStoryId(self.nChapterId)
|
||||
local recentIndex = 1
|
||||
for i = 1, #self.tbAllStory do
|
||||
if self.tbAllStory[i] == recentStoryId then
|
||||
recentIndex = i
|
||||
break
|
||||
end
|
||||
end
|
||||
local scrollIndex = recentIndex
|
||||
if 0 < BRANCH_COUNT then
|
||||
local branchEnd = BRANCH_GRID_INDEX + BRANCH_COUNT - 1
|
||||
if recentIndex >= BRANCH_GRID_INDEX and recentIndex <= branchEnd then
|
||||
scrollIndex = BRANCH_GRID_INDEX
|
||||
elseif recentIndex > branchEnd then
|
||||
scrollIndex = recentIndex - (BRANCH_COUNT - 1)
|
||||
end
|
||||
end
|
||||
self.curIndex = recentIndex
|
||||
self._mapNode.svStory:SetAnim(0.07)
|
||||
local branchCount = 0 < BRANCH_COUNT and BRANCH_COUNT - 1 or 0
|
||||
self._mapNode.svStory:Init(#self.tbAllStory - branchCount, self, self.OnRefreshGrid)
|
||||
local time = self.bInit and 0 or self.nScrollTime
|
||||
self:AddTimer(1, 0.1, function()
|
||||
self._mapNode.svStory:SetScrollGridPos(scrollIndex, time, 0)
|
||||
self.bInit = true
|
||||
end, true, true, true)
|
||||
end
|
||||
function ViewfinderStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchIndex)
|
||||
local storyId = self.tbAllStory[gridIndex]
|
||||
local avgcfg = ConfigTable.GetData("ActivityStory", storyId)
|
||||
local goInstanceID = grid:GetInstanceID()
|
||||
local btnGrid = grid.transform:Find("btnGrid"):GetComponent("UIButton")
|
||||
local RootNode = grid.transform:Find("btnGrid/AnimRoot/RootNode")
|
||||
local imgStory = bBranch and RootNode:Find("imgStory/imgBg2"):GetComponent("Image") or RootNode:Find("imgStory"):GetComponent("Image")
|
||||
local goNotOpen = RootNode:Find("goNotOpen").gameObject
|
||||
local txtLevel = btnGrid.transform:Find("AnimRoot/txtLevel"):GetComponent("TMP_Text")
|
||||
local txtLevelLock = bBranch and grid.transform:Find("btnGridText/scale_on_click/goLockState/txtLevelLock"):GetComponent("TMP_Text") or goNotOpen.transform:Find("txtLevelLock"):GetComponent("TMP_Text")
|
||||
local imgStoryTitleBg = RootNode:Find("imgStoryTitleBg")
|
||||
local imgBattleTitleBg = RootNode:Find("imgBattleTitleBg")
|
||||
local RedDot = RootNode:Find("RedDot").gameObject
|
||||
local goLock = RootNode:Find("goLockState").gameObject
|
||||
local goComplete = RootNode:Find("goComplete").gameObject
|
||||
local goImgTime = RootNode.transform:Find("imgTime")
|
||||
local txtTime = goImgTime:Find("txtTime"):GetComponent("TMP_Text")
|
||||
local txtTitle = RootNode:Find("tmpGroupDone"):GetComponent("TMP_Text")
|
||||
local txtComplete = goComplete.transform:Find("imgBg/txtComplete"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtComplete, ConfigTable.GetUIText("RoguelikeBuild_Manage_FilterPass"))
|
||||
local isUnlock, tbResult = ActivityAvgData:IsUnlock(avgcfg.ConditionId)
|
||||
local isReaded = ActivityAvgData:IsStoryReaded(storyId)
|
||||
local bOpen, nOpenTime = ActivityAvgData:IsOpen(avgcfg.StoryId)
|
||||
local nIndex = 0
|
||||
if isUnlock then
|
||||
nIndex = bBranch and BRANCH_GRID_INDEX or gridIndex
|
||||
if nIndex > BRANCH_GRID_INDEX then
|
||||
nIndex = nIndex - (BRANCH_COUNT - 1)
|
||||
end
|
||||
end
|
||||
local branchSuffix = bBranch and string.char(string.byte("a") + nBranchIndex - 1) or ""
|
||||
local bShowImgStory = not bBranch or not not isUnlock
|
||||
imgStory.gameObject:SetActive(bShowImgStory)
|
||||
if bShowImgStory then
|
||||
if bOpen and isUnlock then
|
||||
self:SetPngSprite(imgStory, avgcfg.Icon .. branchSuffix)
|
||||
else
|
||||
self:SetPngSprite(imgStory, string.format("Icon/ActivityStory/ep_event07_00"))
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(txtTitle, avgcfg.Title)
|
||||
NovaAPI.SetTMPText(txtLevel, avgcfg.Index)
|
||||
txtLevel.gameObject:SetActive(not bBranch or not not isUnlock)
|
||||
NovaAPI.SetTMPText(txtLevelLock, bBranch and ConfigTable.GetUIText("Story_Unkown_Chapter") or avgcfg.Index)
|
||||
txtTitle.gameObject:SetActive(isUnlock and bOpen)
|
||||
goImgTime.gameObject:SetActive(not bOpen)
|
||||
goComplete.gameObject:SetActive(isUnlock and isReaded and bOpen)
|
||||
goLock.gameObject:SetActive(not isUnlock and bOpen)
|
||||
goNotOpen.gameObject:SetActive(not bOpen or bBranch and not isUnlock)
|
||||
imgBattleTitleBg.gameObject:SetActive(avgcfg.IsBattle and isUnlock and bOpen)
|
||||
imgStoryTitleBg.gameObject:SetActive(not avgcfg.IsBattle and isUnlock and bOpen)
|
||||
if avgcfg.IsBattle == true then
|
||||
local txtPlot = imgBattleTitleBg:Find("txtPlot"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtPlot, ConfigTable.GetUIText("SelectTeam_StartBattle"))
|
||||
else
|
||||
local txtPlot = imgStoryTitleBg:Find("txtPlot"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtPlot, ConfigTable.GetUIText("TowerDef_Story"))
|
||||
end
|
||||
if not bOpen then
|
||||
local strTime = self:GetRemainTimeStr(nOpenTime, avgcfg.DayOpen)
|
||||
if self.tbGridTimer[goInstanceID] ~= nil then
|
||||
self.tbGridTimer[goInstanceID]:Cancel()
|
||||
self.tbGridTimer[goInstanceID] = nil
|
||||
end
|
||||
self.tbGridTimer[goInstanceID] = self:AddTimer(0, 1, function()
|
||||
local strTime, bLock = self:GetRemainTimeStr(nOpenTime, avgcfg.DayOpen)
|
||||
if bLock then
|
||||
NovaAPI.SetTMPText(txtTime, strTime)
|
||||
else
|
||||
self:RefreshStoryList()
|
||||
end
|
||||
end, true, true, true)
|
||||
NovaAPI.SetTMPText(txtTime, strTime)
|
||||
end
|
||||
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
|
||||
nActGroupId,
|
||||
self.nActId,
|
||||
avgcfg.Id
|
||||
}, RedDot, nil, nil, true)
|
||||
local clickFuc = function()
|
||||
if not bOpen or self.bCantClick then
|
||||
return
|
||||
end
|
||||
if isUnlock then
|
||||
local bNew = not isReaded
|
||||
self.avgId = avgcfg.StoryId
|
||||
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
|
||||
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
|
||||
self.curIndex = gridIndex
|
||||
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
|
||||
PlayerData.ActivityAvg:RefreshAvgRedDot()
|
||||
elseif tbResult ~= nil then
|
||||
local lockTxt = ""
|
||||
for i = 1, #tbResult do
|
||||
local value = tbResult[i]
|
||||
if value[1] == false then
|
||||
if UnlockConditionPriority[i] == "MustStoryIds" then
|
||||
do
|
||||
local tbStoryIds = value[2]
|
||||
for k, v in pairs(tbStoryIds) do
|
||||
if v == false then
|
||||
local storyData = ConfigTable.GetData("ActivityStory", k)
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "OneofStoryIds" then
|
||||
do
|
||||
local tbStoryIds = value[2]
|
||||
for k, v in pairs(tbStoryIds) do
|
||||
if v == false then
|
||||
local storyData = ConfigTable.GetData("ActivityStory", k)
|
||||
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if lockTxt == "" then
|
||||
for k, v in pairs(tbStoryIds) do
|
||||
local storyData = ConfigTable.GetData("ActivityStory", k)
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "MustEvIds" then
|
||||
lockTxt = ConfigTable.GetUIText("Story_UnlockClueCondition")
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "OneofEvIds" then
|
||||
lockTxt = ConfigTable.GetUIText("Story_UnlockClueCondition")
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "WorldLevel" then
|
||||
do
|
||||
local level = value[2]
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockWorldLv") or "", level)
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "MustAchievementIds" then
|
||||
if self.bHasAchievementData == true then
|
||||
local tbAchievementList = value[2]
|
||||
for k, v in pairs(tbAchievementList) do
|
||||
if v == false then
|
||||
local achievementId = k
|
||||
local achievement = ConfigTable.GetData("Achievement", achievementId)
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockAchievement") or "", achievement.Title) .. "\n" .. "(" .. achievement.Desc .. ")"
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "MustActivityLevel" then
|
||||
local levelId = value[2]
|
||||
if 0 < levelId then
|
||||
local levelData = ConfigTable.GetData("ActivityLevelsLevel", levelId)
|
||||
if levelData then
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("ActivityStory_UnlockActivityLevel"), levelData.Name)
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = lockTxt
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
end
|
||||
btnGrid.onClick:RemoveAllListeners()
|
||||
btnGrid.onClick:AddListener(clickFuc)
|
||||
end
|
||||
function ViewfinderStoryCtrl:OnRefreshGrid(grid, index)
|
||||
local gridIndex = index + 1
|
||||
local rectTransform = grid.transform:GetComponent("RectTransform")
|
||||
local pos = rectTransform.anchoredPosition
|
||||
pos.y = gridIndex % 2 == 0 and pos.y + self.storyNodePos[1] or pos.y + self.storyNodePos[2]
|
||||
rectTransform.anchoredPosition = pos
|
||||
local normalRoot = grid.transform:Find("Normal")
|
||||
local branchRoot = grid.transform:Find("Branch")
|
||||
if 0 < BRANCH_GRID_INDEX and gridIndex == BRANCH_GRID_INDEX then
|
||||
for i = 1, BRANCH_COUNT do
|
||||
local branchGrid = branchRoot:Find("tog" .. i)
|
||||
self:RefreshGridInfo(branchGrid.gameObject, gridIndex + i - 1, true, i)
|
||||
end
|
||||
normalRoot.gameObject:SetActive(false)
|
||||
branchRoot.gameObject:SetActive(true)
|
||||
if not self.tbPlayedAnim[gridIndex] then
|
||||
self.tbPlayedAnim[gridIndex] = true
|
||||
local anim = branchRoot:GetComponent("Animator")
|
||||
if anim then
|
||||
anim:Play("ViewfinderStoryPanel_Story_in_02")
|
||||
end
|
||||
end
|
||||
else
|
||||
if 0 < BRANCH_COUNT and gridIndex > BRANCH_GRID_INDEX then
|
||||
gridIndex = gridIndex + (BRANCH_COUNT - 1)
|
||||
end
|
||||
self:RefreshGridInfo(normalRoot.gameObject, gridIndex)
|
||||
normalRoot.gameObject:SetActive(true)
|
||||
branchRoot.gameObject:SetActive(false)
|
||||
if not self.tbPlayedAnim[gridIndex] then
|
||||
self.tbPlayedAnim[gridIndex] = true
|
||||
local animRoot = grid.transform:Find("Normal/btnGrid/AnimRoot")
|
||||
local anim = animRoot and animRoot:GetComponent("Animator")
|
||||
if anim then
|
||||
anim:Play("ViewfinderStoryPanel_Story_in_01")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ViewfinderStoryCtrl:GetRemainTimeStr(nOpenTime, openDay)
|
||||
local timeStr = ""
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local openTime = CS.ClientManager.Instance:GetNextRefreshTime(nOpenTime) - 86400
|
||||
local nRemainTime = openTime + openDay * 86400 - curTime
|
||||
local day = math.floor(nRemainTime / 86400)
|
||||
local hour = math.floor(nRemainTime / 3600)
|
||||
local min = math.floor((nRemainTime - hour * 3600) / 60)
|
||||
local sec = nRemainTime - hour * 3600 - min * 60
|
||||
if 0 < day then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Day_Color_Common"), "08d3d4", day)
|
||||
elseif 0 < hour then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour_Color_Common"), "08d3d4", hour)
|
||||
elseif 0 < min then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color_Common"), "08d3d4", min)
|
||||
elseif 0 < sec then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color_Common"), "08d3d4", sec)
|
||||
end
|
||||
return timeStr, 0 < nRemainTime
|
||||
end
|
||||
function ViewfinderStoryCtrl:OnBtn_ClickBack()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ViewfinderStory)
|
||||
end
|
||||
function ViewfinderStoryCtrl:OnBtn_ClickHome()
|
||||
PanelManager.Home()
|
||||
end
|
||||
function ViewfinderStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
|
||||
self._mapNode.t_fullscreen_blur_black:SetActive(false)
|
||||
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
|
||||
self._mapNode.goChapterComplete:SetActive(false)
|
||||
end
|
||||
function ViewfinderStoryCtrl:OnEvent_StoryDialog_DialogEnd()
|
||||
WwiseAudioMgr:SetState("menuTransition", "open")
|
||||
end
|
||||
function ViewfinderStoryCtrl:OnEvent_Story_Done(bHasReward)
|
||||
self:RefreshPanel()
|
||||
if bHasReward then
|
||||
self.bCantClick = true
|
||||
end
|
||||
end
|
||||
function ViewfinderStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
|
||||
local OpenPanel = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
|
||||
end
|
||||
if bConfirm then
|
||||
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
|
||||
end
|
||||
end
|
||||
function ViewfinderStoryCtrl:OnEvent_Activity_Story_RewardClosed()
|
||||
self.bCantClick = false
|
||||
if self.curIndex == #self.tbAllStory then
|
||||
self._mapNode.goChapterComplete:SetActive(true)
|
||||
end
|
||||
end
|
||||
function ViewfinderStoryCtrl:OnBtn_ClickCloseCompete()
|
||||
self._mapNode.goChapterComplete:SetActive(false)
|
||||
end
|
||||
return ViewfinderStoryCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local ViewfinderStoryPanel = class("ViewfinderStoryPanel", BasePanel)
|
||||
ViewfinderStoryPanel._sUIResRootPath = "UI_Activity/"
|
||||
ViewfinderStoryPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10107/Story/ViewfinderStoryPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10107.Story.ViewfinderStoryCtrl"
|
||||
}
|
||||
}
|
||||
function ViewfinderStoryPanel:Awake()
|
||||
end
|
||||
function ViewfinderStoryPanel:OnEnable()
|
||||
end
|
||||
function ViewfinderStoryPanel:OnDisable()
|
||||
end
|
||||
function ViewfinderStoryPanel:OnDestroy()
|
||||
end
|
||||
function ViewfinderStoryPanel:OnRelease()
|
||||
end
|
||||
return ViewfinderStoryPanel
|
||||
@@ -0,0 +1,16 @@
|
||||
local ViewfinderTaskPanel = class("ViewfinderTaskPanel", BasePanel)
|
||||
ViewfinderTaskPanel._sUIResRootPath = "UI_Activity/"
|
||||
ViewfinderTaskPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10107/Task.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.TaskCommon.TaskCommonCtrl_01"
|
||||
}
|
||||
}
|
||||
local tbImgDbType = {SizeDelta = 1, FillAmount = 2}
|
||||
function ViewfinderTaskPanel:Awake()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" and tbParam[3] == nil then
|
||||
tbParam[3] = tbImgDbType.FillAmount
|
||||
end
|
||||
end
|
||||
return ViewfinderTaskPanel
|
||||
@@ -0,0 +1,613 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local ViewfinderThemeCtrl = class("ViewfinderThemeCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
ViewfinderThemeCtrl._mapNodeConfig = {
|
||||
btnEntrance_ = {
|
||||
nCount = 5,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickActivityEntrance"
|
||||
},
|
||||
imgRemaineTime = {},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtActivityDate = {sComponentName = "TMP_Text"},
|
||||
imgEnd = {},
|
||||
txtActivityEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgMiniGame = {sComponentName = "Image"},
|
||||
txtMiniGame = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_MiniGame_ThrowGifts"
|
||||
},
|
||||
imgMiniGameEnd = {},
|
||||
txtMiniGameEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_MiniGame_ThrowGifts"
|
||||
},
|
||||
txtMiniGame_End = {},
|
||||
txtTask = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Task"
|
||||
},
|
||||
txtTaskProgress = {sComponentName = "TMP_Text"},
|
||||
imgTaskActivityTime = {},
|
||||
txtTaskActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgStory = {sComponentName = "Image"},
|
||||
txtStory = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Story"
|
||||
},
|
||||
txtStory_End = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Story"
|
||||
},
|
||||
goStoryEnd = {},
|
||||
txtStoryEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtMiniGameEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtTaskEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtShopEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtShop = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Shop"
|
||||
},
|
||||
imgShopActivityTime = {},
|
||||
txtShopActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtLevel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Level"
|
||||
},
|
||||
txtLevel_End = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Level"
|
||||
},
|
||||
goLevelEnd = {},
|
||||
txtLevelEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgLevelActivityUnlockTime = {},
|
||||
txtLevelActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgLevelEnd = {},
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
imgMiniGameActivityUnlockTime = {},
|
||||
txtMiniGameActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgTaskBgEnd = {},
|
||||
txtTaskEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Task"
|
||||
},
|
||||
txtTaskProgress_End = {},
|
||||
imgTaskActivityUnlockTime = {},
|
||||
txtTaskActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgStoryActivityTime = {},
|
||||
txtStoryActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgStoryActivityUnlockTime = {},
|
||||
txtStoryActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgShopActivityUnlockTime = {},
|
||||
txtShopActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgLevelActivityTime = {},
|
||||
txtLevelActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgMiniGameActivityTime = {},
|
||||
txtMiniGameActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtShopEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Shop"
|
||||
},
|
||||
imgShopEnd = {},
|
||||
txtShop_End = {},
|
||||
txtTaskProgressEnd = {sComponentName = "TMP_Text"},
|
||||
dbTaskEnd = {},
|
||||
miniGameRedDot = {},
|
||||
redDotEntrance2 = {},
|
||||
storyRedDot = {},
|
||||
reddotLevel = {},
|
||||
goMiniGameEnd = {},
|
||||
imgStoryEnd = {}
|
||||
}
|
||||
ViewfinderThemeCtrl._mapEventConfig = {}
|
||||
local ActivityState = {
|
||||
NotOpen = 1,
|
||||
Open = 2,
|
||||
Closed = 3
|
||||
}
|
||||
function ViewfinderThemeCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.ViewfinderData = PlayerData.Activity:GetActivityGroupDataById(self.nActId)
|
||||
if self.ViewfinderData ~= nil then
|
||||
self.ActivityGroupCfg = self.ViewfinderData.actGroupConfig
|
||||
end
|
||||
for k, v in pairs(self._mapNode.btnEntrance_) do
|
||||
v.interactable = false
|
||||
end
|
||||
end
|
||||
function ViewfinderThemeCtrl:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
local sAnimName = "ViewfinderPanel_in"
|
||||
local sSoundName = "Mode_HuoChu_activity"
|
||||
if self.animRoot ~= nil then
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
sAnimName = "ViewfinderPanel_in1"
|
||||
sSoundName = "Mode_HuoChu_activity_01"
|
||||
end
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
self.animRoot:Play(sAnimName, 0, 0)
|
||||
CS.WwiseAudioManager.Instance:PlaySound(sSoundName)
|
||||
local nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {sAnimName})
|
||||
self:AddTimer(1, nAnimLength, function()
|
||||
for k, v in pairs(self._mapNode.btnEntrance_) do
|
||||
v.interactable = true
|
||||
end
|
||||
end, true, true, true)
|
||||
end
|
||||
function ViewfinderThemeCtrl:OnEnable()
|
||||
self:RefreshPanel()
|
||||
for i = 1, 5 do
|
||||
local actData = self.ViewfinderData:GetActivityDataByIndex(i)
|
||||
local nActId = actData ~= nil and actData.ActivityId or 0
|
||||
local state = self.tbActState[nActId]
|
||||
if nActId ~= nil and 0 < nActId and state ~= nil then
|
||||
if i == AllEnum.ActivityThemeFuncIndex.Task then
|
||||
if state == ActivityState.Closed then
|
||||
self._mapNode.redDotEntrance2:SetActive(false)
|
||||
else
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.redDotEntrance2)
|
||||
end
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Level then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.reddotLevel)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.storyRedDot)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.MiniGame then
|
||||
local bOld = LocalData.GetPlayerLocalData("Activity_MiniGame_10107_New") or state ~= ActivityState.Open
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_GroupNew_MiniGame, {
|
||||
self.nActId
|
||||
}, not bOld)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_MiniGame, {
|
||||
self.nActId
|
||||
}, self._mapNode.miniGameRedDot)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ViewfinderThemeCtrl:OnDisable()
|
||||
if nil ~= self.minigameRemainTimer then
|
||||
TimerManager.Remove(self.minigameRemainTimer)
|
||||
self.minigameRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.remainTimer then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
end
|
||||
if nil ~= self.shopRemainTimer then
|
||||
TimerManager.Remove(self.shopRemainTimer)
|
||||
self.shopRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.levelRemainTimer then
|
||||
TimerManager.Remove(self.levelRemainTimer)
|
||||
self.levelRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.avgRemainTimer then
|
||||
TimerManager.Remove(self.avgRemainTimer)
|
||||
self.avgRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.taskRemainTimer then
|
||||
TimerManager.Remove(self.taskRemainTimer)
|
||||
self.taskRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.eatingAnimationTimer then
|
||||
TimerManager.Remove(self.eatingAnimationTimer)
|
||||
self.eatingAnimationTimer = nil
|
||||
end
|
||||
end
|
||||
function ViewfinderThemeCtrl:RefreshPanel()
|
||||
if self.ViewfinderData == nil or self.ActivityGroupCfg == nil then
|
||||
return
|
||||
end
|
||||
self:RefreshTime()
|
||||
self:RefreshButtonState()
|
||||
end
|
||||
function ViewfinderThemeCtrl:RefreshTime()
|
||||
local bOpen = self.ViewfinderData:CheckActivityGroupOpen()
|
||||
if bOpen then
|
||||
self:RefreshRemainTime(self.ViewfinderData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(self.ViewfinderData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
end
|
||||
self._mapNode.imgRemaineTime:SetActive(bOpen)
|
||||
self._mapNode.imgEnd:SetActive(not bOpen)
|
||||
local nOpenMonth, nOpenDay, nEndMonth, nEndDay, nOpenYear, nEndYear = self.ViewfinderData:GetActGroupDate()
|
||||
local strOpenDay = string.format("%d", nOpenDay)
|
||||
local strEndDay = string.format("%d", nEndDay)
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityDate, dateStr)
|
||||
end
|
||||
function ViewfinderThemeCtrl:RefreshRemainTime(endTime, txtComp)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(txtComp, sTimeStr)
|
||||
return remainTime
|
||||
end
|
||||
function ViewfinderThemeCtrl:RefreshRemainOpenTime(openTime)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time_Min") or "", min)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time") or "", hour)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time_Day") or "", day)
|
||||
end
|
||||
return sTimeStr
|
||||
end
|
||||
function ViewfinderThemeCtrl:RefreshButtonState()
|
||||
self.tbActState = {}
|
||||
for i = 1, 5 do
|
||||
local actData = self.ViewfinderData:GetActivityDataByIndex(i)
|
||||
if i == AllEnum.ActivityThemeFuncIndex.MiniGame then
|
||||
self:RefreshMiniGameButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Task then
|
||||
self:RefreshTaskButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Level then
|
||||
self:RefreshLevelButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Shop then
|
||||
self:RefreshShopButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
self:RefreshStoryButtonState(actData)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ViewfinderThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans, refreshFunc)
|
||||
local countDowmTimer
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
local state = ActivityState.NotOpen
|
||||
local bShowCountDown = false
|
||||
if activityData ~= nil then
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
if activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
elseif curTime >= openTime and curTime <= endTime then
|
||||
state = ActivityState.Open
|
||||
else
|
||||
state = ActivityState.Closed
|
||||
end
|
||||
elseif activityData.EndType == GameEnum.activityEndType.NoLimit then
|
||||
state = ActivityState.Open
|
||||
if activityData.StartTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
end
|
||||
end
|
||||
end
|
||||
if state == ActivityState.NotOpen then
|
||||
if nil == timer and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local fcTimer = function()
|
||||
curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
if 0 < remainTime then
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
local txtUnlock = imgTrans:GetComponentInChildren(typeof(CS.TMPro.TMP_Text))
|
||||
if txtUnlock ~= nil then
|
||||
NovaAPI.SetTMPText(txtUnlock, sTimeStr)
|
||||
end
|
||||
else
|
||||
imgTrans:SetActive(false)
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
refreshFunc(actData)
|
||||
self:RefreshActivityData()
|
||||
end
|
||||
end
|
||||
fcTimer()
|
||||
countDowmTimer = self:AddTimer(0, 1, fcTimer, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Open and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
do
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
if endTime > self.ViewfinderData:GetActGroupEndTime() then
|
||||
bShowCountDown = true
|
||||
elseif endTime < self.ViewfinderData:GetActGroupEndTime() then
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
if timer == nil and bShowCountDown then
|
||||
self:RefreshRemainTime(endTime, txtTrans)
|
||||
do
|
||||
local fcTimer = function()
|
||||
local remainTime = self:RefreshRemainTime(endTime, txtTrans)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
refreshFunc(actData)
|
||||
end
|
||||
end
|
||||
fcTimer()
|
||||
countDowmTimer = self:AddTimer(0, 1, fcTimer, true, true, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return state, bShowCountDown, countDowmTimer
|
||||
end
|
||||
function ViewfinderThemeCtrl:RefreshMiniGameButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
self:RefreshMiniGameButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.minigameRemainTimer, self._mapNode.txtMiniGameActivityTime, self._mapNode.imgMiniGameActivityUnlockTime, refreshFunc)
|
||||
if self.minigameRemainTimer == nil then
|
||||
self.minigameRemainTimer = countDowmTimer
|
||||
end
|
||||
self._mapNode.imgMiniGameActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.imgMiniGameActivityTime.gameObject:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgMiniGameEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtMiniGame_End:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtMiniGameEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.goMiniGameEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
if state ~= ActivityState.Open then
|
||||
end
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function ViewfinderThemeCtrl:RefreshTaskButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local actInsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
if actInsData ~= nil then
|
||||
actInsData:RefreshTaskRedDot()
|
||||
end
|
||||
self:RefreshTaskButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.taskRemainTimer, self._mapNode.txtTaskActivityTime, self._mapNode.imgTaskActivityUnlockTime, refreshFunc)
|
||||
if self.taskRemainTimer == nil then
|
||||
self.taskRemainTimer = countDowmTimer
|
||||
end
|
||||
if state == ActivityState.Closed and actInsData ~= nil then
|
||||
actInsData:RefreshTaskRedDot()
|
||||
end
|
||||
self._mapNode.imgTaskActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.txtTaskProgress_End:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.dbTaskEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskBgEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtTaskEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self.tbActState[activityId] = state
|
||||
local ActivityTaskData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local nDone, nTotal = 0, 0
|
||||
if ActivityTaskData ~= nil then
|
||||
nDone, nTotal = ActivityTaskData:CalcTotalProgress()
|
||||
end
|
||||
local progress = string.format("%d/%d", nDone, nTotal)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskProgress, progress)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskProgressEnd, progress)
|
||||
end
|
||||
end
|
||||
function ViewfinderThemeCtrl:RefreshStoryButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
local avgData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if nil ~= avgData then
|
||||
avgData:RefreshAvgRedDot()
|
||||
end
|
||||
self:RefreshStoryButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.avgRemainTimer, self._mapNode.txtStoryActivityTime, self._mapNode.imgStoryActivityUnlockTime, refreshFunc)
|
||||
if self.avgRemainTimer == nil then
|
||||
self.avgRemainTimer = countDowmTimer
|
||||
end
|
||||
if state == ActivityState.Closed then
|
||||
local avgData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if nil ~= avgData then
|
||||
avgData:RefreshAvgRedDot()
|
||||
end
|
||||
end
|
||||
self._mapNode.imgStoryActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgStoryActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.goStoryEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgStoryEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtStory_End.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function ViewfinderThemeCtrl:RefreshLevelButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
local activityLevelsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if nil ~= activityLevelsData then
|
||||
activityLevelsData:ChangeAllRedHot()
|
||||
end
|
||||
self:RefreshLevelButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.levelRemainTimer, self._mapNode.txtLevelActivityTime, self._mapNode.imgLevelActivityUnlockTime, refreshFunc)
|
||||
if self.levelRemainTimer == nil then
|
||||
self.levelRemainTimer = countDowmTimer
|
||||
end
|
||||
if state == ActivityState.Closed then
|
||||
local activityLevelsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if nil ~= activityLevelsData then
|
||||
activityLevelsData:ChangeAllRedHot()
|
||||
end
|
||||
end
|
||||
self._mapNode.imgLevelActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgLevelActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.imgLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.goLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtLevel_End.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function ViewfinderThemeCtrl:RefreshShopButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
self:RefreshShopButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.shopRemainTimer, self._mapNode.txtShopActivityTime, self._mapNode.imgShopActivityUnlockTime, refreshFunc)
|
||||
if self.shopRemainTimer == nil then
|
||||
self.shopRemainTimer = countDowmTimer
|
||||
end
|
||||
self._mapNode.imgShopActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgShopActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.txtShopEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgShopEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtShop_End:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function ViewfinderThemeCtrl:RequireActiviyData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
local callFunc = function()
|
||||
self.bRequireSucc = true
|
||||
self:RefreshPanel()
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_detail_req, {}, nil, callFunc)
|
||||
self.bRequiredActData = true
|
||||
self:AddTimer(1, 1, function()
|
||||
self.bRequiredActData = false
|
||||
end, true, true, true)
|
||||
end
|
||||
function ViewfinderThemeCtrl:RefreshActivityData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
self:AddTimer(1, 3, self.RequireActiviyData, true, true, true)
|
||||
end
|
||||
function ViewfinderThemeCtrl:OnBtn_ClickActivityEntrance(btn, nIndex)
|
||||
local actData = self.ViewfinderData:GetActivityDataByIndex(nIndex)
|
||||
local state = self.tbActState[actData.ActivityId]
|
||||
if nil == state then
|
||||
return
|
||||
end
|
||||
if state == ActivityState.Closed then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
|
||||
return
|
||||
elseif state == ActivityState.NotOpen then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
return
|
||||
elseif state == ActivityState.Open then
|
||||
local activityData = PlayerData.Activity:GetActivityDataById(actData.ActivityId)
|
||||
if activityData == nil then
|
||||
local bHint = true
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
bHint = not PlayerData.ActivityAvg:HasActivityData(actData.ActivityId)
|
||||
end
|
||||
if self.bRequiredActData and bHint then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Data_Refreshing"))
|
||||
return
|
||||
end
|
||||
if bHint then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
self:RequireActiviyData()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
if actData.PanelId ~= nil and ActivityState.Open == state then
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.MiniGame then
|
||||
LocalData.SetPlayerLocalData("Activity_MiniGame_10107_New", true)
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_GroupNew_MiniGame, {
|
||||
actData.ActivityId
|
||||
}, false)
|
||||
local func = function()
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId, self.nActId)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, 45, func)
|
||||
elseif self.ActivityGroupCfg.TransitionId ~= nil and self.ActivityGroupCfg.TransitionId > 0 then
|
||||
EventManager.Hit(EventId.SetTransition, self.ActivityGroupCfg.TransitionId, function()
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
|
||||
end)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
|
||||
end
|
||||
end
|
||||
end
|
||||
return ViewfinderThemeCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local ViewfinderThemePanel = class("ViewfinderThemePanel", BasePanel)
|
||||
ViewfinderThemePanel._sUIResRootPath = "UI_Activity/"
|
||||
ViewfinderThemePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10107/ViewfinderPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10107.ViewfinderThemeCtrl"
|
||||
}
|
||||
}
|
||||
function ViewfinderThemePanel:Awake()
|
||||
end
|
||||
function ViewfinderThemePanel:OnEnable()
|
||||
end
|
||||
function ViewfinderThemePanel:OnDisable()
|
||||
end
|
||||
function ViewfinderThemePanel:OnDestroy()
|
||||
end
|
||||
function ViewfinderThemePanel:OnRelease()
|
||||
end
|
||||
return ViewfinderThemePanel
|
||||
@@ -0,0 +1,136 @@
|
||||
local ActivityLevelsLvCtrl = class("ActivityLevelsLvCtrl", BaseCtrl)
|
||||
local lvIndexTitle = "{0}-{1}"
|
||||
ActivityLevelsLvCtrl._mapNodeConfig = {
|
||||
tog = {sComponentName = "UIButton"},
|
||||
Select = {},
|
||||
SelectAni = {sNodeName = "Select", sComponentName = "Animator"},
|
||||
unSelect = {},
|
||||
txt_Select = {sComponentName = "TMP_Text"},
|
||||
txt_unSelect = {sComponentName = "TMP_Text"},
|
||||
rt_Targets = {},
|
||||
btnTarget = {sComponentName = "Button", nCount = 3},
|
||||
rtLockInfo = {},
|
||||
bgCondition = {},
|
||||
rtLockPreLv = {},
|
||||
redH = {},
|
||||
AnimSwitch = {sComponentName = "Animator"},
|
||||
imgSlc = {}
|
||||
}
|
||||
function ActivityLevelsLvCtrl:InitData(parent, nType, activityData, data, isOpen, isLevelUnLock)
|
||||
self._mapNode.imgSlc:SetActive(false)
|
||||
local txtLockConditionTime = self._mapNode.bgCondition.transform:Find("txtLockCondition"):GetComponent("TMP_Text")
|
||||
if self.timerRun ~= nil then
|
||||
self.timerRun:Pause(true)
|
||||
self.timerRun = nil
|
||||
end
|
||||
self._mapNode.Select:SetActive(false)
|
||||
self.lvLock = false
|
||||
if isOpen and isLevelUnLock then
|
||||
self._mapNode.rt_Targets:SetActive(true)
|
||||
for i = 1, 3 do
|
||||
self._mapNode.btnTarget[i].interactable = i <= data.Star
|
||||
end
|
||||
self._mapNode.rtLockInfo:SetActive(false)
|
||||
self._mapNode.rtLockPreLv:SetActive(false)
|
||||
self._mapNode.bgCondition:SetActive(false)
|
||||
elseif isOpen and not isLevelUnLock then
|
||||
self._mapNode.rt_Targets:SetActive(false)
|
||||
self._mapNode.rtLockInfo:SetActive(false)
|
||||
self._mapNode.rtLockPreLv:SetActive(true)
|
||||
self._mapNode.bgCondition:SetActive(false)
|
||||
elseif not isOpen then
|
||||
self._mapNode.rt_Targets:SetActive(false)
|
||||
self._mapNode.rtLockInfo:SetActive(true)
|
||||
self._mapNode.rtLockPreLv:SetActive(false)
|
||||
self._mapNode.bgCondition:SetActive(true)
|
||||
local day = activityData:GetUnLockDay(nType, data.baseData.Id)
|
||||
if day == 0 then
|
||||
local timerCount = function()
|
||||
local hour, min, sec = parent.activityLevelsData:GetUnLockHour(nType, data.baseData.Id)
|
||||
if 0 < hour then
|
||||
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour_Color_Common"), "08d3d4", hour))
|
||||
elseif 0 < min then
|
||||
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color_Common"), "08d3d4", min))
|
||||
elseif 0 < sec then
|
||||
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color_Common"), "08d3d4", sec))
|
||||
end
|
||||
end
|
||||
timerCount()
|
||||
self.timerRun = self:AddTimer(0, 1, function()
|
||||
timerCount()
|
||||
end, true, true, false)
|
||||
else
|
||||
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Day_Color_Common"), "08d3d4", day))
|
||||
end
|
||||
self.lvLock = true
|
||||
end
|
||||
local strTitle = ""
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
strTitle = orderedFormat(lvIndexTitle, 1, data.baseData.Difficulty)
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
strTitle = orderedFormat(lvIndexTitle, 2, data.baseData.Difficulty)
|
||||
elseif nType == GameEnum.ActivityLevelType.HARD then
|
||||
strTitle = orderedFormat(lvIndexTitle, 3, data.baseData.Difficulty)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_Select, strTitle)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_unSelect, strTitle)
|
||||
self._mapNode.tog.onClick:RemoveAllListeners()
|
||||
local clickCb = function()
|
||||
if self._mapNode.Select.activeSelf == true then
|
||||
return
|
||||
end
|
||||
self:SetDefault(true)
|
||||
parent:SetSelectObj(self)
|
||||
parent:RefreshInstanceInfo(nType, data.baseData.Difficulty, false)
|
||||
parent.activityLevelsData:ChangeRedDot(nType, data.baseData.Id)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
self._mapNode.tog.onClick:AddListener(clickCb)
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(parent.nActId)
|
||||
if bInActGroup then
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Explore_Level, {
|
||||
nActGroupId,
|
||||
data.baseData.Id
|
||||
}, self._mapNode.redH)
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure_Level, {
|
||||
nActGroupId,
|
||||
data.baseData.Id
|
||||
}, self._mapNode.redH)
|
||||
elseif nType == GameEnum.ActivityLevelType.HARD then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Hard_Level, {
|
||||
nActGroupId,
|
||||
data.baseData.Id
|
||||
}, self._mapNode.redH)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsLvCtrl:SetDefault(isOn)
|
||||
if self._mapNode.AnimSwitch.enabled == true then
|
||||
self._mapNode.AnimSwitch.enabled = false
|
||||
end
|
||||
if not isOn then
|
||||
self:ShowArrowAni(false)
|
||||
end
|
||||
self._mapNode.Select:SetActive(isOn)
|
||||
self._mapNode.unSelect:SetActive(not isOn)
|
||||
self._mapNode.imgSlc:SetActive(isOn)
|
||||
self._mapNode.txt_Select.gameObject:SetActive(isOn)
|
||||
self._mapNode.txt_unSelect.gameObject:SetActive(not isOn)
|
||||
if not self.lvLock and isOn then
|
||||
self._mapNode.SelectAni:Play("10108_ActitvityLevels_Select")
|
||||
end
|
||||
end
|
||||
function ActivityLevelsLvCtrl:ShowArrowAni(isShow)
|
||||
end
|
||||
function ActivityLevelsLvCtrl:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
function ActivityLevelsLvCtrl:OnDisable()
|
||||
if self.timerRun ~= nil then
|
||||
self.timerRun:Pause(true)
|
||||
self.timerRun = nil
|
||||
end
|
||||
end
|
||||
return ActivityLevelsLvCtrl
|
||||
@@ -0,0 +1,763 @@
|
||||
local ActivityLevelsSelectCtrl = class("ActivityLevelsSelectCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
local mapToggle = {
|
||||
[1] = GameEnum.diffculty.Diffculty_1,
|
||||
[2] = GameEnum.diffculty.Diffculty_2,
|
||||
[3] = GameEnum.diffculty.Diffculty_3,
|
||||
[4] = GameEnum.diffculty.Diffculty_4,
|
||||
[5] = GameEnum.diffculty.Diffculty_5,
|
||||
[6] = GameEnum.diffculty.Diffculty_6,
|
||||
[7] = GameEnum.diffculty.Diffculty_7,
|
||||
[8] = GameEnum.diffculty.Diffculty_8,
|
||||
[9] = GameEnum.diffculty.Diffculty_9,
|
||||
[10] = GameEnum.diffculty.Diffculty_10
|
||||
}
|
||||
local colorSelect = Color(1.0, 0.9882352941176471, 0.9568627450980393, 1)
|
||||
local colorUnSelect = Color(0.4, 0.13333333333333333, 0.15294117647058825, 1)
|
||||
local colorSelectLock = Color(0.9529411764705882, 0.8588235294117647, 0.7215686274509804, 1)
|
||||
local colorUnSelectLock = Color(0.4, 0.13333333333333333, 0.15294117647058825, 1)
|
||||
local timeUnLockColor = "fff7ca"
|
||||
local colorConditionsUnLock = Color(0.22745098039215686, 0.24705882352941178, 0.28627450980392155, 0.5)
|
||||
local colorConditionsLock = Color(0.22745098039215686, 0.24705882352941178, 0.28627450980392155, 1)
|
||||
local lvIndexTitle = "{0}-{1}"
|
||||
local twelveLvGroupPadding = {
|
||||
88,
|
||||
88,
|
||||
-180,
|
||||
0
|
||||
}
|
||||
local twelveLvGroupPaddingOpen = {
|
||||
88,
|
||||
818,
|
||||
-180,
|
||||
0
|
||||
}
|
||||
local fourLvGroupPadding = {
|
||||
500,
|
||||
88,
|
||||
-180,
|
||||
0
|
||||
}
|
||||
local fourLvGroupPaddingOpen = {
|
||||
88,
|
||||
818,
|
||||
-180,
|
||||
0
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
goEnemyInfo = {
|
||||
sCtrlName = "Game.UI.MainlineEx.MainlineMonsterInfoCtrl"
|
||||
},
|
||||
togTypeExplore = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TogTypeExplore"
|
||||
},
|
||||
togTypeExploreCtrl = {
|
||||
sNodeName = "togTypeExplore",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
lockExplore = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClick_BtnLockExplore"
|
||||
},
|
||||
redExplore = {},
|
||||
togTypeAdventure = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TogTypeAdventure"
|
||||
},
|
||||
togTypeAdventureCtrl = {
|
||||
sNodeName = "togTypeAdventure",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
lockAdventure = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClick_BtnLockAdventure"
|
||||
},
|
||||
redAdventure = {},
|
||||
togTypeHard = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TogTypeHard"
|
||||
},
|
||||
togTypeHardCtrl = {
|
||||
sNodeName = "togTypeHard",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
lockHard = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClick_BtnLockHard"
|
||||
},
|
||||
redHard = {},
|
||||
rtToggles = {
|
||||
sNodeName = "srToggle",
|
||||
sComponentName = "UIScrollRect"
|
||||
},
|
||||
rtTogglesTmp = {
|
||||
sNodeName = "rt_ToggleTmp",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
togRoot = {
|
||||
nCount = 12,
|
||||
sCtrlName = "Game.UI.ActivityTheme.10108.ActivityLevels.ActivityLevelsLvCtrl"
|
||||
},
|
||||
imgGear = {nCount = 12},
|
||||
rt_Toggle = {},
|
||||
rt_ToggleTrans = {sNodeName = "rt_Toggle", sComponentName = "Transform"},
|
||||
btnCloseBg = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_CloseBossInfo"
|
||||
},
|
||||
rtBoss = {},
|
||||
rtBossAni = {sNodeName = "rtBoss", sComponentName = "Animator"},
|
||||
txtRecommendLevel = {
|
||||
sNodeName = "txtSuggestLevel",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
txtTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "InfinityTower_Recommend_Lv"
|
||||
},
|
||||
txtBuildTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "InfinityTower_Recommend_Construct"
|
||||
},
|
||||
imgBuild = {sComponentName = "Image"},
|
||||
TMPName = {sComponentName = "TMP_Text"},
|
||||
TMPLevel = {sComponentName = "TMP_Text"},
|
||||
detailDescSc = {sComponentName = "Transform"},
|
||||
detailDesc = {sComponentName = "TMP_Text"},
|
||||
btnEnemyInfo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_EnemyInfo"
|
||||
},
|
||||
tex_EnemyInfo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Instance_EnemyInfo"
|
||||
},
|
||||
txtTitleTarget = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RogueBoss_Pause_Target"
|
||||
},
|
||||
txtReward = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Level_Award"
|
||||
},
|
||||
Task = {sComponentName = "Transform", nCount = 3},
|
||||
rewardRoot = {sComponentName = "Transform"},
|
||||
btn_itemTemp = {},
|
||||
btnListRoot = {},
|
||||
btnRaid = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickBtnRaid"
|
||||
},
|
||||
txtBtnRaid = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Raid_Title_Raid"
|
||||
},
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickBtnGo"
|
||||
},
|
||||
txtBtnGoRaidUnlock = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Maninline_Btn_Go"
|
||||
},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Maninline_Btn_Go"
|
||||
},
|
||||
goCoin = {},
|
||||
txtTicketsCount = {sComponentName = "TMP_Text"},
|
||||
btnRaidUnlock = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickBtnGo"
|
||||
},
|
||||
goCoinRaidUnlock = {},
|
||||
txtTicketsCountRaidUnlock = {sComponentName = "TMP_Text"},
|
||||
grpRaidUnlock = {},
|
||||
TMPRaidUnlockHint = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Raid_Btn_CondStar"
|
||||
},
|
||||
ListConditions = {},
|
||||
ListConditionsObj = {
|
||||
sNodeName = "Conditions_",
|
||||
nCount = 2
|
||||
}
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapEventConfig = {
|
||||
[EventId.UpdateEnergy] = "OnEvent_UpdateEnergy",
|
||||
[EventId.ClosePanel] = "OnEvent_ClosePanel"
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapRedDotConfig = {}
|
||||
function ActivityLevelsSelectCtrl:Awake()
|
||||
self.detailDescContent = self._mapNode.detailDescSc:Find("Viewport/Content").transform
|
||||
self.curRequireEnergy = 0
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Explore
|
||||
self.tabRewardList = {}
|
||||
self.AniRoot = self.gameObject:GetComponent("Animator")
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
|
||||
if bInActGroup then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Explore, {nActGroupId}, self._mapNode.redExplore)
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure, {nActGroupId}, self._mapNode.redAdventure)
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Hard, {nActGroupId}, self._mapNode.redHard)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEnable()
|
||||
self.isOpenLvMsg = false
|
||||
self:ShowBossInfo(false)
|
||||
self.timeTab = {}
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
self.SelectTogPreLvLock = nil
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in")
|
||||
self:Init()
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnDisable()
|
||||
self.timeTab = {}
|
||||
for i = 1, #self.tabRewardList do
|
||||
local go = self.tabRewardList[i].gameObject
|
||||
local btnSelect = self.tabRewardList[i].gameObject:GetComponent("UIButton")
|
||||
btnSelect.onClick:RemoveAllListeners()
|
||||
self:UnbindCtrlByNode(self.tabRewardList[i])
|
||||
destroy(go)
|
||||
end
|
||||
self.tabRewardList = {}
|
||||
self.SelectTogPreLvLock = nil
|
||||
self.SelectObj = nil
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnDestroy(...)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:Init()
|
||||
self.activityLevelsData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
self:RefreshTogTypeCount()
|
||||
self:Refresh()
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:Refresh()
|
||||
self.nLevelType = self.activityLevelsData:GetDefaultSelectionType()
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogTypeCount()
|
||||
self._mapNode.togTypeExploreCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_Explore"))
|
||||
self._mapNode.togTypeAdventureCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_Adventure"))
|
||||
self._mapNode.togTypeHardCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_HardCommon"))
|
||||
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Adventure)
|
||||
self._mapNode.togTypeHardCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.HARD)
|
||||
local objExploreCert = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/iconCert").gameObject
|
||||
local objAdventureCert = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/iconCert").gameObject
|
||||
local objHardCert = self._mapNode.togTypeHard.gameObject.transform:Find("AnimRoot/AnimSwitch/iconCert").gameObject
|
||||
self.firstExploreLevel = self.activityLevelsData.levelTabExploreDifficulty[1]
|
||||
local isOpenExplore = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Explore, self.firstExploreLevel)
|
||||
self._mapNode.lockExplore.gameObject:SetActive(not isOpenExplore)
|
||||
self.firstAdventureLevel = self.activityLevelsData.levelTabAdventureDifficulty[1]
|
||||
local isOpenAdventure = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
|
||||
self._mapNode.lockAdventure.gameObject:SetActive(not isOpenAdventure)
|
||||
local txt_SelectAdventure = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_Select").gameObject
|
||||
local txt_unSelectAdventure = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelect").gameObject
|
||||
txt_SelectAdventure.transform.localScale = isOpenAdventure == true and Vector3.one or Vector3.zero
|
||||
txt_unSelectAdventure.transform.localScale = isOpenAdventure == true and Vector3.one or Vector3.zero
|
||||
self.firstHardLevel = self.activityLevelsData.levelTabHardDifficulty[1]
|
||||
local isOpenHard = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.HARD, self.firstHardLevel)
|
||||
self._mapNode.lockHard.gameObject:SetActive(not isOpenHard)
|
||||
local txt_SelectHard = self._mapNode.togTypeHard.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_Select").gameObject
|
||||
local txt_unSelectHard = self._mapNode.togTypeHard.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelect").gameObject
|
||||
txt_SelectHard.transform.localScale = isOpenHard == true and Vector3.one or Vector3.zero
|
||||
txt_unSelectHard.transform.localScale = isOpenHard == true and Vector3.one or Vector3.zero
|
||||
objExploreCert:SetActive(true)
|
||||
for i, v in pairs(self.activityLevelsData.levelTabExplore) do
|
||||
if v.Star < 3 then
|
||||
objExploreCert:SetActive(false)
|
||||
break
|
||||
end
|
||||
end
|
||||
objAdventureCert:SetActive(true)
|
||||
for i, v in pairs(self.activityLevelsData.levelTabAdventure) do
|
||||
if v.Star < 3 then
|
||||
objAdventureCert:SetActive(false)
|
||||
break
|
||||
end
|
||||
end
|
||||
objHardCert:SetActive(true)
|
||||
for i, v in pairs(self.activityLevelsData.levelTabHard) do
|
||||
if v.Star < 3 then
|
||||
objHardCert:SetActive(false)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClick_BtnLockExplore()
|
||||
self:FirstLevelLockTips(GameEnum.ActivityLevelType.Explore, self.firstExploreLevel)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClick_BtnLockAdventure()
|
||||
self:FirstLevelLockTips(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClick_BtnLockHard()
|
||||
self:FirstLevelLockTips(GameEnum.ActivityLevelType.HARD, self.firstHardLevel)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:FirstLevelLockTips(nType, nLevel)
|
||||
local day = self.activityLevelsData:GetUnLockDay(nType, nLevel)
|
||||
local strTips = ""
|
||||
if day == 0 then
|
||||
local hour, min, sec = self.activityLevelsData:GetUnLockHour(nType, nLevel)
|
||||
if 0 < hour then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour)
|
||||
elseif 0 < min then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min)
|
||||
elseif 0 < sec then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec"), sec)
|
||||
end
|
||||
else
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_DayOpen"), day)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, strTips)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeExplore()
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.Explore then
|
||||
return
|
||||
end
|
||||
self:CloseAllTimer()
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Explore
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeAdventure()
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.Adventure then
|
||||
return
|
||||
end
|
||||
self:CloseAllTimer()
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Adventure
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeHard()
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.HARD then
|
||||
return
|
||||
end
|
||||
self:CloseAllTimer()
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
self.nLevelType = GameEnum.ActivityLevelType.HARD
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:CloseAllTimer()
|
||||
for i, v in pairs(self.timeTab) do
|
||||
v:Pause(true)
|
||||
end
|
||||
self.timeTab = {}
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogType(nType)
|
||||
self._mapNode.togTypeExploreCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.Adventure)
|
||||
self._mapNode.togTypeHardCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.HARD)
|
||||
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Adventure)
|
||||
self._mapNode.togTypeHardCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.HARD)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogList(nType, nDifficulty)
|
||||
self.SelectObj = nil
|
||||
local tabLevelInfo, tabLevelInfoDifficulty
|
||||
self.currentTypeLvCount = 0
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
tabLevelInfo = self.activityLevelsData.levelTabExplore
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabExploreDifficulty
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
tabLevelInfo = self.activityLevelsData.levelTabAdventure
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabAdventureDifficulty
|
||||
else
|
||||
tabLevelInfo = self.activityLevelsData.levelTabHard
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabHardDifficulty
|
||||
end
|
||||
self.currentTypeLvCount = #tabLevelInfoDifficulty
|
||||
self._mapNode.rtToggles.gameObject:SetActive(true)
|
||||
local isFour = self.currentTypeLvCount == 4
|
||||
if self.isOpenLvMsg == false then
|
||||
local tmpPadding = isFour and fourLvGroupPadding or twelveLvGroupPadding
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, tmpPadding[1], tmpPadding[2], tmpPadding[3], tmpPadding[4])
|
||||
else
|
||||
local tmpPadding = isFour and fourLvGroupPaddingOpen or twelveLvGroupPaddingOpen
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, tmpPadding[1], tmpPadding[2], tmpPadding[3], tmpPadding[4])
|
||||
end
|
||||
for i = 1, 12 do
|
||||
self._mapNode.togRoot[i].gameObject:SetActive(i <= self.currentTypeLvCount)
|
||||
self._mapNode.imgGear[i].gameObject:SetActive(i <= self.currentTypeLvCount)
|
||||
end
|
||||
for i = 1, self.currentTypeLvCount do
|
||||
do
|
||||
local tmpId = tabLevelInfoDifficulty[i]
|
||||
local tmpData = tabLevelInfo[tmpId]
|
||||
local isOpen = self.activityLevelsData:GetLevelDayOpen(nType, tmpData.baseData.Id)
|
||||
local isLevelUnLock = self.activityLevelsData:GetLevelUnLock(nType, tmpData.baseData.Id)
|
||||
self._mapNode.togRoot[i]:InitData(self, nType, self.activityLevelsData, tmpData, isOpen, isLevelUnLock)
|
||||
if nDifficulty == i then
|
||||
if self.isOpenLvMsg then
|
||||
self.SelectObj = self._mapNode.togRoot[i]
|
||||
self._mapNode.togRoot[i]:SetDefault(true)
|
||||
self:RefreshInstanceInfo(nType, nDifficulty, true)
|
||||
else
|
||||
self._mapNode.togRoot[i]:SetDefault(false)
|
||||
local wait = function()
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rt_ToggleTrans.gameObject:GetComponent("RectTransform"))
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
if i < 3 then
|
||||
self._mapNode.rt_ToggleTrans.localPosition = Vector3(0, self._mapNode.rt_ToggleTrans.localPosition.y, 0)
|
||||
elseif 10 < i then
|
||||
self._mapNode.rt_ToggleTrans.localPosition = Vector3(-2440, self._mapNode.rt_ToggleTrans.localPosition.y, 0)
|
||||
else
|
||||
self._mapNode.rt_ToggleTrans.localPosition = Vector3(-270 * (i - 2), self._mapNode.rt_ToggleTrans.localPosition.y, 0)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
else
|
||||
self._mapNode.togRoot[i]:SetDefault(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:SetSelectObj(tmpSelectObj)
|
||||
if self.SelectObj ~= nil then
|
||||
self.SelectObj:SetDefault(false)
|
||||
end
|
||||
self.SelectObj = tmpSelectObj
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_CloseBossInfo()
|
||||
self._mapNode.rtBossAni:Play("rtBoss_out")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self:ShowBossInfo(false)
|
||||
end, true, true, true)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:ShowBossInfo(isShow)
|
||||
self.isOpenLvMsg = isShow
|
||||
self._mapNode.rtBoss:SetActive(isShow)
|
||||
self._mapNode.btnCloseBg.gameObject:SetActive(isShow)
|
||||
if not isShow and self.SelectObj ~= nil then
|
||||
self.SelectObj:SetDefault(false)
|
||||
self.SelectObj = nil
|
||||
end
|
||||
if not isShow then
|
||||
local isFour = self.currentTypeLvCount == 4
|
||||
local tmpPadding = isFour and fourLvGroupPadding or twelveLvGroupPadding
|
||||
if isFour then
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
local moveTime = 0.2
|
||||
local layoutGroup = self._mapNode.rt_Toggle:GetComponent("HorizontalLayoutGroup")
|
||||
local startLeft = layoutGroup ~= nil and layoutGroup.padding.left or tmpPadding[1]
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, startLeft, fourLvGroupPaddingOpen[2], fourLvGroupPaddingOpen[3], fourLvGroupPaddingOpen[4])
|
||||
CS.DG.Tweening.DOVirtual.Float(startLeft, tmpPadding[1], moveTime, function(v)
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, math.floor(v), tmpPadding[2], tmpPadding[3], tmpPadding[4])
|
||||
end)
|
||||
else
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, tmpPadding[1], tmpPadding[2], tmpPadding[3], tmpPadding[4])
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshInstanceInfo(nType, nHard, isInit)
|
||||
if self.currentTypeLvCount == 12 then
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, twelveLvGroupPaddingOpen[1], twelveLvGroupPaddingOpen[2], twelveLvGroupPaddingOpen[3], twelveLvGroupPaddingOpen[4])
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
local moveTime = isInit and 0.4 or 0.2
|
||||
if nHard < 3 then
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(0, moveTime)
|
||||
elseif 10 < nHard then
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-2440, moveTime)
|
||||
else
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-270 * (nHard - 2), moveTime)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
elseif self.currentTypeLvCount == 8 then
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, twelveLvGroupPaddingOpen[1], twelveLvGroupPaddingOpen[2], twelveLvGroupPaddingOpen[3], twelveLvGroupPaddingOpen[4])
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
local moveTime = isInit and 0.4 or 0.2
|
||||
if nHard < 3 then
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(0, moveTime)
|
||||
elseif 6 < nHard then
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-1170, moveTime)
|
||||
else
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-270 * (nHard - 2), moveTime)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
else
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
local moveTime = isInit and 0.4 or 0.2
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, moveTime)
|
||||
local layoutGroup = self._mapNode.rt_Toggle:GetComponent("HorizontalLayoutGroup")
|
||||
local startLeft = layoutGroup ~= nil and layoutGroup.padding.left or fourLvGroupPadding[1]
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, startLeft, fourLvGroupPaddingOpen[2], fourLvGroupPaddingOpen[3], fourLvGroupPaddingOpen[4])
|
||||
CS.DG.Tweening.DOVirtual.Float(startLeft, fourLvGroupPaddingOpen[1], moveTime, function(v)
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, math.floor(v), fourLvGroupPaddingOpen[2], fourLvGroupPaddingOpen[3], fourLvGroupPaddingOpen[4])
|
||||
end)
|
||||
if nHard < 2 then
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(0, moveTime)
|
||||
elseif 3 <= nHard then
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(0, moveTime)
|
||||
else
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(0 * (nHard - 1), moveTime)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
self.curSelectHard = nHard
|
||||
local levelId = 0
|
||||
self.selectLevelData = nil
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
levelId = self.activityLevelsData.levelTabExploreDifficulty[nHard]
|
||||
self.selectLevelData = self.activityLevelsData.levelTabExplore[levelId]
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
levelId = self.activityLevelsData.levelTabAdventureDifficulty[nHard]
|
||||
self.selectLevelData = self.activityLevelsData.levelTabAdventure[levelId]
|
||||
else
|
||||
levelId = self.activityLevelsData.levelTabHardDifficulty[nHard]
|
||||
self.selectLevelData = self.activityLevelsData.levelTabHard[levelId]
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRecommendLevel, self.selectLevelData.baseData.SuggestedPower)
|
||||
local sRank = "Icon/BuildRank/BuildRank_" .. self.selectLevelData.baseData.RecommendBuildRank
|
||||
self:SetPngSprite(self._mapNode.imgBuild, sRank)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPName, self.selectLevelData.baseData.Name)
|
||||
local strTitle = ""
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
strTitle = orderedFormat(lvIndexTitle, 1, self.selectLevelData.baseData.Difficulty)
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
strTitle = orderedFormat(lvIndexTitle, 2, self.selectLevelData.baseData.Difficulty)
|
||||
elseif nType == GameEnum.ActivityLevelType.HARD then
|
||||
strTitle = orderedFormat(lvIndexTitle, 3, self.selectLevelData.baseData.Difficulty)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPLevel, strTitle)
|
||||
NovaAPI.SetTMPText(self._mapNode.detailDesc, self.selectLevelData.baseData.Desc)
|
||||
self.detailDescContent:DOLocalMoveY(0, 0)
|
||||
self.curStar = self.selectLevelData.Star
|
||||
local tbCond = {
|
||||
self.selectLevelData.baseData.OneStarDesc,
|
||||
self.selectLevelData.baseData.TwoStarDesc,
|
||||
self.selectLevelData.baseData.ThreeStarDesc
|
||||
}
|
||||
for i = 1, 3 do
|
||||
local rtTask = self._mapNode.Task[i]
|
||||
local goDone = rtTask:Find("imgDone").gameObject
|
||||
local imgUnDone = rtTask:Find("imgUnDone").gameObject
|
||||
local Text = rtTask:Find("Text"):GetComponent("TMP_Text")
|
||||
goDone:SetActive(i <= self.curStar)
|
||||
imgUnDone:SetActive(i > self.curStar)
|
||||
local cond = tbCond[i]
|
||||
if cond == nil then
|
||||
rtTask.gameObject:SetActive(false)
|
||||
return
|
||||
else
|
||||
rtTask.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(Text, cond)
|
||||
end
|
||||
end
|
||||
self.PreviewMonsterGroupId = self.selectLevelData.baseData.PreviewMonsterGroupId
|
||||
local isOpen = self.activityLevelsData:GetLevelDayOpen(nType, self.selectLevelData.baseData.Id)
|
||||
local isLevelUnLock = self.activityLevelsData:GetLevelUnLock(nType, self.selectLevelData.baseData.Id)
|
||||
local isNeedEnergyConsume = true
|
||||
if not self.selectLevelData.baseData.EnergyConsumeOnRetry and 0 < self.selectLevelData.Star then
|
||||
isNeedEnergyConsume = false
|
||||
end
|
||||
if isOpen and isLevelUnLock then
|
||||
self._mapNode.btnListRoot:SetActive(true)
|
||||
self._mapNode.ListConditions:SetActive(false)
|
||||
if self.selectLevelData.baseData.ThreeStarSweep then
|
||||
if self.selectLevelData.Star == 3 then
|
||||
self._mapNode.btnRaid.gameObject:SetActive(true)
|
||||
self._mapNode.btnGo.gameObject:SetActive(true)
|
||||
self._mapNode.btnRaidUnlock.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.btnRaid.gameObject:SetActive(false)
|
||||
self._mapNode.btnGo.gameObject:SetActive(false)
|
||||
self._mapNode.btnRaidUnlock.gameObject:SetActive(true)
|
||||
self._mapNode.grpRaidUnlock:SetActive(true)
|
||||
end
|
||||
else
|
||||
self._mapNode.btnRaid.gameObject:SetActive(false)
|
||||
self._mapNode.btnGo.gameObject:SetActive(false)
|
||||
self._mapNode.btnRaidUnlock.gameObject:SetActive(true)
|
||||
self._mapNode.grpRaidUnlock:SetActive(false)
|
||||
end
|
||||
local nHas = PlayerData.Base:GetCurEnergy()
|
||||
local nRequire = self.selectLevelData.baseData.EnergyConsume
|
||||
if not isNeedEnergyConsume then
|
||||
nRequire = 0
|
||||
end
|
||||
self.curRequireEnergy = nRequire
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTicketsCount, nRequire)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCount, nRequire > nHas.nEnergy and Red_Unable or Blue_Normal)
|
||||
self._mapNode.goCoin:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTicketsCountRaidUnlock, nRequire)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCountRaidUnlock, nRequire > nHas.nEnergy and Red_Unable or Blue_Normal)
|
||||
self._mapNode.goCoinRaidUnlock:SetActive(true)
|
||||
elseif isOpen and not isLevelUnLock then
|
||||
self._mapNode.btnListRoot:SetActive(false)
|
||||
self._mapNode.ListConditions:SetActive(true)
|
||||
local preLevelId = self.selectLevelData.baseData.PreLevelId
|
||||
if preLevelId ~= 0 then
|
||||
local lvPreNeedStar = self.selectLevelData.baseData.PreLevelStar
|
||||
local lvPreStar = self.activityLevelsData:GetPreLevelStar(nType, self.selectLevelData.baseData.Id)
|
||||
local imgConditions_Lock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_Lock").gameObject
|
||||
local imgConditions_UnLock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_UnLock").gameObject
|
||||
local txt = self._mapNode.ListConditionsObj[1].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
|
||||
local tmpData = ConfigTable.GetData("ActivityLevelsLevel", preLevelId)
|
||||
imgConditions_Lock_1:SetActive(lvPreNeedStar > lvPreStar)
|
||||
imgConditions_UnLock_1:SetActive(lvPreNeedStar <= lvPreStar)
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_PreLevel"), tmpData.Name))
|
||||
NovaAPI.SetTMPColor(txt, lvPreNeedStar <= lvPreStar and colorConditionsUnLock or colorConditionsLock)
|
||||
else
|
||||
local imgConditions_Lock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_Lock").gameObject
|
||||
local imgConditions_UnLock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_UnLock").gameObject
|
||||
local txt = self._mapNode.ListConditionsObj[1].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
|
||||
imgConditions_Lock_1:SetActive(true)
|
||||
imgConditions_UnLock_1:SetActive(false)
|
||||
NovaAPI.SetTMPText(txt, ConfigTable.GetUIText("Unlocked_By_PreLevel"))
|
||||
NovaAPI.SetTMPColor(txt, colorConditionsUnLock)
|
||||
end
|
||||
local preActivityStory = self.selectLevelData.baseData.PreActivityStory
|
||||
if preActivityStory ~= nil and preActivityStory[1] ~= nil then
|
||||
local isRead = PlayerData.ActivityAvg:IsStoryReaded(preActivityStory[2])
|
||||
local imgConditions_Lock_2 = self._mapNode.ListConditionsObj[2].transform:Find("imgConditions_Lock").gameObject
|
||||
local imgConditions_UnLock_2 = self._mapNode.ListConditionsObj[2].transform:Find("imgConditions_UnLock").gameObject
|
||||
local txt = self._mapNode.ListConditionsObj[2].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
|
||||
imgConditions_Lock_2:SetActive(not isRead)
|
||||
imgConditions_UnLock_2:SetActive(isRead)
|
||||
local cfgdata = ConfigTable.GetData("ActivityStory", preActivityStory[2])
|
||||
if cfgdata ~= nil then
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Avg"), cfgdata.Title))
|
||||
self._mapNode.ListConditionsObj[2]:SetActive(true)
|
||||
NovaAPI.SetTMPColor(txt, isRead and colorConditionsUnLock or colorConditionsLock)
|
||||
else
|
||||
self._mapNode.ListConditionsObj[2]:SetActive(false)
|
||||
end
|
||||
else
|
||||
self._mapNode.ListConditionsObj[2]:SetActive(false)
|
||||
end
|
||||
elseif not isOpen then
|
||||
self._mapNode.btnListRoot:SetActive(false)
|
||||
self._mapNode.ListConditions:SetActive(true)
|
||||
self._mapNode.ListConditionsObj[2]:SetActive(false)
|
||||
local imgConditions_Lock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_Lock").gameObject
|
||||
local imgConditions_UnLock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_UnLock").gameObject
|
||||
imgConditions_Lock_1:SetActive(true)
|
||||
imgConditions_UnLock_1:SetActive(false)
|
||||
NovaAPI.SetTMPColor(txt, colorConditionsUnLock)
|
||||
local txt = self._mapNode.ListConditionsObj[1].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
|
||||
local day = self.activityLevelsData:GetUnLockDay(nType, self.selectLevelData.baseData.Id)
|
||||
if day == 0 then
|
||||
local hour, min, sec = self.activityLevelsData:GetUnLockHour(nType, self.selectLevelData.baseData.Id)
|
||||
if 0 < hour then
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour))
|
||||
elseif 0 < min then
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min))
|
||||
elseif 0 < sec then
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min))
|
||||
end
|
||||
else
|
||||
local _day, _hour = self.activityLevelsData:GetUnLockDayHour(nType, self.selectLevelData.baseData.Id)
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_DayHourOpen"), _day, _hour))
|
||||
end
|
||||
end
|
||||
for i = 1, #self.tabRewardList do
|
||||
self.tabRewardList[i].gameObject:SetActive(false)
|
||||
end
|
||||
local tbReward = decodeJson(self.selectLevelData.baseData.CompleteRewardPreview)
|
||||
for i = 1, #tbReward do
|
||||
if i > #self.tabRewardList then
|
||||
local obj = instantiate(self._mapNode.btn_itemTemp, self._mapNode.rewardRoot)
|
||||
self.tabRewardList[i] = self:BindCtrlByNode(obj, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
do
|
||||
local itemCtrl = self.tabRewardList[i]
|
||||
itemCtrl.gameObject:SetActive(true)
|
||||
if tbReward[i] ~= nil then
|
||||
local bReceived = 0 < self.selectLevelData.Star and tbReward[i][3] == 1
|
||||
local bFirstPass = tbReward[i][3] == 1
|
||||
itemCtrl:SetItem(tbReward[i][1], nil, UTILS.ParseRewardItemCount(tbReward[i]), nil, bReceived, bFirstPass, false, true)
|
||||
local btnItem = itemCtrl.gameObject:GetComponent("UIButton")
|
||||
btnItem.onClick:RemoveAllListeners()
|
||||
local clickCb = function()
|
||||
self:OnBtnClick_RewardItem(tbReward[i][1], btnItem.gameObject)
|
||||
end
|
||||
btnItem.onClick:AddListener(clickCb)
|
||||
end
|
||||
end
|
||||
end
|
||||
if self._mapNode.rtBoss.activeSelf == false then
|
||||
self:ShowBossInfo(true)
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self._mapNode.rtBossAni:Play("rtBoss_in")
|
||||
end, true, true, true)
|
||||
else
|
||||
self._mapNode.rtBossAni:Play("rtBoss_Empty")
|
||||
self:AddTimer(1, 0.1, function()
|
||||
self._mapNode.rtBossAni:Play("rtBoss_in")
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_RewardItem(nTid, btn)
|
||||
local rtBtn = btn.transform
|
||||
UTILS.ClickItemGridWithTips(nTid, rtBtn, false, true, false)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClickBtnGo()
|
||||
local nEnergy = PlayerData.Base:GetCurEnergy().nEnergy
|
||||
if nEnergy < self.curRequireEnergy then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.EnergyBuy)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.EnergyBuy, AllEnum.EnergyPanelType.Main, {}, true, callback)
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("MainlineData_Energy"))
|
||||
return
|
||||
end
|
||||
if self.SelectObj ~= nil then
|
||||
self.SelectObj:ShowArrowAni(true)
|
||||
end
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self.activityLevelsData:ChangeRedDot(self.selectLevelData.baseData.Type, self.selectLevelData.baseData.Id)
|
||||
PlayerData.Activity:SetActivityLevelActId(self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityLevels, self.selectLevelData.baseData.Id, {
|
||||
self.nActId
|
||||
})
|
||||
end, true, true, true)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClickBtnRaid()
|
||||
if self.curStar ~= 3 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Raid_Lock"))
|
||||
return
|
||||
end
|
||||
if self.SelectObj ~= nil then
|
||||
self.SelectObj:ShowArrowAni(true)
|
||||
end
|
||||
self:AddTimer(1, 0.2, function()
|
||||
local nNeedEnergy = self.curRequireEnergy
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 5, self.nActId)
|
||||
end, true, true, true)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEvent_ClosePanel(nPanelId)
|
||||
if type(nPanelId) == "number" and nPanelId == PanelId.Raid and self.SelectObj ~= nil then
|
||||
self.SelectObj:ShowArrowAni(false)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_EnemyInfo()
|
||||
EventManager.Hit("OpenActivityLevelsMonsterInfo", self.PreviewMonsterGroupId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEvent_UpdateEnergy()
|
||||
local nHas = PlayerData.Base:GetCurEnergy()
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCount, nHas.nEnergy < self.curRequireEnergy and Red_Unable or Blue_Normal)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCountRaidUnlock, nHas.nEnergy < self.curRequireEnergy and Red_Unable or Blue_Normal)
|
||||
end
|
||||
return ActivityLevelsSelectCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local ActivityLevelsSelectPanel = class("ActivityLevelsSelectPanel", BasePanel)
|
||||
ActivityLevelsSelectPanel._sUIResRootPath = "UI_Activity/"
|
||||
ActivityLevelsSelectPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10108/ActivityLevels/ActivityLevelsSelect.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10108.ActivityLevels.ActivityLevelsSelectCtrl"
|
||||
}
|
||||
}
|
||||
function ActivityLevelsSelectPanel:Awake()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnEnable()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnAfterEnter()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnDisable()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnDestroy()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnRelease()
|
||||
end
|
||||
return ActivityLevelsSelectPanel
|
||||
@@ -0,0 +1,173 @@
|
||||
local ActivityTechCtrl = class("ActivityTechCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivityTechCtrl._mapNodeConfig = {
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Go"
|
||||
},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
svReward = {
|
||||
sNodeName = "PreviewUpgradeMaterial",
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
txtAdvanceMat = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MessageBox_Reward"
|
||||
},
|
||||
txtDate = {sComponentName = "TMP_Text"},
|
||||
imgLock = {},
|
||||
txtLock = {sComponentName = "TMP_Text"},
|
||||
imgEnd = {},
|
||||
txtActivityEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgRemaineTime = {},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_TowerAllOpen_Go"
|
||||
},
|
||||
txtBtnActDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Detail"
|
||||
},
|
||||
btnActDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
}
|
||||
}
|
||||
function ActivityTechCtrl:Awake()
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityTechCtrl:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivityTechCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self:RefreshLockState()
|
||||
self:RefreshDate()
|
||||
self:RefreshTimeout()
|
||||
self:RefreshReward()
|
||||
end
|
||||
function ActivityTechCtrl:UnInit()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivityTechCtrl:UnbindCtrl()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityTechCtrl:RefreshLockState()
|
||||
local IsUnlock, txtLock = self.actData:IsUnlock()
|
||||
self._mapNode.imgLock.gameObject:SetActive(not IsUnlock)
|
||||
self._mapNode.btnGo.gameObject:SetActive(IsUnlock)
|
||||
if not IsUnlock then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLock, txtLock)
|
||||
end
|
||||
end
|
||||
function ActivityTechCtrl:RefreshTimeout()
|
||||
local endTime = self.actData:GetActGroupEndTime()
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
self._mapNode.imgRemaineTime:SetActive(0 < remainTime)
|
||||
self._mapNode.imgEnd:SetActive(remainTime <= 0)
|
||||
if remainTime < 0 and self.remainTimer ~= nil then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
|
||||
end
|
||||
function ActivityTechCtrl:RefreshDate()
|
||||
local nOpenMonth, nOpenDay, nEndMonth, nEndDay, nOpenYear, nEndYear = self.actData:GetActGroupDate()
|
||||
local strOpenDay = string.format("%d", nOpenDay)
|
||||
local strEndDay = string.format("%d", nEndDay)
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
|
||||
end
|
||||
function ActivityTechCtrl:RefreshReward()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
local rewardData = actGroupCfg.RewardsShow
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self._mapNode.svReward:Init(#rewardData, self, self.RefreshRewardGridItem, self.BtnRewardGridClick)
|
||||
end
|
||||
function ActivityTechCtrl:RefreshRewardGridItem(go, index)
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
local rewardData = actGroupCfg.RewardsShow
|
||||
local rewardId = rewardData[index + 1]
|
||||
local nInstanceID = go:GetInstanceID()
|
||||
if not self.tbGridCtrl[nInstanceID] then
|
||||
self.tbGridCtrl[nInstanceID] = self:BindCtrlByNode(go, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
self.tbGridCtrl[nInstanceID]:SetItem(rewardId)
|
||||
end
|
||||
function ActivityTechCtrl:BtnRewardGridClick(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
local rewardData = actGroupCfg.RewardsShow
|
||||
local item = goGrid.transform:Find("AnimRoot/item")
|
||||
UTILS.ClickItemGridWithTips(rewardData[nIndex], item.transform, true, true, false)
|
||||
end
|
||||
function ActivityTechCtrl:OnBtnClick_Go()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
if actGroupCfg ~= nil and actGroupCfg ~= nil and actGroupCfg.PanelId ~= nil and actGroupCfg.PanelId > 0 then
|
||||
if actGroupCfg.TransitionId ~= nil and 0 < actGroupCfg.TransitionId then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, actGroupCfg.PanelId, actGroupCfg.Id, true)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, actGroupCfg.TransitionId, callback)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, actGroupCfg.PanelId, actGroupCfg.Id, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityTechCtrl:OnBtnClick_Detail()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
if actGroupCfg == nil then
|
||||
return
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = actGroupCfg.DesText,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function ActivityTechCtrl:ClearActivity()
|
||||
end
|
||||
return ActivityTechCtrl
|
||||
@@ -0,0 +1,134 @@
|
||||
local ActivityShopGoodsItemCtrl = class("ActivityShopGoodsItemCtrl", BaseCtrl)
|
||||
ActivityShopGoodsItemCtrl._mapNodeConfig = {
|
||||
imgRare = {sComponentName = "Image"},
|
||||
imgLeft = {},
|
||||
txtLeft = {sComponentName = "TMP_Text"},
|
||||
imgTime = {},
|
||||
txtLeftTime = {sComponentName = "TMP_Text"},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgElement = {sComponentName = "Image"},
|
||||
goStar = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
|
||||
},
|
||||
imgExpire = {sComponentName = "Image"},
|
||||
txtCount = {sComponentName = "TMP_Text"},
|
||||
imgCoin = {sComponentName = "Image"},
|
||||
txtPrice = {sComponentName = "TMP_Text"},
|
||||
imgMask = {},
|
||||
goRestock = {},
|
||||
txtRestock = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Mall_Package_SoldOut"
|
||||
},
|
||||
goCondition = {},
|
||||
txtCondition = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
ActivityShopGoodsItemCtrl._mapEventConfig = {}
|
||||
function ActivityShopGoodsItemCtrl:Refresh(mapData, nCurrencyItemId)
|
||||
self.mapData = mapData
|
||||
self.mapGoodsCfg = ConfigTable.GetData("ActivityGoods", mapData.nId)
|
||||
if not self.mapGoodsCfg then
|
||||
return
|
||||
end
|
||||
self:RefreshInfo()
|
||||
self:RefreshPrice(nCurrencyItemId)
|
||||
self:RefreshTime()
|
||||
self:RefreshLimit()
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:RefreshInfo()
|
||||
local mapItemCfg = ConfigTable.GetData_Item(self.mapGoodsCfg.ItemId)
|
||||
if not mapItemCfg then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, self.mapGoodsCfg.Name)
|
||||
if mapItemCfg.Type == GameEnum.itemType.Disc then
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapItemCfg.Icon .. AllEnum.OutfitIconSurfix.Item)
|
||||
self._mapNode.imgElement.gameObject:SetActive(true)
|
||||
self._mapNode.goStar.gameObject:SetActive(true)
|
||||
local mapDiscCfgData = ConfigTable.GetData("Disc", self.mapGoodsCfg.ItemId)
|
||||
if mapDiscCfgData then
|
||||
self:SetAtlasSprite(self._mapNode.imgElement, "12_rare", AllEnum.Star_Element[mapDiscCfgData.EET].icon)
|
||||
end
|
||||
local nStar = 6 - mapItemCfg.Rarity
|
||||
self._mapNode.goStar:SetStar(nStar, nStar)
|
||||
else
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapItemCfg.Icon)
|
||||
self._mapNode.imgElement.gameObject:SetActive(false)
|
||||
self._mapNode.goStar.gameObject:SetActive(false)
|
||||
end
|
||||
self._mapNode.imgExpire.gameObject:SetActive(mapItemCfg.ExpireType > 0)
|
||||
local sPath = "db_tech_shop_" .. AllEnum.FrameColor_New[mapItemCfg.Rarity]
|
||||
self:SetActivityAtlasSprite_New(self._mapNode.imgRare, "10108/SpriteAtlas/1010804", sPath)
|
||||
local bLimit = 0 < self.mapData.nMaximumLimit
|
||||
if bLimit then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLeft, orderedFormat(ConfigTable.GetUIText("Shop_Left"), self.mapData.nMaximumLimit - self.mapData.nBoughtCount))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLeft, orderedFormat(ConfigTable.GetUIText("Shop_Left"), ConfigTable.GetUIText("Shop_Unlimited")))
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCount, orderedFormat(ConfigTable.GetUIText("Shop_GoodsItem_Count"), self.mapGoodsCfg.ItemQuantity))
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:RefreshPrice(nCurrencyItemId)
|
||||
self:SetSprite_Coin(self._mapNode.imgCoin, nCurrencyItemId)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPrice, self.mapGoodsCfg.Price)
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:RefreshTime()
|
||||
local bTime = self.mapData.bPurchasTime and self.mapData.nNextRefreshTime > 0
|
||||
self._mapNode.imgTime:SetActive(bTime)
|
||||
if not bTime then
|
||||
return
|
||||
end
|
||||
local sTime = ""
|
||||
local nRemaining = self.mapData.nNextRefreshTime - CS.ClientManager.Instance.serverTimeStamp
|
||||
if nRemaining <= 3600 and 0 < nRemaining then
|
||||
sTime = ConfigTable.GetUIText("Shop_WithinHour")
|
||||
elseif 3600 < nRemaining and nRemaining <= 86400 then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("Shop_Hour"), math.floor(nRemaining / 3600))
|
||||
elseif 86400 < nRemaining then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("Shop_Day"), math.floor(nRemaining / 86400))
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLeftTime, sTime)
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:RefreshLimit()
|
||||
local bMask = not self.mapData.bPurchasable or not self.mapData.bPurchasTime or self.mapData.bSoldOut
|
||||
self._mapNode.imgMask:SetActive(bMask)
|
||||
if self.mapData.bSoldOut then
|
||||
self._mapNode.goRestock:SetActive(true)
|
||||
self._mapNode.goCondition:SetActive(false)
|
||||
return
|
||||
end
|
||||
self._mapNode.goRestock:SetActive(false)
|
||||
self._mapNode.goCondition:SetActive(true)
|
||||
if self.mapData.nUnlockPurchaseTime > 0 and self.mapData.nUnlockPurchaseTime == self.mapData.nNextRefreshTime then
|
||||
local sTime = ""
|
||||
local nRemaining = self.mapData.nNextRefreshTime - CS.ClientManager.Instance.serverTimeStamp
|
||||
if nRemaining <= 3600 and 0 < nRemaining then
|
||||
sTime = ConfigTable.GetUIText("Shop_WithinHourUnLock")
|
||||
elseif 3600 < nRemaining and nRemaining <= 86400 then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("Shop_HourUnLock"), math.floor(nRemaining / 3600))
|
||||
elseif 86400 < nRemaining then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("Shop_DayUnLock"), math.floor(nRemaining / 86400))
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCondition, sTime)
|
||||
return
|
||||
end
|
||||
if not self.mapData.bPurchasable then
|
||||
local sCond = ""
|
||||
if self.mapData.nPurchaseCondType == GameEnum.shopCond.WorldClassSpecific then
|
||||
sCond = orderedFormat(ConfigTable.GetUIText("Shop_Cond_WorldClass"), self.mapData.tbPurchaseCondParams[1])
|
||||
elseif self.mapData.nPurchaseCondType == GameEnum.shopCond.ShopPreGoodsSellOut or self.mapData.nPurchaseCondType == GameEnum.shopCond.ActivityShopPreGoodsSellOut then
|
||||
sCond = ConfigTable.GetUIText("Shop_Cond_PreGoodsSellOut")
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCondition, sCond)
|
||||
return
|
||||
end
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:Awake()
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:OnEnable()
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:OnDisable()
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:OnDestroy()
|
||||
end
|
||||
return ActivityShopGoodsItemCtrl
|
||||
@@ -0,0 +1,24 @@
|
||||
local ActivityShopPanel = class("ActivityShopPanel", BasePanel)
|
||||
ActivityShopPanel._sUIResRootPath = "UI_Activity/"
|
||||
ActivityShopPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10108/Shop/ActivityShopPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.ShopCommon.ActivityShopCtrl"
|
||||
}
|
||||
}
|
||||
function ActivityShopPanel:Awake()
|
||||
self.nDefaultId = nil
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.nActId = tbParam[1]
|
||||
self.nDefaultId = tbParam[2]
|
||||
end
|
||||
self.actShopData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
end
|
||||
function ActivityShopPanel:OnEnable()
|
||||
end
|
||||
function ActivityShopPanel:OnDisable()
|
||||
end
|
||||
function ActivityShopPanel:OnDestroy()
|
||||
end
|
||||
return ActivityShopPanel
|
||||
@@ -0,0 +1,393 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local TechStoryCtrl = class("TechStoryCtrl", BaseCtrl)
|
||||
local ActivityAvgData = PlayerData.ActivityAvg
|
||||
TechStoryCtrl._mapNodeConfig = {
|
||||
svStory = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
ctlAvgRoot = {
|
||||
sNodeName = "goAvgInfoRoot",
|
||||
sCtrlName = "Game.UI.ActivityTheme.ActivityAvgInfoExCtrl"
|
||||
},
|
||||
t_fullscreen_blur_black = {},
|
||||
btnsnapshot = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtn_ClickCloseLevelInfoPanel"
|
||||
},
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
goChapterComplete = {},
|
||||
snapshot_complete = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickCloseCompete"
|
||||
},
|
||||
ctlgoEnemyInfo = {
|
||||
sNodeName = "goEnemyInfo",
|
||||
sCtrlName = "Game.UI.MainlineEx.MainlineMonsterInfoCtrl"
|
||||
},
|
||||
imgCharHead = {sComponentName = "Image"},
|
||||
txtCharName = {sComponentName = "TMP_Text"},
|
||||
goPersonalityRoot = {
|
||||
sNodeName = "grpUnderBar"
|
||||
},
|
||||
goPersonality = {
|
||||
sNodeName = "goPersonality",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
txtPersonalityPercent = {
|
||||
nCount = 3,
|
||||
sNodeName = "txtPersonalityPercent",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
txtPersonality1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Personality_Instinct"
|
||||
},
|
||||
txtPersonality2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Personality_Analyze"
|
||||
},
|
||||
txtPersonality3 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Personality_Chaos"
|
||||
}
|
||||
}
|
||||
TechStoryCtrl._mapEventConfig = {
|
||||
Story_Done = "OnEvent_Story_Done",
|
||||
SelectMainlineBattle = "OnEvent_SelectMainlineBattle",
|
||||
Story_RewardClosed = "OnEvent_Activity_Story_RewardClosed"
|
||||
}
|
||||
local UnlockConditionPriority = {
|
||||
[1] = "MustStoryIds",
|
||||
[2] = "OneofStoryIds",
|
||||
[3] = "MustEvIds",
|
||||
[4] = "OneofEvIds",
|
||||
[5] = "WorldLevel",
|
||||
[6] = "MustAchievementIds",
|
||||
[7] = "MustActivityLevel"
|
||||
}
|
||||
function TechStoryCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.storyNodePos = {-23.7, -107}
|
||||
self.tbGridTimer = {}
|
||||
self.tbPlayedAnim = {}
|
||||
self.nScrollTime = 0.5
|
||||
self.bInit = false
|
||||
end
|
||||
function TechStoryCtrl:OnEnable()
|
||||
self:RefreshPanel()
|
||||
end
|
||||
function TechStoryCtrl.FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
function TechStoryCtrl.OnDisable()
|
||||
end
|
||||
function TechStoryCtrl:RefreshPanel()
|
||||
self:RefreshStoryList()
|
||||
self:RefreshPersonality()
|
||||
end
|
||||
function TechStoryCtrl:RefreshPersonality()
|
||||
local cfg = ConfigTable.GetData("ActivityStoryChapter", self.nChapterId)
|
||||
local personalityId = cfg.PersonalityId
|
||||
self._mapNode.goPersonalityRoot:SetActive(0 < personalityId)
|
||||
if personalityId <= 0 then
|
||||
return
|
||||
end
|
||||
local tbRetPercent, sTitle, sFace, tbPData, nTotalCount, sHead = PlayerData.ActivityAvg:CalcPersonality(personalityId, self.nChapterId, true)
|
||||
NovaAPI.SetPersonalityRing(self._mapNode.goPersonality, tbRetPercent)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCharName, sTitle)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPersonalityPercent[1], math.floor(tbRetPercent[1] * 100) .. "%")
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPersonalityPercent[2], math.floor(tbRetPercent[2] * 100) .. "%")
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPersonalityPercent[3], math.floor(tbRetPercent[3] * 100) .. "%")
|
||||
local sIcon = "Icon/PlayerHead/" .. sHead
|
||||
self:SetPngSprite(self._mapNode.imgCharHead, sIcon)
|
||||
end
|
||||
function TechStoryCtrl:RefreshStoryList()
|
||||
self.tbPlayedAnim = {}
|
||||
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
|
||||
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
|
||||
return
|
||||
end
|
||||
local recentStoryId = ActivityAvgData:GetRecentStoryId(self.nChapterId)
|
||||
local recentIndex = 1
|
||||
for i = 1, #self.tbAllStory do
|
||||
if self.tbAllStory[i] == recentStoryId then
|
||||
recentIndex = i
|
||||
break
|
||||
end
|
||||
end
|
||||
self.curIndex = recentIndex
|
||||
self._mapNode.svStory:SetAnim(0.07)
|
||||
self._mapNode.svStory:Init(#self.tbAllStory, self, self.OnRefreshGrid)
|
||||
local time = self.bInit and 0 or self.nScrollTime
|
||||
self:AddTimer(1, 0.1, function()
|
||||
self._mapNode.svStory:SetScrollGridPos(recentIndex, time, 0)
|
||||
self.bInit = true
|
||||
end, true, true, true)
|
||||
end
|
||||
function TechStoryCtrl:RefreshGridInfo(grid, gridIndex)
|
||||
local storyId = self.tbAllStory[gridIndex]
|
||||
local avgcfg = ConfigTable.GetData("ActivityStory", storyId)
|
||||
local goInstanceID = grid:GetInstanceID()
|
||||
local btnGrid = grid.transform:Find("btnGrid"):GetComponent("UIButton")
|
||||
local RootNode = grid.transform:Find("btnGrid/AnimRoot/RootNode")
|
||||
RootNode.gameObject:SetActive(true)
|
||||
local newRoot = RootNode:Find("imgZs5")
|
||||
local dotweenGear = newRoot:Find("imgZs4").gameObject
|
||||
if gridIndex == #self.tbAllStory then
|
||||
RootNode.gameObject:SetActive(false)
|
||||
RootNode = grid.transform:Find("btnGrid/AnimRoot/RootNode2")
|
||||
RootNode.gameObject:SetActive(true)
|
||||
newRoot = RootNode
|
||||
dotweenGear = newRoot:Find("imgZs3").gameObject
|
||||
else
|
||||
local RootNode2 = grid.transform:Find("btnGrid/AnimRoot/RootNode2")
|
||||
RootNode2.gameObject:SetActive(false)
|
||||
end
|
||||
local imgStory = newRoot:Find("imgStory"):GetComponent("Image")
|
||||
local goNotOpen = newRoot:Find("goNotOpen").gameObject
|
||||
local txtLevel = newRoot:Find("txtLevel"):GetComponent("TMP_Text")
|
||||
local txtLevelLock = goNotOpen.transform:Find("txtLevelLock"):GetComponent("TMP_Text")
|
||||
local imgStoryTitleBg = newRoot:Find("imgStoryTitleBg")
|
||||
local imgBattleTitleBg = newRoot:Find("imgBattleTitleBg")
|
||||
local RedDot = RootNode:Find("RedDot").gameObject
|
||||
local goLock = RootNode:Find("goLockState").gameObject
|
||||
local goComplete = txtLevel.transform:Find("goComplete").gameObject
|
||||
local goImgTime = RootNode.transform:Find("imgTime")
|
||||
local txtTime = goImgTime:Find("txtTime"):GetComponent("TMP_Text")
|
||||
local txtTitle = RootNode:Find("tmpGroupDone"):GetComponent("TMP_Text")
|
||||
local txtComplete = goComplete.transform:Find("imgBg/txtComplete"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtComplete, ConfigTable.GetUIText("RoguelikeBuild_Manage_FilterPass"))
|
||||
local isUnlock, tbResult = ActivityAvgData:IsUnlock(avgcfg.ConditionId)
|
||||
local isReaded = ActivityAvgData:IsStoryReaded(storyId)
|
||||
local bOpen, nOpenTime = ActivityAvgData:IsOpen(avgcfg.StoryId)
|
||||
NovaAPI.CtrlDotweenAnimation(dotweenGear, isUnlock and bOpen and 1 or 0)
|
||||
imgStory.gameObject:SetActive(true)
|
||||
if bOpen and isUnlock then
|
||||
self:SetPngSprite(imgStory, avgcfg.Icon)
|
||||
else
|
||||
self:SetPngSprite(imgStory, string.format("Icon/ActivityStory/ep_event08_00"))
|
||||
end
|
||||
NovaAPI.SetTMPText(txtTitle, avgcfg.Title)
|
||||
NovaAPI.SetTMPText(txtLevel, avgcfg.Index)
|
||||
NovaAPI.SetTMPText(txtLevelLock, avgcfg.Index)
|
||||
txtTitle.gameObject:SetActive(isUnlock and bOpen)
|
||||
goImgTime.gameObject:SetActive(not bOpen)
|
||||
goComplete.gameObject:SetActive(isUnlock and isReaded and bOpen)
|
||||
goLock.gameObject:SetActive(not isUnlock and bOpen)
|
||||
goNotOpen.gameObject:SetActive(not bOpen)
|
||||
imgBattleTitleBg.gameObject:SetActive(avgcfg.IsBattle and isUnlock and bOpen)
|
||||
imgStoryTitleBg.gameObject:SetActive(not avgcfg.IsBattle and isUnlock and bOpen)
|
||||
if avgcfg.IsBattle == true then
|
||||
local txtPlot = imgBattleTitleBg:Find("txtPlot"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtPlot, ConfigTable.GetUIText("SelectTeam_StartBattle"))
|
||||
else
|
||||
local txtPlot = imgStoryTitleBg:Find("txtPlot"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtPlot, ConfigTable.GetUIText("TowerDef_Story"))
|
||||
end
|
||||
if not bOpen then
|
||||
local strTime = self:GetRemainTimeStr(nOpenTime, avgcfg.DayOpen)
|
||||
if self.tbGridTimer[goInstanceID] ~= nil then
|
||||
self.tbGridTimer[goInstanceID]:Cancel()
|
||||
self.tbGridTimer[goInstanceID] = nil
|
||||
end
|
||||
self.tbGridTimer[goInstanceID] = self:AddTimer(0, 1, function()
|
||||
local strTimeNew, bLock = self:GetRemainTimeStr(nOpenTime, avgcfg.DayOpen)
|
||||
if bLock then
|
||||
NovaAPI.SetTMPText(txtTime, strTimeNew)
|
||||
else
|
||||
self:RefreshStoryList()
|
||||
end
|
||||
end, true, true, true)
|
||||
NovaAPI.SetTMPText(txtTime, strTime)
|
||||
end
|
||||
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
|
||||
nActGroupId,
|
||||
self.nActId,
|
||||
avgcfg.Id
|
||||
}, RedDot, nil, nil, true)
|
||||
local clickFuc = function()
|
||||
if not bOpen or self.bCantClick then
|
||||
return
|
||||
end
|
||||
if isUnlock then
|
||||
local bNew = not isReaded
|
||||
self.avgId = avgcfg.StoryId
|
||||
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
|
||||
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
|
||||
self.curIndex = gridIndex
|
||||
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
|
||||
ActivityAvgData:RefreshAvgRedDot()
|
||||
elseif tbResult ~= nil then
|
||||
local lockTxt = ""
|
||||
for i = 1, #tbResult do
|
||||
local value = tbResult[i]
|
||||
if value[1] == false then
|
||||
if UnlockConditionPriority[i] == "MustStoryIds" then
|
||||
do
|
||||
local tbStoryIds = value[2]
|
||||
for k, v in pairs(tbStoryIds) do
|
||||
if v == false then
|
||||
local storyData = ConfigTable.GetData("ActivityStory", k)
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "OneofStoryIds" then
|
||||
do
|
||||
local tbStoryIds = value[2]
|
||||
for k, v in pairs(tbStoryIds) do
|
||||
if v == false then
|
||||
local storyData = ConfigTable.GetData("ActivityStory", k)
|
||||
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if lockTxt == "" then
|
||||
for k, _v in pairs(tbStoryIds) do
|
||||
local storyData = ConfigTable.GetData("ActivityStory", k)
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "MustEvIds" then
|
||||
lockTxt = ConfigTable.GetUIText("Story_UnlockClueCondition")
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "OneofEvIds" then
|
||||
lockTxt = ConfigTable.GetUIText("Story_UnlockClueCondition")
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "WorldLevel" then
|
||||
do
|
||||
local level = value[2]
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockWorldLv") or "", level)
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "MustAchievementIds" then
|
||||
if self.bHasAchievementData == true then
|
||||
local tbAchievementList = value[2]
|
||||
for k, v in pairs(tbAchievementList) do
|
||||
if v == false then
|
||||
local achievementId = k
|
||||
local achievement = ConfigTable.GetData("Achievement", achievementId)
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockAchievement") or "", achievement.Title) .. "\n" .. "(" .. achievement.Desc .. ")"
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "MustActivityLevel" then
|
||||
local levelId = value[2]
|
||||
if 0 < levelId then
|
||||
local levelData = ConfigTable.GetData("ActivityLevelsLevel", levelId)
|
||||
if levelData then
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("ActivityStory_UnlockActivityLevel"), levelData.Name)
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = lockTxt
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
end
|
||||
btnGrid.onClick:RemoveAllListeners()
|
||||
btnGrid.onClick:AddListener(clickFuc)
|
||||
end
|
||||
function TechStoryCtrl:OnRefreshGrid(grid, index)
|
||||
local gridIndex = index + 1
|
||||
local rectTransform = grid.transform:GetComponent("RectTransform")
|
||||
local pos = rectTransform.anchoredPosition
|
||||
pos.y = gridIndex % 2 == 0 and pos.y + self.storyNodePos[1] or pos.y + self.storyNodePos[2]
|
||||
rectTransform.anchoredPosition = pos
|
||||
local normalRoot = grid.transform:Find("Normal")
|
||||
self:RefreshGridInfo(normalRoot.gameObject, gridIndex)
|
||||
normalRoot.gameObject:SetActive(true)
|
||||
if not self.tbPlayedAnim[gridIndex] then
|
||||
self.tbPlayedAnim[gridIndex] = true
|
||||
local animRoot = grid.transform:Find("Normal/btnGrid/AnimRoot")
|
||||
local anim = animRoot and animRoot:GetComponent("Animator")
|
||||
if anim then
|
||||
anim:Play("TechStoryPanel_Story_in")
|
||||
end
|
||||
end
|
||||
end
|
||||
function TechStoryCtrl:GetRemainTimeStr(nOpenTime, openDay)
|
||||
local timeStr = ""
|
||||
local clientMgr = CS.ClientManager.Instance
|
||||
local curTime = clientMgr.serverTimeStamp
|
||||
local openTime = clientMgr:GetNextRefreshTime(nOpenTime) - 86400
|
||||
local nRemainTime = openTime + openDay * 86400 - curTime
|
||||
local day = math.floor(nRemainTime / 86400)
|
||||
local hour = math.floor(nRemainTime / 3600)
|
||||
local min = math.floor((nRemainTime - hour * 3600) / 60)
|
||||
local sec = nRemainTime - hour * 3600 - min * 60
|
||||
if 0 < day then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Day_Color_Common"), "08d3d4", day)
|
||||
elseif 0 < hour then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour_Color_Common"), "08d3d4", hour)
|
||||
elseif 0 < min then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color_Common"), "08d3d4", min)
|
||||
elseif 0 < sec then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color_Common"), "08d3d4", sec)
|
||||
end
|
||||
return timeStr, 0 < nRemainTime
|
||||
end
|
||||
function TechStoryCtrl.OnBtn_ClickBack()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.TechStory)
|
||||
end
|
||||
function TechStoryCtrl.OnBtn_ClickHome()
|
||||
PanelManager.Home()
|
||||
end
|
||||
function TechStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
|
||||
self._mapNode.t_fullscreen_blur_black:SetActive(false)
|
||||
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
|
||||
self._mapNode.goChapterComplete:SetActive(false)
|
||||
end
|
||||
function TechStoryCtrl:OnEvent_Story_Done(bHasReward)
|
||||
self:RefreshPanel()
|
||||
if bHasReward then
|
||||
self.bCantClick = true
|
||||
end
|
||||
end
|
||||
function TechStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
|
||||
local OpenPanel = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
|
||||
end
|
||||
if bConfirm then
|
||||
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
|
||||
end
|
||||
end
|
||||
function TechStoryCtrl:OnEvent_Activity_Story_RewardClosed()
|
||||
self.bCantClick = false
|
||||
if self.curIndex == #self.tbAllStory then
|
||||
self._mapNode.goChapterComplete:SetActive(true)
|
||||
end
|
||||
end
|
||||
function TechStoryCtrl:OnBtn_ClickCloseCompete()
|
||||
self._mapNode.goChapterComplete:SetActive(false)
|
||||
end
|
||||
return TechStoryCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local TechStoryPanel = class("TechStoryPanel", BasePanel)
|
||||
TechStoryPanel._sUIResRootPath = "UI_Activity/"
|
||||
TechStoryPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10108/Story/TechStoryPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10108.Story.TechStoryCtrl"
|
||||
}
|
||||
}
|
||||
function TechStoryPanel:Awake()
|
||||
end
|
||||
function TechStoryPanel:OnEnable()
|
||||
end
|
||||
function TechStoryPanel:OnDisable()
|
||||
end
|
||||
function TechStoryPanel:OnDestroy()
|
||||
end
|
||||
function TechStoryPanel:OnRelease()
|
||||
end
|
||||
return TechStoryPanel
|
||||
@@ -0,0 +1,16 @@
|
||||
local TechTaskPanel = class("TechTaskPanel", BasePanel)
|
||||
TechTaskPanel._sUIResRootPath = "UI_Activity/"
|
||||
TechTaskPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10108/Task.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.TaskCommon.TaskCommonCtrl_01"
|
||||
}
|
||||
}
|
||||
local tbImgDbType = {SizeDelta = 1, FillAmount = 2}
|
||||
function TechTaskPanel:Awake()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" and tbParam[3] == nil then
|
||||
tbParam[3] = tbImgDbType.FillAmount
|
||||
end
|
||||
end
|
||||
return TechTaskPanel
|
||||
@@ -0,0 +1,638 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local TechThemeCtrl = class("TechThemeCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
TechThemeCtrl._mapNodeConfig = {
|
||||
btnEntrance_ = {
|
||||
nCount = 5,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickActivityEntrance"
|
||||
},
|
||||
imgRemaineTime = {},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtActivityDate = {sComponentName = "TMP_Text"},
|
||||
imgEnd = {},
|
||||
txtActivityEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgMiniGame = {sComponentName = "Image"},
|
||||
txtMiniGame = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Mini_Game_Cookie"
|
||||
},
|
||||
imgMiniGameEnd = {},
|
||||
txtMiniGameEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Mini_Game_Cookie"
|
||||
},
|
||||
txtMiniGame_End = {},
|
||||
txtTask = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Task"
|
||||
},
|
||||
txtTaskProgress = {sComponentName = "TMP_Text"},
|
||||
imgTaskActivityTime = {},
|
||||
txtTaskActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgStory = {sComponentName = "Image"},
|
||||
txtStory = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Story"
|
||||
},
|
||||
txtStory_End = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Story"
|
||||
},
|
||||
goStoryEnd = {},
|
||||
txtStoryEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtMiniGameEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtTaskEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtShopEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtShop = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Shop"
|
||||
},
|
||||
imgShopActivityTime = {},
|
||||
txtShopActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtLevel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Level"
|
||||
},
|
||||
txtLevel_End = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Level"
|
||||
},
|
||||
goLevelEnd = {},
|
||||
txtLevelEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgLevelActivityUnlockTime = {},
|
||||
txtLevelActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgLevelEnd = {},
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
imgMiniGameActivityUnlockTime = {},
|
||||
txtMiniGameActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgTaskBgEnd = {},
|
||||
txtTaskEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Task"
|
||||
},
|
||||
txtTaskProgress_End = {},
|
||||
imgTaskActivityUnlockTime = {},
|
||||
txtTaskActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgStoryActivityTime = {},
|
||||
txtStoryActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgStoryActivityUnlockTime = {},
|
||||
txtStoryActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgShopActivityUnlockTime = {},
|
||||
txtShopActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgLevelActivityTime = {},
|
||||
txtLevelActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgMiniGameActivityTime = {},
|
||||
txtMiniGameActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtShopEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Shop"
|
||||
},
|
||||
imgShopEnd = {},
|
||||
txtShop_End = {},
|
||||
txtTaskProgressEnd = {sComponentName = "TMP_Text"},
|
||||
dbTaskEnd = {},
|
||||
miniGameRedDot = {},
|
||||
redDotEntrance2 = {},
|
||||
storyRedDot = {},
|
||||
reddotLevel = {},
|
||||
goMiniGameEnd = {},
|
||||
imgStoryEnd = {},
|
||||
animGearShop = {
|
||||
sNodeName = "imgDecoShop",
|
||||
nCount = 2
|
||||
},
|
||||
animGearStory = {
|
||||
sNodeName = "imgDecoStory",
|
||||
nCount = 4
|
||||
},
|
||||
animGearBattle = {
|
||||
sNodeName = "imgDecoBattle",
|
||||
nCount = 2
|
||||
}
|
||||
}
|
||||
TechThemeCtrl._mapEventConfig = {}
|
||||
local ActivityState = {
|
||||
NotOpen = 1,
|
||||
Open = 2,
|
||||
Closed = 3
|
||||
}
|
||||
function TechThemeCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.TechData = PlayerData.Activity:GetActivityGroupDataById(self.nActId)
|
||||
if self.TechData ~= nil then
|
||||
self.ActivityGroupCfg = self.TechData.actGroupConfig
|
||||
end
|
||||
for k, v in pairs(self._mapNode.btnEntrance_) do
|
||||
v.interactable = false
|
||||
end
|
||||
end
|
||||
function TechThemeCtrl:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
local sAnimName = "TechPanel_in"
|
||||
local sSoundName = "Mode_Rouguang_activity"
|
||||
if self.animRoot ~= nil then
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
sAnimName = "TechPanel_in1"
|
||||
sSoundName = "Mode_Rouguang_activity_short"
|
||||
end
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
self.animRoot:Play(sAnimName, 0, 0)
|
||||
CS.WwiseAudioManager.Instance:PlaySound(sSoundName)
|
||||
local nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {sAnimName})
|
||||
self:AddTimer(1, nAnimLength, function()
|
||||
for k, v in pairs(self._mapNode.btnEntrance_) do
|
||||
v.interactable = true
|
||||
end
|
||||
end, true, true, true)
|
||||
end
|
||||
function TechThemeCtrl:OnEnable()
|
||||
self:RefreshPanel()
|
||||
for i = 1, 5 do
|
||||
local actData = self.TechData:GetActivityDataByIndex(i)
|
||||
local nActId = actData ~= nil and actData.ActivityId or 0
|
||||
local state = self.tbActState[nActId]
|
||||
if nActId ~= nil and 0 < nActId and state ~= nil then
|
||||
if i == AllEnum.ActivityThemeFuncIndex.Task then
|
||||
if state == ActivityState.Closed then
|
||||
self._mapNode.redDotEntrance2:SetActive(false)
|
||||
else
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.redDotEntrance2)
|
||||
end
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Level then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.reddotLevel)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.storyRedDot)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.MiniGame then
|
||||
local bOld = LocalData.GetPlayerLocalData("Activity_MiniGame_10108_New") or state ~= ActivityState.Open
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_GroupNew_MiniGame, {
|
||||
self.nActId
|
||||
}, not bOld)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_MiniGame, {
|
||||
self.nActId
|
||||
}, self._mapNode.miniGameRedDot)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function TechThemeCtrl:OnDisable()
|
||||
if nil ~= self.minigameRemainTimer then
|
||||
TimerManager.Remove(self.minigameRemainTimer)
|
||||
self.minigameRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.remainTimer then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
end
|
||||
if nil ~= self.shopRemainTimer then
|
||||
TimerManager.Remove(self.shopRemainTimer)
|
||||
self.shopRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.levelRemainTimer then
|
||||
TimerManager.Remove(self.levelRemainTimer)
|
||||
self.levelRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.avgRemainTimer then
|
||||
TimerManager.Remove(self.avgRemainTimer)
|
||||
self.avgRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.taskRemainTimer then
|
||||
TimerManager.Remove(self.taskRemainTimer)
|
||||
self.taskRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.eatingAnimationTimer then
|
||||
TimerManager.Remove(self.eatingAnimationTimer)
|
||||
self.eatingAnimationTimer = nil
|
||||
end
|
||||
end
|
||||
function TechThemeCtrl:RefreshPanel()
|
||||
if self.TechData == nil or self.ActivityGroupCfg == nil then
|
||||
return
|
||||
end
|
||||
self:RefreshTime()
|
||||
self:RefreshButtonState()
|
||||
end
|
||||
function TechThemeCtrl:RefreshTime()
|
||||
local bOpen = self.TechData:CheckActivityGroupOpen()
|
||||
if bOpen then
|
||||
self:RefreshRemainTime(self.TechData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(self.TechData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
end
|
||||
self._mapNode.imgRemaineTime:SetActive(bOpen)
|
||||
self._mapNode.imgEnd:SetActive(not bOpen)
|
||||
local nOpenMonth, nOpenDay, nEndMonth, nEndDay, nOpenYear, nEndYear = self.TechData:GetActGroupDate()
|
||||
local strOpenDay = string.format("%d", nOpenDay)
|
||||
local strEndDay = string.format("%d", nEndDay)
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityDate, dateStr)
|
||||
end
|
||||
function TechThemeCtrl:RefreshRemainTime(endTime, txtComp)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(txtComp, sTimeStr)
|
||||
return remainTime
|
||||
end
|
||||
function TechThemeCtrl:RefreshRemainOpenTime(openTime)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time_Min") or "", min)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time") or "", hour)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time_Day") or "", day)
|
||||
end
|
||||
return sTimeStr
|
||||
end
|
||||
function TechThemeCtrl:RefreshButtonState()
|
||||
self.tbActState = {}
|
||||
for i = 1, 5 do
|
||||
local actData = self.TechData:GetActivityDataByIndex(i)
|
||||
if i == AllEnum.ActivityThemeFuncIndex.MiniGame then
|
||||
self:RefreshMiniGameButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Task then
|
||||
self:RefreshTaskButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Level then
|
||||
self:RefreshLevelButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Shop then
|
||||
self:RefreshShopButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
self:RefreshStoryButtonState(actData)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TechThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans, refreshFunc)
|
||||
local countDowmTimer
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
local state = ActivityState.NotOpen
|
||||
local bShowCountDown = false
|
||||
if activityData ~= nil then
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
if activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
elseif curTime >= openTime and curTime <= endTime then
|
||||
state = ActivityState.Open
|
||||
else
|
||||
state = ActivityState.Closed
|
||||
end
|
||||
elseif activityData.EndType == GameEnum.activityEndType.NoLimit then
|
||||
state = ActivityState.Open
|
||||
if activityData.StartTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
end
|
||||
end
|
||||
end
|
||||
if state == ActivityState.NotOpen then
|
||||
if nil == timer and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local fcTimer = function()
|
||||
curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
if 0 < remainTime then
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
local txtUnlock = imgTrans:GetComponentInChildren(typeof(CS.TMPro.TMP_Text))
|
||||
if txtUnlock ~= nil then
|
||||
NovaAPI.SetTMPText(txtUnlock, sTimeStr)
|
||||
end
|
||||
else
|
||||
imgTrans:SetActive(false)
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
refreshFunc(actData)
|
||||
self:RefreshActivityData()
|
||||
end
|
||||
end
|
||||
fcTimer()
|
||||
countDowmTimer = self:AddTimer(0, 1, fcTimer, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Open and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
do
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
if endTime > self.TechData:GetActGroupEndTime() then
|
||||
bShowCountDown = true
|
||||
elseif endTime < self.TechData:GetActGroupEndTime() then
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
if timer == nil and bShowCountDown then
|
||||
self:RefreshRemainTime(endTime, txtTrans)
|
||||
do
|
||||
local fcTimer = function()
|
||||
local remainTime = self:RefreshRemainTime(endTime, txtTrans)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
refreshFunc(actData)
|
||||
end
|
||||
end
|
||||
fcTimer()
|
||||
countDowmTimer = self:AddTimer(0, 1, fcTimer, true, true, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return state, bShowCountDown, countDowmTimer
|
||||
end
|
||||
function TechThemeCtrl:RefreshMiniGameButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
self:RefreshMiniGameButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.minigameRemainTimer, self._mapNode.txtMiniGameActivityTime, self._mapNode.imgMiniGameActivityUnlockTime, refreshFunc)
|
||||
if self.minigameRemainTimer == nil then
|
||||
self.minigameRemainTimer = countDowmTimer
|
||||
end
|
||||
self._mapNode.imgMiniGameActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.imgMiniGameActivityTime.gameObject:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgMiniGameEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtMiniGame_End:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtMiniGameEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.goMiniGameEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
if state ~= ActivityState.Open then
|
||||
end
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function TechThemeCtrl:RefreshTaskButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local actInsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
if actInsData ~= nil then
|
||||
actInsData:RefreshTaskRedDot()
|
||||
end
|
||||
self:RefreshTaskButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.taskRemainTimer, self._mapNode.txtTaskActivityTime, self._mapNode.imgTaskActivityUnlockTime, refreshFunc)
|
||||
if self.taskRemainTimer == nil then
|
||||
self.taskRemainTimer = countDowmTimer
|
||||
end
|
||||
if state == ActivityState.Closed and actInsData ~= nil then
|
||||
actInsData:RefreshTaskRedDot()
|
||||
end
|
||||
self._mapNode.imgTaskActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.txtTaskProgress_End:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.dbTaskEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskBgEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtTaskEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self.tbActState[activityId] = state
|
||||
local ActivityTaskData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local nDone, nTotal = 0, 0
|
||||
if ActivityTaskData ~= nil then
|
||||
nDone, nTotal = ActivityTaskData:CalcTotalProgress()
|
||||
end
|
||||
local progress = string.format("%d/%d", nDone, nTotal)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskProgress, progress)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskProgressEnd, progress)
|
||||
end
|
||||
end
|
||||
function TechThemeCtrl:RefreshStoryButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
local avgData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if nil ~= avgData then
|
||||
avgData:RefreshAvgRedDot()
|
||||
end
|
||||
self:RefreshStoryButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.avgRemainTimer, self._mapNode.txtStoryActivityTime, self._mapNode.imgStoryActivityUnlockTime, refreshFunc)
|
||||
if self.avgRemainTimer == nil then
|
||||
self.avgRemainTimer = countDowmTimer
|
||||
end
|
||||
if state == ActivityState.Closed then
|
||||
local avgData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if nil ~= avgData then
|
||||
avgData:RefreshAvgRedDot()
|
||||
end
|
||||
end
|
||||
self._mapNode.imgStoryActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgStoryActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.goStoryEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgStoryEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtStory_End.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
local nDotweenStatus = state == ActivityState.Closed and 0 or 1
|
||||
for i = 1, #self._mapNode.animGearStory do
|
||||
NovaAPI.CtrlDotweenAnimation(self._mapNode.animGearStory[i], nDotweenStatus)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TechThemeCtrl:RefreshLevelButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
local activityLevelsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if nil ~= activityLevelsData then
|
||||
activityLevelsData:ChangeAllRedHot()
|
||||
end
|
||||
self:RefreshLevelButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.levelRemainTimer, self._mapNode.txtLevelActivityTime, self._mapNode.imgLevelActivityUnlockTime, refreshFunc)
|
||||
if self.levelRemainTimer == nil then
|
||||
self.levelRemainTimer = countDowmTimer
|
||||
end
|
||||
if state == ActivityState.Closed then
|
||||
local activityLevelsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if nil ~= activityLevelsData then
|
||||
activityLevelsData:ChangeAllRedHot()
|
||||
end
|
||||
end
|
||||
self._mapNode.imgLevelActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgLevelActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.imgLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.goLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtLevel_End.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
local nDotweenStatus = state == ActivityState.Closed and 0 or 1
|
||||
for i = 1, #self._mapNode.animGearBattle do
|
||||
NovaAPI.CtrlDotweenAnimation(self._mapNode.animGearBattle[i], nDotweenStatus)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TechThemeCtrl:RefreshShopButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
self:RefreshShopButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.shopRemainTimer, self._mapNode.txtShopActivityTime, self._mapNode.imgShopActivityUnlockTime, refreshFunc)
|
||||
if self.shopRemainTimer == nil then
|
||||
self.shopRemainTimer = countDowmTimer
|
||||
end
|
||||
self._mapNode.imgShopActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgShopActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.txtShopEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgShopEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtShop_End:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
local nDotweenStatus = state == ActivityState.Closed and 0 or 1
|
||||
for i = 1, #self._mapNode.animGearShop do
|
||||
NovaAPI.CtrlDotweenAnimation(self._mapNode.animGearShop[i], nDotweenStatus)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TechThemeCtrl:RequireActiviyData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
local callFunc = function()
|
||||
self.bRequireSucc = true
|
||||
self:RefreshPanel()
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_detail_req, {}, nil, callFunc)
|
||||
self.bRequiredActData = true
|
||||
self:AddTimer(1, 1, function()
|
||||
self.bRequiredActData = false
|
||||
end, true, true, true)
|
||||
end
|
||||
function TechThemeCtrl:RefreshActivityData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
self:AddTimer(1, 3, self.RequireActiviyData, true, true, true)
|
||||
end
|
||||
function TechThemeCtrl:OnBtn_ClickActivityEntrance(btn, nIndex)
|
||||
local actData = self.TechData:GetActivityDataByIndex(nIndex)
|
||||
local state = self.tbActState[actData.ActivityId]
|
||||
if nil == state then
|
||||
return
|
||||
end
|
||||
if state == ActivityState.Closed then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
|
||||
return
|
||||
elseif state == ActivityState.NotOpen then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
return
|
||||
elseif state == ActivityState.Open then
|
||||
local activityData = PlayerData.Activity:GetActivityDataById(actData.ActivityId)
|
||||
if activityData == nil then
|
||||
local bHint = true
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
bHint = not PlayerData.ActivityAvg:HasActivityData(actData.ActivityId)
|
||||
end
|
||||
if self.bRequiredActData and bHint then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Data_Refreshing"))
|
||||
return
|
||||
end
|
||||
if bHint then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
self:RequireActiviyData()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
if actData.PanelId ~= nil and ActivityState.Open == state then
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.MiniGame then
|
||||
LocalData.SetPlayerLocalData("Activity_MiniGame_10108_New", true)
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_GroupNew_MiniGame, {
|
||||
actData.ActivityId
|
||||
}, false)
|
||||
local nRandom = math.random(46, 47)
|
||||
local func = function()
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId, self.nActId)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, nRandom, func)
|
||||
elseif self.ActivityGroupCfg.TransitionId ~= nil and self.ActivityGroupCfg.TransitionId > 0 then
|
||||
EventManager.Hit(EventId.SetTransition, self.ActivityGroupCfg.TransitionId, function()
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
|
||||
end)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
|
||||
end
|
||||
end
|
||||
end
|
||||
return TechThemeCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local TechThemePanel = class("TechThemePanel", BasePanel)
|
||||
TechThemePanel._sUIResRootPath = "UI_Activity/"
|
||||
TechThemePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10108/TechPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10108.TechThemeCtrl"
|
||||
}
|
||||
}
|
||||
function TechThemePanel:Awake()
|
||||
end
|
||||
function TechThemePanel:OnEnable()
|
||||
end
|
||||
function TechThemePanel:OnDisable()
|
||||
end
|
||||
function TechThemePanel:OnDestroy()
|
||||
end
|
||||
function TechThemePanel:OnRelease()
|
||||
end
|
||||
return TechThemePanel
|
||||
@@ -0,0 +1,622 @@
|
||||
local ActivityLevelsSelectCtrl = class("ActivityLevelsSelectCtrl", BaseCtrl)
|
||||
local mapToggle = {
|
||||
[1] = GameEnum.diffculty.Diffculty_1,
|
||||
[2] = GameEnum.diffculty.Diffculty_2,
|
||||
[3] = GameEnum.diffculty.Diffculty_3,
|
||||
[4] = GameEnum.diffculty.Diffculty_4,
|
||||
[5] = GameEnum.diffculty.Diffculty_5,
|
||||
[6] = GameEnum.diffculty.Diffculty_6,
|
||||
[7] = GameEnum.diffculty.Diffculty_7,
|
||||
[8] = GameEnum.diffculty.Diffculty_8,
|
||||
[9] = GameEnum.diffculty.Diffculty_9,
|
||||
[10] = GameEnum.diffculty.Diffculty_10
|
||||
}
|
||||
local colorConditionsUnLock = Color(0.8274509803921568, 0.8941176470588236, 0.9803921568627451, 0.5)
|
||||
local colorConditionsLock = Color(0.8274509803921568, 0.8941176470588236, 0.9803921568627451, 1)
|
||||
ActivityLevelsSelectCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
goEnemyInfo = {
|
||||
sCtrlName = "Game.UI.MainlineEx.MainlineMonsterInfoCtrl"
|
||||
},
|
||||
togTypeExplore = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TogTypeExplore"
|
||||
},
|
||||
togTypeExploreCtrl = {
|
||||
sNodeName = "togTypeExplore",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
lockExplore = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClick_BtnLockExplore"
|
||||
},
|
||||
redExplore = {},
|
||||
togTypeAdventure = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TogTypeAdventure"
|
||||
},
|
||||
togTypeAdventureCtrl = {
|
||||
sNodeName = "togTypeAdventure",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
lockAdventure = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClick_BtnLockAdventure"
|
||||
},
|
||||
redAdventure = {},
|
||||
rtToggles = {
|
||||
sNodeName = "srToggle",
|
||||
sComponentName = "UIScrollRect"
|
||||
},
|
||||
tog = {
|
||||
sComponentName = "UIButton",
|
||||
nCount = 10,
|
||||
callback = "OnBtnClick_Tog"
|
||||
},
|
||||
togCtrl = {
|
||||
sNodeName = "tog",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl",
|
||||
nCount = 10
|
||||
},
|
||||
togAniRoot = {sNodeName = "rt_Toggle", sComponentName = "Animator"},
|
||||
txtRecommendLevel = {
|
||||
sNodeName = "txtSuggestLevel",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
txtTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "InfinityTower_Recommend_Lv"
|
||||
},
|
||||
txtBuildTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "InfinityTower_Recommend_Construct"
|
||||
},
|
||||
imgBuild = {sComponentName = "Image"},
|
||||
TMPName = {sComponentName = "TMP_Text"},
|
||||
detailDesc = {sComponentName = "TMP_Text"},
|
||||
btnEnemyInfo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_EnemyInfo"
|
||||
},
|
||||
tex_EnemyInfo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Instance_EnemyInfo"
|
||||
},
|
||||
txtTitleTarget = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RogueBoss_Pause_Target"
|
||||
},
|
||||
txtReward = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Level_Award"
|
||||
},
|
||||
Task = {sComponentName = "Transform", nCount = 3},
|
||||
rewardRoot = {sComponentName = "Transform"},
|
||||
btn_itemTemp = {},
|
||||
btnListRoot = {},
|
||||
btnRaid = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickBtnRaid"
|
||||
},
|
||||
imgRaidUnlockMask = {},
|
||||
txtBtnRaid = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Raid_Title_Raid"
|
||||
},
|
||||
TMPRaidUnlockHint = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Raid_Btn_Cond"
|
||||
},
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickBtnGo"
|
||||
},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Maninline_Btn_Go"
|
||||
},
|
||||
goCoin = {},
|
||||
txtTicketsCount = {sComponentName = "TMP_Text"},
|
||||
ListConditions = {},
|
||||
ListConditionsObj = {
|
||||
sNodeName = "Conditions_",
|
||||
nCount = 2
|
||||
}
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapEventConfig = {
|
||||
[EventId.UpdateEnergy] = "OnEvent_UpdateEnergy"
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapRedDotConfig = {}
|
||||
function ActivityLevelsSelectCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Explore
|
||||
self.tabRewardList = {}
|
||||
self.AniRoot = self.gameObject:GetComponent("Animator")
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
|
||||
if bInActGroup then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Explore, {nActGroupId}, self._mapNode.redExplore)
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure, {nActGroupId}, self._mapNode.redAdventure)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEnable()
|
||||
self.timeTab = {}
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
self.SelectTogPreLvLock = nil
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in")
|
||||
self:Init()
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnDisable()
|
||||
self.timeTab = {}
|
||||
for i = 1, #self.tabRewardList do
|
||||
local go = self.tabRewardList[i].gameObject
|
||||
local btnSelect = self.tabRewardList[i].gameObject:GetComponent("UIButton")
|
||||
btnSelect.onClick:RemoveAllListeners()
|
||||
self:UnbindCtrlByNode(self.tabRewardList[i])
|
||||
destroy(go)
|
||||
end
|
||||
self.tabRewardList = {}
|
||||
self.SelectTogPreLvLock = nil
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnDestroy(...)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:Init()
|
||||
self.activityLevelsData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
self:RefreshTogTypeCount()
|
||||
self:Refresh()
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:Refresh()
|
||||
self.nLevelType = self.activityLevelsData:GetDefaultSelectionType()
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogTypeCount()
|
||||
self._mapNode.togTypeExploreCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_Explore"))
|
||||
self._mapNode.togTypeAdventureCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_Adventure"))
|
||||
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Adventure)
|
||||
local texExplore_SelectCount = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_SelectCount"):GetComponent("TMP_Text")
|
||||
local texExplore_UnSelectCount = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelectCount"):GetComponent("TMP_Text")
|
||||
local texAdventure_SelectCount = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_SelectCount"):GetComponent("TMP_Text")
|
||||
local texAdventure_UnSelectCount = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelectCount"):GetComponent("TMP_Text")
|
||||
local totalExplore, exploreCount = self.activityLevelsData:GetLevelStarMsg(GameEnum.ActivityLevelType.Explore)
|
||||
local totalAdventure, adventureCount = self.activityLevelsData:GetLevelStarMsg(GameEnum.ActivityLevelType.Adventure)
|
||||
local str = "%s/%s"
|
||||
self.firstExploreLevel = self.activityLevelsData.levelTabExploreDifficulty[1]
|
||||
local isOpenExplore = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Explore, self.firstExploreLevel)
|
||||
self._mapNode.lockExplore.gameObject:SetActive(not isOpenExplore)
|
||||
if isOpenExplore then
|
||||
NovaAPI.SetTMPText(texExplore_SelectCount, string.format(str, exploreCount, totalExplore))
|
||||
NovaAPI.SetTMPText(texExplore_UnSelectCount, string.format(str, exploreCount, totalExplore))
|
||||
else
|
||||
NovaAPI.SetTMPText(texExplore_SelectCount, "")
|
||||
NovaAPI.SetTMPText(texExplore_UnSelectCount, "")
|
||||
end
|
||||
self.firstAdventureLevel = self.activityLevelsData.levelTabAdventureDifficulty[1]
|
||||
local isOpenAdventure = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
|
||||
self._mapNode.lockAdventure.gameObject:SetActive(not isOpenAdventure)
|
||||
if isOpenAdventure then
|
||||
NovaAPI.SetTMPText(texAdventure_SelectCount, string.format(str, adventureCount, totalAdventure))
|
||||
NovaAPI.SetTMPText(texAdventure_UnSelectCount, string.format(str, adventureCount, totalAdventure))
|
||||
else
|
||||
NovaAPI.SetTMPText(texAdventure_SelectCount, "")
|
||||
NovaAPI.SetTMPText(texAdventure_UnSelectCount, "")
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClick_BtnLockExplore()
|
||||
self:FirstLevelLockTips(GameEnum.ActivityLevelType.Explore, self.firstExploreLevel)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClick_BtnLockAdventure()
|
||||
self:FirstLevelLockTips(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:FirstLevelLockTips(nType, nLevel)
|
||||
local day = self.activityLevelsData:GetUnLockDay(nType, nLevel)
|
||||
local strTips = ""
|
||||
if day == 0 then
|
||||
local hour, min, sec = self.activityLevelsData:GetUnLockHour(nType, nLevel)
|
||||
if 0 < hour then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour)
|
||||
elseif 0 < min then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min)
|
||||
elseif 0 < sec then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec"), sec)
|
||||
end
|
||||
else
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Day"), day)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, strTips)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeExplore()
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.Explore then
|
||||
return
|
||||
end
|
||||
self:CloseAllTimer()
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
self._mapNode.togAniRoot:Play("ActivityLevelsSelect_Toggle_in")
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Explore
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeAdventure()
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.Adventure then
|
||||
return
|
||||
end
|
||||
self:CloseAllTimer()
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
self._mapNode.togAniRoot:Play("ActivityLevelsSelect_Toggle_in")
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Adventure
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:CloseAllTimer()
|
||||
for i, v in pairs(self.timeTab) do
|
||||
v:Pause(true)
|
||||
end
|
||||
self.timeTab = {}
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogType(nType)
|
||||
if self.SelectTogPreLvLock ~= nil then
|
||||
NovaAPI.SetImageColor(self.SelectTogPreLvLock, Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764, 1))
|
||||
end
|
||||
self._mapNode.togTypeExploreCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.Adventure)
|
||||
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Adventure)
|
||||
local explore_SelectCount = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_SelectCount").gameObject
|
||||
local explore_UnSelectCount = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelectCount").gameObject
|
||||
local adventure_SelectCount = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_SelectCount").gameObject
|
||||
local adventure_UnSelectCount = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelectCount").gameObject
|
||||
explore_SelectCount:SetActive(nType == GameEnum.ActivityLevelType.Explore)
|
||||
explore_UnSelectCount:SetActive(nType ~= GameEnum.ActivityLevelType.Explore)
|
||||
adventure_SelectCount:SetActive(nType == GameEnum.ActivityLevelType.Adventure)
|
||||
adventure_UnSelectCount:SetActive(nType ~= GameEnum.ActivityLevelType.Adventure)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogList(nType, nDifficulty)
|
||||
local tabLevelInfo, tabLevelInfoDifficulty
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
tabLevelInfo = self.activityLevelsData.levelTabExplore
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabExploreDifficulty
|
||||
else
|
||||
tabLevelInfo = self.activityLevelsData.levelTabAdventure
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabAdventureDifficulty
|
||||
end
|
||||
for i = 1, 10 do
|
||||
self._mapNode.tog[i].gameObject:SetActive(i <= #tabLevelInfoDifficulty)
|
||||
end
|
||||
for i = 1, #tabLevelInfoDifficulty do
|
||||
local tmpId = tabLevelInfoDifficulty[i]
|
||||
local tmpData = tabLevelInfo[tmpId]
|
||||
self._mapNode.togCtrl[i]:SetText(tmpData.baseData.Name)
|
||||
local isOpen = self.activityLevelsData:GetLevelDayOpen(nType, tmpData.baseData.Id)
|
||||
local isLevelUnLock = self.activityLevelsData:GetLevelUnLock(nType, tmpData.baseData.Id)
|
||||
local objTog = self._mapNode.tog[i].gameObject
|
||||
local rt_Targets = objTog.transform:Find("AnimRoot/AnimSwitch/rt_Targets").gameObject
|
||||
local rtLockInfo = objTog.transform:Find("AnimRoot/AnimSwitch/rtLockInfo").gameObject
|
||||
local rtLockPreLv = objTog.transform:Find("AnimRoot/AnimSwitch/rtLockPreLv").gameObject
|
||||
local rtLockPreLvSelect = rtLockPreLv.transform:Find("rtLockPreLvSelect"):GetComponent("Image")
|
||||
NovaAPI.SetImageColor(rtLockPreLvSelect, Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764, 1))
|
||||
local strTips = ""
|
||||
local redH = objTog.transform:Find("AnimRoot/AnimSwitch/redH").gameObject
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
|
||||
if bInActGroup then
|
||||
if tmpData.baseData.Type == GameEnum.ActivityLevelType.Explore then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Explore_Level, {
|
||||
nActGroupId,
|
||||
tmpData.baseData.Id
|
||||
}, redH)
|
||||
else
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure_Level, {
|
||||
nActGroupId,
|
||||
tmpData.baseData.Id
|
||||
}, redH)
|
||||
end
|
||||
end
|
||||
if isOpen and isLevelUnLock then
|
||||
rt_Targets:SetActive(true)
|
||||
for j = 1, 3 do
|
||||
local btnStar = rt_Targets.gameObject.transform:Find("btnTarget" .. j):GetComponent("Button")
|
||||
btnStar.interactable = j <= tmpData.Star
|
||||
end
|
||||
rtLockInfo:SetActive(false)
|
||||
rtLockPreLv:SetActive(false)
|
||||
elseif isOpen and not isLevelUnLock then
|
||||
rt_Targets:SetActive(false)
|
||||
rtLockInfo:SetActive(false)
|
||||
rtLockPreLv:SetActive(true)
|
||||
elseif not isOpen then
|
||||
for i = 1, 5 do
|
||||
local objDeco = objTog.transform:Find("AnimRoot/AnimSwitch/goBg/Select/imgFlowWave1/imgDeco" .. i).gameObject
|
||||
if objDeco ~= nil then
|
||||
objDeco:SetActive(false)
|
||||
end
|
||||
end
|
||||
rt_Targets:SetActive(false)
|
||||
local day = self.activityLevelsData:GetUnLockDay(nType, tmpData.baseData.Id)
|
||||
if day == 0 then
|
||||
local rtLockInfoDay = rtLockInfo.gameObject.transform:Find("rtLockInfoDay").gameObject
|
||||
local bgCondition = rtLockInfo.gameObject.transform:Find("bgCondition").gameObject
|
||||
rtLockInfoDay:SetActive(false)
|
||||
bgCondition:SetActive(true)
|
||||
local txtLockCondition = rtLockInfo.gameObject.transform:Find("bgCondition/txtLockCondition"):GetComponent("TMP_Text")
|
||||
local timerCount = function()
|
||||
local hour, min, sec = self.activityLevelsData:GetUnLockHour(nType, tmpData.baseData.Id)
|
||||
if 0 < hour then
|
||||
NovaAPI.SetTMPText(txtLockCondition, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour_Color"), hour))
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour)
|
||||
elseif 0 < min then
|
||||
NovaAPI.SetTMPText(txtLockCondition, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color"), min))
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min)
|
||||
elseif 0 < sec then
|
||||
NovaAPI.SetTMPText(txtLockCondition, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color"), sec))
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec"), sec)
|
||||
end
|
||||
end
|
||||
timerCount()
|
||||
self.timeTab[tmpData.baseData.Id] = self:AddTimer(0, 1, function()
|
||||
timerCount()
|
||||
end, true, true, false)
|
||||
rtLockInfo:SetActive(true)
|
||||
rtLockPreLv:SetActive(false)
|
||||
else
|
||||
rt_Targets:SetActive(false)
|
||||
local rtLockInfoDay = rtLockInfo.gameObject.transform:Find("rtLockInfoDay").gameObject
|
||||
local bgCondition = rtLockInfo.gameObject.transform:Find("bgCondition").gameObject
|
||||
rtLockInfoDay:SetActive(true)
|
||||
bgCondition:SetActive(false)
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Day"), day)
|
||||
rtLockInfo:SetActive(true)
|
||||
rtLockPreLv:SetActive(false)
|
||||
end
|
||||
end
|
||||
local clickCb = function()
|
||||
EventManager.Hit(EventId.OpenMessageBox, strTips)
|
||||
end
|
||||
if i == nDifficulty then
|
||||
self:RefreshInstanceInfo(nType, nDifficulty, true, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_Tog(btn)
|
||||
local nHard = table.indexof(self._mapNode.tog, btn:GetComponent("UIButton"))
|
||||
local togIdx = table.indexof(self._mapNode.tog, btn)
|
||||
if nHard == nil then
|
||||
return
|
||||
end
|
||||
if self.curSelectHard ~= nHard then
|
||||
if self.SelectTogPreLvLock ~= nil then
|
||||
NovaAPI.SetImageColor(self.SelectTogPreLvLock, Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764, 1))
|
||||
end
|
||||
for idx, value in pairs(mapToggle) do
|
||||
if value == self.curSelectHard then
|
||||
self._mapNode.togCtrl[idx]:SetDefault(false)
|
||||
break
|
||||
end
|
||||
end
|
||||
self._mapNode.togCtrl[togIdx]:SetDefault(true)
|
||||
self.SelectTogPreLvLock = self._mapNode.togCtrl[togIdx].gameObject.transform:Find("AnimRoot/AnimSwitch/rtLockPreLv/rtLockPreLvSelect"):GetComponent("Image")
|
||||
NovaAPI.SetImageColor(self.SelectTogPreLvLock, Color(1, 1, 1, 1))
|
||||
self:RefreshInstanceInfo(self.nLevelType, nHard, nil, false)
|
||||
local levelId = 0
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.Explore then
|
||||
levelId = self.activityLevelsData.levelTabExploreDifficulty[nHard]
|
||||
else
|
||||
levelId = self.activityLevelsData.levelTabAdventureDifficulty[nHard]
|
||||
end
|
||||
self.activityLevelsData:ChangeRedDot(self.nLevelType, levelId)
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshInstanceInfo(nType, nHard, bLocation, bSetTog)
|
||||
if bLocation then
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
NovaAPI.UIScrollRectScrollTo(self._mapNode.rtToggles, nHard + 1, true)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
if bSetTog then
|
||||
for i = 1, 10 do
|
||||
self._mapNode.togCtrl[i]:SetDefault(i == nHard)
|
||||
end
|
||||
end
|
||||
self.curSelectHard = nHard
|
||||
local levelId = 0
|
||||
self.selectLevelData = nil
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
levelId = self.activityLevelsData.levelTabExploreDifficulty[nHard]
|
||||
self.selectLevelData = self.activityLevelsData.levelTabExplore[levelId]
|
||||
else
|
||||
levelId = self.activityLevelsData.levelTabAdventureDifficulty[nHard]
|
||||
self.selectLevelData = self.activityLevelsData.levelTabAdventure[levelId]
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRecommendLevel, self.selectLevelData.baseData.SuggestedPower)
|
||||
local sRank = "Icon/BuildRank/BuildRank_" .. self.selectLevelData.baseData.RecommendBuildRank
|
||||
self:SetPngSprite(self._mapNode.imgBuild, sRank)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPName, self.selectLevelData.baseData.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode.detailDesc, self.selectLevelData.baseData.Desc)
|
||||
self.curStar = self.selectLevelData.Star
|
||||
local tbCond = {
|
||||
self.selectLevelData.baseData.OneStarDesc,
|
||||
self.selectLevelData.baseData.TwoStarDesc,
|
||||
self.selectLevelData.baseData.ThreeStarDesc
|
||||
}
|
||||
for i = 1, 3 do
|
||||
local rtTask = self._mapNode.Task[i]
|
||||
local goDone = rtTask:Find("imgDone").gameObject
|
||||
local imgUnDone = rtTask:Find("imgUnDone").gameObject
|
||||
local Text = rtTask:Find("Text"):GetComponent("TMP_Text")
|
||||
goDone:SetActive(i <= self.curStar)
|
||||
imgUnDone:SetActive(i > self.curStar)
|
||||
local cond = tbCond[i]
|
||||
if cond == nil then
|
||||
rtTask.gameObject:SetActive(false)
|
||||
return
|
||||
else
|
||||
rtTask.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(Text, cond)
|
||||
end
|
||||
end
|
||||
self.PreviewMonsterGroupId = self.selectLevelData.baseData.PreviewMonsterGroupId
|
||||
local isOpen = self.activityLevelsData:GetLevelDayOpen(nType, self.selectLevelData.baseData.Id)
|
||||
local isLevelUnLock = self.activityLevelsData:GetLevelUnLock(nType, self.selectLevelData.baseData.Id)
|
||||
local isNeedEnergyConsume = true
|
||||
if not self.selectLevelData.baseData.EnergyConsumeOnRetry and 0 < self.selectLevelData.Star then
|
||||
isNeedEnergyConsume = false
|
||||
end
|
||||
if isOpen and isLevelUnLock then
|
||||
self._mapNode.btnListRoot:SetActive(true)
|
||||
self._mapNode.ListConditions:SetActive(false)
|
||||
if self.selectLevelData.baseData.ThreeStarSweep then
|
||||
self._mapNode.btnRaid.gameObject:SetActive(true)
|
||||
self._mapNode.txtBtnRaid.gameObject:SetActive(self.curStar == 3)
|
||||
self._mapNode.imgRaidUnlockMask.gameObject:SetActive(self.curStar ~= 3)
|
||||
else
|
||||
self._mapNode.btnRaid.gameObject:SetActive(false)
|
||||
end
|
||||
local nHas = PlayerData.Base:GetCurEnergy()
|
||||
local nRequire = self.selectLevelData.baseData.EnergyConsume
|
||||
if not isNeedEnergyConsume then
|
||||
nRequire = 0
|
||||
end
|
||||
self.curRequireEnergy = nRequire
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTicketsCount, nRequire)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCount, nRequire > nHas.nEnergy and Red_Unable or Blue_Normal)
|
||||
self._mapNode.goCoin:SetActive(isNeedEnergyConsume)
|
||||
elseif isOpen and not isLevelUnLock then
|
||||
self._mapNode.btnListRoot:SetActive(false)
|
||||
self._mapNode.ListConditions:SetActive(true)
|
||||
local preLevelId = self.selectLevelData.baseData.PreLevelId
|
||||
if preLevelId ~= 0 then
|
||||
local lvPreNeedStar = self.selectLevelData.baseData.PreLevelStar
|
||||
local lvPreStar = self.activityLevelsData:GetPreLevelStar(nType, self.selectLevelData.baseData.Id)
|
||||
local imgConditions_Lock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_Lock").gameObject
|
||||
local imgConditions_UnLock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_UnLock").gameObject
|
||||
local txt = self._mapNode.ListConditionsObj[1].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
|
||||
local tmpData = ConfigTable.GetData("ActivityLevelsLevel", preLevelId)
|
||||
imgConditions_Lock_1:SetActive(lvPreNeedStar > lvPreStar)
|
||||
imgConditions_UnLock_1:SetActive(lvPreNeedStar <= lvPreStar)
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_PreLevel"), tmpData.Name))
|
||||
NovaAPI.SetTMPColor(txt, lvPreNeedStar <= lvPreStar and colorConditionsUnLock or colorConditionsLock)
|
||||
else
|
||||
local imgConditions_Lock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_Lock").gameObject
|
||||
local imgConditions_UnLock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_UnLock").gameObject
|
||||
local txt = self._mapNode.ListConditionsObj[1].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
|
||||
imgConditions_Lock_1:SetActive(true)
|
||||
imgConditions_UnLock_1:SetActive(false)
|
||||
NovaAPI.SetTMPText(txt, ConfigTable.GetUIText("Unlocked_By_PreLevel"))
|
||||
NovaAPI.SetTMPColor(txt, colorConditionsUnLock)
|
||||
end
|
||||
local preActivityStory = self.selectLevelData.baseData.PreActivityStory
|
||||
if preActivityStory ~= nil and preActivityStory[1] ~= nil then
|
||||
local isRead = PlayerData.ActivityAvg:IsStoryReaded(preActivityStory[2])
|
||||
local imgConditions_Lock_2 = self._mapNode.ListConditionsObj[2].transform:Find("imgConditions_Lock").gameObject
|
||||
local imgConditions_UnLock_2 = self._mapNode.ListConditionsObj[2].transform:Find("imgConditions_UnLock").gameObject
|
||||
local txt = self._mapNode.ListConditionsObj[2].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
|
||||
imgConditions_Lock_2:SetActive(not isRead)
|
||||
imgConditions_UnLock_2:SetActive(isRead)
|
||||
local cfgdata = ConfigTable.GetData("ActivityStory", preActivityStory[2])
|
||||
if cfgdata ~= nil then
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Avg"), cfgdata.Title))
|
||||
self._mapNode.ListConditionsObj[2]:SetActive(true)
|
||||
NovaAPI.SetTMPColor(txt, isRead and colorConditionsUnLock or colorConditionsLock)
|
||||
else
|
||||
self._mapNode.ListConditionsObj[2]:SetActive(false)
|
||||
end
|
||||
else
|
||||
self._mapNode.ListConditionsObj[2]:SetActive(false)
|
||||
end
|
||||
elseif not isOpen then
|
||||
self._mapNode.btnListRoot:SetActive(false)
|
||||
self._mapNode.ListConditions:SetActive(true)
|
||||
self._mapNode.ListConditionsObj[2]:SetActive(false)
|
||||
local imgConditions_Lock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_Lock").gameObject
|
||||
local imgConditions_UnLock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_UnLock").gameObject
|
||||
imgConditions_Lock_1:SetActive(true)
|
||||
imgConditions_UnLock_1:SetActive(false)
|
||||
NovaAPI.SetTMPColor(txt, colorConditionsUnLock)
|
||||
local txt = self._mapNode.ListConditionsObj[1].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
|
||||
local day = self.activityLevelsData:GetUnLockDay(nType, self.selectLevelData.baseData.Id)
|
||||
if day == 0 then
|
||||
local hour, min, sec = self.activityLevelsData:GetUnLockHour(nType, self.selectLevelData.baseData.Id)
|
||||
if 0 < hour then
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour))
|
||||
elseif 0 < min then
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min))
|
||||
elseif 0 < sec then
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min))
|
||||
end
|
||||
else
|
||||
local _day, _hour = self.activityLevelsData:GetUnLockDayHour(nType, self.selectLevelData.baseData.Id)
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_DayHourOpen"), _day, _hour))
|
||||
end
|
||||
end
|
||||
for i = 1, #self.tabRewardList do
|
||||
self.tabRewardList[i].gameObject:SetActive(false)
|
||||
end
|
||||
local tbReward = decodeJson(self.selectLevelData.baseData.CompleteRewardPreview)
|
||||
for i = 1, #tbReward do
|
||||
if i > #self.tabRewardList then
|
||||
local obj = instantiate(self._mapNode.btn_itemTemp, self._mapNode.rewardRoot)
|
||||
self.tabRewardList[i] = self:BindCtrlByNode(obj, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
do
|
||||
local itemCtrl = self.tabRewardList[i]
|
||||
itemCtrl.gameObject:SetActive(true)
|
||||
if tbReward[i] ~= nil then
|
||||
local bReceived = 0 < self.selectLevelData.Star and tbReward[i][3] == 1
|
||||
local bFirstPass = tbReward[i][3] == 1
|
||||
itemCtrl:SetItem(tbReward[i][1], nil, UTILS.ParseRewardItemCount(tbReward[i]), nil, bReceived, bFirstPass, false, true)
|
||||
local btnItem = itemCtrl.gameObject:GetComponent("UIButton")
|
||||
btnItem.onClick:RemoveAllListeners()
|
||||
local clickCb = function()
|
||||
self:OnBtnClick_RewardItem(tbReward[i][1], btnItem.gameObject)
|
||||
end
|
||||
btnItem.onClick:AddListener(clickCb)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_RewardItem(nTid, btn)
|
||||
local rtBtn = btn.transform
|
||||
UTILS.ClickItemGridWithTips(nTid, rtBtn, false, true, false)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClickBtnGo()
|
||||
local nEnergy = PlayerData.Base:GetCurEnergy().nEnergy
|
||||
if nEnergy < self.curRequireEnergy then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.EnergyBuy)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.EnergyBuy, AllEnum.EnergyPanelType.Main, {}, true, callback)
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("MainlineData_Energy"))
|
||||
return
|
||||
end
|
||||
self.activityLevelsData:ChangeRedDot(self.selectLevelData.baseData.Type, self.selectLevelData.baseData.Id)
|
||||
PlayerData.Activity:SetActivityLevelActId(self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityLevels, self.selectLevelData.baseData.Id, {
|
||||
self.nActId
|
||||
})
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClickBtnRaid()
|
||||
if self.curStar ~= 3 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Raid_Lock"))
|
||||
return
|
||||
end
|
||||
local nNeedEnergy = self.curRequireEnergy
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 5, self.nActId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_EnemyInfo()
|
||||
EventManager.Hit("OpenActivityLevelsMonsterInfo", self.PreviewMonsterGroupId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEvent_UpdateEnergy()
|
||||
local nHas = PlayerData.Base:GetCurEnergy()
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCount, nHas.nEnergy < self.curRequireEnergy and Red_Unable or Blue_Normal)
|
||||
end
|
||||
return ActivityLevelsSelectCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local ActivityLevelsSelectPanel = class("ActivityLevelsSelectPanel", BasePanel)
|
||||
ActivityLevelsSelectPanel._sUIResRootPath = "UI_Activity/"
|
||||
ActivityLevelsSelectPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "11100/ActivityLevels/ActivityLevelsSelect.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.11100.ActivityLevels.ActivityLevelsSelectCtrl"
|
||||
}
|
||||
}
|
||||
function ActivityLevelsSelectPanel:Awake()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnEnable()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnAfterEnter()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnDisable()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnDestroy()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnRelease()
|
||||
end
|
||||
return ActivityLevelsSelectPanel
|
||||
@@ -0,0 +1,173 @@
|
||||
local ActivitySwimCtrl = class("ActivitySwimCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivitySwimCtrl._mapNodeConfig = {
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Go"
|
||||
},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
svReward = {
|
||||
sNodeName = "PreviewUpgradeMaterial",
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
txtAdvanceMat = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MessageBox_Reward"
|
||||
},
|
||||
txtDate = {sComponentName = "TMP_Text"},
|
||||
imgLock = {},
|
||||
txtLock = {sComponentName = "TMP_Text"},
|
||||
btnActDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txtBtnActDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Detail"
|
||||
},
|
||||
imgEnd = {},
|
||||
txtActivityEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgRemaineTime = {},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TowerDef_EnterActivity"
|
||||
}
|
||||
}
|
||||
function ActivitySwimCtrl:Awake()
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivitySwimCtrl:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivitySwimCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self:RefreshLockState()
|
||||
self:RefreshDate()
|
||||
self:RefreshTimeout()
|
||||
self:RefreshReward()
|
||||
end
|
||||
function ActivitySwimCtrl:UnInit()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivitySwimCtrl:UnbindCtrl()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivitySwimCtrl:RefreshLockState()
|
||||
local IsUnlock, txtLock = self.actData:IsUnlock()
|
||||
self._mapNode.imgLock.gameObject:SetActive(not IsUnlock)
|
||||
self._mapNode.btnGo.gameObject:SetActive(IsUnlock)
|
||||
if not IsUnlock then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLock, txtLock)
|
||||
end
|
||||
end
|
||||
function ActivitySwimCtrl:RefreshTimeout()
|
||||
local endTime = self.actData:GetActGroupEndTime()
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
self._mapNode.imgRemaineTime:SetActive(0 < remainTime)
|
||||
self._mapNode.imgEnd:SetActive(remainTime <= 0)
|
||||
if remainTime < 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
|
||||
end
|
||||
function ActivitySwimCtrl:RefreshDate()
|
||||
local nOpenMonth, nOpenDay, nEndMonth, nEndDay, nOpenYear, nEndYear = self.actData:GetActGroupDate()
|
||||
local strOpenDay = string.format("%d", nOpenDay)
|
||||
local strEndDay = string.format("%d", nEndDay)
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
|
||||
end
|
||||
function ActivitySwimCtrl:RefreshReward()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
local rewardData = actGroupCfg.RewardsShow
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self._mapNode.svReward:Init(#rewardData, self, self.RefreshRewardGridItem, self.BtnRewardGridClick)
|
||||
end
|
||||
function ActivitySwimCtrl:RefreshRewardGridItem(go, index)
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
local rewardData = actGroupCfg.RewardsShow
|
||||
local rewardId = rewardData[index + 1]
|
||||
local nInstanceID = go:GetInstanceID()
|
||||
if not self.tbGridCtrl[nInstanceID] then
|
||||
self.tbGridCtrl[nInstanceID] = self:BindCtrlByNode(go, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
self.tbGridCtrl[nInstanceID]:SetItem(rewardId)
|
||||
end
|
||||
function ActivitySwimCtrl:BtnRewardGridClick(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
local rewardData = actGroupCfg.RewardsShow
|
||||
local item = goGrid.transform:Find("AnimRoot/item")
|
||||
UTILS.ClickItemGridWithTips(rewardData[nIndex], item.transform, true, true, false)
|
||||
end
|
||||
function ActivitySwimCtrl:OnBtnClick_Go()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
if actGroupCfg ~= nil then
|
||||
if actGroupCfg.TransitionId ~= nil and actGroupCfg.TransitionId > 0 then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.SwimTheme, actGroupCfg.Id)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, actGroupCfg.TransitionId, callback)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.SwimTheme, actGroupCfg.Id)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivitySwimCtrl:OnBtnClick_Detail()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
if actGroupCfg == nil then
|
||||
return
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = actGroupCfg.DesText,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function ActivitySwimCtrl:ClearActivity()
|
||||
end
|
||||
return ActivitySwimCtrl
|
||||
@@ -0,0 +1,134 @@
|
||||
local ActivityShopGoodsItemCtrl = class("ActivityShopGoodsItemCtrl", BaseCtrl)
|
||||
ActivityShopGoodsItemCtrl._mapNodeConfig = {
|
||||
imgRare = {sComponentName = "Image"},
|
||||
imgLeft = {},
|
||||
txtLeft = {sComponentName = "TMP_Text"},
|
||||
imgTime = {},
|
||||
txtLeftTime = {sComponentName = "TMP_Text"},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgElement = {sComponentName = "Image"},
|
||||
goStar = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
|
||||
},
|
||||
imgExpire = {sComponentName = "Image"},
|
||||
txtCount = {sComponentName = "TMP_Text"},
|
||||
imgCoin = {sComponentName = "Image"},
|
||||
txtPrice = {sComponentName = "TMP_Text"},
|
||||
imgMask = {},
|
||||
goRestock = {},
|
||||
txtRestock = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Mall_Package_SoldOut"
|
||||
},
|
||||
goCondition = {},
|
||||
txtCondition = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
ActivityShopGoodsItemCtrl._mapEventConfig = {}
|
||||
function ActivityShopGoodsItemCtrl:Refresh(mapData, nCurrencyItemId)
|
||||
self.mapData = mapData
|
||||
self.mapGoodsCfg = ConfigTable.GetData("ActivityGoods", mapData.nId)
|
||||
if not self.mapGoodsCfg then
|
||||
return
|
||||
end
|
||||
self:RefreshInfo()
|
||||
self:RefreshPrice(nCurrencyItemId)
|
||||
self:RefreshTime()
|
||||
self:RefreshLimit()
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:RefreshInfo()
|
||||
local mapItemCfg = ConfigTable.GetData_Item(self.mapGoodsCfg.ItemId)
|
||||
if not mapItemCfg then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, self.mapGoodsCfg.Name)
|
||||
if mapItemCfg.Type == GameEnum.itemType.Disc then
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapItemCfg.Icon .. AllEnum.OutfitIconSurfix.Item)
|
||||
self._mapNode.imgElement.gameObject:SetActive(true)
|
||||
self._mapNode.goStar.gameObject:SetActive(true)
|
||||
local mapDiscCfgData = ConfigTable.GetData("Disc", self.mapGoodsCfg.ItemId)
|
||||
if mapDiscCfgData then
|
||||
self:SetAtlasSprite(self._mapNode.imgElement, "12_rare", AllEnum.Star_Element[mapDiscCfgData.EET].icon)
|
||||
end
|
||||
local nStar = 6 - mapItemCfg.Rarity
|
||||
self._mapNode.goStar:SetStar(nStar, nStar)
|
||||
else
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapItemCfg.Icon)
|
||||
self._mapNode.imgElement.gameObject:SetActive(false)
|
||||
self._mapNode.goStar.gameObject:SetActive(false)
|
||||
end
|
||||
self._mapNode.imgExpire.gameObject:SetActive(mapItemCfg.ExpireType > 0)
|
||||
local sPath = "db_swimsuit_shop_" .. AllEnum.FrameColor_New[mapItemCfg.Rarity]
|
||||
self:SetActivityAtlasSprite_New(self._mapNode.imgRare, "11100/SpriteAtlas", sPath)
|
||||
local bLimit = 0 < self.mapData.nMaximumLimit
|
||||
if bLimit then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLeft, orderedFormat(ConfigTable.GetUIText("Shop_Left"), self.mapData.nMaximumLimit - self.mapData.nBoughtCount))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLeft, orderedFormat(ConfigTable.GetUIText("Shop_Left"), ConfigTable.GetUIText("Shop_Unlimited")))
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCount, orderedFormat(ConfigTable.GetUIText("Shop_GoodsItem_Count"), self.mapGoodsCfg.ItemQuantity))
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:RefreshPrice(nCurrencyItemId)
|
||||
self:SetSprite_Coin(self._mapNode.imgCoin, nCurrencyItemId)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPrice, self.mapGoodsCfg.Price)
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:RefreshTime()
|
||||
local bTime = self.mapData.bPurchasTime and self.mapData.nNextRefreshTime > 0
|
||||
self._mapNode.imgTime:SetActive(bTime)
|
||||
if not bTime then
|
||||
return
|
||||
end
|
||||
local sTime = ""
|
||||
local nRemaining = self.mapData.nNextRefreshTime - CS.ClientManager.Instance.serverTimeStamp
|
||||
if nRemaining <= 3600 and 0 < nRemaining then
|
||||
sTime = ConfigTable.GetUIText("Shop_WithinHour")
|
||||
elseif 3600 < nRemaining and nRemaining <= 86400 then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("Shop_Hour"), math.floor(nRemaining / 3600))
|
||||
elseif 86400 < nRemaining then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("Shop_Day"), math.floor(nRemaining / 86400))
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLeftTime, sTime)
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:RefreshLimit()
|
||||
local bMask = not self.mapData.bPurchasable or not self.mapData.bPurchasTime or self.mapData.bSoldOut
|
||||
self._mapNode.imgMask:SetActive(bMask)
|
||||
if self.mapData.bSoldOut then
|
||||
self._mapNode.goRestock:SetActive(true)
|
||||
self._mapNode.goCondition:SetActive(false)
|
||||
return
|
||||
end
|
||||
self._mapNode.goRestock:SetActive(false)
|
||||
self._mapNode.goCondition:SetActive(true)
|
||||
if self.mapData.nUnlockPurchaseTime > 0 and self.mapData.nUnlockPurchaseTime == self.mapData.nNextRefreshTime then
|
||||
local sTime = ""
|
||||
local nRemaining = self.mapData.nNextRefreshTime - CS.ClientManager.Instance.serverTimeStamp
|
||||
if nRemaining <= 3600 and 0 < nRemaining then
|
||||
sTime = ConfigTable.GetUIText("Shop_WithinHourUnLock")
|
||||
elseif 3600 < nRemaining and nRemaining <= 86400 then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("Shop_HourUnLock"), math.floor(nRemaining / 3600))
|
||||
elseif 86400 < nRemaining then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("Shop_DayUnLock"), math.floor(nRemaining / 86400))
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCondition, sTime)
|
||||
return
|
||||
end
|
||||
if not self.mapData.bPurchasable then
|
||||
local sCond = ""
|
||||
if self.mapData.nPurchaseCondType == GameEnum.shopCond.WorldClassSpecific then
|
||||
sCond = orderedFormat(ConfigTable.GetUIText("Shop_Cond_WorldClass"), self.mapData.tbPurchaseCondParams[1])
|
||||
elseif self.mapData.nPurchaseCondType == GameEnum.shopCond.ShopPreGoodsSellOut or self.mapData.nPurchaseCondType == GameEnum.shopCond.ActivityShopPreGoodsSellOut then
|
||||
sCond = ConfigTable.GetUIText("Shop_Cond_PreGoodsSellOut")
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCondition, sCond)
|
||||
return
|
||||
end
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:Awake()
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:OnEnable()
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:OnDisable()
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:OnDestroy()
|
||||
end
|
||||
return ActivityShopGoodsItemCtrl
|
||||
@@ -0,0 +1,24 @@
|
||||
local ActivityShopPanel = class("ActivityShopPanel", BasePanel)
|
||||
ActivityShopPanel._sUIResRootPath = "UI_Activity/"
|
||||
ActivityShopPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "11100/Shop/ActivityShopPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.ShopCommon.ActivityShopCtrl"
|
||||
}
|
||||
}
|
||||
function ActivityShopPanel:Awake()
|
||||
self.nDefaultId = nil
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.nActId = tbParam[1]
|
||||
self.nDefaultId = tbParam[2]
|
||||
end
|
||||
self.actShopData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
end
|
||||
function ActivityShopPanel:OnEnable()
|
||||
end
|
||||
function ActivityShopPanel:OnDisable()
|
||||
end
|
||||
function ActivityShopPanel:OnDestroy()
|
||||
end
|
||||
return ActivityShopPanel
|
||||
@@ -0,0 +1,354 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local SwimThemeStory_11100Ctrl = class("SwimThemeStory_11100Ctrl", BaseCtrl)
|
||||
local ActivityAvgData = PlayerData.ActivityAvg
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
SwimThemeStory_11100Ctrl._mapNodeConfig = {
|
||||
goActTime = {},
|
||||
txtYear = {sComponentName = "TMP_Text"},
|
||||
txtActivityDate = {sComponentName = "TMP_Text"},
|
||||
svStory = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
imgHead = {sComponentName = "Image"},
|
||||
txtPersonality = {sComponentName = "TMP_Text"},
|
||||
ctlAvgRoot = {
|
||||
sNodeName = "goAvgInfoRoot",
|
||||
sCtrlName = "Game.UI.ActivityTheme.ActivityAvgInfoExCtrl"
|
||||
},
|
||||
t_fullscreen_blur_black = {},
|
||||
btnsnapshot = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtn_ClickCloseLevelInfoPanel"
|
||||
},
|
||||
goPersonalityRoot = {
|
||||
sNodeName = "---Personality---"
|
||||
},
|
||||
goPersonality = {
|
||||
sNodeName = "goPersonality",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
goChapterComplete = {}
|
||||
}
|
||||
SwimThemeStory_11100Ctrl._mapEventConfig = {
|
||||
Story_Done = "OnEvent_Story_Done",
|
||||
SelectMainlineBattle = "OnEvent_SelectMainlineBattle",
|
||||
Story_RewardClosed = "OnEvent_Activity_Story_RewardClosed",
|
||||
StoryDialog_DialogEnd = "OnEvent_StoryDialog_DialogEnd"
|
||||
}
|
||||
local UnlockConditionPriority = {
|
||||
[1] = "MustStoryIds",
|
||||
[2] = "OneofStoryIds",
|
||||
[3] = "MustEvIds",
|
||||
[4] = "OneofEvIds",
|
||||
[5] = "WorldLevel",
|
||||
[6] = "MustAchievementIds",
|
||||
[7] = "MustActivityLevel"
|
||||
}
|
||||
function SwimThemeStory_11100Ctrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.storyNodePos = {27, -30}
|
||||
self.tbGridTimer = {}
|
||||
self.tbPlayedAnim = {}
|
||||
self.nScrollTime = 0.5
|
||||
self.bInit = false
|
||||
end
|
||||
function SwimThemeStory_11100Ctrl:OnEnable()
|
||||
self._mapNode.goActTime.gameObject:SetActive(false)
|
||||
self:RefreshPanel()
|
||||
end
|
||||
function SwimThemeStory_11100Ctrl:OnDisable()
|
||||
end
|
||||
function SwimThemeStory_11100Ctrl:RefreshPanel()
|
||||
self:RefreshDate()
|
||||
self:RefreshStoryList()
|
||||
self:RefreshPersonality()
|
||||
end
|
||||
function SwimThemeStory_11100Ctrl:RefreshDate()
|
||||
local nOpenTime, nEndTime = PlayerData.ActivityAvg:GetActivityOpenTime(self.nActId)
|
||||
local nYear = tonumber(os.date("%Y", nOpenTime))
|
||||
local nOpenMonth = tonumber(os.date("%m", nOpenTime))
|
||||
local nOpenDay = tonumber(os.date("%d", nOpenTime))
|
||||
local nEndDay = tonumber(os.date("%d", nEndTime))
|
||||
local nEndMonth = tonumber(os.date("%m", nEndTime))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtYear, nYear)
|
||||
local strOpenDay = string.format("%d", nOpenDay)
|
||||
local strEndDay = string.format("%d", nEndDay)
|
||||
local dateStr = string.format("%s/%s ~ %s/%s", nOpenMonth, strOpenDay, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityDate, dateStr)
|
||||
end
|
||||
function SwimThemeStory_11100Ctrl:RefreshPersonality()
|
||||
local cfg = ConfigTable.GetData("ActivityStoryChapter", self.nChapterId)
|
||||
local personalityId = cfg.PersonalityId
|
||||
self._mapNode.goPersonalityRoot:SetActive(0 < personalityId)
|
||||
if personalityId <= 0 then
|
||||
return
|
||||
end
|
||||
local tbRetPercent, sTitle, sFace, tbPData, nTotalCount, sHead = PlayerData.ActivityAvg:CalcPersonality(personalityId)
|
||||
NovaAPI.SetPersonalityRing(self._mapNode.goPersonality, tbRetPercent)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPersonality, sTitle)
|
||||
local sIcon = "Icon/PlayerHead/" .. sHead
|
||||
self:SetPngSprite(self._mapNode.imgHead, sIcon)
|
||||
end
|
||||
function SwimThemeStory_11100Ctrl:RefreshStoryList()
|
||||
self.tbPlayedAnim = {}
|
||||
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
|
||||
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
|
||||
return
|
||||
end
|
||||
local recentStoryId = ActivityAvgData:GetRecentStoryId(self.nChapterId)
|
||||
local recentIndex = 1
|
||||
for i = 1, #self.tbAllStory do
|
||||
if self.tbAllStory[i] == recentStoryId then
|
||||
recentIndex = i
|
||||
break
|
||||
end
|
||||
end
|
||||
self.curIndex = recentIndex
|
||||
local time = self.bInit and 0 or self.nScrollTime
|
||||
self._mapNode.svStory:Init(#self.tbAllStory, self, self.OnRefreshGrid)
|
||||
self:AddTimer(1, 0.1, function()
|
||||
self._mapNode.svStory:SetScrollGridPos(recentIndex, time, 0)
|
||||
self.bInit = true
|
||||
end, true, true, true)
|
||||
end
|
||||
function SwimThemeStory_11100Ctrl:OnRefreshGrid(grid, index)
|
||||
local gridIndex = index + 1
|
||||
local storyId = self.tbAllStory[gridIndex]
|
||||
local avgcfg = ConfigTable.GetData("ActivityStory", storyId)
|
||||
local goInstanceID = grid:GetInstanceID()
|
||||
local RootNode = grid.transform:Find("btnGrid/AnimRoot/RootNode"):GetComponent("RectTransform")
|
||||
local pos = RootNode.anchoredPosition
|
||||
pos.y = gridIndex % 2 == 0 and self.storyNodePos[1] or self.storyNodePos[2]
|
||||
RootNode.anchoredPosition = pos
|
||||
local goUnlock = RootNode:Find("goUnlock")
|
||||
local goComplete = RootNode:Find("goComplete")
|
||||
local goLock = RootNode:Find("goLock")
|
||||
local reddot = RootNode:Find("RedDot")
|
||||
local isUnlock, tbResult = ActivityAvgData:IsUnlock(avgcfg.ConditionId)
|
||||
local isReaded = ActivityAvgData:IsStoryReaded(storyId)
|
||||
local bOpen, nOpenTime = ActivityAvgData:IsOpen(avgcfg.StoryId)
|
||||
local isFullUnlock = isUnlock and bOpen
|
||||
goUnlock.gameObject:SetActive(isFullUnlock)
|
||||
goComplete.gameObject:SetActive(isReaded and bOpen)
|
||||
goLock.gameObject:SetActive(not isFullUnlock)
|
||||
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
|
||||
nActGroupId,
|
||||
self.nActId,
|
||||
avgcfg.Id
|
||||
}, reddot, nil, nil, true)
|
||||
local imgStory = RootNode:Find("imgStory"):GetComponent("Image")
|
||||
local txtIndex = goUnlock:Find("txtIndex"):GetComponent("TMP_Text")
|
||||
local txtTitle = goUnlock:Find("txtTitle"):GetComponent("TMP_Text")
|
||||
local txtComplete = goComplete:Find("imgBg/txtComplete"):GetComponent("TMP_Text")
|
||||
if bOpen then
|
||||
self:SetPngSprite(imgStory, avgcfg.Icon)
|
||||
else
|
||||
self:SetPngSprite(imgStory, "Icon/ActivityStory/ep_event07_00")
|
||||
end
|
||||
NovaAPI.SetTMPText(txtIndex, avgcfg.Index)
|
||||
NovaAPI.SetTMPText(txtTitle, avgcfg.Title)
|
||||
NovaAPI.SetTMPText(txtComplete, ConfigTable.GetUIText("RoguelikeBuild_Manage_FilterPass"))
|
||||
if not isFullUnlock then
|
||||
local goLockBg = goLock:Find("goLockBg")
|
||||
local goTime = goLock:Find("imgTime")
|
||||
local txtTime = goTime:Find("txtTime"):GetComponent("TMP_Text")
|
||||
local goLockState = goLock:Find("goLockState")
|
||||
local blueMask = goLockState:Find("blueMask")
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local remainTime = curTime - (nOpenTime + avgcfg.DayOpen * 86400)
|
||||
if not bOpen or remainTime < 0 then
|
||||
goLockBg.gameObject:SetActive(true)
|
||||
goTime.gameObject:SetActive(true)
|
||||
goLockState.gameObject:SetActive(false)
|
||||
local strTime = self:GetRemainTimeStr(nOpenTime, avgcfg.DayOpen)
|
||||
if self.tbGridTimer[goInstanceID] ~= nil then
|
||||
self.tbGridTimer[goInstanceID]:Cancel()
|
||||
self.tbGridTimer[goInstanceID] = nil
|
||||
end
|
||||
self.tbGridTimer[goInstanceID] = self:AddTimer(0, 1, function()
|
||||
local strTimeNew, bLock = self:GetRemainTimeStr(nOpenTime, avgcfg.DayOpen)
|
||||
if bLock then
|
||||
NovaAPI.SetTMPText(txtTime, strTimeNew)
|
||||
else
|
||||
self:RefreshStoryList()
|
||||
end
|
||||
end, true, true, true)
|
||||
NovaAPI.SetTMPText(txtTime, strTime)
|
||||
else
|
||||
goLockBg.gameObject:SetActive(false)
|
||||
goTime.gameObject:SetActive(false)
|
||||
goLockState.gameObject:SetActive(true)
|
||||
blueMask.gameObject:SetActive(true)
|
||||
end
|
||||
end
|
||||
local clickFuc = function()
|
||||
if not bOpen or self.bCantClick then
|
||||
return
|
||||
end
|
||||
if isFullUnlock then
|
||||
local bNew = not isReaded
|
||||
self.avgId = avgcfg.StoryId
|
||||
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
|
||||
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
|
||||
self.curIndex = gridIndex
|
||||
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
|
||||
ActivityAvgData:RefreshAvgRedDot()
|
||||
elseif tbResult ~= nil then
|
||||
local lockTxt = ""
|
||||
for i = 1, #tbResult do
|
||||
local value = tbResult[i]
|
||||
if value[1] == false then
|
||||
if UnlockConditionPriority[i] == "MustStoryIds" then
|
||||
do
|
||||
local tbStoryIds = value[2]
|
||||
for k, v in pairs(tbStoryIds) do
|
||||
if v == false then
|
||||
local storyData = ConfigTable.GetData("ActivityStory", k)
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "OneofStoryIds" then
|
||||
do
|
||||
local tbStoryIds = value[2]
|
||||
for k, v in pairs(tbStoryIds) do
|
||||
if v == false then
|
||||
local storyData = ConfigTable.GetData("ActivityStory", k)
|
||||
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if lockTxt == "" then
|
||||
for k, _v in pairs(tbStoryIds) do
|
||||
local storyData = ConfigTable.GetData("ActivityStory", k)
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "MustEvIds" then
|
||||
lockTxt = ConfigTable.GetUIText("Story_UnlockClueCondition")
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "OneofEvIds" then
|
||||
lockTxt = ConfigTable.GetUIText("Story_UnlockClueCondition")
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "WorldLevel" then
|
||||
do
|
||||
local level = value[2]
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockWorldLv") or "", level)
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "MustAchievementIds" then
|
||||
if self.bHasAchievementData == true then
|
||||
local tbAchievementList = value[2]
|
||||
for k, v in pairs(tbAchievementList) do
|
||||
if v == false then
|
||||
local achievementId = k
|
||||
local achievement = ConfigTable.GetData("Achievement", achievementId)
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockAchievement") or "", achievement.Title) .. "\n" .. "(" .. achievement.Desc .. ")"
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "MustActivityLevel" then
|
||||
local levelId = value[2]
|
||||
if 0 < levelId then
|
||||
local levelData = ConfigTable.GetData("ActivityLevelsLevel", levelId)
|
||||
if levelData then
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("ActivityStory_UnlockActivityLevel"), levelData.Name)
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = lockTxt
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
end
|
||||
local btnGrid = grid.transform:Find("btnGrid"):GetComponent("UIButton")
|
||||
btnGrid.onClick:RemoveAllListeners()
|
||||
btnGrid.onClick:AddListener(clickFuc)
|
||||
local anim = grid:GetComponent("Animator")
|
||||
anim:Play("go")
|
||||
end
|
||||
function SwimThemeStory_11100Ctrl:GetRemainTimeStr(nOpenTime, openDay)
|
||||
local timeStr = ""
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local openTime = CS.ClientManager.Instance:GetNextRefreshTime(nOpenTime) - 86400
|
||||
local nRemainTime = openTime + openDay * 86400 - curTime
|
||||
local day = math.floor(nRemainTime / 86400)
|
||||
local hour = math.floor(nRemainTime / 3600)
|
||||
local min = math.floor((nRemainTime - hour * 3600) / 60)
|
||||
local sec = nRemainTime - hour * 3600 - min * 60
|
||||
if 0 < day then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Day_Color_Common"), "08d3d4", day)
|
||||
elseif 0 < hour then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour_Color_Common"), "08d3d4", hour)
|
||||
elseif 0 < min then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color_Common"), "08d3d4", min)
|
||||
elseif 0 < sec then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color_Common"), "08d3d4", sec)
|
||||
end
|
||||
return timeStr, 0 < nRemainTime
|
||||
end
|
||||
function SwimThemeStory_11100Ctrl:OnBtn_ClickBack()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.SwimThemeStory_11100)
|
||||
end
|
||||
function SwimThemeStory_11100Ctrl:OnBtn_ClickHome()
|
||||
PanelManager.Home()
|
||||
end
|
||||
function SwimThemeStory_11100Ctrl:OnBtn_ClickCloseLevelInfoPanel()
|
||||
self._mapNode.t_fullscreen_blur_black:SetActive(false)
|
||||
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
|
||||
self._mapNode.goChapterComplete:SetActive(false)
|
||||
end
|
||||
function SwimThemeStory_11100Ctrl:OnEvent_StoryDialog_DialogEnd()
|
||||
WwiseAudioMgr:SetState("menuTransition", "open")
|
||||
end
|
||||
function SwimThemeStory_11100Ctrl:OnEvent_Story_Done(bHasReward)
|
||||
self:RefreshPanel()
|
||||
if bHasReward then
|
||||
self.bCantClick = true
|
||||
end
|
||||
end
|
||||
function SwimThemeStory_11100Ctrl:OnEvent_SelectMainlineBattle(bConfirm)
|
||||
local OpenPanel = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
|
||||
end
|
||||
if bConfirm then
|
||||
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
|
||||
end
|
||||
end
|
||||
function SwimThemeStory_11100Ctrl:OnEvent_Activity_Story_RewardClosed()
|
||||
self.bCantClick = false
|
||||
if self.curIndex == #self.tbAllStory then
|
||||
self._mapNode.goChapterComplete:SetActive(true)
|
||||
end
|
||||
end
|
||||
return SwimThemeStory_11100Ctrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local SwimThemeStory_11100Panel = class("SwimThemeStory_11100Panel", BasePanel)
|
||||
SwimThemeStory_11100Panel._sUIResRootPath = "UI_Activity/"
|
||||
SwimThemeStory_11100Panel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "11100/Story/SwimThemeStoryPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.11100.Story.SwimThemeStory_11100Ctrl"
|
||||
}
|
||||
}
|
||||
function SwimThemeStory_11100Panel:Awake()
|
||||
end
|
||||
function SwimThemeStory_11100Panel:OnEnable()
|
||||
end
|
||||
function SwimThemeStory_11100Panel:OnDisable()
|
||||
end
|
||||
function SwimThemeStory_11100Panel:OnDestroy()
|
||||
end
|
||||
function SwimThemeStory_11100Panel:OnRelease()
|
||||
end
|
||||
return SwimThemeStory_11100Panel
|
||||
@@ -0,0 +1,724 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local SwimTheme_11100Ctrl = class("SwimTheme_11100Ctrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
SwimTheme_11100Ctrl._mapNodeConfig = {
|
||||
btnEntrance_ = {
|
||||
nCount = 5,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickActivityEntrance"
|
||||
},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtActivityDate = {sComponentName = "TMP_Text"},
|
||||
imgEnd = {},
|
||||
txtActivityEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgMiniGame = {sComponentName = "Image"},
|
||||
txtMiniGame = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Mini_Game"
|
||||
},
|
||||
imgMiniGameEnd = {},
|
||||
txtMiniGameEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Mini_Game"
|
||||
},
|
||||
txtMiniGame_End = {},
|
||||
txtTask = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Task"
|
||||
},
|
||||
txtTaskProgress = {sComponentName = "TMP_Text"},
|
||||
imgTaskActivityTime = {},
|
||||
txtTaskActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtStory = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Story"
|
||||
},
|
||||
imgStory = {sComponentName = "Image"},
|
||||
imgStoryIcon = {sComponentName = "Image"},
|
||||
imgStoryEnd = {},
|
||||
goStoryEnd = {},
|
||||
txtStory_End = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Story"
|
||||
},
|
||||
imgStoryIconEnd = {},
|
||||
txtStoryEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtMiniGameEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtTaskEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtShopEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtShop = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Shop"
|
||||
},
|
||||
imgShopActivityTime = {},
|
||||
txtShopActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgLevel = {sComponentName = "Image"},
|
||||
txtLevel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Level"
|
||||
},
|
||||
goLevelEnd = {},
|
||||
txtLevelEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgLevelActivityUnlockTime = {},
|
||||
txtLevelActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
txtLevel_End = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Level"
|
||||
},
|
||||
imgLevelEnd = {},
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
imgMiniGameActivityUnlockTime = {},
|
||||
txtMiniGameActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgTaskBgEnd = {},
|
||||
imgTaskEnd = {},
|
||||
txtTaskEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Task"
|
||||
},
|
||||
txtTaskProgress_End = {},
|
||||
imgTaskActivityUnlockTime = {},
|
||||
txtTaskActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgStoryActivityTime = {},
|
||||
txtStoryActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgStoryActivityUnlockTime = {},
|
||||
txtStoyActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgShopActivityUnlockTime = {},
|
||||
txtShopActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgLevelActivityTime = {},
|
||||
txtLevelActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgMiniGameActivityTime = {},
|
||||
txtMiniGameActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtShopEnd = {},
|
||||
imgShopEnd = {},
|
||||
txtShop_End = {},
|
||||
txtTaskProgressEnd = {sComponentName = "TMP_Text"},
|
||||
redDotEntrance2 = {},
|
||||
storyRedDot = {},
|
||||
reddotLevel = {}
|
||||
}
|
||||
SwimTheme_11100Ctrl._mapEventConfig = {}
|
||||
SwimTheme_11100Ctrl._mapRedDotConfig = {}
|
||||
local ActivityState = {
|
||||
NotOpen = 1,
|
||||
Open = 2,
|
||||
Closed = 3
|
||||
}
|
||||
function SwimTheme_11100Ctrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.SwimThemeData = PlayerData.Activity:GetActivityGroupDataById(self.nActId)
|
||||
if self.SwimThemeData ~= nil then
|
||||
self.ActivityGroupCfg = self.SwimThemeData.actGroupConfig
|
||||
end
|
||||
end
|
||||
function SwimTheme_11100Ctrl:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
function SwimTheme_11100Ctrl:OnEnable()
|
||||
self:RefreshPanel()
|
||||
for i = 1, 5 do
|
||||
local actData = self.SwimThemeData:GetActivityDataByIndex(i)
|
||||
if i == AllEnum.ActivityThemeFuncIndex.Task then
|
||||
local nActId = actData.ActivityId
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.redDotEntrance2)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
local nActId = actData.ActivityId
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.storyRedDot)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Level then
|
||||
local nActId = actData.ActivityId
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.reddotLevel)
|
||||
end
|
||||
end
|
||||
end
|
||||
function SwimTheme_11100Ctrl:OnDisable()
|
||||
if nil ~= self.minigameRemainTimer then
|
||||
TimerManager.Remove(self.minigameRemainTimer)
|
||||
self.minigameRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.remainTimer then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
end
|
||||
if nil ~= self.shopRemainTimer then
|
||||
TimerManager.Remove(self.shopRemainTimer)
|
||||
self.shopRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.levelRemainTimer then
|
||||
TimerManager.Remove(self.levelRemainTimer)
|
||||
self.levelRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.avgRemainTimer then
|
||||
TimerManager.Remove(self.avgRemainTimer)
|
||||
self.avgRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.taskRemainTimer then
|
||||
TimerManager.Remove(self.taskRemainTimer)
|
||||
self.taskRemainTimer = nil
|
||||
end
|
||||
end
|
||||
function SwimTheme_11100Ctrl:RefreshPanel()
|
||||
if self.SwimThemeData == nil or self.ActivityGroupCfg == nil then
|
||||
return
|
||||
end
|
||||
self:RefreshTime()
|
||||
self:RefreshButtonState()
|
||||
end
|
||||
function SwimTheme_11100Ctrl:RefreshTime()
|
||||
local bOpen = self.SwimThemeData:CheckActivityGroupOpen()
|
||||
if bOpen then
|
||||
RefreshRemainTime(self.SwimThemeData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = RefreshRemainTime(self.SwimThemeData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
end
|
||||
self._mapNode.imgEnd:SetActive(not bOpen)
|
||||
local nOpenMonth, nOpenDay, nEndMonth, nEndDay, nOpenYear, nEndYear = self.SwimThemeData:GetActGroupDate()
|
||||
local strOpenDay = string.format("%d", nOpenDay)
|
||||
local strEndDay = string.format("%d", nEndDay)
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityDate, dateStr)
|
||||
end
|
||||
function SwimTheme_11100Ctrl:RefreshRemainOpenTime(openTime)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time_Min") or "", min)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time") or "", hour)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time_Day") or "", day)
|
||||
end
|
||||
return sTimeStr
|
||||
end
|
||||
function SwimTheme_11100Ctrl:RefreshButtonState()
|
||||
self.tbActState = {}
|
||||
for i = 1, 5 do
|
||||
local actData = self.SwimThemeData:GetActivityDataByIndex(i)
|
||||
if i == AllEnum.ActivityThemeFuncIndex.MiniGame then
|
||||
self:RefreshMiniGameButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Task then
|
||||
self:RefreshTaskButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
self:RefreshStoryButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Level then
|
||||
self:RefreshLevelButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Shop then
|
||||
self:RefreshShopButtonState(actData)
|
||||
end
|
||||
end
|
||||
end
|
||||
function SwimTheme_11100Ctrl:RefreshMiniGameButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local state = ActivityState.NotOpen
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local bShowCountDown = false
|
||||
if activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
elseif curTime >= openTime and curTime <= endTime then
|
||||
state = ActivityState.Open
|
||||
else
|
||||
state = ActivityState.Closed
|
||||
end
|
||||
elseif activityData.EndType == GameEnum.activityEndType.NoLimit then
|
||||
state = ActivityState.Open
|
||||
if activityData.StartTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
end
|
||||
end
|
||||
end
|
||||
if state == ActivityState.NotOpen then
|
||||
if nil == self.minigameRemainTimer and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtMiniGameActivityUnlockTime, sTimeStr)
|
||||
self.minigameRemainTimer = self:AddTimer(0, 1, function()
|
||||
curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
if 0 < remainTime then
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtMiniGameActivityUnlockTime, sTimeStr)
|
||||
else
|
||||
self._mapNode.imgMiniGameActivityUnlockTime:SetActive(false)
|
||||
TimerManager.Remove(self.minigameRemainTimer)
|
||||
self.minigameRemainTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
self:RefreshMiniGameButtonState(actData)
|
||||
self:RefreshActivityData()
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Open and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
if endTime > self.SwimThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = curTime >= self.SwimThemeData:GetActGroupEndTime()
|
||||
elseif endTime < self.SwimThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
if nil == self.minigameRemainTimer and bShowCountDown then
|
||||
RefreshRemainTime(endTime, self._mapNode.txtMiniGameActivityTime)
|
||||
self.minigameRemainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = RefreshRemainTime(endTime, self._mapNode.txtMiniGameActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.minigameRemainTimer)
|
||||
self.minigameRemainTimer = nil
|
||||
self:RefreshMiniGameButtonState(actData)
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
end
|
||||
self._mapNode.imgMiniGameActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.imgMiniGameActivityTime.gameObject:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgMiniGameEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtMiniGame_End:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtMiniGameEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function SwimTheme_11100Ctrl:RefreshTaskButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local actInsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local bShowCountDown = false
|
||||
local state = ActivityState.NotOpen
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
if activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
elseif curTime >= openTime and curTime <= endTime then
|
||||
state = ActivityState.Open
|
||||
else
|
||||
state = ActivityState.Closed
|
||||
if actInsData ~= nil then
|
||||
actInsData:RefreshTaskRedDot()
|
||||
end
|
||||
end
|
||||
if endTime > self.SwimThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = curTime >= self.SwimThemeData:GetActGroupEndTime()
|
||||
elseif endTime < self.SwimThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
elseif activityData.EndType == GameEnum.activityEndType.NoLimit then
|
||||
state = ActivityState.Open
|
||||
if activityData.StartTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
end
|
||||
end
|
||||
end
|
||||
if state == ActivityState.NotOpen then
|
||||
if nil == self.taskRemainTimer and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskActivityUnlockTime, sTimeStr)
|
||||
self.taskRemainTimer = self:AddTimer(0, 1, function()
|
||||
curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
if 0 < remainTime then
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskActivityUnlockTime, sTimeStr)
|
||||
else
|
||||
self._mapNode.imgTaskActivityUnlockTime:SetActive(false)
|
||||
TimerManager.Remove(self.taskRemainTimer)
|
||||
self.taskRemainTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
self:RefreshTaskButtonState(actData)
|
||||
self:RefreshActivityData()
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Open and nil == self.taskRemainTimer and activityData.StartTime ~= "" and activityData.EndTime ~= "" and bShowCountDown then
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
RefreshRemainTime(endTime, self._mapNode.txtTaskActivityTime)
|
||||
self.taskRemainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = RefreshRemainTime(endTime, self._mapNode.txtTaskActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.taskRemainTimer)
|
||||
self.taskRemainTimer = nil
|
||||
if actInsData ~= nil then
|
||||
actInsData:RefreshTaskRedDot()
|
||||
end
|
||||
self:RefreshTaskButtonState(actData)
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
self._mapNode.imgTaskActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.txtTaskProgress_End:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtTaskProgressEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskBgEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtTaskEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.txtTaskProgress.gameObject:SetActive(state >= ActivityState.Open)
|
||||
self.tbActState[activityId] = state
|
||||
local ActivityTaskData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local nDone, nTotal = 0, 0
|
||||
if ActivityTaskData ~= nil then
|
||||
nDone, nTotal = ActivityTaskData:CalcTotalProgress()
|
||||
end
|
||||
local progress = string.format("%d/%d", nDone, nTotal)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskProgress, progress)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskProgressEnd, progress)
|
||||
end
|
||||
end
|
||||
function SwimTheme_11100Ctrl:RefreshStoryButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local bShowCountDown = false
|
||||
local state = ActivityState.NotOpen
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
if activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
elseif curTime >= openTime and curTime <= endTime then
|
||||
state = ActivityState.Open
|
||||
else
|
||||
state = ActivityState.Closed
|
||||
end
|
||||
if endTime > self.SwimThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = curTime >= self.SwimThemeData:GetActGroupEndTime()
|
||||
elseif endTime < self.SwimThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
elseif activityData.EndType == GameEnum.activityEndType.NoLimit then
|
||||
state = ActivityState.Open
|
||||
if activityData.StartTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
end
|
||||
end
|
||||
end
|
||||
if state == ActivityState.NotOpen then
|
||||
if nil == self.avgRemainTimer and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtStoyActivityUnlockTime, sTimeStr)
|
||||
self.avgRemainTimer = self:AddTimer(0, 1, function()
|
||||
curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
if 0 < remainTime then
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtStoyActivityUnlockTime, sTimeStr)
|
||||
else
|
||||
self._mapNode.imgStoryActivityUnlockTime:SetActive(false)
|
||||
TimerManager.Remove(self.avgRemainTimer)
|
||||
self.avgRemainTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
self:RefreshStoryButtonState(actData)
|
||||
self:RefreshActivityData()
|
||||
PlayerData.ActivityAvg:RefreshAvgRedDot()
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Open then
|
||||
if nil == self.avgRemainTimer and activityData.StartTime ~= "" and activityData.EndTime ~= "" and bShowCountDown then
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
RefreshRemainTime(endTime, self._mapNode.txtStoryActivityTime)
|
||||
self.avgRemainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = RefreshRemainTime(endTime, self._mapNode.txtStoryActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.avgRemainTimer)
|
||||
self.avgRemainTimer = nil
|
||||
self:RefreshStoryButtonState(actData)
|
||||
PlayerData.ActivityAvg:RefreshAvgRedDot()
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Closed then
|
||||
PlayerData.ActivityAvg:RefreshAvgRedDot()
|
||||
end
|
||||
self._mapNode.imgStoryEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgStoryIconEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtStory_End.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.goStoryEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgStoryActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgStoryActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function SwimTheme_11100Ctrl:RefreshLevelButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local bShowCountDown = false
|
||||
local state = ActivityState.NotOpen
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
if activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
elseif curTime >= openTime and curTime <= endTime then
|
||||
state = ActivityState.Open
|
||||
else
|
||||
state = ActivityState.Closed
|
||||
end
|
||||
if endTime > self.SwimThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = curTime >= self.SwimThemeData:GetActGroupEndTime()
|
||||
elseif endTime < self.SwimThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
elseif activityData.EndType == GameEnum.activityEndType.NoLimit then
|
||||
state = ActivityState.Open
|
||||
if activityData.StartTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
end
|
||||
end
|
||||
end
|
||||
if state == ActivityState.NotOpen then
|
||||
if nil == self.levelRemainTimer and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelActivityUnlockTime, sTimeStr)
|
||||
self.levelRemainTimer = self:AddTimer(0, 1, function()
|
||||
curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
if 0 < remainTime then
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelActivityUnlockTime, sTimeStr)
|
||||
else
|
||||
self._mapNode.imgLevelActivityUnlockTime:SetActive(false)
|
||||
TimerManager.Remove(self.levelRemainTimer)
|
||||
self.levelRemainTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
self:RefreshLevelButtonState(actData)
|
||||
self:RefreshActivityData()
|
||||
local activityLevelsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if nil ~= activityLevelsData then
|
||||
activityLevelsData:ChangeAllRedHot()
|
||||
end
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Open then
|
||||
if nil == self.levelRemainTimer and activityData.StartTime ~= "" and activityData.EndTime ~= "" and bShowCountDown then
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
RefreshRemainTime(endTime, self._mapNode.txtLevelActivityTime)
|
||||
self.levelRemainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = RefreshRemainTime(endTime, self._mapNode.txtLevelActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.levelRemainTimer)
|
||||
self.levelRemainTimer = nil
|
||||
self:RefreshLevelButtonState(actData)
|
||||
local activityLevelsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if activityLevelsData ~= nil then
|
||||
activityLevelsData:ChangeAllRedHot()
|
||||
end
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Closed then
|
||||
local activityLevelsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if activityLevelsData ~= nil then
|
||||
activityLevelsData:ChangeAllRedHot()
|
||||
end
|
||||
end
|
||||
self._mapNode.imgLevelActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgLevelActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.imgLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtLevel_End.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.goLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function SwimTheme_11100Ctrl:RefreshShopButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local bShowCountDown = false
|
||||
local state = ActivityState.NotOpen
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
if activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
if openTime > curTime then
|
||||
state = ActivityState.NotOpen
|
||||
elseif openTime <= curTime and endTime >= curTime then
|
||||
state = ActivityState.Open
|
||||
else
|
||||
state = ActivityState.Closed
|
||||
end
|
||||
if endTime > self.SwimThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = curTime >= self.SwimThemeData:GetActGroupEndTime()
|
||||
elseif endTime < self.SwimThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
elseif activityData.EndType == GameEnum.activityEndType.NoLimit then
|
||||
state = ActivityState.Open
|
||||
if activityData.StartTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
end
|
||||
end
|
||||
end
|
||||
if state == ActivityState.NotOpen then
|
||||
if nil == self.shopRemainTimer and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtShopActivityUnlockTime, sTimeStr)
|
||||
self.shopRemainTimer = self:AddTimer(0, 1, function()
|
||||
curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
if 0 < remainTime then
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtShopActivityUnlockTime, sTimeStr)
|
||||
else
|
||||
self._mapNode.imgShopActivityUnlockTime:SetActive(false)
|
||||
TimerManager.Remove(self.shopRemainTimer)
|
||||
self.shopRemainTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
self:RefreshShopButtonState(actData)
|
||||
self:RefreshActivityData()
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Open and nil == self.shopRemainTimer and activityData.StartTime ~= "" and activityData.EndTime ~= "" and bShowCountDown then
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
RefreshRemainTime(endTime, self._mapNode.txtShopActivityTime)
|
||||
self.shopRemainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = RefreshRemainTime(endTime, self._mapNode.txtShopActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.shopRemainTimer)
|
||||
self.shopRemainTimer = nil
|
||||
self:RefreshShopButtonState(actData)
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
self._mapNode.imgShopActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgShopActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.txtShopEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgShopEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtShop_End:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function SwimTheme_11100Ctrl:RequireActiviyData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
local callFunc = function(mapMsgData)
|
||||
self.bRequireSucc = true
|
||||
PlayerData.Activity:CacheAllActivityData(mapMsgData)
|
||||
self:RefreshPanel()
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_detail_req, {}, nil, callFunc)
|
||||
self.bRequiredActData = true
|
||||
self:AddTimer(1, 1, function()
|
||||
self.bRequiredActData = false
|
||||
end, true, true, true)
|
||||
end
|
||||
function SwimTheme_11100Ctrl:RefreshActivityData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
self:AddTimer(1, 3, self.RequireActiviyData, true, true, true)
|
||||
end
|
||||
function SwimTheme_11100Ctrl:OnBtn_ClickActivityEntrance(btn, nIndex)
|
||||
local actData = self.SwimThemeData:GetActivityDataByIndex(nIndex)
|
||||
local state = self.tbActState[actData.ActivityId]
|
||||
if nil == state then
|
||||
return
|
||||
end
|
||||
if state == ActivityState.Closed then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
|
||||
return
|
||||
elseif state == ActivityState.NotOpen then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
return
|
||||
elseif state == ActivityState.Open then
|
||||
local activityData = PlayerData.Activity:GetActivityDataById(actData.ActivityId)
|
||||
if activityData == nil then
|
||||
local bHint = true
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
bHint = not PlayerData.ActivityAvg:HasActivityData(actData.ActivityId)
|
||||
end
|
||||
if self.bRequiredActData and bHint then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Data_Refreshing"))
|
||||
return
|
||||
end
|
||||
if bHint then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
self:RequireActiviyData()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
if actData.PanelId ~= nil and ActivityState.Open == state then
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.MiniGame then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
|
||||
end
|
||||
local miniGameData = PlayerData.Activity:GetActivityDataById(actData.ActivityId)
|
||||
if miniGameData ~= nil then
|
||||
miniGameData:RequestLevelData(0, callback)
|
||||
end
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
|
||||
end
|
||||
end
|
||||
end
|
||||
return SwimTheme_11100Ctrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local SwimTheme_11100Panel = class("SwimTheme_11100Panel", BasePanel)
|
||||
SwimTheme_11100Panel._sUIResRootPath = "UI_Activity/"
|
||||
SwimTheme_11100Panel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "11100/SwimThemePanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.11100.SwimTheme_11100Ctrl"
|
||||
}
|
||||
}
|
||||
function SwimTheme_11100Panel:Awake()
|
||||
end
|
||||
function SwimTheme_11100Panel:OnEnable()
|
||||
end
|
||||
function SwimTheme_11100Panel:OnDisable()
|
||||
end
|
||||
function SwimTheme_11100Panel:OnDestroy()
|
||||
end
|
||||
function SwimTheme_11100Panel:OnRelease()
|
||||
end
|
||||
return SwimTheme_11100Panel
|
||||
@@ -0,0 +1,16 @@
|
||||
local SwimTask_11100Panel = class("SwimTask_11100Panel", BasePanel)
|
||||
SwimTask_11100Panel._sUIResRootPath = "UI_Activity/"
|
||||
SwimTask_11100Panel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "11100/Task.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.TaskCommon.TaskCommonCtrl_01"
|
||||
}
|
||||
}
|
||||
local tbImgDbType = {SizeDelta = 1, FillAmount = 2}
|
||||
function SwimTask_11100Panel:Awake()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" and tbParam[3] == nil then
|
||||
tbParam[3] = tbImgDbType.SizeDelta
|
||||
end
|
||||
end
|
||||
return SwimTask_11100Panel
|
||||
@@ -214,10 +214,10 @@ end
|
||||
function ChristmasThemeCtrl:RefreshTime()
|
||||
local bOpen = self.ChristmasData:CheckActivityGroupOpen()
|
||||
if bOpen then
|
||||
self:RefreshRemainTime(self.ChristmasData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
RefreshRemainTime(self.ChristmasData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(self.ChristmasData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
local remainTime = RefreshRemainTime(self.ChristmasData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
@@ -233,41 +233,6 @@ function ChristmasThemeCtrl:RefreshTime()
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityDate, dateStr)
|
||||
end
|
||||
function ChristmasThemeCtrl:RefreshRemainTime(endTime, txtComp)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(txtComp, sTimeStr)
|
||||
return remainTime
|
||||
end
|
||||
function ChristmasThemeCtrl:RefreshRemainOpenTime(openTime)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
@@ -347,7 +312,7 @@ function ChristmasThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTran
|
||||
end
|
||||
else
|
||||
imgTrans:SetActive(false)
|
||||
TimerManager.Remove(timer)
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
refreshFunc(actData)
|
||||
@@ -366,12 +331,12 @@ function ChristmasThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTran
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
if timer == nil and bShowCountDown then
|
||||
self:RefreshRemainTime(endTime, txtTrans)
|
||||
RefreshRemainTime(endTime, txtTrans)
|
||||
do
|
||||
local fcTimer = function()
|
||||
local remainTime = self:RefreshRemainTime(endTime, txtTrans)
|
||||
local remainTime = RefreshRemainTime(endTime, txtTrans)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(timer)
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
refreshFunc(actData)
|
||||
end
|
||||
|
||||
@@ -292,10 +292,10 @@ end
|
||||
function SolodanceThemeCtrl:RefreshTime()
|
||||
local bOpen = self.SolodanceData:CheckActivityGroupOpen()
|
||||
if bOpen then
|
||||
self:RefreshRemainTime(self.SolodanceData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
RefreshRemainTime(self.SolodanceData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(self.SolodanceData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
local remainTime = RefreshRemainTime(self.SolodanceData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
@@ -311,41 +311,6 @@ function SolodanceThemeCtrl:RefreshTime()
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityDate, dateStr)
|
||||
end
|
||||
function SolodanceThemeCtrl:RefreshRemainTime(endTime, txtComp)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(txtComp, sTimeStr)
|
||||
return remainTime
|
||||
end
|
||||
function SolodanceThemeCtrl:RefreshRemainOpenTime(openTime)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
@@ -425,7 +390,7 @@ function SolodanceThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTran
|
||||
end
|
||||
else
|
||||
imgTrans:SetActive(false)
|
||||
TimerManager.Remove(timer)
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
refreshFunc(actData)
|
||||
@@ -444,12 +409,12 @@ function SolodanceThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTran
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
if timer == nil and bShowCountDown then
|
||||
self:RefreshRemainTime(endTime, txtTrans)
|
||||
RefreshRemainTime(endTime, txtTrans)
|
||||
do
|
||||
local fcTimer = function()
|
||||
local remainTime = self:RefreshRemainTime(endTime, txtTrans)
|
||||
local remainTime = RefreshRemainTime(endTime, txtTrans)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(timer)
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
refreshFunc(actData)
|
||||
end
|
||||
|
||||
@@ -121,10 +121,10 @@ end
|
||||
function BreakOutThemeCtrl:RefreshTime()
|
||||
local bOpen = self.BreakOut_30101Data:CheckActivityGroupOpen()
|
||||
if bOpen then
|
||||
self:RefreshRemainTime(self.BreakOut_30101Data:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
RefreshRemainTime(self.BreakOut_30101Data:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(self.BreakOut_30101Data:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
local remainTime = RefreshRemainTime(self.BreakOut_30101Data:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
@@ -133,41 +133,6 @@ function BreakOutThemeCtrl:RefreshTime()
|
||||
end
|
||||
end
|
||||
end
|
||||
function BreakOutThemeCtrl:RefreshRemainTime(endTime, txtComp)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(txtComp, sTimeStr)
|
||||
return remainTime
|
||||
end
|
||||
function BreakOutThemeCtrl:RefreshRemainOpenTime(openTime)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
@@ -244,7 +209,7 @@ function BreakOutThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans
|
||||
end
|
||||
else
|
||||
imgTrans:SetActive(false)
|
||||
TimerManager.Remove(timer)
|
||||
TimerManager.Remove(countDownTimer)
|
||||
countDownTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
refreshFunc(actData)
|
||||
@@ -263,12 +228,12 @@ function BreakOutThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
if timer == nil and bShowCountDown then
|
||||
self:RefreshRemainTime(endTime, txtTrans)
|
||||
RefreshRemainTime(endTime, txtTrans)
|
||||
do
|
||||
local fcTimer = function()
|
||||
local remainTime = self:RefreshRemainTime(endTime, txtTrans)
|
||||
local remainTime = RefreshRemainTime(endTime, txtTrans)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(timer)
|
||||
TimerManager.Remove(countDownTimer)
|
||||
countDownTimer = nil
|
||||
refreshFunc(actData)
|
||||
end
|
||||
|
||||
@@ -1,250 +0,0 @@
|
||||
local ActivityShopCtrl = class("ActivityShopCtrl", BaseCtrl)
|
||||
local LocalSettingData = require("GameCore.Data.LocalSettingData")
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local BubbleVoiceManager = require("Game.Actor2D.BubbleVoiceManager")
|
||||
local PlayerVoiceData = PlayerData.Voice
|
||||
ActivityShopCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
rawImgActor2D = {
|
||||
sNodeName = "----Actor2D----",
|
||||
sComponentName = "RawImage"
|
||||
},
|
||||
trActor2D_PNG = {
|
||||
sNodeName = "----Actor2D_PNG----",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
aniRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
btnActor2D = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Actor2D"
|
||||
},
|
||||
svTog = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
trSvTog = {sNodeName = "svTog", sComponentName = "Transform"},
|
||||
Goods = {
|
||||
sNodeName = "---Goods---",
|
||||
sCtrlName = "Game.UI.ActivityTheme.30101.Shop.ActivityShopGoodsCtrl"
|
||||
},
|
||||
goBubbleRoot = {
|
||||
sNodeName = "----fixed_bubble----"
|
||||
}
|
||||
}
|
||||
ActivityShopCtrl._mapEventConfig = {
|
||||
ActivityShopTimeRefresh = "OnEvent_TimeRefresh",
|
||||
[EventId.ShowBubbleVoiceText] = "OnEvent_ShowBubbleVoiceText",
|
||||
ActivityShopBuyVoice = "PlayBuyVoice",
|
||||
[EventId.UIBackConfirm] = "OnEvent_UIBack",
|
||||
[EventId.UIHomeConfirm] = "OnEvent_Home"
|
||||
}
|
||||
function ActivityShopCtrl:CheckShopData()
|
||||
EventManager.Hit("ActivityShopCloseDetail")
|
||||
self._panel.actShopData:RefreshActivityShopData()
|
||||
self:RefreshData()
|
||||
if self.nShopCount == 0 or not self.nSelectShop then
|
||||
return
|
||||
end
|
||||
self:RefreshTog()
|
||||
self:SetTimer()
|
||||
self:SwitchTog()
|
||||
self:RefreshNPC2D()
|
||||
end
|
||||
function ActivityShopCtrl:RefreshData()
|
||||
self.tbShops = self._panel.actShopData:GetShopList()
|
||||
self.nShopCount = #self.tbShops
|
||||
self.ctrlTog = {}
|
||||
if self.nCurTog == nil then
|
||||
self.nCurTog = 1
|
||||
if self._panel.nDefaultId then
|
||||
for k, v in ipairs(self.tbShops) do
|
||||
if v.nId == self._panel.nDefaultId then
|
||||
self.nCurTog = k
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if not self.tbShops[self.nCurTog] or self.nSelectShop and self.tbShops[self.nCurTog].nId ~= self.nSelectShop then
|
||||
self.nCurTog = 1
|
||||
end
|
||||
if self.tbShops[self.nCurTog] then
|
||||
self.nSelectShop = self.tbShops[self.nCurTog].nId
|
||||
end
|
||||
end
|
||||
function ActivityShopCtrl:RefreshTog()
|
||||
if self.nShopCount > 1 then
|
||||
self._mapNode.svTog.gameObject:SetActive(true)
|
||||
for nInstanceID, objCtrl in pairs(self.ctrlTog) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.ctrlTog[nInstanceID] = nil
|
||||
end
|
||||
self._mapNode.svTog:Init(self.nShopCount, self, self.OnGridRefresh, self.OnGridBtnClick)
|
||||
else
|
||||
self._mapNode.svTog.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function ActivityShopCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local nInstanceID = goGrid:GetInstanceID()
|
||||
if not self.ctrlTog[nInstanceID] then
|
||||
self.ctrlTog[nInstanceID] = self:BindCtrlByNode(goGrid, "Game.UI.TemplateEx.TemplateToggleCtrl")
|
||||
end
|
||||
local mapCfg = ConfigTable.GetData("ActivityShop", self.tbShops[nIndex].nId)
|
||||
if mapCfg then
|
||||
self.ctrlTog[nInstanceID]:SetText(mapCfg.Name)
|
||||
end
|
||||
self.ctrlTog[nInstanceID]:SetDefault(nIndex == self.nCurTog)
|
||||
end
|
||||
function ActivityShopCtrl:OnGridBtnClick(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local nInstanceID = goGrid:GetInstanceID()
|
||||
if nIndex == self.nCurTog then
|
||||
return
|
||||
end
|
||||
self.ctrlTog[nInstanceID]:SetTrigger(true)
|
||||
if self.nCurTog then
|
||||
local goSelect = self._mapNode.trSvTog:Find("Viewport/Content/" .. self.nCurTog - 1)
|
||||
if goSelect then
|
||||
self.ctrlTog[goSelect.gameObject:GetInstanceID()]:SetTrigger(false)
|
||||
end
|
||||
end
|
||||
self.nCurTog = nIndex
|
||||
self.nSelectShop = self.tbShops[self.nCurTog].nId
|
||||
self:SwitchTog()
|
||||
self._mapNode.aniRoot:Play("ShopPanel_in")
|
||||
self:PlaySwitchTogVoice()
|
||||
end
|
||||
function ActivityShopCtrl:SetTimer()
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel(false)
|
||||
self.timer = nil
|
||||
end
|
||||
local nTime = self._panel.actShopData:GetShopAutoUpdateTime()
|
||||
if 0 < nTime then
|
||||
self.timer = self:AddTimer(1, nTime, function()
|
||||
self:CheckShopData()
|
||||
if self.nShopCount == 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
|
||||
EventManager.Hit(EventId.CloseMessageBox)
|
||||
EventManager.Hit(EventId.CloesCurPanel)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Shop_ShopRefresh"))
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
end
|
||||
function ActivityShopCtrl:SwitchTog()
|
||||
local mapShop = self.tbShops[self.nCurTog]
|
||||
local mapCfg = ConfigTable.GetData("ActivityShop", mapShop.nId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
self._mapNode.TopBar:CreateCoin({
|
||||
mapCfg.CurrencyItemId
|
||||
})
|
||||
self._mapNode.Goods:Open(mapShop.nId, mapShop.nNextRefreshTime)
|
||||
end
|
||||
function ActivityShopCtrl:RefreshNPC2D()
|
||||
local bUseL2D = LocalSettingData.mapData.UseLive2D
|
||||
self._mapNode.rawImgActor2D.transform.localScale = bUseL2D == true and Vector3.one or Vector3.zero
|
||||
self._mapNode.trActor2D_PNG.localScale = bUseL2D == true and Vector3.zero or Vector3.one
|
||||
if bUseL2D == true then
|
||||
Actor2DManager.SetBoardNPC2D(PanelId.SwimShop, self._mapNode.rawImgActor2D, self.nNpcId)
|
||||
else
|
||||
Actor2DManager.SetBoardNPC2D_PNG(self._mapNode.trActor2D_PNG, PanelId.SwimShop, self.nNpcId)
|
||||
end
|
||||
end
|
||||
function ActivityShopCtrl:PlayEnterVoice()
|
||||
local bFirst = self._panel.actShopData:GetShopFirstIn()
|
||||
local sTimeVoice = PlayerData.Voice:GetNPCGreetTimeVoiceKey()
|
||||
if bFirst then
|
||||
PlayerData.Voice:PlayCharVoice(sTimeVoice, self.nNpcId, nil, true)
|
||||
else
|
||||
local nIndex = math.random(1, 2)
|
||||
local sVoice = nIndex == 1 and sTimeVoice or "greet_npc"
|
||||
PlayerData.Voice:PlayCharVoice(sVoice, self.nNpcId, nil, true)
|
||||
end
|
||||
end
|
||||
function ActivityShopCtrl:PlayBuyVoice(bLimit)
|
||||
local sVoice = ""
|
||||
if bLimit then
|
||||
sVoice = "limited"
|
||||
else
|
||||
sVoice = "thank_npc"
|
||||
end
|
||||
PlayerData.Voice:PlayCharVoice(sVoice, self.nNpcId, nil, true)
|
||||
end
|
||||
function ActivityShopCtrl:PlaySwitchTogVoice()
|
||||
PlayerData.Voice:PlayCharVoice("Tab", self.nNpcId, nil, true)
|
||||
end
|
||||
function ActivityShopCtrl:RefreshNPCId()
|
||||
local mapCfg = ConfigTable.GetData("ActivityShopControl", self._panel.nActId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
local tbNpc = mapCfg.Npc
|
||||
local nRandomIndex = math.random(1, #tbNpc)
|
||||
self.nNpcId = tbNpc[nRandomIndex]
|
||||
end
|
||||
function ActivityShopCtrl:FadeIn(bPlayFadeIn)
|
||||
self._mapNode.aniRoot:Play("ShopPanel_in")
|
||||
end
|
||||
function ActivityShopCtrl:Awake()
|
||||
self.nCurTog = nil
|
||||
end
|
||||
function ActivityShopCtrl:OnEnable()
|
||||
self:RefreshNPCId()
|
||||
PlayerVoiceData:StartBoardFreeTimer(self.nNpcId)
|
||||
self:PlayEnterVoice()
|
||||
self:CheckShopData()
|
||||
end
|
||||
function ActivityShopCtrl:OnDisable()
|
||||
if self.ctrlTog then
|
||||
for nInstanceId, objCtrl in pairs(self.ctrlTog) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.ctrlTog[nInstanceId] = nil
|
||||
end
|
||||
self.ctrlTog = {}
|
||||
end
|
||||
Actor2DManager.UnsetBoardNPC2D()
|
||||
BubbleVoiceManager.StopBubbleAnim()
|
||||
PlayerVoiceData:ClearTimer()
|
||||
PlayerVoiceData:StopCharVoice()
|
||||
end
|
||||
function ActivityShopCtrl:OnDestroy()
|
||||
end
|
||||
function ActivityShopCtrl:OnBtnClick_Actor2D()
|
||||
PlayerVoiceData:PlayBoardNPCClickVoice(self.nNpcId)
|
||||
end
|
||||
function ActivityShopCtrl:OnEvent_TimeRefresh()
|
||||
self:CheckShopData()
|
||||
end
|
||||
function ActivityShopCtrl:OnEvent_ShowBubbleVoiceText(nNpcId, nId)
|
||||
if nNpcId ~= self.nNpcId then
|
||||
return
|
||||
end
|
||||
local mapVoDirectoryData = ConfigTable.GetData("VoDirectory", nId)
|
||||
if mapVoDirectoryData == nil then
|
||||
printError("VoDirectory未找到数据id:" .. nId)
|
||||
return
|
||||
end
|
||||
BubbleVoiceManager.PlayFixedBubbleAnim(self._mapNode.goBubbleRoot, mapVoDirectoryData.voResource)
|
||||
end
|
||||
function ActivityShopCtrl:OnEvent_UIBack(nPanelId)
|
||||
if PanelId.DiscSample ~= nPanelId or PanelId.CharBgTrialPanel ~= nPanelId then
|
||||
PlayerVoiceData:StartBoardFreeTimer(self.nNpcId)
|
||||
CS.WwiseAudioManager.Instance:SetState("menuTransition", "open")
|
||||
end
|
||||
end
|
||||
function ActivityShopCtrl:OnEvent_Home(nPanelId)
|
||||
if PanelId.DiscSample ~= nPanelId or PanelId.CharBgTrialPanel ~= nPanelId then
|
||||
PlayerVoiceData:StartBoardFreeTimer(self.nNpcId)
|
||||
end
|
||||
end
|
||||
return ActivityShopCtrl
|
||||
@@ -1,75 +0,0 @@
|
||||
local ActivityShopGoodsCtrl = class("ActivityShopGoodsCtrl", BaseCtrl)
|
||||
ActivityShopGoodsCtrl._mapNodeConfig = {
|
||||
sv = {
|
||||
sComponentName = "LoopScrollView"
|
||||
}
|
||||
}
|
||||
ActivityShopGoodsCtrl._mapEventConfig = {
|
||||
ActivityShopRefreshGoods = "CheckGoodsData"
|
||||
}
|
||||
function ActivityShopGoodsCtrl:Open(nShopId, nShopAutoTime)
|
||||
self.nShopId = nShopId
|
||||
self.nShopAutoTime = nShopAutoTime
|
||||
self:CheckGoodsData(true)
|
||||
end
|
||||
function ActivityShopGoodsCtrl:CheckGoodsData(bResetPos)
|
||||
self._panel.actShopData:CheckGoodsData(self.nShopId)
|
||||
self.tbGoods = self._panel.actShopData:GetGoodsList(self.nShopId)
|
||||
self:SetTimer()
|
||||
self:RefreshList(bResetPos)
|
||||
end
|
||||
function ActivityShopGoodsCtrl:SetTimer()
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel(false)
|
||||
self.timer = nil
|
||||
end
|
||||
local nTime = self._panel.actShopData:GetGoodsAutoUpdateTime(self.nShopId)
|
||||
if 0 < nTime and (self.nShopAutoTime == 0 or nTime < self.nShopAutoTime) then
|
||||
self.timer = self:AddTimer(1, nTime, function()
|
||||
EventManager.Hit("ActivityShopCloseDetail")
|
||||
EventManager.Hit(EventId.CloseMessageBox)
|
||||
self:CheckGoodsData(true)
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Shop_GoodsRefresh"))
|
||||
end, true, true, false)
|
||||
end
|
||||
end
|
||||
function ActivityShopGoodsCtrl:RefreshList(bResetPos)
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self._mapNode.sv:SetAnim(0.04)
|
||||
self._mapNode.sv:Init(#self.tbGoods, self, self.OnGridRefresh, self.OnGridBtnClick, not bResetPos)
|
||||
end
|
||||
function ActivityShopGoodsCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local mapData = self.tbGoods[nIndex]
|
||||
local nInstanceID = goGrid:GetInstanceID()
|
||||
if not self.tbGridCtrl[nInstanceID] then
|
||||
self.tbGridCtrl[nInstanceID] = self:BindCtrlByNode(goGrid, "Game.UI.ActivityTheme.30101.Shop.ActivityShopGoodsItemCtrl")
|
||||
end
|
||||
local mapCfg = ConfigTable.GetData("ActivityShop", self.nShopId)
|
||||
if mapCfg then
|
||||
self.tbGridCtrl[nInstanceID]:Refresh(mapData, mapCfg.CurrencyItemId)
|
||||
end
|
||||
end
|
||||
function ActivityShopGoodsCtrl:OnGridBtnClick(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local mapData = self.tbGoods[nIndex]
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ShopPopup_30101, mapData, self.nShopId, self._panel.nActId)
|
||||
end
|
||||
function ActivityShopGoodsCtrl:Awake()
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityShopGoodsCtrl:OnEnable()
|
||||
end
|
||||
function ActivityShopGoodsCtrl:OnDisable()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityShopGoodsCtrl:OnDestroy()
|
||||
end
|
||||
return ActivityShopGoodsCtrl
|
||||
@@ -1,256 +0,0 @@
|
||||
local ActivityShopGoodsDetailCtrl = class("ActivityShopGoodsDetailCtrl", BaseCtrl)
|
||||
ActivityShopGoodsDetailCtrl._mapNodeConfig = {
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Shop_TitleBuy"
|
||||
},
|
||||
goItem = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
btnDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
txtDesc = {sComponentName = "TMP_Text"},
|
||||
txtHas = {sComponentName = "TMP_Text"},
|
||||
txtPriceCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Shop_UnitPrice"
|
||||
},
|
||||
imgCoin = {nCount = 2, sComponentName = "Image"},
|
||||
txtPrice = {sComponentName = "TMP_Text"},
|
||||
txtStock = {sComponentName = "TMP_Text"},
|
||||
goStock = {},
|
||||
txtBtnBuy = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Shop_Btn_Buy"
|
||||
},
|
||||
txtCoinCount = {sComponentName = "TMP_Text"},
|
||||
btnBuy = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Buy"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnBuy2 = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Disable"
|
||||
},
|
||||
txtDisable = {sComponentName = "TMP_Text"},
|
||||
goQuantitySelector = {
|
||||
sNodeName = "tc_quantity_selector",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateQuantitySelectorCtrl"
|
||||
}
|
||||
}
|
||||
ActivityShopGoodsDetailCtrl._mapEventConfig = {}
|
||||
function ActivityShopGoodsDetailCtrl:Refresh(mapData, nShopId, nActId)
|
||||
self.mapGoodsCfg = ConfigTable.GetData("ActivityGoods", mapData.nId)
|
||||
local mapShopCfg = ConfigTable.GetData("ActivityShop", nShopId)
|
||||
if not self.mapGoodsCfg or not mapShopCfg then
|
||||
return
|
||||
end
|
||||
self.mapData = mapData
|
||||
self.nShopId = nShopId
|
||||
self.nCurrencyItemId = mapShopCfg.CurrencyItemId
|
||||
self.bAble = mapData.bPurchasTime and mapData.bPurchasable and not mapData.bSoldOut
|
||||
self.actShopData = PlayerData.Activity:GetActivityDataById(nActId)
|
||||
self:PlayInAni()
|
||||
self:RefreshInfo()
|
||||
self:RefreshPrice()
|
||||
self:RefreshBuyState()
|
||||
self:RefreshBuyCount()
|
||||
end
|
||||
function ActivityShopGoodsDetailCtrl:RefreshInfo()
|
||||
local nItemId = self.mapGoodsCfg.ItemId
|
||||
local mapCfg = ConfigTable.GetData_Item(nItemId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, self.mapGoodsCfg.Name)
|
||||
self._mapNode.goItem:SetItem(nItemId, nil, self.mapGoodsCfg.ItemQuantity, nil, nil, nil, nil, true)
|
||||
if mapCfg.Type == GameEnum.itemType.Disc or mapCfg.Type == GameEnum.itemType.Char or mapCfg.Type == GameEnum.itemType.CharacterSkin then
|
||||
self._mapNode.txtHas.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.txtHas.gameObject:SetActive(true)
|
||||
local nCount = PlayerData.Item:GetItemCountByID(nItemId)
|
||||
if 999999 < nCount then
|
||||
local nFloor = math.floor(nCount / 100)
|
||||
local nK = string.format("%.0f", nFloor / 10)
|
||||
local sCount = nK .. "k"
|
||||
NovaAPI.SetTMPText(self._mapNode.txtHas, ConfigTable.GetUIText("Shop_Has") .. sCount)
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtHas, ConfigTable.GetUIText("Shop_Has") .. nCount)
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDesc, self.mapGoodsCfg.Desc)
|
||||
local bLimit = self.mapData.nMaximumLimit > 0
|
||||
if bLimit then
|
||||
local nLeft = self.mapData.nMaximumLimit - self.mapData.nBoughtCount
|
||||
NovaAPI.SetTMPText(self._mapNode.txtStock, orderedFormat(ConfigTable.GetUIText("Shop_Stock"), nLeft))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtStock, nLeft == 0 and Red_Unable or Blue_Dark)
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtStock, ConfigTable.GetUIText("Shop_Unlimited"))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtStock, Blue_Dark)
|
||||
end
|
||||
self._mapNode.btnDetail.interactable = mapCfg and (mapCfg.Stype == GameEnum.itemStype.Disc or mapCfg.Stype == GameEnum.itemStype.Char or mapCfg.Stype == GameEnum.itemStype.RandomPackage or mapCfg.Stype == GameEnum.itemStype.ComCYO or mapCfg.Stype == GameEnum.itemStype.OutfitCYO)
|
||||
end
|
||||
function ActivityShopGoodsDetailCtrl:RefreshPrice()
|
||||
for i = 1, 2 do
|
||||
self:SetSprite_Coin(self._mapNode.imgCoin[i], self.nCurrencyItemId)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPrice, self.mapGoodsCfg.Price)
|
||||
end
|
||||
function ActivityShopGoodsDetailCtrl:RefreshBuyCount()
|
||||
local nCost = self.nBuyCount * self.mapGoodsCfg.Price
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, nCost)
|
||||
local nHasCoin = PlayerData.Item:GetItemCountByID(self.nCurrencyItemId)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtCoinCount, nCost > nHasCoin and Red_Unable or Blue_Normal)
|
||||
end
|
||||
function ActivityShopGoodsDetailCtrl:RefreshBuyState()
|
||||
self._mapNode.btnBuy.gameObject:SetActive(self.bAble)
|
||||
self._mapNode.btnBuy2.gameObject:SetActive(not self.bAble)
|
||||
self._mapNode.txtDisable.gameObject:SetActive(not self.mapData.bPurchasable or self.mapData.bSoldOut)
|
||||
self.nBuyCount = self.bAble and 1 or 0
|
||||
local nMax = self:CountMaxBuy()
|
||||
local callback = function(nCount)
|
||||
self.nBuyCount = nCount
|
||||
self:RefreshBuyCount()
|
||||
end
|
||||
self._mapNode.goQuantitySelector:Init(callback, self.nBuyCount, nMax)
|
||||
if self.mapData.bSoldOut then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDisable, ConfigTable.GetUIText("Shop_Cond_SoldOutShort"))
|
||||
elseif not self.mapData.bPurchasable then
|
||||
if self.mapData.nPurchaseCondType == GameEnum.shopCond.WorldClassSpecific then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDisable, orderedFormat(ConfigTable.GetUIText("Shop_Cond_WorldClassShort"), self.mapData.tbPurchaseCondParams[1]))
|
||||
elseif self.mapData.nPurchaseCondType == GameEnum.shopCond.ShopPreGoodsSellOut or self.mapData.nPurchaseCondType == GameEnum.shopCond.ActivityShopPreGoodsSellOut then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDisable, ConfigTable.GetUIText("Shop_Cond_PreGoodsSellOut"))
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityShopGoodsDetailCtrl:CountMaxBuy()
|
||||
local nHasCoin = PlayerData.Item:GetItemCountByID(self.nCurrencyItemId)
|
||||
local nMax = math.floor(nHasCoin / self.mapGoodsCfg.Price)
|
||||
if nMax == 0 then
|
||||
return 1
|
||||
end
|
||||
if 0 < self.mapData.nMaximumLimit then
|
||||
local nRemain = self.mapData.nMaximumLimit - self.mapData.nBoughtCount
|
||||
return nMax > nRemain and nRemain or nMax
|
||||
else
|
||||
return nMax
|
||||
end
|
||||
end
|
||||
function ActivityShopGoodsDetailCtrl:PlayInAni()
|
||||
self.gameObject:SetActive(true)
|
||||
self.ani:Play("t_window_04_t_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
function ActivityShopGoodsDetailCtrl:PlayOutAni()
|
||||
self.ani:Play("t_window_04_t_out")
|
||||
self:AddTimer(1, 0.2, "Close", true, true, true)
|
||||
end
|
||||
function ActivityShopGoodsDetailCtrl:Close()
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
function ActivityShopGoodsDetailCtrl:Awake()
|
||||
self.ani = self.gameObject.transform:GetComponent("Animator")
|
||||
end
|
||||
function ActivityShopGoodsDetailCtrl:OnEnable()
|
||||
end
|
||||
function ActivityShopGoodsDetailCtrl:OnDisable()
|
||||
end
|
||||
function ActivityShopGoodsDetailCtrl:OnDestroy()
|
||||
end
|
||||
function ActivityShopGoodsDetailCtrl:OnBtnClick_Buy()
|
||||
local nCost = self.nBuyCount * self.mapGoodsCfg.Price
|
||||
local nHasCoin = PlayerData.Item:GetItemCountByID(self.nCurrencyItemId)
|
||||
local sName = ConfigTable.GetData_Item(self.nCurrencyItemId).Title
|
||||
if nCost > nHasCoin then
|
||||
EventManager.Hit(EventId.OpenMessageBox, orderedFormat(ConfigTable.GetUIText("Shop_NotEnough"), sName))
|
||||
return
|
||||
end
|
||||
local buy = function()
|
||||
local callback = function()
|
||||
EventManager.Hit("ActivityShopRefreshGoods")
|
||||
EventManager.Hit("ActivityShopCloseDetail")
|
||||
local bLimit = self.mapData.nMaximumLimit > 0
|
||||
EventManager.Hit("ActivityShopBuyVoice", bLimit)
|
||||
end
|
||||
self.actShopData:SendActivityShopPurchaseReq(self.nShopId, self.mapData.nId, self.nBuyCount, callback)
|
||||
end
|
||||
local buy_confirm = function()
|
||||
local nAll = self.mapGoodsCfg.ItemQuantity * self.nBuyCount
|
||||
local sTip = 1 < nAll and orderedFormat(ConfigTable.GetUIText("Shop_MultiBuyComfirm"), nCost, sName, nAll, self.mapGoodsCfg.Name) or orderedFormat(ConfigTable.GetUIText("Shop_BuyComfirm"), nCost, sName, self.mapGoodsCfg.Name)
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = sTip,
|
||||
callbackConfirm = buy,
|
||||
bBlur = false
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
local nItemId = self.mapGoodsCfg.ItemId
|
||||
local mapCfg = ConfigTable.GetData_Item(nItemId)
|
||||
local sTip
|
||||
if mapCfg then
|
||||
if mapCfg.Type == GameEnum.itemType.Disc then
|
||||
sTip = PlayerData.Item:GetDiscHoldingState(nItemId, self.nBuyCount)
|
||||
elseif mapCfg.Type == GameEnum.itemType.Char then
|
||||
sTip = PlayerData.Item:GetCharHoldingState(nItemId, self.nBuyCount)
|
||||
elseif mapCfg.Stype == GameEnum.itemStype.CharShard then
|
||||
local nCharId = PlayerData.Talent:GetFragmentsToChar(nItemId)
|
||||
sTip = PlayerData.Item:GetCharHoldingState(nCharId, 0, self.nBuyCount)
|
||||
end
|
||||
end
|
||||
if sTip then
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = sTip,
|
||||
callbackConfirm = buy_confirm,
|
||||
bBlur = false
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
else
|
||||
buy_confirm()
|
||||
end
|
||||
end
|
||||
function ActivityShopGoodsDetailCtrl:OnBtnClick_Close()
|
||||
EventManager.Hit("ActivityShopCloseDetail")
|
||||
end
|
||||
function ActivityShopGoodsDetailCtrl:OnBtnClick_Detail()
|
||||
local nItemId = self.mapGoodsCfg.ItemId
|
||||
local mapCfg = ConfigTable.GetData_Item(nItemId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
if mapCfg.Stype == GameEnum.itemStype.Disc then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSample, nItemId)
|
||||
elseif mapCfg.Stype == GameEnum.itemStype.Char then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgTrialPanel, PanelId.CharInfoTrial, nItemId)
|
||||
elseif mapCfg.Stype == GameEnum.itemStype.RandomPackage or mapCfg.Stype == GameEnum.itemStype.ComCYO then
|
||||
local tbDetailItem, sDetailTitle = PlayerData.Item:GetCYODisplayItem(nItemId)
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.ItemList,
|
||||
tbItem = tbDetailItem,
|
||||
sTitle = sDetailTitle,
|
||||
bBlur = false
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
elseif mapCfg.Stype == GameEnum.itemStype.OutfitCYO then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscPreview, nItemId)
|
||||
end
|
||||
end
|
||||
function ActivityShopGoodsDetailCtrl:OnBtnClick_Disable()
|
||||
if self.mapData.bSoldOut then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Shop_GoodsEmpty"))
|
||||
elseif not self.mapData.bPurchasable then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Shop_Condition"))
|
||||
elseif not self.mapData.bPurchasTime then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Shop_NotPurchasTime"))
|
||||
end
|
||||
end
|
||||
return ActivityShopGoodsDetailCtrl
|
||||
@@ -3,7 +3,7 @@ ActivityShopPanel._sUIResRootPath = "UI_Activity/"
|
||||
ActivityShopPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "30101/Shop/ActivityShopPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.30101.Shop.ActivityShopCtrl"
|
||||
sCtrlName = "Game.UI.ActivityTheme.ShopCommon.ActivityShopCtrl"
|
||||
}
|
||||
}
|
||||
function ActivityShopPanel:Awake()
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
local ActivityShopPopupCtrl = class("ActivityShopPopupCtrl", BaseCtrl)
|
||||
ActivityShopPopupCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
blur = {
|
||||
sNodeName = "t_fullscreen_blur_blue"
|
||||
},
|
||||
aniBlur = {
|
||||
sNodeName = "t_fullscreen_blur_blue",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
btnCloseDatail = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_CloseDetail"
|
||||
},
|
||||
Detail = {
|
||||
sNodeName = "---Detail---",
|
||||
sCtrlName = "Game.UI.ActivityTheme.30101.Shop.ActivityShopGoodsDetailCtrl"
|
||||
}
|
||||
}
|
||||
ActivityShopPopupCtrl._mapEventConfig = {
|
||||
ActivityShopCloseDetail = "OnBtnClick_CloseDetail"
|
||||
}
|
||||
function ActivityShopPopupCtrl:Open()
|
||||
local mapCfg = ConfigTable.GetData("ActivityShop", self.nShopId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
self._mapNode.TopBar:CreateCoin({
|
||||
mapCfg.CurrencyItemId
|
||||
}, true)
|
||||
self._mapNode.blur:SetActive(true)
|
||||
self._mapNode.Detail:Refresh(self.mapData, self.nShopId, self.nActId)
|
||||
end
|
||||
function ActivityShopPopupCtrl:Awake()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.mapData = tbParam[1]
|
||||
self.nShopId = tbParam[2]
|
||||
self.nActId = tbParam[3]
|
||||
end
|
||||
end
|
||||
function ActivityShopPopupCtrl:OnEnable()
|
||||
self:Open()
|
||||
end
|
||||
function ActivityShopPopupCtrl:OnDisable()
|
||||
end
|
||||
function ActivityShopPopupCtrl:OnDestroy()
|
||||
end
|
||||
function ActivityShopPopupCtrl:OnBtnClick_CloseDetail()
|
||||
if self._mapNode.Detail.gameObject.activeSelf == false then
|
||||
return
|
||||
end
|
||||
self._mapNode.Detail:PlayOutAni()
|
||||
self._mapNode.aniBlur:SetTrigger("tOut")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ShopPopup_30101)
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
end
|
||||
return ActivityShopPopupCtrl
|
||||
@@ -1,18 +0,0 @@
|
||||
local ActivityShopPopupPanel = class("ActivityShopPopupPanel", BasePanel)
|
||||
ActivityShopPopupPanel._sUIResRootPath = "UI_Activity/"
|
||||
ActivityShopPopupPanel._bIsMainPanel = false
|
||||
ActivityShopPopupPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "30101/Shop/ActivityShopPopupPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.30101.Shop.ActivityShopPopupCtrl"
|
||||
}
|
||||
}
|
||||
function ActivityShopPopupPanel:Awake()
|
||||
end
|
||||
function ActivityShopPopupPanel:OnEnable()
|
||||
end
|
||||
function ActivityShopPopupPanel:OnDisable()
|
||||
end
|
||||
function ActivityShopPopupPanel:OnDestroy()
|
||||
end
|
||||
return ActivityShopPopupPanel
|
||||
@@ -0,0 +1,186 @@
|
||||
local ActivityBreakOutCtrl = class("ActivityBreakOutCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivityBreakOutCtrl._mapNodeConfig = {
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Go"
|
||||
},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
svReward = {
|
||||
sNodeName = "PreviewUpgradeMaterial",
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
txtAdvanceMat = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MessageBox_Reward"
|
||||
},
|
||||
txtDate = {sComponentName = "TMP_Text"},
|
||||
imgLock = {},
|
||||
txtLock = {sComponentName = "TMP_Text"},
|
||||
btnDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txtBtnDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Detail"
|
||||
},
|
||||
imgEnd = {},
|
||||
txtActivityEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgRemaineTime = {},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GoToChallenge"
|
||||
},
|
||||
imgProgressBg = {
|
||||
sNodeName = "imgProgressBg"
|
||||
},
|
||||
imgFill = {sNodeName = "imgFill"},
|
||||
txt_Target = {
|
||||
sNodeName = "txt_Target",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "ChallengingGoals"
|
||||
},
|
||||
txtProgress = {
|
||||
sNodeName = "txtProgress",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
btn_goTaskPanel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GoTaskPanel"
|
||||
}
|
||||
}
|
||||
function ActivityBreakOutCtrl:Awake()
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityBreakOutCtrl:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivityBreakOutCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self:RefreshLockState()
|
||||
self:RefreshDate()
|
||||
self:RefreshTimeout()
|
||||
self:RefreshReward()
|
||||
end
|
||||
function ActivityBreakOutCtrl:UnInit()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivityBreakOutCtrl:UnbindCtrl()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityBreakOutCtrl:RefreshLockState()
|
||||
local IsUnlock, txtLock = self.actData:IsUnlock()
|
||||
self._mapNode.imgLock.gameObject:SetActive(not IsUnlock)
|
||||
self._mapNode.btnGo.gameObject:SetActive(IsUnlock)
|
||||
if not IsUnlock then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLock, txtLock)
|
||||
end
|
||||
end
|
||||
function ActivityBreakOutCtrl:RefreshTimeout()
|
||||
local endTime = self.actData:GetActGroupEndTime()
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
self._mapNode.imgRemaineTime:SetActive(0 < remainTime)
|
||||
self._mapNode.imgEnd:SetActive(remainTime <= 0)
|
||||
if remainTime < 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
|
||||
end
|
||||
function ActivityBreakOutCtrl:RefreshDate()
|
||||
local nOpenMonth, nOpenDay, nEndMonth, nEndDay, nOpenYear, nEndYear = self.actData:GetActGroupDate()
|
||||
local strOpenDay = string.format("%d", nOpenDay)
|
||||
local strEndDay = string.format("%d", nEndDay)
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
|
||||
end
|
||||
function ActivityBreakOutCtrl:RefreshReward()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
local rewardData = actGroupCfg.RewardsShow
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self._mapNode.svReward:Init(#rewardData, self, self.RefreshRewardGridItem, self.BtnRewardGridClick)
|
||||
end
|
||||
function ActivityBreakOutCtrl:RefreshRewardGridItem(go, index)
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
local rewardData = actGroupCfg.RewardsShow
|
||||
local rewardId = rewardData[index + 1]
|
||||
local nInstanceID = go:GetInstanceID()
|
||||
if not self.tbGridCtrl[nInstanceID] then
|
||||
self.tbGridCtrl[nInstanceID] = self:BindCtrlByNode(go, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
self.tbGridCtrl[nInstanceID]:SetItem(rewardId)
|
||||
end
|
||||
function ActivityBreakOutCtrl:BtnRewardGridClick(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
local rewardData = actGroupCfg.RewardsShow
|
||||
local item = goGrid.transform:Find("AnimRoot/item")
|
||||
UTILS.ClickItemGridWithTips(rewardData[nIndex], item.transform, true, true, false)
|
||||
end
|
||||
function ActivityBreakOutCtrl:OnBtnClick_Go()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
if actGroupCfg ~= nil then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BreakOutThemePanel_S2, actGroupCfg.Id)
|
||||
end
|
||||
end
|
||||
function ActivityBreakOutCtrl:OnBtnClick_GoTaskPanel()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Task_30102, self.nActTaskId)
|
||||
end
|
||||
function ActivityBreakOutCtrl:OnBtnClick_Detail()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
if actGroupCfg == nil then
|
||||
return
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = actGroupCfg.DesText,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function ActivityBreakOutCtrl:ClearActivity()
|
||||
end
|
||||
return ActivityBreakOutCtrl
|
||||
@@ -0,0 +1,405 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local BreakOutThemeCtrl = class("BreakOutThemeCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
BreakOutThemeCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
BreakOutLevelSelectPanel = {
|
||||
sNodeName = "----BreakOutLevelSelect----",
|
||||
sCtrlName = "Game.UI.Play_BreakOut_30101.LevelSelectCtrl"
|
||||
},
|
||||
imgProgressBg = {
|
||||
sNodeName = "imgProgressBg"
|
||||
},
|
||||
txt_Target = {
|
||||
sNodeName = "txt_Target",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "ChallengingGoals"
|
||||
},
|
||||
imgFill = {sNodeName = "imgFill"},
|
||||
txtProgress = {
|
||||
sNodeName = "txtProgress",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
TaskActivityTime = {},
|
||||
txtTaskActivityTime = {
|
||||
sNodeName = "txtTaskActivityTime",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
TaskMask = {},
|
||||
txt_TaskEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
ShopActivityTime = {},
|
||||
txt_Shop = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "ExchangeShop"
|
||||
},
|
||||
txtShopActivityTime = {
|
||||
sNodeName = "txtShopActivityTime",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
btnEntrance_ = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickActivityEntrance"
|
||||
},
|
||||
redDotEntrance2 = {}
|
||||
}
|
||||
BreakOutThemeCtrl._mapEventConfig = {
|
||||
JumpToLevelDetail = "JumpTo_LevelDetail",
|
||||
SetAnimatorState = "SetAnimatorState"
|
||||
}
|
||||
BreakOutThemeCtrl._mapRedDotConfig = {}
|
||||
local ActivityState = {
|
||||
NotOpen = 1,
|
||||
Open = 2,
|
||||
Closed = 3
|
||||
}
|
||||
function BreakOutThemeCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.BreakOut_30101Data = PlayerData.Activity:GetActivityGroupDataById(self.nActId)
|
||||
if self.BreakOut_30101Data == nil then
|
||||
printError("活动组 id:" .. self.nActId .. " 数据为空")
|
||||
return
|
||||
else
|
||||
self.ActivityGroupCfg = self.BreakOut_30101Data.actGroupConfig
|
||||
end
|
||||
self.isLevelEnd = false
|
||||
end
|
||||
function BreakOutThemeCtrl:OnEnable()
|
||||
self.BreakOutTheme_Animator = self.gameObject:GetComponent("Animator")
|
||||
if self.BreakOut_30101Data == nil then
|
||||
printError("活动组 id:" .. self.nActId .. " 数据为空")
|
||||
return
|
||||
end
|
||||
self:RefreshPanel()
|
||||
for i = 1, 5 do
|
||||
local actData = self.BreakOut_30101Data:GetActivityDataByIndex(i)
|
||||
if actData ~= nil and i == AllEnum.ActivityThemeFuncIndex.Task then
|
||||
local nActId = actData.ActivityId
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.redDotEntrance2)
|
||||
end
|
||||
end
|
||||
self:SetAnimatorState()
|
||||
end
|
||||
function BreakOutThemeCtrl:OnDisable()
|
||||
if nil ~= self.remainTimer then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
end
|
||||
if nil ~= self.shopRemainTimer then
|
||||
TimerManager.Remove(self.shopRemainTimer)
|
||||
self.shopRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.avgRemainTimer then
|
||||
TimerManager.Remove(self.avgRemainTimer)
|
||||
self.avgRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.taskRemainTimer then
|
||||
TimerManager.Remove(self.taskRemainTimer)
|
||||
self.taskRemainTimer = nil
|
||||
end
|
||||
end
|
||||
function BreakOutThemeCtrl:RefreshPanel()
|
||||
if self.BreakOut_30101Data == nil or self.ActivityGroupCfg == nil then
|
||||
return
|
||||
end
|
||||
self:RefreshTime()
|
||||
self:RefreshButtonState()
|
||||
end
|
||||
function BreakOutThemeCtrl:RefreshTime()
|
||||
local bOpen = self.BreakOut_30101Data:CheckActivityGroupOpen()
|
||||
if bOpen then
|
||||
self:RefreshRemainTime(self.BreakOut_30101Data:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(self.BreakOut_30101Data:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function BreakOutThemeCtrl:RefreshRemainTime(endTime, txtComp)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(txtComp, sTimeStr)
|
||||
return remainTime
|
||||
end
|
||||
function BreakOutThemeCtrl:RefreshRemainOpenTime(openTime)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time_Min") or "", min)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time") or "", hour)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time_Day") or "", day)
|
||||
end
|
||||
return sTimeStr
|
||||
end
|
||||
function BreakOutThemeCtrl:RefreshButtonState()
|
||||
self.tbActState = {}
|
||||
for i = 1, 5 do
|
||||
local actData = self.BreakOut_30101Data:GetActivityDataByIndex(i)
|
||||
if actData ~= nil then
|
||||
if i == AllEnum.ActivityThemeFuncIndex.Task then
|
||||
self:RefreshTaskButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Shop then
|
||||
self:RefreshShopButtonState(actData)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function BreakOutThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans, refreshFunc)
|
||||
local countDownTimer
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
local state = ActivityState.NotOpen
|
||||
local bShowCountDown = false
|
||||
if activityData ~= nil then
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
if activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
elseif curTime >= openTime and curTime <= endTime then
|
||||
state = ActivityState.Open
|
||||
else
|
||||
state = ActivityState.Closed
|
||||
end
|
||||
elseif activityData.EndType == GameEnum.activityEndType.NoLimit then
|
||||
state = ActivityState.Open
|
||||
if activityData.StartTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
end
|
||||
end
|
||||
end
|
||||
if state == ActivityState.NotOpen then
|
||||
if nil == timer and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local fcTimer = function()
|
||||
curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
if imgTrans == nil then
|
||||
return
|
||||
end
|
||||
if 0 < remainTime then
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
local txtUnlock = imgTrans:GetComponentInChildren(typeof(CS.TMPro.TMP_Text))
|
||||
if txtUnlock ~= nil then
|
||||
NovaAPI.SetTMPText(txtUnlock, sTimeStr)
|
||||
end
|
||||
else
|
||||
imgTrans:SetActive(false)
|
||||
TimerManager.Remove(timer)
|
||||
countDownTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
refreshFunc(actData)
|
||||
self:RefreshActivityData()
|
||||
end
|
||||
end
|
||||
fcTimer()
|
||||
countDownTimer = self:AddTimer(0, 1, fcTimer, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Open and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
do
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
if endTime > self.BreakOut_30101Data:GetActGroupEndTime() then
|
||||
bShowCountDown = true
|
||||
elseif endTime < self.BreakOut_30101Data:GetActGroupEndTime() then
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
if timer == nil and bShowCountDown then
|
||||
self:RefreshRemainTime(endTime, txtTrans)
|
||||
do
|
||||
local fcTimer = function()
|
||||
local remainTime = self:RefreshRemainTime(endTime, txtTrans)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(timer)
|
||||
countDownTimer = nil
|
||||
refreshFunc(actData)
|
||||
end
|
||||
end
|
||||
fcTimer()
|
||||
countDownTimer = self:AddTimer(0, 1, fcTimer, true, true, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return state, bShowCountDown, countDownTimer
|
||||
end
|
||||
function BreakOutThemeCtrl:RefreshTaskButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local actInsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
if actInsData ~= nil then
|
||||
actInsData:RefreshTaskRedDot()
|
||||
end
|
||||
self:RefreshTaskButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDownTimer = self:RefreshButtonTimer(actData, self.taskRemainTimer, self._mapNode.txtTaskActivityTime, nil, refreshFunc)
|
||||
if self.taskRemainTimer == nil then
|
||||
self.taskRemainTimer = countDownTimer
|
||||
end
|
||||
if state == ActivityState.Closed and actInsData ~= nil then
|
||||
actInsData:RefreshTaskRedDot()
|
||||
end
|
||||
self._mapNode.TaskActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.TaskMask:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
local ActivityTaskData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local nDone, nTotal = 0, 0
|
||||
if ActivityTaskData ~= nil then
|
||||
nDone, nTotal = ActivityTaskData:CalcTotalProgress()
|
||||
end
|
||||
local progress = string.format("%d/%d", nDone, nTotal)
|
||||
local rt = self._mapNode.imgProgressBg:GetComponent("RectTransform")
|
||||
local nWidth = 0 < nTotal and nDone / nTotal * rt.rect.width or 0
|
||||
self._mapNode.imgFill:GetComponent("RectTransform").sizeDelta = Vector2(nWidth, rt.rect.height)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtProgress, progress)
|
||||
end
|
||||
end
|
||||
function BreakOutThemeCtrl:RefreshShopButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
self:RefreshShopButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDownTimer = self:RefreshButtonTimer(actData, self.shopRemainTimer, self._mapNode.txtShopActivityTime, nil, refreshFunc)
|
||||
if self.shopRemainTimer == nil then
|
||||
self.shopRemainTimer = countDownTimer
|
||||
end
|
||||
self._mapNode.ShopActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function BreakOutThemeCtrl:RequireActivityData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
local callFunc = function()
|
||||
self.bRequireSucc = true
|
||||
self:RefreshPanel()
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_detail_req, {}, nil, callFunc)
|
||||
self.bRequiredActData = true
|
||||
self:AddTimer(1, 1, function()
|
||||
self.bRequiredActData = false
|
||||
end, true, true, true)
|
||||
end
|
||||
function BreakOutThemeCtrl:RefreshActivityData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
self:AddTimer(1, 3, self.RequireActivityData, true, true, true)
|
||||
end
|
||||
function BreakOutThemeCtrl:OnBtn_ClickActivityEntrance(btn, nIndex)
|
||||
local actData
|
||||
if nIndex == 1 then
|
||||
nIndex = AllEnum.ActivityThemeFuncIndex.Shop
|
||||
actData = self.BreakOut_30101Data:GetActivityDataByIndex(nIndex)
|
||||
elseif nIndex == 2 then
|
||||
nIndex = AllEnum.ActivityThemeFuncIndex.Task
|
||||
actData = self.BreakOut_30101Data:GetActivityDataByIndex(nIndex)
|
||||
end
|
||||
local state = self.tbActState[actData.ActivityId]
|
||||
if nil == state then
|
||||
return
|
||||
end
|
||||
if state == ActivityState.Closed then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
|
||||
return
|
||||
elseif state == ActivityState.NotOpen then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
return
|
||||
elseif state == ActivityState.Open then
|
||||
local activityData = PlayerData.Activity:GetActivityDataById(actData.ActivityId)
|
||||
if activityData == nil then
|
||||
local bHint = true
|
||||
if self.bRequiredActData and bHint then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Data_Refreshing"))
|
||||
return
|
||||
end
|
||||
if bHint then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
self:RequireActivityData()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
if actData.PanelId ~= nil and ActivityState.Open == state then
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
|
||||
end
|
||||
end
|
||||
function BreakOutThemeCtrl:JumpTo_LevelDetail(nActId, nLevelId)
|
||||
local OpenPanel = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BreakOutLevelDetailPanelS2, nActId, nLevelId)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, 3, OpenPanel)
|
||||
end
|
||||
function BreakOutThemeCtrl:SetAnimatorState()
|
||||
self.BreakOutTheme_Animator:Play("BreakOutThemePanel_idle", 0, 0)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForSeconds(0.02))
|
||||
self.BreakOutTheme_Animator:Play("BreakOutThemePanel_in", 0, 0)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
return BreakOutThemeCtrl
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user