Major Update - 2.0.0.143

EN: 2.0.0.143
CN: 2.0.0.142
JP: 2.0.0.145
KR: 2.0.0.150
This commit is contained in:
SL1900
2026-10-20 13:00:00 +09:00
parent 4bcada6061
commit 08b515afd9
1773 changed files with 1095195 additions and 65670 deletions
+32 -13
View File
@@ -278,11 +278,14 @@ local Init_RT = function(tbRenderer)
end
end
local UnInit_RT = function(tbRenderer)
if IsNull(tbRenderer._tr) then
return
end
if tbRenderer._targetRawImage ~= nil then
NovaAPI.SetTexture(tbRenderer._targetRawImage, nil)
tbRenderer._targetRawImage = nil
end
if tbRenderer._cam ~= nil then
if not IsNull(tbRenderer._cam) then
tbRenderer._cam.targetTexture = nil
end
if tbRenderer._RenderTexture ~= nil then
@@ -316,8 +319,12 @@ local UnSet_RawImg = function(tbRenderer)
NovaAPI.SetTexture(tbRenderer._targetRawImage, nil)
tbRenderer._targetRawImage = nil
end
tbRenderer._tr.localScale = Vector3.zero
tbRenderer._cam.gameObject:SetActive(false)
if not IsNull(tbRenderer._tr) then
tbRenderer._tr.localScale = Vector3.zero
end
if not IsNull(tbRenderer._cam) then
tbRenderer._cam.gameObject:SetActive(false)
end
end
local MAX_L2D_INS_COUNT = 5
local MAX_L2D_RENDERER_COUNT = 3
@@ -398,29 +405,38 @@ local SetL2DInsParent = function(trIns, trParent)
trIns.localScale = Vector3.one
end
local ResetRenderer = function(tbRenderer)
if IsNull(tbRenderer._tr) then
return
end
UnSet_RawImg(tbRenderer)
UnInit_RT(tbRenderer)
if tbRenderer.trL2DIns ~= nil then
if not IsNull(tbRenderer.trL2DIns) then
SetL2DInsParent(tbRenderer.trL2DIns, trL2DInsRoot)
local trBg = tbRenderer.trL2DIns:Find("root/----bg----")
if trBg ~= nil and trBg:IsNull() == false then
if not IsNull(trBg) then
trBg.localScale = Vector3.one
end
local trBgEft = tbRenderer.trL2DIns:Find("root/----bg_effect----")
if trBgEft ~= nil and trBgEft:IsNull() == false then
if not IsNull(trBgEft) then
trBgEft.localScale = Vector3.one
end
tbRenderer.trL2DIns = nil
end
tbRenderer.sL2D = nil
SetPanelOffset(tbRenderer)
tbRenderer.trOffset.localPosition = Vector3.zero
tbRenderer.trOffset.localScale = Vector3.one
if not IsNull(tbRenderer.trOffset) then
tbRenderer.trOffset.localPosition = Vector3.zero
tbRenderer.trOffset.localScale = Vector3.one
end
NovaAPI.SetSpriteRendererSprite(tbRenderer.spr_body, nil)
NovaAPI.SetSpriteRendererSprite(tbRenderer.spr_face, nil)
NovaAPI.SetSpriteRendererSprite(tbRenderer.spr_bg, nil)
tbRenderer.parent_L2D.localScale = Vector3.zero
tbRenderer.parent_PNG.localScale = Vector3.zero
if not IsNull(tbRenderer.parent_L2D) then
tbRenderer.parent_L2D.localScale = Vector3.zero
end
if not IsNull(tbRenderer.parent_PNG) then
tbRenderer.parent_PNG.localScale = Vector3.zero
end
Actor2DManager.ResetActor2DAnim(tbRenderer)
end
local GetRenderer = function(sL2D, bForceMatch, nIndex)
@@ -1494,8 +1510,7 @@ function Actor2DManager.SetActor2D_ForActor2DEditor(nPanelId, rawImg, sSkinId, b
NovaAPI.SetSPSortingOrder(tbRenderer.spr_body, 900)
NovaAPI.SetSpriteRendererColor(tbRenderer.spr_face, Color(1, 1, 1, 0.5))
NovaAPI.SetSPSortingOrder(tbRenderer.spr_face, 901)
local L2DAnimPlayer = goModel:GetComponent("L2DAnimPlayer")
L2DAnimPlayer:PlayAnimInUI("ultra", true, true)
NovaAPIHotfix.PlayAnimInUI(goModel, "ultra", true, true)
else
NovaAPI.SetSpriteRendererColor(tbRenderer.spr_body, Color.white)
NovaAPI.SetSPSortingOrder(tbRenderer.spr_body, 0)
@@ -1588,7 +1603,11 @@ function Actor2DManager.SetL2D_InBBVEditor(rawImg, bIsNpc, nSkinId, bIsCG)
if bIsCG ~= true then
local objOffsetAsset = LoadAsset(sOffsetPath, Offset)
local nX, nY = 0, 0
local s, x, y = objOffsetAsset:GetOffsetData(PanelId.MainView, indexOfPose("a"), true, nX, nY)
local nPanelId = PanelId.MainView
if bIsNpc == true then
nPanelId = PanelId.ShopPanel
end
local s, x, y = objOffsetAsset:GetOffsetData(nPanelId, indexOfPose("a"), true, nX, nY)
tbRenderer.trOffset.localPosition = Vector3(x, y, 0)
tbRenderer.trOffset.localScale = Vector3(s, s, 1)
else
@@ -181,7 +181,7 @@ function ActivityLevelsInstanceLevel:PlaySuccessPerform(FixedRewardItems, FirstR
local sName = ConfigTable.GetData("EndSceneType", nType).EndSceneName
local tbSkin = {}
for _, nCharId in ipairs(tbChar) do
local nSkinId = PlayerData.Char:GetCharSkinId(nCharId)
local nSkinId = PlayerData.Build:GetBattleCharSkinId(nCharId)
table.insert(tbSkin, nSkinId)
end
CS.AdventureModuleHelper.PlaySettlementPerform(sName, "", tbSkin, func_SettlementFinish)
@@ -258,7 +258,7 @@ function ActivityLevelsInstanceLevel:SetDiscInfo()
safe_call_cs_func(CS.AdventureModuleHelper.SetDiscInfo, tbDiscInfo)
end
function ActivityLevelsInstanceLevel:OnEvent_Pause()
EventManager.Hit("OpenActivityLevelsInstancePause", self.nActivityId, self.nLevelId, self.tbCharId)
EventManager.Hit("OpenActivityLevelsInstancePause", self.nActivityId, self.nLevelId, self.tbCharId, self.tbCharTrialId)
end
function ActivityLevelsInstanceLevel:OnEvent_ActivityLevels_Time(nTime)
self.levelTotalTime = nTime
@@ -136,7 +136,7 @@ function DailyInstanceLevel:PlaySuccessPerform(FirstRewardItems, tbSelectReward,
local sName = ConfigTable.GetData("EndSceneType", nType).EndSceneName
local tbSkin = {}
for _, nCharId in ipairs(tbChar) do
local nSkinId = PlayerData.Char:GetCharSkinId(nCharId)
local nSkinId = PlayerData.Build:GetBattleCharSkinId(nCharId)
table.insert(tbSkin, nSkinId)
end
CS.AdventureModuleHelper.PlaySettlementPerform(sName, "", tbSkin, func_SettlementFinish)
@@ -191,6 +191,6 @@ function DailyInstanceLevel:SetDiscInfo()
safe_call_cs_func(CS.AdventureModuleHelper.SetDiscInfo, tbDiscInfo)
end
function DailyInstanceLevel:OnEvnet_Pause()
EventManager.Hit("OpenDailyInstancePause", self.nLevelId, self.tbCharId)
EventManager.Hit("OpenDailyInstancePause", self.nLevelId, self.tbCharId, self.tbCharTrialId)
end
return DailyInstanceLevel
@@ -136,7 +136,7 @@ function EquipmentInstanceLevel:PlaySuccessPerform(FirstRewardItems, tbStarRewar
local sName = ConfigTable.GetData("EndSceneType", nType).EndSceneName
local tbSkin = {}
for _, nCharId in ipairs(tbChar) do
local nSkinId = PlayerData.Char:GetCharSkinId(nCharId)
local nSkinId = PlayerData.Build:GetBattleCharSkinId(nCharId)
table.insert(tbSkin, nSkinId)
end
CS.AdventureModuleHelper.PlaySettlementPerform(sName, "", tbSkin, func_SettlementFinish)
@@ -191,6 +191,6 @@ function EquipmentInstanceLevel:SetDiscInfo()
safe_call_cs_func(CS.AdventureModuleHelper.SetDiscInfo, tbDiscInfo)
end
function EquipmentInstanceLevel:OnEvnet_Pause()
EventManager.Hit("OpenEquipmentInstancePause", self.nLevelId, self.tbCharId)
EventManager.Hit("OpenEquipmentInstancePause", self.nLevelId, self.tbCharId, self.tbCharTrialId)
end
return EquipmentInstanceLevel
@@ -186,7 +186,7 @@ function RegionBossBattleLevel:PlaySuccessPerform(nMapId, buildId, nExp, tbRewar
print("sceneName:" .. sName)
local tbSkin = {}
for _, nCharId in ipairs(tbChar) do
local nSkinId = PlayerData.Char:GetCharSkinId(nCharId)
local nSkinId = PlayerData.Build:GetBattleCharSkinId(nCharId)
table.insert(tbSkin, nSkinId)
end
CS.AdventureModuleHelper.PlaySettlementPerform(sName, "", tbSkin, func_SettlementFinish)
@@ -196,7 +196,7 @@ function RegionBossBattleLevel:PlaySuccessPerform(nMapId, buildId, nExp, tbRewar
print("sceneName:" .. sName)
local tbSkin = {}
for _, nCharId in ipairs(tbChar) do
local nSkinId = PlayerData.Char:GetCharSkinId(nCharId)
local nSkinId = PlayerData.Build:GetBattleCharSkinId(nCharId)
table.insert(tbSkin, nSkinId)
end
CS.AdventureModuleHelper.PlaySettlementPerform(sName, "", tbSkin, func_SettlementFinish)
@@ -306,6 +306,6 @@ function RegionBossBattleLevel:SetDiscInfo()
safe_call_cs_func(CS.AdventureModuleHelper.SetDiscInfo, tbDiscInfo)
end
function RegionBossBattleLevel:OnEvnet_Pause()
EventManager.Hit("OpenRegionBossPause", self.nLevelId, self.tbCharId)
EventManager.Hit("OpenRegionBossPause", self.nLevelId, self.tbCharId, self.tbCharTrialId)
end
return RegionBossBattleLevel
@@ -136,7 +136,7 @@ function SkillInstanceLevel:PlaySuccessPerform(FirstRewardItems, tbStarReward, t
local sName = ConfigTable.GetData("EndSceneType", nType).EndSceneName
local tbSkin = {}
for _, nCharId in ipairs(tbChar) do
local nSkinId = PlayerData.Char:GetCharSkinId(nCharId)
local nSkinId = PlayerData.Build:GetBattleCharSkinId(nCharId)
table.insert(tbSkin, nSkinId)
end
CS.AdventureModuleHelper.PlaySettlementPerform(sName, "", tbSkin, func_SettlementFinish)
@@ -191,6 +191,6 @@ function SkillInstanceLevel:SetDiscInfo()
safe_call_cs_func(CS.AdventureModuleHelper.SetDiscInfo, tbDiscInfo)
end
function SkillInstanceLevel:OnEvent_Pause()
EventManager.Hit("OpenSkillInstancePause", self.nLevelId, self.tbCharId)
EventManager.Hit("OpenSkillInstancePause", self.nLevelId, self.tbCharId, self.tbCharTrialId)
end
return SkillInstanceLevel
+52 -23
View File
@@ -16,7 +16,8 @@ local mapEventConfig = {
SoldierLevel_AddItem = "OnEvent_AddItem",
Soldier_CastSkill = "OnEvent_CastSkill",
SoldierActor_Spawn = "OnEvent_ActorSpawn",
Soldier_DamageValue = "OnEvent_Damage"
Soldier_DamageValue = "OnEvent_Damage",
SoldierHarvestSkill = "OnEvent_SoldierHarvestSkill"
}
function SoldierBattle:EnterLevel()
self.nTotalHp = 0
@@ -28,18 +29,27 @@ function SoldierBattle:EnterLevel()
v.nDamage = 0
end
local sJson = self:GetSoldierLevelMsg()
local nShopLevel = self.parent:GetShopLevel()
AdventureModuleHelper.EnterDynamic(self.nFloorId, {}, GameEnum.dynamicLevelType.SoldierChess, {
tostring(self.nTemplateId),
sJson
tostring(self.nAdjustmentGrade),
tostring(self.nStageId),
tostring(self.nBossTemplateId),
sJson,
tostring(nShopLevel)
})
end
function SoldierBattle:Init(parent, tbChess, nFloorId, nTemplateId)
function SoldierBattle:Init(parent, tbChess, nFloorId, nStageId, nTemplateId, nAdjustmentGrade, nBossTemplateId)
self:BindEvent()
self.parent = parent
self.tbChess = tbChess
self.nFloorId = nFloorId
self.nStageId = nStageId
self.nTemplateId = nTemplateId
self.nAdjustmentGrade = nAdjustmentGrade
self.nBossTemplateId = nBossTemplateId
self.tbCharDamage = {}
self.nHarvestSkillCount = 0
self.tbPartner = SoldierAttrData.CalcActivePartners(tbChess)
self:EnterLevel()
NovaAPI.EnterModule("AdventureModuleScene", true, 17)
@@ -85,11 +95,17 @@ function SoldierBattle:GetSoldierLevelMsg()
end
soldierLevelMsg.SoldierData:Add(CS.SoldierLevelController.SoldierMsg(v.nId, bMain, nIndex, v.nStar, mapAttr))
end
for _, nId in pairs(self.tbPartner) do
if 0 < nId then
soldierLevelMsg.PartnerArr:Add(nId)
for _, info in ipairs(self.tbPartner) do
if info.nId and info.nId > 0 then
soldierLevelMsg:AddPartner(info.nId, info.tbSoldiers)
end
end
local tbTechBuffs = PlayerData.SoldierData:GetClientBattleBuffList()
for _, nBuffId in ipairs(tbTechBuffs) do
soldierLevelMsg.buffEffectList:Add(nBuffId)
end
local nHarvestCount = self.parent:GetClientHarvestCount()
soldierLevelMsg.nHarvestCount = nHarvestCount
return soldierLevelMsg:ToJson()
end
function SoldierBattle:OnEvent_LoadLevelRefresh()
@@ -105,42 +121,53 @@ function SoldierBattle:OnEvent_UnloadComplete()
end
function SoldierBattle:OnEvent_Result(bResult)
local tbDamage = {}
for nId, nValue in pairs(self.tbCharDamage) do
local nStar = 0
for _, v in ipairs(self.tbChess) do
if v.nId == nId then
nStar = v.nStar
break
local nAllDamage = 0
for _, v in ipairs(self.tbChess) do
if v.nId ~= 0 then
local nDamage = 0
if self.tbCharDamage[v.nId] ~= nil then
nDamage = self.tbCharDamage[v.nId]
end
tbDamage[v.nId] = {
nStar = v.nStar,
nDamage = nDamage
}
nAllDamage = nAllDamage + nDamage
end
tbDamage[nId] = {nStar = nStar, nDamage = nValue}
end
local nCoin = self.tbItems[AllEnum.CoinItemId.SoldierCurrency] or 0
nCoin = math.min(nCoin, ConfigTable.GetConfigNumber("SoldierSkillCoinMax"))
self.parent:BattleEnd(bResult, {
nTime = self.nBattleTime,
tbDamage = tbDamage,
nCoin = nCoin
nCoin = nCoin,
nHarvest = self.nHarvestSkillCount,
nAllDamage = nAllDamage
})
end
function SoldierBattle:OnEvent_SettleSoldierBattle()
local tbDamage = {}
for nId, nValue in pairs(self.tbCharDamage) do
local nStar = 0
for _, v in ipairs(self.tbChess) do
if v.nId == nId then
nStar = v.nStar
break
local nAllDamage = 0
for _, v in ipairs(self.tbChess) do
if v.nId ~= 0 then
local nDamage = 0
if self.tbCharDamage[v.nId] ~= nil then
nDamage = self.tbCharDamage[v.nId]
end
tbDamage[v.nId] = {
nStar = v.nStar,
nDamage = nDamage
}
nAllDamage = nAllDamage + nDamage
end
tbDamage[nId] = {nStar = nStar, nDamage = nValue}
end
local nCoin = self.tbItems[AllEnum.CoinItemId.SoldierCurrency] or 0
nCoin = math.min(nCoin, ConfigTable.GetConfigNumber("SoldierSkillCoinMax"))
self.parent:BattleEnd(false, {
nTime = self.nBattleTime,
tbDamage = tbDamage,
nCoin = nCoin
nCoin = nCoin,
nHarvest = self.nHarvestSkillCount
})
end
function SoldierBattle:OnEvent_RestartSoldier()
@@ -180,6 +207,9 @@ function SoldierBattle:OnEvent_Damage(nUId, nDamage)
end
end
end
function SoldierBattle:OnEvent_SoldierHarvestSkill()
self.nHarvestSkillCount = self.nHarvestSkillCount + 1
end
function SoldierBattle:OnEvent_GamePlayTime(nTime)
self.nBattleTime = nTime
if 0 < nTime then
@@ -200,7 +230,6 @@ function SoldierBattle:OnEvent_AddItem(nId, nCount)
local nCount = self.tbItems[AllEnum.CoinItemId.SoldierCurrency] or 0
EventManager.Hit("RefreshSoldierCoin", nCount)
if nId == AllEnum.CoinItemId.SoldierCurrency then
printError("[Soldier]战斗内技能获得金币数量:" .. nCount)
end
end
function SoldierBattle:OnEvent_CastSkill(nUId, nId, nSkillId)
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,969 @@
local StarTowerAutoDecision = {}
StarTowerAutoDecision.ActionType = {
None = 0,
SelectPotential = 1,
PotentialReroll = 2,
OpenShop = 3,
StrengthMachine = 4,
ShopBuy = 5,
ShopReroll = 6,
EventSelect = 7
}
StarTowerAutoDecision.FailReason = {
None = 0,
Disabled = 1,
InvalidParam = 2,
NoOption = 3,
NoMatchedTarget = 4,
TokenNotEnough = 5,
CoinNotEnough = 6,
RerollUnavailable = 7
}
StarTowerAutoDecision.PotentialRule = {
MainChar = 1,
AssistChar1 = 2,
AssistChar2 = 3,
BookLocked = 4,
PresetNotOwned = 5,
LevelAdd2 = 6,
LevelAdd3 = 7,
RarePotential = 8
}
StarTowerAutoDecision.ShopMode = {BuyFirst = 1, UpgradeFirst = 2}
StarTowerAutoDecision.ShopRule = {
NeedNote = 1,
DiscountNote = 2,
DiscountMainPotential = 3,
DiscountRandomPotential = 4,
MainPotentialNoDiscount = 5,
RandomPotentialNoDiscount = 6
}
StarTowerAutoDecision.EventTendency = {
Stable = 1,
Standard = 2,
Aggressive = 3
}
StarTowerAutoDecision.EventRule = {
MainPotential = 1,
AssistPotential = 2,
RarePotential = 3,
NormalPotential = 4,
NeedNote = 5,
RandomNote = 6,
Coin = 7
}
StarTowerAutoDecision.OptionTag = {
Stable = 1,
Standard = 2,
Aggressive = 3,
MainPotential = 4,
AssistPotential = 5,
Coin = 6,
RarePotential = 7,
NormalPotential = 8,
RandomPotential = 9,
RandomNote = 10,
NeedNote = 11
}
local DEFAULT_DELAY = 2
local DEFAULT_TOKEN_COST = 1
local FALLBACK_SCORE = 1
local PRIORITY_BASE_SCORE = 10000
local PRESET_SCORE = 100000
local TENDENCY_SCORE = 50000
local CORRECT_EVENT_OPTION_SCORE = 1000000
local _IsTable = function(value)
return type(value) == "table"
end
local _ToNumber = function(value, nDefault)
local nValue = tonumber(value)
if nValue == nil then
return nDefault or 0
end
return nValue
end
local _IsArrayEmpty = function(tbList)
return not _IsTable(tbList) or #tbList <= 0
end
local _ListContains = function(tbList, value)
if not _IsTable(tbList) then
return false
end
for _, v in ipairs(tbList) do
if v == value then
return true
end
end
return false
end
local _BuildSet = function(tbList, bZeroBasedIndex)
local mapSet = {}
if not _IsTable(tbList) then
return mapSet
end
for _, value in ipairs(tbList) do
mapSet[value] = true
if bZeroBasedIndex and type(value) == "number" then
mapSet[value + 1] = true
end
end
return mapSet
end
local _CopyArray = function(tbList)
local tbRet = {}
if not _IsTable(tbList) then
return tbRet
end
for _, v in ipairs(tbList) do
table.insert(tbRet, v)
end
return tbRet
end
local _AddReason = function(mapCandidate, sReason)
if mapCandidate.tbReasons == nil then
mapCandidate.tbReasons = {}
end
table.insert(mapCandidate.tbReasons, sReason)
end
local _GetPlan = function(mapContext)
if _IsTable(mapContext) and _IsTable(mapContext.mapPlan) then
return mapContext.mapPlan
end
return {}
end
local _GetTokenCost = function(mapContext, nActionType)
if _IsTable(mapContext) and _IsTable(mapContext.mapTokenCostByAction) then
local nCost = mapContext.mapTokenCostByAction[nActionType]
if nCost ~= nil then
return nCost
end
end
if _IsTable(mapContext) and mapContext.nTokenCost ~= nil then
return _ToNumber(mapContext.nTokenCost, DEFAULT_TOKEN_COST)
end
return DEFAULT_TOKEN_COST
end
local _MakeFail = function(nFailReason, sReason, tbDebug)
return {
bSuccess = false,
nActionType = StarTowerAutoDecision.ActionType.None,
nFailReason = nFailReason or StarTowerAutoDecision.FailReason.None,
sReason = sReason or "",
tbDebug = tbDebug or {}
}
end
local _MakeSuccess = function(nActionType, mapData)
mapData = mapData or {}
mapData.bSuccess = true
mapData.nActionType = nActionType
mapData.nFailReason = StarTowerAutoDecision.FailReason.None
if mapData.nDelay == nil then
mapData.nDelay = DEFAULT_DELAY
end
if mapData.bNeedToken == nil then
mapData.bNeedToken = false
end
return mapData
end
local _AttachTokenCheck = function(mapContext, mapDecision)
if not _IsTable(mapDecision) or not mapDecision.bSuccess then
return mapDecision
end
if mapDecision.bNeedToken ~= true then
return mapDecision
end
local nCost = mapDecision.nTokenCost or _GetTokenCost(mapContext, mapDecision.nActionType)
mapDecision.nTokenCost = nCost
if _IsTable(mapContext) and mapContext.nToken ~= nil and nCost > _ToNumber(mapContext.nToken, 0) then
return _MakeFail(StarTowerAutoDecision.FailReason.TokenNotEnough, "TokenNotEnough", {
nActionType = mapDecision.nActionType,
nToken = mapContext.nToken,
nTokenCost = nCost
})
end
return mapDecision
end
local _BuildPriorityMap = function(tbPriority, bMapMode)
local mapPriority = {}
if not _IsTable(tbPriority) then
return mapPriority
end
if bMapMode then
for nRule, nPriority in pairs(tbPriority) do
if type(nRule) == "number" and type(nPriority) == "number" and 0 < nPriority then
mapPriority[nRule] = nPriority
end
end
return mapPriority
end
for nPriority, nRule in ipairs(tbPriority) do
if type(nRule) == "number" and 0 < nPriority then
mapPriority[nRule] = nPriority
end
end
return mapPriority
end
local _GetPriorityScore = function(mapPriority, nRule)
local nPriority = mapPriority[nRule]
if nPriority == nil or nPriority <= 0 then
return 0
end
return PRIORITY_BASE_SCORE - nPriority
end
local _RefreshCandidateScore = function(mapCandidate)
mapCandidate.nScore = _ToNumber(mapCandidate.nBaseScore, 0) + _ToNumber(mapCandidate.nPriorityScore, 0)
end
local _AddCandidateBaseScore = function(mapCandidate, nScore, sReason)
mapCandidate.nBaseScore = _ToNumber(mapCandidate.nBaseScore, 0) + nScore
_RefreshCandidateScore(mapCandidate)
if sReason ~= nil then
_AddReason(mapCandidate, sReason)
end
end
local _AddCandidatePriorityScore = function(mapCandidate, mapPriority, nRule, sReason)
local nScore = _GetPriorityScore(mapPriority, nRule)
if nScore <= 0 then
return false
end
mapCandidate.mapMatchedPriority = mapCandidate.mapMatchedPriority or {}
mapCandidate.mapMatchedPriority[mapPriority[nRule]] = true
if nScore > _ToNumber(mapCandidate.nPriorityScore, 0) then
mapCandidate.nPriorityScore = nScore
_RefreshCandidateScore(mapCandidate)
end
_AddReason(mapCandidate, sReason)
return true
end
local _GetPotentialCfg = function(nPotentialId)
if ConfigTable == nil then
return nil
end
return ConfigTable.GetData("Potential", nPotentialId)
end
local _GetItemCfg = function(nItemId)
if ConfigTable == nil then
return nil
end
if ConfigTable.GetData_Item ~= nil then
local mapItem = ConfigTable.GetData_Item(nItemId)
if mapItem ~= nil then
return mapItem
end
end
return ConfigTable.GetData("Item", nItemId)
end
local _GetEventOptionCfg = function(nOptionId)
if ConfigTable == nil then
return nil
end
return ConfigTable.GetData("EventOptions", nOptionId)
end
local _GetPotentialCurLevel = function(mapContext, nPotentialId, nCharId, mapPotential)
if _IsTable(mapPotential) and mapPotential[nPotentialId] ~= nil then
return _ToNumber(mapPotential[nPotentialId], 0)
end
if _IsTable(mapContext) and _IsTable(mapContext.mapPotential) then
if nCharId ~= nil and _IsTable(mapContext.mapPotential[nCharId]) and mapContext.mapPotential[nCharId][nPotentialId] ~= nil then
return _ToNumber(mapContext.mapPotential[nCharId][nPotentialId], 0)
end
if mapContext.mapPotential[nPotentialId] ~= nil then
return _ToNumber(mapContext.mapPotential[nPotentialId], 0)
end
end
return 0
end
local _GetMainCharId = function(mapContext)
if not _IsTable(mapContext) then
return 0
end
if mapContext.nMainCharId ~= nil then
return mapContext.nMainCharId
end
if _IsTable(mapContext.tbTeam) then
return mapContext.tbTeam[1] or 0
end
return 0
end
local _GetAssistCharId = function(mapContext, nIndex)
if not _IsTable(mapContext) then
return 0
end
if _IsTable(mapContext.tbAssistCharIds) then
return mapContext.tbAssistCharIds[nIndex] or 0
end
if _IsTable(mapContext.tbTeam) then
return mapContext.tbTeam[nIndex + 1] or 0
end
return 0
end
local _IsRarePotential = function(mapContext, nPotentialId, mapItemCfg, bSpecial)
if bSpecial == true then
return true
end
if _IsTable(mapContext) and _IsTable(mapContext.mapRarePotentialIds) and mapContext.mapRarePotentialIds[nPotentialId] == true then
return true
end
if mapItemCfg == nil then
mapItemCfg = _GetItemCfg(nPotentialId)
end
if mapItemCfg == nil then
return false
end
if GameEnum ~= nil and GameEnum.itemStype ~= nil and mapItemCfg.Stype == GameEnum.itemStype.SpecificPotential then
return true
end
local nRareRarity = GameEnum ~= nil and GameEnum.itemRarity ~= nil and GameEnum.itemRarity.SSR or 1
if _IsTable(mapContext) and _GetPlan(mapContext).nRarePotentialRarity ~= nil then
nRareRarity = _GetPlan(mapContext).nRarePotentialRarity
end
return mapItemCfg.Rarity ~= nil and mapItemCfg.Rarity > 0 and nRareRarity >= mapItemCfg.Rarity
end
local _NormalizeRecommend = function(tbRecommend)
local mapRecommend = {}
if not _IsTable(tbRecommend) then
return mapRecommend
end
for _, mapData in ipairs(tbRecommend) do
local nId = mapData.nId or mapData.Id
if nId ~= nil then
mapRecommend[nId] = mapData
end
end
return mapRecommend
end
local _NormalizePotentialOptions = function(tbPotential)
local tbCandidates = {}
if not _IsTable(tbPotential) then
return tbCandidates
end
for nIndex, mapData in ipairs(tbPotential) do
local nPotentialId = mapData.Id or mapData.nId or mapData.Tid
if nPotentialId ~= nil then
table.insert(tbCandidates, {
nIndex = nIndex,
nTargetId = nPotentialId,
nOptionLevel = _ToNumber(mapData.Count or mapData.Level or mapData.nLevel, 0),
mapRawData = mapData,
nBaseScore = 0,
nPriorityScore = 0,
nScore = 0,
tbReasons = {}
})
end
end
return tbCandidates
end
local _CompareCandidatePriority = function(mapCandidateA, mapCandidateB)
if mapCandidateA.nScore ~= mapCandidateB.nScore then
return mapCandidateA.nScore > mapCandidateB.nScore
end
local mapPriorityA = mapCandidateA.mapMatchedPriority or {}
local mapPriorityB = mapCandidateB.mapMatchedPriority or {}
local nFirstDifferentPriority = math.huge
for nPriority in pairs(mapPriorityA) do
if not mapPriorityB[nPriority] and nPriority < nFirstDifferentPriority then
nFirstDifferentPriority = nPriority
end
end
for nPriority in pairs(mapPriorityB) do
if not mapPriorityA[nPriority] and nPriority < nFirstDifferentPriority then
nFirstDifferentPriority = nPriority
end
end
if nFirstDifferentPriority < math.huge then
return mapPriorityA[nFirstDifferentPriority] == true
end
return nil
end
local _SortCandidates = function(tbCandidates)
table.sort(tbCandidates, function(mapCandidateA, mapCandidateB)
local bHigherPriority = _CompareCandidatePriority(mapCandidateA, mapCandidateB)
if bHigherPriority ~= nil then
return bHigherPriority
end
return mapCandidateA.nIndex < mapCandidateB.nIndex
end)
end
local _SortShopCandidates = function(tbCandidates)
local mapFirstIndexByGroup = {}
for _, mapCandidate in ipairs(tbCandidates) do
local sGroup = mapCandidate.sDiscountGroup
local nFirstIndex = mapFirstIndexByGroup[sGroup]
if nFirstIndex == nil or nFirstIndex > mapCandidate.nIndex then
mapFirstIndexByGroup[sGroup] = mapCandidate.nIndex
end
end
table.sort(tbCandidates, function(mapCandidateA, mapCandidateB)
local bHigherPriority = _CompareCandidatePriority(mapCandidateA, mapCandidateB)
if bHigherPriority ~= nil then
return bHigherPriority
end
local nGroupIndexA = mapFirstIndexByGroup[mapCandidateA.sDiscountGroup]
local nGroupIndexB = mapFirstIndexByGroup[mapCandidateB.sDiscountGroup]
if nGroupIndexA ~= nGroupIndexB then
return nGroupIndexA < nGroupIndexB
end
if mapCandidateA.nDiscountRate ~= mapCandidateB.nDiscountRate then
return mapCandidateA.nDiscountRate < mapCandidateB.nDiscountRate
end
return mapCandidateA.nIndex < mapCandidateB.nIndex
end)
end
function StarTowerAutoDecision:IsEnabled(mapContext)
if not _IsTable(mapContext) then
return false
end
if mapContext.bAutoEnabled == false then
return false
end
local mapPlan = _GetPlan(mapContext)
if mapPlan.bEnabled == false then
return false
end
return true
end
function StarTowerAutoDecision:BuildContext(objLevelData, mapPlan, mapExtra)
local mapContext = mapExtra or {}
mapContext.mapPlan = mapPlan or mapContext.mapPlan or {}
if objLevelData == nil then
return mapContext
end
mapContext.nTowerId = mapContext.nTowerId or objLevelData.nTowerId
mapContext.nCurFloor = mapContext.nCurFloor or objLevelData.nCurLevel
mapContext.tbTeam = mapContext.tbTeam or _CopyArray(objLevelData.tbTeam)
mapContext.mapNote = mapContext.mapNote or objLevelData._mapNote
mapContext.mapPotential = mapContext.mapPotential or objLevelData._mapPotential
mapContext.mapItem = mapContext.mapItem or objLevelData._mapItem
mapContext.mapFateCard = mapContext.mapFateCard or objLevelData._mapFateCard
mapContext.mapPreselectionData = mapContext.mapPreselectionData or objLevelData.mapPreselectionData
if mapContext.nCoin == nil and _IsTable(objLevelData._mapItem) and AllEnum ~= nil and AllEnum.CoinItemId ~= nil then
mapContext.nCoin = objLevelData._mapItem[AllEnum.CoinItemId.FixedRogCurrency] or 0
end
if mapContext.bFinalFloor == nil and _IsTable(objLevelData.tbStarTowerAllLevel) and objLevelData.nCurLevel ~= nil then
mapContext.bFinalFloor = objLevelData.nCurLevel == #objLevelData.tbStarTowerAllLevel
end
return mapContext
end
function StarTowerAutoDecision:DecidePotential(mapContext, tbPotential, mapPotential, mapRoll, tbNewIds, tbLuckyIds, tbRecommend)
if not self:IsEnabled(mapContext) then
return _MakeFail(StarTowerAutoDecision.FailReason.Disabled, "AutoDisabled")
end
local tbCandidates = _NormalizePotentialOptions(tbPotential)
if _IsArrayEmpty(tbCandidates) then
return _MakeFail(StarTowerAutoDecision.FailReason.NoOption, "NoPotentialOption")
end
local mapPlan = _GetPlan(mapContext)
local mapPriority = _BuildPriorityMap(mapPlan.tbPotentialRulePriority, false)
if next(mapPriority) == nil then
mapPriority = _BuildPriorityMap(mapPlan.mapPotentialRulePriority, true)
end
local bHasPreset = _IsTable(mapContext.mapPreselectionData)
local mapRecommend = bHasPreset and _NormalizeRecommend(tbRecommend) or {}
local mapNewIds = _BuildSet(tbNewIds)
local mapLuckyIds = _BuildSet(tbLuckyIds)
local nMainCharId = _GetMainCharId(mapContext)
local nAssistCharId1 = _GetAssistCharId(mapContext, 1)
local nAssistCharId2 = _GetAssistCharId(mapContext, 2)
local bPreferPreset = bHasPreset and mapPlan.bPreferPresetPotential ~= false
local bPresetOnly = bPreferPreset and mapPlan.bPresetOnly == true
local bHasSpecialPotential = false
for _, mapCandidate in ipairs(tbCandidates) do
local nPotentialId = mapCandidate.nTargetId
local mapPotentialCfg = _GetPotentialCfg(nPotentialId)
local mapItemCfg = _GetItemCfg(nPotentialId)
local nCharId = mapPotentialCfg and mapPotentialCfg.CharId or 0
local nCurLevel = _GetPotentialCurLevel(mapContext, nPotentialId, nCharId, mapPotential)
local mapRecommendData = mapRecommend[nPotentialId]
local nRecommendLevel = mapRecommendData and _ToNumber(mapRecommendData.nLevel or mapRecommendData.Level, 0) or 0
local bSpecial = mapCandidate.mapRawData.bSpecial == true or mapItemCfg ~= nil and GameEnum ~= nil and GameEnum.itemStype ~= nil and mapItemCfg.Stype == GameEnum.itemStype.SpecificPotential
bHasSpecialPotential = bHasSpecialPotential or bSpecial
mapCandidate.bPresetEligible = mapRecommendData ~= nil and nCurLevel < nRecommendLevel
mapCandidate.bPresetSpecial = bSpecial and mapCandidate.bPresetEligible
if mapCandidate.bPresetSpecial then
_AddCandidateBaseScore(mapCandidate, PRESET_SCORE, "PresetSpecialPotential")
elseif bPreferPreset and mapCandidate.bPresetEligible then
_AddCandidateBaseScore(mapCandidate, PRESET_SCORE, "PreferPresetPotential")
end
if nCharId == nMainCharId then
_AddCandidatePriorityScore(mapCandidate, mapPriority, StarTowerAutoDecision.PotentialRule.MainChar, "MainChar")
end
if nCharId == nAssistCharId1 then
_AddCandidatePriorityScore(mapCandidate, mapPriority, StarTowerAutoDecision.PotentialRule.AssistChar1, "AssistChar1")
end
if nCharId == nAssistCharId2 then
_AddCandidatePriorityScore(mapCandidate, mapPriority, StarTowerAutoDecision.PotentialRule.AssistChar2, "AssistChar2")
end
if mapNewIds[nPotentialId] then
_AddCandidatePriorityScore(mapCandidate, mapPriority, StarTowerAutoDecision.PotentialRule.BookLocked, "BookLocked")
end
if mapRecommendData ~= nil and nCurLevel <= 0 then
_AddCandidatePriorityScore(mapCandidate, mapPriority, StarTowerAutoDecision.PotentialRule.PresetNotOwned, "PresetNotOwned")
end
if mapCandidate.nOptionLevel == 2 then
_AddCandidatePriorityScore(mapCandidate, mapPriority, StarTowerAutoDecision.PotentialRule.LevelAdd2, "LevelAdd2")
end
if mapCandidate.nOptionLevel == 3 then
_AddCandidatePriorityScore(mapCandidate, mapPriority, StarTowerAutoDecision.PotentialRule.LevelAdd3, "LevelAdd3")
end
if _IsRarePotential(mapContext, nPotentialId, mapItemCfg, mapCandidate.mapRawData.bSpecial) then
_AddCandidatePriorityScore(mapCandidate, mapPriority, StarTowerAutoDecision.PotentialRule.RarePotential, "RarePotential")
end
if mapNewIds[nPotentialId] then
_AddReason(mapCandidate, "NewId")
end
if mapLuckyIds[nPotentialId] then
_AddReason(mapCandidate, "LuckyId")
end
end
_SortCandidates(tbCandidates)
local mapBest = tbCandidates[1]
local mapPresetSpecial
for _, mapCandidate in ipairs(tbCandidates) do
if mapCandidate.bPresetSpecial then
mapPresetSpecial = mapCandidate
break
end
end
if mapPresetSpecial ~= nil then
mapBest = mapPresetSpecial
elseif bPresetOnly then
mapBest = nil
for _, mapCandidate in ipairs(tbCandidates) do
if mapCandidate.bPresetEligible then
mapBest = mapCandidate
break
end
end
end
if mapBest == nil or 0 >= mapBest.nScore then
local nCoin = _ToNumber(mapContext.nCoin, 0)
local bCanReroll = not bHasSpecialPotential and _IsTable(mapRoll) and mapRoll.CanReRoll == true
local nRerollPrice = _ToNumber(_IsTable(mapRoll) and mapRoll.ReRollPrice or 0, 0)
local nRerollCoinMin = _ToNumber(mapPlan.nPotentialRerollCoinMin, 0)
if mapPlan.bPotentialReroll == true and bCanReroll and nCoin >= nRerollPrice and nCoin > nRerollCoinMin then
return _AttachTokenCheck(mapContext, _MakeSuccess(StarTowerAutoDecision.ActionType.PotentialReroll, {
bReRoll = true,
bNeedToken = false,
nTargetIndex = 0,
nTargetId = 0,
sReason = "PotentialReroll",
tbDebug = {nCoin = nCoin, nRerollPrice = nRerollPrice}
}))
end
mapBest = tbCandidates[1]
if 0 >= mapBest.nScore then
mapBest.nScore = FALLBACK_SCORE
_AddReason(mapBest, "FallbackFirst")
end
end
return _AttachTokenCheck(mapContext, _MakeSuccess(StarTowerAutoDecision.ActionType.SelectPotential, {
nTargetIndex = mapBest.nIndex,
nTargetId = mapBest.nTargetId,
bNeedToken = true,
sReason = mapBest.tbReasons[1] or "SelectPotential",
tbDebug = {
nScore = mapBest.nScore,
tbReasons = mapBest.tbReasons,
mapRawData = mapBest.mapRawData
}
}))
end
local _DecideUpgradeBeforeShopSpendAll = function(mapContext, mapShopOption, nCoin)
local mapPlan = _GetPlan(mapContext)
if mapContext.bFinalFloor ~= true or mapPlan.bShopSpendAllWhenFinalNoTarget ~= true or (mapPlan.nShopMode or StarTowerAutoDecision.ShopMode.BuyFirst) ~= StarTowerAutoDecision.ShopMode.BuyFirst or mapShopOption.bMachine ~= true then
return nil
end
local nMachineCost = _ToNumber(mapShopOption.nMachineCost, 0)
local nMaxUpgradePrice = _ToNumber(mapPlan.nShopUpgradeMaxPrice, 180)
if nMachineCost > nMaxUpgradePrice or nCoin < nMachineCost then
return nil
end
return _AttachTokenCheck(mapContext, _MakeSuccess(StarTowerAutoDecision.ActionType.StrengthMachine, {
bNeedToken = true,
sReason = "UpgradeBeforeShopSpendAll",
tbDebug = {nMachineCost = nMachineCost, nCoin = nCoin}
}))
end
function StarTowerAutoDecision:DecideShopEntry(mapContext, mapShopOption)
if not self:IsEnabled(mapContext) then
return _MakeFail(StarTowerAutoDecision.FailReason.Disabled, "AutoDisabled")
end
if not _IsTable(mapShopOption) then
return _MakeFail(StarTowerAutoDecision.FailReason.InvalidParam, "InvalidShopOption")
end
local mapPlan = _GetPlan(mapContext)
local nMode = mapPlan.nShopMode or StarTowerAutoDecision.ShopMode.BuyFirst
local nCoin = _ToNumber(mapShopOption.nCoin or mapContext.nCoin, 0)
local bShop = mapShopOption.bShop == true
local bMachine = mapShopOption.bMachine == true
local nMachineCost = _ToNumber(mapShopOption.nMachineCost, 0)
local nMaxUpgradePrice = _ToNumber(mapPlan.nShopUpgradeMaxPrice, 180)
if bShop and mapShopOption.bUpgradeBeforeSpendAll == true then
local mapDecision = _DecideUpgradeBeforeShopSpendAll(mapContext, mapShopOption, nCoin)
if mapDecision ~= nil then
return mapDecision
end
end
local bSpendAllOnUpgrade = mapContext.bFinalFloor == true and mapPlan.bShopSpendAllWhenFinalNoTarget == true and mapShopOption.bShopExhausted == true and not bShop
local bMachineAvailable = bMachine and nCoin >= nMachineCost and (bSpendAllOnUpgrade or nMachineCost <= nMaxUpgradePrice)
if nMode == StarTowerAutoDecision.ShopMode.UpgradeFirst and bMachineAvailable then
return _AttachTokenCheck(mapContext, _MakeSuccess(StarTowerAutoDecision.ActionType.StrengthMachine, {
bNeedToken = true,
sReason = "UpgradeFirst",
tbDebug = {nMachineCost = nMachineCost, nCoin = nCoin}
}))
end
if bShop then
return _MakeSuccess(StarTowerAutoDecision.ActionType.OpenShop, {bNeedToken = false, sReason = "OpenShop"})
end
if bMachineAvailable then
return _AttachTokenCheck(mapContext, _MakeSuccess(StarTowerAutoDecision.ActionType.StrengthMachine, {
bNeedToken = true,
sReason = "StrengthMachine",
tbDebug = {nMachineCost = nMachineCost, nCoin = nCoin}
}))
end
return _MakeFail(StarTowerAutoDecision.FailReason.NoMatchedTarget, "NoShopEntryTarget", {
bShop = bShop,
bMachine = bMachine,
nMachineCost = nMachineCost,
nCoin = nCoin
})
end
local _IsDiscountGood = function(mapGood)
return 0 < _ToNumber(mapGood.nDiscount, 0)
end
local _GetGoodPrice = function(mapGood)
if 0 < _ToNumber(mapGood.nDiscount, 0) then
return _ToNumber(mapGood.nDiscount, 0)
end
return _ToNumber(mapGood.Price, 0)
end
local _GetGoodDiscountRate = function(mapGood)
local nOriginalPrice = _ToNumber(mapGood.Price, 0)
local nDiscountPrice = _ToNumber(mapGood.nDiscount, 0)
if nOriginalPrice <= 0 or nDiscountPrice <= 0 then
return 1
end
return nDiscountPrice / nOriginalPrice
end
local _GetShopGoodDiscountGroup = function(mapGood, bDiscount, bMainPotential, bRandomPotential)
local nType = _ToNumber(mapGood.nType, 0)
local sSubType = "Other"
if nType == 1 then
if bMainPotential then
sSubType = "MainPotential"
elseif bRandomPotential then
sSubType = "RandomPotential"
else
sSubType = "Potential"
end
elseif nType == 2 then
sSubType = "Note"
end
return tostring(nType) .. ":" .. sSubType .. ":" .. (bDiscount and "Discount" or "Regular")
end
local _IsNoteGood = function(mapGood, mapItemCfg)
if _ToNumber(mapGood.nType, 0) ~= 2 then
return false
end
if mapItemCfg == nil then
mapItemCfg = _GetItemCfg(mapGood.nGoodsId)
end
return mapItemCfg ~= nil and GameEnum ~= nil and GameEnum.itemStype ~= nil and mapItemCfg.Stype == GameEnum.itemStype.SubNoteSkill
end
local _IsPotentialGood = function(mapGood)
return _ToNumber(mapGood.nType, 0) == 1
end
local _GetPotentialGoodCharId = function(mapGood)
return _ToNumber(mapGood.nCharId, 0)
end
local _IsMainPotentialGood = function(mapContext, mapGood)
if not _IsPotentialGood(mapGood) then
return false
end
local nMainCharId = _GetMainCharId(mapContext)
local nGoodCharId = _GetPotentialGoodCharId(mapGood)
return 0 < nMainCharId and 0 < nGoodCharId and nGoodCharId == nMainCharId
end
local _IsRandomPotentialGood = function(mapGood)
if not _IsPotentialGood(mapGood) then
return false
end
return _GetPotentialGoodCharId(mapGood) <= 0
end
local _HasShopReroll = function(mapRoll)
return _IsTable(mapRoll) and mapRoll.CanReRoll == true and 0 < _ToNumber(mapRoll.ReRollTimes, 0)
end
local _CanShopReroll = function(mapPlan, mapContext, mapRoll, nCoin)
local bFinalFloor = mapContext.bFinalFloor == true
local bAllowReroll = bFinalFloor and mapPlan.bShopRerollWhenFinalNoTarget == true or not bFinalFloor and mapPlan.bShopRerollWhenNoTarget == true
local bCanReroll = _HasShopReroll(mapRoll)
local nRerollPrice = _ToNumber(_IsTable(mapRoll) and mapRoll.ReRollPrice or 0, 0)
local nRerollCoinMin = _ToNumber(mapPlan.nShopRerollCoinMin, 500)
return bAllowReroll and bCanReroll and nCoin >= nRerollPrice and (bFinalFloor or nCoin > nRerollCoinMin), nRerollPrice
end
function StarTowerAutoDecision:DecideShop(mapContext, tbShopData, mapRoll, nCoin)
if not self:IsEnabled(mapContext) then
return _MakeFail(StarTowerAutoDecision.FailReason.Disabled, "AutoDisabled")
end
if _IsArrayEmpty(tbShopData) then
local mapDecision = _MakeFail(StarTowerAutoDecision.FailReason.NoOption, "NoShopGoods")
mapDecision.bShopExhausted = not _HasShopReroll(mapRoll)
return mapDecision
end
local mapPlan = _GetPlan(mapContext)
local mapPriority = _BuildPriorityMap(mapPlan.tbShopRulePriority, false)
if next(mapPriority) == nil then
mapPriority = _BuildPriorityMap(mapPlan.mapShopRulePriority, true)
end
local nCurCoin = _ToNumber(nCoin or mapContext.nCoin, 0)
local tbCandidates = {}
for nIndex, mapGood in ipairs(tbShopData) do
local nPrice = _GetGoodPrice(mapGood)
if mapGood.bSoldOut ~= true and nCurCoin >= nPrice then
local mapItemCfg = _ToNumber(mapGood.nType, 0) == 2 and _GetItemCfg(mapGood.nGoodsId) or nil
local bDiscount = _IsDiscountGood(mapGood)
local bNote = _IsNoteGood(mapGood, mapItemCfg)
local bNeedNote = bNote
if _IsTable(mapContext.mapNeedNote) then
bNeedNote = bNote and mapContext.mapNeedNote[mapGood.nGoodsId] == true
end
local bMainPotential = _IsMainPotentialGood(mapContext, mapGood)
local bRandomPotential = _IsRandomPotentialGood(mapGood)
local mapCandidate = {
nIndex = nIndex,
nTargetIndex = mapGood.Idx or nIndex,
nTargetId = mapGood.nSid,
nGoodsId = mapGood.nGoodsId,
nPrice = nPrice,
nDiscountRate = _GetGoodDiscountRate(mapGood),
sDiscountGroup = _GetShopGoodDiscountGroup(mapGood, bDiscount, bMainPotential, bRandomPotential),
nBaseScore = 0,
nPriorityScore = 0,
nScore = 0,
tbReasons = {},
mapRawData = mapGood
}
if bNeedNote then
_AddCandidatePriorityScore(mapCandidate, mapPriority, StarTowerAutoDecision.ShopRule.NeedNote, "NeedNote")
end
if bMainPotential and not bDiscount then
_AddCandidatePriorityScore(mapCandidate, mapPriority, StarTowerAutoDecision.ShopRule.MainPotentialNoDiscount, "MainPotentialNoDiscount")
end
if bRandomPotential and not bDiscount then
_AddCandidatePriorityScore(mapCandidate, mapPriority, StarTowerAutoDecision.ShopRule.RandomPotentialNoDiscount, "RandomPotentialNoDiscount")
end
if bNote and bDiscount then
_AddCandidatePriorityScore(mapCandidate, mapPriority, StarTowerAutoDecision.ShopRule.DiscountNote, "DiscountNote")
end
if bMainPotential and bDiscount then
_AddCandidatePriorityScore(mapCandidate, mapPriority, StarTowerAutoDecision.ShopRule.DiscountMainPotential, "DiscountMainPotential")
end
if bRandomPotential and bDiscount then
_AddCandidatePriorityScore(mapCandidate, mapPriority, StarTowerAutoDecision.ShopRule.DiscountRandomPotential, "DiscountRandomPotential")
end
table.insert(tbCandidates, mapCandidate)
end
end
if _IsArrayEmpty(tbCandidates) then
local bCanReroll, nRerollPrice = _CanShopReroll(mapPlan, mapContext, mapRoll, nCurCoin)
if bCanReroll then
return _MakeSuccess(StarTowerAutoDecision.ActionType.ShopReroll, {
bReRoll = true,
bNeedToken = false,
sReason = "ShopRerollNoAffordableGoods",
tbDebug = {nCoin = nCurCoin, nRerollPrice = nRerollPrice}
})
end
local mapDecision = _MakeFail(StarTowerAutoDecision.FailReason.CoinNotEnough, "NoAffordableGoods", {nCoin = nCurCoin})
mapDecision.bShopExhausted = not _HasShopReroll(mapRoll)
return mapDecision
end
_SortShopCandidates(tbCandidates)
local mapBest = tbCandidates[1]
if 0 >= mapBest.nScore then
local bFinalFloor = mapContext.bFinalFloor == true
local bCanReroll, nRerollPrice = _CanShopReroll(mapPlan, mapContext, mapRoll, nCurCoin)
if bCanReroll then
return _MakeSuccess(StarTowerAutoDecision.ActionType.ShopReroll, {
bReRoll = true,
bNeedToken = false,
sReason = "ShopReroll",
tbDebug = {nCoin = nCurCoin, nRerollPrice = nRerollPrice}
})
end
if bFinalFloor and mapPlan.bShopSpendAllWhenFinalNoTarget == true then
local mapDecision = _DecideUpgradeBeforeShopSpendAll(mapContext, mapContext, nCurCoin)
if mapDecision ~= nil then
return mapDecision
end
mapBest.nScore = FALLBACK_SCORE
_AddReason(mapBest, "FinalFloorSpendAll")
else
return _MakeFail(StarTowerAutoDecision.FailReason.NoOption, "NoMatchedShopGoods", {bFinalFloor = bFinalFloor, nCoin = nCurCoin})
end
end
return _AttachTokenCheck(mapContext, _MakeSuccess(StarTowerAutoDecision.ActionType.ShopBuy, {
nTargetIndex = mapBest.nTargetIndex,
nTargetId = mapBest.nTargetId,
nGoodsId = mapBest.nGoodsId,
bNeedToken = true,
sReason = mapBest.tbReasons[1] or "ShopBuy",
tbDebug = {
nScore = mapBest.nScore,
nPrice = mapBest.nPrice,
tbReasons = mapBest.tbReasons,
mapRawData = mapBest.mapRawData
}
}))
end
local _BuildOptionTags = function(mapContext, nOptionId, mapOptionCfg)
local mapTags = {}
if _IsTable(mapContext.mapEventOptionTags) and _IsTable(mapContext.mapEventOptionTags[nOptionId]) then
for key, value in pairs(mapContext.mapEventOptionTags[nOptionId]) do
if value == true then
mapTags[key] = true
else
mapTags[value] = true
end
end
return mapTags
end
if mapOptionCfg == nil then
mapOptionCfg = _GetEventOptionCfg(nOptionId)
end
if mapOptionCfg == nil then
return mapTags
end
local tbTags = mapOptionCfg.OptionTag or mapOptionCfg.OptionTags or mapOptionCfg.EventOptionTag
if type(tbTags) == "string" then
local tbJsonTags = decodeJson(tbTags)
if tbJsonTags ~= nil then
tbTags = tbJsonTags
end
end
if type(tbTags) == "number" or type(tbTags) == "string" then
mapTags[tbTags] = true
elseif _IsTable(tbTags) then
for _, tag in ipairs(tbTags) do
mapTags[tag] = true
end
end
return mapTags
end
local _HasTag = function(mapTags, tag)
return _IsTable(mapTags) and mapTags[tag] == true
end
local _GetEventOptionTag = function(sTagName)
if GameEnum == nil or GameEnum.EventOptionTag == nil then
return nil
end
return GameEnum.EventOptionTag[sTagName]
end
local _HasEventOptionTag = function(mapTags, sTagName)
local nTag = _GetEventOptionTag(sTagName)
return nTag ~= nil and _HasTag(mapTags, nTag)
end
local _HasNeededNoteTag = function(mapContext, mapTags)
if not _IsTable(mapContext.mapNeedNote) then
return false
end
for nNoteId, bNeed in pairs(mapContext.mapNeedNote) do
if bNeed == true and _HasEventOptionTag(mapTags, "Note" .. tostring(nNoteId)) then
return true
end
end
return false
end
function StarTowerAutoDecision:DecideEvent(mapContext, tbOption, tbUnabledOption, nEventId)
if not self:IsEnabled(mapContext) then
return _MakeFail(StarTowerAutoDecision.FailReason.Disabled, "AutoDisabled")
end
if _IsArrayEmpty(tbOption) then
return _MakeFail(StarTowerAutoDecision.FailReason.NoOption, "NoEventOption")
end
local mapPlan = _GetPlan(mapContext)
local mapPriority = _BuildPriorityMap(mapPlan.tbEventRulePriority, false)
if next(mapPriority) == nil then
mapPriority = _BuildPriorityMap(mapPlan.mapEventRulePriority, true)
end
local mapDisabled = _BuildSet(tbUnabledOption, false)
local nTendency = mapPlan.nEventTendency or StarTowerAutoDecision.EventTendency.Standard
local mapTendencyTagName = {
[StarTowerAutoDecision.EventTendency.Stable] = "Preservative",
[StarTowerAutoDecision.EventTendency.Standard] = "Standard",
[StarTowerAutoDecision.EventTendency.Aggressive] = "Aggresive"
}
local tbCandidates = {}
for nIndex, nOptionId in ipairs(tbOption) do
if mapDisabled[nIndex - 1] ~= true then
local mapOptionCfg = _GetEventOptionCfg(nOptionId)
local mapTags = _BuildOptionTags(mapContext, nOptionId, mapOptionCfg)
local mapCandidate = {
nIndex = nIndex,
nTargetIndex = nIndex,
nTargetId = nOptionId,
nBaseScore = 0,
nPriorityScore = 0,
nScore = 0,
tbReasons = {},
mapTags = mapTags,
bNeedToken = true
}
if _HasEventOptionTag(mapTags, "Correct") then
_AddCandidateBaseScore(mapCandidate, CORRECT_EVENT_OPTION_SCORE, "CorrectAnswer")
end
local sTendencyTagName = mapTendencyTagName[nTendency]
if sTendencyTagName ~= nil and _HasEventOptionTag(mapTags, sTendencyTagName) then
_AddCandidateBaseScore(mapCandidate, TENDENCY_SCORE, "EventTendency")
end
local tbRuleToTagName = {
[StarTowerAutoDecision.EventRule.MainPotential] = "PotentialMain",
[StarTowerAutoDecision.EventRule.AssistPotential] = "PotentialAssist",
[StarTowerAutoDecision.EventRule.Coin] = "Coin",
[StarTowerAutoDecision.EventRule.RarePotential] = "PotentialRare",
[StarTowerAutoDecision.EventRule.NormalPotential] = "PotentialCommon",
[StarTowerAutoDecision.EventRule.RandomNote] = "NoteRandom"
}
if _HasNeededNoteTag(mapContext, mapTags) then
_AddCandidatePriorityScore(mapCandidate, mapPriority, StarTowerAutoDecision.EventRule.NeedNote, "NeedNote")
end
for nRule, sTagName in pairs(tbRuleToTagName) do
if _HasEventOptionTag(mapTags, sTagName) then
_AddCandidatePriorityScore(mapCandidate, mapPriority, nRule, "EventRule" .. tostring(nRule))
end
end
table.insert(tbCandidates, mapCandidate)
end
end
if _IsArrayEmpty(tbCandidates) then
return _MakeFail(StarTowerAutoDecision.FailReason.NoMatchedTarget, "NoEnabledEventOption", {nEventId = nEventId})
end
_SortCandidates(tbCandidates)
local mapBest = tbCandidates[1]
if 0 >= mapBest.nScore then
mapBest.nScore = FALLBACK_SCORE
_AddReason(mapBest, "FallbackFirst")
end
return _AttachTokenCheck(mapContext, _MakeSuccess(StarTowerAutoDecision.ActionType.EventSelect, {
nTargetIndex = mapBest.nTargetIndex,
nTargetId = mapBest.nTargetId,
bNeedToken = mapBest.bNeedToken,
sReason = mapBest.tbReasons[1] or "EventSelect",
tbDebug = {
nEventId = nEventId,
nScore = mapBest.nScore,
tbReasons = mapBest.tbReasons,
mapTags = mapBest.mapTags
}
}))
end
function StarTowerAutoDecision:CanConsumeToken(mapContext, nActionType)
local nCost = _GetTokenCost(mapContext, nActionType)
if not _IsTable(mapContext) or mapContext.nToken == nil then
return true, nCost
end
return nCost <= _ToNumber(mapContext.nToken, 0), nCost
end
return StarTowerAutoDecision
@@ -0,0 +1,113 @@
local StarTowerSettingGate = {}
local objLevelData
local nSerial = 0
local objReadyOwner
local mapTransition = {}
local mapOwnerVersion = {}
local mapRequests = {}
function StarTowerSettingGate.Start(objData)
EventManager.Remove("StarTowerSettingRequestFailed", StarTowerSettingGate, StarTowerSettingGate.OnRequestFailed)
objLevelData = objData
nSerial = nSerial + 1
objReadyOwner = nil
mapTransition = {}
mapOwnerVersion = {}
mapRequests = {}
if objData ~= nil then
EventManager.Add("StarTowerSettingRequestFailed", StarTowerSettingGate, StarTowerSettingGate.OnRequestFailed)
end
end
function StarTowerSettingGate.Stop(objData)
if objLevelData == objData then
StarTowerSettingGate.Start(nil)
end
end
function StarTowerSettingGate.Begin()
nSerial = nSerial + 1
objReadyOwner = nil
return nSerial
end
function StarTowerSettingGate.Ready(objOwner, nExpectedSerial)
if objLevelData ~= nil and nExpectedSerial == nSerial then
objReadyOwner = objOwner
end
end
function StarTowerSettingGate.ReadyAfter(objOwner, nExpectedSerial, nDuration)
if objLevelData == nil then
return
end
local nOwnerVersion = mapOwnerVersion[objOwner] or 0
objOwner:AddTimer(1, nDuration, function()
if (mapOwnerVersion[objOwner] or 0) == nOwnerVersion then
StarTowerSettingGate.Ready(objOwner, nExpectedSerial)
end
end, true, true, true)
end
function StarTowerSettingGate.Transition(objOwner, nDuration)
if objLevelData == nil then
return
end
local mapToken = {}
mapTransition[mapToken] = objOwner
objOwner:AddTimer(1, nDuration, function()
mapTransition[mapToken] = nil
end, true, true, true)
end
function StarTowerSettingGate.Clear(objOwner)
mapOwnerVersion[objOwner] = (mapOwnerVersion[objOwner] or 0) + 1
if objReadyOwner == objOwner then
StarTowerSettingGate.Begin()
end
for mapToken, objTransitionOwner in pairs(mapTransition) do
if objTransitionOwner == objOwner then
mapTransition[mapToken] = nil
end
end
end
function StarTowerSettingGate.ResumeAfterSetting()
local objOwner = objReadyOwner
if objLevelData == nil or objOwner == nil then
return
end
local nExpectedSerial = StarTowerSettingGate.Begin()
local nOwnerVersion = mapOwnerVersion[objOwner] or 0
cs_coroutine.start(function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
if (mapOwnerVersion[objOwner] or 0) == nOwnerVersion then
StarTowerSettingGate.Ready(objOwner, nExpectedSerial)
end
end)
end
function StarTowerSettingGate.BeginRequest(failedCallback)
StarTowerSettingGate.Begin()
local mapToken = {failedCallback = failedCallback}
if objLevelData ~= nil then
mapRequests[mapToken] = nSerial
end
return mapToken
end
function StarTowerSettingGate.FinishRequest(mapToken)
mapRequests[mapToken] = nil
end
function StarTowerSettingGate.OnRequestFailed(_, mapError)
local mapOldestToken
local nOldestSerial = math.huge
for mapToken, nRequestSerial in pairs(mapRequests) do
if nRequestSerial < nOldestSerial then
mapOldestToken = mapToken
nOldestSerial = nRequestSerial
end
end
if mapOldestToken ~= nil then
mapRequests[mapOldestToken] = nil
StarTowerSettingGate.Begin()
if mapOldestToken.failedCallback ~= nil then
mapOldestToken.failedCallback(mapError)
end
end
end
function StarTowerSettingGate.CanOpen(objData)
return objData ~= nil and objLevelData == objData and objReadyOwner ~= nil and next(mapTransition) == nil and next(mapRequests) == nil and objData.bEnd ~= true and not objData:IsAutoDecisionEnabled() and not objData:IsAutoDecisionBusy()
end
return StarTowerSettingGate
File diff suppressed because it is too large Load Diff
+2 -8
View File
@@ -54,12 +54,6 @@ function StoryLevel:Init(parent, nLevelId, nBuildId, bActivityStory)
end
function StoryLevel:RefreshCharDamageData()
self.tbCharDamage = UTILS.GetCharDamageResult(self.tbCharId)
for k, v in pairs(self.tbCharDamage) do
local mapSkin = ConfigTable.GetData_CharacterSkin(PlayerData.Char:GetCharSkinId(v.nCharId))
if mapSkin ~= nil then
v.nSkinId = mapSkin.Id
end
end
end
function StoryLevel:OnEvent_LoadLevelRefresh()
local mapAllEft, mapDiscEft, mapNoteEffect, tbNoteInfo = PlayerData.Build:GetBuildAllEft(self.mapBuildData.nBuildId)
@@ -95,7 +89,7 @@ function StoryLevel:OnEvent_SendMsgFinishBattle(LevelResult, FadeTime, sVideoNam
List = PlayerData.Achievement:GetBattleAchievement(GameEnum.levelType.Mainline, LevelResult ~= AllEnum.LevelResult.Failed)
}
if self.bActivityStory then
PlayerData.ActivityAvg:SendMsg_STORY_DONE(func_cbFinishSucc, events)
self.parent:SendMsg_STORY_DONE(func_cbFinishSucc, events)
else
PlayerData.Avg:SendMsg_STORY_DONE(func_cbFinishSucc, events)
end
@@ -184,7 +178,7 @@ function StoryLevel:PlaySuccessPerform(FadeTime, mapChangeInfo, sVideoName)
EventManager.Add("SettlementPerformLoadFinish", self, openBattleResultPanel)
local tbSkin = {}
for _, nCharId in ipairs(tbChar) do
local nSkinId = PlayerData.Char:GetCharSkinId(nCharId)
local nSkinId = PlayerData.Build:GetBattleCharSkinId(nCharId)
table.insert(tbSkin, nSkinId)
end
CS.AdventureModuleHelper.PlaySettlementPerform(sName, "", tbSkin, func_SettlementFinish)
@@ -210,7 +210,7 @@ function TravelerDuelLevelData:PlaySuccessPerform(bNewRecord, nStar, nTime)
local sName = ConfigTable.GetData("EndSceneType", nType).EndSceneName
local tbSkin = {}
for _, nCharId in ipairs(tbChar) do
local nSkinId = PlayerData.Char:GetCharSkinId(nCharId)
local nSkinId = PlayerData.Build:GetBattleCharSkinId(nCharId)
table.insert(tbSkin, nSkinId)
end
CS.AdventureModuleHelper.PlaySettlementPerform(sName, "", tbSkin, func_OpenResult)
@@ -244,7 +244,7 @@ function TravelerDuelLevelData:OnEvnet_Pause()
nHard = nHard + mapAffixCfgData.Difficulty
end
end
EventManager.Hit("OpenTDPause", self.nlevelId, self.tbCharId, nHard)
EventManager.Hit("OpenTDPause", self.nlevelId, self.tbCharId, nHard, self.tbCharTrialId)
end
function TravelerDuelLevelData:OnEvent_UploadDodgeEvent(padMode)
local tab = {}
@@ -182,7 +182,7 @@ function VampireSurvivorLevelData:Init(parent, nLevelId, nBuildId1, nBuildId2, t
local tbActivedDropData = PlayerData.VampireSurvivor:GetActivedDropItem()
CS.AdventureModuleHelper.EnterVampireFloor(self.floorId, self.tbCharId, true, self.tbFirstHalfEventType1, self.tbFirstHalfEventType2, self.bHalfBattle, tbActivedDropData)
NovaAPI.EnterModule("AdventureModuleScene", true, 17)
EventManager.Hit(EventId.OpenPanel, PanelId.VampireSurvivorBattlePanel, self.tbCharId, self.nLevelId)
EventManager.Hit(EventId.OpenPanel, PanelId.VampireSurvivorBattlePanel, self.tbCharId, self.nLevelId, self.mapBuildData)
end
PlayerData.Build:GetBuildDetailData(GetBuildCallback, nBuildId1)
end
@@ -427,7 +427,7 @@ function VampireSurvivorLevelData:InitReEnter(parent, nLevelId, nBuildId1, nBuil
local tbActivedDropData = PlayerData.VampireSurvivor:GetActivedDropItem()
CS.AdventureModuleHelper.EnterVampireFloor(self.floorId, self.tbCharId, false, self.tbSecondHalfEventType1, self.tbSecondHalfEventType2, self.bHalfBattle, tbActivedDropData)
NovaAPI.EnterModule("AdventureModuleScene", true, 17)
EventManager.Hit(EventId.OpenPanel, PanelId.VampireSurvivorBattlePanel, self.tbCharId, self.nLevelId)
EventManager.Hit(EventId.OpenPanel, PanelId.VampireSurvivorBattlePanel, self.tbCharId, self.nLevelId, self.mapBuildData)
end
PlayerData.Build:GetBuildDetailData(GetBuildCallback, nBuildId2)
end
@@ -992,7 +992,7 @@ function VampireSurvivorLevelData:ChangeArea()
safe_call_cs_func(CS.AdventureModuleHelper.SetActorAttribute, nCharId, stActorInfo)
end
end
EventManager.Hit("VampireSurvivorChangeArea", self.tbCharId)
EventManager.Hit("VampireSurvivorChangeArea", self.tbCharId, self.mapBuildData)
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
NovaAPI.DispatchEventWithData("Level_Restart", nil, {})
local wait = function()
@@ -1196,7 +1196,7 @@ function VampireSurvivorLevelData:ReTry()
end
end
EventManager.Hit("BattleRestart")
EventManager.Hit("VampireSurvivorChangeArea", self.tbCharId)
EventManager.Hit("VampireSurvivorChangeArea", self.tbCharId, self.mapBuildData)
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
NovaAPI.DispatchEventWithData("Level_Restart", nil, {})
local wait = function()
@@ -1207,15 +1207,22 @@ function VampireSurvivorLevelData:ReTry()
end
cs_coroutine.start(wait)
end
local BuildIds = {
local tbBuildId = {
self.nBuildId1
}
if self.nBuildId2 > 0 then
table.insert(BuildIds, self.nBuildId2)
table.insert(tbBuildId, self.nBuildId2)
end
local tbBuilds = {}
for _, nBuildId in ipairs(tbBuildId) do
table.insert(tbBuilds, {
Type = PlayerData.Build:IsUseTrialRuntime(nBuildId) and 2 or 1,
BuildId = nBuildId
})
end
local msg = {
Id = self.nLevelId,
BuildIds = BuildIds
Builds = tbBuilds
}
HttpNetHandler.SendMsg(NetMsgId.Id.vampire_survivor_apply_req, msg, nil, NetCallback)
else
@@ -1257,7 +1264,7 @@ function VampireSurvivorLevelData:ReTry()
safe_call_cs_func(CS.AdventureModuleHelper.SetActorAttribute, nCharId, stActorInfo)
end
end
EventManager.Hit("VampireSurvivorChangeArea", self.tbCharId)
EventManager.Hit("VampireSurvivorChangeArea", self.tbCharId, self.mapBuildData)
EventManager.Hit("BattleRestart")
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
NovaAPI.DispatchEventWithData("Level_Restart", nil, {})
@@ -1479,8 +1486,11 @@ function VampireSurvivorLevelData:OnEvent_Time(nTime)
end
end
function VampireSurvivorLevelData:OnEvent_BattlePause()
if self.bBattleEnd then
return
end
local nScore = self:CalCurScore()
EventManager.Hit("OpenVampirePause", self.nLevelId, self.tbCharId, self.nCurTotalTime, nScore)
EventManager.Hit("OpenVampirePause", self.nLevelId, self.tbCharId, self.nCurTotalTime, nScore, self.tbCharTrialId)
end
function VampireSurvivorLevelData:OnEvent_Abandon()
self:AbandonBattle()
+394 -102
View File
@@ -49,7 +49,10 @@ GameEnum.handbookType = {
OUTFIT = 2,
PLOT = 3,
CG = 4,
StorySet = 5
StorySet = 5,
DormSkin = 6,
DormFurniture = 7,
StoryReview = 8
}
GameEnum.roguelikeLevelStyle = {
CountrySide = 1,
@@ -142,7 +145,19 @@ GameEnum.roguelikeLevelStyle = {
StoryActivity_16 = 476,
StoryActivity_16_01 = 477,
StoryActivity_17 = 481,
StoryActivity_17_Boss01 = 482,
StoryActivity_18 = 486,
StoryActivity_19 = 491,
StoryActivity_19_01 = 492,
StoryActivity_20 = 496,
StoryActivity_20_01 = 497,
StoryActivity_21 = 501,
StoryActivity_22 = 506,
StoryActivity_22_01 = 507,
StoryActivity_23 = 511,
StoryActivity_24 = 516,
StoryActivity_25 = 521,
StoryActivity_25_01 = 522,
Training = 901
}
GameEnum.roguelikeFloorFunction = {
@@ -311,7 +326,8 @@ GameEnum.referenceattrib = {
SEP = 18,
AEP = 19,
LEP = 20,
DEP = 21
DEP = 21,
CurrentHp = 22
}
GameEnum.subMapName = {
ThunderBluff = 1,
@@ -382,7 +398,9 @@ GameEnum.jumpType = {
ActivityStory = 44,
ActivityLevel = 45,
ActivityGame1 = 46,
ActivityGame2 = 47
ActivityGame2 = 47,
Soldier = 48,
Dorm = 49
}
GameEnum.characterSearchTargetType = {MELEE = 1, RANGED = 2}
GameEnum.characterSearchTargetTypeTowerDefense = {NORMAL = 1}
@@ -391,7 +409,8 @@ GameEnum.gachaStorageType = {
CharacterCardPool = 2,
DiscUpCardPool = 3,
DiscCardPool = 4,
BeginnerCardPool = 5
BeginnerCardPool = 5,
CharacterCardRewardPool = 6
}
GameEnum.guidetype = {
ForcedClick = 1,
@@ -420,7 +439,9 @@ GameEnum.guideprepose = {
UnlockFunction = 4,
HoldItem = 5,
FinishStarTowerQuest = 6,
UnFinishCharacterPlot = 7
UnFinishCharacterPlot = 7,
FinishDormQuest = 8,
FinishDormQuestGroup = 9
}
GameEnum.guidepost = {UnDoneGuide = 1}
GameEnum.guidetrigger = {
@@ -550,7 +571,9 @@ GameEnum.itemType = {
LevelHonor = 15,
TraceRequest = 16,
HuntPermit = 17,
SoldierItem = 18
SoldierItem = 18,
DormFurniture = 19,
DormHonor = 20
}
GameEnum.expireType = {
ExpireMin = 1,
@@ -693,6 +716,19 @@ GameEnum.achievementCond = {
WeekBossClearTotal = 123,
TraceHuntTraceComplete = 159,
TraceHuntAssistHunt = 160,
DormFurnitureAcquire = 161,
DormRewardReceive = 162,
DormUnlockRoom = 163,
DormPlaceFurniture = 164,
DormRoleInteractionReward = 165,
DormFurnitureCollect = 166,
DormDailyReceiveReward = 171,
DormSendGift = 172,
ActivityStoryPass = 173,
SoldierClearTotal = 174,
SoldierClearTotalWithSeason = 175,
SoldierSpecificRankWithSeason = 176,
DormSaveRoom = 177,
ClientReport = 200,
TowerBattleTimes = 501,
TowerBossChallengeSpecificHighRewardWithTotal = 502,
@@ -788,7 +824,12 @@ GameEnum.activityQuestCompleteCond = {
ActivityIceCreamLevelPassed = 155,
ActivityIceCreamCumulativeUseItem = 156,
ActivityIceCreamCumulativeCombo = 157,
ActivitySoldierScore = 158
ActivitySoldierScore = 158,
ActivityMathParkourCumulativeUseItem = 167,
ActivityMathParkourCumulativeScore = 168,
ActivityMathParkourLevelPassed = 169,
ActivityPenguinCardClearDifficulty = 170,
ActivityStoryPass = 173
}
GameEnum.chatCond = {
CharacterAcquire = 5,
@@ -815,7 +856,9 @@ GameEnum.handBookCond = {
SkinAcquire = 61,
StoryClear = 63,
StorySetClearSpecific = 116,
CharacterWithSpecificSkillAndLevel = 118
CharacterWithSpecificSkillAndLevel = 118,
DormFurnitureAcquire = 161,
ActivityStoryPass = 173
}
GameEnum.jointDrillCond = {JointDrillScoreTotal = 95}
GameEnum.questAcceptCond = {
@@ -942,6 +985,18 @@ GameEnum.questCompleteCond = {
WeekBossClearTotal = 123,
ActivityStoryReadStory = 124,
ActivitySoldierScore = 158,
DormRewardReceive = 162,
DormUnlockRoom = 163,
DormPlaceFurniture = 164,
DormRoleInteractionReward = 165,
DormFurnitureCollect = 166,
DormDailyReceiveReward = 171,
DormSendGift = 172,
ActivityStoryPass = 173,
SoldierClearTotal = 174,
SoldierClearTotalWithSeason = 175,
SoldierSpecificRankWithSeason = 176,
DormSaveRoom = 177,
ClientReport = 200,
TowerBattleTimes = 501,
TowerBossChallengeSpecificHighRewardWithTotal = 502,
@@ -1043,7 +1098,8 @@ GameEnum.honorType = {
Normal = 1,
Character = 2,
Group = 3,
Levels = 4
Levels = 4,
Dorm = 5
}
GameEnum.headType = {
HeroineAvatar = 1,
@@ -1545,7 +1601,15 @@ GameEnum.itemStype = {
CharacterSkin = 46,
SouvenirEnergyItem = 47,
Build = 48,
Chess = 49
Chess = 49,
DormHonor = 50,
DormFurniture = 51,
DormKit = 52,
DormScene = 53,
DormSkin = 54,
DormRoom = 55,
DormLayout = 56,
TokenItem = 57
}
GameEnum.targetType = {
AllActor = 1,
@@ -1898,7 +1962,12 @@ GameEnum.activityType = {
IceCream = 23,
FollowSocialMedia = 24,
Soldier = 25,
NewStory = 30
Reengagement = 26,
MathParkour = 27,
MailBind = 28,
NewStory = 30,
MallLogin = 31,
SignIn = 32
}
GameEnum.activityOpenType = {
None = 0,
@@ -2206,7 +2275,8 @@ GameEnum.force = {
Force14 = 14,
Force15 = 15,
Force16 = 16,
Force17 = 17
Force17 = 17,
Force18 = 18
}
GameEnum.bubbleDirection = {Left = 1, Right = 2}
GameEnum.attributeType = {BaseAttrType = 1, PlayerAttrType = 2}
@@ -2341,7 +2411,11 @@ GameEnum.OpenFuncType = {
QuestNewbie = 31,
TraceHunt = 32,
EnergyBattery = 33,
EventReminder = 34
EventReminder = 34,
Dorm = 35,
GuideMission = 36,
Soldier = 37,
ActivityReview = 38
}
GameEnum.TowerQuestType = {Core = 1, Normal = 2}
GameEnum.poolType = {Elite = 1, Boss = 2}
@@ -2594,7 +2668,9 @@ GameEnum.activityThemeType = {
CultivationManual_10111 = 18,
BreakOut_30103 = 19,
LongestDay_10112 = 20,
BreakOut_30104 = 21
BreakOut_30104 = 21,
DustDawn_20104 = 22,
UnchartedMap_10113 = 23
}
GameEnum.ActivityLevelType = {
Explore = 1,
@@ -2651,9 +2727,24 @@ GameEnum.PopUpSeqType = {
ActivityFaceAnnounce = 5,
ActivityLogin = 6,
NewChat = 7,
MessageBox = 8
MessageBox = 8,
Reengagement = 9,
ReengagementAvg = 10,
StarTowerBuildSave = 12,
MainViewGuide = 13
}
GameEnum.MallItemType = {
Package = 1,
Skin = 2,
Furniture = 3
}
GameEnum.MallItemSubType = {
Package = 1,
Skin = 2,
Furniture = 3,
FurnitureSet = 4,
FurnitureTheme = 5
}
GameEnum.MallItemType = {Package = 1, Skin = 2}
GameEnum.GetLinesType = {
GachaNew = 1,
Gacha = 2,
@@ -2840,7 +2931,8 @@ GameEnum.MallAdvRecommendItemType = {
MonthlyCard = 1,
BattlePass = 2,
Package = 3,
Skin = 4
Skin = 4,
Furniture = 5
}
GameEnum.StoryPreviewType = {
None = 0,
@@ -2976,7 +3068,25 @@ GameEnum.ChessPartnerType = {
DianFengZhanShi = 16,
MeiLiManYi = 17,
RenDuoShiZhong = 18,
MoYu = 19
MoYu = 19,
LongYi = 20,
BaiMaoJuTuan = 21,
ShaXieYongBingTuan = 22,
LiMingJinWei = 23,
HangHaiJia = 24,
WangPaiTeGong = 25,
ZhiHuiGuan = 26,
QiLiMoFa = 27,
HuoLiYaZhi = 28,
XueFuWuChe = 29,
MeiShiJianShangJia = 30,
QiShiJingShen = 31,
WuQiDaShi = 32,
ShouYeRen = 33,
GaoGeDaXinWen = 34,
QianBianRenZhe = 35,
RenDaoChuanCheng = 36,
BenZunJiaDao = 37
}
GameEnum.ActivityIceCreamLevelType = {
Teaching = 1,
@@ -3005,13 +3115,17 @@ GameEnum.soldierNodeType = {
Event = 1,
Battle = 2,
MidBossBattle = 3,
FinalBossBattle = 4
FinalBossBattle = 4,
CheckStage = 5
}
GameEnum.soldierEventType = {
FinalBossBattle = 1,
MidBossBattle = 2,
NormalBattle = 3,
BattleOptions = 4
BattleOptions = 4,
StoryPersonality = 5,
StoryCost = 6,
CheckStage = 7
}
GameEnum.soldierLevelName = {
Simple = 1,
@@ -3071,70 +3185,39 @@ GameEnum.SoldierClientEffect = {
AmendAttr = 2,
PercentAmendAttr = 3,
PartnerTag = 4,
BattleAttrHalve = 5
BattleAttrHalve = 5,
BaseAmendAttr = 6,
BasePercentAmendAttr = 7
}
GameEnum.soldierEffectLifecycleType = {
IMMEDIATE = 0,
CONDITIONAL = 1,
PERMANENT = 2
}
GameEnum.soldierBuffCond = {
CurrentNodeEqual = 1,
CurrentNodeAfterKeep = 2,
CurrentNodeSpecific = 3,
NextNodes = 4,
EnterNodeCountKeep = 5,
EnterNodeCountEqual = 6,
EnterNodeCountEqualLoop = 7,
CurrentStageSpecific = 8,
CurrentStage = 9,
NextNodeType = 11,
BattleCount = 12,
BattleCountLoop = 13,
BattleVictoryCount = 14,
BattleVictoryCountLoop = 15,
BattleDefeatCount = 16,
BattleDefeatCountLoop = 17,
BattleContinuousVictoryCount = 18,
BattleContinuousVictoryCountLoop = 19,
BattleContinuousDefeatCount = 20,
BattleContinuousDefeatCountLoop = 21,
BattleContinuousDefeatCountKeep = 22,
BattleContinuousVictoryCountKeep = 23,
ShopLevelSpecific = 24,
ShopLevelUpgrade = 25,
ShopLevelKeep = 26,
ShopRefreshCountKeep = 28,
ShopRefreshCountLoop = 30,
ShopPurchaseChess = 32,
ShopPurchaseChessLoop = 33,
ShopPurchaseChessCost = 34,
ShopPurchaseChessCostLoop = 35,
ShopPurchaseChessPartner = 36,
ShopPurchaseChessPartnerLoop = 37,
ShopPurchaseChessType = 38,
ShopPurchaseChessTypeLoop = 39,
ShopChessSell = 40,
ShopChessSellLoop = 41,
ShopPurchaseExpCount = 42,
ShopPurchaseExpCountLoop = 43,
HpEqual = 44,
HpGreaterThan = 45,
HpLessThan = 46,
ResAdd = 47,
ResDeductKeep = 48,
ResDeductLoop = 49,
ResKeep = 50,
ChessMergeSpecificStar = 51,
ChessMergeSpecificStarWithCost = 52,
ChessMergeSpecificStarWithType = 53,
ChessMergeSpecificStarWithPartner = 54,
DeployChessSpecificCountWithCost = 55,
DeployChessSpecificCountWithType = 56,
DeployChessSpecificCountWithPartner = 57,
UsageQuota = 58,
UsageQuotaPerNode = 59,
ShopRefreshCount = 60,
ResDeduct = 61,
DeployChessEqualCountWithPartner = 62,
HpGreaterThanLoop = 63,
HpLessThanLoop = 64,
DeployChessEqualCountWithType = 65
EnterNodeCountEqual = 1,
NextNodeType = 2,
BattleCount = 3,
BattleVictoryCount = 4,
BattleDefeatCount = 5,
BattleContinuousVictoryCount = 6,
BattleContinuousDefeatCount = 7,
ShopRefreshCount = 8,
ShopPurchaseChess = 9,
ShopPurchaseChessCost = 10,
ShopPurchaseChessPartner = 11,
ShopPurchaseChessType = 12,
ShopChessSell = 13,
ShopPurchaseExpCount = 14,
ResAdd = 15,
ResDeduct = 16,
HpGreaterThan = 17,
HpLessThan = 18,
ChessMergeSpecificStar = 19,
ChessMergeSpecificStarWithCost = 20,
ChessMergeSpecificStarWithType = 21,
ChessMergeSpecificStarWithPartner = 22,
NextNode = 23
}
GameEnum.soldierBuffEffect = {
GainItem = 1,
@@ -3151,32 +3234,75 @@ GameEnum.soldierBuffEffect = {
PartnerSpecificAddCount = 12,
NodeTypeModify = 13,
ShopAddExp = 14,
ResMultiply = 15,
ResSet = 16,
RandomChessAddByStar = 17,
RandomChessAddByStarAndCost = 18,
RandomChessAddByType = 19,
ShopRefreshDiscount = 20,
ShopPurchaseExpDiscount = 21,
GainResScale = 22,
HoldResScale = 23,
ShopRandomRarityWeightDouble = 24,
GetTwoDice = 25,
RandomStrategyCardSpecificRarity = 26,
LeftmostWaitingChessChange = 27,
LeftmostWaitingChessSpecificCostChange = 28,
ShopRandomChessBecomeAnotherHigherCost = 29,
ExchangeHpAndGold = 30,
ShopGoodsProbabilityBecomingHigherStar = 31,
ChessWeightUpWithSpecificPartner = 32,
ClientEffect = 33
ResSet = 15,
RandomChessAddByStar = 16,
RandomChessAddByStarAndCost = 17,
RandomChessAddByType = 18,
ShopRefreshDiscount = 19,
ShopPurchaseExpDiscount = 20,
GainResScale = 21,
HoldResScale = 22,
ShopRandomRarityWeightDouble = 23,
GetTwoDice = 24,
RandomStrategyCardSpecificRarity = 25,
LeftmostWaitingChessChange = 26,
LeftmostWaitingChessSpecificCostChange = 27,
ShopRandomChessBecomeAnotherHigherCost = 28,
ExchangeHpAndGold = 29,
ShopGoodsProbabilityBecomingHigherStar = 30,
ChessWeightUpWithSpecificPartner = 31,
ClientEffectAttr = 32,
ClientEffectHarvest = 33,
InterestLimitAdd = 34,
CardReRollAddCount = 35,
DiceAddPoint = 36,
ShopRandomTempFreeRefresh = 37,
PartnerAddShopExp = 38,
HarvestAddRes = 39,
HarvestBattleDefeatAddRes = 40,
ClientEffectAddGold = 41
}
GameEnum.soldierBuffEvent = {
EnterNode = 1,
HpChange = 2,
Battle = 3,
Deploy = 4,
ShopPurchase = 5,
ShopUpgrade = 6,
ShopRefresh = 7,
ShopSell = 8,
ResChange = 9,
ChessMerge = 10,
Client = 11
}
GameEnum.soldierBuffState = {
NextNodes = 1,
CurrentNode = 2,
CurrentStage = 3,
CurrentNodeAfter = 4,
CheckNode = 5,
CheckStage = 6,
CheckNodeType = 7,
CheckHp = 8,
CheckRes = 9,
CheckShopLevel = 10,
CheckDeployChessByPartner = 11,
CheckDeployChessByType = 12,
CheckDeployChessByCost = 13,
CheckDeployChessById = 14,
CheckBattleResult = 15,
CheckBattleCount = 16,
CheckShopRefreshCount = 17,
CheckResConsume = 18,
CheckResObtain = 19
}
GameEnum.PartnerLevelQuality = {
None = 0,
Copper = 1,
Silver = 2,
Gold = 3,
Color = 4
Color = 4,
Special = 5
}
GameEnum.SoldierCharacterType = {Actor = 1, Monster = 2}
GameEnum.ActivityPenguinCardLevelType = {Normal = 1, Endless = 2}
@@ -3189,4 +3315,170 @@ GameEnum.EventReminderType = {
}
GameEnum.CharGemInstanceRewardType = {General = 1, Enhance = 2}
GameEnum.CharGemInstanceDropGuarantee = {RoundTableGuarantee = 1, SequentialGuarantee = 2}
GameEnum.DormRoomType = {Outdoor = 0, Indoor = 1}
GameEnum.DormRoomSizeType = {OutdoorSize1 = 0, IndoorSize1 = 1}
GameEnum.DormFurType = {
OnFloor = 0,
OnWall = 1,
Carpet = 2,
Poster = 3,
Wall = 4,
Floor = 5,
FloorCarpet = 6,
FloorPoster = 7
}
GameEnum.DormFurFixedType = {
None = 0,
Wall = 1,
Floor = 2,
Doll = 3,
Drink = 4,
Elevator = 5
}
GameEnum.DormFurRotate = {
None = 0,
Quarter = 1,
Half = 2,
Quarter3 = 3
}
GameEnum.DormRoleType = {
MoWang = 0,
Character = 1,
NPC = 2
}
GameEnum.DormRewardType = {Normal = 0, Entry = 1}
GameEnum.DormConditionType = {
Room = 1,
Furniture = 2,
Role = 3
}
GameEnum.DormInterType = {Common = 1, Approproative = 2}
GameEnum.DormAchievementType = {FurnitureCollectionValue = 1}
GameEnum.ActivityStoryPreviewType = {
None = 0,
MainlineStory = 1,
StorySet = 2,
ActivityStory = 3
}
GameEnum.MathParkourObjectType = {
Enemy = 1,
TrappedActor = 2,
AccelerationConveyor = 3,
DecelerationConveyor = 4,
SpecialConveyor = 5,
BenefitItem = 6,
Boss = 7,
Wall = 8
}
GameEnum.MathParkourBuffType = {
Rocket = 1,
Drill = 2,
Saw = 3,
Shield = 4,
ActorA = 5,
ActorB = 6,
ActorC = 7,
Boom = 8
}
GameEnum.TowerVitaOptionCategories = {
Potential = 1,
Shop = 2,
Event = 3
}
GameEnum.TowerVitaOptionType = {
Switch = 1,
Selector = 2,
DropList = 3,
NumberInput = 4,
SortTableList = 5
}
GameEnum.SoldierTechNodeType = {
None = 0,
Core = 1,
Attribute = 2,
BossAbility = 3
}
GameEnum.SoldierTechBattleEffect = {
None = 0,
FinalDamageUp = 1,
FinalDamageReduceUp = 2,
SkillCritRateUp = 3,
SkillFinalDamageUp = 4
}
GameEnum.ShopType = {
None = 0,
Resident = 1,
GuideMission = 2
}
GameEnum.SoldierTechBattleBuffTarget = {
All = 0,
Team = 1,
Enemy = 2
}
GameEnum.SoldierPersonalityGrade = {
PersonalityGrade_1 = 1,
PersonalityGrade_2 = 2,
PersonalityGrade_3 = 3,
PersonalityGrade_4 = 4,
PersonalityGrade_5 = 5,
PersonalityGrade_6 = 6,
PersonalityGrade_7 = 7
}
GameEnum.SoldierRolePersonality = {
Personality_Intuition = 1,
Personality_Analysis = 2,
Personality_Chaos = 3
}
GameEnum.SoldierRoleSkillType = {
SoldierRoleSkillType_1 = 1,
SoldierRoleSkillType_2 = 2,
SoldierRoleSkillType_3 = 3,
SoldierRoleSkillType_4 = 4
}
GameEnum.SoldierSeason = {None = 0, S1 = 1}
GameEnum.SoldierStoryOptionCond = {
BossPersonalityGrade = 1,
OptionChosenInRun = 2,
EndingUnlocked = 3,
GradeLevelUnlocked = 4,
CoinUnlocked = 5,
HpUnlocked = 6
}
GameEnum.SoldierStoryRewardType = {
GainItem = 1,
GainChessStarCostWeight = 2,
GainChessByCost = 3,
GainChessStarPartnerWeight = 4,
GainCardQualityWeight = 5,
GainCardByQuality = 6,
RecoverHp = 7,
GainHiddenCard = 8,
LoseHp = 9,
LoseItem = 10,
LoseAllCoin = 11
}
GameEnum.EndingCondition = {FinalBossDefeated = 1, FinalBossNotDefeated = 2}
GameEnum.SoldierStoryCondFailMode = {Hide = 1, Disable = 2}
GameEnum.SoldierStoryResultType = {Default = 1, Fail = 2}
GameEnum.PartnerCatalogue = {Camp = 1, Style = 2}
GameEnum.EventOptionTag = {
Preservative = 1,
Standard = 2,
Aggresive = 3,
Correct = 4,
PotentialCommon = 5,
PotentialRare = 6,
PotentialMain = 7,
PotentialAssist = 8,
PotentialRandom = 9,
NoteRandom = 10,
Note90011 = 11,
Note90012 = 12,
Note90013 = 13,
Note90014 = 14,
Note90015 = 15,
Note90016 = 16,
Note90017 = 17,
Coin = 18
}
return GameEnum
+186 -4
View File
@@ -22,6 +22,7 @@ GameTableDefine.CommonTable = {
Key = true,
Lang = {"Desc"}
},
ActivityEntrance = {Key = true},
ActivityGoods = {
Key = true,
Lang = {"Name", "Desc"}
@@ -51,6 +52,10 @@ GameTableDefine.CommonTable = {
"Desc"
}
},
ActivityMailBindControl = {
Key = true,
Lang = {"Desc"}
},
ActivityPenguinCardLevel = {
Key = true,
Lang = {"Name"}
@@ -63,6 +68,36 @@ GameTableDefine.CommonTable = {
Key = true,
Lang = {"GroupName"}
},
ActivityReturnee = {Key = true},
ActivityReturneeCard = {
Key = true,
Lang = {"Name", "Desc"}
},
ActivityReturneeLoginRewardControl = {
Key = true,
Lang = {"DesText"}
},
ActivityReturneeLoginRewardGroup = {
Key = true,
Lang = {"RewardDesc"}
},
ActivityReturneePack = {
Key = true,
Lang = {
"Name",
"DetailName",
"SimpleName"
}
},
ActivityReturneeQuest = {
Key = true,
Lang = {"Title"}
},
ActivityReturneeQuestGroup = {Key = true},
ActivityReturneeQuestPoint = {},
ActivityReturneeReunionReward = {Key = true},
ActivityReturneeTrialBuild = {Key = true},
ActivityReturneeTrialBuildGroup = {Key = true},
ActivityShop = {
Key = true,
Lang = {"Name"}
@@ -77,9 +112,16 @@ GameTableDefine.CommonTable = {
"Aim"
}
},
ActivityStoryChapter = {Key = true},
ActivityStoryChapter = {
Key = true,
Lang = {"Title", "StoryTime"}
},
ActivityStoryCondition = {Key = true},
ActivityStoryEvidence = {Key = true},
ActivityStoryLine = {
Key = true,
Lang = {"Title"}
},
ActivityTask = {
Key = true,
Lang = {"Title", "Desc"}
@@ -416,6 +458,45 @@ GameTableDefine.CommonTable = {
Key = true,
Lang = {"Title"}
},
DormAchievement = {
Key = true,
Lang = {"Title", "Desc"}
},
DormFurniture = {Key = true},
DormHonorTitle = {Key = true},
DormInteractive = {Key = true},
DormLayoutReward = {
Key = true,
Lang = {
"RoomLayoutName",
"RoomLayoutDesc",
"RoomLayoutTag",
"GetWay"
}
},
DormQuest = {
Key = true,
Lang = {"Title"}
},
DormQuestGroup = {
Key = true,
Lang = {"Title"}
},
DormReward = {Key = true},
DormRole = {Key = true},
DormRoleSkin = {Key = true},
DormRoom = {
Key = true,
Lang = {
"DefaultName"
}
},
DormRoomLayout = {Key = true},
DormRoomScene = {
Key = true,
Lang = {"Desc"}
},
DormRoomSize = {Key = true},
Drop = {},
DropItemShow = {},
DropObject = {Key = true},
@@ -477,6 +558,7 @@ GameTableDefine.CommonTable = {
GachaATypeProb = {},
GachaNewbie = {Key = true},
GachaPkg = {},
GachaReward = {Key = true},
GachaStorage = {
Key = true,
Lang = {"Name"}
@@ -538,8 +620,14 @@ GameTableDefine.CommonTable = {
GoldenSpySkill = {Key = true},
Guide = {Key = true},
GuideGroup = {Key = true},
GuideMissionChapter = {Key = true},
GuideMissionQuest = {Key = true},
GuideMissionChapter = {
Key = true,
Lang = {"Index", "Title"}
},
GuideMissionQuest = {
Key = true,
Lang = {"Title"}
},
GuideMissionQuestGroup = {Key = true},
Handbook = {Key = true},
HitDamage = {Key = true},
@@ -669,6 +757,10 @@ GameTableDefine.CommonTable = {
Key = true,
Lang = {"Name", "Desc"}
},
MallActivity = {
Key = true,
Lang = {"Name"}
},
MallAdvRecommend = {Key = true},
MallGem = {
Key = true,
@@ -710,6 +802,33 @@ GameTableDefine.CommonTable = {
Key = true,
Lang = {"Title"}
},
MathParkourAreaConfig = {Key = true},
MathParkourBuffItem = {
Key = true,
Lang = {"Name", "Desc"}
},
MathParkourConfig = {Key = true},
MathParkourControl = {
Key = true,
Lang = {"Desc"}
},
MathParkourItemGroup = {Key = true},
MathParkourLevel = {
Key = true,
Lang = {"Title", "Desc"}
},
MathParkourObject = {
Key = true,
Lang = {"Name"}
},
MathParkourQuest = {
Key = true,
Lang = {"Desc"}
},
MathParkourQuestGroup = {
Key = true,
Lang = {"GroupName"}
},
MiningControl = {
Key = true,
Lang = {"Desc"}
@@ -822,7 +941,7 @@ GameTableDefine.CommonTable = {
PenguinCardFixedTurn = {Key = true},
PenguinCardFloor = {
Key = true,
Lang = {"Floortips"}
Lang = {"Floortips", "FloorDesc"}
},
PenguinCardHandRank = {
Key = true,
@@ -945,12 +1064,24 @@ GameTableDefine.CommonTable = {
Key = true,
Lang = {"Name"}
},
SoldierBossPersonalityGrade = {},
SoldierBossTemplate = {
Key = true,
Lang = {
"Name",
"Title",
"Desc"
}
},
SoldierBuff = {Key = true},
SoldierCardEffect = {Key = true},
SoldierCharacter = {
Key = true,
Lang = {"Name"}
},
SoldierCharGrowthTier = {Key = true},
SoldierCharTierAttrBonus = {Key = true},
SoldierCheckStageAddScore = {Key = true},
SoldierChessAI = {Key = true},
SoldierChessType = {
Key = true,
@@ -961,10 +1092,19 @@ GameTableDefine.CommonTable = {
Key = true,
Lang = {"DesText"}
},
SoldierDifficultyAdjustGrade = {Key = true},
SoldierEndingPlan = {
Key = true,
Lang = {
"EndingTitle",
"Desc"
}
},
SoldierEventBattlePool = {
Key = true,
Lang = {"Title", "Name"}
},
SoldierEventPersonalityStory = {Key = true},
SoldierEventPlan = {Key = true},
SoldierFloor = {Key = true},
SoldierGradeChallenge = {
@@ -977,6 +1117,10 @@ GameTableDefine.CommonTable = {
},
SoldierLabelMark = {Key = true},
SoldierNodePlan = {Key = true},
SoldierOptionType = {
Key = true,
Lang = {"OptionDesc", "CostDesc"}
},
SoldierPartner = {
Key = true,
Lang = {"Name", "Desc"}
@@ -1023,6 +1167,20 @@ GameTableDefine.CommonTable = {
"Desc"
}
},
SoldierStoryPersonalityOption = {Key = true},
SoldierStoryResult = {
Key = true,
Lang = {"ResultText"}
},
SoldierStoryReward = {Key = true},
SoldierStoryType = {
Key = true,
Lang = {
"Title",
"Desc",
"OptionTitleDesc1"
}
},
SoldierStrategyCard = {
Key = true,
Lang = {
@@ -1031,6 +1189,12 @@ GameTableDefine.CommonTable = {
"Desc"
}
},
SoldierTechBattleEffect = {Key = true},
SoldierTechNode = {
Key = true,
Lang = {"Name", "Desc"}
},
SoldierTotalReward = {Key = true},
StarTower = {
Key = true,
Lang = {"Name", "Desc"}
@@ -1138,6 +1302,10 @@ GameTableDefine.CommonTable = {
Key = true,
Lang = {"Name", "Desc"}
},
StoryLine = {
Key = true,
Lang = {"TitleMain", "TitleSub"}
},
StoryPersonality = {
Key = true,
Lang = {"Name"}
@@ -1277,6 +1445,20 @@ GameTableDefine.CommonTable = {
},
TowerDefenseStory = {Key = true},
TowerDefenseTeamExp = {Key = true},
TowerVitaOption = {
Key = true,
Lang = {
"OptionText1",
"OptionText2",
"OptionText3",
"OptionText4",
"OptionText5",
"OptionText6",
"OptionText7",
"OptionText8",
"OptionText9"
}
},
TraceHuntBoss = {Key = true},
TraceHuntControl = {Key = true},
TraceHuntDifficulty = {},
+270 -89
View File
@@ -1,17 +1,248 @@
local JumpUtil = {}
local ModuleManager = require("GameCore.Module.ModuleManager")
local LocalData = require("GameCore.Data.LocalData")
function JumpUtil.JumpTo(jumpId, ...)
if jumpId == nil then
return
end
local args = {
...
}
local checkCallback = function(bNeedOpenPanel, bNeedTransition, nTransitionId, nTransitionType)
local sCurModule = ModuleManager.GetCurModuleName()
if sCurModule == "DormModuleScene" then
if not bNeedOpenPanel then
JumpUtil.DoJump(jumpId, table.unpack(args))
return
end
local nUseTransitionId = nTransitionId == 0 and 6 or nTransitionId
local transitionOpenCallback = function()
PanelManager.Home()
local function OnEventAfterEnterMain()
EventManager.Remove(EventId.AfterEnterMain, JumpUtil, OnEventAfterEnterMain)
PanelManager.IGNORE_CS_TRANS_EVENT = false
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
JumpUtil.DoJump(jumpId, table.unpack(args))
if not bNeedTransition then
EventManager.Hit(EventId.SetTransition)
end
end
cs_coroutine.start(wait)
end
local function OnEventDormLevelFinish()
EventManager.Remove("DORM_LEVEL_FINISH", JumpUtil, OnEventDormLevelFinish)
PanelManager.IGNORE_CS_TRANS_EVENT = true
NovaAPI.EnterModule("MainMenuModuleScene", true)
end
EventManager.Add("DORM_LEVEL_FINISH", JumpUtil, OnEventDormLevelFinish)
EventManager.Add(EventId.AfterEnterMain, JumpUtil, OnEventAfterEnterMain)
NovaAPI.DispatchEventWithData("DORM_LEVEL_STATE_CHANGED", nil, {true, 0})
end
EventManager.Hit(EventId.SetTransition, nUseTransitionId, transitionOpenCallback, AllEnum.MainViewCorner.Dorm)
else
local transitionOpenCallback = function()
JumpUtil.DoJump(jumpId, table.unpack(args))
end
if bNeedTransition then
EventManager.Hit(EventId.SetTransition, nTransitionId, transitionOpenCallback, nTransitionType)
else
transitionOpenCallback()
end
end
end
JumpUtil.JumpCheckAndTransition(jumpId, checkCallback, ...)
end
function JumpUtil.JumpCheckAndTransition(jumpId, callback, ...)
local unLock, mapJumpTo = JumpUtil.CheckJumpUnLock(jumpId, true)
if not unLock then
callback(false, false, 0)
return
end
if mapJumpTo == nil then
printError("未配置此跳转Id, JumpId: " .. jumpId)
callback(false, false, 0)
return
end
local nType = mapJumpTo.Type
if nType == GameEnum.jumpType.Shop then
callback(true, true, 5)
elseif nType == GameEnum.jumpType.Mall then
if PanelManager.CheckPanelOpen(PanelId.Mall) or PanelManager.CheckPanelOpen(PanelId.MallPopup) then
callback(false, false, 0)
else
local nState = ConfigTable.GetConfigNumber("IsShowComBtn")
if nState == 1 then
callback(true, true, 5)
else
callback(false, false, 0)
end
end
elseif nType == GameEnum.jumpType.Gacha then
local getInfoCallback = function()
callback(true, true, 6)
end
PlayerData.Gacha:GetGachaInfomation(getInfoCallback)
elseif nType == GameEnum.jumpType.TravelerDuelLevel then
local checkCallback = function()
local trekkerVersusData
local tbActList = PlayerData.Activity:GetActivityList()
for nId, v in pairs(tbActList) do
local nActType = v:GetActType()
if nActType == GameEnum.activityType.TrekkerVersus then
trekkerVersusData = v
break
end
end
if trekkerVersusData ~= nil then
local nActEndTime = trekkerVersusData:GetChallengeEndTime()
local nCurTime = CS.ClientManager.Instance.serverTimeStamp
if nActEndTime < nCurTime then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Invalid_Tip_3"))
return
end
callback(true, true, 30)
end
end
PlayerData.Activity:SendActivityDetailMsg(checkCallback)
elseif nType == GameEnum.jumpType.Crafting then
if PanelManager.CheckPanelOpen(PanelId.CraftingTip) then
callback(false, false, 0)
elseif PanelManager.CheckPanelOpen(PanelId.Crafting) then
callback(false, false, 0)
else
callback(true, false, 0)
end
elseif nType == GameEnum.jumpType.StarTower then
local bState = PlayerData.State:CheckStarTowerState()
if bState then
return
end
local nStarTowerId = mapJumpTo.Param[1]
local mapStarTower = ConfigTable.GetData("StarTower", nStarTowerId)
if mapStarTower == nil then
return
end
callback(true, false, 0)
elseif nType == GameEnum.jumpType.StarTowerGroup then
local bState = PlayerData.State:CheckStarTowerState()
if bState then
return
end
callback(true, false, 0)
elseif nType == GameEnum.jumpType.StarTowerPanel then
local bState = PlayerData.State:CheckStarTowerState()
if bState then
return
end
callback(true, false, 0)
elseif nType == GameEnum.jumpType.InfinityTower then
callback(true, true, 0)
elseif nType == GameEnum.jumpType.Phone then
local openCallback = function()
callback(true, false, 0)
end
PlayerData.Base:CheckFunctionBtn(GameEnum.OpenFuncType.Phone, openCallback)
elseif nType == GameEnum.jumpType.Vampire then
local stateCallback = function(bReEnter)
if not bReEnter then
local function success(bSuccess)
EventManager.Remove("GetTalentDataVampire", JumpUtil, success)
if bSuccess then
callback(true, true, 13)
end
end
EventManager.Add("GetTalentDataVampire", JumpUtil, success)
local ret, _, _ = PlayerData.VampireSurvivor:GetTalentData()
if ret ~= nil then
success(true)
end
end
end
local callbackCheck = function()
PlayerData.State:CheckVampireState(stateCallback)
end
PlayerData.Base:CheckFunctionBtn(GameEnum.OpenFuncType.VampireSurvivor, callbackCheck, "ui_systerm_locked")
elseif nType == GameEnum.jumpType.ComCYO then
callback(false, false, 0)
elseif nType == GameEnum.jumpType.ScoreBoss then
local openSC = function()
callback(true, false, 0)
end
if not PlayerData.ScoreBoss:GetInitInfoState() then
PlayerData.ScoreBoss:GetScoreBossInstanceData(openSC)
else
openSC()
end
elseif nType == GameEnum.jumpType.StorySet then
PlayerData.StorySet:TryOpenStorySetPanel(function()
callback(true, false, 0)
end)
elseif nType == GameEnum.jumpType.StarTowerGrowth then
local checkCallback = function()
callback(true, false, 0)
end
PlayerData.StarTower:SendTowerGrowthDetailReq(checkCallback)
elseif nType == GameEnum.jumpType.ActivityTask then
local nActId = mapJumpTo.Param[1]
if PlayerData.Activity:IsActivityInActivityGroup(nActId) then
local actGroupId = ConfigTable.GetData("Activity", nActId).MidGroupId
if actGroupId == 0 then
return
end
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
callback(true, false, 0)
return
end
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
end
elseif nType == GameEnum.jumpType.QuestNewbie then
if PanelManager.GetCurPanelId() == PanelId.QuestNewbie then
callback(false, false, 0)
else
callback(true, false, 0)
end
elseif nType == GameEnum.jumpType.TraceHunt then
local afterReq = function()
if PlayerData.TraceHunt:GetControlLeftTime() <= 0 then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("TraceHunt_Tips_ControlInterrupt"))
callback(false, false, 0)
return
end
callback(true, true, 49)
end
PlayerData.TraceHunt:SendTraceHuntInfoReq(afterReq)
elseif nType == GameEnum.jumpType.Dorm then
if ModuleManager.GetCurModuleName() == "DormModuleScene" then
return
end
local GetRoomInfoCallback = function(mapDormRoomInfo, mapDormBaseInfo)
if next(mapDormRoomInfo) == nil then
return
end
callback(true, true, 6, AllEnum.MainViewCorner.Dorm)
end
local GetBagInfoCallback = function()
PlayerData.PlayerDormData:GetRoomInfo(GetRoomInfoCallback)
end
PlayerData.PlayerDormData:GetBagInfo(GetBagInfoCallback)
else
callback(true, false, 0)
end
end
function JumpUtil.DoJump(jumpId, ...)
local unLock, mapJumpTo = JumpUtil.CheckJumpUnLock(jumpId, true)
if not unLock then
return false
end
if mapJumpTo == nil then
printError("未配置此跳转Id, JumpId: " .. jumpId)
return false
end
PanelManager.CloseAllDisposablePanel()
local nType = mapJumpTo.Type
EventManager.Hit(EventId.JumpToSuccess, nType)
@@ -37,10 +268,7 @@ function JumpUtil.JumpTo(jumpId, ...)
EventManager.Hit(EventId.OpenPanel, PanelId.LevelMenu)
elseif nType == GameEnum.jumpType.Shop then
local nTabIndex = mapJumpTo.Param[1]
local func = function()
EventManager.Hit(EventId.OpenPanel, PanelId.ShopPanel, nTabIndex)
end
EventManager.Hit(EventId.SetTransition, 5, func)
EventManager.Hit(EventId.OpenPanel, PanelId.ShopPanel, nTabIndex)
elseif nType == GameEnum.jumpType.Mall then
local nTabIndex1 = mapJumpTo.Param[1]
local nTabIndex2 = mapJumpTo.Param[2]
@@ -50,28 +278,17 @@ function JumpUtil.JumpTo(jumpId, ...)
EventManager.Hit(EventId.ClosePanel, PanelId.MallPopup)
EventManager.Hit("OpenMallTog", nTabIndex1)
else
do
local nState = ConfigTable.GetConfigNumber("IsShowComBtn")
if nState == 1 then
local func = function()
EventManager.Hit(EventId.OpenPanel, PanelId.Mall, nTabIndex1, nTabIndex2)
end
EventManager.Hit(EventId.SetTransition, 5, func)
else
local sContent = ConfigTable.GetUIText("Function_NotAvailable")
EventManager.Hit(EventId.OpenMessageBox, sContent)
end
local nState = ConfigTable.GetConfigNumber("IsShowComBtn")
if nState == 1 then
EventManager.Hit(EventId.OpenPanel, PanelId.Mall, nTabIndex1, nTabIndex2)
else
local sContent = ConfigTable.GetUIText("Function_NotAvailable")
EventManager.Hit(EventId.OpenMessageBox, sContent)
end
end
elseif nType == GameEnum.jumpType.Gacha then
local nPoolId = mapJumpTo.Param[1]
local getInfoCallback = function()
local func = function()
EventManager.Hit(EventId.OpenPanel, PanelId.GachaSpin, nPoolId)
end
EventManager.Hit(EventId.SetTransition, 6, func, AllEnum.MainViewCorner.Recruit)
end
PlayerData.Gacha:GetGachaInfomation(getInfoCallback)
EventManager.Hit(EventId.OpenPanel, PanelId.GachaSpin, nPoolId)
elseif nType == GameEnum.jumpType.DailyInstanceLevel then
local nHard = mapJumpTo.Param[1]
local nDailyType = mapJumpTo.Param[2]
@@ -164,10 +381,7 @@ function JumpUtil.JumpTo(jumpId, ...)
EventManager.Hit(EventId.OpenPanel, PanelId.StoryChapter)
elseif nType == GameEnum.jumpType.InfinityTower then
CS.WwiseAudioManager.Instance:PlaySound("ui_level_select")
local func = function()
EventManager.Hit(EventId.OpenPanel, PanelId.InfinityTowerSelectTower)
end
EventManager.Hit(EventId.SetTransition, 8, func)
EventManager.Hit(EventId.OpenPanel, PanelId.InfinityTowerSelectTower)
elseif nType == GameEnum.jumpType.InfinityTowerGroup then
local nStarTowerId = mapJumpTo.Param[1]
EventManager.Hit(EventId.OpenPanel, PanelId.InfinityTowerSelectTower, nStarTowerId)
@@ -177,35 +391,9 @@ function JumpUtil.JumpTo(jumpId, ...)
CS.WwiseAudioManager.Instance:PlaySound("ui_level_select")
elseif nType == GameEnum.jumpType.Phone then
local nTog = mapJumpTo.Param[1]
local openCallback = function()
PlayerData.Phone:OpenPhonePanel(nil, nTog)
end
PlayerData.Base:CheckFunctionBtn(GameEnum.OpenFuncType.Phone, openCallback)
PlayerData.Phone:OpenPhonePanel(nil, nTog)
elseif nType == GameEnum.jumpType.Vampire then
local stateCallback = function(bReEnter)
if not bReEnter then
local function success(bSuccess)
EventManager.Remove("GetTalentDataVampire", JumpUtil, success)
if bSuccess then
local OpenTransCallback = function()
EventManager.Hit(EventId.OpenPanel, PanelId.VampireSurvivorLevelSelectPanel)
end
EventManager.Hit(EventId.SetTransition, 13, OpenTransCallback)
else
EventManager.Hit(EventId.SetTransition)
end
end
EventManager.Add("GetTalentDataVampire", JumpUtil, success)
local ret, _, _ = PlayerData.VampireSurvivor:GetTalentData()
if ret ~= nil then
success(true)
end
end
end
local callbackCheck = function()
PlayerData.State:CheckVampireState(stateCallback)
end
PlayerData.Base:CheckFunctionBtn(GameEnum.OpenFuncType.VampireSurvivor, callbackCheck, "ui_systerm_locked")
EventManager.Hit(EventId.OpenPanel, PanelId.VampireSurvivorLevelSelectPanel)
elseif nType == GameEnum.jumpType.ComCYO then
EventManager.Hit(EventId.OpenPanel, PanelId.Consumable, select(1, ...), select(2, ...), select(3, ...))
elseif nType == GameEnum.jumpType.Quest then
@@ -217,25 +405,13 @@ function JumpUtil.JumpTo(jumpId, ...)
local nGroup = mapJumpTo.Param[1]
EventManager.Hit(EventId.OpenPanel, PanelId.SkillInstanceLevelSelect, 0, nGroup, true)
elseif nType == GameEnum.jumpType.ScoreBoss then
local openSC = function()
EventManager.Hit(EventId.OpenPanel, PanelId.ScoreBossSelectPanel)
end
if not PlayerData.ScoreBoss:GetInitInfoState() then
PlayerData.ScoreBoss:GetScoreBossInstanceData(openSC)
else
openSC()
end
EventManager.Hit(EventId.OpenPanel, PanelId.ScoreBossSelectPanel)
elseif nType == GameEnum.jumpType.WeeklyCopies then
EventManager.Hit(EventId.OpenPanel, PanelId.WeeklyCopiesPanel, mapJumpTo.Param[1])
elseif nType == GameEnum.jumpType.StorySet then
PlayerData.StorySet:TryOpenStorySetPanel(function()
EventManager.Hit(EventId.OpenPanel, PanelId.StorySet, true)
end)
EventManager.Hit(EventId.OpenPanel, PanelId.StorySet, true)
elseif nType == GameEnum.jumpType.StarTowerGrowth then
local callback = function()
EventManager.Hit(EventId.OpenPanel, PanelId.StarTowerGrowth)
end
PlayerData.StarTower:SendTowerGrowthDetailReq(callback)
EventManager.Hit(EventId.OpenPanel, PanelId.StarTowerGrowth)
elseif nType == GameEnum.jumpType.ActivityTask then
local nActId = mapJumpTo.Param[1]
local panelId = mapJumpTo.Param[2]
@@ -247,12 +423,7 @@ function JumpUtil.JumpTo(jumpId, ...)
end
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, taskActId, tabId)
return
end
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
EventManager.Hit(EventId.OpenPanel, panelId, taskActId, tabId)
end
elseif nType == GameEnum.jumpType.MainLineStoryChapter then
local chapterIndex = mapJumpTo.Param[1]
@@ -282,6 +453,12 @@ function JumpUtil.JumpTo(jumpId, ...)
}
local nCharInfoPanelId = tbCharInfoPanelId[nModuleType] or PanelId.CharInfo
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgPanel, nCharInfoPanelId, nCharId, {nCharId})
elseif nType == GameEnum.jumpType.TraceHunt then
EventManager.Hit(EventId.OpenPanel, PanelId.TraceHunt)
elseif nType == GameEnum.jumpType.Soldier then
EventManager.Hit(EventId.OpenPanel, PanelId.SoldierMainViewPanel)
elseif nType == GameEnum.jumpType.Dorm then
EventManager.Hit(EventId.OpenPanel, PanelId.DormPanel)
end
end
function JumpUtil.CheckJumpUnLock(jumpId, showTips)
@@ -325,6 +502,9 @@ function JumpUtil.CheckJumpUnLock(jumpId, showTips)
local nProductionId = mapJumpTo.Param[1]
bOpen = PlayerData.Crafting:CheckProductionUnlock(nProductionId)
sLockTip = ConfigTable.GetUIText("Crafting_Lock_Tip")
elseif nType == GameEnum.jumpType.Shop then
local nShopId = mapJumpTo.Param[1]
bOpen, sLockTip = PlayerData.Shop:CheckShopJumpAble(nShopId)
elseif nType == GameEnum.jumpType.StarTower then
local nStarTowerId = mapJumpTo.Param[1]
bOpen = PlayerData.StarTower:IsStarTowerUnlock(nStarTowerId)
@@ -398,17 +578,14 @@ function JumpUtil.CheckJumpUnLock(jumpId, showTips)
bOpen = true
end
elseif nType == GameEnum.jumpType.TraceHunt then
local callback = function()
if PlayerData.TraceHunt:GetControlLeftTime() <= 0 then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("TraceHunt_Tips_ControlInterrupt"))
return
end
local func = function()
EventManager.Hit(EventId.OpenPanel, PanelId.TraceHunt)
end
EventManager.Hit(EventId.SetTransition, 49, func)
end
PlayerData.TraceHunt:SendTraceHuntInfoReq(callback)
bFuncUnlock = PlayerData.Base:CheckFunctionUnlock(GameEnum.OpenFuncType.TraceHunt, true)
showTips = false
elseif nType == GameEnum.jumpType.Soldier then
bFuncUnlock = PlayerData.Base:CheckFunctionUnlock(GameEnum.OpenFuncType.Soldier, true)
showTips = false
elseif nType == GameEnum.jumpType.Dorm then
bFuncUnlock = PlayerData.Base:CheckFunctionUnlock(GameEnum.OpenFuncType.Dorm, true)
showTips = false
end
bOpen = bFuncUnlock and bOpen
if not bOpen and showTips then
@@ -448,13 +625,17 @@ end
function JumpUtil.JumpToActivity(tbJumpData)
if tbJumpData[1] == GameEnum.jumpType.MainLineStoryChapter then
local chapterIndex = tbJumpData[2]
local panelId = PanelId.MainlineEx
if chapterIndex == 11 then
panelId = PanelId.DustDawnStory
end
local isUnlock = PlayerData.Avg:IsStoryChapterUnlock(chapterIndex)
if isUnlock then
EventManager.Hit(EventId.OpenPanel, PanelId.MainlineEx, chapterIndex)
EventManager.Hit(EventId.OpenPanel, panelId, chapterIndex)
else
local sLockReadTipsKey = "Mainline_Preview_Lock_Read_" .. chapterIndex
if LocalData.GetPlayerLocalData(sLockReadTipsKey) then
EventManager.Hit(EventId.OpenPanel, PanelId.MainlineEx, chapterIndex)
EventManager.Hit(EventId.OpenPanel, panelId, chapterIndex)
return
end
local sTip = ConfigTable.GetUIText("Mainline_Preview_Lock_Read")
@@ -463,7 +644,7 @@ function JumpUtil.JumpToActivity(tbJumpData)
sContent = sTip,
callbackConfirm = function()
LocalData.SetPlayerLocalData(sLockReadTipsKey, true)
EventManager.Hit(EventId.OpenPanel, PanelId.MainlineEx, chapterIndex)
EventManager.Hit(EventId.OpenPanel, panelId, chapterIndex)
end
}
EventManager.Hit(EventId.OpenMessageBox, msg)
@@ -0,0 +1,99 @@
local AnniversaryActCtrl = class("AnniversaryActCtrl", BaseCtrl)
local ClientManager = CS.ClientManager.Instance
AnniversaryActCtrl._mapNodeConfig = {
btnJump = {
nCount = 4,
sComponentName = "UIButton",
callback = "OnBtnClick_Jump"
},
btnName = {
nCount = 2,
sComponentName = "UIButton",
callback = "OnBtnClick_Name"
},
txtBtnSkin = {nCount = 2, sComponentName = "TMP_Text"},
txtBtnChar = {nCount = 2, sComponentName = "TMP_Text"},
txtBtnJump1 = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Advertise_Skin_201018"
},
txtBtnJump2 = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Advertise_Package_201018"
},
txtBtnJump3 = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Advertise_Bonus_201018"
},
txtBtnJump4 = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Advertise_ChargeReset_201018"
},
txtDiscount = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Advertise_PackageDiscount_201018"
},
reddotMall = {}
}
AnniversaryActCtrl._mapRedDotConfig = {
[RedDotDefine.Mall_Page] = {
sNodeName = "reddotMall",
param = {
AllEnum.MallToggle.Activity
}
}
}
function AnniversaryActCtrl:InitActData(actData)
self.actData = actData
self.nActId = actData:GetActId()
self.AdConfig = ConfigTable.GetData("AdControl", self.nActId)
self:RefreshAct()
end
local tbCharId = {110, 155}
local tbSkinId = {11003, 15503}
function AnniversaryActCtrl:RefreshAct()
local tbTxtSkin = self._mapNode.txtBtnSkin
local tbTxtChar = self._mapNode.txtBtnChar
for i = 1, #tbSkinId do
local mapSkinCfg = ConfigTable.GetData_CharacterSkin(tbSkinId[i])
if mapSkinCfg == nil then
printError(string.format("CharacterSkin表里找不到皮肤id:%d", tbSkinId[i]))
end
NovaAPI.SetTMPText(tbTxtSkin[i], mapSkinCfg ~= nil and mapSkinCfg.Name or "")
local mapCharCfg = ConfigTable.GetData_Character(tbCharId[i])
if mapCharCfg == nil then
printError(string.format("Character表里找不到角色id:%d", tbCharId[i]))
end
NovaAPI.SetTMPText(tbTxtChar[i], mapCharCfg ~= nil and mapCharCfg.Name or "")
end
end
function AnniversaryActCtrl:OnBtnClick_Name(btn, nIndex)
local callback = function()
EventManager.Hit(EventId.OpenPanel, PanelId.Mall, AllEnum.MallToggle.Skin)
end
EventManager.Hit(EventId.SetTransition, 5, callback)
end
function AnniversaryActCtrl:OnBtnClick_Jump(btn, nIndex)
local nEndTime = self.actData:GetActEndTime()
local nCurTime = ClientManager.serverTimeStamp
if nEndTime < nCurTime then
return
end
local bPlayCond = self.actData:CheckActJumpCond(true)
if not bPlayCond then
return
end
local callback = function()
if nIndex == 1 then
EventManager.Hit(EventId.OpenPanel, PanelId.Mall, AllEnum.MallToggle.Skin)
elseif nIndex == 2 then
EventManager.Hit(EventId.OpenPanel, PanelId.Mall, AllEnum.MallToggle.Package)
elseif nIndex == 3 then
EventManager.Hit(EventId.OpenPanel, PanelId.Mall, AllEnum.MallToggle.Activity)
elseif nIndex == 4 then
EventManager.Hit(EventId.OpenPanel, PanelId.Mall, AllEnum.MallToggle.Gem)
end
end
EventManager.Hit(EventId.SetTransition, 5, callback)
end
return AnniversaryActCtrl
@@ -1,5 +1,5 @@
local TimerManager = require("GameCore.Timer.TimerManager")
NewTutorialsActCtrl = class("NewTutorialsActCtrl", BaseCtrl)
local NewTutorialsActCtrl = class("NewTutorialsActCtrl", BaseCtrl)
NewTutorialsActCtrl._mapNodeConfig = {
goBaseGuide = {},
goAdvanceGuide = {},
@@ -263,7 +263,7 @@ function NewTutorialsActCtrl:RefreshGuideQuset()
self._mapNode.btn_GoGuideQusetPanel.gameObject:SetActive(bPlayCond)
self._mapNode.txt_Locked1.gameObject:SetActive(not bPlayCond)
local mapLockCfgData = ConfigTable.GetData("OpenFunc", GameEnum.OpenFuncType.Quest) or {}
sLockTip = UTILS.ParseParamDesc(mapLockCfgData.Tips, mapLockCfgData)
local sLockTip = UTILS.ParseParamDesc(mapLockCfgData.Tips, mapLockCfgData)
NovaAPI.SetTMPText(self._mapNode.txt_Locked1, sLockTip)
if not bPlayCond then
return
@@ -290,7 +290,7 @@ function NewTutorialsActCtrl:RefreshTutorial()
self._mapNode.btn_GoTutorialPanel.gameObject:SetActive(bPlayCond)
self._mapNode.txt_Locked2.gameObject:SetActive(not bPlayCond)
local mapLockCfgData = ConfigTable.GetData("OpenFunc", GameEnum.OpenFuncType.TutorialLevel) or {}
sLockTip = UTILS.ParseParamDesc(mapLockCfgData.Tips, mapLockCfgData)
local sLockTip = UTILS.ParseParamDesc(mapLockCfgData.Tips, mapLockCfgData)
NovaAPI.SetTMPText(self._mapNode.txt_Locked2, sLockTip)
if not bPlayCond then
return
@@ -315,7 +315,7 @@ function NewTutorialsActCtrl:RefreshTeamFormation()
self._mapNode.btn_GoTeamFormationPanel.gameObject:SetActive(bPlayCond)
self._mapNode.txt_Locked3.gameObject:SetActive(not bPlayCond)
local mapLockCfgData = ConfigTable.GetData("OpenFunc", GameEnum.OpenFuncType.QuestNewbie) or {}
sLockTip = UTILS.ParseParamDesc(mapLockCfgData.Tips, mapLockCfgData)
local sLockTip = UTILS.ParseParamDesc(mapLockCfgData.Tips, mapLockCfgData)
NovaAPI.SetTMPText(self._mapNode.txt_Locked3, sLockTip)
if not bPlayCond then
return
@@ -347,7 +347,7 @@ function NewTutorialsActCtrl:RefreshWeekBoss()
self._mapNode.btn_GoWeekBossPanel.gameObject:SetActive(bPlayCond)
self._mapNode.goCountDown3.gameObject:SetActive(bPlayCond)
local mapLockCfgData = ConfigTable.GetData("OpenFunc", GameEnum.OpenFuncType.WeeklyCopies) or {}
sLockTip = UTILS.ParseParamDesc(mapLockCfgData.Tips, mapLockCfgData)
local sLockTip = UTILS.ParseParamDesc(mapLockCfgData.Tips, mapLockCfgData)
self._mapNode.txt_AdvanceLocked3.gameObject:SetActive(not bPlayCond)
NovaAPI.SetTMPText(self._mapNode.txt_AdvanceLocked3, sLockTip)
if not bPlayCond then
@@ -370,7 +370,7 @@ function NewTutorialsActCtrl:RefreshVampireSurvivor()
self._mapNode.goCountDown1.gameObject:SetActive(bPlayCond)
self._mapNode.goProgress1.gameObject:SetActive(bPlayCond)
local mapLockCfgData = ConfigTable.GetData("OpenFunc", GameEnum.OpenFuncType.VampireSurvivor) or {}
sLockTip = UTILS.ParseParamDesc(mapLockCfgData.Tips, mapLockCfgData)
local sLockTip = UTILS.ParseParamDesc(mapLockCfgData.Tips, mapLockCfgData)
self._mapNode.txt_AdvanceLocked1.gameObject:SetActive(not bPlayCond)
NovaAPI.SetTMPText(self._mapNode.txt_AdvanceLocked1, sLockTip)
if not bPlayCond then
@@ -420,7 +420,7 @@ function NewTutorialsActCtrl:RefreshScoreBoss()
self._mapNode.goProgress2.gameObject:SetActive(bPlayCond)
self._mapNode.txt_AdvanceLocked2.gameObject:SetActive(not bPlayCond)
local mapLockCfgData = ConfigTable.GetData("OpenFunc", GameEnum.OpenFuncType.ScoreBoss) or {}
sLockTip = UTILS.ParseParamDesc(mapLockCfgData.Tips, mapLockCfgData)
local sLockTip = UTILS.ParseParamDesc(mapLockCfgData.Tips, mapLockCfgData)
NovaAPI.SetTMPText(self._mapNode.txt_AdvanceLocked2, sLockTip)
if not bPlayCond then
return
@@ -0,0 +1,159 @@
local LoginRewardPopUpCtrl_01 = class("LoginRewardPopUpCtrl_01", BaseCtrl)
local ClientManager = CS.ClientManager.Instance
LoginRewardPopUpCtrl_01._mapNodeConfig = {
imgActivity = {sComponentName = "Image"},
goActTime = {},
txtActivityTime = {sComponentName = "TMP_Text"},
btnActivity = {
sComponentName = "Button",
callback = "OnBtnClick_Activity"
},
txtTips = {
sComponentName = "TMP_Text",
sLanguageId = "LoginReward_PopUp_Tip"
},
goRewardItem = {
nCount = 7,
sCtrlName = "Game.UI.Activity.LoginReward.LoginSpRewardItemCtrl"
},
imgActor = {nCount = 2, sComponentName = "Image"},
trActor2D_PNG = {
sNodeName = "----Actor2D_PNG----",
sComponentName = "Transform"
}
}
LoginRewardPopUpCtrl_01._mapEventConfig = {}
LoginRewardPopUpCtrl_01._mapRedDotConfig = {}
function LoginRewardPopUpCtrl_01:RefreshRemainTime()
local endTime = self.actData:GetActEndTime()
local curTime = ClientManager.serverTimeStamp
local remainTime = endTime - curTime
if remainTime < 0 then
self._mapNode.goActTime.gameObject:SetActive(false)
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.txtActivityTime, sTimeStr)
end
function LoginRewardPopUpCtrl_01:RefreshActData()
self.nActId = self._panel.nActId
self.actData = self._panel.actData
self.remainTimer = nil
self:RefreshRewardList()
self:RefreshNPC2D()
local actCfg = self.actData:GetActCfgData()
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
self._mapNode.goActTime.gameObject:SetActive(false)
else
self._mapNode.goActTime.gameObject:SetActive(true)
self:RefreshRemainTime()
end
end
function LoginRewardPopUpCtrl_01:RefreshRewardList()
local tbRewardList = self.actData:GetActLoginRewardList()
if nil ~= tbRewardList then
local nReceiveDay = self.actData:GetCanReceive()
self.nActual = self.actData:GetReceived()
for k, v in ipairs(self._mapNode.goRewardItem) do
local mapReward = tbRewardList[k]
v.gameObject:SetActive(mapReward ~= nil)
if mapReward ~= nil then
v:SetRewardItem(k, mapReward, true, nReceiveDay == self.nActual and k == self.nActual + 1, true)
end
end
end
end
function LoginRewardPopUpCtrl_01:RefreshNPC2D()
local tbRewardList = self.actData:GetActLoginRewardList()
local nReceive = self.actData:GetCanReceive()
local nNpcId = tbRewardList[nReceive].NpcId
local sPath = "LoginNpc_" .. nNpcId
self._mapNode.imgActor[1].gameObject:SetActive(true)
self:SetActivityAtlasSprite(self._mapNode.imgActor[1], "_" .. self.nActId, sPath)
NovaAPI.SetImageNativeSize(self._mapNode.imgActor[1])
end
function LoginRewardPopUpCtrl_01:PlayOutAnim()
local nAnimLength = 0
if self.animRoot ~= nil then
nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {
"LoginReward_01_out"
})
self.animRoot:Play("LoginReward_01_out")
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
end
return nAnimLength
end
function LoginRewardPopUpCtrl_01:Awake()
self.animRoot = self.gameObject:GetComponent("Animator")
end
function LoginRewardPopUpCtrl_01:OnEnable()
if self.animRoot ~= nil then
local nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {
"LoginReward_01_in"
})
self.animRoot:Play("LoginReward_01_in")
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
end
end
function LoginRewardPopUpCtrl_01:OnDisable()
end
function LoginRewardPopUpCtrl_01:OnDestroy()
end
function LoginRewardPopUpCtrl_01:OnBtnClick_Activity()
local bOpen = self.actData:CheckActivityOpen()
if not bOpen then
local callback = function()
EventManager.Hit("RefreshLoginRewardPanel")
end
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Alert,
sContent = ConfigTable.GetUIText("Activity_PopUp_Time_Out"),
callbackConfirm = callback
})
return
end
local canReceive = self.actData:CheckCanReceive()
if not canReceive then
EventManager.Hit("RefreshLoginRewardPanel")
return
end
local tbRewardList = self.actData:GetActLoginRewardList()
local nReceive = self.actData:GetCanReceive()
local mapNpc = {
nNpcId = tbRewardList[nReceive].NpcId,
nVoiceId = tbRewardList[nReceive].VoiceId
}
local callback = function()
EventManager.Hit("RefreshLoginRewardPanel")
end
PlayerData.Activity:SendReceiveLoginRewardMsg(self.nActId, callback, mapNpc)
end
return LoginRewardPopUpCtrl_01
@@ -0,0 +1,28 @@
local LoginSpRewardCtrl_01 = class("LoginSpRewardCtrl_01", BaseCtrl)
LoginSpRewardCtrl_01._mapNodeConfig = {
goCommon = {
sNodeName = "---Common---"
}
}
LoginSpRewardCtrl_01._mapEventConfig = {}
function LoginSpRewardCtrl_01:UnbindCtrl()
if self.activityCtrl ~= nil then
self:UnbindCtrlByNode(self.activityCtrl)
self.activityCtrl = nil
end
end
function LoginSpRewardCtrl_01:InitActData(actData)
if self.activityCtrl == nil then
self.activityCtrl = self:BindCtrlByNode(self._mapNode.goCommon, "Game.UI.Activity.LoginReward.LoginSpRewardCtrl_List")
end
self.actData = actData
self.nActId = actData:GetActId()
self.activityCtrl:InitActData(actData)
end
function LoginSpRewardCtrl_01:ClearActivity()
self:UnbindCtrl()
end
function LoginSpRewardCtrl_01:OnDisable()
self:UnbindCtrl()
end
return LoginSpRewardCtrl_01
@@ -0,0 +1,200 @@
local LoginRewardCtrl_01 = class("LoginRewardCtrl_01", BaseCtrl)
local TimerManager = require("GameCore.Timer.TimerManager")
local ClientManager = CS.ClientManager.Instance
LoginRewardCtrl_01._mapNodeConfig = {
btnDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_Detail"
},
txtDetail = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Btn_Detail"
},
goActTime = {},
txtActivityTime = {sComponentName = "TMP_Text"},
sv = {
sComponentName = "LoopScrollView"
},
btnActivity = {
sComponentName = "Button",
callback = "OnBtnClick_Activity"
}
}
LoginRewardCtrl_01._mapEventConfig = {}
function LoginRewardCtrl_01:UnbindCtrl()
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
end
self.tbGridCtrl = {}
end
function LoginRewardCtrl_01:RefreshRemainTime()
local endTime = self.actData:GetActEndTime()
local curTime = ClientManager.serverTimeStamp
local remainTime = endTime - curTime
if remainTime < 0 then
TimerManager.Remove(self.remainTimer)
self.remainTimer = nil
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Alert,
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
callbackConfirm = function()
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
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.txtActivityTime, sTimeStr)
end
function LoginRewardCtrl_01:RefreshRewardList()
local tbRewardList = self.actData:GetActLoginRewardList()
if nil ~= tbRewardList then
local nMaxDay = #tbRewardList
self.nReceiveDay = self.actData:GetCanReceive()
self.nActual = self.actData:GetReceived()
local canReceive = self.actData:CheckCanReceive()
local nSelectIndex = 0
if canReceive then
nSelectIndex = self.actData:GetCanReceive()
else
nSelectIndex = self.nActual
end
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
end
self._mapNode.sv:SetAnim(0.06)
self._mapNode.sv:Init(nMaxDay, self, self.OnGridRefresh, self.OnGridBtnClick)
self._mapNode.sv:SetScrollGridPos(nSelectIndex - 2, 0)
end
end
function LoginRewardCtrl_01:OnGridRefresh(goGrid, gridIndex)
local nIndex = gridIndex + 1
local tbRewardList = self.actData:GetActLoginRewardList()
local nMaxDay = #tbRewardList
local mapReward = tbRewardList[nIndex]
local nInstanceID = goGrid:GetInstanceID()
if not self.tbGridCtrl[nInstanceID] then
self.tbGridCtrl[nInstanceID] = self:BindCtrlByNode(goGrid, "Game.UI.Activity.LoginReward.LoginRewardItemCtrl")
end
self.tbGridCtrl[nInstanceID]:SetRewardItem(nIndex, mapReward, nIndex == nMaxDay, self.nReceiveDay == self.nActual and nIndex == self.nActual + 1, "zs_activity_03_num_")
end
function LoginRewardCtrl_01:OnGridBtnClick(goGrid, gridIndex)
local nIndex = gridIndex + 1
local tbRewardList = self.actData:GetActLoginRewardList()
local mapReward = tbRewardList[nIndex]
local tbShowReward = {}
if mapReward ~= nil then
for i = 1, 3 do
local nTid = mapReward["RewardId" .. i]
local nCount = mapReward["Qty" .. i]
if nTid ~= 0 then
table.insert(tbShowReward, {nTid = nTid, nCount = nCount})
end
end
end
self._mapNode.sv:SetScrollGridPos(nIndex - 1, 0.1, 1)
EventManager.Hit(EventId.BlockInput, true)
self:AddTimer(1, 0.1, function()
EventManager.Hit(EventId.BlockInput, false)
local btn = goGrid.transform:Find("btnGrid/AnimRoot/goRewardItem/btnItem")
if #tbShowReward == 1 then
local nTid = tbShowReward[1].nTid
UTILS.ClickItemGridWithTips(nTid, btn.gameObject.transform, true, true, false)
else
local tbReward = {}
for _, v in ipairs(tbShowReward) do
local rewardData = {
[1] = v.nTid,
[5] = v.nCount
}
table.insert(tbReward, rewardData)
end
EventManager.Hit("ShowActRewardList", tbReward)
end
end, true, true, true)
end
function LoginRewardCtrl_01:RefreshDetail()
local mapActCfg = self.actData:GetLoginRewardControlCfg()
local bEmpty = mapActCfg.DesText == ""
self._mapNode.btnDetail.gameObject:SetActive(not bEmpty)
end
function LoginRewardCtrl_01:InitActData(actData)
self.actData = actData
self.nActId = actData:GetActId()
self:RefreshRewardList()
self:RefreshDetail()
local canReceive = self.actData:CheckCanReceive()
self._mapNode.btnActivity.gameObject:SetActive(canReceive)
local actCfg = self.actData:GetActCfgData()
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
self._mapNode.goActTime.gameObject:SetActive(false)
else
self._mapNode.goActTime.gameObject:SetActive(true)
self:RefreshRemainTime()
if nil == self.remainTimer then
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
end
end
end
function LoginRewardCtrl_01:ClearActivity()
self:UnbindCtrl()
end
function LoginRewardCtrl_01:Awake()
self.tbGridCtrl = {}
end
function LoginRewardCtrl_01:OnDisable()
self:UnbindCtrl()
end
function LoginRewardCtrl_01:OnBtnClick_Detail()
local mapActCfg = self.actData:GetLoginRewardControlCfg()
local msg = {
nType = AllEnum.MessageBox.Desc,
sContent = mapActCfg.DesText,
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
}
EventManager.Hit(EventId.OpenMessageBox, msg)
end
function LoginRewardCtrl_01:OnBtnClick_Activity()
local callback = function()
self._mapNode.btnActivity.gameObject:SetActive(false)
local actData = PlayerData.Activity:GetActivityDataById(self.actData:GetActId())
self:InitActData(actData)
end
local canReceive = self.actData:CheckCanReceive()
if not canReceive then
callback()
return
end
PlayerData.Activity:SendReceiveLoginRewardMsg(self.actData:GetActId(), callback)
end
return LoginRewardCtrl_01
@@ -0,0 +1,157 @@
local LoginRewardPopUpCtrl_01 = class("LoginRewardPopUpCtrl_01", BaseCtrl)
local ClientManager = CS.ClientManager.Instance
local TimerManager = require("GameCore.Timer.TimerManager")
LoginRewardPopUpCtrl_01._mapNodeConfig = {
sv = {
sNodeName = "goRewardList",
sComponentName = "LoopScrollView"
},
goActTime = {},
txtActivityTime = {sComponentName = "TMP_Text"},
btnActivity = {
sComponentName = "Button",
callback = "OnBtnClick_Activity"
},
txtTips = {
sComponentName = "TMP_Text",
sLanguageId = "LoginReward_PopUp_Tip"
}
}
LoginRewardPopUpCtrl_01._mapEventConfig = {}
LoginRewardPopUpCtrl_01._mapRedDotConfig = {}
function LoginRewardPopUpCtrl_01:RefreshRemainTime()
local endTime = self.actData:GetActEndTime()
local curTime = ClientManager.serverTimeStamp
local remainTime = endTime - curTime
if remainTime < 0 then
self._mapNode.goActTime.gameObject:SetActive(false)
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.txtActivityTime, sTimeStr)
end
function LoginRewardPopUpCtrl_01:RefreshActData()
self.nActId = self._panel.nActId
self.actData = self._panel.actData
self.remainTimer = nil
self:RefreshRewardList()
local actCfg = self.actData:GetActCfgData()
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
self._mapNode.goActTime.gameObject:SetActive(false)
else
self._mapNode.goActTime.gameObject:SetActive(true)
self:RefreshRemainTime()
end
end
function LoginRewardPopUpCtrl_01:RefreshRewardList()
local tbRewardList = self.actData:GetActLoginRewardList()
if nil ~= tbRewardList then
local nMaxDay = #tbRewardList
local nActual = self.actData:GetReceived()
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
end
self._mapNode.sv:SetAnim(0.06)
self._mapNode.sv:Init(nMaxDay, self, self.OnGridRefresh)
self:AddTimer(1, 0.5, function()
self._mapNode.sv:SetScrollGridPos(nActual - 1, 0.5)
end, true, true, true)
end
end
function LoginRewardPopUpCtrl_01:OnGridRefresh(goGrid, gridIndex)
local nIndex = gridIndex + 1
local tbRewardList = self.actData:GetActLoginRewardList()
local nMaxDay = #tbRewardList
local mapReward = tbRewardList[nIndex]
local nInstanceID = goGrid:GetInstanceID()
if not self.tbGridCtrl[nInstanceID] then
self.tbGridCtrl[nInstanceID] = self:BindCtrlByNode(goGrid, "Game.UI.Activity.LoginReward.LoginRewardItemCtrl")
end
self.tbGridCtrl[nInstanceID]:SetRewardItem(nIndex, mapReward, nIndex == nMaxDay, nil, "zs_activity_03_num_")
end
function LoginRewardPopUpCtrl_01:PlayOutAnim()
local nAnimLength = 0
if self.animRoot ~= nil then
nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {
"LoginReward_01_out"
})
self.animRoot:Play("LoginReward_01_out")
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
end
return nAnimLength
end
function LoginRewardPopUpCtrl_01:Awake()
self.animRoot = self.gameObject:GetComponent("Animator")
self.tbGridCtrl = {}
end
function LoginRewardPopUpCtrl_01:OnEnable()
if self.animRoot ~= nil then
local nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {
"LoginReward_01_in"
})
self.animRoot:Play("LoginReward_01_in")
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
end
end
function LoginRewardPopUpCtrl_01:OnDisable()
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
end
self.tbGridCtrl = {}
end
function LoginRewardPopUpCtrl_01:OnDestroy()
end
function LoginRewardPopUpCtrl_01:OnBtnClick_Activity()
local bOpen = self.actData:CheckActivityOpen()
if not bOpen then
local callback = function()
EventManager.Hit("RefreshLoginRewardPanel")
end
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Alert,
sContent = ConfigTable.GetUIText("Activity_PopUp_Time_Out"),
callbackConfirm = callback
})
return
end
local canReceive = self.actData:CheckCanReceive()
if not canReceive then
EventManager.Hit("RefreshLoginRewardPanel")
return
end
local callback = function()
EventManager.Hit("RefreshLoginRewardPanel")
end
PlayerData.Activity:SendReceiveLoginRewardMsg(self.nActId, callback)
end
return LoginRewardPopUpCtrl_01
@@ -19,8 +19,6 @@ LoginRewardPopUpCtrl_01._mapNodeConfig = {
sLanguageId = "Quest_Receive"
}
}
LoginRewardPopUpCtrl_01._mapEventConfig = {}
LoginRewardPopUpCtrl_01._mapRedDotConfig = {}
function LoginRewardPopUpCtrl_01:RefreshRemainTime()
local endTime = self.actData:GetActEndTime()
local curTime = ClientManager.serverTimeStamp
@@ -63,7 +61,6 @@ end
function LoginRewardPopUpCtrl_01:RefreshActData()
self.nActId = self._panel.nActId
self.actData = self._panel.actData
self.remainTimer = nil
local actCfg = self.actData:GetActCfgData()
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
self._mapNode.goActTime.gameObject:SetActive(false)
@@ -120,8 +117,10 @@ function LoginRewardPopUpCtrl_01:OnBtnClick_Activity()
return
end
local callback = function()
EventManager.Hit("RefreshLoginRewardPanel")
PlayerData.CharSkin:TryOpenSkinShowPanel(function()
EventManager.Hit("RefreshLoginRewardPanel")
end)
end
PlayerData.Activity:SendReceiveLoginRewardMsg(301042, callback)
PlayerData.Activity:SendReceiveLoginRewardMsg(self.nActId, callback)
end
return LoginRewardPopUpCtrl_01
@@ -1,5 +1,6 @@
local LoginSkinRewardCtrl_01 = class("LoginSkinRewardCtrl_01", BaseCtrl)
local ClientManager = CS.ClientManager.Instance
local TimerManager = require("GameCore.Timer.TimerManager")
LoginSkinRewardCtrl_01._mapNodeConfig = {
btnDetail = {
sNodeName = "btnActDetail",
@@ -36,17 +37,14 @@ LoginSkinRewardCtrl_01._mapNodeConfig = {
LoginSkinRewardCtrl_01._mapEventConfig = {
ClickLoginRewardTips = "OnEvent_ClickLoginRewardTips"
}
function LoginSkinRewardCtrl_01:UnbindCtrl()
end
function LoginSkinRewardCtrl_01:InitActData(actData)
self.actData = actData
self.nActId = actData:GetActId()
self.nNpcId = nil
self.bPlayVoice = false
self:RefreshDetail()
local canReceive = self.actData:CheckCanReceive()
self._mapNode.btnReward.gameObject:SetActive(canReceive)
self._mapNode.btnUnReward.gameObject:SetActive(not canReceive)
self._mapNode.imgEnd.gameObject:SetActive(false)
local actCfg = self.actData:GetActCfgData()
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
self._mapNode.goActTime.gameObject:SetActive(false)
@@ -62,11 +60,17 @@ function LoginSkinRewardCtrl_01:RefreshRemainTime()
local endTime = self.actData:GetActEndTime()
local curTime = ClientManager.serverTimeStamp
local remainTime = endTime - curTime
self._mapNode.goActTime:SetActive(0 < remainTime)
self._mapNode.imgEnd:SetActive(remainTime <= 0)
self._mapNode.goActTime.gameObject:SetActive(0 < remainTime)
self._mapNode.imgEnd.gameObject:SetActive(remainTime <= 0)
if remainTime < 0 then
TimerManager.Remove(self.remainTimer)
self.remainTimer = nil
if self.remainTimer then
TimerManager.Remove(self.remainTimer)
self.remainTimer = nil
end
if self._bEndPopped then
return
end
self._bEndPopped = true
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Alert,
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
@@ -114,8 +118,6 @@ function LoginSkinRewardCtrl_01:RefreshDetail()
local sTips = ConfigTable.GetUIText("LoginSkinRewardTips1_301053") .. "\n" .. ConfigTable.GetUIText("LoginSkinRewardTips2_301053")
NovaAPI.SetTMPText(self._mapNode.txtAdvanceMat, sTips)
end
function LoginSkinRewardCtrl_01:ClearActivity()
end
function LoginSkinRewardCtrl_01:OnBtnClick_Detail()
local mapActCfg = self.actData:GetLoginRewardControlCfg()
local msg = {
@@ -129,6 +131,7 @@ function LoginSkinRewardCtrl_01:OnBtnClick_Activity()
local callback = function()
self._mapNode.btnReward.gameObject:SetActive(false)
local actData = PlayerData.Activity:GetActivityDataById(self.actData:GetActId())
PlayerData.CharSkin:TryOpenSkinShowPanel()
self:InitActData(actData)
end
local canReceive = self.actData:CheckCanReceive()
@@ -136,6 +139,7 @@ function LoginSkinRewardCtrl_01:OnBtnClick_Activity()
return
end
PlayerData.Activity:SendReceiveLoginRewardMsg(self.actData:GetActId(), callback)
RedDotManager.SetValid(RedDotDefine.Activity_Tab, self.nActId, false)
end
function LoginSkinRewardCtrl_01:OnEvent_ClickLoginRewardTips(callback, index)
callback()
@@ -143,5 +147,9 @@ end
function LoginSkinRewardCtrl_01:OnBtnClick_Reward()
end
function LoginSkinRewardCtrl_01:OnDisable()
if self.remainTimer then
TimerManager.Remove(self.remainTimer)
self.remainTimer = nil
end
end
return LoginSkinRewardCtrl_01
@@ -127,6 +127,16 @@ function LoginSpRewardCtrl_List:RefreshRewardList()
end
end
end
function LoginSpRewardCtrl_List:StopVoice()
self.bPlayVoice = false
BubbleVoiceManager.StopBubbleAnim()
PlayerVoiceData:ClearTimer()
PlayerVoiceData:StopCharVoice()
if self.timer then
self.timer:Cancel()
self.timer = nil
end
end
function LoginSpRewardCtrl_List:RefreshNPC2D(bSwitch)
local tbRewardList = self.actData:GetActLoginRewardList()
local nNpcId = tbRewardList[self.nSelectIndex].NpcId
@@ -144,14 +154,7 @@ function LoginSpRewardCtrl_List:RefreshNPC2D(bSwitch)
self._mapNode.animActorL2D:Play("Actor2D_PNG_right_middle_in", 0, 0)
end
if bSwitch and self.bPlayVoice then
self.bPlayVoice = false
BubbleVoiceManager.StopBubbleAnim()
PlayerVoiceData:ClearTimer()
PlayerVoiceData:StopCharVoice()
if self.timer then
self.timer:Cancel()
self.timer = nil
end
self:StopVoice()
else
self:PlayVoice()
end
@@ -180,6 +183,7 @@ function LoginSpRewardCtrl_List:InitActData(actData)
self.actData = actData
self.nNpcId = nil
self.bPlayVoice = false
self.bChangeTabStop = true
self:RefreshRewardList()
self:RefreshNPC2D()
self:RefreshDetail()
@@ -202,9 +206,7 @@ function LoginSpRewardCtrl_List:OnEnable()
end
function LoginSpRewardCtrl_List:OnDisable()
Actor2DManager.UnsetBoardNPC2D()
BubbleVoiceManager.StopBubbleAnim()
PlayerVoiceData:ClearTimer()
PlayerVoiceData:StopCharVoice()
self:StopVoice()
end
function LoginSpRewardCtrl_List:OnDestroy()
end
@@ -280,9 +282,7 @@ function LoginSpRewardCtrl_List:OnEvent_ActivityListChangeTab(nId)
self.bChangeTabStop = true
elseif nId ~= self.actData:GetActId() and self.bChangeTabStop then
self.bChangeTabStop = false
BubbleVoiceManager.StopBubbleAnim()
PlayerVoiceData:ClearTimer()
PlayerVoiceData:StopCharVoice()
self:StopVoice()
end
end
function LoginSpRewardCtrl_List:OnEvent_ClosePanel(nPanelId)
@@ -127,6 +127,16 @@ function LoginSpRewardCtrl_List_01:RefreshRewardList()
end
end
end
function LoginSpRewardCtrl_List_01:StopVoice()
self.bPlayVoice = false
BubbleVoiceManager.StopBubbleAnim()
PlayerVoiceData:ClearTimer()
PlayerVoiceData:StopCharVoice()
if self.timer then
self.timer:Cancel()
self.timer = nil
end
end
function LoginSpRewardCtrl_List_01:RefreshNPC2D(bSwitch)
local tbRewardList = self.actData:GetActLoginRewardList()
local nNpcId = tbRewardList[self.nSelectIndex].NpcId
@@ -144,14 +154,7 @@ function LoginSpRewardCtrl_List_01:RefreshNPC2D(bSwitch)
self._mapNode.animActorL2D:Play("Actor2D_PNG_right_middle_in", 0, 0)
end
if bSwitch and self.bPlayVoice then
self.bPlayVoice = false
BubbleVoiceManager.StopBubbleAnim()
PlayerVoiceData:ClearTimer()
PlayerVoiceData:StopCharVoice()
if self.timer then
self.timer:Cancel()
self.timer = nil
end
self:StopVoice()
else
self:PlayVoice()
end
@@ -180,6 +183,7 @@ function LoginSpRewardCtrl_List_01:InitActData(actData)
self.actData = actData
self.nNpcId = nil
self.bPlayVoice = false
self.bChangeTabStop = true
self:RefreshRewardList()
self:RefreshNPC2D()
self:RefreshDetail()
@@ -202,9 +206,7 @@ function LoginSpRewardCtrl_List_01:OnEnable()
end
function LoginSpRewardCtrl_List_01:OnDisable()
Actor2DManager.UnsetBoardNPC2D()
BubbleVoiceManager.StopBubbleAnim()
PlayerVoiceData:ClearTimer()
PlayerVoiceData:StopCharVoice()
self:StopVoice()
end
function LoginSpRewardCtrl_List_01:OnDestroy()
end
@@ -280,9 +282,7 @@ function LoginSpRewardCtrl_List_01:OnEvent_ActivityListChangeTab(nId)
self.bChangeTabStop = true
elseif nId ~= self.actData:GetActId() and self.bChangeTabStop then
self.bChangeTabStop = false
BubbleVoiceManager.StopBubbleAnim()
PlayerVoiceData:ClearTimer()
PlayerVoiceData:StopCharVoice()
self:StopVoice()
end
end
function LoginSpRewardCtrl_List_01:OnEvent_ClosePanel(nPanelId)
@@ -153,6 +153,16 @@ function LoginSpRewardCtrl_Lsv:OnGridBtnClick(goGrid, gridIndex)
self.nSelectIndex = nIndex
self:RefreshNPC2D(true)
end
function LoginSpRewardCtrl_Lsv:StopVoice()
self.bPlayVoice = false
BubbleVoiceManager.StopBubbleAnim()
PlayerVoiceData:ClearTimer()
PlayerVoiceData:StopCharVoice()
if self.timer then
self.timer:Cancel()
self.timer = nil
end
end
function LoginSpRewardCtrl_Lsv:RefreshNPC2D(bSwitch)
local tbRewardList = self.actData:GetActLoginRewardList()
local nNpcId = tbRewardList[self.nSelectIndex].NpcId
@@ -170,14 +180,7 @@ function LoginSpRewardCtrl_Lsv:RefreshNPC2D(bSwitch)
self._mapNode.animActorL2D:Play("Actor2D_PNG_right_middle_in", 0, 0)
end
if bSwitch and self.bPlayVoice then
self.bPlayVoice = false
BubbleVoiceManager.StopBubbleAnim()
PlayerVoiceData:ClearTimer()
PlayerVoiceData:StopCharVoice()
if self.timer then
self.timer:Cancel()
self.timer = nil
end
self:StopVoice()
else
self:PlayVoice()
end
@@ -206,6 +209,7 @@ function LoginSpRewardCtrl_Lsv:InitActData(actData)
self.actData = actData
self.nNpcId = nil
self.bPlayVoice = false
self.bChangeTabStop = true
self:RefreshRewardList()
self:RefreshNPC2D()
self:RefreshDetail()
@@ -234,9 +238,7 @@ function LoginSpRewardCtrl_Lsv:OnDisable()
end
self.tbGridCtrl = {}
Actor2DManager.UnsetBoardNPC2D()
BubbleVoiceManager.StopBubbleAnim()
PlayerVoiceData:ClearTimer()
PlayerVoiceData:StopCharVoice()
self:StopVoice()
end
function LoginSpRewardCtrl_Lsv:OnDestroy()
end
@@ -302,9 +304,7 @@ function LoginSpRewardCtrl_Lsv:OnEvent_ActivityListChangeTab(nId)
self.bChangeTabStop = true
elseif nId ~= self.actData:GetActId() and self.bChangeTabStop then
self.bChangeTabStop = false
BubbleVoiceManager.StopBubbleAnim()
PlayerVoiceData:ClearTimer()
PlayerVoiceData:StopCharVoice()
self:StopVoice()
end
end
function LoginSpRewardCtrl_Lsv:OnEvent_ClosePanel(nPanelId)
@@ -0,0 +1,63 @@
local ActMailBindCtrl = class("ActMailBindCtrl", BaseCtrl)
local SDKManager = CS.SDKManager.Instance
ActMailBindCtrl._mapNodeConfig = {
txtDesc = {sComponentName = "TMP_Text"},
btnGo = {
sComponentName = "UIButton",
callback = "OnBtnClick_Go"
},
txtBtnGo = {
sComponentName = "TMP_Text",
sLanguageId = "MailBind_Go"
},
btnGoLock = {},
txtBtnGoLock = {
sComponentName = "TMP_Text",
sLanguageId = "MailBind_GoLock"
}
}
ActMailBindCtrl._mapEventConfig = {
MailBind_RequestUpdate = "OnEvent_RequestUpdate"
}
ActMailBindCtrl._mapRedDotConfig = {}
function ActMailBindCtrl:InitActData(actData)
self.actData = actData
self.nActId = self.actData:GetActId()
local config = ConfigTable.GetData("ActivityMailBindControl", self.nActId)
if config == nil then
return
end
NovaAPI.SetTMPText(self._mapNode.txtDesc, config.Desc)
local itemCfg = ConfigTable.GetData("Item", config.Reward1Tid)
if itemCfg == nil then
return
end
self:SetPngSprite(self._mapNode.imgItem, itemCfg.Icon)
NovaAPI.SetTMPText(self._mapNode.txtCount, config.Reward1Qty)
self:InitRewardStatus()
end
function ActMailBindCtrl:InitRewardStatus()
local bGettedReward = self.actData:GetRewardData()
self._mapNode.btnGo.gameObject:SetActive(not bGettedReward)
self._mapNode.btnGoLock.gameObject:SetActive(bGettedReward)
end
function ActMailBindCtrl:OnBtnClick_Go()
local bRequestState = self.actData:GetRequestState()
if bRequestState then
return
end
local bGettedReward = self.actData:GetRewardData()
if bGettedReward then
self:InitRewardStatus()
return
end
if not SDKManager:IsSDKInit() then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Function_NotAvailable"))
return
end
self.actData:RequestReward()
end
function ActMailBindCtrl:OnEvent_RequestUpdate()
self:InitRewardStatus()
end
return ActMailBindCtrl
@@ -0,0 +1,22 @@
local MathParkourLevelSelectPanel = class("MathParkourLevelSelectPanel", BasePanel)
MathParkourLevelSelectPanel._sUIResRootPath = "UI_Activity/"
MathParkourLevelSelectPanel._tbDefine = {
{
sPrefabPath = "_400018/MathParkourLevelsSelect.prefab",
sCtrlName = "Game.UI.Activity.MathParkour.MathParkourLevelSelectCtrl"
}
}
function MathParkourLevelSelectPanel:Awake()
self.nSelectIndex = 0
end
function MathParkourLevelSelectPanel:OnEnable()
end
function MathParkourLevelSelectPanel:OnAfterEnter()
end
function MathParkourLevelSelectPanel:OnDisable()
end
function MathParkourLevelSelectPanel:OnDestroy()
end
function MathParkourLevelSelectPanel:OnRelease()
end
return MathParkourLevelSelectPanel
@@ -0,0 +1,30 @@
local MathParkourPanel = class("MathParkourPanel", BasePanel)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
MathParkourPanel._sUIResRootPath = "UI_Activity/"
MathParkourPanel._tbDefine = {
{
sPrefabPath = "_400018/MathParkourPanel.prefab",
sCtrlName = "Game.UI.Activity.MathParkour.MathParkourCtrl"
},
{
sPrefabPath = "_400018/MathParkourSkillDisplayPanel.prefab",
sCtrlName = "Game.UI.Activity.MathParkour.MathParkourSkillDisplayCtrl"
}
}
function MathParkourPanel:Awake()
GamepadUIManager.EnterAdventure(true)
GamepadUIManager.EnableGamepadUI("MathParkourCtrl", {}, nil, false)
end
function MathParkourPanel:OnEnable()
end
function MathParkourPanel:OnAfterEnter()
end
function MathParkourPanel:OnDisable()
end
function MathParkourPanel:OnDestroy()
GamepadUIManager.DisableGamepadUI("MathParkourCtrl")
GamepadUIManager.QuitAdventure()
end
function MathParkourPanel:OnRelease()
end
return MathParkourPanel
@@ -0,0 +1,23 @@
local MathParkourResultPanel = class("MathParkourResultPanel", BasePanel)
MathParkourResultPanel._nSnapshotPrePanel = 1
MathParkourResultPanel._sUIResRootPath = "UI_Activity/"
MathParkourResultPanel._bIsMainPanel = false
MathParkourResultPanel._tbDefine = {
{
sPrefabPath = "_400018/MathParkourResultPanel.prefab",
sCtrlName = "Game.UI.Activity.MathParkour.MathParkourResultCtrl"
}
}
function MathParkourResultPanel:Awake()
end
function MathParkourResultPanel:OnEnable()
end
function MathParkourResultPanel:OnAfterEnter()
end
function MathParkourResultPanel:OnDisable()
end
function MathParkourResultPanel:OnDestroy()
end
function MathParkourResultPanel:OnRelease()
end
return MathParkourResultPanel
@@ -0,0 +1,21 @@
local MathParkourSkillDisplayPanel = class("MathParkourSkillDisplayPanel", BasePanel)
MathParkourSkillDisplayPanel._bIsMainPanel = false
MathParkourSkillDisplayPanel._tbDefine = {
{
sPrefabPath = "Activity/MathParkour/400018/MathParkourSkillDisplayPanel.prefab",
sCtrlName = "Game.UI.Activity.MathParkour.MathParkourSkillDisplayPanelCtrl"
}
}
function MathParkourSkillDisplayPanel:Awake()
end
function MathParkourSkillDisplayPanel:OnEnable()
end
function MathParkourSkillDisplayPanel:OnAfterEnter()
end
function MathParkourSkillDisplayPanel:OnDisable()
end
function MathParkourSkillDisplayPanel:OnDestroy()
end
function MathParkourSkillDisplayPanel:OnRelease()
end
return MathParkourSkillDisplayPanel
@@ -0,0 +1,90 @@
local MathParkourBuffCtrl = class("MathParkourBuffCtrl", BaseCtrl)
local AssetPath = "UI_Activity/_400018/SpriteAtlas/"
MathParkourBuffCtrl._mapNodeConfig = {
imgIcon = {sComponentName = "Image"},
TMPBuffTime1 = {sComponentName = "TMP_Text"}
}
MathParkourBuffCtrl._mapEventConfig = {}
MathParkourBuffCtrl._mapRedDotConfig = {}
function MathParkourBuffCtrl:Awake()
self.timer = nil
self.boomTimer = nil
self.animator = self.gameObject:GetComponent("Animator")
end
function MathParkourBuffCtrl:OnEnable()
end
function MathParkourBuffCtrl:ShowBuff(nBuffId, bPause)
self.nBuffId = nBuffId
local buffCfg = ConfigTable.GetData("MathParkourBuffItem", nBuffId)
if self.timer ~= nil then
self.timer:Cancel()
self.timer = nil
end
if buffCfg.Icon ~= "" then
self:SetPngSprite(self._mapNode.imgIcon, AssetPath .. buffCfg.Icon)
end
self.nCurTime = buffCfg.Time
self.nBoomTime = buffCfg.Time
self:SetTimeText(self.nCurTime)
self.timer = self:AddTimer(0, 1, function()
self.nCurTime = self.nCurTime - 1
self.nCurTime = math.max(self.nCurTime, 0)
if self.nCurTime <= 0 then
self.timer:Cancel()
self.timer = nil
self:HideBuff()
return
end
self:SetTimeText(self.nCurTime)
end, true, true, true)
self.timer:Pause(bPause)
if buffCfg.ObjType == GameEnum.MathParkourBuffType.Boom then
if self.boomTimer ~= nil then
self.boomTimer:Cancel()
self.boomTimer = nil
end
EventManager.Hit("MathParkour_BoomTime", 1.0)
self.boomTimer = self:AddTimer(0, 0.02, function()
self.nBoomTime = self.nBoomTime - 0.02
if self.nBoomTime <= 0 then
self.boomTimer:Cancel()
self.boomTimer = nil
return
end
EventManager.Hit("MathParkour_BoomTime", self.nBoomTime / buffCfg.Time)
end, true, true, true)
self.boomTimer:Pause(bPause)
end
if self.animator ~= nil then
self.animator:Play("rtBuff_in")
end
end
function MathParkourBuffCtrl:SetTimeText(nTime)
nTime = math.max(nTime, 0)
nTime = math.floor(nTime)
local sTimeText = string.format("%02d:%02d", math.floor(nTime / 60), nTime % 60)
NovaAPI.SetTMPText(self._mapNode.TMPBuffTime1, sTimeText)
end
function MathParkourBuffCtrl:HideBuff()
if self.timer ~= nil then
self.timer:Cancel()
self.timer = nil
end
if self.boomTimer ~= nil then
self.boomTimer:Cancel()
self.boomTimer = nil
end
if self.nBuffId ~= nil and self.nBuffId ~= 0 then
EventManager.Hit("MathParkour_BuffTimeOut", self.nBuffId)
end
self.nBuffId = 0
end
function MathParkourBuffCtrl:Pause(bPause)
if self.timer ~= nil then
self.timer:Pause(bPause)
end
if self.boomTimer ~= nil then
self.boomTimer:Pause(bPause)
end
end
return MathParkourBuffCtrl
@@ -0,0 +1,615 @@
local MathParkourCtrl = class("MathParkourCtrl", BaseCtrl)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
MathParkourCtrl._mapNodeConfig = {
rtBuff = {
nCount = 5,
sCtrlName = "Game.UI.Activity.MathParkour.MathParkourBuffCtrl"
},
txt_newScore = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Text_NewScore"
},
txt_targetScore = {sComponentName = "TMP_Text"},
imgActProgress = {sComponentName = "Image"},
StarItem = {nCount = 3},
obj_Time = {},
btnPause = {
sComponentName = "NaviButton",
callback = "OnBtnClick_Pause",
sAction = "MathParkour_Pause"
},
goChallenge = {
sCtrlName = "Game.UI.Activity.MathParkour.MathParkourResultSuccessCtrl"
},
goFailure = {
sCtrlName = "Game.UI.Activity.MathParkour.MathParkourResultFailCtrl"
},
goPause = {
sNodeName = "MathParkourPause",
sCtrlName = "Game.UI.Activity.MathParkour.MathParkourPauseCtrl"
},
btn_qte = {
sComponentName = "NaviButton",
callback = "OnBtnClick_QTE",
sAction = "MathParkour_QTE",
sActionIconType = "Dark"
},
goSmash = {},
imgSmasProgress = {sComponentName = "Image"},
txt_SmashScore = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Text_SmashScore"
},
btnClearthescene = {
sComponentName = "NaviButton",
callback = "OnBtnClick_ClearTheScene",
sAction = "MathParkour_Boom"
},
txt_Clearthescene = {
sComponentName = "TMP_Text",
nCount = 2,
sLanguageId = "MathParkour_Clearthescene"
},
imgProgress = {sComponentName = "Image"},
txt_Score1 = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Text_Score1"
},
txt_Score = {sComponentName = "TMP_Text"},
canvasGroup = {
sNodeName = "----SafeAreaRoot---",
sComponentName = "CanvasGroup"
}
}
MathParkourCtrl._mapEventConfig = {
MathParkour_AddScore = "OnEvent_AddScore",
MathParkour_BuffItemCollected = "OnEvent_AddBuff",
MathParkour_UseBuff = "OnEvent_UseBuff",
MathParkour_BuffConsumed = "OnEvent_BuffConsumed",
MathParkour_BoomTime = "OnEvent_BoomTime",
MathParkour_LevelEnd = "OnEvent_LevelEnd",
MathParkour_BossEncountered = "OnEvent_BossEncountered",
MathParkour_Confirm = "OnEvent_Confirm",
MathParkour_Again = "OnEvent_Again",
MathParkour_NextLevel = "OnEvent_GoNextLevel",
MathParkour_BuffTimeOut = "OnEvent_BuffTimeOut",
MathParkour_Exit_OnClick = "OnEvent_Exit",
MathParkour_Restart_OnClick = "OnEvent_Restart",
MathParkour_Continue_OnClick = "OnEvent_Continue",
MathParkour_EnterLevel = "OnEvent_EnterLevel",
MathParkour_BlockInput = "OnEvent_BlockInput",
MathParkour_GMRemoveBuff = "OnEvent_GMRemoveBuff",
MathParkour_GM_ToggleBuffOverlay = "OnEvent_GMToggleBuffOverlay",
MathParkour_GM_Pause = "OnEvent_GMPause"
}
MathParkourCtrl._mapRedDotConfig = {}
function MathParkourCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.nLevelId = param[2]
end
self.tbGamepadUINode = self:GetGamepadUINode()
GamepadUIManager.AddGamepadUINode("MathParkourCtrl", self.tbGamepadUINode)
self:InitData()
self:UpdatePanelData()
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, 0)
end
function MathParkourCtrl:OnDestroy()
self:ClearGMBuffOverlay()
end
function MathParkourCtrl:InitData()
self.bPause = true
self.levelCfg = ConfigTable.GetData("MathParkourLevel", self.nLevelId)
self.cfg = ConfigTable.GetData("MathParkourConfig", self.levelCfg.ConfigId)
self.actData = PlayerData.Activity:GetActivityDataById(self.nActId)
self.CurLevelData = self.actData:GetLevelData(self.nLevelId)
self.nCurScore = 0
self.nStar = 0
self.bInResult = false
self:UpdateScore(0)
self.nAddBuffCount = 0
self.tbUsedBuffItem = {}
self.tbBuffItem = {}
self.bBossEncountered = false
for i = 1, 5 do
self.tbBuffItem[i] = self._mapNode.rtBuff[i]
self.tbBuffItem[i].gameObject:SetActive(false)
end
end
function MathParkourCtrl:UpdatePanelData()
self._mapNode.btnClearthescene.gameObject:SetActive(false)
self._mapNode.goChallenge:HidePanel()
self._mapNode.goFailure:HidePanel()
self._mapNode.obj_Time:SetActive(true)
local timeOutGo = self._mapNode.obj_Time.transform:Find("AnimRoot")
timeOutGo.gameObject:SetActive(false)
self:InitQTE()
self._mapNode.txt_Score1.gameObject:SetActive(self.bBossEncountered)
self._mapNode.txt_Score.gameObject:SetActive(self.bBossEncountered)
end
function MathParkourCtrl:InitQTE()
self._mapNode.goSmash.gameObject:SetActive(false)
self._mapNode.btn_qte.gameObject:SetActive(false)
if self.qteTimer ~= nil then
self.qteTimer:Cancel()
self.qteTimer = nil
end
self.nQte = 0
end
function MathParkourCtrl:StartGame()
local bNewLevel = self.actData:GetLevelIsNew(self.nLevelId)
if bNewLevel and self.levelCfg.DicId ~= 0 then
self.actData:EnterLevel(self.nLevelId)
EventManager.Hit(EventId.OpenPanel, PanelId.DictionaryEntry, self.levelCfg.DicId, true, function()
WwiseAudioMgr:PostEvent("Mode_400018_start")
self:AddTimer(1, 0.5, function()
local timeOutGo = self._mapNode.obj_Time.transform:Find("AnimRoot")
timeOutGo.gameObject:SetActive(true)
NovaAPI.DispatchEventWithData("MATHPARKOUR_STARTLEVEL", nil, nil)
EventManager.Hit(EventId.BlockInput, true)
self:AddTimer(1, 3.5, function()
self._mapNode.obj_Time:SetActive(false)
self.bPause = false
EventManager.Hit(EventId.BlockInput, false)
NovaAPI.DispatchEventWithData("MATHPARKOUR_START", nil, nil)
end, true, true, true)
end, true, true, true)
end)
else
EventManager.Hit(EventId.BlockInput, true)
WwiseAudioMgr:PostEvent("Mode_400018_start")
self:AddTimer(1, 0.5, function()
local timeOutGo = self._mapNode.obj_Time.transform:Find("AnimRoot")
timeOutGo.gameObject:SetActive(true)
NovaAPI.DispatchEventWithData("MATHPARKOUR_STARTLEVEL", nil, nil)
self:AddTimer(1, 3.5, function()
self._mapNode.obj_Time:SetActive(false)
self.bPause = false
EventManager.Hit(EventId.BlockInput, false)
NovaAPI.DispatchEventWithData("MATHPARKOUR_START", nil, nil)
end, true, true, true)
end, true, true, true)
self.actData:EnterLevel(self.nLevelId)
end
end
function MathParkourCtrl:ShowQTE()
NovaAPI.SetImageFillAmount(self._mapNode.imgSmasProgress, 0)
self._mapNode.goSmash.gameObject:SetActive(true)
self._mapNode.btn_qte.gameObject:SetActive(true)
self.qteTimer = self:AddTimer(0, 1, function()
self.nQte = self.nQte - self.cfg.QteProgressDeduction
self.nQte = math.max(self.nQte, 0)
NovaAPI.SetImageFillAmount(self._mapNode.imgSmasProgress, self.nQte / self.cfg.QteProgressLimit)
NovaAPI.DispatchEventWithData("MathParkour_SetQteSpeed", nil, {
self.nQte * self.cfg.QteSpeedFactor
})
end, true, true, true)
end
function MathParkourCtrl:RemoveBuff(nBuffId)
if self.tbUsedBuffItem[nBuffId] ~= nil then
local buffItem = self.tbUsedBuffItem[nBuffId]
table.insert(self.tbBuffItem, buffItem)
buffItem.gameObject:SetActive(false)
local buffCfg = ConfigTable.GetData("MathParkourBuffItem", nBuffId)
if buffCfg.ObjType == GameEnum.MathParkourBuffType.Boom then
self._mapNode.btnClearthescene.gameObject:SetActive(false)
end
self.tbUsedBuffItem[nBuffId] = nil
NovaAPI.DispatchEventWithData("MathParkour_BuffRemoved", nil, {nBuffId})
end
end
function MathParkourCtrl:Remap(nValue, nInMin, nInMax, nOutMin, nOutMax)
if nInMax == nInMin then
return nOutMin
end
return nOutMin + (nValue - nInMin) / (nInMax - nInMin) * (nOutMax - nOutMin)
end
function MathParkourCtrl:UpdateScore(nAddScore)
self.nCurScore = math.max(self.nCurScore + nAddScore, 0)
NovaAPI.SetTMPText(self._mapNode.txt_targetScore, self.nCurScore)
self._mapNode.txt_newScore.gameObject:SetActive(self.nCurScore > self.CurLevelData.nScore)
local nStar = 0
if self.nCurScore >= self.levelCfg.Reward3Condition then
NovaAPI.SetImageFillAmount(self._mapNode.imgActProgress, 1)
nStar = 3
elseif self.nCurScore >= self.levelCfg.Reward2Condition then
local nTempScore = self.nCurScore - self.levelCfg.Reward2Condition
local amount = self:Remap(nTempScore / (self.levelCfg.Reward3Condition - self.levelCfg.Reward2Condition), 0, 1, 0, 0.33) + 0.66
NovaAPI.SetImageFillAmount(self._mapNode.imgActProgress, amount)
nStar = 2
elseif self.nCurScore >= self.levelCfg.Reward1Condition then
local nTempScore = self.nCurScore - self.levelCfg.Reward1Condition
local amount = self:Remap(nTempScore / (self.levelCfg.Reward2Condition - self.levelCfg.Reward1Condition), 0, 1, 0, 0.33) + 0.33
NovaAPI.SetImageFillAmount(self._mapNode.imgActProgress, amount)
nStar = 1
else
local amount = self:Remap(self.nCurScore / self.levelCfg.Reward1Condition, 0, 1, 0, 0.33)
NovaAPI.SetImageFillAmount(self._mapNode.imgActProgress, amount)
nStar = 0
end
for i = 1, 3 do
local star = self._mapNode.StarItem[i].transform:Find("ImgStarGray")
star.gameObject:SetActive(i > nStar)
end
self.nStar = nStar
end
function MathParkourCtrl:ApplyLogicPause(bPause)
if bPause then
NovaAPI.DispatchEventWithData("MATHPARKOUR_PAUSE_STATE_CHANGED", nil, {1})
EventManager.Hit("MathParkour_CastAssistSkillPause", true)
if self.tbUsedBuffItem ~= nil then
for _, v in pairs(self.tbUsedBuffItem) do
v:Pause(true)
end
end
WwiseAudioMgr:PostEvent("Mode_400018_all_pasue")
else
NovaAPI.DispatchEventWithData("MATHPARKOUR_PAUSE_STATE_CHANGED", nil, {0})
EventManager.Hit("MathParkour_CastAssistSkillPause", false)
if self.tbUsedBuffItem ~= nil then
for _, v in pairs(self.tbUsedBuffItem) do
v:Pause(false)
end
end
WwiseAudioMgr:PostEvent("Mode_400018_all_resume")
end
end
function MathParkourCtrl:IsLogicPaused()
return self.bPause == true or self.bGMPaused == true
end
function MathParkourCtrl:OnEvent_GMPause(bPause)
if bPause then
if self:IsLogicPaused() then
return
end
self.bGMPaused = true
self:ApplyLogicPause(true)
return
end
if not self.bGMPaused then
return
end
self.bGMPaused = false
if self:IsLogicPaused() then
return
end
self:ApplyLogicPause(false)
end
function MathParkourCtrl:OnBtnClick_Pause()
if self.bInResult then
return
end
self.bPause = true
self:ApplyLogicPause(true)
self._mapNode.goPause:Open(self.levelCfg.DicId)
end
function MathParkourCtrl:OnBtnClick_Start()
end
function MathParkourCtrl:OnBtnClick_ClearTheScene()
if self.tempClearSceneBuffId ~= nil and self.tbUsedBuffItem[self.tempClearSceneBuffId] ~= nil then
NovaAPI.DispatchEventWithData("MATHPARKOUR_CLEAR_THE_SCENE", nil, {
self.tempClearSceneBuffId
})
end
if self.tbUsedBuffItem[self.tempClearSceneBuffId] ~= nil then
local buffItem = self.tbUsedBuffItem[self.tempClearSceneBuffId]
table.insert(self.tbBuffItem, buffItem)
buffItem.gameObject:SetActive(false)
local buffCfg = ConfigTable.GetData("MathParkourBuffItem", self.tempClearSceneBuffId)
if buffCfg.ObjType == GameEnum.MathParkourBuffType.Boom then
self._mapNode.btnClearthescene.gameObject:SetActive(false)
end
self.tbUsedBuffItem[self.tempClearSceneBuffId] = nil
end
end
function MathParkourCtrl:OnBtnClick_QTE()
self.nQte = self.nQte + self.cfg.QteProgressPerClick
self.nQte = math.min(self.nQte, self.cfg.QteProgressLimit)
NovaAPI.SetImageFillAmount(self._mapNode.imgSmasProgress, self.nQte / self.cfg.QteProgressLimit)
NovaAPI.DispatchEventWithData("MathParkour_SetQteSpeed", nil, {
self.nQte * self.cfg.QteSpeedFactor
})
end
function MathParkourCtrl:OnEvent_AddScore(nAddScore)
self:UpdateScore(nAddScore)
if self.bBossEncountered then
self.nBossScore = self.nBossScore + nAddScore
NovaAPI.SetTMPText(self._mapNode.txt_Score, "+" .. tostring(self.nBossScore))
end
end
function MathParkourCtrl:OnEvent_AddBuff(nBuffId)
self.nAddBuffCount = self.nAddBuffCount + 1
local buffCfg = ConfigTable.GetData("MathParkourBuffItem", nBuffId)
if NovaAPI.IsEditorPlatform() then
print("MathParkourCtrl:OnEvent_AddBuff nBuffId=" .. tostring(nBuffId) .. "=====" .. buffCfg.Name)
end
if buffCfg.ObjType == GameEnum.MathParkourBuffType.Rocket then
NovaAPI.DispatchEventWithData("MathParkour_BuffAdded", nil, {nBuffId})
NovaAPI.DispatchEventWithData("MathParkour_BuffRemoved", nil, {nBuffId})
return
end
if self.tbUsedBuffItem[nBuffId] == nil then
local buffItem = self.tbBuffItem[1]
buffItem.gameObject:SetActive(true)
buffItem:ShowBuff(nBuffId, self:IsLogicPaused())
self.tbUsedBuffItem[nBuffId] = buffItem
if buffCfg.ObjType == GameEnum.MathParkourBuffType.Boom then
self._mapNode.btnClearthescene.gameObject:SetActive(true)
self.tempClearSceneBuffId = nBuffId
end
table.remove(self.tbBuffItem, 1)
NovaAPI.DispatchEventWithData("MathParkour_BuffAdded", nil, {nBuffId})
else
self.tbUsedBuffItem[nBuffId]:ShowBuff(nBuffId, self:IsLogicPaused())
end
end
function MathParkourCtrl:OnEvent_BuffTimeOut(nBuffId)
local cfg = ConfigTable.GetData("MathParkourBuffItem", nBuffId)
if cfg.ObjType == GameEnum.MathParkourBuffType.Boom then
self:OnBtnClick_ClearTheScene()
end
self:RemoveBuff(nBuffId)
end
function MathParkourCtrl:OnEvent_UseBuff(nBuffId)
self:RemoveBuff(nBuffId)
end
function MathParkourCtrl:OnEvent_BuffConsumed(nBuffId)
self:RemoveBuff(nBuffId)
end
function MathParkourCtrl:OnEvent_BoomTime(fTime)
NovaAPI.SetImageFillAmount(self._mapNode.imgProgress, fTime)
end
function MathParkourCtrl:OnEvent_LevelEnd(bResult)
self:ClearGMBuffOverlay()
self.bInResult = true
if bResult then
local nNextLevelId = self.actData:GetNextLevelId(self.nLevelId)
self._mapNode.goChallenge:ShowPanel(self.nCurScore, self.nCurScore > self.CurLevelData.nScore, self.nStar, nNextLevelId ~= nil, self.nActId)
else
self._mapNode.goFailure:ShowPanel(self.nCurScore)
end
self.actData:DoResult(self.nLevelId, bResult, self.nCurScore, self.nStar, self.nAddBuffCount)
end
function MathParkourCtrl:OnEvent_BossEncountered()
EventManager.Hit(EventId.TemporaryBlockInput, 1.6)
EventManager.Hit("MathParkour_CastAssistSkill", 140, 14001)
self:AddTimer(1, 1.66, function()
self.bBossEncountered = true
self:ShowQTE()
self._mapNode.txt_Score1.gameObject:SetActive(self.bBossEncountered)
self._mapNode.txt_Score.gameObject:SetActive(self.bBossEncountered)
self.nBossScore = 0
NovaAPI.SetTMPText(self._mapNode.txt_Score, "+" .. tostring(self.nBossScore))
end, true, true, true)
end
function MathParkourCtrl:OnEvent_Confirm()
if NovaAPI.GetCurrentModuleName() == "MainMenuModuleScene" then
CS.AdventureModuleHelper.LevelStateChanged(true, 0, false)
EventManager.Hit(EventId.CloesCurPanel)
PlayerData.Base:OnBackToMainMenuModule()
else
NovaAPI.EnterModule("MainMenuModuleScene", true)
end
end
function MathParkourCtrl:OnEvent_Again()
NovaAPI.DispatchEventWithData("MathParkour_Restart", nil, nil)
self:InitData()
self:UpdatePanelData()
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, 0)
end
function MathParkourCtrl:OnEvent_GoNextLevel()
local nNextLevelId = self.actData:GetNextLevelId(self.nLevelId)
if nNextLevelId == nil then
return
end
WwiseAudioMgr:PostEvent("Mode_400018_all_stop")
self.nLevelId = nNextLevelId
self:AddTimer(1, 0.1, function()
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, 0)
end, true, true, true)
self:InitData()
self:UpdatePanelData()
local param = {}
table.insert(param, tostring(self.nActId))
table.insert(param, tostring(self.CurLevelData.nId))
table.insert(param, tostring(0))
CS.MiniGameHelper.SetMiniGameData(param)
NovaAPI.DispatchEventWithData("MathParkour_NextLevel", nil, nil)
end
function MathParkourCtrl:OnEvent_Exit()
WwiseAudioMgr:PostEvent("Mode_400018_all_stop")
if NovaAPI.GetCurrentModuleName() == "MainMenuModuleScene" then
CS.AdventureModuleHelper.LevelStateChanged(true, 0, false)
EventManager.Hit(EventId.CloesCurPanel)
PlayerData.Base:OnBackToMainMenuModule()
else
NovaAPI.EnterModule("MainMenuModuleScene", true)
end
end
function MathParkourCtrl:OnEvent_Restart()
WwiseAudioMgr:PostEvent("Mode_400018_all_stop")
self._mapNode.goPause:Close()
NovaAPI.DispatchEventWithData("MathParkour_Restart", nil, nil)
self:AddTimer(1, 0.1, function()
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, 0)
end, true, true, true)
self:InitData()
self:UpdatePanelData()
end
function MathParkourCtrl:OnEvent_Continue()
self._mapNode.goPause:Close()
self.bPause = false
if self:IsLogicPaused() then
return
end
self:ApplyLogicPause(false)
end
function MathParkourCtrl:OnEvent_EnterLevel()
local animator = self.gameObject:GetComponent("Animator")
if animator ~= nil then
animator:Play("MathParkourPanel_in")
end
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, 1)
self:StartGame()
end
function MathParkourCtrl:OnEvent_BlockInput(bBlock)
EventManager.Hit(EventId.BlockInput, bBlock)
end
function MathParkourCtrl:OnEvent_GMRemoveBuff(nBuffId)
self:RemoveBuff(nBuffId)
end
function MathParkourCtrl:OnEvent_GMToggleBuffOverlay()
self.bGMBuffOverlay = not self.bGMBuffOverlay
if self.bGMBuffOverlay then
self:EnsureGMBuffOverlay()
self:RefreshGMBuffOverlay()
if self.gmOverlayTimer == nil then
self.gmOverlayTimer = self:AddTimer(0, 0.5, function()
if self.bGMBuffOverlay then
self:RefreshGMBuffOverlay()
end
end, true, true, true)
else
self.gmOverlayTimer:Pause(false)
end
else
if self.goGMBuffOverlay ~= nil and not self.goGMBuffOverlay:IsNull() then
self.goGMBuffOverlay:SetActive(false)
end
if self.gmOverlayTimer ~= nil then
self.gmOverlayTimer:Pause(true)
end
end
end
local GM_OVERLAY_COL_MAX = 4
local GetGMOverlayFont = function(trParent)
local srcTxt = trParent:GetComponentInChildren(typeof(CS.UnityEngine.UI.Text))
if srcTxt ~= nil and srcTxt.font ~= nil then
return srcTxt.font
end
local ok, builtinFont = pcall(function()
return CS.UnityEngine.Resources.GetBuiltinResource(typeof(CS.UnityEngine.Font), "LegacyRuntime.ttf")
end)
if ok then
return builtinFont
end
return nil
end
local CreateGMOverlayText = function(goParent, sName, font)
local go = CS.UnityEngine.GameObject(sName, typeof(CS.UnityEngine.RectTransform))
go.layer = goParent.layer
go.transform:SetParent(goParent.transform, false)
local txt = go:AddComponent(typeof(CS.UnityEngine.UI.Text))
txt.fontSize = 22
txt.color = CS.UnityEngine.Color.black
txt.alignment = CS.UnityEngine.TextAnchor.UpperLeft
txt.horizontalOverflow = CS.UnityEngine.HorizontalWrapMode.Overflow
txt.verticalOverflow = CS.UnityEngine.VerticalWrapMode.Overflow
txt.raycastTarget = false
if font ~= nil then
txt.font = font
end
return txt
end
local StretchGMOverlayText = function(txt, nAnchorMinX, nAnchorMaxX)
local rt = txt:GetComponent("RectTransform")
rt.anchorMin = Vector2(nAnchorMinX, 0)
rt.anchorMax = Vector2(nAnchorMaxX, 1)
rt.pivot = Vector2(0.5, 1)
rt.offsetMin = Vector2(8, 0)
rt.offsetMax = Vector2(-8, 0)
end
function MathParkourCtrl:EnsureGMBuffOverlay()
if self.goGMBuffOverlay ~= nil and not self.goGMBuffOverlay:IsNull() and self.txtGMBuffOverlayRight ~= nil then
self.goGMBuffOverlay:SetActive(true)
return
end
if self.goGMBuffOverlay ~= nil and not self.goGMBuffOverlay:IsNull() then
destroy(self.goGMBuffOverlay)
end
local parent = self._mapNode.canvasGroup.transform
local go = CS.UnityEngine.GameObject("GMBuffOverlay", typeof(CS.UnityEngine.RectTransform))
go.layer = parent.gameObject.layer
go.transform:SetParent(parent, false)
local rt = go:GetComponent("RectTransform")
rt.anchorMin = Vector2(0.5, 0.5)
rt.anchorMax = Vector2(0.5, 0.5)
rt.pivot = Vector2(0.5, 1)
rt.anchoredPosition = Vector2(0, -90)
rt.sizeDelta = Vector2(560, 180)
local font = GetGMOverlayFont(parent)
local txtLeft = CreateGMOverlayText(go, "txtLeft", font)
local txtRight = CreateGMOverlayText(go, "txtRight", font)
StretchGMOverlayText(txtLeft, 0, 1)
StretchGMOverlayText(txtRight, 0.5, 1)
txtRight.gameObject:SetActive(false)
self.goGMBuffOverlay = go
self.txtGMBuffOverlay = txtLeft
self.txtGMBuffOverlayRight = txtRight
end
function MathParkourCtrl:RefreshGMBuffOverlay()
if self.txtGMBuffOverlay == nil then
return
end
local tbLines = {}
for nBuffId, buffCtrl in pairs(self.tbUsedBuffItem) do
local buffCfg = ConfigTable.GetData("MathParkourBuffItem", nBuffId)
local sName = buffCfg ~= nil and buffCfg.Name or tostring(nBuffId)
local nTime = buffCtrl.nCurTime or 0
table.insert(tbLines, {
nId = nBuffId,
sText = string.format("%s %02d:%02d", sName, math.floor(nTime / 60), nTime % 60)
})
end
table.sort(tbLines, function(a, b)
return a.nId < b.nId
end)
local JoinLines = function(nFrom, nTo)
local s = "当前效果:\n"
if nTo < nFrom then
return s .. "(无)"
end
for i = nFrom, nTo do
s = s .. tbLines[i].sText .. "\n"
end
return s
end
local nCount = #tbLines
local bTwoCol = nCount > GM_OVERLAY_COL_MAX
if not bTwoCol then
StretchGMOverlayText(self.txtGMBuffOverlay, 0, 1)
self.txtGMBuffOverlay.alignment = CS.UnityEngine.TextAnchor.UpperCenter
NovaAPI.SetText(self.txtGMBuffOverlay, JoinLines(1, nCount))
if self.txtGMBuffOverlayRight ~= nil then
self.txtGMBuffOverlayRight.gameObject:SetActive(false)
end
return
end
local nLeft = math.ceil(nCount / 2)
StretchGMOverlayText(self.txtGMBuffOverlay, 0, 0.5)
self.txtGMBuffOverlay.alignment = CS.UnityEngine.TextAnchor.UpperLeft
NovaAPI.SetText(self.txtGMBuffOverlay, JoinLines(1, nLeft))
self.txtGMBuffOverlayRight.gameObject:SetActive(true)
self.txtGMBuffOverlayRight.alignment = CS.UnityEngine.TextAnchor.UpperLeft
local sRight = ""
for i = nLeft + 1, nCount do
sRight = sRight .. tbLines[i].sText .. "\n"
end
NovaAPI.SetText(self.txtGMBuffOverlayRight, "\n" .. sRight)
end
function MathParkourCtrl:ClearGMBuffOverlay()
self.bGMBuffOverlay = false
if self.gmOverlayTimer ~= nil then
self.gmOverlayTimer:Cancel()
self.gmOverlayTimer = nil
end
if self.goGMBuffOverlay ~= nil and not self.goGMBuffOverlay:IsNull() then
destroy(self.goGMBuffOverlay)
end
self.goGMBuffOverlay = nil
self.txtGMBuffOverlay = nil
self.txtGMBuffOverlayRight = nil
end
return MathParkourCtrl
@@ -0,0 +1,162 @@
local MathParkourLevelDetailCtrl = class("MathParkourLevelDetailCtrl", BaseCtrl)
local AssetPath = "UI_Activity/_400018/SpriteAtlas/"
MathParkourLevelDetailCtrl._mapNodeConfig = {
txt_LevelName = {sComponentName = "TMP_Text"},
txt_detailDesc = {sComponentName = "TMP_Text"},
txt_ScoreTitle = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_ScoreTitle"
},
txt_MaxScore = {sComponentName = "TMP_Text"},
txt_Title1 = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Title1"
},
txt_Title2 = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Title2"
},
listReward = {
sComponentName = "LoopScrollView"
},
rtReward1 = {},
btn_item = {nCount = 4},
btn_firstPassItem = {sComponentName = "UIButton"},
firstPassItem = {
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
},
btn_threePassItem = {sComponentName = "UIButton"},
threePassItem = {
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
},
btn_Go = {
sComponentName = "UIButton",
callback = "OnBtnClick_Go"
},
txtBtnGo = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Go"
}
}
MathParkourLevelDetailCtrl._mapEventConfig = {}
MathParkourLevelDetailCtrl._mapRedDotConfig = {}
function MathParkourLevelDetailCtrl:Awake()
self.animator = self.gameObject:GetComponent("Animator")
end
function MathParkourLevelDetailCtrl:OnEnable()
end
function MathParkourLevelDetailCtrl:OnDisable()
end
function MathParkourLevelDetailCtrl:OnDestroy()
self:Clear()
end
function MathParkourLevelDetailCtrl:Clear()
if self.tbItemCtrl ~= nil then
for _, ctrl in pairs(self.tbItemCtrl) do
self:UnbindCtrlByNode(ctrl)
end
end
self.tbItemCtrl = {}
end
function MathParkourLevelDetailCtrl:ShowPanel(nActId, levelData)
self.nActId = nActId
self.levelData = levelData
local config = ConfigTable.GetData("MathParkourLevel", levelData.nId)
if config == nil then
return
end
NovaAPI.SetTMPText(self._mapNode.txt_LevelName, config.Title)
NovaAPI.SetTMPText(self._mapNode.txt_detailDesc, config.Desc)
NovaAPI.SetTMPText(self._mapNode.txt_MaxScore, levelData.nScore)
local buffItem = config.DropItemList
self._mapNode.listReward.gameObject:SetActive(4 < #buffItem)
self._mapNode.rtReward1.gameObject:SetActive(#buffItem <= 4)
if 4 < #buffItem then
self._mapNode.listReward:Init(#buffItem, self, self.OnGridRefresh, self.OnGridBtnClick, false)
else
for i = 1, 4 do
if i <= #buffItem then
local btn_item = self._mapNode.btn_item[i]
btn_item.gameObject:SetActive(true)
local itemId = buffItem[i]
local buffCfg = ConfigTable.GetData("MathParkourBuffItem", itemId)
if buffCfg ~= nil then
local imgIcon = btn_item.transform:Find("AnimRoot/item/AnimRoot/imgIcon"):GetComponent("Image")
if buffCfg.Icon ~= "" then
self:SetPngSprite(imgIcon, AssetPath .. buffCfg.Icon)
end
local btn = btn_item.gameObject:GetComponent("UIButton")
btn.onClick:RemoveAllListeners()
btn.onClick:AddListener(function()
local msgData = {
Title = buffCfg.Name,
Desc = {
buffCfg.Desc or ""
}
}
EventManager.Hit(EventId.OpenPanel, PanelId.DescTips, btn.transform, msgData)
end)
end
else
self._mapNode.btn_item[i].gameObject:SetActive(false)
end
end
end
self._mapNode.btn_firstPassItem.gameObject:SetActive(config.Reward1Id)
if config.Reward1Id > 0 then
self._mapNode.firstPassItem:SetItem(config.Reward1Id, nil, config.Reward1Count, false, 0 < levelData.nStar, true)
self._mapNode.btn_firstPassItem.onClick:RemoveAllListeners()
self._mapNode.btn_firstPassItem.onClick:AddListener(function()
UTILS.ClickItemGridWithTips(config.Reward1Id, self._mapNode.btn_firstPassItem.transform, true, true, false)
end)
end
self._mapNode.btn_threePassItem.gameObject:SetActive(config.Reward3Id)
if 0 < config.Reward3Id then
self._mapNode.threePassItem:SetItem(config.Reward3Id, nil, config.Reward3Count, false, levelData.nStar >= 3, false, true)
self._mapNode.btn_threePassItem.onClick:RemoveAllListeners()
self._mapNode.btn_threePassItem.onClick:AddListener(function()
UTILS.ClickItemGridWithTips(config.Reward3Id, self._mapNode.btn_threePassItem.transform, true, true, false)
end)
end
self.gameObject:SetActive(true)
if self.animator ~= nil then
self.animator:Play("LevelDetailsPanel_in")
end
end
function MathParkourLevelDetailCtrl:ClosePanel()
self.gameObject:SetActive(false)
self:Clear()
end
function MathParkourLevelDetailCtrl:OnGridRefresh(goGrid, gridIndex)
local nIndex = gridIndex + 1
local nInstanceId = goGrid:GetInstanceID()
local item = goGrid.transform:Find("btn_itemTemp/AnimRoot/item")
if not self.tbItemCtrl[nInstanceId] then
self.tbItemCtrl[nInstanceId] = self:BindCtrlByNode(item, "Game.UI.TemplateEx.TemplateItemCtrl")
end
local config = ConfigTable.GetData("MathParkourLevel", self.levelData.nId)
if config == nil then
return
end
local itemId = config.DropItemList[nIndex]
self.tbItemCtrl[nInstanceId]:SetItem(itemId)
end
function MathParkourLevelDetailCtrl:OnGridBtnClick(go, nIndex)
local nIndex = nIndex + 1
local config = ConfigTable.GetData("MathParkourLevel", self.levelData.nId)
if config == nil then
return
end
local itemId = config.DropItemList[nIndex]
UTILS.ClickItemGridWithTips(itemId, go.transform, true, true, false)
end
function MathParkourLevelDetailCtrl:OnBtnClick_Go()
local param = {}
table.insert(param, tostring(self.nActId))
table.insert(param, tostring(self.levelData.nId))
table.insert(param, tostring(0))
CS.MiniGameHelper.SetMiniGameData(param)
NovaAPI.EnterModule("MathParkourModuleScene", true, 56)
EventManager.Hit(EventId.OpenPanel, PanelId.MathParkourPanel, self.nActId, self.levelData.nId)
end
return MathParkourLevelDetailCtrl
@@ -0,0 +1,268 @@
local MathParkourLevelSelectCtrl = class("MathParkourLevelSelectCtrl", BaseCtrl)
local SpineManager = require("Game.Spine.SpineManager")
local layoutRight = 915
local layoutRightDefault = 322
local layoutMax = -427
MathParkourLevelSelectCtrl._mapNodeConfig = {
TopBar = {
sNodeName = "TopBarPanel",
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
},
btnCloseBg = {
sComponentName = "UIButton",
callback = "OnBtnClick_CloseBg"
},
togRoot = {nCount = 7},
btnTask = {
sComponentName = "UIButton",
callback = "OnBtnClick_Task"
},
txtTask = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_QuestTitle"
},
Sp_BookScene = {
sComponentName = "RectTransform"
},
Sp_BookSceneFront = {
sComponentName = "RectTransform"
},
rt_Toggle = {},
srToggle = {
sComponentName = "UIScrollRect"
},
rt_ToggleTrans = {
sNodeName = "rt_Toggle",
sComponentName = "RectTransform"
},
levelDetail = {
sNodeName = "LevelDetailsPanel",
sCtrlName = "Game.UI.Activity.MathParkour.MathParkourLevelDetailCtrl"
},
charSpine = {sNodeName = "Sp_char"},
reward_reddot = {}
}
MathParkourLevelSelectCtrl._mapEventConfig = {
MathParkourLevelUpdate = "OnEvent_LevelUpdate"
}
MathParkourLevelSelectCtrl._mapRedDotConfig = {}
function MathParkourLevelSelectCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
end
end
function MathParkourLevelSelectCtrl:OnEnable()
self._mapNode.rt_Toggle.gameObject:SetActive(false)
local aniamtor = self.gameObject:GetComponent("Animator")
if aniamtor ~= nil then
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
aniamtor:Play("MathParkourLevelsSelect_in")
self._mapNode.rt_Toggle.gameObject:SetActive(true)
end
cs_coroutine.start(wait)
end
self._mapNode.Sp_BookSceneFront.gameObject:SetActive(true)
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)
end
end
self:RefreshLevelList()
self._mapNode.levelDetail:ClosePanel()
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, 194, layoutRightDefault, -32, 0)
self._mapNode.Sp_BookScene.localPosition = Vector3(0, self._mapNode.Sp_BookScene.localPosition.y, 0)
self._mapNode.rt_ToggleTrans.localPosition = Vector3(0, self._mapNode.rt_ToggleTrans.localPosition.y, 0)
if 0 < self._panel.nSelectIndex then
local cacheLevelId = self.actData:GetCacheLevelId()
if cacheLevelId ~= nil then
for i, v in ipairs(self.tbLevelData) do
if v.nId == cacheLevelId then
self._panel.nSelectIndex = i
self.actData:ClearCacheLevelId()
break
end
end
end
self:AddTimer(1, 1.5, function()
self:ShowDetail(self.tbLevelData[self._panel.nSelectIndex], self._panel.nSelectIndex, false)
local imgSelect = self._mapNode.togRoot[self._panel.nSelectIndex].transform:Find("tog/AnimRoot/AnimSwitch/imgSelect")
imgSelect.gameObject:SetActive(true)
if self._panel.nSelectIndex > 4 then
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, 194, layoutRight, -32, 0)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
local moveTime = 0.2
local moveX = -325 - 340 * (self._panel.nSelectIndex - 5)
self._mapNode.rt_ToggleTrans:DOLocalMoveX(moveX, moveTime)
self._mapNode.Sp_BookScene:DOLocalMoveX(moveX, moveTime)
end
cs_coroutine.start(wait)
end
end, true, true, true)
EventManager.Hit(EventId.TemporaryBlockInput, 1.5)
else
EventManager.Hit(EventId.TemporaryBlockInput, 1)
end
SpineManager.PlayAnim(self._mapNode.Sp_BookScene.gameObject, "in", false)
SpineManager.PlayAnim(self._mapNode.Sp_BookSceneFront, "in_Front", false)
self:AddTimer(1, 1, function()
SpineManager.PlayAnim(self._mapNode.Sp_BookScene.gameObject, "idle", true)
self._mapNode.Sp_BookSceneFront.gameObject:SetActive(false)
end, true, true, true)
function self.onScrollValueChanged(value)
self._mapNode.Sp_BookScene.localPosition = Vector3(self._mapNode.rt_ToggleTrans.localPosition.x, self._mapNode.Sp_BookScene.localPosition.y, 0)
end
self._mapNode.srToggle.onValueChanged:AddListener(self.onScrollValueChanged)
SpineManager.PlayAnim(self._mapNode.charSpine, "in", false)
self:AddTimer(1, 0.9, function()
SpineManager.PlayAnim(self._mapNode.charSpine, "idle", true)
end, true, true, true)
end
function MathParkourLevelSelectCtrl:OnDisable()
if self.onScrollValueChanged ~= nil then
self._mapNode.srToggle.onValueChanged:RemoveListener(self.onScrollValueChanged)
self.onScrollValueChanged = nil
end
end
function MathParkourLevelSelectCtrl:RefreshLevelList()
self.actData = PlayerData.Activity:GetActivityDataById(self.nActId)
if self.actData == nil then
return
end
self.tbLevelData = self.actData:GetAllLevelData()
for i = 1, 7 do
local levelData = self.tbLevelData[i]
if levelData ~= nil then
self:SetLevelToggle(levelData, self._mapNode.togRoot[i], i)
self._mapNode.togRoot[i]:SetActive(true)
else
self._mapNode.togRoot[i]:SetActive(false)
end
end
end
function MathParkourLevelSelectCtrl:OnEvent_LevelUpdate()
self:RefreshLevelList()
end
function MathParkourLevelSelectCtrl:OnDestroy()
if PlayerData.Activity:IsActivityInActivityGroup(self.nActId) 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.UnRegisterNode(RedDotDefine.Activity_Group_Task_Group, {
actGroupId,
taskActId,
mapActivityData.MiniGameRedDot
}, self._mapNode.reward_reddot)
return
end
end
end
function MathParkourLevelSelectCtrl:SetLevelToggle(levelData, toggle, nIndex)
local rt_Targets = toggle.transform:Find("tog/grpText/rt_Targets")
local rtLockPreLv = toggle.transform:Find("tog/grpText/rtLockPreLv")
local txt_Open = toggle.transform:Find("tog/AnimRoot/AnimSwitch/txt_Open"):GetComponent("TextMeshProUGUI")
local txt_Lock = toggle.transform:Find("tog/AnimRoot/AnimSwitch/txt_Lock"):GetComponent("TextMeshProUGUI")
local levelUnlock = self.actData:GetLevelUnlock(levelData.nId)
local tog = toggle.transform:Find("tog"):GetComponent("UIButton")
tog.onClick:RemoveAllListeners()
rt_Targets.gameObject:SetActive(levelUnlock)
rtLockPreLv.gameObject:SetActive(not levelUnlock)
txt_Open.gameObject:SetActive(levelUnlock)
txt_Lock.gameObject:SetActive(not levelUnlock)
local sLevelIndex = string.format("%02d", nIndex)
NovaAPI.SetTMPText(txt_Open, sLevelIndex)
NovaAPI.SetTMPText(txt_Lock, sLevelIndex)
local imgSelect = toggle.transform:Find("tog/AnimRoot/AnimSwitch/imgSelect")
imgSelect.gameObject:SetActive(false)
if not levelUnlock then
return
end
for i = 1, 3 do
local btnTarget = rt_Targets.transform:Find("btnTarget" .. i):GetComponent("Button")
btnTarget.interactable = i <= levelData.nStar
end
tog.onClick:AddListener(function()
self:ShowDetail(levelData, nIndex, true)
imgSelect.gameObject:SetActive(true)
end)
local bNewDot = toggle.transform:Find("tog/AnimRoot/AnimSwitch/redH")
RedDotManager.RegisterNode(RedDotDefine.Activity_MathParkour_New_Level, {
self.nActId,
levelData.nId
}, bNewDot)
end
function MathParkourLevelSelectCtrl:ShowDetail(levelData, nIndex, bScroll)
local tempIndex = self._panel.nSelectIndex
if 0 < tempIndex then
local imgSelect = self._mapNode.togRoot[tempIndex].transform:Find("tog/AnimRoot/AnimSwitch/imgSelect")
imgSelect.gameObject:SetActive(false)
end
self._panel.nSelectIndex = nIndex
self._mapNode.levelDetail:ShowPanel(self.nActId, levelData)
if bScroll and 4 < nIndex then
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, 194, layoutRight, -32, 0)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
local moveTime = 0.2
local moveX = -325 - 340 * (nIndex - 5)
self._mapNode.rt_ToggleTrans:DOLocalMoveX(moveX, moveTime)
self._mapNode.Sp_BookScene:DOLocalMoveX(moveX, moveTime)
end
cs_coroutine.start(wait)
end
end
function MathParkourLevelSelectCtrl:OnBtnClick_CloseBg()
local tempIndex = self._panel.nSelectIndex
if 0 < tempIndex then
local imgSelect = self._mapNode.togRoot[tempIndex].transform:Find("tog/AnimRoot/AnimSwitch/imgSelect")
imgSelect.gameObject:SetActive(false)
end
self._panel.nSelectIndex = 0
self._mapNode.levelDetail:ClosePanel()
local moveTime = 0.2
EventManager.Hit(EventId.TemporaryBlockInput, moveTime)
local layout = layoutRight
self.tweener = DOTween.To(function()
return layout
end, function(v)
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, 194, math.floor(v), -32, 0)
end, layoutRightDefault, moveTime):OnComplete(function()
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, 194, layoutRightDefault, -32, 0)
end)
end
function MathParkourLevelSelectCtrl:OnBtnClick_Task()
if PlayerData.Activity:IsActivityInActivityGroup(self.nActId) 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
EventManager.Hit(EventId.OpenPanel, PanelId.Task_20104, taskActId, GameEnum.ActivityTaskTabType.Tab4)
return
end
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
end
return MathParkourLevelSelectCtrl
@@ -0,0 +1,80 @@
local MathParkourPauseCtrl = class("MathParkourPauseCtrl", BaseCtrl)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
MathParkourPauseCtrl._mapNodeConfig = {
blur = {},
txt_title = {
sComponentName = "TMP_Text",
sLanguageId = "TowerDef_Text_Pause"
},
txt_exit = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "TowerDef_Button_Leave"
},
txt_restart = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "TowerDef_Button_Re"
},
txt_continue = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "TowerDef_Button_Back"
},
txt_dic = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "Tutorial_DicTitle"
},
btn_exit = {
sComponentName = "NaviButton",
callback = "OnBtnClick_Exit",
sAction = "Giveup"
},
btn_restart = {
sComponentName = "NaviButton",
callback = "OnBtnClick_Restart",
sAction = "Retry"
},
btn_continue = {
sComponentName = "NaviButton",
callback = "OnBtnClick_Continue",
sAction = "Back"
},
btn_dic = {
sComponentName = "NaviButton",
callback = "OnBtnClick_OpenDic",
sAction = "Depot"
}
}
MathParkourPauseCtrl._mapEventConfig = {}
MathParkourPauseCtrl._mapRedDotConfig = {}
function MathParkourPauseCtrl:Awake()
end
function MathParkourPauseCtrl:Open(nDicId)
self.nDicId = nDicId
self.gameObject:SetActive(true)
self._mapNode.btn_dic.gameObject:SetActive(0 < nDicId)
self.tbGamepadUINode = self:GetGamepadUINode()
GamepadUIManager.EnableGamepadUI("MathParkourPauseCtrl", self.tbGamepadUINode, nil, false)
end
function MathParkourPauseCtrl:Close()
GamepadUIManager.DisableGamepadUI("MathParkourPauseCtrl")
self.gameObject:SetActive(false)
end
function MathParkourPauseCtrl:OnBtnClick_Exit()
EventManager.Hit("MathParkour_Exit_OnClick")
end
function MathParkourPauseCtrl:OnBtnClick_Restart()
EventManager.Hit("MathParkour_Restart_OnClick")
end
function MathParkourPauseCtrl:OnBtnClick_Continue()
EventManager.Hit("MathParkour_Continue_OnClick")
end
function MathParkourPauseCtrl:OnBtnClick_OpenDic()
if self.nDicId == 0 then
return
end
EventManager.Hit(EventId.OpenPanel, PanelId.DictionaryEntry, self.nDicId, true)
end
return MathParkourPauseCtrl
@@ -0,0 +1,45 @@
local MathParkourResultFailCtrl = class("MathParkourResultFailCtrl", BaseCtrl)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
MathParkourResultFailCtrl._mapNodeConfig = {
txtCompleteTipsPrev1 = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Text_CompleteTipsPrev"
},
txt_Complete = {sComponentName = "TMP_Text"},
btn_Confirm = {
sComponentName = "UIButton",
callback = "OnBtnClick_Confirm"
},
txt_confirm = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Text_Confirm"
},
btn_Again = {
sComponentName = "UIButton",
callback = "OnBtnClick_Again"
},
txt_again = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Text_Again"
}
}
MathParkourResultFailCtrl._mapEventConfig = {}
MathParkourResultFailCtrl._mapRedDotConfig = {}
function MathParkourResultFailCtrl:ShowPanel(nScore)
self.gameObject:SetActive(true)
NovaAPI.SetTMPText(self._mapNode.txt_Complete, nScore)
self.tbGamepadUINode = self:GetGamepadUINode()
GamepadUIManager.EnableGamepadUI("MathParkourResultFailCtrl", self.tbGamepadUINode, nil, true)
end
function MathParkourResultFailCtrl:HidePanel()
self.gameObject:SetActive(false)
end
function MathParkourResultFailCtrl:OnBtnClick_Confirm()
GamepadUIManager.DisableGamepadUI("MathParkourResultFailCtrl")
EventManager.Hit("MathParkour_Confirm")
end
function MathParkourResultFailCtrl:OnBtnClick_Again()
GamepadUIManager.DisableGamepadUI("MathParkourResultFailCtrl")
EventManager.Hit("MathParkour_Again")
end
return MathParkourResultFailCtrl
@@ -0,0 +1,67 @@
local MathParkourResultSuccessCtrl = class("MathParkourResultSuccessCtrl", BaseCtrl)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
MathParkourResultSuccessCtrl._mapNodeConfig = {
txtCompleteTipsPrev1 = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_StarTitle"
},
ScoreStar = {nCount = 3},
txtCompleteTipsPrev2 = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Text_CompleteTipsPrev"
},
txt_Complete = {sComponentName = "TMP_Text"},
txt_curScore = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Text_NewScore"
},
btn_Confirm = {
sComponentName = "UIButton",
callback = "OnBtnClick_Confirm"
},
txt_confirm = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Text_Confirm"
},
btn_Nextlevel = {
sComponentName = "UIButton",
callback = "OnBtnClick_NextLevel"
},
txt_nextlevel = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Text_NextLevel"
}
}
MathParkourResultSuccessCtrl._mapEventConfig = {}
MathParkourResultSuccessCtrl._mapRedDotConfig = {}
function MathParkourResultSuccessCtrl:ShowPanel(nScore, bNew, nStarCount, bCanNextLevel, nActId)
self.gameObject:SetActive(true)
NovaAPI.SetTMPText(self._mapNode.txt_Complete, nScore)
self._mapNode.txt_curScore.gameObject:SetActive(bNew)
for i = 1, 3 do
self._mapNode.ScoreStar[i].gameObject:SetActive(i <= nStarCount)
end
bCanNextLevel = bCanNextLevel or false
self._mapNode.btn_Nextlevel.gameObject:SetActive(bCanNextLevel)
self.actData = PlayerData.Activity:GetActivityDataById(nActId)
if self.actData ~= nil then
EventManager.Hit(EventId.TemporaryBlockInput, 1)
self:AddTimer(1, 1, function()
self.actData:OpenTempChangeInfo()
end, true, true, true)
end
self.tbGamepadUINode = self:GetGamepadUINode()
GamepadUIManager.EnableGamepadUI("MathParkourResultSuccessCtrl", self.tbGamepadUINode, nil, true)
end
function MathParkourResultSuccessCtrl:HidePanel()
self.gameObject:SetActive(false)
end
function MathParkourResultSuccessCtrl:OnBtnClick_Confirm()
GamepadUIManager.DisableGamepadUI("MathParkourResultSuccessCtrl")
EventManager.Hit("MathParkour_Confirm")
end
function MathParkourResultSuccessCtrl:OnBtnClick_NextLevel()
GamepadUIManager.DisableGamepadUI("MathParkourResultSuccessCtrl")
EventManager.Hit("MathParkour_NextLevel")
end
return MathParkourResultSuccessCtrl
@@ -0,0 +1,113 @@
local MathParkourSkillDisplayCtrl = class("MathParkourSkillDisplayCtrl", BaseCtrl)
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
local ResTypeAny = GameResourceLoader.ResType.Any
local Path = require("path")
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
local LocalSettingData = require("GameCore.Data.LocalSettingData")
MathParkourSkillDisplayCtrl._mapNodeConfig = {
DisplayParent = {},
imgBgChar = {sComponentName = "Image"},
imgBgPortrait = {sComponentName = "Image"},
DisplayL2d = {sComponentName = "RawImage"},
animRoot = {sComponentName = "Animator", sNodeName = "animove"},
imgBgCharL2d = {}
}
MathParkourSkillDisplayCtrl._mapEventConfig = {
MathParkour_CastAssistSkill = "OnEvent_CastAssistSkill",
MathParkour_CastAssistSkillPause = "OnEvent_CastAssistSkillPause"
}
MathParkourSkillDisplayCtrl._mapRedDotConfig = {}
function MathParkourSkillDisplayCtrl:Awake()
end
function MathParkourSkillDisplayCtrl:OnEnable()
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.DisplayParent:SetActive(true)
NovaAPI.SetMaskAllDirty(self._mapNode.imgBgCharL2d)
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.DisplayParent:SetActive(false)
end
cs_coroutine.start(wait)
end
function MathParkourSkillDisplayCtrl:OnDisable()
end
function MathParkourSkillDisplayCtrl:OnDestroy()
self.tbInterruptedDisplay = nil
Actor2DManager.UnsetActor2D(false, 1, true)
end
function MathParkourSkillDisplayCtrl:InterrputAllDisplay()
self:InterrputAnim()
end
function MathParkourSkillDisplayCtrl:InterrputAnim()
if self.timer ~= nil then
self.timer:Cancel(false)
self.timer = nil
end
Actor2DManager.UnsetActor2D(false, 1, true)
self.callback = nil
self._mapNode.DisplayParent:SetActive(false)
end
function MathParkourSkillDisplayCtrl:UltimateDisplay(nCharId, nSkinId)
self:InitL2dRes(nCharId, nSkinId)
self:ShowSkill(nCharId, nSkinId)
end
function MathParkourSkillDisplayCtrl:InitL2dRes(nCharId, nSkinId)
local mapSkin = ConfigTable.GetData_CharacterSkin(nSkinId)
local sBodyName = string.format("%s_001", nSkinId)
self.LoadSprite(self._mapNode.imgBgPortrait, mapSkin.Portrait, sBodyName)
local mapCharDescCfg = ConfigTable.GetData("CharacterDes", nCharId)
local sColor
if mapCharDescCfg == nil then
sColor = ""
else
sColor = mapCharDescCfg.CharSkillColor == "" and mapCharDescCfg.CharColor or mapCharDescCfg.CharSkillColor
end
local _b, _color = ColorUtility.TryParseHtmlString(sColor)
NovaAPI.SetImageColor(self._mapNode.imgBgChar, _color)
end
function MathParkourSkillDisplayCtrl.LoadSprite(imgObj, sPath, sName)
local _sPath = string.format("%s/atlas_png/a/%s.png", Path.dirname(sPath), sName)
NovaAPI.SetImageSprite(imgObj, Settings.AB_ROOT_PATH .. _sPath)
end
function MathParkourSkillDisplayCtrl:ShowSkill(nCharId, nSkinId, callback)
if self.timer ~= nil then
self.timer:Cancel(false)
self.timer = nil
end
WwiseAudioMgr:PostEvent("ui_tip_support_ult")
self._mapNode.DisplayParent:SetActive(true)
NovaAPI.SetMaskAllDirty(self._mapNode.imgBgCharL2d)
self._mapNode.animRoot:Play("Empty")
self._mapNode.animRoot:Play("SubskillDisplay_moves_1")
self.gameObject.transform.localScale = Vector3.one
Actor2DManager.SetActor2D_ForSubSKill(PanelId.SubSkillDisplay, self._mapNode.DisplayL2d, nCharId, nSkinId, nil, nIdx)
Actor2DManager.PlayAnim("ultra", true, 1)
self.callback = callback
self.timer = self:AddTimer(1, 1.5, "ShowEnd", true, true, true, true)
end
function MathParkourSkillDisplayCtrl:ShowEnd()
if self.callback ~= nil and type(self.callback) == "function" then
self.callback()
end
Actor2DManager.UnsetActor2D(false, 1)
self.callback = nil
self._mapNode.DisplayParent:SetActive(false)
self.timer = nil
end
function MathParkourSkillDisplayCtrl:OnEvent_CastAssistSkillPause(bPause)
if bPause then
if self.callback ~= nil and type(self.callback) == "function" then
self.callback()
end
self:InterrputAllDisplay()
end
end
function MathParkourSkillDisplayCtrl:OnEvent_CastAssistSkill(nCharId, nSkinId)
self.UseLive2D = LocalSettingData.mapData.UseLive2D
if not (nCharId and nSkinId) or not self.UseLive2D then
return
end
self:UltimateDisplay(nCharId, nSkinId)
end
return MathParkourSkillDisplayCtrl
@@ -1,4 +1,5 @@
local PeriodicQuestCtrl_01 = class("PeriodicQuestCtrl_01", BaseCtrl)
local TimerManager = require("GameCore.Timer.TimerManager")
PeriodicQuestCtrl_01._mapNodeConfig = {
goCommon = {
sNodeName = "---Common---"
@@ -38,11 +39,24 @@ PeriodicQuestCtrl_01._mapNodeConfig = {
btnCharDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_CharPreview"
}
},
btnDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_Detail"
},
txtBtnDetail = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Btn_Detail"
},
goActTime = {},
txtActivityTime = {sComponentName = "TMP_Text"}
}
PeriodicQuestCtrl_01._mapEventConfig = {
RefreshPeriodicAct = "OnEvent_RefreshPeriodicAct"
}
function PeriodicQuestCtrl_01:OnDisable()
self:UnbindCtrl()
end
function PeriodicQuestCtrl_01:RefreshActInfo()
if self.activityCtrl ~= nil then
self.activityCtrl:RefreshQuestList()
@@ -108,24 +122,22 @@ function PeriodicQuestCtrl_01:InitActData(actData, bResetGroup)
self.nActId = actData:GetActId()
self.activityCtrl:InitActData(actData, bResetGroup)
self:RefreshActInfo()
self:SetTime()
end
function PeriodicQuestCtrl_01:ClearActivity()
self:UnbindCtrl()
end
function PeriodicQuestCtrl_01:Awake()
end
function PeriodicQuestCtrl_01:FadeIn()
end
function PeriodicQuestCtrl_01:FadeOut()
end
function PeriodicQuestCtrl_01:OnEnable()
end
function PeriodicQuestCtrl_01:OnDisable()
self:UnbindCtrl()
end
function PeriodicQuestCtrl_01:OnDestroy()
end
function PeriodicQuestCtrl_01:OnRelease()
function PeriodicQuestCtrl_01:SetTime()
local actCfg = self.actData:GetActCfgData()
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
self._mapNode.goActTime.gameObject:SetActive(false)
else
self._mapNode.goActTime.gameObject:SetActive(true)
self:RefreshRemainTime()
if nil == self.remainTimer then
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
end
end
end
function PeriodicQuestCtrl_01:OnBtnClick_Receive()
local callback = function()
@@ -169,4 +181,60 @@ function PeriodicQuestCtrl_01:OnBtnClick_CharPreview()
end
end
end
function PeriodicQuestCtrl_01:OnBtnClick_Detail()
local perQuestActCfg = self.actData:GetPerQuestCfg()
local msg = {
nType = AllEnum.MessageBox.Desc,
sContent = perQuestActCfg.DesText,
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
}
EventManager.Hit(EventId.OpenMessageBox, msg)
end
function PeriodicQuestCtrl_01:RefreshRemainTime()
local endTime = self.actData:GetActEndTime()
local curTime = CS.ClientManager.Instance.serverTimeStamp
local remainTime = endTime - curTime
if remainTime < 0 then
TimerManager.Remove(self.remainTimer)
self.remainTimer = nil
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Alert,
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
callbackConfirm = function()
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
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.txtActivityTime, orderedFormat(ConfigTable.GetUIText("PerActivity_Remain_Time") or "", sTimeStr))
end
return PeriodicQuestCtrl_01
@@ -0,0 +1,126 @@
local PeriodicQuestCtrl_cover = class("PeriodicQuestCtrl_cover", BaseCtrl)
local TimerManager = require("GameCore.Timer.TimerManager")
PeriodicQuestCtrl_cover._mapNodeConfig = {
goCommon = {
sNodeName = "---Common---"
},
btnDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_Detail"
},
txtBtnDetail = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Btn_Detail"
},
txtActivityTitle = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_CopyMemo"
},
goActTime = {},
txtActivityTime = {sComponentName = "TMP_Text"}
}
PeriodicQuestCtrl_cover._mapEventConfig = {
RefreshPeriodicAct = "OnEvent_RefreshPeriodicAct"
}
function PeriodicQuestCtrl_cover:OnDisable()
self:UnbindCtrl()
end
function PeriodicQuestCtrl_cover:RefreshActInfo()
if self.activityCtrl ~= nil then
self.activityCtrl:RefreshQuestList()
end
end
function PeriodicQuestCtrl_cover:UnbindCtrl()
if self.activityCtrl ~= nil then
self:UnbindCtrlByNode(self.activityCtrl)
self.activityCtrl = nil
end
end
function PeriodicQuestCtrl_cover:InitActData(actData, bResetGroup)
if self.activityCtrl == nil then
self.activityCtrl = self:BindCtrlByNode(self._mapNode.goCommon, "Game.UI.Activity.PeriodicQuest.PeriodicQuestCtrl")
end
self.actData = actData
self.nActId = actData:GetActId()
self.activityCtrl:InitActData(actData, bResetGroup)
self:RefreshActInfo()
self:SetTime()
end
function PeriodicQuestCtrl_cover:ClearActivity()
self:UnbindCtrl()
end
function PeriodicQuestCtrl_cover:SetTime()
local actCfg = self.actData:GetActCfgData()
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
self._mapNode.goActTime.gameObject:SetActive(false)
else
self._mapNode.goActTime.gameObject:SetActive(true)
self:RefreshRemainTime()
if nil == self.remainTimer then
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
end
end
end
function PeriodicQuestCtrl_cover:OnEvent_RefreshPeriodicAct(nActId)
if nActId == self.nActId then
self.bQuestAnim = false
self:RefreshActInfo()
end
end
function PeriodicQuestCtrl_cover:OnBtnClick_Detail()
local perQuestActCfg = self.actData:GetPerQuestCfg()
local msg = {
nType = AllEnum.MessageBox.Desc,
sContent = perQuestActCfg.DesText,
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
}
EventManager.Hit(EventId.OpenMessageBox, msg)
end
function PeriodicQuestCtrl_cover:RefreshRemainTime()
local endTime = self.actData:GetActEndTime()
local curTime = CS.ClientManager.Instance.serverTimeStamp
local remainTime = endTime - curTime
if remainTime < 0 then
TimerManager.Remove(self.remainTimer)
self.remainTimer = nil
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Alert,
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
callbackConfirm = function()
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
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.txtActivityTime, sTimeStr)
end
return PeriodicQuestCtrl_cover
@@ -1,5 +1,4 @@
local PeriodicQuestCtrl = class("PeriodicQuestCtrl", BaseCtrl)
local TimerManager = require("GameCore.Timer.TimerManager")
PeriodicQuestCtrl._mapNodeConfig = {
loopSv = {
sNodeName = "srGuideQuest",
@@ -22,73 +21,36 @@ PeriodicQuestCtrl._mapNodeConfig = {
sComponentName = "UIButton",
callback = "OnBtnClick_GroupLock"
},
btnDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_Detail"
},
txtBtnDetail = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Btn_Detail"
},
btnQuickRec = {
sComponentName = "UIButton",
callback = "OnBtnClick_QuickRec"
},
btnCanNotQuickRec = {
sComponentName = "UIButton",
callback = "OnBtnClick_CannotQuickRec"
},
txtBtnQuickRec = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Btn_Quick_Receive"
},
goActTime = {},
txtActivityTime = {sComponentName = "TMP_Text"}
txtBtnCannotQuickRec = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Btn_Quick_Receive"
},
btnShop = {
sComponentName = "UIButton",
callback = "OnBtnClick_Shop"
},
btnGuideMission = {
sComponentName = "UIButton",
callback = "OnBtnClick_GuideMission"
},
txtBtnGuideMission = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_AvgReview"
}
}
PeriodicQuestCtrl._mapEventConfig = {}
function PeriodicQuestCtrl:RefreshRemainTime()
local endTime = self.actData:GetActEndTime()
local curTime = CS.ClientManager.Instance.serverTimeStamp
local remainTime = endTime - curTime
if remainTime < 0 then
TimerManager.Remove(self.remainTimer)
self.remainTimer = nil
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Alert,
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
callbackConfirm = function()
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
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.txtActivityTime, orderedFormat(ConfigTable.GetUIText("PerActivity_Remain_Time") or "", sTimeStr))
end
function PeriodicQuestCtrl:RefreshQuestList()
self.tbAllQuestList = self.actData:GetQuestListByGroup()
if nil == self.tbAllQuestList[self._panel.nSelectGroup] then
@@ -114,6 +76,7 @@ function PeriodicQuestCtrl:RefreshQuestList()
end
local _, _, canReceive = self.actData:GetQuestProgress()
self._mapNode.btnQuickRec.gameObject:SetActive(0 < canReceive)
self._mapNode.btnCanNotQuickRec.gameObject:SetActive(canReceive <= 0)
for k, v in ipairs(self._mapNode.PerActGroupItem) do
local nAllQuest, nReceivedQuest = self.actData:GetDayQuestStatus(k)
v:RefreshStatus(nAllQuest <= nReceivedQuest and 0 < nReceivedQuest)
@@ -186,27 +149,11 @@ function PeriodicQuestCtrl:InitActData(actData, bResetGroup)
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
return
end
local actCfg = self.actData:GetActCfgData()
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
self._mapNode.goActTime.gameObject:SetActive(false)
else
self._mapNode.goActTime.gameObject:SetActive(true)
self:RefreshRemainTime()
if nil == self.remainTimer then
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
end
end
end
function PeriodicQuestCtrl:Awake()
self.tbGridCtrl = {}
self.tbSequences = {}
end
function PeriodicQuestCtrl:FadeIn()
end
function PeriodicQuestCtrl:FadeOut()
end
function PeriodicQuestCtrl:OnEnable()
end
function PeriodicQuestCtrl:OnDisable()
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
@@ -214,10 +161,6 @@ function PeriodicQuestCtrl:OnDisable()
end
self.tbGridCtrl = {}
end
function PeriodicQuestCtrl:OnDestroy()
end
function PeriodicQuestCtrl:OnRelease()
end
function PeriodicQuestCtrl:OnBtnClick_Group(_, nIndex)
if self._panel.nSelectGroup == nIndex then
return
@@ -240,15 +183,6 @@ end
function PeriodicQuestCtrl:OnBtnClick_GroupLock()
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PerActivity_Not_Open"))
end
function PeriodicQuestCtrl:OnBtnClick_Detail()
local perQuestActCfg = self.actData:GetPerQuestCfg()
local msg = {
nType = AllEnum.MessageBox.Desc,
sContent = perQuestActCfg.DesText,
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
}
EventManager.Hit(EventId.OpenMessageBox, msg)
end
function PeriodicQuestCtrl:OnBtnClick_QuickRec()
local callback = function()
EventManager.Hit("RefreshPeriodicAct", self.nActId)
@@ -256,4 +190,19 @@ function PeriodicQuestCtrl:OnBtnClick_QuickRec()
end
PlayerData.Activity:SendReceivePerQuest(self.nActId, 0, callback)
end
function PeriodicQuestCtrl:OnBtnClick_CannotQuickRec()
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("InfinityTower_Reward_Tips"))
end
function PeriodicQuestCtrl:OnBtnClick_Shop()
EventManager.Hit(EventId.OpenPanel, PanelId.GuideMission, 3)
end
function PeriodicQuestCtrl:OnBtnClick_GuideMission()
local nActivityId = tonumber(self.actData:GetSpecialParam())
if type(nActivityId) == "number" then
local data = ConfigTable.GetData("ActivityStoryChapter", nActivityId)
if data ~= nil then
PlayerData.StoryReview:TryOpenStoryChapter(data.ChapterId)
end
end
end
return PeriodicQuestCtrl
@@ -1,54 +0,0 @@
local PeriodicQuestCtrl_02 = class("PeriodicQuestCtrl_02", BaseCtrl)
PeriodicQuestCtrl_02._mapNodeConfig = {
goCommon = {
sNodeName = "---Common---"
}
}
PeriodicQuestCtrl_02._mapEventConfig = {
RefreshPeriodicAct = "OnEvent_RefreshPeriodicAct"
}
function PeriodicQuestCtrl_02:RefreshActInfo()
if self.activityCtrl ~= nil then
self.activityCtrl:RefreshQuestList()
end
end
function PeriodicQuestCtrl_02:UnbindCtrl()
if self.activityCtrl ~= nil then
self:UnbindCtrlByNode(self.activityCtrl)
self.activityCtrl = nil
end
end
function PeriodicQuestCtrl_02:InitActData(actData, bResetGroup)
if self.activityCtrl == nil then
self.activityCtrl = self:BindCtrlByNode(self._mapNode.goCommon, "Game.UI.Activity.PeriodicQuest.PeriodicQuestCtrl")
end
self.actData = actData
self.nActId = actData:GetActId()
self.activityCtrl:InitActData(actData, bResetGroup)
self:RefreshActInfo()
end
function PeriodicQuestCtrl_02:ClearActivity()
self:UnbindCtrl()
end
function PeriodicQuestCtrl_02:Awake()
end
function PeriodicQuestCtrl_02:FadeIn()
end
function PeriodicQuestCtrl_02:FadeOut()
end
function PeriodicQuestCtrl_02:OnEnable()
end
function PeriodicQuestCtrl_02:OnDisable()
self:UnbindCtrl()
end
function PeriodicQuestCtrl_02:OnDestroy()
end
function PeriodicQuestCtrl_02:OnRelease()
end
function PeriodicQuestCtrl_02:OnEvent_RefreshPeriodicAct(nActId)
if nActId == self.nActId then
self.bQuestAnim = false
self:RefreshActInfo()
end
end
return PeriodicQuestCtrl_02
@@ -14,9 +14,16 @@ PeriodicQuestItemCtrl._mapNodeConfig = {
sComponentName = "UIButton",
callback = "OnBtnClick_Reward"
},
btnReward2 = {
sComponentName = "UIButton",
callback = "OnBtnClick_Reward2"
},
rtReward = {
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
},
rtReward2 = {
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
},
btnReceive = {
sComponentName = "UIButton",
callback = "OnBtnClick_Receive"
@@ -56,6 +63,9 @@ function PeriodicQuestItemCtrl:SetData(nActId, mapData)
self.nJumpTo = questCfg.JumpTo
self.rewardId = questCfg.Reward
self._mapNode.rtReward:SetItem(questCfg.Reward, nil, questCfg.RewardQty, nil, nil, nil, nil, true)
self.rewardId2 = questCfg.Reward2
self._mapNode.rtReward2:SetItem(questCfg.Reward2, nil, questCfg.RewardQty2, nil, nil, nil, nil, true)
self._mapNode.btnReward2.gameObject:SetActive(self.rewardId2 ~= 0)
self._mapNode.txtUnComplete.gameObject:SetActive(nStatus == AllEnum.ActQuestStatus.UnComplete and questCfg.JumpTo == 0)
self._mapNode.btnJump.gameObject:SetActive(nStatus == AllEnum.ActQuestStatus.UnComplete and questCfg.JumpTo ~= 0)
self._mapNode.btnReceive.gameObject:SetActive(nStatus == AllEnum.ActQuestStatus.Complete)
@@ -90,6 +100,11 @@ function PeriodicQuestItemCtrl:OnBtnClick_Reward(btn)
UTILS.ClickItemGridWithTips(self.rewardId, btn.transform, true, true, true)
end
end
function PeriodicQuestItemCtrl:OnBtnClick_Reward2(btn)
if nil ~= self.rewardId2 then
UTILS.ClickItemGridWithTips(self.rewardId2, btn.transform, true, true, true)
end
end
function PeriodicQuestItemCtrl:OnBtnClick_Receive()
local callback = function()
EventManager.Hit("RefreshPeriodicAct", self.nActId)
@@ -6,21 +6,6 @@ ActivityReengagement_101004PopUpCtrl._mapNodeConfig = {
sComponentName = "TMP_Text",
sLanguageId = "Reengagement_Popup_Tip"
},
btnActivity = {
sComponentName = "Button",
callback = "OnBtnClick_Goto"
},
goContent = {
sNodeName = "---Common---"
},
btnGo = {
sComponentName = "UIButton",
callback = "OnBtnClick_Goto"
},
txtBtnGo = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_PopUp_Goto_1"
},
goRewardItem = {
nCount = 4,
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
@@ -31,27 +16,50 @@ ActivityReengagement_101004PopUpCtrl._mapNodeConfig = {
sComponentName = "UIButton",
callback = "OnClickBtnRewardItem"
},
rtBtn = {}
rtBtn = {},
btnWelcome = {
sComponentName = "UIButton",
callback = "OnBtnClick_Welcome"
},
txtBtnWelcome = {
sComponentName = "TMP_Text",
sLanguageId = "Reengagement_Popup_Welcome"
}
}
ActivityReengagement_101004PopUpCtrl._mapEventConfig = {}
function ActivityReengagement_101004PopUpCtrl: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
local bCanReceive = PlayerData.Reengagement:CheckCanReceive()
self._mapNode.rtBtn:SetActive(bCanReceive)
local nActId = PlayerData.Reengagement:GetActId()
local mapActData = ConfigTable.GetData("ActivityReturneeReunionReward", nActId)
if mapActData == nil then
if self.callback ~= nil then
self.callback()
end
return
end
self._mapNode.rtBtn:SetActive(false)
local tbRewards = {}
self.tbItemReward = {}
for i = 1, 3 do
local nId = mapActData["Reward" .. i .. "Tid"]
local nQty = mapActData["Reward" .. i .. "Qty"]
if 0 < nId then
table.insert(tbRewards, {nId = nId, nQty = nQty})
table.insert(self.tbItemReward, nId)
end
end
for i = 1, #self._mapNode.goRewardItem do
local item = self._mapNode.goRewardItem[i]
item:SetItem(self.actCfg.reward[i])
if i <= #tbRewards then
item:SetItem(tbRewards[i].nId, nil, tbRewards[i].nQty)
self._mapNode.btnRewardItem[i].gameObject:SetActive(true)
else
self._mapNode.btnRewardItem[i].gameObject:SetActive(false)
end
end
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
self.anim = self.gameObject:GetComponent("Animator")
self:PlayOpenAnim()
end
@@ -79,9 +87,8 @@ end
function ActivityReengagement_101004PopUpCtrl:OnBtnClick_Goto()
local callback = function()
if nil ~= self.nCurActId then
PopUpManager.InterruptPopUp(self.popUpIndex)
PlayerData.Activity:SendActivityDetailMsg()
local endTime = self.nEndTime
local endTime = PlayerData.Reengagement:GetReengagementCloseTime()
local curTime = ClientManager.serverTimeStamp
local remainTime = endTime - curTime
if remainTime <= 0 then
@@ -91,13 +98,26 @@ function ActivityReengagement_101004PopUpCtrl:OnBtnClick_Goto()
end
return
end
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityPopUp)
EventManager.Hit(EventId.OpenPanel, PanelId.ActivityList, self.nCurActId)
PopUpManager.PauseAfterCurrent()
local openAct = function()
EventManager.Hit(EventId.OpenPanel, PanelId.ReengagementPanel)
end
if self.callback ~= nil then
self.callback(openAct, true)
else
openAct()
end
end
end
self:ClosePopUp(callback)
end
function ActivityReengagement_101004PopUpCtrl:OnClickBtnRewardItem(btn, index)
UTILS.ClickItemGridWithTips(self.tbItemReward[index], self._mapNode.goRewardItem[index].transform, true, true, false)
UTILS.ClickItemGridWithTips(self.tbItemReward[index], self._mapNode.btnRewardItem[index].transform, true, true, false)
end
function ActivityReengagement_101004PopUpCtrl:OnBtnClick_Welcome()
local cb = function()
self:OnBtnClick_Goto()
end
PlayerData.Reengagement:RequestReceiveReunionReward(cb)
end
return ActivityReengagement_101004PopUpCtrl
@@ -0,0 +1,21 @@
local ActivityReengagementPopUpPanel = class("ActivityReengagementPopUpPanel", BasePanel)
ActivityReengagementPopUpPanel._bIsMainPanel = false
ActivityReengagementPopUpPanel._tbDefine = {
{
sPrefabPath = "ActivityList/ActivityPopUpPanel.prefab",
sCtrlName = "Game.UI.Activity.Reengagement.ReengagementPopUpCtrl"
}
}
function ActivityReengagementPopUpPanel:Awake()
end
function ActivityReengagementPopUpPanel:OnEnable()
end
function ActivityReengagementPopUpPanel:OnAfterEnter()
end
function ActivityReengagementPopUpPanel:OnDisable()
end
function ActivityReengagementPopUpPanel:OnDestroy()
end
function ActivityReengagementPopUpPanel:OnRelease()
end
return ActivityReengagementPopUpPanel
@@ -25,6 +25,8 @@ ReengagementBDPreviewCtrl._mapNodeConfig = {
sComponentName = "TMP_Text",
sLanguageId = "Quest_WorldClass_Level"
},
txtLevel = {sComponentName = "TMP_Text"},
imgExpBar = {sComponentName = "Image"},
svAll = {
sComponentName = "LoopScrollView"
}
@@ -41,15 +43,26 @@ function ReengagementBDPreviewCtrl:OpenPanel()
self:InitPanel()
self._mapNode.animRoot:Play("t_window_04_t_in")
end
cs_coroutine.start(wait)
end
function ReengagementBDPreviewCtrl:InitPanel()
self.tbLevelInterval = {}
local foreachData = function(mapData)
table.insert(self.tbLevelInterval, mapData)
end
ForEachTableLine(ConfigTable.GetData("ReengagementBDTrial"), foreachData)
ForEachTableLine(ConfigTable.Get("ActivityReturneeTrialBuildGroup"), foreachData)
table.sort(self.tbLevelInterval, function(a, b)
return a.LevelMin < b.LevelMin
end)
self.nWorldLevel = PlayerData.Base:GetWorldClass()
NovaAPI.SetTMPText(self._mapNode.txtLevel, self.nWorldLevel)
local nCurExp = PlayerData.Base:GetWorldExp()
local mapCfg = ConfigTable.GetData("WorldClass", self.nWorldLevel + 1, true)
local nFullExp = 0
if mapCfg ~= nil then
nFullExp = mapCfg.Exp
NovaAPI.SetImageFillAmount(self._mapNode.imgExpBar, nCurExp / nFullExp)
end
self._mapNode.svAll:Init(#self.tbLevelInterval, self, self.OnGridRefresh)
end
function ReengagementBDPreviewCtrl:OnGridRefresh(goGrid, nGridIndex)
@@ -58,7 +71,7 @@ function ReengagementBDPreviewCtrl:OnGridRefresh(goGrid, nGridIndex)
local imgOnBg = goGrid.transform:Find("imgOnBg").gameObject
local imgOffBg = goGrid.transform:Find("imgOffBg").gameObject
local imgSelect = goGrid.transform:Find("imgSelect").gameObject
if self.nWorldLevel >= mapData.MinLevel and self.nWorldLevel <= mapData.MaxLevel then
if self.nWorldLevel >= mapData.LevelMin and (mapData.LevelMax == -1 or self.nWorldLevel <= mapData.LevelMax) then
imgOnBg:SetActive(true)
imgOffBg:SetActive(false)
imgSelect:SetActive(true)
@@ -69,13 +82,20 @@ function ReengagementBDPreviewCtrl:OnGridRefresh(goGrid, nGridIndex)
end
local txtDesc = goGrid.transform:Find("txtDesc"):GetComponent("TMP_Text")
if txtDesc ~= nil then
local nLevelMin = math.max(1, mapData.LevelMin)
local nLevelMax = PlayerData.Base:GetMaxWorldClass()
if mapData.LevelMax ~= -1 then
nLevelMax = math.min(nLevelMax, mapData.LevelMax)
end
local sText = ConfigTable.GetUIText("Reengagement_BDTrialPreview_WorldClass")
sText = sText .. mapData.MinLevel .. "~" .. mapData.MaxLevel
sText = sText .. nLevelMin .. "~" .. nLevelMax
NovaAPI.SetTMPText(txtDesc, sText)
end
local imgIcon = goGrid.transform:Find("imgIcon"):GetComponent("Image")
if imgIcon ~= nil then
self:SetPngSprite(imgIcon, mapData.Icon)
local rank = PlayerData.Build:CalBuildRank(mapData.Score)
local sScore = "Icon/BuildRank/BuildRank_" .. rank.Id
self:SetPngSprite(imgIcon, sScore)
end
end
function ReengagementBDPreviewCtrl:ClosePanel()
@@ -17,14 +17,10 @@ ReengagementBDPreviewItemCtrl._mapNodeConfig = {
imgCharFrame = {nCount = 3, sComponentName = "Image"},
txtPotentialCount = {nCount = 3, sComponentName = "TMP_Text"},
imgCharElement = {nCount = 3, sComponentName = "Image"},
txtChar = {
sComponentName = "TMP_Text",
sLanguageId = "StarTower_Build_Char_Title"
},
imgIcon = {sComponentName = "Image"},
txtRating = {
sComponentName = "TMP_Text",
sLanguageId = "StarTower_Build_Rating"
sLanguageId = "Template_Score"
}
}
ReengagementBDPreviewItemCtrl._mapEventConfig = {}
@@ -54,7 +50,7 @@ function ReengagementBDPreviewItemCtrl:RefreshChar()
local mapCharData = self.mapBuildData.tbChar[i]
local nCharTid = mapCharData ~= nil and mapCharData.nTid or 0
local mapCharCfg = 0 < nCharTid and ConfigTable.GetData_Character(nCharTid) or nil
local nCharSkinId = 0 < nCharTid and PlayerData.Char:GetCharSkinId(nCharTid) or 0
local nCharSkinId = 0 < nCharTid and PlayerData.Build:GetBuildCharSkinId(self.mapBuildData, mapCharData) or 0
local mapCharSkin = 0 < nCharSkinId and ConfigTable.GetData_CharacterSkin(nCharSkinId) or nil
local bShowChar = mapCharCfg ~= nil and mapCharSkin ~= nil
self._mapNode.imgCharIcon[i].gameObject:SetActive(bShowChar)
@@ -1,4 +1,6 @@
local ReengagementBDTrialCtrl = class("ReengagementBDTrialCtrl", BaseCtrl)
local TimerManager = CS.TimerManager.Instance
local ClientManager = CS.ClientManager.Instance
ReengagementBDTrialCtrl._mapNodeConfig = {
txtActName = {
sComponentName = "TMP_Text",
@@ -15,30 +17,72 @@ ReengagementBDTrialCtrl._mapNodeConfig = {
goInstanceItem = {
nCount = 6,
sCtrlName = "Game.UI.Activity.Reengagement.ReengagementBDPreviewItemCtrl"
}
},
txtTime = {sComponentName = "TMP_Text"}
}
ReengagementBDTrialCtrl._mapEventConfig = {}
function ReengagementBDTrialCtrl:Refresh(nCurTog)
if nCurTog ~= AllEnum.ReengagementTog.BDTrial then
return
end
self:RefreshTrialItems()
self:RefreshRemainTime()
if nil == self.remainTimer then
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
end
end
function ReengagementBDTrialCtrl:RefreshTrialItems()
self.nWorldLevel = PlayerData.Base:GetWorldClass()
self.mapTrialBuildData = {}
local foreachMapData = function(mapData)
if self.nWorldLevel >= mapData.MinLevel and self.nWorldLevel <= mapData.MaxLevel then
self.mapTrialBuildData = mapData
end
end
ForEachTableLine(ConfigTable.Get("ReengagementBDTrial"), foreachMapData)
if self.mapTrialBuildData == {} then
return
end
self.tbBuildIds = self.mapTrialBuildData.BuildIds
self.tbBuildIds = PlayerData.Reengagement:GetLimitedTrialBuildList()
for k, nBuildId in ipairs(self.tbBuildIds) do
local itemCtrl = self.goInstanceItem[k]
local itemCtrl = self._mapNode.goInstanceItem[k]
itemCtrl:Refresh(nBuildId)
end
end
function ReengagementBDTrialCtrl:RefreshRemainTime()
local endTime = PlayerData.Reengagement:GetReengagementCloseTime()
local curTime = ClientManager.serverTimeStamp
local remainTime = endTime - curTime
if remainTime < 0 then
TimerManager.Remove(self.remainTimer)
self.remainTimer = nil
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Alert,
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
callbackConfirm = function()
EventManager.Hit(EventId.ClosePanel, PanelId.ReengagementPanel)
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
return ReengagementBDTrialCtrl
@@ -1,6 +1,11 @@
local ReengagementCtrl = class("ReengagementCtrl", BaseCtrl)
local TimerManager = require("GameCore.Timer.TimerManager")
local nTogCount = 5
ReengagementCtrl._mapNodeConfig = {
TopBar = {
sNodeName = "TopBarPanel",
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
},
svTog = {
sComponentName = "LoopScrollView"
},
@@ -56,21 +61,80 @@ ReengagementCtrl._mapNodeConfig = {
sCtrlName = "Game.UI.Activity.Reengagement.ReengagementBDPreviewCtrl"
}
}
ReengagementCtrl._mapEventConfig = {}
ReengagementCtrl._mapEventConfig = {
[EventId.IsNewDay] = "OnEvent_NewDay"
}
local mapReddotKey = {
[1] = RedDotDefine.Activity_Reengagement_LoginReward,
[2] = RedDotDefine.Activity_Reengagement_Task,
[4] = RedDotDefine.Activity_Reengagement_WeeklyCard
}
function ReengagementCtrl:ClearTogCtrl()
if self.ctrlTog == nil then
self.ctrlTog = {}
return
end
for nInstanceID, objCtrl in pairs(self.ctrlTog) do
objCtrl:UnRegisterReddot()
self:UnbindCtrlByNode(objCtrl)
self.ctrlTog[nInstanceID] = nil
end
end
function ReengagementCtrl:InitTog()
self._mapNode.svTog:Init(5, self, self.OnGridRefresh, self.OnGridBtnClick)
self:ClearTogCtrl()
if self.nCurTog == nil or self.nCurTog < 1 or self.nCurTog > nTogCount then
self.nCurTog = self:GetDefaultTog()
end
self._mapNode.svTog:Init(nTogCount, self, self.OnGridRefresh, self.OnGridBtnClick)
end
function ReengagementCtrl:GetDefaultTog()
for nIndex = 1, nTogCount do
local sReddotKey = mapReddotKey[nIndex]
if sReddotKey ~= nil and RedDotManager.GetValid(sReddotKey, {
self.nActId
}) then
return nIndex
end
end
local mapLoginReward = PlayerData.Reengagement:GetActLoginRewardList()
if mapLoginReward == nil or (tonumber(mapLoginReward.Actual) or 0) < 7 then
return 1
end
for nDay = 1, 7 do
local tbQuestConfig = PlayerData.Reengagement:GetQuestConfigDataByGroup(100 + nDay)
if #tbQuestConfig == 0 then
return 2
end
for _, mapQuestConfig in ipairs(tbQuestConfig) do
local mapQuest = PlayerData.Reengagement:GetQuestDataById(mapQuestConfig.Id)
if mapQuest == nil or mapQuest.nStatus ~= 1 and mapQuest.nStatus ~= 2 then
return 2
end
end
end
if 0 < PlayerData.Reengagement:GetDoubleDropCount() then
return 3
end
return 1
end
function ReengagementCtrl: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")
self.ctrlTog[nInstanceID] = self:BindCtrlByNode(goGrid, "Game.UI.Activity.Reengagement.TemplateToggleReengagementCtrl")
end
local mapCfg = ConfigTable.GetUIText("ReengagementTog_" .. nIndex)
if mapCfg then
self.ctrlTog[nInstanceID]:SetText(mapCfg)
end
self.ctrlTog[nInstanceID]:SetDefault(nIndex == self.nCurTog)
local sReddotKey = mapReddotKey[nIndex]
self.ctrlTog[nInstanceID]:SetReddot(sReddotKey, {
self.nActId
})
if self.nCurTog == nIndex then
self.ctrlTog[nInstanceID]:SetTrigger(true)
end
end
function ReengagementCtrl:OnGridBtnClick(goGrid, gridIndex)
local nIndex = gridIndex + 1
@@ -78,27 +142,35 @@ function ReengagementCtrl:OnGridBtnClick(goGrid, gridIndex)
if nIndex == self.nCurTog then
return
end
self.ctrlTog[nInstanceID]:SetTrigger(true)
if self.nCurTog then
if self.ctrlTog[nInstanceID] ~= nil then
self.ctrlTog[nInstanceID]:SetTrigger(true)
end
if self.nCurTog ~= nil and self.nCurTog > 0 then
local goSelect = self._mapNode.trSvTog:Find("Viewport/Content/" .. self.nCurTog - 1)
if goSelect then
self.ctrlTog[goSelect.gameObject:GetInstanceID()]:SetTrigger(false)
local objCurTog = self.ctrlTog[goSelect.gameObject:GetInstanceID()]
if objCurTog ~= nil then
objCurTog:SetTrigger(false)
end
end
end
self.nCurTog = nIndex
self:SwitchTog()
self:SwitchTog(self._bInfoReady == true)
end
function ReengagementCtrl:SwitchTog()
self._mapNode.rtSignin:SetActive(self.nCurTog == 1)
self._mapNode.rtTask:SetActive(self.nCurTog == 2)
self._mapNode.rtDoubleDrop:SetActive(self.nCurTog == 3)
self._mapNode.rtShopMall:SetActive(self.nCurTog == 4)
self._mapNode.rtBDTrial:SetActive(self.nCurTog == 5)
self.ctrlSignin:Refresh(self.nCurTog)
self.ctrlTask:Refresh(self.nCurTog)
self.ctrlDoubleDrop:Refresh(self.nCurTog)
self.ctrlShopMall:Refresh(self.nCurTog)
self.ctrlBDTrial:Refresh(self.nCurTog)
function ReengagementCtrl:SwitchTog(bRefreshData)
self._mapNode.rtSignin.gameObject:SetActive(self.nCurTog == 1)
self._mapNode.rtTask.gameObject:SetActive(self.nCurTog == 2)
self._mapNode.rtDoubleDrop.gameObject:SetActive(self.nCurTog == 3)
self._mapNode.rtShopMall.gameObject:SetActive(self.nCurTog == 4)
self._mapNode.rtBDTrial.gameObject:SetActive(self.nCurTog == 5)
if bRefreshData ~= true then
return
end
self._mapNode.ctrlSignin:Refresh(self.nCurTog)
self._mapNode.ctrlTask:Refresh(self.nCurTog)
self._mapNode.ctrlDoubleDrop:Refresh(self.nCurTog)
self._mapNode.ctrlShopMall:Refresh(self.nCurTog)
self._mapNode.ctrlBDTrial:Refresh(self.nCurTog)
end
local nMaxEnergyBatteryFillerLength = 252
local nMinEnergyBatteryFillerLength = 15
@@ -115,23 +187,65 @@ function ReengagementCtrl:RefreshEnergyBattery()
self._mapNode.imgEnergyBarFill.sizeDelta = Vector2(nFillerLength, self._mapNode.imgEnergyBarFill.sizeDelta.y)
end
function ReengagementCtrl:Awake()
self.ctrlTog = {}
if self._bInfoReady == nil then
self._bInfoReady = false
end
end
function ReengagementCtrl:FadeIn()
end
function ReengagementCtrl:FadeOut()
end
function ReengagementCtrl:OnEnable()
self.nCurTog = 1
self:SwitchTog()
local nActId = PlayerData.Reengagement:GetActId()
local nOpenTime = PlayerData.Reengagement:GetReengagementOpenTime()
if self.nActId ~= nActId or self._nActOpenTime ~= nOpenTime then
self._bInfoReady = false
self.nCurTog = 0
self._panel.nSelectGroup = nil
end
self.nActId = nActId
self._nActOpenTime = nOpenTime
self.nCurTog = self.nCurTog or 0
self._mapNode.svTog.gameObject:SetActive(false)
self:SwitchTog(false)
self:RefreshEnergyBattery()
local init = function()
self._bInfoReady = true
if self._panel == nil or self._panel._bIsActive ~= true then
return
end
self._mapNode.svTog.gameObject:SetActive(true)
self:InitTog()
self:SwitchTog(true)
end
if self._bInfoReady == false then
PlayerData.Reengagement:RequestReengagementInfo(init)
else
init()
end
end
function ReengagementCtrl:OnDisable()
self:ClearTogCtrl()
end
function ReengagementCtrl:OnDestroy()
end
function ReengagementCtrl:OnRelease()
end
function ReengagementCtrl:OnClickTrialDetail()
self.ReengagementPreviewPanel:OpenPanel()
self._mapNode.ReengagementPreviewPanel:OpenPanel()
end
function ReengagementCtrl:OnEvent_NewDay()
if PanelManager.GetCurPanelId() == PanelId.MainView then
EventManager.Hit("NewDay_Clear_Guide")
local msg = {
nType = AllEnum.MessageBox.Alert,
sContent = ConfigTable.GetUIText("Alert_NextDay"),
callbackConfirm = function()
PanelManager.Home()
end
}
EventManager.Hit(EventId.OpenMessageBox, msg)
end
end
return ReengagementCtrl
@@ -1,3 +1,4 @@
local ClientManager = CS.ClientManager.Instance
local ReengagementDoubleDropCtrl = class("ReengagementDoubleDropCtrl", BaseCtrl)
ReengagementDoubleDropCtrl._mapNodeConfig = {
txtActName = {
@@ -30,8 +31,7 @@ ReengagementDoubleDropCtrl._mapNodeConfig = {
nCount = 4,
sComponentName = "TMP_Text",
sLanguageId = "Double_Drops_Goto_Instance"
},
redDotQuest = {}
}
}
ReengagementDoubleDropCtrl._mapEventConfig = {}
function ReengagementDoubleDropCtrl:Refresh(nCurTog)
@@ -40,10 +40,15 @@ function ReengagementDoubleDropCtrl:Refresh(nCurTog)
end
self:InitActData()
end
local tbInstanceToFunc = {
[GameEnum.instanceType.DailyInstance] = GameEnum.OpenFuncType.DailyInstance,
[GameEnum.instanceType.RegionBoss] = GameEnum.OpenFuncType.RegionBoss,
[GameEnum.instanceType.SkillInstance] = GameEnum.OpenFuncType.SkillInstance,
[GameEnum.instanceType.CharGemInstance] = GameEnum.OpenFuncType.CharGemInstance
}
function ReengagementDoubleDropCtrl:InitActData()
self.actData = {}
self.nActId = 0
self.tbFuncType = self.actData:GetDoubleFuncType()
self.tbFuncType = PlayerData.Reengagement:GetDoubleFuncType()
if self.tbFuncType == nil then
return
end
@@ -51,13 +56,14 @@ function ReengagementDoubleDropCtrl:InitActData()
for k, v in ipairs(self._mapNode.goInstanceItem) do
v.gameObject:SetActive(self.tbFuncType[k] ~= nil)
if self.tbFuncType[k] ~= nil then
v:InitItem(self.tbFuncType[k])
local bUnlock = PlayerData.Base:CheckFunctionUnlock(self.tbFuncType[k])
local nFuncType = tbInstanceToFunc[self.tbFuncType[k]]
v:InitItem(nFuncType)
local bUnlock = PlayerData.Base:CheckFunctionUnlock(nFuncType)
self._mapNode.btnGoto[k].gameObject:SetActive(bUnlock)
end
end
NovaAPI.SetTMPText(self._mapNode.txtDoubleCount, self.actData:GetDropActString())
RedDotManager.RegisterNode(RedDotDefine.Activity_DoubleDrop_Quest, self.nActId, self._mapNode.redDotQuest)
local sText = ConfigTable.GetUIText("Reengagement_DoubleDrop_Count") .. PlayerData.Reengagement:GetDoubleDropCount() .. "/" .. PlayerData.Reengagement:GetMaxDoubleDropCount()
NovaAPI.SetTMPText(self._mapNode.txtDoubleCount, sText)
end
function ReengagementDoubleDropCtrl:GetTimeStr(nRemainTime)
local sTimeStr = ""
@@ -96,8 +102,8 @@ function ReengagementDoubleDropCtrl:StartActTimer()
self.timer:Cancel()
self.timer = nil
end
local nOpenTime = self.actData:GetActOpenTime()
local nCloseTime = self.actData:GetActEndTime()
local nOpenTime = PlayerData.Reengagement:GetReengagementOpenTime()
local nCloseTime = PlayerData.Reengagement:GetReengagementCloseTime()
local refreshTime = function()
local nCurTime = ClientManager.serverTimeStamp
local sTime = ""
@@ -110,6 +116,13 @@ function ReengagementDoubleDropCtrl:StartActTimer()
if nRemainTime <= 0 and self.timer ~= nil then
self.timer:Cancel()
self.timer = nil
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Alert,
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
callbackConfirm = function()
EventManager.Hit(EventId.ClosePanel, PanelId.ReengagementPanel)
end
})
end
NovaAPI.SetTMPText(self._mapNode.txtTime, sTime)
end
@@ -133,13 +146,13 @@ function ReengagementDoubleDropCtrl:OnBtnClick_Goto(btn, nIndex)
if nType == nil then
return
end
if nType == GameEnum.OpenFuncType.DailyInstance then
if nType == GameEnum.instanceType.DailyInstance then
EventManager.Hit(EventId.OpenPanel, PanelId.DailyInstanceLevelSelect, 0, 0, true)
elseif nType == GameEnum.OpenFuncType.RegionBoss then
elseif nType == GameEnum.instanceType.RegionBoss then
EventManager.Hit(EventId.OpenPanel, PanelId.RogueBossLevel, 0, 0, true)
elseif nType == GameEnum.OpenFuncType.SkillInstance then
elseif nType == GameEnum.instanceType.SkillInstance then
EventManager.Hit(EventId.OpenPanel, PanelId.SkillInstanceLevelSelect)
elseif nType == GameEnum.OpenFuncType.CharGemInstance then
elseif nType == GameEnum.instanceType.CharGemInstance then
EventManager.Hit(EventId.OpenPanel, PanelId.EquipmentInstanceLevelSelect)
end
end
@@ -8,14 +8,8 @@ ReengagementMallCtrl._mapNodeConfig = {
},
txtLabelValue = {sComponentName = "TMP_Text"},
txtRemainDay = {sComponentName = "TMP_Text"},
txtWeeklyCardName = {
sComponentName = "TMP_Text",
sLanguageId = "Reengagement_WeeklyCardName"
},
txtWeeklyCardDesc = {
sComponentName = "TMP_Text",
sLanguageId = "Reengagement_WeeklyCardDesc"
},
txtWeeklyCardName = {sComponentName = "TMP_Text"},
txtWeeklyCardDesc = {sComponentName = "TMP_Text"},
txtGetNow = {
sComponentName = "TMP_Text",
sLanguageId = "Reengagement_GetNow"
@@ -24,10 +18,18 @@ ReengagementMallCtrl._mapNodeConfig = {
sComponentName = "TMP_Text",
sLanguageId = "Reengagement_GetDaily"
},
btnBuyWeeklyCard = {
sComponentName = "UIButton",
callback = "OnBtnClick_BuyWeeklyCard"
},
txtBtnBuy = {sComponentName = "TMP_Text"},
txtBtnReceiveWeeklyCard = {
sComponentName = "TMP_Text",
sLanguageId = "Quest_Receive_Btn_Text"
},
txtAlreadyReceived = {
sComponentName = "TMP_Text",
sLanguageId = "Reengagement_AlreadyReceived"
sLanguageId = "CharPlot_Task_Received"
},
btnReceiveWeeklyCard = {
sComponentName = "UIButton",
@@ -41,6 +43,7 @@ ReengagementMallCtrl._mapNodeConfig = {
nCount = 3,
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
},
btnMallItem = {nCount = 3, sComponentName = "UIButton"},
txtBannerTitle = {
sComponentName = "TMP_Text",
sLanguageId = "Reengagement_Mall_BannerTitle"
@@ -70,15 +73,26 @@ ReengagementMallCtrl._mapNodeConfig = {
imgPointBg = {nCount = 10},
PkgItem = {
nCount = 3,
sCtrlName = "Game.UI.Mall.MallPackageItemCtrl"
sCtrlName = "Game.UI.Activity.Reengagement.ReengagementMallPackageItemCtrl"
}
}
ReengagementMallCtrl._mapEventConfig = {}
ReengagementMallCtrl._mapEventConfig = {
MallOrderClear = "OnEvent_MallOrderClear",
RefreshReengagementWeeklyCard = "OnEvent_RefreshReengagementWeeklyCard"
}
function ReengagementMallCtrl:OnEnable()
self.tbPackagePage = {}
self.actData = {}
self.tbBannerInitPos = {}
for _, v in ipairs(self._mapNode.activityBannerItem) do
self.nBannerWidth = v.sizeDelta.x
table.insert(self.tbBannerInitPos, v.anchoredPosition)
end
self.nBannerInterval = ConfigTable.GetConfigNumber("Activity_Banner_Interval_Time")
end
function ReengagementMallCtrl:OnDisable()
self._mapNode.btnMallItem[1].onClick:RemoveAllListeners()
self._mapNode.btnMallItem[2].onClick:RemoveAllListeners()
self._mapNode.btnMallItem[3].onClick:RemoveAllListeners()
self:ResetTimer()
end
function ReengagementMallCtrl:Refresh(nCurTog)
@@ -90,22 +104,75 @@ function ReengagementMallCtrl:Refresh(nCurTog)
self:RefreshPkgItem()
end
function ReengagementMallCtrl:RefreshWeeklyCard()
local mapWeeklyCardCfg = self.actData:GetWeeklyCardData()
local mapWeeklyCardData = {}
NovaAPI.SetTMPText(self._mapNode.txtLabelValue, "")
NovaAPI.SetTMPText(self._mapNode.txtWeeklyCardDesc, "")
self._mapNode.btnReceiveWeeklyCard.gameObject:SetActive(true)
self._mapNode.btnAlreadyReceived.gameObject:SetActive(true)
self._mapNode.MallItem[1]:SetItem()
self._mapNode.MallItem[2]:SetItem()
self._mapNode.MallItem[3]:SetItem()
local mapWeeklyCard = PlayerData.Reengagement:GetWeeklyCardData()
local nActId = PlayerData.Reengagement:GetActId()
local bHasWeeklyCard = mapWeeklyCard.Id ~= nil and mapWeeklyCard.Id ~= ""
local foreach = function(mapData)
if mapData ~= nil and mapData.ReturneeId == nActId then
self.mapCurWeeklyCard = mapData
end
end
ForEachTableLine(ConfigTable.Get("ActivityReturneeCard"), foreach)
local sCanBuy = ConfigTable.GetUIText("Mall_Package_LimitTitle") .. ":1/1"
local sOut = ConfigTable.GetUIText("Mall_Package_SoldOut")
local bDisabled = mapWeeklyCard.Received or mapWeeklyCard.Remaining <= 0
NovaAPI.SetTMPText(self._mapNode.txtLabelValue, bHasWeeklyCard and sOut or sCanBuy)
NovaAPI.SetTMPText(self._mapNode.txtWeeklyCardDesc, self.mapCurWeeklyCard.Desc)
NovaAPI.SetTMPText(self._mapNode.txtWeeklyCardName, self.mapCurWeeklyCard.Name)
self._mapNode.btnReceiveWeeklyCard.gameObject:SetActive(not bDisabled and bHasWeeklyCard)
self._mapNode.btnAlreadyReceived.gameObject:SetActive(bDisabled and bHasWeeklyCard)
self._mapNode.btnBuyWeeklyCard.gameObject:SetActive(not bHasWeeklyCard)
NovaAPI.SetTMPText(self._mapNode.txtBtnBuy, self.mapCurWeeklyCard.ShowPrice)
if bHasWeeklyCard then
local sRemain = orderedFormat(ConfigTable.GetUIText("Mall_MonthlyCard_RemainDay") or "", mapWeeklyCard.Remaining)
local sReceived = ""
if mapWeeklyCard.Received then
sReceived = ConfigTable.GetUIText("Mall_MonthlyCard_Received")
else
sReceived = ConfigTable.GetUIText("Mall_MonthlyCard_Unreceived")
end
local sToday = "<color=#08D3D4>" .. sReceived .. "</color>"
if mapWeeklyCard.Remaining > 0 then
sRemain = sRemain .. " " .. sToday
end
NovaAPI.SetTMPText(self._mapNode.txtRemainDay, sRemain)
end
self._mapNode.txtRemainDay.gameObject:SetActive(bHasWeeklyCard)
self._mapNode.MallItem[1]:SetItem(self.mapCurWeeklyCard.BaseItemId, nil, self.mapCurWeeklyCard.BaseItemQty)
self._mapNode.MallItem[2]:SetItem(self.mapCurWeeklyCard.DailyItemId1, nil, self.mapCurWeeklyCard.DailyItemQty1)
self._mapNode.MallItem[3]:SetItem(self.mapCurWeeklyCard.DailyItemId2, nil, self.mapCurWeeklyCard.DailyItemQty2)
self._mapNode.btnMallItem[1].onClick:RemoveAllListeners()
self._mapNode.btnMallItem[2].onClick:RemoveAllListeners()
self._mapNode.btnMallItem[3].onClick:RemoveAllListeners()
self._mapNode.btnMallItem[1].onClick:AddListener(function()
UTILS.ClickItemGridWithTips(self.mapCurWeeklyCard.BaseItemId, self._mapNode.btnMallItem[1].transform, true, true, false)
end)
self._mapNode.btnMallItem[2].onClick:AddListener(function()
UTILS.ClickItemGridWithTips(self.mapCurWeeklyCard.DailyItemId1, self._mapNode.btnMallItem[2].transform, true, true, false)
end)
self._mapNode.btnMallItem[3].onClick:AddListener(function()
UTILS.ClickItemGridWithTips(self.mapCurWeeklyCard.DailyItemId2, self._mapNode.btnMallItem[3].transform, true, true, false)
end)
end
function ReengagementMallCtrl:RefreshPkgItem()
local nActId = PlayerData.Reengagement:GetActId()
self.tbPackagePage = {}
local foreach = function(mapData)
if mapData ~= nil and mapData.ReturneeId == nActId then
table.insert(self.tbPackagePage, mapData)
end
end
ForEachTableLine(ConfigTable.Get("ActivityReturneePack"), foreach)
table.sort(self.tbPackagePage, function(a, b)
return a.Sort < b.Sort
end)
local tbPurchasedBundles = PlayerData.Reengagement:GetPurchasedBundles()
for i = 1, 3 do
local mapData = self.tbPackagePage[i]
if mapData ~= nil then
local bPurchased = table.indexof(tbPurchasedBundles, mapData.Id) > 0
self._mapNode.PkgItem[i].gameObject:SetActive(true)
self._mapNode.PkgItem[i]:Refresh(mapData)
self._mapNode.PkgItem[i]:RefreshReengagement(mapData, bPurchased)
else
self._mapNode.PkgItem[i].gameObject:SetActive(false)
end
@@ -122,7 +189,7 @@ function ReengagementMallCtrl:SetBanner()
for _, v in ipairs(self._mapNode.imgPointBg) do
v.gameObject:SetActive(false)
end
for k, v in ipairs(self.tbBannerList) do
for k, v in pairs(self.tbBannerList) do
if nil ~= self._mapNode.imgPointBg[k] then
self._mapNode.imgPointBg[k]:SetActive(true)
self._mapNode.imgPointBg[k].transform:Find("imgPoint").gameObject:SetActive(false)
@@ -135,216 +202,6 @@ function ReengagementMallCtrl:SetBanner()
self:StartActBannerTimer()
self._mapNode.eventActBannerDrag.enabled = #self.tbBannerList > 1
end
function ReengagementMallCtrl:AddActivityBanner()
local tb_activityBanner = PlayerData.Activity:GetActivityBannerList()
for _, value in ipairs(tb_activityBanner) do
table.insert(self.tbBannerList, {
nId = value:GetActId(),
nType = GameEnum.bannerType.Activity,
actData = value,
nFuncType = GameEnum.OpenFuncType.Activity
})
end
end
function ReengagementMallCtrl:AddOtherBanner()
local nNextOpenTime = 0
local nNextCloseTime = 0
local nCurTime = CS.ClientManager.Instance.serverTimeStamp
local forEachMap = function(mapLineData)
if mapLineData.BannerType == GameEnum.bannerType.OpenFunc then
local funcNum = tonumber(mapLineData.Param1)
if funcNum == nil then
return
end
local bUnlock = PlayerData.Base:CheckFunctionUnlock(funcNum, false)
if bUnlock then
local jumpToNum = tonumber(mapLineData.Param2)
if jumpToNum == nil then
return
end
table.insert(self.tbBannerList, {
nId = mapLineData.Id,
nType = GameEnum.bannerType.OpenFunc,
sBanner = mapLineData.bannerName,
nJumpTo = jumpToNum,
nFuncType = funcNum
})
end
elseif mapLineData.BannerType == GameEnum.bannerType.Community then
local clientPublishRegion = CS.ClientConfig.ClientPublishRegion
local channelName = CS.ClientConfig.ClientPublishChannelName
if SDKManager:IsSDKInit() and clientPublishRegion == CS.ClientPublishRegion.CN and (channelName == "Official" or channelName == "TEST_1" or channelName == "Taptap") then
table.insert(self.tbBannerList, {
nId = mapLineData.Id,
nType = GameEnum.bannerType.Community,
sBanner = mapLineData.bannerName
})
end
elseif mapLineData.BannerType == GameEnum.bannerType.Payment then
if not NovaAPI.IsReviewServerEnv() then
local clientPublishRegion = CS.ClientConfig.ClientPublishRegion
local channelName = CS.ClientConfig.ClientPublishChannelName
if SDKManager:IsSDKInit() and clientPublishRegion == CS.ClientPublishRegion.CN and (channelName == "Official" or channelName == "TEST_1" or channelName == "Taptap" or channelName == "TEST_2") then
table.insert(self.tbBannerList, {
nId = mapLineData.Id,
nType = GameEnum.bannerType.Payment,
sBanner = mapLineData.bannerName
})
end
end
elseif mapLineData.BannerType == GameEnum.bannerType.Mall or mapLineData.BannerType == GameEnum.bannerType.MallSkin then
local nOpenTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(mapLineData.Param1)
local nCloseTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(mapLineData.Param2)
if nOpenTime <= nCurTime and nCloseTime >= nCurTime then
table.insert(self.tbBannerList, {
nId = mapLineData.Id,
nType = mapLineData.BannerType,
sBanner = mapLineData.bannerName,
sParam = mapLineData.Param3
})
if nCloseTime < nNextCloseTime or nNextCloseTime == 0 then
nNextCloseTime = nCloseTime
end
elseif nOpenTime > nCurTime and (nOpenTime < nNextOpenTime or nNextOpenTime == 0) then
nNextOpenTime = nOpenTime
end
elseif mapLineData.BannerType == GameEnum.bannerType.TimeLimit_Func then
local nOpenTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(mapLineData.Param1)
local nCloseTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(mapLineData.Param2)
local nJumpToId = tonumber(mapLineData.Param3)
local nFuncType = tonumber(mapLineData.Param4)
if nFuncType == nil or nJumpToId == nil then
return
end
local bUnlock = PlayerData.Base:CheckFunctionUnlock(nFuncType, false)
if bUnlock and nOpenTime <= nCurTime and nCloseTime >= nCurTime then
table.insert(self.tbBannerList, {
nId = mapLineData.Id,
nType = GameEnum.bannerType.TimeLimit_Func,
sBanner = mapLineData.bannerName,
nJumpTo = nJumpToId,
nFuncType = nFuncType
})
if nCloseTime < nNextCloseTime or nNextCloseTime == 0 then
nNextCloseTime = nCloseTime
end
elseif nOpenTime > nCurTime and (nOpenTime < nNextOpenTime or nNextOpenTime == 0) then
nNextOpenTime = nOpenTime
end
elseif mapLineData.BannerType == GameEnum.bannerType.JumpToUrl then
if NovaAPI.IsReviewServerEnv() and mapLineData.Param6 == "1" then
return
end
local sUrl = mapLineData.Param3
if sUrl == nil or sUrl == "" then
return
end
local sPlatform = mapLineData.Param4
local sOption = mapLineData.Param5
local curPlatform = CS.ClientManager.Instance.Platform
local bUseOpenUrl = mapLineData.Param7 == "1"
if mapLineData.Param1 == "" then
if sPlatform == "" then
table.insert(self.tbBannerList, {
nId = mapLineData.Id,
nType = GameEnum.bannerType.JumpToUrl,
sBanner = mapLineData.bannerName,
sUrl = sUrl,
bInside = true,
bUseOpenUrl = bUseOpenUrl
})
else
local tbPlatformList = string.split(sPlatform, ",")
local tbOptionList = string.split(sOption, ",")
local nIndex = table.indexof(tbPlatformList, curPlatform)
if nIndex ~= nil and 0 < nIndex then
local sOptionType = tbOptionList[nIndex]
local bInside = sOptionType == "0"
table.insert(self.tbBannerList, {
nId = mapLineData.Id,
nType = GameEnum.bannerType.JumpToUrl,
sBanner = mapLineData.bannerName,
sUrl = sUrl,
bInside = bInside,
bUseOpenUrl = bUseOpenUrl
})
end
end
else
local nOpenTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(mapLineData.Param1)
local nCloseTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(mapLineData.Param2)
if nOpenTime <= nCurTime and nCloseTime >= nCurTime then
if sPlatform == "" then
table.insert(self.tbBannerList, {
nId = mapLineData.Id,
nType = GameEnum.bannerType.JumpToUrl,
sBanner = mapLineData.bannerName,
sUrl = sUrl,
bInside = true,
bUseOpenUrl = bUseOpenUrl
})
else
local tbPlatformList = string.split(sPlatform, ",")
local tbOptionList = string.split(sOption, ",")
local nIndex = table.indexof(tbPlatformList, curPlatform)
if nIndex ~= nil and 0 < nIndex then
local sOptionType = tbOptionList[nIndex]
local bInside = sOptionType == "0"
table.insert(self.tbBannerList, {
nId = mapLineData.Id,
nType = GameEnum.bannerType.JumpToUrl,
sBanner = mapLineData.bannerName,
sUrl = sUrl,
bInside = bInside,
bUseOpenUrl = bUseOpenUrl
})
end
end
if nCloseTime < nNextCloseTime or nNextCloseTime == 0 then
nNextCloseTime = nCloseTime
end
elseif nOpenTime > nCurTime and (nOpenTime < nNextOpenTime or nNextOpenTime == 0) then
nNextOpenTime = nOpenTime
end
end
elseif mapLineData.BannerType == GameEnum.bannerType.SeaPayment and not NovaAPI.IsReviewServerEnv() then
local sUrl = mapLineData.Param3
if sUrl == nil or sUrl == "" then
return
end
local nOpenTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(mapLineData.Param1)
local nCloseTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(mapLineData.Param2)
if nOpenTime <= nCurTime and nCloseTime >= nCurTime then
local sPlatform = mapLineData.Param4
local sOption = mapLineData.Param5
local curPlatform = CS.ClientManager.Instance.Platform
local tbPlatformList = string.split(sPlatform, ",")
local tbOptionList = string.split(sOption, ",")
local nIndex = table.indexof(tbPlatformList, curPlatform)
local sPid = mapLineData.Param6
if nIndex ~= nil and 0 < nIndex then
local sOptionType = tbOptionList[nIndex]
local bInside = sOptionType == "0"
if SDKManager:IsSDKInit() then
table.insert(self.tbBannerList, {
nId = mapLineData.Id,
nType = GameEnum.bannerType.SeaPayment,
sBanner = mapLineData.bannerName,
sUrl = sUrl,
bInside = bInside,
sPid = sPid
})
end
end
end
end
end
ForEachTableLine(DataTable.Banner, forEachMap)
local nRefreshTime = math.min(math.max(nNextOpenTime, 0), math.max(nNextCloseTime, 0))
if 0 < nRefreshTime and nCurTime < nRefreshTime then
self.bannerRefreshTimer = self:AddTimer(1, nRefreshTime - nCurTime, "SetBanner", true, true, true)
end
end
function ReengagementMallCtrl:AddGachaBanner()
local tbOpenedPool = PlayerData.Gacha:GetOpenedPool()
local comp = function(a, b)
@@ -586,4 +443,21 @@ function ReengagementMallCtrl:ResetTimer()
self.bannerRefreshTimer = nil
end
end
function ReengagementMallCtrl:OnBtnClick_BuyWeeklyCard()
PlayerData.Reengagement:BuyWeeklyCard(self.mapCurWeeklyCard.Id, self.mapCurWeeklyCard.StatisticalGroup)
end
function ReengagementMallCtrl:OnBtnClick_ReceiveWeeklyCard()
PlayerData.Reengagement:RequestReceiveWeeklyCard()
end
function ReengagementMallCtrl:OnEvent_RefreshReengagementWeeklyCard()
self:RefreshWeeklyCard()
end
function ReengagementMallCtrl:OnBtnClick_AlreadyReceived()
end
function ReengagementMallCtrl:OnEvent_MallOrderClear()
PlayerData.Reengagement:RequestReengagementInfo(function()
self:RefreshWeeklyCard()
self:RefreshPkgItem()
end)
end
return ReengagementMallCtrl
@@ -0,0 +1,50 @@
local MallPackageDetailCtrl = import("Game.UI.Mall.MallPackageDetailCtrl")
local ReengagementMallPackageDetailCtrl = class("ReengagementMallPackageDetailCtrl", MallPackageDetailCtrl)
function ReengagementMallPackageDetailCtrl:Refresh(sPackageId)
self._sPackageId = sPackageId
local mapCfg = ConfigTable.GetData("ActivityReturneePack", sPackageId)
if not mapCfg or not PlayerData.Reengagement:GetActIsOpen() then
self:OnBtnClick_Close()
return
end
local bPurchased = table.indexof(PlayerData.Reengagement:GetPurchasedBundles(), sPackageId) > 0
local mapData = {
nCurStock = bPurchased and 0 or 1,
nNextRefreshTime = PlayerData.Reengagement:GetReengagementCloseTime(),
bPrioritizeDeList = true
}
self:PlayInAni()
self:RefreshInfo(mapCfg)
self:RefreshPrice(mapCfg)
self:RefreshLimit(mapCfg, mapData)
self:RefreshTime(mapData)
self:RefreshItem(mapCfg)
self:RefreshBuy(mapCfg, mapData)
end
function ReengagementMallPackageDetailCtrl:RefreshLimit(mapCfg, mapData)
NovaAPI.SetTMPText(self._mapNode.txtLimit, mapData.nCurStock .. "/1")
NovaAPI.SetTMPText(self._mapNode.txtLimitCn, ConfigTable.GetUIText("Mall_Package_LimitTitle"))
end
function ReengagementMallPackageDetailCtrl:OnBtnClick_Buy()
if not PlayerData.Reengagement:GetActIsOpen() then
self:OnBtnClick_Close()
return
end
local mapCfg = ConfigTable.GetData("ActivityReturneePack", self._sPackageId)
if not mapCfg then
return
end
if table.indexof(PlayerData.Reengagement:GetPurchasedBundles(), self._sPackageId) > 0 then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Mall_Package_SoldOut"))
return
end
if not PlayerData.Shop:CheckShopCond(mapCfg.OrderCondType, decodeJson(mapCfg.OrderCondParams)) then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Shop_Condition"))
return
end
PlayerData.Mall:BuyReengagementPackage(self._sPackageId, mapCfg.StatisticalGroup)
end
function ReengagementMallPackageDetailCtrl:OnBtnClick_Close()
EventManager.Hit("ReengagementMallCloseDetail")
end
return ReengagementMallPackageDetailCtrl
@@ -0,0 +1,150 @@
local ReengagementMallPackageItemCtrl = class("ReengagementMallPackageItemCtrl", BaseCtrl)
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
ReengagementMallPackageItemCtrl._mapNodeConfig = {
txtName = {sComponentName = "TMP_Text"},
imgIcon = {sComponentName = "Image"},
imgBg = {sComponentName = "Image"},
txtPrice = {sComponentName = "TMP_Text"},
txtLimit = {sComponentName = "TMP_Text"},
imgCurrency = {sComponentName = "Image"},
goCurrency = {},
goTime = {},
goCondition = {},
goSoldOut = {},
imgSoldOut = {nCount = 2},
txtRefreshTime = {sComponentName = "TMP_Text"},
txtTime = {sComponentName = "TMP_Text"},
txtSoldOut = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "Mall_Package_SoldOut"
},
txtCondition = {sComponentName = "TMP_Text"},
goSaleRate = {
sComponentName = "RectTransform"
},
fxSaleRate = {sNodeName = "goSaleRate", sComponentName = "UIShiny"},
txtSaleRate = {sComponentName = "TMP_Text"},
imgMask = {},
imgSaleMask = {},
reddotPkg = {},
reddotNew = {},
btnGrid = {
sComponentName = "UIButton",
callback = "OnBtnClick_Buy"
}
}
ReengagementMallPackageItemCtrl._mapEventConfig = {}
function ReengagementMallPackageItemCtrl:RefreshReengagement(mapData, bPurchased)
self.sId = mapData.Id
self.sStatistical = mapData.StatisticalGroup
self.bPurchased = bPurchased
self:RefreshInfo(mapData, bPurchased)
self:RefreshPrice(mapData)
end
function ReengagementMallPackageItemCtrl:RefreshPrice(mapCfg)
if mapCfg.CurrencyType == GameEnum.currencyType.Cash then
self._mapNode.goCurrency:SetActive(false)
NovaAPI.SetTMPText(self._mapNode.txtPrice, tostring(mapCfg.CurrencyShowPrice))
elseif mapCfg.CurrencyType == GameEnum.currencyType.Item then
self._mapNode.goCurrency:SetActive(true)
NovaAPI.SetTMPText(self._mapNode.txtPrice, mapCfg.CurrencyItemQty)
self:SetPngSprite(self._mapNode.imgCurrency, ConfigTable.GetData_Item(mapCfg.CurrencyItemId).Icon2)
elseif mapCfg.CurrencyType == GameEnum.currencyType.Free then
self._mapNode.goCurrency:SetActive(false)
NovaAPI.SetTMPText(self._mapNode.txtPrice, ConfigTable.GetUIText("Mall_Package_Free"))
end
end
function ReengagementMallPackageItemCtrl:RefreshInfo(mapCfg, bPurchased)
NovaAPI.SetTMPText(self._mapNode.txtName, mapCfg.Name)
self:SetPngSprite(self._mapNode.imgIcon, mapCfg.Icon)
self:SetPngSprite(self._mapNode.imgBg, mapCfg.IconBg)
self._mapNode.goSaleRate.gameObject:SetActive(not bPurchased)
if mapCfg.SaleRate ~= 0 then
if mapCfg.SaleRate == -1 then
NovaAPI.SetTMPText(self._mapNode.txtSaleRate, ConfigTable.GetUIText("Mall_Package_Recommend"))
else
NovaAPI.SetTMPText(self._mapNode.txtSaleRate, string.format("%s%%", mapCfg.SaleRate))
end
end
local sLimit = bPurchased and orderedFormat(ConfigTable.GetUIText("Mall_Package_Limit") or "", 0, 1) or orderedFormat(ConfigTable.GetUIText("Mall_Package_Limit") or "", 1, 1)
NovaAPI.SetTMPText(self._mapNode.txtLimit, sLimit)
self._mapNode.imgMask:SetActive(bPurchased)
end
function ReengagementMallPackageItemCtrl:RefreshTime(mapCfg, mapData)
local bDisposable = mapCfg.RefreshType == GameEnum.mallPackageRefreshType.None
self._mapNode.goTime.gameObject:SetActive(mapData.nNextRefreshTime > 0 and bDisposable)
if mapData.nNextRefreshTime > 0 and bDisposable then
local sSuffix = mapData.bPrioritizeDeList and ConfigTable.GetUIText("Mall_Package_Delist") or ConfigTable.GetUIText("Mall_Package_Refresh")
local sPrefix
local nRemaining = mapData.nNextRefreshTime - CS.ClientManager.Instance.serverTimeStamp
if nRemaining <= 3600 then
sPrefix = ConfigTable.GetUIText("Mall_Package_WithinHour")
elseif 3600 < nRemaining and nRemaining <= 86400 then
sPrefix = orderedFormat(ConfigTable.GetUIText("Mall_Package_Hour") or "", math.floor(nRemaining / 3600))
elseif 86400 < nRemaining then
sPrefix = orderedFormat(ConfigTable.GetUIText("Mall_Package_Day") or "", math.floor(nRemaining / 86400))
end
NovaAPI.SetTMPText(self._mapNode.txtTime, sPrefix .. sSuffix)
end
end
function ReengagementMallPackageItemCtrl:RefreshCond(mapData, bPurchased)
local bShowMask = not bPurchased
self._mapNode.imgMask:SetActive(bShowMask)
self._mapNode.imgSaleMask:SetActive(bShowMask)
NovaAPI.SetComponentEnable(self._mapNode.fxSaleRate, not bShowMask)
self._mapNode.goCondition:SetActive(not bPurchased)
self._mapNode.goSoldOut:SetActive(not bPurchased)
if not bPurchaseAble then
local sCond = ""
if mapCfg.OrderCondType == GameEnum.shopCond.WorldClassSpecific then
sCond = orderedFormat(ConfigTable.GetUIText("Mall_Cond_WorldClass") or "", tbCond[1])
end
NovaAPI.SetTMPText(self._mapNode.txtCondition, sCond)
end
if bPurchased then
local bTime = mapData.nNextRefreshTime > 0
self._mapNode.imgSoldOut[1]:SetActive(not bTime)
self._mapNode.imgSoldOut[2]:SetActive(bTime)
if mapData.nNextRefreshTime > 0 then
local sPrefix
local nRemaining = mapData.nNextRefreshTime - CS.ClientManager.Instance.serverTimeStamp
if nRemaining <= 3600 then
sPrefix = ConfigTable.GetUIText("Mall_Package_WithinHourRefresh")
elseif 3600 < nRemaining and nRemaining <= 86400 then
sPrefix = orderedFormat(ConfigTable.GetUIText("Mall_Package_HourRefresh") or "", math.floor(nRemaining / 3600))
elseif 86400 < nRemaining then
sPrefix = orderedFormat(ConfigTable.GetUIText("Mall_Package_DayRefresh") or "", math.floor(nRemaining / 86400))
end
NovaAPI.SetTMPText(self._mapNode.txtRefreshTime, sPrefix)
end
end
end
function ReengagementMallPackageItemCtrl:RegisterRedDot(mapCfg)
RedDotManager.RegisterNode(RedDotDefine.FreePackage, self.sId, self._mapNode.reddotPkg)
local groupCfg = ConfigTable.GetData("MallPackagePage", mapCfg.GroupId)
if groupCfg == nil then
return
end
RedDotManager.RegisterNode(RedDotDefine.Mall_Package_New, {
AllEnum.MallToggle.Package,
groupCfg.Sort,
self.sId
}, self._mapNode.reddotNew)
end
function ReengagementMallPackageItemCtrl:Awake()
end
function ReengagementMallPackageItemCtrl:OnEnable()
end
function ReengagementMallPackageItemCtrl:OnDisable()
end
function ReengagementMallPackageItemCtrl:OnDestroy()
end
function ReengagementMallPackageItemCtrl:OnBtnClick_Buy()
if self.bPurchased then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Mall_Package_SoldOut"))
return
end
EventManager.Hit(EventId.OpenPanel, PanelId.ReengagementMallPopup, self.sId)
end
return ReengagementMallPackageItemCtrl
@@ -0,0 +1,67 @@
local ReengagementMallPopupCtrl = class("ReengagementMallPopupCtrl", BaseCtrl)
ReengagementMallPopupCtrl._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"
},
PackageDetail = {
sNodeName = "---PackageDetail---",
sCtrlName = "Game.UI.Activity.Reengagement.ReengagementMallPackageDetailCtrl"
},
ShopDetail = {
sNodeName = "---ShopDetail---"
},
FurnitureDetail = {
sNodeName = "---FurnitureDetail---"
},
FurnitureSet = {
sNodeName = "---FurnitureSet---"
}
}
ReengagementMallPopupCtrl._mapEventConfig = {
ReengagementMallCloseDetail = "OnBtnClick_CloseDetail",
MallOrderClear = "OnBtnClick_CloseDetail"
}
function ReengagementMallPopupCtrl:Awake()
self._mapNode.PackageDetail.gameObject:SetActive(false)
self._mapNode.ShopDetail:SetActive(false)
self._mapNode.FurnitureDetail:SetActive(false)
self._mapNode.FurnitureSet:SetActive(false)
self._sPackageId = self:GetPanelParam()[1]
end
function ReengagementMallPopupCtrl:OnEnable()
self._bClosing = false
self._mapNode.blur:SetActive(true)
self._mapNode.TopBar:CreateCoin({
AllEnum.CoinItemId.FREESTONE
}, true)
self._mapNode.PackageDetail:Refresh(self._sPackageId)
end
function ReengagementMallPopupCtrl:OnBtnClick_CloseDetail()
if self._bClosing then
return
end
self._bClosing = true
if self._mapNode.PackageDetail.gameObject.activeSelf then
self._mapNode.PackageDetail:PlayOutAni()
end
self._mapNode.TopBar.gameObject:SetActive(false)
self._mapNode.aniBlur:SetTrigger("tOut")
self:AddTimer(1, 0.2, function()
EventManager.Hit(EventId.ClosePanel, PanelId.ReengagementMallPopup)
end, true, true, true)
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
end
return ReengagementMallPopupCtrl
@@ -0,0 +1,9 @@
local ReengagementMallPopupPanel = class("ReengagementMallPopupPanel", BasePanel)
ReengagementMallPopupPanel._bIsMainPanel = false
ReengagementMallPopupPanel._tbDefine = {
{
sPrefabPath = "Mall/MallPopupPanel.prefab",
sCtrlName = "Game.UI.Activity.Reengagement.ReengagementMallPopupCtrl"
}
}
return ReengagementMallPopupPanel
@@ -1,6 +1,7 @@
local BasePanel = require("GameCore.UI.BasePanel")
local ReengagementPanel = class("ReengagementPanel", BasePanel)
ReengagementPanel._sUIResRootPath = "UI_Activity/"
ReengagementPanel._bIsMainPanel = true
ReengagementPanel._tbDefine = {
{
sPrefabPath = "_101004/ReengagementPanel.prefab",
@@ -0,0 +1,85 @@
local ReengagementPopUpCtrl = class("ReengagementPopUpCtrl", BaseCtrl)
local sPrefabFolder = "UI_Activity/%s.prefab"
ReengagementPopUpCtrl._mapNodeConfig = {
imgBlurredBg = {},
goContent = {
sNodeName = "---Content---"
},
PopUpRoot = {
sNodeName = "---PopUpRoot---",
sComponentName = "RectTransform"
}
}
ReengagementPopUpCtrl._mapEventConfig = {}
ReengagementPopUpCtrl._mapRedDotConfig = {}
function ReengagementPopUpCtrl:Awake()
local tbParam = self:GetPanelParam()
if type(tbParam) == "table" then
local mapData = tbParam[1]
if type(mapData) == "table" then
self.nActId = mapData.nActId or mapData[1]
else
self.nActId = mapData
end
self.callback = tbParam[2]
end
end
function ReengagementPopUpCtrl:OnEnable()
self._mapNode.goContent.gameObject:SetActive(false)
self._mapNode.PopUpRoot.gameObject:SetActive(false)
self._mapNode.imgBlurredBg.gameObject:SetActive(true)
self:ShowPopUp()
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.PopUpRoot.gameObject:SetActive(self.curPopUpCtrl ~= nil)
end
cs_coroutine.start(wait)
end
function ReengagementPopUpCtrl:OnDisable()
self:ResetContent()
end
function ReengagementPopUpCtrl:OnDestroy()
end
function ReengagementPopUpCtrl:ResetContent()
if self.curPopUpCtrl ~= nil then
destroy(self.curPopUpCtrl.gameObject)
self:UnbindCtrlByNode(self.curPopUpCtrl)
end
self.curPopUpCtrl = nil
end
function ReengagementPopUpCtrl:ShowPopUp()
if self.nActId == nil then
self:ClosePopUp()
return
end
local mapPopUpCfg = ConfigTable.GetData("ActivityReturneeLoginRewardControl", self.nActId)
if mapPopUpCfg == nil or mapPopUpCfg.UIAssets == nil or mapPopUpCfg.UIAssets == "" or mapPopUpCfg.CtrlName == nil or mapPopUpCfg.CtrlName == "" then
self:ClosePopUp()
return
end
self:ResetContent()
local sPrefabPath = string.format(sPrefabFolder, mapPopUpCfg.UIAssets)
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.PopUpRoot)
local sCtrlPath = string.format("Game.UI.Activity.%s", mapPopUpCfg.CtrlName)
self.curPopUpCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
local callback = function(funcCall, bPauseQueue)
self:ClosePopUp(funcCall, bPauseQueue)
end
self.curPopUpCtrl:ShowPopUp(self.nActId, callback, 1)
end
function ReengagementPopUpCtrl:ClosePopUp(funcCall, bPauseQueue)
self:ResetContent()
EventManager.Hit(EventId.ClosePanel, PanelId.ReengagementPopUpPanel)
if bPauseQueue then
if funcCall ~= nil then
funcCall()
end
return
end
if self.callback ~= nil then
self.callback(funcCall)
elseif funcCall ~= nil then
funcCall()
end
end
return ReengagementPopUpCtrl
@@ -0,0 +1,109 @@
local ReengagementQuestItemCtrl = class("ReengagementQuestItemCtrl", BaseCtrl)
local JumpUtil = require("Game.Common.Utils.JumpUtil")
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
ReengagementQuestItemCtrl._mapNodeConfig = {
rtTitle = {
sComponentName = "RectTransform"
},
txtTitle = {sNodeName = "TMPTitle", sComponentName = "TMP_Text"},
rtBarFill = {
sComponentName = "RectTransform"
},
txtProcess = {sNodeName = "TMPProcess", sComponentName = "TMP_Text"},
btnReward = {
sComponentName = "UIButton",
callback = "OnBtnClick_Reward"
},
rtReward = {
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
},
btnReceive = {
sComponentName = "UIButton",
callback = "OnBtnClick_Receive"
},
txtBtnReceive = {
sComponentName = "TMP_Text",
sLanguageId = "PerActivity_Quest_Receive"
},
btnJump = {
sComponentName = "UIButton",
callback = "OnBtnClick_Jump"
},
txtBtnJump = {
sComponentName = "TMP_Text",
sLanguageId = "PerActivity_Quest_Jump"
},
txtUnComplete = {
sNodeName = "TMPUncomplete",
sComponentName = "TMP_Text",
sLanguageId = "PerActivity_Quest_UnComplete"
},
imgComplete = {},
imgCompleteMask = {},
imgPoint = {}
}
ReengagementQuestItemCtrl._mapEventConfig = {}
local totalLength = 520
local totalHeight = 37
function ReengagementQuestItemCtrl:SetData(nActId, mapData)
self.nActId = nActId
self.nQuestId = mapData.Id
local tbQuest = PlayerData.Reengagement:GetQuestDataById(self.nQuestId)
if tbQuest == nil then
tbQuest = {
nStatus = 0,
Progress = {Cur = 0, Max = 1}
}
end
local nStatus = tbQuest.nStatus
local questCfg = PlayerData.Reengagement:GetQuestConfigDataById(self.nQuestId)
self.nGroupId = questCfg.GroupId
if nil ~= questCfg then
NovaAPI.SetTMPText(self._mapNode.txtTitle, questCfg.Title)
NovaAPI.SetTMPText(self._mapNode.txtProcess, string.format("%s/%s", tbQuest.Progress.Cur, tbQuest.Progress.Max))
self.nJumpTo = questCfg.JumpTo
self.rewardId = questCfg.Reward1Tid
self._mapNode.rtReward:SetItem(questCfg.Reward1Tid, nil, questCfg.Reward1Qty, nil, nil, nil, nil, true)
self._mapNode.txtUnComplete.gameObject:SetActive(nStatus == 0 and questCfg.JumpTo == 0)
self._mapNode.btnJump.gameObject:SetActive(nStatus == 0 and questCfg.JumpTo ~= 0)
self._mapNode.btnReceive.gameObject:SetActive(nStatus == 1)
self._mapNode.imgComplete.gameObject:SetActive(nStatus == 2)
self._mapNode.imgCompleteMask.gameObject:SetActive(nStatus == 2)
self._mapNode.imgPoint.gameObject:SetActive(nStatus ~= 2)
if nStatus == 2 then
NovaAPI.SetTMPText(self._mapNode.txtProcess, ConfigTable.GetUIText("PerActivity_Quest_Complete"))
self._mapNode.rtBarFill.sizeDelta = Vector2(totalLength, totalHeight)
else
self._mapNode.rtBarFill.sizeDelta = Vector2(tbQuest.Progress.Cur / tbQuest.Progress.Max * totalLength, totalHeight)
end
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rtTitle)
end
end
function ReengagementQuestItemCtrl:Awake()
end
function ReengagementQuestItemCtrl:FadeIn()
end
function ReengagementQuestItemCtrl:FadeOut()
end
function ReengagementQuestItemCtrl:OnEnable()
end
function ReengagementQuestItemCtrl:OnDisable()
end
function ReengagementQuestItemCtrl:OnDestroy()
end
function ReengagementQuestItemCtrl:OnRelease()
end
function ReengagementQuestItemCtrl:OnBtnClick_Reward(btn)
if nil ~= self.rewardId then
UTILS.ClickItemGridWithTips(self.rewardId, btn.transform, true, true, true)
end
end
function ReengagementQuestItemCtrl:OnBtnClick_Receive()
PlayerData.Reengagement:RequestReceiveQuestReward(self.nQuestId, self.nGroupId)
end
function ReengagementQuestItemCtrl:OnBtnClick_Jump()
if nil ~= self.nJumpTo and 0 ~= self.nJumpTo then
JumpUtil.JumpTo(self.nJumpTo)
end
end
return ReengagementQuestItemCtrl
@@ -40,13 +40,13 @@ ReengagementSigninCtrl._mapNodeConfig = {
}
ReengagementSigninCtrl._mapEventConfig = {}
function ReengagementSigninCtrl:Refresh(nCurTog)
if nCurTog ~= AllEnum.ReengagementTog.ShopMall then
if nCurTog ~= AllEnum.ReengagementTog.Signin then
return
end
self:InitActData()
end
function ReengagementSigninCtrl:RefreshRemainTime()
local endTime = self.actData:GetActEndTime()
local endTime = PlayerData.Reengagement:GetReengagementCloseTime()
local curTime = ClientManager.serverTimeStamp
local remainTime = endTime - curTime
if remainTime < 0 then
@@ -56,7 +56,7 @@ function ReengagementSigninCtrl:RefreshRemainTime()
nType = AllEnum.MessageBox.Alert,
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
callbackConfirm = function()
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
EventManager.Hit(EventId.ClosePanel, PanelId.ReengagementPanel)
end
})
return
@@ -93,17 +93,42 @@ function ReengagementSigninCtrl:RefreshRemainTime()
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
end
function ReengagementSigninCtrl:RefreshRewardList()
local canReceive = self.mapLoginRewardData.Receive > self.mapLoginRewardData.Actual
self._mapNode.btnActivity.gameObject:SetActive(canReceive)
self.nLoginRewardGroup = 0
self.tbRewardList = {}
local tbRewardList = self.actData:GetActLoginRewardList()
local tbRewardList = {}
local mapDataLoginRewardCtrl = ConfigTable.GetData("ActivityReturneeLoginRewardControl", PlayerData.Reengagement:GetActId())
if mapDataLoginRewardCtrl ~= nil then
self.nLoginRewardGroup = mapDataLoginRewardCtrl.RewardsGroup
end
local foreachfunc = function(mapData)
if mapData ~= nil and mapData.RewardGroupId == self.nLoginRewardGroup then
table.insert(tbRewardList, mapData)
end
end
ForEachTableLine(ConfigTable.Get("ActivityReturneeLoginRewardGroup"), foreachfunc)
table.sort(tbRewardList, function(a, b)
return a.Order < b.Order
end)
if nil ~= tbRewardList then
local nMaxDay = #tbRewardList
local nReceiveDay = self.actData:GetCanReceive()
local nActual = self.actData:GetReceived()
local nReceiveDay = self.mapLoginRewardData.Receive
local nActual = self.mapLoginRewardData.Actual
for k, v in ipairs(self._mapNode.goRewardItem) do
self.tbRewardList[k] = {}
local mapReward = tbRewardList[k]
v.gameObject:SetActive(mapReward ~= nil)
if mapReward ~= nil then
local Status = 0
if k <= nReceiveDay and k > nActual then
Status = 1
elseif k <= nReceiveDay and k <= nActual then
Status = 2
elseif k > nReceiveDay then
Status = 0
end
mapReward.Status = Status
v:SetRewardItem(k, mapReward, k == nMaxDay, nReceiveDay == nActual and k == nActual + 1)
for i = 1, 3 do
local nTid = mapReward["RewardId" .. i]
@@ -117,12 +142,9 @@ function ReengagementSigninCtrl:RefreshRewardList()
end
end
function ReengagementSigninCtrl:InitActData()
local actData = {}
self.actData = actData
self:RefreshRewardList()
local canReceive = self.actData:CheckCanReceive()
self._mapNode.btnActivity.gameObject:SetActive(canReceive)
self.mapLoginRewardData = PlayerData.Reengagement:GetActLoginRewardList()
self._mapNode.imgRemaineTime.gameObject:SetActive(true)
self:RefreshRewardList()
self:RefreshRemainTime()
if nil == self.remainTimer then
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
@@ -137,43 +159,54 @@ end
function ReengagementSigninCtrl:OnDestroy()
end
function ReengagementSigninCtrl:OnBtnClick_Detail()
local mapActCfg = self.actData:GetLoginRewardControlCfg()
local mapActData = ConfigTable.GetData("ActivityReturneeReunionReward", PlayerData.Reengagement:GetActId())
if mapActData == nil then
return
end
local tbRewards = {}
for i = 1, 3 do
local nId = mapActData["Reward" .. i .. "Tid"]
local nQty = mapActData["Reward" .. i .. "Qty"]
if 0 < nId then
table.insert(tbRewards, {
nId = nId,
nCount = nQty,
bReceived = true
})
end
end
local msg = {
nType = AllEnum.MessageBox.Desc,
sContent = mapActCfg.DesText,
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
nType = AllEnum.MessageBox.ItemList,
tbItem = tbRewards,
bBlur = true
}
EventManager.Hit(EventId.OpenMessageBox, msg)
end
function ReengagementSigninCtrl:OnBtnClick_Item(btn, nIndex)
if self.tbRewardList[nIndex] ~= nil then
if #self.tbRewardList[nIndex] == 1 then
if nIndex < self.mapLoginRewardData.Actual or self.mapLoginRewardData.Actual == self.mapLoginRewardData.Receive then
local nTid = self.tbRewardList[nIndex][1].nTid
UTILS.ClickItemGridWithTips(nTid, btn.gameObject.transform, true, true, false)
else
local tbReward = {}
for _, v in ipairs(self.tbRewardList[nIndex]) do
local rewardData = {
[1] = v.nTid,
[5] = v.nCount
}
table.insert(tbReward, rewardData)
end
EventManager.Hit("ShowActRewardList", tbReward)
PlayerData.Reengagement:RequestReceiveLoginReward(function()
self:RefreshRewardList()
end)
end
end
end
function ReengagementSigninCtrl:OnBtnClick_Activity()
local callback = function()
self._mapNode.btnActivity.gameObject:SetActive(false)
local actData = PlayerData.Activity:GetActivityDataById(self.actData:GetActId())
self:InitActData(actData)
if self.mapLoginRewardData.Actual < self.mapLoginRewardData.Receive then
PlayerData.Reengagement:RequestReceiveLoginReward(function()
self:RefreshRewardList()
end)
end
local canReceive = self.actData:CheckCanReceive()
if not canReceive then
callback()
return
end
function ReengagementSigninCtrl:OnBtnClick_Play()
local mapActData = ConfigTable.GetData("ActivityReturnee", PlayerData.Reengagement:GetActId())
local sAvgId
if mapActData ~= nil and mapActData.AVG ~= nil then
sAvgId = mapActData.AVG
end
PlayerData.Activity:SendReceiveLoginRewardMsg(self.actData:GetActId(), callback)
EventManager.Hit("StoryDialog_DialogStart", sAvgId, Settings.sCurrentTxtLanguage, Settings.sCurrentVoLanguage)
end
return ReengagementSigninCtrl
@@ -34,14 +34,6 @@ ReengagementTaskCtrl._mapNodeConfig = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Btn_Detail"
},
btnQuickRec = {
sComponentName = "UIButton",
callback = "OnBtnClick_QuickRec"
},
txtBtnQuickRec = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Btn_Quick_Receive"
},
goActTime = {},
txtActivityTime = {sComponentName = "TMP_Text"},
txtActValue = {sComponentName = "TMP_Text"},
@@ -52,17 +44,27 @@ ReengagementTaskCtrl._mapNodeConfig = {
nCount = 7,
sComponentName = "UIButton",
callback = "OnBtnClick_NodeItem"
},
item = {
nCount = 7,
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
}
}
ReengagementTaskCtrl._mapEventConfig = {}
ReengagementTaskCtrl._mapEventConfig = {
RefreshReengagementQuest = "RefreshQuestList",
RefreshReengagementQuestPoint = "RefreshActivityNode",
RefreshReengagementGroup = "OnRefreshGroup"
}
function ReengagementTaskCtrl:Refresh(nCurTog)
if nCurTog ~= AllEnum.ReengagementTog.Task then
return
end
self:InitActData()
self:RefreshQuestList()
self:RefreshActivityNode()
end
function ReengagementTaskCtrl:RefreshRemainTime()
local endTime = self.actData:GetActEndTime()
local endTime = PlayerData.Reengagement:GetReengagementCloseTime()
local curTime = CS.ClientManager.Instance.serverTimeStamp
local remainTime = endTime - curTime
if remainTime < 0 then
@@ -72,7 +74,7 @@ function ReengagementTaskCtrl:RefreshRemainTime()
nType = AllEnum.MessageBox.Alert,
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
callbackConfirm = function()
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
EventManager.Hit(EventId.ClosePanel, PanelId.ReengagementPanel)
end
})
return
@@ -108,66 +110,83 @@ function ReengagementTaskCtrl:RefreshRemainTime()
end
NovaAPI.SetTMPText(self._mapNode.txtActivityTime, orderedFormat(ConfigTable.GetUIText("PerActivity_Remain_Time") or "", sTimeStr))
end
local tbConvertStatus = {
[0] = 1,
[1] = 0,
[2] = 2
}
function ReengagementTaskCtrl:RefreshQuestList()
self.tbAllQuestList = self.actData:GetQuestListByGroup()
if nil == self.tbAllQuestList[self._panel.nSelectGroup] then
printLog(string.format("任务列表为空!!!actId = %s, group = %s", self.nActId, self._panel.nSelectGroup))
return
end
self.tbQuestList = self.tbAllQuestList[self._panel.nSelectGroup]
table.sort(self.tbQuestList, function(a, b)
if a.nStatus == b.nStatus then
local nGroupId = 100 + (self._panel.nSelectGroup or 1)
self.tbQuestList = PlayerData.Reengagement:GetQuestListByGroup(nGroupId)
self.tbQuestData = PlayerData.Reengagement:GetQuestConfigDataByGroup(nGroupId)
table.sort(self.tbQuestData, function(a, b)
if not self.tbQuestList[a.Id] or not self.tbQuestList[b.Id] then
return a.Id < b.Id
end
return a.nStatus < b.nStatus
if self.tbQuestList[a.Id].nStatus == self.tbQuestList[b.Id].nStatus then
return a.Id < b.Id
end
return tbConvertStatus[self.tbQuestList[a.Id].nStatus] < tbConvertStatus[self.tbQuestList[b.Id].nStatus]
end)
for k, v in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(v)
self.tbGridCtrl[k] = nil
end
if nil ~= self.tbQuestList then
if #self.tbQuestData > 0 then
self.nPageCount = 0
self._mapNode.loopSv:SetAnim(0.06)
self._mapNode.loopSv:Init(#self.tbQuestList, self, self.OnGridRefresh, nil, false, self.GetGridPageCount)
self._mapNode.loopSv:Init(#self.tbQuestData, self, self.OnGridRefresh, nil, false, self.GetGridPageCount)
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
end
local _, _, canReceive = self.actData:GetQuestProgress()
self._mapNode.btnQuickRec.gameObject:SetActive(0 < canReceive)
for k, v in ipairs(self._mapNode.PerActGroupItem) do
local nAllQuest, nReceivedQuest = self.actData:GetDayQuestStatus(k)
v:RefreshStatus(nAllQuest <= nReceivedQuest and 0 < nReceivedQuest)
local bAllReceived = PlayerData.Reengagement:IsQuestGroupAllReceived(k)
v:RefreshStatus(bAllReceived)
end
end
function ReengagementTaskCtrl:GetGridPageCount(pageCount)
self.nPageCount = pageCount > #self.tbQuestList and #self.tbQuestList or pageCount
end
function ReengagementTaskCtrl:InitGroupList()
local nCurDay = self.actData:GetCurOpenDay()
self.nMaxOpenGroup = 0
self.tbGroupList = {}
local foreachtabelline = function(mapData)
if mapData.ReturneeId == self.nActId then
table.insert(self.tbGroupList, mapData)
end
end
ForEachTableLine(ConfigTable.Get("ActivityReturneeQuestGroup"), foreachtabelline)
local tbNextOpenGroupList = {}
if nil ~= CacheTable.GetData("_PeriodicQuestGroup", self.nActId) then
local tbGroup = CacheTable.GetData("_PeriodicQuestGroup", self.nActId)[nCurDay]
if nil ~= tbGroup then
for _, v in ipairs(tbGroup) do
if v > self.nMaxOpenGroup then
self.nMaxOpenGroup = v
end
end
end
if nil ~= CacheTable.GetData("_PeriodicQuestGroup", self.nActId)[nCurDay + 1] then
for _, v in ipairs(CacheTable.GetData("_PeriodicQuestGroup", self.nActId)[nCurDay + 1]) do
tbNextOpenGroupList[v] = 1
end
local nEventOpenTime = PlayerData.Reengagement:GetReengagementOpenTime()
local nCurTime = CS.ClientManager.Instance.serverTimeStamp
self.nCurDay = 0
if nil ~= nEventOpenTime and 0 < nEventOpenTime and nEventOpenTime < nCurTime then
local nOpenDayStartTime = CS.ClientManager.Instance:GetNextRefreshTime(nEventOpenTime) - 86400
self.nCurDay = math.floor((nCurTime - nOpenDayStartTime) / 86400)
end
for _, v in ipairs(self.tbGroupList) do
local nOpenDay = v.DayOpen
if nOpenDay <= self.nCurDay then
self.nMaxOpenGroup = math.max(self.nMaxOpenGroup, v.Id - 100)
elseif nOpenDay == self.nCurDay + 1 then
tbNextOpenGroupList[v.Id] = 1
end
end
local nSelectGroup = self.actData:GetCanReceiveRewardGroup()
if 0 == nSelectGroup then
nSelectGroup = self.nMaxOpenGroup
local nRedDotGroup = 0
for _, mapGroup in ipairs(self.tbGroupList) do
if mapGroup.DayOpen <= self.nCurDay and RedDotManager.GetValid(RedDotDefine.Activity_Reengagement_Task_Group, {
self.nActId,
mapGroup.Id
}) then
nRedDotGroup = math.max(nRedDotGroup, mapGroup.Id - 100)
end
end
local nSelectGroup = 0 < nRedDotGroup and nRedDotGroup or math.max(1, self.nMaxOpenGroup)
for k, v in ipairs(self._mapNode.PerActGroupItem) do
v:Init(self.nActId, k, self.nMaxOpenGroup)
if nil ~= tbNextOpenGroupList[k] then
local nHour = self.actData:GetNextDayOpenTime()
local bAllReceived = PlayerData.Reengagement:IsQuestGroupAllReceived(k)
v:Init(self.nActId, k, self.nMaxOpenGroup, bAllReceived)
if nil ~= tbNextOpenGroupList[k + 100] then
local nNextRefreshTime = CS.ClientManager.Instance:GetNextRefreshTime(nCurTime)
local nHour = math.floor((nNextRefreshTime - nCurTime) / 3600)
if nHour < 1 then
v:SetTime(orderedFormat(ConfigTable.GetUIText("PerActivity_Quest_Open_Time_2") or "", 1))
else
@@ -175,58 +194,62 @@ function ReengagementTaskCtrl:InitGroupList()
end
end
end
if nil == self._panel.nSelectGroup then
if nil == self._panel.nSelectGroup or 0 >= self._panel.nSelectGroup or self._panel.nSelectGroup > self.nMaxOpenGroup then
self._panel.nSelectGroup = nSelectGroup
end
self._mapNode.PerActGroupItem[self._panel.nSelectGroup]:SetSelect(true)
if nil ~= self._mapNode.PerActGroupItem[self._panel.nSelectGroup] then
self._mapNode.PerActGroupItem[self._panel.nSelectGroup]:SetSelect(true)
end
end
function ReengagementTaskCtrl: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.Activity.PeriodicQuest.PeriodicQuestItemCtrl")
self.tbGridCtrl[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.Activity.Reengagement.ReengagementQuestItemCtrl")
end
self.tbGridCtrl[nInstanceId]:SetData(self.nActId, self.tbQuestList[nIndex])
self.tbGridCtrl[nInstanceId]:SetData(self.nActId, self.tbQuestData[nIndex])
end
local totalLength = 816
local totalNodeLength = 136
local actNodeItemHeight = 152
local totalHeight = 20
function ReengagementTaskCtrl:RefreshActivityNode()
NovaAPI.SetTMPText(self._mapNode.txtActValue, self.nActiveCount)
local bAllComplete = self.nActiveCount >= self.nTotalActiveCount
self.tbQuestActive = {}
self.nTotalActiveCount = 0
local ForeachActivity = function(mapData)
table.insert(self.tbQuestActive, mapData)
if mapData.ReturneeId == self.nActId then
table.insert(self.tbQuestActive, mapData)
end
end
ForEachTableLine(ConfigTable.Get("DailyQuestActive"), ForeachActivity)
ForEachTableLine(ConfigTable.Get("ActivityReturneeQuestPoint"), ForeachActivity)
table.sort(self.tbQuestActive, function(a, b)
return a.Active < b.Active
return a.Point < b.Point
end)
local nMaxAct = self.tbQuestActive[#self.tbQuestActive].Active
self.tbCanReceiveAct = {}
local nMaxAct = self.tbQuestActive[#self.tbQuestActive].Point
self.nTotalActiveCount = nMaxAct
self.nActiveCount = PlayerData.Reengagement:GetQuestPointInfo().Point or 0
NovaAPI.SetTMPText(self._mapNode.txtActValue, self.nActiveCount)
for k, v in ipairs(self.tbQuestActive) do
if self._mapNode.btnNodeItem[k] ~= nil then
local bReceived = PlayerData.Reengagement:CheckPointRewardReceived(v.Index)
self._mapNode.item[k]:SetItem(v.Reward1Tid, nil, v.Reward1Qty, nil, bReceived)
local node = self._mapNode.btnNodeItem[k]
local nPosX = math.min(k / #self.tbQuestActive * totalNodeLength, totalNodeLength)
node.transform:GetComponent("RectTransform").anchoredPosition = Vector2(nPosX, actNodeItemHeight)
node.gameObject:SetActive(true)
local txtNodeAct = node.transform:Find("AnimRoot/goNodeItem/txtNodeAct"):GetComponent("TMP_Text")
NovaAPI.SetTMPText(txtNodeAct, v.Active)
local imgNodeAct1 = node.transform:Find("AnimRoot/goNodeItem/imgNumNml")
local imgNodeAct2 = node.transform:Find("AnimRoot/goNodeItem/imgNumSel")
local txtNodeAct1 = node.transform:Find("AnimRoot/goNodeItem/imgNumNml/txtNmlValue"):GetComponent("TMP_Text")
local txtNodeAct2 = node.transform:Find("AnimRoot/goNodeItem/imgNumSel/txtSelValue"):GetComponent("TMP_Text")
NovaAPI.SetTMPText(txtNodeAct1, v.Point)
NovaAPI.SetTMPText(txtNodeAct2, v.Point)
local anim = node.transform:Find("AnimRoot"):GetComponent("Animator")
local imgGift = node.transform:Find("AnimRoot/goNodeItem/imgGift")
local imgComplete = node.transform:Find("AnimRoot/goNodeItem/imgComplete")
local goParticle1 = node.transform:Find("AnimRoot/goNodeItem/UIParticle1")
local goParticle2 = node.transform:Find("AnimRoot/goNodeItem/UIParticle2")
local bReceived = PlayerData.Quest:CheckDailyActiveReceive(v.Id)
local bComplete = v.Active <= self.nActiveCount
imgGift.gameObject:SetActive(not bReceived)
imgComplete.gameObject:SetActive(bReceived)
local bComplete = v.Point <= self.nActiveCount and not bReceived
imgNodeAct1.gameObject:SetActive(not bReceived)
imgNodeAct2.gameObject:SetActive(bReceived)
goParticle1.gameObject:SetActive(not bReceived and bComplete)
goParticle2.gameObject:SetActive(not bReceived and bComplete)
if bComplete and not bReceived then
table.insert(self.tbCanReceiveAct, k)
end
if not bReceived and bComplete then
anim:Play("Quest_btnNodeComplete_loop", 0, 0)
else
@@ -234,38 +257,27 @@ function ReengagementTaskCtrl:RefreshActivityNode()
end
end
end
self._mapNode.btnActReceive.gameObject:SetActive(#self.tbCanReceiveAct > 0)
self._mapNode.txtActComplete.gameObject:SetActive(bAllComplete and not (#self.tbCanReceiveAct > 0))
self._mapNode.btnActReceiveGray.gameObject:SetActive(not bAllComplete and not (#self.tbCanReceiveAct > 0))
local nWidth = math.min(self.nActiveCount / nMaxAct * totalLength, totalLength)
self._mapNode.rtActProgressFill.sizeDelta = Vector2(nWidth, totalHeight)
end
function ReengagementTaskCtrl:InitActData(actData, bResetGroup)
self.actData = actData
if bResetGroup then
function ReengagementTaskCtrl:InitActData(bResetGroup)
if bResetGroup or self._panel.nSelectGroup == nil or self._panel.nSelectGroup == 0 then
self._panel.nSelectGroup = nil
end
self.nActId = actData:GetActId()
self.nActId = PlayerData.Reengagement:GetActId()
self.bQuestAnim = false
self:InitGroupList()
local tbAllQuestList = self.actData:GetQuestListByGroup()
if nil == tbAllQuestList[self._panel.nSelectGroup] then
if nil == PlayerData.Reengagement:GetQuestListByGroup(self._panel.nSelectGroup + 100) then
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Tips,
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1")
})
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
return
end
local actCfg = self.actData:GetActCfgData()
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
self._mapNode.goActTime.gameObject:SetActive(false)
else
self._mapNode.goActTime.gameObject:SetActive(true)
self:RefreshRemainTime()
if nil == self.remainTimer then
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
end
self._mapNode.goActTime.gameObject:SetActive(true)
self:RefreshRemainTime()
if nil == self.remainTimer then
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
end
end
function ReengagementTaskCtrl:Awake()
@@ -289,6 +301,10 @@ function ReengagementTaskCtrl:OnDestroy()
end
function ReengagementTaskCtrl:OnRelease()
end
function ReengagementTaskCtrl:OnRefreshGroup()
self:InitGroupList()
self:RefreshRemainTime()
end
function ReengagementTaskCtrl:OnBtnClick_Group(_, nIndex)
if self._panel.nSelectGroup == nIndex then
return
@@ -296,7 +312,7 @@ function ReengagementTaskCtrl:OnBtnClick_Group(_, nIndex)
if nIndex > self.nMaxOpenGroup then
return
end
if nil == self.tbAllQuestList[nIndex] or nil == next(self.tbAllQuestList[nIndex]) then
if nil == PlayerData.Reengagement:GetQuestConfigDataByGroup(nIndex + 100) or nil == next(PlayerData.Reengagement:GetQuestConfigDataByGroup(nIndex + 100)) then
printError(string.format("当前任务组下没有任务!!! 活动id = %d, 任务组 = %s", self.nActId, nIndex))
return
end
@@ -312,7 +328,7 @@ function ReengagementTaskCtrl:OnBtnClick_GroupLock()
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PerActivity_Not_Open"))
end
function ReengagementTaskCtrl:OnBtnClick_Detail()
local perQuestActCfg = self.actData:GetPerQuestCfg()
local perQuestActCfg = PlayerData.Reengagement:GetActDetail(AllEnum.ReengagementTog.Task)
local msg = {
nType = AllEnum.MessageBox.Desc,
sContent = perQuestActCfg.DesText,
@@ -320,11 +336,16 @@ function ReengagementTaskCtrl:OnBtnClick_Detail()
}
EventManager.Hit(EventId.OpenMessageBox, msg)
end
function ReengagementTaskCtrl:OnBtnClick_QuickRec()
local callback = function()
EventManager.Hit("RefreshPeriodicAct", self.nActId)
PlayerData.Base:TryOpenWorldClassUpgrade()
function ReengagementTaskCtrl:OnBtnClick_NodeItem(btn, index)
if PlayerData.Reengagement:CheckPointRewardReceived(index) then
UTILS.ClickItemGridWithTips(self.tbQuestActive[index].Reward1Tid, btn.transform, true, true, false)
return
end
if self.nActiveCount >= self.tbQuestActive[index].Point then
PlayerData.Reengagement:RequestReceiveQuestPointReward(index)
else
UTILS.ClickItemGridWithTips(self.tbQuestActive[index].Reward1Tid, btn.transform, true, true, false)
return
end
PlayerData.Activity:SendReceivePerQuest(self.nActId, 0, callback)
end
return ReengagementTaskCtrl
@@ -10,9 +10,10 @@ ReengagementTaskGroupCtrl._mapNodeConfig = {
imgComplete = {}
}
ReengagementTaskGroupCtrl._mapEventConfig = {}
function ReengagementTaskGroupCtrl:Init(nActId, nGroup, nCurGroup)
function ReengagementTaskGroupCtrl:Init(nActId, nGroup, nCurGroup, bAllReceived)
self.nActId = nActId
self.nGroup = nGroup
self.nGroupId = 100 < nGroup and nGroup or nGroup + 100
for _, v in ipairs(self._mapNode.txt_Group) do
NovaAPI.SetTMPText(v, self.nGroup)
end
@@ -23,14 +24,17 @@ function ReengagementTaskGroupCtrl:Init(nActId, nGroup, nCurGroup)
self._mapNode.redDotGroup.gameObject:SetActive(false)
self.bUnlock = nGroup <= nCurGroup
self:SetSelect(false)
self._mapNode.imgComplete.gameObject:SetActive(bAllReceived)
self._mapNode.goNormal.gameObject:SetActive(nGroup <= nCurGroup)
self._mapNode.goLock.gameObject:SetActive(nCurGroup < nGroup)
self:RegisterRedDot()
if nGroup <= nCurGroup then
self:RegisterRedDot()
end
end
function ReengagementTaskGroupCtrl:RegisterRedDot()
RedDotManager.RegisterNode(RedDotDefine.Activity_Reengagement_Task_Group, {
self.nActId,
self.nGroup
self.nGroupId
}, self._mapNode.redDotGroup)
end
function ReengagementTaskGroupCtrl:SetTime(sTime)
@@ -43,7 +47,7 @@ function ReengagementTaskGroupCtrl:SetSelect(bSelect)
self._mapNode.goSelect.gameObject:SetActive(self.bSelect)
end
function ReengagementTaskGroupCtrl:RefreshStatus(bAllReceived)
self._mapNode.imgComplete.gameObject:SetActive(bAllReceived and self.bUnlock)
self._mapNode.imgComplete.gameObject:SetActive(bAllReceived)
end
function ReengagementTaskGroupCtrl:Awake()
end
@@ -0,0 +1,94 @@
local TemplateToggleReengagementCtrl = class("TemplateToggleReengagementCtrl", BaseCtrl)
TemplateToggleReengagementCtrl._mapNodeConfig = {
AnimSwitch = {sComponentName = "Animator"},
txt_Select = {sComponentName = "TMP_Text"},
txt_unSelect = {sComponentName = "TMP_Text"},
Select = {},
unSelect = {},
reddotTog = {}
}
TemplateToggleReengagementCtrl._mapEventConfig = {}
function TemplateToggleReengagementCtrl:SetText(sText)
NovaAPI.SetTMPText(self._mapNode.txt_Select, sText)
NovaAPI.SetTMPText(self._mapNode.txt_unSelect, sText)
end
function TemplateToggleReengagementCtrl:SetDefault(bOn)
if self._mapNode.AnimSwitch.enabled == true then
self._mapNode.AnimSwitch.enabled = false
end
self._mapNode.Select:SetActive(bOn)
self._mapNode.unSelect:SetActive(not bOn)
self._mapNode.txt_Select.gameObject:SetActive(bOn)
self._mapNode.txt_unSelect.gameObject:SetActive(not bOn)
NovaAPI.SetTMPColor(self._mapNode.txt_Select, White_Normal)
NovaAPI.SetTMPColor(self._mapNode.txt_unSelect, Blue_Normal)
end
function TemplateToggleReengagementCtrl:SetDefaultDorm(bOn)
if self._mapNode.AnimSwitch.enabled == true then
self._mapNode.AnimSwitch.enabled = false
end
self._mapNode.Select:SetActive(bOn)
self._mapNode.unSelect:SetActive(not bOn)
self._mapNode.txt_Select.gameObject:SetActive(bOn)
self._mapNode.txt_unSelect.gameObject:SetActive(not bOn)
end
function TemplateToggleReengagementCtrl:SetDefaultAct10101(bOn)
if self._mapNode.AnimSwitch.enabled == true then
self._mapNode.AnimSwitch.enabled = false
end
self._mapNode.Select:SetActive(bOn)
self._mapNode.unSelect:SetActive(not bOn)
self._mapNode.txt_Select.gameObject:SetActive(bOn)
self._mapNode.txt_unSelect.gameObject:SetActive(not bOn)
NovaAPI.SetTMPColor(self._mapNode.txt_Select, Color(1, 1, 1, 1))
NovaAPI.SetTMPColor(self._mapNode.txt_unSelect, Color(0.2196078431372549, 0.1803921568627451, 0.1450980392156863, 1))
end
function TemplateToggleReengagementCtrl:SetDefaultActivity(bOn, colorSelect, colorUnSelect)
if self._mapNode.AnimSwitch.enabled == true then
self._mapNode.AnimSwitch.enabled = false
end
self._mapNode.Select:SetActive(bOn)
self._mapNode.unSelect:SetActive(not bOn)
self._mapNode.txt_Select.gameObject:SetActive(bOn)
self._mapNode.txt_unSelect.gameObject:SetActive(not bOn)
if colorSelect ~= nil then
NovaAPI.SetTMPColor(self._mapNode.txt_Select, colorSelect)
NovaAPI.SetTMPColor(self._mapNode.txt_unSelect, colorUnSelect)
end
end
function TemplateToggleReengagementCtrl:SetTrigger(bOn)
if self._mapNode.AnimSwitch.enabled == false then
self._mapNode.AnimSwitch.enabled = true
end
if bOn then
self._mapNode.AnimSwitch:SetTrigger("tOn")
else
self._mapNode.AnimSwitch:SetTrigger("tOff")
end
end
function TemplateToggleReengagementCtrl:ResetTrigger()
if self._mapNode.AnimSwitch.enabled == false then
self._mapNode.AnimSwitch.enabled = true
end
self._mapNode.AnimSwitch:ResetTrigger("tOff")
end
function TemplateToggleReengagementCtrl:SetReddot(sKey, param)
self:UnRegisterReddot()
if sKey == nil then
return
end
self.sReddotKey = sKey
self.mapReddotParam = param
RedDotManager.RegisterNode(sKey, param, self._mapNode.reddotTog)
end
function TemplateToggleReengagementCtrl:UnRegisterReddot()
if self.sReddotKey ~= nil then
RedDotManager.UnRegisterNode(self.sReddotKey, self.mapReddotParam, self._mapNode.reddotTog)
end
self.sReddotKey = nil
self.mapReddotParam = nil
end
function TemplateToggleReengagementCtrl:OnEnable()
self._mapNode.reddotTog:SetActive(false)
end
return TemplateToggleReengagementCtrl
+50 -8
View File
@@ -32,6 +32,7 @@ local sEntranceFolder = "UI_Activity/%s.prefab"
local sActTypePath = {
[GameEnum.activityType.PeriodicQuest] = "PeriodicQuest",
[GameEnum.activityType.LoginReward] = "LoginReward",
[GameEnum.activityType.SignIn] = "LoginReward",
[GameEnum.activityType.Mining] = "Mining",
[GameEnum.activityType.Trial] = "Trial",
[GameEnum.activityType.Cookie] = "Cookie",
@@ -42,8 +43,22 @@ local sActTypePath = {
[GameEnum.activityType.PenguinCard] = "PenguinCard",
[GameEnum.activityType.Double] = "DoubleDrop",
[GameEnum.activityType.FollowSocialMedia] = "FollowSocialMedia",
[GameEnum.activityType.Soldier] = "Soldier"
[GameEnum.activityType.Soldier] = "Soldier",
[GameEnum.activityType.MailBind] = "MailBind"
}
function ActivityListCtrl:GetEntranceId()
if self.nInitActId ~= nil and self.nInitActId ~= 0 then
local actCfg = ConfigTable.GetData("Activity", self.nInitActId)
if actCfg ~= nil then
return actCfg.EntranceId or 0
end
local actGroupCfg = ConfigTable.GetData("ActivityGroup", self.nInitActId)
if actGroupCfg ~= nil then
return actGroupCfg.EntranceId or 0
end
end
return self.nEntranceId or 0
end
function ActivityListCtrl:InitActivityList(nCurActId)
local tbActList = PlayerData.Activity:GetSortedActList()
local tbActGroupList = PlayerData.Activity:GetSortedActGroupList()
@@ -52,8 +67,9 @@ function ActivityListCtrl:InitActivityList(nCurActId)
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
end
local nCurEntranceId = self:GetEntranceId()
for k, v in ipairs(tbActList) do
if not v.actCfg.HideFromActivityList then
if not v.actCfg.HideFromActivityList and (v.actCfg.EntranceId or 0) == nCurEntranceId then
table.insert(self.tbActList, {
nType = AllEnum.ActivityMainType.Activity,
actData = v
@@ -61,10 +77,12 @@ function ActivityListCtrl:InitActivityList(nCurActId)
end
end
for k, v in ipairs(tbActGroupList) do
table.insert(self.tbActList, {
nType = AllEnum.ActivityMainType.ActivityGroup,
actData = v
})
if (v.actGroupCfg.EntranceId or 0) == nCurEntranceId then
table.insert(self.tbActList, {
nType = AllEnum.ActivityMainType.ActivityGroup,
actData = v
})
end
end
if nil ~= self.tbActList then
if nil ~= self._panel.nSelectActId and nil ~= self.nSelectActMainType then
@@ -186,7 +204,7 @@ function ActivityListCtrl:AddLoginRewardActivityCtrl(actData)
local actCtrl = self.tbActCtrlObj[actData:GetActId()]
if nil == actCtrl then
local mapActCfg = actData:GetLoginRewardControlCfg()
local sCtrlFolder = sActTypePath[GameEnum.activityType.LoginReward]
local sCtrlFolder = sActTypePath[GameEnum.activityType.LoginReward] or sActTypePath[GameEnum.activityType.SignIn]
if sCtrlFolder == nil then
return
end
@@ -443,6 +461,26 @@ function ActivityListCtrl:AddSoldierActivityCtrl(actData)
actCtrl.gameObject:SetActive(true)
actCtrl:InitActData(actData)
end
function ActivityListCtrl:AddMailBindActivityCtrl(actData)
local actCtrl = self.tbActCtrlObj[actData:GetActId()]
if nil == actCtrl then
local sFolder = sActTypePath[GameEnum.activityType.MailBind]
if sFolder == nil then
return
end
local mapActCfg = ConfigTable.GetData("ActivityMailBindControl", actData:GetActId())
if not mapActCfg then
return
end
local sPrefabPath = string.format(sEntranceFolder, mapActCfg.UIAssets)
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.rtContent)
local sCtrlPath = string.format("Game.UI.Activity.%s.%s", sFolder, mapActCfg.CtrlName)
actCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
self.tbActCtrlObj[actData:GetActId()] = actCtrl
end
actCtrl.gameObject:SetActive(true)
actCtrl:InitActData(actData)
end
function ActivityListCtrl:RefreshSelectActivity(bResetDay)
for _, v in pairs(self.tbActCtrlObj) do
v.gameObject:SetActive(false)
@@ -457,7 +495,7 @@ function ActivityListCtrl:RefreshSelectActivity(bResetDay)
local actType = actData.actData:GetActType()
if actType == GameEnum.activityType.PeriodicQuest then
self:AddPeriodicActivityCtrl(actData.actData, bResetDay)
elseif actType == GameEnum.activityType.LoginReward then
elseif actType == GameEnum.activityType.LoginReward or actType == GameEnum.activityType.SignIn then
self:AddLoginRewardActivityCtrl(actData.actData)
elseif actType == GameEnum.activityType.Mining then
self:AddMiningActivityCtrl(actData.actData)
@@ -483,6 +521,8 @@ function ActivityListCtrl:RefreshSelectActivity(bResetDay)
self:AddFollowSocialMediaActivityCtrl(actData.actData)
elseif actType == GameEnum.activityType.Soldier then
self:AddSoldierActivityCtrl(actData.actData)
elseif actType == GameEnum.activityType.MailBind then
self:AddMailBindActivityCtrl(actData.actData)
end
elseif actData.nType == AllEnum.ActivityMainType.ActivityGroup then
self._panel.nSelectActId = actData.actData:GetActGroupId()
@@ -500,11 +540,13 @@ end
function ActivityListCtrl:Awake()
self.nSelectIndex = nil
self.nInitActId = nil
self.nEntranceId = nil
self.bPlayAnim = true
self.tbInitActIds = {}
local tbParams = self:GetPanelParam()
if type(tbParams) == "table" then
self.nInitActId = tbParams[1]
self.nEntranceId = tbParams[2]
end
self._mapNode.goRewardList.gameObject:SetActive(false)
end
@@ -56,13 +56,9 @@ function ActivityBreakOutPopUpCtrl:PlayOpenAnim()
end
end
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))
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)
local sOpen = os.date("%m/%d", self.nOpenTime)
local sEnd = os.date("%m/%d", self.nEndTime)
local dateStr = string.format("%s ~ %s", sOpen, sEnd)
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
end
function ActivityBreakOutPopUpCtrl:RefreshTimeout()
@@ -0,0 +1,162 @@
local ActivityDustDawn_20104PopUpCtrl = class("ActivityDustDawn_20104PopUpCtrl", BaseCtrl)
local TimerManager = require("GameCore.Timer.TimerManager")
local LocalData = require("GameCore.Data.LocalData")
local ClientManager = CS.ClientManager.Instance
ActivityDustDawn_20104PopUpCtrl._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"
}
}
ActivityDustDawn_20104PopUpCtrl._mapEventConfig = {}
function ActivityDustDawn_20104PopUpCtrl: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 ActivityDustDawn_20104PopUpCtrl:PlayOpenAnim()
if self.anim then
self.anim:Play("open", 0, 0)
end
end
function ActivityDustDawn_20104PopUpCtrl:RefreshDate()
local nOpenYear = tonumber(os.date("%Y", self.nOpenTime))
local nOpenMonth = tonumber(os.date("%m", self.nOpenTime))
local nOpenDay = tonumber(os.date("%d", self.nOpenTime))
local nEndYear = tonumber(os.date("%Y", self.nEndTime))
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/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
end
function ActivityDustDawn_20104PopUpCtrl: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 ActivityDustDawn_20104PopUpCtrl: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 ActivityDustDawn_20104PopUpCtrl: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 ActivityDustDawn_20104PopUpCtrl: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, true)
end
EventManager.Hit(EventId.SetTransition, self.actGroupCfg.TransitionId, callback)
else
EventManager.Hit(EventId.OpenPanel, self.actGroupCfg.PanelId, self.actGroupCfg.Id, true)
end
end, true, true, true)
end
end
return ActivityDustDawn_20104PopUpCtrl
@@ -0,0 +1,162 @@
local ActivityUnchartedMap_10113PopUpCtrl = class("ActivityUnchartedMap_10113PopUpCtrl", BaseCtrl)
local TimerManager = require("GameCore.Timer.TimerManager")
local LocalData = require("GameCore.Data.LocalData")
local ClientManager = CS.ClientManager.Instance
ActivityUnchartedMap_10113PopUpCtrl._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"
}
}
ActivityUnchartedMap_10113PopUpCtrl._mapEventConfig = {}
function ActivityUnchartedMap_10113PopUpCtrl: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 ActivityUnchartedMap_10113PopUpCtrl:PlayOpenAnim()
if self.anim then
self.anim:Play("open", 0, 0)
end
end
function ActivityUnchartedMap_10113PopUpCtrl:RefreshDate()
local nOpenYear = tonumber(os.date("%Y", self.nOpenTime))
local nOpenMonth = tonumber(os.date("%m", self.nOpenTime))
local nOpenDay = tonumber(os.date("%d", self.nOpenTime))
local nEndYear = tonumber(os.date("%Y", self.nEndTime))
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/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
end
function ActivityUnchartedMap_10113PopUpCtrl: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 ActivityUnchartedMap_10113PopUpCtrl: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 ActivityUnchartedMap_10113PopUpCtrl: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 ActivityUnchartedMap_10113PopUpCtrl: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, true)
end
EventManager.Hit(EventId.SetTransition, self.actGroupCfg.TransitionId, callback)
else
EventManager.Hit(EventId.OpenPanel, self.actGroupCfg.PanelId, self.actGroupCfg.Id, true)
end
end, true, true, true)
end
end
return ActivityUnchartedMap_10113PopUpCtrl
@@ -0,0 +1,163 @@
local ActivityStoryReceiveCtrl = class("ActivityStoryReceiveCtrl", BaseCtrl)
ActivityStoryReceiveCtrl._mapNodeConfig = {
btnReceiveCG = {
sComponentName = "UIButton",
callback = "OnBtnClick_ReceiveCG"
},
goOn = {},
goOff = {},
txtBtnReceive = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "StoryReview_Btn_ReceiveCG"
},
reddotGift = {},
goSafeArea = {
sNodeName = "----SafeAreaRoot----"
},
goProgress = {},
txtProgress = {sComponentName = "TMP_Text"},
goReceived = {},
txtReceived = {
sComponentName = "TMP_Text",
sLanguageId = "StoryReview_CGReceived"
},
txtReceiveTip = {
sComponentName = "TMP_Text",
sLanguageId = "StoryReview_ReceiveCGSuc"
},
blur = {
sNodeName = "t_fullscreen_blur_blue"
},
aniBlur = {
sNodeName = "t_fullscreen_blur_blue",
sComponentName = "Animator"
},
btnBlur = {
sNodeName = "snapshot",
sComponentName = "Button",
callback = "OnBtnClick_ClosePopup"
},
goComplete = {
sNodeName = "--Complete--"
},
aniComplete = {
sNodeName = "--Complete--",
sComponentName = "Animator"
}
}
ActivityStoryReceiveCtrl._mapEventConfig = {
Story_Done = "OnEvent_Story_Done",
ActivityStoryReceive_SetVisible = "OnEvent_SetVisible"
}
ActivityStoryReceiveCtrl._mapRedDotConfig = {}
local State = {
Lock = 1,
CanReceive = 2,
Received = 3
}
function ActivityStoryReceiveCtrl:SetState(nState)
self.nState = nState
local bReceived = nState == State.Received
self._mapNode.btnReceiveCG.gameObject:SetActive(not bReceived)
self._mapNode.goOn:SetActive(nState == State.CanReceive)
self._mapNode.goOff:SetActive(nState == State.Lock)
self._mapNode.reddotGift:SetActive(nState == State.CanReceive)
self._mapNode.goProgress:SetActive(not bReceived)
self._mapNode.goReceived:SetActive(bReceived)
end
function ActivityStoryReceiveCtrl:SetProgress(nRead, nTotal)
local sFormat = ConfigTable.GetUIText("StoryReview_ReadProgress") or ""
NovaAPI.SetTMPText(self._mapNode.txtProgress, orderedFormat(sFormat, nRead or 0, nTotal or 0))
end
function ActivityStoryReceiveCtrl:RefreshState()
local nRead, nTotal = PlayerData.StoryReview:GetChapterReadProgress(self.nChapterId)
self:SetProgress(nRead, nTotal)
if PlayerData.StoryReview:IsChapterReadByHandbook(self.nChapterId) then
self:SetState(State.Received)
elseif 0 < nTotal and nTotal <= nRead then
self:SetState(State.CanReceive)
else
self:SetState(State.Lock)
end
end
function ActivityStoryReceiveCtrl:ShowPopup()
self._mapNode.blur:SetActive(true)
self._mapNode.goComplete:SetActive(true)
self._mapNode.aniComplete:Play("ActivityStoryReceivePanel_tips_in")
EventManager.Hit(EventId.TemporaryBlockInput, 0.5)
end
function ActivityStoryReceiveCtrl:HidePopup()
self._mapNode.aniComplete:Play("ActivityStoryReceivePanel_tips_out")
self._mapNode.aniBlur:SetTrigger("tOut")
self:AddTimer(1, 0.33, function()
if self._mapNode == nil then
return
end
self._mapNode.goComplete:SetActive(false)
self._mapNode.blur:SetActive(false)
end, true, true, true)
EventManager.Hit(EventId.TemporaryBlockInput, 0.33)
end
function ActivityStoryReceiveCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.bReview = param[2] == true
end
local mapCfg = ConfigTable.GetData("ActivityStoryChapter", self.nActId)
self.nChapterId = mapCfg ~= nil and mapCfg.ChapterId or 0
end
function ActivityStoryReceiveCtrl:OnEnable()
if not self.bReview then
self.gameObject:SetActive(false)
return
end
self._mapNode.goSafeArea:SetActive(true)
self:RefreshState()
end
function ActivityStoryReceiveCtrl:OnDisable()
end
function ActivityStoryReceiveCtrl:OnDestroy()
end
function ActivityStoryReceiveCtrl:OnBtnClick_ReceiveCG(btn)
if self.nState ~= State.CanReceive then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("StoryReview_ReceiveLockTip"))
return
end
PlayerData.StoryReview:SendChapterPass(self.nChapterId, function()
if self._mapNode == nil then
return
end
self:RefreshState()
self:ShowPopup()
end)
end
function ActivityStoryReceiveCtrl:OnEvent_Story_Done(bHasReward)
if not self.bReview then
return
end
self:RefreshState()
end
function ActivityStoryReceiveCtrl:OnEvent_SetVisible(bShow)
if not self.bReview then
return
end
self.bWantShow = bShow == true
if self.bWantShow then
self._mapNode.goSafeArea:SetActive(true)
return
end
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
if self._mapNode == nil or self.bWantShow then
return
end
self._mapNode.goSafeArea:SetActive(false)
end
cs_coroutine.start(wait)
end
function ActivityStoryReceiveCtrl:OnBtnClick_ClosePopup(btn)
self:HidePopup()
end
return ActivityStoryReceiveCtrl
@@ -0,0 +1,604 @@
local ActivityStoryReviewCtrl = class("ActivityStoryReviewCtrl", BaseCtrl)
local LocalData = require("GameCore.Data.LocalData")
local newDayTime = UTILS.GetDayRefreshTimeOffset()
ActivityStoryReviewCtrl._mapNodeConfig = {
TopBar = {
sNodeName = "TopBarPanel",
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
},
imgBgChapterLower = {sComponentName = "Image"},
imgBgChapterHigher = {sComponentName = "Image"},
goList = {sNodeName = "---List---"},
chapterLsv = {
sComponentName = "LoopScrollView"
},
snapChapter = {
sNodeName = "chapterLsv",
sComponentName = "LoopScrollSnap",
callback = "OnGridSelect_Chapter"
},
goItem = {},
rtList = {
sComponentName = "RectTransform"
},
btnTitle = {
sComponentName = "UIButton",
callback = "OnBtnClick_Title"
},
reddotStoryLineList = {},
imgTitle = {sComponentName = "Image"},
txtTitle = {sComponentName = "TMP_Text"},
goStoryLine = {
sNodeName = "---StoryLineList---"
},
aniStoryLine = {
sNodeName = "---StoryLineList---",
sComponentName = "Animator"
},
tabLsv = {
sComponentName = "LoopScrollView"
},
btnArrow = {
sComponentName = "UIButton",
callback = "OnBtnClick_Arrow"
},
btnCloseStoryLine = {
sComponentName = "UIButton",
callback = "OnBtnClick_Arrow"
},
txtEmpty = {
sComponentName = "TMP_Text",
sLanguageId = "StorySet_Chapter_Empty_Tip"
},
btnShowUnRead = {
sNodeName = "btnShowUnRead",
sComponentName = "UIButton",
callback = "OnClick_ShowUnRead"
},
imgShowUnReadOn = {},
txtShowUnReadDesc = {
sComponentName = "TMP_Text",
sLanguageId = "StorySet_Only_Show_Unread"
},
goPopUp = {
sNodeName = "---PopUp---"
},
goBlur = {
sNodeName = "t_fullscreen_blur_black"
},
goWindow = {},
animWindow = {sNodeName = "rtWindow", sComponentName = "Animator"},
txtStoryTitle = {
sComponentName = "TMP_Text",
sLanguageId = "StoryReview_PreStory_Window_Title"
},
btnClose = {
sComponentName = "UIButton",
callback = "OnBtnClick_CloseWindow"
},
btnBlur = {
sNodeName = "snapshot",
sComponentName = "Button",
callback = "OnBtnClick_CloseWindow"
},
txtWindowTitle = {
sComponentName = "TMP_Text",
sLanguageId = "StoryReview_PreStory_Tips"
},
txtStoryType = {sComponentName = "TMP_Text"},
txtMainlineStoryTitle = {sComponentName = "TMP_Text"},
txtStory = {sComponentName = "TMP_Text"},
btnGoto = {
sComponentName = "UIButton",
callback = "OnBtnClick_Goto"
},
txtBtnGoto = {
sComponentName = "TMP_Text",
sLanguageId = "StoryReview_PreStory_Btn_Goto"
},
btnDontShow = {
sComponentName = "UIButton",
callback = "OnBtnClick_DontShow"
},
imgDontShow2 = {},
txtDontShow = {
sComponentName = "TMP_Text",
sLanguageId = "MessageBox_TodayWarning"
},
btnCancel = {
sComponentName = "UIButton",
callback = "OnBtnClick_Cancel"
},
txtCancelBtn = {
sComponentName = "TMP_Text",
sLanguageId = "StoryReview_Read_Cancel"
},
btnContinue = {
sComponentName = "UIButton",
callback = "OnBtnClick_Continue"
},
txtBtnContinue = {
sComponentName = "TMP_Text",
sLanguageId = "StoryReview_Read_Continue"
}
}
ActivityStoryReviewCtrl._mapEventConfig = {
LoopScrollGridAnimUpdate = "OnEvent_GridAnimUpdate"
}
ActivityStoryReviewCtrl._mapRedDotConfig = {
[RedDotDefine.StoryReview] = {
sNodeName = "reddotStoryLineList"
}
}
function ActivityStoryReviewCtrl:UpdateAllChapters()
self.tbLineChapters = PlayerData.StoryReview:GetAllStoryReview()
self.tbAllLineIds = PlayerData.StoryReview:GetSortedStoryLineIds()
end
function ActivityStoryReviewCtrl:RefreshStoryLineList()
self.tbStoryLineGrid = {}
self._mapNode.tabLsv:Init(#self.tbAllLineIds, self, self.OnGridLineRefresh, self.OnGridLineBtnClick, true)
end
function ActivityStoryReviewCtrl:OnGridLineRefresh(goGrid, nGridIndex)
local nLineId = self.tbAllLineIds[nGridIndex + 1]
if nLineId ~= nil then
self.tbStoryLineGrid[nLineId] = goGrid
local goRedDot = goGrid.transform:Find("btnGrid/AnimRoot/reddotStoryLine")
RedDotManager.RegisterNode(RedDotDefine.StoryReview_StoryLine, nLineId, goRedDot, nil, nil, true)
local mapCfg = ConfigTable.GetData("ActivityStoryLine", nLineId)
if mapCfg ~= nil then
local txtStoryLine = goGrid.transform:Find("btnGrid/AnimRoot/goDeselect/txtStoryLine"):GetComponent("TMP_Text")
local txtStoryLineSelect = goGrid.transform:Find("btnGrid/AnimRoot/goSelect/txtStoryLineSelect"):GetComponent("TMP_Text")
local goSelect = goGrid.transform:Find("btnGrid/AnimRoot/goSelect")
local goDeselect = goGrid.transform:Find("btnGrid/AnimRoot/goDeselect")
goSelect.gameObject:SetActive(nLineId == self.nSelectLineId)
goDeselect.gameObject:SetActive(nLineId ~= self.nSelectLineId)
NovaAPI.SetTMPText(txtStoryLine, mapCfg.Title)
NovaAPI.SetTMPText(txtStoryLineSelect, mapCfg.Title)
end
end
end
function ActivityStoryReviewCtrl:OnGridLineBtnClick(goGrid, nGridIndex)
local nSelectLine = self.tbAllLineIds[nGridIndex + 1] or 0
if self.nSelectLineId == nSelectLine then
return
end
local goLastGrid = self.tbStoryLineGrid[self.nSelectLineId]
if goLastGrid ~= nil then
local imgLastSelect = goLastGrid.transform:Find("btnGrid/AnimRoot/goSelect")
local imgLastUnSelect = goLastGrid.transform:Find("btnGrid/AnimRoot/goDeselect")
imgLastSelect.gameObject:SetActive(false)
imgLastUnSelect.gameObject:SetActive(true)
end
local goSelect = goGrid.transform:Find("btnGrid/AnimRoot/goSelect")
local goDeselect = goGrid.transform:Find("btnGrid/AnimRoot/goDeselect")
local ani = goGrid.transform:Find("btnGrid/AnimRoot"):GetComponent("Animator")
goSelect.gameObject:SetActive(true)
goDeselect.gameObject:SetActive(false)
ani:Play("rtLineList_in", 0, 0)
self.ani:Play("ActivityStoryReview_switch", 0, 0)
self.nSelectLineId = nSelectLine
self.nScrollPos = nil
self:RefreshChapterList()
end
function ActivityStoryReviewCtrl:UpdateSelectChapters()
self.tbSelectChapters = self.tbLineChapters[self.nSelectLineId] or {}
if not PlayerData.StoryReview:GetOnlyShowUnRead() then
return
end
local tbUnRead = {}
for _, nChapterId in ipairs(self.tbSelectChapters) do
if not PlayerData.StoryReview:IsChapterReadByHandbook(nChapterId) then
table.insert(tbUnRead, nChapterId)
end
end
self.tbSelectChapters = tbUnRead
end
function ActivityStoryReviewCtrl:RefreshChapterList()
self.nSelectChapterId = 0
self.nPreChapterType = 0
self.nPreChapterId = 0
self:UpdateSelectChapters()
self.nBgLowerIndex = nil
local mapLineCfg = ConfigTable.GetData("ActivityStoryLine", self.nSelectLineId)
if mapLineCfg ~= nil then
NovaAPI.SetTMPText(self._mapNode.txtTitle, mapLineCfg.Title)
end
for nInstanceId, objCtrl in pairs(self.tbChaptersGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbChaptersGridCtrl[nInstanceId] = nil
end
local bEmpty = #self.tbSelectChapters == 0
self._mapNode.txtEmpty.gameObject:SetActive(bEmpty)
self._mapNode.chapterLsv.gameObject:SetActive(not bEmpty)
if bEmpty then
self.nBgIndex = nil
self:SetChapterBgSprite(self._mapNode.imgBgChapterLower, nil)
self:SetChapterBgSprite(self._mapNode.imgBgChapterHigher, nil)
else
self._mapNode.chapterLsv:Init(#self.tbSelectChapters, self, self.OnGridChaptersRefresh, self.OnGridChaptersBtnClick, self.nScrollPos ~= nil)
EventManager.Hit("ActivityStoryReviewListIn")
end
end
function ActivityStoryReviewCtrl:OnGridChaptersRefresh(goGrid, nGridIndex)
local nInstanceId = goGrid:GetInstanceID()
if not self.tbChaptersGridCtrl[nInstanceId] then
self.tbChaptersGridCtrl[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.ActivityStoryReview.ActivityStoryReviewItemCtrl")
end
local nChapterId = self.tbSelectChapters[nGridIndex + 1]
if nChapterId ~= nil then
self.tbChaptersGridCtrl[nInstanceId]:SetItem(nChapterId)
end
end
function ActivityStoryReviewCtrl:OnGridChaptersBtnClick(goGrid, nGridIndex)
local nChapterId = self.tbSelectChapters[nGridIndex + 1]
if nChapterId == nil then
return
end
local mapCfg = CacheTable.GetData("_ActivityStoryChapter", nChapterId)
if mapCfg == nil then
return
end
self.nSelectChapterId = nChapterId
self.bSelectChapterRead = PlayerData.StoryReview:IsChapterReadByHandbook(nChapterId)
self.nPreChapterType = mapCfg.PrevChapterType
self.nPreChapterId = mapCfg.PrevChapterId
local bMove = self.nBgIndex ~= nGridIndex + 1
if bMove then
self._mapNode.chapterLsv:SetScrollGridPos(nGridIndex, 0.2, 0)
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
self:AddTimer(1, 0.2, function()
self:OpenStoryChapter(nChapterId)
end, true, true, true)
else
self:OpenStoryChapter(nChapterId)
end
end
function ActivityStoryReviewCtrl:OpenStoryChapter(nChapterId)
local open = function()
if self.bOpenStoryLine then
self.ani:Play("ActivityStoryReview_out2", 0, 0)
else
self.ani:Play("ActivityStoryReview_out1", 0, 0)
end
EventManager.Hit("ActivityStoryReviewListOut")
self._mapNode.btnCloseStoryLine.gameObject:SetActive(false)
self._mapNode.btnTitle.gameObject:SetActive(false)
self._mapNode.goStoryLine.gameObject:SetActive(false)
self._mapNode.TopBar.gameObject:SetActive(false)
EventManager.Hit(EventId.TemporaryBlockInput, 0.5)
self:AddTimer(1, 0.5, function()
PlayerData.StoryReview:TryOpenStoryChapter(nChapterId)
end, true, true, true)
end
local checkOpenWindow = function(bPass)
if not bPass and not self.dontShowAgain then
self:ShowPreStoryWindow()
else
open()
end
end
if self.nPreChapterType == GameEnum.ActivityStoryPreviewType.MainlineStory then
local bPass = PlayerData.Avg:IsChapterLastStoryRead(self.nPreChapterId)
checkOpenWindow(bPass)
elseif self.nPreChapterType == GameEnum.ActivityStoryPreviewType.StorySet then
local bPass = PlayerData.StorySet:IsChapterAllRead(self.nPreChapterId)
checkOpenWindow(bPass)
elseif self.nPreChapterType == GameEnum.ActivityStoryPreviewType.ActivityStory then
if PlayerData.StoryReview:IsChapterLoaded(self.nPreChapterId) then
local bPass = PlayerData.StoryReview:IsChapterRead(self.nPreChapterId)
checkOpenWindow(bPass)
else
local netCallback = function()
local bPass = PlayerData.StoryReview:IsChapterRead(self.nPreChapterId)
checkOpenWindow(bPass)
end
PlayerData.StoryReview:SendGetChapterInfo(self.nPreChapterId, netCallback)
end
else
open()
end
end
function ActivityStoryReviewCtrl:MoveChapterList(bImmediate)
local fOpenOffsetX = 277
local fMoveTime = 0.2
local rtList = self._mapNode.rtList
local nTargetX = self.bOpenStoryLine and fOpenOffsetX or 0
rtList:DOKill()
if bImmediate then
rtList.anchoredPosition = Vector2(nTargetX, -40)
else
rtList:DOAnchorPosX(nTargetX, fMoveTime):SetUpdate(true):SetEase(Ease.InOutQuad)
end
end
function ActivityStoryReviewCtrl:ShowStoryLine(bImmediate)
self._mapNode.btnCloseStoryLine.gameObject:SetActive(self.bOpenStoryLine)
self._mapNode.btnTitle.gameObject:SetActive(not self.bOpenStoryLine)
self:MoveChapterList(bImmediate)
if self.bOpenStoryLine then
self._mapNode.tabLsv:SetScrollGridPos(self.nSelectLineId - 1, 0, 1)
self._mapNode.goStoryLine.gameObject:SetActive(true)
self._mapNode.aniStoryLine:Play("StoryLineList_in", 0, 0)
EventManager.Hit(EventId.TemporaryBlockInput, 0.26)
elseif bImmediate then
self._mapNode.goStoryLine.gameObject:SetActive(false)
else
self._mapNode.aniStoryLine:Play("StoryLineList_out", 0, 0)
self.ani:Play("ActivityStoryReview_out", 0, 0)
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
self:AddTimer(1, 0.2, function()
self._mapNode.goStoryLine.gameObject:SetActive(false)
end, true, true, true)
end
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.TopBar.gameObject:SetActive(not self.bOpenStoryLine)
end
cs_coroutine.start(wait)
end
function ActivityStoryReviewCtrl:ShowPreStoryWindow()
self._mapNode.goPopUp.gameObject:SetActive(true)
self._mapNode.goWindow.gameObject:SetActive(false)
self._mapNode.goBlur.gameObject:SetActive(true)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.goWindow:SetActive(true)
self._mapNode.animWindow:Play("t_window_04_t_in")
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
end
cs_coroutine.start(wait)
local sName = ""
if self.nPreChapterType == GameEnum.ActivityStoryPreviewType.MainlineStory then
NovaAPI.SetTMPText(self._mapNode.txtStoryType, ConfigTable.GetUIText("StoryReview_PreType_Mainline"))
self._mapNode.txtMainlineStoryTitle.gameObject:SetActive(true)
local chapterConfig = ConfigTable.GetData("StoryChapter", self.nPreChapterId, "")
NovaAPI.SetTMPText(self._mapNode.txtMainlineStoryTitle, chapterConfig.Name)
sName = chapterConfig.Desc
elseif self.nPreChapterType == GameEnum.ActivityStoryPreviewType.StorySet then
NovaAPI.SetTMPText(self._mapNode.txtStoryType, ConfigTable.GetUIText("StoryReview_PreType_StorySet"))
self._mapNode.txtMainlineStoryTitle.gameObject:SetActive(false)
local chapterConfig = ConfigTable.GetData("StorySetChapter", self.nPreChapterId, "")
sName = chapterConfig.Name
elseif self.nPreChapterType == GameEnum.ActivityStoryPreviewType.ActivityStory then
NovaAPI.SetTMPText(self._mapNode.txtStoryType, ConfigTable.GetUIText("StoryReview_PreType_ActivityStory"))
self._mapNode.txtMainlineStoryTitle.gameObject:SetActive(false)
local chapterConfig = CacheTable.GetData("_ActivityStoryChapter", self.nPreChapterId, "")
sName = chapterConfig.Title
end
NovaAPI.SetTMPText(self._mapNode.txtStory, sName)
end
function ActivityStoryReviewCtrl:GetChapterBg(nIndex)
local nChapterId = self.tbSelectChapters[nIndex]
if nChapterId == nil then
return nil
end
local mapCfgData = CacheTable.GetData("_ActivityStoryChapter", nChapterId)
if mapCfgData == nil or mapCfgData.IconRes3 == "" then
return nil
end
return mapCfgData.IconRes3
end
function ActivityStoryReviewCtrl:SetChapterBgSprite(imgBg, sBg)
local bHasBg = sBg ~= nil and sBg ~= ""
imgBg.gameObject:SetActive(bHasBg)
if bHasBg then
self:SetPngSprite(imgBg, sBg)
end
end
function ActivityStoryReviewCtrl:RefreshChapterBgPair(nLowerIndex)
if self.nBgLowerIndex == nLowerIndex then
return
end
self.nBgLowerIndex = nLowerIndex
self:SetChapterBgSprite(self._mapNode.imgBgChapterLower, self:GetChapterBg(nLowerIndex))
self:SetChapterBgSprite(self._mapNode.imgBgChapterHigher, self:GetChapterBg(nLowerIndex + 1))
end
function ActivityStoryReviewCtrl:UpdateChapterBgFade(ratio)
if self.nBgIndex == nil then
return
end
local nBgAnimRange = 2
local fBgFadeHold = 0.2
local fOffset = (0.5 - ratio) * 2 * nBgAnimRange
fOffset = math.min(math.max(fOffset, -0.5), 0.5)
local bBack = fOffset < 0
local nLowerIndex = bBack and self.nBgIndex - 1 or self.nBgIndex
local fT = bBack and fOffset + 1 or fOffset
self:RefreshChapterBgPair(nLowerIndex)
local fProgress = math.min(math.max(fT - fBgFadeHold, 0) / (1 - 2 * fBgFadeHold), 1)
if nLowerIndex < 1 then
fProgress = 1
elseif nLowerIndex + 1 > #self.tbSelectChapters then
fProgress = 0
end
NovaAPI.SetImageColor(self._mapNode.imgBgChapterLower, Color(1, 1, 1, 1 - fProgress))
NovaAPI.SetImageColor(self._mapNode.imgBgChapterHigher, Color(1, 1, 1, fProgress))
end
function ActivityStoryReviewCtrl:ClosePreStoryWindow()
if self.dontShowAgain then
local _curTimeStamp = CS.ClientManager.Instance.serverTimeStampWithTimeZone
local _fixedTimeStamp = _curTimeStamp + newDayTime * 3600
local _nYear = tonumber(os.date("!%Y", _fixedTimeStamp))
local _nMonth = tonumber(os.date("!%m", _fixedTimeStamp))
local _nDay = tonumber(os.date("!%d", _fixedTimeStamp))
local _nowD = _nYear * 366 + _nMonth * 31 + _nDay
LocalData.SetPlayerLocalData("ActStoryReview_Tips_Time", tostring(_nowD))
end
self._mapNode.goBlur.gameObject:SetActive(false)
self._mapNode.goWindow.gameObject:SetActive(false)
end
function ActivityStoryReviewCtrl:PlayWindowCloseAnim()
self._mapNode.animWindow:Play("t_window_04_t_out")
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
self:AddTimer(1, 0.3, function()
self:ClosePreStoryWindow()
end, true, true, true)
end
function ActivityStoryReviewCtrl:Awake()
self.nSelectLineId = 0
self.nSelectChapterId = 0
self.tbAllChapters = {}
self.tbSelectChapters = {}
self.bOpenStoryLine = false
self.tbStoryLineGrid = {}
self.tbChaptersGridCtrl = {}
self.ani = self.gameObject.transform:GetComponent("Animator")
self.bSelectChapterRead = false
self._mapNode.imgShowUnReadOn:SetActive(PlayerData.StoryReview:GetOnlyShowUnRead())
end
function ActivityStoryReviewCtrl:OnEnable()
local TipsTime = LocalData.GetPlayerLocalData("ActStoryReview_Tips_Time")
local _tipDay = 0
if TipsTime ~= nil then
_tipDay = tonumber(TipsTime)
end
local curTimeStamp = CS.ClientManager.Instance.serverTimeStampWithTimeZone
local fixedTimeStamp = curTimeStamp + newDayTime * 3600
local nYear = tonumber(os.date("!%Y", fixedTimeStamp))
local nMonth = tonumber(os.date("!%m", fixedTimeStamp))
local nDay = tonumber(os.date("!%d", fixedTimeStamp))
local nowD = nYear * 366 + nMonth * 31 + nDay
self.dontShowAgain = nowD == _tipDay
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
self:UpdateAllChapters()
PlayerData.StoryReview:RefreshAvgRedDot()
if PlayerData.StoryReview:GetOnlyShowUnRead() and self.nSelectChapterId ~= 0 and not self.bSelectChapterRead and PlayerData.StoryReview:IsChapterReadByHandbook(self.nSelectChapterId) then
self.nScrollPos = nil
end
self.nLastReadChapterId = PlayerData.StoryReview:GetLastReadChapterId() or 0
local tbParam = self:GetPanelParam()
local nTargetChapterId = 0
if type(tbParam) == "table" then
nTargetChapterId = tonumber(tbParam[1]) or 0
end
local nEffectiveChapterId = 0
if nTargetChapterId ~= nil and nTargetChapterId ~= 0 then
nEffectiveChapterId = nTargetChapterId
elseif self.nLastReadChapterId ~= 0 then
nEffectiveChapterId = self.nLastReadChapterId
end
if self.nSelectLineId == 0 then
if nEffectiveChapterId ~= 0 then
for _, nLineId in ipairs(self.tbAllLineIds) do
local tbChapters = self.tbLineChapters[nLineId]
if tbChapters ~= nil then
for _, nChapterId in ipairs(tbChapters) do
if nChapterId == nEffectiveChapterId then
self.nSelectLineId = nLineId
break
end
end
end
if self.nSelectLineId ~= 0 then
break
end
end
end
if self.nSelectLineId == 0 then
self.nSelectLineId = self.tbAllLineIds[1] or 0
end
end
self:RefreshStoryLineList()
self:RefreshChapterList()
self:ShowStoryLine(true)
end
function ActivityStoryReviewCtrl:OnDisable()
self._mapNode.rtList:DOKill()
for nInstanceId, objCtrl in pairs(self.tbChaptersGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbChaptersGridCtrl[nInstanceId] = nil
end
self.nScrollPos = self._mapNode.chapterLsv:GetScrollPos()
end
function ActivityStoryReviewCtrl:OnDestroy()
end
function ActivityStoryReviewCtrl:OnRelease()
end
function ActivityStoryReviewCtrl:OnBtnClick_Title()
self.bOpenStoryLine = true
self:ShowStoryLine()
end
function ActivityStoryReviewCtrl:OnBtnClick_Arrow()
self.bOpenStoryLine = false
self:ShowStoryLine()
end
function ActivityStoryReviewCtrl:OnClick_ShowUnRead()
local bOnlyShowUnRead = not PlayerData.StoryReview:GetOnlyShowUnRead()
PlayerData.StoryReview:SetOnlyShowUnRead(bOnlyShowUnRead)
self._mapNode.imgShowUnReadOn:SetActive(bOnlyShowUnRead)
if self.bOpenStoryLine then
self.ani:Play("ActivityStoryReview_switch", 0, 0)
else
self.ani:Play("ActivityStoryReview_in", 0, 0)
end
self.nScrollPos = nil
self:RefreshChapterList()
end
function ActivityStoryReviewCtrl:OnBtnClick_CloseWindow()
self:PlayWindowCloseAnim()
end
function ActivityStoryReviewCtrl:OnBtnClick_Goto()
local nChapterId = self.nPreChapterId or 0
if nChapterId == 0 then
self:ClosePreStoryWindow()
return
end
local lockTips = function(sTip)
if sTip ~= nil and sTip ~= "" then
EventManager.Hit(EventId.OpenMessageBox, sTip)
else
printError("前置剧情锁着但没取到锁定原因,章节 id:" .. tostring(nChapterId))
end
end
if self.nPreChapterType == GameEnum.ActivityStoryPreviewType.MainlineStory then
local bUnlock, sTip = PlayerData.Avg:IsStoryChapterUnlock(nChapterId)
if not bUnlock then
lockTips(sTip)
return
end
self:ClosePreStoryWindow()
local chapterCfg = ConfigTable.GetData("StoryChapter", nChapterId)
local nPanelId = chapterCfg ~= nil and chapterCfg.StoryPanelId or 0
if nPanelId == 0 then
nPanelId = PanelId.MainlineEx
end
EventManager.Hit(EventId.OpenPanel, nPanelId, nChapterId)
elseif self.nPreChapterType == GameEnum.ActivityStoryPreviewType.StorySet then
PlayerData.StorySet:TryOpenStorySetPanel(function()
local bUnlock, sTip = PlayerData.StorySet:IsChapterUnlock(nChapterId)
if not bUnlock then
lockTips(sTip)
return
end
self:ClosePreStoryWindow()
EventManager.Hit(EventId.OpenPanel, PanelId.StorySet, true, nChapterId)
end)
elseif self.nPreChapterType == GameEnum.ActivityStoryPreviewType.ActivityStory then
if not PlayerData.StoryReview:CheckStoryInReview(nChapterId) then
lockTips(ConfigTable.GetUIText("Activity_Not_Open"))
return
end
self:ClosePreStoryWindow()
PlayerData.StoryReview:TryOpenStoryChapter(nChapterId)
else
self:ClosePreStoryWindow()
end
end
function ActivityStoryReviewCtrl:OnBtnClick_DontShow()
self.dontShowAgain = not self.dontShowAgain
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
end
function ActivityStoryReviewCtrl:OnBtnClick_Cancel()
self:PlayWindowCloseAnim()
end
function ActivityStoryReviewCtrl:OnBtnClick_Continue()
self:ClosePreStoryWindow()
PlayerData.StoryReview:TryOpenStoryChapter(self.nSelectChapterId)
end
function ActivityStoryReviewCtrl:OnGridSelect_Chapter(_, goGrid)
self.nBgIndex = tonumber(goGrid.name) + 1
end
function ActivityStoryReviewCtrl:OnEvent_GridAnimUpdate(ratio, index)
self.nBgIndex = index + 1
self:UpdateChapterBgFade(ratio)
end
return ActivityStoryReviewCtrl
@@ -0,0 +1,56 @@
local ActivityStoryReviewItemCtrl = class("ActivityStoryReviewItemCtrl", BaseCtrl)
ActivityStoryReviewItemCtrl._mapNodeConfig = {
goRedDot = {},
reddotChapter = {},
txtStoryTime = {sComponentName = "TMP_Text"},
goContinue = {},
txtContinue = {
sComponentName = "TMP_Text",
sLanguageId = "StoryReview_Read_Continue"
},
imgStoryTitle = {sComponentName = "Image"},
imgChapter = {sComponentName = "Image"},
aniItem = {sNodeName = "goItem", sComponentName = "Animator"}
}
ActivityStoryReviewItemCtrl._mapEventConfig = {
ActivityStoryReviewListIn = "OnEvent_In",
ActivityStoryReviewListOut = "OnEvent_Out"
}
ActivityStoryReviewItemCtrl._mapRedDotConfig = {}
local fTitleScale = 0.6
function ActivityStoryReviewItemCtrl:SetItem(nChapterId)
self.nChapterId = nChapterId
local mapCfgData = CacheTable.GetData("_ActivityStoryChapter", nChapterId)
if mapCfgData ~= nil then
NovaAPI.SetTMPText(self._mapNode.txtStoryTime, mapCfgData.StoryTime)
self:SetPngSprite(self._mapNode.imgStoryTitle, mapCfgData.IconRes1)
self:SetPngSprite(self._mapNode.imgChapter, mapCfgData.IconRes2)
local imgStoryTitle = self._mapNode.imgStoryTitle
if imgStoryTitle.sprite ~= nil then
NovaAPI.SetImageNativeSize(imgStoryTitle)
local v2Size = imgStoryTitle.rectTransform.sizeDelta
imgStoryTitle.rectTransform.sizeDelta = Vector2(v2Size.x * fTitleScale, v2Size.y * fTitleScale)
end
end
self._mapNode.goRedDot.gameObject:SetActive(false)
local nLineId = mapCfgData ~= nil and mapCfgData.StoryLineId or 0
RedDotManager.RegisterNode(RedDotDefine.StoryReview_Chapter, {nLineId, nChapterId}, self._mapNode.reddotChapter, nil, nil, true)
local nLastReadChapterId = PlayerData.StoryReview:GetLastReadChapterId() or 0
local bContinue = nChapterId == nLastReadChapterId
self._mapNode.goContinue.gameObject:SetActive(bContinue)
end
function ActivityStoryReviewItemCtrl:Awake()
end
function ActivityStoryReviewItemCtrl:OnEnable()
end
function ActivityStoryReviewItemCtrl:OnDisable()
end
function ActivityStoryReviewItemCtrl:OnDestroy()
end
function ActivityStoryReviewItemCtrl:OnEvent_In()
self._mapNode.aniItem:Play("chapterLsv_in", 0, 0)
end
function ActivityStoryReviewItemCtrl:OnEvent_Out()
self._mapNode.aniItem:Play("chapterLsv_out", 0, 0)
end
return ActivityStoryReviewItemCtrl
@@ -0,0 +1,20 @@
local ActivityStoryReviewPanel = class("ActivityStoryReviewPanel", BasePanel)
ActivityStoryReviewPanel._tbDefine = {
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReviewPanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReviewCtrl"
}
}
function ActivityStoryReviewPanel:Awake()
end
function ActivityStoryReviewPanel:OnEnable()
end
function ActivityStoryReviewPanel:OnAfterEnter()
end
function ActivityStoryReviewPanel:OnDisable()
end
function ActivityStoryReviewPanel:OnDestroy()
end
function ActivityStoryReviewPanel:OnRelease()
end
return ActivityStoryReviewPanel
@@ -1,7 +1,6 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local SpringFestivalStoryCtrl = class("SpringFestivalStoryCtrl", BaseCtrl)
local ActivityAvgData = PlayerData.ActivityAvg
SpringFestivalStoryCtrl._mapNodeConfig = {
svStory = {
sComponentName = "LoopScrollView"
@@ -48,7 +47,9 @@ function SpringFestivalStoryCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.bReview = param[2] == true
end
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self.storyNodePos = {27, -30}
self.tbGridTimer = {}
self.nScrollTime = 0.5
@@ -63,13 +64,13 @@ function SpringFestivalStoryCtrl:RefreshPanel()
self:RefreshStoryList()
end
function SpringFestivalStoryCtrl:RefreshStoryList()
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
self.tbAllStory, self.nChapterId = self.storyData:GetStoryIdListByActivityId(self.nActId)
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
return
end
self._mapNode.svStory:SetAnim(0.07)
self._mapNode.svStory:Init(#self.tbAllStory, self, self.OnRefreshGrid)
local recentStoryId = PlayerData.ActivityAvg:GetRecentStoryId(self.nChapterId)
local recentStoryId = self.storyData:GetRecentStoryId(self.nChapterId)
local recentIndex = 1
for i = 1, #self.tbAllStory do
if self.tbAllStory[i] == recentStoryId then
@@ -106,9 +107,9 @@ function SpringFestivalStoryCtrl:OnRefreshGrid(grid, index)
local goLockState = btnGridText.transform:Find("scale_on_click/goLockState").gameObject
local goComplete = btnGridText.transform:Find("scale_on_click/goComplete").gameObject
local txtComplete = goComplete.transform:Find("imgBg/txtComplete"):GetComponent("TMP_Text")
local isUnlock, tbResult = PlayerData.ActivityAvg:IsUnlock(avgcfg.ConditionId)
local isReaded = PlayerData.ActivityAvg:IsStoryReaded(storyId)
local bOpen, nOpenTime = PlayerData.ActivityAvg:IsOpen(avgcfg.StoryId)
local isUnlock, tbResult = self.storyData:IsUnlock(avgcfg.ConditionId)
local isReaded = self.storyData:IsStoryReaded(storyId)
local bOpen, nOpenTime = self.storyData:IsOpen(avgcfg.StoryId)
self:SetPngSprite(imgStory, string.format("Icon/ActivityStory/ep_event03_%02d", gridIndex))
imgStory.gameObject:SetActive(bOpen and isUnlock)
NovaAPI.SetTMPText(txtTitle, avgcfg.Index)
@@ -138,12 +139,16 @@ function SpringFestivalStoryCtrl:OnRefreshGrid(grid, index)
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)
if self.bReview then
RedDot:SetActive(false)
else
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
end
local clickFuc = function()
if not bOpen or self.bCantClick then
return
@@ -152,10 +157,10 @@ function SpringFestivalStoryCtrl:OnRefreshGrid(grid, index)
local bNew = not isReaded
self.avgId = avgcfg.StoryId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew, self.bReview)
self.curIndex = gridIndex
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
PlayerData.ActivityAvg:RefreshAvgRedDot()
LocalData.SetPlayerLocalData(self.storyData:_GetLocalReadKey(self.nActId, avgcfg.Id), true)
self.storyData:RefreshAvgRedDot()
elseif tbResult ~= nil then
local lockTxt = ""
for i = 1, #tbResult do
@@ -180,7 +185,7 @@ function SpringFestivalStoryCtrl:OnRefreshGrid(grid, index)
for k, v in pairs(tbStoryIds) do
if v == false then
local storyData = ConfigTable.GetData("ActivityStory", k)
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
if self.storyData:IsUnlock(storyData.ConditionId) then
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
break
end
@@ -272,6 +277,7 @@ function SpringFestivalStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function SpringFestivalStoryCtrl:OnEvent_Story_Done(bHasReward)
self:RefreshPanel()
@@ -281,7 +287,7 @@ function SpringFestivalStoryCtrl:OnEvent_Story_Done(bHasReward)
end
function SpringFestivalStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId, self.bReview)
end
if bConfirm then
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
@@ -291,9 +297,11 @@ function SpringFestivalStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self.bCantClick = false
if self.curIndex == #self.tbAllStory then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
function SpringFestivalStoryCtrl:OnBtn_ClickCloseCompete()
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
return SpringFestivalStoryCtrl
@@ -1,13 +1,21 @@
local BasePanel = require("GameCore.UI.BasePanel")
local SpringFestivalStoryPanel = class("SpringFestivalStoryPanel", BasePanel)
SpringFestivalStoryPanel._sUIResRootPath = "UI_Activity/"
SpringFestivalStoryPanel._tbDefine = {
{
sPrefabPath = "10104/Story/SpringThemeStoryPanel.prefab",
sPrefabPath = "ActivityStoryReview/10104/SpringThemeStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10104.Story.SpringFestivalStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function SpringFestivalStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
function SpringFestivalStoryPanel:OnEnable()
end
@@ -1,7 +1,6 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local WinterNightStoryCtrl = class("WinterNightStoryCtrl", BaseCtrl)
local ActivityAvgData = PlayerData.ActivityAvg
WinterNightStoryCtrl._mapNodeConfig = {
svStory = {
sComponentName = "LoopScrollView"
@@ -48,7 +47,9 @@ function WinterNightStoryCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.bReview = param[2] == true
end
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self.storyNodePos = {0, -66.1}
self.tbGridTimer = {}
self.nScrollTime = 0.5
@@ -63,11 +64,11 @@ function WinterNightStoryCtrl:RefreshPanel()
self:RefreshStoryList()
end
function WinterNightStoryCtrl:RefreshStoryList()
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
self.tbAllStory, self.nChapterId = self.storyData:GetStoryIdListByActivityId(self.nActId)
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
return
end
local recentStoryId = PlayerData.ActivityAvg:GetRecentStoryId(self.nChapterId)
local recentStoryId = self.storyData:GetRecentStoryId(self.nChapterId)
local recentIndex = 1
for i = 1, #self.tbAllStory do
if self.tbAllStory[i] == recentStoryId then
@@ -114,9 +115,9 @@ function WinterNightStoryCtrl:OnRefreshGrid(grid, index)
local child = grpRock:GetChild(i - 1)
child.gameObject:SetActive(i == rocketIndex)
end
local isUnlock, tbResult = PlayerData.ActivityAvg:IsUnlock(avgcfg.ConditionId)
local isReaded = PlayerData.ActivityAvg:IsStoryReaded(storyId)
local bOpen, nOpenTime = PlayerData.ActivityAvg:IsOpen(avgcfg.StoryId)
local isUnlock, tbResult = self.storyData:IsUnlock(avgcfg.ConditionId)
local isReaded = self.storyData:IsStoryReaded(storyId)
local bOpen, nOpenTime = self.storyData:IsOpen(avgcfg.StoryId)
local nIndex = 0
if isUnlock then
nIndex = avgcfg.IsBattle and 2 or 1
@@ -156,12 +157,16 @@ function WinterNightStoryCtrl:OnRefreshGrid(grid, index)
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)
if self.bReview then
RedDot:SetActive(false)
else
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
end
local clickFuc = function()
if not bOpen or self.bCantClick then
return
@@ -170,10 +175,10 @@ function WinterNightStoryCtrl:OnRefreshGrid(grid, index)
local bNew = not isReaded
self.avgId = avgcfg.StoryId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew, self.bReview)
self.curIndex = gridIndex
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
PlayerData.ActivityAvg:RefreshAvgRedDot()
LocalData.SetPlayerLocalData(self.storyData:_GetLocalReadKey(self.nActId, avgcfg.Id), true)
self.storyData:RefreshAvgRedDot()
elseif tbResult ~= nil then
local lockTxt = ""
for i = 1, #tbResult do
@@ -198,7 +203,7 @@ function WinterNightStoryCtrl:OnRefreshGrid(grid, index)
for k, v in pairs(tbStoryIds) do
if v == false then
local storyData = ConfigTable.GetData("ActivityStory", k)
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
if self.storyData:IsUnlock(storyData.ConditionId) then
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
break
end
@@ -288,6 +293,7 @@ function WinterNightStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function WinterNightStoryCtrl:OnEvent_Story_Done(bHasReward)
self:RefreshPanel()
@@ -297,7 +303,7 @@ function WinterNightStoryCtrl:OnEvent_Story_Done(bHasReward)
end
function WinterNightStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId, self.bReview)
end
if bConfirm then
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
@@ -307,9 +313,11 @@ function WinterNightStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self.bCantClick = false
if self.curIndex == #self.tbAllStory then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
function WinterNightStoryCtrl:OnBtn_ClickCloseCompete()
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
return WinterNightStoryCtrl
@@ -1,13 +1,21 @@
local BasePanel = require("GameCore.UI.BasePanel")
local WinterNightStoryPanel = class("WinterNightStoryPanel", BasePanel)
WinterNightStoryPanel._sUIResRootPath = "UI_Activity/"
WinterNightStoryPanel._tbDefine = {
{
sPrefabPath = "10105/Story/WinterNightStoryPanel.prefab",
sPrefabPath = "ActivityStoryReview/10105/WinterNightStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10105.Story.WinterNightStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function WinterNightStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
function WinterNightStoryPanel:OnEnable()
end
@@ -1,7 +1,6 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local PostalStoryCtrl = class("PostalStoryCtrl", BaseCtrl)
local ActivityAvgData = PlayerData.ActivityAvg
PostalStoryCtrl._mapNodeConfig = {
svStory = {
sComponentName = "LoopScrollView"
@@ -50,7 +49,9 @@ function PostalStoryCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.bReview = param[2] == true
end
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self.storyNodePos = {0, -66.1}
self.tbGridTimer = {}
self.tbPlayedAnim = {}
@@ -70,11 +71,11 @@ function PostalStoryCtrl:RefreshPanel()
end
function PostalStoryCtrl:RefreshStoryList()
self.tbPlayedAnim = {}
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
self.tbAllStory, self.nChapterId = self.storyData:GetStoryIdListByActivityId(self.nActId)
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
return
end
local recentStoryId = ActivityAvgData:GetRecentStoryId(self.nChapterId)
local recentStoryId = self.storyData:GetRecentStoryId(self.nChapterId)
local recentIndex = 1
for i = 1, #self.tbAllStory do
if self.tbAllStory[i] == recentStoryId then
@@ -119,9 +120,9 @@ function PostalStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchIndex)
local txtComplete = goComplete.transform:Find("imgBg/txtComplete"):GetComponent("TMP_Text")
local btnGridText = grid.transform:Find("btnGridText").gameObject
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, self.nActId)
local isUnlock, tbResult = self.storyData:IsUnlock(avgcfg.ConditionId)
local isReaded = self.storyData:IsStoryReaded(storyId)
local bOpen, nOpenTime = self.storyData:IsOpen(avgcfg.StoryId, self.nActId)
local nIndex = 0
if isUnlock then
nIndex = bBranch and BRANCH_GRID_INDEX or gridIndex
@@ -174,12 +175,16 @@ function PostalStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchIndex)
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)
if self.bReview then
RedDot:SetActive(false)
else
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
end
local clickFuc = function()
if not bOpen or self.bCantClick then
return
@@ -188,10 +193,10 @@ function PostalStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchIndex)
local bNew = not isReaded
self.avgId = avgcfg.StoryId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew, self.bReview)
self.curIndex = gridIndex
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
PlayerData.ActivityAvg:RefreshAvgRedDot()
LocalData.SetPlayerLocalData(self.storyData:_GetLocalReadKey(self.nActId, avgcfg.Id), true)
self.storyData:RefreshAvgRedDot()
elseif tbResult ~= nil then
local lockTxt = ""
for i = 1, #tbResult do
@@ -216,7 +221,7 @@ function PostalStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchIndex)
for k, v in pairs(tbStoryIds) do
if v == false then
local storyData = ConfigTable.GetData("ActivityStory", k)
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
if self.storyData:IsUnlock(storyData.ConditionId) then
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
break
end
@@ -355,6 +360,7 @@ function PostalStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function PostalStoryCtrl:OnEvent_Story_Done(bHasReward)
self:RefreshPanel()
@@ -364,7 +370,7 @@ function PostalStoryCtrl:OnEvent_Story_Done(bHasReward)
end
function PostalStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId, self.bReview)
end
if bConfirm then
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
@@ -374,9 +380,11 @@ function PostalStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self.bCantClick = false
if self.curIndex == #self.tbAllStory then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
function PostalStoryCtrl:OnBtn_ClickCloseCompete()
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
return PostalStoryCtrl
@@ -1,13 +1,21 @@
local BasePanel = require("GameCore.UI.BasePanel")
local PostalStoryPanel = class("PostalStoryPanel", BasePanel)
PostalStoryPanel._sUIResRootPath = "UI_Activity/"
PostalStoryPanel._tbDefine = {
{
sPrefabPath = "10106/Story/PostalStoryPanel.prefab",
sPrefabPath = "ActivityStoryReview/10106/PostalStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10106.Story.PostalStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function PostalStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
function PostalStoryPanel:OnEnable()
end
@@ -1,7 +1,6 @@
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 = {
@@ -52,7 +51,9 @@ function ViewfinderStoryCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.bReview = param[2] == true
end
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self.storyNodePos = {-187.2, -270.5}
self.tbGridTimer = {}
self.tbPlayedAnim = {}
@@ -72,11 +73,11 @@ function ViewfinderStoryCtrl:RefreshPanel()
end
function ViewfinderStoryCtrl:RefreshStoryList()
self.tbPlayedAnim = {}
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
self.tbAllStory, self.nChapterId = self.storyData:GetStoryIdListByActivityId(self.nActId)
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
return
end
local recentStoryId = ActivityAvgData:GetRecentStoryId(self.nChapterId)
local recentStoryId = self.storyData:GetRecentStoryId(self.nChapterId)
local recentIndex = 1
for i = 1, #self.tbAllStory do
if self.tbAllStory[i] == recentStoryId then
@@ -123,9 +124,9 @@ function ViewfinderStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchIn
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, self.nActId)
local isUnlock, tbResult = self.storyData:IsUnlock(avgcfg.ConditionId)
local isReaded = self.storyData:IsStoryReaded(storyId)
local bOpen, nOpenTime = self.storyData:IsOpen(avgcfg.StoryId, self.nActId)
local nIndex = 0
if isUnlock then
nIndex = bBranch and BRANCH_GRID_INDEX or gridIndex
@@ -177,12 +178,16 @@ function ViewfinderStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchIn
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)
if self.bReview then
RedDot:SetActive(false)
else
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
end
local clickFuc = function()
if not bOpen or self.bCantClick then
return
@@ -191,10 +196,10 @@ function ViewfinderStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchIn
local bNew = not isReaded
self.avgId = avgcfg.StoryId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew, self.bReview)
self.curIndex = gridIndex
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
PlayerData.ActivityAvg:RefreshAvgRedDot()
LocalData.SetPlayerLocalData(self.storyData:_GetLocalReadKey(self.nActId, avgcfg.Id), true)
self.storyData:RefreshAvgRedDot()
elseif tbResult ~= nil then
local lockTxt = ""
for i = 1, #tbResult do
@@ -219,7 +224,7 @@ function ViewfinderStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchIn
for k, v in pairs(tbStoryIds) do
if v == false then
local storyData = ConfigTable.GetData("ActivityStory", k)
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
if self.storyData:IsUnlock(storyData.ConditionId) then
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
break
end
@@ -355,6 +360,7 @@ function ViewfinderStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function ViewfinderStoryCtrl:OnEvent_StoryDialog_DialogEnd()
WwiseAudioMgr:SetState("menuTransition", "open")
@@ -367,7 +373,7 @@ function ViewfinderStoryCtrl:OnEvent_Story_Done(bHasReward)
end
function ViewfinderStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId, self.bReview)
end
if bConfirm then
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
@@ -377,9 +383,11 @@ function ViewfinderStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self.bCantClick = false
if self.curIndex == #self.tbAllStory then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
function ViewfinderStoryCtrl:OnBtn_ClickCloseCompete()
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
return ViewfinderStoryCtrl
@@ -1,13 +1,21 @@
local BasePanel = require("GameCore.UI.BasePanel")
local ViewfinderStoryPanel = class("ViewfinderStoryPanel", BasePanel)
ViewfinderStoryPanel._sUIResRootPath = "UI_Activity/"
ViewfinderStoryPanel._tbDefine = {
{
sPrefabPath = "10107/Story/ViewfinderStoryPanel.prefab",
sPrefabPath = "ActivityStoryReview/10107/ViewfinderStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10107.Story.ViewfinderStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function ViewfinderStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
function ViewfinderStoryPanel:OnEnable()
end
@@ -1,7 +1,6 @@
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"
@@ -74,7 +73,9 @@ function TechStoryCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.bReview = param[2] == true
end
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self.storyNodePos = {-23.7, -107}
self.tbGridTimer = {}
self.tbPlayedAnim = {}
@@ -100,7 +101,7 @@ function TechStoryCtrl:RefreshPersonality()
if personalityId <= 0 then
return
end
local tbRetPercent, sTitle, sFace, tbPData, nTotalCount, sHead = PlayerData.ActivityAvg:CalcPersonality(personalityId, self.nChapterId)
local tbRetPercent, sTitle, sFace, tbPData, nTotalCount, sHead = self.storyData:CalcPersonality(personalityId, self.nChapterId)
NovaAPI.SetPersonalityRing(self._mapNode.goPersonality, tbRetPercent)
NovaAPI.SetTMPText(self._mapNode.txtCharName, sTitle)
NovaAPI.SetTMPText(self._mapNode.txtPersonalityPercent[1], math.floor(tbRetPercent[1] * 100) .. "%")
@@ -111,11 +112,11 @@ function TechStoryCtrl:RefreshPersonality()
end
function TechStoryCtrl:RefreshStoryList()
self.tbPlayedAnim = {}
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
self.tbAllStory, self.nChapterId = self.storyData:GetStoryIdListByActivityId(self.nActId)
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
return
end
local recentStoryId = ActivityAvgData:GetRecentStoryId(self.nChapterId)
local recentStoryId = self.storyData:GetRecentStoryId(self.nChapterId)
local recentIndex = 1
for i = 1, #self.tbAllStory do
if self.tbAllStory[i] == recentStoryId then
@@ -165,9 +166,9 @@ function TechStoryCtrl:RefreshGridInfo(grid, gridIndex)
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, self.nActId)
local isUnlock, tbResult = self.storyData:IsUnlock(avgcfg.ConditionId)
local isReaded = self.storyData:IsStoryReaded(storyId)
local bOpen, nOpenTime = self.storyData:IsOpen(avgcfg.StoryId, self.nActId)
NovaAPI.CtrlDotweenAnimation(dotweenGear, isUnlock and bOpen and 1 or 0)
imgStory.gameObject:SetActive(true)
if bOpen and isUnlock then
@@ -208,12 +209,16 @@ function TechStoryCtrl:RefreshGridInfo(grid, gridIndex)
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)
if self.bReview then
RedDot:SetActive(false)
else
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
end
local clickFuc = function()
if not bOpen or self.bCantClick then
return
@@ -222,10 +227,10 @@ function TechStoryCtrl:RefreshGridInfo(grid, gridIndex)
local bNew = not isReaded
self.avgId = avgcfg.StoryId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew, self.bReview)
self.curIndex = gridIndex
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
ActivityAvgData:RefreshAvgRedDot()
LocalData.SetPlayerLocalData(self.storyData:_GetLocalReadKey(self.nActId, avgcfg.Id), true)
self.storyData:RefreshAvgRedDot()
elseif tbResult ~= nil then
local lockTxt = ""
for i = 1, #tbResult do
@@ -250,7 +255,7 @@ function TechStoryCtrl:RefreshGridInfo(grid, gridIndex)
for k, v in pairs(tbStoryIds) do
if v == false then
local storyData = ConfigTable.GetData("ActivityStory", k)
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
if self.storyData:IsUnlock(storyData.ConditionId) then
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
break
end
@@ -366,6 +371,7 @@ function TechStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function TechStoryCtrl:OnEvent_Story_Done(bHasReward)
self:RefreshPanel()
@@ -375,7 +381,7 @@ function TechStoryCtrl:OnEvent_Story_Done(bHasReward)
end
function TechStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId, self.bReview)
end
if bConfirm then
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
@@ -385,9 +391,11 @@ function TechStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self.bCantClick = false
if self.curIndex == #self.tbAllStory then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
function TechStoryCtrl:OnBtn_ClickCloseCompete()
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
return TechStoryCtrl
@@ -1,13 +1,21 @@
local BasePanel = require("GameCore.UI.BasePanel")
local TechStoryPanel = class("TechStoryPanel", BasePanel)
TechStoryPanel._sUIResRootPath = "UI_Activity/"
TechStoryPanel._tbDefine = {
{
sPrefabPath = "10108/Story/TechStoryPanel.prefab",
sPrefabPath = "ActivityStoryReview/10108/TechStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10108.Story.TechStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function TechStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
function TechStoryPanel:OnEnable()
end
@@ -1,7 +1,6 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local GunStormStoryCtrl = class("GunStormStoryCtrl", BaseCtrl)
local ActivityAvgData = PlayerData.ActivityAvg
GunStormStoryCtrl._mapNodeConfig = {
svStory = {
sComponentName = "LoopScrollView"
@@ -56,7 +55,9 @@ function GunStormStoryCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.bReview = param[2] == true
end
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self.storyNodePos = {0, -66.1}
self.tbGridTimer = {}
self.tbPlayedAnim = {}
@@ -113,11 +114,11 @@ function GunStormStoryCtrl:RefreshPanel()
end
function GunStormStoryCtrl:RefreshStoryList()
self.tbPlayedAnim = {}
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
self.tbAllStory, self.nChapterId = self.storyData:GetStoryIdListByActivityId(self.nActId)
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
return
end
local recentStoryId = ActivityAvgData:GetRecentStoryId(self.nChapterId)
local recentStoryId = self.storyData:GetRecentStoryId(self.nChapterId)
local recentIndex = 1
for i = 1, #self.tbAllStory do
if self.tbAllStory[i] == recentStoryId then
@@ -165,9 +166,9 @@ function GunStormStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchInde
local btnGridText = grid.transform:Find("btnGridText")
local imgDb = btnGridText:Find("scale_on_click/grpTitle/imgDb")
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, self.nActId)
local isUnlock, tbResult = self.storyData:IsUnlock(avgcfg.ConditionId)
local isReaded = self.storyData:IsStoryReaded(storyId)
local bOpen, nOpenTime = self.storyData:IsOpen(avgcfg.StoryId, self.nActId)
local nIndex = 0
if isUnlock then
nIndex = bBranch and BRANCH_GRID_INDEX or gridIndex
@@ -212,12 +213,16 @@ function GunStormStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchInde
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)
if self.bReview then
RedDot:SetActive(false)
else
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
end
local clickFuc = function()
if not bOpen or self.bCantClick then
return
@@ -226,10 +231,10 @@ function GunStormStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchInde
local bNew = not isReaded
self.avgId = avgcfg.StoryId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew, self.bReview)
self.curIndex = gridIndex
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
PlayerData.ActivityAvg:RefreshAvgRedDot()
LocalData.SetPlayerLocalData(self.storyData:_GetLocalReadKey(self.nActId, avgcfg.Id), true)
self.storyData:RefreshAvgRedDot()
elseif tbResult ~= nil then
local lockTxt = ""
for i = 1, #tbResult do
@@ -254,7 +259,7 @@ function GunStormStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchInde
for k, v in pairs(tbStoryIds) do
if v == false then
local storyData = ConfigTable.GetData("ActivityStory", k)
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
if self.storyData:IsUnlock(storyData.ConditionId) then
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
break
end
@@ -371,6 +376,7 @@ function GunStormStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function GunStormStoryCtrl:OnEvent_Story_Done(bHasReward)
self:RefreshPanel()
@@ -380,7 +386,7 @@ function GunStormStoryCtrl:OnEvent_Story_Done(bHasReward)
end
function GunStormStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId, self.bReview)
end
if bConfirm then
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
@@ -390,9 +396,11 @@ function GunStormStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self.bCantClick = false
if self.curIndex == #self.tbAllStory then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
function GunStormStoryCtrl:OnBtn_ClickCloseCompete()
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
return GunStormStoryCtrl
@@ -1,13 +1,21 @@
local BasePanel = require("GameCore.UI.BasePanel")
local GunStormStoryPanel = class("GunStormStoryPanel", BasePanel)
GunStormStoryPanel._sUIResRootPath = "UI_Activity/"
GunStormStoryPanel._tbDefine = {
{
sPrefabPath = "10109/Story/GunStormStoryPanel.prefab",
sPrefabPath = "ActivityStoryReview/10109/GunStormStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10109.Story.GunStormStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function GunStormStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
function GunStormStoryPanel:OnEnable()
end
@@ -1,7 +1,6 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local SummerAdvStoryCtrl = class("SummerAdvStoryCtrl", BaseCtrl)
local ActivityAvgData = PlayerData.ActivityAvg
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
local ResType = GameResourceLoader.ResType
local typeof = typeof
@@ -94,7 +93,9 @@ function SummerAdvStoryCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.bReview = param[2] == true
end
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self.storyNodePos = {0, -66.1}
self.tbGridTimer = {}
self.tbPlayedAnim = {}
@@ -149,6 +150,7 @@ end
function SummerAdvStoryCtrl:RefreshPanel()
self:RefreshStoryList()
self:RefreshPersonality()
self._mapNode.btnReview.gameObject:SetActive(not self.bReview)
end
function SummerAdvStoryCtrl:RefreshPersonality()
local cfg = ConfigTable.GetData("ActivityStoryChapter", self.nActId)
@@ -157,7 +159,7 @@ function SummerAdvStoryCtrl:RefreshPersonality()
if personalityId <= 0 then
return
end
local tbRetPercent, sTitle, sFace, tbPData, nTotalCount, sHead = PlayerData.ActivityAvg:CalcPersonality(personalityId, self.nChapterId)
local tbRetPercent, sTitle, sFace, tbPData, nTotalCount, sHead = self.storyData:CalcPersonality(personalityId, self.nChapterId)
NovaAPI.SetPersonalityRing(self._mapNode.goPersonality, tbRetPercent)
NovaAPI.SetTMPText(self._mapNode.txtCharName, sTitle)
NovaAPI.SetTMPText(self._mapNode.txtPersonalityPercent[1], math.floor(tbRetPercent[1] * 100) .. "%")
@@ -168,11 +170,11 @@ function SummerAdvStoryCtrl:RefreshPersonality()
end
function SummerAdvStoryCtrl:RefreshStoryList()
self.tbPlayedAnim = {}
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
self.tbAllStory, self.nChapterId = self.storyData:GetStoryIdListByActivityId(self.nActId)
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
return
end
local recentStoryId = ActivityAvgData:GetRecentStoryId(self.nChapterId)
local recentStoryId = self.storyData:GetRecentStoryId(self.nChapterId)
local recentIndex = 1
for i = 1, #self.tbAllStory do
if self.tbAllStory[i] == recentStoryId then
@@ -224,9 +226,9 @@ function SummerAdvStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchInd
local goLockState = grid.transform:Find("btnGridText/scale_on_click/goLockState").gameObject
local imgDb = grid.transform:Find("btnGridText/scale_on_click/grpTitle/imgDb")
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, self.nActId)
local isUnlock, tbResult = self.storyData:IsUnlock(avgcfg.ConditionId)
local isReaded = self.storyData:IsStoryReaded(storyId)
local bOpen, nOpenTime = self.storyData:IsOpen(avgcfg.StoryId, self.nActId)
local nIndex = 0
if isUnlock then
nIndex = bBranch and BRANCH_GRID_INDEX or gridIndex
@@ -243,7 +245,7 @@ function SummerAdvStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchInd
NovaAPI.SetTMPText(txtStoryTitle, ConfigTable.GetUIText("Story_StoryTitle"))
end
local bgIndex = string.sub(avgcfg.Icon, -1)
local sFullPath = Settings.AB_ROOT_PATH .. "UI_Activity/10110/FX/Textures/fx_ui_SummerAdv_Dissolve" .. bgIndex .. ".png"
local sFullPath = Settings.AB_ROOT_PATH .. "UI/ActivityStoryReview/10110/FX/Textures/fx_ui_SummerAdv_Dissolve" .. bgIndex .. ".png"
local tex = GameResourceLoader.LoadAsset(ResType.Any, sFullPath, typeof(Texture), "UI", self._panel._nPanelId)
NovaAPIHotfix.ChangeUIDissolveTarget(imgStory.gameObject, tex)
self:SetPngSprite(imgStory, avgcfg.Icon)
@@ -275,12 +277,16 @@ function SummerAdvStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchInd
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)
if self.bReview then
RedDot:SetActive(false)
else
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
end
local clickFuc = function()
if not bOpen or self.bCantClick then
return
@@ -289,10 +295,10 @@ function SummerAdvStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchInd
local bNew = not isReaded
self.avgId = avgcfg.StoryId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew, self.bReview)
self.curIndex = gridIndex
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
PlayerData.ActivityAvg:RefreshAvgRedDot()
LocalData.SetPlayerLocalData(self.storyData:_GetLocalReadKey(self.nActId, avgcfg.Id), true)
self.storyData:RefreshAvgRedDot()
elseif tbResult ~= nil then
local lockTxt = ""
for i = 1, #tbResult do
@@ -317,7 +323,7 @@ function SummerAdvStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchInd
for k, v in pairs(tbStoryIds) do
if v == false then
local storyData = ConfigTable.GetData("ActivityStory", k)
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
if self.storyData:IsUnlock(storyData.ConditionId) then
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
break
end
@@ -434,6 +440,7 @@ function SummerAdvStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function SummerAdvStoryCtrl:OnEvent_Story_Done(bHasReward)
self:RefreshPanel()
@@ -443,7 +450,7 @@ function SummerAdvStoryCtrl:OnEvent_Story_Done(bHasReward)
end
function SummerAdvStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId, self.bReview)
end
if bConfirm then
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
@@ -453,10 +460,12 @@ function SummerAdvStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self.bCantClick = false
if self.curIndex == #self.tbAllStory then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
function SummerAdvStoryCtrl:OnBtn_ClickCloseCompete()
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function SummerAdvStoryCtrl:OnBtn_ClickReview()
EventManager.Hit(EventId.OpenPanel, PanelId.SummerCheckinStory_20103, REVIEW_ACTIVITY_ID)
@@ -1,13 +1,21 @@
local BasePanel = require("GameCore.UI.BasePanel")
local SummerAdvStoryPanel = class("SummerAdvStoryPanel", BasePanel)
SummerAdvStoryPanel._sUIResRootPath = "UI_Activity/"
SummerAdvStoryPanel._tbDefine = {
{
sPrefabPath = "10110/Story/SummerAdvStoryPanel.prefab",
sPrefabPath = "ActivityStoryReview/10110/SummerAdvStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10110.Story.SummerAdvStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function SummerAdvStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
function SummerAdvStoryPanel:OnEnable()
end
@@ -1,7 +1,6 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local CultivationManualStoryCtrl = class("CultivationManualStoryCtrl", BaseCtrl)
local ActivityAvgData = PlayerData.ActivityAvg
CultivationManualStoryCtrl._mapNodeConfig = {
svStory = {
sComponentName = "LoopScrollView"
@@ -50,7 +49,9 @@ function CultivationManualStoryCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.bReview = param[2] == true
end
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self.storyNodePos = {0, -66.1}
self.tbGridTimer = {}
self.tbPlayedAnim = {}
@@ -70,11 +71,11 @@ function CultivationManualStoryCtrl:RefreshPanel()
end
function CultivationManualStoryCtrl:RefreshStoryList()
self.tbPlayedAnim = {}
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
self.tbAllStory, self.nChapterId = self.storyData:GetStoryIdListByActivityId(self.nActId)
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
return
end
local recentStoryId = ActivityAvgData:GetRecentStoryId(self.nChapterId)
local recentStoryId = self.storyData:GetRecentStoryId(self.nChapterId)
local recentIndex = 1
for i = 1, #self.tbAllStory do
if self.tbAllStory[i] == recentStoryId then
@@ -130,9 +131,9 @@ function CultivationManualStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nB
else
NovaAPI.SetTMPText(txtStoryTitle, ConfigTable.GetUIText("Story_StoryTitle"))
end
local isUnlock, tbResult = ActivityAvgData:IsUnlock(avgcfg.ConditionId)
local isReaded = ActivityAvgData:IsStoryReaded(storyId)
local bOpen, nOpenTime = ActivityAvgData:IsOpen(avgcfg.StoryId, self.nActId)
local isUnlock, tbResult = self.storyData:IsUnlock(avgcfg.ConditionId)
local isReaded = self.storyData:IsStoryReaded(storyId)
local bOpen, nOpenTime = self.storyData:IsOpen(avgcfg.StoryId, self.nActId)
local nIndex = 0
if isUnlock then
nIndex = bBranch and BRANCH_GRID_INDEX or gridIndex
@@ -178,12 +179,16 @@ function CultivationManualStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nB
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)
if self.bReview then
RedDot:SetActive(false)
else
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
end
local clickFuc = function()
if not bOpen or self.bCantClick then
return
@@ -192,10 +197,10 @@ function CultivationManualStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nB
local bNew = not isReaded
self.avgId = avgcfg.StoryId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew, self.bReview)
self.curIndex = gridIndex
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
ActivityAvgData:RefreshAvgRedDot()
LocalData.SetPlayerLocalData(self.storyData:_GetLocalReadKey(self.nActId, avgcfg.Id), true)
self.storyData:RefreshAvgRedDot()
elseif tbResult ~= nil then
local lockTxt = ""
for i = 1, #tbResult do
@@ -220,7 +225,7 @@ function CultivationManualStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nB
for k, v in pairs(tbStoryIds) do
if v == false then
local storyData = ConfigTable.GetData("ActivityStory", k)
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
if self.storyData:IsUnlock(storyData.ConditionId) then
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
break
end
@@ -350,6 +355,7 @@ function CultivationManualStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function CultivationManualStoryCtrl:OnEvent_Story_Done(bHasReward)
self:RefreshPanel()
@@ -359,7 +365,7 @@ function CultivationManualStoryCtrl:OnEvent_Story_Done(bHasReward)
end
function CultivationManualStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId, self.bReview)
end
if bConfirm then
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
@@ -369,9 +375,11 @@ function CultivationManualStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self.bCantClick = false
if self.curIndex == #self.tbAllStory then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
function CultivationManualStoryCtrl:OnBtn_ClickCloseCompete()
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
return CultivationManualStoryCtrl
@@ -1,13 +1,21 @@
local BasePanel = require("GameCore.UI.BasePanel")
local CultivationManualStoryPanel = class("CultivationManualStoryPanel", BasePanel)
CultivationManualStoryPanel._sUIResRootPath = "UI_Activity/"
CultivationManualStoryPanel._tbDefine = {
{
sPrefabPath = "10111/Story/CultivationManualStoryPanel.prefab",
sPrefabPath = "ActivityStoryReview/10111/CultivationManualStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10111.Story.CultivationManualStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function CultivationManualStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
function CultivationManualStoryPanel:OnEnable()
end
@@ -0,0 +1,154 @@
local ActivityLevelsLvCtrl = class("ActivityLevelsLvCtrl", BaseCtrl)
local lvIndexTitle = "{0}-{1}"
local colorLockSelectImage = Color(0.9764705882352941, 0.9215686274509803, 0.8588235294117647, 1)
local colorLockUnSelectImage = Color(0.9764705882352941, 0.9215686274509803, 0.8588235294117647, 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 = {},
rtLockInfoDay = {sComponentName = "Image"},
imgLockMask = {},
bgCondition = {},
rtLockPreLv = {},
rtLockPreLvSelect = {sComponentName = "Image"},
redH = {}
}
function ActivityLevelsLvCtrl:InitData(parent, nType, activityData, data, isOpen, isLevelUnLock)
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
self._mapNode.rtLockInfoDay.gameObject:SetActive(false)
self.isShowTexLv = false
self.isOpen = isOpen
if isOpen and isLevelUnLock then
self.isShowTexLv = true
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(true)
self._mapNode.imgLockMask: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.imgLockMask:SetActive(true)
self._mapNode.rtLockInfoDay.gameObject: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"), "ea7869", hour))
elseif 0 < min then
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color_Common"), "ea7869", min))
elseif 0 < sec then
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color_Common"), "ea7869", 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"), "ea7869", 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 not isOn then
self:ShowArrowAni(false)
end
self._mapNode.Select:SetActive(isOn)
self._mapNode.unSelect:SetActive(not isOn)
self._mapNode.txt_Select.gameObject:SetActive(isOn)
self._mapNode.txt_unSelect.gameObject:SetActive(not isOn)
if isOn then
NovaAPI.SetImageColor(self._mapNode.rtLockInfoDay, colorLockSelectImage)
NovaAPI.SetImageColor(self._mapNode.rtLockPreLvSelect, colorLockSelectImage)
else
NovaAPI.SetImageColor(self._mapNode.rtLockInfoDay, colorLockUnSelectImage)
NovaAPI.SetImageColor(self._mapNode.rtLockPreLvSelect, colorLockUnSelectImage)
end
if not self.isOpen then
self._mapNode.imgLockMask:SetActive(not isOn)
end
if isOn then
self._mapNode.SelectAni:Play("Select_idle")
else
self._mapNode.SelectAni.enabled = false
self._mapNode.SelectAni.enabled = true
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,790 @@
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.11764705882352941, 0.12549019607843137, 0.17254901960784313, 1)
local colorUnSelectLock = Color(0.4823529411764706, 0.5333333333333333, 0.6509803921568628, 1)
local timeUnLockColor = "fff7ca"
local colorLockSelectImage = Color(0.984313725490196, 0.9333333333333333, 0.8784313725490196, 1)
local colorLockUnSelectImage = Color(0.24705882352941178, 0.19215686274509805, 0.19215686274509805, 1)
local colorConditionsUnLock = Color(0.6509803921568628, 0.5647058823529412, 0.5647058823529412, 1)
local colorConditionsLock = Color(0.6509803921568628, 0.5647058823529412, 0.5647058823529412, 1)
local lvIndexTitle = "{0}-{1}"
local twelveLvGroupPadding = {
44,
150,
50,
0
}
local twelveLvGroupPaddingOpen = {
44,
818,
50,
0
}
local fourLvGroupPadding = {
300,
88,
50,
0
}
local fourLvGroupPaddingOpen = {
86,
818,
50,
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.ActivityTheme.10113.ActivityLevels.TemplateToggleCtrl10113"
},
lockExplore = {
sComponentName = "UIButton",
callback = "OnClick_BtnLockExplore"
},
redExplore = {},
togTypeAdventure = {
sComponentName = "UIButton",
callback = "OnBtnClick_TogTypeAdventure"
},
togTypeAdventureCtrl = {
sNodeName = "togTypeAdventure",
sCtrlName = "Game.UI.ActivityTheme.10113.ActivityLevels.TemplateToggleCtrl10113"
},
lockAdventure = {
sComponentName = "UIButton",
callback = "OnClick_BtnLockAdventure"
},
redAdventure = {},
togTypeHard = {
sComponentName = "UIButton",
callback = "OnBtnClick_TogTypeHard"
},
togTypeHardCtrl = {
sNodeName = "togTypeHard",
sCtrlName = "Game.UI.ActivityTheme.10113.ActivityLevels.TemplateToggleCtrl10113"
},
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.10113.ActivityLevels.ActivityLevelsLvCtrl"
},
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, true)
self.timeTab = {}
EventManager.Hit(EventId.SetTransition)
self.SelectTogPreLvLock = nil
self.AniRoot:Play("ActivityLevelsSelect_in")
self:Init()
function self.onScrollValueChanged(value)
self._mapNode.rtTogglesTmp.localPosition = self._mapNode.rt_ToggleTrans.localPosition * 0.7
end
self._mapNode.rtToggles.onValueChanged:AddListener(self.onScrollValueChanged)
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
if self.onScrollValueChanged ~= nil then
self._mapNode.rtToggles.onValueChanged:RemoveListener(self.onScrollValueChanged)
self.onScrollValueChanged = nil
end
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_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)
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
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)
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)
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, self._nSortingOrder)
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(-3400, self._mapNode.rt_ToggleTrans.localPosition.y, 0)
else
self._mapNode.rt_ToggleTrans.localPosition = Vector3(-400 * (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, false)
end, true, true, true)
end
function ActivityLevelsSelectCtrl:ShowBossInfo(isShow, isOnEnable)
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 and not isOnEnable 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(-3400, moveTime)
else
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-400 * (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(-1800, moveTime)
else
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-400 * (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(-250, moveTime)
else
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-75 * (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)
self._mapNode.btn_itemTemp.gameObject:SetActive(false)
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, false)
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, 0, 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 = "10113/ActivityLevels/ActivityLevelsSelect.prefab",
sCtrlName = "Game.UI.ActivityTheme.10113.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,61 @@
local TemplateToggleCtrl10113 = class("TemplateToggleCtrl10113", BaseCtrl)
TemplateToggleCtrl10113._mapNodeConfig = {
AnimSwitch = {sComponentName = "Animator"},
txt_Select = {sComponentName = "TMP_Text"},
txt_unSelect = {sComponentName = "TMP_Text"},
Select = {},
unSelect = {}
}
TemplateToggleCtrl10113._mapEventConfig = {}
function TemplateToggleCtrl10113:SetText(sText)
NovaAPI.SetTMPText(self._mapNode.txt_Select, sText)
NovaAPI.SetTMPText(self._mapNode.txt_unSelect, sText)
end
function TemplateToggleCtrl10113:SetDefault(bOn)
if self._mapNode.AnimSwitch.enabled == true then
self._mapNode.AnimSwitch.enabled = false
end
self._mapNode.Select:SetActive(bOn)
self._mapNode.unSelect:SetActive(not bOn)
self._mapNode.txt_Select.gameObject:SetActive(bOn)
self._mapNode.txt_unSelect.gameObject:SetActive(not bOn)
NovaAPI.SetTMPColor(self._mapNode.txt_Select, White_Normal)
NovaAPI.SetTMPColor(self._mapNode.txt_unSelect, Blue_Normal)
end
function TemplateToggleCtrl10113:SetDefaultAct10101(bOn)
if self._mapNode.AnimSwitch.enabled == true then
self._mapNode.AnimSwitch.enabled = false
end
self._mapNode.Select:SetActive(bOn)
self._mapNode.unSelect:SetActive(not bOn)
self._mapNode.txt_Select.gameObject:SetActive(bOn)
self._mapNode.txt_unSelect.gameObject:SetActive(not bOn)
NovaAPI.SetTMPColor(self._mapNode.txt_Select, Color(1, 1, 1, 1))
NovaAPI.SetTMPColor(self._mapNode.txt_unSelect, Color(0.2196078431372549, 0.1803921568627451, 0.1450980392156863, 1))
end
function TemplateToggleCtrl10113:SetDefaultActivity(bOn, colorSelect, colorUnSelect)
self._mapNode.Select:SetActive(bOn)
self._mapNode.unSelect:SetActive(not bOn)
self._mapNode.txt_Select.gameObject:SetActive(bOn)
self._mapNode.txt_unSelect.gameObject:SetActive(not bOn)
self._mapNode.unSelect.transform:Find("SelectAni").gameObject:SetActive(false)
if bOn then
self._mapNode.AnimSwitch:Play("togType_in")
else
self._mapNode.AnimSwitch.enabled = false
self._mapNode.AnimSwitch.enabled = true
end
if colorSelect ~= nil then
NovaAPI.SetTMPColor(self._mapNode.txt_Select, colorSelect)
NovaAPI.SetTMPColor(self._mapNode.txt_unSelect, colorUnSelect)
end
end
function TemplateToggleCtrl10113:SetTrigger(bOn)
end
function TemplateToggleCtrl10113:ResetTrigger()
if self._mapNode.AnimSwitch.enabled == false then
self._mapNode.AnimSwitch.enabled = true
end
self._mapNode.AnimSwitch:ResetTrigger("tOff")
end
return TemplateToggleCtrl10113
@@ -0,0 +1,173 @@
local ActivityUnchartedMapCtrl = class("ActivityUnchartedMapCtrl", BaseCtrl)
local TimerManager = require("GameCore.Timer.TimerManager")
local ClientManager = CS.ClientManager.Instance
ActivityUnchartedMapCtrl._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 = "TowerDef_EnterActivity"
},
txtBtnActDetail = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Btn_Detail"
},
btnActDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_Detail"
}
}
function ActivityUnchartedMapCtrl:Awake()
self.tbGridCtrl = {}
end
function ActivityUnchartedMapCtrl:OnDisable()
self:UnbindCtrl()
end
function ActivityUnchartedMapCtrl:InitActData(actData)
self.actData = actData
self:RefreshLockState()
self:RefreshDate()
self:RefreshTimeout()
self:RefreshReward()
end
function ActivityUnchartedMapCtrl:UnInit()
self:UnbindCtrl()
end
function ActivityUnchartedMapCtrl:UnbindCtrl()
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
end
self.tbGridCtrl = {}
end
function ActivityUnchartedMapCtrl: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 ActivityUnchartedMapCtrl: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 ActivityUnchartedMapCtrl: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 ActivityUnchartedMapCtrl: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 ActivityUnchartedMapCtrl: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 ActivityUnchartedMapCtrl: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 ActivityUnchartedMapCtrl: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 ActivityUnchartedMapCtrl: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 ActivityUnchartedMapCtrl:ClearActivity()
end
return ActivityUnchartedMapCtrl
@@ -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_shop_" .. AllEnum.FrameColor_New[mapItemCfg.Rarity]
self:SetActivityAtlasSprite_New(self._mapNode.imgRare, "10113/SpriteAtlas/10113" .. "04", 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 = "10113/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,317 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local UnchartedMapStoryCtrl = class("UnchartedMapStoryCtrl", BaseCtrl)
UnchartedMapStoryCtrl._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_ClickCloseComplete"
},
ctlgoEnemyInfo = {
sNodeName = "goEnemyInfo",
sCtrlName = "Game.UI.MainlineEx.MainlineMonsterInfoCtrl"
}
}
UnchartedMapStoryCtrl._mapEventConfig = {
Story_Done = "OnEvent_Story_Done",
SelectMainlineBattle = "OnEvent_SelectMainlineBattle",
Story_RewardClosed = "OnEvent_Activity_Story_RewardClosed"
}
function UnchartedMapStoryCtrl:Awake()
local tbParam = self:GetPanelParam()
self._nActId = tbParam[1]
self._bReview = tbParam[2] == true
self._objStoryData = self._bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self._tbAllStory = {}
self._mapGridTimer = {}
self._bInit = false
self._bCantClick = false
end
function UnchartedMapStoryCtrl:OnEnable()
self._bCantClick = false
self:OnBtn_ClickCloseLevelInfoPanel()
self:RefreshPanel()
end
function UnchartedMapStoryCtrl:FadeIn()
EventManager.Hit(EventId.SetTransition)
end
function UnchartedMapStoryCtrl:OnPreExit()
self._mapGridTimer = {}
self._objScrollTimer = nil
end
function UnchartedMapStoryCtrl:RefreshPanel()
self:RefreshStoryList()
end
function UnchartedMapStoryCtrl:RefreshStoryList()
for _, objTimer in pairs(self._mapGridTimer) do
objTimer:Cancel()
end
self._mapGridTimer = {}
if self._objScrollTimer then
self._objScrollTimer:Cancel()
self._objScrollTimer = nil
end
self._tbAllStory, self._nChapterId = self._objStoryData:GetStoryIdListByActivityId(self._nActId)
self._tbAllStory = self._tbAllStory or {}
self._mapNode.svStory:SetAnim(0.07)
self._mapNode.svStory:Init(#self._tbAllStory, self, self.OnRefreshGrid)
if #self._tbAllStory == 0 then
return
end
local nRecentStoryId = self._objStoryData:GetRecentStoryId(self._nChapterId)
local nRecentIndex = 1
for nIndex, nStoryId in ipairs(self._tbAllStory) do
if nStoryId == nRecentStoryId then
nRecentIndex = nIndex
break
end
end
local nScrollTime = self._bInit and 0 or 0.5
self._objScrollTimer = self:AddTimer(1, 0.1, function()
self._objScrollTimer = nil
self._mapNode.svStory:SetScrollGridPos(nRecentIndex, nScrollTime, 0)
self._bInit = true
end, true, true, true)
end
function UnchartedMapStoryCtrl:OnRefreshGrid(goGrid, nIndex)
local trNormal = goGrid.transform:Find("Normal")
trNormal.gameObject:SetActive(true)
goGrid.transform:Find("Branch").gameObject:SetActive(false)
self:RefreshGridInfo(trNormal.gameObject, nIndex + 1)
end
function UnchartedMapStoryCtrl:RefreshGridInfo(goGrid, nIndex)
local nStoryId = self._tbAllStory[nIndex]
local mapStoryCfg = ConfigTable.GetData("ActivityStory", nStoryId)
local nInstanceId = goGrid:GetInstanceID()
if self._mapGridTimer[nInstanceId] then
self._mapGridTimer[nInstanceId]:Cancel()
self._mapGridTimer[nInstanceId] = nil
end
local btnGrid = goGrid.transform:Find("btnGrid"):GetComponent("UIButton")
local trRoot = goGrid.transform:Find("btnGrid/AnimRoot/RootNode")
local trTextRoot = goGrid.transform:Find("btnGridText/scale_on_click")
local imgStory = trRoot:Find("rtBg/imgStory"):GetComponent("Image")
local txtIndex = trRoot:Find("txtIndex"):GetComponent("TMP_Text")
local trStoryTitle = trRoot:Find("imgStoryTitle")
local trBattleTitle = trRoot:Find("imgBattleTitle")
local trTitle = trTextRoot:Find("grpTitle")
local txtTitle = trTitle:Find("tmpGroupDone"):GetComponent("TMP_Text")
local trComplete = trTextRoot:Find("goComplete")
local txtComplete = trComplete:Find("imgBg/txtComplete"):GetComponent("TMP_Text")
local trTime = trTextRoot:Find("imgTime")
local txtTime = trTime:Find("txtTime"):GetComponent("TMP_Text")
local animNormal = goGrid:GetComponent("Animator")
local goRedDot = trRoot:Find("RedDot").gameObject
local bUnlock = self._objStoryData:IsUnlock(mapStoryCfg.ConditionId)
local bRead = self._objStoryData:IsStoryReaded(nStoryId)
local bOpen, nOpenTime = self._objStoryData:IsOpen(mapStoryCfg.StoryId, self._nActId)
local bAvailable = bOpen and bUnlock
self:SetPngSprite(imgStory, bAvailable and mapStoryCfg.Icon or "Icon/ActivityStory/ep_event_13_00")
NovaAPI.SetTMPText(txtIndex, mapStoryCfg.Index)
NovaAPI.SetTMPText(txtTitle, mapStoryCfg.Title)
NovaAPI.SetTMPText(txtComplete, ConfigTable.GetUIText("RoguelikeBuild_Manage_FilterPass"))
NovaAPI.SetTMPText(trStoryTitle:Find("txtPlot"):GetComponent("TMP_Text"), ConfigTable.GetUIText("Story_StoryTitle"))
NovaAPI.SetTMPText(trBattleTitle:Find("txtPlot"):GetComponent("TMP_Text"), ConfigTable.GetUIText("Story_BattleTitle"))
trStoryTitle.gameObject:SetActive(bAvailable and not mapStoryCfg.IsBattle)
trBattleTitle.gameObject:SetActive(bAvailable and mapStoryCfg.IsBattle)
trRoot:Find("goNotOpen").gameObject:SetActive(not bOpen)
trRoot:Find("goLockState").gameObject:SetActive(bOpen and not bUnlock)
trTextRoot:Find("goLocktxtState").gameObject:SetActive(bOpen and not bUnlock)
trTitle.gameObject:SetActive(bAvailable)
trComplete.gameObject:SetActive(bAvailable and bRead)
trTime.gameObject:SetActive(not bOpen)
if bRead then
animNormal:Play("svStory_idle", 0, 0)
end
if not bOpen then
NovaAPI.SetTMPText(txtTime, self:GetRemainTimeStr(nOpenTime, mapStoryCfg.DayOpen))
self._mapGridTimer[nInstanceId] = self:AddTimer(0, 1, function()
if self._objStoryData:IsOpen(mapStoryCfg.StoryId, self._nActId) then
self:RefreshStoryList()
else
NovaAPI.SetTMPText(txtTime, self:GetRemainTimeStr(nOpenTime, mapStoryCfg.DayOpen))
end
end, true, true, true)
end
if self._bReview then
goRedDot:SetActive(false)
else
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self._nActId)
if bInActGroup then
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self._nActId,
nStoryId
}, goRedDot, nil, nil, true)
else
goRedDot:SetActive(false)
end
end
btnGrid.onClick:RemoveAllListeners()
btnGrid.onClick:AddListener(function()
self:OnClickStory(nStoryId)
end)
local objAnimator = goGrid:GetComponent("Animator")
if objAnimator ~= nil then
objAnimator:Play(bAvailable and "svStory_in" or "svStoryNotOpen_in")
end
end
function UnchartedMapStoryCtrl:OnClickStory(nStoryId)
if self._bCantClick then
return
end
local mapStoryCfg = ConfigTable.GetData("ActivityStory", nStoryId)
if not self._objStoryData:IsOpen(mapStoryCfg.StoryId, self._nActId) then
return
end
local bUnlock, tbResult = self._objStoryData:IsUnlock(mapStoryCfg.ConditionId)
if not bUnlock then
local sLockText = self:GetUnlockTip(tbResult)
if sLockText ~= "" then
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Alert,
sContent = sLockText
})
end
return
end
self._nSelectedStoryId = nStoryId
self._sAvgId = mapStoryCfg.StoryId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(self._sAvgId, self._nActId, not self._objStoryData:IsStoryReaded(nStoryId), self._bReview)
LocalData.SetPlayerLocalData(self._objStoryData:_GetLocalReadKey(self._nActId, nStoryId), true)
self._objStoryData:RefreshAvgRedDot()
end
function UnchartedMapStoryCtrl:GetUnlockTip(tbResult)
for nConditionIndex, tbCondition in ipairs(tbResult or {}) do
if tbCondition[1] == false then
local conditionValue = tbCondition[2]
if nConditionIndex == 1 or nConditionIndex == 2 then
do
local mapFallbackCfg
for nStoryId, bRead in pairs(conditionValue) do
if not bRead then
local mapStoryCfg = ConfigTable.GetData("ActivityStory", nStoryId)
mapFallbackCfg = mapFallbackCfg or mapStoryCfg
if nConditionIndex == 1 or self._objStoryData:IsUnlock(mapStoryCfg.ConditionId) then
return orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", mapStoryCfg.Title)
end
end
end
if mapFallbackCfg then
return orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", mapFallbackCfg.Title)
end
end
break
end
if nConditionIndex == 3 or nConditionIndex == 4 then
do return ConfigTable.GetUIText("Story_UnlockClueCondition") end
break
end
if nConditionIndex == 5 then
do return orderedFormat(ConfigTable.GetUIText("Story_UnlockWorldLv") or "", conditionValue) end
break
end
if nConditionIndex == 6 then
for nAchievementId, bComplete in pairs(conditionValue) do
if not bComplete then
local mapAchievementCfg = ConfigTable.GetData("Achievement", nAchievementId)
return orderedFormat(ConfigTable.GetUIText("Story_UnlockAchievement") or "", mapAchievementCfg.Title) .. [[
(]] .. mapAchievementCfg.Desc .. ")"
end
end
break
end
if nConditionIndex == 7 and 0 < conditionValue then
local mapLevelCfg = ConfigTable.GetData("ActivityLevelsLevel", conditionValue)
if mapLevelCfg then
return orderedFormat(ConfigTable.GetUIText("ActivityStory_UnlockActivityLevel"), mapLevelCfg.Name)
end
end
break
end
end
return ""
end
function UnchartedMapStoryCtrl:GetRemainTimeStr(nOpenTime, nOpenDay)
local nRefreshTime = CS.ClientManager.Instance:GetNextRefreshTime(nOpenTime) - 86400
local nRemainTime = nRefreshTime + nOpenDay * 86400 - CS.ClientManager.Instance.serverTimeStamp
local tbUnits = {
{
86400,
"ActivityLevels_Lock_Day_Color_Common"
},
{
3600,
"ActivityLevels_Lock_Hour_Color_Common"
},
{
60,
"ActivityLevels_Lock_Min_Color_Common"
},
{
1,
"ActivityLevels_Lock_Sec_Color_Common"
}
}
for _, tbUnit in ipairs(tbUnits) do
local nCount = math.floor(nRemainTime / tbUnit[1])
if 0 < nCount then
return orderedFormat(ConfigTable.GetUIText(tbUnit[2]), "FFF0DB", nCount)
end
end
return ""
end
function UnchartedMapStoryCtrl:OnBtn_ClickBack()
EventManager.Hit(EventId.ClosePanel, PanelId.UnchartedMapStory_10113)
end
function UnchartedMapStoryCtrl:OnBtn_ClickHome()
PanelManager.Home()
end
function UnchartedMapStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function UnchartedMapStoryCtrl:OnEvent_Story_Done(bHasReward)
self._bCantClick = bHasReward == true
self:RefreshPanel()
end
function UnchartedMapStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
if bConfirm and self._sAvgId then
EventManager.Hit(EventId.SetTransition, 2, function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self._sAvgId, self._nActId, self._bReview)
end)
end
end
function UnchartedMapStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self._bCantClick = false
if self._nSelectedStoryId and self._nSelectedStoryId == self._tbAllStory[#self._tbAllStory] and self._objStoryData:IsStoryReaded(self._nSelectedStoryId) then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
function UnchartedMapStoryCtrl:OnBtn_ClickCloseComplete()
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
return UnchartedMapStoryCtrl
@@ -0,0 +1,20 @@
local BasePanel = require("GameCore.UI.BasePanel")
local UnchartedMapStoryPanel = class("UnchartedMapStoryPanel", BasePanel)
UnchartedMapStoryPanel._tbDefine = {
{
sPrefabPath = "ActivityStoryReview/10113/UnchartedMapStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10113.Story.UnchartedMapStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function UnchartedMapStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
return UnchartedMapStoryPanel
@@ -0,0 +1,16 @@
local UnchartedMapTaskPanel = class("UnchartedMapTaskPanel", BasePanel)
UnchartedMapTaskPanel._sUIResRootPath = "UI_Activity/"
UnchartedMapTaskPanel._tbDefine = {
{
sPrefabPath = "10113/Task.prefab",
sCtrlName = "Game.UI.ActivityTheme.TaskCommon.TaskCommonCtrl_01"
}
}
local tbImgDbType = {SizeDelta = 1, FillAmount = 2}
function UnchartedMapTaskPanel:Awake()
local tbParam = self:GetPanelParam()
if type(tbParam) == "table" and tbParam[3] == nil then
tbParam[3] = tbImgDbType.FillAmount
end
end
return UnchartedMapTaskPanel
@@ -0,0 +1,622 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local UnchartedMapCtrl = class("UnchartedMapCtrl", BaseCtrl)
local ClientManager = CS.ClientManager.Instance
local TimerManager = require("GameCore.Timer.TimerManager")
local LocalData = require("GameCore.Data.LocalData")
UnchartedMapCtrl._mapNodeConfig = {
goBg = {sNodeName = "---Bg---"},
TopBar = {
sNodeName = "TopBarPanel",
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
},
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"
},
txtMiniGame = {
sComponentName = "TMP_Text",
sLanguageId = "IceCreamTruck_PlayTitle"
},
imgMiniGameEnd = {},
dbMiniGameEnd = {},
txtMiniGameEnd = {
sComponentName = "TMP_Text",
sLanguageId = "IceCreamTruck_PlayTitle"
},
txtMiniGame_End = {},
txtMiniGameEndState = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
imgMiniGameActivityUnlockTime = {},
txtMiniGameActivityUnlockTime = {sComponentName = "TMP_Text"},
imgMiniGameActivityTime = {},
txtMiniGameActivityTime = {sComponentName = "TMP_Text"},
goMiniGameEnd = {},
txtTask = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Task"
},
txtTaskProgress = {sComponentName = "TMP_Text"},
imgTaskActivityTime = {},
txtTaskActivityTime = {sComponentName = "TMP_Text"},
dbTaskEnd = {},
txtTaskEndState = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
imgTaskEnd = {},
txtTaskEnd = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Task"
},
txtTaskProgress_End = {},
imgTaskActivityUnlockTime = {},
txtTaskActivityUnlockTime = {sComponentName = "TMP_Text"},
txtTaskProgressEnd = {sComponentName = "TMP_Text"},
txtStory = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Story"
},
txtStory_End = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Story"
},
goStoryEnd = {},
txtStoryEnd = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
imgStoryActivityTime = {},
txtStoryActivityTime = {sComponentName = "TMP_Text"},
imgStoryActivityUnlockTime = {},
txtStoryActivityUnlockTime = {sComponentName = "TMP_Text"},
imgStoryEnd = {},
txtShopEndState = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
txtShop = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Shop"
},
imgShopActivityTime = {},
txtShopActivityTime = {sComponentName = "TMP_Text"},
imgShopActivityUnlockTime = {},
txtShopActivityUnlockTime = {sComponentName = "TMP_Text"},
txtShopEnd = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Shop"
},
imgShopEnd = {},
txtShop_End = {},
dbShopEnd = {},
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 = {},
imgLevelActivityTime = {},
txtLevelActivityTime = {sComponentName = "TMP_Text"},
miniGameRedDot = {},
redDotEntrance2 = {},
storyRedDot = {},
reddotLevel = {}
}
UnchartedMapCtrl._mapEventConfig = {}
local ActivityState = {
NotOpen = 1,
Open = 2,
Closed = 3
}
function UnchartedMapCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
end
self.ActData = PlayerData.Activity:GetActivityGroupDataById(self.nActId)
if self.ActData ~= nil then
self.ActivityGroupCfg = self.ActData.actGroupConfig
end
end
function UnchartedMapCtrl:OnEnable()
self:RefreshPanel()
self:RegisterReddot()
end
function UnchartedMapCtrl:SetEnterState()
local sAnimName = "LongestDayPanel_Full"
local sAudioName = "Mode_10112_activity"
if self.bFirstEnter then
sAnimName = "LongestDayPanel_Pullback"
sAudioName = "Mode_10112_activity_01"
end
self.bFirstEnter = true
self.animRoot = self.gameObject:GetComponent("Animator")
local nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {sAnimName})
self.animRoot:Play(sAnimName, 0, 0)
WwiseAudioMgr:PostEvent(sAudioName)
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
end
function UnchartedMapCtrl:RegisterReddot()
for i = 1, 5 do
local actData = self.ActData: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
if state == ActivityState.Closed then
self._mapNode.miniGameRedDot:SetActive(false)
else
local nActId = actData.ActivityId
RedDotManager.RegisterNode(RedDotDefine.Activity_IceCreamTruck_New, {nActId}, self._mapNode.miniGameRedDot)
end
end
end
end
end
function UnchartedMapCtrl: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 UnchartedMapCtrl:RefreshPanel()
if self.ActData == nil or self.ActivityGroupCfg == nil then
return
end
self:RefreshTime()
self:RefreshButtonState()
end
function UnchartedMapCtrl:RefreshTime()
local bOpen = self.ActData:CheckActivityGroupOpen()
if bOpen then
self:RefreshRemainTime(self.ActData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
if nil == self.remainTimer then
self.remainTimer = self:AddTimer(0, 1, function()
local remainTime = self:RefreshRemainTime(self.ActData: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.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.txtActivityDate, dateStr)
end
function UnchartedMapCtrl: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 UnchartedMapCtrl: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 UnchartedMapCtrl:RefreshButtonState()
self.tbActState = {}
for i = 1, 5 do
local actData = self.ActData: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 UnchartedMapCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans, refreshFunc)
local countDowmTimer
local activityId = actData.ActivityId
local activityData = ConfigTable.GetData("Activity", activityId)
local sEndTime = ""
if activityData ~= nil then
sEndTime = activityData.EndTime
end
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.ActData:GetActGroupEndTime() then
bShowCountDown = true
elseif endTime < self.ActData: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 UnchartedMapCtrl: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.dbMiniGameEnd: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
RedDotManager.SetValid(RedDotDefine.Activity_ThrowGift_New, {
actData.ActivityId
}, false)
end
self.tbActState[activityId] = state
end
end
function UnchartedMapCtrl: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.imgTaskEnd.gameObject:SetActive(state == ActivityState.Closed)
self._mapNode.dbTaskEnd.gameObject: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 UnchartedMapCtrl: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.imgShopActivityUnlockTime, 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 UnchartedMapCtrl: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 anim = self._mapNode.btnEntrance_[AllEnum.ActivityThemeFuncIndex.Level].transform:GetChild(0):GetComponent("Animator")
if state == ActivityState.Open then
anim:Play("btnEntrance_5_idle")
end
end
end
function UnchartedMapCtrl: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.dbShopEnd: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 UnchartedMapCtrl: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 UnchartedMapCtrl:RefreshActivityData()
if self.bRequiredActData then
return
end
self:AddTimer(1, 3, function()
self:RequireActiviyData()
end, true, true, true)
end
function UnchartedMapCtrl:OnBtn_ClickActivityEntrance(btn, nIndex)
local actData = self.ActData:GetActivityDataByIndex(nIndex)
if actData == nil then
return
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 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_ThrowGift_New", true)
RedDotManager.SetValid(RedDotDefine.Activity_ThrowGift_New, {
actData.ActivityId
}, false)
local func = function()
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId, self.nActId)
end
EventManager.Hit(EventId.SetTransition, 52, 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 UnchartedMapCtrl

Some files were not shown because too many files have changed in this diff Show More