Update - 1.9.0.103
EN: 1.9.0.103 CN: 1.9.0.104 JP: 1.9.0.106 KR: 1.9.0.108
This commit is contained in:
@@ -12,6 +12,7 @@ local ResTypeAny = GameResourceLoader.ResType.Any
|
||||
local typeof = typeof
|
||||
local TN = AllEnum.Actor2DType.Normal
|
||||
local TF = AllEnum.Actor2DType.FullScreen
|
||||
local b_UseLive2D_EX = false
|
||||
local RapidJson = require("rapidjson")
|
||||
local Actor_Node_Path = string.format("%sUI/CommonEx/Template/----Actor2D_Node----.prefab", Settings.AB_ROOT_PATH)
|
||||
local L2DType = {
|
||||
@@ -507,7 +508,7 @@ local GetActor2DParams = function(nPanelId, nCharId, nSkinId, param, nSpecifyTyp
|
||||
if mapSkinData == nil then
|
||||
printError("未找到角色皮肤数据")
|
||||
end
|
||||
local bL = tbConfig.bL2D and LocalSettingData.mapData.UseLive2D
|
||||
local bL = tbConfig.bL2D and LocalSettingData.mapData.UseLive2D or b_UseLive2D_EX
|
||||
if type(param) == "table" and param[1] == "TalentL2D" then
|
||||
bL = true
|
||||
end
|
||||
@@ -668,10 +669,7 @@ function Actor2DManager.ClearAll()
|
||||
mapL2DPrefab = {}
|
||||
mapSprite = {}
|
||||
mapBg = {}
|
||||
GameResourceLoader.Unload("Actor2D")
|
||||
GameResourceLoader.Unload("Disc")
|
||||
GameResourceLoader.Unload("CG")
|
||||
GameResourceLoader.Unload("Image")
|
||||
GameResourceLoader.Unload("UI")
|
||||
end
|
||||
function Actor2DManager.SetActor2D_ForSubSKill(nPanelId, rawImg, nCharId, nSkinId, param, nIndex)
|
||||
RT_SUB_SKILL_SHOW = true
|
||||
@@ -1098,6 +1096,9 @@ function Actor2DManager.GetActor2DTypeByPanel(nPanelId, nCharId)
|
||||
end
|
||||
return TF
|
||||
end
|
||||
function Actor2DManager.ForceUseL2D(bForce)
|
||||
b_UseLive2D_EX = bForce == true
|
||||
end
|
||||
function Actor2DManager.SwitchActor2DDragOffset()
|
||||
local mapCurChar = mapCurrent.tbChar[1]
|
||||
local tbRenderer = tbL2DRenderer[1]
|
||||
|
||||
@@ -3,18 +3,23 @@ local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local AdventureModuleHelper = CS.AdventureModuleHelper
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local mapEventConfig = {
|
||||
LevelStateChanged = "OnEvent_SendMsgFinishBattle",
|
||||
LoadLevelRefresh = "OnEvent_LoadLevelRefresh",
|
||||
[EventId.AbandonBattle] = "OnEvent_AbandonBattle",
|
||||
AdventureModuleEnter = "OnEvent_AdventureModuleEnter",
|
||||
BattlePause = "OnEvent_Pause",
|
||||
ActivityInstance_Result = "LevelResultChange",
|
||||
ActivityLevelSettle_Failed = "OnEvent_ActivityLevelSettleFailed"
|
||||
ActivityLevelSettle_Failed = "OnEvent_ActivityLevelSettleFailed",
|
||||
ActivityLevels_Instance_Gameplay_Time = "OnEvent_ActivityLevels_Time"
|
||||
}
|
||||
function ActivityLevelsInstanceLevel:Init(parent, nActivityId, nLevelId, nBuildId)
|
||||
self.parent = parent
|
||||
self.nLevelId = nLevelId
|
||||
self.nActivityId = nActivityId
|
||||
self.isSettlement = false
|
||||
self.nBuildId = nBuildId
|
||||
self.curFloorIdx = 1
|
||||
self.levelTotalTime = 0
|
||||
local GetBuildCallback = function(mapBuildData)
|
||||
self.mapBuildData = mapBuildData
|
||||
self.tbCharId = {}
|
||||
@@ -32,8 +37,12 @@ function ActivityLevelsInstanceLevel:Init(parent, nActivityId, nLevelId, nBuildI
|
||||
local stActorInfo = self:CalCharFixedEffect(nTid, idx == 1, self.tbDiscId)
|
||||
self.mapActorInfo[nTid] = stActorInfo
|
||||
end
|
||||
PlayerData.nCurGameType = AllEnum.WorldMapNodeType.EquipmentInstance
|
||||
CS.AdventureModuleHelper.EnterActivityLevelsInstance(nLevelId, self.tbCharId)
|
||||
PlayerData.nCurGameType = AllEnum.WorldMapNodeType.ActivityLevels
|
||||
local mapParams = {
|
||||
tostring(self.curFloorIdx),
|
||||
tostring(self.levelTotalTime)
|
||||
}
|
||||
CS.AdventureModuleHelper.EnterActivityLevelsInstance(nLevelId, self.tbCharId, mapParams)
|
||||
NovaAPI.EnterModule("AdventureModuleScene", true, 17)
|
||||
end
|
||||
PlayerData.Build:GetBuildDetailData(GetBuildCallback, nBuildId)
|
||||
@@ -42,7 +51,7 @@ function ActivityLevelsInstanceLevel:OnEvent_LoadLevelRefresh()
|
||||
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)
|
||||
EventManager.Hit("OpenActivityLevelsInstanceRoomInfo", self.nLevelId)
|
||||
EventManager.Hit("OpenActivityLevelsInstanceRoomInfo", self.nLevelId, self.levelTotalTime)
|
||||
end
|
||||
function ActivityLevelsInstanceLevel:OnEvent_LevelResult(tbStar, bAbandon)
|
||||
end
|
||||
@@ -59,6 +68,40 @@ function ActivityLevelsInstanceLevel:OnEvent_AdventureModuleEnter()
|
||||
safe_call_cs_func(CS.AdventureModuleHelper.SetActorAttribute, nCharId, stActorInfo)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsInstanceLevel:OnEvent_SendMsgFinishBattle()
|
||||
local mapCfg = ConfigTable.GetData("ActivityLevelsLevel", self.nLevelId)
|
||||
if self.curFloorIdx < #mapCfg.FloorId then
|
||||
local GetBuildCallback = function(mapBuildData)
|
||||
self.curFloorIdx = self.curFloorIdx + 1
|
||||
self.mapBuildData = mapBuildData
|
||||
self.tbCharId = {}
|
||||
for _, mapChar in ipairs(self.mapBuildData.tbChar) do
|
||||
table.insert(self.tbCharId, mapChar.nTid)
|
||||
end
|
||||
self.tbDiscId = {}
|
||||
for _, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
if 0 < nDiscId then
|
||||
table.insert(self.tbDiscId, nDiscId)
|
||||
end
|
||||
end
|
||||
self.mapActorInfo = {}
|
||||
for idx, nTid in ipairs(self.tbCharId) do
|
||||
local stActorInfo = self:CalCharFixedEffect(nTid, idx == 1, self.tbDiscId)
|
||||
self.mapActorInfo[nTid] = stActorInfo
|
||||
end
|
||||
PlayerData.nCurGameType = AllEnum.WorldMapNodeType.ActivityLevels
|
||||
local mapParams = {
|
||||
tostring(self.curFloorIdx),
|
||||
tostring(self.levelTotalTime)
|
||||
}
|
||||
CS.AdventureModuleHelper.EnterActivityLevelsInstance(self.nLevelId, self.tbCharId, mapParams)
|
||||
CS.AdventureModuleHelper.LevelStateChanged(false)
|
||||
self:OnEvent_AdventureModuleEnter()
|
||||
end
|
||||
PlayerData.Build:GetBuildDetailData(GetBuildCallback, self.nBuildId)
|
||||
return
|
||||
end
|
||||
end
|
||||
function ActivityLevelsInstanceLevel:LevelResultChange(isWin, totalTime)
|
||||
EventManager.Hit("ActivityLevelsInstanceBattleEnd")
|
||||
self:SettleLevelsInstance(isWin, totalTime)
|
||||
@@ -121,7 +164,9 @@ function ActivityLevelsInstanceLevel:PlaySuccessPerform(FixedRewardItems, FirstR
|
||||
local tbChar = self.tbCharId
|
||||
local function levelEndCallback()
|
||||
EventManager.Remove("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
|
||||
local nType = ConfigTable.GetData("ActivityLevelsFloor", ConfigTable.GetData("ActivityLevelsLevel", self.nLevelId).FloorId).Theme
|
||||
local tabFloor = ConfigTable.GetData("ActivityLevelsLevel", self.nLevelId).FloorId
|
||||
local tabFloorCount = #tabFloor
|
||||
local nType = ConfigTable.GetData("ActivityLevelsFloor", tabFloor[tabFloorCount]).Theme
|
||||
local sName = ConfigTable.GetData("EndSceneType", nType).EndSceneName
|
||||
local tbSkin = {}
|
||||
for _, nCharId in ipairs(tbChar) do
|
||||
@@ -204,4 +249,7 @@ end
|
||||
function ActivityLevelsInstanceLevel:OnEvent_Pause()
|
||||
EventManager.Hit("OpenActivityLevelsInstancePause", self.nActivityId, self.nLevelId, self.tbCharId)
|
||||
end
|
||||
function ActivityLevelsInstanceLevel:OnEvent_ActivityLevels_Time(nTime)
|
||||
self.levelTotalTime = nTime
|
||||
end
|
||||
return ActivityLevelsInstanceLevel
|
||||
|
||||
@@ -84,8 +84,7 @@ function JointDrillLevelData_1:Init(parent, nLevelId, nBuildId, nCurLevel, nLeve
|
||||
tostring(self.bChangeLevel),
|
||||
tostring(self.nGameTime)
|
||||
}
|
||||
self.bRestart = false
|
||||
if not self.bChangeLevel then
|
||||
if not self.bChangeLevel and not self.bRestart then
|
||||
AdventureModuleHelper.EnterDynamic(self.nLevelId, self.tbCharId, GameEnum.dynamicLevelType.JointDrill, mapParams)
|
||||
NovaAPI.EnterModule("AdventureModuleScene", true, 17)
|
||||
else
|
||||
@@ -161,7 +160,6 @@ function JointDrillLevelData_1:CacheTempData(bCharacter, bBoss, bChangeTeam, bCh
|
||||
self.mapTempData.mapCharacterTempData = {}
|
||||
self.mapTempData.mapBossTempData = {}
|
||||
if bCharacter then
|
||||
local id = AdventureModuleHelper.GetCurrentActivePlayer()
|
||||
self.mapTempData.mapCharacterTempData.hpInfo = {}
|
||||
self.mapTempData.mapCharacterTempData.skillInfo = {}
|
||||
self.mapTempData.mapCharacterTempData.effectInfo = {}
|
||||
@@ -170,7 +168,7 @@ function JointDrillLevelData_1:CacheTempData(bCharacter, bBoss, bChangeTeam, bCh
|
||||
self.mapTempData.mapCharacterTempData.ammoInfo = {}
|
||||
self.mapTempData.mapCharacterTempData.sommonInfo = AdventureModuleHelper.GetSummonMonsterInfos()
|
||||
self.mapActorInfo = self:GetActorHp()
|
||||
self.mapTempData.mapCharacterTempData.hpInfo = self:GetActorHp()
|
||||
self.mapTempData.mapCharacterTempData.hpInfo = self.mapActorInfo
|
||||
local playerids = AdventureModuleHelper.GetCurrentGroupPlayers()
|
||||
local Count = playerids.Count - 1
|
||||
for i = 0, Count do
|
||||
@@ -437,10 +435,19 @@ function JointDrillLevelData_1:CheckJointDrillGameOver()
|
||||
local nChallengeCount = self.parent:GetJointDrillBattleCount()
|
||||
local nAllChallengeCount = self.parent:GetMaxChallengeCount(self.nLevelId)
|
||||
if nChallengeCount >= nAllChallengeCount then
|
||||
local callback = function(netMsg)
|
||||
self:JointDrillFail(AllEnum.JointDrillResultType.ChallengeEnd, netMsg)
|
||||
local nHp, nHpMax = 0, 0
|
||||
local data, nDataLength = self:CacheTempData(false, true, true)
|
||||
if self.mapTempData ~= nil and self.mapTempData.mapBossTempData ~= nil then
|
||||
nHp = self.mapTempData.mapBossTempData.nHp
|
||||
nHpMax = self.mapTempData.mapBossTempData.nHpMax
|
||||
end
|
||||
self.parent:JointDrillGameOver(callback)
|
||||
local syncCallback = function()
|
||||
local callback = function(netMsg)
|
||||
self:JointDrillFail(AllEnum.JointDrillResultType.ChallengeEnd, netMsg)
|
||||
end
|
||||
self.parent:JointDrillGameOver(callback)
|
||||
end
|
||||
self.parent:JointDrillSync(self.nCurLevel, self.nGameTime, self.nDamageValue, nHp, nHpMax, data, syncCallback)
|
||||
else
|
||||
local bBossFloor = self.mapFloor.FloorType == GameEnum.JointDrillFloorType.Boss
|
||||
local data, nDataLength = self:CacheTempData(false, bBossFloor, true, false, true)
|
||||
@@ -538,7 +545,7 @@ function JointDrillLevelData_1:OnEvent_MonsterSpawn(nBossId)
|
||||
if self.bChangeLevel then
|
||||
return
|
||||
end
|
||||
local data, nDataLength = self:CacheTempData(true, bBoss, true)
|
||||
local data, nDataLength = self:CacheTempData(false, bBoss, true)
|
||||
local nHp, nHpMax = 1, 1
|
||||
if self.mapTempData ~= nil and self.mapTempData.mapBossTempData ~= nil then
|
||||
nHp = self.mapTempData.mapBossTempData.nHp
|
||||
@@ -551,6 +558,8 @@ function JointDrillLevelData_1:OnEvent_BattleLvsToggle(nBattleLv, nTotalTime, nD
|
||||
if nBattleLv < self.nCurLevel then
|
||||
return
|
||||
end
|
||||
self.bChangeLevel = true
|
||||
self.bRestart = false
|
||||
nTotalTime = math.min(self.mapLevel.BattleTime * 1000, self:GetSyncGameTime(nTotalTime))
|
||||
self.nCurLevel = nBattleLv + 1
|
||||
self.nDamageValue = self.nDamageValue + nDamageValue
|
||||
@@ -563,6 +572,7 @@ function JointDrillLevelData_1:OnEvent_BattleLvsToggle(nBattleLv, nTotalTime, nD
|
||||
local func = function()
|
||||
local syncCallback = function()
|
||||
PanelManager.InputEnable()
|
||||
EventManager.Hit("CloseJointDrillPause")
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
AdventureModuleHelper.LevelStateChanged(false)
|
||||
@@ -607,6 +617,7 @@ function JointDrillLevelData_1:OnEvent_GiveUpBattle()
|
||||
end
|
||||
function JointDrillLevelData_1:OnEvent_RestartJointDrill()
|
||||
self.bRestart = true
|
||||
self.bChangeLevel = false
|
||||
self.parent:SetGameTime(0)
|
||||
AdventureModuleHelper.ClearCharacterDamageRecord(true)
|
||||
local sRecord = self.parent:EncodeTempDataJson(self.mapInitTempData)
|
||||
@@ -614,6 +625,7 @@ function JointDrillLevelData_1:OnEvent_RestartJointDrill()
|
||||
self.parent:SetRecorderExcludeIds(true)
|
||||
AdventureModuleHelper.LevelStateChanged(false)
|
||||
EventManager.Hit("ResetBossHUD")
|
||||
EventManager.Hit("JointDrillReset")
|
||||
end
|
||||
function JointDrillLevelData_1:OnEvent_RetreatJointDrill()
|
||||
local callback = function()
|
||||
@@ -650,11 +662,20 @@ function JointDrillLevelData_1:JointDrillTimeOut()
|
||||
end
|
||||
self.bInResult = true
|
||||
NovaAPI.DispatchEventWithData("JointDrill_Level_TimeOut")
|
||||
local callback = function(netMsg)
|
||||
self:JointDrillFail(AllEnum.JointDrillResultType.ChallengeEnd, netMsg)
|
||||
local nHp, nHpMax = 0, 0
|
||||
local data, nDataLength = self:CacheTempData(false, true, true)
|
||||
if self.mapTempData ~= nil and self.mapTempData.mapBossTempData ~= nil then
|
||||
nHp = self.mapTempData.mapBossTempData.nHp
|
||||
nHpMax = self.mapTempData.mapBossTempData.nHpMax
|
||||
end
|
||||
self.parent:AddJointDrillTeam(self.mapBuildData, self.nGameTime, self.nDamageValue)
|
||||
self.parent:JointDrillGameOver(callback)
|
||||
local syncCallback = function()
|
||||
local callback = function(netMsg)
|
||||
self:JointDrillFail(AllEnum.JointDrillResultType.ChallengeEnd, netMsg)
|
||||
end
|
||||
self.parent:AddJointDrillTeam(self.mapBuildData, self.nGameTime, self.nDamageValue)
|
||||
self.parent:JointDrillGameOver(callback)
|
||||
end
|
||||
self.parent:JointDrillSync(self.nCurLevel, self.nGameTime, self.nDamageValue, nHp, nHpMax, data, syncCallback)
|
||||
end
|
||||
function JointDrillLevelData_1:OnEvent_CharDamageValue(charDamageValue)
|
||||
for nCharId, nValue in pairs(charDamageValue) do
|
||||
|
||||
@@ -195,39 +195,44 @@ end
|
||||
function JointDrillLevelData_2:CheckJointDrillGameOver()
|
||||
local nChallengeCount = self.parent:GetJointDrillBattleCount()
|
||||
local nAllChallengeCount = self.parent:GetMaxChallengeCount(self.nLevelId)
|
||||
if nChallengeCount >= nAllChallengeCount then
|
||||
local callback = function(netMsg)
|
||||
self:JointDrillFail(AllEnum.JointDrillResultType.ChallengeEnd, netMsg, self.nCurLevel)
|
||||
end
|
||||
self.parent:JointDrillGameOver(callback)
|
||||
else
|
||||
function self.recordCallback(sRecord)
|
||||
function self.recordCallback(sRecord)
|
||||
if nChallengeCount >= nAllChallengeCount then
|
||||
local syncCallback = function()
|
||||
local callback = function(netMsg)
|
||||
self:JointDrillFail(AllEnum.JointDrillResultType.ChallengeEnd, netMsg, self.nCurLevel)
|
||||
end
|
||||
self.parent:JointDrillGameOver(callback)
|
||||
end
|
||||
self.parent:JointDrillSync(self.nCurLevel, self.nGameTime, self.nDamageValue, "", syncCallback)
|
||||
else
|
||||
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
|
||||
NovaAPI.DispatchEventWithData("JointDrill_CacheTempData_Start", nil, {
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
0,
|
||||
0
|
||||
})
|
||||
end
|
||||
NovaAPI.DispatchEventWithData("JointDrill_CacheTempData_Start", nil, {
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
0,
|
||||
0
|
||||
})
|
||||
end
|
||||
function JointDrillLevelData_2:JointDrillFail(nResultType, netMsg, nLevel)
|
||||
local bossInfo = {}
|
||||
local mapAllBossInfo = self.parent:GetBossInfo()
|
||||
local mapCurBossInfo = mapAllBossInfo[nLevel]
|
||||
for nIndex, v in ipairs(mapCurBossInfo) do
|
||||
if v.nBossCfgId ~= 0 then
|
||||
table.insert(bossInfo, {
|
||||
nBossId = v.nBossCfgId,
|
||||
nHp = v.nHp,
|
||||
nHpMax = v.nHpMax
|
||||
})
|
||||
if mapCurBossInfo ~= nil then
|
||||
for nIndex, v in ipairs(mapCurBossInfo) do
|
||||
if v.nBossCfgId ~= 0 then
|
||||
table.insert(bossInfo, {
|
||||
nBossId = v.nBossCfgId,
|
||||
nHp = v.nHp,
|
||||
nHpMax = v.nHpMax
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
local bSimulate = self.parent:GetBattleSimulate()
|
||||
|
||||
@@ -71,6 +71,9 @@ function PreviewLevel:PlaySuccessPerform()
|
||||
elseif self.nLevelType == GameEnum.worldLevelType.DailyInstance then
|
||||
local nType = ConfigTable.GetData("DailyInstanceFloor", self.nLevelId).Theme
|
||||
sName = ConfigTable.GetData("EndSceneType", nType).EndSceneName
|
||||
elseif self.nLevelType == GameEnum.worldLevelType.ActivityStory then
|
||||
local nType = ConfigTable.GetData("ActivityLevelsFloor", self.nLevelId).Theme
|
||||
sName = ConfigTable.GetData("EndSceneType", nType).EndSceneName
|
||||
else
|
||||
local nType = ConfigTable.GetData("StarTowerMap", self.nLevelId).Theme
|
||||
sName = ConfigTable.GetData("EndSceneType", nType).EndSceneName
|
||||
|
||||
@@ -294,6 +294,12 @@ function StarTowerLevelData:Init(mapMeta, mapRoom, mapBag, lastId)
|
||||
}
|
||||
}
|
||||
self.nRoomType = mapRoom.Data.RoomType == nil and -1 or mapRoom.Data.RoomType
|
||||
local mapStarTower = ConfigTable.GetData("StarTower", self.nTowerId)
|
||||
if mapStarTower then
|
||||
local nTeamIndex = PlayerData.StarTower:GetGroupFormation(mapStarTower.GroupId)
|
||||
local nPreselectionId = PlayerData.Team:GetTeamPreselectionId(nTeamIndex)
|
||||
self.mapPreselectionData = PlayerData.PotentialPreselection:GetPreselectionById(nPreselectionId)
|
||||
end
|
||||
self.cachedClientData = mapMeta.ClientData
|
||||
self.mapCharacterTempData = DecodeTempDataJson(mapMeta.ClientData)
|
||||
self.mapEffectTriggerCount = {}
|
||||
@@ -961,7 +967,9 @@ function StarTowerLevelData:BuildCharacterData(tbCharacterData, tbDiscData)
|
||||
local mapEquipmentInfo = {
|
||||
Lock = false,
|
||||
Attributes = starTowerEquipment.Attributes,
|
||||
AlterAttributes = {}
|
||||
AlterAttributes = {},
|
||||
OverlockCount = starTowerEquipment.OverlockCount,
|
||||
AlterOverlockCount = {}
|
||||
}
|
||||
local equipmentData = EquipmentData.new(mapEquipmentInfo, mapChar.Id, nGemId)
|
||||
table.insert(tbEquipment, equipmentData)
|
||||
@@ -2430,6 +2438,33 @@ function StarTowerLevelData:GetRecommondPotential(tbPotentialData)
|
||||
for _, mapData in ipairs(tbPotentialData) do
|
||||
table.insert(tbPotential, mapData.Id)
|
||||
end
|
||||
if self.mapPreselectionData ~= nil then
|
||||
local tbRecommend = {}
|
||||
for k, v in ipairs(self.mapPreselectionData.tbCharPotential) do
|
||||
if k == 1 then
|
||||
if self.tbTeam[k] == v.nCharId then
|
||||
for _, potential in ipairs(v.tbPotential) do
|
||||
if table.indexof(tbPotential, potential.nId) > 0 then
|
||||
table.insert(tbRecommend, {
|
||||
nId = potential.nId,
|
||||
nLevel = potential.nLevel
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif 1 < table.indexof(self.tbTeam, v.nCharId) then
|
||||
for _, potential in ipairs(v.tbPotential) do
|
||||
if table.indexof(tbPotential, potential.nId) > 0 then
|
||||
table.insert(tbRecommend, {
|
||||
nId = potential.nId,
|
||||
nLevel = potential.nLevel
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return tbRecommend
|
||||
end
|
||||
local ret = {}
|
||||
local curRarity = 999
|
||||
for _, nPotentialId in ipairs(tbPotential) do
|
||||
@@ -2442,9 +2477,9 @@ function StarTowerLevelData:GetRecommondPotential(tbPotentialData)
|
||||
if curRarity > nRarity then
|
||||
ret = {}
|
||||
curRarity = nRarity
|
||||
table.insert(ret, nPotentialId)
|
||||
table.insert(ret, {nId = nPotentialId})
|
||||
elseif nRarity == curRarity then
|
||||
table.insert(ret, nPotentialId)
|
||||
table.insert(ret, {nId = nPotentialId})
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -2463,7 +2498,8 @@ function StarTowerLevelData:GetRecommondPotential(tbPotentialData)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
for _, nPotentialId in ipairs(ret) do
|
||||
for _, v in ipairs(ret) do
|
||||
local nPotentialId = v.nId
|
||||
local potentialCfg = ConfigTable.GetData("Potential", nPotentialId)
|
||||
if potentialCfg ~= nil then
|
||||
local nCharId = potentialCfg.CharId
|
||||
@@ -2471,14 +2507,14 @@ function StarTowerLevelData:GetRecommondPotential(tbPotentialData)
|
||||
if nCurCount < 0 then
|
||||
nCurCharId = nCharId
|
||||
nCurCount = nCount
|
||||
table.insert(ret1, nPotentialId)
|
||||
table.insert(ret1, {nId = nPotentialId})
|
||||
elseif nCharId ~= nCurCharId and nCount < nCurCount then
|
||||
ret1 = {}
|
||||
nCurCharId = nCharId
|
||||
nCurCount = nCount
|
||||
table.insert(ret1, nPotentialId)
|
||||
table.insert(ret1, {nId = nPotentialId})
|
||||
else
|
||||
table.insert(ret1, nPotentialId)
|
||||
table.insert(ret1, {nId = nPotentialId})
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -2514,34 +2550,35 @@ function StarTowerLevelData:GetRecommondPotential(tbPotentialData)
|
||||
end
|
||||
return ret, retBuild
|
||||
end
|
||||
for _, nPotentialId in ipairs(ret1) do
|
||||
for _, v in ipairs(ret1) do
|
||||
local nPotentialId = v.nId
|
||||
local nCount, nBuild = GetPotentialBuildCount(nPotentialId)
|
||||
if nCurBuildCount < 0 and nBuild ~= 0 then
|
||||
table.insert(ret2, nPotentialId)
|
||||
table.insert(ret2, {nId = nPotentialId})
|
||||
nCurBuildCount = nCount
|
||||
bHasBuild = nBuild ~= GameEnum.potentialBuild.PotentialBuildCommon
|
||||
elseif bHasBuild then
|
||||
if nBuild ~= GameEnum.potentialBuild.PotentialBuildCommon then
|
||||
if nCount == nCurBuildCount then
|
||||
table.insert(ret2, nPotentialId)
|
||||
table.insert(ret2, {nId = nPotentialId})
|
||||
elseif nCount > nCurBuildCount then
|
||||
ret2 = {}
|
||||
table.insert(ret2, nPotentialId)
|
||||
table.insert(ret2, {nId = nPotentialId})
|
||||
nCurBuildCount = nCount
|
||||
bHasBuild = nBuild ~= GameEnum.potentialBuild.PotentialBuildCommon
|
||||
end
|
||||
end
|
||||
elseif nBuild == GameEnum.potentialBuild.PotentialBuildCommon then
|
||||
if nCount == nCurBuildCount then
|
||||
table.insert(ret2, nPotentialId)
|
||||
table.insert(ret2, {nId = nPotentialId})
|
||||
elseif nCount > nCurBuildCount then
|
||||
ret2 = {}
|
||||
table.insert(ret2, nPotentialId)
|
||||
table.insert(ret2, {nId = nPotentialId})
|
||||
nCurBuildCount = nCount
|
||||
end
|
||||
else
|
||||
ret2 = {}
|
||||
table.insert(ret2, nPotentialId)
|
||||
table.insert(ret2, {nId = nPotentialId})
|
||||
nCurBuildCount = nCount
|
||||
bHasBuild = true
|
||||
end
|
||||
@@ -2554,7 +2591,8 @@ function StarTowerLevelData:GetRecommondPotential(tbPotentialData)
|
||||
end
|
||||
local ret3 = {}
|
||||
local curLessPotential = -1
|
||||
for _, nPotentialId in ipairs(ret2) do
|
||||
for _, v in ipairs(ret2) do
|
||||
local nPotentialId = v.nId
|
||||
local potentialCfg = ConfigTable.GetData("Potential", nPotentialId)
|
||||
if potentialCfg ~= nil then
|
||||
local nCharId = potentialCfg.CharId
|
||||
@@ -2563,13 +2601,13 @@ function StarTowerLevelData:GetRecommondPotential(tbPotentialData)
|
||||
nCurCount = self._mapPotential[nCharId][nPotentialId]
|
||||
end
|
||||
if curLessPotential < 0 then
|
||||
table.insert(ret3, nPotentialId)
|
||||
table.insert(ret3, {nId = nPotentialId})
|
||||
curLessPotential = nCurCount
|
||||
elseif nCurCount == curLessPotential then
|
||||
table.insert(ret3, nPotentialId)
|
||||
table.insert(ret3, {nId = nPotentialId})
|
||||
elseif nCurCount < curLessPotential then
|
||||
ret3 = {}
|
||||
table.insert(ret3, nPotentialId)
|
||||
table.insert(ret3, {nId = nPotentialId})
|
||||
curLessPotential = nCurCount
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1396,9 +1396,15 @@ function StarTowerPrologueLevel:CacheTempData()
|
||||
self.mapCharacterTempData.ammoInfo[charTid].nAmmo1 = tbAmmo[0]
|
||||
self.mapCharacterTempData.ammoInfo[charTid].nAmmo2 = tbAmmo[1]
|
||||
self.mapCharacterTempData.ammoInfo[charTid].nAmmo3 = tbAmmo[2]
|
||||
self.mapCharacterTempData.ammoInfo[charTid].nAmmoMax1 = tbAmmo[3]
|
||||
self.mapCharacterTempData.ammoInfo[charTid].nAmmoMax2 = tbAmmo[4]
|
||||
self.mapCharacterTempData.ammoInfo[charTid].nAmmoMax3 = tbAmmo[5]
|
||||
if tbAmmo.Length >= 6 then
|
||||
self.mapCharacterTempData.ammoInfo[charTid].nAmmoMax1 = tbAmmo[3]
|
||||
self.mapCharacterTempData.ammoInfo[charTid].nAmmoMax2 = tbAmmo[4]
|
||||
self.mapCharacterTempData.ammoInfo[charTid].nAmmoMax3 = tbAmmo[5]
|
||||
else
|
||||
self.mapCharacterTempData.ammoInfo[charTid].nAmmoMax1 = 0
|
||||
self.mapCharacterTempData.ammoInfo[charTid].nAmmoMax2 = 0
|
||||
self.mapCharacterTempData.ammoInfo[charTid].nAmmoMax3 = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1696,9 +1702,9 @@ function StarTowerPrologueLevel:GetRecommondPotential(tbPotentialData)
|
||||
if curRarity > nRarity then
|
||||
ret = {}
|
||||
curRarity = nRarity
|
||||
table.insert(ret, nPotentialId)
|
||||
table.insert(ret, {nId = nPotentialId})
|
||||
elseif nRarity == curRarity then
|
||||
table.insert(ret, nPotentialId)
|
||||
table.insert(ret, {nId = nPotentialId})
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1717,7 +1723,8 @@ function StarTowerPrologueLevel:GetRecommondPotential(tbPotentialData)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
for _, nPotentialId in ipairs(ret) do
|
||||
for _, v in ipairs(ret) do
|
||||
local nPotentialId = v.nId
|
||||
local potentialCfg = ConfigTable.GetData("Potential", nPotentialId)
|
||||
if potentialCfg ~= nil then
|
||||
local nCharId = potentialCfg.CharId
|
||||
@@ -1725,14 +1732,14 @@ function StarTowerPrologueLevel:GetRecommondPotential(tbPotentialData)
|
||||
if nCurCount < 0 then
|
||||
nCurCharId = nCharId
|
||||
nCurCount = nCount
|
||||
table.insert(ret1, nPotentialId)
|
||||
table.insert(ret1, {nId = nPotentialId})
|
||||
elseif nCharId ~= nCurCharId and nCount < nCurCount then
|
||||
ret1 = {}
|
||||
nCurCharId = nCharId
|
||||
nCurCount = nCount
|
||||
table.insert(ret1, nPotentialId)
|
||||
table.insert(ret1, {nId = nPotentialId})
|
||||
else
|
||||
table.insert(ret1, nPotentialId)
|
||||
table.insert(ret1, {nId = nPotentialId})
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1755,16 +1762,17 @@ function StarTowerPrologueLevel:GetRecommondPotential(tbPotentialData)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
for _, nPotentialId in ipairs(ret1) do
|
||||
for _, v in ipairs(ret1) do
|
||||
local nPotentialId = v.nId
|
||||
local nCount = GetPotentialBuildCount(nPotentialId)
|
||||
if nCurBuildCount < 0 then
|
||||
table.insert(ret2, nPotentialId)
|
||||
table.insert(ret2, {nId = nPotentialId})
|
||||
nCurBuildCount = nCount
|
||||
elseif nCount == nCurBuildCount then
|
||||
table.insert(ret2, nPotentialId)
|
||||
table.insert(ret2, {nId = nPotentialId})
|
||||
elseif nCount < nCurBuildCount then
|
||||
ret2 = {}
|
||||
table.insert(ret2, nPotentialId)
|
||||
table.insert(ret2, {nId = nPotentialId})
|
||||
nCurBuildCount = nCount
|
||||
end
|
||||
end
|
||||
@@ -1773,7 +1781,8 @@ function StarTowerPrologueLevel:GetRecommondPotential(tbPotentialData)
|
||||
end
|
||||
local ret3 = {}
|
||||
local curLessPotential = -1
|
||||
for _, nPotentialId in ipairs(ret2) do
|
||||
for _, v in ipairs(ret2) do
|
||||
local nPotentialId = v.nId
|
||||
local potentialCfg = ConfigTable.GetData("Potential", nPotentialId)
|
||||
if potentialCfg ~= nil then
|
||||
local nCharId = potentialCfg.CharId
|
||||
@@ -1782,13 +1791,13 @@ function StarTowerPrologueLevel:GetRecommondPotential(tbPotentialData)
|
||||
nCurCount = self._mapPotential[nCharId][nPotentialId]
|
||||
end
|
||||
if curLessPotential < 0 then
|
||||
table.insert(ret3, nPotentialId)
|
||||
table.insert(ret3, {nId = nPotentialId})
|
||||
curLessPotential = nCurCount
|
||||
elseif nCurCount == curLessPotential then
|
||||
table.insert(ret3, nPotentialId)
|
||||
table.insert(ret3, {nId = nPotentialId})
|
||||
elseif nCurCount < curLessPotential then
|
||||
ret3 = {}
|
||||
table.insert(ret3, nPotentialId)
|
||||
table.insert(ret3, {nId = nPotentialId})
|
||||
curLessPotential = nCurCount
|
||||
end
|
||||
end
|
||||
|
||||
@@ -139,6 +139,12 @@ function StarTowerSweepData:Init(mapMeta, mapRoom, mapBag)
|
||||
self.nRankBattleTime = 0
|
||||
end
|
||||
self.nRoomType = mapRoom.Data.RoomType == nil and -1 or mapRoom.Data.RoomType
|
||||
local mapStarTower = ConfigTable.GetData("StarTower", self.nTowerId)
|
||||
if mapStarTower then
|
||||
local nTeamIndex = PlayerData.StarTower:GetGroupFormation(mapStarTower.GroupId)
|
||||
local nPreselectionId = PlayerData.Team:GetTeamPreselectionId(nTeamIndex)
|
||||
self.mapPreselectionData = PlayerData.PotentialPreselection:GetPreselectionById(nPreselectionId)
|
||||
end
|
||||
if mapBag ~= nil then
|
||||
for _, mapFateCardEft in ipairs(mapBag.FateCard) do
|
||||
self._mapFateCard[mapFateCardEft.Tid] = {
|
||||
@@ -194,7 +200,9 @@ function StarTowerSweepData:BuildCharacterData(tbCharacterData, tbDiscData)
|
||||
local mapEquipmentInfo = {
|
||||
Lock = false,
|
||||
Attributes = starTowerEquipment.Attributes,
|
||||
AlterAttributes = {}
|
||||
AlterAttributes = {},
|
||||
OverlockCount = starTowerEquipment.OverlockCount,
|
||||
AlterOverlockCount = {}
|
||||
}
|
||||
local equipmentData = EquipmentData.new(mapEquipmentInfo, mapChar.Id, nGemId)
|
||||
table.insert(tbEquipment, equipmentData)
|
||||
@@ -1651,6 +1659,33 @@ function StarTowerSweepData:GetRecommondPotential(tbPotentialData)
|
||||
for _, mapData in ipairs(tbPotentialData) do
|
||||
table.insert(tbPotential, mapData.Id)
|
||||
end
|
||||
if self.mapPreselectionData ~= nil then
|
||||
local tbRecommend = {}
|
||||
for k, v in ipairs(self.mapPreselectionData.tbCharPotential) do
|
||||
if k == 1 then
|
||||
if self.tbTeam[k] == v.nCharId then
|
||||
for _, potential in ipairs(v.tbPotential) do
|
||||
if table.indexof(tbPotential, potential.nId) > 0 then
|
||||
table.insert(tbRecommend, {
|
||||
nId = potential.nId,
|
||||
nLevel = potential.nLevel
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif 1 < table.indexof(self.tbTeam, v.nCharId) then
|
||||
for _, potential in ipairs(v.tbPotential) do
|
||||
if table.indexof(tbPotential, potential.nId) > 0 then
|
||||
table.insert(tbRecommend, {
|
||||
nId = potential.nId,
|
||||
nLevel = potential.nLevel
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return tbRecommend
|
||||
end
|
||||
local ret = {}
|
||||
local curRarity = 999
|
||||
for _, nPotentialId in ipairs(tbPotential) do
|
||||
@@ -1663,9 +1698,9 @@ function StarTowerSweepData:GetRecommondPotential(tbPotentialData)
|
||||
if curRarity > nRarity then
|
||||
ret = {}
|
||||
curRarity = nRarity
|
||||
table.insert(ret, nPotentialId)
|
||||
table.insert(ret, {nId = nPotentialId})
|
||||
elseif nRarity == curRarity then
|
||||
table.insert(ret, nPotentialId)
|
||||
table.insert(ret, {nId = nPotentialId})
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1684,7 +1719,8 @@ function StarTowerSweepData:GetRecommondPotential(tbPotentialData)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
for _, nPotentialId in ipairs(ret) do
|
||||
for _, v in ipairs(ret) do
|
||||
local nPotentialId = v.nId
|
||||
local potentialCfg = ConfigTable.GetData("Potential", nPotentialId)
|
||||
if potentialCfg ~= nil then
|
||||
local nCharId = potentialCfg.CharId
|
||||
@@ -1692,14 +1728,14 @@ function StarTowerSweepData:GetRecommondPotential(tbPotentialData)
|
||||
if nCurCount < 0 then
|
||||
nCurCharId = nCharId
|
||||
nCurCount = nCount
|
||||
table.insert(ret1, nPotentialId)
|
||||
table.insert(ret1, {nId = nPotentialId})
|
||||
elseif nCharId ~= nCurCharId and nCount < nCurCount then
|
||||
ret1 = {}
|
||||
nCurCharId = nCharId
|
||||
nCurCount = nCount
|
||||
table.insert(ret1, nPotentialId)
|
||||
table.insert(ret1, {nId = nPotentialId})
|
||||
else
|
||||
table.insert(ret1, nPotentialId)
|
||||
table.insert(ret1, {nId = nPotentialId})
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1735,34 +1771,35 @@ function StarTowerSweepData:GetRecommondPotential(tbPotentialData)
|
||||
end
|
||||
return ret, retBuild
|
||||
end
|
||||
for _, nPotentialId in ipairs(ret1) do
|
||||
for _, v in ipairs(ret1) do
|
||||
local nPotentialId = v.nId
|
||||
local nCount, nBuild = GetPotentialBuildCount(nPotentialId)
|
||||
if nCurBuildCount < 0 and nBuild ~= 0 then
|
||||
table.insert(ret2, nPotentialId)
|
||||
table.insert(ret2, {nId = nPotentialId})
|
||||
nCurBuildCount = nCount
|
||||
bHasBuild = nBuild ~= GameEnum.potentialBuild.PotentialBuildCommon
|
||||
elseif bHasBuild then
|
||||
if nBuild ~= GameEnum.potentialBuild.PotentialBuildCommon then
|
||||
if nCount == nCurBuildCount then
|
||||
table.insert(ret2, nPotentialId)
|
||||
table.insert(ret2, {nId = nPotentialId})
|
||||
elseif nCount > nCurBuildCount then
|
||||
ret2 = {}
|
||||
table.insert(ret2, nPotentialId)
|
||||
table.insert(ret2, {nId = nPotentialId})
|
||||
nCurBuildCount = nCount
|
||||
bHasBuild = nBuild ~= GameEnum.potentialBuild.PotentialBuildCommon
|
||||
end
|
||||
end
|
||||
elseif nBuild == GameEnum.potentialBuild.PotentialBuildCommon then
|
||||
if nCount == nCurBuildCount then
|
||||
table.insert(ret2, nPotentialId)
|
||||
table.insert(ret2, {nId = nPotentialId})
|
||||
elseif nCount > nCurBuildCount then
|
||||
ret2 = {}
|
||||
table.insert(ret2, nPotentialId)
|
||||
table.insert(ret2, {nId = nPotentialId})
|
||||
nCurBuildCount = nCount
|
||||
end
|
||||
else
|
||||
ret2 = {}
|
||||
table.insert(ret2, nPotentialId)
|
||||
table.insert(ret2, {nId = nPotentialId})
|
||||
nCurBuildCount = nCount
|
||||
bHasBuild = true
|
||||
end
|
||||
@@ -1775,7 +1812,8 @@ function StarTowerSweepData:GetRecommondPotential(tbPotentialData)
|
||||
end
|
||||
local ret3 = {}
|
||||
local curLessPotential = -1
|
||||
for _, nPotentialId in ipairs(ret2) do
|
||||
for _, v in ipairs(ret2) do
|
||||
local nPotentialId = v.nId
|
||||
local potentialCfg = ConfigTable.GetData("Potential", nPotentialId)
|
||||
if potentialCfg ~= nil then
|
||||
local nCharId = potentialCfg.CharId
|
||||
@@ -1784,13 +1822,13 @@ function StarTowerSweepData:GetRecommondPotential(tbPotentialData)
|
||||
nCurCount = self._mapPotential[nCharId][nPotentialId]
|
||||
end
|
||||
if curLessPotential < 0 then
|
||||
table.insert(ret3, nPotentialId)
|
||||
table.insert(ret3, {nId = nPotentialId})
|
||||
curLessPotential = nCurCount
|
||||
elseif nCurCount == curLessPotential then
|
||||
table.insert(ret3, nPotentialId)
|
||||
table.insert(ret3, {nId = nPotentialId})
|
||||
elseif nCurCount < curLessPotential then
|
||||
ret3 = {}
|
||||
table.insert(ret3, nPotentialId)
|
||||
table.insert(ret3, {nId = nPotentialId})
|
||||
curLessPotential = nCurCount
|
||||
end
|
||||
end
|
||||
|
||||
@@ -36,8 +36,13 @@ function StoryLevel:Init(parent, nLevelId, nBuildId, bActivityStory)
|
||||
table.insert(self.tbDiscId, nDiscId)
|
||||
end
|
||||
end
|
||||
PlayerData.nCurGameType = AllEnum.WorldMapNodeType.Mainline
|
||||
CS.AdventureModuleHelper.EnterMainlineMap(mapStory.FloorId[1], self.tbCharId, {})
|
||||
if bActivityStory then
|
||||
PlayerData.nCurGameType = AllEnum.WorldMapNodeType.ActivityStory
|
||||
CS.AdventureModuleHelper.EnterActivityStoryLevelsInstance(mapStory.FloorId[1], self.tbCharId)
|
||||
else
|
||||
PlayerData.nCurGameType = AllEnum.WorldMapNodeType.Mainline
|
||||
CS.AdventureModuleHelper.EnterMainlineMap(mapStory.FloorId[1], self.tbCharId, {})
|
||||
end
|
||||
NovaAPI.EnterModule("AdventureModuleScene", true, 17)
|
||||
end
|
||||
if self.bTrialLevel then
|
||||
@@ -178,7 +183,7 @@ function StoryLevel:PlaySuccessPerform(FadeTime, mapChangeInfo, sVideoName)
|
||||
local storyCfg = self.bActivityStory == true and ConfigTable.GetData("ActivityStory", self.nLevelId) or ConfigTable.GetData_Story(self.nLevelId)
|
||||
local nFloorCount = #storyCfg.FloorId
|
||||
local nMapId = storyCfg.FloorId[nFloorCount]
|
||||
local nType = ConfigTable.GetData("MainlineFloor", nMapId).Theme
|
||||
local nType = self.bActivityStory == true and ConfigTable.GetData("ActivityLevelsFloor", nMapId).Theme or ConfigTable.GetData("MainlineFloor", nMapId).Theme
|
||||
local sName = ConfigTable.GetData("EndSceneType", nType).EndSceneName
|
||||
EventManager.Add("SettlementPerformLoadFinish", self, openBattleResultPanel)
|
||||
local tbSkin = {}
|
||||
@@ -271,7 +276,11 @@ function StoryLevel:ChangeFloor()
|
||||
self:SetCharStatus()
|
||||
end
|
||||
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelUnloadCallback)
|
||||
CS.AdventureModuleHelper.EnterMainlineMap(mapStory.FloorId[self.curFloorIdx], self.tbCharId, {})
|
||||
if self.bActivityStory then
|
||||
CS.AdventureModuleHelper.EnterActivityStoryLevelsInstance(mapStory.FloorId[self.curFloorIdx], self.tbCharId)
|
||||
else
|
||||
CS.AdventureModuleHelper.EnterMainlineMap(mapStory.FloorId[self.curFloorIdx], self.tbCharId, {})
|
||||
end
|
||||
CS.AdventureModuleHelper.LevelStateChanged(false)
|
||||
self.bSettle = false
|
||||
end
|
||||
|
||||
@@ -70,6 +70,9 @@ GameEnum.roguelikeLevelStyle = {
|
||||
Forest_Main_2_5 = 17,
|
||||
Main_5_1 = 18,
|
||||
Main_6_2 = 19,
|
||||
Main_7_1 = 20,
|
||||
Main_7_2 = 21,
|
||||
Main_8_1 = 22,
|
||||
Roguelike_non = 101,
|
||||
Roguelike_miniboss = 102,
|
||||
Roguelike_shilaimu = 103,
|
||||
@@ -88,6 +91,7 @@ GameEnum.roguelikeLevelStyle = {
|
||||
DailyInstance_02 = 116,
|
||||
DailyInstance_03 = 117,
|
||||
Boss_TuRen = 118,
|
||||
Boss_PX = 119,
|
||||
TravelBoss_Maoyan = 201,
|
||||
TravelBoss_Huayuan = 202,
|
||||
TravelBoss_Huochui = 203,
|
||||
@@ -114,6 +118,11 @@ GameEnum.roguelikeLevelStyle = {
|
||||
StoryActivity_7_Tow = 432,
|
||||
StoryActivity_8 = 436,
|
||||
StoryActivity_9 = 441,
|
||||
StoryActivity_10 = 446,
|
||||
StoryActivity_11 = 451,
|
||||
StoryActivity_12 = 456,
|
||||
StoryActivity_13 = 461,
|
||||
StoryActivity_14 = 466,
|
||||
Training = 901
|
||||
}
|
||||
GameEnum.roguelikeFloorFunction = {
|
||||
@@ -132,7 +141,14 @@ GameEnum.effectiveGoals = {
|
||||
ASSISTANT_PLAYER = 7,
|
||||
TEAM_SUMMONED = 8,
|
||||
FULL_TEAM_AND_SUMMONED = 9,
|
||||
ONESELF_AND_SUMMONED = 10
|
||||
ONESELF_AND_SUMMONED = 10,
|
||||
FRIEND_FACTION = 11,
|
||||
FRIEND_AND_ENEMY_FACTION = 12,
|
||||
FROM_ACTOR_SUMMONED = 13,
|
||||
TEAMMATE_SUMMONED = 14,
|
||||
ENEMY_SUMMONED = 15,
|
||||
FRIEND_AND_ENEMY_SUMMONED = 16,
|
||||
TEAMMATE_AND_SUMMONED = 17
|
||||
}
|
||||
GameEnum.screen = {
|
||||
NONE = 0,
|
||||
@@ -233,7 +249,8 @@ GameEnum.worldLevelType = {
|
||||
ActivityLevels = 20,
|
||||
BrickBreaker = 21,
|
||||
TowerDefense = 22,
|
||||
Tutorial = 23
|
||||
Tutorial = 23,
|
||||
ActivityStory = 24
|
||||
}
|
||||
GameEnum.dynamicLevelType = {
|
||||
JointDrill = 1,
|
||||
@@ -501,7 +518,8 @@ GameEnum.itemType = {
|
||||
MonthlyCard = 11,
|
||||
Title = 12,
|
||||
Honor = 13,
|
||||
HeadItem = 14
|
||||
HeadItem = 14,
|
||||
LevelHonor = 15
|
||||
}
|
||||
GameEnum.expireType = {
|
||||
ExpireMin = 1,
|
||||
@@ -591,9 +609,6 @@ GameEnum.achievementCond = {
|
||||
SkinAcquire = 61,
|
||||
StageClearSpecificStars = 62,
|
||||
StoryClear = 63,
|
||||
TravelerDuelChallengeSpecificBoosLevelWithDifficultyAndTotal = 64,
|
||||
TravelerDuelChallengeClearSpecificBossLevelAndAffix = 67,
|
||||
TravelerDuelClearSpecificBossTotal = 69,
|
||||
WorldClassSpecific = 71,
|
||||
RegionBossClearSpecificTypeWithTotal = 72,
|
||||
CharactersWithSpecificDatingCount = 73,
|
||||
@@ -704,7 +719,16 @@ GameEnum.activityQuestCompleteCond = {
|
||||
ActivityThrowGiftAccUseItem = 138,
|
||||
ActivityThrowGiftLevelHitGift = 139,
|
||||
ActivityThrowGiftLevelScore = 140,
|
||||
ActivityThrowGiftLevelThrowGift = 141
|
||||
ActivityThrowGiftLevelThrowGift = 141,
|
||||
ActivityGoldenSpyAccPickItem = 142,
|
||||
ActivityGoldenSpyAccMaxScore = 143,
|
||||
ActivityGoldenSpyPassFloorInSpecifiedLevel = 144,
|
||||
ActivityGoldenSpyAccGroupMaxScore = 145,
|
||||
ActivityGoldenSpyGetScoreInSpecifiedLevel = 146,
|
||||
ActivityGoldenSpyAccCompleteTask = 147,
|
||||
ActivityGoldenSpyAccUseSkill = 148,
|
||||
ActivityPenguinCardClearScore = 149,
|
||||
ActivityPenguinCardClearStar = 150
|
||||
}
|
||||
GameEnum.chatCond = {
|
||||
CharacterAcquire = 5,
|
||||
@@ -809,9 +833,10 @@ GameEnum.questCompleteCond = {
|
||||
SkillsWithSpecificQuantityAndLevel = 60,
|
||||
StageClearSpecificStars = 62,
|
||||
StoryClear = 63,
|
||||
TravelerDuelChallengeSpecificBoosLevelWithDifficultyAndTotal = 64,
|
||||
TravelerDuelChallengeClearSpecificBossLevelAndAffix = 67,
|
||||
TravelerDuelClearSpecificBossTotal = 69,
|
||||
TrekkerVersusClearCount = 64,
|
||||
TrekkerVersusClearWithSpecificAffix = 65,
|
||||
TrekkerVersusClearWithSpecificDifficultyAndTotal = 66,
|
||||
TrekkerVersusFansWithSpecificLevel = 67,
|
||||
WorldClassSpecific = 71,
|
||||
RegionBossClearSpecificTypeWithTotal = 72,
|
||||
CharactersWithSpecificDatingCount = 73,
|
||||
@@ -956,7 +981,8 @@ GameEnum.vampireSurvivorCond = {
|
||||
GameEnum.honorType = {
|
||||
Normal = 1,
|
||||
Character = 2,
|
||||
Group = 3
|
||||
Group = 3,
|
||||
Levels = 4
|
||||
}
|
||||
GameEnum.headType = {
|
||||
HeroineAvatar = 1,
|
||||
@@ -1190,7 +1216,8 @@ GameEnum.effectAttributeType = {
|
||||
SUMMON_SUPPRESS = 93,
|
||||
PROJECTILE_SUPPRESS = 94,
|
||||
OTHER_SUPPRESS = 95,
|
||||
MAX = 96
|
||||
ENV_AMEND = 96,
|
||||
MAX = 97
|
||||
}
|
||||
GameEnum.attributeFinialLimitType = {
|
||||
FINAL_ELEMENTTYPE_DAMAGETYPE_DMG = 1,
|
||||
@@ -1295,7 +1322,8 @@ GameEnum.takeEffect = {
|
||||
WEAKELEMENTTYPE = 50,
|
||||
CERTAIN_MARK_TYPE = 51,
|
||||
BE_MIANCONTROL = 52,
|
||||
BE_ASSISTANT = 53
|
||||
BE_ASSISTANT = 53,
|
||||
CERTAIN_DAMAGETYPE = 54
|
||||
}
|
||||
GameEnum.effectType = {
|
||||
STATE_CAHNGE = 1,
|
||||
@@ -1343,7 +1371,17 @@ GameEnum.effectType = {
|
||||
STATE_AMOUNT = 50,
|
||||
DROP_ITEM_PICKUP_RANGE_FIX = 51,
|
||||
ELEMENTTYPE_ATTR_FIX = 52,
|
||||
DAMAGETYPE_ATTR_FIX = 53
|
||||
DAMAGETYPE_ATTR_FIX = 53,
|
||||
HITTED_ADDITIONAL_ELEMENTTYPE_ATTR_FIX = 54,
|
||||
HITTED_ADDITIONAL_DAMAGETYPE_ATTR_FIX = 55,
|
||||
ELEMENTTYPE_ATTR_PERCENT_FIX = 56,
|
||||
DAMAGETYPE_ATTR_PERCENT_FIX = 57,
|
||||
HITTED_ADDITIONAL_ELEMENTTYPE_ATTR_PERCENT_FIX = 58,
|
||||
HITTED_ADDITIONAL_DAMAGETYPE_ATTR_PERCENT_FIX = 59,
|
||||
ELEMENTTYPE_ATTR_ASSIGNMENT = 60,
|
||||
DAMAGETYPE_ATTR_ASSIGNMENT = 61,
|
||||
ELEMENTTYPE_ATTR_PERCENT_ASSIGNMENT = 62,
|
||||
DAMAGETYPE_ATTR_PERCENT_ASSIGNMENT = 63
|
||||
}
|
||||
GameEnum.stateAttributeType = {
|
||||
NONE = 0,
|
||||
@@ -1421,6 +1459,7 @@ GameEnum.itemStype = {
|
||||
TalentStrengthen = 9,
|
||||
DiscStrengthen = 12,
|
||||
DiscPromote = 13,
|
||||
LevelHonor = 15,
|
||||
TreasureBox = 17,
|
||||
GearTreasureBox = 18,
|
||||
SubNoteSkill = 19,
|
||||
@@ -1787,7 +1826,8 @@ GameEnum.activityType = {
|
||||
TrekkerVersus = 16,
|
||||
Story = 17,
|
||||
PenguinCard = 18,
|
||||
ThrowGift = 19
|
||||
ThrowGift = 19,
|
||||
GoldenSpy = 20
|
||||
}
|
||||
GameEnum.activityOpenType = {
|
||||
None = 0,
|
||||
@@ -1931,7 +1971,10 @@ GameEnum.BrickDropType = {
|
||||
BrickExpCoin = 3,
|
||||
BrickHp = 4,
|
||||
BrickPaddle = 5,
|
||||
BrickBoom = 6
|
||||
BrickBoom = 6,
|
||||
BrickBoomBall = 7,
|
||||
BrickInv = 8,
|
||||
BrickSplit = 9
|
||||
}
|
||||
GameEnum.starTowerRoomType = {
|
||||
BattleRoom = 0,
|
||||
@@ -2300,7 +2343,11 @@ GameEnum.scoreBossBehavior = {
|
||||
TriggerFengNiaoBeatFlowerWhenUltraSkill = 21,
|
||||
TriggerFengNiaoFlowerMissPlayer = 22,
|
||||
TriggerTaiDengMissPlayer = 23,
|
||||
TriggerTaiDengKill = 24
|
||||
TriggerTaiDengKill = 24,
|
||||
TriggerCommon1 = 25,
|
||||
TriggerCommon2 = 26,
|
||||
TriggerCommon3 = 27,
|
||||
TriggerCommon4 = 28
|
||||
}
|
||||
GameEnum.scoreBossType = {WildCard = 1}
|
||||
GameEnum.JointDrillBattleLvsToggle = {HpLessThan = 1}
|
||||
@@ -2322,7 +2369,8 @@ GameEnum.bannerType = {
|
||||
MallSkin = 6,
|
||||
Payment = 7,
|
||||
TimeLimit_Func = 8,
|
||||
JumpToUrl = 9
|
||||
JumpToUrl = 9,
|
||||
SeaPayment = 10
|
||||
}
|
||||
GameEnum.FrozenTimeHighlightUnit = {Self = 1, SelfAndTarget = 2}
|
||||
GameEnum.TowerDefGuideType = {Character = 1, Item = 2}
|
||||
@@ -2452,7 +2500,8 @@ GameEnum.activityThemeType = {
|
||||
Miracle_10103 = 6,
|
||||
Spring_10104 = 7,
|
||||
WinterNight_10105 = 8,
|
||||
Postal_10106 = 9
|
||||
Postal_10106 = 9,
|
||||
SoloDance_20102 = 10
|
||||
}
|
||||
GameEnum.ActivityLevelType = {
|
||||
Explore = 1,
|
||||
@@ -2602,14 +2651,28 @@ GameEnum.PenguinBaseCardSuit = {
|
||||
GameEnum.PenguinCardTriggerPhase = {
|
||||
Dealing = 1,
|
||||
Flip = 2,
|
||||
Settlement = 3
|
||||
Settlement = 3,
|
||||
Prepare = 4,
|
||||
BeforeUpgrade = 5,
|
||||
AfterUpgrade = 6,
|
||||
FatalDamage = 7,
|
||||
PenguinCardChange = 8,
|
||||
FlipEnd = 9
|
||||
}
|
||||
GameEnum.PenguinCardTriggerType = {
|
||||
None = 1,
|
||||
SuitCards = 2,
|
||||
SuitCount = 3,
|
||||
HandRankSuitCount = 4,
|
||||
BaseCardId = 5
|
||||
BaseCardId = 5,
|
||||
RepeatHandRank = 6,
|
||||
HandRank = 7
|
||||
}
|
||||
GameEnum.PenguinCardGrowthTriggerType = {
|
||||
None = 1,
|
||||
SuitCountInCard = 2,
|
||||
LevelCount = 3,
|
||||
HandRank = 4
|
||||
}
|
||||
GameEnum.PenguinCardTriggerLimit = {
|
||||
None = 1,
|
||||
@@ -2617,12 +2680,31 @@ GameEnum.PenguinCardTriggerLimit = {
|
||||
Turn = 3,
|
||||
Game = 4
|
||||
}
|
||||
GameEnum.PenguinCardGrowthType = {
|
||||
None = 1,
|
||||
FullGame = 2,
|
||||
CurTurn = 3
|
||||
}
|
||||
GameEnum.PenguinCardEffectType = {
|
||||
ReplaceBaseCard = 1,
|
||||
AddBaseCardWeight = 2,
|
||||
IncreaseBasicChips = 3,
|
||||
IncreaseMultiplier = 4,
|
||||
MultiMultiplier = 5
|
||||
MultiMultiplier = 5,
|
||||
UpgradeDiscount = 6,
|
||||
AddRound = 7,
|
||||
BlockFatalDamage = 8,
|
||||
UpgradeRebate = 9
|
||||
}
|
||||
GameEnum.PenguinCardQuestType = {
|
||||
Score = 1,
|
||||
SuitCount = 2,
|
||||
HandRank = 3
|
||||
}
|
||||
GameEnum.PenguinCardBuffDuration = {
|
||||
FullGame = 1,
|
||||
Count = 2,
|
||||
Turn = 3
|
||||
}
|
||||
GameEnum.ThrowGiftSpawnPointType = {
|
||||
None = 0,
|
||||
@@ -2634,7 +2716,13 @@ GameEnum.ThrowGiftSpawnCond = {
|
||||
All = 2,
|
||||
Random = 3
|
||||
}
|
||||
GameEnum.SpecialObstacleType = {Score = 1, Obstacle = 2}
|
||||
GameEnum.SpecialObstacleType = {
|
||||
Score = 1,
|
||||
Obstacle = 2,
|
||||
WindForce = 3,
|
||||
Portal = 4,
|
||||
PortalExit = 5
|
||||
}
|
||||
GameEnum.MallPackageRarity = {
|
||||
White = 1,
|
||||
Green = 2,
|
||||
@@ -2679,4 +2767,53 @@ GameEnum.TravelerDuelHotValueItemType = {
|
||||
TypeC = 3
|
||||
}
|
||||
GameEnum.CharPlotType = {CharPlot = 1, SkinPlot = 2}
|
||||
GameEnum.GoldenSpyLevelType = {
|
||||
Normal = 1,
|
||||
Quest = 2,
|
||||
Random = 3
|
||||
}
|
||||
GameEnum.GoldenSpyBuffEffect = {
|
||||
AddScore = 1,
|
||||
AddTaskWeight = 2,
|
||||
AddExScoreFactor = 3,
|
||||
ReduceItemWeight = 4,
|
||||
AddSkillUseCount = 5,
|
||||
SpeedUpHook = 6,
|
||||
AddHookRadius = 7,
|
||||
AddHookK = 8,
|
||||
AddTimeInFloor = 9,
|
||||
LabelAddPercentage = 10
|
||||
}
|
||||
GameEnum.GoldenSpyBuffQty = {}
|
||||
GameEnum.GoldenSpyBuffType = {
|
||||
TemporaryBuff = 1,
|
||||
DelayBuff = 2,
|
||||
PermanentBuff = 3,
|
||||
SkillCountBuff = 4
|
||||
}
|
||||
GameEnum.GoldenSpyItem = {
|
||||
FileBag = 1,
|
||||
Furniture = 2,
|
||||
Gem = 3,
|
||||
IntelligenceScroll = 4,
|
||||
ChipDevice = 5,
|
||||
SafeBox = 6,
|
||||
Patrol = 7,
|
||||
Companion = 8,
|
||||
Boom = 9,
|
||||
BuffItem = 10
|
||||
}
|
||||
GameEnum.GoldenSpyObstacle = {Laser = 1}
|
||||
GameEnum.CharRechargeSpeed = {
|
||||
SupHigh = 1,
|
||||
High = 2,
|
||||
Mid = 3,
|
||||
Low = 4
|
||||
}
|
||||
GameEnum.CharEnergyCostSpeed = {
|
||||
SupHigh = 1,
|
||||
High = 2,
|
||||
Mid = 3,
|
||||
Low = 4
|
||||
}
|
||||
return GameEnum
|
||||
|
||||
@@ -486,6 +486,33 @@ GameTableDefine.CommonTable = {
|
||||
GMOrder = {},
|
||||
GMSuperman = {Key = true},
|
||||
GMTeam = {Key = true},
|
||||
GoldenSpyBuffCard = {
|
||||
Key = true,
|
||||
Lang = {"Name", "Desc"}
|
||||
},
|
||||
GoldenSpyBuffCardPool = {Key = true},
|
||||
GoldenSpyConfig = {Key = true},
|
||||
GoldenSpyControl = {Key = true},
|
||||
GoldenSpyExtraScore = {Key = true},
|
||||
GoldenSpyFloor = {Key = true},
|
||||
GoldenSpyItem = {
|
||||
Key = true,
|
||||
Lang = {"Name"}
|
||||
},
|
||||
GoldenSpyLevel = {
|
||||
Key = true,
|
||||
Lang = {
|
||||
"LevelName",
|
||||
"WinCondDesc",
|
||||
"LevelDesc"
|
||||
}
|
||||
},
|
||||
GoldenSpyLevelGroup = {
|
||||
Key = true,
|
||||
Lang = {"GroupName"}
|
||||
},
|
||||
GoldenSpyObstacle = {Key = true},
|
||||
GoldenSpySkill = {Key = true},
|
||||
Guide = {Key = true},
|
||||
GuideGroup = {Key = true},
|
||||
Handbook = {Key = true},
|
||||
@@ -495,6 +522,7 @@ GameTableDefine.CommonTable = {
|
||||
Lang = {"Name"}
|
||||
},
|
||||
HonorCharacter = {Key = true},
|
||||
HonorLevel = {Key = true},
|
||||
HtmlConfig = {Key = true},
|
||||
InfinityTower = {
|
||||
Key = true,
|
||||
@@ -686,6 +714,10 @@ GameTableDefine.CommonTable = {
|
||||
MonsterValueTempleteAdjust = {Key = true},
|
||||
MonsterValueTempleteModify = {Key = true},
|
||||
MonthlyCard = {Key = true},
|
||||
NotificationConfig = {
|
||||
Key = true,
|
||||
Lang = {"Title", "Content"}
|
||||
},
|
||||
NPCAffinityGroup = {
|
||||
Key = true,
|
||||
Lang = {
|
||||
@@ -728,6 +760,11 @@ GameTableDefine.CommonTable = {
|
||||
Key = true,
|
||||
Lang = {"Title", "Desc"}
|
||||
},
|
||||
PenguinCardBuff = {
|
||||
Key = true,
|
||||
Lang = {"Title", "Desc"}
|
||||
},
|
||||
PenguinCardBuffWeight = {Key = true},
|
||||
PenguinCardControl = {
|
||||
Key = true,
|
||||
Lang = {"DesText"}
|
||||
@@ -742,6 +779,11 @@ GameTableDefine.CommonTable = {
|
||||
Key = true,
|
||||
Lang = {"Title", "Desc"}
|
||||
},
|
||||
PenguinCardQuest = {
|
||||
Key = true,
|
||||
Lang = {"Desc"}
|
||||
},
|
||||
PenguinCardQuestWeight = {Key = true},
|
||||
PenguinCardWeight = {Key = true},
|
||||
PeriodicQuest = {
|
||||
Key = true,
|
||||
@@ -1134,7 +1176,15 @@ GameTableDefine.CommonTable = {
|
||||
Key = true,
|
||||
Lang = {"Title"}
|
||||
},
|
||||
TravelerDuelFansLevel = {Key = true},
|
||||
TravelerDuelFloor = {Key = true},
|
||||
TravelerDuelHotValueItem = {Key = true},
|
||||
TravelerDuelHotValueRewards = {Key = true},
|
||||
TravelerDuelIdleRewards = {},
|
||||
TravelerDuelTarget = {
|
||||
Key = true,
|
||||
Lang = {"RivalName"}
|
||||
},
|
||||
TrialBuild = {
|
||||
Key = true,
|
||||
Lang = {"Name"}
|
||||
|
||||
@@ -324,7 +324,9 @@ function NewTutorialsActCtrl:RefreshTeamFormation()
|
||||
local nReceivedCount, nTotalCount = 0, 0
|
||||
for i = 1, nAttrQuestCount do
|
||||
local bComplete = PlayerData.Quest:CheckTeamFormationAttributeCompleted(i)
|
||||
nReceivedCount, nTotalCount = PlayerData.Quest:GetTeamFormationAttributeProgress(i)
|
||||
local nThisReceivedCount, nThisTotalCount = PlayerData.Quest:GetTeamFormationAttributeProgress(i)
|
||||
nReceivedCount = nReceivedCount + nThisReceivedCount
|
||||
nTotalCount = nTotalCount + nThisTotalCount
|
||||
end
|
||||
if nTotalCount == nReceivedCount then
|
||||
self._mapNode.btn_GoTeamFormationPanel.gameObject:SetActive(false)
|
||||
|
||||
@@ -59,7 +59,7 @@ function BdConvertQuestCtrl:OnEnable()
|
||||
self._mapNode.animator:Play("t_window_04_t_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
function BdConvertQuestCtrl:OnDestory()
|
||||
function BdConvertQuestCtrl:OnDestroy()
|
||||
if self.tbItemCtrl ~= nil then
|
||||
for _, ctrl in pairs(self.tbItemCtrl) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
local GoldenSpyBaseItem = class("GoldenSpyBaseItem", BaseCtrl)
|
||||
GoldenSpyBaseItem._mapNodeConfig = {
|
||||
HitArea = {
|
||||
sNodeName = "HitArea",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
flash = {}
|
||||
}
|
||||
GoldenSpyBaseItem._mapEventConfig = {
|
||||
GM_GoldenSpy_Show = "OnEvent_GM_GoldenSpy_Show"
|
||||
}
|
||||
GoldenSpyBaseItem._mapRedDotConfig = {}
|
||||
function GoldenSpyBaseItem:Awake()
|
||||
self._mapNode.flash:SetActive(false)
|
||||
end
|
||||
function GoldenSpyBaseItem:OnEnable()
|
||||
end
|
||||
function GoldenSpyBaseItem:OnDisable()
|
||||
end
|
||||
function GoldenSpyBaseItem:OnDestroy()
|
||||
end
|
||||
function GoldenSpyBaseItem:Init()
|
||||
self.nUid = nil
|
||||
self.nItemId = nil
|
||||
self.trParent = self.gameObject.transform.parent
|
||||
self.bFrozen = false
|
||||
end
|
||||
function GoldenSpyBaseItem:SetData(data, floorCtrl, commonConfigId)
|
||||
self.nUid = data.nUid
|
||||
self.nItemId = data.nItemId
|
||||
self.itemCfg = ConfigTable.GetData("GoldenSpyItem", self.nItemId)
|
||||
self.nHitAreaType = data.nHitAreaType
|
||||
self.floorCtrl = floorCtrl
|
||||
self.commonConfigId = commonConfigId
|
||||
self.commonCfg = ConfigTable.GetData("GoldenSpyConfig", self.commonConfigId)
|
||||
self:InitData()
|
||||
end
|
||||
function GoldenSpyBaseItem:InitData()
|
||||
end
|
||||
function GoldenSpyBaseItem:GetUid()
|
||||
return self.nUid
|
||||
end
|
||||
function GoldenSpyBaseItem:GetItemCfg()
|
||||
return self.itemCfg
|
||||
end
|
||||
function GoldenSpyBaseItem:GetWeight()
|
||||
return self.itemCfg.Weight
|
||||
end
|
||||
function GoldenSpyBaseItem:GetScore()
|
||||
return self.itemCfg.Score
|
||||
end
|
||||
function GoldenSpyBaseItem:GetHitArea()
|
||||
local hitArea = {}
|
||||
return hitArea
|
||||
end
|
||||
function GoldenSpyBaseItem:GetParent()
|
||||
return self.trParent
|
||||
end
|
||||
function GoldenSpyBaseItem:StartFloor()
|
||||
end
|
||||
function GoldenSpyBaseItem:FinishFloor()
|
||||
end
|
||||
function GoldenSpyBaseItem:Pause()
|
||||
end
|
||||
function GoldenSpyBaseItem:Resume()
|
||||
end
|
||||
function GoldenSpyBaseItem:OnCapture(callback)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function GoldenSpyBaseItem:OnSkill_InVision(callback)
|
||||
end
|
||||
function GoldenSpyBaseItem:OnSkill_Boom(callback)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function GoldenSpyBaseItem:OnSkill_Frozen(callback)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function GoldenSpyBaseItem:OnSkill_Frozen_Resume(callback)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function GoldenSpyBaseItem:OnEvent_GM_GoldenSpy_Show()
|
||||
local img = self._mapNode.HitArea:GetComponent("Image")
|
||||
if img then
|
||||
img.enabled = true
|
||||
end
|
||||
end
|
||||
return GoldenSpyBaseItem
|
||||
@@ -0,0 +1,61 @@
|
||||
local GoldenSpyBaseTrap = class("GoldenSpyBaseTrap", BaseCtrl)
|
||||
GoldenSpyBaseTrap._mapNodeConfig = {
|
||||
TriggerArea = {
|
||||
sNodeName = "TriggerArea",
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
GoldenSpyBaseTrap._mapEventConfig = {
|
||||
GM_GoldenSpy_Show = "OnEvent_GM_GoldenSpy_Show"
|
||||
}
|
||||
GoldenSpyBaseTrap._mapRedDotConfig = {}
|
||||
function GoldenSpyBaseTrap:Awake()
|
||||
end
|
||||
function GoldenSpyBaseTrap:OnEnable()
|
||||
end
|
||||
function GoldenSpyBaseTrap:OnDisable()
|
||||
end
|
||||
function GoldenSpyBaseTrap:OnDestroy()
|
||||
end
|
||||
function GoldenSpyBaseTrap:Init()
|
||||
end
|
||||
function GoldenSpyBaseTrap:SetData(data, floorCtrl)
|
||||
self.nTrapId = data.nTrapId
|
||||
self.floorCtrl = floorCtrl
|
||||
self.trapCfg = ConfigTable.GetData("GoldenSpyObstacle", self.nTrapId)
|
||||
self:InitData()
|
||||
end
|
||||
function GoldenSpyBaseTrap:InitData()
|
||||
end
|
||||
function GoldenSpyBaseTrap:StartFloor()
|
||||
end
|
||||
function GoldenSpyBaseTrap:GetTriggerArea()
|
||||
local triggerArea = {}
|
||||
return triggerArea
|
||||
end
|
||||
function GoldenSpyBaseTrap:FinishFloor()
|
||||
end
|
||||
function GoldenSpyBaseTrap:Pause()
|
||||
end
|
||||
function GoldenSpyBaseTrap:Resume()
|
||||
end
|
||||
function GoldenSpyBaseTrap:OnSkill_Frozen(callback)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function GoldenSpyBaseTrap:OnSkill_Frozen_Resume(callback)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function GoldenSpyBaseTrap:SetHookIsInvincible()
|
||||
self.floorCtrl:SetHookIsInvincible(true)
|
||||
end
|
||||
function GoldenSpyBaseTrap:OnEvent_GM_GoldenSpy_Show()
|
||||
local img = self._mapNode.TriggerArea:GetComponent("Image")
|
||||
if img then
|
||||
img.enabled = true
|
||||
end
|
||||
end
|
||||
return GoldenSpyBaseTrap
|
||||
@@ -0,0 +1,126 @@
|
||||
local GoldenSpyBaseItem = require("Game.UI.Activity.GoldenSpy.GoldenSpyBaseItem")
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local GoldenSpyBoomItem = class("GoldenSpyBoomItem", GoldenSpyBaseItem)
|
||||
GoldenSpyBoomItem._mapNodeConfig = {
|
||||
BoomArea = {
|
||||
sNodeName = "BoomArea",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
Icon = {},
|
||||
HitArea = {
|
||||
sNodeName = "HitArea",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
Effect_Boom = {}
|
||||
}
|
||||
GoldenSpyBoomItem._mapEventConfig = {
|
||||
GM_GoldenSpy_Show = "OnEvent_GM_GoldenSpy_Show"
|
||||
}
|
||||
GoldenSpyBoomItem._mapRedDotConfig = {}
|
||||
function GoldenSpyBoomItem:Awake()
|
||||
self._mapNode.Effect_Boom.gameObject:SetActive(false)
|
||||
self.tbTimer = {}
|
||||
end
|
||||
function GoldenSpyBoomItem:OnEnable()
|
||||
end
|
||||
function GoldenSpyBoomItem:OnDisable()
|
||||
end
|
||||
function GoldenSpyBoomItem:OnDestroy()
|
||||
for _, v in ipairs(self.tbTimer) do
|
||||
if v ~= nil then
|
||||
v:Cancel()
|
||||
end
|
||||
end
|
||||
self.tbTimer = {}
|
||||
end
|
||||
function GoldenSpyBoomItem:GetHitArea()
|
||||
local tr = self.gameObject:GetComponent("RectTransform")
|
||||
local hitArea = {
|
||||
nType = self.nHitAreaType,
|
||||
center = self._mapNode.HitArea.anchoredPosition + tr.anchoredPosition,
|
||||
width = self._mapNode.HitArea.sizeDelta.x,
|
||||
height = self._mapNode.HitArea.sizeDelta.y
|
||||
}
|
||||
return hitArea
|
||||
end
|
||||
function GoldenSpyBoomItem:GetBoomArea()
|
||||
local tr = self.gameObject:GetComponent("RectTransform")
|
||||
local boomArea = {
|
||||
center = self._mapNode.BoomArea.anchoredPosition + tr.anchoredPosition,
|
||||
radius = self._mapNode.BoomArea.sizeDelta.x * 0.5
|
||||
}
|
||||
return boomArea
|
||||
end
|
||||
function GoldenSpyBoomItem:Boom(callback)
|
||||
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()
|
||||
if ctrl:GetItemCfg().ItemType == GameEnum.GoldenSpyItem.Boom then
|
||||
return
|
||||
end
|
||||
self.floorCtrl:RemoveItem(ctrl)
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
self._mapNode.Icon:SetActive(false)
|
||||
self._mapNode.Effect_Boom.gameObject:SetActive(true)
|
||||
local timer = self:AddTimer(1, 0.1, boom, true, true, true)
|
||||
table.insert(self.tbTimer, timer)
|
||||
local timer2 = self:AddTimer(1, 0.5, function()
|
||||
self.gameObject:SetActive(false)
|
||||
self.floorCtrl:RemoveItem(self)
|
||||
end, true, true, true)
|
||||
table.insert(self.tbTimer, timer2)
|
||||
WwiseAudioMgr:PostEvent("Mode_steal_boom_big")
|
||||
end
|
||||
function GoldenSpyBoomItem:OnSkill_Boom(callback)
|
||||
if callback then
|
||||
self:Boom()
|
||||
callback()
|
||||
end
|
||||
if self.gameObject then
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function GoldenSpyBoomItem:OnSkill_Frozen(callback)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function GoldenSpyBoomItem:OnSkill_Frozen_Resume(callback)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function GoldenSpyBoomItem:OnEvent_GM_GoldenSpy_Show()
|
||||
local img = self._mapNode.HitArea:GetComponent("Image")
|
||||
if img then
|
||||
img.enabled = true
|
||||
end
|
||||
local boomImg = self._mapNode.BoomArea:GetComponent("Image")
|
||||
if boomImg then
|
||||
boomImg.enabled = true
|
||||
end
|
||||
end
|
||||
return GoldenSpyBoomItem
|
||||
@@ -0,0 +1,57 @@
|
||||
local GoldenSpyBuffCellCtrl = class("GoldenSpyBuffCellCtrl", BaseCtrl)
|
||||
local BuffSpritePath = "UI_Activity/_400008/SpriteAtlas/Buff/"
|
||||
local buff_state_color = {
|
||||
[1] = Color(0.8549019607843137, 0.37254901960784315, 0.9137254901960784, 1),
|
||||
[2] = Color(0.42745098039215684, 0.4470588235294118, 0.8509803921568627, 1)
|
||||
}
|
||||
GoldenSpyBuffCellCtrl._mapNodeConfig = {
|
||||
btn_buff = {sComponentName = "UIButton"},
|
||||
img_selected = {},
|
||||
img_icon = {sComponentName = "Image"},
|
||||
img_state = {sComponentName = "Image"},
|
||||
txt_state = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
GoldenSpyBuffCellCtrl._mapEventConfig = {
|
||||
GoldenSpyBuffTipsClose = "OnEvent_BuffTipsClose"
|
||||
}
|
||||
GoldenSpyBuffCellCtrl._mapRedDotConfig = {}
|
||||
function GoldenSpyBuffCellCtrl:Awake()
|
||||
self._mapNode.img_selected:SetActive(false)
|
||||
end
|
||||
function GoldenSpyBuffCellCtrl:SetData(data)
|
||||
self.data = data
|
||||
self.buffId = self.data.buffData.buffId
|
||||
self.buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", self.buffId)
|
||||
if self.buffCfg == nil then
|
||||
return
|
||||
end
|
||||
if self.data.nState == AllEnum.GoldenSpyBuffType.UnactiveBuff then
|
||||
self._mapNode.txt_state.gameObject:SetActive(false)
|
||||
self._mapNode.img_state.gameObject:SetActive(false)
|
||||
NovaAPI.SetImageColor(self._mapNode.img_icon, Color(1, 1, 1, 0.3))
|
||||
elseif self.data.nState == AllEnum.GoldenSpyBuffType.DelayBuff then
|
||||
self._mapNode.txt_state.gameObject:SetActive(true)
|
||||
self._mapNode.img_state.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_state, ConfigTable.GetUIText("GoldenSpyBuffState2"))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_state, buff_state_color[self.data.nState])
|
||||
NovaAPI.SetImageColor(self._mapNode.img_state, buff_state_color[self.data.nState])
|
||||
NovaAPI.SetImageColor(self._mapNode.img_icon, Color(1, 1, 1, 1))
|
||||
elseif self.data.nState == AllEnum.GoldenSpyBuffType.ActiveBuff then
|
||||
self._mapNode.txt_state.gameObject:SetActive(true)
|
||||
self._mapNode.img_state.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_state, ConfigTable.GetUIText("GoldenSpyBuffState1"))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_state, buff_state_color[self.data.nState])
|
||||
NovaAPI.SetImageColor(self._mapNode.img_state, buff_state_color[self.data.nState])
|
||||
NovaAPI.SetImageColor(self._mapNode.img_icon, Color(1, 1, 1, 1))
|
||||
end
|
||||
self._mapNode.btn_buff.onClick:RemoveAllListeners()
|
||||
self._mapNode.btn_buff.onClick:AddListener(function()
|
||||
self._mapNode.img_selected:SetActive(true)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.GoldenSpyBuffTipsPanel, self._mapNode.btn_buff.transform, self.buffId)
|
||||
end)
|
||||
self:SetPngSprite(self._mapNode.img_icon, BuffSpritePath .. self.buffCfg.Icon .. "_s")
|
||||
end
|
||||
function GoldenSpyBuffCellCtrl:OnEvent_BuffTipsClose()
|
||||
self._mapNode.img_selected:SetActive(false)
|
||||
end
|
||||
return GoldenSpyBuffCellCtrl
|
||||
@@ -0,0 +1,271 @@
|
||||
local GoldenSpyBuffSelectCtrl = class("GoldenSpyBuffSelectCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
local BuffSpritePath = "UI_Activity/_400008/SpriteAtlas/Buff/"
|
||||
local ItemSpritePath = "UI_Activity/_400008/SpriteAtlas/Item/"
|
||||
local bg_buff = {
|
||||
[1] = "bg_goldenspy_game_buff_04",
|
||||
[2] = "bg_goldenspy_game_buff_02",
|
||||
[3] = "bg_goldenspy_game_buff_03",
|
||||
[4] = "bg_goldenspy_game_buff_01"
|
||||
}
|
||||
local bg_type = {
|
||||
[1] = "db_goldenspy_tips_buff_01",
|
||||
[2] = "db_goldenspy_tips_buff_02",
|
||||
[3] = "db_goldenspy_tips_buff_03",
|
||||
[4] = "db_goldenspy_tips_buff_04"
|
||||
}
|
||||
local buff_type_lang = {
|
||||
[1] = "GoldenSpyBuffType1",
|
||||
[2] = "GoldenSpyBuffType2",
|
||||
[3] = "GoldenSpyBuffType3",
|
||||
[4] = "GoldenSpyBuffType4"
|
||||
}
|
||||
GoldenSpyBuffSelectCtrl._mapNodeConfig = {
|
||||
root = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
blur = {
|
||||
sNodeName = "t_fullscreen_blur_black"
|
||||
},
|
||||
animCtrl = {
|
||||
sComponentName = "Animator",
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
btnBuff = {
|
||||
sComponentName = "NaviButton",
|
||||
nCount = 3,
|
||||
callback = "OnBtnClick_BuffItem"
|
||||
},
|
||||
rtBtnBuff = {
|
||||
sNodeName = "btnBuff",
|
||||
sComponentName = "RectTransform",
|
||||
nCount = 3
|
||||
},
|
||||
btnConfirm = {
|
||||
sComponentName = "NaviButton",
|
||||
nCount = 3,
|
||||
callback = "OnBtnClick_Confirm"
|
||||
},
|
||||
txtBtnConfirm = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Potential_Select_Confirm",
|
||||
nCount = 3
|
||||
},
|
||||
rtBtnConfirm = {
|
||||
sNodeName = "btnConfirm",
|
||||
sComponentName = "RectTransform",
|
||||
nCount = 3
|
||||
},
|
||||
lsv_item = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
lsv_buff = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
txt_toolBox = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GoldenSpy_ToolBox_Title"
|
||||
}
|
||||
}
|
||||
GoldenSpyBuffSelectCtrl._mapEventConfig = {}
|
||||
GoldenSpyBuffSelectCtrl._mapRedDotConfig = {}
|
||||
function GoldenSpyBuffSelectCtrl:Awake()
|
||||
self._mapNode.root:SetActive(false)
|
||||
self._mapNode.blur:SetActive(false)
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
GamepadUIManager.AddGamepadUINode("GoldenSpyBuffSelect", self.tbGamepadUINode)
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.tbShowItem = param[1]
|
||||
self.tbBuff = param[2]
|
||||
self.tbSelectBuff = param[3]
|
||||
self.selectedCallback = param[4]
|
||||
end
|
||||
self.mapBuffCellCtrl = {}
|
||||
self:ShowBuffSelect(self.tbShowItem, self.tbBuff, self.tbSelectBuff, self.selectedCallback)
|
||||
self.bConfirmed = false
|
||||
end
|
||||
function GoldenSpyBuffSelectCtrl:OnEnable()
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.blur:SetActive(true)
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.root:SetActive(true)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
self.handler = {}
|
||||
for k, v in ipairs(self._mapNode.btnBuff) do
|
||||
self.handler[k] = ui_handler(self, self.OnBtnSelect_BuffItem, v, k)
|
||||
v.onSelect:AddListener(self.handler[k])
|
||||
end
|
||||
end
|
||||
function GoldenSpyBuffSelectCtrl:OnDisable()
|
||||
for k, v in ipairs(self._mapNode.btnBuff) do
|
||||
v.onSelect:RemoveListener(self.handler[k])
|
||||
end
|
||||
end
|
||||
function GoldenSpyBuffSelectCtrl:OnDestroy()
|
||||
for k, v in pairs(self.mapBuffCellCtrl) do
|
||||
self:UnbindCtrlByNode(v)
|
||||
self.mapBuffCellCtrl[k] = nil
|
||||
end
|
||||
self.mapBuffCellCtrl = {}
|
||||
end
|
||||
function GoldenSpyBuffSelectCtrl:ShowBuffSelect(tbShowItem, tbBuff, tbSelectBuff, selectedCallback)
|
||||
self.selectedCallback = selectedCallback
|
||||
self:RefreshItemList(tbShowItem)
|
||||
self:RefreshBuffList(tbBuff)
|
||||
self:RefreshBuffSelectList(tbSelectBuff)
|
||||
self:ResetSelect(self._mapNode.btnBuff)
|
||||
end
|
||||
function GoldenSpyBuffSelectCtrl:OnRefreshItemGrid(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local itemId = self.tbShowItem[nIndex].itemId
|
||||
local itemScore = self.tbShowItem[nIndex].score
|
||||
itemScore = math.floor(itemScore)
|
||||
local itemCfg = ConfigTable.GetData("GoldenSpyItem", itemId)
|
||||
if itemCfg == nil then
|
||||
return
|
||||
end
|
||||
local img_icon = goGrid.transform:Find("db/icon"):GetComponent("Image")
|
||||
local txt_score = goGrid.transform:Find("db/txt_score"):GetComponent("TMP_Text")
|
||||
self:SetPngSprite(img_icon, ItemSpritePath .. itemCfg.IconPath .. "_s")
|
||||
NovaAPI.SetTMPText(txt_score, itemScore)
|
||||
end
|
||||
function GoldenSpyBuffSelectCtrl:RefreshBuffSelectList(tbSelectBuff)
|
||||
self.tbSelectBuff = tbSelectBuff
|
||||
for k, v in ipairs(self._mapNode.btnBuff) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
for i = 1, #self.tbSelectBuff do
|
||||
local buffId = self.tbSelectBuff[i]
|
||||
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", buffId)
|
||||
if buffCfg ~= nil then
|
||||
local btn = self._mapNode.btnBuff[i]
|
||||
btn.gameObject:SetActive(true)
|
||||
local goSelect = btn.transform:Find("AnimRoot/CardRoot/go_select").gameObject
|
||||
local img_db = btn.transform:Find("AnimRoot/CardRoot/img_db"):GetComponent("Image")
|
||||
local img_icon = btn.transform:Find("AnimRoot/CardRoot/img_icon"):GetComponent("Image")
|
||||
local txt_name = btn.transform:Find("AnimRoot/CardRoot/txt_name"):GetComponent("TMP_Text")
|
||||
local txt_des = btn.transform:Find("AnimRoot/CardRoot/txt_des"):GetComponent("TMP_Text")
|
||||
local db_type = btn.transform:Find("AnimRoot/CardRoot/db_type"):GetComponent("Image")
|
||||
local txt_type = btn.transform:Find("AnimRoot/CardRoot/db_type/txt_type"):GetComponent("TMP_Text")
|
||||
self:SetSprite(img_db, "UI_Activity/_400008/SpriteAtlas/" .. bg_buff[buffCfg.BuffType])
|
||||
self:SetPngSprite(img_icon, BuffSpritePath .. buffCfg.Icon .. "_m")
|
||||
NovaAPI.SetTMPText(txt_name, buffCfg.Name)
|
||||
NovaAPI.SetTMPText(txt_des, buffCfg.Desc)
|
||||
self:SetPngSprite(db_type, "UI_Activity/_400008/SpriteAtlas/" .. bg_type[buffCfg.BuffType])
|
||||
NovaAPI.SetTMPText(txt_type, ConfigTable.GetUIText(buff_type_lang[buffCfg.BuffType]))
|
||||
goSelect:SetActive(false)
|
||||
local tbEffectItem = buffCfg.ConnectItems
|
||||
local tbItemGO = {}
|
||||
for i = 1, 3 do
|
||||
local goItem = btn.transform:Find("AnimRoot/CardRoot/EffectItem" .. i).gameObject
|
||||
goItem:SetActive(false)
|
||||
table.insert(tbItemGO, goItem)
|
||||
end
|
||||
for i = 1, #tbEffectItem do
|
||||
local goItem = tbItemGO[i]
|
||||
local itemCfg = ConfigTable.GetData("GoldenSpyItem", tbEffectItem[i])
|
||||
local img_icon = goItem.transform:Find("itemIcon"):GetComponent("Image")
|
||||
self:SetPngSprite(img_icon, ItemSpritePath .. itemCfg.IconPath .. "_s")
|
||||
goItem:SetActive(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function GoldenSpyBuffSelectCtrl:RefreshItemList(tbShowItem)
|
||||
self.tbShowItem = tbShowItem
|
||||
if self.tbShowItem == nil or #self.tbShowItem == 0 then
|
||||
self._mapNode.lsv_item.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
self._mapNode.lsv_item:Init(#self.tbShowItem, self, self.OnRefreshItemGrid)
|
||||
self._mapNode.lsv_item.gameObject:SetActive(true)
|
||||
end
|
||||
function GoldenSpyBuffSelectCtrl:RefreshBuffList(tbBuff)
|
||||
self.tbBuff = tbBuff
|
||||
if self.tbBuff == nil or #self.tbBuff == 0 then
|
||||
self._mapNode.lsv_buff.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
self._mapNode.lsv_buff.gameObject:SetActive(true)
|
||||
self._mapNode.lsv_buff:Init(#self.tbBuff, self, self.OnRefreshBuffGrid)
|
||||
end
|
||||
function GoldenSpyBuffSelectCtrl:OnRefreshBuffGrid(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local nInstanceId = goGrid:GetInstanceID()
|
||||
local objCtrl = self.mapBuffCellCtrl[nInstanceId]
|
||||
if objCtrl == nil then
|
||||
objCtrl = self:BindCtrlByNode(goGrid, "Game.UI.Activity.GoldenSpy.GoldenSpyBuffCellCtrl")
|
||||
self.mapBuffCellCtrl[nInstanceId] = objCtrl
|
||||
end
|
||||
objCtrl:SetData(self.tbBuff[nIndex])
|
||||
end
|
||||
function GoldenSpyBuffSelectCtrl:ResetSelect(tbUI)
|
||||
self.nSelectIdx = 0
|
||||
GamepadUIManager.SetNavigation(tbUI)
|
||||
local nCardAnimTime = 0
|
||||
local nPanelAnimTime = 0
|
||||
local nAnimTime = nCardAnimTime > nPanelAnimTime and nCardAnimTime or nPanelAnimTime
|
||||
nAnimTime = nAnimTime + 0.4
|
||||
self:AddTimer(1, nAnimTime, function()
|
||||
if self.nSelectIdx == 0 then
|
||||
GamepadUIManager.ClearSelectedUI()
|
||||
GamepadUIManager.SetSelectedUI(self._mapNode.btnBuff[1].gameObject)
|
||||
if GamepadUIManager.GetCurUIType() == AllEnum.GamepadUIType.Mouse then
|
||||
self:OnBtnClick_BuffItem(self._mapNode.btnBuff[1].gameObject, 1)
|
||||
end
|
||||
end
|
||||
end, true, true, true)
|
||||
end
|
||||
function GoldenSpyBuffSelectCtrl:OnBtnClick_BuffItem(btn, nIndex)
|
||||
if nil == self.tbSelectBuff[nIndex] or self.nSelectIdx == nIndex then
|
||||
return
|
||||
end
|
||||
for k, v in ipairs(self._mapNode.btnBuff) do
|
||||
local goSelect = v.transform:Find("AnimRoot/CardRoot/go_select").gameObject
|
||||
local animator = v.transform:Find("AnimRoot"):GetComponent("Animator")
|
||||
if k == nIndex then
|
||||
goSelect:SetActive(true)
|
||||
animator:Play("btnBuff_up")
|
||||
elseif k == self.nSelectIdx then
|
||||
goSelect:SetActive(false)
|
||||
animator:Play("btnBuff_down")
|
||||
end
|
||||
end
|
||||
self.nSelectIdx = nIndex
|
||||
end
|
||||
function GoldenSpyBuffSelectCtrl:OnBtnSelect_BuffItem(btn, nIndex)
|
||||
local nUIType = GamepadUIManager.GetCurUIType()
|
||||
if nUIType ~= AllEnum.GamepadUIType.Other and nUIType ~= AllEnum.GamepadUIType.Mouse then
|
||||
self:OnBtnClick_BuffItem(btn, nIndex)
|
||||
end
|
||||
end
|
||||
function GoldenSpyBuffSelectCtrl:OnBtnClick_Confirm(btn, nIndex)
|
||||
if self.bConfirmed then
|
||||
return
|
||||
end
|
||||
if self.nSelectIdx ~= 0 and self.selectedCallback ~= nil then
|
||||
self.bConfirmed = true
|
||||
for k, v in ipairs(self._mapNode.btnBuff) do
|
||||
if k ~= self.nSelectIdx then
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
local selectBtn = self._mapNode.btnBuff[self.nSelectIdx]
|
||||
local animator = selectBtn.transform:Find("AnimRoot"):GetComponent("Animator")
|
||||
animator:Play("btnBuff_get")
|
||||
self._mapNode.animCtrl:Play("GoldenSpyBuffSelectPanel_out")
|
||||
self:AddTimer(1, 0.6, function()
|
||||
self.selectedCallback(self.tbSelectBuff[self.nSelectIdx])
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.GoldenSpyBuffSelectPanel)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end, true, true, true, nil)
|
||||
end
|
||||
end
|
||||
return GoldenSpyBuffSelectCtrl
|
||||
@@ -0,0 +1,26 @@
|
||||
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 = "_400008/GoldenSpyBuffSelectPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.GoldenSpy.GoldenSpyBuffSelectCtrl"
|
||||
}
|
||||
}
|
||||
function GoldenSpyBuffSelectPanel:Awake()
|
||||
GamepadUIManager.EnableGamepadUI("GoldenSpyBuffSelect", {})
|
||||
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,101 @@
|
||||
local GoldenSpyBuffTipsCtrl = class("GoldenSpyBuffTipsCtrl", BaseCtrl)
|
||||
local nOffsetBottom = -85
|
||||
local nContentEdge = -20
|
||||
local nArrowOffect = 17
|
||||
local leftSafeEdge = 30
|
||||
GoldenSpyBuffTipsCtrl.minTipHeight = 87
|
||||
GoldenSpyBuffTipsCtrl.maxTipHeight = 557
|
||||
local titleHeight = 240
|
||||
local MoveUpHeight = 45
|
||||
GoldenSpyBuffTipsCtrl._mapNodeConfig = {
|
||||
btnCloseTips = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ClosePanel"
|
||||
},
|
||||
TMPBuffName = {sComponentName = "TMP_Text"},
|
||||
TMPBuffDes = {sComponentName = "TMP_Text"},
|
||||
imgArrow = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
rtContent = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
safeAreaRoot = {
|
||||
sNodeName = "----SafeAreaRoot---",
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
GoldenSpyBuffTipsCtrl._mapEventConfig = {}
|
||||
GoldenSpyBuffTipsCtrl._mapRedDotConfig = {}
|
||||
function GoldenSpyBuffTipsCtrl:Awake()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.rtTarget = tbParam[1]
|
||||
self.buffId = tbParam[2]
|
||||
end
|
||||
end
|
||||
function GoldenSpyBuffTipsCtrl:OnEnable()
|
||||
self:SetTipsContent()
|
||||
end
|
||||
function GoldenSpyBuffTipsCtrl:OnDisable()
|
||||
end
|
||||
function GoldenSpyBuffTipsCtrl:OnDestroy()
|
||||
end
|
||||
function GoldenSpyBuffTipsCtrl:SetTipsContent()
|
||||
NovaAPI.SetComponentEnableByName(self.rtTarget.gameObject, "TopGridCanvas", true)
|
||||
self.sortingOrder = NovaAPI.GetCanvasSortingOrder(self.gameObject:GetComponent("Canvas"))
|
||||
NovaAPI.SetTopGridCanvasSorting(self.rtTarget.gameObject, self.sortingOrder)
|
||||
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", self.buffId)
|
||||
if buffCfg == nil then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPBuffName, buffCfg.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPBuffDes, buffCfg.Desc)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self:SetTipsPosition(self.rtTarget, self._mapNode.rtContent, self._mapNode.safeAreaRoot)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function GoldenSpyBuffTipsCtrl:SetTipsPosition(rtTarget, rtContent, safeAreaRoot)
|
||||
local rtTargetRect = rtTarget:GetComponent("RectTransform")
|
||||
local rtTipsContent = rtContent:Find("rtTipsPoint/imgTipsBg"):GetComponent("RectTransform")
|
||||
local rtArrow = rtContent:Find("rtTipsPoint/imgArrow"):GetComponent("RectTransform")
|
||||
local rtTipsPoint = rtContent:Find("rtTipsPoint"):GetComponent("RectTransform")
|
||||
local screenHeight = safeAreaRoot.rect.size.y
|
||||
local screenWidth = safeAreaRoot.rect.size.x
|
||||
local nTipHeight = rtTipsContent.sizeDelta.y
|
||||
local nTipWidth = rtTipsContent.sizeDelta.x
|
||||
local niconSize = rtTargetRect.sizeDelta.x
|
||||
local nIconScale = rtTargetRect.localScale.x
|
||||
local nFinalSize = niconSize * nIconScale
|
||||
rtContent.sizeDelta = Vector2(nFinalSize, nFinalSize)
|
||||
rtContent.position = rtTarget.transform.position
|
||||
local nFactor = -1
|
||||
if rtContent.anchoredPosition.x + nContentEdge - 0.5 * nFinalSize - nTipWidth - nArrowOffect - leftSafeEdge < -(0.5 * screenWidth) then
|
||||
nFactor = 1
|
||||
end
|
||||
local xPoint = 0.5 * nFinalSize * nFactor
|
||||
local xArrow = nArrowOffect * nFactor
|
||||
local xTip = 0.5 * nTipWidth * nFactor - nContentEdge * nFactor
|
||||
local nTipsContentYOffest = 0
|
||||
if rtContent.anchoredPosition.y + nOffsetBottom + nTipHeight > 0.5 * screenHeight - 30 then
|
||||
nTipsContentYOffest = rtContent.anchoredPosition.y + nOffsetBottom + nTipHeight - (0.5 * screenHeight - 30)
|
||||
elseif rtContent.anchoredPosition.y + nOffsetBottom < -0.5 * screenHeight + 30 then
|
||||
nTipsContentYOffest = rtContent.anchoredPosition.y + nOffsetBottom - (-0.5 * screenHeight + 30)
|
||||
end
|
||||
local yTip = nOffsetBottom - nTipsContentYOffest
|
||||
rtTipsPoint.anchoredPosition = Vector2(xPoint, 0)
|
||||
rtArrow.anchoredPosition = Vector2(xArrow, 0)
|
||||
rtTipsContent.anchoredPosition = Vector2(xTip, yTip)
|
||||
rtArrow.localScale = Vector3(nFactor, 1, 1)
|
||||
local cg = rtContent:GetComponent("CanvasGroup")
|
||||
NovaAPI.SetCanvasGroupAlpha(cg, 1)
|
||||
end
|
||||
function GoldenSpyBuffTipsCtrl:OnBtnClick_ClosePanel()
|
||||
NovaAPI.SetComponentEnableByName(self.rtTarget.gameObject, "TopGridCanvas", false)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.GoldenSpyBuffTipsPanel)
|
||||
EventManager.Hit("GoldenSpyBuffTipsClose")
|
||||
end
|
||||
return GoldenSpyBuffTipsCtrl
|
||||
@@ -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 = "_400008/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,448 @@
|
||||
local GoldenSpyBaseItem = require("Game.UI.Activity.GoldenSpy.GoldenSpyBaseItem")
|
||||
local GoldenSpyCompanionItem = class("GoldenSpyCompanionItem", GoldenSpyBaseItem)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local VisionAngle = 45
|
||||
local VisionRadius = 250
|
||||
GoldenSpyCompanionItem._mapNodeConfig = {
|
||||
trDrone = {
|
||||
sNodeName = "Drone",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
StartPoint = {
|
||||
sNodeName = "StartPoint",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
EndPoint = {
|
||||
sNodeName = "EndPoint",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
VisionPoint = {
|
||||
sNodeName = "VisionPoint",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
HitArea = {
|
||||
sNodeName = "HitArea",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
animator = {sNodeName = "Icon", sComponentName = "Animator"},
|
||||
flash = {},
|
||||
imgIce = {},
|
||||
IceRoot = {
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
GoldenSpyCompanionItem._mapEventConfig = {
|
||||
GM_GoldenSpy_Show = "OnEvent_GM_GoldenSpy_Show"
|
||||
}
|
||||
GoldenSpyCompanionItem._mapRedDotConfig = {}
|
||||
function GoldenSpyCompanionItem:Awake()
|
||||
self._moveTweener = nil
|
||||
self._visionTweener = nil
|
||||
self._mapNode.flash:SetActive(false)
|
||||
self._mapNode.imgIce:SetActive(false)
|
||||
self._mapNode.IceRoot.gameObject:SetActive(false)
|
||||
end
|
||||
function GoldenSpyCompanionItem:OnEnable()
|
||||
end
|
||||
function GoldenSpyCompanionItem:OnDisable()
|
||||
end
|
||||
function GoldenSpyCompanionItem:OnDestroy()
|
||||
self:StopMove()
|
||||
end
|
||||
function GoldenSpyCompanionItem:Init()
|
||||
self.nUid = nil
|
||||
self.nItemId = nil
|
||||
self.bDirection = true
|
||||
self.nBagItemPrice = 0
|
||||
local startPoint = self._mapNode.StartPoint.anchoredPosition
|
||||
self.vStartPoint = Vector3(startPoint.x, startPoint.y, 0)
|
||||
local endPoint = self._mapNode.EndPoint.anchoredPosition
|
||||
self.vEndPoint = Vector3(endPoint.x, endPoint.y, 0)
|
||||
local visionPoint = self._mapNode.VisionPoint.anchoredPosition
|
||||
self.vVisionPoint = Vector3(visionPoint.x, visionPoint.y, 0)
|
||||
self.bDirection = self.vEndPoint.x > self.vStartPoint.x
|
||||
self.bDestination = false
|
||||
end
|
||||
function GoldenSpyCompanionItem:InitData()
|
||||
self.nVisionAngle = self.itemCfg.Params[2] or VisionAngle
|
||||
self.nVisionRadius = self.itemCfg.Params[3] or VisionRadius
|
||||
end
|
||||
function GoldenSpyCompanionItem:GetHitArea()
|
||||
local tr = self.gameObject:GetComponent("RectTransform")
|
||||
local hitArea = {
|
||||
nType = self.nHitAreaType,
|
||||
center = self._mapNode.HitArea.anchoredPosition + tr.anchoredPosition + self._mapNode.trDrone.anchoredPosition,
|
||||
width = self._mapNode.HitArea.sizeDelta.x,
|
||||
height = self._mapNode.HitArea.sizeDelta.y
|
||||
}
|
||||
return hitArea
|
||||
end
|
||||
function GoldenSpyCompanionItem:StartFloor()
|
||||
self:StartMove()
|
||||
end
|
||||
function GoldenSpyCompanionItem:FinishFloor()
|
||||
self:StopMove()
|
||||
end
|
||||
function GoldenSpyCompanionItem:GetBagItemPrice()
|
||||
return self.nBagItemPrice
|
||||
end
|
||||
function GoldenSpyCompanionItem:GetVisionArea()
|
||||
local visionArea = {
|
||||
center = self._mapNode.VisionPoint.anchoredPosition + self.gameObject.transform.anchoredPosition,
|
||||
radius = self._mapNode.VisionPoint.sizeDelta.x * 0.5,
|
||||
direction = self.bDirection
|
||||
}
|
||||
return visionArea
|
||||
end
|
||||
function GoldenSpyCompanionItem:Pause()
|
||||
if self._moveTweener ~= nil then
|
||||
self._moveTweener:Pause()
|
||||
end
|
||||
if self._visionUpdateTimer ~= nil then
|
||||
self._visionUpdateTimer:Pause(true)
|
||||
end
|
||||
end
|
||||
function GoldenSpyCompanionItem:Resume()
|
||||
if self.bFrozen then
|
||||
return
|
||||
end
|
||||
if self._moveTweener ~= nil then
|
||||
self._moveTweener:Play()
|
||||
end
|
||||
if self._visionUpdateTimer ~= nil then
|
||||
self._visionUpdateTimer:Pause(false)
|
||||
end
|
||||
end
|
||||
function GoldenSpyCompanionItem:onCatch(callback)
|
||||
self:StopMove()
|
||||
self._mapNode.trDrone.anchoredPosition = Vector2.zero
|
||||
self._mapNode.animator:Play("Patrol_out")
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function GoldenSpyCompanionItem:OnSkill_Boom(callback)
|
||||
self:StopMove()
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
if self.gameObject then
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function GoldenSpyCompanionItem:OnSkill_Frozen(callback)
|
||||
self.bFrozen = true
|
||||
self._mapNode.imgIce:SetActive(true)
|
||||
self._mapNode.animator:Play("Patrol_out")
|
||||
self:Pause()
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function GoldenSpyCompanionItem:OnSkill_Frozen_Resume(callback)
|
||||
self.bFrozen = false
|
||||
self._mapNode.imgIce:SetActive(false)
|
||||
self._mapNode.IceRoot:SetParent(self.gameObject.transform)
|
||||
self._mapNode.IceRoot.anchoredPosition = self._mapNode.trDrone.anchoredPosition
|
||||
self._mapNode.IceRoot.gameObject:SetActive(true)
|
||||
self._mapNode.animator:Play("Patrol_idle")
|
||||
self:Resume()
|
||||
self:AddTimer(1, 0.5, function()
|
||||
self._mapNode.IceRoot.gameObject:SetActive(false)
|
||||
self._mapNode.IceRoot:SetParent(self._mapNode.trDrone)
|
||||
end, true, true, true)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function GoldenSpyCompanionItem:StartMove()
|
||||
self:StopMove()
|
||||
self.bDirection = self.vEndPoint.x > self.vStartPoint.x
|
||||
self:_ApplyForwardRotation()
|
||||
self:_StartMoveTween()
|
||||
self:_StartVisionCheck()
|
||||
end
|
||||
function GoldenSpyCompanionItem:_StartMoveTween()
|
||||
local tr = self._mapNode.trDrone
|
||||
if tr == nil then
|
||||
return
|
||||
end
|
||||
local from = tr.anchoredPosition
|
||||
local to = self.bDestination and self.vStartPoint or self.vEndPoint
|
||||
local dist = to.x - from.x
|
||||
local duration = math.abs(dist / (self.itemCfg.Params[1] or 100))
|
||||
if duration <= 0 then
|
||||
self:_OnReachTarget()
|
||||
return
|
||||
end
|
||||
if self._moveTweener ~= nil then
|
||||
self._moveTweener:Kill(false)
|
||||
self._moveTweener = nil
|
||||
end
|
||||
self._moveTweener = tr:DOAnchorPosX(to.x, duration):SetEase(Ease.Linear):SetUpdate(true):OnUpdate(function()
|
||||
end):OnComplete(function()
|
||||
self:_OnReachTarget()
|
||||
end):OnKill(function()
|
||||
end)
|
||||
end
|
||||
function GoldenSpyCompanionItem:StopMove()
|
||||
self:_KillMoveTween()
|
||||
self:_StopVisionCheck()
|
||||
end
|
||||
function GoldenSpyCompanionItem:_OnReachTarget()
|
||||
self.bDirection = not self.bDirection
|
||||
self.bDestination = not self.bDestination
|
||||
self:_ApplyForwardRotation()
|
||||
self:_StartMoveTween()
|
||||
end
|
||||
function GoldenSpyCompanionItem:_ApplyForwardRotation()
|
||||
local tr = self._mapNode.trDrone
|
||||
if tr then
|
||||
if self.bDirection then
|
||||
tr.localEulerAngles = Vector3(0, 0, 0)
|
||||
else
|
||||
tr.localEulerAngles = Vector3(0, 180, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
function GoldenSpyCompanionItem:_KillMoveTween()
|
||||
if self._moveTweener ~= nil then
|
||||
self._moveTweener:Kill(false)
|
||||
self._moveTweener = nil
|
||||
end
|
||||
if self._mapNode.trDrone ~= nil then
|
||||
self._mapNode.trDrone:DOKill(false)
|
||||
end
|
||||
end
|
||||
function GoldenSpyCompanionItem:GetForwardAngle()
|
||||
if self.bDirection then
|
||||
return 0
|
||||
else
|
||||
return 180
|
||||
end
|
||||
end
|
||||
function GoldenSpyCompanionItem:_PointInSector(px, py, cx, cy, forwardAngle, visionAngle, radius)
|
||||
local dx, dy = px - cx, py - cy
|
||||
local dist2 = dx * dx + dy * dy
|
||||
if dist2 > radius * radius then
|
||||
return false
|
||||
end
|
||||
local angle = math.deg(math.atan(dy, dx))
|
||||
local lo = forwardAngle - visionAngle
|
||||
local hi = forwardAngle + visionAngle
|
||||
while angle < lo do
|
||||
angle = angle + 360
|
||||
end
|
||||
while angle > hi + 360 do
|
||||
angle = angle - 360
|
||||
end
|
||||
if lo <= angle and hi >= angle then
|
||||
return true
|
||||
end
|
||||
if angle >= lo - 360 and angle <= hi - 360 then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
function GoldenSpyCompanionItem:_HitAreaInSector(hitArea, vx, vy, forwardAngle, halfAngle, radius)
|
||||
if not (hitArea and vx) or not vy then
|
||||
return false
|
||||
end
|
||||
local shape = hitArea.nType
|
||||
local cx, cy = vx, vy
|
||||
local ix, iy
|
||||
if hitArea.center then
|
||||
ix, iy = hitArea.center.x, hitArea.center.y
|
||||
else
|
||||
return false
|
||||
end
|
||||
if shape == AllEnum.GoldenSpyHitAreaType.Rectangle then
|
||||
local w = (hitArea.width or 0) * 0.5
|
||||
local h = (hitArea.width or 0) * 0.5
|
||||
local corners = {
|
||||
{ix, iy},
|
||||
{
|
||||
ix + w,
|
||||
iy
|
||||
},
|
||||
{
|
||||
ix - w,
|
||||
iy
|
||||
},
|
||||
{
|
||||
ix,
|
||||
iy + h
|
||||
},
|
||||
{
|
||||
ix,
|
||||
iy - h
|
||||
},
|
||||
{
|
||||
ix + w,
|
||||
iy + h
|
||||
},
|
||||
{
|
||||
ix - w,
|
||||
iy - h
|
||||
},
|
||||
{
|
||||
ix + w,
|
||||
iy - h
|
||||
},
|
||||
{
|
||||
ix - w,
|
||||
iy + h
|
||||
}
|
||||
}
|
||||
for _, p in ipairs(corners) do
|
||||
if self:_PointInSector(p[1], p[2], cx, cy, forwardAngle, halfAngle, radius) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
local itemR = hitArea.radius or 0
|
||||
return self:_CircleSectorIntersect(ix, iy, itemR, cx, cy, forwardAngle, halfAngle, radius)
|
||||
end
|
||||
function GoldenSpyCompanionItem:_PointToSectorDist(px, py, cx, cy, forwardAngle, halfAngle, radius)
|
||||
local dx, dy = px - cx, py - cy
|
||||
local dist = math.sqrt(dx * dx + dy * dy)
|
||||
local angleDeg = math.deg(math.atan(dy, dx))
|
||||
local lo = forwardAngle - halfAngle
|
||||
local hi = forwardAngle + halfAngle
|
||||
while angleDeg < lo - 180 do
|
||||
angleDeg = angleDeg + 360
|
||||
end
|
||||
while angleDeg > hi + 180 do
|
||||
angleDeg = angleDeg - 360
|
||||
end
|
||||
if lo <= angleDeg and hi >= angleDeg and radius >= dist then
|
||||
return 0
|
||||
end
|
||||
local radLo = math.rad(lo)
|
||||
local radHi = math.rad(hi)
|
||||
local clampAngle = angleDeg
|
||||
if lo > clampAngle then
|
||||
clampAngle = lo
|
||||
end
|
||||
if hi < clampAngle then
|
||||
clampAngle = hi
|
||||
end
|
||||
local radClamp = math.rad(clampAngle)
|
||||
local ax = cx + radius * math.cos(radClamp)
|
||||
local ay = cy + radius * math.sin(radClamp)
|
||||
local dArc = math.sqrt((px - ax) ^ 2 + (py - ay) ^ 2)
|
||||
local distToRay = function(angleRay)
|
||||
local rad = math.rad(angleRay)
|
||||
local rx, ry = math.cos(rad), math.sin(rad)
|
||||
local t = dx * rx + dy * ry
|
||||
if t <= 0 then
|
||||
return math.sqrt(dx * dx + dy * dy)
|
||||
end
|
||||
if t >= radius then
|
||||
local ex = cx + radius * rx
|
||||
local ey = cy + radius * ry
|
||||
return math.sqrt((px - ex) ^ 2 + (py - ey) ^ 2)
|
||||
end
|
||||
local nx = cx + t * rx
|
||||
local ny = cy + t * ry
|
||||
return math.sqrt((px - nx) ^ 2 + (py - ny) ^ 2)
|
||||
end
|
||||
local dRay1 = distToRay(lo)
|
||||
local dRay2 = distToRay(hi)
|
||||
return math.min(dArc, dRay1, dRay2)
|
||||
end
|
||||
function GoldenSpyCompanionItem:_CircleSectorIntersect(circleCx, circleCy, circleR, sectorCx, sectorCy, sectorForward, sectorHalfAngle, sectorRadius)
|
||||
local dist = self:_PointToSectorDist(circleCx, circleCy, sectorCx, sectorCy, sectorForward, sectorHalfAngle, sectorRadius)
|
||||
return circleR >= dist
|
||||
end
|
||||
function GoldenSpyCompanionItem:_CheckVision()
|
||||
local tr = self.gameObject:GetComponent("RectTransform")
|
||||
local vp = self._mapNode.VisionPoint.anchoredPosition + tr.anchoredPosition + self._mapNode.trDrone.anchoredPosition
|
||||
if vp == nil then
|
||||
return
|
||||
end
|
||||
local vx, vy = vp.x, vp.y
|
||||
local forwardAngle = self:GetForwardAngle()
|
||||
local halfAngle = self.nVisionAngle
|
||||
local radius = self.nVisionRadius
|
||||
if not self.floorCtrl.tbItem then
|
||||
return
|
||||
end
|
||||
local tempItems = {}
|
||||
for _, item in ipairs(self.floorCtrl.tbItem) do
|
||||
table.insert(tempItems, item)
|
||||
end
|
||||
local tbRemoveItems = {}
|
||||
for _, item in ipairs(tempItems) do
|
||||
if item.Ctrl ~= self then
|
||||
local hitArea = item.Ctrl:GetHitArea()
|
||||
if hitArea and self:_HitAreaInSector(hitArea, vx, vy, forwardAngle, halfAngle, radius) then
|
||||
if item.Ctrl == self.floorCtrl.catchedItem then
|
||||
goto lbl_228
|
||||
end
|
||||
if item.Ctrl:GetItemCfg().ItemType == GameEnum.GoldenSpyItem.Boom then
|
||||
item.Ctrl:Boom(nil)
|
||||
else
|
||||
local itemCfg = item.Ctrl:GetItemCfg()
|
||||
local nScore = itemCfg.Score
|
||||
local tbHasBuff = self.floorCtrl.levelCtrl.GoldenSpyLevelData:GetBuffData()
|
||||
for _, v in ipairs(tbHasBuff) do
|
||||
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
|
||||
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore and buffCfg.Params[1] == itemCfg.ItemType then
|
||||
local curFloor = self.floorCtrl.levelCtrl.GoldenSpyLevelData:GetCurFloor()
|
||||
if buffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
|
||||
if v.bActive and table.indexof(v.tbActiveFloor, curFloor) > 0 then
|
||||
nScore = nScore + buffCfg.Params[2]
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.DelayBuff then
|
||||
if v.bActive and table.indexof(v.tbActiveFloor, curFloor) > 0 then
|
||||
nScore = nScore + buffCfg.Params[2]
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.PermanentBuff then
|
||||
if v.bActive then
|
||||
nScore = nScore + buffCfg.Params[2]
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.SkillCountBuff then
|
||||
end
|
||||
end
|
||||
end
|
||||
self._mapNode.animator:Play("Patrol_attack")
|
||||
item.Ctrl:OnSkill_InVision()
|
||||
self.nBagItemPrice = self.nBagItemPrice + nScore
|
||||
WwiseAudioMgr:PostEvent("Mode_steal_eat")
|
||||
local tr = self.gameObject:GetComponent("RectTransform")
|
||||
local vPos = tr.anchoredPosition + self._mapNode.trDrone.anchoredPosition
|
||||
EventManager.Hit("GoldenSpy_CompanionAddScore", nScore, vPos)
|
||||
end
|
||||
table.insert(tbRemoveItems, item)
|
||||
else
|
||||
end
|
||||
for _, v in ipairs(tbRemoveItems) do
|
||||
self.floorCtrl:RemoveItem(v.Ctrl)
|
||||
end
|
||||
tbRemoveItems = {}
|
||||
end
|
||||
::lbl_228::
|
||||
end
|
||||
end
|
||||
function GoldenSpyCompanionItem:_StartVisionCheck()
|
||||
self:_StopVisionCheck()
|
||||
self._visionUpdateTimer = self:AddTimer(0, 0, "OnVisionUpdate", true, true, true)
|
||||
end
|
||||
function GoldenSpyCompanionItem:OnVisionUpdate()
|
||||
self:_CheckVision()
|
||||
end
|
||||
function GoldenSpyCompanionItem:_StopVisionCheck()
|
||||
if self._visionUpdateTimer ~= nil then
|
||||
self._visionUpdateTimer:Cancel()
|
||||
self._visionUpdateTimer = nil
|
||||
end
|
||||
end
|
||||
function GoldenSpyCompanionItem:OnEvent_GM_GoldenSpy_Show()
|
||||
local img = self._mapNode.HitArea:GetComponent("Image")
|
||||
if img then
|
||||
img.enabled = true
|
||||
end
|
||||
end
|
||||
return GoldenSpyCompanionItem
|
||||
@@ -0,0 +1,395 @@
|
||||
local GoldenSpyFloorCtrl = class("GoldenSpyFloorCtrl", BaseCtrl)
|
||||
local LevelPrefabPath = "UI_Activity/_400008/LevelPrefab/"
|
||||
GoldenSpyFloorCtrl._mapNodeConfig = {
|
||||
HookCtrl = {
|
||||
sNodeName = "HookRoot",
|
||||
sCtrlName = "Game.UI.Activity.GoldenSpy.GoldenSpyHookCtrl"
|
||||
},
|
||||
PrefabRoot = {
|
||||
sNodeName = "PrefabRoot",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
floorItemRoot = {
|
||||
sNodeName = "floorItemRoot",
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
local itemCtrlPath = "Game.UI.Activity.GoldenSpy."
|
||||
local ItemHitAreaType = {
|
||||
[1] = AllEnum.GoldenSpyHitAreaType.Rectangle,
|
||||
[2] = AllEnum.GoldenSpyHitAreaType.Rectangle,
|
||||
[3] = AllEnum.GoldenSpyHitAreaType.Circle,
|
||||
[4] = AllEnum.GoldenSpyHitAreaType.Rectangle,
|
||||
[5] = AllEnum.GoldenSpyHitAreaType.Rectangle,
|
||||
[6] = AllEnum.GoldenSpyHitAreaType.Rectangle,
|
||||
[7] = AllEnum.GoldenSpyHitAreaType.Rectangle,
|
||||
[8] = AllEnum.GoldenSpyHitAreaType.Rectangle,
|
||||
[9] = AllEnum.GoldenSpyHitAreaType.Circle,
|
||||
[10] = AllEnum.GoldenSpyHitAreaType.Rectangle
|
||||
}
|
||||
function GoldenSpyFloorCtrl:Awake()
|
||||
end
|
||||
function GoldenSpyFloorCtrl:Init(levelId, floorId, levelCtrl)
|
||||
self.levelId = levelId
|
||||
self.floorId = floorId
|
||||
self.levelCtrl = levelCtrl
|
||||
if self.prefab ~= nil then
|
||||
for i = #self.tbItem, 1, -1 do
|
||||
self:UnbindCtrlByNode(self.tbItem[i].Ctrl)
|
||||
end
|
||||
for i = #self.tbTrap, 1, -1 do
|
||||
self:UnbindCtrlByNode(self.tbTrap[i].Ctrl)
|
||||
end
|
||||
for i = #self.tbNeedRemoveItem, 1, -1 do
|
||||
self:UnbindCtrlByNode(self.tbNeedRemoveItem[i].Ctrl)
|
||||
end
|
||||
destroy(self.prefab)
|
||||
end
|
||||
self.tbItem = {}
|
||||
self.tbNeedRemoveItem = {}
|
||||
self.tbTrap = {}
|
||||
self.prefab = nil
|
||||
local floorCfg = ConfigTable.GetData("GoldenSpyFloor", floorId)
|
||||
if floorCfg == nil then
|
||||
return
|
||||
end
|
||||
local nPrefabName = self.levelCtrl.GoldenSpyLevelData:GetLevelPrefabName()
|
||||
local goLevelPerfab = self:LoadAsset(LevelPrefabPath .. nPrefabName .. ".prefab")
|
||||
self.prefab = instantiate(goLevelPerfab, self._mapNode.floorItemRoot)
|
||||
self.prefab.transform.localPosition = Vector3.zero
|
||||
self.prefab.transform.localScale = Vector3.one
|
||||
self.prefab.transform.localRotation = Quaternion.identity
|
||||
self:InitItem()
|
||||
self:InitRandomBuff()
|
||||
self:InitTrap()
|
||||
self.bInvincible = false
|
||||
self._mapNode.HookCtrl:Init(self.levelId, self.floorId, self, self.levelCtrl.GoldenSpyLevelData, self.levelCtrl.GoldenSpyFloorData)
|
||||
end
|
||||
function GoldenSpyFloorCtrl:InitItem()
|
||||
if self.prefab == nil then
|
||||
return
|
||||
end
|
||||
local itemRoot = self.prefab.transform:Find("ItemRoot")
|
||||
if itemRoot == nil then
|
||||
return
|
||||
end
|
||||
local levelCfg = ConfigTable.GetData("GoldenSpyLevel", self.levelId)
|
||||
local nChildCount = itemRoot.transform.childCount
|
||||
for i = 1, nChildCount do
|
||||
local child = itemRoot.transform:GetChild(i - 1)
|
||||
local nItemId = tonumber(child.gameObject.name)
|
||||
local itemCfg = ConfigTable.GetData("GoldenSpyItem", nItemId)
|
||||
if itemCfg ~= nil then
|
||||
local itemCtrl = self:BindCtrlByNode(child.gameObject, itemCtrlPath .. itemCfg.luaCtrl)
|
||||
itemCtrl:Init()
|
||||
itemCtrl:SetData({
|
||||
nUid = #self.tbItem + i,
|
||||
nItemId = nItemId,
|
||||
nHitAreaType = ItemHitAreaType[itemCfg.ItemType]
|
||||
}, self, levelCfg.ConfigId)
|
||||
table.insert(self.tbItem, {Ctrl = itemCtrl})
|
||||
self.levelCtrl.GoldenSpyFloorData:SetItem(nItemId)
|
||||
end
|
||||
end
|
||||
end
|
||||
function GoldenSpyFloorCtrl:InitRandomBuff()
|
||||
local levelCfg = ConfigTable.GetData("GoldenSpyLevel", self.levelId)
|
||||
if levelCfg == nil then
|
||||
return
|
||||
end
|
||||
if levelCfg.LevelType ~= GameEnum.GoldenSpyLevelType.Random then
|
||||
return
|
||||
end
|
||||
local floorCfg = ConfigTable.GetData("GoldenSpyFloor", self.floorId)
|
||||
if floorCfg == nil then
|
||||
return
|
||||
end
|
||||
local buffRandomRoot = self.prefab.transform:Find("BuffRandomRoot")
|
||||
if buffRandomRoot == nil then
|
||||
return
|
||||
end
|
||||
local randomCount = floorCfg.BuffCardCount
|
||||
local nChildCount = buffRandomRoot.childCount
|
||||
local tbAllBuffPrefab = {}
|
||||
for i = 1, nChildCount do
|
||||
local child = buffRandomRoot.transform:GetChild(i - 1)
|
||||
table.insert(tbAllBuffPrefab, child)
|
||||
child.gameObject:SetActive(false)
|
||||
end
|
||||
if randomCount > nChildCount then
|
||||
return
|
||||
end
|
||||
local randomIndex = math.random(1, nChildCount)
|
||||
for i = 1, randomCount do
|
||||
local buff = tbAllBuffPrefab[randomIndex]
|
||||
buff.gameObject:SetActive(true)
|
||||
local nItemId = tonumber(buff.gameObject.name)
|
||||
local itemCfg = ConfigTable.GetData("GoldenSpyItem", nItemId)
|
||||
if itemCfg ~= nil then
|
||||
local buffCtrl = self:BindCtrlByNode(buff.gameObject, itemCtrlPath .. itemCfg.luaCtrl)
|
||||
buffCtrl:Init()
|
||||
buffCtrl:SetData({
|
||||
nUid = i,
|
||||
nItemId = nItemId,
|
||||
nHitAreaType = ItemHitAreaType[itemCfg.ItemType]
|
||||
}, self, levelCfg.ConfigId)
|
||||
table.insert(self.tbItem, {Ctrl = buffCtrl})
|
||||
randomIndex = randomIndex % nChildCount + 1
|
||||
self.levelCtrl.GoldenSpyFloorData:SetItem(nItemId)
|
||||
end
|
||||
end
|
||||
end
|
||||
function GoldenSpyFloorCtrl:InitTrap()
|
||||
if self.prefab == nil then
|
||||
return
|
||||
end
|
||||
local trapRoot = self.prefab.transform:Find("TrapRoot")
|
||||
if trapRoot == nil then
|
||||
return
|
||||
end
|
||||
local nChildCount = trapRoot.transform.childCount
|
||||
for i = 1, nChildCount do
|
||||
local child = trapRoot.transform:GetChild(i - 1)
|
||||
local trapId = tonumber(child.gameObject.name)
|
||||
local trapCfg = ConfigTable.GetData("GoldenSpyObstacle", trapId)
|
||||
if trapCfg ~= nil then
|
||||
local trapCtrl = self:BindCtrlByNode(child.gameObject, itemCtrlPath .. trapCfg.luaCtrl)
|
||||
trapCtrl:Init()
|
||||
trapCtrl:SetData({nTrapId = trapId}, self)
|
||||
table.insert(self.tbTrap, {Ctrl = trapCtrl})
|
||||
end
|
||||
end
|
||||
end
|
||||
function GoldenSpyFloorCtrl:StartFloor()
|
||||
self.bStartFloor = true
|
||||
local hookCtrl = self._mapNode.HookCtrl
|
||||
hookCtrl:StartSwing()
|
||||
for _, v in ipairs(self.tbItem) do
|
||||
v.Ctrl:StartFloor()
|
||||
end
|
||||
for _, v in ipairs(self.tbTrap) do
|
||||
if v.Ctrl ~= nil then
|
||||
v.Ctrl:StartFloor()
|
||||
end
|
||||
end
|
||||
end
|
||||
function GoldenSpyFloorCtrl:FinishFloor()
|
||||
self.bStartFloor = false
|
||||
self:Exit()
|
||||
end
|
||||
function GoldenSpyFloorCtrl:GetHookEndPos()
|
||||
return self._mapNode.HookCtrl:GetHookEndWorldPosition()
|
||||
end
|
||||
function GoldenSpyFloorCtrl:GetHookEndPosInRectLocal(targetRect)
|
||||
if targetRect == nil or targetRect:IsNull() then
|
||||
return nil
|
||||
end
|
||||
local hookCtrl = self._mapNode.HookCtrl
|
||||
if hookCtrl == nil then
|
||||
return nil
|
||||
end
|
||||
local hookPos = hookCtrl:GetHookEndWorldPosition()
|
||||
local hookRootTr = hookCtrl.gameObject.transform
|
||||
local posInCommon = hookRootTr:TransformPoint(hookPos)
|
||||
return targetRect:InverseTransformPoint(posInCommon)
|
||||
end
|
||||
function GoldenSpyFloorCtrl:GetHookRadius()
|
||||
return self.levelCtrl:GetHookRadius()
|
||||
end
|
||||
function GoldenSpyFloorCtrl:ResumeHookSwing()
|
||||
local hookCtrl = self._mapNode.HookCtrl
|
||||
if hookCtrl and hookCtrl.ResumeSwing then
|
||||
hookCtrl:ResumeSwing(true)
|
||||
end
|
||||
end
|
||||
function GoldenSpyFloorCtrl:Shoot(nSpeed, nRadius, nFactor, 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()
|
||||
if onRetractComplete then
|
||||
onRetractComplete()
|
||||
end
|
||||
end, function(itemCtrl)
|
||||
if onCatched then
|
||||
onCatched(itemCtrl)
|
||||
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
|
||||
end
|
||||
end
|
||||
self.catchedItem = nil
|
||||
self.bInvincible = false
|
||||
if onCatchedComplete then
|
||||
onCatchedComplete(itemCtrl)
|
||||
end
|
||||
end)
|
||||
end
|
||||
function GoldenSpyFloorCtrl:RemoveItem(itemCtrl)
|
||||
local bDelSuccess = false
|
||||
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)
|
||||
bDelSuccess = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if bDelSuccess then
|
||||
self.levelCtrl.GoldenSpyFloorData:DeleteItem(itemCtrl:GetItemCfg().Id)
|
||||
end
|
||||
end
|
||||
function GoldenSpyFloorCtrl:DropItem()
|
||||
if self.catchedItem == 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
|
||||
end
|
||||
function GoldenSpyFloorCtrl:SetHookIsInvincible(bInvincible)
|
||||
self.bInvincible = bInvincible
|
||||
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
|
||||
function GoldenSpyFloorCtrl:DoStartRetract()
|
||||
self.levelCtrl:StartRetract()
|
||||
end
|
||||
function GoldenSpyFloorCtrl:StartRetract(finishCallback)
|
||||
local hookCtrl = self._mapNode.HookCtrl
|
||||
if hookCtrl and hookCtrl.StartRetract then
|
||||
hookCtrl:StartRetract(self.levelCtrl:GetHookBaseSpeed(), function()
|
||||
self:ResumeHookSwing()
|
||||
if finishCallback then
|
||||
finishCallback()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
function GoldenSpyFloorCtrl:StartBoom(useCallback, finishCallback)
|
||||
if self.catchedItem == nil 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)
|
||||
return true
|
||||
end
|
||||
function GoldenSpyFloorCtrl:CheckHasFrozenItem()
|
||||
for _, v in ipairs(self.tbItem) do
|
||||
local itemCfg = v.Ctrl:GetItemCfg()
|
||||
if itemCfg.ItemType == GameEnum.GoldenSpyItem.Companion or itemCfg.ItemType == GameEnum.GoldenSpyItem.Patrol then
|
||||
return true
|
||||
end
|
||||
end
|
||||
if #self.tbTrap > 0 then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
function GoldenSpyFloorCtrl:StartFrozen()
|
||||
for _, v in ipairs(self.tbItem) do
|
||||
if v.Ctrl ~= nil and v.Ctrl ~= self.catchedItem then
|
||||
v.Ctrl:OnSkill_Frozen()
|
||||
end
|
||||
end
|
||||
for _, v in ipairs(self.tbTrap) do
|
||||
if v.Ctrl ~= nil then
|
||||
v.Ctrl:OnSkill_Frozen()
|
||||
end
|
||||
end
|
||||
end
|
||||
function GoldenSpyFloorCtrl:StopFrozen()
|
||||
for _, v in ipairs(self.tbItem) do
|
||||
if v.Ctrl ~= nil and v.Ctrl ~= self.catchedItem then
|
||||
v.Ctrl:OnSkill_Frozen_Resume()
|
||||
end
|
||||
end
|
||||
for _, v in ipairs(self.tbTrap) do
|
||||
if v.Ctrl ~= nil then
|
||||
v.Ctrl:OnSkill_Frozen_Resume()
|
||||
end
|
||||
end
|
||||
end
|
||||
function GoldenSpyFloorCtrl:Pause()
|
||||
self._mapNode.HookCtrl:Pause()
|
||||
for _, v in ipairs(self.tbItem) do
|
||||
if v.Ctrl ~= nil then
|
||||
v.Ctrl:Pause()
|
||||
end
|
||||
end
|
||||
for _, v in ipairs(self.tbTrap) do
|
||||
if v.Ctrl ~= nil then
|
||||
v.Ctrl:Pause()
|
||||
end
|
||||
end
|
||||
end
|
||||
function GoldenSpyFloorCtrl:Exit()
|
||||
if self.prefab ~= nil then
|
||||
for i = #self.tbItem, 1, -1 do
|
||||
self.tbItem[i].Ctrl:FinishFloor()
|
||||
self:UnbindCtrlByNode(self.tbItem[i].Ctrl)
|
||||
end
|
||||
for i = #self.tbTrap, 1, -1 do
|
||||
self.tbTrap[i].Ctrl:FinishFloor()
|
||||
self:UnbindCtrlByNode(self.tbTrap[i].Ctrl)
|
||||
end
|
||||
for i = #self.tbNeedRemoveItem, 1, -1 do
|
||||
self:UnbindCtrlByNode(self.tbNeedRemoveItem[i].Ctrl)
|
||||
end
|
||||
destroy(self.prefab)
|
||||
end
|
||||
self.tbItem = {}
|
||||
self.tbTrap = {}
|
||||
self.tbNeedRemoveItem = {}
|
||||
self.prefab = nil
|
||||
self._mapNode.HookCtrl:Exit()
|
||||
end
|
||||
function GoldenSpyFloorCtrl:Continue()
|
||||
self._mapNode.HookCtrl:Continue()
|
||||
for _, v in ipairs(self.tbItem) do
|
||||
if v.Ctrl ~= nil then
|
||||
v.Ctrl:Resume()
|
||||
end
|
||||
end
|
||||
for _, v in ipairs(self.tbTrap) do
|
||||
if v.Ctrl ~= nil then
|
||||
v.Ctrl:Resume()
|
||||
end
|
||||
end
|
||||
end
|
||||
return GoldenSpyFloorCtrl
|
||||
@@ -0,0 +1,53 @@
|
||||
local GoldenSpyFloorData = class("GoldenSpyFloorData")
|
||||
function GoldenSpyFloorData:ctor()
|
||||
end
|
||||
function GoldenSpyFloorData:InitData()
|
||||
self.tbItem = {}
|
||||
end
|
||||
function GoldenSpyFloorData:StartFloor(levelId, floorId)
|
||||
self.levelId = levelId
|
||||
self.floorId = floorId
|
||||
self.floorConfig = ConfigTable.GetData("GoldenSpyFloor", floorId)
|
||||
if self.floorConfig == nil then
|
||||
return
|
||||
end
|
||||
end
|
||||
function GoldenSpyFloorData:GetCurFloor()
|
||||
return self.floorId
|
||||
end
|
||||
function GoldenSpyFloorData:GetFloorConfig()
|
||||
return self.floorConfig
|
||||
end
|
||||
function GoldenSpyFloorData:SetItem(itemId)
|
||||
if self.tbItem[itemId] == nil then
|
||||
self.tbItem[itemId] = {itemId = itemId, itemCount = 0}
|
||||
end
|
||||
self.tbItem[itemId].itemCount = self.tbItem[itemId].itemCount + 1
|
||||
end
|
||||
function GoldenSpyFloorData:DeleteItem(itemId)
|
||||
if self.tbItem[itemId] == nil then
|
||||
return
|
||||
end
|
||||
self.tbItem[itemId].itemCount = self.tbItem[itemId].itemCount - 1
|
||||
if self.tbItem[itemId].itemCount <= 0 then
|
||||
self.tbItem[itemId] = nil
|
||||
end
|
||||
local itemCfg = ConfigTable.GetData("GoldenSpyItem", itemId)
|
||||
if itemCfg.ItemType == GameEnum.GoldenSpyItem.BuffItem then
|
||||
return
|
||||
end
|
||||
local nCount = 0
|
||||
for k, v in pairs(self.tbItem) do
|
||||
local itemCfg = ConfigTable.GetData("GoldenSpyItem", k)
|
||||
if itemCfg ~= nil and itemCfg.ItemType ~= GameEnum.GoldenSpyItem.Boom then
|
||||
nCount = nCount + v.itemCount
|
||||
end
|
||||
end
|
||||
if self.tbItem == nil or nCount <= 0 then
|
||||
EventManager.Hit("GoldenSpy_FinishFloor")
|
||||
end
|
||||
end
|
||||
function GoldenSpyFloorData:GetItems()
|
||||
return self.tbItem
|
||||
end
|
||||
return GoldenSpyFloorData
|
||||
@@ -0,0 +1,606 @@
|
||||
local GoldenSpyHookCtrl = class("GoldenSpyHookCtrl", BaseCtrl)
|
||||
local LoopType = CS.DG.Tweening.LoopType
|
||||
GoldenSpyHookCtrl._mapNodeConfig = {
|
||||
trHookPivot = {
|
||||
sNodeName = "HookPivot",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
trLine = {
|
||||
sNodeName = "hook_line",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
trHookEnd = {
|
||||
sNodeName = "hook",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
rtMaxLengthArea = {
|
||||
sNodeName = "MaxLengthArea",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
itemParent = {
|
||||
sNodeName = "itemParent",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
hook_open = {},
|
||||
hook_normal = {},
|
||||
hook_catched = {}
|
||||
}
|
||||
GoldenSpyHookCtrl.DefaultLineSize = 100
|
||||
GoldenSpyHookCtrl.DefaultHookPosY = -90
|
||||
GoldenSpyHookCtrl.HOOK_SWING_EASE = Ease.Linear
|
||||
GoldenSpyHookCtrl.HOOK_EXTEND_EASE = Ease.Linear
|
||||
GoldenSpyHookCtrl.HOOK_RETRACT_EASE = Ease.Linear
|
||||
local HookStage = {
|
||||
STATE_SWINGING = 1,
|
||||
STATE_EXTENDING = 2,
|
||||
STATE_RETRACTING = 3
|
||||
}
|
||||
function GoldenSpyHookCtrl:Init(levelId, floorId, floorCtrl, levelData, floorData)
|
||||
self.levelId = levelId
|
||||
self.floorId = floorId
|
||||
self.floorCtrl = floorCtrl
|
||||
self.levelData = levelData
|
||||
self.floorData = floorData
|
||||
self:DestroyItemInHook()
|
||||
local levelCfg = ConfigTable.GetData("GoldenSpyLevel", self.levelId)
|
||||
local configCfg = ConfigTable.GetData("GoldenSpyConfig", levelCfg.ConfigId)
|
||||
self.HOOK_SWING_LEFT_ANGLE = -configCfg.MaxAngle
|
||||
self.HOOK_SWING_RIGHT_ANGLE = configCfg.MaxAngle
|
||||
self.HOOK_SWING_DURATION = configCfg.AngleTime
|
||||
self._swingTweener = nil
|
||||
self._extendTweener = nil
|
||||
self._retractTweener = nil
|
||||
self._hookLength = 0
|
||||
self._hookState = 0
|
||||
self._onExtendComplete = nil
|
||||
self._onRetractComplete = nil
|
||||
self._swingGoingRight = true
|
||||
self._swingAtRight = false
|
||||
self.curCatchedItem = nil
|
||||
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)
|
||||
end
|
||||
function GoldenSpyHookCtrl:DestroyItemInHook()
|
||||
local itemParent = self._mapNode.itemParent
|
||||
if itemParent == nil then
|
||||
return
|
||||
end
|
||||
local nChildCount = itemParent.transform.childCount
|
||||
for i = 1, nChildCount do
|
||||
local child = itemParent.transform:GetChild(i - 1)
|
||||
destroy(child.gameObject)
|
||||
end
|
||||
end
|
||||
function GoldenSpyHookCtrl:ApplyHookLength()
|
||||
local tr = self._mapNode.trHookEnd
|
||||
if tr then
|
||||
tr.localPosition = Vector3(0, -self._hookLength + self.DefaultHookPosY, 0)
|
||||
end
|
||||
local rtLine = self._mapNode.trLine
|
||||
if rtLine and not rtLine:IsNull() then
|
||||
rtLine.sizeDelta = Vector2(rtLine.sizeDelta.x, self._hookLength + self.DefaultLineSize)
|
||||
end
|
||||
end
|
||||
function GoldenSpyHookCtrl:SetHookLength(length)
|
||||
self._hookLength = math.max(0, length)
|
||||
self:ApplyHookLength()
|
||||
end
|
||||
function GoldenSpyHookCtrl:_DoSwingPhase(fromAngle, toAngle, onPhaseComplete)
|
||||
local pivot = self._mapNode.trHookPivot
|
||||
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)
|
||||
self._swingGoingRight = toAngle == self.HOOK_SWING_RIGHT_ANGLE
|
||||
pivot.localEulerAngles = Vector3(0, 0, fromAngle)
|
||||
local realAngle = math.abs(toAngle - fromAngle)
|
||||
local realDuration = realAngle / 1.0 / math.abs(self.HOOK_SWING_RIGHT_ANGLE * 2) * self.HOOK_SWING_DURATION
|
||||
if self._swingTweener ~= nil then
|
||||
self._swingTweener:Kill()
|
||||
self._swingTweener = nil
|
||||
end
|
||||
self._swingTweener = pivot:DOLocalRotate(Vector3(0, 0, toAngle), realDuration, RotateMode.Fast):SetEase(self.HOOK_SWING_EASE):SetUpdate(true):OnComplete(function()
|
||||
onPhaseComplete()
|
||||
end)
|
||||
end
|
||||
function GoldenSpyHookCtrl:_ChainSwing()
|
||||
local pivot = self._mapNode.trHookPivot
|
||||
if pivot == nil then
|
||||
return
|
||||
end
|
||||
local leftAngle = self.HOOK_SWING_LEFT_ANGLE
|
||||
local rightAngle = self.HOOK_SWING_RIGHT_ANGLE
|
||||
if self._swingAtRight then
|
||||
self._swingGoingRight = false
|
||||
self:_DoSwingPhase(rightAngle, leftAngle, function()
|
||||
self._swingAtRight = false
|
||||
self:_ChainSwing()
|
||||
end)
|
||||
else
|
||||
self._swingGoingRight = true
|
||||
self:_DoSwingPhase(leftAngle, rightAngle, function()
|
||||
self._swingAtRight = true
|
||||
self:_ChainSwing()
|
||||
end)
|
||||
end
|
||||
end
|
||||
function GoldenSpyHookCtrl:StartSwing(leftAngle, rightAngle)
|
||||
if self._hookState == HookStage.STATE_EXTENDING or self._hookState == HookStage.STATE_RETRACTING then
|
||||
return
|
||||
end
|
||||
self:StopSwing()
|
||||
self:StopExtend()
|
||||
self:StopRetract()
|
||||
self._mapNode.hook_open:SetActive(false)
|
||||
self._mapNode.hook_normal:SetActive(true)
|
||||
self._mapNode.hook_catched:SetActive(false)
|
||||
local pivot = self._mapNode.trHookPivot
|
||||
if pivot == nil then
|
||||
return
|
||||
end
|
||||
self._hookLength = 0
|
||||
self:ApplyHookLength()
|
||||
self._hookState = HookStage.STATE_SWINGING
|
||||
leftAngle = leftAngle or self.HOOK_SWING_LEFT_ANGLE
|
||||
rightAngle = rightAngle or self.HOOK_SWING_RIGHT_ANGLE
|
||||
self._swingAtRight = false
|
||||
self._swingGoingRight = true
|
||||
self:_DoSwingPhase(0, rightAngle, function()
|
||||
self._swingAtRight = true
|
||||
self:_ChainSwing()
|
||||
end)
|
||||
EventManager.Hit("GoldenSpyHookResumeSwing")
|
||||
end
|
||||
function GoldenSpyHookCtrl:PauseSwing()
|
||||
self:StopSwing()
|
||||
if self._hookState == HookStage.STATE_SWINGING then
|
||||
end
|
||||
end
|
||||
function GoldenSpyHookCtrl:ResumeSwing(fromCurrent)
|
||||
local pivot = self._mapNode.trHookPivot
|
||||
if pivot == nil then
|
||||
return
|
||||
end
|
||||
local leftAngle = self.HOOK_SWING_LEFT_ANGLE
|
||||
local rightAngle = self.HOOK_SWING_RIGHT_ANGLE
|
||||
if fromCurrent then
|
||||
self:StopExtend()
|
||||
self:StopRetract()
|
||||
self:StopSwing()
|
||||
local curZ = self:_NormalizeAngleZ(pivot.localEulerAngles.z)
|
||||
if self._swingGoingRight then
|
||||
self._swingAtRight = false
|
||||
self._swingGoingRight = true
|
||||
self:_DoSwingPhase(curZ, rightAngle, function()
|
||||
self._swingAtRight = true
|
||||
self:_ChainSwing()
|
||||
end)
|
||||
else
|
||||
self._swingAtRight = true
|
||||
self._swingGoingRight = false
|
||||
self:_DoSwingPhase(curZ, leftAngle, function()
|
||||
self._swingAtRight = false
|
||||
self:_ChainSwing()
|
||||
end)
|
||||
end
|
||||
else
|
||||
self:StartSwing()
|
||||
return
|
||||
end
|
||||
self._hookState = HookStage.STATE_SWINGING
|
||||
EventManager.Hit("GoldenSpyHookResumeSwing")
|
||||
end
|
||||
function GoldenSpyHookCtrl:_NormalizeAngleZ(z)
|
||||
while 180 < z do
|
||||
z = z - 360
|
||||
end
|
||||
while z < -180 do
|
||||
z = z + 360
|
||||
end
|
||||
return z
|
||||
end
|
||||
function GoldenSpyHookCtrl:StopSwing()
|
||||
if self._swingTweener ~= nil then
|
||||
self._swingTweener:Kill()
|
||||
self._swingTweener = nil
|
||||
end
|
||||
end
|
||||
function GoldenSpyHookCtrl:StartExtend(speed, radius, factor, onComplete, onCatched, onCatchedComplete)
|
||||
self:StopSwing()
|
||||
self:StopExtend()
|
||||
self:StopRetract()
|
||||
EventManager.Hit("GoldenSpyHookStartExtend")
|
||||
local tr = self._mapNode.trHookEnd
|
||||
if tr == nil then
|
||||
return
|
||||
end
|
||||
local maxLength = self:GetCurrentMaxLength()
|
||||
self._onExtendComplete = onComplete
|
||||
self._hookState = HookStage.STATE_EXTENDING
|
||||
local fromLen = self._hookLength
|
||||
local duration = (maxLength - fromLen) / speed
|
||||
if duration <= 0 then
|
||||
self._hookLength = maxLength
|
||||
self:ApplyHookLength()
|
||||
self._hookState = 0
|
||||
if self._onExtendComplete then
|
||||
self._onExtendComplete()
|
||||
self._onExtendComplete = nil
|
||||
end
|
||||
return
|
||||
end
|
||||
self._mapNode.hook_open:SetActive(true)
|
||||
self._mapNode.hook_normal:SetActive(false)
|
||||
self._mapNode.hook_catched:SetActive(false)
|
||||
self._extendTweener = DOTween.To(function()
|
||||
return self._hookLength
|
||||
end, function(v)
|
||||
self._hookLength = v
|
||||
self:ApplyHookLength()
|
||||
local items = self.floorCtrl.tbItem
|
||||
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
|
||||
item.Ctrl:Boom(nil)
|
||||
self:StartRetract(speed, function()
|
||||
self:ResumeSwing(true)
|
||||
if onCatchedComplete then
|
||||
onCatchedComplete(item.Ctrl)
|
||||
end
|
||||
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 then
|
||||
local curFloor = self.levelData:GetCurFloor()
|
||||
if buffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
|
||||
if v.bActive and table.indexof(v.tbActiveFloor, curFloor) > 0 and itemCfg.ItemType == buffCfg.Params[1] then
|
||||
itemNormalWeight = itemNormalWeight - buffCfg.Params[2]
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.DelayBuff then
|
||||
if v.bActive and table.indexof(v.tbActiveFloor, curFloor) > 0 and itemCfg.ItemType == buffCfg.Params[1] then
|
||||
itemNormalWeight = itemNormalWeight - buffCfg.Params[2]
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.PermanentBuff then
|
||||
if v.bActive and itemCfg.ItemType == buffCfg.Params[1] then
|
||||
itemNormalWeight = itemNormalWeight - buffCfg.Params[2]
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.SkillCountBuff then
|
||||
end
|
||||
end
|
||||
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)
|
||||
end
|
||||
self.curCatchedItem.gameObject:SetActive(false)
|
||||
self.curCatchedItem = nil
|
||||
end)
|
||||
self:StopExtend()
|
||||
break
|
||||
end
|
||||
end
|
||||
end, maxLength, duration):SetEase(self.HOOK_EXTEND_EASE):SetUpdate(true):OnComplete(function()
|
||||
self._extendTweener = nil
|
||||
self._hookState = 0
|
||||
self:StartRetract(speed, function()
|
||||
self:ResumeSwing(true)
|
||||
if onCatchedComplete then
|
||||
onCatchedComplete(self.curCatchedItem)
|
||||
end
|
||||
self.curCatchedItem = nil
|
||||
end)
|
||||
if self._onExtendComplete then
|
||||
self._onExtendComplete()
|
||||
self._onExtendComplete = nil
|
||||
end
|
||||
end)
|
||||
end
|
||||
function GoldenSpyHookCtrl:GetHookEndWorldPosition()
|
||||
local rootTr = self.gameObject.transform
|
||||
local trEnd = self._mapNode.trHookEnd
|
||||
local localPt = rootTr:InverseTransformPoint(trEnd.position)
|
||||
return Vector3(localPt.x, localPt.y, 0)
|
||||
end
|
||||
function GoldenSpyHookCtrl:StopExtend()
|
||||
if self._extendTweener ~= nil then
|
||||
self._extendTweener:Kill()
|
||||
self._extendTweener = nil
|
||||
end
|
||||
if self._hookState == HookStage.STATE_EXTENDING then
|
||||
self._hookState = 0
|
||||
end
|
||||
self._onExtendComplete = nil
|
||||
end
|
||||
function GoldenSpyHookCtrl:PauseExtend()
|
||||
if self._extendTweener ~= nil then
|
||||
self._extendTweener:Pause()
|
||||
end
|
||||
if self._hookState == HookStage.STATE_EXTENDING then
|
||||
end
|
||||
end
|
||||
function GoldenSpyHookCtrl:ResumeExtend()
|
||||
if self._extendTweener ~= nil then
|
||||
self._extendTweener:Play()
|
||||
end
|
||||
if self._hookState == HookStage.STATE_EXTENDING then
|
||||
end
|
||||
end
|
||||
function GoldenSpyHookCtrl:StartRetract(speed, onComplete)
|
||||
self:StopSwing()
|
||||
self:StopExtend()
|
||||
self:StopRetract()
|
||||
local tr = self._mapNode.trHookEnd
|
||||
if tr == nil then
|
||||
if onComplete then
|
||||
onComplete()
|
||||
end
|
||||
return
|
||||
end
|
||||
self._mapNode.hook_open:SetActive(false)
|
||||
self._mapNode.hook_normal:SetActive(false)
|
||||
self._mapNode.hook_catched:SetActive(true)
|
||||
self._onRetractComplete = onComplete
|
||||
self._hookState = HookStage.STATE_RETRACTING
|
||||
local fromLen = self._hookLength
|
||||
local duration = fromLen / speed
|
||||
if duration <= 0 then
|
||||
self._hookLength = 0
|
||||
self:ApplyHookLength()
|
||||
self._hookState = 0
|
||||
if self._onRetractComplete then
|
||||
self._onRetractComplete()
|
||||
self._onRetractComplete = nil
|
||||
end
|
||||
return
|
||||
end
|
||||
self._retractTweener = DOTween.To(function()
|
||||
return self._hookLength
|
||||
end, function(v)
|
||||
self._hookLength = v
|
||||
self:ApplyHookLength()
|
||||
end, 0, duration):SetEase(self.HOOK_RETRACT_EASE):SetUpdate(true):OnComplete(function()
|
||||
self._retractTweener = nil
|
||||
self._hookState = 0
|
||||
if self._onRetractComplete then
|
||||
self._onRetractComplete()
|
||||
self._onRetractComplete = nil
|
||||
end
|
||||
end):OnKill(function()
|
||||
self._retractTweener = nil
|
||||
if self._hookState == HookStage.STATE_RETRACTING then
|
||||
self._hookState = 0
|
||||
end
|
||||
end)
|
||||
end
|
||||
function GoldenSpyHookCtrl:StopRetract()
|
||||
if self._retractTweener ~= nil then
|
||||
self._retractTweener:Kill()
|
||||
self._retractTweener = nil
|
||||
end
|
||||
if self._hookState == HookStage.STATE_RETRACTING then
|
||||
self._hookState = 0
|
||||
end
|
||||
self._onRetractComplete = nil
|
||||
end
|
||||
function GoldenSpyHookCtrl:SetRetractSpeed(newSpeed)
|
||||
if not self:IsRetracting() then
|
||||
return
|
||||
end
|
||||
local onComplete = self._onRetractComplete
|
||||
self:StopRetract()
|
||||
self:StartRetract(newSpeed, onComplete)
|
||||
end
|
||||
function GoldenSpyHookCtrl:PauseRetract()
|
||||
if self._retractTweener ~= nil then
|
||||
self._retractTweener:Pause()
|
||||
end
|
||||
if self._hookState == HookStage.STATE_RETRACTING then
|
||||
end
|
||||
end
|
||||
function GoldenSpyHookCtrl:ResumeRetract()
|
||||
if self._retractTweener ~= nil then
|
||||
self._retractTweener:Play()
|
||||
end
|
||||
if self._hookState == HookStage.STATE_RETRACTING then
|
||||
end
|
||||
end
|
||||
function GoldenSpyHookCtrl:GetHookAngle()
|
||||
local pivot = self._mapNode.trHookPivot
|
||||
if pivot == nil then
|
||||
return 0
|
||||
end
|
||||
return pivot.localEulerAngles.z
|
||||
end
|
||||
function GoldenSpyHookCtrl:GetMaxLengthForAngle(angleDeg)
|
||||
local rect = self._mapNode.rtMaxLengthArea
|
||||
local trLine = self._mapNode.trLine
|
||||
if rect == nil or rect:IsNull() or trLine == nil or trLine:IsNull() then
|
||||
return 0
|
||||
end
|
||||
local lineLocalPos = rect:InverseTransformPoint(trLine.position)
|
||||
local sx, sy = lineLocalPos.x, lineLocalPos.y
|
||||
local left = 0
|
||||
local bottom = 0
|
||||
local right = rect.sizeDelta.x
|
||||
local top = rect.sizeDelta.y
|
||||
local rad = math.rad(angleDeg)
|
||||
local worldDir = Vector3(math.sin(rad), -math.cos(rad), 0)
|
||||
local localDir = rect:InverseTransformDirection(worldDir)
|
||||
local dx, dy = localDir.x, localDir.y
|
||||
local lenSq = dx * dx + dy * dy
|
||||
if lenSq < 1.0E-12 then
|
||||
return 0
|
||||
end
|
||||
local invLen = 1 / math.sqrt(lenSq)
|
||||
dx, dy = dx * invLen, dy * invLen
|
||||
local tMin
|
||||
if math.abs(dx) > 1.0E-6 then
|
||||
local tL = (left - sx) / dx
|
||||
if 0 < tL then
|
||||
local y = sy + tL * dy
|
||||
if bottom <= y and top >= y then
|
||||
tMin = tMin == nil and tL or math.min(tMin, tL)
|
||||
end
|
||||
end
|
||||
local tR = (right - sx) / dx
|
||||
if 0 < tR then
|
||||
local y = sy + tR * dy
|
||||
if bottom <= y and top >= y then
|
||||
tMin = tMin == nil and tR or math.min(tMin, tR)
|
||||
end
|
||||
end
|
||||
end
|
||||
if math.abs(dy) > 1.0E-6 then
|
||||
local tB = (bottom - sy) / dy
|
||||
if 0 < tB then
|
||||
local x = sx + tB * dx
|
||||
if left <= x and right >= x then
|
||||
tMin = tMin == nil and tB or math.min(tMin, tB)
|
||||
end
|
||||
end
|
||||
local tT = (top - sy) / dy
|
||||
if 0 < tT then
|
||||
local x = sx + tT * dx
|
||||
if left <= x and right >= x then
|
||||
tMin = tMin == nil and tT or math.min(tMin, tT)
|
||||
end
|
||||
end
|
||||
end
|
||||
return math.max(0, tMin or 0)
|
||||
end
|
||||
function GoldenSpyHookCtrl:GetCurrentMaxLength()
|
||||
return self:GetMaxLengthForAngle(self:GetHookAngle())
|
||||
end
|
||||
function GoldenSpyHookCtrl:_CircleCircleIntersect(hx, hy, hookR, ix, iy, itemR)
|
||||
local dx, dy = ix - hx, iy - hy
|
||||
local dist2 = dx * dx + dy * dy
|
||||
local sumR = hookR + (itemR or 0)
|
||||
return dist2 <= sumR * sumR
|
||||
end
|
||||
function GoldenSpyHookCtrl:_CircleRectIntersect(hx, hy, hookR, cx, cy, width, height)
|
||||
local hw = (width or 0) * 0.5
|
||||
local hh = (height or 0) * 0.5
|
||||
local px = hx
|
||||
if px < cx - hw then
|
||||
px = cx - hw
|
||||
elseif px > cx + hw then
|
||||
px = cx + hw
|
||||
end
|
||||
local py = hy
|
||||
if py < cy - hh then
|
||||
py = cy - hh
|
||||
elseif py > cy + hh then
|
||||
py = cy + hh
|
||||
end
|
||||
local dx, dy = hx - px, hy - py
|
||||
local dist2 = dx * dx + dy * dy
|
||||
return dist2 <= hookR * hookR
|
||||
end
|
||||
function GoldenSpyHookCtrl:CheckCatchIntersect(hookWorldPos, hookRadius, item)
|
||||
if hookWorldPos == nil or not item then
|
||||
return false
|
||||
end
|
||||
local hx, hy = hookWorldPos.x, hookWorldPos.y
|
||||
local hitArea = item:GetHitArea()
|
||||
local ix, iy = hitArea.center.x, hitArea.center.y
|
||||
if hitArea.nType == AllEnum.GoldenSpyHitAreaType.Circle then
|
||||
return self:_CircleCircleIntersect(hx, hy, hookRadius, ix, iy, (hitArea.width or 0) / 2)
|
||||
elseif hitArea.nType == AllEnum.GoldenSpyHitAreaType.Rectangle then
|
||||
return self:_CircleRectIntersect(hx, hy, hookRadius, ix, iy, hitArea.width or 0, hitArea.height or 0)
|
||||
end
|
||||
return self:_CircleCircleIntersect(hx, hy, hookRadius, ix, iy, item.radius or 0)
|
||||
end
|
||||
function GoldenSpyHookCtrl:CheckCatchInRadius(hookWorldPos, radius, items)
|
||||
if not (hookWorldPos ~= nil and items) or #items == 0 then
|
||||
return nil
|
||||
end
|
||||
for i = 1, #items do
|
||||
local item = items[i]
|
||||
if self:CheckCatchIntersect(hookWorldPos, radius, item) then
|
||||
return item
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
function GoldenSpyHookCtrl:GetHookLength()
|
||||
return self._hookLength
|
||||
end
|
||||
function GoldenSpyHookCtrl:GetState()
|
||||
return self._hookState
|
||||
end
|
||||
function GoldenSpyHookCtrl:IsSwinging()
|
||||
return self._hookState == HookStage.STATE_SWINGING
|
||||
end
|
||||
function GoldenSpyHookCtrl:IsExtending()
|
||||
return self._hookState == HookStage.STATE_EXTENDING
|
||||
end
|
||||
function GoldenSpyHookCtrl:IsRetracting()
|
||||
return self._hookState == HookStage.STATE_RETRACTING
|
||||
end
|
||||
function GoldenSpyHookCtrl:DropItem()
|
||||
self.curCatchedItem = nil
|
||||
end
|
||||
function GoldenSpyHookCtrl:OnDestroy()
|
||||
self:StopSwing()
|
||||
self:StopExtend()
|
||||
self:StopRetract()
|
||||
end
|
||||
function GoldenSpyHookCtrl:GetBuffData()
|
||||
return self.levelData:GetBuffData()
|
||||
end
|
||||
function GoldenSpyHookCtrl:Pause()
|
||||
if self:IsSwinging() then
|
||||
self:PauseSwing()
|
||||
end
|
||||
if self:IsExtending() then
|
||||
self:PauseExtend()
|
||||
end
|
||||
if self:IsRetracting() then
|
||||
self:PauseRetract()
|
||||
end
|
||||
end
|
||||
function GoldenSpyHookCtrl:Continue()
|
||||
if self:IsSwinging() then
|
||||
self:ResumeSwing(true)
|
||||
end
|
||||
if self:IsExtending() then
|
||||
self:ResumeExtend()
|
||||
end
|
||||
if self:IsRetracting() then
|
||||
self:ResumeRetract()
|
||||
end
|
||||
end
|
||||
function GoldenSpyHookCtrl:Exit()
|
||||
self:StopSwing()
|
||||
self:StopExtend()
|
||||
self:StopRetract()
|
||||
end
|
||||
return GoldenSpyHookCtrl
|
||||
@@ -0,0 +1,236 @@
|
||||
local GoldenSpyBaseTrap = require("Game.UI.Activity.GoldenSpy.GoldenSpyBaseTrap")
|
||||
local GoldenSpyLaserTrap = class("GoldenSpyLaserTrap", GoldenSpyBaseTrap)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local LoopType = CS.DG.Tweening.LoopType
|
||||
local Ease = CS.DG.Tweening.Ease.Linear
|
||||
GoldenSpyLaserTrap._mapNodeConfig = {
|
||||
TriggerArea = {
|
||||
sNodeName = "TriggerArea",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
trRotatePivot = {
|
||||
sNodeName = "RotatePivot",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
imgIce = {},
|
||||
IceRoot = {
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
GoldenSpyLaserTrap._mapEventConfig = {
|
||||
GoldenSpyHookStartExtend = "OnEvent_GoldenSpyHookStartExtend",
|
||||
GM_GoldenSpy_Show = "OnEvent_GM_GoldenSpy_Show"
|
||||
}
|
||||
GoldenSpyLaserTrap._mapRedDotConfig = {}
|
||||
GoldenSpyLaserTrap.LASER_ROTATE_EASE = "Linear"
|
||||
GoldenSpyLaserTrap.TRIGGER_CHECK_INTERVAL = 0.03
|
||||
function GoldenSpyLaserTrap:Awake()
|
||||
self._rotateTweener = nil
|
||||
self._triggerTimer = nil
|
||||
self._lastLaserAngle = nil
|
||||
self._rotateHeadingToMax = nil
|
||||
self.bTrigger = true
|
||||
self._mapNode.imgIce:SetActive(false)
|
||||
self._mapNode.IceRoot.gameObject:SetActive(false)
|
||||
end
|
||||
function GoldenSpyLaserTrap:OnEnable()
|
||||
end
|
||||
function GoldenSpyLaserTrap:OnDisable()
|
||||
end
|
||||
function GoldenSpyLaserTrap:OnDestroy()
|
||||
self:_StopRotate()
|
||||
self:_StopTriggerCheck()
|
||||
end
|
||||
function GoldenSpyLaserTrap:InitData()
|
||||
self.LASER_ANGLE_MIN = self.trapCfg.Params[1]
|
||||
self.LASER_ANGLE_MAX = self.trapCfg.Params[2]
|
||||
self.LASER_ROTATE_DURATION = self.trapCfg.Params[3]
|
||||
self.SUBTIME = self.trapCfg.Params[4]
|
||||
end
|
||||
function GoldenSpyLaserTrap:GetTriggerArea()
|
||||
local rt = self._mapNode.TriggerArea
|
||||
if rt == nil or rt:IsNull() then
|
||||
return {}
|
||||
end
|
||||
return {
|
||||
nType = AllEnum.GoldenSpyHitAreaType.Rectangle,
|
||||
center = rt.position,
|
||||
width = rt.sizeDelta.x,
|
||||
height = rt.sizeDelta.y
|
||||
}
|
||||
end
|
||||
function GoldenSpyLaserTrap:FinishFloor()
|
||||
self:_StopRotate()
|
||||
self:_StopTriggerCheck()
|
||||
end
|
||||
function GoldenSpyLaserTrap:_StartRotate()
|
||||
self:_StopRotate()
|
||||
local pivot = self._mapNode.trRotatePivot
|
||||
if pivot == nil or pivot:IsNull() then
|
||||
pivot = self.transform
|
||||
end
|
||||
if pivot == nil then
|
||||
return
|
||||
end
|
||||
local angleMin = self.LASER_ANGLE_MIN or -90
|
||||
local angleMax = self.LASER_ANGLE_MAX or 90
|
||||
local duration = self.LASER_ROTATE_DURATION or 3
|
||||
local fullRange = math.max(0.001, angleMax - angleMin)
|
||||
local tweenAngleMin = angleMin
|
||||
local tweenAngleMax = angleMax
|
||||
if 0.001 > math.abs(fullRange - 180) then
|
||||
tweenAngleMax = angleMax - 0.01
|
||||
end
|
||||
local currentZ = pivot.localEulerAngles.z
|
||||
if 180 < currentZ then
|
||||
currentZ = currentZ - 360
|
||||
end
|
||||
self._lastLaserAngle = currentZ
|
||||
local RotateMode = CS.DG.Tweening.RotateMode.Fast
|
||||
local headingToMax = self._rotateHeadingToMax ~= false
|
||||
if currentZ >= angleMax - 0.01 then
|
||||
self._rotateHeadingToMax = false
|
||||
self._rotateTweener = pivot:DOLocalRotate(Vector3(0, 0, tweenAngleMin), duration, RotateMode):SetEase(Ease):SetLoops(-1, LoopType.Yoyo):SetUpdate(true)
|
||||
elseif currentZ <= angleMin + 0.01 then
|
||||
self._rotateHeadingToMax = true
|
||||
self._rotateTweener = pivot:DOLocalRotate(Vector3(0, 0, tweenAngleMax), duration, RotateMode):SetEase(Ease):SetLoops(-1, LoopType.Yoyo):SetUpdate(true)
|
||||
elseif headingToMax then
|
||||
self._rotateHeadingToMax = true
|
||||
local ratio = math.abs(angleMax - currentZ) / fullRange
|
||||
local durationFirst = duration * math.max(0.01, ratio)
|
||||
local seq = DOTween.Sequence()
|
||||
seq:SetUpdate(true)
|
||||
seq:Append(pivot:DOLocalRotate(Vector3(0, 0, tweenAngleMax), durationFirst, RotateMode):SetEase(Ease))
|
||||
seq:Append(pivot:DOLocalRotate(Vector3(0, 0, tweenAngleMin), duration, RotateMode):SetEase(Ease):SetLoops(-1, LoopType.Yoyo))
|
||||
self._rotateTweener = seq
|
||||
else
|
||||
self._rotateHeadingToMax = false
|
||||
local ratio = math.abs(currentZ - angleMin) / fullRange
|
||||
local durationFirst = duration * math.max(0.01, ratio)
|
||||
local seq = DOTween.Sequence()
|
||||
seq:SetUpdate(true)
|
||||
seq:Append(pivot:DOLocalRotate(Vector3(0, 0, tweenAngleMin), durationFirst, RotateMode):SetEase(Ease))
|
||||
seq:Append(pivot:DOLocalRotate(Vector3(0, 0, tweenAngleMax), duration, RotateMode):SetEase(Ease):SetLoops(-1, LoopType.Yoyo))
|
||||
self._rotateTweener = seq
|
||||
end
|
||||
end
|
||||
function GoldenSpyLaserTrap:_StopRotate()
|
||||
if self._rotateTweener ~= nil then
|
||||
self._rotateTweener:Kill()
|
||||
self._rotateTweener = nil
|
||||
end
|
||||
end
|
||||
function GoldenSpyLaserTrap:_IsHookInTriggerArea(hookPos, hookRadius)
|
||||
if hookPos == nil then
|
||||
return false
|
||||
end
|
||||
local rt = self._mapNode.TriggerArea
|
||||
if rt == nil or rt:IsNull() then
|
||||
return false
|
||||
end
|
||||
local radius = hookRadius ~= nil and hookRadius or self.HOOK_TRIGGER_RADIUS_DEFAULT or 0
|
||||
local w = rt.sizeDelta.x
|
||||
local h = rt.sizeDelta.y
|
||||
local hw = w * 0.5
|
||||
local hh = h * 0.5
|
||||
local x, y = hookPos.x, hookPos.y
|
||||
local dx = math.max(0, math.abs(x) - hw)
|
||||
local dy = math.max(0, math.abs(y) - hh)
|
||||
local distSq = dx * dx + dy * dy
|
||||
return distSq <= radius * radius
|
||||
end
|
||||
function GoldenSpyLaserTrap:_OnTriggerCheck()
|
||||
local pivot = self._mapNode.trRotatePivot
|
||||
if pivot == nil or pivot:IsNull() then
|
||||
pivot = self.transform
|
||||
end
|
||||
if pivot ~= nil then
|
||||
local z = pivot.localEulerAngles.z
|
||||
if 180 < z then
|
||||
z = z - 360
|
||||
end
|
||||
if self._lastLaserAngle ~= nil then
|
||||
if z > self._lastLaserAngle then
|
||||
self._rotateHeadingToMax = true
|
||||
elseif z < self._lastLaserAngle then
|
||||
self._rotateHeadingToMax = false
|
||||
end
|
||||
end
|
||||
self._lastLaserAngle = z
|
||||
end
|
||||
local bInvincible = self.floorCtrl:GetHookIsInvincible()
|
||||
if bInvincible then
|
||||
return
|
||||
end
|
||||
local hookPos = self.floorCtrl:GetHookEndPos()
|
||||
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()
|
||||
WwiseAudioMgr:PostEvent("Mode_steal_error")
|
||||
self.floorCtrl:DoStartRetract()
|
||||
self.floorCtrl:SubTime(self.SUBTIME)
|
||||
self.bTrigger = false
|
||||
end
|
||||
end
|
||||
function GoldenSpyLaserTrap:_StartTriggerCheck()
|
||||
self:_StopTriggerCheck()
|
||||
local interval = self.TRIGGER_CHECK_INTERVAL or 0.03
|
||||
self._triggerTimer = self:AddTimer(0, interval, function()
|
||||
self:_OnTriggerCheck()
|
||||
end, true, true, true)
|
||||
end
|
||||
function GoldenSpyLaserTrap:_StopTriggerCheck()
|
||||
if self._triggerTimer ~= nil then
|
||||
self._triggerTimer:Cancel()
|
||||
self._triggerTimer = nil
|
||||
end
|
||||
end
|
||||
function GoldenSpyLaserTrap:StartFloor()
|
||||
self:_StartRotate()
|
||||
self:_StartTriggerCheck()
|
||||
end
|
||||
function GoldenSpyLaserTrap:Pause()
|
||||
self:_StopRotate()
|
||||
self:_StopTriggerCheck()
|
||||
end
|
||||
function GoldenSpyLaserTrap:Resume()
|
||||
if self.bFrozen then
|
||||
return
|
||||
end
|
||||
self:_StartRotate()
|
||||
self:_StartTriggerCheck()
|
||||
end
|
||||
function GoldenSpyLaserTrap:OnSkill_Frozen(callback)
|
||||
self.bFrozen = true
|
||||
self:_StopRotate()
|
||||
self:_StopTriggerCheck()
|
||||
self._mapNode.imgIce:SetActive(true)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function GoldenSpyLaserTrap:OnSkill_Frozen_Resume(callback)
|
||||
self.bFrozen = false
|
||||
self:_StartRotate()
|
||||
self:_StartTriggerCheck()
|
||||
self._mapNode.imgIce:SetActive(false)
|
||||
self:AddTimer(1, 0.5, function()
|
||||
self._mapNode.IceRoot.gameObject:SetActive(false)
|
||||
end, true, true, true)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function GoldenSpyLaserTrap:OnBtnClick_AAA()
|
||||
end
|
||||
function GoldenSpyLaserTrap:OnEvent_GoldenSpyHookStartExtend()
|
||||
self.bTrigger = true
|
||||
end
|
||||
function GoldenSpyLaserTrap:OnEvent_GM_GoldenSpy_Show()
|
||||
local img = self._mapNode.TriggerArea:GetComponent("Image")
|
||||
if img then
|
||||
img.enabled = true
|
||||
end
|
||||
end
|
||||
return GoldenSpyLaserTrap
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,360 @@
|
||||
local GoldenSpyLevelData = class("GoldenSpyLevelData")
|
||||
local GoldenSpyFloorData = require("Game.UI.Activity.GoldenSpy.GoldenSpyFloorData")
|
||||
function GoldenSpyLevelData:ctor()
|
||||
end
|
||||
function GoldenSpyLevelData:InitData()
|
||||
if self.floorData == nil then
|
||||
self.floorData = GoldenSpyFloorData.new()
|
||||
end
|
||||
self.floorData:InitData()
|
||||
self.nCurScore = 0
|
||||
self.nCurFloor = 1
|
||||
self.nCurFloorId = nil
|
||||
self.tbCatchItem = {}
|
||||
self.tbBuff = {}
|
||||
self.tbUsedSkill = {}
|
||||
self.tbSkillData = {}
|
||||
self.taskData = {
|
||||
nScore = 0,
|
||||
tbItems = {}
|
||||
}
|
||||
self.nCompleteTaskCount = 0
|
||||
self.nLevelType = nil
|
||||
self.tbRandomPrefabName = {}
|
||||
end
|
||||
function GoldenSpyLevelData:StartLevel(levelId)
|
||||
self.levelId = levelId
|
||||
self.levelConfig = ConfigTable.GetData("GoldenSpyLevel", levelId)
|
||||
if self.levelConfig == nil then
|
||||
return
|
||||
end
|
||||
self.nCurFloorId = self.levelConfig.FloorList[self.nCurFloor]
|
||||
self.floorData:StartFloor(levelId, self.nCurFloorId)
|
||||
self.nLevelType = self.levelConfig.LevelType
|
||||
local tbSkillData = decodeJson(self.levelConfig.Skill)
|
||||
for _, v in ipairs(tbSkillData) do
|
||||
self.tbSkillData[v[1]] = v[2]
|
||||
self.tbUsedSkill[v[1]] = 0
|
||||
end
|
||||
end
|
||||
function GoldenSpyLevelData:NextFloor()
|
||||
self.nCurFloor = self.nCurFloor + 1
|
||||
self.nCurFloorId = self.levelConfig.FloorList[self.nCurFloor]
|
||||
self.floorData:InitData()
|
||||
self.floorData:StartFloor(self.levelId, self.nCurFloorId)
|
||||
end
|
||||
function GoldenSpyLevelData:GetFloorData()
|
||||
return self.floorData
|
||||
end
|
||||
function GoldenSpyLevelData:GetCurScore()
|
||||
return self.nCurScore
|
||||
end
|
||||
function GoldenSpyLevelData:AddScore(nScore)
|
||||
self.nCurScore = self.nCurScore + nScore
|
||||
end
|
||||
function GoldenSpyLevelData:GetCurFloor()
|
||||
return self.nCurFloor
|
||||
end
|
||||
function GoldenSpyLevelData:GetTotalFloor()
|
||||
return #self.levelConfig.FloorList
|
||||
end
|
||||
function GoldenSpyLevelData:GetCurFloorId()
|
||||
return self.nCurFloorId
|
||||
end
|
||||
function GoldenSpyLevelData:GetLevelPrefabName()
|
||||
local floorCfg = ConfigTable.GetData("GoldenSpyFloor", self.nCurFloorId)
|
||||
if floorCfg == nil then
|
||||
return
|
||||
end
|
||||
local nPrefabName = floorCfg.PrefabName[1]
|
||||
if self.levelConfig.LevelType == GameEnum.GoldenSpyLevelType.Random then
|
||||
local tbPrefabPool = {}
|
||||
for i = 1, #floorCfg.PrefabName do
|
||||
table.insert(tbPrefabPool, floorCfg.PrefabName[i])
|
||||
end
|
||||
for i = #tbPrefabPool, 1, -1 do
|
||||
local index = table.indexof(self.tbRandomPrefabName, tbPrefabPool[i])
|
||||
if 0 < index then
|
||||
table.remove(tbPrefabPool, i)
|
||||
end
|
||||
end
|
||||
local nRandomIndex = math.random(1, #tbPrefabPool)
|
||||
nPrefabName = tbPrefabPool[nRandomIndex]
|
||||
table.insert(self.tbRandomPrefabName, nPrefabName)
|
||||
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()
|
||||
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 then
|
||||
if buffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
|
||||
if v.bActive and table.indexof(v.tbActiveFloor, self.nCurFloor) > 0 then
|
||||
nScore = nScore + buffCfg.Params[2]
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.DelayBuff then
|
||||
if v.bActive and table.indexof(v.tbActiveFloor, self.nCurFloor) > 0 then
|
||||
nScore = nScore + buffCfg.Params[2]
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.PermanentBuff then
|
||||
if v.bActive then
|
||||
nScore = nScore + buffCfg.Params[2]
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.SkillCountBuff then
|
||||
end
|
||||
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
|
||||
end
|
||||
function GoldenSpyLevelData:GetCatchItemData()
|
||||
return self.tbCatchItem
|
||||
end
|
||||
function GoldenSpyLevelData:GetTaskData()
|
||||
return self.taskData
|
||||
end
|
||||
function GoldenSpyLevelData:RefreshTask()
|
||||
local nScore = 0
|
||||
local tbItems = {}
|
||||
self.taskData = {
|
||||
nScore = 0,
|
||||
tbItems = {}
|
||||
}
|
||||
local allItems = self.floorData:GetItems()
|
||||
local items = {}
|
||||
for _, v in pairs(allItems) do
|
||||
local itemCfg = ConfigTable.GetData("GoldenSpyItem", v.itemId)
|
||||
if itemCfg ~= nil and itemCfg.IsTask then
|
||||
table.insert(items, v)
|
||||
end
|
||||
end
|
||||
local nTotalItemCount = 0
|
||||
for _, v in pairs(items) do
|
||||
nTotalItemCount = nTotalItemCount + v.itemCount
|
||||
end
|
||||
if nTotalItemCount <= 0 then
|
||||
return
|
||||
end
|
||||
local nRandomMaxCount = math.min(nTotalItemCount, 3)
|
||||
local nExWeight = 0
|
||||
for _, v in ipairs(self.tbBuff) do
|
||||
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
|
||||
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddTaskWeight then
|
||||
if buffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
|
||||
if v.bActive and 0 < table.indexof(v.tbActiveFloor, self.nCurFloor) then
|
||||
nExWeight = nExWeight + buffCfg.Params[1]
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.DelayBuff then
|
||||
if v.bActive and 0 < table.indexof(v.tbActiveFloor, self.nCurFloor) then
|
||||
nExWeight = nExWeight + buffCfg.Params[1]
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.PermanentBuff then
|
||||
if v.bActive then
|
||||
nExWeight = nExWeight + buffCfg.Params[1]
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.SkillCountBuff then
|
||||
end
|
||||
end
|
||||
end
|
||||
local tbRandomTaskConfig = {}
|
||||
local nRandomTotalWeight = 0
|
||||
local mLogWeight = 0
|
||||
local forEachLine_ExScore = function(mapLineData)
|
||||
if mapLineData.ItemCount <= nRandomMaxCount then
|
||||
table.insert(tbRandomTaskConfig, mapLineData)
|
||||
if mapLineData.ItemCount == 1 then
|
||||
nRandomTotalWeight = nRandomTotalWeight + mapLineData.Weight + nExWeight
|
||||
mLogWeight = mapLineData.Weight + nExWeight
|
||||
else
|
||||
nRandomTotalWeight = nRandomTotalWeight + mapLineData.Weight
|
||||
end
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.GoldenSpyExtraScore, forEachLine_ExScore)
|
||||
if NovaAPI.IsEditorPlatform() then
|
||||
print("GoldenSpyLevelCtrl: 单个物品任务权重:", mLogWeight, "总权重:", nRandomTotalWeight)
|
||||
end
|
||||
if #tbRandomTaskConfig <= 0 then
|
||||
return
|
||||
end
|
||||
local nRandomWeight = math.random(1, nRandomTotalWeight)
|
||||
local tempWeight = 0
|
||||
local nRandomCount = 0
|
||||
for i, v in ipairs(tbRandomTaskConfig) do
|
||||
if v.ItemCount == 1 then
|
||||
tempWeight = tempWeight + v.Weight + nExWeight
|
||||
else
|
||||
tempWeight = tempWeight + v.Weight
|
||||
end
|
||||
if nRandomWeight <= tempWeight then
|
||||
nScore = v.Score
|
||||
nRandomCount = v.ItemCount
|
||||
break
|
||||
end
|
||||
end
|
||||
local tempNum = 0
|
||||
local tempItemList = {}
|
||||
for _, v in pairs(items) do
|
||||
for i = 1, v.itemCount do
|
||||
table.insert(tempItemList, v.itemId)
|
||||
end
|
||||
end
|
||||
for i = 1, nRandomCount do
|
||||
local nRandomNum = math.random(1, #tempItemList)
|
||||
table.insert(tbItems, {
|
||||
nItemId = tempItemList[nRandomNum],
|
||||
bFinish = false
|
||||
})
|
||||
table.remove(tempItemList, nRandomNum)
|
||||
end
|
||||
for _, v in ipairs(self.tbBuff) do
|
||||
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
|
||||
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddExScoreFactor then
|
||||
if buffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
|
||||
if v.bActive and 0 < table.indexof(v.tbActiveFloor, self.nCurFloor) then
|
||||
nScore = nScore * (1 + buffCfg.Params[1] / 100.0)
|
||||
nScore = math.floor(nScore)
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.DelayBuff then
|
||||
if v.bActive and 0 < table.indexof(v.tbActiveFloor, self.nCurFloor) then
|
||||
nScore = nScore * (1 + buffCfg.Params[1] / 100.0)
|
||||
nScore = math.floor(nScore)
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.PermanentBuff then
|
||||
if v.bActive then
|
||||
nScore = nScore * (1 + buffCfg.Params[1] / 100.0)
|
||||
nScore = math.floor(nScore)
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.SkillCountBuff then
|
||||
end
|
||||
end
|
||||
end
|
||||
self.taskData = {nScore = nScore, tbItems = tbItems}
|
||||
end
|
||||
function GoldenSpyLevelData:UpdateTask(nItemId)
|
||||
if self.taskData == nil or self.taskData.nScore == 0 then
|
||||
return false
|
||||
end
|
||||
for _, v in ipairs(self.taskData.tbItems) do
|
||||
if v.nItemId == nItemId and v.bFinish == false then
|
||||
v.bFinish = true
|
||||
break
|
||||
end
|
||||
end
|
||||
local bFinish = true
|
||||
for _, v in ipairs(self.taskData.tbItems) do
|
||||
if v.bFinish == false then
|
||||
bFinish = false
|
||||
break
|
||||
end
|
||||
end
|
||||
if bFinish then
|
||||
self:AddScore(self.taskData.nScore)
|
||||
self.nCompleteTaskCount = self.nCompleteTaskCount + 1
|
||||
end
|
||||
return bFinish
|
||||
end
|
||||
function GoldenSpyLevelData:GetCompleteTaskCount()
|
||||
return self.nCompleteTaskCount
|
||||
end
|
||||
function GoldenSpyLevelData:GetBuffData()
|
||||
return self.tbBuff
|
||||
end
|
||||
function GoldenSpyLevelData:AddBuff(nBuffId)
|
||||
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", nBuffId)
|
||||
if buffCfg == nil then
|
||||
return
|
||||
end
|
||||
local buffEntity = {
|
||||
buffId = nBuffId,
|
||||
tbActiveFloor = {},
|
||||
bActive = false
|
||||
}
|
||||
if buffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
|
||||
table.insert(buffEntity.tbActiveFloor, self.nCurFloor)
|
||||
buffEntity.bActive = true
|
||||
if buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddTimeInFloor then
|
||||
buffEntity.bActive = false
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.DelayBuff then
|
||||
table.insert(buffEntity.tbActiveFloor, self.nCurFloor + 1)
|
||||
buffEntity.bActive = true
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.PermanentBuff then
|
||||
buffEntity.bActive = true
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.SkillCountBuff then
|
||||
buffEntity.bActive = true
|
||||
if buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddSkillUseCount then
|
||||
self.tbSkillData[buffCfg.Params[1]] = self.tbSkillData[buffCfg.Params[1]] + buffCfg.Params[2]
|
||||
EventManager.Hit("GoldenSpy_UpdateSkillCount", buffCfg.Params[1], self.tbSkillData[buffCfg.Params[1]])
|
||||
end
|
||||
end
|
||||
table.insert(self.tbBuff, buffEntity)
|
||||
if self.taskData ~= nil and self.taskData.nScore > 0 and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddExScoreFactor then
|
||||
if buffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
|
||||
if buffEntity.bActive and 0 < table.indexof(buffEntity.tbActiveFloor, self.nCurFloor) then
|
||||
self.taskData.nScore = self.taskData.nScore * (1 + buffCfg.Params[1] / 100.0)
|
||||
self.taskData.nScore = math.floor(self.taskData.nScore)
|
||||
EventManager.Hit("GoldenSpy_UpdateTaskScore", self.taskData.nScore)
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.DelayBuff then
|
||||
if buffEntity.bActive and 0 < table.indexof(buffEntity.tbActiveFloor, self.nCurFloor) then
|
||||
self.taskData.nScore = self.taskData.nScore * (1 + buffCfg.Params[1] / 100.0)
|
||||
self.taskData.nScore = math.floor(self.taskData.nScore)
|
||||
EventManager.Hit("GoldenSpy_UpdateTaskScore", self.taskData.nScore)
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.PermanentBuff then
|
||||
if buffEntity.bActive then
|
||||
self.taskData.nScore = self.taskData.nScore * (1 + buffCfg.Params[1] / 100.0)
|
||||
self.taskData.nScore = math.floor(self.taskData.nScore)
|
||||
EventManager.Hit("GoldenSpy_UpdateTaskScore", self.taskData.nScore)
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.SkillCountBuff then
|
||||
end
|
||||
end
|
||||
if buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore then
|
||||
EventManager.Hit("GoldenSpy_ItemUpdateScore", self.tbBuff)
|
||||
end
|
||||
end
|
||||
function GoldenSpyLevelData:GetSkillData()
|
||||
return self.tbSkillData
|
||||
end
|
||||
function GoldenSpyLevelData:GetUsedSkillData()
|
||||
return self.tbUsedSkill
|
||||
end
|
||||
function GoldenSpyLevelData:UseSkill(nSkillId)
|
||||
if self.tbSkillData[nSkillId] == nil or self.tbSkillData[nSkillId] <= 0 then
|
||||
return
|
||||
end
|
||||
self.tbSkillData[nSkillId] = self.tbSkillData[nSkillId] - 1
|
||||
self.tbUsedSkill[nSkillId] = self.tbUsedSkill[nSkillId] + 1
|
||||
end
|
||||
function GoldenSpyLevelData:AddSkill(nSkillId, nCount)
|
||||
if self.tbSkillData[nSkillId] == nil then
|
||||
return
|
||||
end
|
||||
self.tbSkillData[nSkillId] = self.tbSkillData[nSkillId] + nCount
|
||||
EventManager.Hit("GoldenSpy_UpdateSkillCount", nSkillId, self.tbSkillData[nSkillId])
|
||||
end
|
||||
return GoldenSpyLevelData
|
||||
@@ -0,0 +1,28 @@
|
||||
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 = "_400008/GoldenSpyPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.GoldenSpy.GoldenSpyLevelCtrl"
|
||||
}
|
||||
}
|
||||
function GoldenSpyLevelPanel:Awake()
|
||||
PlayerData.Base:SetSkipNewDayWindow(true)
|
||||
self.bFirstInCtrl = true
|
||||
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,343 @@
|
||||
local GoldenSpyLevelSelectCtrl = class("GoldenSpyLevelSelectCtrl", BaseCtrl)
|
||||
local UIAssetPath = "UI_Activity/_400008/SpriteAtlas/"
|
||||
local PanelTab = {Group = 1, Level = 2}
|
||||
local GroupState = {
|
||||
Normal = 1,
|
||||
LockByTime = 2,
|
||||
LockByPreGroup = 3
|
||||
}
|
||||
GoldenSpyLevelSelectCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
GroupSelectRoot = {},
|
||||
btn_task = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Task"
|
||||
},
|
||||
txt_task = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GoldenSpy_QuestTitle"
|
||||
},
|
||||
reddot_task = {},
|
||||
btn_Group = {
|
||||
nCount = 4,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Group"
|
||||
},
|
||||
LevelDetalRoot = {},
|
||||
reward = {
|
||||
nCount = 2,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
btn_go = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Go"
|
||||
},
|
||||
txt_go = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GoldenSpy_Go"
|
||||
},
|
||||
img_Pass = {},
|
||||
go_lockTips = {},
|
||||
txt_lockTips = {sComponentName = "TMP_Text"},
|
||||
btn_level = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Level"
|
||||
},
|
||||
img_select = {nCount = 2}
|
||||
}
|
||||
GoldenSpyLevelSelectCtrl._mapEventConfig = {
|
||||
[EventId.UIBackConfirm] = "OnEvent_BackHome",
|
||||
[EventId.UIHomeConfirm] = "OnEvent_Home"
|
||||
}
|
||||
GoldenSpyLevelSelectCtrl._mapRedDotConfig = {}
|
||||
function GoldenSpyLevelSelectCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActivityId = param[1]
|
||||
end
|
||||
EventManager.Add(EventId.TemporaryBlockInput, 1.5)
|
||||
end
|
||||
function GoldenSpyLevelSelectCtrl:OnEnable()
|
||||
self.animator = self.gameObject:GetComponent("Animator")
|
||||
local mapActivityData = ConfigTable.GetData("Activity", self.nActivityId)
|
||||
if mapActivityData ~= nil then
|
||||
local nGroupId = mapActivityData.MidGroupId
|
||||
local mapGroupData = PlayerData.Activity:GetActivityGroupDataById(nGroupId)
|
||||
if mapGroupData ~= nil then
|
||||
local actData = mapGroupData:GetActivityDataByIndex(AllEnum.ActivityThemeFuncIndex.Task)
|
||||
if actData ~= nil then
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task_Group, {
|
||||
nGroupId,
|
||||
actData.ActivityId,
|
||||
mapActivityData.MiniGameRedDot
|
||||
}, self._mapNode.reddot_task)
|
||||
else
|
||||
self._mapNode.reddot_task:SetActive(false)
|
||||
end
|
||||
else
|
||||
self._mapNode.reddot_task:SetActive(false)
|
||||
end
|
||||
else
|
||||
self._mapNode.reddot_task:SetActive(false)
|
||||
end
|
||||
if self._panel.nPanelTab == PanelTab.Level then
|
||||
local groupCfg = ConfigTable.GetData("GoldenSpyLevelGroup", self._panel.nSelectGroupId)
|
||||
for _, v in ipairs(groupCfg.LevelList) do
|
||||
local levelData = self.GoldenSpyActData:GetLevelDataById(v)
|
||||
if levelData ~= nil and not levelData.bFirstComplete then
|
||||
self._panel.nSelectLevelId = v
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
self:SwitchPanelTab(self._panel.nPanelTab)
|
||||
end
|
||||
function GoldenSpyLevelSelectCtrl:SwitchPanelTab(nTab)
|
||||
local oldTab = self._panel.nPanelTab
|
||||
self._panel.nPanelTab = nTab
|
||||
if nTab == PanelTab.Group then
|
||||
if oldTab == PanelTab.Level then
|
||||
self.animator:Play("GoldenSpyLevelSelectPanel_idle")
|
||||
end
|
||||
self:InitGroupData()
|
||||
self._mapNode.GroupSelectRoot.gameObject:SetActive(true)
|
||||
self._mapNode.LevelDetalRoot.gameObject:SetActive(false)
|
||||
elseif nTab == PanelTab.Level then
|
||||
self.animator:Play("GoldenSpyLevelSelectPanel_switch")
|
||||
EventManager.Add(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)
|
||||
self._mapNode.img_select[i].gameObject:SetActive(self._panel.nSelectLevelId == ConfigTable.GetData("GoldenSpyLevelGroup", self._panel.nSelectGroupId).LevelList[i])
|
||||
end
|
||||
self:InitLevelData()
|
||||
self._mapNode.GroupSelectRoot.gameObject:SetActive(false)
|
||||
self._mapNode.LevelDetalRoot.gameObject:SetActive(true)
|
||||
end
|
||||
end
|
||||
function GoldenSpyLevelSelectCtrl:InitGroupData()
|
||||
self.tbGroupStateList = {}
|
||||
self.GoldenSpyActData = PlayerData.Activity:GetActivityDataById(self.nActivityId)
|
||||
if self.GoldenSpyActData == nil then
|
||||
return
|
||||
end
|
||||
self.tbGroupIdList = ConfigTable.GetData("GoldenSpyControl", self.nActivityId).LevelGroupList
|
||||
for i, v in ipairs(self.tbGroupIdList) do
|
||||
local groupData = self.GoldenSpyActData:GetLevelGroupDataById(v)
|
||||
if groupData ~= nil then
|
||||
local groupCfg = ConfigTable.GetData("GoldenSpyLevelGroup", v)
|
||||
if groupCfg ~= nil then
|
||||
local btn = self._mapNode.btn_Group[i]
|
||||
local normalRoot = btn.transform:Find("AnimRoot/normalRoot")
|
||||
local lockByTimeRoot = btn.transform:Find("AnimRoot/lockByTimeRoot")
|
||||
local lockByPreGroupRoot = btn.transform:Find("AnimRoot/lockByPreGroupRoot")
|
||||
normalRoot.gameObject:SetActive(false)
|
||||
lockByTimeRoot.gameObject:SetActive(false)
|
||||
lockByPreGroupRoot.gameObject:SetActive(false)
|
||||
if CS.ClientManager.Instance.serverTimeStamp < groupData.nStartTime and groupData.nStartTime ~= 0 then
|
||||
lockByTimeRoot.gameObject:SetActive(true)
|
||||
table.insert(self.tbGroupStateList, GroupState.LockByTime)
|
||||
elseif not self.GoldenSpyActData:CheckPreGroupPassByGroupId(v) then
|
||||
lockByPreGroupRoot.gameObject:SetActive(true)
|
||||
table.insert(self.tbGroupStateList, GroupState.LockByPreGroup)
|
||||
else
|
||||
normalRoot.gameObject:SetActive(true)
|
||||
table.insert(self.tbGroupStateList, GroupState.Normal)
|
||||
end
|
||||
local reddot = normalRoot.transform:Find("bg_GroupName/go_new")
|
||||
local actGroupId = ConfigTable.GetData("Activity", self.nActivityId).MidGroupId
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_GoldenSpy_Group, {actGroupId, v}, reddot.gameObject)
|
||||
local bg = normalRoot.transform:Find("bg"):GetComponent("Image")
|
||||
local txt_GroupName = normalRoot.transform:Find("bg_GroupName/txt_GroupName"):GetComponent("TMP_Text")
|
||||
local tbPointList = {}
|
||||
for i = 1, 3 do
|
||||
local point = normalRoot.transform:Find("GameObject/point" .. i)
|
||||
point.gameObject:SetActive(false)
|
||||
local img_pass = point.transform:Find("img_pass")
|
||||
img_pass.gameObject:SetActive(false)
|
||||
table.insert(tbPointList, point)
|
||||
end
|
||||
self:SetPngSprite(bg, UIAssetPath .. groupCfg.IconPath)
|
||||
NovaAPI.SetTMPText(txt_GroupName, groupCfg.GroupName)
|
||||
for m, n in ipairs(groupCfg.LevelList) do
|
||||
local levelData = self.GoldenSpyActData:GetLevelDataById(n)
|
||||
if levelData ~= nil then
|
||||
tbPointList[m].gameObject:SetActive(true)
|
||||
local levelCfg = ConfigTable.GetData("GoldenSpyLevel", n)
|
||||
if not (levelData.nMaxScore < levelCfg.Score) then
|
||||
local img_pass = tbPointList[m].transform:Find("img_pass")
|
||||
img_pass.gameObject:SetActive(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
local bg_lock = lockByPreGroupRoot.transform:Find("bg"):GetComponent("Image")
|
||||
local txt_GroupName_Lock = lockByPreGroupRoot.transform:Find("bg_GroupName/txt_GroupName"):GetComponent("TMP_Text")
|
||||
local txt_lock = lockByPreGroupRoot.transform:Find("txt_lock"):GetComponent("TMP_Text")
|
||||
self:SetPngSprite(bg_lock, UIAssetPath .. groupCfg.IconPath)
|
||||
NovaAPI.SetTMPText(txt_GroupName_Lock, groupCfg.GroupName)
|
||||
local nIndex = table.indexof(self.tbGroupIdList, v)
|
||||
if 1 < nIndex then
|
||||
local preGroupId = self.tbGroupIdList[nIndex - 1]
|
||||
local preGroupCfg = ConfigTable.GetData("GoldenSpyLevelGroup", preGroupId)
|
||||
NovaAPI.SetTMPText(txt_lock, orderedFormat(ConfigTable.GetUIText("GoldenSpy_LevelGroup_Lock_PreGroup"), preGroupCfg.GroupName))
|
||||
end
|
||||
local txt_time = lockByTimeRoot.transform:Find("txt_time"):GetComponent("TMP_Text")
|
||||
local nStartTime = self.GoldenSpyActData:GetGroupStartTime(v)
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
if 0 < nStartTime then
|
||||
local remainTime = nStartTime - CS.ClientManager.Instance.serverTimeStamp
|
||||
local sTimeStr = self:GetTimeText(remainTime)
|
||||
NovaAPI.SetTMPText(txt_time, orderedFormat(ConfigTable.GetUIText("GoldenSpy_TimeTips") or "", sTimeStr))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function GoldenSpyLevelSelectCtrl:InitLevelData()
|
||||
local groupCfg = ConfigTable.GetData("GoldenSpyLevelGroup", self._panel.nSelectGroupId)
|
||||
if groupCfg == nil then
|
||||
return
|
||||
end
|
||||
local levelCfg = ConfigTable.GetData("GoldenSpyLevel", self._panel.nSelectLevelId)
|
||||
if levelCfg == nil then
|
||||
return
|
||||
end
|
||||
local levelData = self.GoldenSpyActData:GetLevelDataById(self._panel.nSelectLevelId)
|
||||
local levelRoot = self._mapNode.LevelDetalRoot
|
||||
local txt_GroupName = levelRoot.transform:Find("bg_GroupName/txt_GroupName"):GetComponent("TMP_Text")
|
||||
local img_level = levelRoot.transform:Find("img_level"):GetComponent("Image")
|
||||
local txt_levelName = levelRoot.transform:Find("AnimRoot/GameObject/txt_levelName"):GetComponent("TMP_Text")
|
||||
local txt_floorCount = levelRoot.transform:Find("AnimRoot/GameObject/db_floor/txt_floorCount"):GetComponent("TMP_Text")
|
||||
local txt_levelDes = levelRoot.transform:Find("AnimRoot/txt_levelDes"):GetComponent("TMP_Text")
|
||||
local title_score = levelRoot.transform:Find("AnimRoot/Image/title_score"):GetComponent("TMP_Text")
|
||||
local txt_score = levelRoot.transform:Find("AnimRoot/Image/txt_score"):GetComponent("TMP_Text")
|
||||
local txt_target = levelRoot.transform:Find("AnimRoot/db_reward/txt_target"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txt_GroupName, groupCfg.GroupName)
|
||||
self:SetPngSprite(img_level, UIAssetPath .. levelCfg.IconPath)
|
||||
NovaAPI.SetTMPText(txt_levelName, levelCfg.LevelName)
|
||||
local nTotalFloor = #levelCfg.FloorList
|
||||
NovaAPI.SetTMPText(txt_floorCount, orderedFormat(ConfigTable.GetUIText("GoldenSpy_TotalFloor"), nTotalFloor))
|
||||
NovaAPI.SetTMPText(txt_levelDes, levelCfg.LevelDesc)
|
||||
NovaAPI.SetTMPText(title_score, ConfigTable.GetUIText("GoldenSpy_HighestScoreTitle"))
|
||||
NovaAPI.SetTMPText(txt_score, orderedFormat(ConfigTable.GetUIText("GoldenSpy_HighestScore"), levelData.nMaxScore))
|
||||
NovaAPI.SetTMPText(txt_target, levelCfg.WinCondDesc)
|
||||
for i = 1, 2 do
|
||||
self._mapNode.reward[i]:SetItem(levelCfg["Item" .. i .. "Id"], nil, levelCfg["Item" .. i .. "Count"], nil, levelData.bFirstComplete, nil, nil, false)
|
||||
local btn_reward = self._mapNode.reward[i].gameObject:GetComponent("UIButton")
|
||||
btn_reward.onClick:RemoveAllListeners()
|
||||
local clickCb = function()
|
||||
UTILS.ClickItemGridWithTips(levelCfg["Item" .. i .. "Id"], btn_reward.transform, true, false, false)
|
||||
end
|
||||
btn_reward.onClick:AddListener(clickCb)
|
||||
end
|
||||
local bPreLevelPass = self.GoldenSpyActData:CheckPreLevelPassById(self._panel.nSelectLevelId)
|
||||
if bPreLevelPass then
|
||||
self._mapNode.btn_go.gameObject:SetActive(true)
|
||||
self._mapNode.go_lockTips.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.btn_go.gameObject:SetActive(false)
|
||||
local preLevelData = self.GoldenSpyActData:GetLevelDataById(levelCfg.PreLevelId)
|
||||
if preLevelData ~= nil then
|
||||
local preLevelCfg = ConfigTable.GetData("GoldenSpyLevel", levelCfg.PreLevelId)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_lockTips, orderedFormat(ConfigTable.GetUIText("GoldenSpy_LockTips"), preLevelCfg.LevelName))
|
||||
self._mapNode.go_lockTips.gameObject:SetActive(true)
|
||||
end
|
||||
end
|
||||
self._mapNode.img_Pass.gameObject:SetActive(levelData.bFirstComplete)
|
||||
end
|
||||
function GoldenSpyLevelSelectCtrl:GetTimeText(remainTime)
|
||||
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
|
||||
return sTimeStr
|
||||
end
|
||||
function GoldenSpyLevelSelectCtrl:OnBtnClick_Task()
|
||||
local mapActivityData = ConfigTable.GetData("Activity", self.nActivityId)
|
||||
if mapActivityData ~= nil then
|
||||
local nGroupId = mapActivityData.MidGroupId
|
||||
local mapGroupData = PlayerData.Activity:GetActivityGroupDataById(nGroupId)
|
||||
if mapGroupData ~= nil then
|
||||
local actData = mapGroupData:GetActivityDataByIndex(AllEnum.ActivityThemeFuncIndex.Task)
|
||||
if actData ~= nil then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Task_20102, actData.ActivityId, 4)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function GoldenSpyLevelSelectCtrl:OnBtnClick_Group(btn, nIndex)
|
||||
local groupState = self.tbGroupStateList[nIndex]
|
||||
if groupState ~= GroupState.Normal then
|
||||
return
|
||||
end
|
||||
self._panel.nSelectGroupId = self.tbGroupIdList[nIndex]
|
||||
local groupCfg = ConfigTable.GetData("GoldenSpyLevelGroup", self._panel.nSelectGroupId)
|
||||
local tempLevelId = groupCfg.LevelList[1]
|
||||
for _, v in ipairs(groupCfg.LevelList) do
|
||||
local levelData = self.GoldenSpyActData:GetLevelDataById(v)
|
||||
if levelData ~= nil then
|
||||
tempLevelId = v
|
||||
if not levelData.bFirstComplete then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
self._panel.nSelectLevelId = tempLevelId
|
||||
self:SwitchPanelTab(PanelTab.Level)
|
||||
self.GoldenSpyActData:EnterGroupSelect(self._panel.nSelectGroupId)
|
||||
end
|
||||
function GoldenSpyLevelSelectCtrl:OnBtnClick_Level(btn, nIndex)
|
||||
for i = 1, 2 do
|
||||
self._mapNode.img_select[i].gameObject:SetActive(i == nIndex)
|
||||
end
|
||||
local groupCfg = ConfigTable.GetData("GoldenSpyLevelGroup", self._panel.nSelectGroupId)
|
||||
self._panel.nSelectLevelId = groupCfg.LevelList[nIndex]
|
||||
self:InitLevelData()
|
||||
end
|
||||
function GoldenSpyLevelSelectCtrl:OnBtnClick_Go()
|
||||
self.GoldenSpyActData:StartLevel(self._panel.nSelectGroupId, self._panel.nSelectLevelId)
|
||||
end
|
||||
function GoldenSpyLevelSelectCtrl:OnEvent_BackHome(nPanelId)
|
||||
if nPanelId == PanelId.GoldenSpyLevelSelectPanel then
|
||||
if self._panel.nPanelTab == PanelTab.Group then
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.GoldenSpyLevelSelectPanel)
|
||||
elseif self._panel.nPanelTab == PanelTab.Level then
|
||||
self:SwitchPanelTab(PanelTab.Group)
|
||||
end
|
||||
end
|
||||
end
|
||||
function GoldenSpyLevelSelectCtrl:OnEvent_Home(nPanelId)
|
||||
if nPanelId == PanelId.GoldenSpyLevelSelectPanel then
|
||||
PanelManager.Home()
|
||||
end
|
||||
end
|
||||
return GoldenSpyLevelSelectCtrl
|
||||
@@ -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 = "_400008/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,100 @@
|
||||
local GoldenSpyBaseItem = require("Game.UI.Activity.GoldenSpy.GoldenSpyBaseItem")
|
||||
local GoldenSpyNormalItem = class("GoldenSpyNormalItem", GoldenSpyBaseItem)
|
||||
GoldenSpyNormalItem._mapNodeConfig = {
|
||||
HitArea = {
|
||||
sNodeName = "HitArea",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
flash = {}
|
||||
}
|
||||
GoldenSpyNormalItem._mapEventConfig = {
|
||||
GM_GoldenSpy_Show = "OnEvent_GM_GoldenSpy_Show",
|
||||
GoldenSpy_ItemUpdateScore = "OnEvent_GoldenSpy_ItemUpdateScore"
|
||||
}
|
||||
GoldenSpyNormalItem._mapRedDotConfig = {}
|
||||
function GoldenSpyNormalItem:InitData()
|
||||
local nScore = self.itemCfg.Score
|
||||
for _, v in ipairs(self.floorCtrl.levelCtrl.GoldenSpyLevelData:GetBuffData()) do
|
||||
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
|
||||
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore and buffCfg.Params[1] == self.itemCfg.ItemType and self:IsBuffActive(v) then
|
||||
nScore = nScore + buffCfg.Params[2]
|
||||
end
|
||||
end
|
||||
self:InitFlash(nScore)
|
||||
end
|
||||
function GoldenSpyNormalItem:InitFlash(nScore)
|
||||
if self.itemCfg.NeedShowFlash == false then
|
||||
return
|
||||
end
|
||||
self._mapNode.flash:SetActive(nScore >= self.commonCfg.HighValueEffect)
|
||||
end
|
||||
function GoldenSpyNormalItem:GetHitArea()
|
||||
local tr = self.gameObject:GetComponent("RectTransform")
|
||||
local hitArea = {
|
||||
nType = self.nHitAreaType,
|
||||
center = self._mapNode.HitArea.anchoredPosition + tr.anchoredPosition,
|
||||
width = self._mapNode.HitArea.sizeDelta.x,
|
||||
height = self._mapNode.HitArea.sizeDelta.y
|
||||
}
|
||||
return hitArea
|
||||
end
|
||||
function GoldenSpyNormalItem:IsBuffActive(buffData)
|
||||
local bResult = false
|
||||
local nCurFloor = self.floorCtrl.levelCtrl.GoldenSpyLevelData:GetCurFloor()
|
||||
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", buffData.buffId)
|
||||
if buffCfg == nil then
|
||||
return false
|
||||
end
|
||||
if buffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
|
||||
if buffData.bActive and table.indexof(buffData.tbActiveFloor, nCurFloor) > 0 then
|
||||
bResult = true
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.DelayBuff then
|
||||
if buffData.bActive and table.indexof(buffData.tbActiveFloor, nCurFloor) > 0 then
|
||||
bResult = true
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.PermanentBuff then
|
||||
if buffData.bActive then
|
||||
bResult = true
|
||||
end
|
||||
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.SkillCountBuff then
|
||||
end
|
||||
return bResult
|
||||
end
|
||||
function GoldenSpyNormalItem:OnSkill_InVision()
|
||||
self.floorCtrl:RemoveItem(self)
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
function GoldenSpyNormalItem:OnSkill_Boom(callback)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
if self.gameObject then
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function GoldenSpyNormalItem:OnSkill_Frozen(callback)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function GoldenSpyNormalItem:OnEvent_GoldenSpy_ItemUpdateScore(tbBuff)
|
||||
if self.gameObject.activeSelf == false then
|
||||
return
|
||||
end
|
||||
local nScore = self.itemCfg.Score
|
||||
for _, v in ipairs(tbBuff) do
|
||||
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
|
||||
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore and buffCfg.Params[1] == self.itemCfg.ItemType and self:IsBuffActive(v) then
|
||||
nScore = nScore + buffCfg.Params[2]
|
||||
end
|
||||
end
|
||||
self:InitFlash(nScore)
|
||||
end
|
||||
function GoldenSpyNormalItem:OnEvent_GM_GoldenSpy_Show()
|
||||
local img = self._mapNode.HitArea:GetComponent("Image")
|
||||
if img then
|
||||
img.enabled = true
|
||||
end
|
||||
end
|
||||
return GoldenSpyNormalItem
|
||||
@@ -0,0 +1,383 @@
|
||||
local GoldenSpyBaseItem = require("Game.UI.Activity.GoldenSpy.GoldenSpyBaseItem")
|
||||
local GoldenSpyPatrolItem = class("GoldenSpyPatrolItem", GoldenSpyBaseItem)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local VisionAngle = 45
|
||||
local VisionRadius = 250
|
||||
GoldenSpyPatrolItem._mapNodeConfig = {
|
||||
trDrone = {
|
||||
sNodeName = "Drone",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
StartPoint = {
|
||||
sNodeName = "StartPoint",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
EndPoint = {
|
||||
sNodeName = "EndPoint",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
VisionPoint = {
|
||||
sNodeName = "VisionPoint",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
img_normal = {},
|
||||
img_warning = {},
|
||||
HitArea = {
|
||||
sNodeName = "HitArea",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
animator = {sNodeName = "Icon", sComponentName = "Animator"},
|
||||
flash = {},
|
||||
imgIce = {},
|
||||
IceRoot = {
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
GoldenSpyPatrolItem._mapEventConfig = {
|
||||
GoldenSpyHookStartExtend = "OnEvent_GoldenSpyHookStartExtend",
|
||||
GM_GoldenSpy_Show = "OnEvent_GM_GoldenSpy_Show"
|
||||
}
|
||||
GoldenSpyPatrolItem._mapRedDotConfig = {}
|
||||
function GoldenSpyPatrolItem:Awake()
|
||||
self._moveTweener = nil
|
||||
self._visionUpdateTimer = nil
|
||||
self._mapNode.img_normal:SetActive(true)
|
||||
self._mapNode.img_warning:SetActive(false)
|
||||
self.bTrigger = true
|
||||
self._mapNode.flash:SetActive(false)
|
||||
self._mapNode.imgIce:SetActive(false)
|
||||
self._mapNode.IceRoot.gameObject:SetActive(false)
|
||||
end
|
||||
function GoldenSpyPatrolItem:OnEnable()
|
||||
end
|
||||
function GoldenSpyPatrolItem:OnDisable()
|
||||
end
|
||||
function GoldenSpyPatrolItem:OnDestroy()
|
||||
self:StopMove()
|
||||
end
|
||||
function GoldenSpyPatrolItem:Init()
|
||||
self.nUid = nil
|
||||
self.nItemId = nil
|
||||
self.bDirection = true
|
||||
self.nBagItemPrice = 0
|
||||
local startPoint = self._mapNode.StartPoint.anchoredPosition
|
||||
self.vStartPoint = Vector3(startPoint.x, startPoint.y, 0)
|
||||
local endPoint = self._mapNode.EndPoint.anchoredPosition
|
||||
self.vEndPoint = Vector3(endPoint.x, endPoint.y, 0)
|
||||
local visionPoint = self._mapNode.VisionPoint.anchoredPosition
|
||||
self.vVisionPoint = Vector3(visionPoint.x, visionPoint.y, 0)
|
||||
self.bDirection = self.vEndPoint.x > self.vStartPoint.x
|
||||
self.bDestination = false
|
||||
end
|
||||
function GoldenSpyPatrolItem:InitData()
|
||||
self.nVisionAngle = self.itemCfg.Params[3] or VisionAngle
|
||||
self.nVisionRadius = self.itemCfg.Params[4] or VisionRadius
|
||||
end
|
||||
function GoldenSpyPatrolItem:StartFloor()
|
||||
self:StartMove()
|
||||
end
|
||||
function GoldenSpyPatrolItem:FinishFloor()
|
||||
self:StopMove()
|
||||
end
|
||||
function GoldenSpyPatrolItem:GetHitArea()
|
||||
local tr = self.gameObject:GetComponent("RectTransform")
|
||||
local hitArea = {
|
||||
nType = self.nHitAreaType,
|
||||
center = self._mapNode.HitArea.anchoredPosition + tr.anchoredPosition + self._mapNode.trDrone.anchoredPosition,
|
||||
width = self._mapNode.HitArea.sizeDelta.x,
|
||||
height = self._mapNode.HitArea.sizeDelta.y
|
||||
}
|
||||
return hitArea
|
||||
end
|
||||
function GoldenSpyPatrolItem:Boom(callback)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
function GoldenSpyPatrolItem:GetVisionArea()
|
||||
local visionArea = {
|
||||
center = self._mapNode.VisionPoint.anchoredPosition + self.gameObject.transform.anchoredPosition,
|
||||
radius = self._mapNode.VisionPoint.sizeDelta.x * 0.5,
|
||||
direction = self.bDirection
|
||||
}
|
||||
return visionArea
|
||||
end
|
||||
function GoldenSpyPatrolItem:Pause()
|
||||
if self._moveTweener ~= nil then
|
||||
self._moveTweener:Pause()
|
||||
end
|
||||
if self._visionUpdateTimer ~= nil then
|
||||
self._visionUpdateTimer:Pause(true)
|
||||
end
|
||||
end
|
||||
function GoldenSpyPatrolItem:Resume()
|
||||
if self.bFrozen then
|
||||
return
|
||||
end
|
||||
if self._moveTweener ~= nil then
|
||||
self._moveTweener:Play()
|
||||
end
|
||||
if self._visionUpdateTimer ~= nil then
|
||||
self._visionUpdateTimer:Pause(false)
|
||||
end
|
||||
end
|
||||
function GoldenSpyPatrolItem:onCatch(callback)
|
||||
self:StopMove()
|
||||
self._mapNode.trDrone.anchoredPosition = Vector2.zero
|
||||
self._mapNode.img_warning:SetActive(false)
|
||||
self._mapNode.img_normal:SetActive(false)
|
||||
self._mapNode.animator:Play("Companion_out")
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function GoldenSpyPatrolItem:OnSkill_Boom(callback)
|
||||
self:StopMove()
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
if self.gameObject then
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function GoldenSpyPatrolItem:OnSkill_Frozen(callback)
|
||||
self.bFrozen = true
|
||||
self._mapNode.imgIce:SetActive(true)
|
||||
self._mapNode.img_normal:SetActive(false)
|
||||
self._mapNode.img_warning:SetActive(false)
|
||||
self._mapNode.animator:Play("Companion_out")
|
||||
self:Pause()
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function GoldenSpyPatrolItem:OnSkill_Frozen_Resume(callback)
|
||||
self.bFrozen = false
|
||||
self._mapNode.imgIce:SetActive(false)
|
||||
self._mapNode.IceRoot:SetParent(self.gameObject.transform)
|
||||
self._mapNode.IceRoot.anchoredPosition = self._mapNode.trDrone.anchoredPosition
|
||||
self._mapNode.IceRoot.gameObject:SetActive(true)
|
||||
self._mapNode.img_normal:SetActive(true)
|
||||
self._mapNode.animator:Play("Companion_idle")
|
||||
if self._moveTweener ~= nil then
|
||||
self._moveTweener:Play()
|
||||
end
|
||||
if self._visionUpdateTimer ~= nil then
|
||||
self._visionUpdateTimer:Pause(false)
|
||||
end
|
||||
self:AddTimer(1, 0.5, function()
|
||||
self._mapNode.IceRoot.gameObject:SetActive(false)
|
||||
self._mapNode.IceRoot:SetParent(self._mapNode.trDrone)
|
||||
end, true, true, true)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function GoldenSpyPatrolItem:StartMove()
|
||||
self:StopMove()
|
||||
self.bDirection = self.vEndPoint.x > self.vStartPoint.x
|
||||
self:_ApplyForwardRotation()
|
||||
self:_StartMoveTween()
|
||||
self:_StartVisionCheck()
|
||||
end
|
||||
function GoldenSpyPatrolItem:_StartMoveTween()
|
||||
local tr = self._mapNode.trDrone
|
||||
if tr == nil then
|
||||
return
|
||||
end
|
||||
local from = tr.anchoredPosition
|
||||
local to = self.bDestination and self.vStartPoint or self.vEndPoint
|
||||
local dist = to.x - from.x
|
||||
local duration = math.abs(dist / (self.itemCfg.Params[1] or 100))
|
||||
if duration <= 0 then
|
||||
self:_OnReachTarget()
|
||||
return
|
||||
end
|
||||
if self._moveTweener ~= nil then
|
||||
self._moveTweener:Kill(false)
|
||||
self._moveTweener = nil
|
||||
end
|
||||
self._moveTweener = tr:DOAnchorPosX(to.x, duration):SetEase(Ease.Linear):SetUpdate(true):OnUpdate(function()
|
||||
end):OnComplete(function()
|
||||
self:_OnReachTarget()
|
||||
end):OnKill(function()
|
||||
end)
|
||||
end
|
||||
function GoldenSpyPatrolItem:StopMove()
|
||||
self:_KillMoveTween()
|
||||
self:_StopVisionCheck()
|
||||
end
|
||||
function GoldenSpyPatrolItem:_OnReachTarget()
|
||||
self.bDirection = not self.bDirection
|
||||
self.bDestination = not self.bDestination
|
||||
self:_ApplyForwardRotation()
|
||||
self:_StartMoveTween()
|
||||
end
|
||||
function GoldenSpyPatrolItem:_ApplyForwardRotation()
|
||||
local tr = self._mapNode.trDrone
|
||||
if tr then
|
||||
if self.bDirection then
|
||||
tr.localEulerAngles = Vector3(0, 0, 0)
|
||||
else
|
||||
tr.localEulerAngles = Vector3(0, 180, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
function GoldenSpyPatrolItem:_KillMoveTween()
|
||||
if self._moveTweener ~= nil then
|
||||
self._moveTweener:Kill(false)
|
||||
self._moveTweener = nil
|
||||
end
|
||||
if self._mapNode.trDrone ~= nil then
|
||||
self._mapNode.trDrone:DOKill(false)
|
||||
end
|
||||
end
|
||||
function GoldenSpyPatrolItem:GetForwardAngle()
|
||||
if self.bDirection then
|
||||
return 0
|
||||
else
|
||||
return 180
|
||||
end
|
||||
end
|
||||
function GoldenSpyPatrolItem:_PointInSector(px, py, cx, cy, forwardAngle, visionAngle, radius)
|
||||
local dx, dy = px - cx, py - cy
|
||||
local dist2 = dx * dx + dy * dy
|
||||
if dist2 > radius * radius then
|
||||
return false
|
||||
end
|
||||
local angle = math.deg(math.atan(dy, dx))
|
||||
local lo = forwardAngle - visionAngle
|
||||
local hi = forwardAngle + visionAngle
|
||||
while angle < lo do
|
||||
angle = angle + 360
|
||||
end
|
||||
while angle > hi + 360 do
|
||||
angle = angle - 360
|
||||
end
|
||||
if lo <= angle and hi >= angle then
|
||||
return true
|
||||
end
|
||||
if angle >= lo - 360 and angle <= hi - 360 then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
function GoldenSpyPatrolItem:_HitAreaInSector(hitArea, vx, vy, forwardAngle, halfAngle, radius)
|
||||
if not (hitArea and vx) or not vy then
|
||||
return false
|
||||
end
|
||||
local cx, cy = vx, vy
|
||||
local ix, iy
|
||||
if hitArea.position then
|
||||
ix, iy = hitArea.position.x, hitArea.position.y
|
||||
else
|
||||
return false
|
||||
end
|
||||
local itemR = hitArea.radius or 0
|
||||
return self:_CircleSectorIntersect(ix, iy, itemR, cx, cy, forwardAngle, halfAngle, radius)
|
||||
end
|
||||
function GoldenSpyPatrolItem:_PointToSectorDist(px, py, cx, cy, forwardAngle, halfAngle, radius)
|
||||
local dx, dy = px - cx, py - cy
|
||||
local dist = math.sqrt(dx * dx + dy * dy)
|
||||
local angleDeg = math.deg(math.atan(dy, dx))
|
||||
local lo = forwardAngle - halfAngle
|
||||
local hi = forwardAngle + halfAngle
|
||||
while angleDeg < lo - 180 do
|
||||
angleDeg = angleDeg + 360
|
||||
end
|
||||
while angleDeg > hi + 180 do
|
||||
angleDeg = angleDeg - 360
|
||||
end
|
||||
if lo <= angleDeg and hi >= angleDeg and radius >= dist then
|
||||
return 0
|
||||
end
|
||||
local radLo = math.rad(lo)
|
||||
local radHi = math.rad(hi)
|
||||
local clampAngle = angleDeg
|
||||
if lo > clampAngle then
|
||||
clampAngle = lo
|
||||
end
|
||||
if hi < clampAngle then
|
||||
clampAngle = hi
|
||||
end
|
||||
local radClamp = math.rad(clampAngle)
|
||||
local ax = cx + radius * math.cos(radClamp)
|
||||
local ay = cy + radius * math.sin(radClamp)
|
||||
local dArc = math.sqrt((px - ax) ^ 2 + (py - ay) ^ 2)
|
||||
local distToRay = function(angleRay)
|
||||
local rad = math.rad(angleRay)
|
||||
local rx, ry = math.cos(rad), math.sin(rad)
|
||||
local t = dx * rx + dy * ry
|
||||
if t <= 0 then
|
||||
return math.sqrt(dx * dx + dy * dy)
|
||||
end
|
||||
if t >= radius then
|
||||
local ex = cx + radius * rx
|
||||
local ey = cy + radius * ry
|
||||
return math.sqrt((px - ex) ^ 2 + (py - ey) ^ 2)
|
||||
end
|
||||
local nx = cx + t * rx
|
||||
local ny = cy + t * ry
|
||||
return math.sqrt((px - nx) ^ 2 + (py - ny) ^ 2)
|
||||
end
|
||||
local dRay1 = distToRay(lo)
|
||||
local dRay2 = distToRay(hi)
|
||||
return math.min(dArc, dRay1, dRay2)
|
||||
end
|
||||
function GoldenSpyPatrolItem:_CircleSectorIntersect(circleCx, circleCy, circleR, sectorCx, sectorCy, sectorForward, sectorHalfAngle, sectorRadius)
|
||||
local dist = self:_PointToSectorDist(circleCx, circleCy, sectorCx, sectorCy, sectorForward, sectorHalfAngle, sectorRadius)
|
||||
return circleR >= dist
|
||||
end
|
||||
function GoldenSpyPatrolItem:_CheckVision()
|
||||
local tr = self.gameObject:GetComponent("RectTransform")
|
||||
local vp = self._mapNode.VisionPoint.anchoredPosition + tr.anchoredPosition + self._mapNode.trDrone.anchoredPosition
|
||||
if vp == nil then
|
||||
return
|
||||
end
|
||||
local vx, vy = vp.x, vp.y
|
||||
local forwardAngle = self:GetForwardAngle()
|
||||
local halfAngle = self.nVisionAngle
|
||||
local radius = self.nVisionRadius
|
||||
local hitArea = {
|
||||
position = self.floorCtrl:GetHookEndPos(),
|
||||
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()
|
||||
WwiseAudioMgr:PostEvent("Mode_steal_error")
|
||||
self.floorCtrl:SubTime(self.itemCfg.Params[2])
|
||||
self._mapNode.img_normal:SetActive(false)
|
||||
self._mapNode.img_warning:SetActive(true)
|
||||
self:AddTimer(1, 0.5, function()
|
||||
self._mapNode.img_normal:SetActive(true)
|
||||
self._mapNode.img_warning:SetActive(false)
|
||||
end, true, true, true)
|
||||
self.bTrigger = false
|
||||
else
|
||||
end
|
||||
end
|
||||
function GoldenSpyPatrolItem:_StartVisionCheck()
|
||||
self:_StopVisionCheck()
|
||||
self._visionUpdateTimer = self:AddTimer(0, 0, "OnVisionUpdate", true, true, true)
|
||||
end
|
||||
function GoldenSpyPatrolItem:OnVisionUpdate()
|
||||
self:_CheckVision()
|
||||
end
|
||||
function GoldenSpyPatrolItem:_StopVisionCheck()
|
||||
if self._visionUpdateTimer ~= nil then
|
||||
self._visionUpdateTimer:Cancel()
|
||||
self._visionUpdateTimer = nil
|
||||
end
|
||||
end
|
||||
function GoldenSpyPatrolItem:OnEvent_GoldenSpyHookStartExtend()
|
||||
self.bTrigger = true
|
||||
end
|
||||
function GoldenSpyPatrolItem:OnEvent_GM_GoldenSpy_Show()
|
||||
local img = self._mapNode.HitArea:GetComponent("Image")
|
||||
if img then
|
||||
img.enabled = true
|
||||
end
|
||||
end
|
||||
return GoldenSpyPatrolItem
|
||||
@@ -0,0 +1,76 @@
|
||||
local GoldenSpyPauseCtrl = class("GoldenSpyPauseCtrl", BaseCtrl)
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
GoldenSpyPauseCtrl._mapNodeConfig = {
|
||||
blur = {},
|
||||
txt_title = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TowerDef_Text_Pause"
|
||||
},
|
||||
txt_exit = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TowerDef_Button_Leave"
|
||||
},
|
||||
txt_restart = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TowerDef_Button_Re"
|
||||
},
|
||||
txt_continue = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TowerDef_Button_Back"
|
||||
},
|
||||
txt_dic = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Tutorial_DicTitle"
|
||||
},
|
||||
btn_exit = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Exit",
|
||||
sAction = "Giveup"
|
||||
},
|
||||
btn_restart = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Restart",
|
||||
sAction = "Retry"
|
||||
},
|
||||
btn_continue = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Continue",
|
||||
sAction = "Back"
|
||||
},
|
||||
btn_dic = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_OpenDic",
|
||||
sAction = "Depot"
|
||||
}
|
||||
}
|
||||
GoldenSpyPauseCtrl._mapEventConfig = {}
|
||||
GoldenSpyPauseCtrl._mapRedDotConfig = {}
|
||||
function GoldenSpyPauseCtrl:Awake()
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
end
|
||||
function GoldenSpyPauseCtrl:Open(needShowDic)
|
||||
self.gameObject:SetActive(true)
|
||||
self._mapNode.btn_dic.gameObject:SetActive(needShowDic)
|
||||
GamepadUIManager.EnableGamepadUI("GoldenSpyPauseCtrl", self.tbGamepadUINode)
|
||||
end
|
||||
function GoldenSpyPauseCtrl:Close()
|
||||
GamepadUIManager.DisableGamepadUI("GoldenSpyPauseCtrl")
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
function GoldenSpyPauseCtrl:OnBtnClick_Exit()
|
||||
EventManager.Hit("GoldenSpy_Exit_OnClick")
|
||||
end
|
||||
function GoldenSpyPauseCtrl:OnBtnClick_Restart()
|
||||
EventManager.Hit("GoldenSpy_Restart_OnClick")
|
||||
end
|
||||
function GoldenSpyPauseCtrl:OnBtnClick_Continue()
|
||||
EventManager.Hit("GoldenSpy_Continue_OnClick")
|
||||
end
|
||||
function GoldenSpyPauseCtrl:OnBtnClick_OpenDic()
|
||||
EventManager.Hit("GoldenSpy_OpenDic_OnClick")
|
||||
end
|
||||
return GoldenSpyPauseCtrl
|
||||
@@ -0,0 +1,155 @@
|
||||
local GoldenSpyResultCtrl = class("GoldenSpyResultCtrl", BaseCtrl)
|
||||
GoldenSpyResultCtrl._mapNodeConfig = {
|
||||
txt_title = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
txt_titleShadow = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
btn_finish1 = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Finish"
|
||||
},
|
||||
txt_finish1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GoldenSpy_Result_Finish"
|
||||
},
|
||||
btn_finish2 = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Finish"
|
||||
},
|
||||
txt_finish2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GoldenSpy_LevelFinish"
|
||||
},
|
||||
GoNextRoot = {},
|
||||
txtTipShadow = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GoldenSpy_Result_Tip"
|
||||
},
|
||||
txtTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GoldenSpy_Result_Tip"
|
||||
},
|
||||
btn_goNext = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GoNext"
|
||||
},
|
||||
txt_goNext = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GoldenSpy_Result_GoNext"
|
||||
},
|
||||
txt_ttTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GoldenSpy_Result_TotalTargetTitle"
|
||||
},
|
||||
txt_ttValue = {sComponentName = "TMP_Text"},
|
||||
img_finish = {},
|
||||
FinishRoot = {}
|
||||
}
|
||||
GoldenSpyResultCtrl._mapEventConfig = {}
|
||||
GoldenSpyResultCtrl._mapRedDotConfig = {}
|
||||
function GoldenSpyResultCtrl:Awake()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.bResult = tbParam[1]
|
||||
self.nLevelId = tbParam[2]
|
||||
self.nCurFloorId = tbParam[3]
|
||||
self.nFloor = tbParam[4]
|
||||
self.nTotalFloor = tbParam[5]
|
||||
self.nCurScore = tbParam[6]
|
||||
self.finishCallback = tbParam[7]
|
||||
self.goNextCallback = tbParam[8]
|
||||
self.bSuccess = tbParam[9]
|
||||
end
|
||||
self.levelCfg = ConfigTable.GetData("GoldenSpyLevel", self.nLevelId)
|
||||
self.floorCfg = ConfigTable.GetData("GoldenSpyFloor", self.nCurFloorId)
|
||||
self._mapNode.GoNextRoot:SetActive(not self.bResult)
|
||||
self._mapNode.FinishRoot:SetActive(self.bResult)
|
||||
self:SetContent()
|
||||
if self.bSuccess then
|
||||
for i, v in ipairs(self._mapNode.txt_title) do
|
||||
NovaAPI.SetTMPText(v, ConfigTable.GetUIText("GoldenSpy_Result_Title"))
|
||||
end
|
||||
for i, v in ipairs(self._mapNode.txt_titleShadow) do
|
||||
NovaAPI.SetTMPText(v, ConfigTable.GetUIText("GoldenSpy_Result_Title"))
|
||||
end
|
||||
else
|
||||
for i, v in ipairs(self._mapNode.txt_title) do
|
||||
NovaAPI.SetTMPText(v, ConfigTable.GetUIText("GoldenSpy_Result_Failure"))
|
||||
end
|
||||
for i, v in ipairs(self._mapNode.txt_titleShadow) do
|
||||
NovaAPI.SetTMPText(v, ConfigTable.GetUIText("GoldenSpy_Result_Failure"))
|
||||
end
|
||||
end
|
||||
end
|
||||
function GoldenSpyResultCtrl:OnEnable()
|
||||
end
|
||||
function GoldenSpyResultCtrl:OnDisable()
|
||||
end
|
||||
function GoldenSpyResultCtrl:OnDestroy()
|
||||
end
|
||||
function GoldenSpyResultCtrl:SetContent()
|
||||
self:SetGoNextTarget()
|
||||
self:SetFinishTarget()
|
||||
end
|
||||
function GoldenSpyResultCtrl:SetGoNextTarget()
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_ttValue, tostring(self.levelCfg.Score))
|
||||
self._mapNode.img_finish:SetActive(self.nCurScore >= self.levelCfg.Score)
|
||||
local goNext = self._mapNode.GoNextRoot
|
||||
local target1 = goNext.transform:Find("AnimRoot/target1")
|
||||
local txt_target1 = target1.transform:Find("txt_target"):GetComponent("TMP_Text")
|
||||
local txt_value1 = target1.transform:Find("txt_value"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txt_target1, ConfigTable.GetUIText("GoldenSpy_Result_GoNextTarget1"))
|
||||
NovaAPI.SetTMPText(txt_value1, orderedFormat(ConfigTable.GetUIText("GoldenSpy_Result_TargetValue2"), self.floorCfg.GoalScore))
|
||||
local target2 = goNext.transform:Find("AnimRoot/target2")
|
||||
local txt_target2 = target2.transform:Find("txt_target"):GetComponent("TMP_Text")
|
||||
local txt_value2 = target2.transform:Find("txt_value"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txt_target2, ConfigTable.GetUIText("GoldenSpy_Result_GoNextTarget2"))
|
||||
NovaAPI.SetTMPText(txt_value2, orderedFormat(ConfigTable.GetUIText("GoldenSpy_Result_TargetValue2"), self.nCurScore))
|
||||
end
|
||||
function GoldenSpyResultCtrl:SetFinishTarget()
|
||||
local finish = self._mapNode.FinishRoot
|
||||
local target1 = finish.transform:Find("AnimRoot/target1")
|
||||
local txt_target1 = target1.transform:Find("txt_target"):GetComponent("TMP_Text")
|
||||
local txt_value1 = target1.transform:Find("txt_value"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txt_target1, ConfigTable.GetUIText("GoldenSpy_Result_FinishTarget1"))
|
||||
NovaAPI.SetTMPText(txt_value1, orderedFormat(ConfigTable.GetUIText("GoldenSpy_Result_TargetValue1"), self.nTotalFloor))
|
||||
local target2 = finish.transform:Find("AnimRoot/target2")
|
||||
local txt_target2 = target2.transform:Find("txt_target"):GetComponent("TMP_Text")
|
||||
local txt_value2 = target2.transform:Find("txt_value"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txt_target2, ConfigTable.GetUIText("GoldenSpy_Result_FinishTarget2"))
|
||||
NovaAPI.SetTMPText(txt_value2, orderedFormat(ConfigTable.GetUIText("GoldenSpy_Result_TargetValue1"), self.nFloor))
|
||||
local target3 = finish.transform:Find("AnimRoot/target3")
|
||||
local txt_target3 = target3.transform:Find("txt_target"):GetComponent("TMP_Text")
|
||||
local txt_value3 = target3.transform:Find("txt_value"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txt_target3, ConfigTable.GetUIText("GoldenSpy_Result_FinishTarget3"))
|
||||
NovaAPI.SetTMPText(txt_value3, orderedFormat(ConfigTable.GetUIText("GoldenSpy_Result_TargetValue2"), self.levelCfg.Score))
|
||||
local target4 = finish.transform:Find("AnimRoot/target4")
|
||||
local txt_target4 = target4.transform:Find("txt_target"):GetComponent("TMP_Text")
|
||||
local txt_value4 = target4.transform:Find("txt_value"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txt_target4, ConfigTable.GetUIText("GoldenSpy_Result_FinishTarget4"))
|
||||
NovaAPI.SetTMPText(txt_value4, orderedFormat(ConfigTable.GetUIText("GoldenSpy_Result_TargetValue2"), self.nCurScore))
|
||||
end
|
||||
function GoldenSpyResultCtrl:OnBtnClick_Finish()
|
||||
if self.bResult then
|
||||
local callback = function()
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.GoldenSpyResultPanel)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
if self.finishCallback ~= nil then
|
||||
self.finishCallback(callback)
|
||||
end
|
||||
else
|
||||
self.bResult = true
|
||||
self._mapNode.GoNextRoot:SetActive(not self.bResult)
|
||||
self._mapNode.FinishRoot:SetActive(self.bResult)
|
||||
end
|
||||
end
|
||||
function GoldenSpyResultCtrl:OnBtnClick_GoNext()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.GoldenSpyResultPanel)
|
||||
if self.goNextCallback ~= nil then
|
||||
self.goNextCallback()
|
||||
end
|
||||
end
|
||||
return GoldenSpyResultCtrl
|
||||
@@ -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 = "_400008/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
|
||||
@@ -0,0 +1,61 @@
|
||||
local GoldenSpyBaseItem = require("Game.UI.Activity.GoldenSpy.GoldenSpyBaseItem")
|
||||
local GoldenSpySafeBoxItem = class("GoldenSpySafeBoxItem", GoldenSpyBaseItem)
|
||||
GoldenSpySafeBoxItem._mapNodeConfig = {
|
||||
HitArea = {
|
||||
sNodeName = "HitArea",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
flash = {}
|
||||
}
|
||||
GoldenSpySafeBoxItem._mapEventConfig = {
|
||||
GM_GoldenSpy_Show = "OnEvent_GM_GoldenSpy_Show"
|
||||
}
|
||||
GoldenSpySafeBoxItem._mapRedDotConfig = {}
|
||||
function GoldenSpySafeBoxItem:InitData()
|
||||
local nWeightMin = self.itemCfg.Params[1]
|
||||
local nWeightMax = self.itemCfg.Params[2]
|
||||
local nScoreMin = self.itemCfg.Params[3]
|
||||
local nScoreMax = self.itemCfg.Params[4]
|
||||
self.nWeight = math.random(nWeightMin, nWeightMax)
|
||||
self.nScore = math.random(nScoreMin, nScoreMax)
|
||||
end
|
||||
function GoldenSpySafeBoxItem:GetWeight()
|
||||
return self.nWeight
|
||||
end
|
||||
function GoldenSpySafeBoxItem:GetScore()
|
||||
return self.nScore
|
||||
end
|
||||
function GoldenSpySafeBoxItem:GetHitArea()
|
||||
local tr = self.gameObject:GetComponent("RectTransform")
|
||||
local hitArea = {
|
||||
nType = self.nHitAreaType,
|
||||
center = self._mapNode.HitArea.anchoredPosition + tr.anchoredPosition,
|
||||
width = self._mapNode.HitArea.sizeDelta.x,
|
||||
height = self._mapNode.HitArea.sizeDelta.y
|
||||
}
|
||||
return hitArea
|
||||
end
|
||||
function GoldenSpySafeBoxItem:OnSkill_InVision()
|
||||
self.floorCtrl:RemoveItem(self)
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
function GoldenSpySafeBoxItem:OnSkill_Boom(callback)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
if self.gameObject ~= nil then
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function GoldenSpySafeBoxItem:OnSkill_Frozen(callback)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function GoldenSpySafeBoxItem:OnEvent_GM_GoldenSpy_Show()
|
||||
local img = self._mapNode.HitArea:GetComponent("Image")
|
||||
if img then
|
||||
img.enabled = true
|
||||
end
|
||||
end
|
||||
return GoldenSpySafeBoxItem
|
||||
@@ -0,0 +1,116 @@
|
||||
local GoldenSpyToolBoxCtrl = class("GoldenSpyToolBoxCtrl", BaseCtrl)
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
local BuffSpritePath = "UI_Activity/_400008/SpriteAtlas/Buff/"
|
||||
local ItemSpritePath = "UI_Activity/_400008/SpriteAtlas/Item/"
|
||||
GoldenSpyToolBoxCtrl._mapNodeConfig = {
|
||||
txt_toolBox = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GoldenSpy_ToolBox_Title"
|
||||
},
|
||||
sv_item = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
sv_buff = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
btn_close = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
safeAreaRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
txt_None = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GoldenSpyBoxEmpty"
|
||||
}
|
||||
}
|
||||
GoldenSpyToolBoxCtrl._mapEventConfig = {}
|
||||
GoldenSpyToolBoxCtrl._mapRedDotConfig = {}
|
||||
function GoldenSpyToolBoxCtrl:Awake()
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
self.mapBuffCellCtrl = {}
|
||||
end
|
||||
function GoldenSpyToolBoxCtrl:OnEnable()
|
||||
end
|
||||
function GoldenSpyToolBoxCtrl:OnDisable()
|
||||
end
|
||||
function GoldenSpyToolBoxCtrl:OnDestroy()
|
||||
end
|
||||
function GoldenSpyToolBoxCtrl:Show(tbItem, tbBuff, callback)
|
||||
self.gameObject:SetActive(true)
|
||||
self._mapNode.safeAreaRoot:SetActive(false)
|
||||
self:RefreshBuffList(tbBuff)
|
||||
self:RefreshItemList(tbItem)
|
||||
self.callback = callback
|
||||
GamepadUIManager.EnableGamepadUI("GoldenSpyToolBoxCtrl", self.tbGamepadUINode)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 1)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.safeAreaRoot:SetActive(true)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function GoldenSpyToolBoxCtrl:RefreshBuffList(tbBuff)
|
||||
self.tbBuff = tbBuff
|
||||
if self.tbBuff == nil or #self.tbBuff == 0 then
|
||||
self._mapNode.sv_buff.gameObject:SetActive(false)
|
||||
self._mapNode.txt_None.gameObject:SetActive(true)
|
||||
return
|
||||
end
|
||||
self._mapNode.txt_None.gameObject:SetActive(false)
|
||||
self._mapNode.sv_buff.gameObject:SetActive(true)
|
||||
self._mapNode.sv_buff:Init(#self.tbBuff, self, self.OnRefreshBuffGrid)
|
||||
end
|
||||
function GoldenSpyToolBoxCtrl:OnRefreshBuffGrid(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local nInstanceId = goGrid:GetInstanceID()
|
||||
local objCtrl = self.mapBuffCellCtrl[nInstanceId]
|
||||
if objCtrl == nil then
|
||||
objCtrl = self:BindCtrlByNode(goGrid, "Game.UI.Activity.GoldenSpy.GoldenSpyBuffCellCtrl")
|
||||
self.mapBuffCellCtrl[nInstanceId] = objCtrl
|
||||
end
|
||||
objCtrl:SetData(self.tbBuff[nIndex])
|
||||
end
|
||||
function GoldenSpyToolBoxCtrl:RefreshItemList(tbItem)
|
||||
self.tbShowItem = tbItem
|
||||
if self.tbShowItem == nil or #self.tbShowItem == 0 then
|
||||
self._mapNode.sv_item.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
self._mapNode.sv_item:Init(#self.tbShowItem, self, self.OnRefreshItemGrid)
|
||||
self._mapNode.sv_item.gameObject:SetActive(true)
|
||||
end
|
||||
function GoldenSpyToolBoxCtrl:OnRefreshItemGrid(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local itemId = self.tbShowItem[nIndex].itemId
|
||||
local itemScore = self.tbShowItem[nIndex].score
|
||||
itemScore = math.floor(itemScore)
|
||||
local itemCfg = ConfigTable.GetData("GoldenSpyItem", itemId)
|
||||
if itemCfg == nil then
|
||||
return
|
||||
end
|
||||
local img_icon = goGrid.transform:Find("db/icon"):GetComponent("Image")
|
||||
local txt_score = goGrid.transform:Find("db/txt_score"):GetComponent("TMP_Text")
|
||||
self:SetPngSprite(img_icon, ItemSpritePath .. itemCfg.IconPath .. "_s")
|
||||
NovaAPI.SetTMPText(txt_score, itemScore)
|
||||
end
|
||||
function GoldenSpyToolBoxCtrl:OnBtnClick_Close()
|
||||
self._mapNode.safeAreaRoot:SetActive(false)
|
||||
self.gameObject:SetActive(false)
|
||||
for k, v in pairs(self.mapBuffCellCtrl) do
|
||||
self:UnbindCtrlByNode(v)
|
||||
self.mapBuffCellCtrl[k] = nil
|
||||
end
|
||||
self.mapBuffCellCtrl = {}
|
||||
if self.callback ~= nil then
|
||||
self.callback()
|
||||
end
|
||||
GamepadUIManager.DisableGamepadUI("GoldenSpyToolBoxCtrl")
|
||||
end
|
||||
function GoldenSpyToolBoxCtrl:OnEvent_AAA()
|
||||
end
|
||||
return GoldenSpyToolBoxCtrl
|
||||
@@ -0,0 +1,162 @@
|
||||
local LoginRewardPopUpCtrl_01 = class("LoginRewardPopUpCtrl_01", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalSettingData = require("GameCore.Data.LocalSettingData")
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
LoginRewardPopUpCtrl_01._mapNodeConfig = {
|
||||
imgActivity = {sComponentName = "Image"},
|
||||
goActTime = {},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"},
|
||||
btnActivity = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Activity"
|
||||
},
|
||||
txtTips = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "LoginReward_PopUp_Tip"
|
||||
},
|
||||
goRewardItem = {
|
||||
nCount = 7,
|
||||
sCtrlName = "Game.UI.Activity.LoginReward.LoginSpRewardItemCtrl"
|
||||
},
|
||||
imgActor = {nCount = 2, sComponentName = "Image"},
|
||||
trActor2D_PNG = {
|
||||
sNodeName = "----Actor2D_PNG----",
|
||||
sComponentName = "Transform"
|
||||
}
|
||||
}
|
||||
LoginRewardPopUpCtrl_01._mapEventConfig = {}
|
||||
LoginRewardPopUpCtrl_01._mapRedDotConfig = {}
|
||||
function LoginRewardPopUpCtrl_01:RefreshRemainTime()
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
self._mapNode.goActTime.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityTime, sTimeStr)
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:RefreshActData()
|
||||
self.nActId = self._panel.nActId
|
||||
self.actData = self._panel.actData
|
||||
self.remainTimer = nil
|
||||
self:RefreshRewardList()
|
||||
self:RefreshNPC2D()
|
||||
local actCfg = self.actData:GetActCfgData()
|
||||
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
|
||||
self._mapNode.goActTime.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.goActTime.gameObject:SetActive(true)
|
||||
self:RefreshRemainTime()
|
||||
end
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:RefreshRewardList()
|
||||
local tbRewardList = self.actData:GetActLoginRewardList()
|
||||
if nil ~= tbRewardList then
|
||||
local nReceiveDay = self.actData:GetCanReceive()
|
||||
self.nActual = self.actData:GetReceived()
|
||||
for k, v in ipairs(self._mapNode.goRewardItem) do
|
||||
local mapReward = tbRewardList[k]
|
||||
v.gameObject:SetActive(mapReward ~= nil)
|
||||
if mapReward ~= nil then
|
||||
v:SetRewardItem(k, mapReward, true, nReceiveDay == self.nActual and k == self.nActual + 1, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:RefreshNPC2D()
|
||||
local tbRewardList = self.actData:GetActLoginRewardList()
|
||||
local nReceive = self.actData:GetCanReceive()
|
||||
local nNpcId = tbRewardList[nReceive].NpcId
|
||||
local sPath = "LoginNpc_" .. nNpcId
|
||||
self._mapNode.imgActor[1].gameObject:SetActive(true)
|
||||
self:SetActivityAtlasSprite(self._mapNode.imgActor[1], "_" .. self.nActId, sPath)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgActor[1])
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:PlayOutAnim()
|
||||
local nAnimLength = 0
|
||||
if self.animRoot ~= nil then
|
||||
nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"LoginReward_01_out"
|
||||
})
|
||||
self.animRoot:Play("LoginReward_01_out")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
|
||||
end
|
||||
return nAnimLength
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:Awake()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:OnEnable()
|
||||
if self.animRoot ~= nil then
|
||||
local nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"LoginReward_01_in"
|
||||
})
|
||||
self.animRoot:Play("LoginReward_01_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
|
||||
end
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:OnDisable()
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:OnDestroy()
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:OnBtnClick_Activity()
|
||||
local bOpen = self.actData:CheckActivityOpen()
|
||||
if not bOpen then
|
||||
local callback = function()
|
||||
EventManager.Hit("RefreshLoginRewardPanel")
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_PopUp_Time_Out"),
|
||||
callbackConfirm = callback
|
||||
})
|
||||
return
|
||||
end
|
||||
local canReceive = self.actData:CheckCanReceive()
|
||||
if not canReceive then
|
||||
EventManager.Hit("RefreshLoginRewardPanel")
|
||||
return
|
||||
end
|
||||
local tbRewardList = self.actData:GetActLoginRewardList()
|
||||
local nReceive = self.actData:GetCanReceive()
|
||||
local mapNpc = {
|
||||
nNpcId = tbRewardList[nReceive].NpcId,
|
||||
nVoiceId = tbRewardList[nReceive].VoiceId
|
||||
}
|
||||
local callback = function()
|
||||
EventManager.Hit("RefreshLoginRewardPanel")
|
||||
end
|
||||
PlayerData.Activity:SendReceiveLoginRewardMsg(self.nActId, callback, mapNpc)
|
||||
end
|
||||
return LoginRewardPopUpCtrl_01
|
||||
@@ -0,0 +1,28 @@
|
||||
local LoginSpRewardCtrl_01 = class("LoginSpRewardCtrl_01", BaseCtrl)
|
||||
LoginSpRewardCtrl_01._mapNodeConfig = {
|
||||
goCommon = {
|
||||
sNodeName = "---Common---"
|
||||
}
|
||||
}
|
||||
LoginSpRewardCtrl_01._mapEventConfig = {}
|
||||
function LoginSpRewardCtrl_01:UnbindCtrl()
|
||||
if self.activityCtrl ~= nil then
|
||||
self:UnbindCtrlByNode(self.activityCtrl)
|
||||
self.activityCtrl = nil
|
||||
end
|
||||
end
|
||||
function LoginSpRewardCtrl_01:InitActData(actData)
|
||||
if self.activityCtrl == nil then
|
||||
self.activityCtrl = self:BindCtrlByNode(self._mapNode.goCommon, "Game.UI.Activity.LoginReward.LoginSpRewardCtrl_List")
|
||||
end
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self.activityCtrl:InitActData(actData)
|
||||
end
|
||||
function LoginSpRewardCtrl_01:ClearActivity()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function LoginSpRewardCtrl_01:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
return LoginSpRewardCtrl_01
|
||||
@@ -0,0 +1,28 @@
|
||||
local LoginRewardCtrl_01 = class("LoginRewardCtrl_01", BaseCtrl)
|
||||
LoginRewardCtrl_01._mapNodeConfig = {
|
||||
goCommon = {
|
||||
sNodeName = "---Common---"
|
||||
}
|
||||
}
|
||||
LoginRewardCtrl_01._mapEventConfig = {}
|
||||
function LoginRewardCtrl_01:UnbindCtrl()
|
||||
if self.activityCtrl ~= nil then
|
||||
self:UnbindCtrlByNode(self.activityCtrl)
|
||||
self.activityCtrl = nil
|
||||
end
|
||||
end
|
||||
function LoginRewardCtrl_01:InitActData(actData)
|
||||
if self.activityCtrl == nil then
|
||||
self.activityCtrl = self:BindCtrlByNode(self._mapNode.goCommon, "Game.UI.Activity.LoginReward.LoginRewardCtrl_List")
|
||||
end
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self.activityCtrl:InitActData(actData)
|
||||
end
|
||||
function LoginRewardCtrl_01:ClearActivity()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function LoginRewardCtrl_01:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
return LoginRewardCtrl_01
|
||||
@@ -0,0 +1,143 @@
|
||||
local LoginRewardPopUpCtrl_01 = class("LoginRewardPopUpCtrl_01", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
LoginRewardPopUpCtrl_01._mapNodeConfig = {
|
||||
imgActivity = {sComponentName = "Image"},
|
||||
goActTime = {},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"},
|
||||
btnActivity = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Activity"
|
||||
},
|
||||
txtTips = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "LoginReward_PopUp_Tip"
|
||||
},
|
||||
goRewardItem = {
|
||||
nCount = 7,
|
||||
sCtrlName = "Game.UI.Activity.LoginReward.LoginRewardItemCtrl_01"
|
||||
},
|
||||
imgActor = {nCount = 2, sComponentName = "Image"}
|
||||
}
|
||||
LoginRewardPopUpCtrl_01._mapEventConfig = {}
|
||||
LoginRewardPopUpCtrl_01._mapRedDotConfig = {}
|
||||
function LoginRewardPopUpCtrl_01:RefreshRemainTime()
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
self._mapNode.goActTime.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityTime, sTimeStr)
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:RefreshActData()
|
||||
self.nActId = self._panel.nActId
|
||||
self.actData = self._panel.actData
|
||||
self.remainTimer = nil
|
||||
self:RefreshRewardList()
|
||||
local actCfg = self.actData:GetActCfgData()
|
||||
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
|
||||
self._mapNode.goActTime.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.goActTime.gameObject:SetActive(true)
|
||||
self:RefreshRemainTime()
|
||||
end
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:RefreshRewardList()
|
||||
local tbRewardList = self.actData:GetActLoginRewardList()
|
||||
if nil ~= tbRewardList then
|
||||
for k, v in ipairs(self._mapNode.goRewardItem) do
|
||||
local mapReward = tbRewardList[k]
|
||||
v.gameObject:SetActive(mapReward ~= nil)
|
||||
if mapReward ~= nil then
|
||||
v:SetRewardItem(k, mapReward)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:PlayOutAnim()
|
||||
local nAnimLength = 0
|
||||
if self.animRoot ~= nil then
|
||||
nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"LoginReward_01_out"
|
||||
})
|
||||
self.animRoot:Play("LoginReward_01_out")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
|
||||
end
|
||||
return nAnimLength
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:Awake()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:OnEnable()
|
||||
if self.animRoot ~= nil then
|
||||
local nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"LoginReward_01_in"
|
||||
})
|
||||
self.animRoot:Play("LoginReward_01_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
|
||||
end
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:OnDisable()
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:OnDestroy()
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:OnBtnClick_Activity()
|
||||
local bOpen = self.actData:CheckActivityOpen()
|
||||
if not bOpen then
|
||||
local callback = function()
|
||||
EventManager.Hit("RefreshLoginRewardPanel")
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_PopUp_Time_Out"),
|
||||
callbackConfirm = callback
|
||||
})
|
||||
return
|
||||
end
|
||||
local canReceive = self.actData:CheckCanReceive()
|
||||
if not canReceive then
|
||||
EventManager.Hit("RefreshLoginRewardPanel")
|
||||
return
|
||||
end
|
||||
local tbRewardList = self.actData:GetActLoginRewardList()
|
||||
local nReceive = self.actData:GetCanReceive()
|
||||
local mapNpc = {
|
||||
nNpcId = tbRewardList[nReceive].NpcId,
|
||||
nVoiceId = tbRewardList[nReceive].VoiceId
|
||||
}
|
||||
local callback = function()
|
||||
EventManager.Hit("RefreshLoginRewardPanel")
|
||||
end
|
||||
PlayerData.Activity:SendReceiveLoginRewardMsg(self.nActId, callback)
|
||||
end
|
||||
return LoginRewardPopUpCtrl_01
|
||||
@@ -0,0 +1,173 @@
|
||||
local LoginRewardCtrl_List = class("LoginRewardCtrl_List", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
LoginRewardCtrl_List._mapNodeConfig = {
|
||||
btnDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txtDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Detail"
|
||||
},
|
||||
goActTime = {},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"},
|
||||
goRewardItem = {
|
||||
nCount = 7,
|
||||
sCtrlName = "Game.UI.Activity.LoginReward.LoginRewardItemCtrl_01"
|
||||
},
|
||||
btnRewardItem = {
|
||||
nCount = 7,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Item"
|
||||
},
|
||||
btnActivity = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Activity"
|
||||
}
|
||||
}
|
||||
LoginRewardCtrl_List._mapEventConfig = {
|
||||
ClickLoginRewardTips = "OnEvent_ClickLoginRewardTips"
|
||||
}
|
||||
function LoginRewardCtrl_List:RefreshRemainTime()
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
|
||||
callbackConfirm = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
|
||||
end
|
||||
})
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityTime, sTimeStr)
|
||||
end
|
||||
function LoginRewardCtrl_List:RefreshRewardList()
|
||||
local tbRewardList = self.actData:GetActLoginRewardList()
|
||||
if nil ~= tbRewardList then
|
||||
local nReceiveDay = self.actData:GetCanReceive()
|
||||
self.nActual = self.actData:GetReceived()
|
||||
local canReceive = self.actData:CheckCanReceive()
|
||||
if canReceive then
|
||||
self.nSelectIndex = self.actData:GetCanReceive()
|
||||
else
|
||||
self.nSelectIndex = self.nActual
|
||||
end
|
||||
for k, v in ipairs(self._mapNode.goRewardItem) do
|
||||
local mapReward = tbRewardList[k]
|
||||
v.gameObject:SetActive(mapReward ~= nil)
|
||||
if mapReward ~= nil then
|
||||
v:SetRewardItem(k, mapReward, true, nReceiveDay == self.nActual and k == self.nActual + 1, true)
|
||||
v:SetSelect(self.nSelectIndex == k)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function LoginRewardCtrl_List:RefreshDetail()
|
||||
local mapActCfg = self.actData:GetLoginRewardControlCfg()
|
||||
local bEmpty = mapActCfg.DesText == ""
|
||||
self._mapNode.btnDetail.gameObject:SetActive(not bEmpty)
|
||||
end
|
||||
function LoginRewardCtrl_List:InitActData(actData)
|
||||
self.actData = actData
|
||||
self.nNpcId = nil
|
||||
self.bPlayVoice = false
|
||||
self:RefreshRewardList()
|
||||
self:RefreshDetail()
|
||||
local canReceive = self.actData:CheckCanReceive()
|
||||
self._mapNode.btnActivity.gameObject:SetActive(canReceive)
|
||||
local actCfg = self.actData:GetActCfgData()
|
||||
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
|
||||
self._mapNode.goActTime.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.goActTime.gameObject:SetActive(true)
|
||||
self:RefreshRemainTime()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function LoginRewardCtrl_List:Awake()
|
||||
end
|
||||
function LoginRewardCtrl_List:OnEnable()
|
||||
end
|
||||
function LoginRewardCtrl_List:OnDisable()
|
||||
end
|
||||
function LoginRewardCtrl_List:OnDestroy()
|
||||
end
|
||||
function LoginRewardCtrl_List:OnBtnClick_Detail()
|
||||
local mapActCfg = self.actData:GetLoginRewardControlCfg()
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = mapActCfg.DesText,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function LoginRewardCtrl_List: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
|
||||
local tbRewardList = self.actData:GetActLoginRewardList()
|
||||
local nReceive = self.actData:GetCanReceive()
|
||||
local mapNpc = {
|
||||
nNpcId = tbRewardList[nReceive].NpcId,
|
||||
nVoiceId = tbRewardList[nReceive].VoiceId
|
||||
}
|
||||
PlayerData.Activity:SendReceiveLoginRewardMsg(self.actData:GetActId(), callback, mapNpc)
|
||||
end
|
||||
function LoginRewardCtrl_List:OnEvent_ClickLoginRewardTips(callback, index)
|
||||
callback()
|
||||
end
|
||||
function LoginRewardCtrl_List:OnBtnClick_Item(btn, nIndex)
|
||||
if nIndex > self.nActual then
|
||||
return
|
||||
end
|
||||
if self.nSelectIndex then
|
||||
self._mapNode.goRewardItem[self.nSelectIndex]:SetSelect(false)
|
||||
end
|
||||
self._mapNode.goRewardItem[nIndex]:SetSelect(true)
|
||||
self.nSelectIndex = nIndex
|
||||
end
|
||||
return LoginRewardCtrl_List
|
||||
@@ -0,0 +1,108 @@
|
||||
local LoginRewardItemCtrl_01 = class("LoginRewardItemCtrl_01", BaseCtrl)
|
||||
LoginRewardItemCtrl_01._mapNodeConfig = {
|
||||
imgCanReceiveBg = {},
|
||||
imgBg = {},
|
||||
imgPlusBg = {},
|
||||
imgDay = {nCount = 2, sComponentName = "Image"},
|
||||
item = {
|
||||
nCount = 2,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
btnItem = {nCount = 2, sComponentName = "UIButton"},
|
||||
txtItemName = {sComponentName = "TMP_Text"},
|
||||
goReceived = {},
|
||||
Select = {},
|
||||
imgCanReceive = {},
|
||||
txtCanReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "LoginReward_Can_Receive"
|
||||
},
|
||||
imgNextReceive = {},
|
||||
txtNextReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "LoginReward_Next_Receive"
|
||||
},
|
||||
goParticle = {sNodeName = "UIParticle"}
|
||||
}
|
||||
LoginRewardItemCtrl_01._mapEventConfig = {}
|
||||
LoginRewardItemCtrl_01._mapRedDotConfig = {}
|
||||
function LoginRewardItemCtrl_01:SetRewardItem(nDay, mapReward, bEnableSelect, bNextDay, bClickTips)
|
||||
self.nDay = nDay
|
||||
self._mapNode.imgCanReceiveBg.gameObject:SetActive(mapReward.Status == 1)
|
||||
self._mapNode.imgBg.gameObject:SetActive(not mapReward.DisRare)
|
||||
self._mapNode.imgPlusBg.gameObject:SetActive(mapReward.DisRare)
|
||||
for _, v in ipairs(self._mapNode.imgDay) do
|
||||
self:SetAtlasSprite(v, "05_number", "zs_activity_02_num_" .. nDay)
|
||||
end
|
||||
self._mapNode.btnItem[1].gameObject:SetActive(mapReward.RewardId1 > 0)
|
||||
if mapReward.RewardId1 > 0 then
|
||||
self._mapNode.item[1]:SetItem(mapReward.RewardId1, nil, mapReward.Qty1, nil, mapReward.Status == 2)
|
||||
end
|
||||
self._mapNode.btnItem[2].gameObject:SetActive(0 < mapReward.RewardId2)
|
||||
if 0 < mapReward.RewardId2 then
|
||||
self._mapNode.item[2]:SetItem(mapReward.RewardId2, nil, mapReward.Qty2, nil, mapReward.Status == 2)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemName, mapReward.RewardDesc)
|
||||
self._mapNode.imgCanReceive.gameObject:SetActive(mapReward.Status == 1)
|
||||
self._mapNode.goReceived.gameObject:SetActive(mapReward.Status == 2)
|
||||
self._mapNode.imgNextReceive.gameObject:SetActive(bNextDay)
|
||||
self._mapNode.goParticle.gameObject:SetActive(mapReward.DisRare and mapReward.Status ~= 2)
|
||||
self:SetItemFxSate(mapReward.DisRare and mapReward.Status ~= 2)
|
||||
self:SetImgPlaySate(mapReward.Status == 2 and bEnableSelect)
|
||||
self:SetSelect(false)
|
||||
self.tbRewardList = {}
|
||||
for i = 1, 3 do
|
||||
local nTid = mapReward["RewardId" .. i]
|
||||
local nCount = mapReward["Qty" .. i]
|
||||
if nTid ~= 0 then
|
||||
table.insert(self.tbRewardList, {nTid = nTid, nCount = nCount})
|
||||
end
|
||||
end
|
||||
if bClickTips then
|
||||
if self.handler then
|
||||
self:UnBindHandler()
|
||||
end
|
||||
self:BindHandler()
|
||||
end
|
||||
end
|
||||
function LoginRewardItemCtrl_01:SetSelect(bEnable)
|
||||
self._mapNode.Select.gameObject:SetActive(bEnable)
|
||||
end
|
||||
function LoginRewardItemCtrl_01:BindHandler()
|
||||
self.handler = {}
|
||||
for i = 1, 2 do
|
||||
local comp = self._mapNode.btnItem[i]
|
||||
self.handler[i] = ui_handler(self, self.OnBtnClick_Item, comp, i)
|
||||
comp.onClick:AddListener(self.handler[i])
|
||||
end
|
||||
end
|
||||
function LoginRewardItemCtrl_01:UnBindHandler()
|
||||
for i = 1, 2 do
|
||||
local comp = self._mapNode.btnItem[i]
|
||||
comp.onClick:RemoveListener(self.handler[i])
|
||||
end
|
||||
self.handler = nil
|
||||
end
|
||||
function LoginRewardItemCtrl_01:OnBtnClick_Item(btn, index)
|
||||
local callback = function()
|
||||
UTILS.ClickItemGridWithTips(self.tbRewardList[index].nTid, btn.transform, true, true, false)
|
||||
end
|
||||
EventManager.Hit("ClickLoginRewardTips", callback, self.nDay)
|
||||
end
|
||||
function LoginRewardItemCtrl_01:SetItemFxSate(bShowFx)
|
||||
local FX = self.gameObject.transform:Find("FX")
|
||||
if FX then
|
||||
FX.gameObject:SetActive(bShowFx)
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
function LoginRewardItemCtrl_01:SetImgPlaySate(bShowImgPlay)
|
||||
local ImgPlay = self.gameObject.transform:Find("imgPlay")
|
||||
if ImgPlay then
|
||||
ImgPlay.gameObject:SetActive(bShowImgPlay)
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
return LoginRewardItemCtrl_01
|
||||
@@ -56,7 +56,8 @@ LoginSpRewardCtrl_List._mapNodeConfig = {
|
||||
LoginSpRewardCtrl_List._mapEventConfig = {
|
||||
ClickLoginRewardTips = "OnEvent_ClickLoginRewardTips",
|
||||
[EventId.ShowBubbleVoiceText] = "OnEvent_ShowBubbleVoiceText",
|
||||
ActivityListChangeTab = "OnEvent_ActivityListChangeTab"
|
||||
ActivityListChangeTab = "OnEvent_ActivityListChangeTab",
|
||||
[EventId.ClosePanel] = "OnEvent_ClosePanel"
|
||||
}
|
||||
function LoginSpRewardCtrl_List:RefreshRemainTime()
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
@@ -284,4 +285,10 @@ function LoginSpRewardCtrl_List:OnEvent_ActivityListChangeTab(nId)
|
||||
PlayerVoiceData:StopCharVoice()
|
||||
end
|
||||
end
|
||||
function LoginSpRewardCtrl_List:OnEvent_ClosePanel(nPanelId)
|
||||
if nPanelId == PanelId.DiscSample then
|
||||
self.bPlayVoice = false
|
||||
self:PlayVoice()
|
||||
end
|
||||
end
|
||||
return LoginSpRewardCtrl_List
|
||||
|
||||
@@ -48,6 +48,7 @@ function LoginSpRewardItemCtrl:SetRewardItem(nDay, mapReward, bEnableSelect, bNe
|
||||
self._mapNode.goReceived.gameObject:SetActive(mapReward.Status == 2)
|
||||
self._mapNode.imgNextReceive.gameObject:SetActive(bNextDay)
|
||||
self._mapNode.goParticle.gameObject:SetActive(mapReward.DisRare and mapReward.Status ~= 2)
|
||||
self:SetItemFxSate(mapReward.DisRare and mapReward.Status ~= 2)
|
||||
self._mapNode.imgPlay.gameObject:SetActive(mapReward.Status == 2 and bEnableSelect)
|
||||
self:SetSelect(false)
|
||||
self.tbRewardList = {}
|
||||
@@ -89,4 +90,12 @@ function LoginSpRewardItemCtrl:OnBtnClick_Item(btn, index)
|
||||
end
|
||||
EventManager.Hit("ClickLoginRewardTips", callback, self.nDay)
|
||||
end
|
||||
function LoginSpRewardItemCtrl:SetItemFxSate(bShowFx)
|
||||
local FX = self.gameObject.transform:Find("FX")
|
||||
if FX then
|
||||
FX.gameObject:SetActive(bShowFx)
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
return LoginSpRewardItemCtrl
|
||||
|
||||
@@ -8,7 +8,7 @@ ActivityMiningCtrl._mapNodeConfig = {
|
||||
callback = "OnBtnClick_Go"
|
||||
}
|
||||
}
|
||||
function ActivityMiningCtrl:OnDestory(...)
|
||||
function ActivityMiningCtrl:OnDestroy(...)
|
||||
self:UnInit()
|
||||
end
|
||||
function ActivityMiningCtrl:InitActData(actData)
|
||||
|
||||
@@ -47,13 +47,7 @@ function ThrowGiftItemSelectCtrl:OnDestroy()
|
||||
end
|
||||
function ThrowGiftItemSelectCtrl:OnRelease()
|
||||
end
|
||||
function ThrowGiftItemSelectCtrl:OpenPanel(tbItem, callback, curIdx)
|
||||
GamepadUIManager.EnableGamepadUI("ThrowGiftItemSelectCtrl", self.tbGamepadUINode)
|
||||
self.curPosIdx = curIdx
|
||||
self.gameObject:SetActive(true)
|
||||
self.callback = callback
|
||||
self.bSelected = false
|
||||
self.curIdx = 0
|
||||
function ThrowGiftItemSelectCtrl:Refresh(tbItem)
|
||||
self._mapNode.btnItemSelectCtrl[1]:Refresh(tbItem[1])
|
||||
self._mapNode.btnItemSelectCtrl[2]:Refresh(tbItem[2])
|
||||
self._mapNode.btnItemSelectCtrl[1]:SetSelect(false)
|
||||
@@ -67,6 +61,18 @@ function ThrowGiftItemSelectCtrl:OpenPanel(tbItem, callback, curIdx)
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_intensify")
|
||||
self:ResetSelect(self._mapNode.btnItemSelect)
|
||||
end
|
||||
function ThrowGiftItemSelectCtrl:OpenPanel(tbItem, callback, curIdx)
|
||||
GamepadUIManager.EnableGamepadUI("ThrowGiftItemSelectCtrl", self.tbGamepadUINode)
|
||||
self.curPosIdx = curIdx
|
||||
self.gameObject:SetActive(true)
|
||||
self.callback = callback
|
||||
self.bSelected = false
|
||||
self.curIdx = 0
|
||||
self.tbItems = tbItem
|
||||
self.nCurItemsIdx = 1
|
||||
self.tbResultIdx = {}
|
||||
self:Refresh(self.tbItems[self.nCurItemsIdx])
|
||||
end
|
||||
function ThrowGiftItemSelectCtrl:ResetSelect(tbUI)
|
||||
self.curIdx = 0
|
||||
GamepadUIManager.SetNavigation(tbUI)
|
||||
@@ -109,34 +115,48 @@ function ThrowGiftItemSelectCtrl:OnEvent_ThrowGiftItemSelectConfirmClick()
|
||||
end
|
||||
self.bSelected = true
|
||||
self._mapNode.btnItemSelectCtrl[self.curIdx]:PlaySelectAnim()
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_intensify_ok")
|
||||
local endPos = self._mapNode.rtPos[self.curPosIdx].transform.position
|
||||
local beginPos = self._mapNode.btnItemSelectCtrl[self.curIdx].gameObject.transform.position
|
||||
local controlPos = Vector3(3, 5, 0)
|
||||
for i = 1, 2 do
|
||||
self._mapNode.btnItemSelectCtrl[i].gameObject:SetActive(i == self.curIdx)
|
||||
end
|
||||
local wait = function()
|
||||
local totalMoveTime = 0.3
|
||||
local moveTime = 0
|
||||
local normalizedTime = 0
|
||||
while normalizedTime < 1 do
|
||||
moveTime = moveTime + CS.UnityEngine.Time.unscaledDeltaTime
|
||||
normalizedTime = moveTime / totalMoveTime
|
||||
normalizedTime = normalizedTime <= 1 and normalizedTime or 1
|
||||
local x, y, z = UTILS.GetBezierPointByT(beginPos, controlPos, endPos, normalizedTime)
|
||||
local angleZ = -180 * normalizedTime
|
||||
self._mapNode.btnItemSelectCtrl[self.curIdx].gameObject.transform.localEulerAngles = Vector3(0, 0, angleZ)
|
||||
self._mapNode.btnItemSelectCtrl[self.curIdx].gameObject.transform.position = Vector3(x, y, z)
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
table.insert(self.tbResultIdx, self.curIdx)
|
||||
if self.nCurItemsIdx < #self.tbItems then
|
||||
self.nCurItemsIdx = self.nCurItemsIdx + 1
|
||||
self:Refresh(self.tbItems[self.nCurItemsIdx])
|
||||
else
|
||||
WwiseAudioMgr:PostEvent("Mode_Present_intensify_ok")
|
||||
local endPos = self._mapNode.rtPos[self.curPosIdx].transform.position
|
||||
local beginPos = self._mapNode.btnItemSelectCtrl[self.curIdx].gameObject.transform.position
|
||||
local controlPos = Vector3(3, 5, 0)
|
||||
for i = 1, 2 do
|
||||
self._mapNode.btnItemSelectCtrl[i].gameObject:SetActive(i == self.curIdx)
|
||||
end
|
||||
if self.callback ~= nil and type(self.callback) == "function" then
|
||||
self.callback(self.curIdx)
|
||||
local wait = function()
|
||||
local totalMoveTime = 0.3
|
||||
local moveTime = 0
|
||||
local normalizedTime = 0
|
||||
while normalizedTime < 1 do
|
||||
moveTime = moveTime + CS.UnityEngine.Time.unscaledDeltaTime
|
||||
normalizedTime = moveTime / totalMoveTime
|
||||
normalizedTime = normalizedTime <= 1 and normalizedTime or 1
|
||||
local x, y, z = UTILS.GetBezierPointByT(beginPos, controlPos, endPos, normalizedTime)
|
||||
local angleZ = -180 * normalizedTime
|
||||
self._mapNode.btnItemSelectCtrl[self.curIdx].gameObject.transform.localEulerAngles = Vector3(0, 0, angleZ)
|
||||
self._mapNode.btnItemSelectCtrl[self.curIdx].gameObject.transform.position = Vector3(x, y, z)
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
end
|
||||
if self.callback ~= nil and type(self.callback) == "function" then
|
||||
self.callback(self.tbResultIdx)
|
||||
end
|
||||
self.gameObject:SetActive(false)
|
||||
GamepadUIManager.DisableGamepadUI("ThrowGiftItemSelectCtrl")
|
||||
end
|
||||
if #self.tbResultIdx <= 1 then
|
||||
cs_coroutine.start(wait)
|
||||
else
|
||||
if self.callback ~= nil and type(self.callback) == "function" then
|
||||
self.callback(self.tbResultIdx)
|
||||
end
|
||||
self.gameObject:SetActive(false)
|
||||
GamepadUIManager.DisableGamepadUI("ThrowGiftItemSelectCtrl")
|
||||
end
|
||||
self.gameObject:SetActive(false)
|
||||
GamepadUIManager.DisableGamepadUI("ThrowGiftItemSelectCtrl")
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function ThrowGiftItemSelectCtrl:OnEvent_GamepadUIChange(sName, nBeforeType, nAfterType)
|
||||
if sName ~= "ThrowGiftItemSelectCtrl" then
|
||||
|
||||
@@ -201,7 +201,7 @@ end
|
||||
function ThrowGiftCtrl:SetTarget(nCur)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTarget, string.format(self.mapLevelCfgData.ThrowGiftLevelCondDesc .. " (<color=#08d3d4>%d</color>/%d)", nCur, self.mapLevelCfgData.throwGiftLevelParams))
|
||||
end
|
||||
function ThrowGiftCtrl:OpenItemSelect(tbItem, selectCallback)
|
||||
function ThrowGiftCtrl:OpenItemSelect(tbItems, selectCallback)
|
||||
local pos = 1
|
||||
if self.nCurItem[1] == 0 or self.nCurItem[1] == nil then
|
||||
pos = 1
|
||||
@@ -210,14 +210,23 @@ function ThrowGiftCtrl:OpenItemSelect(tbItem, selectCallback)
|
||||
elseif self.tbItemIdx[1] > self.tbItemIdx[2] then
|
||||
pos = 2
|
||||
end
|
||||
local callback = function(nIdx)
|
||||
local callback = function(tbIdx)
|
||||
if selectCallback ~= nil and type(selectCallback) == "function" then
|
||||
selectCallback(nIdx)
|
||||
selectCallback(tbIdx)
|
||||
end
|
||||
if #tbItems <= 1 then
|
||||
self.nCurItem[pos] = tbItems[1][tbIdx[1]]
|
||||
self.tbItemIdx[pos] = math.max(self.tbItemIdx[1], self.tbItemIdx[2]) + 1
|
||||
self._mapNode.rtItem[pos]:SetItem(tbItems[1][tbIdx[1]])
|
||||
self._mapNode.rtItem[pos]:PlayAnim(3)
|
||||
else
|
||||
self.tbItemIdx[1] = self.tbItemIdx[1] + 1
|
||||
self.tbItemIdx[2] = self.tbItemIdx[2] + 1
|
||||
self._mapNode.rtItem[1]:SetItem(tbItems[1][tbIdx[1]])
|
||||
self._mapNode.rtItem[1]:PlayAnim(3)
|
||||
self._mapNode.rtItem[2]:SetItem(tbItems[2][tbIdx[2]])
|
||||
self._mapNode.rtItem[2]:PlayAnim(3)
|
||||
end
|
||||
self.nCurItem[pos] = tbItem[nIdx]
|
||||
self.tbItemIdx[pos] = math.max(self.tbItemIdx[1], self.tbItemIdx[2]) + 1
|
||||
self._mapNode.rtItem[pos]:SetItem(tbItem[nIdx])
|
||||
self._mapNode.rtItem[pos]:PlayAnim(3)
|
||||
end
|
||||
self._mapNode.rtItemSelect:OpenPanel(tbItem, callback, pos)
|
||||
end
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -133,7 +133,12 @@ function ActivityListCtrl:OnGridBtnClick(goGrid, gridIndex)
|
||||
return
|
||||
end
|
||||
local actData = self.tbActList[nIndex].actData
|
||||
local bOpen = self.tbActList[nIndex].nType == AllEnum.ActivityMainType.Activity and actData:CheckActivityOpen() or actData:CheckActGroupShow()
|
||||
local bOpen = false
|
||||
if actData == nil then
|
||||
printError("活动列表中该活动数据为空")
|
||||
elseif self.tbActList[nIndex].nType == AllEnum.ActivityMainType.Activity and actData:CheckActivityOpen() or self.tbActList[nIndex].nType == AllEnum.ActivityMainType.ActivityGroup and actData:CheckActGroupShow() then
|
||||
bOpen = true
|
||||
end
|
||||
if not bOpen then
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
local ActivitySolodance_20102PopUpCtrl = class("ActivitySolodance_20102PopUpCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivitySolodance_20102PopUpCtrl._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"
|
||||
}
|
||||
}
|
||||
ActivitySolodance_20102PopUpCtrl._mapEventConfig = {}
|
||||
function ActivitySolodance_20102PopUpCtrl: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 ActivitySolodance_20102PopUpCtrl:PlayOpenAnim()
|
||||
if self.anim then
|
||||
self.anim:Play("open", 0, 0)
|
||||
end
|
||||
end
|
||||
function ActivitySolodance_20102PopUpCtrl: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 ActivitySolodance_20102PopUpCtrl: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 ActivitySolodance_20102PopUpCtrl: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 ActivitySolodance_20102PopUpCtrl: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 ActivitySolodance_20102PopUpCtrl: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 ActivitySolodance_20102PopUpCtrl
|
||||
@@ -0,0 +1,132 @@
|
||||
local ActivityLevelsLvCtrl = class("ActivityLevelsLvCtrl", BaseCtrl)
|
||||
local lvIndexTitle = "{0}-{1}"
|
||||
ActivityLevelsLvCtrl._mapNodeConfig = {
|
||||
tog = {sComponentName = "UIButton"},
|
||||
Select = {},
|
||||
unSelect = {},
|
||||
txt_Select = {sComponentName = "TMP_Text"},
|
||||
txt_unSelect = {sComponentName = "TMP_Text"},
|
||||
rt_Targets = {},
|
||||
btnTarget = {sComponentName = "Button", nCount = 3},
|
||||
rtLockInfo = {},
|
||||
bgCondition = {},
|
||||
rtLockPreLv = {},
|
||||
redH = {},
|
||||
AnimSwitch = {sComponentName = "Animator"},
|
||||
imgSlc = {sComponentName = "Canvas"}
|
||||
}
|
||||
function ActivityLevelsLvCtrl:InitData(parent, nType, activityData, data, isOpen, isLevelUnLock, nSortingOrder)
|
||||
NovaAPI.SetCanvasSortingName(self._mapNode.imgSlc, AllEnum.SortingLayerName.UI)
|
||||
NovaAPI.SetCanvasSortingOrder(self._mapNode.imgSlc, nSortingOrder + 1)
|
||||
local txtLockConditionTime = self._mapNode.bgCondition.transform:Find("txtLockCondition"):GetComponent("TMP_Text")
|
||||
if self.timerRun ~= nil then
|
||||
self.timerRun:Pause(true)
|
||||
self.timerRun = nil
|
||||
end
|
||||
self._mapNode.Select:SetActive(false)
|
||||
self.lvLock = false
|
||||
if isOpen and isLevelUnLock then
|
||||
self._mapNode.rt_Targets:SetActive(true)
|
||||
for i = 1, 3 do
|
||||
self._mapNode.btnTarget[i].interactable = i <= data.Star
|
||||
end
|
||||
self._mapNode.rtLockInfo:SetActive(false)
|
||||
self._mapNode.rtLockPreLv:SetActive(false)
|
||||
self._mapNode.bgCondition:SetActive(false)
|
||||
elseif isOpen and not isLevelUnLock then
|
||||
self._mapNode.rt_Targets:SetActive(false)
|
||||
self._mapNode.rtLockInfo:SetActive(false)
|
||||
self._mapNode.rtLockPreLv:SetActive(true)
|
||||
self._mapNode.bgCondition:SetActive(false)
|
||||
elseif not isOpen then
|
||||
self._mapNode.rt_Targets:SetActive(false)
|
||||
self._mapNode.rtLockInfo:SetActive(true)
|
||||
self._mapNode.rtLockPreLv:SetActive(false)
|
||||
self._mapNode.bgCondition:SetActive(true)
|
||||
local day = activityData:GetUnLockDay(nType, data.baseData.Id)
|
||||
if day == 0 then
|
||||
local timerCount = function()
|
||||
local hour, min, sec = parent.activityLevelsData:GetUnLockHour(nType, data.baseData.Id)
|
||||
if 0 < hour then
|
||||
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour_Color_Common"), "08d3d4", hour))
|
||||
elseif 0 < min then
|
||||
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color_Common"), "08d3d4", min))
|
||||
elseif 0 < sec then
|
||||
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color_Common"), "08d3d4", sec))
|
||||
end
|
||||
end
|
||||
timerCount()
|
||||
self.timerRun = self:AddTimer(0, 1, function()
|
||||
timerCount()
|
||||
end, true, true, false)
|
||||
else
|
||||
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Day_Color_Common"), "08d3d4", day))
|
||||
end
|
||||
self.lvLock = true
|
||||
end
|
||||
local strTitle = ""
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
strTitle = orderedFormat(lvIndexTitle, 1, data.baseData.Difficulty)
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
strTitle = orderedFormat(lvIndexTitle, 2, data.baseData.Difficulty)
|
||||
elseif nType == GameEnum.ActivityLevelType.HARD then
|
||||
strTitle = orderedFormat(lvIndexTitle, 3, data.baseData.Difficulty)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_Select, strTitle)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_unSelect, strTitle)
|
||||
self._mapNode.tog.onClick:RemoveAllListeners()
|
||||
local clickCb = function()
|
||||
if self._mapNode.Select.activeSelf == true then
|
||||
return
|
||||
end
|
||||
self:SetDefault(true)
|
||||
parent:SetSelectObj(self)
|
||||
parent:RefreshInstanceInfo(nType, data.baseData.Difficulty, false)
|
||||
parent.activityLevelsData:ChangeRedDot(nType, data.baseData.Id)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
self._mapNode.tog.onClick:AddListener(clickCb)
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(parent.nActId)
|
||||
if bInActGroup then
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Explore_Level, {
|
||||
nActGroupId,
|
||||
data.baseData.Id
|
||||
}, self._mapNode.redH)
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure_Level, {
|
||||
nActGroupId,
|
||||
data.baseData.Id
|
||||
}, self._mapNode.redH)
|
||||
elseif nType == GameEnum.ActivityLevelType.HARD then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Hard_Level, {
|
||||
nActGroupId,
|
||||
data.baseData.Id
|
||||
}, self._mapNode.redH)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsLvCtrl:SetDefault(isOn)
|
||||
if self._mapNode.AnimSwitch.enabled == true then
|
||||
self._mapNode.AnimSwitch.enabled = false
|
||||
end
|
||||
if not isOn then
|
||||
self:ShowArrowAni(false)
|
||||
end
|
||||
self._mapNode.Select:SetActive(isOn)
|
||||
self._mapNode.unSelect:SetActive(not isOn)
|
||||
self._mapNode.txt_Select.gameObject:SetActive(isOn)
|
||||
self._mapNode.txt_unSelect.gameObject:SetActive(not isOn)
|
||||
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,738 @@
|
||||
local ActivityLevelsSelectCtrl = class("ActivityLevelsSelectCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
local mapToggle = {
|
||||
[1] = GameEnum.diffculty.Diffculty_1,
|
||||
[2] = GameEnum.diffculty.Diffculty_2,
|
||||
[3] = GameEnum.diffculty.Diffculty_3,
|
||||
[4] = GameEnum.diffculty.Diffculty_4,
|
||||
[5] = GameEnum.diffculty.Diffculty_5,
|
||||
[6] = GameEnum.diffculty.Diffculty_6,
|
||||
[7] = GameEnum.diffculty.Diffculty_7,
|
||||
[8] = GameEnum.diffculty.Diffculty_8,
|
||||
[9] = GameEnum.diffculty.Diffculty_9,
|
||||
[10] = GameEnum.diffculty.Diffculty_10
|
||||
}
|
||||
local colorSelect = Color(1.0, 0.9882352941176471, 0.9568627450980393, 1)
|
||||
local colorUnSelect = Color(0.4, 0.13333333333333333, 0.15294117647058825, 1)
|
||||
local colorSelectLock = Color(0.9529411764705882, 0.8588235294117647, 0.7215686274509804, 1)
|
||||
local colorUnSelectLock = Color(0.4, 0.13333333333333333, 0.15294117647058825, 1)
|
||||
local timeUnLockColor = "fff7ca"
|
||||
local colorConditionsUnLock = Color(0.5607843137254902, 0.6666666666666666, 0.8745098039215686, 1)
|
||||
local colorConditionsLock = Color(1.0, 0.996078431372549, 0.9450980392156862, 1)
|
||||
local lvIndexTitle = "{0}-{1}"
|
||||
local twelveLvGroupPadding = {
|
||||
51,
|
||||
478,
|
||||
-236,
|
||||
0
|
||||
}
|
||||
local twelveLvGroupPaddingOpen = {
|
||||
51,
|
||||
818,
|
||||
-236,
|
||||
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.10107.ActivityLevels.ActivityLevelsLvCtrl"
|
||||
},
|
||||
imgLine = {nCount = 11},
|
||||
rt_Toggle = {},
|
||||
rt_ToggleTrans = {sNodeName = "rt_Toggle", sComponentName = "Transform"},
|
||||
btnCloseBg = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_CloseBossInfo"
|
||||
},
|
||||
rtBoss = {},
|
||||
rtBossAni = {sNodeName = "rtBoss", sComponentName = "Animator"},
|
||||
txtRecommendLevel = {
|
||||
sNodeName = "txtSuggestLevel",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
txtTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "InfinityTower_Recommend_Lv"
|
||||
},
|
||||
txtBuildTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "InfinityTower_Recommend_Construct"
|
||||
},
|
||||
imgBuild = {sComponentName = "Image"},
|
||||
TMPName = {sComponentName = "TMP_Text"},
|
||||
TMPLevel = {sComponentName = "TMP_Text"},
|
||||
detailDescSc = {sComponentName = "Transform"},
|
||||
detailDesc = {sComponentName = "TMP_Text"},
|
||||
btnEnemyInfo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_EnemyInfo"
|
||||
},
|
||||
tex_EnemyInfo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Instance_EnemyInfo"
|
||||
},
|
||||
txtTitleTarget = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RogueBoss_Pause_Target"
|
||||
},
|
||||
txtReward = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Level_Award"
|
||||
},
|
||||
Task = {sComponentName = "Transform", nCount = 3},
|
||||
rewardRoot = {sComponentName = "Transform"},
|
||||
btn_itemTemp = {},
|
||||
btnListRoot = {},
|
||||
btnRaid = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickBtnRaid"
|
||||
},
|
||||
txtBtnRaid = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Raid_Title_Raid"
|
||||
},
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickBtnGo"
|
||||
},
|
||||
txtBtnGoRaidUnlock = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Maninline_Btn_Go"
|
||||
},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Maninline_Btn_Go"
|
||||
},
|
||||
goCoin = {},
|
||||
txtTicketsCount = {sComponentName = "TMP_Text"},
|
||||
btnRaidUnlock = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickBtnGo"
|
||||
},
|
||||
goCoinRaidUnlock = {},
|
||||
txtTicketsCountRaidUnlock = {sComponentName = "TMP_Text"},
|
||||
grpRaidUnlock = {},
|
||||
TMPRaidUnlockHint = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Raid_Btn_CondStar"
|
||||
},
|
||||
ListConditions = {},
|
||||
ListConditionsObj = {
|
||||
sNodeName = "Conditions_",
|
||||
nCount = 2
|
||||
}
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapEventConfig = {
|
||||
[EventId.UpdateEnergy] = "OnEvent_UpdateEnergy",
|
||||
[EventId.ClosePanel] = "OnEvent_ClosePanel"
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapRedDotConfig = {}
|
||||
function ActivityLevelsSelectCtrl:Awake()
|
||||
self.detailDescContent = self._mapNode.detailDescSc:Find("Viewport/Content").transform
|
||||
self.curRequireEnergy = 0
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Explore
|
||||
self.tabRewardList = {}
|
||||
self.AniRoot = self.gameObject:GetComponent("Animator")
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
|
||||
if bInActGroup then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Explore, {nActGroupId}, self._mapNode.redExplore)
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure, {nActGroupId}, self._mapNode.redAdventure)
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Hard, {nActGroupId}, self._mapNode.redHard)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEnable()
|
||||
self.isOpenLvMsg = false
|
||||
self:ShowBossInfo(false)
|
||||
self.timeTab = {}
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
self.SelectTogPreLvLock = nil
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in")
|
||||
self:Init()
|
||||
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_HardCommon"))
|
||||
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Adventure)
|
||||
self._mapNode.togTypeHardCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.HARD)
|
||||
local objExploreCert = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/iconCert").gameObject
|
||||
local objAdventureCert = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/iconCert").gameObject
|
||||
local objHardCert = self._mapNode.togTypeHard.gameObject.transform:Find("AnimRoot/AnimSwitch/iconCert").gameObject
|
||||
self.firstExploreLevel = self.activityLevelsData.levelTabExploreDifficulty[1]
|
||||
local isOpenExplore = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Explore, self.firstExploreLevel)
|
||||
self._mapNode.lockExplore.gameObject:SetActive(not isOpenExplore)
|
||||
self.firstAdventureLevel = self.activityLevelsData.levelTabAdventureDifficulty[1]
|
||||
local isOpenAdventure = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
|
||||
self._mapNode.lockAdventure.gameObject:SetActive(not isOpenAdventure)
|
||||
local txt_SelectAdventure = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_Select").gameObject
|
||||
local txt_unSelectAdventure = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelect").gameObject
|
||||
txt_SelectAdventure.transform.localScale = isOpenAdventure == true and Vector3.one or Vector3.zero
|
||||
txt_unSelectAdventure.transform.localScale = isOpenAdventure == true and Vector3.one or Vector3.zero
|
||||
self.firstHardLevel = self.activityLevelsData.levelTabHardDifficulty[1]
|
||||
local isOpenHard = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.HARD, self.firstHardLevel)
|
||||
self._mapNode.lockHard.gameObject:SetActive(not isOpenHard)
|
||||
local txt_SelectHard = self._mapNode.togTypeHard.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_Select").gameObject
|
||||
local txt_unSelectHard = self._mapNode.togTypeHard.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelect").gameObject
|
||||
txt_SelectHard.transform.localScale = isOpenHard == true and Vector3.one or Vector3.zero
|
||||
txt_unSelectHard.transform.localScale = isOpenHard == true and Vector3.one or Vector3.zero
|
||||
objExploreCert:SetActive(true)
|
||||
for i, v in pairs(self.activityLevelsData.levelTabExplore) do
|
||||
if v.Star < 3 then
|
||||
objExploreCert:SetActive(false)
|
||||
break
|
||||
end
|
||||
end
|
||||
objAdventureCert:SetActive(true)
|
||||
for i, v in pairs(self.activityLevelsData.levelTabAdventure) do
|
||||
if v.Star < 3 then
|
||||
objAdventureCert:SetActive(false)
|
||||
break
|
||||
end
|
||||
end
|
||||
objHardCert:SetActive(true)
|
||||
for i, v in pairs(self.activityLevelsData.levelTabHard) do
|
||||
if v.Star < 3 then
|
||||
objHardCert:SetActive(false)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClick_BtnLockExplore()
|
||||
self:FirstLevelLockTips(GameEnum.ActivityLevelType.Explore, self.firstExploreLevel)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClick_BtnLockAdventure()
|
||||
self:FirstLevelLockTips(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClick_BtnLockHard()
|
||||
self:FirstLevelLockTips(GameEnum.ActivityLevelType.HARD, self.firstHardLevel)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:FirstLevelLockTips(nType, nLevel)
|
||||
local day = self.activityLevelsData:GetUnLockDay(nType, nLevel)
|
||||
local strTips = ""
|
||||
if day == 0 then
|
||||
local hour, min, sec = self.activityLevelsData:GetUnLockHour(nType, nLevel)
|
||||
if 0 < hour then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour)
|
||||
elseif 0 < min then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min)
|
||||
elseif 0 < sec then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec"), sec)
|
||||
end
|
||||
else
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_DayOpen"), day)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, strTips)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeExplore()
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.Explore then
|
||||
return
|
||||
end
|
||||
self:CloseAllTimer()
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Explore
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeAdventure()
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.Adventure then
|
||||
return
|
||||
end
|
||||
self:CloseAllTimer()
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Adventure
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeHard()
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.HARD then
|
||||
return
|
||||
end
|
||||
self:CloseAllTimer()
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
self.nLevelType = GameEnum.ActivityLevelType.HARD
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:CloseAllTimer()
|
||||
for i, v in pairs(self.timeTab) do
|
||||
v:Pause(true)
|
||||
end
|
||||
self.timeTab = {}
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogType(nType)
|
||||
self._mapNode.togTypeExploreCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.Adventure)
|
||||
self._mapNode.togTypeHardCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.HARD)
|
||||
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Adventure)
|
||||
self._mapNode.togTypeHardCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.HARD)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogList(nType, nDifficulty)
|
||||
self.SelectObj = nil
|
||||
local tabLevelInfo, tabLevelInfoDifficulty
|
||||
self.currentTypeLvCount = 0
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
tabLevelInfo = self.activityLevelsData.levelTabExplore
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabExploreDifficulty
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
tabLevelInfo = self.activityLevelsData.levelTabAdventure
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabAdventureDifficulty
|
||||
else
|
||||
tabLevelInfo = self.activityLevelsData.levelTabHard
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabHardDifficulty
|
||||
end
|
||||
self.currentTypeLvCount = #tabLevelInfoDifficulty
|
||||
self._mapNode.rtToggles.gameObject:SetActive(true)
|
||||
local isTwelveLv = self.currentTypeLvCount == 12
|
||||
local isEightLv = self.currentTypeLvCount == 8
|
||||
if self.isOpenLvMsg == false then
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, twelveLvGroupPadding[1], twelveLvGroupPadding[2], twelveLvGroupPadding[3], twelveLvGroupPadding[4])
|
||||
else
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, twelveLvGroupPaddingOpen[1], twelveLvGroupPaddingOpen[2], twelveLvGroupPaddingOpen[3], twelveLvGroupPaddingOpen[4])
|
||||
end
|
||||
for i = 1, 12 do
|
||||
self._mapNode.togRoot[i].gameObject:SetActive(i <= self.currentTypeLvCount)
|
||||
if i ~= 12 then
|
||||
self._mapNode.imgLine[i].gameObject:SetActive(i < self.currentTypeLvCount)
|
||||
end
|
||||
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)
|
||||
else
|
||||
self._mapNode.rt_ToggleTrans.localPosition = Vector3(-400, self._mapNode.rt_ToggleTrans.localPosition.y, 0)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
else
|
||||
self._mapNode.togRoot[i]:SetDefault(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:SetSelectObj(tmpSelectObj)
|
||||
if self.SelectObj ~= nil then
|
||||
self.SelectObj:SetDefault(false)
|
||||
end
|
||||
self.SelectObj = tmpSelectObj
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_CloseBossInfo()
|
||||
self._mapNode.rtBossAni:Play("rtBoss_out")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self:ShowBossInfo(false)
|
||||
end, true, true, true)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:ShowBossInfo(isShow)
|
||||
self.isOpenLvMsg = isShow
|
||||
self._mapNode.rtBoss:SetActive(isShow)
|
||||
self._mapNode.btnCloseBg.gameObject:SetActive(isShow)
|
||||
if not isShow and self.SelectObj ~= nil then
|
||||
self.SelectObj:SetDefault(false)
|
||||
self.SelectObj = nil
|
||||
end
|
||||
if not isShow then
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, twelveLvGroupPadding[1], twelveLvGroupPadding[2], twelveLvGroupPadding[3], twelveLvGroupPadding[4])
|
||||
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(-4030, moveTime)
|
||||
else
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-450 * (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(-2230, moveTime)
|
||||
else
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-450 * (nHard - 2), moveTime)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
else
|
||||
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 < 2 then
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(0, moveTime)
|
||||
elseif 3 <= nHard then
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-438, 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)
|
||||
for i = 1, #tbReward do
|
||||
if i > #self.tabRewardList then
|
||||
local obj = instantiate(self._mapNode.btn_itemTemp, self._mapNode.rewardRoot)
|
||||
self.tabRewardList[i] = self:BindCtrlByNode(obj, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
do
|
||||
local itemCtrl = self.tabRewardList[i]
|
||||
itemCtrl.gameObject:SetActive(true)
|
||||
if tbReward[i] ~= nil then
|
||||
local bReceived = 0 < self.selectLevelData.Star and tbReward[i][3] == 1
|
||||
local bFirstPass = tbReward[i][3] == 1
|
||||
itemCtrl:SetItem(tbReward[i][1], nil, UTILS.ParseRewardItemCount(tbReward[i]), nil, bReceived, bFirstPass, false, true)
|
||||
local btnItem = itemCtrl.gameObject:GetComponent("UIButton")
|
||||
btnItem.onClick:RemoveAllListeners()
|
||||
local clickCb = function()
|
||||
self:OnBtnClick_RewardItem(tbReward[i][1], btnItem.gameObject)
|
||||
end
|
||||
btnItem.onClick:AddListener(clickCb)
|
||||
end
|
||||
end
|
||||
end
|
||||
if self._mapNode.rtBoss.activeSelf == false then
|
||||
self:ShowBossInfo(true)
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self._mapNode.rtBossAni:Play("rtBoss_in")
|
||||
end, true, true, true)
|
||||
else
|
||||
self._mapNode.rtBossAni:Play("rtBoss_Empty")
|
||||
self:AddTimer(1, 0.1, function()
|
||||
self._mapNode.rtBossAni:Play("rtBoss_in")
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_RewardItem(nTid, btn)
|
||||
local rtBtn = btn.transform
|
||||
UTILS.ClickItemGridWithTips(nTid, rtBtn, false, true, false)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClickBtnGo()
|
||||
local nEnergy = PlayerData.Base:GetCurEnergy().nEnergy
|
||||
if nEnergy < self.curRequireEnergy then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.EnergyBuy)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.EnergyBuy, AllEnum.EnergyPanelType.Main, {}, true, callback)
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("MainlineData_Energy"))
|
||||
return
|
||||
end
|
||||
if self.SelectObj ~= nil then
|
||||
self.SelectObj:ShowArrowAni(true)
|
||||
end
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self.activityLevelsData:ChangeRedDot(self.selectLevelData.baseData.Type, self.selectLevelData.baseData.Id)
|
||||
PlayerData.Activity:SetActivityLevelActId(self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityLevels, self.selectLevelData.baseData.Id, {
|
||||
self.nActId
|
||||
})
|
||||
end, true, true, true)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClickBtnRaid()
|
||||
if self.curStar ~= 3 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Raid_Lock"))
|
||||
return
|
||||
end
|
||||
if self.SelectObj ~= nil then
|
||||
self.SelectObj:ShowArrowAni(true)
|
||||
end
|
||||
self:AddTimer(1, 0.2, function()
|
||||
local nNeedEnergy = self.curRequireEnergy
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 5, self.nActId)
|
||||
end, true, true, true)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEvent_ClosePanel(nPanelId)
|
||||
if type(nPanelId) == "number" and nPanelId == PanelId.Raid and self.SelectObj ~= nil then
|
||||
self.SelectObj:ShowArrowAni(false)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_EnemyInfo()
|
||||
EventManager.Hit("OpenActivityLevelsMonsterInfo", self.PreviewMonsterGroupId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEvent_UpdateEnergy()
|
||||
local nHas = PlayerData.Base:GetCurEnergy()
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCount, nHas.nEnergy < self.curRequireEnergy and Red_Unable or Blue_Normal)
|
||||
end
|
||||
return ActivityLevelsSelectCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local ActivityLevelsSelectPanel = class("ActivityLevelsSelectPanel", BasePanel)
|
||||
ActivityLevelsSelectPanel._sUIResRootPath = "UI_Activity/"
|
||||
ActivityLevelsSelectPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10107/ActivityLevels/ActivityLevelsSelect.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10107.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
|
||||
@@ -301,7 +301,7 @@ function ChristmasThemeCtrl:RefreshButtonState()
|
||||
self:RefreshShopButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
self:RefreshStoryButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Other then
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.TrekkerVersus then
|
||||
self:RefreshOtherButtonState(actData)
|
||||
end
|
||||
end
|
||||
@@ -575,7 +575,7 @@ function ChristmasThemeCtrl:OnBtn_ClickActivityEntrance(btn, nIndex)
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
|
||||
return
|
||||
elseif state == ActivityState.NotOpen then
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.Other then
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.TrekkerVersus then
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
local ActivityLevelsLvCtrl = class("ActivityLevelsLvCtrl", BaseCtrl)
|
||||
local lvIndexTitle = "{0}-{1}"
|
||||
ActivityLevelsLvCtrl._mapNodeConfig = {
|
||||
tog = {sComponentName = "UIButton"},
|
||||
Select = {},
|
||||
DecoRootCanvas = {sNodeName = "DecoRoot", sComponentName = "Canvas"},
|
||||
unSelect = {},
|
||||
txt_Select = {sComponentName = "TMP_Text"},
|
||||
txt_unSelect = {sComponentName = "TMP_Text"},
|
||||
rt_Targets = {},
|
||||
btnTarget = {sComponentName = "Button", nCount = 3},
|
||||
rtLockInfo = {},
|
||||
AnimRootTitle = {},
|
||||
tmpGroupDone = {sComponentName = "TMP_Text"},
|
||||
bgCondition = {},
|
||||
rtLockPreLv = {},
|
||||
goUnOpen = {},
|
||||
redH = {},
|
||||
AnimSwitch = {sComponentName = "Animator"},
|
||||
arrowRoot = {},
|
||||
imgCert = {}
|
||||
}
|
||||
function ActivityLevelsLvCtrl:InitData(parent, nType, activityData, data, isOpen, isPreLevelOpen, isLevelUnLock)
|
||||
NovaAPI.SetCanvasSortingName(self._mapNode.DecoRootCanvas, AllEnum.SortingLayerName.UI)
|
||||
NovaAPI.SetCanvasSortingOrder(self._mapNode.DecoRootCanvas, parent._nSortingOrder + 1)
|
||||
local txtLockConditionTime = self._mapNode.bgCondition.transform:Find("txtLockCondition"):GetComponent("TMP_Text")
|
||||
local txtLockConditionLv = self._mapNode.goUnOpen.transform:Find("txtLockCondition"):GetComponent("TMP_Text")
|
||||
if self.timerRun ~= nil then
|
||||
self.timerRun:Pause(true)
|
||||
self.timerRun = nil
|
||||
end
|
||||
self._mapNode.Select:SetActive(false)
|
||||
self.lvLock = false
|
||||
if isOpen and isLevelUnLock then
|
||||
self._mapNode.rt_Targets:SetActive(true)
|
||||
for i = 1, 3 do
|
||||
self._mapNode.btnTarget[i].interactable = i <= data.Star
|
||||
end
|
||||
self._mapNode.imgCert:SetActive(data.Star == 3)
|
||||
self._mapNode.rtLockInfo:SetActive(false)
|
||||
self._mapNode.rtLockPreLv:SetActive(false)
|
||||
self._mapNode.bgCondition:SetActive(false)
|
||||
self._mapNode.AnimRootTitle:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.tmpGroupDone, data.baseData.Name)
|
||||
self._mapNode.goUnOpen:SetActive(false)
|
||||
elseif isOpen and not isLevelUnLock then
|
||||
self._mapNode.rt_Targets:SetActive(false)
|
||||
self._mapNode.rtLockInfo:SetActive(false)
|
||||
self._mapNode.rtLockPreLv:SetActive(true)
|
||||
self._mapNode.bgCondition:SetActive(false)
|
||||
self._mapNode.goUnOpen:SetActive(false)
|
||||
NovaAPI.SetTMPText(txtLockConditionLv, ConfigTable.GetUIText("ActivityLevels_Lock_LastLV"))
|
||||
self._mapNode.AnimRootTitle:SetActive(false)
|
||||
elseif not isOpen then
|
||||
self._mapNode.rt_Targets:SetActive(false)
|
||||
self._mapNode.rtLockInfo:SetActive(true)
|
||||
self._mapNode.rtLockPreLv:SetActive(false)
|
||||
self._mapNode.bgCondition:SetActive(isPreLevelOpen)
|
||||
self._mapNode.AnimRootTitle:SetActive(false)
|
||||
self._mapNode.goUnOpen:SetActive(false)
|
||||
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"), "e0c27c", hour))
|
||||
elseif 0 < min then
|
||||
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color_Common"), "e0c27c", min))
|
||||
elseif 0 < sec then
|
||||
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color_Common"), "e0c27c", 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"), "e0c27c", day))
|
||||
end
|
||||
self.lvLock = true
|
||||
end
|
||||
local strTitle = ""
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
strTitle = orderedFormat(lvIndexTitle, 1, data.baseData.Difficulty)
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
strTitle = orderedFormat(lvIndexTitle, 2, data.baseData.Difficulty)
|
||||
elseif nType == GameEnum.ActivityLevelType.HARD then
|
||||
strTitle = orderedFormat(lvIndexTitle, 3, data.baseData.Difficulty)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_Select, strTitle)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_unSelect, strTitle)
|
||||
self._mapNode.tog.onClick:RemoveAllListeners()
|
||||
local clickCb = function()
|
||||
if self._mapNode.Select.activeSelf == true then
|
||||
return
|
||||
end
|
||||
self:SetDefault(true)
|
||||
parent:SetSelectObj(self)
|
||||
parent:RefreshInstanceInfo(nType, data.baseData.Difficulty, false)
|
||||
parent.activityLevelsData:ChangeRedDot(nType, data.baseData.Id)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
self._mapNode.tog.onClick:AddListener(clickCb)
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(parent.nActId)
|
||||
if bInActGroup then
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Explore_Level, {
|
||||
nActGroupId,
|
||||
data.baseData.Id
|
||||
}, self._mapNode.redH)
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure_Level, {
|
||||
nActGroupId,
|
||||
data.baseData.Id
|
||||
}, self._mapNode.redH)
|
||||
elseif nType == GameEnum.ActivityLevelType.HARD then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Hard_Level, {
|
||||
nActGroupId,
|
||||
data.baseData.Id
|
||||
}, self._mapNode.redH)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsLvCtrl:SetDefault(isOn)
|
||||
if self._mapNode.AnimSwitch.enabled == true then
|
||||
self._mapNode.AnimSwitch.enabled = false
|
||||
end
|
||||
if not isOn then
|
||||
self:ShowArrowAni(false)
|
||||
end
|
||||
self._mapNode.Select:SetActive(isOn)
|
||||
self._mapNode.unSelect:SetActive(not isOn)
|
||||
self._mapNode.txt_Select.gameObject:SetActive(isOn)
|
||||
self._mapNode.txt_unSelect.gameObject:SetActive(not isOn)
|
||||
end
|
||||
function ActivityLevelsLvCtrl:ShowArrowAni(isShow)
|
||||
self._mapNode.arrowRoot:SetActive(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,894 @@
|
||||
local ActivityLevelsSelectCtrl = class("ActivityLevelsSelectCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
local mapToggle = {
|
||||
[1] = GameEnum.diffculty.Diffculty_1,
|
||||
[2] = GameEnum.diffculty.Diffculty_2,
|
||||
[3] = GameEnum.diffculty.Diffculty_3,
|
||||
[4] = GameEnum.diffculty.Diffculty_4,
|
||||
[5] = GameEnum.diffculty.Diffculty_5,
|
||||
[6] = GameEnum.diffculty.Diffculty_6,
|
||||
[7] = GameEnum.diffculty.Diffculty_7,
|
||||
[8] = GameEnum.diffculty.Diffculty_8,
|
||||
[9] = GameEnum.diffculty.Diffculty_9,
|
||||
[10] = GameEnum.diffculty.Diffculty_10
|
||||
}
|
||||
local colorSelect = Color(1.0, 0.9882352941176471, 0.9568627450980393, 1)
|
||||
local colorUnSelect = Color(0.4, 0.13333333333333333, 0.15294117647058825, 1)
|
||||
local colorSelectLock = Color(0.9529411764705882, 0.8588235294117647, 0.7215686274509804, 1)
|
||||
local colorUnSelectLock = Color(0.4, 0.13333333333333333, 0.15294117647058825, 1)
|
||||
local timeUnLockColor = "fff7ca"
|
||||
local colorConditionsUnLock = Color(0.7411764705882353, 0.6431372549019608, 0.5215686274509804, 0.5019607843137255)
|
||||
local colorConditionsLock = Color(0.7411764705882353, 0.6431372549019608, 0.5215686274509804, 1)
|
||||
local lvIndexTitle = "{0}-{1}"
|
||||
local twelveLvGroupPadding = {
|
||||
238,
|
||||
478,
|
||||
0,
|
||||
0
|
||||
}
|
||||
local twelveLvGroupPaddingOpen = {
|
||||
238,
|
||||
818,
|
||||
0,
|
||||
0
|
||||
}
|
||||
local eightLvGroupPadding = {
|
||||
238,
|
||||
238,
|
||||
0,
|
||||
0
|
||||
}
|
||||
local eightLvGroupPaddingOpen = {
|
||||
238,
|
||||
818,
|
||||
0,
|
||||
0
|
||||
}
|
||||
local fourLvGroupPadding = {
|
||||
277,
|
||||
326,
|
||||
0,
|
||||
0
|
||||
}
|
||||
local fourLvGroupPaddingOpen = {
|
||||
277,
|
||||
910,
|
||||
0,
|
||||
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"
|
||||
},
|
||||
rtToggleDeco = {
|
||||
sNodeName = "rt_ToggleDeco",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
togRoot = {
|
||||
nCount = 12,
|
||||
sCtrlName = "Game.UI.ActivityTheme.20102.ActivityLevels.ActivityLevelsLvCtrl"
|
||||
},
|
||||
rt_Toggle = {},
|
||||
rt_ToggleTrans = {sNodeName = "rt_Toggle", sComponentName = "Transform"},
|
||||
rtToggleEight = {
|
||||
sNodeName = "srToggleEight",
|
||||
sComponentName = "UIScrollRect"
|
||||
},
|
||||
rtTogglesTmpEight = {
|
||||
sNodeName = "rt_ToggleTmpEight",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
rtToggleDecoEight = {
|
||||
sNodeName = "rt_ToggleDecoEight",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
togRootEight = {
|
||||
nCount = 8,
|
||||
sCtrlName = "Game.UI.ActivityTheme.20102.ActivityLevels.ActivityLevelsLvCtrl"
|
||||
},
|
||||
rt_ToggleEight = {},
|
||||
rt_ToggleTransEight = {
|
||||
sNodeName = "rt_ToggleEight",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
rtToggleFour = {
|
||||
sNodeName = "srToggleFour",
|
||||
sComponentName = "UIScrollRect"
|
||||
},
|
||||
rtTogglesTmpFour = {
|
||||
sNodeName = "rt_ToggleTmpFour",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
rtToggleDecoFour = {
|
||||
sNodeName = "rt_ToggleDecoFour",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
togRootFour = {
|
||||
nCount = 4,
|
||||
sCtrlName = "Game.UI.ActivityTheme.20102.ActivityLevels.ActivityLevelsLvCtrl"
|
||||
},
|
||||
rt_ToggleFour = {},
|
||||
rt_ToggleTransFour = {
|
||||
sNodeName = "rt_ToggleFour",
|
||||
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
|
||||
},
|
||||
togTypeCanvas = {sNodeName = "togType", sComponentName = "Canvas"},
|
||||
rtBossCanvas = {sNodeName = "rtBoss", sComponentName = "Canvas"},
|
||||
topBarCanvas = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sComponentName = "Canvas"
|
||||
},
|
||||
goEnemyInfoCanvas = {
|
||||
sNodeName = "goEnemyInfo",
|
||||
sComponentName = "Canvas"
|
||||
}
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapEventConfig = {
|
||||
[EventId.UpdateEnergy] = "OnEvent_UpdateEnergy",
|
||||
[EventId.ClosePanel] = "OnEvent_ClosePanel"
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapRedDotConfig = {}
|
||||
function ActivityLevelsSelectCtrl:Awake()
|
||||
self.detailDescContent = self._mapNode.detailDescSc:Find("Viewport/Content").transform
|
||||
self.curRequireEnergy = 0
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Explore
|
||||
self.tabRewardList = {}
|
||||
self.AniRoot = self.gameObject:GetComponent("Animator")
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
|
||||
if bInActGroup then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Explore, {nActGroupId}, self._mapNode.redExplore)
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure, {nActGroupId}, self._mapNode.redAdventure)
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Hard, {nActGroupId}, self._mapNode.redHard)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEnable()
|
||||
self.isOpenLvMsg = false
|
||||
self:ShowBossInfo(false)
|
||||
self.timeTab = {}
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
self.SelectTogPreLvLock = nil
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in")
|
||||
self:Init()
|
||||
function self.onScrollValueChanged(value)
|
||||
self._mapNode.rtTogglesTmp.localPosition = self._mapNode.rt_ToggleTrans.localPosition
|
||||
self._mapNode.rtToggleDeco.localPosition = self._mapNode.rt_ToggleTrans.localPosition
|
||||
end
|
||||
self._mapNode.rtToggles.onValueChanged:AddListener(self.onScrollValueChanged)
|
||||
function self.onScrollValueChangedEight(value)
|
||||
self._mapNode.rtTogglesTmpEight.localPosition = self._mapNode.rt_ToggleTransEight.localPosition
|
||||
self._mapNode.rtToggleDecoEight.localPosition = self._mapNode.rt_ToggleTransEight.localPosition
|
||||
end
|
||||
self._mapNode.rtToggleEight.onValueChanged:AddListener(self.onScrollValueChangedEight)
|
||||
function self.onScrollValueChangedFour(value)
|
||||
self._mapNode.rtTogglesTmpFour.localPosition = self._mapNode.rt_ToggleTransFour.localPosition
|
||||
self._mapNode.rtToggleDecoFour.localPosition = self._mapNode.rt_ToggleTransFour.localPosition
|
||||
end
|
||||
self._mapNode.rtToggleFour.onValueChanged:AddListener(self.onScrollValueChangedFour)
|
||||
NovaAPI.SetCanvasSortingName(self._mapNode.rtBossCanvas, AllEnum.SortingLayerName.UI)
|
||||
NovaAPI.SetCanvasSortingOrder(self._mapNode.rtBossCanvas, self._nSortingOrder + 2)
|
||||
NovaAPI.SetCanvasSortingName(self._mapNode.togTypeCanvas, AllEnum.SortingLayerName.UI)
|
||||
NovaAPI.SetCanvasSortingOrder(self._mapNode.togTypeCanvas, self._nSortingOrder + 2)
|
||||
NovaAPI.SetCanvasSortingName(self._mapNode.topBarCanvas, AllEnum.SortingLayerName.UI)
|
||||
NovaAPI.SetCanvasSortingOrder(self._mapNode.topBarCanvas, self._nSortingOrder + 3)
|
||||
NovaAPI.SetCanvasSortingName(self._mapNode.goEnemyInfoCanvas, AllEnum.SortingLayerName.UI)
|
||||
NovaAPI.SetCanvasSortingOrder(self._mapNode.goEnemyInfoCanvas, self._nSortingOrder + 4)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnDisable()
|
||||
self.timeTab = {}
|
||||
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
|
||||
if self.onScrollValueChangedEight ~= nil then
|
||||
self._mapNode.rtToggleEight.onValueChanged:RemoveListener(self.onScrollValueChangedEight)
|
||||
self.onScrollValueChangedEight = nil
|
||||
end
|
||||
if self.onScrollValueChangedFour ~= nil then
|
||||
self._mapNode.rtToggleFour.onValueChanged:RemoveListener(self.onScrollValueChangedFour)
|
||||
self.onScrollValueChangedFour = 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_HardCommon"))
|
||||
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Adventure)
|
||||
self._mapNode.togTypeHardCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.HARD)
|
||||
local objExploreCert = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/iconCert").gameObject
|
||||
local objAdventureCert = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/iconCert").gameObject
|
||||
local objHardCert = self._mapNode.togTypeHard.gameObject.transform:Find("AnimRoot/AnimSwitch/iconCert").gameObject
|
||||
self.firstExploreLevel = self.activityLevelsData.levelTabExploreDifficulty[1]
|
||||
local isOpenExplore = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Explore, self.firstExploreLevel)
|
||||
self._mapNode.lockExplore.gameObject:SetActive(not isOpenExplore)
|
||||
self.firstAdventureLevel = self.activityLevelsData.levelTabAdventureDifficulty[1]
|
||||
local isOpenAdventure = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
|
||||
self._mapNode.lockAdventure.gameObject:SetActive(not isOpenAdventure)
|
||||
self.firstHardLevel = self.activityLevelsData.levelTabHardDifficulty[1]
|
||||
local isOpenHard = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.HARD, self.firstHardLevel)
|
||||
self._mapNode.lockHard.gameObject:SetActive(not isOpenHard)
|
||||
objExploreCert:SetActive(true)
|
||||
for i, v in pairs(self.activityLevelsData.levelTabExplore) do
|
||||
if v.Star < 3 then
|
||||
objExploreCert:SetActive(false)
|
||||
break
|
||||
end
|
||||
end
|
||||
objAdventureCert:SetActive(true)
|
||||
for i, v in pairs(self.activityLevelsData.levelTabAdventure) do
|
||||
if v.Star < 3 then
|
||||
objAdventureCert:SetActive(false)
|
||||
break
|
||||
end
|
||||
end
|
||||
objHardCert:SetActive(true)
|
||||
for i, v in pairs(self.activityLevelsData.levelTabHard) do
|
||||
if v.Star < 3 then
|
||||
objHardCert:SetActive(false)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClick_BtnLockExplore()
|
||||
self:FirstLevelLockTips(GameEnum.ActivityLevelType.Explore, self.firstExploreLevel)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClick_BtnLockAdventure()
|
||||
self:FirstLevelLockTips(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClick_BtnLockHard()
|
||||
self:FirstLevelLockTips(GameEnum.ActivityLevelType.HARD, self.firstHardLevel)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:FirstLevelLockTips(nType, nLevel)
|
||||
local day = self.activityLevelsData:GetUnLockDay(nType, nLevel)
|
||||
local strTips = ""
|
||||
if day == 0 then
|
||||
local hour, min, sec = self.activityLevelsData:GetUnLockHour(nType, nLevel)
|
||||
if 0 < hour then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour)
|
||||
elseif 0 < min then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min)
|
||||
elseif 0 < sec then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec"), sec)
|
||||
end
|
||||
else
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_DayOpen"), day)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, strTips)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeExplore()
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.Explore then
|
||||
return
|
||||
end
|
||||
self:CloseAllTimer()
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Explore
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeAdventure()
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.Adventure then
|
||||
return
|
||||
end
|
||||
self:CloseAllTimer()
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Adventure
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeHard()
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.HARD then
|
||||
return
|
||||
end
|
||||
self:CloseAllTimer()
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
self.nLevelType = GameEnum.ActivityLevelType.HARD
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:CloseAllTimer()
|
||||
for i, v in pairs(self.timeTab) do
|
||||
v:Pause(true)
|
||||
end
|
||||
self.timeTab = {}
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogType(nType)
|
||||
self._mapNode.togTypeExploreCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.Adventure)
|
||||
self._mapNode.togTypeHardCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.HARD)
|
||||
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Adventure)
|
||||
self._mapNode.togTypeHardCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.HARD)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogList(nType, nDifficulty)
|
||||
self.SelectObj = nil
|
||||
local tabLevelInfo, tabLevelInfoDifficulty
|
||||
self.currentTypeLvCount = 0
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
tabLevelInfo = self.activityLevelsData.levelTabExplore
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabExploreDifficulty
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
tabLevelInfo = self.activityLevelsData.levelTabAdventure
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabAdventureDifficulty
|
||||
else
|
||||
tabLevelInfo = self.activityLevelsData.levelTabHard
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabHardDifficulty
|
||||
end
|
||||
self.currentTypeLvCount = #tabLevelInfoDifficulty
|
||||
self._mapNode.rtToggles.gameObject:SetActive(self.currentTypeLvCount == 12)
|
||||
self._mapNode.rtToggleEight.gameObject:SetActive(self.currentTypeLvCount == 8)
|
||||
self._mapNode.rtToggleFour.gameObject:SetActive(self.currentTypeLvCount == 4)
|
||||
local isTwelveLv = self.currentTypeLvCount == 12
|
||||
local isEightLv = self.currentTypeLvCount == 8
|
||||
if isTwelveLv then
|
||||
if self.isOpenLvMsg == false then
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, twelveLvGroupPadding[1], twelveLvGroupPadding[2], twelveLvGroupPadding[3], twelveLvGroupPadding[4])
|
||||
else
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, twelveLvGroupPaddingOpen[1], twelveLvGroupPaddingOpen[2], twelveLvGroupPaddingOpen[3], twelveLvGroupPaddingOpen[4])
|
||||
end
|
||||
elseif isEightLv then
|
||||
if self.isOpenLvMsg == false then
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_ToggleEight, eightLvGroupPadding[1], eightLvGroupPadding[2], eightLvGroupPadding[3], eightLvGroupPadding[4])
|
||||
else
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_ToggleEight, eightLvGroupPaddingOpen[1], eightLvGroupPaddingOpen[2], eightLvGroupPaddingOpen[3], eightLvGroupPaddingOpen[4])
|
||||
end
|
||||
elseif self.isOpenLvMsg == false then
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_ToggleFour, fourLvGroupPadding[1], fourLvGroupPadding[2], fourLvGroupPadding[3], fourLvGroupPadding[4])
|
||||
else
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_ToggleFour, fourLvGroupPaddingOpen[1], fourLvGroupPaddingOpen[2], fourLvGroupPaddingOpen[3], fourLvGroupPaddingOpen[4])
|
||||
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 preLevelId = tmpData.baseData.PreLevelId
|
||||
local isPreLevelOpen = true
|
||||
if preLevelId ~= 0 then
|
||||
local tmpDataPre = ConfigTable.GetData("ActivityLevelsLevel", preLevelId)
|
||||
isPreLevelOpen = self.activityLevelsData:GetLevelDayOpen(tmpDataPre.Type, tmpDataPre.Id)
|
||||
end
|
||||
local isLevelUnLock = self.activityLevelsData:GetLevelUnLock(nType, tmpData.baseData.Id)
|
||||
if isTwelveLv then
|
||||
self._mapNode.togRoot[i]:InitData(self, nType, self.activityLevelsData, tmpData, isOpen, isPreLevelOpen, isLevelUnLock)
|
||||
elseif isEightLv then
|
||||
self._mapNode.togRootEight[i]:InitData(self, nType, self.activityLevelsData, tmpData, isOpen, isPreLevelOpen, isLevelUnLock)
|
||||
else
|
||||
self._mapNode.togRootFour[i]:InitData(self, nType, self.activityLevelsData, tmpData, isOpen, isPreLevelOpen, isLevelUnLock)
|
||||
end
|
||||
if nDifficulty == i then
|
||||
if self.isOpenLvMsg then
|
||||
if isTwelveLv then
|
||||
self.SelectObj = self._mapNode.togRoot[i]
|
||||
self._mapNode.togRoot[i]:SetDefault(true)
|
||||
elseif isEightLv then
|
||||
self.SelectObj = self._mapNode.togRootEight[i]
|
||||
self._mapNode.togRootEight[i]:SetDefault(true)
|
||||
else
|
||||
self.SelectObj = self._mapNode.togRootFour[i]
|
||||
self._mapNode.togRootFour[i]:SetDefault(true)
|
||||
end
|
||||
self:RefreshInstanceInfo(nType, nDifficulty, true)
|
||||
elseif isTwelveLv then
|
||||
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)
|
||||
else
|
||||
self._mapNode.rt_ToggleTrans.localPosition = Vector3(-400, self._mapNode.rt_ToggleTrans.localPosition.y, 0)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
elseif isEightLv then
|
||||
self._mapNode.togRootEight[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)
|
||||
else
|
||||
self._mapNode.rt_ToggleTrans.localPosition = Vector3(-400, self._mapNode.rt_ToggleTrans.localPosition.y, 0)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
else
|
||||
self._mapNode.togRootFour[i]:SetDefault(false)
|
||||
local wait = function()
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rt_ToggleTransFour.gameObject:GetComponent("RectTransform"))
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.rt_ToggleTransFour.localPosition = Vector3(0, self._mapNode.rt_ToggleTransFour.localPosition.y, 0)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
elseif isTwelveLv then
|
||||
self._mapNode.togRoot[i]:SetDefault(false)
|
||||
elseif isEightLv then
|
||||
self._mapNode.togRootEight[i]:SetDefault(false)
|
||||
else
|
||||
self._mapNode.togRootFour[i]:SetDefault(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:SetSelectObj(tmpSelectObj)
|
||||
if self.SelectObj ~= nil then
|
||||
self.SelectObj:SetDefault(false)
|
||||
end
|
||||
self.SelectObj = tmpSelectObj
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_CloseBossInfo()
|
||||
self._mapNode.rtBossAni:Play("rtBoss_out")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self:ShowBossInfo(false)
|
||||
end, true, true, true)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:ShowBossInfo(isShow)
|
||||
self.isOpenLvMsg = isShow
|
||||
self._mapNode.rtBoss:SetActive(isShow)
|
||||
self._mapNode.btnCloseBg.gameObject:SetActive(isShow)
|
||||
if not isShow and self.SelectObj ~= nil then
|
||||
self.SelectObj:SetDefault(false)
|
||||
self.SelectObj = nil
|
||||
end
|
||||
if not isShow then
|
||||
if self.currentTypeLvCount == 12 then
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, twelveLvGroupPadding[1], twelveLvGroupPadding[2], twelveLvGroupPadding[3], twelveLvGroupPadding[4])
|
||||
elseif self.currentTypeLvCount == 8 then
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_ToggleEight, eightLvGroupPadding[1], eightLvGroupPadding[2], eightLvGroupPadding[3], eightLvGroupPadding[4])
|
||||
else
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_ToggleFour, fourLvGroupPadding[1], fourLvGroupPadding[2], fourLvGroupPadding[3], fourLvGroupPadding[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(-3135, 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_ToggleEight, eightLvGroupPaddingOpen[1], eightLvGroupPaddingOpen[2], eightLvGroupPaddingOpen[3], eightLvGroupPaddingOpen[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_ToggleTransEight:DOLocalMoveX(0, moveTime)
|
||||
elseif 6 < nHard then
|
||||
self._mapNode.rt_ToggleTransEight:DOLocalMoveX(-1700, moveTime)
|
||||
else
|
||||
self._mapNode.rt_ToggleTransEight:DOLocalMoveX(-400 * (nHard - 2), moveTime)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
else
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_ToggleFour, fourLvGroupPaddingOpen[1], fourLvGroupPaddingOpen[2], fourLvGroupPaddingOpen[3], fourLvGroupPaddingOpen[4])
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
local moveTime = isInit and 0.4 or 0.2
|
||||
if nHard < 2 then
|
||||
self._mapNode.rt_ToggleTransFour:DOLocalMoveX(0, moveTime)
|
||||
elseif 3 <= nHard then
|
||||
self._mapNode.rt_ToggleTransFour:DOLocalMoveX(-775, moveTime)
|
||||
else
|
||||
self._mapNode.rt_ToggleTransFour:DOLocalMoveX(-330 * (nHard - 1), moveTime)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
self.curSelectHard = nHard
|
||||
local levelId = 0
|
||||
self.selectLevelData = nil
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
levelId = self.activityLevelsData.levelTabExploreDifficulty[nHard]
|
||||
self.selectLevelData = self.activityLevelsData.levelTabExplore[levelId]
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
levelId = self.activityLevelsData.levelTabAdventureDifficulty[nHard]
|
||||
self.selectLevelData = self.activityLevelsData.levelTabAdventure[levelId]
|
||||
else
|
||||
levelId = self.activityLevelsData.levelTabHardDifficulty[nHard]
|
||||
self.selectLevelData = self.activityLevelsData.levelTabHard[levelId]
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRecommendLevel, self.selectLevelData.baseData.SuggestedPower)
|
||||
local sRank = "Icon/BuildRank/BuildRank_" .. self.selectLevelData.baseData.RecommendBuildRank
|
||||
self:SetPngSprite(self._mapNode.imgBuild, sRank)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPName, self.selectLevelData.baseData.Name)
|
||||
local strTitle = ""
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
strTitle = orderedFormat(lvIndexTitle, 1, self.selectLevelData.baseData.Difficulty)
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
strTitle = orderedFormat(lvIndexTitle, 2, self.selectLevelData.baseData.Difficulty)
|
||||
elseif nType == GameEnum.ActivityLevelType.HARD then
|
||||
strTitle = orderedFormat(lvIndexTitle, 3, self.selectLevelData.baseData.Difficulty)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPLevel, strTitle)
|
||||
NovaAPI.SetTMPText(self._mapNode.detailDesc, self.selectLevelData.baseData.Desc)
|
||||
self.detailDescContent:DOLocalMoveY(0, 0)
|
||||
self.curStar = self.selectLevelData.Star
|
||||
local tbCond = {
|
||||
self.selectLevelData.baseData.OneStarDesc,
|
||||
self.selectLevelData.baseData.TwoStarDesc,
|
||||
self.selectLevelData.baseData.ThreeStarDesc
|
||||
}
|
||||
for i = 1, 3 do
|
||||
local rtTask = self._mapNode.Task[i]
|
||||
local goDone = rtTask:Find("imgDone").gameObject
|
||||
local imgUnDone = rtTask:Find("imgUnDone").gameObject
|
||||
local Text = rtTask:Find("Text"):GetComponent("TMP_Text")
|
||||
goDone:SetActive(i <= self.curStar)
|
||||
imgUnDone:SetActive(i > self.curStar)
|
||||
local cond = tbCond[i]
|
||||
if cond == nil then
|
||||
rtTask.gameObject:SetActive(false)
|
||||
return
|
||||
else
|
||||
rtTask.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(Text, cond)
|
||||
end
|
||||
end
|
||||
self.PreviewMonsterGroupId = self.selectLevelData.baseData.PreviewMonsterGroupId
|
||||
local isOpen = self.activityLevelsData:GetLevelDayOpen(nType, self.selectLevelData.baseData.Id)
|
||||
local isLevelUnLock = self.activityLevelsData:GetLevelUnLock(nType, self.selectLevelData.baseData.Id)
|
||||
local isNeedEnergyConsume = true
|
||||
if not self.selectLevelData.baseData.EnergyConsumeOnRetry and 0 < self.selectLevelData.Star then
|
||||
isNeedEnergyConsume = false
|
||||
end
|
||||
if isOpen and isLevelUnLock then
|
||||
self._mapNode.btnListRoot:SetActive(true)
|
||||
self._mapNode.ListConditions:SetActive(false)
|
||||
if self.selectLevelData.baseData.ThreeStarSweep then
|
||||
if self.selectLevelData.Star == 3 then
|
||||
self._mapNode.btnRaid.gameObject:SetActive(true)
|
||||
self._mapNode.btnGo.gameObject:SetActive(true)
|
||||
self._mapNode.btnRaidUnlock.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.btnRaid.gameObject:SetActive(false)
|
||||
self._mapNode.btnGo.gameObject:SetActive(false)
|
||||
self._mapNode.btnRaidUnlock.gameObject:SetActive(true)
|
||||
self._mapNode.grpRaidUnlock:SetActive(true)
|
||||
end
|
||||
else
|
||||
self._mapNode.btnRaid.gameObject:SetActive(false)
|
||||
self._mapNode.btnGo.gameObject:SetActive(false)
|
||||
self._mapNode.btnRaidUnlock.gameObject:SetActive(true)
|
||||
self._mapNode.grpRaidUnlock:SetActive(false)
|
||||
end
|
||||
local nHas = PlayerData.Base:GetCurEnergy()
|
||||
local nRequire = self.selectLevelData.baseData.EnergyConsume
|
||||
if not isNeedEnergyConsume then
|
||||
nRequire = 0
|
||||
end
|
||||
self.curRequireEnergy = nRequire
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTicketsCount, nRequire)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCount, nRequire > nHas.nEnergy and Red_Unable or Blue_Normal)
|
||||
self._mapNode.goCoin:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTicketsCountRaidUnlock, nRequire)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCountRaidUnlock, nRequire > nHas.nEnergy and Red_Unable or Blue_Normal)
|
||||
self._mapNode.goCoinRaidUnlock:SetActive(true)
|
||||
elseif isOpen and not isLevelUnLock then
|
||||
self._mapNode.btnListRoot:SetActive(false)
|
||||
self._mapNode.ListConditions:SetActive(true)
|
||||
local preLevelId = self.selectLevelData.baseData.PreLevelId
|
||||
if preLevelId ~= 0 then
|
||||
local lvPreNeedStar = self.selectLevelData.baseData.PreLevelStar
|
||||
local lvPreStar = self.activityLevelsData:GetPreLevelStar(nType, self.selectLevelData.baseData.Id)
|
||||
local imgConditions_Lock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_Lock").gameObject
|
||||
local imgConditions_UnLock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_UnLock").gameObject
|
||||
local txt = self._mapNode.ListConditionsObj[1].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
|
||||
local tmpData = ConfigTable.GetData("ActivityLevelsLevel", preLevelId)
|
||||
imgConditions_Lock_1:SetActive(lvPreNeedStar > lvPreStar)
|
||||
imgConditions_UnLock_1:SetActive(lvPreNeedStar <= lvPreStar)
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_PreLevel"), tmpData.Name))
|
||||
NovaAPI.SetTMPColor(txt, lvPreNeedStar <= lvPreStar and colorConditionsUnLock or colorConditionsLock)
|
||||
else
|
||||
local imgConditions_Lock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_Lock").gameObject
|
||||
local imgConditions_UnLock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_UnLock").gameObject
|
||||
local txt = self._mapNode.ListConditionsObj[1].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
|
||||
imgConditions_Lock_1:SetActive(true)
|
||||
imgConditions_UnLock_1:SetActive(false)
|
||||
NovaAPI.SetTMPText(txt, ConfigTable.GetUIText("Unlocked_By_PreLevel"))
|
||||
NovaAPI.SetTMPColor(txt, colorConditionsUnLock)
|
||||
end
|
||||
local preActivityStory = self.selectLevelData.baseData.PreActivityStory
|
||||
if preActivityStory ~= nil and preActivityStory[1] ~= nil then
|
||||
local isRead = PlayerData.ActivityAvg:IsStoryReaded(preActivityStory[2])
|
||||
local imgConditions_Lock_2 = self._mapNode.ListConditionsObj[2].transform:Find("imgConditions_Lock").gameObject
|
||||
local imgConditions_UnLock_2 = self._mapNode.ListConditionsObj[2].transform:Find("imgConditions_UnLock").gameObject
|
||||
local txt = self._mapNode.ListConditionsObj[2].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
|
||||
imgConditions_Lock_2:SetActive(not isRead)
|
||||
imgConditions_UnLock_2:SetActive(isRead)
|
||||
local cfgdata = ConfigTable.GetData("ActivityStory", preActivityStory[2])
|
||||
if cfgdata ~= nil then
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Avg"), cfgdata.Title))
|
||||
self._mapNode.ListConditionsObj[2]:SetActive(true)
|
||||
NovaAPI.SetTMPColor(txt, isRead and colorConditionsUnLock or colorConditionsLock)
|
||||
else
|
||||
self._mapNode.ListConditionsObj[2]:SetActive(false)
|
||||
end
|
||||
else
|
||||
self._mapNode.ListConditionsObj[2]:SetActive(false)
|
||||
end
|
||||
elseif not isOpen then
|
||||
self._mapNode.btnListRoot:SetActive(false)
|
||||
self._mapNode.ListConditions:SetActive(true)
|
||||
self._mapNode.ListConditionsObj[2]:SetActive(false)
|
||||
local imgConditions_Lock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_Lock").gameObject
|
||||
local imgConditions_UnLock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_UnLock").gameObject
|
||||
imgConditions_Lock_1:SetActive(true)
|
||||
imgConditions_UnLock_1:SetActive(false)
|
||||
NovaAPI.SetTMPColor(txt, colorConditionsUnLock)
|
||||
local txt = self._mapNode.ListConditionsObj[1].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
|
||||
local day = self.activityLevelsData:GetUnLockDay(nType, self.selectLevelData.baseData.Id)
|
||||
if day == 0 then
|
||||
local hour, min, sec = self.activityLevelsData:GetUnLockHour(nType, self.selectLevelData.baseData.Id)
|
||||
if 0 < hour then
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour))
|
||||
elseif 0 < min then
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min))
|
||||
elseif 0 < sec then
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min))
|
||||
end
|
||||
else
|
||||
local _day, _hour = self.activityLevelsData:GetUnLockDayHour(nType, self.selectLevelData.baseData.Id)
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_DayHourOpen"), _day, _hour))
|
||||
end
|
||||
end
|
||||
for i = 1, #self.tabRewardList do
|
||||
self.tabRewardList[i].gameObject:SetActive(false)
|
||||
end
|
||||
local tbReward = decodeJson(self.selectLevelData.baseData.CompleteRewardPreview)
|
||||
for i = 1, #tbReward do
|
||||
if i > #self.tabRewardList then
|
||||
local obj = instantiate(self._mapNode.btn_itemTemp, self._mapNode.rewardRoot)
|
||||
self.tabRewardList[i] = self:BindCtrlByNode(obj, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
do
|
||||
local itemCtrl = self.tabRewardList[i]
|
||||
itemCtrl.gameObject:SetActive(true)
|
||||
if tbReward[i] ~= nil then
|
||||
local bReceived = 0 < self.selectLevelData.Star and tbReward[i][3] == 1
|
||||
local bFirstPass = tbReward[i][3] == 1
|
||||
itemCtrl:SetItem(tbReward[i][1], nil, UTILS.ParseRewardItemCount(tbReward[i]), nil, bReceived, bFirstPass, false, true)
|
||||
local btnItem = itemCtrl.gameObject:GetComponent("UIButton")
|
||||
btnItem.onClick:RemoveAllListeners()
|
||||
local clickCb = function()
|
||||
self:OnBtnClick_RewardItem(tbReward[i][1], btnItem.gameObject)
|
||||
end
|
||||
btnItem.onClick:AddListener(clickCb)
|
||||
end
|
||||
end
|
||||
end
|
||||
if self._mapNode.rtBoss.activeSelf == false then
|
||||
self:ShowBossInfo(true)
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self._mapNode.rtBossAni:Play("rtBoss_in")
|
||||
end, true, true, true)
|
||||
else
|
||||
self._mapNode.rtBossAni:Play("rtBoss_Empty")
|
||||
self:AddTimer(1, 0.1, function()
|
||||
self._mapNode.rtBossAni:Play("rtBoss_in")
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_RewardItem(nTid, btn)
|
||||
local rtBtn = btn.transform
|
||||
UTILS.ClickItemGridWithTips(nTid, rtBtn, false, true, false)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClickBtnGo()
|
||||
local nEnergy = PlayerData.Base:GetCurEnergy().nEnergy
|
||||
if nEnergy < self.curRequireEnergy then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.EnergyBuy)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.EnergyBuy, AllEnum.EnergyPanelType.Main, {}, true, callback)
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("MainlineData_Energy"))
|
||||
return
|
||||
end
|
||||
if self.SelectObj ~= nil then
|
||||
self.SelectObj:ShowArrowAni(true)
|
||||
end
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self.activityLevelsData:ChangeRedDot(self.selectLevelData.baseData.Type, self.selectLevelData.baseData.Id)
|
||||
PlayerData.Activity:SetActivityLevelActId(self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityLevels, self.selectLevelData.baseData.Id, {
|
||||
self.nActId
|
||||
})
|
||||
end, true, true, true)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClickBtnRaid()
|
||||
if self.curStar ~= 3 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Raid_Lock"))
|
||||
return
|
||||
end
|
||||
if self.SelectObj ~= nil then
|
||||
self.SelectObj:ShowArrowAni(true)
|
||||
end
|
||||
self:AddTimer(1, 0.2, function()
|
||||
local nNeedEnergy = self.curRequireEnergy
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 5, self.nActId)
|
||||
end, true, true, true)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEvent_ClosePanel(nPanelId)
|
||||
if type(nPanelId) == "number" and nPanelId == PanelId.Raid and self.SelectObj ~= nil then
|
||||
self.SelectObj:ShowArrowAni(false)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_EnemyInfo()
|
||||
EventManager.Hit("OpenActivityLevelsMonsterInfo", self.PreviewMonsterGroupId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEvent_UpdateEnergy()
|
||||
local nHas = PlayerData.Base:GetCurEnergy()
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCount, nHas.nEnergy < self.curRequireEnergy and Red_Unable or Blue_Normal)
|
||||
end
|
||||
return ActivityLevelsSelectCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local ActivityLevelsSelectPanel = class("ActivityLevelsSelectPanel", BasePanel)
|
||||
ActivityLevelsSelectPanel._sUIResRootPath = "UI_Activity/"
|
||||
ActivityLevelsSelectPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "20102/ActivityLevels/ActivityLevelsSelect.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.20102.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,177 @@
|
||||
local ActivitySolodanceCtrl = class("ActivitySolodanceCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivitySolodanceCtrl._mapNodeConfig = {
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Go"
|
||||
},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
svReward = {
|
||||
sNodeName = "PreviewUpgradeMaterial",
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
txtAdvanceMat = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MessageBox_Reward"
|
||||
},
|
||||
txtDate = {sComponentName = "TMP_Text"},
|
||||
imgLock = {},
|
||||
txtLock = {sComponentName = "TMP_Text"},
|
||||
imgEnd = {},
|
||||
txtActivityEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgRemaineTime = {},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_TowerAllOpen_Go"
|
||||
},
|
||||
txtBtnActDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Detail"
|
||||
},
|
||||
btnActDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
}
|
||||
}
|
||||
function ActivitySolodanceCtrl:Awake()
|
||||
self.tbGridCtrl = {}
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function ActivitySolodanceCtrl:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivitySolodanceCtrl:InitActData(actData, bInit)
|
||||
self.actData = actData
|
||||
self:RefreshLockState()
|
||||
self:RefreshDate()
|
||||
self:RefreshTimeout()
|
||||
self:RefreshReward()
|
||||
if bInit and self.animRoot ~= nil then
|
||||
self.animRoot:Play("Entrance_in_01")
|
||||
end
|
||||
end
|
||||
function ActivitySolodanceCtrl:UnInit()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivitySolodanceCtrl:UnbindCtrl()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivitySolodanceCtrl: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 ActivitySolodanceCtrl: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 ActivitySolodanceCtrl: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 ActivitySolodanceCtrl: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 ActivitySolodanceCtrl: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 ActivitySolodanceCtrl: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 ActivitySolodanceCtrl:OnBtnClick_Go()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
if actGroupCfg ~= nil then
|
||||
if actGroupCfg.TransitionId ~= nil and actGroupCfg.TransitionId > 0 then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.SolodanceThemePanel, actGroupCfg.Id, true)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, actGroupCfg.TransitionId, callback)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.SolodanceThemePanel, actGroupCfg.Id, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivitySolodanceCtrl: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 ActivitySolodanceCtrl:ClearActivity()
|
||||
end
|
||||
return ActivitySolodanceCtrl
|
||||
@@ -0,0 +1,134 @@
|
||||
local ActivityShopGoodsItemCtrl = class("ActivityShopGoodsItemCtrl", BaseCtrl)
|
||||
ActivityShopGoodsItemCtrl._mapNodeConfig = {
|
||||
imgRare = {sComponentName = "Image"},
|
||||
imgLeft = {},
|
||||
txtLeft = {sComponentName = "TMP_Text"},
|
||||
imgTime = {},
|
||||
txtLeftTime = {sComponentName = "TMP_Text"},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgElement = {sComponentName = "Image"},
|
||||
goStar = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
|
||||
},
|
||||
imgExpire = {sComponentName = "Image"},
|
||||
txtCount = {sComponentName = "TMP_Text"},
|
||||
imgCoin = {sComponentName = "Image"},
|
||||
txtPrice = {sComponentName = "TMP_Text"},
|
||||
imgMask = {},
|
||||
goRestock = {},
|
||||
txtRestock = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Mall_Package_SoldOut"
|
||||
},
|
||||
goCondition = {},
|
||||
txtCondition = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
ActivityShopGoodsItemCtrl._mapEventConfig = {}
|
||||
function ActivityShopGoodsItemCtrl:Refresh(mapData, nCurrencyItemId)
|
||||
self.mapData = mapData
|
||||
self.mapGoodsCfg = ConfigTable.GetData("ActivityGoods", mapData.nId)
|
||||
if not self.mapGoodsCfg then
|
||||
return
|
||||
end
|
||||
self:RefreshInfo()
|
||||
self:RefreshPrice(nCurrencyItemId)
|
||||
self:RefreshTime()
|
||||
self:RefreshLimit()
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:RefreshInfo()
|
||||
local mapItemCfg = ConfigTable.GetData_Item(self.mapGoodsCfg.ItemId)
|
||||
if not mapItemCfg then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, self.mapGoodsCfg.Name)
|
||||
if mapItemCfg.Type == GameEnum.itemType.Disc then
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapItemCfg.Icon .. AllEnum.OutfitIconSurfix.Item)
|
||||
self._mapNode.imgElement.gameObject:SetActive(true)
|
||||
self._mapNode.goStar.gameObject:SetActive(true)
|
||||
local mapDiscCfgData = ConfigTable.GetData("Disc", self.mapGoodsCfg.ItemId)
|
||||
if mapDiscCfgData then
|
||||
self:SetAtlasSprite(self._mapNode.imgElement, "12_rare", AllEnum.Star_Element[mapDiscCfgData.EET].icon)
|
||||
end
|
||||
local nStar = 6 - mapItemCfg.Rarity
|
||||
self._mapNode.goStar:SetStar(nStar, nStar)
|
||||
else
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapItemCfg.Icon)
|
||||
self._mapNode.imgElement.gameObject:SetActive(false)
|
||||
self._mapNode.goStar.gameObject:SetActive(false)
|
||||
end
|
||||
self._mapNode.imgExpire.gameObject:SetActive(mapItemCfg.ExpireType > 0)
|
||||
local sPath = "db_shop_" .. AllEnum.FrameColor_New[mapItemCfg.Rarity]
|
||||
self:SetActivityAtlasSprite_New(self._mapNode.imgRare, "20102/SpriteAtlas/_2010204", 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 = "20102/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,703 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local SolodanceThemeCtrl = class("SolodanceThemeCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
SolodanceThemeCtrl._mapNodeConfig = {
|
||||
btnEntrance_ = {
|
||||
nCount = 7,
|
||||
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_20102"
|
||||
},
|
||||
imgMiniGameEnd = {},
|
||||
txtMiniGameEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Mini_Game_20102"
|
||||
},
|
||||
txtMiniGame_End = {},
|
||||
txtTask = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Task"
|
||||
},
|
||||
txtTaskProgress = {sComponentName = "TMP_Text"},
|
||||
imgTaskActivityTime = {},
|
||||
txtTaskActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgStory = {sComponentName = "Image"},
|
||||
txtStory = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_StoryName_20102"
|
||||
},
|
||||
txtStory_End = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_StoryName_20102"
|
||||
},
|
||||
goStoryEnd = {},
|
||||
txtStoryEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtMiniGameEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtTaskEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtShopEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtShop = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Shop"
|
||||
},
|
||||
imgShopActivityTime = {},
|
||||
txtShopActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgLevel = {sComponentName = "Image"},
|
||||
txtLevel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Level"
|
||||
},
|
||||
txtLevel_End = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Level"
|
||||
},
|
||||
goLevelEnd = {},
|
||||
txtLevelEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgLevelActivityUnlockTime = {},
|
||||
txtLevelActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgLevelEnd = {},
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
imgMiniGameActivityUnlockTime = {},
|
||||
txtMiniGameActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgTaskBgEnd = {},
|
||||
txtTaskEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Task"
|
||||
},
|
||||
txtTaskProgress_End = {},
|
||||
imgTaskActivityUnlockTime = {},
|
||||
txtTaskActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgStoryActivityTime = {},
|
||||
txtStoryActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgStoryActivityUnlockTime = {},
|
||||
imgShopActivityUnlockTime = {},
|
||||
txtShopActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgLevelActivityTime = {},
|
||||
txtLevelActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgMiniGameActivityTime = {},
|
||||
txtMiniGameActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtShopEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Shop"
|
||||
},
|
||||
imgShopEnd = {},
|
||||
txtShop_End = {},
|
||||
txtTaskProgressEnd = {sComponentName = "TMP_Text"},
|
||||
dbTaskEnd = {},
|
||||
redDotEntrance2 = {},
|
||||
storyRedDot = {},
|
||||
reddotLevel = {},
|
||||
goMiniGameEnd = {},
|
||||
imgStoryEnd = {},
|
||||
imgShowEnd = {},
|
||||
imgShowActivityTime = {},
|
||||
txtShowActivityTime = {sComponentName = "TMP_Text"},
|
||||
goShowEnd = {},
|
||||
txtShowEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgShowActivityUnlockTime = {},
|
||||
txtShowActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgShowLock = {},
|
||||
txtLock = {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 = {},
|
||||
txtFateCardEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgFateCardActivityUnlockTime = {},
|
||||
txtFateCardActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgFateCardActivityTime = {},
|
||||
txtFateCardActivityTime = {sComponentName = "TMP_Text"},
|
||||
reddotShow = {},
|
||||
dbMiniGameEnd = {},
|
||||
dbShopEnd = {},
|
||||
dbLevelEnd = {},
|
||||
dbFateCardEnd = {},
|
||||
imgLevelTxtEnd = {},
|
||||
goBG = {sNodeName = "---Bg---", sComponentName = "GameObject"},
|
||||
reddotFatecard = {},
|
||||
reddotMiniGame = {}
|
||||
}
|
||||
SolodanceThemeCtrl._mapEventConfig = {}
|
||||
SolodanceThemeCtrl._mapRedDotConfig = {}
|
||||
local ActivityState = {
|
||||
NotOpen = 1,
|
||||
Open = 2,
|
||||
Closed = 3
|
||||
}
|
||||
function SolodanceThemeCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
self.bFromEntrance = param[2]
|
||||
end
|
||||
self.tbLive2D = {}
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
self.SolodanceData = PlayerData.Activity:GetActivityGroupDataById(self.nActId)
|
||||
if self.SolodanceData ~= nil then
|
||||
self.ActivityGroupCfg = self.SolodanceData.actGroupConfig
|
||||
end
|
||||
end
|
||||
function SolodanceThemeCtrl:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
function SolodanceThemeCtrl:OnEnable()
|
||||
if self.animRoot ~= nil then
|
||||
local sAnim = "SolodanceThemePanel_Pullback"
|
||||
local sLive2DPath = "UI_Activity/20102/Live2d_20102_Pullback.prefab"
|
||||
if self.bFromEntrance then
|
||||
sAnim = "SolodanceThemePanel_Full"
|
||||
sLive2DPath = "UI_Activity/20102/Live2d_20102_Full.prefab"
|
||||
end
|
||||
self.animRoot:Play(sAnim, 0, 0)
|
||||
if self.tbLive2D[sLive2DPath] == nil then
|
||||
self.tbLive2D[sLive2DPath] = self:CreatePrefabInstance(sLive2DPath, self._mapNode.goBG.transform)
|
||||
end
|
||||
end
|
||||
self:RefreshPanel()
|
||||
for i = 1, 7 do
|
||||
local actData = self.SolodanceData:GetActivityDataByIndex(i)
|
||||
if i == AllEnum.ActivityThemeFuncIndex.Task then
|
||||
local nActId = actData.ActivityId
|
||||
local state = self.tbActState[nActId]
|
||||
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
|
||||
local nActId = actData.ActivityId
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.reddotLevel)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.TrekkerVersus then
|
||||
local activityData = ConfigTable.GetData("Activity", actData.ActivityId)
|
||||
local nNeedWorldLevel = tonumber(activityData.LimitParam) or 0
|
||||
if nNeedWorldLevel > PlayerData.Base:GetWorldClass() then
|
||||
self._mapNode.reddotShow:SetActive(false)
|
||||
return
|
||||
end
|
||||
local nActId = actData.ActivityId
|
||||
RedDotManager.RegisterNode(RedDotDefine.TrekkerVersus, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.reddotShow)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.FateCard then
|
||||
local nActId = actData.ActivityId
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_PenguinCard_Level, {
|
||||
self.nActId
|
||||
}, self._mapNode.reddotFatecard)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.MiniGame then
|
||||
local nActId = actData.ActivityId
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_GoldenSpy, {
|
||||
self.nActId
|
||||
}, self._mapNode.reddotMiniGame)
|
||||
end
|
||||
end
|
||||
end
|
||||
function SolodanceThemeCtrl:OnDisable()
|
||||
if nil ~= self.minigameRemainTimer then
|
||||
TimerManager.Remove(self.minigameRemainTimer)
|
||||
self.minigameRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.remainTimer then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
end
|
||||
if nil ~= self.shopRemainTimer then
|
||||
TimerManager.Remove(self.shopRemainTimer)
|
||||
self.shopRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.levelRemainTimer then
|
||||
TimerManager.Remove(self.levelRemainTimer)
|
||||
self.levelRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.avgRemainTimer then
|
||||
TimerManager.Remove(self.avgRemainTimer)
|
||||
self.avgRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.taskRemainTimer then
|
||||
TimerManager.Remove(self.taskRemainTimer)
|
||||
self.taskRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.fateCardRemainTimer then
|
||||
TimerManager.Remove(self.fateCardRemainTimer)
|
||||
self.fateCardRemainTimer = nil
|
||||
end
|
||||
for k, v in pairs(self.tbLive2D) do
|
||||
self:DestroyPrefabInstance(k)
|
||||
self.tbLive2D[k] = nil
|
||||
end
|
||||
self.bFromEntrance = false
|
||||
end
|
||||
function SolodanceThemeCtrl:RefreshPanel()
|
||||
if self.SolodanceData == nil or self.ActivityGroupCfg == nil then
|
||||
return
|
||||
end
|
||||
self:RefreshTime()
|
||||
self:RefreshButtonState()
|
||||
end
|
||||
function SolodanceThemeCtrl:RefreshTime()
|
||||
local bOpen = self.SolodanceData:CheckActivityGroupOpen()
|
||||
if bOpen then
|
||||
self:RefreshRemainTime(self.SolodanceData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(self.SolodanceData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
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.SolodanceData: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 SolodanceThemeCtrl:RefreshRemainTime(endTime, txtComp)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(txtComp, sTimeStr)
|
||||
return remainTime
|
||||
end
|
||||
function SolodanceThemeCtrl:RefreshRemainOpenTime(openTime)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
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 SolodanceThemeCtrl:RefreshButtonState()
|
||||
self.tbActState = {}
|
||||
for i = 1, 7 do
|
||||
local actData = self.SolodanceData: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.TrekkerVersus then
|
||||
self:RefreshOtherButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.FateCard then
|
||||
self:RefreshFateCardButtonState(actData)
|
||||
end
|
||||
end
|
||||
end
|
||||
function SolodanceThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans, refreshFunc)
|
||||
local countDowmTimer
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
local state = ActivityState.NotOpen
|
||||
local bShowCountDown = false
|
||||
if activityData ~= nil then
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
if activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
elseif curTime >= openTime and curTime <= endTime then
|
||||
state = ActivityState.Open
|
||||
else
|
||||
state = ActivityState.Closed
|
||||
end
|
||||
elseif activityData.EndType == GameEnum.activityEndType.NoLimit then
|
||||
state = ActivityState.Open
|
||||
if activityData.StartTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
end
|
||||
end
|
||||
end
|
||||
if state == ActivityState.NotOpen then
|
||||
if nil == timer and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local fcTimer = function()
|
||||
curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
if 0 < remainTime then
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
local txtUnlock = imgTrans:GetComponentInChildren(typeof(CS.TMPro.TMP_Text))
|
||||
if txtUnlock ~= nil then
|
||||
NovaAPI.SetTMPText(txtUnlock, sTimeStr)
|
||||
end
|
||||
else
|
||||
imgTrans:SetActive(false)
|
||||
TimerManager.Remove(timer)
|
||||
countDowmTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
refreshFunc(actData)
|
||||
self:RefreshActivityData()
|
||||
end
|
||||
end
|
||||
fcTimer()
|
||||
countDowmTimer = self:AddTimer(0, 1, fcTimer, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Open and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
do
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
if endTime > self.SolodanceData:GetActGroupEndTime() then
|
||||
bShowCountDown = true
|
||||
elseif endTime < self.SolodanceData: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)
|
||||
countDowmTimer = nil
|
||||
refreshFunc(actData)
|
||||
end
|
||||
end
|
||||
fcTimer()
|
||||
countDowmTimer = self:AddTimer(0, 1, fcTimer, true, true, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return state, bShowCountDown, countDowmTimer
|
||||
end
|
||||
function SolodanceThemeCtrl: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.dbMiniGameEnd:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function SolodanceThemeCtrl:RefreshTaskButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local actInsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
if actInsData ~= nil then
|
||||
actInsData:RefreshTaskRedDot()
|
||||
end
|
||||
self:RefreshTaskButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.taskRemainTimer, self._mapNode.txtTaskActivityTime, self._mapNode.imgTaskActivityUnlockTime, refreshFunc)
|
||||
if self.taskRemainTimer == nil then
|
||||
self.taskRemainTimer = countDowmTimer
|
||||
end
|
||||
if state == ActivityState.Closed and actInsData ~= nil then
|
||||
actInsData:RefreshTaskRedDot()
|
||||
end
|
||||
self._mapNode.imgTaskActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.txtTaskProgress_End:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.dbTaskEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskBgEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtTaskEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self.tbActState[activityId] = state
|
||||
local ActivityTaskData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local nDone, nTotal = 0, 0
|
||||
if ActivityTaskData ~= nil then
|
||||
nDone, nTotal = ActivityTaskData:CalcTotalProgress()
|
||||
end
|
||||
local progress = string.format("%d/%d", nDone, nTotal)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskProgress, progress)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskProgressEnd, progress)
|
||||
end
|
||||
end
|
||||
function SolodanceThemeCtrl:RefreshOtherButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local nNeedWorldLevel = tonumber(activityData.LimitParam) or 0
|
||||
local bNeedLv = nNeedWorldLevel <= PlayerData.Base:GetWorldClass()
|
||||
local refreshFunc = function(actData)
|
||||
self:RefreshOtherButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer
|
||||
if bNeedLv then
|
||||
state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.showRemainTimer, self._mapNode.txtShowActivityTime, self._mapNode.imgShowActivityUnlockTime, refreshFunc)
|
||||
if self.showRemainTimer == nil then
|
||||
self.showRemainTimer = countDowmTimer
|
||||
end
|
||||
else
|
||||
state = ActivityState.NotOpen
|
||||
end
|
||||
self._mapNode.imgShowActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgShowActivityUnlockTime:SetActive(state == ActivityState.NotOpen and bNeedLv)
|
||||
self._mapNode.imgShowEnd:SetActive(state == ActivityState.Closed or not bNeedLv)
|
||||
self._mapNode.goShowEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgShowLock:SetActive(state == ActivityState.NotOpen and not bNeedLv)
|
||||
local txtLock = orderedFormat(ConfigTable.GetUIText("ActivityEnter_Lock"), nNeedWorldLevel)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLock, txtLock)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function SolodanceThemeCtrl:RefreshLevelButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
local activityLevelsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if nil ~= activityLevelsData then
|
||||
activityLevelsData:ChangeAllRedHot()
|
||||
end
|
||||
self:RefreshLevelButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.levelRemainTimer, self._mapNode.txtLevelActivityTime, self._mapNode.imgLevelActivityUnlockTime, refreshFunc)
|
||||
if self.levelRemainTimer == nil then
|
||||
self.levelRemainTimer = countDowmTimer
|
||||
end
|
||||
if state == ActivityState.Closed then
|
||||
local activityLevelsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if nil ~= activityLevelsData then
|
||||
activityLevelsData:ChangeAllRedHot()
|
||||
end
|
||||
end
|
||||
self._mapNode.imgLevelActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgLevelActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.imgLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.goLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtLevel_End.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.dbLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgLevelTxtEnd:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function SolodanceThemeCtrl: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.dbShopEnd:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function SolodanceThemeCtrl: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 SolodanceThemeCtrl: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 SolodanceThemeCtrl:RefreshActivityData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
self:AddTimer(1, 3, self.RequireActiviyData, true, true, true)
|
||||
end
|
||||
function SolodanceThemeCtrl:OnBtn_ClickActivityEntrance(btn, nIndex)
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
local chapterId = 7
|
||||
local isUnlock = PlayerData.Avg:IsStoryChapterUnlock(chapterId)
|
||||
if isUnlock then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.SolodanceStory, chapterId)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StoryChapter)
|
||||
end
|
||||
return
|
||||
end
|
||||
local actData = self.SolodanceData:GetActivityDataByIndex(nIndex)
|
||||
local state = self.tbActState[actData.ActivityId]
|
||||
if nil == state then
|
||||
return
|
||||
end
|
||||
if state == ActivityState.Closed then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
|
||||
return
|
||||
elseif state == ActivityState.NotOpen then
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.TrekkerVersus then
|
||||
local activityData = ConfigTable.GetData("Activity", actData.ActivityId)
|
||||
if activityData ~= nil then
|
||||
local nNeedWorldLevel = tonumber(activityData.LimitParam) or 0
|
||||
local bNeedLv = nNeedWorldLevel <= PlayerData.Base:GetWorldClass()
|
||||
if not bNeedLv then
|
||||
local txtLock = orderedFormat(ConfigTable.GetUIText("ActivityEnter_Lock"), nNeedWorldLevel)
|
||||
EventManager.Hit(EventId.OpenMessageBox, txtLock)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
return
|
||||
elseif state == ActivityState.Open then
|
||||
local activityData = PlayerData.Activity:GetActivityDataById(actData.ActivityId)
|
||||
if activityData == nil then
|
||||
local bHint = true
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
bHint = not PlayerData.ActivityAvg:HasActivityData(actData.ActivityId)
|
||||
end
|
||||
if self.bRequiredActData and bHint then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Data_Refreshing"))
|
||||
return
|
||||
end
|
||||
if bHint then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
self:RequireActiviyData()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
if actData.PanelId ~= nil and ActivityState.Open == state then
|
||||
local nTransitionIdx = self.ActivityGroupCfg.TransitionId
|
||||
if nTransitionIdx == nil or nTransitionIdx == 0 and nIndex == AllEnum.ActivityThemeFuncIndex.TrekkerVersus then
|
||||
nTransitionIdx = 30
|
||||
end
|
||||
if nTransitionIdx ~= 0 then
|
||||
EventManager.Hit(EventId.SetTransition, nTransitionIdx, function()
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
|
||||
end)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
|
||||
end
|
||||
end
|
||||
end
|
||||
return SolodanceThemeCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local SolodanceThemePanel = class("SolodanceThemePanel", BasePanel)
|
||||
SolodanceThemePanel._sUIResRootPath = "UI_Activity/"
|
||||
SolodanceThemePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "20102/SolodanceThemePanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.20102.SolodanceThemeCtrl"
|
||||
}
|
||||
}
|
||||
function SolodanceThemePanel:Awake()
|
||||
end
|
||||
function SolodanceThemePanel:OnEnable()
|
||||
end
|
||||
function SolodanceThemePanel:OnDisable()
|
||||
end
|
||||
function SolodanceThemePanel:OnDestroy()
|
||||
end
|
||||
function SolodanceThemePanel:OnRelease()
|
||||
end
|
||||
return SolodanceThemePanel
|
||||
@@ -0,0 +1,394 @@
|
||||
local SoloDanceTaskCtrl = class("SoloDanceTaskCtrl", BaseCtrl)
|
||||
local JumpUtil = require("Game.Common.Utils.JumpUtil")
|
||||
local PlayerActivityData = PlayerData.Activity
|
||||
local TabType = GameEnum.ActivityTaskTabType
|
||||
local ItemType = GameEnum.itemType
|
||||
local tbTabNameUITextId = {
|
||||
[TabType.Tab1] = "Quest_Normal",
|
||||
[TabType.Tab2] = "Quest_Story",
|
||||
[TabType.Tab3] = "Quest_Challenge",
|
||||
[TabType.Tab4] = "Quest_Play",
|
||||
[TabType.Tab5] = "Quest_Active"
|
||||
}
|
||||
SoloDanceTaskCtrl._mapNodeConfig = {
|
||||
TopBarPanel = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
svList_Tab = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
svList_Task = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
svList_GroupReward = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
imgGroupDone = {},
|
||||
tmpGroupName = {sComponentName = "TMP_Text"},
|
||||
tmpGroupProgress = {sComponentName = "TMP_Text"},
|
||||
tmpGroupUndone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_UnComplete"
|
||||
},
|
||||
btnGroupDone = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "onBtn_GroupDone"
|
||||
},
|
||||
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"
|
||||
}
|
||||
}
|
||||
SoloDanceTaskCtrl._mapEventConfig = {
|
||||
onClick_RewardItem = "onEvent_ClickRewardItem",
|
||||
onClick_TaskDone = "onEvent_ClickTaskDone",
|
||||
onClick_TaskJump = "onEvent_ClickTaskJump"
|
||||
}
|
||||
SoloDanceTaskCtrl._mapRedDotConfig = {}
|
||||
function SoloDanceTaskCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
|
||||
self.nCurGroupIndex = tbParam[2] or 1
|
||||
if type(self.nActivityId) ~= "number" then
|
||||
self.nActivityId = nil
|
||||
end
|
||||
self:BuildData(self.nActivityId)
|
||||
self:refresh_Tab()
|
||||
self:refresh_Task()
|
||||
self:refresh_Group()
|
||||
end
|
||||
function SoloDanceTaskCtrl:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
function SoloDanceTaskCtrl:BuildData(nActivityId)
|
||||
if self.tbData == nil then
|
||||
self.tbData = {}
|
||||
end
|
||||
if self.tbGroupId == nil then
|
||||
self.tbGroupId = {}
|
||||
end
|
||||
if self.nCurGroupIndex == nil then
|
||||
self.nCurGroupIndex = 1
|
||||
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,
|
||||
nJumpTo = 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
|
||||
end
|
||||
function SoloDanceTaskCtrl:refresh_Tab()
|
||||
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
|
||||
end
|
||||
function SoloDanceTaskCtrl: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
|
||||
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 SoloDanceTaskCtrl: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)
|
||||
self:refresh_Group()
|
||||
end
|
||||
end
|
||||
function SoloDanceTaskCtrl: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"), ConfigTable.GetUIText(tbTabNameUITextId[mapCfgData_ActivityTaskGroup.TaskTabType]))
|
||||
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"), ConfigTable.GetUIText(tbTabNameUITextId[mapCfgData_ActivityTaskGroup.TaskTabType]))
|
||||
NovaAPI.SetTMPText(tr:Find("scale_on_click/imgDb_off/tmpTabProgress_off"):GetComponent("TMP_Text"), sProgress)
|
||||
end
|
||||
end
|
||||
function SoloDanceTaskCtrl: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 SoloDanceTaskCtrl: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 imgProgessBar = tr:Find("imgProgessBar"):GetComponent("Image")
|
||||
NovaAPI.SetImageFillAmount(imgProgessBar, nCur / nMax)
|
||||
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("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 = self:SetBigNum(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
|
||||
end
|
||||
end
|
||||
tr:Find("tmpUndone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 >= mapTask.nJumpTo 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("goDone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Received and Vector3.one or Vector3.zero
|
||||
end
|
||||
function SoloDanceTaskCtrl: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 SoloDanceTaskCtrl: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)
|
||||
self:refresh_Group()
|
||||
end
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
self.ins_ActivityTaskData:SendMsg_ActivityTaskRewardReceiveReq(mapData.nGroupId, 0, mapData.nTabType, cb)
|
||||
end
|
||||
end
|
||||
function SoloDanceTaskCtrl:onEvent_ClickTaskJump(goBtn)
|
||||
local nJumpId = tonumber(goBtn.transform:GetChild(0).name)
|
||||
if 0 < nJumpId then
|
||||
JumpUtil.JumpTo(nJumpId)
|
||||
end
|
||||
end
|
||||
function SoloDanceTaskCtrl:refresh_Group()
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local nGroupId = mapData.nGroupId
|
||||
local tbTaskData = mapData.tbTaskData
|
||||
self.bGot = table.indexof(self.ins_ActivityTaskData.tbActivityTaskGroupIds, nGroupId) > 0
|
||||
local nDone = mapData.nTaskDoneNum
|
||||
local nOK = mapData.nTaskOKNum
|
||||
local nTotal = #tbTaskData
|
||||
local bDone = nOK == nTotal
|
||||
local mapCfgData_ActivityTaskGroup = ConfigTable.GetData("ActivityTaskGroup", nGroupId)
|
||||
NovaAPI.SetTMPText(self._mapNode.tmpGroupName, ConfigTable.GetUIText(tbTabNameUITextId[mapCfgData_ActivityTaskGroup.TaskTabType]))
|
||||
NovaAPI.SetTMPText(self._mapNode.tmpGroupProgress, string.format("%s/%s", tostring(nDone), tostring(nTotal)))
|
||||
self._mapNode.tmpGroupUndone.transform.localScale = bDone == true and Vector3.zero or Vector3.one
|
||||
self._mapNode.btnGroupDone.transform.localScale = bDone == true and self.bGot == false and Vector3.one or Vector3.zero
|
||||
self._mapNode.imgGroupDone.transform.localScale = self.bGot == true and Vector3.one or Vector3.zero
|
||||
self.tbCurGroupRewardId = mapData.tbGroupRewardId
|
||||
self.tbCurGroupRewardNum = mapData.tbGroupRewardNum
|
||||
self._mapNode.svList_GroupReward:Init(#self.tbCurGroupRewardId, self, self.onGridRefresh_GroupRewardItem, self.onGridBtnClick_GroupRewardItem)
|
||||
end
|
||||
function SoloDanceTaskCtrl:onGridRefresh_GroupRewardItem(go)
|
||||
local nIndex = tonumber(go.name) + 1
|
||||
local mapCfgData_Item = ConfigTable.GetData("Item", self.tbCurGroupRewardId[nIndex])
|
||||
local tr = go.transform
|
||||
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 = self.bGot == true and Vector3.one or Vector3.zero
|
||||
local nNum = self:SetBigNum(self.tbCurGroupRewardNum[nIndex])
|
||||
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:Find("scale_on_click/goTimeLimit").localScale = mapCfgData_Item.ExpireType > 0 and Vector3.one or Vector3.zero
|
||||
end
|
||||
function SoloDanceTaskCtrl:onGridBtnClick_GroupRewardItem(go)
|
||||
local nIndex = tonumber(go.transform.parent.name) + 1
|
||||
UTILS.ClickItemGridWithTips(self.tbCurGroupRewardId[nIndex], go.transform, true, true, true)
|
||||
end
|
||||
function SoloDanceTaskCtrl:onBtn_GroupDone()
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local cb = function()
|
||||
self:BuildData(self.nActivityId)
|
||||
self:refresh_Tab()
|
||||
self:refresh_Group()
|
||||
end
|
||||
self.ins_ActivityTaskData:SendMsg_ActivityTaskGroupRewardReceiveReq(mapData.nGroupId, cb)
|
||||
end
|
||||
function SoloDanceTaskCtrl:SetBigNum(number)
|
||||
local nNum = number
|
||||
if 999999 < nNum then
|
||||
local nFloor = math.floor(nNum / 100)
|
||||
local nK = string.format("%.0f", nFloor / 10)
|
||||
nNum = nK .. "k"
|
||||
end
|
||||
return nNum
|
||||
end
|
||||
return SoloDanceTaskCtrl
|
||||
@@ -0,0 +1,9 @@
|
||||
local SoloDanceTaskPanel = class("SoloDanceTaskPanel", BasePanel)
|
||||
SoloDanceTaskPanel._sUIResRootPath = "UI_Activity/"
|
||||
SoloDanceTaskPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "20102/Task.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.20102.Task.SoloDanceTaskCtrl"
|
||||
}
|
||||
}
|
||||
return SoloDanceTaskPanel
|
||||
@@ -134,23 +134,6 @@ function ActivityBreakOutCtrl:RefreshDate()
|
||||
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:RefreshTaskData()
|
||||
local sortFunc = function(a, b)
|
||||
return a.Index < b.Index
|
||||
end
|
||||
table.sort(self.actData.tbAllActivity, sortFunc)
|
||||
self.nActTaskId = self.actData.tbAllActivity[1].ActivityId
|
||||
local ActivityTaskData = PlayerData.Activity:GetActivityDataById(self.nActTaskId)
|
||||
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 = nDone / nTotal * rt.rect.width
|
||||
self._mapNode.imgFill:GetComponent("RectTransform").sizeDelta = Vector2(nWidth, rt.rect.height)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtProgress, progress)
|
||||
end
|
||||
function ActivityBreakOutCtrl:RefreshReward()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
local rewardData = actGroupCfg.RewardsShow
|
||||
|
||||
@@ -310,7 +310,7 @@ function BreakOutThemeCtrl:RefreshTaskButtonState(actData)
|
||||
end
|
||||
local progress = string.format("%d/%d", nDone, nTotal)
|
||||
local rt = self._mapNode.imgProgressBg:GetComponent("RectTransform")
|
||||
local nWidth = nDone / nTotal * rt.rect.width
|
||||
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
|
||||
@@ -348,7 +348,7 @@ function BreakOutThemeCtrl:RefreshActivityData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
self:AddTimer(1, 3, self.RequireActiviyData, true, true, true)
|
||||
self:AddTimer(1, 3, self.RequireActivityData, true, true, true)
|
||||
end
|
||||
function BreakOutThemeCtrl:OnBtn_ClickActivityEntrance(btn, nIndex)
|
||||
local actData
|
||||
|
||||
@@ -50,9 +50,9 @@ function ActivityLevelsInstanceRoomInfo:OnDestroy()
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:OnRelease()
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:OnEvent_OpenUI(nLevelId)
|
||||
function ActivityLevelsInstanceRoomInfo:OnEvent_OpenUI(nLevelId, totalT)
|
||||
self._mapNode.BossChallenge.gameObject:SetActive(true)
|
||||
self:StartEvent(1, nLevelId)
|
||||
self:StartEvent(1, nLevelId, totalT)
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:OnEvent_CloseUI()
|
||||
self:LevelEnd()
|
||||
@@ -68,7 +68,7 @@ end
|
||||
function ActivityLevelsInstanceRoomInfo:OnEvent_BattleEnd()
|
||||
self.bBattleEnd = true
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:StartEvent(nWaitTime, nLevelId)
|
||||
function ActivityLevelsInstanceRoomInfo:StartEvent(nWaitTime, nLevelId, totalT)
|
||||
self.mapLevelCfgData = ConfigTable.GetData("ActivityLevelsLevel", nLevelId)
|
||||
self.tbTime = {
|
||||
self.mapLevelCfgData.ThreeStarCondition[1],
|
||||
@@ -81,7 +81,7 @@ function ActivityLevelsInstanceRoomInfo:StartEvent(nWaitTime, nLevelId)
|
||||
self._mapNode.rtnfo:SetActive(false)
|
||||
self._mapNode.rtChallengeTime:SetActive(false)
|
||||
self._mapNode.TMPDesc.gameObject:SetActive(false)
|
||||
self:SetTime(self.totalTime)
|
||||
self:SetTime(self.totalTime - totalT)
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorWhite)
|
||||
local nStateDesc = 3 - #self.tbTime > 0 and 3 - #self.tbTime or 1
|
||||
if nStateDesc < 3 then
|
||||
|
||||
@@ -0,0 +1,415 @@
|
||||
local TaskCommonCtrl_01 = class("TaskCommonCtrl_01", BaseCtrl)
|
||||
local JumpUtil = require("Game.Common.Utils.JumpUtil")
|
||||
local PlayerActivityData = PlayerData.Activity
|
||||
local TabType = GameEnum.ActivityTaskTabType
|
||||
local ItemType = GameEnum.itemType
|
||||
local tbTabNameUITextId = {
|
||||
[TabType.Tab1] = "Quest_Normal",
|
||||
[TabType.Tab2] = "Quest_Story",
|
||||
[TabType.Tab3] = "Quest_Challenge",
|
||||
[TabType.Tab4] = "Quest_Play",
|
||||
[TabType.Tab5] = "Quest_Active"
|
||||
}
|
||||
local tbImgDbType = {SizeDelta = 1, FillAmount = 2}
|
||||
TaskCommonCtrl_01._mapNodeConfig = {
|
||||
TopBarPanel = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
svList_Tab = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
svList_Task = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
svList_GroupReward = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
imgGroupDone = {},
|
||||
tmpGroupName = {sComponentName = "TMP_Text"},
|
||||
tmpGroupProgress = {sComponentName = "TMP_Text"},
|
||||
tmpGroupUndone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_UnComplete"
|
||||
},
|
||||
btnGroupDone = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "onBtn_GroupDone"
|
||||
},
|
||||
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"
|
||||
}
|
||||
}
|
||||
TaskCommonCtrl_01._mapEventConfig = {
|
||||
onClick_RewardItem = "onEvent_ClickRewardItem",
|
||||
onClick_TaskDone = "onEvent_ClickTaskDone",
|
||||
onClick_TaskJump = "onEvent_ClickTaskJump"
|
||||
}
|
||||
TaskCommonCtrl_01._mapRedDotConfig = {}
|
||||
function TaskCommonCtrl_01:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
|
||||
self.nCurGroupIndex = tbParam[2] or 1
|
||||
self.imgDbType = tbParam[3]
|
||||
if type(self.nActivityId) ~= "number" then
|
||||
self.nActivityId = nil
|
||||
end
|
||||
self:BuildData(self.nActivityId)
|
||||
self:refresh_Tab()
|
||||
self:refresh_Task()
|
||||
self:refresh_Group()
|
||||
end
|
||||
function TaskCommonCtrl_01:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
function TaskCommonCtrl_01:BuildData(nActivityId)
|
||||
if self.tbData == nil then
|
||||
self.tbData = {}
|
||||
end
|
||||
if self.tbGroupId == nil then
|
||||
self.tbGroupId = {}
|
||||
end
|
||||
if self.nCurGroupIndex == nil then
|
||||
self.nCurGroupIndex = 1
|
||||
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,
|
||||
nJumpTo = 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
|
||||
end
|
||||
function TaskCommonCtrl_01:refresh_Tab()
|
||||
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
|
||||
end
|
||||
function TaskCommonCtrl_01: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
|
||||
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 TaskCommonCtrl_01: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)
|
||||
self:refresh_Group()
|
||||
end
|
||||
end
|
||||
function TaskCommonCtrl_01: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"), ConfigTable.GetUIText(tbTabNameUITextId[mapCfgData_ActivityTaskGroup.TaskTabType]))
|
||||
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"), ConfigTable.GetUIText(tbTabNameUITextId[mapCfgData_ActivityTaskGroup.TaskTabType]))
|
||||
NovaAPI.SetTMPText(tr:Find("scale_on_click/imgDb_off/tmpTabProgress_off"):GetComponent("TMP_Text"), sProgress)
|
||||
end
|
||||
end
|
||||
function TaskCommonCtrl_01: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 TaskCommonCtrl_01: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
|
||||
if self.imgDbType == tbImgDbType.SizeDelta then
|
||||
self:SetImgBar_SizeDelta(mapTask, tr)
|
||||
elseif self.imgDbType == tbImgDbType.FillAmount then
|
||||
self:SetImgBar_FillAmount(mapTask, tr)
|
||||
end
|
||||
local nCount = #mapTask.tbTaskRewardId
|
||||
for i = 1, 2 do
|
||||
local _tr = tr:Find("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
|
||||
end
|
||||
end
|
||||
tr:Find("tmpUndone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 >= mapTask.nJumpTo 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("goDone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Received and Vector3.one or Vector3.zero
|
||||
end
|
||||
function TaskCommonCtrl_01: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 TaskCommonCtrl_01: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)
|
||||
self:refresh_Group()
|
||||
end
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
self.ins_ActivityTaskData:SendMsg_ActivityTaskRewardReceiveReq(mapData.nGroupId, 0, mapData.nTabType, cb)
|
||||
end
|
||||
end
|
||||
function TaskCommonCtrl_01:onEvent_ClickTaskJump(goBtn)
|
||||
local nJumpId = tonumber(goBtn.transform:GetChild(0).name)
|
||||
if 0 < nJumpId then
|
||||
JumpUtil.JumpTo(nJumpId)
|
||||
end
|
||||
end
|
||||
function TaskCommonCtrl_01:refresh_Group()
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local nGroupId = mapData.nGroupId
|
||||
local tbTaskData = mapData.tbTaskData
|
||||
self.bGot = table.indexof(self.ins_ActivityTaskData.tbActivityTaskGroupIds, nGroupId) > 0
|
||||
local nDone = mapData.nTaskDoneNum
|
||||
local nOK = mapData.nTaskOKNum
|
||||
local nTotal = #tbTaskData
|
||||
local bDone = nOK == nTotal
|
||||
local mapCfgData_ActivityTaskGroup = ConfigTable.GetData("ActivityTaskGroup", nGroupId)
|
||||
NovaAPI.SetTMPText(self._mapNode.tmpGroupName, ConfigTable.GetUIText(tbTabNameUITextId[mapCfgData_ActivityTaskGroup.TaskTabType]))
|
||||
NovaAPI.SetTMPText(self._mapNode.tmpGroupProgress, string.format("%s/%s", tostring(nDone), tostring(nTotal)))
|
||||
self._mapNode.tmpGroupUndone.transform.localScale = bDone == true and Vector3.zero or Vector3.one
|
||||
self._mapNode.btnGroupDone.transform.localScale = bDone == true and self.bGot == false and Vector3.one or Vector3.zero
|
||||
self._mapNode.imgGroupDone.transform.localScale = self.bGot == true and Vector3.one or Vector3.zero
|
||||
self.tbCurGroupRewardId = mapData.tbGroupRewardId
|
||||
self.tbCurGroupRewardNum = mapData.tbGroupRewardNum
|
||||
self._mapNode.svList_GroupReward:Init(#self.tbCurGroupRewardId, self, self.onGridRefresh_GroupRewardItem, self.onGridBtnClick_GroupRewardItem)
|
||||
end
|
||||
function TaskCommonCtrl_01:onGridRefresh_GroupRewardItem(go)
|
||||
local nIndex = tonumber(go.name) + 1
|
||||
local mapCfgData_Item = ConfigTable.GetData("Item", self.tbCurGroupRewardId[nIndex])
|
||||
local tr = go.transform
|
||||
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 = self.bGot == true and Vector3.one or Vector3.zero
|
||||
local nNum = self.tbCurGroupRewardNum[nIndex]
|
||||
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:Find("scale_on_click/goTimeLimit").localScale = mapCfgData_Item.ExpireType > 0 and Vector3.one or Vector3.zero
|
||||
end
|
||||
function TaskCommonCtrl_01:onGridBtnClick_GroupRewardItem(go)
|
||||
local nIndex = tonumber(go.transform.parent.name) + 1
|
||||
UTILS.ClickItemGridWithTips(self.tbCurGroupRewardId[nIndex], go.transform, true, true, true)
|
||||
end
|
||||
function TaskCommonCtrl_01:onBtn_GroupDone()
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local cb = function()
|
||||
self:BuildData(self.nActivityId)
|
||||
self:refresh_Tab()
|
||||
self:refresh_Group()
|
||||
end
|
||||
self.ins_ActivityTaskData:SendMsg_ActivityTaskGroupRewardReceiveReq(mapData.nGroupId, cb)
|
||||
end
|
||||
function TaskCommonCtrl_01:SetImgBar_SizeDelta(mapTask, tr)
|
||||
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, rt.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)))
|
||||
end
|
||||
function TaskCommonCtrl_01:SetImgBar_FillAmount(mapTask, tr)
|
||||
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 imgProgessBar = tr:Find("imgProgessBar"):GetComponent("Image")
|
||||
NovaAPI.SetImageFillAmount(imgProgessBar, nCur / nMax)
|
||||
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)))
|
||||
end
|
||||
return TaskCommonCtrl_01
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1876,7 +1876,7 @@ return {
|
||||
param = {
|
||||
6,
|
||||
"avg1_135",
|
||||
"可怜我的话,不如给我一点八卦或者新闻吧?==RT==你们跟魔王很熟吧?透露点他的情报给我吧~",
|
||||
"可怜我的话,不如给我一点八卦或者新闻吧?==RT==你们跟魔王很熟吧?透露点==SEX1==的情报给我吧~",
|
||||
0,
|
||||
"",
|
||||
false,
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
return {
|
||||
{
|
||||
cmd = "SetGroupId",
|
||||
param = {"14501"}
|
||||
},
|
||||
{
|
||||
cmd = "SetCharL2D",
|
||||
param = {
|
||||
"avg1_145",
|
||||
3,
|
||||
"none",
|
||||
"",
|
||||
0
|
||||
}
|
||||
},
|
||||
{
|
||||
cmd = "SetCharL2D",
|
||||
param = {
|
||||
"avg1_145",
|
||||
0,
|
||||
"avg_emoji_think",
|
||||
"",
|
||||
0
|
||||
}
|
||||
},
|
||||
{
|
||||
cmd = "SetCharL2D",
|
||||
param = {
|
||||
"avg1_145",
|
||||
0,
|
||||
"none",
|
||||
"chat_a",
|
||||
0
|
||||
}
|
||||
},
|
||||
{
|
||||
cmd = "SetTalk",
|
||||
param = {
|
||||
0,
|
||||
"avg1_145",
|
||||
"不愧是你指定的地方,竟然有意料之外的收获。",
|
||||
0,
|
||||
"",
|
||||
false,
|
||||
""
|
||||
}
|
||||
},
|
||||
{
|
||||
cmd = "SetTalk",
|
||||
param = {
|
||||
0,
|
||||
"avg1_145",
|
||||
"该不会……从一开始就在你的算计之中吧?",
|
||||
0,
|
||||
"",
|
||||
false,
|
||||
""
|
||||
}
|
||||
},
|
||||
{
|
||||
cmd = "SetGroupId",
|
||||
param = {"14502"}
|
||||
},
|
||||
{
|
||||
cmd = "SetCharL2D",
|
||||
param = {
|
||||
"avg1_145",
|
||||
3,
|
||||
"none",
|
||||
"",
|
||||
0
|
||||
}
|
||||
},
|
||||
{
|
||||
cmd = "SetCharL2D",
|
||||
param = {
|
||||
"avg1_145",
|
||||
0,
|
||||
"avg_emoji_happy",
|
||||
"",
|
||||
0
|
||||
}
|
||||
},
|
||||
{
|
||||
cmd = "SetCharL2D",
|
||||
param = {
|
||||
"avg1_145",
|
||||
0,
|
||||
"none",
|
||||
"presents_a",
|
||||
0
|
||||
}
|
||||
},
|
||||
{
|
||||
cmd = "SetTalk",
|
||||
param = {
|
||||
0,
|
||||
"avg1_145",
|
||||
"好久没做过这么轻松的任务了。",
|
||||
0,
|
||||
"",
|
||||
false,
|
||||
""
|
||||
}
|
||||
},
|
||||
{
|
||||
cmd = "SetTalk",
|
||||
param = {
|
||||
0,
|
||||
"avg1_145",
|
||||
"总觉得,身心都舒畅了呢。",
|
||||
0,
|
||||
"",
|
||||
false,
|
||||
""
|
||||
}
|
||||
},
|
||||
{cmd = "End"}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -3661,7 +3661,7 @@ return {
|
||||
param = {
|
||||
2,
|
||||
"avg3_100",
|
||||
"联合种业的执政官和二把手都没问题,那灰夫人又是怎么回事?灰夫人的靠山到底是谁?",
|
||||
"联合种业的执行官和二把手都没问题,那灰夫人又是怎么回事?灰夫人的靠山到底是谁?",
|
||||
0,
|
||||
"",
|
||||
false,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -6488,7 +6488,7 @@ return {
|
||||
param = {
|
||||
0,
|
||||
"avg1_119",
|
||||
"在您的指挥下,行动非常顺利。不愧是魔王协议的首席执政官。",
|
||||
"在您的指挥下,行动非常顺利。不愧是魔王协议的首席执行官。",
|
||||
0,
|
||||
"",
|
||||
false,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user