Update - 1.15.0.134
EN: 1.15.0.134 CN: 1.15.0.133 JP: 1.15.0.137 KR: 1.15.0.139
This commit is contained in:
@@ -16,6 +16,8 @@ ExeEditorCtrl._mapNodeConfig = {
|
||||
}
|
||||
ExeEditorCtrl._mapEventConfig = {}
|
||||
function ExeEditorCtrl:OnEnable()
|
||||
local go = GameObject.Find("==== UI ROOT ====/---- UI OVERLAY ----/TouchEffectUI")
|
||||
go:SetActive(false)
|
||||
local _goLogView = GameObject.Find("==== UI ROOT ====/---- UI OVERLAY ----/_InGameLogView")
|
||||
if _goLogView ~= nil and _goLogView:IsNull() == false then
|
||||
_goLogView:SetActive(true)
|
||||
|
||||
@@ -23,8 +23,10 @@ function ActivityLevelsInstanceLevel:Init(parent, nActivityId, nLevelId, nBuildI
|
||||
local GetBuildCallback = function(mapBuildData)
|
||||
self.mapBuildData = mapBuildData
|
||||
self.tbCharId = {}
|
||||
self.tbCharTrialId = {}
|
||||
for _, mapChar in ipairs(self.mapBuildData.tbChar) do
|
||||
table.insert(self.tbCharId, mapChar.nTid)
|
||||
self.tbCharTrialId[mapChar.nTid] = mapChar.nTrialId
|
||||
end
|
||||
self.tbDiscId = {}
|
||||
for _, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
@@ -78,8 +80,10 @@ function ActivityLevelsInstanceLevel:OnEvent_SendMsgFinishBattle()
|
||||
self.curFloorIdx = self.curFloorIdx + 1
|
||||
self.mapBuildData = mapBuildData
|
||||
self.tbCharId = {}
|
||||
self.tbCharTrialId = {}
|
||||
for _, mapChar in ipairs(self.mapBuildData.tbChar) do
|
||||
table.insert(self.tbCharId, mapChar.nTid)
|
||||
self.tbCharTrialId[mapChar.nTid] = mapChar.nTrialId
|
||||
end
|
||||
self.tbDiscId = {}
|
||||
for _, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
@@ -224,13 +228,13 @@ function ActivityLevelsInstanceLevel:SetCharFixedAttribute()
|
||||
end
|
||||
function ActivityLevelsInstanceLevel:CalCharFixedEffect(nCharId, bMainChar, tbDiscId)
|
||||
local stActorInfo = CS.Lua2CSharpInfo_CharAttribute()
|
||||
PlayerData.Char:CalCharacterAttrBattle(nCharId, stActorInfo, bMainChar, tbDiscId, self.mapBuildData.nBuildId)
|
||||
PlayerData.Build:CalBuildCharacterAttrBattle(self.mapBuildData.nBuildId, nCharId, self.tbCharTrialId and self.tbCharTrialId[nCharId], stActorInfo, bMainChar, tbDiscId)
|
||||
return stActorInfo
|
||||
end
|
||||
function ActivityLevelsInstanceLevel:SetPersonalPerk()
|
||||
if self.mapBuildData ~= nil then
|
||||
for nCharId, tbPerk in pairs(self.mapBuildData.tbPotentials) do
|
||||
local mapAddLevel = PlayerData.Char:GetCharEnhancedPotential(nCharId)
|
||||
local mapAddLevel = PlayerData.Build:GetBuildEnhancedPotential(self.mapBuildData.nBuildId, nCharId, self.tbCharTrialId and self.tbCharTrialId[nCharId])
|
||||
local tbPerkInfo = {}
|
||||
for _, mapPerkInfo in ipairs(tbPerk) do
|
||||
local nAddLv = mapAddLevel[mapPerkInfo.nPotentialId] or 0
|
||||
@@ -247,7 +251,7 @@ function ActivityLevelsInstanceLevel:SetDiscInfo()
|
||||
local tbDiscInfo = {}
|
||||
for k, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
if k <= 3 then
|
||||
local discInfo = PlayerData.Disc:CalcDiscInfoInBuild(nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
local discInfo = PlayerData.Build:GetBuildDiscInfoInBuild(self.mapBuildData.nBuildId, nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
table.insert(tbDiscInfo, discInfo)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,8 +15,10 @@ function DailyInstanceLevel:Init(parent, nLevelId, nBuildId)
|
||||
local GetBuildCallback = function(mapBuildData)
|
||||
self.mapBuildData = mapBuildData
|
||||
self.tbCharId = {}
|
||||
self.tbCharTrialId = {}
|
||||
for _, mapChar in ipairs(self.mapBuildData.tbChar) do
|
||||
table.insert(self.tbCharId, mapChar.nTid)
|
||||
self.tbCharTrialId[mapChar.nTid] = mapChar.nTrialId
|
||||
end
|
||||
self.tbDiscId = {}
|
||||
for _, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
@@ -159,13 +161,13 @@ function DailyInstanceLevel:SetCharFixedAttribute()
|
||||
end
|
||||
function DailyInstanceLevel:CalCharFixedEffect(nCharId, bMainChar, tbDiscId)
|
||||
local stActorInfo = CS.Lua2CSharpInfo_CharAttribute()
|
||||
PlayerData.Char:CalCharacterAttrBattle(nCharId, stActorInfo, bMainChar, tbDiscId, self.mapBuildData.nBuildId)
|
||||
PlayerData.Build:CalBuildCharacterAttrBattle(self.mapBuildData.nBuildId, nCharId, self.tbCharTrialId and self.tbCharTrialId[nCharId], stActorInfo, bMainChar, tbDiscId)
|
||||
return stActorInfo
|
||||
end
|
||||
function DailyInstanceLevel:SetPersonalPerk()
|
||||
if self.mapBuildData ~= nil then
|
||||
for nCharId, tbPerk in pairs(self.mapBuildData.tbPotentials) do
|
||||
local mapAddLevel = PlayerData.Char:GetCharEnhancedPotential(nCharId)
|
||||
local mapAddLevel = PlayerData.Build:GetBuildEnhancedPotential(self.mapBuildData.nBuildId, nCharId, self.tbCharTrialId and self.tbCharTrialId[nCharId])
|
||||
local tbPerkInfo = {}
|
||||
for _, mapPerkInfo in ipairs(tbPerk) do
|
||||
local nAddLv = mapAddLevel[mapPerkInfo.nPotentialId] or 0
|
||||
@@ -182,7 +184,7 @@ function DailyInstanceLevel:SetDiscInfo()
|
||||
local tbDiscInfo = {}
|
||||
for k, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
if k <= 3 then
|
||||
local discInfo = PlayerData.Disc:CalcDiscInfoInBuild(nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
local discInfo = PlayerData.Build:GetBuildDiscInfoInBuild(self.mapBuildData.nBuildId, nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
table.insert(tbDiscInfo, discInfo)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,8 +15,10 @@ function EquipmentInstanceLevel:Init(parent, nLevelId, nBuildId)
|
||||
local GetBuildCallback = function(mapBuildData)
|
||||
self.mapBuildData = mapBuildData
|
||||
self.tbCharId = {}
|
||||
self.tbCharTrialId = {}
|
||||
for _, mapChar in ipairs(self.mapBuildData.tbChar) do
|
||||
table.insert(self.tbCharId, mapChar.nTid)
|
||||
self.tbCharTrialId[mapChar.nTid] = mapChar.nTrialId
|
||||
end
|
||||
self.tbDiscId = {}
|
||||
for _, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
@@ -159,13 +161,13 @@ function EquipmentInstanceLevel:SetCharFixedAttribute()
|
||||
end
|
||||
function EquipmentInstanceLevel:CalCharFixedEffect(nCharId, bMainChar, tbDiscId)
|
||||
local stActorInfo = CS.Lua2CSharpInfo_CharAttribute()
|
||||
PlayerData.Char:CalCharacterAttrBattle(nCharId, stActorInfo, bMainChar, tbDiscId, self.mapBuildData.nBuildId)
|
||||
PlayerData.Build:CalBuildCharacterAttrBattle(self.mapBuildData.nBuildId, nCharId, self.tbCharTrialId and self.tbCharTrialId[nCharId], stActorInfo, bMainChar, tbDiscId)
|
||||
return stActorInfo
|
||||
end
|
||||
function EquipmentInstanceLevel:SetPersonalPerk()
|
||||
if self.mapBuildData ~= nil then
|
||||
for nCharId, tbPerk in pairs(self.mapBuildData.tbPotentials) do
|
||||
local mapAddLevel = PlayerData.Char:GetCharEnhancedPotential(nCharId)
|
||||
local mapAddLevel = PlayerData.Build:GetBuildEnhancedPotential(self.mapBuildData.nBuildId, nCharId, self.tbCharTrialId and self.tbCharTrialId[nCharId])
|
||||
local tbPerkInfo = {}
|
||||
for _, mapPerkInfo in ipairs(tbPerk) do
|
||||
local nAddLv = mapAddLevel[mapPerkInfo.nPotentialId] or 0
|
||||
@@ -182,7 +184,7 @@ function EquipmentInstanceLevel:SetDiscInfo()
|
||||
local tbDiscInfo = {}
|
||||
for k, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
if k <= 3 then
|
||||
local discInfo = PlayerData.Disc:CalcDiscInfoInBuild(nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
local discInfo = PlayerData.Build:GetBuildDiscInfoInBuild(self.mapBuildData.nBuildId, nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
table.insert(tbDiscInfo, discInfo)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,8 +15,10 @@ function InfinityTowerLevel:Init(parent, floorId, nBuildId, againOrNextLv, isCon
|
||||
local GetBuildCallback = function(mapBuildData)
|
||||
self.mapBuildData = mapBuildData
|
||||
self.tbCharId = {}
|
||||
self.tbCharTrialId = {}
|
||||
for _, mapChar in ipairs(self.mapBuildData.tbChar) do
|
||||
table.insert(self.tbCharId, mapChar.nTid)
|
||||
self.tbCharTrialId[mapChar.nTid] = mapChar.nTrialId
|
||||
end
|
||||
self.tbDiscId = {}
|
||||
for _, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
@@ -43,7 +45,7 @@ function InfinityTowerLevel:Init(parent, floorId, nBuildId, againOrNextLv, isCon
|
||||
end
|
||||
function InfinityTowerLevel:CalCharFixedEffect(nCharId, bMainChar, tbDiscId)
|
||||
local stActorInfo = CS.Lua2CSharpInfo_CharAttribute()
|
||||
PlayerData.Char:CalCharacterAttrBattle(nCharId, stActorInfo, bMainChar, tbDiscId, self.mapBuildData.nBuildId)
|
||||
PlayerData.Build:CalBuildCharacterAttrBattle(self.mapBuildData.nBuildId, nCharId, self.tbCharTrialId and self.tbCharTrialId[nCharId], stActorInfo, bMainChar, tbDiscId)
|
||||
return stActorInfo
|
||||
end
|
||||
function InfinityTowerLevel:BindEvent()
|
||||
@@ -97,7 +99,7 @@ end
|
||||
function InfinityTowerLevel:SetPersonalPerk()
|
||||
if self.mapBuildData ~= nil then
|
||||
for nCharId, tbPerk in pairs(self.mapBuildData.tbPotentials) do
|
||||
local mapAddLevel = PlayerData.Char:GetCharEnhancedPotential(nCharId)
|
||||
local mapAddLevel = PlayerData.Build:GetBuildEnhancedPotential(self.mapBuildData.nBuildId, nCharId, self.tbCharTrialId and self.tbCharTrialId[nCharId])
|
||||
local tbPerkInfo = {}
|
||||
for _, mapPerkInfo in ipairs(tbPerk) do
|
||||
local nAddLv = mapAddLevel[mapPerkInfo.nPotentialId] or 0
|
||||
@@ -114,7 +116,7 @@ function InfinityTowerLevel:SetDiscInfo()
|
||||
local tbDiscInfo = {}
|
||||
for k, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
if k <= 3 then
|
||||
local discInfo = PlayerData.Disc:CalcDiscInfoInBuild(nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
local discInfo = PlayerData.Build:GetBuildDiscInfoInBuild(self.mapBuildData.nBuildId, nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
table.insert(tbDiscInfo, discInfo)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -428,7 +428,8 @@ function JointDrillLevelData_1:JointDrillSuccess(netMsg)
|
||||
}
|
||||
local bSimulate = self.parent:GetBattleSimulate()
|
||||
local nBattleCount = self.parent:GetJointDrillBattleCount()
|
||||
EventManager.Hit(EventId.OpenPanel, JointDrillContext.GetPanelId(self.parent.nActId, "Result"), nResultType, self.nCurLevel, 0, self.nLevelId, {}, mapScore, netMsg.Items or {}, netMsg.Change or {}, netMsg.Old, netMsg.New, bSimulate, nBattleCount, self.tbCharDamage)
|
||||
local tbLastCharIds = self.parent:GetJointDrillLastTeam()
|
||||
EventManager.Hit(EventId.OpenPanel, JointDrillContext.GetPanelId(self.parent.nActId, "Result"), nResultType, self.nCurLevel, 0, self.nLevelId, {}, mapScore, netMsg.Items or {}, netMsg.Change or {}, netMsg.Old, netMsg.New, bSimulate, nBattleCount, self.tbCharDamage, tbLastCharIds)
|
||||
self.parent:ChallengeEnd()
|
||||
end
|
||||
EventManager.Add("SettlementPerformLoadFinish", self, openBattleResultPanel)
|
||||
@@ -473,7 +474,6 @@ function JointDrillLevelData_1:JointDrillFail(nResultType, netMsg)
|
||||
bossInfo.nHpMax = tempBossData.nHpMax
|
||||
end
|
||||
local bSimulate = self.parent:GetBattleSimulate()
|
||||
local nBattleCount = self.parent:GetJointDrillBattleCount()
|
||||
local mapScore = {}
|
||||
local mapReward = {}
|
||||
local mapChange = {}
|
||||
@@ -498,7 +498,9 @@ function JointDrillLevelData_1:JointDrillFail(nResultType, netMsg)
|
||||
mapReward = netMsg.Items or {}
|
||||
mapChange = netMsg.Change or {}
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, JointDrillContext.GetPanelId(self.parent.nActId, "Result"), nResultType, self.nCurLevel, self.nGameTime, self.nLevelId, bossInfo, mapScore, mapReward, mapChange, nOld, nNew, bSimulate, nBattleCount, self.tbCharDamage)
|
||||
local nBattleCount = self.parent:GetJointDrillBattleCount()
|
||||
local tbLastCharIds = self.parent:GetJointDrillLastTeam()
|
||||
EventManager.Hit(EventId.OpenPanel, JointDrillContext.GetPanelId(self.parent.nActId, "Result"), nResultType, self.nCurLevel, self.nGameTime, self.nLevelId, bossInfo, mapScore, mapReward, mapChange, nOld, nNew, bSimulate, nBattleCount, self.tbCharDamage, tbLastCharIds)
|
||||
self.parent:LevelEnd(nResultType)
|
||||
end
|
||||
function JointDrillLevelData_1:SyncGameTime(nTime)
|
||||
|
||||
@@ -186,7 +186,8 @@ function JointDrillLevelData_2:JointDrillSuccess(netMsg)
|
||||
}
|
||||
local bSimulate = self.parent:GetBattleSimulate()
|
||||
local nBattleCount = self.parent:GetJointDrillBattleCount()
|
||||
EventManager.Hit(EventId.OpenPanel, JointDrillContext.GetPanelId(self.parent.nActId, "Result"), nResultType, self.nCurLevel, 0, self.nLevelId, {}, mapScore, netMsg.Items or {}, netMsg.Change or {}, netMsg.Old, netMsg.New, bSimulate, nBattleCount, self.tbCharDamage)
|
||||
local tbLastCharIds = self.parent:GetJointDrillLastTeam()
|
||||
EventManager.Hit(EventId.OpenPanel, JointDrillContext.GetPanelId(self.parent.nActId, "Result"), nResultType, self.nCurLevel, 0, self.nLevelId, {}, mapScore, netMsg.Items or {}, netMsg.Change or {}, netMsg.Old, netMsg.New, bSimulate, nBattleCount, self.tbCharDamage, tbLastCharIds)
|
||||
self.parent:ChallengeEnd()
|
||||
end
|
||||
EventManager.Add("SettlementPerformLoadFinish", self, openBattleResultPanel)
|
||||
@@ -206,10 +207,13 @@ function JointDrillLevelData_2:CheckJointDrillGameOver()
|
||||
end
|
||||
self.parent:JointDrillSync(self.nCurLevel, self.nGameTime, self.nDamageValue, "", syncCallback)
|
||||
else
|
||||
local callback = function(netMsg)
|
||||
self:JointDrillFail(AllEnum.JointDrillResultType.BattleEnd, netMsg, self.nCurLevel)
|
||||
local syncCallback = function()
|
||||
local callback = function(netMsg)
|
||||
self:JointDrillFail(AllEnum.JointDrillResultType.BattleEnd, netMsg, self.nCurLevel)
|
||||
end
|
||||
self.parent:JointDrillGiveUp(self.nCurLevel, self.nGameTime, self.nDamageValue, sRecord, callback)
|
||||
end
|
||||
self.parent:JointDrillGiveUp(self.nCurLevel, self.nGameTime, self.nDamageValue, sRecord, callback)
|
||||
self.parent:JointDrillSync(self.nCurLevel, self.nGameTime, self.nDamageValue, "", syncCallback)
|
||||
end
|
||||
end
|
||||
NovaAPI.DispatchEventWithData("JointDrill_CacheTempData_Start", nil, {
|
||||
@@ -237,7 +241,6 @@ function JointDrillLevelData_2:JointDrillFail(nResultType, netMsg, nLevel)
|
||||
end
|
||||
end
|
||||
local bSimulate = self.parent:GetBattleSimulate()
|
||||
local nBattleCount = self.parent:GetJointDrillBattleCount()
|
||||
local mapScore = {}
|
||||
local mapReward = {}
|
||||
local mapChange = {}
|
||||
@@ -262,7 +265,9 @@ function JointDrillLevelData_2:JointDrillFail(nResultType, netMsg, nLevel)
|
||||
mapReward = netMsg.Items or {}
|
||||
mapChange = netMsg.Change or {}
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, JointDrillContext.GetPanelId(self.parent.nActId, "Result"), nResultType, self.nCurLevel, self.nGameTime, self.nLevelId, bossInfo, mapScore, mapReward, mapChange, nOld, nNew, bSimulate, nBattleCount, self.tbCharDamage)
|
||||
local nBattleCount = self.parent:GetJointDrillBattleCount()
|
||||
local tbLastCharIds = self.parent:GetJointDrillLastTeam()
|
||||
EventManager.Hit(EventId.OpenPanel, JointDrillContext.GetPanelId(self.parent.nActId, "Result"), nResultType, self.nCurLevel, self.nGameTime, self.nLevelId, bossInfo, mapScore, mapReward, mapChange, nOld, nNew, bSimulate, nBattleCount, self.tbCharDamage, tbLastCharIds)
|
||||
self.parent:LevelEnd(nResultType)
|
||||
end
|
||||
function JointDrillLevelData_2:JointDrillTimeOut()
|
||||
|
||||
@@ -17,6 +17,7 @@ function RegionBossBattleLevel:Init(parent, nLevelId, nBuildId, isWeekBoss)
|
||||
local GetBuildCallback = function(mapBuildData)
|
||||
self.mapBuildData = mapBuildData
|
||||
self.tbCharId = {}
|
||||
self.tbCharTrialId = {}
|
||||
if mapBuildData == nil then
|
||||
local sTip = ConfigTable.GetUIText("RegionBoss_Team_Delete")
|
||||
EventManager.Hit(EventId.OpenMessageBox, sTip)
|
||||
@@ -24,6 +25,7 @@ function RegionBossBattleLevel:Init(parent, nLevelId, nBuildId, isWeekBoss)
|
||||
end
|
||||
for _, mapChar in ipairs(self.mapBuildData.tbChar) do
|
||||
table.insert(self.tbCharId, mapChar.nTid)
|
||||
self.tbCharTrialId[mapChar.nTid] = mapChar.nTrialId
|
||||
end
|
||||
self.tbDiscId = {}
|
||||
for _, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
@@ -274,13 +276,13 @@ function RegionBossBattleLevel:SetCharFixedAttribute()
|
||||
end
|
||||
function RegionBossBattleLevel:CalCharFixedEffect(nCharId, bMainChar, tbDiscId)
|
||||
local stActorInfo = CS.Lua2CSharpInfo_CharAttribute()
|
||||
PlayerData.Char:CalCharacterAttrBattle(nCharId, stActorInfo, bMainChar, tbDiscId, self.mapBuildData.nBuildId)
|
||||
PlayerData.Build:CalBuildCharacterAttrBattle(self.mapBuildData.nBuildId, nCharId, self.tbCharTrialId and self.tbCharTrialId[nCharId], stActorInfo, bMainChar, tbDiscId)
|
||||
return stActorInfo
|
||||
end
|
||||
function RegionBossBattleLevel:SetPersonalPerk()
|
||||
if self.mapBuildData ~= nil then
|
||||
for nCharId, tbPerk in pairs(self.mapBuildData.tbPotentials) do
|
||||
local mapAddLevel = PlayerData.Char:GetCharEnhancedPotential(nCharId)
|
||||
local mapAddLevel = PlayerData.Build:GetBuildEnhancedPotential(self.mapBuildData.nBuildId, nCharId, self.tbCharTrialId and self.tbCharTrialId[nCharId])
|
||||
local tbPerkInfo = {}
|
||||
for _, mapPerkInfo in ipairs(tbPerk) do
|
||||
local nAddLv = mapAddLevel[mapPerkInfo.nPotentialId] or 0
|
||||
@@ -297,7 +299,7 @@ function RegionBossBattleLevel:SetDiscInfo()
|
||||
local tbDiscInfo = {}
|
||||
for k, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
if k <= 3 then
|
||||
local discInfo = PlayerData.Disc:CalcDiscInfoInBuild(nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
local discInfo = PlayerData.Build:GetBuildDiscInfoInBuild(self.mapBuildData.nBuildId, nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
table.insert(tbDiscInfo, discInfo)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,8 +15,10 @@ function SkillInstanceLevel:Init(parent, nLevelId, nBuildId)
|
||||
local GetBuildCallback = function(mapBuildData)
|
||||
self.mapBuildData = mapBuildData
|
||||
self.tbCharId = {}
|
||||
self.tbCharTrialId = {}
|
||||
for _, mapChar in ipairs(self.mapBuildData.tbChar) do
|
||||
table.insert(self.tbCharId, mapChar.nTid)
|
||||
self.tbCharTrialId[mapChar.nTid] = mapChar.nTrialId
|
||||
end
|
||||
self.tbDiscId = {}
|
||||
for _, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
@@ -159,13 +161,13 @@ function SkillInstanceLevel:SetCharFixedAttribute()
|
||||
end
|
||||
function SkillInstanceLevel:CalCharFixedEffect(nCharId, bMainChar, tbDiscId)
|
||||
local stActorInfo = CS.Lua2CSharpInfo_CharAttribute()
|
||||
PlayerData.Char:CalCharacterAttrBattle(nCharId, stActorInfo, bMainChar, tbDiscId, self.mapBuildData.nBuildId)
|
||||
PlayerData.Build:CalBuildCharacterAttrBattle(self.mapBuildData.nBuildId, nCharId, self.tbCharTrialId and self.tbCharTrialId[nCharId], stActorInfo, bMainChar, tbDiscId)
|
||||
return stActorInfo
|
||||
end
|
||||
function SkillInstanceLevel:SetPersonalPerk()
|
||||
if self.mapBuildData ~= nil then
|
||||
for nCharId, tbPerk in pairs(self.mapBuildData.tbPotentials) do
|
||||
local mapAddLevel = PlayerData.Char:GetCharEnhancedPotential(nCharId)
|
||||
local mapAddLevel = PlayerData.Build:GetBuildEnhancedPotential(self.mapBuildData.nBuildId, nCharId, self.tbCharTrialId and self.tbCharTrialId[nCharId])
|
||||
local tbPerkInfo = {}
|
||||
for _, mapPerkInfo in ipairs(tbPerk) do
|
||||
local nAddLv = mapAddLevel[mapPerkInfo.nPotentialId] or 0
|
||||
@@ -182,7 +184,7 @@ function SkillInstanceLevel:SetDiscInfo()
|
||||
local tbDiscInfo = {}
|
||||
for k, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
if k <= 3 then
|
||||
local discInfo = PlayerData.Disc:CalcDiscInfoInBuild(nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
local discInfo = PlayerData.Build:GetBuildDiscInfoInBuild(self.mapBuildData.nBuildId, nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
table.insert(tbDiscInfo, discInfo)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1342,6 +1342,7 @@ end
|
||||
function SoldierLevelData:OpenSandTable()
|
||||
if self.bOpenSandTable then
|
||||
EventManager.Hit("EnterStandTable")
|
||||
self:SendDeploySync()
|
||||
end
|
||||
self.bOpenSandTable = false
|
||||
end
|
||||
|
||||
@@ -62,12 +62,7 @@ function StoryLevel:RefreshCharDamageData()
|
||||
end
|
||||
end
|
||||
function StoryLevel:OnEvent_LoadLevelRefresh()
|
||||
local mapAllEft, mapDiscEft, mapNoteEffect, tbNoteInfo = {}, {}, {}, {}
|
||||
if self.bTrialLevel then
|
||||
mapAllEft, mapDiscEft, mapNoteEffect, tbNoteInfo = PlayerData.Build:GetTrialBuildAllEft()
|
||||
else
|
||||
mapAllEft, mapDiscEft, mapNoteEffect, tbNoteInfo = PlayerData.Build:GetBuildAllEft(self.mapBuildData.nBuildId)
|
||||
end
|
||||
local mapAllEft, mapDiscEft, mapNoteEffect, tbNoteInfo = PlayerData.Build:GetBuildAllEft(self.mapBuildData.nBuildId)
|
||||
safe_call_cs_func(CS.AdventureModuleHelper.SetNoteInfo, tbNoteInfo)
|
||||
self.mapEftData = UTILS.AddBuildEffect(mapAllEft, mapDiscEft, mapNoteEffect)
|
||||
self:ResetCharacter()
|
||||
@@ -120,8 +115,7 @@ function StoryLevel:OnEvent_AdventureModuleEnter()
|
||||
self:SetPersonalPerk()
|
||||
self:SetDiscInfo()
|
||||
for idx, nCharId in ipairs(self.tbCharId) do
|
||||
local nTrialOrCharId = self.bTrialLevel and self.tbCharTrialId[nCharId] or nCharId
|
||||
local stActorInfo = self:CalCharFixedEffect(nTrialOrCharId, idx == 1, self.tbDiscId, self.bTrialLevel)
|
||||
local stActorInfo = self:CalCharFixedEffect(nCharId, idx == 1, self.tbDiscId)
|
||||
safe_call_cs_func(CS.AdventureModuleHelper.SetActorAttribute, nCharId, stActorInfo)
|
||||
end
|
||||
end
|
||||
@@ -203,28 +197,15 @@ function StoryLevel:PlaySuccessPerform(FadeTime, mapChangeInfo, sVideoName)
|
||||
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
|
||||
CS.AdventureModuleHelper.LevelStateChanged(true, FadeTime or 0.5)
|
||||
end
|
||||
function StoryLevel:CalCharFixedEffect(nTrialOrCharId, bMainChar, tbDiscId, bTrialLevel)
|
||||
function StoryLevel:CalCharFixedEffect(nCharId, bMainChar, tbDiscId)
|
||||
local stActorInfo = CS.Lua2CSharpInfo_CharAttribute()
|
||||
if bTrialLevel then
|
||||
PlayerData.Char:CalCharacterTrialAttrBattle(nTrialOrCharId, stActorInfo, bMainChar, tbDiscId, self.mapBuildData.nBuildId)
|
||||
else
|
||||
PlayerData.Char:CalCharacterAttrBattle(nTrialOrCharId, stActorInfo, bMainChar, tbDiscId, self.mapBuildData.nBuildId)
|
||||
end
|
||||
PlayerData.Build:CalBuildCharacterAttrBattle(self.mapBuildData.nBuildId, nCharId, self.tbCharTrialId and self.tbCharTrialId[nCharId], stActorInfo, bMainChar, tbDiscId)
|
||||
return stActorInfo
|
||||
end
|
||||
function StoryLevel:SetPersonalPerk()
|
||||
if self.mapBuildData ~= nil then
|
||||
for nCharId, tbPerk in pairs(self.mapBuildData.tbPotentials) do
|
||||
local mapAddLevel = {}
|
||||
if self.bTrialLevel then
|
||||
if self.tbCharTrialId[nCharId] then
|
||||
mapAddLevel = PlayerData.Talent:GetTrialEnhancedPotential(self.tbCharTrialId[nCharId])
|
||||
else
|
||||
printError("体验build内,有多余角色的潜能" .. nCharId)
|
||||
end
|
||||
else
|
||||
mapAddLevel = PlayerData.Char:GetCharEnhancedPotential(nCharId)
|
||||
end
|
||||
local mapAddLevel = PlayerData.Build:GetBuildEnhancedPotential(self.mapBuildData.nBuildId, nCharId, self.tbCharTrialId and self.tbCharTrialId[nCharId])
|
||||
local tbPerkInfo = {}
|
||||
for _, mapPerkInfo in ipairs(tbPerk) do
|
||||
local nAddLv = mapAddLevel[mapPerkInfo.nPotentialId] or 0
|
||||
@@ -241,12 +222,7 @@ function StoryLevel:SetDiscInfo()
|
||||
local tbDiscInfo = {}
|
||||
for k, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
if k <= 3 then
|
||||
local discInfo
|
||||
if self.bTrialLevel then
|
||||
discInfo = PlayerData.Disc:CalcTrialInfoInBuild(nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
else
|
||||
discInfo = PlayerData.Disc:CalcDiscInfoInBuild(nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
end
|
||||
local discInfo = PlayerData.Build:GetBuildDiscInfoInBuild(self.mapBuildData.nBuildId, nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
table.insert(tbDiscInfo, discInfo)
|
||||
end
|
||||
end
|
||||
@@ -257,6 +233,17 @@ function StoryLevel:OnEvent_Time(nTime)
|
||||
end
|
||||
function StoryLevel:OnEvnet_Pause()
|
||||
local sAim = self.bActivityStory == true and ConfigTable.GetData("ActivityStory", self.nLevelId).Aim or ConfigTable.GetData_Story(self.nLevelId).Aim
|
||||
if not self.bActivityStory then
|
||||
local mapStory = ConfigTable.GetData_Story(self.nLevelId)
|
||||
if mapStory == nil then
|
||||
printError("mapStory is nil,id = " .. self.nLevelId)
|
||||
return
|
||||
end
|
||||
if mapStory.EnterMethod == GameEnum.EnterMethod.JumpFormation then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ChapterPausePanel, self.nMainLineTime or 0, self.mapBuildData.tbChar, sAim)
|
||||
return
|
||||
end
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.MainBattlePause, self.nMainLineTime or 0, self.mapBuildData.tbChar, sAim)
|
||||
end
|
||||
function StoryLevel:ChangeFloor()
|
||||
@@ -269,8 +256,7 @@ function StoryLevel:ChangeFloor()
|
||||
self:SetPersonalPerk()
|
||||
self:SetDiscInfo()
|
||||
for idx, nCharId in ipairs(self.tbCharId) do
|
||||
local nTrialOrCharId = self.bTrialLevel and self.tbCharTrialId[nCharId] or nCharId
|
||||
local stActorInfo = self:CalCharFixedEffect(nTrialOrCharId, idx == 1, self.tbDiscId, self.bTrialLevel)
|
||||
local stActorInfo = self:CalCharFixedEffect(nCharId, idx == 1, self.tbDiscId)
|
||||
safe_call_cs_func(CS.AdventureModuleHelper.SetActorAttribute, nCharId, stActorInfo)
|
||||
end
|
||||
self:SetCharStatus()
|
||||
|
||||
@@ -11,7 +11,7 @@ local mapEventConfig = {
|
||||
TraceHuntSettleSuccess = "OnEvent_TraceHuntSettleSuccess",
|
||||
ADVENTURE_LEVEL_UNLOAD_COMPLETE = "OnEvent_UnloadComplete"
|
||||
}
|
||||
function TraceHuntLevel:Init(parent, nLevelId, nBuildId, isAgain)
|
||||
function TraceHuntLevel:Init(parent, nLevelId, nBuildId, nFloorId, isAgain)
|
||||
self.isSettlement = false
|
||||
self.parent = parent
|
||||
self.LevelId = nLevelId
|
||||
@@ -22,9 +22,9 @@ function TraceHuntLevel:Init(parent, nLevelId, nBuildId, isAgain)
|
||||
self.BattleLv = 1
|
||||
self.nTime = 0
|
||||
self.isCanPause = true
|
||||
local leveData = ConfigTable.GetData("TraceHuntBoss", nLevelId)
|
||||
local leveData = ConfigTable.GetData("TraceHuntFloorGroup", nFloorId)
|
||||
if leveData == nil then
|
||||
printError("TraceHuntBoss 表不存在 id ==== " .. nLevelId)
|
||||
printError("TraceHuntFloorGroup 表不存在 id ==== " .. nFloorId)
|
||||
return
|
||||
end
|
||||
self.ScoreGetSwitchGroupId = leveData.ScoreGetSwitchGroup
|
||||
@@ -36,8 +36,10 @@ function TraceHuntLevel:Init(parent, nLevelId, nBuildId, isAgain)
|
||||
local GetBuildCallback = function(mapBuildData)
|
||||
self.mapBuildData = mapBuildData
|
||||
self.tbCharId = {}
|
||||
self.tbCharTrialId = {}
|
||||
for _, mapChar in ipairs(self.mapBuildData.tbChar) do
|
||||
table.insert(self.tbCharId, mapChar.nTid)
|
||||
self.tbCharTrialId[mapChar.nTid] = mapChar.nTrialId
|
||||
end
|
||||
self.tbDiscId = {}
|
||||
for _, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
@@ -52,7 +54,7 @@ function TraceHuntLevel:Init(parent, nLevelId, nBuildId, isAgain)
|
||||
end
|
||||
PlayerData.nCurGameType = AllEnum.WorldMapNodeType.TraceHunt
|
||||
local params = NovaAPI.GetDynamicLevelParamsBootConfig()
|
||||
CS.AdventureModuleHelper.EnterDynamic(self.LevelId, self.tbCharId, GameEnum.dynamicLevelType.TraceHunt, params)
|
||||
CS.AdventureModuleHelper.EnterDynamic(nFloorId, self.tbCharId, GameEnum.dynamicLevelType.TraceHunt, params)
|
||||
if not isAgain then
|
||||
NovaAPI.EnterModule("AdventureModuleScene", true, 17)
|
||||
else
|
||||
@@ -63,7 +65,7 @@ function TraceHuntLevel:Init(parent, nLevelId, nBuildId, isAgain)
|
||||
end
|
||||
function TraceHuntLevel:CalCharFixedEffect(nCharId, bMainChar, tbDiscId)
|
||||
local stActorInfo = CS.Lua2CSharpInfo_CharAttribute()
|
||||
PlayerData.Char:CalCharacterAttrBattle(nCharId, stActorInfo, bMainChar, tbDiscId, self.mapBuildData.nBuildId)
|
||||
PlayerData.Build:CalBuildCharacterAttrBattle(self.mapBuildData.nBuildId, nCharId, self.tbCharTrialId and self.tbCharTrialId[nCharId], stActorInfo, bMainChar, tbDiscId)
|
||||
return stActorInfo
|
||||
end
|
||||
function TraceHuntLevel:OnEvent_LoadLevelRefresh()
|
||||
@@ -85,7 +87,7 @@ end
|
||||
function TraceHuntLevel:SetPersonalPerk()
|
||||
if self.mapBuildData ~= nil then
|
||||
for nCharId, tbPerk in pairs(self.mapBuildData.tbPotentials) do
|
||||
local mapAddLevel = PlayerData.Char:GetCharEnhancedPotential(nCharId)
|
||||
local mapAddLevel = PlayerData.Build:GetBuildEnhancedPotential(self.mapBuildData.nBuildId, nCharId, self.tbCharTrialId and self.tbCharTrialId[nCharId])
|
||||
local tbPerkInfo = {}
|
||||
for _, mapPerkInfo in ipairs(tbPerk) do
|
||||
local nAddLv = mapAddLevel[mapPerkInfo.nPotentialId] or 0
|
||||
@@ -102,7 +104,7 @@ function TraceHuntLevel:SetDiscInfo()
|
||||
local tbDiscInfo = {}
|
||||
for k, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
if k <= 3 then
|
||||
local discInfo = PlayerData.Disc:CalcDiscInfoInBuild(nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
local discInfo = PlayerData.Build:GetBuildDiscInfoInBuild(self.mapBuildData.nBuildId, nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
table.insert(tbDiscInfo, discInfo)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,8 +29,10 @@ function TravelerDuelLevelData:Init(parent, nLevel, tbAffixes, nBuildId)
|
||||
end
|
||||
self.mapBuildData = mapBuildData
|
||||
self.tbCharId = {}
|
||||
self.tbCharTrialId = {}
|
||||
for i, v in pairs(mapBuildData.tbChar) do
|
||||
table.insert(self.tbCharId, v.nTid)
|
||||
self.tbCharTrialId[v.nTid] = v.nTrialId
|
||||
end
|
||||
self.tbDiscId = {}
|
||||
for _, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
@@ -174,7 +176,7 @@ end
|
||||
function TravelerDuelLevelData:SetPersonalPerk()
|
||||
if self.mapBuildData ~= nil then
|
||||
for nCharId, tbPerk in pairs(self.mapBuildData.tbPotentials) do
|
||||
local mapAddLevel = PlayerData.Char:GetCharEnhancedPotential(nCharId)
|
||||
local mapAddLevel = PlayerData.Build:GetBuildEnhancedPotential(self.mapBuildData.nBuildId, nCharId, self.tbCharTrialId and self.tbCharTrialId[nCharId])
|
||||
local tbPerkInfo = {}
|
||||
for _, mapPerkInfo in ipairs(tbPerk) do
|
||||
local nAddLv = mapAddLevel[mapPerkInfo.nPotentialId] or 0
|
||||
@@ -191,7 +193,7 @@ function TravelerDuelLevelData:SetDiscInfo()
|
||||
local tbDiscInfo = {}
|
||||
for k, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
if k <= 3 then
|
||||
local discInfo = PlayerData.Disc:CalcDiscInfoInBuild(nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
local discInfo = PlayerData.Build:GetBuildDiscInfoInBuild(self.mapBuildData.nBuildId, nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
table.insert(tbDiscInfo, discInfo)
|
||||
end
|
||||
end
|
||||
@@ -231,7 +233,7 @@ function TravelerDuelLevelData:PlaySuccessPerform(bNewRecord, nStar, nTime)
|
||||
end
|
||||
function TravelerDuelLevelData:CalCharFixedEffect(nCharId, bMainChar, tbDiscId)
|
||||
local stActorInfo = CS.Lua2CSharpInfo_CharAttribute()
|
||||
PlayerData.Char:CalCharacterAttrBattle(nCharId, stActorInfo, bMainChar, tbDiscId, self.mapBuildData.nBuildId)
|
||||
PlayerData.Build:CalBuildCharacterAttrBattle(self.mapBuildData.nBuildId, nCharId, self.tbCharTrialId and self.tbCharTrialId[nCharId], stActorInfo, bMainChar, tbDiscId)
|
||||
return stActorInfo
|
||||
end
|
||||
function TravelerDuelLevelData:OnEvnet_Pause()
|
||||
|
||||
@@ -15,6 +15,7 @@ function TrialLevel:Init(parent, nLevelId)
|
||||
self.parent = parent
|
||||
self.nLevelId = nLevelId
|
||||
self.mapChangeInfo = {}
|
||||
self.bTrialBattleStartUploaded = false
|
||||
self.mapLevelCfg = ConfigTable.GetData("TrialFloor", nLevelId)
|
||||
if not self.mapLevelCfg then
|
||||
return
|
||||
@@ -68,6 +69,10 @@ function TrialLevel:OnEvent_LoadLevelRefresh()
|
||||
safe_call_cs_func(CS.AdventureModuleHelper.SetNoteInfo, tbNoteInfo)
|
||||
self.mapEftData = UTILS.AddBuildEffect(mapAllEft, mapDiscEft, mapNoteEffect)
|
||||
EventManager.Hit("OpenTrialInfo", self.nQuestId)
|
||||
if not self.bTrialBattleStartUploaded then
|
||||
self.bTrialBattleStartUploaded = true
|
||||
PlayerData.Trial:UserEventUpload_TrialBattle(1)
|
||||
end
|
||||
end
|
||||
function TrialLevel:RefreshCharDamageData()
|
||||
self.tbCharDamage = UTILS.GetCharDamageResult(self.tbCharId)
|
||||
@@ -79,6 +84,7 @@ function TrialLevel:OnEvent_LevelResult(nLevelTime)
|
||||
self:RefreshCharDamageData()
|
||||
local bReceived = PlayerData.Trial:CheckGroupReceived()
|
||||
local bAbandon = not bReceived
|
||||
local bHasReward = PlayerData.Trial:IsActivityTrialMode()
|
||||
EventManager.Hit("TrialBattleEnd")
|
||||
if self.parent:GetSettlementState() then
|
||||
printError("试玩关结算流程重复进入,本次退出")
|
||||
@@ -88,7 +94,7 @@ function TrialLevel:OnEvent_LevelResult(nLevelTime)
|
||||
if bAbandon then
|
||||
EventManager.Hit("TrialLevelEnd", self.nLevelId)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.BtnTips)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.TrialResult, false, nLevelTime or 0, self.tbCharId, self.parent.nActId, {}, self.tbCharDamage)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.TrialResult, false, nLevelTime or 0, self.tbCharId, self.parent.nActId or 0, {}, self.tbCharDamage, bHasReward)
|
||||
self.parent:LevelEnd()
|
||||
return
|
||||
end
|
||||
@@ -140,6 +146,7 @@ function TrialLevel:PlaySuccessPerform(nLevelTime)
|
||||
local func_SettlementFinish = function(bSuccess)
|
||||
end
|
||||
local tbChar = self.tbCharId
|
||||
local bHasReward = PlayerData.Trial:IsActivityTrialMode()
|
||||
local function levelEndCallback()
|
||||
EventManager.Remove("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
|
||||
local nType = self.mapLevelCfg.Theme
|
||||
@@ -154,7 +161,7 @@ function TrialLevel:PlaySuccessPerform(nLevelTime)
|
||||
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
|
||||
local function openBattleResultPanel()
|
||||
EventManager.Remove("SettlementPerformLoadFinish", self, openBattleResultPanel)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.TrialResult, true, nLevelTime or 0, self.tbCharId, self.parent.nActId, self.mapChangeInfo, self.tbCharDamage)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.TrialResult, true, nLevelTime or 0, self.tbCharId, self.parent.nActId or 0, self.mapChangeInfo, self.tbCharDamage, bHasReward)
|
||||
self.bSettle = false
|
||||
self.parent:LevelEnd()
|
||||
self:UnBindEvent()
|
||||
@@ -208,6 +215,10 @@ function TrialLevel:OnEvent_InitQuest(nQuestId)
|
||||
self.nQuestId = nQuestId
|
||||
end
|
||||
function TrialLevel:OnEvent_QuestComplete()
|
||||
if not PlayerData.Trial:IsActivityTrialMode() then
|
||||
self:ShowTeleportIndicator()
|
||||
return
|
||||
end
|
||||
local bOpen = false
|
||||
local actData = PlayerData.Activity:GetActivityDataById(self.parent.nActId)
|
||||
if actData then
|
||||
|
||||
@@ -162,8 +162,10 @@ function VampireSurvivorLevelData:Init(parent, nLevelId, nBuildId1, nBuildId2, t
|
||||
local GetBuildCallback = function(mapBuildData)
|
||||
self.mapBuildData = mapBuildData
|
||||
self.tbCharId = {}
|
||||
self.tbCharTrialId = {}
|
||||
for _, mapChar in ipairs(self.mapBuildData.tbChar) do
|
||||
table.insert(self.tbCharId, mapChar.nTid)
|
||||
self.tbCharTrialId[mapChar.nTid] = mapChar.nTrialId
|
||||
end
|
||||
self.tbDiscId = {}
|
||||
for _, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
@@ -405,8 +407,10 @@ function VampireSurvivorLevelData:InitReEnter(parent, nLevelId, nBuildId1, nBuil
|
||||
local GetBuildCallback = function(mapBuildData)
|
||||
self.mapBuildData = mapBuildData
|
||||
self.tbCharId = {}
|
||||
self.tbCharTrialId = {}
|
||||
for _, mapChar in ipairs(self.mapBuildData.tbChar) do
|
||||
table.insert(self.tbCharId, mapChar.nTid)
|
||||
self.tbCharTrialId[mapChar.nTid] = mapChar.nTrialId
|
||||
end
|
||||
self.tbDiscId = {}
|
||||
for _, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
@@ -465,7 +469,7 @@ function VampireSurvivorLevelData:OnEvent_AdventureModuleEnter()
|
||||
end
|
||||
function VampireSurvivorLevelData:CalCharFixedEffect(nCharId, bMainChar, tbDiscId)
|
||||
local stActorInfo = CS.Lua2CSharpInfo_CharAttribute()
|
||||
PlayerData.Char:CalCharacterAttrBattle(nCharId, stActorInfo, bMainChar, tbDiscId, self.mapBuildData.nBuildId)
|
||||
PlayerData.Build:CalBuildCharacterAttrBattle(self.mapBuildData.nBuildId, nCharId, self.tbCharTrialId and self.tbCharTrialId[nCharId], stActorInfo, bMainChar, tbDiscId)
|
||||
return stActorInfo
|
||||
end
|
||||
function VampireSurvivorLevelData:OpenFateCardSelect()
|
||||
@@ -931,8 +935,10 @@ function VampireSurvivorLevelData:ChangeArea()
|
||||
local GetBuildCallback = function(mapBuildData)
|
||||
self.mapBuildData = mapBuildData
|
||||
self.tbCharId = {}
|
||||
self.tbCharTrialId = {}
|
||||
for _, mapChar in ipairs(self.mapBuildData.tbChar) do
|
||||
table.insert(self.tbCharId, mapChar.nTid)
|
||||
self.tbCharTrialId[mapChar.nTid] = mapChar.nTrialId
|
||||
end
|
||||
self.tbDiscId = {}
|
||||
for _, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
@@ -1057,7 +1063,7 @@ function VampireSurvivorLevelData:SetDiscInfo()
|
||||
local tbDiscInfo = {}
|
||||
for k, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
if k <= 3 then
|
||||
local discInfo = PlayerData.Disc:CalcDiscInfoInBuild(nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
local discInfo = PlayerData.Build:GetBuildDiscInfoInBuild(self.mapBuildData.nBuildId, nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
table.insert(tbDiscInfo, discInfo)
|
||||
end
|
||||
end
|
||||
@@ -1066,7 +1072,7 @@ end
|
||||
function VampireSurvivorLevelData:SetPersonalPerk()
|
||||
if self.mapBuildData ~= nil then
|
||||
for nCharId, tbPerk in pairs(self.mapBuildData.tbPotentials) do
|
||||
local mapAddLevel = PlayerData.Char:GetCharEnhancedPotential(nCharId)
|
||||
local mapAddLevel = PlayerData.Build:GetBuildEnhancedPotential(self.mapBuildData.nBuildId, nCharId, self.tbCharTrialId and self.tbCharTrialId[nCharId])
|
||||
local tbPerkInfo = {}
|
||||
for _, mapPerkInfo in ipairs(tbPerk) do
|
||||
local nAddLv = mapAddLevel[mapPerkInfo.nPotentialId] or 0
|
||||
|
||||
@@ -76,6 +76,14 @@ GameEnum.roguelikeLevelStyle = {
|
||||
Main_8_1 = 22,
|
||||
Main_8_2 = 23,
|
||||
Main_8_3 = 24,
|
||||
Main_9_1 = 25,
|
||||
Main_9_2 = 26,
|
||||
Main_9_3 = 27,
|
||||
Main_9_4 = 28,
|
||||
Main_9_5 = 29,
|
||||
Main_10_1 = 30,
|
||||
Main_10_2 = 31,
|
||||
Main_10_3 = 32,
|
||||
Roguelike_non = 101,
|
||||
Roguelike_miniboss = 102,
|
||||
Roguelike_shilaimu = 103,
|
||||
@@ -95,6 +103,7 @@ GameEnum.roguelikeLevelStyle = {
|
||||
DailyInstance_03 = 117,
|
||||
Boss_TuRen = 118,
|
||||
Boss_PX = 119,
|
||||
Boss_FL = 120,
|
||||
TravelBoss_Maoyan = 201,
|
||||
TravelBoss_Huayuan = 202,
|
||||
TravelBoss_Huochui = 203,
|
||||
@@ -103,6 +112,7 @@ GameEnum.roguelikeLevelStyle = {
|
||||
JointDrill_02_SZ = 252,
|
||||
JointDrill_02_SZ_Red = 253,
|
||||
JointDrill_02_SZ_Blue = 254,
|
||||
JointDrill_03_MSS = 255,
|
||||
VampireSurvivor_01 = 301,
|
||||
VampireSurvivor_02 = 302,
|
||||
VampireSurvivor_03 = 303,
|
||||
@@ -128,9 +138,11 @@ GameEnum.roguelikeLevelStyle = {
|
||||
StoryActivity_13 = 461,
|
||||
StoryActivity_14 = 466,
|
||||
StoryActivity_15 = 471,
|
||||
StoryActivity_15_01 = 472,
|
||||
StoryActivity_16 = 476,
|
||||
StoryActivity_16_01 = 477,
|
||||
StoryActivity_17 = 481,
|
||||
StoryActivity_18 = 486,
|
||||
Training = 901
|
||||
}
|
||||
GameEnum.roguelikeFloorFunction = {
|
||||
@@ -365,7 +377,12 @@ GameEnum.jumpType = {
|
||||
ActivityTask = 39,
|
||||
MainLineStoryChapter = 40,
|
||||
QuestNewbie = 41,
|
||||
CharInfo = 42
|
||||
CharInfo = 42,
|
||||
TraceHunt = 43,
|
||||
ActivityStory = 44,
|
||||
ActivityLevel = 45,
|
||||
ActivityGame1 = 46,
|
||||
ActivityGame2 = 47
|
||||
}
|
||||
GameEnum.characterSearchTargetType = {MELEE = 1, RANGED = 2}
|
||||
GameEnum.characterSearchTargetTypeTowerDefense = {NORMAL = 1}
|
||||
@@ -674,6 +691,8 @@ GameEnum.achievementCond = {
|
||||
TutorialLevelSpecificClearTotal = 121,
|
||||
DiscWithSpecificQuantityPhaseAndAttr = 122,
|
||||
WeekBossClearTotal = 123,
|
||||
TraceHuntTraceComplete = 159,
|
||||
TraceHuntAssistHunt = 160,
|
||||
ClientReport = 200,
|
||||
TowerBattleTimes = 501,
|
||||
TowerBossChallengeSpecificHighRewardWithTotal = 502,
|
||||
@@ -1878,7 +1897,8 @@ GameEnum.activityType = {
|
||||
HistoryStory = 22,
|
||||
IceCream = 23,
|
||||
FollowSocialMedia = 24,
|
||||
Soldier = 25
|
||||
Soldier = 25,
|
||||
NewStory = 30
|
||||
}
|
||||
GameEnum.activityOpenType = {
|
||||
None = 0,
|
||||
@@ -2028,7 +2048,10 @@ GameEnum.BrickDropType = {
|
||||
BrickBoomBall = 7,
|
||||
BrickInv = 8,
|
||||
BrickSplit = 9,
|
||||
BrickPortal_Hole = 10
|
||||
BrickPortal_Hole = 10,
|
||||
Brick_HorizontalLaser = 11,
|
||||
Brick_VerticalLaser = 12,
|
||||
Brick_Lightning = 13
|
||||
}
|
||||
GameEnum.starTowerRoomType = {
|
||||
BattleRoom = 0,
|
||||
@@ -2317,7 +2340,8 @@ GameEnum.OpenFuncType = {
|
||||
WeeklyQuest = 30,
|
||||
QuestNewbie = 31,
|
||||
TraceHunt = 32,
|
||||
EnergyBattery = 33
|
||||
EnergyBattery = 33,
|
||||
EventReminder = 34
|
||||
}
|
||||
GameEnum.TowerQuestType = {Core = 1, Normal = 2}
|
||||
GameEnum.poolType = {Elite = 1, Boss = 2}
|
||||
@@ -2538,7 +2562,9 @@ GameEnum.TrialSectType = {
|
||||
MainSect1 = 1,
|
||||
MainSect2 = 2,
|
||||
SupSect1 = 3,
|
||||
SupSect2 = 4
|
||||
SupSect2 = 4,
|
||||
SkinMainSect = 5,
|
||||
SkinSupSect = 6
|
||||
}
|
||||
GameEnum.activityGroupType = {
|
||||
None = 0,
|
||||
@@ -2565,7 +2591,10 @@ GameEnum.activityThemeType = {
|
||||
GunStorm_10109 = 15,
|
||||
Summer_20103 = 16,
|
||||
Summer_10110 = 17,
|
||||
BreakOut_30103 = 19
|
||||
CultivationManual_10111 = 18,
|
||||
BreakOut_30103 = 19,
|
||||
LongestDay_10112 = 20,
|
||||
BreakOut_30104 = 21
|
||||
}
|
||||
GameEnum.ActivityLevelType = {
|
||||
Explore = 1,
|
||||
@@ -2720,7 +2749,9 @@ GameEnum.PenguinCardTriggerPhase = {
|
||||
FatalDamage = 7,
|
||||
PenguinCardChange = 8,
|
||||
FlipEnd = 9,
|
||||
ManualRoll = 10
|
||||
ManualRoll = 10,
|
||||
Aura = 11,
|
||||
NextLevel = 12
|
||||
}
|
||||
GameEnum.PenguinCardTriggerType = {
|
||||
None = 1,
|
||||
@@ -2741,7 +2772,8 @@ GameEnum.PenguinCardTriggerLimit = {
|
||||
None = 1,
|
||||
Round = 2,
|
||||
Turn = 3,
|
||||
Game = 4
|
||||
Game = 4,
|
||||
TurnAndRound = 5
|
||||
}
|
||||
GameEnum.PenguinCardGrowthType = {
|
||||
None = 1,
|
||||
@@ -2759,7 +2791,15 @@ GameEnum.PenguinCardEffectType = {
|
||||
BlockFatalDamage = 8,
|
||||
UpgradeRebate = 9,
|
||||
AddCardRollCount = 10,
|
||||
RollSpecificCard = 11
|
||||
RollSpecificCard = 11,
|
||||
UpgradeDiscountAura = 12,
|
||||
CheckRoundAura = 13,
|
||||
AddRoundAura = 14,
|
||||
AimScoreAura = 15,
|
||||
CardLevel = 16,
|
||||
ChangeHp = 17,
|
||||
AideScoreAura = 18,
|
||||
RetryLimit = 19
|
||||
}
|
||||
GameEnum.PenguinCardQuestType = {
|
||||
Score = 1,
|
||||
@@ -2836,7 +2876,8 @@ GameEnum.CharPlotType = {CharPlot = 1, SkinPlot = 2}
|
||||
GameEnum.GoldenSpyLevelType = {
|
||||
Normal = 1,
|
||||
Quest = 2,
|
||||
Random = 3
|
||||
Random = 3,
|
||||
FishingHook = 4
|
||||
}
|
||||
GameEnum.GoldenSpyBuffEffect = {
|
||||
AddScore = 1,
|
||||
@@ -2871,6 +2912,11 @@ GameEnum.GoldenSpyItem = {
|
||||
BuffItem = 10
|
||||
}
|
||||
GameEnum.GoldenSpyObstacle = {Laser = 1}
|
||||
GameEnum.GoldenSpySkillType = {
|
||||
Boom = 1,
|
||||
Frozen = 2,
|
||||
FishingHook = 3
|
||||
}
|
||||
GameEnum.CharRechargeSpeed = {
|
||||
SupHigh = 1,
|
||||
High = 2,
|
||||
@@ -2884,7 +2930,11 @@ GameEnum.CharEnergyCostSpeed = {
|
||||
Low = 4
|
||||
}
|
||||
GameEnum.EnterMethod = {Default = 0, JumpFormation = 1}
|
||||
GameEnum.MainlineMemoryNodeType = {None = 0, DiscType = 1}
|
||||
GameEnum.MainlineMemoryNodeType = {
|
||||
None = 0,
|
||||
DiscType = 1,
|
||||
LastEndType = 2
|
||||
}
|
||||
GameEnum.ChessRarity = {
|
||||
White = 1,
|
||||
Green = 2,
|
||||
@@ -2990,7 +3040,11 @@ GameEnum.TraceHuntLogType = {
|
||||
HuntAfterStart = 15,
|
||||
HuntInterrupt = 16
|
||||
}
|
||||
GameEnum.TDLevelGamePlayType = {None = 1, Hot = 2}
|
||||
GameEnum.TDLevelGamePlayType = {
|
||||
None = 1,
|
||||
Hot = 2,
|
||||
Dark = 3
|
||||
}
|
||||
GameEnum.SoldierPartnerNumType = {GE = 1, EQ = 2}
|
||||
GameEnum.SoldierClientCond = {
|
||||
None = 1,
|
||||
@@ -3121,4 +3175,14 @@ GameEnum.PartnerLevelQuality = {
|
||||
Color = 4
|
||||
}
|
||||
GameEnum.SoldierCharacterType = {Actor = 1, Monster = 2}
|
||||
GameEnum.ActivityPenguinCardLevelType = {Normal = 1, Endless = 2}
|
||||
GameEnum.EventReminderType = {
|
||||
WeeklyCopies = 1,
|
||||
Vampire = 2,
|
||||
ScoreBoss = 3,
|
||||
StarTower = 4,
|
||||
TraceHunt = 5
|
||||
}
|
||||
GameEnum.CharGemInstanceRewardType = {General = 1, Enhance = 2}
|
||||
GameEnum.CharGemInstanceDropGuarantee = {RoundTableGuarantee = 1, SequentialGuarantee = 2}
|
||||
return GameEnum
|
||||
|
||||
@@ -249,10 +249,7 @@ GameTableDefine.CommonTable = {
|
||||
},
|
||||
CharacterSkinOverlap = {Key = true},
|
||||
CharacterSkinPanelFace = {Key = true},
|
||||
CharacterSkinTheme = {
|
||||
Key = true,
|
||||
Lang = {"Name", "Desc"}
|
||||
},
|
||||
CharacterSkinTheme = {Key = true},
|
||||
CharacterSpine = {Key = true},
|
||||
CharacterTag = {
|
||||
Key = true,
|
||||
@@ -271,6 +268,10 @@ GameTableDefine.CommonTable = {
|
||||
Lang = {"Name", "Desc"}
|
||||
},
|
||||
CharGemInstanceFloor = {Key = true},
|
||||
CharGemInstanceRewardGroup = {
|
||||
Key = true,
|
||||
Lang = {"RewardName"}
|
||||
},
|
||||
CharGemInstanceType = {
|
||||
Key = true,
|
||||
Lang = {"Name"}
|
||||
@@ -349,10 +350,7 @@ GameTableDefine.CommonTable = {
|
||||
"Memory"
|
||||
}
|
||||
},
|
||||
DatingCharResponse = {
|
||||
Key = true,
|
||||
Lang = {"Words"}
|
||||
},
|
||||
DatingCharResponse = {Key = true},
|
||||
DatingCharTag = {Key = true},
|
||||
DatingLandmark = {
|
||||
Key = true,
|
||||
@@ -380,10 +378,7 @@ GameTableDefine.CommonTable = {
|
||||
"AdvanceName"
|
||||
}
|
||||
},
|
||||
DemonQuest = {
|
||||
Key = true,
|
||||
Lang = {"Title"}
|
||||
},
|
||||
DemonQuest = {Key = true},
|
||||
DestroyObject = {Key = true},
|
||||
DestroyObjectSpr = {Key = true},
|
||||
DictionaryDiagram = {
|
||||
@@ -450,6 +445,10 @@ GameTableDefine.CommonTable = {
|
||||
Lang = {"Desc"}
|
||||
},
|
||||
EventOptionsRules = {Key = true},
|
||||
EventReminder = {
|
||||
Key = true,
|
||||
Lang = {"Name"}
|
||||
},
|
||||
EventResult = {Key = true},
|
||||
FactionRelation = {Key = true},
|
||||
FateCard = {
|
||||
@@ -539,6 +538,9 @@ GameTableDefine.CommonTable = {
|
||||
GoldenSpySkill = {Key = true},
|
||||
Guide = {Key = true},
|
||||
GuideGroup = {Key = true},
|
||||
GuideMissionChapter = {Key = true},
|
||||
GuideMissionQuest = {Key = true},
|
||||
GuideMissionQuestGroup = {Key = true},
|
||||
Handbook = {Key = true},
|
||||
HitDamage = {Key = true},
|
||||
Honor = {
|
||||
@@ -657,10 +659,7 @@ GameTableDefine.CommonTable = {
|
||||
"Desc"
|
||||
}
|
||||
},
|
||||
Mainline = {
|
||||
Key = true,
|
||||
Lang = {"Name", "Desc"}
|
||||
},
|
||||
Mainline = {Key = true},
|
||||
MainlineFloor = {Key = true},
|
||||
MainScreenCG = {
|
||||
Key = true,
|
||||
@@ -801,6 +800,11 @@ GameTableDefine.CommonTable = {
|
||||
Key = true,
|
||||
Lang = {"Title", "Desc"}
|
||||
},
|
||||
PenguinCardAide = {
|
||||
Key = true,
|
||||
Lang = {"Title"}
|
||||
},
|
||||
PenguinCardAidePool = {Key = true},
|
||||
PenguinCardBuff = {
|
||||
Key = true,
|
||||
Lang = {"Title", "Desc"}
|
||||
@@ -811,6 +815,10 @@ GameTableDefine.CommonTable = {
|
||||
Lang = {"DesText"}
|
||||
},
|
||||
PenguinCardCost = {Key = true},
|
||||
PenguinCardEndlessLevel = {
|
||||
Key = true,
|
||||
Lang = {"Desc"}
|
||||
},
|
||||
PenguinCardFixedTurn = {Key = true},
|
||||
PenguinCardFloor = {
|
||||
Key = true,
|
||||
@@ -836,22 +844,6 @@ GameTableDefine.CommonTable = {
|
||||
Lang = {"DesText"}
|
||||
},
|
||||
PeriodicQuestGroup = {},
|
||||
Perk = {Key = true},
|
||||
PerkPassiveSkill = {
|
||||
Key = true,
|
||||
Lang = {
|
||||
"Name",
|
||||
"Desc",
|
||||
"Desc1",
|
||||
"Param1",
|
||||
"Desc2",
|
||||
"Param2",
|
||||
"Desc3",
|
||||
"Param3",
|
||||
"Desc4",
|
||||
"Param4"
|
||||
}
|
||||
},
|
||||
PlayerHead = {
|
||||
Key = true,
|
||||
Lang = {"Desc"}
|
||||
@@ -866,15 +858,12 @@ GameTableDefine.CommonTable = {
|
||||
Key = true,
|
||||
Lang = {"BriefDesc", "Desc"}
|
||||
},
|
||||
PotentialPassiveSkill = {
|
||||
PotentialPassiveSkill = {Key = true},
|
||||
PotentialPreset = {
|
||||
Key = true,
|
||||
Lang = {
|
||||
"BriefDesc",
|
||||
"Desc",
|
||||
"Param1",
|
||||
"Param2",
|
||||
"Param3",
|
||||
"Param4"
|
||||
"Name",
|
||||
"Description"
|
||||
}
|
||||
},
|
||||
PreviewMonsterGroup = {Key = true},
|
||||
@@ -1252,7 +1241,11 @@ GameTableDefine.CommonTable = {
|
||||
TowerDefenseGuide = {Key = true},
|
||||
TowerDefenseItem = {
|
||||
Key = true,
|
||||
Lang = {"Name", "Des"}
|
||||
Lang = {
|
||||
"Name",
|
||||
"Des",
|
||||
"ItemTips"
|
||||
}
|
||||
},
|
||||
TowerDefenseLevel = {
|
||||
Key = true,
|
||||
@@ -1286,7 +1279,9 @@ GameTableDefine.CommonTable = {
|
||||
TowerDefenseTeamExp = {Key = true},
|
||||
TraceHuntBoss = {Key = true},
|
||||
TraceHuntControl = {Key = true},
|
||||
TraceHuntDifficulty = {},
|
||||
TraceHuntFloor = {Key = true},
|
||||
TraceHuntFloorGroup = {Key = true},
|
||||
TraceHuntLevel = {},
|
||||
TraceHuntLogEntryTemplate = {
|
||||
Key = true,
|
||||
@@ -1294,7 +1289,7 @@ GameTableDefine.CommonTable = {
|
||||
},
|
||||
TraceHuntScoreSwitch = {Key = true},
|
||||
TraceHuntSelfHuntExtraCost = {},
|
||||
TraceHuntStar = {},
|
||||
TraceHuntStar = {Key = true},
|
||||
Trap = {Key = true},
|
||||
TrapAttribute = {Key = true},
|
||||
TravelerDuelBoss = {
|
||||
|
||||
@@ -41,7 +41,7 @@ function GameResourceLoader.ExistsAsset(path)
|
||||
end
|
||||
function GameResourceLoader.MakeBundleGroup(sGroupName, nPanelId)
|
||||
local _clonedBundleGroup
|
||||
if sGroupName ~= nil and nPanelId ~= nil and 0 < nPanelId then
|
||||
if sGroupName ~= nil and nPanelId ~= nil and nPanelId ~= 0 then
|
||||
if tbCachedBundleGroup[nPanelId] == nil then
|
||||
_clonedBundleGroup = CS.GameResourceLoader.CloneBundleGroup(sGroupName)
|
||||
tbCachedBundleGroup[nPanelId] = {clonedBundleGroup = _clonedBundleGroup}
|
||||
|
||||
@@ -157,7 +157,8 @@ function JumpUtil.JumpTo(jumpId, ...)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.EquipmentInstanceLevelSelect)
|
||||
elseif nType == GameEnum.jumpType.EquipmentGroup then
|
||||
local nGroup = mapJumpTo.Param[1]
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.EquipmentInstanceLevelSelect, 0, nGroup, true)
|
||||
local nRewardType = mapJumpTo.Param[2]
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.EquipmentInstanceLevelSelect, 0, nGroup, true, nRewardType)
|
||||
elseif nType == GameEnum.jumpType.MainlineStory then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StoryChapter)
|
||||
elseif nType == GameEnum.jumpType.InfinityTower then
|
||||
@@ -395,6 +396,18 @@ function JumpUtil.CheckJumpUnLock(jumpId, showTips)
|
||||
else
|
||||
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)
|
||||
end
|
||||
bOpen = bFuncUnlock and bOpen
|
||||
if not bOpen and showTips then
|
||||
@@ -402,4 +415,58 @@ function JumpUtil.CheckJumpUnLock(jumpId, showTips)
|
||||
end
|
||||
return bOpen, mapJumpTo
|
||||
end
|
||||
function JumpUtil.IsActivityJumpType(nJumpType)
|
||||
if nJumpType == nil then
|
||||
return false
|
||||
end
|
||||
return nJumpType == GameEnum.jumpType.ActivityStory or nJumpType == GameEnum.jumpType.ActivityLevel or nJumpType == GameEnum.jumpType.ActivityGame1 or nJumpType == GameEnum.jumpType.ActivityGame2
|
||||
end
|
||||
function JumpUtil.CheckJumpActivityOpen(tbJumpData, bShowTips)
|
||||
if tbJumpData == nil or #tbJumpData == 0 then
|
||||
return false
|
||||
end
|
||||
local nJumpType = tbJumpData[1]
|
||||
local nActivityId = tbJumpData[2]
|
||||
local nPanelId = tbJumpData[3]
|
||||
if not JumpUtil.IsActivityJumpType(nJumpType) or nActivityId == nil or nPanelId == nil then
|
||||
if bShowTips then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
end
|
||||
return false
|
||||
end
|
||||
local actGroupData = PlayerData.Activity:GetActivityGroupDataByActivityId(nActivityId)
|
||||
if actGroupData == nil then
|
||||
if bShowTips then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
end
|
||||
return false
|
||||
end
|
||||
local bOpen, _state, _sTips, bNeedRefreshData = actGroupData:CheckActivityEntranceOpen(nActivityId, nPanelId, bShowTips)
|
||||
return bOpen, actGroupData, bNeedRefreshData
|
||||
end
|
||||
function JumpUtil.JumpToActivity(tbJumpData)
|
||||
if tbJumpData[1] == GameEnum.jumpType.MainLineStoryChapter then
|
||||
local chapterIndex = tbJumpData[2]
|
||||
local isUnlock = PlayerData.Avg:IsStoryChapterUnlock(chapterIndex)
|
||||
if not isUnlock then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StoryChapter)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.MainlineEx, chapterIndex)
|
||||
end
|
||||
return
|
||||
end
|
||||
local bOpen, actGroupData, bNeedRefreshData = JumpUtil.CheckJumpActivityOpen(tbJumpData, true)
|
||||
if not bOpen or actGroupData == nil then
|
||||
if bNeedRefreshData then
|
||||
PlayerData.Activity:SendActivityDetailMsg(nil, true)
|
||||
end
|
||||
return
|
||||
end
|
||||
local nJumpType = tbJumpData[1]
|
||||
local nActivityId = tbJumpData[2]
|
||||
local nPanelId = tbJumpData[3]
|
||||
PanelManager.CloseAllDisposablePanel()
|
||||
EventManager.Hit(EventId.JumpToSuccess, nJumpType)
|
||||
actGroupData:OpenActivityEntrance(nActivityId, nPanelId)
|
||||
end
|
||||
return JumpUtil
|
||||
|
||||
+43
-138
@@ -4,8 +4,11 @@ local ResTypeAny = GameResourceLoader.ResType.Any
|
||||
local typeof = typeof
|
||||
local mapInstance = {}
|
||||
local nNextId = 1
|
||||
local LoadPrefab = function(sPath)
|
||||
prefab = GameResourceLoader.LoadAsset(ResTypeAny, Settings.AB_ROOT_PATH .. sPath, typeof(Object))
|
||||
local LoadPrefab = function(sPath, panelId)
|
||||
if panelId == nil then
|
||||
panelId = "SpineManager"
|
||||
end
|
||||
prefab = GameResourceLoader.LoadAsset(ResTypeAny, Settings.AB_ROOT_PATH .. sPath, typeof(Object), "UI", panelId)
|
||||
if prefab == nil then
|
||||
printError("[SpineManager] 加载预制体失败, path = " .. tostring(sPath))
|
||||
return nil
|
||||
@@ -26,12 +29,9 @@ local GetSkeletonGraphic = function(go)
|
||||
end
|
||||
return comp
|
||||
end
|
||||
local GetInstance = function(id)
|
||||
return mapInstance[id]
|
||||
end
|
||||
function SpineManager.Create(nId, trParent)
|
||||
function SpineManager.Create(nId, trParent, panelId)
|
||||
local sPath = "Actor2D_Spine/" .. nId .. "/" .. nId .. ".prefab"
|
||||
local prefab = LoadPrefab(sPath)
|
||||
local prefab = LoadPrefab(sPath, panelId)
|
||||
if prefab == nil then
|
||||
return nil
|
||||
end
|
||||
@@ -40,174 +40,79 @@ function SpineManager.Create(nId, trParent)
|
||||
printError("[SpineManager] instantiate 失败, path = " .. tostring(sPath))
|
||||
return nil
|
||||
end
|
||||
local skeleton = GetSkeletonGraphic(go)
|
||||
if skeleton == nil then
|
||||
printError("[SpineManager] 预制体上未找到 SkeletonGraphic, path = " .. tostring(sPath))
|
||||
return go
|
||||
end
|
||||
function SpineManager.Destroy(go)
|
||||
if go ~= nil and go:IsNull() == false then
|
||||
destroyImmediate(go)
|
||||
return nil
|
||||
end
|
||||
local id = nNextId
|
||||
nNextId = nNextId + 1
|
||||
mapInstance[id] = {
|
||||
go = go,
|
||||
tr = go.transform,
|
||||
skel = skeleton,
|
||||
sPath = sPath,
|
||||
bPaused = false,
|
||||
fLastTimeScale = 1,
|
||||
bBound = false
|
||||
}
|
||||
return id
|
||||
end
|
||||
function SpineManager.Bind(go)
|
||||
if go == nil then
|
||||
return nil
|
||||
end
|
||||
local skeleton = GetSkeletonGraphic(go)
|
||||
if skeleton == nil then
|
||||
printError("[SpineManager] Bind: 未找到 SkeletonGraphic")
|
||||
return nil
|
||||
end
|
||||
local id = nNextId
|
||||
nNextId = nNextId + 1
|
||||
mapInstance[id] = {
|
||||
go = go,
|
||||
tr = go.transform,
|
||||
skel = skeleton,
|
||||
sPath = nil,
|
||||
bPaused = false,
|
||||
fLastTimeScale = 1,
|
||||
bBound = true
|
||||
}
|
||||
return id
|
||||
end
|
||||
function SpineManager.Destroy(id)
|
||||
local tb = mapInstance[id]
|
||||
if tb == nil then
|
||||
return
|
||||
end
|
||||
if tb.go ~= nil and tb.go:IsNull() == false then
|
||||
destroyImmediate(tb.go)
|
||||
end
|
||||
mapInstance[id] = nil
|
||||
end
|
||||
function SpineManager.Unbind(id)
|
||||
if id == nil then
|
||||
return
|
||||
end
|
||||
mapInstance[id] = nil
|
||||
end
|
||||
function SpineManager.ClearAll()
|
||||
for _, tb in pairs(mapInstance) do
|
||||
if tb.bBound ~= true and tb.go ~= nil and tb.go:IsNull() == false then
|
||||
destroyImmediate(tb.go)
|
||||
end
|
||||
end
|
||||
mapInstance = {}
|
||||
GameResourceLoader.UnloadAsset("SpineManager")
|
||||
end
|
||||
function SpineManager.PlayAnim(id, sAnimName, bLoop, nTrackIndex)
|
||||
local tb = GetInstance(id)
|
||||
if tb == nil or tb.skel == nil then
|
||||
function SpineManager.PlayAnim(go, sAnimName, bLoop, nTrackIndex)
|
||||
local skel = GetSkeletonGraphic(go)
|
||||
if skel == nil then
|
||||
return
|
||||
end
|
||||
nTrackIndex = nTrackIndex or 0
|
||||
NovaAPIHotfix.PlayAnim_Graphic(tb.skel, nTrackIndex, sAnimName, bLoop == true)
|
||||
NovaAPIHotfix.PlayAnim_Graphic(skel, nTrackIndex, sAnimName, bLoop == true)
|
||||
end
|
||||
function SpineManager.AddAnim(id, sAnimName, bLoop, fDelay, nTrackIndex)
|
||||
local tb = GetInstance(id)
|
||||
if tb == nil or tb.skel == nil then
|
||||
function SpineManager.AddAnim(go, sAnimName, bLoop, fDelay, nTrackIndex)
|
||||
local skel = GetSkeletonGraphic(go)
|
||||
if skel == nil then
|
||||
return
|
||||
end
|
||||
nTrackIndex = nTrackIndex or 0
|
||||
fDelay = fDelay or 0
|
||||
NovaAPIHotfix.AddAnim_Graphic(tb.skel, nTrackIndex, sAnimName, bLoop == true, fDelay)
|
||||
NovaAPIHotfix.AddAnim_Graphic(skel, nTrackIndex, sAnimName, bLoop == true, fDelay)
|
||||
end
|
||||
function SpineManager.SetTimeScale(id, fScale)
|
||||
local tb = GetInstance(id)
|
||||
if tb == nil or tb.skel == nil then
|
||||
function SpineManager.SetTimeScale(go, fScale)
|
||||
local skel = GetSkeletonGraphic(go)
|
||||
if skel == nil then
|
||||
return
|
||||
end
|
||||
if fScale == nil then
|
||||
fScale = 1
|
||||
end
|
||||
NovaAPIHotfix.SetTimeScale_Graphic(tb.skel, fScale)
|
||||
tb.fLastTimeScale = fScale
|
||||
tb.bPaused = false
|
||||
NovaAPIHotfix.SetTimeScale_Graphic(skel, fScale)
|
||||
end
|
||||
function SpineManager.GetTimeScale(id)
|
||||
local tb = GetInstance(id)
|
||||
if tb == nil or tb.skel == nil then
|
||||
function SpineManager.GetTimeScale(go)
|
||||
local skel = GetSkeletonGraphic(go)
|
||||
if skel == nil then
|
||||
return 1
|
||||
end
|
||||
return NovaAPIHotfix.GetTimeScale_Graphic(tb.skel)
|
||||
return NovaAPIHotfix.GetTimeScale_Graphic(skel)
|
||||
end
|
||||
function SpineManager.Pause(id)
|
||||
local tb = GetInstance(id)
|
||||
if tb == nil or tb.skel == nil then
|
||||
function SpineManager.Pause(go)
|
||||
local skel = GetSkeletonGraphic(go)
|
||||
if skel == nil then
|
||||
return
|
||||
end
|
||||
if tb.bPaused == true then
|
||||
NovaAPIHotfix.SetTimeScale_Graphic(skel, 0)
|
||||
end
|
||||
function SpineManager.Resume(go, fScale)
|
||||
local skel = GetSkeletonGraphic(go)
|
||||
if skel == nil then
|
||||
return
|
||||
end
|
||||
tb.fLastTimeScale = tb.skel.timeScale
|
||||
NovaAPIHotfix.SetTimeScale_Graphic(tb.skel, 0)
|
||||
tb.bPaused = true
|
||||
NovaAPIHotfix.SetTimeScale_Graphic(skel, fScale or 1)
|
||||
end
|
||||
function SpineManager.Resume(id)
|
||||
local tb = GetInstance(id)
|
||||
if tb == nil or tb.skel == nil then
|
||||
return
|
||||
end
|
||||
if tb.bPaused ~= true then
|
||||
return
|
||||
end
|
||||
local fScale = tb.fLastTimeScale
|
||||
if fScale == nil or fScale <= 0 then
|
||||
fScale = 1
|
||||
end
|
||||
NovaAPIHotfix.SetTimeScale_Graphic(tb.skel, fScale)
|
||||
tb.bPaused = false
|
||||
function SpineManager.IsPaused(go)
|
||||
return SpineManager.GetTimeScale(go) == 0
|
||||
end
|
||||
function SpineManager.IsPaused(id)
|
||||
local tb = GetInstance(id)
|
||||
if tb == nil then
|
||||
return false
|
||||
end
|
||||
return tb.bPaused == true
|
||||
end
|
||||
function SpineManager.GetAnimDuration(id, sAnimName)
|
||||
local tb = GetInstance(id)
|
||||
if tb == nil or tb.skel == nil then
|
||||
function SpineManager.GetAnimDuration(go, sAnimName)
|
||||
local skel = GetSkeletonGraphic(go)
|
||||
if skel == nil then
|
||||
return 0
|
||||
end
|
||||
if sAnimName == nil or sAnimName == "" then
|
||||
return 0
|
||||
end
|
||||
local Duration = NovaAPIHotfix.GetAnimDuration(tb.skel, sAnimName)
|
||||
local Duration = NovaAPIHotfix.GetAnimDuration(skel, sAnimName)
|
||||
if Duration == 0 then
|
||||
printError(string.format("[SpineManager] GetAnimDuration: 找不到动画 %s", tostring(sAnimName)))
|
||||
end
|
||||
return Duration
|
||||
end
|
||||
function SpineManager.GetGameObject(id)
|
||||
local tb = mapInstance[id]
|
||||
if tb == nil then
|
||||
return nil
|
||||
end
|
||||
return tb.go
|
||||
end
|
||||
function SpineManager.GetTransform(id)
|
||||
local tb = mapInstance[id]
|
||||
if tb == nil then
|
||||
return nil
|
||||
end
|
||||
return tb.tr
|
||||
end
|
||||
function SpineManager.GetSkeleton(id)
|
||||
local tb = mapInstance[id]
|
||||
if tb == nil then
|
||||
return nil
|
||||
end
|
||||
return tb.skel
|
||||
end
|
||||
return SpineManager
|
||||
|
||||
@@ -211,7 +211,7 @@ function NewTutorialsActCtrl:InitActData(actData)
|
||||
end
|
||||
function NewTutorialsActCtrl:Init()
|
||||
self.bAllAdvanceLocked = true
|
||||
self.bAllBaseComplete = true
|
||||
self.bAllBaseComplete = false
|
||||
self.tbCountDownTimers = {}
|
||||
self.tbCountDownEndTimes = {}
|
||||
self:RefreshGuideQuset()
|
||||
@@ -671,7 +671,7 @@ end
|
||||
function NewTutorialsActCtrl:RefreshAllContent()
|
||||
printLog("NewTutorialsActCtrl: Refreshing all content...")
|
||||
self.bAllAdvanceLocked = true
|
||||
self.bAllBaseComplete = true
|
||||
self.bAllBaseComplete = false
|
||||
self.nShortestTime = nil
|
||||
self.sShortestTime = nil
|
||||
self:RefreshGuideQuset()
|
||||
|
||||
@@ -51,7 +51,7 @@ function BdConvertResultCtrl:RefreshNormal()
|
||||
local ctrlObj = self:BindCtrlByNode(goItem, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
local mapCfg = ConfigTable.GetData_Item(nItemId)
|
||||
if mapCfg then
|
||||
if mapCfg.Type == GameEnum.itemType.Char or mapCfg.Type == GameEnum.itemType.CharacterSkin then
|
||||
if mapCfg.Type == GameEnum.itemType.Char then
|
||||
ctrlObj:SetChar(nItemId, v.count, nil, v.rewardType)
|
||||
else
|
||||
ctrlObj:SetItem(nItemId, mapCfg.Rarity, v.count, nil, nil, v.rewardType and v.rewardType == AllEnum.RewardType.First, v.rewardType and v.rewardType == AllEnum.RewardType.Three, true, false, false, v.rewardType and v.rewardType == AllEnum.RewardType.Extra)
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
local GoldenSpyBuffSelectPanel = class("GoldenSpyBuffSelectPanel", BasePanel)
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
GoldenSpyBuffSelectPanel._bIsMainPanel = false
|
||||
GoldenSpyBuffSelectPanel._sSortingLayerName = AllEnum.SortingLayerName.UI
|
||||
GoldenSpyBuffSelectPanel._sUIResRootPath = "UI_Activity/"
|
||||
GoldenSpyBuffSelectPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_400017/GoldenSpyBuffSelectPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.GoldenSpy.GoldenSpyBuffSelectCtrl"
|
||||
}
|
||||
}
|
||||
function GoldenSpyBuffSelectPanel:Awake()
|
||||
GamepadUIManager.EnableGamepadUI("GoldenSpyBuffSelect", {})
|
||||
self.nTipsPanelId = PanelId.GoldenSpyBuffTipsPanel_400017
|
||||
end
|
||||
function GoldenSpyBuffSelectPanel:OnEnable()
|
||||
end
|
||||
function GoldenSpyBuffSelectPanel:OnAfterEnter()
|
||||
end
|
||||
function GoldenSpyBuffSelectPanel:OnDisable()
|
||||
end
|
||||
function GoldenSpyBuffSelectPanel:OnDestroy()
|
||||
GamepadUIManager.DisableGamepadUI("GoldenSpyBuffSelect")
|
||||
end
|
||||
function GoldenSpyBuffSelectPanel:OnRelease()
|
||||
end
|
||||
return GoldenSpyBuffSelectPanel
|
||||
@@ -0,0 +1,24 @@
|
||||
local GoldenSpyBuffTipsPanel = class("GoldenSpyBuffTipsPanel", BasePanel)
|
||||
GoldenSpyBuffTipsPanel._bIsMainPanel = false
|
||||
GoldenSpyBuffTipsPanel._bAddToBackHistory = false
|
||||
GoldenSpyBuffTipsPanel._sSortingLayerName = AllEnum.SortingLayerName.UI_Top
|
||||
GoldenSpyBuffTipsPanel._sUIResRootPath = "UI_Activity/"
|
||||
GoldenSpyBuffTipsPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_400017/GoldenSpyBuffTips.prefab",
|
||||
sCtrlName = "Game.UI.Activity.GoldenSpy.GoldenSpyBuffTipsCtrl"
|
||||
}
|
||||
}
|
||||
function GoldenSpyBuffTipsPanel:Awake()
|
||||
end
|
||||
function GoldenSpyBuffTipsPanel:OnEnable()
|
||||
end
|
||||
function GoldenSpyBuffTipsPanel:OnAfterEnter()
|
||||
end
|
||||
function GoldenSpyBuffTipsPanel:OnDisable()
|
||||
end
|
||||
function GoldenSpyBuffTipsPanel:OnDestroy()
|
||||
end
|
||||
function GoldenSpyBuffTipsPanel:OnRelease()
|
||||
end
|
||||
return GoldenSpyBuffTipsPanel
|
||||
@@ -0,0 +1,31 @@
|
||||
local GoldenSpyLevelPanel = class("GoldenSpyLevelPanel", BasePanel)
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
GoldenSpyLevelPanel._bIsMainPanel = true
|
||||
GoldenSpyLevelPanel._sSortingLayerName = AllEnum.SortingLayerName.UI
|
||||
GoldenSpyLevelPanel._sUIResRootPath = "UI_Activity/"
|
||||
GoldenSpyLevelPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_400017/GoldenSpyPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.GoldenSpy.GoldenSpyLevelCtrl"
|
||||
}
|
||||
}
|
||||
function GoldenSpyLevelPanel:Awake()
|
||||
PlayerData.Base:SetSkipNewDayWindow(true)
|
||||
self.bFirstInCtrl = true
|
||||
self.nTipsPanelId = PanelId.GoldenSpyBuffTipsPanel_400017
|
||||
self.nResultPanelId = PanelId.GoldenSpyResultPanel_400017
|
||||
self.nBuffSelectPanelId = PanelId.GoldenSpyBuffSelectPanel_400017
|
||||
end
|
||||
function GoldenSpyLevelPanel:OnEnable()
|
||||
end
|
||||
function GoldenSpyLevelPanel:OnAfterEnter()
|
||||
end
|
||||
function GoldenSpyLevelPanel:OnDisable()
|
||||
end
|
||||
function GoldenSpyLevelPanel:OnDestroy()
|
||||
PlayerData.Base:SetSkipNewDayWindow(false)
|
||||
PlayerData.Base:OnBackToMainMenuModule()
|
||||
end
|
||||
function GoldenSpyLevelPanel:OnRelease()
|
||||
end
|
||||
return GoldenSpyLevelPanel
|
||||
@@ -0,0 +1,28 @@
|
||||
local GoldenSpyLevelSelectPanel = class("GoldenSpyLevelSelectPanel", BasePanel)
|
||||
GoldenSpyLevelSelectPanel._bIsMainPanel = true
|
||||
GoldenSpyLevelSelectPanel._bAddToBackHistory = true
|
||||
GoldenSpyLevelSelectPanel._sSortingLayerName = AllEnum.SortingLayerName.UI
|
||||
GoldenSpyLevelSelectPanel._sUIResRootPath = "UI_Activity/"
|
||||
GoldenSpyLevelSelectPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_400017/GoldenSpyLevelSelectPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.GoldenSpy.GoldenSpyLevelSelectCtrl"
|
||||
}
|
||||
}
|
||||
local PanelTab = {Group = 1, Level = 2}
|
||||
function GoldenSpyLevelSelectPanel:Awake()
|
||||
self.nPanelTab = PanelTab.Group
|
||||
self.nSelectGroupId = 0
|
||||
self.nSelectLevelId = 0
|
||||
end
|
||||
function GoldenSpyLevelSelectPanel:OnEnable()
|
||||
end
|
||||
function GoldenSpyLevelSelectPanel:OnAfterEnter()
|
||||
end
|
||||
function GoldenSpyLevelSelectPanel:OnDisable()
|
||||
end
|
||||
function GoldenSpyLevelSelectPanel:OnDestroy()
|
||||
end
|
||||
function GoldenSpyLevelSelectPanel:OnRelease()
|
||||
end
|
||||
return GoldenSpyLevelSelectPanel
|
||||
@@ -0,0 +1,24 @@
|
||||
local GoldenSpyResultPanel = class("GoldenSpyResultPanel", BasePanel)
|
||||
GoldenSpyResultPanel._bIsMainPanel = true
|
||||
GoldenSpyResultPanel._sSortingLayerName = AllEnum.SortingLayerName.UI
|
||||
GoldenSpyResultPanel._nSnapshotPrePanel = 1
|
||||
GoldenSpyResultPanel._sUIResRootPath = "UI_Activity/"
|
||||
GoldenSpyResultPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_400017/GoldenSpyResultPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.GoldenSpy.GoldenSpyResultCtrl"
|
||||
}
|
||||
}
|
||||
function GoldenSpyResultPanel:Awake()
|
||||
end
|
||||
function GoldenSpyResultPanel:OnEnable()
|
||||
end
|
||||
function GoldenSpyResultPanel:OnAfterEnter()
|
||||
end
|
||||
function GoldenSpyResultPanel:OnDisable()
|
||||
end
|
||||
function GoldenSpyResultPanel:OnDestroy()
|
||||
end
|
||||
function GoldenSpyResultPanel:OnRelease()
|
||||
end
|
||||
return GoldenSpyResultPanel
|
||||
@@ -23,6 +23,9 @@ function GoldenSpyBaseTrap:SetData(data, floorCtrl)
|
||||
self.nTrapId = data.nTrapId
|
||||
self.floorCtrl = floorCtrl
|
||||
self.trapCfg = ConfigTable.GetData("GoldenSpyObstacle", self.nTrapId)
|
||||
if self.trapCfg == nil then
|
||||
return
|
||||
end
|
||||
self:InitData()
|
||||
end
|
||||
function GoldenSpyBaseTrap:InitData()
|
||||
|
||||
@@ -52,26 +52,26 @@ function GoldenSpyBoomItem:GetBoomArea()
|
||||
return boomArea
|
||||
end
|
||||
function GoldenSpyBoomItem:Boom(callback)
|
||||
local boomArea = self:GetBoomArea()
|
||||
local center = boomArea.center
|
||||
local radius = boomArea.radius
|
||||
local toHit = {}
|
||||
for _, v in ipairs(self.floorCtrl.tbItem) do
|
||||
if v.Ctrl and v.Ctrl ~= self then
|
||||
local hitArea = v.Ctrl:GetHitArea()
|
||||
if hitArea and hitArea.center then
|
||||
local offset = hitArea.center - center
|
||||
local dist = offset.x * offset.x + offset.y * offset.y
|
||||
if dist <= radius * radius then
|
||||
table.insert(toHit, v.Ctrl)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local boom = function()
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
local boomArea = self:GetBoomArea()
|
||||
local center = boomArea.center
|
||||
local radius = boomArea.radius
|
||||
local toHit = {}
|
||||
for _, v in ipairs(self.floorCtrl.tbItem) do
|
||||
if v.Ctrl and v.Ctrl ~= self then
|
||||
local hitArea = v.Ctrl:GetHitArea()
|
||||
if hitArea and hitArea.center then
|
||||
local offset = hitArea.center - center
|
||||
local dist = offset.x * offset.x + offset.y * offset.y
|
||||
if dist <= radius * radius then
|
||||
table.insert(toHit, v.Ctrl)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for _, ctrl in ipairs(toHit) do
|
||||
if ctrl.gameObject ~= nil and ctrl.gameObject.activeSelf ~= false then
|
||||
ctrl:OnSkill_Boom(function()
|
||||
@@ -93,6 +93,7 @@ function GoldenSpyBoomItem:Boom(callback)
|
||||
end, true, true, true)
|
||||
table.insert(self.tbTimer, timer2)
|
||||
WwiseAudioMgr:PostEvent("Mode_steal_boom_big")
|
||||
return toHit
|
||||
end
|
||||
function GoldenSpyBoomItem:OnSkill_Boom(callback)
|
||||
if callback then
|
||||
|
||||
@@ -62,6 +62,8 @@ function GoldenSpyCompanionItem:Init()
|
||||
self.vVisionPoint = Vector3(visionPoint.x, visionPoint.y, 0)
|
||||
self.bDirection = self.vEndPoint.x > self.vStartPoint.x
|
||||
self.bDestination = false
|
||||
self.trParent = self.gameObject.transform.parent
|
||||
self.bFrozen = false
|
||||
end
|
||||
function GoldenSpyCompanionItem:InitData()
|
||||
self.nVisionAngle = self.itemCfg.Params[2] or VisionAngle
|
||||
@@ -379,8 +381,8 @@ function GoldenSpyCompanionItem:_CheckVision()
|
||||
local removeItem
|
||||
local hitArea = item.Ctrl:GetHitArea()
|
||||
if hitArea and self:_HitAreaInSector(hitArea, vx, vy, forwardAngle, halfAngle, radius) then
|
||||
if item.Ctrl == self.floorCtrl.catchedItem then
|
||||
goto lbl_176
|
||||
if table.indexof(self.floorCtrl.tbCatchedItem, item.Ctrl) > 0 then
|
||||
goto lbl_179
|
||||
end
|
||||
if item.Ctrl:GetItemCfg().ItemType == GameEnum.GoldenSpyItem.Boom then
|
||||
item.Ctrl:Boom(nil)
|
||||
@@ -410,7 +412,7 @@ function GoldenSpyCompanionItem:_CheckVision()
|
||||
end
|
||||
tbRemoveItems = {}
|
||||
end
|
||||
::lbl_176::
|
||||
::lbl_179::
|
||||
end
|
||||
end
|
||||
function GoldenSpyCompanionItem:_StartVisionCheck()
|
||||
|
||||
@@ -202,44 +202,54 @@ function GoldenSpyFloorCtrl:ResumeHookSwing()
|
||||
hookCtrl:ResumeSwing(true)
|
||||
end
|
||||
end
|
||||
function GoldenSpyFloorCtrl:Shoot(nSpeed, nRadius, nFactor, onRetractComplete, onCatched, onCatchedComplete)
|
||||
function GoldenSpyFloorCtrl:Shoot(nSpeed, nRadius, nFactor, nMinSpeed, onRetractComplete, onCatched, onCatchedComplete)
|
||||
local hookCtrl = self._mapNode.HookCtrl
|
||||
if not hookCtrl or not hookCtrl:IsSwinging() then
|
||||
return
|
||||
end
|
||||
hookCtrl:PauseSwing()
|
||||
self.bInvincible = false
|
||||
hookCtrl:StartExtend(nSpeed, nRadius, nFactor, function()
|
||||
hookCtrl:StartExtend(nSpeed, nRadius, nFactor, nMinSpeed, function()
|
||||
if onRetractComplete then
|
||||
onRetractComplete()
|
||||
end
|
||||
end, function(itemCtrl)
|
||||
end, function(tbItemCtrl)
|
||||
if onCatched then
|
||||
onCatched(itemCtrl)
|
||||
onCatched(tbItemCtrl)
|
||||
end
|
||||
if itemCtrl:GetItemCfg().ItemType == GameEnum.GoldenSpyItem.Boom then
|
||||
self:RemoveItem(itemCtrl)
|
||||
return
|
||||
end
|
||||
self.catchedItem = itemCtrl
|
||||
end, function(itemCtrl)
|
||||
if itemCtrl == nil or itemCtrl:GetItemCfg().ItemType == GameEnum.GoldenSpyItem.Boom then
|
||||
return
|
||||
end
|
||||
for i = #self.tbItem, 1, -1 do
|
||||
if self.tbItem[i].Ctrl == itemCtrl then
|
||||
table.insert(self.tbNeedRemoveItem, self.tbItem[i])
|
||||
table.remove(self.tbItem, i)
|
||||
break
|
||||
for _, itemCtrl in ipairs(tbItemCtrl) do
|
||||
if itemCtrl:GetItemCfg().ItemType == GameEnum.GoldenSpyItem.Boom then
|
||||
self:RemoveItem(itemCtrl)
|
||||
end
|
||||
end
|
||||
self.catchedItem = nil
|
||||
self.tbCatchedItem = tbItemCtrl
|
||||
end, function(tbItemCtrl)
|
||||
for _, itemCtrl in ipairs(tbItemCtrl) do
|
||||
if itemCtrl:GetItemCfg().ItemType == GameEnum.GoldenSpyItem.Boom then
|
||||
self:RemoveItem(itemCtrl)
|
||||
else
|
||||
for i = #self.tbItem, 1, -1 do
|
||||
if self.tbItem[i].Ctrl == itemCtrl then
|
||||
table.insert(self.tbNeedRemoveItem, self.tbItem[i])
|
||||
table.remove(self.tbItem, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self.tbCatchedItem = nil
|
||||
self.bInvincible = false
|
||||
if onCatchedComplete then
|
||||
onCatchedComplete(itemCtrl)
|
||||
onCatchedComplete(tbItemCtrl)
|
||||
end
|
||||
end)
|
||||
end
|
||||
function GoldenSpyFloorCtrl:SetHookType(nHookType, nFishingHookRadius)
|
||||
local hookCtrl = self._mapNode.HookCtrl
|
||||
if hookCtrl and hookCtrl.SetHookType then
|
||||
hookCtrl:SetHookType(nHookType, nFishingHookRadius)
|
||||
end
|
||||
end
|
||||
function GoldenSpyFloorCtrl:RemoveItem(itemCtrl, bForce)
|
||||
local bDelSuccess = false
|
||||
local itemId = itemCtrl:GetItemCfg().Id
|
||||
@@ -255,15 +265,28 @@ function GoldenSpyFloorCtrl:RemoveItem(itemCtrl, bForce)
|
||||
self.levelCtrl.GoldenSpyFloorData:DeleteItem(itemId, bForce)
|
||||
end
|
||||
end
|
||||
function GoldenSpyFloorCtrl:CheckCanDropItem()
|
||||
local hookCtrl = self._mapNode.HookCtrl
|
||||
if hookCtrl == nil then
|
||||
return false
|
||||
end
|
||||
local hookType = hookCtrl:GetHookType()
|
||||
if hookType == AllEnum.GoldenSpyHookType.FishingHook then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
function GoldenSpyFloorCtrl:DropItem()
|
||||
if self.catchedItem == nil then
|
||||
if self.tbCatchedItem == nil then
|
||||
return
|
||||
end
|
||||
local hookCtrl = self._mapNode.HookCtrl
|
||||
hookCtrl:DropItem()
|
||||
self.levelCtrl:DropItem()
|
||||
self.catchedItem.gameObject.transform.parent = self.catchedItem:GetParent()
|
||||
self.catchedItem = nil
|
||||
for _, itemCtrl in ipairs(self.tbCatchedItem) do
|
||||
itemCtrl.gameObject.transform.parent = itemCtrl:GetParent()
|
||||
end
|
||||
self.tbCatchedItem = nil
|
||||
end
|
||||
function GoldenSpyFloorCtrl:SetHookIsInvincible(bInvincible)
|
||||
self.bInvincible = bInvincible
|
||||
@@ -271,13 +294,6 @@ end
|
||||
function GoldenSpyFloorCtrl:GetHookIsInvincible()
|
||||
return self.bInvincible
|
||||
end
|
||||
function GoldenSpyFloorCtrl:GetHookHitArea()
|
||||
local hookCtrl = self._mapNode.HookCtrl
|
||||
if hookCtrl and hookCtrl.GetHookHitArea then
|
||||
return hookCtrl:GetHookHitArea()
|
||||
end
|
||||
return nil
|
||||
end
|
||||
function GoldenSpyFloorCtrl:SubTime(nTime)
|
||||
self.levelCtrl:SubTime(nTime)
|
||||
end
|
||||
@@ -295,19 +311,28 @@ function GoldenSpyFloorCtrl:StartRetract(finishCallback)
|
||||
end)
|
||||
end
|
||||
end
|
||||
function GoldenSpyFloorCtrl:CheckCanChangeHook()
|
||||
local hookCtrl = self._mapNode.HookCtrl
|
||||
if not hookCtrl or not hookCtrl:IsSwinging() then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
function GoldenSpyFloorCtrl:StartBoom(useCallback, finishCallback)
|
||||
if self.catchedItem == nil then
|
||||
if self.tbCatchedItem == nil or #self.tbCatchedItem <= 0 then
|
||||
return false
|
||||
end
|
||||
if useCallback then
|
||||
useCallback()
|
||||
end
|
||||
self.catchedItem:OnSkill_Boom(function()
|
||||
self:RemoveItem(self.catchedItem)
|
||||
self.catchedItem = nil
|
||||
self._mapNode.HookCtrl:DropItem()
|
||||
self:StartRetract(finishCallback)
|
||||
end)
|
||||
for _, itemCtrl in ipairs(self.tbCatchedItem) do
|
||||
itemCtrl:OnSkill_Boom(function()
|
||||
self:RemoveItem(itemCtrl)
|
||||
end)
|
||||
end
|
||||
self.tbCatchedItem = nil
|
||||
self._mapNode.HookCtrl:DropItem()
|
||||
self:StartRetract(finishCallback)
|
||||
return true
|
||||
end
|
||||
function GoldenSpyFloorCtrl:CheckHasFrozenItem()
|
||||
@@ -324,7 +349,7 @@ function GoldenSpyFloorCtrl:CheckHasFrozenItem()
|
||||
end
|
||||
function GoldenSpyFloorCtrl:StartFrozen()
|
||||
for _, v in ipairs(self.tbItem) do
|
||||
if v.Ctrl ~= nil and v.Ctrl ~= self.catchedItem then
|
||||
if v.Ctrl ~= nil and (self.tbCatchedItem == nil or self.tbCatchedItem ~= nil and table.indexof(self.tbCatchedItem, v.Ctrl) <= 0) then
|
||||
v.Ctrl:OnSkill_Frozen()
|
||||
end
|
||||
end
|
||||
@@ -336,7 +361,7 @@ function GoldenSpyFloorCtrl:StartFrozen()
|
||||
end
|
||||
function GoldenSpyFloorCtrl:StopFrozen()
|
||||
for _, v in ipairs(self.tbItem) do
|
||||
if v.Ctrl ~= nil and v.Ctrl ~= self.catchedItem then
|
||||
if v.Ctrl ~= nil and (self.tbCatchedItem == nil or self.tbCatchedItem ~= nil and table.indexof(self.tbCatchedItem, v.Ctrl) <= 0) then
|
||||
v.Ctrl:OnSkill_Frozen_Resume()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,6 +34,9 @@ function GoldenSpyFloorData:DeleteItem(itemId, bForce)
|
||||
self.tbItem[itemId] = nil
|
||||
end
|
||||
local itemCfg = ConfigTable.GetData("GoldenSpyItem", itemId)
|
||||
if itemCfg == nil then
|
||||
return
|
||||
end
|
||||
if itemCfg.ItemType == GameEnum.GoldenSpyItem.BuffItem and not bForce then
|
||||
return
|
||||
end
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
local GoldenSpyHookCtrl = class("GoldenSpyHookCtrl", BaseCtrl)
|
||||
local LoopType = CS.DG.Tweening.LoopType
|
||||
local SpineManager = require("Game.Spine.SpineManager")
|
||||
local MaxOffset = 20
|
||||
local MinOffset = 10
|
||||
local OffsetDir = {
|
||||
[1] = Vector2(0, 0),
|
||||
[2] = Vector2(1, 0),
|
||||
[3] = Vector2(1, 1),
|
||||
[4] = Vector2(0, 1),
|
||||
[5] = Vector2(-1, 1),
|
||||
[6] = Vector2(-1, 0),
|
||||
[7] = Vector2(-1, -1),
|
||||
[8] = Vector2(0, -1),
|
||||
[9] = Vector2(1, -1)
|
||||
}
|
||||
GoldenSpyHookCtrl._mapNodeConfig = {
|
||||
trHookPivot = {
|
||||
sNodeName = "HookPivot",
|
||||
@@ -21,9 +34,13 @@ GoldenSpyHookCtrl._mapNodeConfig = {
|
||||
sNodeName = "itemParent",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
hookRoot = {},
|
||||
hook_open = {},
|
||||
hook_normal = {},
|
||||
hook_catched = {}
|
||||
hook_catched = {},
|
||||
nethookRoot = {},
|
||||
nethook_normal = {},
|
||||
nethook_catched = {}
|
||||
}
|
||||
GoldenSpyHookCtrl.DefaultLineSize = 100
|
||||
GoldenSpyHookCtrl.DefaultHookPosY = -90
|
||||
@@ -43,6 +60,9 @@ function GoldenSpyHookCtrl:Init(levelId, floorId, floorCtrl, levelData, floorDat
|
||||
self.floorData = floorData
|
||||
self:DestroyItemInHook()
|
||||
local levelCfg = ConfigTable.GetData("GoldenSpyLevel", self.levelId)
|
||||
if levelCfg == nil then
|
||||
return
|
||||
end
|
||||
local configCfg = ConfigTable.GetData("GoldenSpyConfig", levelCfg.ConfigId)
|
||||
self.HOOK_SWING_LEFT_ANGLE = -configCfg.MaxAngle
|
||||
self.HOOK_SWING_RIGHT_ANGLE = configCfg.MaxAngle
|
||||
@@ -56,13 +76,57 @@ function GoldenSpyHookCtrl:Init(levelId, floorId, floorCtrl, levelData, floorDat
|
||||
self._onRetractComplete = nil
|
||||
self._swingGoingRight = true
|
||||
self._swingAtRight = false
|
||||
self.curCatchedItem = nil
|
||||
self.tbCatchedItem = {}
|
||||
self._mapNode.trHookPivot.localEulerAngles = Vector3(0, 0, 0)
|
||||
self._mapNode.trHookEnd.localPosition = Vector3(0, self.DefaultHookPosY, 0)
|
||||
self:ApplyHookLength()
|
||||
self._mapNode.hook_open:SetActive(false)
|
||||
self._mapNode.hook_normal:SetActive(true)
|
||||
self._mapNode.hook_catched:SetActive(false)
|
||||
if self.tbTimers ~= nil then
|
||||
for _, v in ipairs(self.tbTimers) do
|
||||
if v ~= nil then
|
||||
v:Cancel()
|
||||
end
|
||||
end
|
||||
end
|
||||
self.tbTimers = {}
|
||||
if levelCfg.LevelType == GameEnum.GoldenSpyLevelType.FishingHook then
|
||||
self:SetHookType(AllEnum.GoldenSpyHookType.FishingHook, tonumber(levelCfg.Param1))
|
||||
else
|
||||
self:SetHookType(AllEnum.GoldenSpyHookType.Normal, 0)
|
||||
end
|
||||
SpineManager.Resume(self._mapNode.nethook_catched)
|
||||
if self._hookType == AllEnum.GoldenSpyHookType.Normal then
|
||||
self._mapNode.hookRoot:SetActive(true)
|
||||
self._mapNode.nethookRoot:SetActive(false)
|
||||
self._mapNode.hook_open:SetActive(false)
|
||||
self._mapNode.hook_normal:SetActive(true)
|
||||
self._mapNode.hook_catched:SetActive(false)
|
||||
elseif self._hookType == AllEnum.GoldenSpyHookType.FishingHook then
|
||||
self._mapNode.hookRoot:SetActive(false)
|
||||
self._mapNode.nethookRoot:SetActive(true)
|
||||
self._mapNode.nethook_normal:SetActive(true)
|
||||
self._mapNode.nethook_catched:SetActive(false)
|
||||
end
|
||||
end
|
||||
function GoldenSpyHookCtrl:SetHookType(hookType, fishingHookRadius)
|
||||
self._hookType = hookType
|
||||
self._fishingHookRadius = fishingHookRadius or 0
|
||||
if self._hookType == 0 or self._hookState == HookStage.STATE_SWINGING then
|
||||
if self._hookType == AllEnum.GoldenSpyHookType.Normal then
|
||||
self._mapNode.hookRoot:SetActive(true)
|
||||
self._mapNode.nethookRoot:SetActive(false)
|
||||
self._mapNode.hook_open:SetActive(false)
|
||||
self._mapNode.hook_normal:SetActive(true)
|
||||
self._mapNode.hook_catched:SetActive(false)
|
||||
elseif self._hookType == AllEnum.GoldenSpyHookType.FishingHook then
|
||||
self._mapNode.hookRoot:SetActive(false)
|
||||
self._mapNode.nethookRoot:SetActive(true)
|
||||
self._mapNode.nethook_normal:SetActive(true)
|
||||
self._mapNode.nethook_catched:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function GoldenSpyHookCtrl:GetHookType()
|
||||
return self._hookType
|
||||
end
|
||||
function GoldenSpyHookCtrl:DestroyItemInHook()
|
||||
local itemParent = self._mapNode.itemParent
|
||||
@@ -94,9 +158,18 @@ function GoldenSpyHookCtrl:_DoSwingPhase(fromAngle, toAngle, onPhaseComplete)
|
||||
if pivot == nil or onPhaseComplete == nil then
|
||||
return
|
||||
end
|
||||
self._mapNode.hook_open:SetActive(false)
|
||||
self._mapNode.hook_normal:SetActive(true)
|
||||
self._mapNode.hook_catched:SetActive(false)
|
||||
if self._hookType == AllEnum.GoldenSpyHookType.Normal then
|
||||
self._mapNode.hookRoot:SetActive(true)
|
||||
self._mapNode.nethookRoot:SetActive(false)
|
||||
self._mapNode.hook_open:SetActive(false)
|
||||
self._mapNode.hook_normal:SetActive(true)
|
||||
self._mapNode.hook_catched:SetActive(false)
|
||||
elseif self._hookType == AllEnum.GoldenSpyHookType.FishingHook then
|
||||
self._mapNode.hookRoot:SetActive(false)
|
||||
self._mapNode.nethookRoot:SetActive(true)
|
||||
self._mapNode.nethook_normal:SetActive(true)
|
||||
self._mapNode.nethook_catched:SetActive(false)
|
||||
end
|
||||
self._swingGoingRight = toAngle == self.HOOK_SWING_RIGHT_ANGLE
|
||||
pivot.localEulerAngles = Vector3(0, 0, fromAngle)
|
||||
local realAngle = math.abs(toAngle - fromAngle)
|
||||
@@ -137,9 +210,18 @@ function GoldenSpyHookCtrl:StartSwing(leftAngle, rightAngle)
|
||||
self:StopSwing()
|
||||
self:StopExtend()
|
||||
self:StopRetract()
|
||||
self._mapNode.hook_open:SetActive(false)
|
||||
self._mapNode.hook_normal:SetActive(true)
|
||||
self._mapNode.hook_catched:SetActive(false)
|
||||
if self._hookType == AllEnum.GoldenSpyHookType.Normal then
|
||||
self._mapNode.hookRoot:SetActive(true)
|
||||
self._mapNode.nethookRoot:SetActive(false)
|
||||
self._mapNode.hook_open:SetActive(false)
|
||||
self._mapNode.hook_normal:SetActive(true)
|
||||
self._mapNode.hook_catched:SetActive(false)
|
||||
elseif self._hookType == AllEnum.GoldenSpyHookType.FishingHook then
|
||||
self._mapNode.hookRoot:SetActive(false)
|
||||
self._mapNode.nethookRoot:SetActive(true)
|
||||
self._mapNode.nethook_normal:SetActive(true)
|
||||
self._mapNode.nethook_catched:SetActive(false)
|
||||
end
|
||||
local pivot = self._mapNode.trHookPivot
|
||||
if pivot == nil then
|
||||
return
|
||||
@@ -211,7 +293,7 @@ function GoldenSpyHookCtrl:StopSwing()
|
||||
self._swingTweener = nil
|
||||
end
|
||||
end
|
||||
function GoldenSpyHookCtrl:StartExtend(speed, radius, factor, onComplete, onCatched, onCatchedComplete)
|
||||
function GoldenSpyHookCtrl:StartExtend(speed, radius, factor, nMinSpeed, onComplete, onCatched, onCatchedComplete)
|
||||
self:StopSwing()
|
||||
self:StopExtend()
|
||||
self:StopRetract()
|
||||
@@ -247,11 +329,13 @@ function GoldenSpyHookCtrl:StartExtend(speed, radius, factor, onComplete, onCatc
|
||||
for _, item in ipairs(items) do
|
||||
local worldPos = self:GetHookEndWorldPosition()
|
||||
if self:CheckCatchIntersect(worldPos, radius, item.Ctrl) then
|
||||
if onCatched then
|
||||
onCatched(item.Ctrl)
|
||||
end
|
||||
local itemCfg = item.Ctrl:GetItemCfg()
|
||||
if itemCfg.ItemType == GameEnum.GoldenSpyItem.Boom then
|
||||
if onCatched then
|
||||
local tbCatchItems = {}
|
||||
table.insert(tbCatchItems, item.Ctrl)
|
||||
onCatched(tbCatchItems)
|
||||
end
|
||||
item.Ctrl:Boom(nil)
|
||||
self:StartRetract(speed, function()
|
||||
self:ResumeSwing(true)
|
||||
@@ -261,35 +345,135 @@ function GoldenSpyHookCtrl:StartExtend(speed, radius, factor, onComplete, onCatc
|
||||
end)
|
||||
return
|
||||
end
|
||||
self.curCatchedItem = item.Ctrl
|
||||
if itemCfg.ItemType == GameEnum.GoldenSpyItem.Companion or itemCfg.ItemType == GameEnum.GoldenSpyItem.Patrol then
|
||||
item.Ctrl:onCatch()
|
||||
end
|
||||
self.curCatchedItem.gameObject.transform:SetParent(self._mapNode.itemParent)
|
||||
self.curCatchedItem.gameObject.transform.localPosition = Vector3.zero
|
||||
local itemNormalWeight = item.Ctrl:GetWeight()
|
||||
for _, v in ipairs(self:GetBuffData()) do
|
||||
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
|
||||
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.ReduceItemWeight and self.levelData:CheckBuffActive(v) then
|
||||
itemNormalWeight = itemNormalWeight - buffCfg.Params[2]
|
||||
if self._hookType == AllEnum.GoldenSpyHookType.Normal then
|
||||
do
|
||||
local tbCatchItems = {}
|
||||
table.insert(tbCatchItems, item.Ctrl)
|
||||
if onCatched then
|
||||
onCatched(tbCatchItems)
|
||||
end
|
||||
self.tbCatchedItem = tbCatchItems
|
||||
if itemCfg.ItemType == GameEnum.GoldenSpyItem.Companion or itemCfg.ItemType == GameEnum.GoldenSpyItem.Patrol then
|
||||
item.Ctrl:onCatch()
|
||||
end
|
||||
for _, item in ipairs(self.tbCatchedItem) do
|
||||
item.gameObject.transform:SetParent(self._mapNode.itemParent)
|
||||
item.gameObject.transform.localPosition = Vector3.zero
|
||||
end
|
||||
local itemNormalWeight = item.Ctrl:GetWeight()
|
||||
for _, v in ipairs(self:GetBuffData()) do
|
||||
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
|
||||
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.ReduceItemWeight and self.levelData:CheckBuffActive(v) then
|
||||
itemNormalWeight = itemNormalWeight - buffCfg.Params[2]
|
||||
end
|
||||
end
|
||||
itemNormalWeight = math.max(0, itemNormalWeight)
|
||||
local nbackSpeed = (speed - nMinSpeed) / (1 + -factor / 100 * itemNormalWeight) + nMinSpeed
|
||||
if NovaAPI.IsEditorPlatform() then
|
||||
print("GoldenSpyLevelCtrl:backSpeed=", nbackSpeed)
|
||||
end
|
||||
nbackSpeed = math.max(nMinSpeed, nbackSpeed)
|
||||
self:StartRetract(nbackSpeed, function()
|
||||
self._mapNode.hookRoot:SetActive(true)
|
||||
self._mapNode.nethookRoot:SetActive(false)
|
||||
self._mapNode.hook_open:SetActive(false)
|
||||
self._mapNode.hook_normal:SetActive(true)
|
||||
self._mapNode.hook_catched:SetActive(false)
|
||||
if onCatchedComplete then
|
||||
onCatchedComplete(self.tbCatchedItem)
|
||||
end
|
||||
for _, item in ipairs(self.tbCatchedItem) do
|
||||
item.gameObject:SetActive(false)
|
||||
end
|
||||
self.tbCatchedItem = {}
|
||||
end)
|
||||
self:StopExtend()
|
||||
end
|
||||
break
|
||||
end
|
||||
itemNormalWeight = math.max(0, itemNormalWeight)
|
||||
local nbackSpeed = speed + factor * itemNormalWeight
|
||||
if NovaAPI.IsEditorPlatform() then
|
||||
print("GoldenSpyLevelCtrl:backSpeed=", nbackSpeed)
|
||||
end
|
||||
self:StartRetract(nbackSpeed, function()
|
||||
self._mapNode.hook_open:SetActive(false)
|
||||
self._mapNode.hook_normal:SetActive(true)
|
||||
self._mapNode.hook_catched:SetActive(false)
|
||||
if onCatchedComplete then
|
||||
onCatchedComplete(self.curCatchedItem)
|
||||
if self._hookType == AllEnum.GoldenSpyHookType.FishingHook then
|
||||
self._mapNode.hookRoot:SetActive(false)
|
||||
self._mapNode.nethookRoot:SetActive(true)
|
||||
self._mapNode.nethook_normal:SetActive(false)
|
||||
self._mapNode.nethook_catched:SetActive(true)
|
||||
SpineManager.PlayAnim(self._mapNode.nethook_catched, "open", false)
|
||||
local tbCatchItems = self:GetCatchItems()
|
||||
local tbBoomItems = {}
|
||||
for _, item in ipairs(tbCatchItems) do
|
||||
local itemCfg = item:GetItemCfg()
|
||||
if itemCfg.ItemType == GameEnum.GoldenSpyItem.Boom then
|
||||
local tbRemoveBoomItems = item:Boom(nil)
|
||||
for _, v in ipairs(tbRemoveBoomItems) do
|
||||
table.insert(tbBoomItems, v)
|
||||
end
|
||||
self.floorCtrl:RemoveItem(item)
|
||||
end
|
||||
end
|
||||
self.curCatchedItem.gameObject:SetActive(false)
|
||||
self.curCatchedItem = nil
|
||||
end)
|
||||
self:StopExtend()
|
||||
tbCatchItems = self:GetCatchItems()
|
||||
for _, item in ipairs(tbBoomItems) do
|
||||
if 0 < table.indexof(tbCatchItems, item) then
|
||||
table.remove(tbCatchItems, table.indexof(tbCatchItems, item))
|
||||
end
|
||||
end
|
||||
if onCatched and 0 < #tbCatchItems then
|
||||
onCatched(tbCatchItems)
|
||||
end
|
||||
local bIsBig = false
|
||||
for _, item in ipairs(tbCatchItems) do
|
||||
local itemCfg = item:GetItemCfg()
|
||||
if itemCfg.IsBig then
|
||||
bIsBig = true
|
||||
break
|
||||
end
|
||||
end
|
||||
local timer = self:AddTimer(1, 0.23, function()
|
||||
local nTotalWeight = 0
|
||||
for index, itemCtrl in ipairs(tbCatchItems) do
|
||||
local itemCfg = itemCtrl:GetItemCfg()
|
||||
if itemCfg.ItemType == GameEnum.GoldenSpyItem.Companion or itemCfg.ItemType == GameEnum.GoldenSpyItem.Patrol then
|
||||
itemCtrl:onCatch()
|
||||
end
|
||||
local nIndex = (index - 1) % 9 + 1
|
||||
local vOffset = OffsetDir[nIndex]
|
||||
itemCtrl.gameObject.transform:SetParent(self._mapNode.itemParent)
|
||||
itemCtrl.gameObject.transform.localPosition = Vector3(vOffset.x * math.random(MinOffset, MaxOffset), vOffset.y * math.random(MinOffset, MaxOffset) - 150, 0)
|
||||
local itemNormalWeight = itemCtrl:GetWeight()
|
||||
for _, v in ipairs(self:GetBuffData()) do
|
||||
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
|
||||
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.ReduceItemWeight and self.levelData:CheckBuffActive(v) then
|
||||
itemNormalWeight = itemNormalWeight - buffCfg.Params[2]
|
||||
end
|
||||
end
|
||||
nTotalWeight = nTotalWeight + itemNormalWeight
|
||||
end
|
||||
local nbackSpeed = (speed - nMinSpeed) / (1 + -factor / 100 * nTotalWeight) + nMinSpeed
|
||||
if NovaAPI.IsEditorPlatform() then
|
||||
print("GoldenSpyLevelCtrl:backSpeed=", nbackSpeed)
|
||||
end
|
||||
local sSpineAnim = "catched2"
|
||||
if bIsBig then
|
||||
sSpineAnim = "catched1"
|
||||
end
|
||||
SpineManager.PlayAnim(self._mapNode.nethook_catched, sSpineAnim, false)
|
||||
local timer2 = self:AddTimer(1, 0.16, function()
|
||||
self:StartRetract(nbackSpeed, function()
|
||||
self._mapNode.hookRoot:SetActive(false)
|
||||
self._mapNode.nethookRoot:SetActive(true)
|
||||
self._mapNode.nethook_normal:SetActive(true)
|
||||
self._mapNode.nethook_catched:SetActive(false)
|
||||
if onCatchedComplete then
|
||||
onCatchedComplete(tbCatchItems)
|
||||
end
|
||||
for _, item in ipairs(tbCatchItems) do
|
||||
item.gameObject:SetActive(false)
|
||||
end
|
||||
end, true)
|
||||
end)
|
||||
table.insert(self.tbTimers, timer2)
|
||||
end, true, true, true)
|
||||
table.insert(self.tbTimers, timer)
|
||||
self:StopExtend()
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -299,9 +483,9 @@ function GoldenSpyHookCtrl:StartExtend(speed, radius, factor, onComplete, onCatc
|
||||
self:StartRetract(speed, function()
|
||||
self:ResumeSwing(true)
|
||||
if onCatchedComplete then
|
||||
onCatchedComplete(self.curCatchedItem)
|
||||
onCatchedComplete(self.tbCatchedItem)
|
||||
end
|
||||
self.curCatchedItem = nil
|
||||
self.tbCatchedItem = {}
|
||||
end)
|
||||
if self._onExtendComplete then
|
||||
self._onExtendComplete()
|
||||
@@ -309,10 +493,23 @@ function GoldenSpyHookCtrl:StartExtend(speed, radius, factor, onComplete, onCatc
|
||||
end
|
||||
end)
|
||||
end
|
||||
function GoldenSpyHookCtrl:GetCatchItems()
|
||||
local tbCatchItems = {}
|
||||
local items = self.floorCtrl.tbItem
|
||||
for _, item in ipairs(items) do
|
||||
if self:CheckCatchIntersect(self:GetHookEndWorldPosition(), self._fishingHookRadius, item.Ctrl) then
|
||||
table.insert(tbCatchItems, item.Ctrl)
|
||||
end
|
||||
end
|
||||
return tbCatchItems
|
||||
end
|
||||
function GoldenSpyHookCtrl:GetHookEndWorldPosition()
|
||||
local rootTr = self.gameObject.transform
|
||||
local trEnd = self._mapNode.trHookEnd
|
||||
local localPt = rootTr:InverseTransformPoint(trEnd.position)
|
||||
if self.nHookType == AllEnum.GoldenSpyHookType.FishingHook then
|
||||
localPt.y = localPt.y - 100
|
||||
end
|
||||
return Vector3(localPt.x, localPt.y, 0)
|
||||
end
|
||||
function GoldenSpyHookCtrl:StopExtend()
|
||||
@@ -339,7 +536,8 @@ function GoldenSpyHookCtrl:ResumeExtend()
|
||||
if self._hookState == HookStage.STATE_EXTENDING then
|
||||
end
|
||||
end
|
||||
function GoldenSpyHookCtrl:StartRetract(speed, onComplete)
|
||||
function GoldenSpyHookCtrl:StartRetract(speed, onComplete, bIsCatched)
|
||||
bIsCatched = bIsCatched or false
|
||||
self:StopSwing()
|
||||
self:StopExtend()
|
||||
self:StopRetract()
|
||||
@@ -350,9 +548,18 @@ function GoldenSpyHookCtrl:StartRetract(speed, onComplete)
|
||||
end
|
||||
return
|
||||
end
|
||||
self._mapNode.hook_open:SetActive(false)
|
||||
self._mapNode.hook_normal:SetActive(false)
|
||||
self._mapNode.hook_catched:SetActive(true)
|
||||
if self._hookType == AllEnum.GoldenSpyHookType.Normal then
|
||||
self._mapNode.hookRoot:SetActive(true)
|
||||
self._mapNode.nethookRoot:SetActive(false)
|
||||
self._mapNode.hook_open:SetActive(false)
|
||||
self._mapNode.hook_normal:SetActive(false)
|
||||
self._mapNode.hook_catched:SetActive(true)
|
||||
elseif self._hookType == AllEnum.GoldenSpyHookType.FishingHook then
|
||||
self._mapNode.hookRoot:SetActive(false)
|
||||
self._mapNode.nethookRoot:SetActive(true)
|
||||
self._mapNode.nethook_normal:SetActive(not bIsCatched)
|
||||
self._mapNode.nethook_catched:SetActive(bIsCatched)
|
||||
end
|
||||
self._onRetractComplete = onComplete
|
||||
self._hookState = HookStage.STATE_RETRACTING
|
||||
local fromLen = self._hookLength
|
||||
@@ -552,7 +759,7 @@ function GoldenSpyHookCtrl:IsRetracting()
|
||||
return self._hookState == HookStage.STATE_RETRACTING
|
||||
end
|
||||
function GoldenSpyHookCtrl:DropItem()
|
||||
self.curCatchedItem = nil
|
||||
self.tbCatchedItem = {}
|
||||
end
|
||||
function GoldenSpyHookCtrl:OnDestroy()
|
||||
self:StopSwing()
|
||||
@@ -572,6 +779,12 @@ function GoldenSpyHookCtrl:Pause()
|
||||
if self:IsRetracting() then
|
||||
self:PauseRetract()
|
||||
end
|
||||
for _, v in ipairs(self.tbTimers) do
|
||||
if v ~= nil then
|
||||
v:Pause(true)
|
||||
end
|
||||
end
|
||||
SpineManager.Pause(self._mapNode.nethook_catched)
|
||||
end
|
||||
function GoldenSpyHookCtrl:Continue()
|
||||
if self:IsSwinging() then
|
||||
@@ -583,6 +796,12 @@ function GoldenSpyHookCtrl:Continue()
|
||||
if self:IsRetracting() then
|
||||
self:ResumeRetract()
|
||||
end
|
||||
for _, v in ipairs(self.tbTimers) do
|
||||
if v ~= nil then
|
||||
v:Pause(false)
|
||||
end
|
||||
end
|
||||
SpineManager.Resume(self._mapNode.nethook_catched)
|
||||
end
|
||||
function GoldenSpyHookCtrl:Exit()
|
||||
self:StopSwing()
|
||||
|
||||
@@ -166,9 +166,11 @@ function GoldenSpyLaserTrap:_OnTriggerCheck()
|
||||
local localPos = self.floorCtrl:GetHookEndPosInRectLocal(self._mapNode.TriggerArea)
|
||||
local hookRadius = self.floorCtrl:GetHookRadius()
|
||||
if self:_IsHookInTriggerArea(localPos, hookRadius) and self.bTrigger then
|
||||
self.floorCtrl:DropItem()
|
||||
if self.floorCtrl:CheckCanDropItem() then
|
||||
self.floorCtrl:DropItem()
|
||||
self.floorCtrl:DoStartRetract()
|
||||
end
|
||||
WwiseAudioMgr:PostEvent("Mode_steal_error")
|
||||
self.floorCtrl:DoStartRetract()
|
||||
self.floorCtrl:SubTime(self.SUBTIME)
|
||||
self.bTrigger = false
|
||||
end
|
||||
|
||||
@@ -47,17 +47,17 @@ GoldenSpyLevelCtrl._mapNodeConfig = {
|
||||
callback = "OnBtnClick_Hook",
|
||||
sAction = "GoldenSpy_Hook"
|
||||
},
|
||||
btn_Boom = {
|
||||
img_hook = {sComponentName = "Image"},
|
||||
btn_Skill1 = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Boom",
|
||||
callback = "OnBtnClick_Skill1",
|
||||
sAction = "GoldenSpy_Boom"
|
||||
},
|
||||
btn_Frozen = {
|
||||
btn_Skill2 = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Frozen",
|
||||
callback = "OnBtnClick_Skill2",
|
||||
sAction = "GoldenSpy_Frozen"
|
||||
},
|
||||
img_frozenCD = {sComponentName = "Image"},
|
||||
btn_ToolBox = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_ToolBox",
|
||||
@@ -182,15 +182,24 @@ function GoldenSpyLevelCtrl:Init()
|
||||
self.nLevelType = self.levelCfg.LevelType
|
||||
if self.nLevelType == GameEnum.GoldenSpyLevelType.Normal then
|
||||
self._mapNode.go_Task:SetActive(false)
|
||||
self._mapNode.floorCtrl:SetHookType(AllEnum.GoldenSpyHookType.Normal, 0)
|
||||
self:SetPngSprite(self._mapNode.img_hook, string.format(SpritePath, self.nActId) .. "btn_goldenspy_game_01")
|
||||
elseif self.nLevelType == GameEnum.GoldenSpyLevelType.Quest then
|
||||
self._mapNode.go_Task:SetActive(true)
|
||||
self._mapNode.floorCtrl:SetHookType(AllEnum.GoldenSpyHookType.Normal, 0)
|
||||
self:SetPngSprite(self._mapNode.img_hook, string.format(SpritePath, self.nActId) .. "btn_goldenspy_game_01")
|
||||
elseif self.nLevelType == GameEnum.GoldenSpyLevelType.Random then
|
||||
self._mapNode.go_Task:SetActive(true)
|
||||
self._mapNode.floorCtrl:SetHookType(AllEnum.GoldenSpyHookType.Normal, 0)
|
||||
self:SetPngSprite(self._mapNode.img_hook, string.format(SpritePath, self.nActId) .. "btn_goldenspy_game_01")
|
||||
elseif self.nLevelType == GameEnum.GoldenSpyLevelType.FishingHook then
|
||||
self._mapNode.go_Task:SetActive(false)
|
||||
self._mapNode.floorCtrl:SetHookType(AllEnum.GoldenSpyHookType.FishingHook, self.levelCfg.Param1)
|
||||
self:SetPngSprite(self._mapNode.img_hook, string.format(SpritePath, self.nActId) .. "btn_goldenspy_level_task_02")
|
||||
end
|
||||
for _, v in ipairs(self.tbTimer) do
|
||||
if v ~= nil then
|
||||
v:Cancel()
|
||||
v = nil
|
||||
end
|
||||
end
|
||||
if self.addTween ~= nil then
|
||||
@@ -208,28 +217,41 @@ function GoldenSpyLevelCtrl:Init()
|
||||
self.bStartFloor = false
|
||||
self.bChangeTime = false
|
||||
self.bInFrozen = false
|
||||
self.bInFishingHook = false
|
||||
self:ResetEffect()
|
||||
end
|
||||
function GoldenSpyLevelCtrl:InitSkill(bNewLevel)
|
||||
local skillData = self.GoldenSpyLevelData:GetSkillData()
|
||||
if skillData[BoomSkillId] == nil or skillData[BoomSkillId] <= 0 and bNewLevel then
|
||||
self._mapNode.btn_Boom.gameObject:SetActive(false)
|
||||
if bNewLevel then
|
||||
for i = 1, 2 do
|
||||
local btn_Skill = self._mapNode["btn_Skill" .. i]
|
||||
btn_Skill.gameObject:SetActive(false)
|
||||
end
|
||||
self.skillList = {}
|
||||
for k, v in pairs(skillData) do
|
||||
table.insert(self.skillList, k)
|
||||
end
|
||||
table.sort(self.skillList, function(a, b)
|
||||
return a < b
|
||||
end)
|
||||
else
|
||||
local txt_count = self._mapNode.btn_Boom.transform:Find("AnimRoot/db_skillCount/txt_skillCount"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txt_count, string.format("%d", skillData[BoomSkillId]))
|
||||
local mask = self._mapNode.btn_Boom.transform:Find("AnimRoot/mask"):GetComponent("Image")
|
||||
mask.gameObject:SetActive(skillData[BoomSkillId] <= 0)
|
||||
self._mapNode.btn_Boom.gameObject:SetActive(true)
|
||||
end
|
||||
if skillData[FrozenSkillId] == nil or skillData[FrozenSkillId] <= 0 and bNewLevel then
|
||||
self._mapNode.btn_Frozen.gameObject:SetActive(false)
|
||||
else
|
||||
local txt_count = self._mapNode.btn_Frozen.transform:Find("AnimRoot/db_skillCount/txt_skillCount"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txt_count, string.format("%d", skillData[FrozenSkillId]))
|
||||
local mask = self._mapNode.btn_Frozen.transform:Find("AnimRoot/mask"):GetComponent("Image")
|
||||
mask.gameObject:SetActive(skillData[FrozenSkillId] <= 0)
|
||||
self._mapNode.img_frozenCD.gameObject:SetActive(false)
|
||||
self._mapNode.btn_Frozen.gameObject:SetActive(true)
|
||||
for i = 1, #self.skillList do
|
||||
local skillId = self.skillList[i]
|
||||
local skillCfg = ConfigTable.GetData("GoldenSpySkill", skillId)
|
||||
if skillCfg ~= nil then
|
||||
local btn_Skill = self._mapNode["btn_Skill" .. i]
|
||||
local img_icon = btn_Skill.transform:Find("AnimRoot/icon"):GetComponent("Image")
|
||||
self:SetPngSprite(img_icon, string.format(SpritePath, self.nActId) .. skillCfg.icon)
|
||||
local btn_Skill = self._mapNode["btn_Skill" .. i]
|
||||
local txt_count = btn_Skill.transform:Find("AnimRoot/db_skillCount/txt_skillCount"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txt_count, string.format("%d", skillData[skillId]))
|
||||
local mask = btn_Skill.transform:Find("AnimRoot/mask"):GetComponent("Image")
|
||||
mask.gameObject:SetActive(skillData[skillId] <= 0)
|
||||
local img_cd = btn_Skill.transform:Find("AnimRoot/img_CD"):GetComponent("Image")
|
||||
img_cd.gameObject:SetActive(false)
|
||||
btn_Skill.gameObject:SetActive(true)
|
||||
end
|
||||
end
|
||||
self._mapNode.skill_Boom:SetActive(false)
|
||||
self._mapNode.skill_Boom.transform:SetParent(self._mapNode.rtEffectRoot.transform)
|
||||
@@ -242,7 +264,15 @@ function GoldenSpyLevelCtrl:ResetEffect()
|
||||
self.FrozenTweener:Kill()
|
||||
self.FrozenTweener = nil
|
||||
end
|
||||
self._mapNode.img_frozenCD.gameObject:SetActive(false)
|
||||
if self.FishingHookTweener ~= nil then
|
||||
self.FishingHookTweener:Kill()
|
||||
self.FishingHookTweener = nil
|
||||
end
|
||||
for i = 1, 2 do
|
||||
local btn_Skill = self._mapNode["btn_Skill" .. i]
|
||||
local img_cd = btn_Skill.transform:Find("AnimRoot/img_CD"):GetComponent("Image")
|
||||
img_cd.gameObject:SetActive(false)
|
||||
end
|
||||
local hookMask = self._mapNode.btn_Hook.transform:Find("AnimRoot/mask"):GetComponent("Image")
|
||||
hookMask.gameObject:SetActive(false)
|
||||
self._mapNode.skill_Boom:GetComponent("RectTransform").anchoredPosition = Vector2.zero
|
||||
@@ -336,7 +366,6 @@ function GoldenSpyLevelCtrl:FinishFloor()
|
||||
finishCallback = finishCallback,
|
||||
goNextCallback = goNextCallback,
|
||||
bSuccess = bSuccess,
|
||||
bCanGoNextLevel = bCanGoNextLevel,
|
||||
goNextLevelCallback = goNextLevelCallback
|
||||
}
|
||||
if not self.GoldenSpyActData:CheckActivityOpen() then
|
||||
@@ -379,23 +408,16 @@ function GoldenSpyLevelCtrl:UpdateScoreText()
|
||||
self.nCurScore = math.floor(self.nCurScore)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_curScore, self.nCurScore)
|
||||
end
|
||||
function GoldenSpyLevelCtrl:CatchedItem(itemCtrl)
|
||||
local nItemId = itemCtrl.nItemId
|
||||
local itemCfg = ConfigTable.GetData("GoldenSpyItem", nItemId)
|
||||
if itemCfg == nil then
|
||||
function GoldenSpyLevelCtrl:CatchedItem(tbItemCtrl)
|
||||
if tbItemCtrl == nil or #tbItemCtrl == 0 then
|
||||
return
|
||||
end
|
||||
self.bCanBoom = true
|
||||
end
|
||||
function GoldenSpyLevelCtrl:CatchedComplete(itemCtrl)
|
||||
local nItemId = itemCtrl.nItemId
|
||||
local itemCfg = ConfigTable.GetData("GoldenSpyItem", nItemId)
|
||||
if itemCfg == nil then
|
||||
return nil
|
||||
end
|
||||
function GoldenSpyLevelCtrl:CatchedComplete(tbItemCtrl)
|
||||
WwiseAudioMgr:PostEvent("Mode_steal_coin")
|
||||
local oldScore = self.nCurScore
|
||||
local bFinishTask, addScore = self.GoldenSpyLevelData:CatchedItem(nItemId, itemCtrl)
|
||||
local bFinishTask, addScore = self.GoldenSpyLevelData:CatchedItem(tbItemCtrl)
|
||||
addScore = math.floor(addScore or 0)
|
||||
if NovaAPI.IsEditorPlatform() then
|
||||
print("GoldenSpyLevelCtrl:抓到的道具分", addScore)
|
||||
@@ -430,7 +452,33 @@ function GoldenSpyLevelCtrl:CatchedComplete(itemCtrl)
|
||||
table.insert(self.tbTimer, timer)
|
||||
self.AddScoreTimer = nil
|
||||
end, true, true, true)
|
||||
local callback = function()
|
||||
local tbTempItemCtrl = clone(tbItemCtrl)
|
||||
self:CatchedItemProcess(tbTempItemCtrl, bFinishTask)
|
||||
end
|
||||
function GoldenSpyLevelCtrl:CatchedItemProcess(tbTempItemCtrl, bFinishTask)
|
||||
if #tbTempItemCtrl <= 0 then
|
||||
return
|
||||
end
|
||||
local tempItemCtrl = tbTempItemCtrl[1]
|
||||
table.remove(tbTempItemCtrl, 1)
|
||||
local itemCfg = tempItemCtrl:GetItemCfg()
|
||||
if itemCfg.ItemType == GameEnum.GoldenSpyItem.BuffItem then
|
||||
local buffId = itemCfg.Params[1]
|
||||
if buffId == 0 then
|
||||
self:AddRandomBuff(self.levelCfg.BuffCardPoolId, function()
|
||||
self:CatchedItemProcessCallback(tbTempItemCtrl, tempItemCtrl, bFinishTask)
|
||||
end)
|
||||
else
|
||||
self:AddRandomBuff(buffId, function()
|
||||
self:CatchedItemProcessCallback(tbTempItemCtrl, tempItemCtrl, bFinishTask)
|
||||
end)
|
||||
end
|
||||
else
|
||||
self:CatchedItemProcessCallback(tbTempItemCtrl, tempItemCtrl, bFinishTask)
|
||||
end
|
||||
end
|
||||
function GoldenSpyLevelCtrl:CatchedItemProcessCallback(tbTempItemCtrl, itemCtrl, bFinishTask)
|
||||
if #tbTempItemCtrl <= 0 then
|
||||
if bFinishTask then
|
||||
local taskAnimator = self._mapNode.go_Task.transform:Find("AnimRoot"):GetComponent("Animator")
|
||||
self:UpdateScoreText()
|
||||
@@ -447,29 +495,20 @@ function GoldenSpyLevelCtrl:CatchedComplete(itemCtrl)
|
||||
self:UpdateTaskUI()
|
||||
end
|
||||
self.bCanBoom = false
|
||||
if itemCfg.ItemType == GameEnum.GoldenSpyItem.BuffItem then
|
||||
local nCount = 0
|
||||
local items = self.GoldenSpyFloorData:GetItems()
|
||||
for k, v in pairs(items) do
|
||||
local itemCfg = ConfigTable.GetData("GoldenSpyItem", k)
|
||||
if itemCfg ~= nil and itemCfg.ItemType ~= GameEnum.GoldenSpyItem.Boom then
|
||||
nCount = nCount + v.itemCount
|
||||
end
|
||||
end
|
||||
if items == nil or nCount <= 0 then
|
||||
self:FinishFloor()
|
||||
end
|
||||
end
|
||||
end
|
||||
local itemCfg = itemCtrl:GetItemCfg()
|
||||
if itemCfg.ItemType == GameEnum.GoldenSpyItem.BuffItem then
|
||||
local buffId = itemCfg.Params[1]
|
||||
if buffId == 0 then
|
||||
self:AddRandomBuff(self.levelCfg.BuffCardPoolId, callback)
|
||||
else
|
||||
self:AddRandomBuff(buffId, callback)
|
||||
local nCount = 0
|
||||
local items = self.GoldenSpyFloorData:GetItems()
|
||||
for k, v in pairs(items) do
|
||||
local itemCfg = ConfigTable.GetData("GoldenSpyItem", k)
|
||||
if itemCfg ~= nil and itemCfg.ItemType ~= GameEnum.GoldenSpyItem.Boom then
|
||||
nCount = nCount + v.itemCount
|
||||
end
|
||||
end
|
||||
if items == nil or nCount <= 0 then
|
||||
self:FinishFloor()
|
||||
end
|
||||
else
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function GoldenSpyLevelCtrl:UpdateTaskIcon()
|
||||
@@ -659,6 +698,9 @@ function GoldenSpyLevelCtrl:Pause()
|
||||
if self.FrozenTweener ~= nil then
|
||||
self.FrozenTweener:Pause()
|
||||
end
|
||||
if self.FishingHookTweener ~= nil then
|
||||
self.FishingHookTweener:Pause()
|
||||
end
|
||||
end
|
||||
function GoldenSpyLevelCtrl:Resume()
|
||||
WwiseAudioMgr:PostEvent("Mode_steal_go")
|
||||
@@ -671,6 +713,9 @@ function GoldenSpyLevelCtrl:Resume()
|
||||
if self.FrozenTweener ~= nil then
|
||||
self.FrozenTweener:Play()
|
||||
end
|
||||
if self.FishingHookTweener ~= nil then
|
||||
self.FishingHookTweener:Play()
|
||||
end
|
||||
end
|
||||
function GoldenSpyLevelCtrl:DropItem()
|
||||
WwiseAudioMgr:PostEvent("Mode_steal_get_stop")
|
||||
@@ -772,6 +817,22 @@ function GoldenSpyLevelCtrl:StartRetract()
|
||||
self._mapNode.ActorAnimRoot:Play("ActorPanel_Pull_end")
|
||||
end)
|
||||
end
|
||||
function GoldenSpyLevelCtrl:UseSkill(skillId)
|
||||
if skillId == nil then
|
||||
return
|
||||
end
|
||||
local skillCfg = ConfigTable.GetData("GoldenSpySkill", skillId)
|
||||
if skillCfg == nil then
|
||||
return
|
||||
end
|
||||
if skillCfg.SkillType == GameEnum.GoldenSpySkillType.Boom then
|
||||
self:OnBtnClick_Boom()
|
||||
elseif skillCfg.SkillType == GameEnum.GoldenSpySkillType.Frozen then
|
||||
self:OnBtnClick_Frozen()
|
||||
elseif skillCfg.SkillType == GameEnum.GoldenSpySkillType.FishingHook then
|
||||
self:OnBtnClick_FishingHook()
|
||||
end
|
||||
end
|
||||
function GoldenSpyLevelCtrl:OnBtnClick_Pause()
|
||||
if not self.bStartFloor then
|
||||
return
|
||||
@@ -798,6 +859,7 @@ function GoldenSpyLevelCtrl:OnBtnClick_Hook()
|
||||
local nSpeed = cfg.BaseSpeed
|
||||
local nRadius = cfg.BaseRadius
|
||||
local nFactor = cfg.BaseFactor
|
||||
local nMinSpeed = cfg.MinSpeed
|
||||
for _, v in ipairs(self.GoldenSpyLevelData:GetBuffData()) do
|
||||
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
|
||||
if buffCfg ~= nil and self.GoldenSpyLevelData:CheckBuffActive(v) then
|
||||
@@ -814,61 +876,78 @@ function GoldenSpyLevelCtrl:OnBtnClick_Hook()
|
||||
end
|
||||
local finishCallback = function()
|
||||
end
|
||||
local catchedCallback = function(itemCtrl)
|
||||
if itemCtrl == nil then
|
||||
return
|
||||
end
|
||||
local itemCfg = itemCtrl:GetItemCfg()
|
||||
if itemCfg.ItemType == GameEnum.GoldenSpyItem.Boom then
|
||||
local catchedCallback = function(tbItemCtrl)
|
||||
if tbItemCtrl == nil or #tbItemCtrl == 0 then
|
||||
WwiseAudioMgr:PostEvent("Mode_steal_get_stop")
|
||||
return
|
||||
end
|
||||
self:CatchedItem(itemCtrl)
|
||||
if tbItemCtrl[1]:GetItemCfg().ItemType == GameEnum.GoldenSpyItem.Boom then
|
||||
WwiseAudioMgr:PostEvent("Mode_steal_get_stop")
|
||||
return
|
||||
end
|
||||
self:CatchedItem(tbItemCtrl)
|
||||
WwiseAudioMgr:PostEvent("Mode_steal_get")
|
||||
local itemNormalWeight = itemCtrl:GetWeight()
|
||||
for _, v in ipairs(self.GoldenSpyLevelData:GetBuffData()) do
|
||||
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
|
||||
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.ReduceItemWeight and self.GoldenSpyLevelData:CheckBuffActive(v) and itemCtrl.nItemId == buffCfg.Params[1] then
|
||||
itemNormalWeight = itemNormalWeight - buffCfg.Params[2]
|
||||
local nTotalWeight = 0
|
||||
for _, itemCtrl in ipairs(tbItemCtrl) do
|
||||
local itemNormalWeight = itemCtrl:GetWeight()
|
||||
for _, v in ipairs(self.GoldenSpyLevelData:GetBuffData()) do
|
||||
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
|
||||
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.ReduceItemWeight then
|
||||
if self.GoldenSpyLevelData:CheckBuffActive(v) and itemCtrl.nItemId == buffCfg.Params[1] then
|
||||
itemNormalWeight = itemNormalWeight - buffCfg.Params[2]
|
||||
end
|
||||
nTotalWeight = nTotalWeight + itemNormalWeight
|
||||
end
|
||||
end
|
||||
end
|
||||
itemNormalWeight = math.max(0, itemNormalWeight)
|
||||
local cfg = ConfigTable.GetData("GoldenSpyConfig", self.levelCfg.ConfigId)
|
||||
if cfg ~= nil then
|
||||
self._mapNode.ActorAnimRoot:SetBool("Is_PullSlow", itemNormalWeight > cfg.PullSlowWeight)
|
||||
self._mapNode.ActorAnimRoot:SetBool("Is_PullSlow", nTotalWeight > cfg.PullSlowWeight)
|
||||
end
|
||||
self._mapNode.ActorAnimRoot:Play("ActorPanel_Pull_start")
|
||||
end
|
||||
local catchedCompleteCallback = function(itemCtrl)
|
||||
if itemCtrl == nil or itemCtrl:GetItemCfg().ItemType == GameEnum.GoldenSpyItem.Boom then
|
||||
local catchedCompleteCallback = function(tbItemCtrl)
|
||||
if tbItemCtrl == nil or #tbItemCtrl == 0 then
|
||||
self._mapNode.floorCtrl:ResumeHookSwing()
|
||||
self._mapNode.ActorAnimRoot:Play("ActorPanel_Pull_end")
|
||||
return
|
||||
end
|
||||
if tbItemCtrl[1]:GetItemCfg().ItemType == GameEnum.GoldenSpyItem.Boom then
|
||||
self._mapNode.ActorAnimRoot:Play("ActorPanel_Pull_end")
|
||||
return
|
||||
end
|
||||
local cfg = ConfigTable.GetData("GoldenSpyConfig", self.levelCfg.ConfigId)
|
||||
if cfg ~= nil then
|
||||
if cfg == nil then
|
||||
return
|
||||
end
|
||||
local nTotalScore = 0
|
||||
for _, itemCtrl in ipairs(tbItemCtrl) do
|
||||
local itemCfg = itemCtrl:GetItemCfg()
|
||||
local nScore = itemCfg.Score
|
||||
for _, v in ipairs(self.GoldenSpyLevelData:GetBuffData()) do
|
||||
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
|
||||
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore and buffCfg.Params[1] == itemCfg.ItemType and self.GoldenSpyLevelData:CheckBuffActive(v) then
|
||||
nScore = nScore + buffCfg.Params[2]
|
||||
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore and buffCfg.Params[1] == itemCfg.ItemType then
|
||||
if self.GoldenSpyLevelData:CheckBuffActive(v) then
|
||||
nScore = nScore + buffCfg.Params[2]
|
||||
end
|
||||
nTotalScore = nTotalScore + nScore
|
||||
end
|
||||
end
|
||||
if nScore >= cfg.GetHighValue then
|
||||
self._mapNode.ActorAnimRoot:Play("ActorPanel_Win")
|
||||
WwiseAudioMgr:PostEvent("Mode_steal_nice")
|
||||
self.bInCharAnimator = true
|
||||
local timer = self:AddTimer(1, 0.7, function()
|
||||
self._mapNode.floorCtrl:ResumeHookSwing()
|
||||
self.bInCharAnimator = false
|
||||
self:CatchedComplete(itemCtrl)
|
||||
end, true, true, true)
|
||||
table.insert(self.tbTimer, timer)
|
||||
else
|
||||
self._mapNode.ActorAnimRoot:Play("ActorPanel_Pull_end")
|
||||
end
|
||||
if nTotalScore >= cfg.GetHighValue then
|
||||
self._mapNode.ActorAnimRoot:Play("ActorPanel_Win")
|
||||
WwiseAudioMgr:PostEvent("Mode_steal_nice")
|
||||
self.bInCharAnimator = true
|
||||
local timer = self:AddTimer(1, 0.7, function()
|
||||
self._mapNode.floorCtrl:ResumeHookSwing()
|
||||
self:CatchedComplete(itemCtrl)
|
||||
end
|
||||
self.bInCharAnimator = false
|
||||
self:CatchedComplete(tbItemCtrl)
|
||||
end, true, true, true)
|
||||
table.insert(self.tbTimer, timer)
|
||||
else
|
||||
self._mapNode.ActorAnimRoot:Play("ActorPanel_Pull_end")
|
||||
self._mapNode.floorCtrl:ResumeHookSwing()
|
||||
self:CatchedComplete(tbItemCtrl)
|
||||
end
|
||||
WwiseAudioMgr:PostEvent("Mode_steal_get_stop")
|
||||
end
|
||||
@@ -876,8 +955,21 @@ function GoldenSpyLevelCtrl:OnBtnClick_Hook()
|
||||
print("GoldenSpyLevelCtrl:nSpeed=", nSpeed)
|
||||
print("GoldenSpyLevelCtrl:nRadius=", nRadius)
|
||||
print("GoldenSpyLevelCtrl:nFactor=", nFactor)
|
||||
print("GoldenSpyLevelCtrl:nMinSpeed=", nMinSpeed)
|
||||
end
|
||||
self._mapNode.floorCtrl:Shoot(nSpeed, nRadius, nFactor, finishCallback, catchedCallback, catchedCompleteCallback)
|
||||
self._mapNode.floorCtrl:Shoot(nSpeed, nRadius, nFactor, nMinSpeed, finishCallback, catchedCallback, catchedCompleteCallback)
|
||||
end
|
||||
function GoldenSpyLevelCtrl:OnBtnClick_Skill1()
|
||||
if #self.skillList < 1 then
|
||||
return
|
||||
end
|
||||
self:UseSkill(self.skillList[1])
|
||||
end
|
||||
function GoldenSpyLevelCtrl:OnBtnClick_Skill2()
|
||||
if #self.skillList < 2 then
|
||||
return
|
||||
end
|
||||
self:UseSkill(self.skillList[2])
|
||||
end
|
||||
function GoldenSpyLevelCtrl:OnBtnClick_Boom()
|
||||
if self.bInCharAnimator then
|
||||
@@ -897,16 +989,30 @@ function GoldenSpyLevelCtrl:OnBtnClick_Boom()
|
||||
self._mapNode.ActorAnimRoot:Play("ActorPanel_Pull_end")
|
||||
end)
|
||||
if bUsed then
|
||||
local BoomSkillId = 0
|
||||
local btn_Skill
|
||||
for i = 1, #self.skillList do
|
||||
local skillId = self.skillList[i]
|
||||
local skillCfg = ConfigTable.GetData("GoldenSpySkill", skillId)
|
||||
if skillCfg ~= nil and skillCfg.SkillType == GameEnum.GoldenSpySkillType.Boom then
|
||||
BoomSkillId = skillId
|
||||
btn_Skill = self._mapNode["btn_Skill" .. i]
|
||||
break
|
||||
end
|
||||
end
|
||||
if BoomSkillId == 0 or btn_Skill == nil then
|
||||
return
|
||||
end
|
||||
self.GoldenSpyLevelData:UseSkill(BoomSkillId)
|
||||
local newSkillData = self.GoldenSpyLevelData:GetSkillData()
|
||||
local mask = self._mapNode.btn_Boom.transform:Find("AnimRoot/mask"):GetComponent("Image")
|
||||
local mask = btn_Skill.transform:Find("AnimRoot/mask"):GetComponent("Image")
|
||||
if newSkillData[BoomSkillId] == nil or newSkillData[BoomSkillId] <= 0 then
|
||||
mask.gameObject:SetActive(true)
|
||||
local txt_count = self._mapNode.btn_Boom.transform:Find("AnimRoot/db_skillCount/txt_skillCount"):GetComponent("TMP_Text")
|
||||
local txt_count = btn_Skill.transform:Find("AnimRoot/db_skillCount/txt_skillCount"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txt_count, 0)
|
||||
else
|
||||
mask.gameObject:SetActive(false)
|
||||
local txt_count = self._mapNode.btn_Boom.transform:Find("AnimRoot/db_skillCount/txt_skillCount"):GetComponent("TMP_Text")
|
||||
local txt_count = btn_Skill.transform:Find("AnimRoot/db_skillCount/txt_skillCount"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txt_count, string.format("%d", newSkillData[BoomSkillId]))
|
||||
end
|
||||
self._mapNode.skill_Boom:SetActive(true)
|
||||
@@ -954,16 +1060,31 @@ function GoldenSpyLevelCtrl:OnBtnClick_Frozen()
|
||||
WwiseAudioMgr:PostEvent("Mode_steal_ice_boom")
|
||||
self._mapNode.floorCtrl:StartFrozen()
|
||||
self.bInFrozen = true
|
||||
local FrozenSkillId = 0
|
||||
local btn_Skill
|
||||
for i = 1, #self.skillList do
|
||||
local skillId = self.skillList[i]
|
||||
local skillCfg = ConfigTable.GetData("GoldenSpySkill", skillId)
|
||||
if skillCfg ~= nil and skillCfg.SkillType == GameEnum.GoldenSpySkillType.Frozen then
|
||||
FrozenSkillId = skillId
|
||||
btn_Skill = self._mapNode["btn_Skill" .. i]
|
||||
break
|
||||
end
|
||||
end
|
||||
if FrozenSkillId == 0 or btn_Skill == nil then
|
||||
self.bInFrozen = false
|
||||
return
|
||||
end
|
||||
self.GoldenSpyLevelData:UseSkill(FrozenSkillId)
|
||||
local newSkillData = self.GoldenSpyLevelData:GetSkillData()
|
||||
local mask = self._mapNode.btn_Frozen.transform:Find("AnimRoot/mask"):GetComponent("Image")
|
||||
local mask = btn_Skill.transform:Find("AnimRoot/mask"):GetComponent("Image")
|
||||
if newSkillData[FrozenSkillId] == nil or newSkillData[FrozenSkillId] <= 0 then
|
||||
mask.gameObject:SetActive(true)
|
||||
local txt_count = self._mapNode.btn_Frozen.transform:Find("AnimRoot/db_skillCount/txt_skillCount"):GetComponent("TMP_Text")
|
||||
local txt_count = btn_Skill.transform:Find("AnimRoot/db_skillCount/txt_skillCount"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txt_count, 0)
|
||||
else
|
||||
mask.gameObject:SetActive(false)
|
||||
local txt_count = self._mapNode.btn_Frozen.transform:Find("AnimRoot/db_skillCount/txt_skillCount"):GetComponent("TMP_Text")
|
||||
local txt_count = btn_Skill.transform:Find("AnimRoot/db_skillCount/txt_skillCount"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txt_count, string.format("%d", newSkillData[FrozenSkillId]))
|
||||
end
|
||||
local skillcfg = ConfigTable.GetData("GoldenSpySkill", FrozenSkillId)
|
||||
@@ -980,7 +1101,7 @@ function GoldenSpyLevelCtrl:OnBtnClick_Frozen()
|
||||
end
|
||||
end, true, true, true)
|
||||
table.insert(self.tbTimer, timer)
|
||||
local img_frozenCD = self._mapNode.img_frozenCD
|
||||
local img_frozenCD = btn_Skill.transform:Find("AnimRoot/img_CD"):GetComponent("Image")
|
||||
img_frozenCD.fillAmount = 1
|
||||
img_frozenCD.gameObject:SetActive(true)
|
||||
self.FrozenTweener = DOTween.To(function()
|
||||
@@ -991,6 +1112,68 @@ function GoldenSpyLevelCtrl:OnBtnClick_Frozen()
|
||||
img_frozenCD.gameObject:SetActive(false)
|
||||
end)
|
||||
end
|
||||
function GoldenSpyLevelCtrl:OnBtnClick_FishingHook()
|
||||
if self.bInCharAnimator then
|
||||
return
|
||||
end
|
||||
if not self.bStartFloor then
|
||||
return
|
||||
end
|
||||
if not self._mapNode.floorCtrl:CheckCanChangeHook() then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("GoldenSpy_CanNotChangeHook"))
|
||||
return
|
||||
end
|
||||
self.bInFishingHook = true
|
||||
local FishingHookSkillId = 0
|
||||
local btn_Skill
|
||||
for i = 1, #self.skillList do
|
||||
local skillId = self.skillList[i]
|
||||
local skillCfg = ConfigTable.GetData("GoldenSpySkill", skillId)
|
||||
if skillCfg ~= nil and skillCfg.SkillType == GameEnum.GoldenSpySkillType.FishingHook then
|
||||
FishingHookSkillId = skillId
|
||||
btn_Skill = self._mapNode["btn_Skill" .. i]
|
||||
break
|
||||
end
|
||||
end
|
||||
if FishingHookSkillId == 0 or btn_Skill == nil then
|
||||
self.bInFishingHook = false
|
||||
return
|
||||
end
|
||||
self.GoldenSpyLevelData:UseSkill(FishingHookSkillId)
|
||||
local newSkillData = self.GoldenSpyLevelData:GetSkillData()
|
||||
local mask = btn_Skill.transform:Find("AnimRoot/mask"):GetComponent("Image")
|
||||
if newSkillData[FishingHookSkillId] == nil or newSkillData[FishingHookSkillId] <= 0 then
|
||||
mask.gameObject:SetActive(true)
|
||||
local txt_count = btn_Skill.transform:Find("AnimRoot/db_skillCount/txt_skillCount"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txt_count, 0)
|
||||
else
|
||||
mask.gameObject:SetActive(false)
|
||||
local txt_count = btn_Skill.transform:Find("AnimRoot/db_skillCount/txt_skillCount"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txt_count, string.format("%d", newSkillData[FishingHookSkillId]))
|
||||
end
|
||||
local skillcfg = ConfigTable.GetData("GoldenSpySkill", FishingHookSkillId)
|
||||
self._mapNode.floorCtrl:SetHookType(AllEnum.GoldenSpyHookType.FishingHook, tonumber(skillcfg.Params[1]))
|
||||
local nTime = skillcfg.Params[2]
|
||||
if nTime <= 0 then
|
||||
self.bInFishingHook = false
|
||||
return
|
||||
end
|
||||
local timer = self:AddTimer(1, nTime, function()
|
||||
self._mapNode.floorCtrl:SetHookType(AllEnum.GoldenSpyHookType.Normal, 0)
|
||||
self.bInFishingHook = false
|
||||
end, true, true, true)
|
||||
table.insert(self.tbTimer, timer)
|
||||
local img_FishingHookCD = btn_Skill.transform:Find("AnimRoot/img_CD"):GetComponent("Image")
|
||||
img_FishingHookCD.fillAmount = 1
|
||||
img_FishingHookCD.gameObject:SetActive(true)
|
||||
self.FishingHookTweener = DOTween.To(function()
|
||||
return img_FishingHookCD.fillAmount
|
||||
end, function(value)
|
||||
img_FishingHookCD.fillAmount = value
|
||||
end, 0, nTime):OnComplete(function()
|
||||
img_FishingHookCD.gameObject:SetActive(false)
|
||||
end)
|
||||
end
|
||||
function GoldenSpyLevelCtrl:OnBtnClick_ToolBox()
|
||||
self:Pause()
|
||||
local tbShowItem = {}
|
||||
@@ -1066,6 +1249,10 @@ function GoldenSpyLevelCtrl:ClearTimer()
|
||||
self.FrozenTweener:Kill()
|
||||
self.FrozenTweener = nil
|
||||
end
|
||||
if self.FishingHookTweener ~= nil then
|
||||
self.FishingHookTweener:Kill()
|
||||
self.FishingHookTweener = nil
|
||||
end
|
||||
for _, v in ipairs(self.tbTimer) do
|
||||
if v ~= nil then
|
||||
v:Cancel()
|
||||
@@ -1080,16 +1267,15 @@ end
|
||||
function GoldenSpyLevelCtrl:OnEvent_UpdateSkillCount(nSkillId, nCount)
|
||||
nCount = nCount or 0
|
||||
nCount = math.floor(nCount)
|
||||
if nSkillId == BoomSkillId then
|
||||
local txt_count = self._mapNode.btn_Boom.transform:Find("AnimRoot/db_skillCount/txt_skillCount"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txt_count, string.format("%d", nCount))
|
||||
local mask = self._mapNode.btn_Boom.transform:Find("AnimRoot/mask"):GetComponent("Image")
|
||||
mask.gameObject:SetActive(nCount == 0)
|
||||
elseif nSkillId == FrozenSkillId then
|
||||
local txt_count = self._mapNode.btn_Frozen.transform:Find("AnimRoot/db_skillCount/txt_skillCount"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txt_count, string.format("%d", nCount))
|
||||
local mask = self._mapNode.btn_Frozen.transform:Find("AnimRoot/mask"):GetComponent("Image")
|
||||
mask.gameObject:SetActive(nCount == 0)
|
||||
for i = 1, #self.skillList do
|
||||
local skillId = self.skillList[i]
|
||||
if skillId == nSkillId then
|
||||
local txt_count = self._mapNode["btn_Skill" .. i].transform:Find("AnimRoot/db_skillCount/txt_skillCount"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txt_count, string.format("%d", nCount))
|
||||
local mask = self._mapNode["btn_Skill" .. i].transform:Find("AnimRoot/mask"):GetComponent("Image")
|
||||
mask.gameObject:SetActive(nCount == 0)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
function GoldenSpyLevelCtrl:OnEvent_FinishFloor()
|
||||
|
||||
@@ -46,11 +46,34 @@ function GoldenSpyLevelData:RestartCurrentFloor()
|
||||
self:StartLevel(self.levelId)
|
||||
return
|
||||
end
|
||||
local tbCatchItem = {}
|
||||
for k, v in pairs(self.tempPointData.tbCatchItem) do
|
||||
tbCatchItem[k] = {
|
||||
itemId = k,
|
||||
itemCount = v.itemCount
|
||||
}
|
||||
end
|
||||
local tbBuff = {}
|
||||
for k, v in pairs(self.tempPointData.tbBuff) do
|
||||
tbBuff[k] = {
|
||||
buffId = v.buffId,
|
||||
tbActiveFloor = v.tbActiveFloor,
|
||||
bActive = v.bActive
|
||||
}
|
||||
end
|
||||
local tbUsedSkill = {}
|
||||
for k, v in pairs(self.tempPointData.tbUsedSkill) do
|
||||
tbUsedSkill[k] = v
|
||||
end
|
||||
local tbSkillData = {}
|
||||
for k, v in pairs(self.tempPointData.tbSkillData) do
|
||||
tbSkillData[k] = v
|
||||
end
|
||||
self.nCurScore = self.tempPointData.nCurScore
|
||||
self.tbCatchItem = self.tempPointData.tbCatchItem
|
||||
self.tbBuff = self.tempPointData.tbBuff
|
||||
self.tbUsedSkill = self.tempPointData.tbUsedSkill
|
||||
self.tbSkillData = self.tempPointData.tbSkillData
|
||||
self.tbCatchItem = tbCatchItem
|
||||
self.tbBuff = tbBuff
|
||||
self.tbUsedSkill = tbUsedSkill
|
||||
self.tbSkillData = tbSkillData
|
||||
self.nCompleteTaskCount = self.tempPointData.nCompleteTaskCount
|
||||
self.nBuffRefreshCount = self.tempPointData.nBuffRefreshCount
|
||||
local tbList = {}
|
||||
@@ -145,37 +168,45 @@ function GoldenSpyLevelData:GetLevelPrefabName()
|
||||
end
|
||||
return nPrefabName
|
||||
end
|
||||
function GoldenSpyLevelData:CatchedItem(nItemId, itemCtrl)
|
||||
local itemCfg = ConfigTable.GetData("GoldenSpyItem", nItemId)
|
||||
if itemCfg == nil then
|
||||
return
|
||||
end
|
||||
local nScore = itemCfg.Score
|
||||
if itemCtrl ~= nil then
|
||||
if itemCtrl:GetItemCfg().ItemType == GameEnum.GoldenSpyItem.SafeBox then
|
||||
nScore = itemCtrl:GetScore()
|
||||
end
|
||||
if itemCtrl:GetItemCfg().ItemType == GameEnum.GoldenSpyItem.Companion then
|
||||
nScore = nScore + itemCtrl:GetBagItemPrice()
|
||||
function GoldenSpyLevelData:CatchedItem(tbItemCtrl)
|
||||
local nTotalScore = 0
|
||||
for _, itemCtrl in ipairs(tbItemCtrl) do
|
||||
local itemCfg = itemCtrl:GetItemCfg()
|
||||
if itemCfg ~= nil then
|
||||
local nScore = itemCfg.Score
|
||||
if itemCfg.ItemType == GameEnum.GoldenSpyItem.SafeBox then
|
||||
nScore = itemCtrl:GetScore()
|
||||
end
|
||||
if itemCfg.ItemType == GameEnum.GoldenSpyItem.Companion then
|
||||
nScore = nScore + itemCtrl:GetBagItemPrice()
|
||||
end
|
||||
for _, v in ipairs(self.tbBuff) do
|
||||
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
|
||||
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore and buffCfg.Params[1] == itemCfg.ItemType and self:CheckBuffActive(v) then
|
||||
nScore = nScore + buffCfg.Params[2]
|
||||
end
|
||||
end
|
||||
nTotalScore = nTotalScore + nScore
|
||||
end
|
||||
end
|
||||
for _, v in ipairs(self.tbBuff) do
|
||||
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
|
||||
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore and buffCfg.Params[1] == itemCfg.ItemType and self:CheckBuffActive(v) then
|
||||
nScore = nScore + buffCfg.Params[2]
|
||||
self.nCurScore = self.nCurScore + nTotalScore
|
||||
local bFinishTask = false
|
||||
for _, itemCtrl in ipairs(tbItemCtrl) do
|
||||
local itemCfg = itemCtrl:GetItemCfg()
|
||||
if itemCfg ~= nil then
|
||||
local nItemId = itemCfg.Id
|
||||
if self.tbCatchItem[nItemId] == nil then
|
||||
self.tbCatchItem[nItemId] = {itemId = nItemId, itemCount = 0}
|
||||
end
|
||||
self.tbCatchItem[nItemId].itemCount = self.tbCatchItem[nItemId].itemCount + 1
|
||||
self.floorData:DeleteItem(nItemId)
|
||||
bFinishTask = self:UpdateTask(nItemId) or bFinishTask
|
||||
end
|
||||
end
|
||||
self.nCurScore = self.nCurScore + nScore
|
||||
if self.tbCatchItem[nItemId] == nil then
|
||||
self.tbCatchItem[nItemId] = {itemId = nItemId, itemCount = 0}
|
||||
end
|
||||
self.tbCatchItem[nItemId].itemCount = self.tbCatchItem[nItemId].itemCount + 1
|
||||
self.floorData:DeleteItem(nItemId)
|
||||
local bFinishTask = self:UpdateTask(nItemId)
|
||||
if bFinishTask then
|
||||
self:RefreshTask()
|
||||
end
|
||||
return bFinishTask, nScore
|
||||
return bFinishTask, nTotalScore
|
||||
end
|
||||
function GoldenSpyLevelData:GetCatchItemData()
|
||||
return self.tbCatchItem
|
||||
|
||||
@@ -67,7 +67,7 @@ function GoldenSpyLevelSelectCtrl:Awake()
|
||||
if type(param) == "table" then
|
||||
self.nActivityId = param[1]
|
||||
end
|
||||
EventManager.Add(EventId.TemporaryBlockInput, 1.5)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 1.5)
|
||||
end
|
||||
function GoldenSpyLevelSelectCtrl:OnEnable()
|
||||
self.animator = self.gameObject:GetComponent("Animator")
|
||||
@@ -124,7 +124,7 @@ function GoldenSpyLevelSelectCtrl:SwitchPanelTab(nTab)
|
||||
self._mapNode.LevelDetalRoot.gameObject:SetActive(false)
|
||||
elseif nTab == PanelTab.Level then
|
||||
self.animator:Play("GoldenSpyLevelSelectPanel_switch")
|
||||
EventManager.Add(EventId.TemporaryBlockInput, 1.2)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 1.2)
|
||||
for i = 1, 2 do
|
||||
local levelCount = #ConfigTable.GetData("GoldenSpyLevelGroup", self._panel.nSelectGroupId).LevelList
|
||||
self._mapNode.btn_level[i].gameObject:SetActive(i <= levelCount)
|
||||
@@ -269,9 +269,11 @@ function GoldenSpyLevelSelectCtrl:InitLevelData()
|
||||
local bCanGoNextGroup = false
|
||||
if nextGroupId ~= nil then
|
||||
local groupData = self.GoldenSpyActData:GetLevelGroupDataById(nextGroupId)
|
||||
local time = CS.ClientManager.Instance.serverTimeStamp
|
||||
if time >= groupData.nStartTime and self.GoldenSpyActData:CheckPreGroupPassByGroupId(nextGroupId) then
|
||||
bCanGoNextGroup = true
|
||||
if groupData ~= nil then
|
||||
local time = CS.ClientManager.Instance.serverTimeStamp
|
||||
if time >= groupData.nStartTime and self.GoldenSpyActData:CheckPreGroupPassByGroupId(nextGroupId) then
|
||||
bCanGoNextGroup = true
|
||||
end
|
||||
end
|
||||
end
|
||||
self._mapNode.btnRight.gameObject:SetActive(nextGroupId ~= nil and bCanGoNextGroup)
|
||||
@@ -317,7 +319,7 @@ function GoldenSpyLevelSelectCtrl:OnBtnClick_Task()
|
||||
if mapGroupData ~= nil then
|
||||
local actData = mapGroupData:GetActivityDataByIndex(AllEnum.ActivityThemeFuncIndex.Task)
|
||||
if actData ~= nil then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Task_10109, actData.ActivityId, 4)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Task_10112, actData.ActivityId, 4)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -68,6 +68,8 @@ function GoldenSpyPatrolItem:Init()
|
||||
self.vVisionPoint = Vector3(visionPoint.x, visionPoint.y, 0)
|
||||
self.bDirection = self.vEndPoint.x > self.vStartPoint.x
|
||||
self.bDestination = false
|
||||
self.trParent = self.gameObject.transform.parent
|
||||
self.bFrozen = false
|
||||
end
|
||||
function GoldenSpyPatrolItem:InitData()
|
||||
self.nVisionAngle = self.itemCfg.Params[3] or VisionAngle
|
||||
@@ -344,8 +346,10 @@ function GoldenSpyPatrolItem:_CheckVision()
|
||||
radius = self.floorCtrl:GetHookRadius()
|
||||
}
|
||||
if hitArea and self:_HitAreaInSector(hitArea, vx, vy, forwardAngle, halfAngle, radius) and self.bTrigger then
|
||||
self.floorCtrl:DropItem()
|
||||
self.floorCtrl:DoStartRetract()
|
||||
if self.floorCtrl:CheckCanDropItem() then
|
||||
self.floorCtrl:DropItem()
|
||||
self.floorCtrl:DoStartRetract()
|
||||
end
|
||||
WwiseAudioMgr:PostEvent("Mode_steal_error")
|
||||
self.floorCtrl:SubTime(self.itemCfg.Params[2])
|
||||
self._mapNode.img_normal:SetActive(false)
|
||||
|
||||
@@ -67,7 +67,6 @@ function GoldenSpyResultCtrl:Awake()
|
||||
self.finishCallback = self.data.finishCallback
|
||||
self.goNextCallback = self.data.goNextCallback
|
||||
self.bSuccess = self.data.bSuccess
|
||||
self.bCanGoNextLevel = self.data.bCanGoNextLevel
|
||||
self.goNextLevelCallback = self.data.goNextLevelCallback
|
||||
self.levelCfg = ConfigTable.GetData("GoldenSpyLevel", self.nLevelId)
|
||||
self.floorCfg = ConfigTable.GetData("GoldenSpyFloor", self.nCurFloorId)
|
||||
@@ -176,7 +175,7 @@ function GoldenSpyResultCtrl:OnBtnClick_GoNext()
|
||||
end
|
||||
function GoldenSpyResultCtrl:OnBtnClick_GoNext2()
|
||||
EventManager.Hit(EventId.ClosePanel, self._panel._nPanelId)
|
||||
if self.goNextCallback ~= nil then
|
||||
if self.goNextLevelCallback ~= nil then
|
||||
self.goNextLevelCallback(self.nextGroupId, self.nextLevelId)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
local LoginRewardPopUpCtrl_01 = class("LoginRewardPopUpCtrl_01", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
LoginRewardPopUpCtrl_01._mapNodeConfig = {
|
||||
goActTime = {
|
||||
sNodeName = "imgRemaineTime"
|
||||
},
|
||||
txtActivityTime = {sNodeName = "txtTime", sComponentName = "TMP_Text"},
|
||||
btnActivity = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Activity"
|
||||
},
|
||||
txtTips = {sComponentName = "TMP_Text"},
|
||||
btnReward = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Activity"
|
||||
},
|
||||
txtBtnReward = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Receive"
|
||||
}
|
||||
}
|
||||
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
|
||||
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
|
||||
local sTips = ConfigTable.GetUIText("LoginSkinRewardTips1_301053") .. ConfigTable.GetUIText("LoginSkinRewardTips2_301053")
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTips, sTips)
|
||||
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 callback = function()
|
||||
EventManager.Hit("RefreshLoginRewardPanel")
|
||||
end
|
||||
PlayerData.Activity:SendReceiveLoginRewardMsg(301042, callback)
|
||||
end
|
||||
return LoginRewardPopUpCtrl_01
|
||||
@@ -0,0 +1,147 @@
|
||||
local LoginSkinRewardCtrl_01 = class("LoginSkinRewardCtrl_01", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
LoginSkinRewardCtrl_01._mapNodeConfig = {
|
||||
btnDetail = {
|
||||
sNodeName = "btnActDetail",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txtBtnActDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Detail"
|
||||
},
|
||||
goActTime = {
|
||||
sNodeName = "imgRemaineTime"
|
||||
},
|
||||
imgEnd = {},
|
||||
txtActivityTime = {sNodeName = "txtTime", sComponentName = "TMP_Text"},
|
||||
btnReward = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Activity"
|
||||
},
|
||||
btnUnReward = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Activity"
|
||||
},
|
||||
txtAdvanceMat = {sComponentName = "TMP_Text"},
|
||||
txtBtnReward = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Receive"
|
||||
},
|
||||
txtBtnUnReward = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Received"
|
||||
}
|
||||
}
|
||||
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)
|
||||
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 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)
|
||||
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 LoginSkinRewardCtrl_01:RefreshDetail()
|
||||
local mapActCfg = self.actData:GetLoginRewardControlCfg()
|
||||
local bEmpty = mapActCfg.DesText == ""
|
||||
self._mapNode.btnDetail.gameObject:SetActive(not bEmpty)
|
||||
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 = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = mapActCfg.DesText,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function LoginSkinRewardCtrl_01:OnBtnClick_Activity()
|
||||
local callback = function()
|
||||
self._mapNode.btnReward.gameObject:SetActive(false)
|
||||
local actData = PlayerData.Activity:GetActivityDataById(self.actData:GetActId())
|
||||
self:InitActData(actData)
|
||||
end
|
||||
local canReceive = self.actData:CheckCanReceive()
|
||||
if not canReceive then
|
||||
return
|
||||
end
|
||||
PlayerData.Activity:SendReceiveLoginRewardMsg(self.actData:GetActId(), callback)
|
||||
end
|
||||
function LoginSkinRewardCtrl_01:OnEvent_ClickLoginRewardTips(callback, index)
|
||||
callback()
|
||||
end
|
||||
function LoginSkinRewardCtrl_01:OnBtnClick_Reward()
|
||||
end
|
||||
function LoginSkinRewardCtrl_01:OnDisable()
|
||||
end
|
||||
return LoginSkinRewardCtrl_01
|
||||
@@ -0,0 +1,90 @@
|
||||
local ReengagementBDPreviewCtrl = class("ReengagementBDPreviewCtrl", BaseCtrl)
|
||||
ReengagementBDPreviewCtrl._mapNodeConfig = {
|
||||
window = {},
|
||||
animRoot = {sNodeName = "window", sComponentName = "Animator"},
|
||||
goBlur = {},
|
||||
btnShortcutClose = {sComponentName = "NaviButton", callback = "ClosePanel"},
|
||||
btnClose = {sComponentName = "UIButton", callback = "ClosePanel"},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Reengagement_BDTrialPreview_Title"
|
||||
},
|
||||
txtLevelInterval = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Reengagement_BDTrialPreview_LevelInterval"
|
||||
},
|
||||
txtTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Reengagement_BDTrialPreview_Tip"
|
||||
},
|
||||
txtCurLevel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TD_TitleCurLevel"
|
||||
},
|
||||
txtLevelCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_WorldClass_Level"
|
||||
},
|
||||
svAll = {
|
||||
sComponentName = "LoopScrollView"
|
||||
}
|
||||
}
|
||||
ReengagementBDPreviewCtrl._mapEventConfig = {}
|
||||
function ReengagementBDPreviewCtrl:OpenPanel()
|
||||
self.gameObject:SetActive(true)
|
||||
self._mapNode.window:SetActive(false)
|
||||
local wait = function()
|
||||
self._mapNode.goBlur:SetActive(true)
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.window:SetActive(true)
|
||||
self._mapNode.btnShortcutClose.gameObject:SetActive(true)
|
||||
self:InitPanel()
|
||||
self._mapNode.animRoot:Play("t_window_04_t_in")
|
||||
end
|
||||
end
|
||||
function ReengagementBDPreviewCtrl:InitPanel()
|
||||
self.tbLevelInterval = {}
|
||||
local foreachData = function(mapData)
|
||||
table.insert(self.tbLevelInterval, mapData)
|
||||
end
|
||||
ForEachTableLine(ConfigTable.GetData("ReengagementBDTrial"), foreachData)
|
||||
self.nWorldLevel = PlayerData.Base:GetWorldClass()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, self.nWorldLevel)
|
||||
self._mapNode.svAll:Init(#self.tbLevelInterval, self, self.OnGridRefresh)
|
||||
end
|
||||
function ReengagementBDPreviewCtrl:OnGridRefresh(goGrid, nGridIndex)
|
||||
local nIndex = nGridIndex + 1
|
||||
local mapData = self.tbLevelInterval[nIndex]
|
||||
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
|
||||
imgOnBg:SetActive(true)
|
||||
imgOffBg:SetActive(false)
|
||||
imgSelect:SetActive(true)
|
||||
else
|
||||
imgOnBg:SetActive(false)
|
||||
imgOffBg:SetActive(true)
|
||||
imgSelect:SetActive(false)
|
||||
end
|
||||
local txtDesc = goGrid.transform:Find("txtDesc"):GetComponent("TMP_Text")
|
||||
if txtDesc ~= nil then
|
||||
local sText = ConfigTable.GetUIText("Reengagement_BDTrialPreview_WorldClass")
|
||||
sText = sText .. mapData.MinLevel .. "~" .. mapData.MaxLevel
|
||||
NovaAPI.SetTMPText(txtDesc, sText)
|
||||
end
|
||||
local imgIcon = goGrid.transform:Find("imgIcon"):GetComponent("Image")
|
||||
if imgIcon ~= nil then
|
||||
self:SetPngSprite(imgIcon, mapData.Icon)
|
||||
end
|
||||
end
|
||||
function ReengagementBDPreviewCtrl:ClosePanel()
|
||||
self._mapNode.animRoot:Play("t_window_04_t_out")
|
||||
local animLength = NovaAPI.GetAnimClipLength(self._mapNode.animRoot, {
|
||||
"t_window_04_t_out"
|
||||
})
|
||||
self:AddTimer(1, animLength, function()
|
||||
self.gameObject:SetActive(false)
|
||||
end, true, true, true)
|
||||
end
|
||||
return ReengagementBDPreviewCtrl
|
||||
@@ -0,0 +1,83 @@
|
||||
local ReengagementBDPreviewItemCtrl = class("ReengagementBDPreviewItemCtrl", BaseCtrl)
|
||||
ReengagementBDPreviewItemCtrl._mapNodeConfig = {
|
||||
btnItem = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickItem"
|
||||
},
|
||||
txtLeaderCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Leader"
|
||||
},
|
||||
txtSubCn = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Sub"
|
||||
},
|
||||
imgCharIcon = {nCount = 3, sComponentName = "Image"},
|
||||
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"
|
||||
}
|
||||
}
|
||||
ReengagementBDPreviewItemCtrl._mapEventConfig = {}
|
||||
function ReengagementBDPreviewItemCtrl:Refresh(nTrialBuildId)
|
||||
self.mapBuildData = PlayerData.Build:GetTrialBuild(nTrialBuildId)
|
||||
if self.mapBuildData == nil then
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
self.gameObject:SetActive(true)
|
||||
self:RefreshInfo()
|
||||
self:RefreshChar()
|
||||
end
|
||||
function ReengagementBDPreviewItemCtrl:RefreshInfo()
|
||||
local mapRank = self.mapBuildData.mapRank
|
||||
if mapRank == nil then
|
||||
mapRank = PlayerData.Build:CalBuildRank(self.mapBuildData.nScore or 0)
|
||||
self.mapBuildData.mapRank = mapRank
|
||||
end
|
||||
if mapRank ~= nil then
|
||||
local sScore = "Icon/BuildRank/BuildRank_" .. mapRank.Id
|
||||
self:SetPngSprite(self._mapNode.imgIcon, sScore)
|
||||
end
|
||||
end
|
||||
function ReengagementBDPreviewItemCtrl:RefreshChar()
|
||||
for i = 1, 3 do
|
||||
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 mapCharSkin = 0 < nCharSkinId and ConfigTable.GetData_CharacterSkin(nCharSkinId) or nil
|
||||
local bShowChar = mapCharCfg ~= nil and mapCharSkin ~= nil
|
||||
self._mapNode.imgCharIcon[i].gameObject:SetActive(bShowChar)
|
||||
self._mapNode.imgCharFrame[i].gameObject:SetActive(bShowChar)
|
||||
self._mapNode.txtPotentialCount[i].gameObject:SetActive(bShowChar)
|
||||
self._mapNode.imgCharElement[i].gameObject:SetActive(bShowChar)
|
||||
if bShowChar then
|
||||
local sFrame = AllEnum.FrameType_New.BoardFrame .. AllEnum.BoardFrameColor[mapCharCfg.Grade]
|
||||
self:SetPngSprite(self._mapNode.imgCharIcon[i], mapCharSkin.Icon, AllEnum.CharHeadIconSurfix.XXL)
|
||||
self:SetAtlasSprite(self._mapNode.imgCharFrame[i], "12_rare", sFrame)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPotentialCount[i], mapCharData.nPotentialCount or 0)
|
||||
self:SetAtlasSprite(self._mapNode.imgCharElement[i], "12_rare", AllEnum.Char_Element[mapCharCfg.EET].icon)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ReengagementBDPreviewItemCtrl:OnClickItem()
|
||||
if self.mapBuildData == nil then
|
||||
return
|
||||
end
|
||||
self.mapBuildData = PlayerData.Build:GetTrialBuild(self.mapBuildData.nBuildId)
|
||||
if self.mapBuildData == nil then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StarTowerBuildDetailPreview, self.mapBuildData)
|
||||
end
|
||||
return ReengagementBDPreviewItemCtrl
|
||||
@@ -0,0 +1,44 @@
|
||||
local ReengagementBDTrialCtrl = class("ReengagementBDTrialCtrl", BaseCtrl)
|
||||
ReengagementBDTrialCtrl._mapNodeConfig = {
|
||||
txtActName = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Reengagement_BDTrial_Title"
|
||||
},
|
||||
txtActValue = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Reengagement_BDTrial_TimeLimit"
|
||||
},
|
||||
txtBtnTriaDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Reengagement_BDTrial_Title"
|
||||
},
|
||||
goInstanceItem = {
|
||||
nCount = 6,
|
||||
sCtrlName = "Game.UI.Activity.Reengagement.ReengagementBDPreviewItemCtrl"
|
||||
}
|
||||
}
|
||||
ReengagementBDTrialCtrl._mapEventConfig = {}
|
||||
function ReengagementBDTrialCtrl:Refresh(nCurTog)
|
||||
if nCurTog ~= AllEnum.ReengagementTog.BDTrial then
|
||||
return
|
||||
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
|
||||
for k, nBuildId in ipairs(self.tbBuildIds) do
|
||||
local itemCtrl = self.goInstanceItem[k]
|
||||
itemCtrl:Refresh(nBuildId)
|
||||
end
|
||||
end
|
||||
return ReengagementBDTrialCtrl
|
||||
@@ -0,0 +1,137 @@
|
||||
local ReengagementCtrl = class("ReengagementCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
ReengagementCtrl._mapNodeConfig = {
|
||||
svTog = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
trSvTog = {sNodeName = "svTog", sComponentName = "Transform"},
|
||||
rtSignin = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
ctrlSignin = {
|
||||
sNodeName = "rtSignin",
|
||||
sCtrlName = "Game.UI.Activity.Reengagement.ReengagementSigninCtrl"
|
||||
},
|
||||
rtTask = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
ctrlTask = {
|
||||
sNodeName = "rtTask",
|
||||
sCtrlName = "Game.UI.Activity.Reengagement.ReengagementTaskCtrl"
|
||||
},
|
||||
rtDoubleDrop = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
ctrlDoubleDrop = {
|
||||
sNodeName = "rtDoubleDrop",
|
||||
sCtrlName = "Game.UI.Activity.Reengagement.ReengagementDoubleDropCtrl"
|
||||
},
|
||||
rtShopMall = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
ctrlShopMall = {
|
||||
sNodeName = "rtShopMall",
|
||||
sCtrlName = "Game.UI.Activity.Reengagement.ReengagementMallCtrl"
|
||||
},
|
||||
rtBDTrial = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
ctrlBDTrial = {
|
||||
sNodeName = "rtBDTrial",
|
||||
sCtrlName = "Game.UI.Activity.Reengagement.ReengagementBDTrialCtrl"
|
||||
},
|
||||
txtEnergyTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Energy_Battery_Title"
|
||||
},
|
||||
txtProgress = {sComponentName = "TMP_Text"},
|
||||
imgEnergyBarFill = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
btnTrialDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickTrialDetail"
|
||||
},
|
||||
ReengagementPreviewPanel = {
|
||||
sCtrlName = "Game.UI.Activity.Reengagement.ReengagementBDPreviewCtrl"
|
||||
}
|
||||
}
|
||||
ReengagementCtrl._mapEventConfig = {}
|
||||
function ReengagementCtrl:InitTog()
|
||||
self._mapNode.svTog:Init(5, self, self.OnGridRefresh, self.OnGridBtnClick)
|
||||
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")
|
||||
end
|
||||
local mapCfg = ConfigTable.GetUIText("ReengagementTog_" .. nIndex)
|
||||
if mapCfg then
|
||||
self.ctrlTog[nInstanceID]:SetText(mapCfg)
|
||||
end
|
||||
self.ctrlTog[nInstanceID]:SetDefault(nIndex == self.nCurTog)
|
||||
end
|
||||
function ReengagementCtrl:OnGridBtnClick(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local nInstanceID = goGrid:GetInstanceID()
|
||||
if nIndex == self.nCurTog then
|
||||
return
|
||||
end
|
||||
self.ctrlTog[nInstanceID]:SetTrigger(true)
|
||||
if self.nCurTog then
|
||||
local goSelect = self._mapNode.trSvTog:Find("Viewport/Content/" .. self.nCurTog - 1)
|
||||
if goSelect then
|
||||
self.ctrlTog[goSelect.gameObject:GetInstanceID()]:SetTrigger(false)
|
||||
end
|
||||
end
|
||||
self.nCurTog = nIndex
|
||||
self:SwitchTog()
|
||||
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)
|
||||
end
|
||||
local nMaxEnergyBatteryFillerLength = 252
|
||||
local nMinEnergyBatteryFillerLength = 15
|
||||
function ReengagementCtrl:RefreshEnergyBattery()
|
||||
local nEnergyBattery = PlayerData.Base:GetCurEnergyBattery().nEnergyBattery
|
||||
local nMaxEnergyBattery = ConfigTable.GetConfigNumber("EnergyBatteryMax")
|
||||
NovaAPI.SetTMPText(self._mapNode.txtProgress, nEnergyBattery .. "/" .. nMaxEnergyBattery)
|
||||
local nFillerLength = nEnergyBattery / nMaxEnergyBattery * nMaxEnergyBatteryFillerLength
|
||||
if nFillerLength > nMaxEnergyBatteryFillerLength then
|
||||
nFillerLength = nMaxEnergyBatteryFillerLength
|
||||
elseif nFillerLength < nMinEnergyBatteryFillerLength then
|
||||
nFillerLength = nMinEnergyBatteryFillerLength
|
||||
end
|
||||
self._mapNode.imgEnergyBarFill.sizeDelta = Vector2(nFillerLength, self._mapNode.imgEnergyBarFill.sizeDelta.y)
|
||||
end
|
||||
function ReengagementCtrl:Awake()
|
||||
end
|
||||
function ReengagementCtrl:FadeIn()
|
||||
end
|
||||
function ReengagementCtrl:FadeOut()
|
||||
end
|
||||
function ReengagementCtrl:OnEnable()
|
||||
self.nCurTog = 1
|
||||
self:SwitchTog()
|
||||
self:RefreshEnergyBattery()
|
||||
end
|
||||
function ReengagementCtrl:OnDisable()
|
||||
end
|
||||
function ReengagementCtrl:OnDestroy()
|
||||
end
|
||||
function ReengagementCtrl:OnRelease()
|
||||
end
|
||||
function ReengagementCtrl:OnClickTrialDetail()
|
||||
self.ReengagementPreviewPanel:OpenPanel()
|
||||
end
|
||||
return ReengagementCtrl
|
||||
@@ -0,0 +1,146 @@
|
||||
local ReengagementDoubleDropCtrl = class("ReengagementDoubleDropCtrl", BaseCtrl)
|
||||
ReengagementDoubleDropCtrl._mapNodeConfig = {
|
||||
txtActName = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Reengagement_DoubleDrop_Title"
|
||||
},
|
||||
btnActDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txtBtnActDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Detail"
|
||||
},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
txtDoubleCount = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Reengagement_DoubleDrop_Count"
|
||||
},
|
||||
goInstanceItem = {
|
||||
nCount = 4,
|
||||
sCtrlName = "Game.UI.Activity.DoubleDrop.DoubleDropInsItemCtrl"
|
||||
},
|
||||
btnGoto = {
|
||||
nCount = 4,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Goto"
|
||||
},
|
||||
txtBtnGoto = {
|
||||
nCount = 4,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Double_Drops_Goto_Instance"
|
||||
},
|
||||
redDotQuest = {}
|
||||
}
|
||||
ReengagementDoubleDropCtrl._mapEventConfig = {}
|
||||
function ReengagementDoubleDropCtrl:Refresh(nCurTog)
|
||||
if nCurTog ~= AllEnum.ReengagementTog.DoubleDrop then
|
||||
return
|
||||
end
|
||||
self:InitActData()
|
||||
end
|
||||
function ReengagementDoubleDropCtrl:InitActData()
|
||||
self.actData = {}
|
||||
self.nActId = 0
|
||||
self.tbFuncType = self.actData:GetDoubleFuncType()
|
||||
if self.tbFuncType == nil then
|
||||
return
|
||||
end
|
||||
self:StartActTimer()
|
||||
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])
|
||||
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)
|
||||
end
|
||||
function ReengagementDoubleDropCtrl:GetTimeStr(nRemainTime)
|
||||
local sTimeStr = ""
|
||||
if nRemainTime <= 60 then
|
||||
local sec = math.floor(nRemainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < nRemainTime and nRemainTime <= 3600 then
|
||||
local min = math.floor(nRemainTime / 60)
|
||||
local sec = math.floor(nRemainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < nRemainTime and nRemainTime <= 86400 then
|
||||
local hour = math.floor(nRemainTime / 3600)
|
||||
local min = math.floor((nRemainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < nRemainTime then
|
||||
local day = math.floor(nRemainTime / 86400)
|
||||
local hour = math.floor((nRemainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
return sTimeStr
|
||||
end
|
||||
function ReengagementDoubleDropCtrl:StartActTimer()
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel()
|
||||
self.timer = nil
|
||||
end
|
||||
local nOpenTime = self.actData:GetActOpenTime()
|
||||
local nCloseTime = self.actData:GetActEndTime()
|
||||
local refreshTime = function()
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
local sTime = ""
|
||||
local nRemainTime = math.max(nCloseTime - nCurTime, 0)
|
||||
if nCurTime >= nCloseTime then
|
||||
sTime = ConfigTable.GetUIText("Activity_End")
|
||||
elseif nCurTime >= nOpenTime then
|
||||
sTime = self:GetTimeStr(nRemainTime)
|
||||
end
|
||||
if nRemainTime <= 0 and self.timer ~= nil then
|
||||
self.timer:Cancel()
|
||||
self.timer = nil
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, sTime)
|
||||
end
|
||||
refreshTime()
|
||||
self.timer = self:AddTimer(0, 1, refreshTime, true, true, true)
|
||||
end
|
||||
function ReengagementDoubleDropCtrl:OnBtnClick_Detail()
|
||||
local mapActCfg = ConfigTable.GetData("ActivityDouble", self.nActId)
|
||||
if mapActCfg == nil then
|
||||
return
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = mapActCfg.DesText,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function ReengagementDoubleDropCtrl:OnBtnClick_Goto(btn, nIndex)
|
||||
local nType = self.tbFuncType[nIndex]
|
||||
if nType == nil then
|
||||
return
|
||||
end
|
||||
if nType == GameEnum.OpenFuncType.DailyInstance then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DailyInstanceLevelSelect, 0, 0, true)
|
||||
elseif nType == GameEnum.OpenFuncType.RegionBoss then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.RogueBossLevel, 0, 0, true)
|
||||
elseif nType == GameEnum.OpenFuncType.SkillInstance then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.SkillInstanceLevelSelect)
|
||||
elseif nType == GameEnum.OpenFuncType.CharGemInstance then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.EquipmentInstanceLevelSelect)
|
||||
end
|
||||
end
|
||||
return ReengagementDoubleDropCtrl
|
||||
@@ -0,0 +1,589 @@
|
||||
local ReengagementMallCtrl = class("ReengagementMallCtrl", BaseCtrl)
|
||||
local JumpUtil = require("Game.Common.Utils.JumpUtil")
|
||||
local SDKManager = CS.SDKManager.Instance
|
||||
ReengagementMallCtrl._mapNodeConfig = {
|
||||
txtReMallEndTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Reengagement_Mall_EndTip"
|
||||
},
|
||||
txtLabelValue = {sComponentName = "TMP_Text"},
|
||||
txtRemainDay = {sComponentName = "TMP_Text"},
|
||||
txtWeeklyCardName = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Reengagement_WeeklyCardName"
|
||||
},
|
||||
txtWeeklyCardDesc = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Reengagement_WeeklyCardDesc"
|
||||
},
|
||||
txtGetNow = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Reengagement_GetNow"
|
||||
},
|
||||
txtGetDaily = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Reengagement_GetDaily"
|
||||
},
|
||||
txtBtnBuy = {sComponentName = "TMP_Text"},
|
||||
txtAlreadyReceived = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Reengagement_AlreadyReceived"
|
||||
},
|
||||
btnReceiveWeeklyCard = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ReceiveWeeklyCard"
|
||||
},
|
||||
btnAlreadyReceived = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_AlreadyReceived"
|
||||
},
|
||||
MallItem = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
txtBannerTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Reengagement_Mall_BannerTitle"
|
||||
},
|
||||
goActivityBanner = {},
|
||||
goActBannerList = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
btnActBanner = {
|
||||
sNodeName = "goActBannerList",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_btnActBanner"
|
||||
},
|
||||
eventActBannerDrag = {
|
||||
sNodeName = "goActBannerList",
|
||||
sComponentName = "UIDrag",
|
||||
callback = "OnDrag_ActBanner"
|
||||
},
|
||||
activityBannerItem = {
|
||||
nCount = 3,
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgActBanner = {nCount = 3, sComponentName = "Image"},
|
||||
goBannerDot = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgPointBg = {nCount = 10},
|
||||
PkgItem = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.Mall.MallPackageItemCtrl"
|
||||
}
|
||||
}
|
||||
ReengagementMallCtrl._mapEventConfig = {}
|
||||
function ReengagementMallCtrl:OnEnable()
|
||||
self.tbPackagePage = {}
|
||||
self.actData = {}
|
||||
end
|
||||
function ReengagementMallCtrl:OnDisable()
|
||||
self:ResetTimer()
|
||||
end
|
||||
function ReengagementMallCtrl:Refresh(nCurTog)
|
||||
if nCurTog ~= AllEnum.ReengagementTog.ShopMall then
|
||||
return
|
||||
end
|
||||
self:SetBanner()
|
||||
self:RefreshWeeklyCard()
|
||||
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()
|
||||
end
|
||||
function ReengagementMallCtrl:RefreshPkgItem()
|
||||
for i = 1, 3 do
|
||||
local mapData = self.tbPackagePage[i]
|
||||
if mapData ~= nil then
|
||||
self._mapNode.PkgItem[i].gameObject:SetActive(true)
|
||||
self._mapNode.PkgItem[i]:Refresh(mapData)
|
||||
else
|
||||
self._mapNode.PkgItem[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ReengagementMallCtrl:SetBanner()
|
||||
self.bannerRefreshTimer = nil
|
||||
self.tbBannerList = {}
|
||||
self:AddGachaBanner()
|
||||
if nil == self.tbBannerList or nil == next(self.tbBannerList) then
|
||||
self._mapNode.goActivityBanner.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.goActivityBanner:SetActive(true)
|
||||
for _, v in ipairs(self._mapNode.imgPointBg) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
for k, v in ipairs(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)
|
||||
end
|
||||
end
|
||||
self.nActBannerIdx = 1
|
||||
self.nLastActBannerIdx = 1
|
||||
self:RefreshActivityBanner()
|
||||
end
|
||||
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)
|
||||
local mapGachaA = ConfigTable.GetData("Gacha", a)
|
||||
local mapGachaB = ConfigTable.GetData("Gacha", b)
|
||||
return mapGachaA.Sort < mapGachaB.Sort
|
||||
end
|
||||
table.sort(tbOpenedPool, comp)
|
||||
for _, nPoolId in ipairs(tbOpenedPool) do
|
||||
local mapPoolCfgData = ConfigTable.GetData("Gacha", nPoolId)
|
||||
if mapPoolCfgData ~= nil and mapPoolCfgData.BannerRes ~= nil and mapPoolCfgData.BannerRes ~= "" then
|
||||
table.insert(self.tbBannerList, {
|
||||
nId = nPoolId,
|
||||
nType = GameEnum.bannerType.Gacha,
|
||||
sBanner = mapPoolCfgData.BannerRes,
|
||||
nJumpTo = nPoolId,
|
||||
nFuncType = GameEnum.OpenFuncType.Gacha
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
function ReengagementMallCtrl:RefreshActivityBanner()
|
||||
local lastIndex = self.nActBannerIdx - 1 <= 0 and #self.tbBannerList or self.nActBannerIdx - 1
|
||||
local nextIndex = self.nActBannerIdx + 1 > #self.tbBannerList and 1 or self.nActBannerIdx + 1
|
||||
local tbCurBannerList = {}
|
||||
table.insert(tbCurBannerList, self.tbBannerList[lastIndex])
|
||||
table.insert(tbCurBannerList, self.tbBannerList[self.nActBannerIdx])
|
||||
table.insert(tbCurBannerList, self.tbBannerList[nextIndex])
|
||||
for k, v in ipairs(self._mapNode.imgActBanner) do
|
||||
local bannerData = tbCurBannerList[k]
|
||||
if bannerData ~= nil then
|
||||
if bannerData.nType == GameEnum.bannerType.Activity then
|
||||
if nil ~= bannerData.actData then
|
||||
self:SetPngSprite(v, "Icon/Banner/" .. bannerData.actData:GetBannerPng())
|
||||
end
|
||||
else
|
||||
self:SetPngSprite(v, "Icon/Banner/" .. bannerData.sBanner)
|
||||
end
|
||||
end
|
||||
end
|
||||
self._mapNode.imgPointBg[self.nLastActBannerIdx].transform:Find("imgPoint").gameObject:SetActive(false)
|
||||
self.nLastActBannerIdx = self.nActBannerIdx
|
||||
self._mapNode.imgPointBg[self.nActBannerIdx].transform:Find("imgPoint").gameObject:SetActive(true)
|
||||
end
|
||||
function ReengagementMallCtrl:StartActBannerTimer()
|
||||
if nil == self.actBannerTimer and #self.tbBannerList > 1 then
|
||||
self.actBannerTimer = self:AddTimer(0, self.nBannerInterval, "PlayActBannerAnim", true, true, false)
|
||||
end
|
||||
end
|
||||
function ReengagementMallCtrl:ResetActBannerTimer()
|
||||
if nil ~= self.actBannerTimer then
|
||||
self.actBannerTimer:Cancel(false)
|
||||
end
|
||||
self.actBannerTimer = nil
|
||||
end
|
||||
function ReengagementMallCtrl:PlayActBannerAnim()
|
||||
local onCompleteCb = function()
|
||||
self:BannerTweenerEnd()
|
||||
end
|
||||
for k, v in ipairs(self._mapNode.activityBannerItem) do
|
||||
if k == #self._mapNode.activityBannerItem then
|
||||
v:DOAnchorPosX(self.tbBannerInitPos[k].x - self.nBannerWidth, 0.5):SetUpdate(true):OnComplete(onCompleteCb)
|
||||
else
|
||||
v:DOAnchorPosX(self.tbBannerInitPos[k].x - self.nBannerWidth, 0.5):SetUpdate(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ReengagementMallCtrl:BannerTweenerEnd()
|
||||
for k, v in ipairs(self._mapNode.activityBannerItem) do
|
||||
v.anchoredPosition = self.tbBannerInitPos[k]
|
||||
end
|
||||
self.nActBannerIdx = self.nActBannerIdx + 1
|
||||
if self.nActBannerIdx > #self.tbBannerList then
|
||||
self.nActBannerIdx = 1
|
||||
end
|
||||
self:RefreshActivityBanner()
|
||||
end
|
||||
function ReengagementMallCtrl:OnBtnClick_btnActBanner()
|
||||
local bannerData = self.tbBannerList[self.nActBannerIdx]
|
||||
if bannerData.nType == GameEnum.bannerType.Activity then
|
||||
local openCallback = function()
|
||||
if nil ~= bannerData.actData then
|
||||
PlayerData.Activity:OpenActivityPanel(bannerData.actData:GetActId())
|
||||
end
|
||||
end
|
||||
PlayerData.Base:CheckFunctionBtn(bannerData.nFuncType, openCallback)
|
||||
elseif bannerData.nType == GameEnum.bannerType.OpenFunc or bannerData.nType == GameEnum.bannerType.TimeLimit_Func then
|
||||
local openCallback = function()
|
||||
JumpUtil.JumpTo(bannerData.nJumpTo)
|
||||
end
|
||||
PlayerData.Base:CheckFunctionBtn(bannerData.nFuncType, openCallback)
|
||||
elseif bannerData.nType == GameEnum.bannerType.Gacha then
|
||||
local openCallback = function()
|
||||
local getInfoCallback = function()
|
||||
local func = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.GachaSpin, bannerData.nJumpTo)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, 6, func, AllEnum.MainViewCorner.Recruit)
|
||||
end
|
||||
PlayerData.Gacha:GetGachaInfomation(getInfoCallback)
|
||||
end
|
||||
PlayerData.Base:CheckFunctionBtn(bannerData.nFuncType, openCallback)
|
||||
elseif bannerData.nType == 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
|
||||
local hasUrl, url = UTILS.GetBBSUrl()
|
||||
if hasUrl then
|
||||
local bbsTitle = ConfigTable.GetUIText("BBSTitle")
|
||||
SDKManager:ShowBBS(false, bbsTitle, url, "CN-BBS", false, 2)
|
||||
else
|
||||
printLog(NovaAPI.GetClientChannel() .. "——平台取不到地址")
|
||||
end
|
||||
else
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Function_NotAvailable"))
|
||||
end
|
||||
elseif bannerData.nType == GameEnum.bannerType.Payment 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
|
||||
SDKManager:ShowWebView(false, "", "https://payment.yostar.cn/", 1, 1, false, "CN-PAYMENT")
|
||||
else
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Function_NotAvailable"))
|
||||
end
|
||||
elseif bannerData.nType == GameEnum.bannerType.Mall then
|
||||
local nJumpId = tonumber(bannerData.sParam)
|
||||
JumpUtil.JumpTo(nJumpId)
|
||||
elseif bannerData.nType == GameEnum.bannerType.MallSkin then
|
||||
local sMallPackageId = bannerData.sParam
|
||||
local mapCfg = ConfigTable.GetData("MallPackage", sMallPackageId)
|
||||
if mapCfg == nil then
|
||||
return
|
||||
end
|
||||
local callback = function(tbList, nTime)
|
||||
local bInMall = false
|
||||
for _, v in ipairs(tbList) do
|
||||
if v.sId == sMallPackageId then
|
||||
bInMall = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not bInMall then
|
||||
return
|
||||
end
|
||||
local tbMallList = {}
|
||||
table.insert(tbMallList, {sId = sMallPackageId})
|
||||
local func = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.MallSkinPreview, tbMallList)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, 5, func)
|
||||
end
|
||||
PlayerData.Mall:SendMallPackageListReq(callback)
|
||||
elseif bannerData.nType == GameEnum.bannerType.JumpToUrl then
|
||||
local sUrl = bannerData.sUrl
|
||||
local bInside = bannerData.bInside
|
||||
local bUseOpenUrl = bannerData.bUseOpenUrl
|
||||
if bUseOpenUrl then
|
||||
NovaAPI.OpenURL(sUrl)
|
||||
elseif SDKManager:IsSDKInit() then
|
||||
if bInside then
|
||||
SDKManager:ShowWebView(false, "", sUrl, 1, 0, true)
|
||||
else
|
||||
SDKManager:ShowWebView(false, "", sUrl, 1, 1, true)
|
||||
end
|
||||
else
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Function_NotAvailable"))
|
||||
end
|
||||
elseif bannerData.nType == GameEnum.bannerType.SeaPayment then
|
||||
local sUrl = bannerData.sUrl
|
||||
local bInside = bannerData.bInside
|
||||
local sPid = bannerData.sPid
|
||||
if SDKManager:IsSDKInit() then
|
||||
if bInside then
|
||||
SDKManager:ShowWebView(false, "", sUrl, 1, 0, false, sPid)
|
||||
else
|
||||
SDKManager:ShowWebView(false, "", sUrl, 1, 1, false, sPid)
|
||||
end
|
||||
end
|
||||
end
|
||||
local tab = {}
|
||||
table.insert(tab, {
|
||||
"role_id",
|
||||
tostring(PlayerData.Base._nPlayerId)
|
||||
})
|
||||
table.insert(tab, {
|
||||
"banner_type",
|
||||
tostring(bannerData.nType)
|
||||
})
|
||||
table.insert(tab, {
|
||||
"banner_id",
|
||||
tostring(bannerData.nId)
|
||||
})
|
||||
NovaAPI.UserEventUpload("scrolling_banner_click", tab)
|
||||
end
|
||||
function ReengagementMallCtrl:OnDrag_ActBanner(mDrag)
|
||||
if mDrag.DragEventType == AllEnum.UIDragType.DragStart then
|
||||
self.nBannerDragPosX = 0
|
||||
self:ResetActBannerTimer()
|
||||
elseif mDrag.DragEventType == AllEnum.UIDragType.Drag then
|
||||
self.nBannerDragPosX = self.nBannerDragPosX + mDrag.EventData.delta.x
|
||||
for k, v in ipairs(self._mapNode.activityBannerItem) do
|
||||
v.anchoredPosition = Vector2(self.tbBannerInitPos[k].x + self.nBannerDragPosX, self.tbBannerInitPos[k].y)
|
||||
end
|
||||
elseif mDrag.DragEventType == AllEnum.UIDragType.DragEnd then
|
||||
local nPos = 0
|
||||
if self.nBannerDragPosX > 0 then
|
||||
nPos = self.nBannerWidth
|
||||
self.nActBannerIdx = 0 >= self.nActBannerIdx - 1 and #self.tbBannerList or self.nActBannerIdx - 1
|
||||
elseif self.nBannerDragPosX < 0 then
|
||||
nPos = -self.nBannerWidth
|
||||
self.nActBannerIdx = self.nActBannerIdx + 1 > #self.tbBannerList and 1 or self.nActBannerIdx + 1
|
||||
end
|
||||
local tweener
|
||||
for k, v in ipairs(self._mapNode.activityBannerItem) do
|
||||
tweener = v:DOAnchorPosX(self.tbBannerInitPos[k].x + nPos, 0.5):SetUpdate(true)
|
||||
end
|
||||
local _cb = function()
|
||||
for k, v in ipairs(self._mapNode.activityBannerItem) do
|
||||
v.anchoredPosition = self.tbBannerInitPos[k]
|
||||
end
|
||||
self:RefreshActivityBanner()
|
||||
self:StartActBannerTimer()
|
||||
end
|
||||
tweener.onComplete = dotween_callback_handler(self, _cb)
|
||||
self.nBannerDragPosX = 0
|
||||
end
|
||||
end
|
||||
function ReengagementMallCtrl:ResetTimer()
|
||||
if self.actBannerTimer ~= nil then
|
||||
self.actBannerTimer:Cancel(false)
|
||||
self.actBannerTimer = nil
|
||||
end
|
||||
if self.actBannerRefreshTimer ~= nil then
|
||||
self.actBannerRefreshTimer:Cancel(false)
|
||||
self.actBannerRefreshTimer = nil
|
||||
end
|
||||
if self.bannerRefreshTimer ~= nil then
|
||||
self.bannerRefreshTimer:Cancel(false)
|
||||
self.bannerRefreshTimer = nil
|
||||
end
|
||||
end
|
||||
return ReengagementMallCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local ReengagementPanel = class("ReengagementPanel", BasePanel)
|
||||
ReengagementPanel._sUIResRootPath = "UI_Activity/"
|
||||
ReengagementPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_101004/ReengagementPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.Reengagement.ReengagementCtrl"
|
||||
}
|
||||
}
|
||||
function ReengagementPanel:Awake()
|
||||
end
|
||||
function ReengagementPanel:OnEnable()
|
||||
end
|
||||
function ReengagementPanel:OnDisable()
|
||||
end
|
||||
function ReengagementPanel:OnDestroy()
|
||||
end
|
||||
function ReengagementPanel:OnRelease()
|
||||
end
|
||||
return ReengagementPanel
|
||||
@@ -0,0 +1,179 @@
|
||||
local ReengagementSigninCtrl = class("ReengagementSigninCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ReengagementSigninCtrl._mapNodeConfig = {
|
||||
txtActName = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Reengagement_Signin_Title"
|
||||
},
|
||||
btnRewardDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txtReward = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Reengagement_Signin_OnceReward"
|
||||
},
|
||||
imgRemaineTime = {},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
goRewardItem = {
|
||||
nCount = 7,
|
||||
sCtrlName = "Game.UI.Activity.LoginReward.LoginRewardItemCtrl"
|
||||
},
|
||||
btnItem = {
|
||||
nCount = 7,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Item"
|
||||
},
|
||||
btnPlay = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Play"
|
||||
},
|
||||
btnActivity = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Activity"
|
||||
},
|
||||
txtReplay = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Reengagement_Signin_Replay"
|
||||
}
|
||||
}
|
||||
ReengagementSigninCtrl._mapEventConfig = {}
|
||||
function ReengagementSigninCtrl:Refresh(nCurTog)
|
||||
if nCurTog ~= AllEnum.ReengagementTog.ShopMall then
|
||||
return
|
||||
end
|
||||
self:InitActData()
|
||||
end
|
||||
function ReengagementSigninCtrl: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.txtTime, sTimeStr)
|
||||
end
|
||||
function ReengagementSigninCtrl:RefreshRewardList()
|
||||
self.tbRewardList = {}
|
||||
local tbRewardList = self.actData:GetActLoginRewardList()
|
||||
if nil ~= tbRewardList then
|
||||
local nMaxDay = #tbRewardList
|
||||
local nReceiveDay = self.actData:GetCanReceive()
|
||||
local nActual = self.actData:GetReceived()
|
||||
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
|
||||
v:SetRewardItem(k, mapReward, k == nMaxDay, nReceiveDay == nActual and k == nActual + 1)
|
||||
for i = 1, 3 do
|
||||
local nTid = mapReward["RewardId" .. i]
|
||||
local nCount = mapReward["Qty" .. i]
|
||||
if nTid ~= 0 then
|
||||
table.insert(self.tbRewardList[k], {nTid = nTid, nCount = nCount})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ReengagementSigninCtrl:InitActData()
|
||||
local actData = {}
|
||||
self.actData = actData
|
||||
self:RefreshRewardList()
|
||||
local canReceive = self.actData:CheckCanReceive()
|
||||
self._mapNode.btnActivity.gameObject:SetActive(canReceive)
|
||||
self._mapNode.imgRemaineTime.gameObject:SetActive(true)
|
||||
self:RefreshRemainTime()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
|
||||
end
|
||||
end
|
||||
function ReengagementSigninCtrl:Awake()
|
||||
end
|
||||
function ReengagementSigninCtrl:OnEnable()
|
||||
end
|
||||
function ReengagementSigninCtrl:OnDisable()
|
||||
end
|
||||
function ReengagementSigninCtrl:OnDestroy()
|
||||
end
|
||||
function ReengagementSigninCtrl: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 ReengagementSigninCtrl:OnBtnClick_Item(btn, nIndex)
|
||||
if self.tbRewardList[nIndex] ~= nil then
|
||||
if #self.tbRewardList[nIndex] == 1 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)
|
||||
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)
|
||||
end
|
||||
local canReceive = self.actData:CheckCanReceive()
|
||||
if not canReceive then
|
||||
callback()
|
||||
return
|
||||
end
|
||||
PlayerData.Activity:SendReceiveLoginRewardMsg(self.actData:GetActId(), callback)
|
||||
end
|
||||
return ReengagementSigninCtrl
|
||||
@@ -0,0 +1,330 @@
|
||||
local ReengagementTaskCtrl = class("ReengagementTaskCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
ReengagementTaskCtrl._mapNodeConfig = {
|
||||
txtActName = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Reengagement_Task_Title"
|
||||
},
|
||||
loopSv = {
|
||||
sNodeName = "srGuideQuest",
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
rtDays = {},
|
||||
PerActGroupItem = {
|
||||
nCount = 7,
|
||||
sCtrlName = "Game.UI.Activity.Reengagement.ReengagementTaskGroupCtrl"
|
||||
},
|
||||
btnGroup = {
|
||||
sNodeName = "PerActGroupItem",
|
||||
nCount = 7,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Group"
|
||||
},
|
||||
btnGroupLock = {
|
||||
sNodeName = "btnGroupLock",
|
||||
nCount = 7,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GroupLock"
|
||||
},
|
||||
btnActDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txtBtnActDetail = {
|
||||
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"},
|
||||
rtActProgressFill = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
btnNodeItem = {
|
||||
nCount = 7,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_NodeItem"
|
||||
}
|
||||
}
|
||||
ReengagementTaskCtrl._mapEventConfig = {}
|
||||
function ReengagementTaskCtrl:Refresh(nCurTog)
|
||||
if nCurTog ~= AllEnum.ReengagementTog.Task then
|
||||
return
|
||||
end
|
||||
self:RefreshQuestList()
|
||||
end
|
||||
function ReengagementTaskCtrl: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 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
|
||||
return a.Id < b.Id
|
||||
end
|
||||
return a.nStatus < b.nStatus
|
||||
end)
|
||||
for k, v in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(v)
|
||||
self.tbGridCtrl[k] = nil
|
||||
end
|
||||
if nil ~= self.tbQuestList then
|
||||
self.nPageCount = 0
|
||||
self._mapNode.loopSv:SetAnim(0.06)
|
||||
self._mapNode.loopSv:Init(#self.tbQuestList, 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)
|
||||
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
|
||||
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
|
||||
end
|
||||
end
|
||||
local nSelectGroup = self.actData:GetCanReceiveRewardGroup()
|
||||
if 0 == nSelectGroup then
|
||||
nSelectGroup = self.nMaxOpenGroup
|
||||
end
|
||||
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()
|
||||
if nHour < 1 then
|
||||
v:SetTime(orderedFormat(ConfigTable.GetUIText("PerActivity_Quest_Open_Time_2") or "", 1))
|
||||
else
|
||||
v:SetTime(orderedFormat(ConfigTable.GetUIText("PerActivity_Quest_Open_Time_1") or "", nHour))
|
||||
end
|
||||
end
|
||||
end
|
||||
if nil == self._panel.nSelectGroup then
|
||||
self._panel.nSelectGroup = nSelectGroup
|
||||
end
|
||||
self._mapNode.PerActGroupItem[self._panel.nSelectGroup]:SetSelect(true)
|
||||
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")
|
||||
end
|
||||
self.tbGridCtrl[nInstanceId]:SetData(self.nActId, self.tbQuestList[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 = {}
|
||||
local ForeachActivity = function(mapData)
|
||||
table.insert(self.tbQuestActive, mapData)
|
||||
end
|
||||
ForEachTableLine(ConfigTable.Get("DailyQuestActive"), ForeachActivity)
|
||||
table.sort(self.tbQuestActive, function(a, b)
|
||||
return a.Active < b.Active
|
||||
end)
|
||||
local nMaxAct = self.tbQuestActive[#self.tbQuestActive].Active
|
||||
self.tbCanReceiveAct = {}
|
||||
for k, v in ipairs(self.tbQuestActive) do
|
||||
if self._mapNode.btnNodeItem[k] ~= nil then
|
||||
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 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)
|
||||
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
|
||||
anim:Play("Empty")
|
||||
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
|
||||
self._panel.nSelectGroup = nil
|
||||
end
|
||||
self.nActId = actData:GetActId()
|
||||
self.bQuestAnim = false
|
||||
self:InitGroupList()
|
||||
local tbAllQuestList = self.actData:GetQuestListByGroup()
|
||||
if nil == tbAllQuestList[self._panel.nSelectGroup] 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
|
||||
end
|
||||
end
|
||||
function ReengagementTaskCtrl:Awake()
|
||||
self.tbGridCtrl = {}
|
||||
self.tbSequences = {}
|
||||
end
|
||||
function ReengagementTaskCtrl:FadeIn()
|
||||
end
|
||||
function ReengagementTaskCtrl:FadeOut()
|
||||
end
|
||||
function ReengagementTaskCtrl:OnEnable()
|
||||
end
|
||||
function ReengagementTaskCtrl:OnDisable()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ReengagementTaskCtrl:OnDestroy()
|
||||
end
|
||||
function ReengagementTaskCtrl:OnRelease()
|
||||
end
|
||||
function ReengagementTaskCtrl:OnBtnClick_Group(_, nIndex)
|
||||
if self._panel.nSelectGroup == nIndex then
|
||||
return
|
||||
end
|
||||
if nIndex > self.nMaxOpenGroup then
|
||||
return
|
||||
end
|
||||
if nil == self.tbAllQuestList[nIndex] or nil == next(self.tbAllQuestList[nIndex]) then
|
||||
printError(string.format("当前任务组下没有任务!!! 活动id = %d, 任务组 = %s", self.nActId, nIndex))
|
||||
return
|
||||
end
|
||||
self._mapNode.PerActGroupItem[self._panel.nSelectGroup]:SetSelect(false)
|
||||
if nil ~= self._mapNode.PerActGroupItem[nIndex] then
|
||||
self._mapNode.PerActGroupItem[nIndex]:SetSelect(true)
|
||||
end
|
||||
self._panel.nSelectGroup = nIndex
|
||||
self.bQuestAnim = true
|
||||
self:RefreshQuestList()
|
||||
end
|
||||
function ReengagementTaskCtrl:OnBtnClick_GroupLock()
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PerActivity_Not_Open"))
|
||||
end
|
||||
function ReengagementTaskCtrl: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 ReengagementTaskCtrl:OnBtnClick_QuickRec()
|
||||
local callback = function()
|
||||
EventManager.Hit("RefreshPeriodicAct", self.nActId)
|
||||
PlayerData.Base:TryOpenWorldClassUpgrade()
|
||||
end
|
||||
PlayerData.Activity:SendReceivePerQuest(self.nActId, 0, callback)
|
||||
end
|
||||
return ReengagementTaskCtrl
|
||||
@@ -0,0 +1,56 @@
|
||||
local ReengagementTaskGroupCtrl = class("ReengagementTaskGroupCtrl", BaseCtrl)
|
||||
ReengagementTaskGroupCtrl._mapNodeConfig = {
|
||||
goNormal = {},
|
||||
goSelect = {},
|
||||
goLock = {},
|
||||
txt_Group = {sComponentName = "TMP_Text", nCount = 3},
|
||||
goTime = {},
|
||||
txtOpenTime = {sComponentName = "TMP_Text"},
|
||||
redDotGroup = {},
|
||||
imgComplete = {}
|
||||
}
|
||||
ReengagementTaskGroupCtrl._mapEventConfig = {}
|
||||
function ReengagementTaskGroupCtrl:Init(nActId, nGroup, nCurGroup)
|
||||
self.nActId = nActId
|
||||
self.nGroup = nGroup
|
||||
for _, v in ipairs(self._mapNode.txt_Group) do
|
||||
NovaAPI.SetTMPText(v, self.nGroup)
|
||||
end
|
||||
self._mapNode.goNormal.gameObject:SetActive(true)
|
||||
self._mapNode.goSelect.gameObject:SetActive(false)
|
||||
self._mapNode.goLock.gameObject:SetActive(false)
|
||||
self._mapNode.goTime.gameObject:SetActive(false)
|
||||
self._mapNode.redDotGroup.gameObject:SetActive(false)
|
||||
self.bUnlock = nGroup <= nCurGroup
|
||||
self:SetSelect(false)
|
||||
self._mapNode.goNormal.gameObject:SetActive(nGroup <= nCurGroup)
|
||||
self._mapNode.goLock.gameObject:SetActive(nCurGroup < nGroup)
|
||||
self:RegisterRedDot()
|
||||
end
|
||||
function ReengagementTaskGroupCtrl:RegisterRedDot()
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Reengagement_Task_Group, {
|
||||
self.nActId,
|
||||
self.nGroup
|
||||
}, self._mapNode.redDotGroup)
|
||||
end
|
||||
function ReengagementTaskGroupCtrl:SetTime(sTime)
|
||||
self._mapNode.goTime.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtOpenTime, sTime)
|
||||
end
|
||||
function ReengagementTaskGroupCtrl:SetSelect(bSelect)
|
||||
self.bSelect = bSelect
|
||||
self._mapNode.goNormal.gameObject:SetActive(not self.bSelect)
|
||||
self._mapNode.goSelect.gameObject:SetActive(self.bSelect)
|
||||
end
|
||||
function ReengagementTaskGroupCtrl:RefreshStatus(bAllReceived)
|
||||
self._mapNode.imgComplete.gameObject:SetActive(bAllReceived and self.bUnlock)
|
||||
end
|
||||
function ReengagementTaskGroupCtrl:Awake()
|
||||
end
|
||||
function ReengagementTaskGroupCtrl:OnDisable()
|
||||
end
|
||||
function ReengagementTaskGroupCtrl:OnDestroy()
|
||||
end
|
||||
function ReengagementTaskGroupCtrl:OnRelease()
|
||||
end
|
||||
return ReengagementTaskGroupCtrl
|
||||
@@ -67,12 +67,12 @@ function ActivityListCtrl:InitActivityList(nCurActId)
|
||||
})
|
||||
end
|
||||
if nil ~= self.tbActList then
|
||||
if nil ~= self.nSelectActId and nil ~= self.nSelectActMainType then
|
||||
if nil ~= self._panel.nSelectActId and nil ~= self.nSelectActMainType then
|
||||
local actData
|
||||
if self.nSelectActMainType == AllEnum.ActivityMainType.Activity then
|
||||
actData = PlayerData.Activity:GetActivityDataById(self.nSelectActId)
|
||||
actData = PlayerData.Activity:GetActivityDataById(self._panel.nSelectActId)
|
||||
elseif self.nSelectActMainType == AllEnum.ActivityMainType.ActivityGroup then
|
||||
actData = PlayerData.Activity:GetActivityGroupDataById(self.nSelectActId)
|
||||
actData = PlayerData.Activity:GetActivityGroupDataById(self._panel.nSelectActId)
|
||||
end
|
||||
local bOpen = false
|
||||
if nil ~= actData then
|
||||
@@ -87,12 +87,12 @@ function ActivityListCtrl:InitActivityList(nCurActId)
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_2")
|
||||
})
|
||||
self.nSelectActId = nil
|
||||
self._panel.nSelectActId = nil
|
||||
end
|
||||
end
|
||||
self.nSelectIndex = 1
|
||||
if self.nSelectActId ~= nil or nCurActId ~= nil then
|
||||
local nActId = self.nSelectActId == nil and nCurActId or self.nSelectActId
|
||||
if self._panel.nSelectActId ~= nil or nCurActId ~= nil then
|
||||
local nActId = self._panel.nSelectActId == nil and nCurActId or self._panel.nSelectActId
|
||||
for k, actData in ipairs(self.tbActList) do
|
||||
local actId = actData.nType == AllEnum.ActivityMainType.Activity and actData.actData:GetActId() or actData.actData:GetActGroupId()
|
||||
if nil ~= nActId and actId == nActId then
|
||||
@@ -453,7 +453,7 @@ function ActivityListCtrl:RefreshSelectActivity(bResetDay)
|
||||
end
|
||||
self.nSelectActMainType = actData.nType
|
||||
if actData.nType == AllEnum.ActivityMainType.Activity then
|
||||
self.nSelectActId = actData.actData:GetActId()
|
||||
self._panel.nSelectActId = actData.actData:GetActId()
|
||||
local actType = actData.actData:GetActType()
|
||||
if actType == GameEnum.activityType.PeriodicQuest then
|
||||
self:AddPeriodicActivityCtrl(actData.actData, bResetDay)
|
||||
@@ -485,12 +485,12 @@ function ActivityListCtrl:RefreshSelectActivity(bResetDay)
|
||||
self:AddSoldierActivityCtrl(actData.actData)
|
||||
end
|
||||
elseif actData.nType == AllEnum.ActivityMainType.ActivityGroup then
|
||||
self.nSelectActId = actData.actData:GetActGroupId()
|
||||
self._panel.nSelectActId = actData.actData:GetActGroupId()
|
||||
self:AddActivityGroupCtrl(actData.actData)
|
||||
end
|
||||
if self.nSelectActId ~= nil then
|
||||
LocalData.SetPlayerLocalData("Activity_Tab_New_" .. self.nSelectActId, 1)
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_New_Tab, self.nSelectActId, false)
|
||||
if self._panel.nSelectActId ~= nil then
|
||||
LocalData.SetPlayerLocalData("Activity_Tab_New_" .. self._panel.nSelectActId, 1)
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_New_Tab, self._panel.nSelectActId, false)
|
||||
end
|
||||
end
|
||||
function ActivityListCtrl:FadeIn()
|
||||
@@ -499,7 +499,6 @@ function ActivityListCtrl:FadeIn()
|
||||
end
|
||||
function ActivityListCtrl:Awake()
|
||||
self.nSelectIndex = nil
|
||||
self.nSelectActId = nil
|
||||
self.nInitActId = nil
|
||||
self.bPlayAnim = true
|
||||
self.tbInitActIds = {}
|
||||
|
||||
@@ -6,6 +6,7 @@ ActivityListPanel._tbDefine = {
|
||||
}
|
||||
}
|
||||
function ActivityListPanel:Awake()
|
||||
self.nSelectActId = nil
|
||||
end
|
||||
function ActivityListPanel:OnEnable()
|
||||
end
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
local ActivityCultivationManual_10111PopUpCtrl = class("ActivityCultivationManual_10111PopUpCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivityCultivationManual_10111PopUpCtrl._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"
|
||||
}
|
||||
}
|
||||
ActivityCultivationManual_10111PopUpCtrl._mapEventConfig = {}
|
||||
function ActivityCultivationManual_10111PopUpCtrl: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 ActivityCultivationManual_10111PopUpCtrl:PlayOpenAnim()
|
||||
if self.anim then
|
||||
self.anim:Play("open", 0, 0)
|
||||
end
|
||||
end
|
||||
function ActivityCultivationManual_10111PopUpCtrl:RefreshDate()
|
||||
local nOpenMonth = tonumber(os.date("%m", self.nOpenTime))
|
||||
local nOpenDay = tonumber(os.date("%d", self.nOpenTime))
|
||||
local nOpenYear = tonumber(os.date("%Y", self.nOpenTime))
|
||||
local nEndMonth = tonumber(os.date("%m", self.nEndTime))
|
||||
local nEndDay = tonumber(os.date("%d", self.nEndTime))
|
||||
local nEndYear = tonumber(os.date("%Y", self.nEndTime))
|
||||
local strOpenDay = string.format("%d", nOpenDay)
|
||||
local strEndDay = string.format("%d", nEndDay)
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
|
||||
end
|
||||
function ActivityCultivationManual_10111PopUpCtrl: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 ActivityCultivationManual_10111PopUpCtrl: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 ActivityCultivationManual_10111PopUpCtrl: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 ActivityCultivationManual_10111PopUpCtrl: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 ActivityCultivationManual_10111PopUpCtrl
|
||||
@@ -47,7 +47,8 @@ function ActivityJointDrillPopUpCtrl:ShowPopUp(actId, callback, index)
|
||||
return
|
||||
end
|
||||
self.nOpenTime = actData:GetChallengeStartTime()
|
||||
self.nEndTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actCfg.EndTime)
|
||||
self.nEndTime = actData:GetChallengeEndTime()
|
||||
self.nActEndTime = actData:GetActEndTime()
|
||||
self:RefreshTimeout()
|
||||
self:RefreshDate()
|
||||
if nil == self.remainTimer then
|
||||
@@ -64,10 +65,11 @@ function ActivityJointDrillPopUpCtrl:PlayOpenAnim()
|
||||
end
|
||||
end
|
||||
function ActivityJointDrillPopUpCtrl: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 nOffset = ClientManager.serverTimeZone * 3600
|
||||
local nOpenMonth = tonumber(os.date("!%m", self.nOpenTime + nOffset))
|
||||
local nOpenDay = tonumber(os.date("!%d", self.nOpenTime + nOffset))
|
||||
local nEndMonth = tonumber(os.date("!%m", self.nEndTime + nOffset))
|
||||
local nEndDay = tonumber(os.date("!%d", self.nEndTime + nOffset))
|
||||
local strOpenDay = string.format("%d", nOpenDay)
|
||||
local strEndDay = string.format("%d", nEndDay)
|
||||
local dateStr = string.format("%s/%s ~ %s/%s", nOpenMonth, strOpenDay, nEndMonth, strEndDay)
|
||||
@@ -77,11 +79,12 @@ function ActivityJointDrillPopUpCtrl:RefreshTimeout()
|
||||
local endTime = self.nEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
if remainTime <= 0 then
|
||||
if self.remainTimer ~= nil then
|
||||
self.remainTimer:Cancel()
|
||||
self.remainTimer = nil
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, ConfigTable.GetUIText("JointDrill_Act_Challenge_End"))
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
@@ -142,7 +145,7 @@ function ActivityJointDrillPopUpCtrl:OnBtnClick_Goto()
|
||||
if nil ~= self.nCurActId then
|
||||
PopUpManager.InterruptPopUp(self.popUpIndex)
|
||||
PlayerData.Activity:SendActivityDetailMsg()
|
||||
local endTime = self.nEndTime
|
||||
local endTime = self.nActEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime <= 0 then
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
local ActivityLongestDay_10112PopUpCtrl = class("ActivityLongestDay_10112PopUpCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivityLongestDay_10112PopUpCtrl._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"
|
||||
}
|
||||
}
|
||||
ActivityLongestDay_10112PopUpCtrl._mapEventConfig = {}
|
||||
function ActivityLongestDay_10112PopUpCtrl: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 ActivityLongestDay_10112PopUpCtrl:PlayOpenAnim()
|
||||
if self.anim then
|
||||
self.anim:Play("open", 0, 0)
|
||||
end
|
||||
end
|
||||
function ActivityLongestDay_10112PopUpCtrl:RefreshDate()
|
||||
local nOpenMonth = tonumber(os.date("%m", self.nOpenTime))
|
||||
local nOpenDay = tonumber(os.date("%d", self.nOpenTime))
|
||||
local nEndMonth = tonumber(os.date("%m", self.nEndTime))
|
||||
local nEndDay = tonumber(os.date("%d", self.nEndTime))
|
||||
local strOpenDay = string.format("%d", nOpenDay)
|
||||
local strEndDay = string.format("%d", nEndDay)
|
||||
local dateStr = string.format("%s/%s ~ %s/%s", nOpenMonth, strOpenDay, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
|
||||
end
|
||||
function ActivityLongestDay_10112PopUpCtrl: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 ActivityLongestDay_10112PopUpCtrl: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 ActivityLongestDay_10112PopUpCtrl: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 ActivityLongestDay_10112PopUpCtrl: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 ActivityLongestDay_10112PopUpCtrl
|
||||
@@ -0,0 +1,103 @@
|
||||
local ActivityReengagement_101004PopUpCtrl = class("ActivityReengagement_101004PopUpCtrl", BaseCtrl)
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivityReengagement_101004PopUpCtrl._mapNodeConfig = {
|
||||
txtTips = {
|
||||
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"
|
||||
},
|
||||
btnRewardItem = {
|
||||
nCount = 4,
|
||||
sNodeName = "goRewardItem",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickBtnRewardItem"
|
||||
},
|
||||
rtBtn = {}
|
||||
}
|
||||
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
|
||||
return
|
||||
end
|
||||
self._mapNode.rtBtn:SetActive(false)
|
||||
self.tbItemReward = {}
|
||||
for i = 1, #self._mapNode.goRewardItem do
|
||||
local item = self._mapNode.goRewardItem[i]
|
||||
item:SetItem(self.actCfg.reward[i])
|
||||
end
|
||||
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
|
||||
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
|
||||
self.anim = self.gameObject:GetComponent("Animator")
|
||||
self:PlayOpenAnim()
|
||||
end
|
||||
function ActivityReengagement_101004PopUpCtrl:PlayOpenAnim()
|
||||
if self.anim then
|
||||
self.anim:Play("open", 0, 0)
|
||||
end
|
||||
end
|
||||
function ActivityReengagement_101004PopUpCtrl:ClosePopUp(callback)
|
||||
if self.anim ~= nil then
|
||||
self.anim:Play("close", 0, 0)
|
||||
self:AddTimer(1, 0.1, function()
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.1)
|
||||
elseif callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function ActivityReengagement_101004PopUpCtrl:OnBtnClick_Close()
|
||||
self:ClosePopUp(self.callback)
|
||||
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 curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime <= 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Invalid_Tip_3"))
|
||||
if self.callback ~= nil then
|
||||
self.callback()
|
||||
end
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityPopUp)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ActivityList, self.nCurActId)
|
||||
end
|
||||
end
|
||||
self:ClosePopUp(callback)
|
||||
end
|
||||
function ActivityReengagement_101004PopUpCtrl:OnClickBtnRewardItem(btn, index)
|
||||
UTILS.ClickItemGridWithTips(self.tbItemReward[index], self._mapNode.goRewardItem[index].transform, true, true, false)
|
||||
end
|
||||
return ActivityReengagement_101004PopUpCtrl
|
||||
@@ -3,7 +3,14 @@ OurRegimentTaskPanel._sUIResRootPath = "UI_Activity/"
|
||||
OurRegimentTaskPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10101/Task.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10101.Task.OurRegimentTaskCtrl"
|
||||
sCtrlName = "Game.UI.ActivityTheme.TaskCommon.TaskCommonCtrl_01"
|
||||
}
|
||||
}
|
||||
local tbImgDbType = {SizeDelta = 1, FillAmount = 2}
|
||||
function OurRegimentTaskPanel:Awake()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" and tbParam[3] == nil then
|
||||
tbParam[3] = tbImgDbType.SizeDelta
|
||||
end
|
||||
end
|
||||
return OurRegimentTaskPanel
|
||||
|
||||
@@ -3,7 +3,14 @@ DreamTaskPanel._sUIResRootPath = "UI_Activity/"
|
||||
DreamTaskPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10102/Task.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10102.Task.DreamTaskCtrl"
|
||||
sCtrlName = "Game.UI.ActivityTheme.TaskCommon.TaskCommonCtrl_01"
|
||||
}
|
||||
}
|
||||
local tbImgDbType = {SizeDelta = 1, FillAmount = 2}
|
||||
function DreamTaskPanel:Awake()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" and tbParam[3] == nil then
|
||||
tbParam[3] = tbImgDbType.SizeDelta
|
||||
end
|
||||
end
|
||||
return DreamTaskPanel
|
||||
|
||||
@@ -3,7 +3,14 @@ MiracleTaskPanel._sUIResRootPath = "UI_Activity/"
|
||||
MiracleTaskPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10103/Task.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10103.Task.MiracleTaskCtrl"
|
||||
sCtrlName = "Game.UI.ActivityTheme.TaskCommon.TaskCommonCtrl_01"
|
||||
}
|
||||
}
|
||||
local tbImgDbType = {SizeDelta = 1, FillAmount = 2}
|
||||
function MiracleTaskPanel:Awake()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" and tbParam[3] == nil then
|
||||
tbParam[3] = tbImgDbType.SizeDelta
|
||||
end
|
||||
end
|
||||
return MiracleTaskPanel
|
||||
|
||||
@@ -3,7 +3,14 @@ SpringTaskPanel._sUIResRootPath = "UI_Activity/"
|
||||
SpringTaskPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10104/Task.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10104.Task.SpringTaskCtrl"
|
||||
sCtrlName = "Game.UI.ActivityTheme.TaskCommon.TaskCommonCtrl_01"
|
||||
}
|
||||
}
|
||||
local tbImgDbType = {SizeDelta = 1, FillAmount = 2}
|
||||
function SpringTaskPanel:Awake()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" and tbParam[3] == nil then
|
||||
tbParam[3] = tbImgDbType.SizeDelta
|
||||
end
|
||||
end
|
||||
return SpringTaskPanel
|
||||
|
||||
@@ -3,7 +3,14 @@ WinterNightTaskPanel._sUIResRootPath = "UI_Activity/"
|
||||
WinterNightTaskPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10105/Task.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10105.Task.WinterNightTaskCtrl"
|
||||
sCtrlName = "Game.UI.ActivityTheme.TaskCommon.TaskCommonCtrl_01"
|
||||
}
|
||||
}
|
||||
local tbImgDbType = {SizeDelta = 1, FillAmount = 2}
|
||||
function WinterNightTaskPanel:Awake()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" and tbParam[3] == nil then
|
||||
tbParam[3] = tbImgDbType.SizeDelta
|
||||
end
|
||||
end
|
||||
return WinterNightTaskPanel
|
||||
|
||||
@@ -3,7 +3,14 @@ PostalTaskPanel._sUIResRootPath = "UI_Activity/"
|
||||
PostalTaskPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10106/Task.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10106.Task.PostalTaskCtrl"
|
||||
sCtrlName = "Game.UI.ActivityTheme.TaskCommon.TaskCommonCtrl_01"
|
||||
}
|
||||
}
|
||||
local tbImgDbType = {SizeDelta = 1, FillAmount = 2}
|
||||
function PostalTaskPanel:Awake()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" and tbParam[3] == nil then
|
||||
tbParam[3] = tbImgDbType.SizeDelta
|
||||
end
|
||||
end
|
||||
return PostalTaskPanel
|
||||
|
||||
@@ -139,7 +139,7 @@ function GunStormTaskCtrl:BuildData(nActivityId)
|
||||
nStatus = taskData.nStatus,
|
||||
sDesc = mapData.Desc,
|
||||
nRarity = mapData.Rarity,
|
||||
nJumpTo = mapData.JumpTo,
|
||||
tbJumpTo = mapData.JumpTo,
|
||||
nCur = taskData.nCur,
|
||||
nMax = taskData.nMax,
|
||||
tbTaskRewardId = {},
|
||||
@@ -318,11 +318,11 @@ function GunStormTaskCtrl:onGridRefresh_Task(go)
|
||||
_tr.localScale = Vector3.zero
|
||||
end
|
||||
end
|
||||
tr:Find("tmpUndone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 >= mapTask.nJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("tmpUndone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 >= #mapTask.tbJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnDone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Complete and Vector3.one or Vector3.zero
|
||||
tr:Find("btnDone"):GetChild(0).name = tostring(mapTask.nTaskId)
|
||||
tr:Find("btnJump").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 < mapTask.nJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnJump"):GetChild(0).name = tostring(mapTask.nJumpTo)
|
||||
tr:Find("btnJump").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 < #mapTask.tbJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnJump"):GetChild(0).name = tostring(nIndex)
|
||||
tr:Find("goDone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Received and Vector3.one or Vector3.zero
|
||||
end
|
||||
function GunStormTaskCtrl:onEvent_ClickRewardItem(goBtn)
|
||||
@@ -345,9 +345,12 @@ function GunStormTaskCtrl:onEvent_ClickTaskDone(goBtn)
|
||||
end
|
||||
end
|
||||
function GunStormTaskCtrl:onEvent_ClickTaskJump(goBtn)
|
||||
local nJumpId = tonumber(goBtn.transform:GetChild(0).name)
|
||||
if nJumpId ~= nil and 0 < nJumpId then
|
||||
JumpUtil.JumpTo(nJumpId)
|
||||
local nIndex = tonumber(goBtn.transform:GetChild(0).name)
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local mapTask = mapData.tbTaskData[nIndex]
|
||||
local JumpToData = mapTask.tbJumpTo
|
||||
if JumpToData ~= nil and 0 < #JumpToData then
|
||||
JumpUtil.JumpToActivity(JumpToData)
|
||||
end
|
||||
end
|
||||
function GunStormTaskCtrl:refresh_Group()
|
||||
|
||||
@@ -615,7 +615,7 @@ function SummerAdvCtrl:OnBtn_ClickActivityEntrance(btn, nIndex)
|
||||
local func = function()
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId, self.nActId)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, 37, func)
|
||||
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)
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
local ActivityCultivationManualCtrl = class("ActivityCultivationManualCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivityCultivationManualCtrl._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 ActivityCultivationManualCtrl:Awake()
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityCultivationManualCtrl:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivityCultivationManualCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self:RefreshLockState()
|
||||
self:RefreshDate()
|
||||
self:RefreshTimeout()
|
||||
self:RefreshReward()
|
||||
end
|
||||
function ActivityCultivationManualCtrl:UnInit()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivityCultivationManualCtrl:UnbindCtrl()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityCultivationManualCtrl: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 ActivityCultivationManualCtrl: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 ActivityCultivationManualCtrl: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 ActivityCultivationManualCtrl: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 ActivityCultivationManualCtrl: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 ActivityCultivationManualCtrl: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 ActivityCultivationManualCtrl: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 ActivityCultivationManualCtrl: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 ActivityCultivationManualCtrl:ClearActivity()
|
||||
end
|
||||
return ActivityCultivationManualCtrl
|
||||
@@ -0,0 +1,159 @@
|
||||
local ActivityLevelsLvCtrl = class("ActivityLevelsLvCtrl", BaseCtrl)
|
||||
local lvIndexTitle = "{0}-{1}"
|
||||
local colorLockSelectImage = Color(0.23921568627450981, 0.27450980392156865, 0.3843137254901961, 1)
|
||||
local colorLockUnSelectImage = Color(0.4, 0.48627450980392156, 0.5647058823529412, 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 = {},
|
||||
AnimSwitch = {sComponentName = "Animator"},
|
||||
imgSlc = {},
|
||||
imgDeco4 = {},
|
||||
imgDeco5 = {},
|
||||
imgDeco6 = {},
|
||||
imgDeco7 = {}
|
||||
}
|
||||
function ActivityLevelsLvCtrl:InitData(parent, nType, activityData, data, isOpen, isLevelUnLock)
|
||||
self._mapNode.imgSlc:SetActive(false)
|
||||
local txtLockConditionTime = self._mapNode.bgCondition.transform:Find("txtLockCondition"):GetComponent("TMP_Text")
|
||||
if self.timerRun ~= nil then
|
||||
self.timerRun:Pause(true)
|
||||
self.timerRun = nil
|
||||
end
|
||||
self._mapNode.Select:SetActive(false)
|
||||
self.lvLock = false
|
||||
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"), "ff96b7", hour))
|
||||
elseif 0 < min then
|
||||
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color_Common"), "ff96b7", min))
|
||||
elseif 0 < sec then
|
||||
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color_Common"), "ff96b7", 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"), "ff96b7", day))
|
||||
end
|
||||
self.lvLock = true
|
||||
end
|
||||
local strTitle = ""
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
strTitle = orderedFormat(lvIndexTitle, 1, data.baseData.Difficulty)
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
strTitle = orderedFormat(lvIndexTitle, 2, data.baseData.Difficulty)
|
||||
elseif nType == GameEnum.ActivityLevelType.HARD then
|
||||
strTitle = orderedFormat(lvIndexTitle, 3, data.baseData.Difficulty)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_Select, strTitle)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_unSelect, strTitle)
|
||||
self._mapNode.tog.onClick:RemoveAllListeners()
|
||||
local clickCb = function()
|
||||
if self._mapNode.Select.activeSelf == true then
|
||||
return
|
||||
end
|
||||
self:SetDefault(true)
|
||||
parent:SetSelectObj(self)
|
||||
parent:RefreshInstanceInfo(nType, data.baseData.Difficulty, false)
|
||||
parent.activityLevelsData:ChangeRedDot(nType, data.baseData.Id)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
self._mapNode.tog.onClick:AddListener(clickCb)
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(parent.nActId)
|
||||
if bInActGroup then
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Explore_Level, {
|
||||
nActGroupId,
|
||||
data.baseData.Id
|
||||
}, self._mapNode.redH)
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure_Level, {
|
||||
nActGroupId,
|
||||
data.baseData.Id
|
||||
}, self._mapNode.redH)
|
||||
elseif nType == GameEnum.ActivityLevelType.HARD then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Hard_Level, {
|
||||
nActGroupId,
|
||||
data.baseData.Id
|
||||
}, self._mapNode.redH)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsLvCtrl:SetDefault(isOn)
|
||||
if self._mapNode.AnimSwitch.enabled == true then
|
||||
self._mapNode.AnimSwitch.enabled = false
|
||||
end
|
||||
if not isOn then
|
||||
self:ShowArrowAni(false)
|
||||
end
|
||||
self._mapNode.Select:SetActive(isOn)
|
||||
self._mapNode.imgSlc:SetActive(isOn)
|
||||
if isOn then
|
||||
self._mapNode.SelectAni:Play("10111_ActitvityLevels_Select")
|
||||
end
|
||||
if self.lvLock then
|
||||
NovaAPI.CtrlDotweenAnimation(self._mapNode.imgDeco4, 2)
|
||||
NovaAPI.CtrlDotweenAnimation(self._mapNode.imgDeco5, 2)
|
||||
NovaAPI.CtrlDotweenAnimation(self._mapNode.imgDeco6, 2)
|
||||
NovaAPI.CtrlDotweenAnimation(self._mapNode.imgDeco7, 2)
|
||||
end
|
||||
NovaAPI.CtrlDotweenAnimation(self._mapNode.imgDeco4, not (not isOn or self.lvLock) and 1 or 0)
|
||||
NovaAPI.CtrlDotweenAnimation(self._mapNode.imgDeco5, not (not isOn or self.lvLock) and 1 or 0)
|
||||
NovaAPI.CtrlDotweenAnimation(self._mapNode.imgDeco6, not (not isOn or self.lvLock) and 1 or 0)
|
||||
NovaAPI.CtrlDotweenAnimation(self._mapNode.imgDeco7, not (not isOn or self.lvLock) and 1 or 0)
|
||||
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(1, 1, 1, 1)
|
||||
local colorLockUnSelectImage = Color(0.23921568627450981, 0.27450980392156865, 0.3843137254901961, 1)
|
||||
local colorConditionsUnLock = Color(0.23921568627450981, 0.27450980392156865, 0.3843137254901961, 0.5)
|
||||
local colorConditionsLock = Color(0.23921568627450981, 0.27450980392156865, 0.3843137254901961, 1)
|
||||
local lvIndexTitle = "{0}-{1}"
|
||||
local twelveLvGroupPadding = {
|
||||
205,
|
||||
80,
|
||||
48,
|
||||
0
|
||||
}
|
||||
local twelveLvGroupPaddingOpen = {
|
||||
205,
|
||||
850,
|
||||
48,
|
||||
0
|
||||
}
|
||||
local fourLvGroupPadding = {
|
||||
400,
|
||||
50,
|
||||
48,
|
||||
0
|
||||
}
|
||||
local fourLvGroupPaddingOpen = {
|
||||
205,
|
||||
800,
|
||||
48,
|
||||
0
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
goEnemyInfo = {
|
||||
sCtrlName = "Game.UI.MainlineEx.MainlineMonsterInfoCtrl"
|
||||
},
|
||||
togTypeExplore = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TogTypeExplore"
|
||||
},
|
||||
togTypeExploreCtrl = {
|
||||
sNodeName = "togTypeExplore",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
lockExplore = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClick_BtnLockExplore"
|
||||
},
|
||||
redExplore = {},
|
||||
togTypeAdventure = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TogTypeAdventure"
|
||||
},
|
||||
togTypeAdventureCtrl = {
|
||||
sNodeName = "togTypeAdventure",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
lockAdventure = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClick_BtnLockAdventure"
|
||||
},
|
||||
redAdventure = {},
|
||||
togTypeHard = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TogTypeHard"
|
||||
},
|
||||
togTypeHardCtrl = {
|
||||
sNodeName = "togTypeHard",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
lockHard = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClick_BtnLockHard"
|
||||
},
|
||||
redHard = {},
|
||||
rtToggles = {
|
||||
sNodeName = "srToggle",
|
||||
sComponentName = "UIScrollRect"
|
||||
},
|
||||
rtTogglesTmp = {
|
||||
sNodeName = "rt_ToggleTmp",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
togRoot = {
|
||||
nCount = 12,
|
||||
sCtrlName = "Game.UI.ActivityTheme.10111.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
|
||||
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(-2580, self._mapNode.rt_ToggleTrans.localPosition.y, 0)
|
||||
else
|
||||
self._mapNode.rt_ToggleTrans.localPosition = Vector3(-380 * (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(-3350, moveTime)
|
||||
else
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-380 * (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(-1850, moveTime)
|
||||
else
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-380 * (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 < 3 then
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(0, moveTime)
|
||||
elseif 3 < nHard then
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-300, 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 = "10111/ActivityLevels/ActivityLevelsSelect.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10111.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,572 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local CultivationManualCtrl = class("CultivationManualCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local typeof = typeof
|
||||
local Animator = CS.UnityEngine.Animator
|
||||
CultivationManualCtrl._mapNodeConfig = {
|
||||
goBg = {sNodeName = "---Bg---"},
|
||||
btnEntrance_ = {
|
||||
nCount = 5,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickActivityEntrance"
|
||||
},
|
||||
imgRemaineTime = {},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtActivityDate = {sComponentName = "TMP_Text"},
|
||||
imgEnd = {},
|
||||
txtActivityEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgMiniGame = {sComponentName = "Image"},
|
||||
txtMiniGame = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Mini_Game_Cookie"
|
||||
},
|
||||
imgMiniGameEnd = {},
|
||||
txtMiniGameEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Mini_Game_Cookie"
|
||||
},
|
||||
txtMiniGame_End = {},
|
||||
txtTask = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Cookie_Act_QuestTitle"
|
||||
},
|
||||
txtTaskProgress = {sComponentName = "TMP_Text"},
|
||||
imgTaskActivityTime = {},
|
||||
txtTaskActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgStory = {sComponentName = "Image"},
|
||||
txtStory = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Story"
|
||||
},
|
||||
txtStory_End = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Story"
|
||||
},
|
||||
goStoryEnd = {},
|
||||
txtStoryEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtMiniGameEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtTaskEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtShopEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtShop = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Btn_Shop"
|
||||
},
|
||||
imgShopActivityTime = {},
|
||||
txtShopActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtLevel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Level"
|
||||
},
|
||||
txtLevel_End = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Level"
|
||||
},
|
||||
goLevelEnd = {},
|
||||
txtLevelEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgLevelActivityUnlockTime = {},
|
||||
txtLevelActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgLevelEnd = {},
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
imgMiniGameActivityUnlockTime = {},
|
||||
txtMiniGameActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgTaskEnd = {},
|
||||
txtTaskEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Cookie_Act_QuestTitle"
|
||||
},
|
||||
txtTaskProgress_End = {},
|
||||
imgTaskActivityUnlockTime = {},
|
||||
txtTaskActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgStoryActivityTime = {},
|
||||
txtStoryActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgStoryActivityUnlockTime = {},
|
||||
txtStoryActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgShopActivityUnlockTime = {},
|
||||
txtShopActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgLevelActivityTime = {},
|
||||
txtLevelActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgMiniGameActivityTime = {},
|
||||
txtMiniGameActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgFateCard = {sComponentName = "Image"},
|
||||
txtFateCard = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Fate_Card_20102"
|
||||
},
|
||||
imgFateCardEnd = {},
|
||||
txtFateCardEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Fate_Card_20102"
|
||||
},
|
||||
txtFateCard_End = {},
|
||||
goFateCardEnd = {},
|
||||
imgFateCardActivityUnlockTime = {},
|
||||
txtFateCardActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgFateCardActivityTime = {},
|
||||
txtFateCardActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtShopEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Btn_Shop"
|
||||
},
|
||||
imgShopEnd = {},
|
||||
txtShop_End = {},
|
||||
txtTaskProgressEnd = {sComponentName = "TMP_Text"},
|
||||
dbTaskEnd = {},
|
||||
miniGameRedDot = {},
|
||||
redDotEntrance2 = {},
|
||||
storyRedDot = {},
|
||||
reddotLevel = {},
|
||||
reddotFatecard = {},
|
||||
goMiniGameEnd = {},
|
||||
imgStoryEnd = {}
|
||||
}
|
||||
CultivationManualCtrl._mapEventConfig = {}
|
||||
local ActivityState = {
|
||||
NotOpen = 1,
|
||||
Open = 2,
|
||||
Closed = 3
|
||||
}
|
||||
function CultivationManualCtrl: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 CultivationManualCtrl:OnEnable()
|
||||
self:RefreshPanel()
|
||||
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
|
||||
local bOld = LocalData.GetPlayerLocalData("Activity_MiniGame_10111_New") or state ~= ActivityState.Open
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_GroupNew_MiniGame, {
|
||||
self.nActId
|
||||
}, not bOld)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_MiniGame, {
|
||||
self.nActId
|
||||
}, self._mapNode.miniGameRedDot)
|
||||
end
|
||||
end
|
||||
end
|
||||
local sAnimName = "CultivationManualPanel_Full"
|
||||
local sSoundName = "mode_10111_activity"
|
||||
if self.animRoot ~= nil then
|
||||
self.animRoot = self.gameObject:GetComponent(typeof(Animator))
|
||||
sAnimName = "CultivationManualPanel_Pullback"
|
||||
sSoundName = "mode_10111_activity_1"
|
||||
end
|
||||
self.animRoot = self.gameObject:GetComponent(typeof(Animator))
|
||||
if self.animRoot ~= nil then
|
||||
self.animRoot:Play(sAnimName, 0, 0)
|
||||
end
|
||||
CS.WwiseAudioManager.Instance:PlaySound(sSoundName)
|
||||
end
|
||||
function CultivationManualCtrl: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 CultivationManualCtrl:RefreshPanel()
|
||||
if self.ActData == nil or self.ActivityGroupCfg == nil then
|
||||
return
|
||||
end
|
||||
self:RefreshTime()
|
||||
self:RefreshButtonState()
|
||||
end
|
||||
function CultivationManualCtrl: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 CultivationManualCtrl: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 CultivationManualCtrl: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 CultivationManualCtrl: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 CultivationManualCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans, refreshFunc)
|
||||
local countDowmTimer
|
||||
local activityId = actData.ActivityId
|
||||
local state, bShowCountDown, openTime, endTime = self.ActData:GetActivityEntranceTimerData(activityId)
|
||||
if state == ActivityState.NotOpen then
|
||||
if nil == timer and openTime ~= nil then
|
||||
local fcTimer = function()
|
||||
local 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 endTime ~= nil and timer == nil and bShowCountDown then
|
||||
self:RefreshRemainTime(endTime, txtTrans)
|
||||
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
|
||||
return state, bShowCountDown, countDowmTimer
|
||||
end
|
||||
function CultivationManualCtrl:RefreshMiniGameButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
self:RefreshMiniGameButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.minigameRemainTimer, self._mapNode.txtMiniGameActivityTime, self._mapNode.imgMiniGameActivityUnlockTime, refreshFunc)
|
||||
if self.minigameRemainTimer == nil then
|
||||
self.minigameRemainTimer = countDowmTimer
|
||||
end
|
||||
self._mapNode.imgMiniGameActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.imgMiniGameActivityTime.gameObject:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgMiniGameEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtMiniGame_End:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtMiniGameEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.goMiniGameEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
if state ~= ActivityState.Open then
|
||||
end
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function CultivationManualCtrl: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.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 CultivationManualCtrl: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.imgStoryActivityTime, 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
|
||||
local nDotweenStatus = state == ActivityState.Closed and 0 or 1
|
||||
NovaAPI.CtrlDotweenAnimation(self._mapNode.btnEntrance_[AllEnum.ActivityThemeFuncIndex.Story].gameObject, nDotweenStatus)
|
||||
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 CultivationManualCtrl: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
|
||||
local nDotweenStatus = state == ActivityState.Closed and 0 or 1
|
||||
NovaAPI.CtrlDotweenAnimation(self._mapNode.btnEntrance_[AllEnum.ActivityThemeFuncIndex.Level].gameObject, nDotweenStatus)
|
||||
self._mapNode.imgLevelActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgLevelActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.imgLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.goLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtLevel_End.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function CultivationManualCtrl:RefreshShopButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
self:RefreshShopButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.shopRemainTimer, self._mapNode.txtShopActivityTime, self._mapNode.imgShopActivityUnlockTime, refreshFunc)
|
||||
if self.shopRemainTimer == nil then
|
||||
self.shopRemainTimer = countDowmTimer
|
||||
end
|
||||
self._mapNode.imgShopActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgShopActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.txtShopEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgShopEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtShop_End:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function CultivationManualCtrl:RefreshFateCardButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
self:RefreshFateCardButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.fateCardRemainTimer, self._mapNode.txtFateCardActivityTime, self._mapNode.imgFateCardActivityUnlockTime, refreshFunc)
|
||||
if self.fateCardRemainTimer == nil then
|
||||
self.fateCardRemainTimer = countDowmTimer
|
||||
end
|
||||
self._mapNode.imgFateCardActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.imgFateCardActivityTime.gameObject:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgFateCardEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtFateCard_End:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtFateCardEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.goFateCardEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.dbFateCardEnd:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function CultivationManualCtrl: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 CultivationManualCtrl:RefreshActivityData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
self:AddTimer(1, 3, self.RequireActiviyData, true, true, true)
|
||||
end
|
||||
function CultivationManualCtrl:OnBtn_ClickActivityEntrance(btn, nIndex)
|
||||
local actData = self.ActData:GetActivityDataByIndex(nIndex)
|
||||
if actData == nil then
|
||||
return
|
||||
end
|
||||
local bOpen, _state, _sTips, bNeedRefreshData = self.ActData:CheckActivityEntranceOpen(actData.ActivityId, actData.PanelId, true, self.bRequiredActData)
|
||||
if not bOpen then
|
||||
if bNeedRefreshData then
|
||||
self:RequireActiviyData()
|
||||
end
|
||||
return
|
||||
end
|
||||
local nRandomTransitionId = math.random(50, 51)
|
||||
self.ActData:OpenActivityEntrance(actData.ActivityId, actData.PanelId, nRandomTransitionId)
|
||||
end
|
||||
return CultivationManualCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local CultivationManualPanel = class("CultivationManualPanel", BasePanel)
|
||||
CultivationManualPanel._sUIResRootPath = "UI_Activity/"
|
||||
CultivationManualPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10111/CultivationManualPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10111.CultivationManualCtrl"
|
||||
}
|
||||
}
|
||||
function CultivationManualPanel:Awake()
|
||||
end
|
||||
function CultivationManualPanel:OnEnable()
|
||||
end
|
||||
function CultivationManualPanel:OnDisable()
|
||||
end
|
||||
function CultivationManualPanel:OnDestroy()
|
||||
end
|
||||
function CultivationManualPanel:OnRelease()
|
||||
end
|
||||
return CultivationManualPanel
|
||||
@@ -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_cultivationmanual_shop_" .. AllEnum.FrameColor_New[mapItemCfg.Rarity]
|
||||
self:SetActivityAtlasSprite_New(self._mapNode.imgRare, "10111/SpriteAtlas/10111" .. "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 = "10111/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,377 @@
|
||||
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"
|
||||
},
|
||||
ctlAvgRoot = {
|
||||
sNodeName = "goAvgInfoRoot",
|
||||
sCtrlName = "Game.UI.ActivityTheme.ActivityAvgInfoExCtrl"
|
||||
},
|
||||
t_fullscreen_blur_black = {},
|
||||
btnsnapshot = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtn_ClickCloseLevelInfoPanel"
|
||||
},
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
goChapterComplete = {},
|
||||
snapshot_complete = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickCloseCompete"
|
||||
},
|
||||
ctlgoEnemyInfo = {
|
||||
sNodeName = "goEnemyInfo",
|
||||
sCtrlName = "Game.UI.MainlineEx.MainlineMonsterInfoCtrl"
|
||||
}
|
||||
}
|
||||
CultivationManualStoryCtrl._mapEventConfig = {
|
||||
Story_Done = "OnEvent_Story_Done",
|
||||
SelectMainlineBattle = "OnEvent_SelectMainlineBattle",
|
||||
Story_RewardClosed = "OnEvent_Activity_Story_RewardClosed"
|
||||
}
|
||||
local UnlockConditionPriority = {
|
||||
[1] = "MustStoryIds",
|
||||
[2] = "OneofStoryIds",
|
||||
[3] = "MustEvIds",
|
||||
[4] = "OneofEvIds",
|
||||
[5] = "WorldLevel",
|
||||
[6] = "MustAchievementIds",
|
||||
[7] = "MustActivityLevel"
|
||||
}
|
||||
local BRANCH_GRID_INDEX = 0
|
||||
local BRANCH_COUNT = 0
|
||||
function CultivationManualStoryCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.storyNodePos = {0, -66.1}
|
||||
self.tbGridTimer = {}
|
||||
self.tbPlayedAnim = {}
|
||||
self.nScrollTime = 0.5
|
||||
self.bInit = false
|
||||
end
|
||||
function CultivationManualStoryCtrl:OnEnable()
|
||||
self:RefreshPanel()
|
||||
end
|
||||
function CultivationManualStoryCtrl:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
function CultivationManualStoryCtrl:OnDisable()
|
||||
end
|
||||
function CultivationManualStoryCtrl:RefreshPanel()
|
||||
self:RefreshStoryList()
|
||||
end
|
||||
function CultivationManualStoryCtrl:RefreshStoryList()
|
||||
self.tbPlayedAnim = {}
|
||||
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
|
||||
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
|
||||
return
|
||||
end
|
||||
local recentStoryId = ActivityAvgData:GetRecentStoryId(self.nChapterId)
|
||||
local recentIndex = 1
|
||||
for i = 1, #self.tbAllStory do
|
||||
if self.tbAllStory[i] == recentStoryId then
|
||||
recentIndex = i
|
||||
break
|
||||
end
|
||||
end
|
||||
local scrollIndex = recentIndex
|
||||
if 0 < BRANCH_COUNT then
|
||||
local branchEnd = BRANCH_GRID_INDEX + BRANCH_COUNT - 1
|
||||
if recentIndex >= BRANCH_GRID_INDEX and recentIndex <= branchEnd then
|
||||
scrollIndex = BRANCH_GRID_INDEX
|
||||
elseif recentIndex > branchEnd then
|
||||
scrollIndex = recentIndex - (BRANCH_COUNT - 1)
|
||||
end
|
||||
end
|
||||
self.curIndex = recentIndex
|
||||
self._mapNode.svStory:SetAnim(0.07)
|
||||
local branchCount = 0 < BRANCH_COUNT and BRANCH_COUNT - 1 or 0
|
||||
self._mapNode.svStory:Init(#self.tbAllStory - branchCount, self, self.OnRefreshGrid)
|
||||
local time = self.bInit and 0 or self.nScrollTime
|
||||
self:AddTimer(1, 0.1, function()
|
||||
self._mapNode.svStory:SetScrollGridPos(scrollIndex, time, 0)
|
||||
self.bInit = true
|
||||
end, true, true, true)
|
||||
end
|
||||
function CultivationManualStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchIndex)
|
||||
local storyId = self.tbAllStory[gridIndex]
|
||||
local avgcfg = ConfigTable.GetData("ActivityStory", storyId)
|
||||
local goInstanceID = grid:GetInstanceID()
|
||||
local btnGrid = grid.transform:Find("btnGrid"):GetComponent("UIButton")
|
||||
local RootNode = grid.transform:Find("btnGrid/AnimRoot/RootNode")
|
||||
local imgStory = bBranch and RootNode:Find("imgStory/imgBg2"):GetComponent("Image") or RootNode:Find("imgStory"):GetComponent("Image")
|
||||
local goNotOpen = RootNode:Find("goNotOpen").gameObject
|
||||
local txtLevel = RootNode:Find("txtIndex"):GetComponent("TMP_Text")
|
||||
local imgStoryTitleBg = grid.transform:Find("btnGridText/scale_on_click/imgStoryTitle")
|
||||
local imgBattleTitleBg = grid.transform:Find("btnGridText/scale_on_click/imgBattleTitle")
|
||||
local txtBattleTitle = imgBattleTitleBg:Find("txtPlot"):GetComponent("TMP_Text")
|
||||
local txtStoryTitle = imgStoryTitleBg:Find("txtPlot"):GetComponent("TMP_Text")
|
||||
local RedDot = RootNode:Find("RedDot").gameObject
|
||||
local goLock = RootNode:Find("goLockState").gameObject
|
||||
local goComplete = grid.transform:Find("btnGridText/scale_on_click/grpTitle/goComplete").gameObject
|
||||
local goImgTime = grid.transform:Find("btnGridText/scale_on_click/imgTime")
|
||||
local txtTime = goImgTime:Find("txtTime"):GetComponent("TMP_Text")
|
||||
local txtTitle = bBranch and RootNode:Find("tmpGroupDone"):GetComponent("TMP_Text") or grid.transform:Find("btnGridText/scale_on_click/grpTitle/tmpGroupDone"):GetComponent("TMP_Text")
|
||||
local txtComplete = goComplete.transform:Find("imgBg/txtComplete"):GetComponent("TMP_Text")
|
||||
local btnGridText = grid.transform:Find("btnGridText")
|
||||
local imgDb = btnGridText:Find("scale_on_click/grpTitle/imgDb")
|
||||
local grpTitle = btnGridText:Find("scale_on_click/grpTitle")
|
||||
NovaAPI.SetTMPText(txtComplete, ConfigTable.GetUIText("RoguelikeBuild_Manage_FilterPass"))
|
||||
if avgcfg.IsBattle then
|
||||
NovaAPI.SetTMPText(txtBattleTitle, ConfigTable.GetUIText("Story_BattleTitle"))
|
||||
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 nIndex = 0
|
||||
if isUnlock then
|
||||
nIndex = bBranch and BRANCH_GRID_INDEX or gridIndex
|
||||
if nIndex > BRANCH_GRID_INDEX then
|
||||
nIndex = nIndex - (BRANCH_COUNT - 1)
|
||||
end
|
||||
end
|
||||
local branchSuffix = bBranch and string.char(string.byte("a") + nBranchIndex - 1) or ""
|
||||
local bShowImgStory = not bBranch or not not isUnlock
|
||||
imgStory.gameObject:SetActive(bShowImgStory)
|
||||
if bShowImgStory then
|
||||
if bOpen and isUnlock then
|
||||
self:SetPngSprite(imgStory, avgcfg.Icon .. branchSuffix)
|
||||
else
|
||||
self:SetPngSprite(imgStory, string.format("Icon/ActivityStory/ep_event12_00"))
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(txtTitle, avgcfg.Title)
|
||||
NovaAPI.SetTMPText(txtLevel, avgcfg.Index)
|
||||
txtLevel.gameObject:SetActive(not bBranch or not not isUnlock)
|
||||
txtTitle.gameObject:SetActive(isUnlock and bOpen)
|
||||
goImgTime.gameObject:SetActive(not bOpen)
|
||||
goComplete.gameObject:SetActive(isUnlock and isReaded and bOpen)
|
||||
goLock.gameObject:SetActive(not isUnlock and bOpen)
|
||||
goNotOpen.gameObject:SetActive(not bOpen or bBranch and not isUnlock)
|
||||
imgBattleTitleBg.gameObject:SetActive(avgcfg.IsBattle and isUnlock and bOpen)
|
||||
imgStoryTitleBg.gameObject:SetActive(not avgcfg.IsBattle and isUnlock and bOpen)
|
||||
imgDb.gameObject:SetActive(bOpen)
|
||||
grpTitle.gameObject:SetActive(bOpen and isUnlock)
|
||||
if not bOpen then
|
||||
local strTime = self:GetRemainTimeStr(nOpenTime, avgcfg.DayOpen)
|
||||
if self.tbGridTimer[goInstanceID] ~= nil then
|
||||
self.tbGridTimer[goInstanceID]:Cancel()
|
||||
self.tbGridTimer[goInstanceID] = nil
|
||||
end
|
||||
self.tbGridTimer[goInstanceID] = self:AddTimer(0, 1, function()
|
||||
local strTimeNew, bLock = self:GetRemainTimeStr(nOpenTime, avgcfg.DayOpen)
|
||||
if bLock then
|
||||
NovaAPI.SetTMPText(txtTime, strTimeNew)
|
||||
else
|
||||
self:RefreshStoryList()
|
||||
end
|
||||
end, true, true, true)
|
||||
NovaAPI.SetTMPText(txtTime, strTime)
|
||||
end
|
||||
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
|
||||
nActGroupId,
|
||||
self.nActId,
|
||||
avgcfg.Id
|
||||
}, RedDot, nil, nil, true)
|
||||
local clickFuc = function()
|
||||
if not bOpen or self.bCantClick then
|
||||
return
|
||||
end
|
||||
if isUnlock then
|
||||
local bNew = not isReaded
|
||||
self.avgId = avgcfg.StoryId
|
||||
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
|
||||
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
|
||||
self.curIndex = gridIndex
|
||||
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
|
||||
ActivityAvgData:RefreshAvgRedDot()
|
||||
elseif tbResult ~= nil then
|
||||
local lockTxt = ""
|
||||
for i = 1, #tbResult do
|
||||
local value = tbResult[i]
|
||||
if value[1] == false then
|
||||
if UnlockConditionPriority[i] == "MustStoryIds" then
|
||||
do
|
||||
local tbStoryIds = value[2]
|
||||
for k, v in pairs(tbStoryIds) do
|
||||
if v == false then
|
||||
local storyData = ConfigTable.GetData("ActivityStory", k)
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "OneofStoryIds" then
|
||||
do
|
||||
local tbStoryIds = value[2]
|
||||
for k, v in pairs(tbStoryIds) do
|
||||
if v == false then
|
||||
local storyData = ConfigTable.GetData("ActivityStory", k)
|
||||
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if lockTxt == "" then
|
||||
for k, _v in pairs(tbStoryIds) do
|
||||
local storyData = ConfigTable.GetData("ActivityStory", k)
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "MustEvIds" then
|
||||
lockTxt = ConfigTable.GetUIText("Story_UnlockClueCondition")
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "OneofEvIds" then
|
||||
lockTxt = ConfigTable.GetUIText("Story_UnlockClueCondition")
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "WorldLevel" then
|
||||
do
|
||||
local level = value[2]
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockWorldLv") or "", level)
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "MustAchievementIds" then
|
||||
if self.bHasAchievementData == true then
|
||||
local tbAchievementList = value[2]
|
||||
for k, v in pairs(tbAchievementList) do
|
||||
if v == false then
|
||||
local achievementId = k
|
||||
local achievement = ConfigTable.GetData("Achievement", achievementId)
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockAchievement") or "", achievement.Title) .. "\n" .. "(" .. achievement.Desc .. ")"
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "MustActivityLevel" then
|
||||
local levelId = value[2]
|
||||
if 0 < levelId then
|
||||
local levelData = ConfigTable.GetData("ActivityLevelsLevel", levelId)
|
||||
if levelData then
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("ActivityStory_UnlockActivityLevel"), levelData.Name)
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = lockTxt
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
end
|
||||
btnGrid.onClick:RemoveAllListeners()
|
||||
btnGrid.onClick:AddListener(clickFuc)
|
||||
local anim = grid:GetComponent("Animator")
|
||||
if anim ~= nil then
|
||||
if isUnlock and bOpen then
|
||||
anim:Play("svStory_in")
|
||||
else
|
||||
anim:Play("svStoryNotOpen_in")
|
||||
end
|
||||
end
|
||||
for i = 1, 3 do
|
||||
local imgFlower = RootNode:Find("imgFlower" .. i .. "/imgFlower" .. i)
|
||||
local state = bOpen and isUnlock and 1 or 0
|
||||
NovaAPI.CtrlDotweenAnimation(imgFlower.gameObject, state)
|
||||
end
|
||||
end
|
||||
function CultivationManualStoryCtrl:OnRefreshGrid(grid, index)
|
||||
local gridIndex = index + 1
|
||||
local normalRoot = grid.transform:Find("Normal")
|
||||
local branchRoot = grid.transform:Find("Branch")
|
||||
if 0 < BRANCH_GRID_INDEX and gridIndex == BRANCH_GRID_INDEX then
|
||||
for i = 1, BRANCH_COUNT do
|
||||
local branchGrid = branchRoot:Find("tog" .. i)
|
||||
self:RefreshGridInfo(branchGrid.gameObject, gridIndex + i - 1, true, i)
|
||||
end
|
||||
normalRoot.gameObject:SetActive(false)
|
||||
branchRoot.gameObject:SetActive(true)
|
||||
else
|
||||
if 0 < BRANCH_COUNT and gridIndex > BRANCH_GRID_INDEX then
|
||||
gridIndex = gridIndex + (BRANCH_COUNT - 1)
|
||||
end
|
||||
self:RefreshGridInfo(normalRoot.gameObject, gridIndex, false)
|
||||
normalRoot.gameObject:SetActive(true)
|
||||
branchRoot.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function CultivationManualStoryCtrl:GetRemainTimeStr(nOpenTime, openDay)
|
||||
local timeStr = ""
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local openTime = CS.ClientManager.Instance:GetNextRefreshTime(nOpenTime) - 86400
|
||||
local nRemainTime = openTime + openDay * 86400 - curTime
|
||||
local day = math.floor(nRemainTime / 86400)
|
||||
local hour = math.floor(nRemainTime / 3600)
|
||||
local min = math.floor((nRemainTime - hour * 3600) / 60)
|
||||
local sec = nRemainTime - hour * 3600 - min * 60
|
||||
if 0 < day then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Day_Color_Common"), "FFF0DB", day)
|
||||
elseif 0 < hour then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour_Color_Common"), "FFF0DB", hour)
|
||||
elseif 0 < min then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color_Common"), "FFF0DB", min)
|
||||
elseif 0 < sec then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color_Common"), "FFF0DB", sec)
|
||||
end
|
||||
return timeStr, 0 < nRemainTime
|
||||
end
|
||||
function CultivationManualStoryCtrl:OnBtn_ClickBack()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.CultivationManualStory_10111)
|
||||
end
|
||||
function CultivationManualStoryCtrl:OnBtn_ClickHome()
|
||||
PanelManager.Home()
|
||||
end
|
||||
function CultivationManualStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
|
||||
self._mapNode.t_fullscreen_blur_black:SetActive(false)
|
||||
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
|
||||
self._mapNode.goChapterComplete:SetActive(false)
|
||||
end
|
||||
function CultivationManualStoryCtrl:OnEvent_Story_Done(bHasReward)
|
||||
self:RefreshPanel()
|
||||
if bHasReward then
|
||||
self.bCantClick = true
|
||||
end
|
||||
end
|
||||
function CultivationManualStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
|
||||
local OpenPanel = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
|
||||
end
|
||||
if bConfirm then
|
||||
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
|
||||
end
|
||||
end
|
||||
function CultivationManualStoryCtrl:OnEvent_Activity_Story_RewardClosed()
|
||||
self.bCantClick = false
|
||||
if self.curIndex == #self.tbAllStory then
|
||||
self._mapNode.goChapterComplete:SetActive(true)
|
||||
end
|
||||
end
|
||||
function CultivationManualStoryCtrl:OnBtn_ClickCloseCompete()
|
||||
self._mapNode.goChapterComplete:SetActive(false)
|
||||
end
|
||||
return CultivationManualStoryCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local CultivationManualStoryPanel = class("CultivationManualStoryPanel", BasePanel)
|
||||
CultivationManualStoryPanel._sUIResRootPath = "UI_Activity/"
|
||||
CultivationManualStoryPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10111/Story/CultivationManualStoryPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10111.Story.CultivationManualStoryCtrl"
|
||||
}
|
||||
}
|
||||
function CultivationManualStoryPanel:Awake()
|
||||
end
|
||||
function CultivationManualStoryPanel:OnEnable()
|
||||
end
|
||||
function CultivationManualStoryPanel:OnDisable()
|
||||
end
|
||||
function CultivationManualStoryPanel:OnDestroy()
|
||||
end
|
||||
function CultivationManualStoryPanel:OnRelease()
|
||||
end
|
||||
return CultivationManualStoryPanel
|
||||
@@ -0,0 +1,16 @@
|
||||
local CultivationManualTaskPanel = class("CultivationManualTaskPanel", BasePanel)
|
||||
CultivationManualTaskPanel._sUIResRootPath = "UI_Activity/"
|
||||
CultivationManualTaskPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10111/Task.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.TaskCommon.TaskCommonCtrl_01"
|
||||
}
|
||||
}
|
||||
local tbImgDbType = {SizeDelta = 1, FillAmount = 2}
|
||||
function CultivationManualTaskPanel:Awake()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" and tbParam[3] == nil then
|
||||
tbParam[3] = tbImgDbType.FillAmount
|
||||
end
|
||||
end
|
||||
return CultivationManualTaskPanel
|
||||
@@ -0,0 +1,151 @@
|
||||
local ActivityLevelsLvCtrl = class("ActivityLevelsLvCtrl", BaseCtrl)
|
||||
local lvIndexTitle = "{0}-{1}"
|
||||
local colorLockSelectImage = Color(0.9803921568627451, 0.9803921568627451, 0.9803921568627451, 1)
|
||||
local colorLockUnSelectImage = Color(0.9803921568627451, 0.9803921568627451, 0.9803921568627451, 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"), "08d3d4", hour))
|
||||
elseif 0 < min then
|
||||
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color_Common"), "08d3d4", min))
|
||||
elseif 0 < sec then
|
||||
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color_Common"), "08d3d4", sec))
|
||||
end
|
||||
end
|
||||
timerCount()
|
||||
self.timerRun = self:AddTimer(0, 1, function()
|
||||
timerCount()
|
||||
end, true, true, false)
|
||||
else
|
||||
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Day_Color_Common"), "08d3d4", day))
|
||||
end
|
||||
self.lvLock = true
|
||||
end
|
||||
local strTitle = ""
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
strTitle = orderedFormat(lvIndexTitle, 1, data.baseData.Difficulty)
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
strTitle = orderedFormat(lvIndexTitle, 2, data.baseData.Difficulty)
|
||||
elseif nType == GameEnum.ActivityLevelType.HARD then
|
||||
strTitle = orderedFormat(lvIndexTitle, 3, data.baseData.Difficulty)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_Select, strTitle)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_unSelect, strTitle)
|
||||
self._mapNode.tog.onClick:RemoveAllListeners()
|
||||
local clickCb = function()
|
||||
if self._mapNode.Select.activeSelf == true then
|
||||
return
|
||||
end
|
||||
self:SetDefault(true)
|
||||
parent:SetSelectObj(self)
|
||||
parent:RefreshInstanceInfo(nType, data.baseData.Difficulty, false)
|
||||
parent.activityLevelsData:ChangeRedDot(nType, data.baseData.Id)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
self._mapNode.tog.onClick:AddListener(clickCb)
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(parent.nActId)
|
||||
if bInActGroup then
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Explore_Level, {
|
||||
nActGroupId,
|
||||
data.baseData.Id
|
||||
}, self._mapNode.redH)
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure_Level, {
|
||||
nActGroupId,
|
||||
data.baseData.Id
|
||||
}, self._mapNode.redH)
|
||||
elseif nType == GameEnum.ActivityLevelType.HARD then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Hard_Level, {
|
||||
nActGroupId,
|
||||
data.baseData.Id
|
||||
}, self._mapNode.redH)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsLvCtrl:SetDefault(isOn)
|
||||
if 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 not self.lvLock and isOn then
|
||||
self._mapNode.SelectAni:Play("10112_ActitvityLevels_Select")
|
||||
end
|
||||
end
|
||||
function ActivityLevelsLvCtrl:ShowArrowAni(isShow)
|
||||
end
|
||||
function ActivityLevelsLvCtrl:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
function ActivityLevelsLvCtrl:OnDisable()
|
||||
if self.timerRun ~= nil then
|
||||
self.timerRun:Pause(true)
|
||||
self.timerRun = nil
|
||||
end
|
||||
end
|
||||
return ActivityLevelsLvCtrl
|
||||
@@ -0,0 +1,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.054901960784313725, 0.054901960784313725, 0.054901960784313725, 1)
|
||||
local colorLockUnSelectImage = Color(0.9803921568627451, 0.9803921568627451, 0.9803921568627451, 1)
|
||||
local colorConditionsUnLock = Color(0.9803921568627451, 0.9803921568627451, 0.9803921568627451, 0.5)
|
||||
local colorConditionsLock = Color(0.9803921568627451, 0.9803921568627451, 0.9803921568627451, 1)
|
||||
local lvIndexTitle = "{0}-{1}"
|
||||
local twelveLvGroupPadding = {
|
||||
86,
|
||||
50,
|
||||
50,
|
||||
0
|
||||
}
|
||||
local twelveLvGroupPaddingOpen = {
|
||||
86,
|
||||
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.10112.ActivityLevels.TemplateToggleCtrl10112"
|
||||
},
|
||||
lockExplore = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClick_BtnLockExplore"
|
||||
},
|
||||
redExplore = {},
|
||||
togTypeAdventure = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TogTypeAdventure"
|
||||
},
|
||||
togTypeAdventureCtrl = {
|
||||
sNodeName = "togTypeAdventure",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10112.ActivityLevels.TemplateToggleCtrl10112"
|
||||
},
|
||||
lockAdventure = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClick_BtnLockAdventure"
|
||||
},
|
||||
redAdventure = {},
|
||||
togTypeHard = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TogTypeHard"
|
||||
},
|
||||
togTypeHardCtrl = {
|
||||
sNodeName = "togTypeHard",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10112.ActivityLevels.TemplateToggleCtrl10112"
|
||||
},
|
||||
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.10112.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
|
||||
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(-3758, 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(-3758, 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(-2054, 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(-350, 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 = "10112/ActivityLevels/ActivityLevelsSelect.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10112.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,68 @@
|
||||
local TemplateToggleCtrl10112 = class("TemplateToggleCtrl10112", BaseCtrl)
|
||||
TemplateToggleCtrl10112._mapNodeConfig = {
|
||||
AnimSwitch = {sComponentName = "Animator"},
|
||||
txt_Select = {sComponentName = "TMP_Text"},
|
||||
txt_unSelect = {sComponentName = "TMP_Text"},
|
||||
Select = {},
|
||||
unSelect = {},
|
||||
SelectLine = {}
|
||||
}
|
||||
TemplateToggleCtrl10112._mapEventConfig = {}
|
||||
function TemplateToggleCtrl10112:SetText(sText)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_Select, sText)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_unSelect, sText)
|
||||
end
|
||||
function TemplateToggleCtrl10112: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.SelectLine:SetActive(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 TemplateToggleCtrl10112: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 TemplateToggleCtrl10112: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.SelectLine:SetActive(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 TemplateToggleCtrl10112: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 TemplateToggleCtrl10112:ResetTrigger()
|
||||
if self._mapNode.AnimSwitch.enabled == false then
|
||||
self._mapNode.AnimSwitch.enabled = true
|
||||
end
|
||||
self._mapNode.AnimSwitch:ResetTrigger("tOff")
|
||||
end
|
||||
return TemplateToggleCtrl10112
|
||||
@@ -0,0 +1,173 @@
|
||||
local ActivityLongestDayCtrl = class("ActivityLongestDayCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivityLongestDayCtrl._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 ActivityLongestDayCtrl:Awake()
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityLongestDayCtrl:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivityLongestDayCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self:RefreshLockState()
|
||||
self:RefreshDate()
|
||||
self:RefreshTimeout()
|
||||
self:RefreshReward()
|
||||
end
|
||||
function ActivityLongestDayCtrl:UnInit()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivityLongestDayCtrl:UnbindCtrl()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityLongestDayCtrl: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 ActivityLongestDayCtrl: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 ActivityLongestDayCtrl: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 ActivityLongestDayCtrl: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 ActivityLongestDayCtrl: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 ActivityLongestDayCtrl: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 ActivityLongestDayCtrl: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 ActivityLongestDayCtrl: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 ActivityLongestDayCtrl:ClearActivity()
|
||||
end
|
||||
return ActivityLongestDayCtrl
|
||||
@@ -0,0 +1,546 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local LongestDayCtrl = class("LongestDayCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
LongestDayCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
goBg = {sNodeName = "---Bg---"},
|
||||
btnEntrance_ = {
|
||||
nCount = 5,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickActivityEntrance"
|
||||
},
|
||||
imgRemaineTime = {},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtActivityDate = {sComponentName = "TMP_Text"},
|
||||
imgEnd = {},
|
||||
txtActivityEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgMiniGame = {sComponentName = "Image"},
|
||||
imgMiniGameEnd = {},
|
||||
txtMiniGame = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Mini_Game_10112"
|
||||
},
|
||||
txtMiniGameEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Mini_Game_10112"
|
||||
},
|
||||
txtMiniGame_End = {},
|
||||
txtMiniGameEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgMiniGameActivityUnlockTime = {},
|
||||
txtMiniGameActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgMiniGameActivityTime = {},
|
||||
txtMiniGameActivityTime = {sComponentName = "TMP_Text"},
|
||||
dbMiniGame = {},
|
||||
dbMiniGameEnd = {},
|
||||
txtTask = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Task"
|
||||
},
|
||||
txtTaskProgress = {sComponentName = "TMP_Text"},
|
||||
imgTaskActivityTime = {},
|
||||
txtTaskActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtTaskEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgTaskEnd = {},
|
||||
txtTaskEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Task"
|
||||
},
|
||||
txtTaskProgress_End = {},
|
||||
imgTaskActivityUnlockTime = {},
|
||||
txtTaskActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
dbTaskEnd = {},
|
||||
txtTaskProgressEnd = {sComponentName = "TMP_Text"},
|
||||
dbTask = {},
|
||||
dbTaskEnd = {},
|
||||
txtStory1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Story1_10112"
|
||||
},
|
||||
txtStory1_End = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Story1_10112"
|
||||
},
|
||||
txtStory2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Story2_10112"
|
||||
},
|
||||
txtStory2_End = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Story2_10112"
|
||||
},
|
||||
goStoryEnd = {},
|
||||
txtStoryEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgStoryActivityTime = {},
|
||||
txtStoryActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgStoryActivityUnlockTime = {},
|
||||
txtStoryActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
dbStory = {},
|
||||
dbStoryEnd = {},
|
||||
txtShopEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtShop = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Shop"
|
||||
},
|
||||
txtShopEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Shop"
|
||||
},
|
||||
imgShopEnd = {},
|
||||
txtShop_End = {},
|
||||
imgShopActivityTime = {},
|
||||
txtShopActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgShopActivityUnlockTime = {},
|
||||
txtShopActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
dbShop = {},
|
||||
dbShopEnd = {},
|
||||
txtLevel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Level"
|
||||
},
|
||||
txtLevelShadow = {
|
||||
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"},
|
||||
imgLevelActivityTime = {},
|
||||
txtLevelActivityTime = {sComponentName = "TMP_Text"},
|
||||
grpBg = {},
|
||||
imgLevelEnd = {},
|
||||
miniGameRedDot = {},
|
||||
redDotEntrance2 = {},
|
||||
storyRedDot = {},
|
||||
reddotLevel = {},
|
||||
goMiniGameEnd = {},
|
||||
imgStoryEnd = {}
|
||||
}
|
||||
LongestDayCtrl._mapEventConfig = {}
|
||||
local ActivityState = {
|
||||
NotOpen = 1,
|
||||
Open = 2,
|
||||
Closed = 3
|
||||
}
|
||||
function LongestDayCtrl: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 LongestDayCtrl:OnEnable()
|
||||
self:RefreshPanel()
|
||||
for i = 1, 6 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.FateCard then
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_PenguinCard_Level, {
|
||||
self.nActId
|
||||
}, self._mapNode.reddotFatecard)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.MiniGame then
|
||||
local bOld = LocalData.GetPlayerLocalData("Activity_MiniGame_10112_New") or state ~= ActivityState.Open
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_GroupNew_MiniGame, {
|
||||
self.nActId
|
||||
}, not bOld)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_MiniGame, {
|
||||
self.nActId
|
||||
}, self._mapNode.miniGameRedDot)
|
||||
end
|
||||
end
|
||||
end
|
||||
local sAnimName = "LongestDayPanel_Full"
|
||||
local sAudioName = "Mode_10112_activity"
|
||||
if self.animRoot ~= nil then
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
sAnimName = "LongestDayPanel_Pullback"
|
||||
sAudioName = "Mode_10112_activity_01"
|
||||
end
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
self.animRoot:Play(sAnimName, 0, 0)
|
||||
WwiseAudioMgr:PostEvent(sAudioName)
|
||||
end
|
||||
function LongestDayCtrl: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 LongestDayCtrl:RefreshPanel()
|
||||
if self.ActData == nil or self.ActivityGroupCfg == nil then
|
||||
return
|
||||
end
|
||||
self:RefreshTime()
|
||||
self:RefreshButtonState()
|
||||
end
|
||||
function LongestDayCtrl: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 LongestDayCtrl: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 LongestDayCtrl: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 LongestDayCtrl: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)
|
||||
end
|
||||
end
|
||||
self:RefreshStoryButtonState()
|
||||
end
|
||||
function LongestDayCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans, refreshFunc)
|
||||
local countDowmTimer
|
||||
local activityId = actData.ActivityId
|
||||
local state, bShowCountDown, openTime, endTime = self.ActData:GetActivityEntranceTimerData(activityId)
|
||||
if state == ActivityState.NotOpen then
|
||||
if nil == timer and openTime ~= nil then
|
||||
local fcTimer = function()
|
||||
local 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 endTime ~= nil and timer == nil and bShowCountDown then
|
||||
self:RefreshRemainTime(endTime, txtTrans)
|
||||
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
|
||||
return state, bShowCountDown, countDowmTimer
|
||||
end
|
||||
function LongestDayCtrl:RefreshMiniGameButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
self:RefreshMiniGameButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.minigameRemainTimer, self._mapNode.txtMiniGameActivityTime, self._mapNode.imgMiniGameActivityUnlockTime, refreshFunc)
|
||||
if self.minigameRemainTimer == nil then
|
||||
self.minigameRemainTimer = countDowmTimer
|
||||
end
|
||||
self._mapNode.imgMiniGameActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.imgMiniGameActivityTime.gameObject:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgMiniGameEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtMiniGame_End:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtMiniGameEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.goMiniGameEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.dbMiniGame.gameObject:SetActive(state ~= ActivityState.Closed)
|
||||
self._mapNode.dbMiniGameEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
if state ~= ActivityState.Open then
|
||||
end
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function LongestDayCtrl: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.txtTaskEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.dbTask.gameObject:SetActive(state ~= ActivityState.Closed)
|
||||
self._mapNode.dbTaskEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtTaskProgressEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
local ActivityTaskData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local nDone, nTotal = 0, 0
|
||||
if ActivityTaskData ~= nil then
|
||||
nDone, nTotal = ActivityTaskData:CalcTotalProgress()
|
||||
end
|
||||
local progress = string.format("%d/%d", nDone, nTotal)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskProgress, progress)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskProgressEnd, progress)
|
||||
end
|
||||
end
|
||||
function LongestDayCtrl: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.goLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtLevel_End.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.grpBg:SetActive(state ~= ActivityState.Closed)
|
||||
self._mapNode.imgLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
local anim = self._mapNode.btnEntrance_[AllEnum.ActivityThemeFuncIndex.Level].transform:GetChild(0):GetComponent("Animator")
|
||||
anim.enabled = state == ActivityState.Open
|
||||
end
|
||||
end
|
||||
function LongestDayCtrl:RefreshShopButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
self:RefreshShopButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.shopRemainTimer, self._mapNode.txtShopActivityTime, self._mapNode.imgShopActivityUnlockTime, refreshFunc)
|
||||
if self.shopRemainTimer == nil then
|
||||
self.shopRemainTimer = countDowmTimer
|
||||
end
|
||||
self._mapNode.imgShopActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgShopActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.txtShopEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgShopEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtShop_End:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.dbShop:SetActive(state ~= ActivityState.Closed)
|
||||
self._mapNode.dbShopEnd:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function LongestDayCtrl:RefreshStoryButtonState()
|
||||
self._mapNode.storyRedDot:SetActive(false)
|
||||
self._mapNode.imgStoryActivityTime:SetActive(false)
|
||||
self._mapNode.imgStoryActivityUnlockTime:SetActive(false)
|
||||
self._mapNode.goStoryEnd:SetActive(false)
|
||||
self._mapNode.imgStoryEnd:SetActive(false)
|
||||
self._mapNode.txtStory1_End.gameObject:SetActive(false)
|
||||
self._mapNode.txtStory2_End.gameObject:SetActive(false)
|
||||
self._mapNode.dbStory.gameObject:SetActive(true)
|
||||
self._mapNode.dbStoryEnd.gameObject:SetActive(false)
|
||||
end
|
||||
function LongestDayCtrl: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 LongestDayCtrl:RefreshActivityData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
self:AddTimer(1, 3, self.RequireActiviyData, true, true, true)
|
||||
end
|
||||
function LongestDayCtrl:OnBtn_ClickActivityEntrance(btn, nIndex)
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
local chapterId = 10
|
||||
local isUnlock = PlayerData.Avg:IsStoryChapterUnlock(chapterId)
|
||||
if isUnlock then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.MainlineEx, chapterId)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StoryChapter)
|
||||
end
|
||||
return
|
||||
end
|
||||
local actData = self.ActData:GetActivityDataByIndex(nIndex)
|
||||
if actData == nil then
|
||||
return
|
||||
end
|
||||
local bOpen, _state, _sTips, bNeedRefreshData = self.ActData:CheckActivityEntranceOpen(actData.ActivityId, actData.PanelId, true, self.bRequiredActData)
|
||||
if not bOpen then
|
||||
if bNeedRefreshData then
|
||||
self:RequireActiviyData()
|
||||
end
|
||||
return
|
||||
end
|
||||
self.ActData:OpenActivityEntrance(actData.ActivityId, actData.PanelId)
|
||||
end
|
||||
return LongestDayCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local LongestDayPanel = class("LongestDayPanel", BasePanel)
|
||||
LongestDayPanel._sUIResRootPath = "UI_Activity/"
|
||||
LongestDayPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10112/LongestDayPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10112.LongestDayCtrl"
|
||||
}
|
||||
}
|
||||
function LongestDayPanel:Awake()
|
||||
end
|
||||
function LongestDayPanel:OnEnable()
|
||||
end
|
||||
function LongestDayPanel:OnDisable()
|
||||
end
|
||||
function LongestDayPanel:OnDestroy()
|
||||
end
|
||||
function LongestDayPanel:OnRelease()
|
||||
end
|
||||
return LongestDayPanel
|
||||
@@ -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_longestday_shop_" .. AllEnum.FrameColor_New[mapItemCfg.Rarity]
|
||||
self:SetActivityAtlasSprite_New(self._mapNode.imgRare, "10112/SpriteAtlas/10112" .. "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 = "10112/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,16 @@
|
||||
local LongestDayTaskPanel = class("LongestDayTaskPanel", BasePanel)
|
||||
LongestDayTaskPanel._sUIResRootPath = "UI_Activity/"
|
||||
LongestDayTaskPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10112/Task.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.TaskCommon.TaskCommonCtrl_01"
|
||||
}
|
||||
}
|
||||
local tbImgDbType = {SizeDelta = 1, FillAmount = 2}
|
||||
function LongestDayTaskPanel:Awake()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" and tbParam[3] == nil then
|
||||
tbParam[3] = tbImgDbType.SizeDelta
|
||||
end
|
||||
end
|
||||
return LongestDayTaskPanel
|
||||
@@ -139,7 +139,7 @@ function ChristmasTaskCtrl:BuildData(nActivityId)
|
||||
nStatus = taskData.nStatus,
|
||||
sDesc = mapData.Desc,
|
||||
nRarity = mapData.Rarity,
|
||||
nJumpTo = mapData.JumpTo,
|
||||
tbJumpTo = mapData.JumpTo,
|
||||
nCur = taskData.nCur,
|
||||
nMax = taskData.nMax,
|
||||
tbTaskRewardId = {},
|
||||
@@ -334,11 +334,11 @@ function ChristmasTaskCtrl:onGridRefresh_Task(go)
|
||||
_tr.localScale = Vector3.zero
|
||||
end
|
||||
end
|
||||
tr:Find("tmpUndone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 >= mapTask.nJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("tmpUndone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 >= #mapTask.tbJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnDone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Complete and Vector3.one or Vector3.zero
|
||||
tr:Find("btnDone"):GetChild(0).name = tostring(mapTask.nTaskId)
|
||||
tr:Find("btnJump").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 < mapTask.nJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnJump"):GetChild(0).name = tostring(mapTask.nJumpTo)
|
||||
tr:Find("btnJump").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 < #mapTask.tbJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnJump"):GetChild(0).name = tostring(nIndex)
|
||||
tr:Find("goDone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Received and Vector3.one or Vector3.zero
|
||||
end
|
||||
function ChristmasTaskCtrl:onEvent_ClickRewardItem(goBtn)
|
||||
@@ -361,9 +361,12 @@ function ChristmasTaskCtrl:onEvent_ClickTaskDone(goBtn)
|
||||
end
|
||||
end
|
||||
function ChristmasTaskCtrl:onEvent_ClickTaskJump(goBtn)
|
||||
local nJumpId = tonumber(goBtn.transform:GetChild(0).name)
|
||||
if 0 < nJumpId then
|
||||
JumpUtil.JumpTo(nJumpId)
|
||||
local nIndex = tonumber(goBtn.transform:GetChild(0).name)
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local mapTask = mapData.tbTaskData[nIndex]
|
||||
local JumpToData = mapTask.tbJumpTo
|
||||
if JumpToData ~= nil and 0 < #JumpToData then
|
||||
JumpUtil.JumpToActivity(JumpToData)
|
||||
end
|
||||
end
|
||||
function ChristmasTaskCtrl:refresh_Group()
|
||||
|
||||
@@ -142,7 +142,7 @@ function SoloDanceTaskCtrl:BuildData(nActivityId)
|
||||
nStatus = taskData.nStatus,
|
||||
sDesc = mapData.Desc,
|
||||
nRarity = mapData.Rarity,
|
||||
nJumpTo = mapData.JumpTo,
|
||||
tbJumpTo = mapData.JumpTo,
|
||||
nCur = taskData.nCur,
|
||||
nMax = taskData.nMax,
|
||||
tbTaskRewardId = {},
|
||||
@@ -327,11 +327,11 @@ function SoloDanceTaskCtrl:onGridRefresh_Task(go)
|
||||
_tr.localScale = Vector3.zero
|
||||
end
|
||||
end
|
||||
tr:Find("tmpUndone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 >= mapTask.nJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("tmpUndone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 >= #mapTask.tbJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnDone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Complete and Vector3.one or Vector3.zero
|
||||
tr:Find("btnDone"):GetChild(0).name = tostring(mapTask.nTaskId)
|
||||
tr:Find("btnJump").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 < mapTask.nJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnJump"):GetChild(0).name = tostring(mapTask.nJumpTo)
|
||||
tr:Find("btnJump").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 < #mapTask.tbJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnJump"):GetChild(0).name = tostring(nIndex)
|
||||
tr:Find("goDone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Received and Vector3.one or Vector3.zero
|
||||
end
|
||||
function SoloDanceTaskCtrl:onEvent_ClickRewardItem(goBtn)
|
||||
@@ -354,9 +354,12 @@ function SoloDanceTaskCtrl:onEvent_ClickTaskDone(goBtn)
|
||||
end
|
||||
end
|
||||
function SoloDanceTaskCtrl:onEvent_ClickTaskJump(goBtn)
|
||||
local nJumpId = tonumber(goBtn.transform:GetChild(0).name)
|
||||
if 0 < nJumpId then
|
||||
JumpUtil.JumpTo(nJumpId)
|
||||
local nIndex = tonumber(goBtn.transform:GetChild(0).name)
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local mapTask = mapData.tbTaskData[nIndex]
|
||||
local JumpToData = mapTask.tbJumpTo
|
||||
if JumpToData ~= nil and 0 < #JumpToData then
|
||||
JumpUtil.JumpToActivity(JumpToData)
|
||||
end
|
||||
end
|
||||
function SoloDanceTaskCtrl:refresh_Group()
|
||||
|
||||
@@ -276,11 +276,12 @@ function SummerCheckinThemeCtrl:RegisterReddot()
|
||||
local nNeedWorldLevel = tonumber(activityData.LimitParam) or 0
|
||||
if nNeedWorldLevel > PlayerData.Base:GetWorldClass() then
|
||||
self._mapNode.reddotShow:SetActive(false)
|
||||
else
|
||||
RedDotManager.RegisterNode(RedDotDefine.TrekkerVersus, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.reddotShow)
|
||||
end
|
||||
RedDotManager.RegisterNode(RedDotDefine.TrekkerVersus, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.reddotShow)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.FateCard then
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_PenguinCard_Level, {
|
||||
self.nActId
|
||||
|
||||
@@ -139,7 +139,7 @@ function SummerCheckinTaskCtrl:BuildData(nActivityId)
|
||||
nStatus = taskData.nStatus,
|
||||
sDesc = mapData.Desc,
|
||||
nRarity = mapData.Rarity,
|
||||
nJumpTo = mapData.JumpTo,
|
||||
tbJumpTo = mapData.JumpTo,
|
||||
nCur = taskData.nCur,
|
||||
nMax = taskData.nMax,
|
||||
tbTaskRewardId = {},
|
||||
@@ -328,11 +328,11 @@ function SummerCheckinTaskCtrl:onGridRefresh_Task(go)
|
||||
_tr.localScale = Vector3.zero
|
||||
end
|
||||
end
|
||||
tr:Find("tmpUndone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 >= mapTask.nJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("tmpUndone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 >= #mapTask.tbJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnDone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Complete and Vector3.one or Vector3.zero
|
||||
tr:Find("btnDone"):GetChild(0).name = tostring(mapTask.nTaskId)
|
||||
tr:Find("btnJump").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 < mapTask.nJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnJump"):GetChild(0).name = tostring(mapTask.nJumpTo)
|
||||
tr:Find("btnJump").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 < #mapTask.tbJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnJump"):GetChild(0).name = tostring(nIndex)
|
||||
tr:Find("goDone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Received and Vector3.one or Vector3.zero
|
||||
end
|
||||
function SummerCheckinTaskCtrl:onEvent_ClickRewardItem(goBtn)
|
||||
@@ -355,9 +355,12 @@ function SummerCheckinTaskCtrl:onEvent_ClickTaskDone(goBtn)
|
||||
end
|
||||
end
|
||||
function SummerCheckinTaskCtrl:onEvent_ClickTaskJump(goBtn)
|
||||
local nJumpId = tonumber(goBtn.transform:GetChild(0).name)
|
||||
if 0 < nJumpId then
|
||||
JumpUtil.JumpTo(nJumpId)
|
||||
local nIndex = tonumber(goBtn.transform:GetChild(0).name)
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local mapTask = mapData.tbTaskData[nIndex]
|
||||
local JumpToData = mapTask.tbJumpTo
|
||||
if JumpToData ~= nil and 0 < #JumpToData then
|
||||
JumpUtil.JumpToActivity(JumpToData)
|
||||
end
|
||||
end
|
||||
function SummerCheckinTaskCtrl:refresh_Group()
|
||||
|
||||
@@ -120,7 +120,7 @@ function BreakOutTaskCtrl:BuildData(nActivityId)
|
||||
nStatus = taskData.nStatus,
|
||||
sDesc = mapData.Desc,
|
||||
nRarity = mapData.Rarity,
|
||||
nJumpTo = mapData.JumpTo,
|
||||
tbJumpTo = mapData.JumpTo,
|
||||
nCur = taskData.nCur,
|
||||
nMax = taskData.nMax,
|
||||
tbTaskRewardId = {},
|
||||
@@ -311,11 +311,11 @@ function BreakOutTaskCtrl:onGridRefresh_Task(go)
|
||||
_tr.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
tr:Find("tmpUndone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 >= mapTask.nJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("tmpUndone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 >= #mapTask.tbJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnDone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Complete and Vector3.one or Vector3.zero
|
||||
tr:Find("btnDone"):GetChild(0).name = tostring(mapTask.nTaskId)
|
||||
tr:Find("btnJump").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 < mapTask.nJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnJump"):GetChild(0).name = tostring(mapTask.nJumpTo)
|
||||
tr:Find("btnJump").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 < #mapTask.tbJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnJump"):GetChild(0).name = tostring(nIndex)
|
||||
tr:Find("goDone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Received and Vector3.one or Vector3.zero
|
||||
end
|
||||
function BreakOutTaskCtrl:onEvent_ClickRewardItem(goBtn)
|
||||
@@ -337,9 +337,12 @@ function BreakOutTaskCtrl:onEvent_ClickTaskDone(goBtn)
|
||||
end
|
||||
end
|
||||
function BreakOutTaskCtrl:onEvent_ClickTaskJump(goBtn)
|
||||
local nJumpId = tonumber(goBtn.transform:GetChild(0).name)
|
||||
if 0 < nJumpId then
|
||||
JumpUtil.JumpTo(nJumpId)
|
||||
local nIndex = tonumber(goBtn.transform:GetChild(0).name)
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local mapTask = mapData.tbTaskData[nIndex]
|
||||
local JumpToData = mapTask.tbJumpTo
|
||||
if JumpToData ~= nil and 0 < #JumpToData then
|
||||
JumpUtil.JumpToActivity(JumpToData)
|
||||
end
|
||||
end
|
||||
return BreakOutTaskCtrl
|
||||
|
||||
@@ -120,7 +120,7 @@ function BreakOutTaskCtrl:BuildData(nActivityId)
|
||||
nStatus = taskData.nStatus,
|
||||
sDesc = mapData.Desc,
|
||||
nRarity = mapData.Rarity,
|
||||
nJumpTo = mapData.JumpTo,
|
||||
tbJumpTo = mapData.JumpTo,
|
||||
nCur = taskData.nCur,
|
||||
nMax = taskData.nMax,
|
||||
tbTaskRewardId = {},
|
||||
@@ -311,11 +311,11 @@ function BreakOutTaskCtrl:onGridRefresh_Task(go)
|
||||
_tr.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
tr:Find("tmpUndone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 >= mapTask.nJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("tmpUndone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 >= #mapTask.tbJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnDone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Complete and Vector3.one or Vector3.zero
|
||||
tr:Find("btnDone"):GetChild(0).name = tostring(mapTask.nTaskId)
|
||||
tr:Find("btnJump").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 < mapTask.nJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnJump"):GetChild(0).name = tostring(mapTask.nJumpTo)
|
||||
tr:Find("btnJump").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 < #mapTask.tbJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnJump"):GetChild(0).name = tostring(nIndex)
|
||||
tr:Find("goDone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Received and Vector3.one or Vector3.zero
|
||||
end
|
||||
function BreakOutTaskCtrl:onEvent_ClickRewardItem(goBtn)
|
||||
@@ -337,9 +337,12 @@ function BreakOutTaskCtrl:onEvent_ClickTaskDone(goBtn)
|
||||
end
|
||||
end
|
||||
function BreakOutTaskCtrl:onEvent_ClickTaskJump(goBtn)
|
||||
local nJumpId = tonumber(goBtn.transform:GetChild(0).name)
|
||||
if 0 < nJumpId then
|
||||
JumpUtil.JumpTo(nJumpId)
|
||||
local nIndex = tonumber(goBtn.transform:GetChild(0).name)
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local mapTask = mapData.tbTaskData[nIndex]
|
||||
local JumpToData = mapTask.tbJumpTo
|
||||
if JumpToData ~= nil and 0 < #JumpToData then
|
||||
JumpUtil.JumpToActivity(JumpToData)
|
||||
end
|
||||
end
|
||||
return BreakOutTaskCtrl
|
||||
|
||||
@@ -120,7 +120,7 @@ function BreakOutTaskCtrl:BuildData(nActivityId)
|
||||
nStatus = taskData.nStatus,
|
||||
sDesc = mapData.Desc,
|
||||
nRarity = mapData.Rarity,
|
||||
nJumpTo = mapData.JumpTo,
|
||||
tbJumpTo = mapData.JumpTo,
|
||||
nCur = taskData.nCur,
|
||||
nMax = taskData.nMax,
|
||||
tbTaskRewardId = {},
|
||||
@@ -311,11 +311,11 @@ function BreakOutTaskCtrl:onGridRefresh_Task(go)
|
||||
_tr.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
tr:Find("tmpUndone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 >= mapTask.nJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("tmpUndone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 >= #mapTask.tbJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnDone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Complete and Vector3.one or Vector3.zero
|
||||
tr:Find("btnDone"):GetChild(0).name = tostring(mapTask.nTaskId)
|
||||
tr:Find("btnJump").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 < mapTask.nJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnJump"):GetChild(0).name = tostring(mapTask.nJumpTo)
|
||||
tr:Find("btnJump").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 < #mapTask.tbJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnJump"):GetChild(0).name = tostring(nIndex)
|
||||
tr:Find("goDone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Received and Vector3.one or Vector3.zero
|
||||
end
|
||||
function BreakOutTaskCtrl:onEvent_ClickRewardItem(goBtn)
|
||||
@@ -337,9 +337,12 @@ function BreakOutTaskCtrl:onEvent_ClickTaskDone(goBtn)
|
||||
end
|
||||
end
|
||||
function BreakOutTaskCtrl:onEvent_ClickTaskJump(goBtn)
|
||||
local nJumpId = tonumber(goBtn.transform:GetChild(0).name)
|
||||
if 0 < nJumpId then
|
||||
JumpUtil.JumpTo(nJumpId)
|
||||
local nIndex = tonumber(goBtn.transform:GetChild(0).name)
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local mapTask = mapData.tbTaskData[nIndex]
|
||||
local JumpToData = mapTask.tbJumpTo
|
||||
if JumpToData ~= nil and 0 < #JumpToData then
|
||||
JumpUtil.JumpToActivity(JumpToData)
|
||||
end
|
||||
end
|
||||
return BreakOutTaskCtrl
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
local ActivityBreakOutCtrl = class("ActivityBreakOutCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivityBreakOutCtrl._mapNodeConfig = {
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Go"
|
||||
},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
svReward = {
|
||||
sNodeName = "PreviewUpgradeMaterial",
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
txtAdvanceMat = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MessageBox_Reward"
|
||||
},
|
||||
txtDate = {sComponentName = "TMP_Text"},
|
||||
imgLock = {},
|
||||
txtLock = {sComponentName = "TMP_Text"},
|
||||
btnDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txtBtnDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Detail"
|
||||
},
|
||||
imgEnd = {},
|
||||
txtActivityEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgRemaineTime = {},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GoToChallenge"
|
||||
},
|
||||
imgProgressBg = {
|
||||
sNodeName = "imgProgressBg"
|
||||
},
|
||||
imgFill = {sNodeName = "imgFill"},
|
||||
txt_Target = {
|
||||
sNodeName = "txt_Target",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "ChallengingGoals"
|
||||
},
|
||||
txtProgress = {
|
||||
sNodeName = "txtProgress",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
btn_goTaskPanel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GoTaskPanel"
|
||||
}
|
||||
}
|
||||
function ActivityBreakOutCtrl:Awake()
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityBreakOutCtrl:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivityBreakOutCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self:RefreshLockState()
|
||||
self:RefreshDate()
|
||||
self:RefreshTimeout()
|
||||
self:RefreshReward()
|
||||
end
|
||||
function ActivityBreakOutCtrl:UnInit()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivityBreakOutCtrl:UnbindCtrl()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityBreakOutCtrl:RefreshLockState()
|
||||
local IsUnlock, txtLock = self.actData:IsUnlock()
|
||||
self._mapNode.imgLock.gameObject:SetActive(not IsUnlock)
|
||||
self._mapNode.btnGo.gameObject:SetActive(IsUnlock)
|
||||
if not IsUnlock then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLock, txtLock)
|
||||
end
|
||||
end
|
||||
function ActivityBreakOutCtrl:RefreshTimeout()
|
||||
local endTime = self.actData:GetActGroupEndTime()
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
self._mapNode.imgRemaineTime:SetActive(0 < remainTime)
|
||||
self._mapNode.imgEnd:SetActive(remainTime <= 0)
|
||||
if remainTime < 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
|
||||
end
|
||||
function ActivityBreakOutCtrl:RefreshDate()
|
||||
local nOpenMonth, nOpenDay, nEndMonth, nEndDay, nOpenYear, nEndYear = self.actData:GetActGroupDate()
|
||||
local strOpenDay = string.format("%d", nOpenDay)
|
||||
local strEndDay = string.format("%d", nEndDay)
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
|
||||
end
|
||||
function ActivityBreakOutCtrl:RefreshReward()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
local rewardData = actGroupCfg.RewardsShow
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self._mapNode.svReward:Init(#rewardData, self, self.RefreshRewardGridItem, self.BtnRewardGridClick)
|
||||
end
|
||||
function ActivityBreakOutCtrl:RefreshRewardGridItem(go, index)
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
local rewardData = actGroupCfg.RewardsShow
|
||||
local rewardId = rewardData[index + 1]
|
||||
local nInstanceID = go:GetInstanceID()
|
||||
if not self.tbGridCtrl[nInstanceID] then
|
||||
self.tbGridCtrl[nInstanceID] = self:BindCtrlByNode(go, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
self.tbGridCtrl[nInstanceID]:SetItem(rewardId)
|
||||
end
|
||||
function ActivityBreakOutCtrl:BtnRewardGridClick(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
local rewardData = actGroupCfg.RewardsShow
|
||||
local item = goGrid.transform:Find("AnimRoot/item")
|
||||
UTILS.ClickItemGridWithTips(rewardData[nIndex], item.transform, true, true, false)
|
||||
end
|
||||
function ActivityBreakOutCtrl:OnBtnClick_Go()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
if actGroupCfg ~= nil then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BreakOutThemePanel_S4, actGroupCfg.Id)
|
||||
end
|
||||
end
|
||||
function ActivityBreakOutCtrl:OnBtnClick_GoTaskPanel()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Task_30104, self.nActTaskId)
|
||||
end
|
||||
function ActivityBreakOutCtrl:OnBtnClick_Detail()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
if actGroupCfg == nil then
|
||||
return
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = actGroupCfg.DesText,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function ActivityBreakOutCtrl:ClearActivity()
|
||||
end
|
||||
return ActivityBreakOutCtrl
|
||||
@@ -0,0 +1,405 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local BreakOutThemeCtrl = class("BreakOutThemeCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
BreakOutThemeCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
BreakOutLevelSelectPanel = {
|
||||
sNodeName = "----BreakOutLevelSelect----",
|
||||
sCtrlName = "Game.UI.Play_BreakOut_30101.LevelSelectCtrl"
|
||||
},
|
||||
imgProgressBg = {
|
||||
sNodeName = "imgProgressBg"
|
||||
},
|
||||
txt_Target = {
|
||||
sNodeName = "txt_Target",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "ChallengingGoals"
|
||||
},
|
||||
imgFill = {sNodeName = "imgFill"},
|
||||
txtProgress = {
|
||||
sNodeName = "txtProgress",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
TaskActivityTime = {},
|
||||
txtTaskActivityTime = {
|
||||
sNodeName = "txtTaskActivityTime",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
TaskMask = {},
|
||||
txt_TaskEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
ShopActivityTime = {},
|
||||
txt_Shop = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "ExchangeShop"
|
||||
},
|
||||
txtShopActivityTime = {
|
||||
sNodeName = "txtShopActivityTime",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
btnEntrance_ = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickActivityEntrance"
|
||||
},
|
||||
redDotEntrance2 = {}
|
||||
}
|
||||
BreakOutThemeCtrl._mapEventConfig = {
|
||||
JumpToLevelDetail = "JumpTo_LevelDetail",
|
||||
SetAnimatorState = "SetAnimatorState"
|
||||
}
|
||||
BreakOutThemeCtrl._mapRedDotConfig = {}
|
||||
local ActivityState = {
|
||||
NotOpen = 1,
|
||||
Open = 2,
|
||||
Closed = 3
|
||||
}
|
||||
function BreakOutThemeCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.BreakOut_30101Data = PlayerData.Activity:GetActivityGroupDataById(self.nActId)
|
||||
if self.BreakOut_30101Data == nil then
|
||||
printError("活动组 id:" .. self.nActId .. " 数据为空")
|
||||
return
|
||||
else
|
||||
self.ActivityGroupCfg = self.BreakOut_30101Data.actGroupConfig
|
||||
end
|
||||
self.isLevelEnd = false
|
||||
end
|
||||
function BreakOutThemeCtrl:OnEnable()
|
||||
self.BreakOutTheme_Animator = self.gameObject:GetComponent("Animator")
|
||||
if self.BreakOut_30101Data == nil then
|
||||
printError("活动组 id:" .. self.nActId .. " 数据为空")
|
||||
return
|
||||
end
|
||||
self:RefreshPanel()
|
||||
for i = 1, 5 do
|
||||
local actData = self.BreakOut_30101Data:GetActivityDataByIndex(i)
|
||||
if actData ~= nil and i == AllEnum.ActivityThemeFuncIndex.Task then
|
||||
local nActId = actData.ActivityId
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.redDotEntrance2)
|
||||
end
|
||||
end
|
||||
self:SetAnimatorState()
|
||||
end
|
||||
function BreakOutThemeCtrl:OnDisable()
|
||||
if nil ~= self.remainTimer then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
end
|
||||
if nil ~= self.shopRemainTimer then
|
||||
TimerManager.Remove(self.shopRemainTimer)
|
||||
self.shopRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.avgRemainTimer then
|
||||
TimerManager.Remove(self.avgRemainTimer)
|
||||
self.avgRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.taskRemainTimer then
|
||||
TimerManager.Remove(self.taskRemainTimer)
|
||||
self.taskRemainTimer = nil
|
||||
end
|
||||
end
|
||||
function BreakOutThemeCtrl:RefreshPanel()
|
||||
if self.BreakOut_30101Data == nil or self.ActivityGroupCfg == nil then
|
||||
return
|
||||
end
|
||||
self:RefreshTime()
|
||||
self:RefreshButtonState()
|
||||
end
|
||||
function BreakOutThemeCtrl:RefreshTime()
|
||||
local bOpen = self.BreakOut_30101Data:CheckActivityGroupOpen()
|
||||
if bOpen then
|
||||
self:RefreshRemainTime(self.BreakOut_30101Data:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(self.BreakOut_30101Data:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function BreakOutThemeCtrl:RefreshRemainTime(endTime, txtComp)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(txtComp, sTimeStr)
|
||||
return remainTime
|
||||
end
|
||||
function BreakOutThemeCtrl:RefreshRemainOpenTime(openTime)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time_Min") or "", min)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time") or "", hour)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time_Day") or "", day)
|
||||
end
|
||||
return sTimeStr
|
||||
end
|
||||
function BreakOutThemeCtrl:RefreshButtonState()
|
||||
self.tbActState = {}
|
||||
for i = 1, 5 do
|
||||
local actData = self.BreakOut_30101Data:GetActivityDataByIndex(i)
|
||||
if actData ~= nil then
|
||||
if i == AllEnum.ActivityThemeFuncIndex.Task then
|
||||
self:RefreshTaskButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Shop then
|
||||
self:RefreshShopButtonState(actData)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function BreakOutThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans, refreshFunc)
|
||||
local countDownTimer
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
local state = ActivityState.NotOpen
|
||||
local bShowCountDown = false
|
||||
if activityData ~= nil then
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
if activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
elseif curTime >= openTime and curTime <= endTime then
|
||||
state = ActivityState.Open
|
||||
else
|
||||
state = ActivityState.Closed
|
||||
end
|
||||
elseif activityData.EndType == GameEnum.activityEndType.NoLimit then
|
||||
state = ActivityState.Open
|
||||
if activityData.StartTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
end
|
||||
end
|
||||
end
|
||||
if state == ActivityState.NotOpen then
|
||||
if nil == timer and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local fcTimer = function()
|
||||
curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
if imgTrans == nil then
|
||||
return
|
||||
end
|
||||
if 0 < remainTime then
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
local txtUnlock = imgTrans:GetComponentInChildren(typeof(CS.TMPro.TMP_Text))
|
||||
if txtUnlock ~= nil then
|
||||
NovaAPI.SetTMPText(txtUnlock, sTimeStr)
|
||||
end
|
||||
else
|
||||
imgTrans:SetActive(false)
|
||||
TimerManager.Remove(timer)
|
||||
countDownTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
refreshFunc(actData)
|
||||
self:RefreshActivityData()
|
||||
end
|
||||
end
|
||||
fcTimer()
|
||||
countDownTimer = self:AddTimer(0, 1, fcTimer, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Open and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
do
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
if endTime > self.BreakOut_30101Data:GetActGroupEndTime() then
|
||||
bShowCountDown = true
|
||||
elseif endTime < self.BreakOut_30101Data:GetActGroupEndTime() then
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
if timer == nil and bShowCountDown then
|
||||
self:RefreshRemainTime(endTime, txtTrans)
|
||||
do
|
||||
local fcTimer = function()
|
||||
local remainTime = self:RefreshRemainTime(endTime, txtTrans)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(timer)
|
||||
countDownTimer = nil
|
||||
refreshFunc(actData)
|
||||
end
|
||||
end
|
||||
fcTimer()
|
||||
countDownTimer = self:AddTimer(0, 1, fcTimer, true, true, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return state, bShowCountDown, countDownTimer
|
||||
end
|
||||
function BreakOutThemeCtrl:RefreshTaskButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local actInsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
if actInsData ~= nil then
|
||||
actInsData:RefreshTaskRedDot()
|
||||
end
|
||||
self:RefreshTaskButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDownTimer = self:RefreshButtonTimer(actData, self.taskRemainTimer, self._mapNode.txtTaskActivityTime, nil, refreshFunc)
|
||||
if self.taskRemainTimer == nil then
|
||||
self.taskRemainTimer = countDownTimer
|
||||
end
|
||||
if state == ActivityState.Closed and actInsData ~= nil then
|
||||
actInsData:RefreshTaskRedDot()
|
||||
end
|
||||
self._mapNode.TaskActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.TaskMask:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
local ActivityTaskData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local nDone, nTotal = 0, 0
|
||||
if ActivityTaskData ~= nil then
|
||||
nDone, nTotal = ActivityTaskData:CalcTotalProgress()
|
||||
end
|
||||
local progress = string.format("%d/%d", nDone, nTotal)
|
||||
local rt = self._mapNode.imgProgressBg:GetComponent("RectTransform")
|
||||
local nWidth = 0 < nTotal and nDone / nTotal * rt.rect.width or 0
|
||||
self._mapNode.imgFill:GetComponent("RectTransform").sizeDelta = Vector2(nWidth, rt.rect.height)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtProgress, progress)
|
||||
end
|
||||
end
|
||||
function BreakOutThemeCtrl:RefreshShopButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
self:RefreshShopButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDownTimer = self:RefreshButtonTimer(actData, self.shopRemainTimer, self._mapNode.txtShopActivityTime, nil, refreshFunc)
|
||||
if self.shopRemainTimer == nil then
|
||||
self.shopRemainTimer = countDownTimer
|
||||
end
|
||||
self._mapNode.ShopActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function BreakOutThemeCtrl:RequireActivityData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
local callFunc = function()
|
||||
self.bRequireSucc = true
|
||||
self:RefreshPanel()
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_detail_req, {}, nil, callFunc)
|
||||
self.bRequiredActData = true
|
||||
self:AddTimer(1, 1, function()
|
||||
self.bRequiredActData = false
|
||||
end, true, true, true)
|
||||
end
|
||||
function BreakOutThemeCtrl:RefreshActivityData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
self:AddTimer(1, 3, self.RequireActivityData, true, true, true)
|
||||
end
|
||||
function BreakOutThemeCtrl:OnBtn_ClickActivityEntrance(btn, nIndex)
|
||||
local actData
|
||||
if nIndex == 1 then
|
||||
nIndex = AllEnum.ActivityThemeFuncIndex.Shop
|
||||
actData = self.BreakOut_30101Data:GetActivityDataByIndex(nIndex)
|
||||
elseif nIndex == 2 then
|
||||
nIndex = AllEnum.ActivityThemeFuncIndex.Task
|
||||
actData = self.BreakOut_30101Data:GetActivityDataByIndex(nIndex)
|
||||
end
|
||||
local state = self.tbActState[actData.ActivityId]
|
||||
if nil == state then
|
||||
return
|
||||
end
|
||||
if state == ActivityState.Closed then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
|
||||
return
|
||||
elseif state == ActivityState.NotOpen then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
return
|
||||
elseif state == ActivityState.Open then
|
||||
local activityData = PlayerData.Activity:GetActivityDataById(actData.ActivityId)
|
||||
if activityData == nil then
|
||||
local bHint = true
|
||||
if self.bRequiredActData and bHint then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Data_Refreshing"))
|
||||
return
|
||||
end
|
||||
if bHint then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
self:RequireActivityData()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
if actData.PanelId ~= nil and ActivityState.Open == state then
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
|
||||
end
|
||||
end
|
||||
function BreakOutThemeCtrl:JumpTo_LevelDetail(nActId, nLevelId)
|
||||
local OpenPanel = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BreakOutLevelDetailPanelS4, nActId, nLevelId)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, 3, OpenPanel)
|
||||
end
|
||||
function BreakOutThemeCtrl:SetAnimatorState()
|
||||
self.BreakOutTheme_Animator:Play("BreakOutThemePanel_idle", 0, 0)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForSeconds(0.02))
|
||||
self.BreakOutTheme_Animator:Play("BreakOutThemePanel_in", 0, 0)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
return BreakOutThemeCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local BreakOutThemePanel = class("BreakOutThemePanel", BasePanel)
|
||||
BreakOutThemePanel._sUIResRootPath = "UI_Activity/"
|
||||
BreakOutThemePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "30104/BreakOutThemePanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.30104.BreakOutThemeCtrl"
|
||||
}
|
||||
}
|
||||
function BreakOutThemePanel:Awake()
|
||||
end
|
||||
function BreakOutThemePanel:OnEnable()
|
||||
end
|
||||
function BreakOutThemePanel:OnDisable()
|
||||
end
|
||||
function BreakOutThemePanel:OnDestroy()
|
||||
end
|
||||
function BreakOutThemePanel:OnRelease()
|
||||
end
|
||||
return BreakOutThemePanel
|
||||
@@ -0,0 +1,125 @@
|
||||
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"},
|
||||
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)
|
||||
local mapDiscCfgData = ConfigTable.GetData("Disc", self.mapGoodsCfg.ItemId)
|
||||
self:SetAtlasSprite(self._mapNode.imgElement, "12_rare", AllEnum.Star_Element[mapDiscCfgData.EET].icon)
|
||||
else
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapItemCfg.Icon)
|
||||
self._mapNode.imgElement.gameObject:SetActive(false)
|
||||
end
|
||||
self._mapNode.imgExpire.gameObject:SetActive(mapItemCfg.ExpireType > 0)
|
||||
local sPath = "db_arkanoid_shop_" .. AllEnum.FrameColor_New[mapItemCfg.Rarity]
|
||||
self:SetActivityAtlasSprite_New(self._mapNode.imgRare, "30104/SpriteAtlas/3010403", 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 = "30104/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,348 @@
|
||||
local BreakOutTaskCtrl = class("BreakOutTaskCtrl", BaseCtrl)
|
||||
local JumpUtil = require("Game.Common.Utils.JumpUtil")
|
||||
local PlayerActivityData = PlayerData.Activity
|
||||
local TabType = GameEnum.ActivityTaskTabType
|
||||
local ItemType = GameEnum.itemType
|
||||
BreakOutTaskCtrl._mapNodeConfig = {
|
||||
TopBarPanel = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
svList_Tab = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
svList_Task = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
svList_GroupReward = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
tb_tmpReceived = {
|
||||
nCount = 3,
|
||||
sNodeName = "tmpReceived_",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Received"
|
||||
},
|
||||
tmpUndone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_UnComplete"
|
||||
},
|
||||
tmpDone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Receive"
|
||||
},
|
||||
tmpJump = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Jump"
|
||||
},
|
||||
tmpGroupDone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Receive"
|
||||
}
|
||||
}
|
||||
BreakOutTaskCtrl._mapEventConfig = {
|
||||
onClick_RewardItem = "onEvent_ClickRewardItem",
|
||||
onClick_TaskDone = "onEvent_ClickTaskDone",
|
||||
onClick_TaskJump = "onEvent_ClickTaskJump"
|
||||
}
|
||||
BreakOutTaskCtrl._mapRedDotConfig = {}
|
||||
function BreakOutTaskCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
|
||||
self.nCurGroupIndex = tbParam[2]
|
||||
if type(self.nActivityId) ~= "number" then
|
||||
self.nActivityId = nil
|
||||
end
|
||||
self:BuildData(self.nActivityId)
|
||||
self:refresh_Tab()
|
||||
self:refresh_Task()
|
||||
end
|
||||
function BreakOutTaskCtrl:BuildData(nActivityId)
|
||||
if self.tbData == nil then
|
||||
self.tbData = {}
|
||||
end
|
||||
if self.tbGroupId == nil then
|
||||
self.tbGroupId = {}
|
||||
end
|
||||
if type(nActivityId) ~= "number" then
|
||||
return
|
||||
end
|
||||
self.ins_ActivityTaskData = PlayerActivityData:GetActivityDataById(nActivityId)
|
||||
if self.ins_ActivityTaskData == nil then
|
||||
return
|
||||
end
|
||||
local func_Parse_ActivityTaskGroup = function(mapData)
|
||||
if mapData.ActivityId == nActivityId then
|
||||
local _nGroupId = mapData.Id
|
||||
local nIdx = table.indexof(self.tbGroupId, _nGroupId)
|
||||
if nIdx <= 0 then
|
||||
local _mapData = {
|
||||
nGroupId = _nGroupId,
|
||||
nGroupOrder = mapData.Order,
|
||||
nTabType = mapData.TaskTabType,
|
||||
tbGroupRewardId = {},
|
||||
tbGroupRewardNum = {},
|
||||
tbTaskId = {},
|
||||
tbTaskData = {},
|
||||
nTaskDoneNum = 0,
|
||||
nTaskOKNum = 0
|
||||
}
|
||||
for i = 1, 6 do
|
||||
local nRewardId = mapData["Reward" .. tostring(i)]
|
||||
local nRewardNum = mapData["RewardQty" .. tostring(i)]
|
||||
if 0 < nRewardId and 0 < nRewardNum then
|
||||
table.insert(_mapData.tbGroupRewardId, nRewardId)
|
||||
table.insert(_mapData.tbGroupRewardNum, nRewardNum)
|
||||
end
|
||||
end
|
||||
table.insert(self.tbData, _mapData)
|
||||
table.insert(self.tbGroupId, _nGroupId)
|
||||
else
|
||||
local _mapData = self.tbData[nIdx]
|
||||
_mapData.nTaskDoneNum = 0
|
||||
_mapData.nTaskOKNum = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.ActivityTaskGroup, func_Parse_ActivityTaskGroup)
|
||||
local func_Parse_ActivityTask = function(mapData)
|
||||
local nIdx = table.indexof(self.tbGroupId, mapData.ActivityTaskGroupId)
|
||||
if 0 < nIdx then
|
||||
local _mapData = self.tbData[nIdx]
|
||||
local _tbTaskId = _mapData.tbTaskId
|
||||
local _tbTaskData = _mapData.tbTaskData
|
||||
local _nTaskId = mapData.Id
|
||||
local taskData = self.ins_ActivityTaskData.mapActivityTaskDatas[_nTaskId]
|
||||
local nIndex = table.indexof(_tbTaskId, _nTaskId)
|
||||
if nIndex <= 0 then
|
||||
local _mapTaskData = {
|
||||
nTaskId = _nTaskId,
|
||||
nStatus = taskData.nStatus,
|
||||
sDesc = mapData.Desc,
|
||||
nRarity = mapData.Rarity,
|
||||
tbJumpTo = mapData.JumpTo,
|
||||
nCur = taskData.nCur,
|
||||
nMax = taskData.nMax,
|
||||
tbTaskRewardId = {},
|
||||
tbTaskRewardNum = {}
|
||||
}
|
||||
if taskData.nStatus == AllEnum.ActQuestStatus.Received then
|
||||
_mapData.nTaskDoneNum = _mapData.nTaskDoneNum + 1
|
||||
end
|
||||
if taskData.nStatus ~= AllEnum.ActQuestStatus.UnComplete then
|
||||
_mapData.nTaskOKNum = _mapData.nTaskOKNum + 1
|
||||
end
|
||||
for i = 1, 2 do
|
||||
local nRewardId = mapData["Tid" .. tostring(i)]
|
||||
local nRewardNum = mapData["Qty" .. tostring(i)]
|
||||
if 0 < nRewardId and 0 < nRewardNum then
|
||||
table.insert(_mapTaskData.tbTaskRewardId, nRewardId)
|
||||
table.insert(_mapTaskData.tbTaskRewardNum, nRewardNum)
|
||||
end
|
||||
end
|
||||
table.insert(_tbTaskId, _nTaskId)
|
||||
table.insert(_tbTaskData, _mapTaskData)
|
||||
else
|
||||
local _mapTaskData = _tbTaskData[nIndex]
|
||||
_mapTaskData.nStatus = taskData.nStatus
|
||||
_mapTaskData.nCur = taskData.nCur
|
||||
_mapTaskData.nMax = taskData.nMax
|
||||
if taskData.nStatus == AllEnum.ActQuestStatus.Received then
|
||||
_mapData.nTaskDoneNum = _mapData.nTaskDoneNum + 1
|
||||
end
|
||||
if taskData.nStatus ~= AllEnum.ActQuestStatus.UnComplete then
|
||||
_mapData.nTaskOKNum = _mapData.nTaskOKNum + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.ActivityTask, func_Parse_ActivityTask)
|
||||
table.sort(self.tbData, function(a, b)
|
||||
return a.nGroupOrder < b.nGroupOrder
|
||||
end)
|
||||
for i, v in ipairs(self.tbData) do
|
||||
self.tbGroupId[i] = v.nGroupId
|
||||
end
|
||||
for i, mapData in ipairs(self.tbData) do
|
||||
local tbTaskData = mapData.tbTaskData
|
||||
table.sort(tbTaskData, function(a, b)
|
||||
if a.nStatus == b.nStatus then
|
||||
return a.nTaskId < b.nTaskId
|
||||
else
|
||||
return a.nStatus < b.nStatus
|
||||
end
|
||||
end)
|
||||
for ii, vv in ipairs(tbTaskData) do
|
||||
mapData.tbTaskId[ii] = vv.nTaskId
|
||||
end
|
||||
end
|
||||
if self.nCurGroupIndex == nil then
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
|
||||
local nFirstReddot = 1
|
||||
for i, v in ipairs(self.tbData) do
|
||||
local bRed = false
|
||||
if bInActGroup == false then
|
||||
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
|
||||
self.nActivityId,
|
||||
v.nGroupId
|
||||
})
|
||||
else
|
||||
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
|
||||
nActGroupId,
|
||||
self.nActivityId,
|
||||
v.nGroupId
|
||||
})
|
||||
end
|
||||
if bRed then
|
||||
nFirstReddot = i
|
||||
break
|
||||
end
|
||||
end
|
||||
self.nCurGroupIndex = nFirstReddot
|
||||
end
|
||||
end
|
||||
function BreakOutTaskCtrl:refresh_Tab()
|
||||
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
|
||||
end
|
||||
function BreakOutTaskCtrl:onGridRefresh_Tab(go)
|
||||
local nIndex = tonumber(go.name) + 1
|
||||
local mapData = self.tbData[nIndex]
|
||||
local mapCfgData_ActivityTaskGroup = ConfigTable.GetData("ActivityTaskGroup", mapData.nGroupId)
|
||||
local nDone = mapData.nTaskDoneNum
|
||||
local nTotal = #mapData.tbTaskData
|
||||
local sProgress = string.format("%s/%s", tostring(nDone), tostring(nTotal))
|
||||
local tr = go.transform
|
||||
local canvasGroupOn = tr:Find("scale_on_click/imgDb_on"):GetComponent("CanvasGroup")
|
||||
local canvasGroupOff = tr:Find("scale_on_click/imgDb_off"):GetComponent("CanvasGroup")
|
||||
self:RefreshScaleOnClick_State(tr, nIndex, mapCfgData_ActivityTaskGroup, sProgress)
|
||||
local goRedDot = tr:Find("scale_on_click/redDotTab")
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
|
||||
if bInActGroup == false then
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task_Group, {
|
||||
self.nActivityId,
|
||||
mapData.nGroupId
|
||||
}, goRedDot, nil, nil, true)
|
||||
else
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task_Group, {
|
||||
nActGroupId,
|
||||
self.nActivityId,
|
||||
mapData.nGroupId
|
||||
}, goRedDot, nil, nil, true)
|
||||
end
|
||||
end
|
||||
function BreakOutTaskCtrl:onGridBtnClick_Tab(go)
|
||||
local nIndex = tonumber(go.name) + 1
|
||||
if self.nCurGroupIndex ~= nIndex then
|
||||
local canvasGroupOn = go.transform.parent:GetChild(self.nCurGroupIndex - 1):Find("scale_on_click/imgDb_on"):GetComponent("CanvasGroup")
|
||||
local canvasGroupOff = go.transform.parent:GetChild(self.nCurGroupIndex - 1):Find("scale_on_click/imgDb_off"):GetComponent("CanvasGroup")
|
||||
NovaAPI.SetCanvasGroupAlpha(canvasGroupOn, 0)
|
||||
NovaAPI.SetCanvasGroupAlpha(canvasGroupOff, 1)
|
||||
self.nCurGroupIndex = nIndex
|
||||
self:refresh_Tab()
|
||||
self:refresh_Task(true)
|
||||
end
|
||||
end
|
||||
function BreakOutTaskCtrl:RefreshScaleOnClick_State(tr, nIndex, mapCfgData_ActivityTaskGroup, sProgress)
|
||||
local canvasGroupOn = tr:Find("scale_on_click/imgDb_on"):GetComponent("CanvasGroup")
|
||||
local canvasGroupOff = tr:Find("scale_on_click/imgDb_off"):GetComponent("CanvasGroup")
|
||||
if self.nCurGroupIndex == nIndex then
|
||||
NovaAPI.SetCanvasGroupAlpha(canvasGroupOn, 1)
|
||||
NovaAPI.SetCanvasGroupAlpha(canvasGroupOff, 0)
|
||||
NovaAPI.SetTMPText(tr:Find("scale_on_click/imgDb_on/tmpTabName_on"):GetComponent("TMP_Text"), mapCfgData_ActivityTaskGroup.TabText)
|
||||
NovaAPI.SetTMPText(tr:Find("scale_on_click/imgDb_on/tmpTabProgress_on"):GetComponent("TMP_Text"), sProgress)
|
||||
else
|
||||
NovaAPI.SetCanvasGroupAlpha(canvasGroupOn, 0)
|
||||
NovaAPI.SetCanvasGroupAlpha(canvasGroupOff, 1)
|
||||
NovaAPI.SetTMPText(tr:Find("scale_on_click/imgDb_off/tmpTabName_off"):GetComponent("TMP_Text"), mapCfgData_ActivityTaskGroup.TabText)
|
||||
NovaAPI.SetTMPText(tr:Find("scale_on_click/imgDb_off/tmpTabProgress_off"):GetComponent("TMP_Text"), sProgress)
|
||||
end
|
||||
end
|
||||
function BreakOutTaskCtrl:refresh_Task(bPlayAnim)
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
if bPlayAnim == true then
|
||||
self._mapNode.svList_Task:SetAnim(0.05)
|
||||
end
|
||||
self._mapNode.svList_Task:Init(#mapData.tbTaskData, self, self.onGridRefresh_Task, nil)
|
||||
end
|
||||
function BreakOutTaskCtrl:onGridRefresh_Task(go)
|
||||
local nIndex = tonumber(go.name) + 1
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local mapTask = mapData.tbTaskData[nIndex]
|
||||
local tr = go.transform:GetChild(0)
|
||||
for i = 1, 5 do
|
||||
tr:Find("imgRare_" .. tostring(i)).localScale = i == mapTask.nRarity and Vector3.one or Vector3.zero
|
||||
end
|
||||
local nCur = mapTask.nCur
|
||||
local nMax = mapTask.nMax
|
||||
if nMax <= 0 then
|
||||
nMax = 0 < nCur and nCur or 1
|
||||
end
|
||||
if nCur > nMax then
|
||||
nCur = nMax
|
||||
end
|
||||
if mapTask.nStatus == AllEnum.ActQuestStatus.Complete or mapTask.nStatus == AllEnum.ActQuestStatus.Received then
|
||||
nCur = nMax
|
||||
end
|
||||
local rt = tr:Find("imgProgessDb"):GetComponent("RectTransform")
|
||||
local nWidth = nCur / nMax * rt.rect.width
|
||||
if 0 < nWidth and nWidth < 40 then
|
||||
nWidth = 40
|
||||
end
|
||||
tr:Find("imgProgessBar"):GetComponent("RectTransform").sizeDelta = Vector2(nWidth, tr:Find("imgProgessBar"):GetComponent("RectTransform").rect.height)
|
||||
NovaAPI.SetTMPText(tr:Find("tmpTaskDesc"):GetComponent("TMP_Text"), mapTask.sDesc)
|
||||
NovaAPI.SetTMPText(tr:Find("tmpTaskProgress"):GetComponent("TMP_Text"), string.format("%s/%s", tostring(nCur), tostring(nMax)))
|
||||
local nCount = #mapTask.tbTaskRewardId
|
||||
for i = 1, 2 do
|
||||
local _tr = tr:Find("TaskRewards/goTaskReward" .. tostring(i))
|
||||
if i <= nCount then
|
||||
_tr.localScale = Vector3.one
|
||||
local nId = mapTask.tbTaskRewardId[i]
|
||||
local mapCfgData_Item = ConfigTable.GetData("Item", nId)
|
||||
self:SetSprite_FrameColor(_tr:Find("scale_on_click/imgRare").gameObject:GetComponent("Image"), mapCfgData_Item.Rarity, AllEnum.FrameType_New.Item, false)
|
||||
self:SetPngSprite(_tr:Find("scale_on_click/imgIcon").gameObject:GetComponent("Image"), mapCfgData_Item.Icon)
|
||||
_tr:Find("scale_on_click/goReceived").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Received and Vector3.one or Vector3.zero
|
||||
local nNum = mapTask.tbTaskRewardNum[i]
|
||||
local sNum = mapCfgData_Item.Type ~= ItemType.Char and mapCfgData_Item.Type ~= ItemType.Disc and "×" .. tostring(nNum) or ""
|
||||
NovaAPI.SetTMPText(_tr:Find("scale_on_click/tmpCount").gameObject:GetComponent("TMP_Text"), sNum)
|
||||
_tr:GetChild(0).name = tostring(nId)
|
||||
_tr:Find("scale_on_click/goTimeLimit").localScale = 0 < mapCfgData_Item.ExpireType and Vector3.one or Vector3.zero
|
||||
else
|
||||
_tr.localScale = Vector3.zero
|
||||
_tr.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
tr:Find("tmpUndone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 >= #mapTask.tbJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnDone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Complete and Vector3.one or Vector3.zero
|
||||
tr:Find("btnDone"):GetChild(0).name = tostring(mapTask.nTaskId)
|
||||
tr:Find("btnJump").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 < #mapTask.tbJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnJump"):GetChild(0).name = tostring(nIndex)
|
||||
tr:Find("goDone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Received and Vector3.one or Vector3.zero
|
||||
end
|
||||
function BreakOutTaskCtrl:onEvent_ClickRewardItem(goBtn)
|
||||
local nItemId = tonumber(goBtn.transform:GetChild(0).name)
|
||||
if nItemId ~= nil then
|
||||
UTILS.ClickItemGridWithTips(nItemId, goBtn.transform, true, true, true)
|
||||
end
|
||||
end
|
||||
function BreakOutTaskCtrl:onEvent_ClickTaskDone(goBtn)
|
||||
local nTaskId = tonumber(goBtn.transform:GetChild(0).name)
|
||||
if nTaskId ~= nil then
|
||||
local cb = function()
|
||||
self:BuildData(self.nActivityId)
|
||||
self:refresh_Tab()
|
||||
self:refresh_Task(true)
|
||||
end
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
self.ins_ActivityTaskData:SendMsg_ActivityTaskRewardReceiveReq(mapData.nGroupId, 0, mapData.nTabType, cb)
|
||||
end
|
||||
end
|
||||
function BreakOutTaskCtrl:onEvent_ClickTaskJump(goBtn)
|
||||
local nIndex = tonumber(goBtn.transform:GetChild(0).name)
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local mapTask = mapData.tbTaskData[nIndex]
|
||||
local JumpToData = mapTask.tbJumpTo
|
||||
if JumpToData ~= nil and 0 < #JumpToData then
|
||||
JumpUtil.JumpToActivity(JumpToData)
|
||||
end
|
||||
end
|
||||
return BreakOutTaskCtrl
|
||||
@@ -0,0 +1,9 @@
|
||||
local BreakOutTaskPanel = class("BreakOutTaskPanel", BasePanel)
|
||||
BreakOutTaskPanel._sUIResRootPath = "UI_Activity/"
|
||||
BreakOutTaskPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "30104/Task.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.30104.Task.BreakOutTaskCtrl"
|
||||
}
|
||||
}
|
||||
return BreakOutTaskPanel
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user