Major Update - 2.0.0.143

EN: 2.0.0.143
CN: 2.0.0.142
JP: 2.0.0.145
KR: 2.0.0.150
This commit is contained in:
SL1900
2026-10-20 13:00:00 +09:00
parent 4bcada6061
commit 08b515afd9
1773 changed files with 1095195 additions and 65670 deletions
@@ -0,0 +1,22 @@
local MathParkourLevelSelectPanel = class("MathParkourLevelSelectPanel", BasePanel)
MathParkourLevelSelectPanel._sUIResRootPath = "UI_Activity/"
MathParkourLevelSelectPanel._tbDefine = {
{
sPrefabPath = "_400018/MathParkourLevelsSelect.prefab",
sCtrlName = "Game.UI.Activity.MathParkour.MathParkourLevelSelectCtrl"
}
}
function MathParkourLevelSelectPanel:Awake()
self.nSelectIndex = 0
end
function MathParkourLevelSelectPanel:OnEnable()
end
function MathParkourLevelSelectPanel:OnAfterEnter()
end
function MathParkourLevelSelectPanel:OnDisable()
end
function MathParkourLevelSelectPanel:OnDestroy()
end
function MathParkourLevelSelectPanel:OnRelease()
end
return MathParkourLevelSelectPanel
@@ -0,0 +1,30 @@
local MathParkourPanel = class("MathParkourPanel", BasePanel)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
MathParkourPanel._sUIResRootPath = "UI_Activity/"
MathParkourPanel._tbDefine = {
{
sPrefabPath = "_400018/MathParkourPanel.prefab",
sCtrlName = "Game.UI.Activity.MathParkour.MathParkourCtrl"
},
{
sPrefabPath = "_400018/MathParkourSkillDisplayPanel.prefab",
sCtrlName = "Game.UI.Activity.MathParkour.MathParkourSkillDisplayCtrl"
}
}
function MathParkourPanel:Awake()
GamepadUIManager.EnterAdventure(true)
GamepadUIManager.EnableGamepadUI("MathParkourCtrl", {}, nil, false)
end
function MathParkourPanel:OnEnable()
end
function MathParkourPanel:OnAfterEnter()
end
function MathParkourPanel:OnDisable()
end
function MathParkourPanel:OnDestroy()
GamepadUIManager.DisableGamepadUI("MathParkourCtrl")
GamepadUIManager.QuitAdventure()
end
function MathParkourPanel:OnRelease()
end
return MathParkourPanel
@@ -0,0 +1,23 @@
local MathParkourResultPanel = class("MathParkourResultPanel", BasePanel)
MathParkourResultPanel._nSnapshotPrePanel = 1
MathParkourResultPanel._sUIResRootPath = "UI_Activity/"
MathParkourResultPanel._bIsMainPanel = false
MathParkourResultPanel._tbDefine = {
{
sPrefabPath = "_400018/MathParkourResultPanel.prefab",
sCtrlName = "Game.UI.Activity.MathParkour.MathParkourResultCtrl"
}
}
function MathParkourResultPanel:Awake()
end
function MathParkourResultPanel:OnEnable()
end
function MathParkourResultPanel:OnAfterEnter()
end
function MathParkourResultPanel:OnDisable()
end
function MathParkourResultPanel:OnDestroy()
end
function MathParkourResultPanel:OnRelease()
end
return MathParkourResultPanel
@@ -0,0 +1,21 @@
local MathParkourSkillDisplayPanel = class("MathParkourSkillDisplayPanel", BasePanel)
MathParkourSkillDisplayPanel._bIsMainPanel = false
MathParkourSkillDisplayPanel._tbDefine = {
{
sPrefabPath = "Activity/MathParkour/400018/MathParkourSkillDisplayPanel.prefab",
sCtrlName = "Game.UI.Activity.MathParkour.MathParkourSkillDisplayPanelCtrl"
}
}
function MathParkourSkillDisplayPanel:Awake()
end
function MathParkourSkillDisplayPanel:OnEnable()
end
function MathParkourSkillDisplayPanel:OnAfterEnter()
end
function MathParkourSkillDisplayPanel:OnDisable()
end
function MathParkourSkillDisplayPanel:OnDestroy()
end
function MathParkourSkillDisplayPanel:OnRelease()
end
return MathParkourSkillDisplayPanel
@@ -0,0 +1,90 @@
local MathParkourBuffCtrl = class("MathParkourBuffCtrl", BaseCtrl)
local AssetPath = "UI_Activity/_400018/SpriteAtlas/"
MathParkourBuffCtrl._mapNodeConfig = {
imgIcon = {sComponentName = "Image"},
TMPBuffTime1 = {sComponentName = "TMP_Text"}
}
MathParkourBuffCtrl._mapEventConfig = {}
MathParkourBuffCtrl._mapRedDotConfig = {}
function MathParkourBuffCtrl:Awake()
self.timer = nil
self.boomTimer = nil
self.animator = self.gameObject:GetComponent("Animator")
end
function MathParkourBuffCtrl:OnEnable()
end
function MathParkourBuffCtrl:ShowBuff(nBuffId, bPause)
self.nBuffId = nBuffId
local buffCfg = ConfigTable.GetData("MathParkourBuffItem", nBuffId)
if self.timer ~= nil then
self.timer:Cancel()
self.timer = nil
end
if buffCfg.Icon ~= "" then
self:SetPngSprite(self._mapNode.imgIcon, AssetPath .. buffCfg.Icon)
end
self.nCurTime = buffCfg.Time
self.nBoomTime = buffCfg.Time
self:SetTimeText(self.nCurTime)
self.timer = self:AddTimer(0, 1, function()
self.nCurTime = self.nCurTime - 1
self.nCurTime = math.max(self.nCurTime, 0)
if self.nCurTime <= 0 then
self.timer:Cancel()
self.timer = nil
self:HideBuff()
return
end
self:SetTimeText(self.nCurTime)
end, true, true, true)
self.timer:Pause(bPause)
if buffCfg.ObjType == GameEnum.MathParkourBuffType.Boom then
if self.boomTimer ~= nil then
self.boomTimer:Cancel()
self.boomTimer = nil
end
EventManager.Hit("MathParkour_BoomTime", 1.0)
self.boomTimer = self:AddTimer(0, 0.02, function()
self.nBoomTime = self.nBoomTime - 0.02
if self.nBoomTime <= 0 then
self.boomTimer:Cancel()
self.boomTimer = nil
return
end
EventManager.Hit("MathParkour_BoomTime", self.nBoomTime / buffCfg.Time)
end, true, true, true)
self.boomTimer:Pause(bPause)
end
if self.animator ~= nil then
self.animator:Play("rtBuff_in")
end
end
function MathParkourBuffCtrl:SetTimeText(nTime)
nTime = math.max(nTime, 0)
nTime = math.floor(nTime)
local sTimeText = string.format("%02d:%02d", math.floor(nTime / 60), nTime % 60)
NovaAPI.SetTMPText(self._mapNode.TMPBuffTime1, sTimeText)
end
function MathParkourBuffCtrl:HideBuff()
if self.timer ~= nil then
self.timer:Cancel()
self.timer = nil
end
if self.boomTimer ~= nil then
self.boomTimer:Cancel()
self.boomTimer = nil
end
if self.nBuffId ~= nil and self.nBuffId ~= 0 then
EventManager.Hit("MathParkour_BuffTimeOut", self.nBuffId)
end
self.nBuffId = 0
end
function MathParkourBuffCtrl:Pause(bPause)
if self.timer ~= nil then
self.timer:Pause(bPause)
end
if self.boomTimer ~= nil then
self.boomTimer:Pause(bPause)
end
end
return MathParkourBuffCtrl
@@ -0,0 +1,615 @@
local MathParkourCtrl = class("MathParkourCtrl", BaseCtrl)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
MathParkourCtrl._mapNodeConfig = {
rtBuff = {
nCount = 5,
sCtrlName = "Game.UI.Activity.MathParkour.MathParkourBuffCtrl"
},
txt_newScore = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Text_NewScore"
},
txt_targetScore = {sComponentName = "TMP_Text"},
imgActProgress = {sComponentName = "Image"},
StarItem = {nCount = 3},
obj_Time = {},
btnPause = {
sComponentName = "NaviButton",
callback = "OnBtnClick_Pause",
sAction = "MathParkour_Pause"
},
goChallenge = {
sCtrlName = "Game.UI.Activity.MathParkour.MathParkourResultSuccessCtrl"
},
goFailure = {
sCtrlName = "Game.UI.Activity.MathParkour.MathParkourResultFailCtrl"
},
goPause = {
sNodeName = "MathParkourPause",
sCtrlName = "Game.UI.Activity.MathParkour.MathParkourPauseCtrl"
},
btn_qte = {
sComponentName = "NaviButton",
callback = "OnBtnClick_QTE",
sAction = "MathParkour_QTE",
sActionIconType = "Dark"
},
goSmash = {},
imgSmasProgress = {sComponentName = "Image"},
txt_SmashScore = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Text_SmashScore"
},
btnClearthescene = {
sComponentName = "NaviButton",
callback = "OnBtnClick_ClearTheScene",
sAction = "MathParkour_Boom"
},
txt_Clearthescene = {
sComponentName = "TMP_Text",
nCount = 2,
sLanguageId = "MathParkour_Clearthescene"
},
imgProgress = {sComponentName = "Image"},
txt_Score1 = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Text_Score1"
},
txt_Score = {sComponentName = "TMP_Text"},
canvasGroup = {
sNodeName = "----SafeAreaRoot---",
sComponentName = "CanvasGroup"
}
}
MathParkourCtrl._mapEventConfig = {
MathParkour_AddScore = "OnEvent_AddScore",
MathParkour_BuffItemCollected = "OnEvent_AddBuff",
MathParkour_UseBuff = "OnEvent_UseBuff",
MathParkour_BuffConsumed = "OnEvent_BuffConsumed",
MathParkour_BoomTime = "OnEvent_BoomTime",
MathParkour_LevelEnd = "OnEvent_LevelEnd",
MathParkour_BossEncountered = "OnEvent_BossEncountered",
MathParkour_Confirm = "OnEvent_Confirm",
MathParkour_Again = "OnEvent_Again",
MathParkour_NextLevel = "OnEvent_GoNextLevel",
MathParkour_BuffTimeOut = "OnEvent_BuffTimeOut",
MathParkour_Exit_OnClick = "OnEvent_Exit",
MathParkour_Restart_OnClick = "OnEvent_Restart",
MathParkour_Continue_OnClick = "OnEvent_Continue",
MathParkour_EnterLevel = "OnEvent_EnterLevel",
MathParkour_BlockInput = "OnEvent_BlockInput",
MathParkour_GMRemoveBuff = "OnEvent_GMRemoveBuff",
MathParkour_GM_ToggleBuffOverlay = "OnEvent_GMToggleBuffOverlay",
MathParkour_GM_Pause = "OnEvent_GMPause"
}
MathParkourCtrl._mapRedDotConfig = {}
function MathParkourCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.nLevelId = param[2]
end
self.tbGamepadUINode = self:GetGamepadUINode()
GamepadUIManager.AddGamepadUINode("MathParkourCtrl", self.tbGamepadUINode)
self:InitData()
self:UpdatePanelData()
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, 0)
end
function MathParkourCtrl:OnDestroy()
self:ClearGMBuffOverlay()
end
function MathParkourCtrl:InitData()
self.bPause = true
self.levelCfg = ConfigTable.GetData("MathParkourLevel", self.nLevelId)
self.cfg = ConfigTable.GetData("MathParkourConfig", self.levelCfg.ConfigId)
self.actData = PlayerData.Activity:GetActivityDataById(self.nActId)
self.CurLevelData = self.actData:GetLevelData(self.nLevelId)
self.nCurScore = 0
self.nStar = 0
self.bInResult = false
self:UpdateScore(0)
self.nAddBuffCount = 0
self.tbUsedBuffItem = {}
self.tbBuffItem = {}
self.bBossEncountered = false
for i = 1, 5 do
self.tbBuffItem[i] = self._mapNode.rtBuff[i]
self.tbBuffItem[i].gameObject:SetActive(false)
end
end
function MathParkourCtrl:UpdatePanelData()
self._mapNode.btnClearthescene.gameObject:SetActive(false)
self._mapNode.goChallenge:HidePanel()
self._mapNode.goFailure:HidePanel()
self._mapNode.obj_Time:SetActive(true)
local timeOutGo = self._mapNode.obj_Time.transform:Find("AnimRoot")
timeOutGo.gameObject:SetActive(false)
self:InitQTE()
self._mapNode.txt_Score1.gameObject:SetActive(self.bBossEncountered)
self._mapNode.txt_Score.gameObject:SetActive(self.bBossEncountered)
end
function MathParkourCtrl:InitQTE()
self._mapNode.goSmash.gameObject:SetActive(false)
self._mapNode.btn_qte.gameObject:SetActive(false)
if self.qteTimer ~= nil then
self.qteTimer:Cancel()
self.qteTimer = nil
end
self.nQte = 0
end
function MathParkourCtrl:StartGame()
local bNewLevel = self.actData:GetLevelIsNew(self.nLevelId)
if bNewLevel and self.levelCfg.DicId ~= 0 then
self.actData:EnterLevel(self.nLevelId)
EventManager.Hit(EventId.OpenPanel, PanelId.DictionaryEntry, self.levelCfg.DicId, true, function()
WwiseAudioMgr:PostEvent("Mode_400018_start")
self:AddTimer(1, 0.5, function()
local timeOutGo = self._mapNode.obj_Time.transform:Find("AnimRoot")
timeOutGo.gameObject:SetActive(true)
NovaAPI.DispatchEventWithData("MATHPARKOUR_STARTLEVEL", nil, nil)
EventManager.Hit(EventId.BlockInput, true)
self:AddTimer(1, 3.5, function()
self._mapNode.obj_Time:SetActive(false)
self.bPause = false
EventManager.Hit(EventId.BlockInput, false)
NovaAPI.DispatchEventWithData("MATHPARKOUR_START", nil, nil)
end, true, true, true)
end, true, true, true)
end)
else
EventManager.Hit(EventId.BlockInput, true)
WwiseAudioMgr:PostEvent("Mode_400018_start")
self:AddTimer(1, 0.5, function()
local timeOutGo = self._mapNode.obj_Time.transform:Find("AnimRoot")
timeOutGo.gameObject:SetActive(true)
NovaAPI.DispatchEventWithData("MATHPARKOUR_STARTLEVEL", nil, nil)
self:AddTimer(1, 3.5, function()
self._mapNode.obj_Time:SetActive(false)
self.bPause = false
EventManager.Hit(EventId.BlockInput, false)
NovaAPI.DispatchEventWithData("MATHPARKOUR_START", nil, nil)
end, true, true, true)
end, true, true, true)
self.actData:EnterLevel(self.nLevelId)
end
end
function MathParkourCtrl:ShowQTE()
NovaAPI.SetImageFillAmount(self._mapNode.imgSmasProgress, 0)
self._mapNode.goSmash.gameObject:SetActive(true)
self._mapNode.btn_qte.gameObject:SetActive(true)
self.qteTimer = self:AddTimer(0, 1, function()
self.nQte = self.nQte - self.cfg.QteProgressDeduction
self.nQte = math.max(self.nQte, 0)
NovaAPI.SetImageFillAmount(self._mapNode.imgSmasProgress, self.nQte / self.cfg.QteProgressLimit)
NovaAPI.DispatchEventWithData("MathParkour_SetQteSpeed", nil, {
self.nQte * self.cfg.QteSpeedFactor
})
end, true, true, true)
end
function MathParkourCtrl:RemoveBuff(nBuffId)
if self.tbUsedBuffItem[nBuffId] ~= nil then
local buffItem = self.tbUsedBuffItem[nBuffId]
table.insert(self.tbBuffItem, buffItem)
buffItem.gameObject:SetActive(false)
local buffCfg = ConfigTable.GetData("MathParkourBuffItem", nBuffId)
if buffCfg.ObjType == GameEnum.MathParkourBuffType.Boom then
self._mapNode.btnClearthescene.gameObject:SetActive(false)
end
self.tbUsedBuffItem[nBuffId] = nil
NovaAPI.DispatchEventWithData("MathParkour_BuffRemoved", nil, {nBuffId})
end
end
function MathParkourCtrl:Remap(nValue, nInMin, nInMax, nOutMin, nOutMax)
if nInMax == nInMin then
return nOutMin
end
return nOutMin + (nValue - nInMin) / (nInMax - nInMin) * (nOutMax - nOutMin)
end
function MathParkourCtrl:UpdateScore(nAddScore)
self.nCurScore = math.max(self.nCurScore + nAddScore, 0)
NovaAPI.SetTMPText(self._mapNode.txt_targetScore, self.nCurScore)
self._mapNode.txt_newScore.gameObject:SetActive(self.nCurScore > self.CurLevelData.nScore)
local nStar = 0
if self.nCurScore >= self.levelCfg.Reward3Condition then
NovaAPI.SetImageFillAmount(self._mapNode.imgActProgress, 1)
nStar = 3
elseif self.nCurScore >= self.levelCfg.Reward2Condition then
local nTempScore = self.nCurScore - self.levelCfg.Reward2Condition
local amount = self:Remap(nTempScore / (self.levelCfg.Reward3Condition - self.levelCfg.Reward2Condition), 0, 1, 0, 0.33) + 0.66
NovaAPI.SetImageFillAmount(self._mapNode.imgActProgress, amount)
nStar = 2
elseif self.nCurScore >= self.levelCfg.Reward1Condition then
local nTempScore = self.nCurScore - self.levelCfg.Reward1Condition
local amount = self:Remap(nTempScore / (self.levelCfg.Reward2Condition - self.levelCfg.Reward1Condition), 0, 1, 0, 0.33) + 0.33
NovaAPI.SetImageFillAmount(self._mapNode.imgActProgress, amount)
nStar = 1
else
local amount = self:Remap(self.nCurScore / self.levelCfg.Reward1Condition, 0, 1, 0, 0.33)
NovaAPI.SetImageFillAmount(self._mapNode.imgActProgress, amount)
nStar = 0
end
for i = 1, 3 do
local star = self._mapNode.StarItem[i].transform:Find("ImgStarGray")
star.gameObject:SetActive(i > nStar)
end
self.nStar = nStar
end
function MathParkourCtrl:ApplyLogicPause(bPause)
if bPause then
NovaAPI.DispatchEventWithData("MATHPARKOUR_PAUSE_STATE_CHANGED", nil, {1})
EventManager.Hit("MathParkour_CastAssistSkillPause", true)
if self.tbUsedBuffItem ~= nil then
for _, v in pairs(self.tbUsedBuffItem) do
v:Pause(true)
end
end
WwiseAudioMgr:PostEvent("Mode_400018_all_pasue")
else
NovaAPI.DispatchEventWithData("MATHPARKOUR_PAUSE_STATE_CHANGED", nil, {0})
EventManager.Hit("MathParkour_CastAssistSkillPause", false)
if self.tbUsedBuffItem ~= nil then
for _, v in pairs(self.tbUsedBuffItem) do
v:Pause(false)
end
end
WwiseAudioMgr:PostEvent("Mode_400018_all_resume")
end
end
function MathParkourCtrl:IsLogicPaused()
return self.bPause == true or self.bGMPaused == true
end
function MathParkourCtrl:OnEvent_GMPause(bPause)
if bPause then
if self:IsLogicPaused() then
return
end
self.bGMPaused = true
self:ApplyLogicPause(true)
return
end
if not self.bGMPaused then
return
end
self.bGMPaused = false
if self:IsLogicPaused() then
return
end
self:ApplyLogicPause(false)
end
function MathParkourCtrl:OnBtnClick_Pause()
if self.bInResult then
return
end
self.bPause = true
self:ApplyLogicPause(true)
self._mapNode.goPause:Open(self.levelCfg.DicId)
end
function MathParkourCtrl:OnBtnClick_Start()
end
function MathParkourCtrl:OnBtnClick_ClearTheScene()
if self.tempClearSceneBuffId ~= nil and self.tbUsedBuffItem[self.tempClearSceneBuffId] ~= nil then
NovaAPI.DispatchEventWithData("MATHPARKOUR_CLEAR_THE_SCENE", nil, {
self.tempClearSceneBuffId
})
end
if self.tbUsedBuffItem[self.tempClearSceneBuffId] ~= nil then
local buffItem = self.tbUsedBuffItem[self.tempClearSceneBuffId]
table.insert(self.tbBuffItem, buffItem)
buffItem.gameObject:SetActive(false)
local buffCfg = ConfigTable.GetData("MathParkourBuffItem", self.tempClearSceneBuffId)
if buffCfg.ObjType == GameEnum.MathParkourBuffType.Boom then
self._mapNode.btnClearthescene.gameObject:SetActive(false)
end
self.tbUsedBuffItem[self.tempClearSceneBuffId] = nil
end
end
function MathParkourCtrl:OnBtnClick_QTE()
self.nQte = self.nQte + self.cfg.QteProgressPerClick
self.nQte = math.min(self.nQte, self.cfg.QteProgressLimit)
NovaAPI.SetImageFillAmount(self._mapNode.imgSmasProgress, self.nQte / self.cfg.QteProgressLimit)
NovaAPI.DispatchEventWithData("MathParkour_SetQteSpeed", nil, {
self.nQte * self.cfg.QteSpeedFactor
})
end
function MathParkourCtrl:OnEvent_AddScore(nAddScore)
self:UpdateScore(nAddScore)
if self.bBossEncountered then
self.nBossScore = self.nBossScore + nAddScore
NovaAPI.SetTMPText(self._mapNode.txt_Score, "+" .. tostring(self.nBossScore))
end
end
function MathParkourCtrl:OnEvent_AddBuff(nBuffId)
self.nAddBuffCount = self.nAddBuffCount + 1
local buffCfg = ConfigTable.GetData("MathParkourBuffItem", nBuffId)
if NovaAPI.IsEditorPlatform() then
print("MathParkourCtrl:OnEvent_AddBuff nBuffId=" .. tostring(nBuffId) .. "=====" .. buffCfg.Name)
end
if buffCfg.ObjType == GameEnum.MathParkourBuffType.Rocket then
NovaAPI.DispatchEventWithData("MathParkour_BuffAdded", nil, {nBuffId})
NovaAPI.DispatchEventWithData("MathParkour_BuffRemoved", nil, {nBuffId})
return
end
if self.tbUsedBuffItem[nBuffId] == nil then
local buffItem = self.tbBuffItem[1]
buffItem.gameObject:SetActive(true)
buffItem:ShowBuff(nBuffId, self:IsLogicPaused())
self.tbUsedBuffItem[nBuffId] = buffItem
if buffCfg.ObjType == GameEnum.MathParkourBuffType.Boom then
self._mapNode.btnClearthescene.gameObject:SetActive(true)
self.tempClearSceneBuffId = nBuffId
end
table.remove(self.tbBuffItem, 1)
NovaAPI.DispatchEventWithData("MathParkour_BuffAdded", nil, {nBuffId})
else
self.tbUsedBuffItem[nBuffId]:ShowBuff(nBuffId, self:IsLogicPaused())
end
end
function MathParkourCtrl:OnEvent_BuffTimeOut(nBuffId)
local cfg = ConfigTable.GetData("MathParkourBuffItem", nBuffId)
if cfg.ObjType == GameEnum.MathParkourBuffType.Boom then
self:OnBtnClick_ClearTheScene()
end
self:RemoveBuff(nBuffId)
end
function MathParkourCtrl:OnEvent_UseBuff(nBuffId)
self:RemoveBuff(nBuffId)
end
function MathParkourCtrl:OnEvent_BuffConsumed(nBuffId)
self:RemoveBuff(nBuffId)
end
function MathParkourCtrl:OnEvent_BoomTime(fTime)
NovaAPI.SetImageFillAmount(self._mapNode.imgProgress, fTime)
end
function MathParkourCtrl:OnEvent_LevelEnd(bResult)
self:ClearGMBuffOverlay()
self.bInResult = true
if bResult then
local nNextLevelId = self.actData:GetNextLevelId(self.nLevelId)
self._mapNode.goChallenge:ShowPanel(self.nCurScore, self.nCurScore > self.CurLevelData.nScore, self.nStar, nNextLevelId ~= nil, self.nActId)
else
self._mapNode.goFailure:ShowPanel(self.nCurScore)
end
self.actData:DoResult(self.nLevelId, bResult, self.nCurScore, self.nStar, self.nAddBuffCount)
end
function MathParkourCtrl:OnEvent_BossEncountered()
EventManager.Hit(EventId.TemporaryBlockInput, 1.6)
EventManager.Hit("MathParkour_CastAssistSkill", 140, 14001)
self:AddTimer(1, 1.66, function()
self.bBossEncountered = true
self:ShowQTE()
self._mapNode.txt_Score1.gameObject:SetActive(self.bBossEncountered)
self._mapNode.txt_Score.gameObject:SetActive(self.bBossEncountered)
self.nBossScore = 0
NovaAPI.SetTMPText(self._mapNode.txt_Score, "+" .. tostring(self.nBossScore))
end, true, true, true)
end
function MathParkourCtrl:OnEvent_Confirm()
if NovaAPI.GetCurrentModuleName() == "MainMenuModuleScene" then
CS.AdventureModuleHelper.LevelStateChanged(true, 0, false)
EventManager.Hit(EventId.CloesCurPanel)
PlayerData.Base:OnBackToMainMenuModule()
else
NovaAPI.EnterModule("MainMenuModuleScene", true)
end
end
function MathParkourCtrl:OnEvent_Again()
NovaAPI.DispatchEventWithData("MathParkour_Restart", nil, nil)
self:InitData()
self:UpdatePanelData()
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, 0)
end
function MathParkourCtrl:OnEvent_GoNextLevel()
local nNextLevelId = self.actData:GetNextLevelId(self.nLevelId)
if nNextLevelId == nil then
return
end
WwiseAudioMgr:PostEvent("Mode_400018_all_stop")
self.nLevelId = nNextLevelId
self:AddTimer(1, 0.1, function()
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, 0)
end, true, true, true)
self:InitData()
self:UpdatePanelData()
local param = {}
table.insert(param, tostring(self.nActId))
table.insert(param, tostring(self.CurLevelData.nId))
table.insert(param, tostring(0))
CS.MiniGameHelper.SetMiniGameData(param)
NovaAPI.DispatchEventWithData("MathParkour_NextLevel", nil, nil)
end
function MathParkourCtrl:OnEvent_Exit()
WwiseAudioMgr:PostEvent("Mode_400018_all_stop")
if NovaAPI.GetCurrentModuleName() == "MainMenuModuleScene" then
CS.AdventureModuleHelper.LevelStateChanged(true, 0, false)
EventManager.Hit(EventId.CloesCurPanel)
PlayerData.Base:OnBackToMainMenuModule()
else
NovaAPI.EnterModule("MainMenuModuleScene", true)
end
end
function MathParkourCtrl:OnEvent_Restart()
WwiseAudioMgr:PostEvent("Mode_400018_all_stop")
self._mapNode.goPause:Close()
NovaAPI.DispatchEventWithData("MathParkour_Restart", nil, nil)
self:AddTimer(1, 0.1, function()
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, 0)
end, true, true, true)
self:InitData()
self:UpdatePanelData()
end
function MathParkourCtrl:OnEvent_Continue()
self._mapNode.goPause:Close()
self.bPause = false
if self:IsLogicPaused() then
return
end
self:ApplyLogicPause(false)
end
function MathParkourCtrl:OnEvent_EnterLevel()
local animator = self.gameObject:GetComponent("Animator")
if animator ~= nil then
animator:Play("MathParkourPanel_in")
end
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, 1)
self:StartGame()
end
function MathParkourCtrl:OnEvent_BlockInput(bBlock)
EventManager.Hit(EventId.BlockInput, bBlock)
end
function MathParkourCtrl:OnEvent_GMRemoveBuff(nBuffId)
self:RemoveBuff(nBuffId)
end
function MathParkourCtrl:OnEvent_GMToggleBuffOverlay()
self.bGMBuffOverlay = not self.bGMBuffOverlay
if self.bGMBuffOverlay then
self:EnsureGMBuffOverlay()
self:RefreshGMBuffOverlay()
if self.gmOverlayTimer == nil then
self.gmOverlayTimer = self:AddTimer(0, 0.5, function()
if self.bGMBuffOverlay then
self:RefreshGMBuffOverlay()
end
end, true, true, true)
else
self.gmOverlayTimer:Pause(false)
end
else
if self.goGMBuffOverlay ~= nil and not self.goGMBuffOverlay:IsNull() then
self.goGMBuffOverlay:SetActive(false)
end
if self.gmOverlayTimer ~= nil then
self.gmOverlayTimer:Pause(true)
end
end
end
local GM_OVERLAY_COL_MAX = 4
local GetGMOverlayFont = function(trParent)
local srcTxt = trParent:GetComponentInChildren(typeof(CS.UnityEngine.UI.Text))
if srcTxt ~= nil and srcTxt.font ~= nil then
return srcTxt.font
end
local ok, builtinFont = pcall(function()
return CS.UnityEngine.Resources.GetBuiltinResource(typeof(CS.UnityEngine.Font), "LegacyRuntime.ttf")
end)
if ok then
return builtinFont
end
return nil
end
local CreateGMOverlayText = function(goParent, sName, font)
local go = CS.UnityEngine.GameObject(sName, typeof(CS.UnityEngine.RectTransform))
go.layer = goParent.layer
go.transform:SetParent(goParent.transform, false)
local txt = go:AddComponent(typeof(CS.UnityEngine.UI.Text))
txt.fontSize = 22
txt.color = CS.UnityEngine.Color.black
txt.alignment = CS.UnityEngine.TextAnchor.UpperLeft
txt.horizontalOverflow = CS.UnityEngine.HorizontalWrapMode.Overflow
txt.verticalOverflow = CS.UnityEngine.VerticalWrapMode.Overflow
txt.raycastTarget = false
if font ~= nil then
txt.font = font
end
return txt
end
local StretchGMOverlayText = function(txt, nAnchorMinX, nAnchorMaxX)
local rt = txt:GetComponent("RectTransform")
rt.anchorMin = Vector2(nAnchorMinX, 0)
rt.anchorMax = Vector2(nAnchorMaxX, 1)
rt.pivot = Vector2(0.5, 1)
rt.offsetMin = Vector2(8, 0)
rt.offsetMax = Vector2(-8, 0)
end
function MathParkourCtrl:EnsureGMBuffOverlay()
if self.goGMBuffOverlay ~= nil and not self.goGMBuffOverlay:IsNull() and self.txtGMBuffOverlayRight ~= nil then
self.goGMBuffOverlay:SetActive(true)
return
end
if self.goGMBuffOverlay ~= nil and not self.goGMBuffOverlay:IsNull() then
destroy(self.goGMBuffOverlay)
end
local parent = self._mapNode.canvasGroup.transform
local go = CS.UnityEngine.GameObject("GMBuffOverlay", typeof(CS.UnityEngine.RectTransform))
go.layer = parent.gameObject.layer
go.transform:SetParent(parent, false)
local rt = go:GetComponent("RectTransform")
rt.anchorMin = Vector2(0.5, 0.5)
rt.anchorMax = Vector2(0.5, 0.5)
rt.pivot = Vector2(0.5, 1)
rt.anchoredPosition = Vector2(0, -90)
rt.sizeDelta = Vector2(560, 180)
local font = GetGMOverlayFont(parent)
local txtLeft = CreateGMOverlayText(go, "txtLeft", font)
local txtRight = CreateGMOverlayText(go, "txtRight", font)
StretchGMOverlayText(txtLeft, 0, 1)
StretchGMOverlayText(txtRight, 0.5, 1)
txtRight.gameObject:SetActive(false)
self.goGMBuffOverlay = go
self.txtGMBuffOverlay = txtLeft
self.txtGMBuffOverlayRight = txtRight
end
function MathParkourCtrl:RefreshGMBuffOverlay()
if self.txtGMBuffOverlay == nil then
return
end
local tbLines = {}
for nBuffId, buffCtrl in pairs(self.tbUsedBuffItem) do
local buffCfg = ConfigTable.GetData("MathParkourBuffItem", nBuffId)
local sName = buffCfg ~= nil and buffCfg.Name or tostring(nBuffId)
local nTime = buffCtrl.nCurTime or 0
table.insert(tbLines, {
nId = nBuffId,
sText = string.format("%s %02d:%02d", sName, math.floor(nTime / 60), nTime % 60)
})
end
table.sort(tbLines, function(a, b)
return a.nId < b.nId
end)
local JoinLines = function(nFrom, nTo)
local s = "当前效果:\n"
if nTo < nFrom then
return s .. "(无)"
end
for i = nFrom, nTo do
s = s .. tbLines[i].sText .. "\n"
end
return s
end
local nCount = #tbLines
local bTwoCol = nCount > GM_OVERLAY_COL_MAX
if not bTwoCol then
StretchGMOverlayText(self.txtGMBuffOverlay, 0, 1)
self.txtGMBuffOverlay.alignment = CS.UnityEngine.TextAnchor.UpperCenter
NovaAPI.SetText(self.txtGMBuffOverlay, JoinLines(1, nCount))
if self.txtGMBuffOverlayRight ~= nil then
self.txtGMBuffOverlayRight.gameObject:SetActive(false)
end
return
end
local nLeft = math.ceil(nCount / 2)
StretchGMOverlayText(self.txtGMBuffOverlay, 0, 0.5)
self.txtGMBuffOverlay.alignment = CS.UnityEngine.TextAnchor.UpperLeft
NovaAPI.SetText(self.txtGMBuffOverlay, JoinLines(1, nLeft))
self.txtGMBuffOverlayRight.gameObject:SetActive(true)
self.txtGMBuffOverlayRight.alignment = CS.UnityEngine.TextAnchor.UpperLeft
local sRight = ""
for i = nLeft + 1, nCount do
sRight = sRight .. tbLines[i].sText .. "\n"
end
NovaAPI.SetText(self.txtGMBuffOverlayRight, "\n" .. sRight)
end
function MathParkourCtrl:ClearGMBuffOverlay()
self.bGMBuffOverlay = false
if self.gmOverlayTimer ~= nil then
self.gmOverlayTimer:Cancel()
self.gmOverlayTimer = nil
end
if self.goGMBuffOverlay ~= nil and not self.goGMBuffOverlay:IsNull() then
destroy(self.goGMBuffOverlay)
end
self.goGMBuffOverlay = nil
self.txtGMBuffOverlay = nil
self.txtGMBuffOverlayRight = nil
end
return MathParkourCtrl
@@ -0,0 +1,162 @@
local MathParkourLevelDetailCtrl = class("MathParkourLevelDetailCtrl", BaseCtrl)
local AssetPath = "UI_Activity/_400018/SpriteAtlas/"
MathParkourLevelDetailCtrl._mapNodeConfig = {
txt_LevelName = {sComponentName = "TMP_Text"},
txt_detailDesc = {sComponentName = "TMP_Text"},
txt_ScoreTitle = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_ScoreTitle"
},
txt_MaxScore = {sComponentName = "TMP_Text"},
txt_Title1 = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Title1"
},
txt_Title2 = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Title2"
},
listReward = {
sComponentName = "LoopScrollView"
},
rtReward1 = {},
btn_item = {nCount = 4},
btn_firstPassItem = {sComponentName = "UIButton"},
firstPassItem = {
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
},
btn_threePassItem = {sComponentName = "UIButton"},
threePassItem = {
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
},
btn_Go = {
sComponentName = "UIButton",
callback = "OnBtnClick_Go"
},
txtBtnGo = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Go"
}
}
MathParkourLevelDetailCtrl._mapEventConfig = {}
MathParkourLevelDetailCtrl._mapRedDotConfig = {}
function MathParkourLevelDetailCtrl:Awake()
self.animator = self.gameObject:GetComponent("Animator")
end
function MathParkourLevelDetailCtrl:OnEnable()
end
function MathParkourLevelDetailCtrl:OnDisable()
end
function MathParkourLevelDetailCtrl:OnDestroy()
self:Clear()
end
function MathParkourLevelDetailCtrl:Clear()
if self.tbItemCtrl ~= nil then
for _, ctrl in pairs(self.tbItemCtrl) do
self:UnbindCtrlByNode(ctrl)
end
end
self.tbItemCtrl = {}
end
function MathParkourLevelDetailCtrl:ShowPanel(nActId, levelData)
self.nActId = nActId
self.levelData = levelData
local config = ConfigTable.GetData("MathParkourLevel", levelData.nId)
if config == nil then
return
end
NovaAPI.SetTMPText(self._mapNode.txt_LevelName, config.Title)
NovaAPI.SetTMPText(self._mapNode.txt_detailDesc, config.Desc)
NovaAPI.SetTMPText(self._mapNode.txt_MaxScore, levelData.nScore)
local buffItem = config.DropItemList
self._mapNode.listReward.gameObject:SetActive(4 < #buffItem)
self._mapNode.rtReward1.gameObject:SetActive(#buffItem <= 4)
if 4 < #buffItem then
self._mapNode.listReward:Init(#buffItem, self, self.OnGridRefresh, self.OnGridBtnClick, false)
else
for i = 1, 4 do
if i <= #buffItem then
local btn_item = self._mapNode.btn_item[i]
btn_item.gameObject:SetActive(true)
local itemId = buffItem[i]
local buffCfg = ConfigTable.GetData("MathParkourBuffItem", itemId)
if buffCfg ~= nil then
local imgIcon = btn_item.transform:Find("AnimRoot/item/AnimRoot/imgIcon"):GetComponent("Image")
if buffCfg.Icon ~= "" then
self:SetPngSprite(imgIcon, AssetPath .. buffCfg.Icon)
end
local btn = btn_item.gameObject:GetComponent("UIButton")
btn.onClick:RemoveAllListeners()
btn.onClick:AddListener(function()
local msgData = {
Title = buffCfg.Name,
Desc = {
buffCfg.Desc or ""
}
}
EventManager.Hit(EventId.OpenPanel, PanelId.DescTips, btn.transform, msgData)
end)
end
else
self._mapNode.btn_item[i].gameObject:SetActive(false)
end
end
end
self._mapNode.btn_firstPassItem.gameObject:SetActive(config.Reward1Id)
if config.Reward1Id > 0 then
self._mapNode.firstPassItem:SetItem(config.Reward1Id, nil, config.Reward1Count, false, 0 < levelData.nStar, true)
self._mapNode.btn_firstPassItem.onClick:RemoveAllListeners()
self._mapNode.btn_firstPassItem.onClick:AddListener(function()
UTILS.ClickItemGridWithTips(config.Reward1Id, self._mapNode.btn_firstPassItem.transform, true, true, false)
end)
end
self._mapNode.btn_threePassItem.gameObject:SetActive(config.Reward3Id)
if 0 < config.Reward3Id then
self._mapNode.threePassItem:SetItem(config.Reward3Id, nil, config.Reward3Count, false, levelData.nStar >= 3, false, true)
self._mapNode.btn_threePassItem.onClick:RemoveAllListeners()
self._mapNode.btn_threePassItem.onClick:AddListener(function()
UTILS.ClickItemGridWithTips(config.Reward3Id, self._mapNode.btn_threePassItem.transform, true, true, false)
end)
end
self.gameObject:SetActive(true)
if self.animator ~= nil then
self.animator:Play("LevelDetailsPanel_in")
end
end
function MathParkourLevelDetailCtrl:ClosePanel()
self.gameObject:SetActive(false)
self:Clear()
end
function MathParkourLevelDetailCtrl:OnGridRefresh(goGrid, gridIndex)
local nIndex = gridIndex + 1
local nInstanceId = goGrid:GetInstanceID()
local item = goGrid.transform:Find("btn_itemTemp/AnimRoot/item")
if not self.tbItemCtrl[nInstanceId] then
self.tbItemCtrl[nInstanceId] = self:BindCtrlByNode(item, "Game.UI.TemplateEx.TemplateItemCtrl")
end
local config = ConfigTable.GetData("MathParkourLevel", self.levelData.nId)
if config == nil then
return
end
local itemId = config.DropItemList[nIndex]
self.tbItemCtrl[nInstanceId]:SetItem(itemId)
end
function MathParkourLevelDetailCtrl:OnGridBtnClick(go, nIndex)
local nIndex = nIndex + 1
local config = ConfigTable.GetData("MathParkourLevel", self.levelData.nId)
if config == nil then
return
end
local itemId = config.DropItemList[nIndex]
UTILS.ClickItemGridWithTips(itemId, go.transform, true, true, false)
end
function MathParkourLevelDetailCtrl:OnBtnClick_Go()
local param = {}
table.insert(param, tostring(self.nActId))
table.insert(param, tostring(self.levelData.nId))
table.insert(param, tostring(0))
CS.MiniGameHelper.SetMiniGameData(param)
NovaAPI.EnterModule("MathParkourModuleScene", true, 56)
EventManager.Hit(EventId.OpenPanel, PanelId.MathParkourPanel, self.nActId, self.levelData.nId)
end
return MathParkourLevelDetailCtrl
@@ -0,0 +1,268 @@
local MathParkourLevelSelectCtrl = class("MathParkourLevelSelectCtrl", BaseCtrl)
local SpineManager = require("Game.Spine.SpineManager")
local layoutRight = 915
local layoutRightDefault = 322
local layoutMax = -427
MathParkourLevelSelectCtrl._mapNodeConfig = {
TopBar = {
sNodeName = "TopBarPanel",
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
},
btnCloseBg = {
sComponentName = "UIButton",
callback = "OnBtnClick_CloseBg"
},
togRoot = {nCount = 7},
btnTask = {
sComponentName = "UIButton",
callback = "OnBtnClick_Task"
},
txtTask = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_QuestTitle"
},
Sp_BookScene = {
sComponentName = "RectTransform"
},
Sp_BookSceneFront = {
sComponentName = "RectTransform"
},
rt_Toggle = {},
srToggle = {
sComponentName = "UIScrollRect"
},
rt_ToggleTrans = {
sNodeName = "rt_Toggle",
sComponentName = "RectTransform"
},
levelDetail = {
sNodeName = "LevelDetailsPanel",
sCtrlName = "Game.UI.Activity.MathParkour.MathParkourLevelDetailCtrl"
},
charSpine = {sNodeName = "Sp_char"},
reward_reddot = {}
}
MathParkourLevelSelectCtrl._mapEventConfig = {
MathParkourLevelUpdate = "OnEvent_LevelUpdate"
}
MathParkourLevelSelectCtrl._mapRedDotConfig = {}
function MathParkourLevelSelectCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
end
end
function MathParkourLevelSelectCtrl:OnEnable()
self._mapNode.rt_Toggle.gameObject:SetActive(false)
local aniamtor = self.gameObject:GetComponent("Animator")
if aniamtor ~= nil then
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
aniamtor:Play("MathParkourLevelsSelect_in")
self._mapNode.rt_Toggle.gameObject:SetActive(true)
end
cs_coroutine.start(wait)
end
self._mapNode.Sp_BookSceneFront.gameObject:SetActive(true)
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
if bInActGroup then
local mapActivityData = ConfigTable.GetData("Activity", self.nActId)
local actGroupId = mapActivityData.MidGroupId
local actGroupData = PlayerData.Activity:GetActivityGroupDataById(actGroupId)
local taskActId = actGroupData:GetActivityDataByIndex(AllEnum.ActivityThemeFuncIndex.Task).ActivityId
local taskActData = PlayerData.Activity:GetActivityDataById(taskActId)
if taskActData ~= nil and taskActData:CheckActivityOpen() then
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task_Group, {
nActGroupId,
taskActId,
mapActivityData.MiniGameRedDot
}, self._mapNode.reward_reddot)
end
end
self:RefreshLevelList()
self._mapNode.levelDetail:ClosePanel()
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, 194, layoutRightDefault, -32, 0)
self._mapNode.Sp_BookScene.localPosition = Vector3(0, self._mapNode.Sp_BookScene.localPosition.y, 0)
self._mapNode.rt_ToggleTrans.localPosition = Vector3(0, self._mapNode.rt_ToggleTrans.localPosition.y, 0)
if 0 < self._panel.nSelectIndex then
local cacheLevelId = self.actData:GetCacheLevelId()
if cacheLevelId ~= nil then
for i, v in ipairs(self.tbLevelData) do
if v.nId == cacheLevelId then
self._panel.nSelectIndex = i
self.actData:ClearCacheLevelId()
break
end
end
end
self:AddTimer(1, 1.5, function()
self:ShowDetail(self.tbLevelData[self._panel.nSelectIndex], self._panel.nSelectIndex, false)
local imgSelect = self._mapNode.togRoot[self._panel.nSelectIndex].transform:Find("tog/AnimRoot/AnimSwitch/imgSelect")
imgSelect.gameObject:SetActive(true)
if self._panel.nSelectIndex > 4 then
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, 194, layoutRight, -32, 0)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
local moveTime = 0.2
local moveX = -325 - 340 * (self._panel.nSelectIndex - 5)
self._mapNode.rt_ToggleTrans:DOLocalMoveX(moveX, moveTime)
self._mapNode.Sp_BookScene:DOLocalMoveX(moveX, moveTime)
end
cs_coroutine.start(wait)
end
end, true, true, true)
EventManager.Hit(EventId.TemporaryBlockInput, 1.5)
else
EventManager.Hit(EventId.TemporaryBlockInput, 1)
end
SpineManager.PlayAnim(self._mapNode.Sp_BookScene.gameObject, "in", false)
SpineManager.PlayAnim(self._mapNode.Sp_BookSceneFront, "in_Front", false)
self:AddTimer(1, 1, function()
SpineManager.PlayAnim(self._mapNode.Sp_BookScene.gameObject, "idle", true)
self._mapNode.Sp_BookSceneFront.gameObject:SetActive(false)
end, true, true, true)
function self.onScrollValueChanged(value)
self._mapNode.Sp_BookScene.localPosition = Vector3(self._mapNode.rt_ToggleTrans.localPosition.x, self._mapNode.Sp_BookScene.localPosition.y, 0)
end
self._mapNode.srToggle.onValueChanged:AddListener(self.onScrollValueChanged)
SpineManager.PlayAnim(self._mapNode.charSpine, "in", false)
self:AddTimer(1, 0.9, function()
SpineManager.PlayAnim(self._mapNode.charSpine, "idle", true)
end, true, true, true)
end
function MathParkourLevelSelectCtrl:OnDisable()
if self.onScrollValueChanged ~= nil then
self._mapNode.srToggle.onValueChanged:RemoveListener(self.onScrollValueChanged)
self.onScrollValueChanged = nil
end
end
function MathParkourLevelSelectCtrl:RefreshLevelList()
self.actData = PlayerData.Activity:GetActivityDataById(self.nActId)
if self.actData == nil then
return
end
self.tbLevelData = self.actData:GetAllLevelData()
for i = 1, 7 do
local levelData = self.tbLevelData[i]
if levelData ~= nil then
self:SetLevelToggle(levelData, self._mapNode.togRoot[i], i)
self._mapNode.togRoot[i]:SetActive(true)
else
self._mapNode.togRoot[i]:SetActive(false)
end
end
end
function MathParkourLevelSelectCtrl:OnEvent_LevelUpdate()
self:RefreshLevelList()
end
function MathParkourLevelSelectCtrl:OnDestroy()
if PlayerData.Activity:IsActivityInActivityGroup(self.nActId) then
local mapActivityData = ConfigTable.GetData("Activity", self.nActId)
local actGroupId = mapActivityData.MidGroupId
local actGroupData = PlayerData.Activity:GetActivityGroupDataById(actGroupId)
local taskActId = actGroupData:GetActivityDataByIndex(AllEnum.ActivityThemeFuncIndex.Task).ActivityId
local taskActData = PlayerData.Activity:GetActivityDataById(taskActId)
if taskActData ~= nil and taskActData:CheckActivityOpen() then
RedDotManager.UnRegisterNode(RedDotDefine.Activity_Group_Task_Group, {
actGroupId,
taskActId,
mapActivityData.MiniGameRedDot
}, self._mapNode.reward_reddot)
return
end
end
end
function MathParkourLevelSelectCtrl:SetLevelToggle(levelData, toggle, nIndex)
local rt_Targets = toggle.transform:Find("tog/grpText/rt_Targets")
local rtLockPreLv = toggle.transform:Find("tog/grpText/rtLockPreLv")
local txt_Open = toggle.transform:Find("tog/AnimRoot/AnimSwitch/txt_Open"):GetComponent("TextMeshProUGUI")
local txt_Lock = toggle.transform:Find("tog/AnimRoot/AnimSwitch/txt_Lock"):GetComponent("TextMeshProUGUI")
local levelUnlock = self.actData:GetLevelUnlock(levelData.nId)
local tog = toggle.transform:Find("tog"):GetComponent("UIButton")
tog.onClick:RemoveAllListeners()
rt_Targets.gameObject:SetActive(levelUnlock)
rtLockPreLv.gameObject:SetActive(not levelUnlock)
txt_Open.gameObject:SetActive(levelUnlock)
txt_Lock.gameObject:SetActive(not levelUnlock)
local sLevelIndex = string.format("%02d", nIndex)
NovaAPI.SetTMPText(txt_Open, sLevelIndex)
NovaAPI.SetTMPText(txt_Lock, sLevelIndex)
local imgSelect = toggle.transform:Find("tog/AnimRoot/AnimSwitch/imgSelect")
imgSelect.gameObject:SetActive(false)
if not levelUnlock then
return
end
for i = 1, 3 do
local btnTarget = rt_Targets.transform:Find("btnTarget" .. i):GetComponent("Button")
btnTarget.interactable = i <= levelData.nStar
end
tog.onClick:AddListener(function()
self:ShowDetail(levelData, nIndex, true)
imgSelect.gameObject:SetActive(true)
end)
local bNewDot = toggle.transform:Find("tog/AnimRoot/AnimSwitch/redH")
RedDotManager.RegisterNode(RedDotDefine.Activity_MathParkour_New_Level, {
self.nActId,
levelData.nId
}, bNewDot)
end
function MathParkourLevelSelectCtrl:ShowDetail(levelData, nIndex, bScroll)
local tempIndex = self._panel.nSelectIndex
if 0 < tempIndex then
local imgSelect = self._mapNode.togRoot[tempIndex].transform:Find("tog/AnimRoot/AnimSwitch/imgSelect")
imgSelect.gameObject:SetActive(false)
end
self._panel.nSelectIndex = nIndex
self._mapNode.levelDetail:ShowPanel(self.nActId, levelData)
if bScroll and 4 < nIndex then
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, 194, layoutRight, -32, 0)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
local moveTime = 0.2
local moveX = -325 - 340 * (nIndex - 5)
self._mapNode.rt_ToggleTrans:DOLocalMoveX(moveX, moveTime)
self._mapNode.Sp_BookScene:DOLocalMoveX(moveX, moveTime)
end
cs_coroutine.start(wait)
end
end
function MathParkourLevelSelectCtrl:OnBtnClick_CloseBg()
local tempIndex = self._panel.nSelectIndex
if 0 < tempIndex then
local imgSelect = self._mapNode.togRoot[tempIndex].transform:Find("tog/AnimRoot/AnimSwitch/imgSelect")
imgSelect.gameObject:SetActive(false)
end
self._panel.nSelectIndex = 0
self._mapNode.levelDetail:ClosePanel()
local moveTime = 0.2
EventManager.Hit(EventId.TemporaryBlockInput, moveTime)
local layout = layoutRight
self.tweener = DOTween.To(function()
return layout
end, function(v)
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, 194, math.floor(v), -32, 0)
end, layoutRightDefault, moveTime):OnComplete(function()
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, 194, layoutRightDefault, -32, 0)
end)
end
function MathParkourLevelSelectCtrl:OnBtnClick_Task()
if PlayerData.Activity:IsActivityInActivityGroup(self.nActId) then
local mapActivityData = ConfigTable.GetData("Activity", self.nActId)
local actGroupId = mapActivityData.MidGroupId
local actGroupData = PlayerData.Activity:GetActivityGroupDataById(actGroupId)
local taskActId = actGroupData:GetActivityDataByIndex(AllEnum.ActivityThemeFuncIndex.Task).ActivityId
local taskActData = PlayerData.Activity:GetActivityDataById(taskActId)
if taskActData ~= nil and taskActData:CheckActivityOpen() then
EventManager.Hit(EventId.OpenPanel, PanelId.Task_20104, taskActId, GameEnum.ActivityTaskTabType.Tab4)
return
end
RedDotManager.UnRegisterNode(RedDotDefine.Activity_Group_Task_Group, {
actGroupId,
taskActId,
mapActivityData.MiniGameRedDot
}, self._mapNode.reward_reddot)
self._mapNode.reward_reddot:SetActive(false)
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
end
end
return MathParkourLevelSelectCtrl
@@ -0,0 +1,80 @@
local MathParkourPauseCtrl = class("MathParkourPauseCtrl", BaseCtrl)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
MathParkourPauseCtrl._mapNodeConfig = {
blur = {},
txt_title = {
sComponentName = "TMP_Text",
sLanguageId = "TowerDef_Text_Pause"
},
txt_exit = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "TowerDef_Button_Leave"
},
txt_restart = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "TowerDef_Button_Re"
},
txt_continue = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "TowerDef_Button_Back"
},
txt_dic = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "Tutorial_DicTitle"
},
btn_exit = {
sComponentName = "NaviButton",
callback = "OnBtnClick_Exit",
sAction = "Giveup"
},
btn_restart = {
sComponentName = "NaviButton",
callback = "OnBtnClick_Restart",
sAction = "Retry"
},
btn_continue = {
sComponentName = "NaviButton",
callback = "OnBtnClick_Continue",
sAction = "Back"
},
btn_dic = {
sComponentName = "NaviButton",
callback = "OnBtnClick_OpenDic",
sAction = "Depot"
}
}
MathParkourPauseCtrl._mapEventConfig = {}
MathParkourPauseCtrl._mapRedDotConfig = {}
function MathParkourPauseCtrl:Awake()
end
function MathParkourPauseCtrl:Open(nDicId)
self.nDicId = nDicId
self.gameObject:SetActive(true)
self._mapNode.btn_dic.gameObject:SetActive(0 < nDicId)
self.tbGamepadUINode = self:GetGamepadUINode()
GamepadUIManager.EnableGamepadUI("MathParkourPauseCtrl", self.tbGamepadUINode, nil, false)
end
function MathParkourPauseCtrl:Close()
GamepadUIManager.DisableGamepadUI("MathParkourPauseCtrl")
self.gameObject:SetActive(false)
end
function MathParkourPauseCtrl:OnBtnClick_Exit()
EventManager.Hit("MathParkour_Exit_OnClick")
end
function MathParkourPauseCtrl:OnBtnClick_Restart()
EventManager.Hit("MathParkour_Restart_OnClick")
end
function MathParkourPauseCtrl:OnBtnClick_Continue()
EventManager.Hit("MathParkour_Continue_OnClick")
end
function MathParkourPauseCtrl:OnBtnClick_OpenDic()
if self.nDicId == 0 then
return
end
EventManager.Hit(EventId.OpenPanel, PanelId.DictionaryEntry, self.nDicId, true)
end
return MathParkourPauseCtrl
@@ -0,0 +1,45 @@
local MathParkourResultFailCtrl = class("MathParkourResultFailCtrl", BaseCtrl)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
MathParkourResultFailCtrl._mapNodeConfig = {
txtCompleteTipsPrev1 = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Text_CompleteTipsPrev"
},
txt_Complete = {sComponentName = "TMP_Text"},
btn_Confirm = {
sComponentName = "UIButton",
callback = "OnBtnClick_Confirm"
},
txt_confirm = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Text_Confirm"
},
btn_Again = {
sComponentName = "UIButton",
callback = "OnBtnClick_Again"
},
txt_again = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Text_Again"
}
}
MathParkourResultFailCtrl._mapEventConfig = {}
MathParkourResultFailCtrl._mapRedDotConfig = {}
function MathParkourResultFailCtrl:ShowPanel(nScore)
self.gameObject:SetActive(true)
NovaAPI.SetTMPText(self._mapNode.txt_Complete, nScore)
self.tbGamepadUINode = self:GetGamepadUINode()
GamepadUIManager.EnableGamepadUI("MathParkourResultFailCtrl", self.tbGamepadUINode, nil, true)
end
function MathParkourResultFailCtrl:HidePanel()
self.gameObject:SetActive(false)
end
function MathParkourResultFailCtrl:OnBtnClick_Confirm()
GamepadUIManager.DisableGamepadUI("MathParkourResultFailCtrl")
EventManager.Hit("MathParkour_Confirm")
end
function MathParkourResultFailCtrl:OnBtnClick_Again()
GamepadUIManager.DisableGamepadUI("MathParkourResultFailCtrl")
EventManager.Hit("MathParkour_Again")
end
return MathParkourResultFailCtrl
@@ -0,0 +1,67 @@
local MathParkourResultSuccessCtrl = class("MathParkourResultSuccessCtrl", BaseCtrl)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
MathParkourResultSuccessCtrl._mapNodeConfig = {
txtCompleteTipsPrev1 = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_StarTitle"
},
ScoreStar = {nCount = 3},
txtCompleteTipsPrev2 = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Text_CompleteTipsPrev"
},
txt_Complete = {sComponentName = "TMP_Text"},
txt_curScore = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Text_NewScore"
},
btn_Confirm = {
sComponentName = "UIButton",
callback = "OnBtnClick_Confirm"
},
txt_confirm = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Text_Confirm"
},
btn_Nextlevel = {
sComponentName = "UIButton",
callback = "OnBtnClick_NextLevel"
},
txt_nextlevel = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_Text_NextLevel"
}
}
MathParkourResultSuccessCtrl._mapEventConfig = {}
MathParkourResultSuccessCtrl._mapRedDotConfig = {}
function MathParkourResultSuccessCtrl:ShowPanel(nScore, bNew, nStarCount, bCanNextLevel, nActId)
self.gameObject:SetActive(true)
NovaAPI.SetTMPText(self._mapNode.txt_Complete, nScore)
self._mapNode.txt_curScore.gameObject:SetActive(bNew)
for i = 1, 3 do
self._mapNode.ScoreStar[i].gameObject:SetActive(i <= nStarCount)
end
bCanNextLevel = bCanNextLevel or false
self._mapNode.btn_Nextlevel.gameObject:SetActive(bCanNextLevel)
self.actData = PlayerData.Activity:GetActivityDataById(nActId)
if self.actData ~= nil then
EventManager.Hit(EventId.TemporaryBlockInput, 1)
self:AddTimer(1, 1, function()
self.actData:OpenTempChangeInfo()
end, true, true, true)
end
self.tbGamepadUINode = self:GetGamepadUINode()
GamepadUIManager.EnableGamepadUI("MathParkourResultSuccessCtrl", self.tbGamepadUINode, nil, true)
end
function MathParkourResultSuccessCtrl:HidePanel()
self.gameObject:SetActive(false)
end
function MathParkourResultSuccessCtrl:OnBtnClick_Confirm()
GamepadUIManager.DisableGamepadUI("MathParkourResultSuccessCtrl")
EventManager.Hit("MathParkour_Confirm")
end
function MathParkourResultSuccessCtrl:OnBtnClick_NextLevel()
GamepadUIManager.DisableGamepadUI("MathParkourResultSuccessCtrl")
EventManager.Hit("MathParkour_NextLevel")
end
return MathParkourResultSuccessCtrl
@@ -0,0 +1,113 @@
local MathParkourSkillDisplayCtrl = class("MathParkourSkillDisplayCtrl", BaseCtrl)
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
local ResTypeAny = GameResourceLoader.ResType.Any
local Path = require("path")
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
local LocalSettingData = require("GameCore.Data.LocalSettingData")
MathParkourSkillDisplayCtrl._mapNodeConfig = {
DisplayParent = {},
imgBgChar = {sComponentName = "Image"},
imgBgPortrait = {sComponentName = "Image"},
DisplayL2d = {sComponentName = "RawImage"},
animRoot = {sComponentName = "Animator", sNodeName = "animove"},
imgBgCharL2d = {}
}
MathParkourSkillDisplayCtrl._mapEventConfig = {
MathParkour_CastAssistSkill = "OnEvent_CastAssistSkill",
MathParkour_CastAssistSkillPause = "OnEvent_CastAssistSkillPause"
}
MathParkourSkillDisplayCtrl._mapRedDotConfig = {}
function MathParkourSkillDisplayCtrl:Awake()
end
function MathParkourSkillDisplayCtrl:OnEnable()
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.DisplayParent:SetActive(true)
NovaAPI.SetMaskAllDirty(self._mapNode.imgBgCharL2d)
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.DisplayParent:SetActive(false)
end
cs_coroutine.start(wait)
end
function MathParkourSkillDisplayCtrl:OnDisable()
end
function MathParkourSkillDisplayCtrl:OnDestroy()
self.tbInterruptedDisplay = nil
Actor2DManager.UnsetActor2D(false, 1, true)
end
function MathParkourSkillDisplayCtrl:InterrputAllDisplay()
self:InterrputAnim()
end
function MathParkourSkillDisplayCtrl:InterrputAnim()
if self.timer ~= nil then
self.timer:Cancel(false)
self.timer = nil
end
Actor2DManager.UnsetActor2D(false, 1, true)
self.callback = nil
self._mapNode.DisplayParent:SetActive(false)
end
function MathParkourSkillDisplayCtrl:UltimateDisplay(nCharId, nSkinId)
self:InitL2dRes(nCharId, nSkinId)
self:ShowSkill(nCharId, nSkinId)
end
function MathParkourSkillDisplayCtrl:InitL2dRes(nCharId, nSkinId)
local mapSkin = ConfigTable.GetData_CharacterSkin(nSkinId)
local sBodyName = string.format("%s_001", nSkinId)
self.LoadSprite(self._mapNode.imgBgPortrait, mapSkin.Portrait, sBodyName)
local mapCharDescCfg = ConfigTable.GetData("CharacterDes", nCharId)
local sColor
if mapCharDescCfg == nil then
sColor = ""
else
sColor = mapCharDescCfg.CharSkillColor == "" and mapCharDescCfg.CharColor or mapCharDescCfg.CharSkillColor
end
local _b, _color = ColorUtility.TryParseHtmlString(sColor)
NovaAPI.SetImageColor(self._mapNode.imgBgChar, _color)
end
function MathParkourSkillDisplayCtrl.LoadSprite(imgObj, sPath, sName)
local _sPath = string.format("%s/atlas_png/a/%s.png", Path.dirname(sPath), sName)
NovaAPI.SetImageSprite(imgObj, Settings.AB_ROOT_PATH .. _sPath)
end
function MathParkourSkillDisplayCtrl:ShowSkill(nCharId, nSkinId, callback)
if self.timer ~= nil then
self.timer:Cancel(false)
self.timer = nil
end
WwiseAudioMgr:PostEvent("ui_tip_support_ult")
self._mapNode.DisplayParent:SetActive(true)
NovaAPI.SetMaskAllDirty(self._mapNode.imgBgCharL2d)
self._mapNode.animRoot:Play("Empty")
self._mapNode.animRoot:Play("SubskillDisplay_moves_1")
self.gameObject.transform.localScale = Vector3.one
Actor2DManager.SetActor2D_ForSubSKill(PanelId.SubSkillDisplay, self._mapNode.DisplayL2d, nCharId, nSkinId, nil, nIdx)
Actor2DManager.PlayAnim("ultra", true, 1)
self.callback = callback
self.timer = self:AddTimer(1, 1.5, "ShowEnd", true, true, true, true)
end
function MathParkourSkillDisplayCtrl:ShowEnd()
if self.callback ~= nil and type(self.callback) == "function" then
self.callback()
end
Actor2DManager.UnsetActor2D(false, 1)
self.callback = nil
self._mapNode.DisplayParent:SetActive(false)
self.timer = nil
end
function MathParkourSkillDisplayCtrl:OnEvent_CastAssistSkillPause(bPause)
if bPause then
if self.callback ~= nil and type(self.callback) == "function" then
self.callback()
end
self:InterrputAllDisplay()
end
end
function MathParkourSkillDisplayCtrl:OnEvent_CastAssistSkill(nCharId, nSkinId)
self.UseLive2D = LocalSettingData.mapData.UseLive2D
if not (nCharId and nSkinId) or not self.UseLive2D then
return
end
self:UltimateDisplay(nCharId, nSkinId)
end
return MathParkourSkillDisplayCtrl