Update - 1.12.0.120

EN: 1.12.0.120
CN: 1.12.0.120
JP: 1.12.0.124
KR: 1.12.0.124
This commit is contained in:
SL1900
2026-06-30 14:30:00 +09:00
parent 061d344bf2
commit 80af235e05
826 changed files with 625145 additions and 81163 deletions
@@ -0,0 +1,177 @@
local DoubleDropActQuestCtrl = class("DoubleDropActQuestCtrl", BaseCtrl)
DoubleDropActQuestCtrl._mapNodeConfig = {
goBlur = {
sNodeName = "t_fullscreen_blur_blue"
},
aniBlur = {
sNodeName = "t_fullscreen_blur_blue",
sComponentName = "Animator"
},
goRoot = {
sNodeName = "----SafeAreaRoot----",
sComponentName = "Transform"
},
btnFullClose = {
sComponentName = "UIButton",
callback = "OnBtnClick_Close"
},
aniWindow = {sNodeName = "questPopup", sComponentName = "Animator"},
txtWindowTitle = {
sComponentName = "TMP_Text",
sLanguageId = "Double_Drops_Quest_Reward_Title"
},
btnClose = {
sComponentName = "UIButton",
callback = "OnBtnClick_Close"
},
sv = {
sComponentName = "LoopScrollView"
},
btn_GetAllReward = {
sComponentName = "UIButton",
callback = "OnBtnClick_GetAllReward"
},
btn_GetAllReward_None = {
sComponentName = "UIButton",
callback = "OnBtnClick_GetAllReward"
},
txt_GetAll = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "Double_Drops_Quest_Reward_Receive"
}
}
DoubleDropActQuestCtrl._mapEventConfig = {}
DoubleDropActQuestCtrl._mapRedDotConfig = {}
local nQuestItemWidth = 756
local nMinWidth = 32
function DoubleDropActQuestCtrl:ShowQuestList()
self.actData = PlayerData.Activity:GetActivityDataById(self.nActId)
if self.actData == nil then
return
end
self.tbItemCtrl = {}
self:RefreshQuestList()
self._mapNode.goRoot.gameObject:SetActive(false)
self._mapNode.goBlur:SetActive(true)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.goRoot.gameObject:SetActive(true)
self._mapNode.aniWindow:Play("t_window_04_t_in")
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
end
cs_coroutine.start(wait)
end
function DoubleDropActQuestCtrl:RefreshQuestList()
self.tbQuest = self.actData:GetAllQuests()
table.sort(self.tbQuest, function(a, b)
if a.nStatus == b.nStatus then
return a.nId < b.nId
end
return a.nStatus < b.nStatus
end)
self._mapNode.sv:SetAnim(0.08)
self._mapNode.sv:Init(#self.tbQuest, self, self.OnGridQuestRefresh, nil, false)
self.bHasComQuest = false
for _, v in ipairs(self.tbQuest) do
if v.nStatus == AllEnum.ActQuestStatus.Complete then
self.bHasComQuest = true
break
end
end
self._mapNode.btn_GetAllReward.gameObject:SetActive(self.bHasComQuest)
self._mapNode.btn_GetAllReward_None.gameObject:SetActive(not self.bHasComQuest)
end
function DoubleDropActQuestCtrl:OnGridQuestRefresh(goGrid, gridIndex)
local nIndex = gridIndex + 1
local instanceId = goGrid:GetInstanceID()
local questData = self.tbQuest[nIndex]
local goRoot = goGrid.transform:Find("btnGrid/AnimRoot/Root")
local img_Received = goRoot.transform:Find("img_Received")
local btn_item = goRoot.transform:Find("btn_item"):GetComponent("UIButton")
local item = goRoot.transform:Find("btn_item/AnimRoot/item")
if self.tbItemCtrl[instanceId] == nil then
self.tbItemCtrl[instanceId] = self:BindCtrlByNode(item, "Game.UI.TemplateEx.TemplateItemCtrl")
end
local txtTarget = goRoot.transform:Find("txt_target"):GetComponent("TMP_Text")
local txt_com1 = goRoot.transform:Find("txt_com1"):GetComponent("TMP_Text")
local txt_com2 = goRoot.transform:Find("txt_com2"):GetComponent("TMP_Text")
local bar = goRoot.transform:Find("imgBarBg/rtBarFill/imgMainBarFill"):GetComponent("RectTransform")
local img_state1 = goRoot.transform:Find("img_state1").gameObject
local img_state2 = goRoot.transform:Find("img_state2").gameObject
local img_state3 = goRoot.transform:Find("img_state3").gameObject
img_state1:SetActive(questData.nStatus == AllEnum.ActQuestStatus.Complete)
img_state2:SetActive(questData.nStatus == AllEnum.ActQuestStatus.Received)
img_state3:SetActive(questData.nStatus == AllEnum.ActQuestStatus.UnComplete)
img_Received.gameObject:SetActive(questData.nStatus == AllEnum.ActQuestStatus.Received)
btn_item.onClick:RemoveAllListeners()
local questConfig = ConfigTable.GetData("ActivityDoubleQuest", questData.nId)
if questConfig == nil then
return
end
local itemId = questConfig.ItemId
local itemCount = questConfig.ItemQty
btn_item.onClick:AddListener(function()
UTILS.ClickItemGridWithTips(itemId, btn_item.transform, true, true, false)
end)
self.tbItemCtrl[instanceId]:SetItem(itemId, nil, itemCount, false, questData.nStatus == AllEnum.ActQuestStatus.Received, false, false)
NovaAPI.SetTMPText(txtTarget, questConfig.Desc)
if questData.nStatus == AllEnum.ActQuestStatus.UnComplete then
NovaAPI.SetTMPText(txt_com1, tostring(questData.progress.Cur) .. "/" .. tostring(questData.progress.Max))
NovaAPI.SetTMPText(txt_com2, tostring(questData.progress.Cur) .. "/" .. tostring(questData.progress.Max))
local nWidth = 0
if questData.progress.Cur > 0 then
nWidth = math.max(nQuestItemWidth * (questData.progress.Cur / questData.progress.Max), nMinWidth)
end
bar.sizeDelta = Vector2(nWidth, bar.sizeDelta.y)
else
NovaAPI.SetTMPText(txt_com1, ConfigTable.GetUIText("BdConvert_QuestFinish"))
NovaAPI.SetTMPText(txt_com2, ConfigTable.GetUIText("BdConvert_QuestFinish"))
bar.sizeDelta = Vector2(nQuestItemWidth, bar.sizeDelta.y)
end
txt_com1.gameObject:SetActive(questData.nStatus ~= AllEnum.ActQuestStatus.Received)
txt_com2.gameObject:SetActive(questData.nStatus == AllEnum.ActQuestStatus.Received)
end
function DoubleDropActQuestCtrl:Awake()
end
function DoubleDropActQuestCtrl:OnEnable()
self.tbItemCtrl = {}
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
end
if self.nActId then
self:ShowQuestList()
end
end
function DoubleDropActQuestCtrl:OnDisable()
if self.tbItemCtrl ~= nil then
for _, ctrl in pairs(self.tbItemCtrl) do
self:UnbindCtrlByNode(ctrl)
end
end
end
function DoubleDropActQuestCtrl:OnDestroy()
end
function DoubleDropActQuestCtrl:OnBtnClick_Close()
self._mapNode.aniBlur:SetTrigger("tOut")
self._mapNode.aniWindow:Play("t_window_04_t_out")
self:AddTimer(1, 0.2, function()
EventManager.Hit(EventId.ClosePanel, PanelId.DoubleDropActQuestPanel_103001)
end, true, true, true)
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
end
function DoubleDropActQuestCtrl:OnBtnClick_GetAllReward()
if self.actData == nil then
return
end
if not self.bHasComQuest then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("DoubleDrop_Reward_Receive_Tip"))
return
end
local callback = function()
self:RefreshQuestList()
end
self.actData:SendReceiveQuestReward(0, callback)
end
return DoubleDropActQuestCtrl
@@ -0,0 +1,22 @@
local DoubleDropActQuestPanel = class("DoubleDropActQuestPanel", BasePanel)
DoubleDropActQuestPanel._bIsMainPanel = false
DoubleDropActQuestPanel._sUIResRootPath = "UI_Activity/"
DoubleDropActQuestPanel._tbDefine = {
{
sPrefabPath = "_103001/DoubleDropActRewardPanel.prefab",
sCtrlName = "Game.UI.Activity.DoubleDrop.DoubleDropActQuestCtrl"
}
}
function DoubleDropActQuestPanel:Awake()
end
function DoubleDropActQuestPanel:OnEnable()
end
function DoubleDropActQuestPanel:OnAfterEnter()
end
function DoubleDropActQuestPanel:OnDisable()
end
function DoubleDropActQuestPanel:OnDestroy()
end
function DoubleDropActQuestPanel:OnRelease()
end
return DoubleDropActQuestPanel
@@ -0,0 +1,49 @@
local DoubleDropInsItemCtrl = class("DoubleDropInsItemCtrl", BaseCtrl)
DoubleDropInsItemCtrl._mapNodeConfig = {
imgIconDaily = {},
imgIconRegionBoss = {},
imgIconSkill = {},
imgIconEquipment = {},
txtTitle = {sComponentName = "TMP_Text"},
txtDesc = {sComponentName = "TMP_Text"},
goLock = {},
txtLock = {sComponentName = "TMP_Text"}
}
DoubleDropInsItemCtrl._mapEventConfig = {}
DoubleDropInsItemCtrl._mapRedDotConfig = {}
function DoubleDropInsItemCtrl:InitItem(nFuncType)
self.nType = nFuncType
self._mapNode.imgIconDaily:SetActive(nFuncType == GameEnum.OpenFuncType.DailyInstance)
self._mapNode.imgIconRegionBoss:SetActive(nFuncType == GameEnum.OpenFuncType.RegionBoss)
self._mapNode.imgIconSkill:SetActive(nFuncType == GameEnum.OpenFuncType.SkillInstance)
self._mapNode.imgIconEquipment:SetActive(nFuncType == GameEnum.OpenFuncType.CharGemInstance)
local sDesc = ""
if nFuncType == GameEnum.OpenFuncType.SkillInstance then
sDesc = ConfigTable.GetUIText("LevelMenu_SSkill")
elseif nFuncType == GameEnum.OpenFuncType.RegionBoss then
sDesc = ConfigTable.GetUIText("LevelMenu_SRegion")
elseif nFuncType == GameEnum.OpenFuncType.DailyInstance then
sDesc = ConfigTable.GetUIText("LevelMenu_STime")
elseif nFuncType == GameEnum.OpenFuncType.CharGemInstance then
sDesc = ConfigTable.GetUIText("LevelMenu_SEquipment")
end
NovaAPI.SetTMPText(self._mapNode.txtDesc, sDesc)
local bUnlock = PlayerData.Base:CheckFunctionUnlock(nFuncType)
self._mapNode.goLock:SetActive(not bUnlock)
local mapFuncCfg = ConfigTable.GetData("OpenFunc", nFuncType)
if mapFuncCfg ~= nil then
NovaAPI.SetTMPText(self._mapNode.txtTitle, mapFuncCfg.Name)
if not bUnlock and mapFuncCfg.NeedWorldClass > 0 then
NovaAPI.SetTMPText(self._mapNode.txtLock, orderedFormat(ConfigTable.GetUIText("Double_Drops_WorldClass_Lock"), mapFuncCfg.NeedWorldClass))
end
end
end
function DoubleDropInsItemCtrl:Awake()
end
function DoubleDropInsItemCtrl:OnEnable()
end
function DoubleDropInsItemCtrl:OnDisable()
end
function DoubleDropInsItemCtrl:OnDestroy()
end
return DoubleDropInsItemCtrl
@@ -11,6 +11,7 @@ GoldenSpyBuffSelectPanel._tbDefine = {
}
function GoldenSpyBuffSelectPanel:Awake()
GamepadUIManager.EnableGamepadUI("GoldenSpyBuffSelect", {})
self.nTipsPanelId = PanelId.GoldenSpyBuffTipsPanel_400008
end
function GoldenSpyBuffSelectPanel:OnEnable()
end
@@ -12,6 +12,9 @@ GoldenSpyLevelPanel._tbDefine = {
function GoldenSpyLevelPanel:Awake()
PlayerData.Base:SetSkipNewDayWindow(true)
self.bFirstInCtrl = true
self.nTipsPanelId = PanelId.GoldenSpyBuffTipsPanel_400008
self.nResultPanelId = PanelId.GoldenSpyResultPanel_400008
self.nBuffSelectPanelId = PanelId.GoldenSpyBuffSelectPanel_400008
end
function GoldenSpyLevelPanel:OnEnable()
end
@@ -0,0 +1,27 @@
local GoldenSpyBuffSelectPanel = class("GoldenSpyBuffSelectPanel", BasePanel)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
GoldenSpyBuffSelectPanel._bIsMainPanel = false
GoldenSpyBuffSelectPanel._sSortingLayerName = AllEnum.SortingLayerName.UI
GoldenSpyBuffSelectPanel._sUIResRootPath = "UI_Activity/"
GoldenSpyBuffSelectPanel._tbDefine = {
{
sPrefabPath = "_400012/GoldenSpyBuffSelectPanel.prefab",
sCtrlName = "Game.UI.Activity.GoldenSpy.GoldenSpyBuffSelectCtrl"
}
}
function GoldenSpyBuffSelectPanel:Awake()
GamepadUIManager.EnableGamepadUI("GoldenSpyBuffSelect", {})
self.nTipsPanelId = PanelId.GoldenSpyBuffTipsPanel_400012
end
function GoldenSpyBuffSelectPanel:OnEnable()
end
function GoldenSpyBuffSelectPanel:OnAfterEnter()
end
function GoldenSpyBuffSelectPanel:OnDisable()
end
function GoldenSpyBuffSelectPanel:OnDestroy()
GamepadUIManager.DisableGamepadUI("GoldenSpyBuffSelect")
end
function GoldenSpyBuffSelectPanel:OnRelease()
end
return GoldenSpyBuffSelectPanel
@@ -0,0 +1,24 @@
local GoldenSpyBuffTipsPanel = class("GoldenSpyBuffTipsPanel", BasePanel)
GoldenSpyBuffTipsPanel._bIsMainPanel = false
GoldenSpyBuffTipsPanel._bAddToBackHistory = false
GoldenSpyBuffTipsPanel._sSortingLayerName = AllEnum.SortingLayerName.UI_Top
GoldenSpyBuffTipsPanel._sUIResRootPath = "UI_Activity/"
GoldenSpyBuffTipsPanel._tbDefine = {
{
sPrefabPath = "_400012/GoldenSpyBuffTips.prefab",
sCtrlName = "Game.UI.Activity.GoldenSpy.GoldenSpyBuffTipsCtrl"
}
}
function GoldenSpyBuffTipsPanel:Awake()
end
function GoldenSpyBuffTipsPanel:OnEnable()
end
function GoldenSpyBuffTipsPanel:OnAfterEnter()
end
function GoldenSpyBuffTipsPanel:OnDisable()
end
function GoldenSpyBuffTipsPanel:OnDestroy()
end
function GoldenSpyBuffTipsPanel:OnRelease()
end
return GoldenSpyBuffTipsPanel
@@ -0,0 +1,31 @@
local GoldenSpyLevelPanel = class("GoldenSpyLevelPanel", BasePanel)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
GoldenSpyLevelPanel._bIsMainPanel = true
GoldenSpyLevelPanel._sSortingLayerName = AllEnum.SortingLayerName.UI
GoldenSpyLevelPanel._sUIResRootPath = "UI_Activity/"
GoldenSpyLevelPanel._tbDefine = {
{
sPrefabPath = "_400012/GoldenSpyPanel.prefab",
sCtrlName = "Game.UI.Activity.GoldenSpy.GoldenSpyLevelCtrl"
}
}
function GoldenSpyLevelPanel:Awake()
PlayerData.Base:SetSkipNewDayWindow(true)
self.bFirstInCtrl = true
self.nTipsPanelId = PanelId.GoldenSpyBuffTipsPanel_400012
self.nResultPanelId = PanelId.GoldenSpyResultPanel_400012
self.nBuffSelectPanelId = PanelId.GoldenSpyBuffSelectPanel_400012
end
function GoldenSpyLevelPanel:OnEnable()
end
function GoldenSpyLevelPanel:OnAfterEnter()
end
function GoldenSpyLevelPanel:OnDisable()
end
function GoldenSpyLevelPanel:OnDestroy()
PlayerData.Base:SetSkipNewDayWindow(false)
PlayerData.Base:OnBackToMainMenuModule()
end
function GoldenSpyLevelPanel:OnRelease()
end
return GoldenSpyLevelPanel
@@ -0,0 +1,28 @@
local GoldenSpyLevelSelectPanel = class("GoldenSpyLevelSelectPanel", BasePanel)
GoldenSpyLevelSelectPanel._bIsMainPanel = true
GoldenSpyLevelSelectPanel._bAddToBackHistory = true
GoldenSpyLevelSelectPanel._sSortingLayerName = AllEnum.SortingLayerName.UI
GoldenSpyLevelSelectPanel._sUIResRootPath = "UI_Activity/"
GoldenSpyLevelSelectPanel._tbDefine = {
{
sPrefabPath = "_400012/GoldenSpyLevelSelectPanel.prefab",
sCtrlName = "Game.UI.Activity.GoldenSpy.GoldenSpyLevelSelectCtrl"
}
}
local PanelTab = {Group = 1, Level = 2}
function GoldenSpyLevelSelectPanel:Awake()
self.nPanelTab = PanelTab.Group
self.nSelectGroupId = 0
self.nSelectLevelId = 0
end
function GoldenSpyLevelSelectPanel:OnEnable()
end
function GoldenSpyLevelSelectPanel:OnAfterEnter()
end
function GoldenSpyLevelSelectPanel:OnDisable()
end
function GoldenSpyLevelSelectPanel:OnDestroy()
end
function GoldenSpyLevelSelectPanel:OnRelease()
end
return GoldenSpyLevelSelectPanel
@@ -0,0 +1,24 @@
local GoldenSpyResultPanel = class("GoldenSpyResultPanel", BasePanel)
GoldenSpyResultPanel._bIsMainPanel = true
GoldenSpyResultPanel._sSortingLayerName = AllEnum.SortingLayerName.UI
GoldenSpyResultPanel._nSnapshotPrePanel = 1
GoldenSpyResultPanel._sUIResRootPath = "UI_Activity/"
GoldenSpyResultPanel._tbDefine = {
{
sPrefabPath = "_400012/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
@@ -78,7 +78,7 @@ function GoldenSpyBoomItem:Boom(callback)
if ctrl:GetItemCfg().ItemType == GameEnum.GoldenSpyItem.Boom then
return
end
self.floorCtrl:RemoveItem(ctrl)
self.floorCtrl:RemoveItem(ctrl, true)
end)
end
end
@@ -1,5 +1,5 @@
local GoldenSpyBuffCellCtrl = class("GoldenSpyBuffCellCtrl", BaseCtrl)
local BuffSpritePath = "UI_Activity/_400008/SpriteAtlas/Buff/"
local BuffSpritePath = "UI_Activity/_%s/SpriteAtlas/Buff/"
local buff_state_color = {
[1] = Color(0.8549019607843137, 0.37254901960784315, 0.9137254901960784, 1),
[2] = Color(0.42745098039215684, 0.4470588235294118, 0.8509803921568627, 1)
@@ -18,7 +18,7 @@ GoldenSpyBuffCellCtrl._mapRedDotConfig = {}
function GoldenSpyBuffCellCtrl:Awake()
self._mapNode.img_selected:SetActive(false)
end
function GoldenSpyBuffCellCtrl:SetData(data)
function GoldenSpyBuffCellCtrl:SetData(data, nActId, tipsPanelId)
self.data = data
self.buffId = self.data.buffData.buffId
self.buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", self.buffId)
@@ -47,9 +47,9 @@ function GoldenSpyBuffCellCtrl:SetData(data)
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)
EventManager.Hit(EventId.OpenPanel, tipsPanelId, self._mapNode.btn_buff.transform, self.buffId)
end)
self:SetPngSprite(self._mapNode.img_icon, BuffSpritePath .. self.buffCfg.Icon .. "_s")
self:SetPngSprite(self._mapNode.img_icon, string.format(BuffSpritePath, nActId) .. self.buffCfg.Icon .. "_s")
end
function GoldenSpyBuffCellCtrl:OnEvent_BuffTipsClose()
self._mapNode.img_selected:SetActive(false)
@@ -1,8 +1,8 @@
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 BuffSpritePath = "UI_Activity/_%s/SpriteAtlas/Buff/"
local ItemSpritePath = "UI_Activity/_%s/SpriteAtlas/Item/"
local bg_buff = {
[1] = "bg_goldenspy_game_buff_04",
[2] = "bg_goldenspy_game_buff_02",
@@ -66,9 +66,20 @@ GoldenSpyBuffSelectCtrl._mapNodeConfig = {
txt_toolBox = {
sComponentName = "TMP_Text",
sLanguageId = "GoldenSpy_ToolBox_Title"
}
},
btn_Refresh = {
sComponentName = "NaviButton",
callback = "OnBtnClick_Refresh"
},
txt_Refresh = {
sComponentName = "TMP_Text",
sLanguageId = "GoldenSpy_Refresh_Title"
},
txt_num = {sComponentName = "TMP_Text"}
}
GoldenSpyBuffSelectCtrl._mapEventConfig = {
GM_GoldenSpy_RefeshBuff = "OnEvent_GM_GoldenSpy_RefeshBuff"
}
GoldenSpyBuffSelectCtrl._mapEventConfig = {}
GoldenSpyBuffSelectCtrl._mapRedDotConfig = {}
function GoldenSpyBuffSelectCtrl:Awake()
self._mapNode.root:SetActive(false)
@@ -79,12 +90,17 @@ function GoldenSpyBuffSelectCtrl:Awake()
if type(param) == "table" then
self.tbShowItem = param[1]
self.tbBuff = param[2]
self.tbSelectBuff = param[3]
self.tbBuffPool = param[3]
self.selectedCallback = param[4]
self.getRefreshCallback = param[5]
self.refreshCallback = param[6]
self.nActId = param[7]
end
self.mapBuffCellCtrl = {}
self.tbSelectBuff = self:RandomSelectBuff()
self:ShowBuffSelect(self.tbShowItem, self.tbBuff, self.tbSelectBuff, self.selectedCallback)
self.bConfirmed = false
self:RefreshRefreshCount()
end
function GoldenSpyBuffSelectCtrl:OnEnable()
local wait = function()
@@ -112,6 +128,65 @@ function GoldenSpyBuffSelectCtrl:OnDestroy()
end
self.mapBuffCellCtrl = {}
end
function GoldenSpyBuffSelectCtrl:RandomSelectBuff()
local tbSelectBuff = {}
local tempPool = self:CopyTable(self.tbBuffPool)
for i = 1, 3 do
local buff, index = self:RandomBuff(tempPool)
table.insert(tbSelectBuff, buff.buffId)
table.remove(tempPool, index)
end
return tbSelectBuff
end
function GoldenSpyBuffSelectCtrl:RandomBuff(tbBuffPool)
local tbBuffCount = {}
local tbRemoveBuffIds = {}
for _, v in ipairs(self.tbBuff) do
tbBuffCount[v.buffData.buffId] = (tbBuffCount[v.buffData.buffId] or 0) + 1
end
for k, v in pairs(tbBuffCount) do
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", k)
if buffCfg ~= nil and v >= buffCfg.MaxCount then
table.insert(tbRemoveBuffIds, k)
end
end
for i = #tbBuffPool, 1, -1 do
for _, v in ipairs(tbRemoveBuffIds) do
if tbBuffPool[i].buffId == v then
table.remove(tbBuffPool, i)
break
end
end
end
local nTotalWeight = 0
for i, v in ipairs(tbBuffPool) do
nTotalWeight = nTotalWeight + math.floor(v.weight)
end
local nRandom = math.random(1, nTotalWeight)
local nSum = 0
local nIndex = 0
local buffData
for i, v in ipairs(tbBuffPool) do
nSum = nSum + v.weight
if nRandom <= nSum then
buffData = v
nIndex = i
break
end
end
if NovaAPI.IsEditorPlatform() then
print("GoldenSpyLevelCtrl: tbBuffPool:--------------------------------")
for i, v in ipairs(tbBuffPool) do
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
print("GoldenSpyLevelCtrl: buffId:", v.buffId, " Name:", buffCfg.Name, " weight:", v.weight, " TotalWeight:", nTotalWeight, " 概率:", v.weight / nTotalWeight * 100, "%")
end
end
return buffData, nIndex
end
function GoldenSpyBuffSelectCtrl:RefreshRefreshCount()
local nRefreshCount = self.getRefreshCallback() or 0
NovaAPI.SetTMPText(self._mapNode.txt_num, nRefreshCount)
end
function GoldenSpyBuffSelectCtrl:ShowBuffSelect(tbShowItem, tbBuff, tbSelectBuff, selectedCallback)
self.selectedCallback = selectedCallback
self:RefreshItemList(tbShowItem)
@@ -130,7 +205,7 @@ function GoldenSpyBuffSelectCtrl:OnRefreshItemGrid(goGrid, gridIndex)
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")
self:SetPngSprite(img_icon, string.format(ItemSpritePath, self.nActId) .. itemCfg.IconPath .. "_s")
NovaAPI.SetTMPText(txt_score, itemScore)
end
function GoldenSpyBuffSelectCtrl:RefreshBuffSelectList(tbSelectBuff)
@@ -151,11 +226,11 @@ function GoldenSpyBuffSelectCtrl:RefreshBuffSelectList(tbSelectBuff)
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")
self:SetSprite(img_db, string.format("UI_Activity/_%s/SpriteAtlas/", self.nActId) .. bg_buff[buffCfg.BuffType])
self:SetPngSprite(img_icon, string.format(BuffSpritePath, self.nActId) .. 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])
self:SetPngSprite(db_type, string.format("UI_Activity/_%s/SpriteAtlas/", self.nActId) .. bg_type[buffCfg.BuffType])
NovaAPI.SetTMPText(txt_type, ConfigTable.GetUIText(buff_type_lang[buffCfg.BuffType]))
goSelect:SetActive(false)
local tbEffectItem = buffCfg.ConnectItems
@@ -169,7 +244,7 @@ function GoldenSpyBuffSelectCtrl:RefreshBuffSelectList(tbSelectBuff)
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")
self:SetPngSprite(img_icon, string.format(ItemSpritePath, self.nActId) .. itemCfg.IconPath .. "_s")
goItem:SetActive(true)
end
end
@@ -201,7 +276,7 @@ function GoldenSpyBuffSelectCtrl:OnRefreshBuffGrid(goGrid, gridIndex)
objCtrl = self:BindCtrlByNode(goGrid, "Game.UI.Activity.GoldenSpy.GoldenSpyBuffCellCtrl")
self.mapBuffCellCtrl[nInstanceId] = objCtrl
end
objCtrl:SetData(self.tbBuff[nIndex])
objCtrl:SetData(self.tbBuff[nIndex], self.nActId, self._panel.nTipsPanelId)
end
function GoldenSpyBuffSelectCtrl:ResetSelect(tbUI)
self.nSelectIdx = 0
@@ -220,6 +295,13 @@ function GoldenSpyBuffSelectCtrl:ResetSelect(tbUI)
end
end, true, true, true)
end
function GoldenSpyBuffSelectCtrl:CopyTable(tb)
local tbTemp = {}
for _, v in ipairs(tb) do
table.insert(tbTemp, v)
end
return tbTemp
end
function GoldenSpyBuffSelectCtrl:OnBtnClick_BuffItem(btn, nIndex)
if nil == self.tbSelectBuff[nIndex] or self.nSelectIdx == nIndex then
return
@@ -262,10 +344,32 @@ function GoldenSpyBuffSelectCtrl:OnBtnClick_Confirm(btn, nIndex)
self.selectedCallback(self.tbSelectBuff[self.nSelectIdx])
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
EventManager.Hit(EventId.ClosePanel, PanelId.GoldenSpyBuffSelectPanel)
EventManager.Hit(EventId.ClosePanel, self._panel._nPanelId)
end
cs_coroutine.start(wait)
end, true, true, true, nil)
end
end
function GoldenSpyBuffSelectCtrl:OnBtnClick_Refresh(btn, nIndex)
local nRefreshCount = self.getRefreshCallback() or 0
if nRefreshCount <= 0 then
return
end
self.tbSelectBuff = self:RandomSelectBuff()
self:RefreshBuffSelectList(self.tbSelectBuff)
self:ResetSelect(self._mapNode.btnBuff)
if self.refreshCallback ~= nil then
self.refreshCallback()
end
self:RefreshRefreshCount()
self._mapNode.animCtrl:Play("GoldenSpyBuffSelectPanel_in1Empty")
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
end
function GoldenSpyBuffSelectCtrl:OnEvent_GM_GoldenSpy_RefeshBuff()
self.tbSelectBuff = self:RandomSelectBuff()
self:RefreshBuffSelectList(self.tbSelectBuff)
self:ResetSelect(self._mapNode.btnBuff)
self._mapNode.animCtrl:Play("GoldenSpyBuffSelectPanel_in1Empty")
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
end
return GoldenSpyBuffSelectCtrl
@@ -95,7 +95,7 @@ function GoldenSpyBuffTipsCtrl:SetTipsPosition(rtTarget, rtContent, safeAreaRoot
end
function GoldenSpyBuffTipsCtrl:OnBtnClick_ClosePanel()
NovaAPI.SetComponentEnableByName(self.rtTarget.gameObject, "TopGridCanvas", false)
EventManager.Hit(EventId.ClosePanel, PanelId.GoldenSpyBuffTipsPanel)
EventManager.Hit(EventId.ClosePanel, self._panel._nPanelId)
EventManager.Hit("GoldenSpyBuffTipsClose")
end
return GoldenSpyBuffTipsCtrl
@@ -380,7 +380,7 @@ function GoldenSpyCompanionItem:_CheckVision()
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_229
goto lbl_176
end
if item.Ctrl:GetItemCfg().ItemType == GameEnum.GoldenSpyItem.Boom then
item.Ctrl:Boom(nil)
@@ -390,22 +390,8 @@ function GoldenSpyCompanionItem:_CheckVision()
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
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore and buffCfg.Params[1] == itemCfg.ItemType and self.floorCtrl.levelCtrl.GoldenSpyLevelData:CheckBuffActive(v) then
nScore = nScore + buffCfg.Params[2]
end
end
self._mapNode.animator:Play("Patrol_attack")
@@ -424,7 +410,7 @@ function GoldenSpyCompanionItem:_CheckVision()
end
tbRemoveItems = {}
end
::lbl_229::
::lbl_176::
end
end
function GoldenSpyCompanionItem:_StartVisionCheck()
@@ -1,5 +1,5 @@
local GoldenSpyFloorCtrl = class("GoldenSpyFloorCtrl", BaseCtrl)
local LevelPrefabPath = "UI_Activity/_400008/LevelPrefab/"
local LevelPrefabPath = "UI_Activity/_%s/LevelPrefab/"
GoldenSpyFloorCtrl._mapNodeConfig = {
HookCtrl = {
sNodeName = "HookRoot",
@@ -54,7 +54,7 @@ function GoldenSpyFloorCtrl:Init(levelId, floorId, levelCtrl)
return
end
local nPrefabName = self.levelCtrl.GoldenSpyLevelData:GetLevelPrefabName()
local goLevelPerfab = self:LoadAsset(LevelPrefabPath .. nPrefabName .. ".prefab")
local goLevelPerfab = self:LoadAsset(string.format(LevelPrefabPath, self.levelCtrl.nActId) .. nPrefabName .. ".prefab")
self.prefab = instantiate(goLevelPerfab, self._mapNode.floorItemRoot)
self.prefab.transform.localPosition = Vector3.zero
self.prefab.transform.localScale = Vector3.one
@@ -240,7 +240,7 @@ function GoldenSpyFloorCtrl:Shoot(nSpeed, nRadius, nFactor, onRetractComplete, o
end
end)
end
function GoldenSpyFloorCtrl:RemoveItem(itemCtrl)
function GoldenSpyFloorCtrl:RemoveItem(itemCtrl, bForce)
local bDelSuccess = false
local itemId = itemCtrl:GetItemCfg().Id
for i = #self.tbItem, 1, -1 do
@@ -252,7 +252,7 @@ function GoldenSpyFloorCtrl:RemoveItem(itemCtrl)
end
end
if bDelSuccess then
self.levelCtrl.GoldenSpyFloorData:DeleteItem(itemId)
self.levelCtrl.GoldenSpyFloorData:DeleteItem(itemId, bForce)
end
end
function GoldenSpyFloorCtrl:DropItem()
@@ -24,7 +24,8 @@ function GoldenSpyFloorData:SetItem(itemId)
end
self.tbItem[itemId].itemCount = self.tbItem[itemId].itemCount + 1
end
function GoldenSpyFloorData:DeleteItem(itemId)
function GoldenSpyFloorData:DeleteItem(itemId, bForce)
bForce = bForce or false
if self.tbItem[itemId] == nil then
return
end
@@ -33,7 +34,7 @@ function GoldenSpyFloorData:DeleteItem(itemId)
self.tbItem[itemId] = nil
end
local itemCfg = ConfigTable.GetData("GoldenSpyItem", itemId)
if itemCfg.ItemType == GameEnum.GoldenSpyItem.BuffItem then
if itemCfg.ItemType == GameEnum.GoldenSpyItem.BuffItem and not bForce then
return
end
local nCount = 0
@@ -270,22 +270,8 @@ function GoldenSpyHookCtrl:StartExtend(speed, radius, factor, onComplete, onCatc
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
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.ReduceItemWeight and self.levelData:CheckBuffActive(v) then
itemNormalWeight = itemNormalWeight - buffCfg.Params[2]
end
end
itemNormalWeight = math.max(0, itemNormalWeight)
@@ -1,9 +1,9 @@
local GoldenSpyLevelCtrl = class("GoldenSpyLevelCtrl", BaseCtrl)
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
local ItemSpritePath = "UI_Activity/_400008/SpriteAtlas/Item/"
local SpritePath = "UI_Activity/_400008/SpriteAtlas/"
local PrefabPath = "UI_Activity/_400008/"
local ItemSpritePath = "UI_Activity/_%s/SpriteAtlas/Item/"
local SpritePath = "UI_Activity/_%s/SpriteAtlas/"
local PrefabPath = "UI_Activity/_%s/"
local BoomSkillId = 1001
local FrozenSkillId = 1002
local PlayerActivityData = PlayerData.Activity
@@ -82,7 +82,11 @@ GoldenSpyLevelCtrl._mapNodeConfig = {
imgWarning = {},
skill_Boom = {},
go_CompanionAddScore = {},
txt_CompanionAddScore = {sComponentName = "TMP_Text"}
txt_CompanionAddScore = {sComponentName = "TMP_Text"},
targetScoreCtrl = {
sNodeName = "TargetScorePanel",
sCtrlName = "Game.UI.Activity.GoldenSpy.GoldenSpyTargetScoreCtrl"
}
}
GoldenSpyLevelCtrl._mapEventConfig = {
GoldenSpy_Exit_OnClick = "GoldenSpy_Exit_OnClick",
@@ -96,6 +100,7 @@ GoldenSpyLevelCtrl._mapEventConfig = {
[EventId.ClosePanel] = "OnEvent_CloseDic",
GoldenSpyHookResumeSwing = "OnEvent_GoldenSpyHookResumeSwing",
GoldenSpyHookStartExtend = "OnEvent_GoldenSpyHookStartExtend",
GoldenSpy_TargetScore_Close = "OnEvent_GoldenSpy_TargetScore_Close",
GM_GoldenSpy_RefreshTask = "OnEvent_GM_GoldenSpy_RefreshTask",
GM_GoldenSpy_AddSkill = "OnEvent_GM_GoldenSpy_AddSkill",
GM_GoldenSpy_AddBuff = "OnEvent_GM_GoldenSpy_AddBuff",
@@ -104,6 +109,7 @@ GoldenSpyLevelCtrl._mapEventConfig = {
function GoldenSpyLevelCtrl:Awake()
self._mapNode.PausePanel.gameObject:SetActive(false)
self._mapNode.ToolBoxPanel.gameObject:SetActive(false)
self._mapNode.targetScoreCtrl.gameObject:SetActive(false)
self.tbGamepadUINode = self:GetGamepadUINode()
local param = self:GetPanelParam()
if type(param) == "table" then
@@ -128,7 +134,7 @@ function GoldenSpyLevelCtrl:Awake()
end
local groupCfg = ConfigTable.GetData("GoldenSpyLevelGroup", self.nGroupId)
if groupCfg ~= nil then
local goLightPerfab = self:LoadAsset(PrefabPath .. groupCfg.LightName .. ".prefab")
local goLightPerfab = self:LoadAsset(string.format(PrefabPath, self.nActId) .. groupCfg.LightName .. ".prefab")
self.lightPrefab = instantiate(goLightPerfab, self._mapNode.platformRoot)
local tr = self.lightPrefab.transform:GetComponent("RectTransform")
tr.anchoredPosition = Vector2.zero
@@ -153,9 +159,10 @@ end
function GoldenSpyLevelCtrl:EnterGame()
self._mapNode.ActorAnimRoot:Play("ActorPanel_Jump")
self.bInCharAnimator = false
self:AddTimer(1, 0.7, function()
self:StartFloor()
self:AddTimer(1, 1.7, function()
self:ShowTargetScore()
end, true, true, true)
EventManager.Hit(EventId.TemporaryBlockInput, 1.7)
if self.nLevelType == GameEnum.GoldenSpyLevelType.Quest or self.nLevelType == GameEnum.GoldenSpyLevelType.Random then
self.GoldenSpyLevelData:RefreshTask()
self:UpdateTaskUI()
@@ -167,7 +174,7 @@ function GoldenSpyLevelCtrl:Init()
if self.floorCfg == nil then
return
end
self:SetPngSprite(self._mapNode.img_bg, SpritePath .. self.floorCfg.BgName)
self:SetPngSprite(self._mapNode.img_bg, string.format(SpritePath, self.nActId) .. self.floorCfg.BgName)
local nFloor = self.GoldenSpyLevelData:GetCurFloor()
local nTotalFloor = self.GoldenSpyLevelData:GetTotalFloor()
local sFloorText = orderedFormat(ConfigTable.GetUIText("GoldenSpy_Floor"), nFloor, nTotalFloor)
@@ -271,6 +278,9 @@ function GoldenSpyLevelCtrl:StartFloor()
end
end
function GoldenSpyLevelCtrl:FinishFloor()
if self.bInPause then
self:GoldenSpy_Continue_OnClick()
end
WwiseAudioMgr:PostEvent("Mode_steal_get_stop")
self:ClearTimer()
self.bStartFloor = false
@@ -289,11 +299,12 @@ function GoldenSpyLevelCtrl:FinishFloor()
tbItems = self.GoldenSpyLevelData:GetCatchItemData(),
tbSkills = self.GoldenSpyLevelData:GetUsedSkillData()
}
self.GoldenSpyActData:FinishLevel(self.nLevelId, data, function()
self.GoldenSpyActData:FinishLevel(self.nLevelId, data, function(msgData)
if callback ~= nil then
callback()
local nextGroupId, nextLevelId = self.GoldenSpyActData:GetNextLevel(self.nGroupId, self.nLevelId)
callback(msgData, nextGroupId, nextLevelId)
end
EventManager.Hit(EventId.ClosePanel, PanelId.GoldenSpyPanel)
EventManager.Hit(EventId.ClosePanel, self._panel._nPanelId)
end)
end
local goNextCallback = function()
@@ -305,17 +316,50 @@ function GoldenSpyLevelCtrl:FinishFloor()
else
bSuccess = self.nCurScore >= self.floorCfg.GoalScore
end
local goNextLevelCallback = function(nextGroupId, nextLevelId)
if nextGroupId == nil or nextLevelId == nil then
return
end
local wait = function()
self.GoldenSpyActData:EnterGroupSelect(nextGroupId)
self.GoldenSpyActData:StartLevel(nextGroupId, nextLevelId)
end
cs_coroutine.start(wait)
end
local data = {
bResult = bFinish,
nLevelId = self.nLevelId,
nCurFloorId = nCurFloorId,
nFloor = nFloor,
nTotalFloor = nTotalFloor,
nCurScore = self.nCurScore,
finishCallback = finishCallback,
goNextCallback = goNextCallback,
bSuccess = bSuccess,
bCanGoNextLevel = bCanGoNextLevel,
goNextLevelCallback = goNextLevelCallback
}
if not self.GoldenSpyActData:CheckActivityOpen() then
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Alert,
sContent = ConfigTable.GetUIText("Activity_End_Notice"),
callbackConfirm = function()
PanelManager.Home()
end
})
return
end
if bSuccess then
if self.animator ~= nil then
self.animator:Play("GoldenSpyPanel_out")
self:AddTimer(1, 1.4, function()
EventManager.Hit(EventId.OpenPanel, PanelId.GoldenSpyResultPanel, bFinish, self.nLevelId, nCurFloorId, nFloor, nTotalFloor, self.nCurScore, finishCallback, goNextCallback, bSuccess)
EventManager.Hit(EventId.OpenPanel, self._panel.nResultPanelId, data)
end, true, true, true)
else
EventManager.Hit(EventId.OpenPanel, PanelId.GoldenSpyResultPanel, bFinish, self.nLevelId, nCurFloorId, nFloor, nTotalFloor, self.nCurScore, finishCallback, goNextCallback, bSuccess)
EventManager.Hit(EventId.OpenPanel, self._panel.nResultPanelId, data)
end
else
EventManager.Hit(EventId.OpenPanel, PanelId.GoldenSpyResultPanel, bFinish, self.nLevelId, nCurFloorId, nFloor, nTotalFloor, self.nCurScore, finishCallback, goNextCallback, bSuccess)
EventManager.Hit(EventId.OpenPanel, self._panel.nResultPanelId, data)
end
end
function GoldenSpyLevelCtrl:GoNextFloor()
@@ -353,6 +397,9 @@ function GoldenSpyLevelCtrl:CatchedComplete(itemCtrl)
local oldScore = self.nCurScore
local bFinishTask, addScore = self.GoldenSpyLevelData:CatchedItem(nItemId, itemCtrl)
addScore = math.floor(addScore or 0)
if NovaAPI.IsEditorPlatform() then
print("GoldenSpyLevelCtrl:抓到的道具分", addScore)
end
self.nCurScore = self.GoldenSpyLevelData:GetCurScore()
self.nCurScore = math.floor(self.nCurScore)
local newAddScore = self.nCurScore - oldScore
@@ -364,6 +411,9 @@ function GoldenSpyLevelCtrl:CatchedComplete(itemCtrl)
self.AddScoreTimer = nil
end
self.AddScoreTimer = self:AddTimer(1, 0.8, function()
if not self.bStartFloor then
return
end
if self._mapNode.go_AddScore == nil then
return
end
@@ -387,6 +437,9 @@ function GoldenSpyLevelCtrl:CatchedComplete(itemCtrl)
taskAnimator:Play("go_Task_switch")
self:UpdateTaskIcon()
local timer = self:AddTimer(1, 0.75, function()
if not self.bStartFloor then
return
end
self:UpdateTaskUI()
end, true, true, true)
table.insert(self.tbTimer, timer)
@@ -444,7 +497,7 @@ function GoldenSpyLevelCtrl:UpdateTaskUI()
local img_icon = self._mapNode.target[i].transform:Find("img_icon"):GetComponent("Image")
local icon_cg = img_icon:GetComponent("CanvasGroup")
local imgGet = self._mapNode.target[i].transform:Find("img_get"):GetComponent("Image")
self:SetPngSprite(img_icon, ItemSpritePath .. itemCfg.IconPath .. "_s")
self:SetPngSprite(img_icon, string.format(ItemSpritePath, self.nActId) .. itemCfg.IconPath .. "_s")
if v.bFinish then
imgGet.gameObject:SetActive(true)
NovaAPI.SetCanvasGroupAlpha(icon_cg, 0.3)
@@ -501,108 +554,28 @@ function GoldenSpyLevelCtrl:AddRandomBuff(nPoolId, callback)
break
end
end
if bIsLabel then
if hasBuffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
if n.bActive and table.indexof(n.tbActiveFloor, self.GoldenSpyLevelData:GetCurFloor()) > 0 then
v.weight = v.weight * (1 + hasBuffCfg.Params[2] / 100.0)
end
elseif hasBuffCfg.BuffType == GameEnum.GoldenSpyBuffType.DelayBuff then
if n.bActive and table.indexof(n.tbActiveFloor, self.GoldenSpyLevelData:GetCurFloor()) > 0 then
v.weight = v.weight * (1 + hasBuffCfg.Params[2] / 100.0)
end
elseif hasBuffCfg.BuffType == GameEnum.GoldenSpyBuffType.PermanentBuff then
if n.bActive then
v.weight = v.weight * (1 + hasBuffCfg.Params[2] / 100.0)
end
elseif hasBuffCfg.BuffType == GameEnum.GoldenSpyBuffType.SkillCountBuff then
end
if bIsLabel and self.GoldenSpyLevelData:CheckBuffActive(n) then
v.weight = v.weight * (1 + hasBuffCfg.Params[2] / 100.0)
end
end
end
end
end
local tbBuff = {}
for i = 1, 3 do
local buff, index = self:RandomBuff(tbBuffPool)
table.insert(tbBuff, buff.buffId)
table.remove(tbBuffPool, index)
end
self:ShowBuffSelect(tbBuff, callback)
return tbBuff
self:ShowBuffSelect(tbBuffPool, callback)
end
function GoldenSpyLevelCtrl:RandomBuff(tbBuffPool)
local tbBuffCount = {}
local tbHasBuff = self.GoldenSpyLevelData:GetBuffData()
local tbRemoveBuffIds = {}
for _, v in ipairs(tbHasBuff) do
tbBuffCount[v.buffId] = (tbBuffCount[v.buffId] or 0) + 1
end
for k, v in pairs(tbBuffCount) do
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", k)
if buffCfg ~= nil and v >= buffCfg.MaxCount then
table.insert(tbRemoveBuffIds, k)
end
end
for i = #tbBuffPool, 1, -1 do
for _, v in ipairs(tbRemoveBuffIds) do
if tbBuffPool[i].buffId == v then
table.remove(tbBuffPool, i)
break
end
end
end
local nTotalWeight = 0
for i, v in ipairs(tbBuffPool) do
nTotalWeight = nTotalWeight + math.floor(v.weight)
end
local nRandom = math.random(1, nTotalWeight)
local nSum = 0
local nIndex = 0
local buffData
for i, v in ipairs(tbBuffPool) do
nSum = nSum + v.weight
if nRandom <= nSum then
buffData = v
nIndex = i
break
end
end
if NovaAPI.IsEditorPlatform() then
print("GoldenSpyLevelCtrl: tbBuffPool:--------------------------------")
for i, v in ipairs(tbBuffPool) do
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
print("GoldenSpyLevelCtrl: buffId:", v.buffId, " Name:", buffCfg.Name, " weight:", v.weight, " TotalWeight:", nTotalWeight, " 概率:", v.weight / nTotalWeight * 100, "%")
end
end
return buffData, nIndex
end
function GoldenSpyLevelCtrl:ShowBuffSelect(tbBuff, callback)
function GoldenSpyLevelCtrl:ShowBuffSelect(tbBuffPool, callback)
self:Pause()
local tbShowItem = {}
local tbItems = self.GoldenSpyFloorData:GetItems()
local tbHasBuff = self.GoldenSpyLevelData:GetBuffData()
local curFloor = self.GoldenSpyLevelData:GetCurFloor()
for _, v in pairs(tbItems) do
local itemCfg = ConfigTable.GetData("GoldenSpyItem", v.itemId)
if itemCfg ~= nil and itemCfg.ShowValue ~= false then
local nScore = itemCfg.Score
for _, n in ipairs(tbHasBuff) do
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", n.buffId)
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore then
if buffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
if n.bActive and table.indexof(n.tbActiveFloor, curFloor) > 0 and buffCfg.Params[1] == itemCfg.ItemType then
nScore = nScore + buffCfg.Params[2]
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.DelayBuff then
if n.bActive and table.indexof(n.tbActiveFloor, curFloor) > 0 and buffCfg.Params[1] == itemCfg.ItemType then
nScore = nScore + buffCfg.Params[2]
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.PermanentBuff then
if n.bActive and buffCfg.Params[1] == itemCfg.ItemType then
nScore = nScore + buffCfg.Params[2]
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.SkillCountBuff then
end
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore and self.GoldenSpyLevelData:CheckBuffActive(n) and buffCfg.Params[1] == itemCfg.ItemType then
nScore = nScore + buffCfg.Params[2]
end
end
local itemData = {
@@ -620,7 +593,13 @@ function GoldenSpyLevelCtrl:ShowBuffSelect(tbBuff, callback)
end
end
local tbSortBuff = self:SortBuff(tbHasBuff)
EventManager.Hit(EventId.OpenPanel, PanelId.GoldenSpyBuffSelectPanel, tbShowItem, tbSortBuff, tbBuff, selectedCallback)
local getRefreshCallback = function()
return self.GoldenSpyLevelData:GetRefreshCount()
end
local refreshCallback = function()
self.GoldenSpyLevelData:UseRefreshCount()
end
EventManager.Hit(EventId.OpenPanel, self._panel.nBuffSelectPanelId, tbShowItem, tbSortBuff, tbBuffPool, selectedCallback, getRefreshCallback, refreshCallback, self.nActId)
end
function GoldenSpyLevelCtrl:GetHookBaseSpeed()
local levelCfg = ConfigTable.GetData("GoldenSpyLevel", self.nLevelId)
@@ -634,21 +613,8 @@ function GoldenSpyLevelCtrl:GetHookBaseSpeed()
local nSpeed = cfg.BaseSpeed
for _, v in ipairs(self.GoldenSpyLevelData:GetBuffData()) do
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddSpeed then
if buffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
if v.bActive and 0 < table.indexof(v.tbActiveFloor, self.GoldenSpyLevelData:GetCurFloor()) then
nSpeed = nSpeed + buffCfg.Params[1]
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.DelayBuff then
if v.bActive and 0 < table.indexof(v.tbActiveFloor, self.GoldenSpyLevelData:GetCurFloor()) then
nSpeed = nSpeed + buffCfg.Params[1]
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.PermanentBuff then
if v.bActive then
nSpeed = nSpeed + buffCfg.Params[1]
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.SkillCountBuff then
end
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddSpeed and self.GoldenSpyLevelData:CheckBuffActive(v) then
nSpeed = nSpeed + buffCfg.Params[1]
end
end
return nSpeed
@@ -661,21 +627,8 @@ function GoldenSpyLevelCtrl:GetHookRadius()
local nRadius = cfg.BaseRadius
for _, v in ipairs(self.GoldenSpyLevelData:GetBuffData()) do
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddHookRadius then
if buffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
if v.bActive and 0 < table.indexof(v.tbActiveFloor, self.GoldenSpyLevelData:GetCurFloor()) then
nRadius = nRadius + buffCfg.Params[1]
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.DelayBuff then
if v.bActive and 0 < table.indexof(v.tbActiveFloor, self.GoldenSpyLevelData:GetCurFloor()) then
nRadius = nRadius + buffCfg.Params[1]
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.PermanentBuff then
if v.bActive then
nRadius = nRadius + buffCfg.Params[1]
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.SkillCountBuff then
end
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddHookRadius and self.GoldenSpyLevelData:CheckBuffActive(v) then
nRadius = nRadius + buffCfg.Params[1]
end
end
return nRadius
@@ -828,6 +781,9 @@ function GoldenSpyLevelCtrl:OnBtnClick_Pause()
local bHasDic = self.floorCfg.DictionaryID ~= 0
self._mapNode.PausePanel:Open(bHasDic)
end
function GoldenSpyLevelCtrl:ShowTargetScore()
self._mapNode.targetScoreCtrl:ShowPanel(self.floorCfg.GoalScore, self.nCurScore)
end
function GoldenSpyLevelCtrl:OnBtnClick_Hook()
if self.bInCharAnimator then
return
@@ -844,44 +800,15 @@ function GoldenSpyLevelCtrl:OnBtnClick_Hook()
local nFactor = cfg.BaseFactor
for _, v in ipairs(self.GoldenSpyLevelData:GetBuffData()) do
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
if buffCfg ~= nil then
if buffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
if v.bActive and table.indexof(v.tbActiveFloor, self.GoldenSpyLevelData:GetCurFloor()) > 0 then
if buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.SpeedUpHook then
nSpeed = nSpeed + buffCfg.Params[1]
end
if buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddHookRadius then
nRadius = nRadius + buffCfg.Params[1]
end
if buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddHookK then
nFactor = nFactor + buffCfg.Params[1]
end
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.DelayBuff then
if v.bActive and table.indexof(v.tbActiveFloor, self.GoldenSpyLevelData:GetCurFloor()) > 0 then
if buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.SpeedUpHook then
nSpeed = nSpeed + buffCfg.Params[1]
end
if buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddHookRadius then
nRadius = nRadius + buffCfg.Params[1]
end
if buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddHookK then
nFactor = nFactor + buffCfg.Params[1]
end
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.PermanentBuff then
if v.bActive then
if buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.SpeedUpHook then
nSpeed = nSpeed + buffCfg.Params[1]
end
if buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddHookRadius then
nRadius = nRadius + buffCfg.Params[1]
end
if buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddHookK then
nFactor = nFactor + buffCfg.Params[1]
end
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.SkillCountBuff then
if buffCfg ~= nil and self.GoldenSpyLevelData:CheckBuffActive(v) then
if buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.SpeedUpHook then
nSpeed = nSpeed + buffCfg.Params[1]
end
if buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddHookRadius then
nRadius = nRadius + buffCfg.Params[1]
end
if buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddHookK then
nFactor = nFactor + buffCfg.Params[1]
end
end
end
@@ -901,21 +828,8 @@ function GoldenSpyLevelCtrl:OnBtnClick_Hook()
local itemNormalWeight = itemCtrl:GetWeight()
for _, v in ipairs(self.GoldenSpyLevelData:GetBuffData()) do
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.ReduceItemWeight then
if buffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
if v.bActive and table.indexof(v.tbActiveFloor, self.GoldenSpyLevelData:GetCurFloor()) > 0 and itemCtrl.nItemId == 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, self.GoldenSpyLevelData:GetCurFloor()) > 0 and itemCtrl.nItemId == buffCfg.Params[1] then
itemNormalWeight = itemNormalWeight - buffCfg.Params[2]
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.PermanentBuff then
if v.bActive and itemCtrl.nItemId == buffCfg.Params[1] then
itemNormalWeight = itemNormalWeight - buffCfg.Params[2]
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.SkillCountBuff then
end
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.ReduceItemWeight and self.GoldenSpyLevelData:CheckBuffActive(v) and itemCtrl.nItemId == buffCfg.Params[1] then
itemNormalWeight = itemNormalWeight - buffCfg.Params[2]
end
end
itemNormalWeight = math.max(0, itemNormalWeight)
@@ -936,21 +850,8 @@ function GoldenSpyLevelCtrl:OnBtnClick_Hook()
local nScore = itemCfg.Score
for _, v in ipairs(self.GoldenSpyLevelData:GetBuffData()) do
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", v.buffId)
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore and buffCfg.Params[1] == itemCfg.ItemType then
if buffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
if v.bActive and table.indexof(v.tbActiveFloor, self.GoldenSpyLevelData:GetCurFloor()) > 0 then
nScore = nScore + buffCfg.Params[2]
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.DelayBuff then
if v.bActive and table.indexof(v.tbActiveFloor, self.GoldenSpyLevelData:GetCurFloor()) > 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
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore and buffCfg.Params[1] == itemCfg.ItemType and self.GoldenSpyLevelData:CheckBuffActive(v) then
nScore = nScore + buffCfg.Params[2]
end
end
if nScore >= cfg.GetHighValue then
@@ -1028,6 +929,8 @@ function GoldenSpyLevelCtrl:OnBtnClick_Boom()
end
end, true, true, true)
table.insert(self.tbTimer, timer)
else
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("GoldenSpy_NoneBoom"))
end
end
function GoldenSpyLevelCtrl:OnBtnClick_Frozen()
@@ -1072,7 +975,9 @@ function GoldenSpyLevelCtrl:OnBtnClick_Frozen()
local timer = self:AddTimer(1, nTime, function()
self._mapNode.floorCtrl:StopFrozen()
self.bInFrozen = false
WwiseAudioMgr:PostEvent("Mode_steal_ice_break")
if self._mapNode.floorCtrl:CheckHasFrozenItem() then
WwiseAudioMgr:PostEvent("Mode_steal_ice_break")
end
end, true, true, true)
table.insert(self.tbTimer, timer)
local img_frozenCD = self._mapNode.img_frozenCD
@@ -1097,7 +1002,7 @@ function GoldenSpyLevelCtrl:OnBtnClick_ToolBox()
local nScore = itemCfg.Score
for _, n in ipairs(tbHasBuff) do
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", n.buffId)
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore and buffCfg.Params[1] == itemCfg.ItemType then
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore and self.GoldenSpyLevelData:CheckBuffActive(n) and buffCfg.Params[1] == itemCfg.ItemType then
nScore = nScore + buffCfg.Params[2]
end
end
@@ -1112,7 +1017,7 @@ function GoldenSpyLevelCtrl:OnBtnClick_ToolBox()
self:Resume()
end
local tbSortBuff = self:SortBuff(tbHasBuff)
self._mapNode.ToolBoxPanel:Show(tbShowItem, tbSortBuff, callback)
self._mapNode.ToolBoxPanel:Show(tbShowItem, tbSortBuff, callback, self.nActId, self._panel.nTipsPanelId)
end
function GoldenSpyLevelCtrl:GoldenSpy_Exit_OnClick()
self.bInPause = false
@@ -1125,8 +1030,7 @@ function GoldenSpyLevelCtrl:GoldenSpy_Restart_OnClick()
self.bInPause = false
self._mapNode.floorCtrl:Exit()
self:ClearTimer()
self.GoldenSpyLevelData:InitData()
self.GoldenSpyLevelData:StartLevel(self.nLevelId)
self.GoldenSpyLevelData:RestartCurrentFloor()
self.animator:Play("GoldenSpyPanel_in")
self:Init()
self:InitSkill(true)
@@ -1216,6 +1120,9 @@ function GoldenSpyLevelCtrl:OnEvent_GoldenSpyHookStartExtend()
local hookMask = self._mapNode.btn_Hook.transform:Find("AnimRoot/mask"):GetComponent("Image")
hookMask.gameObject:SetActive(true)
end
function GoldenSpyLevelCtrl:OnEvent_GoldenSpy_TargetScore_Close()
self:StartFloor()
end
function GoldenSpyLevelCtrl:OnEvent_GM_GoldenSpy_RefreshTask()
if self.nLevelType == GameEnum.GoldenSpyLevelType.Quest or self.nLevelType == GameEnum.GoldenSpyLevelType.Random then
self.GoldenSpyLevelData:RefreshTask()
@@ -19,8 +19,10 @@ function GoldenSpyLevelData:InitData()
tbItems = {}
}
self.nCompleteTaskCount = 0
self.nBuffRefreshCount = 0
self.nLevelType = nil
self.tbRandomPrefabName = {}
self.tempPointData = nil
end
function GoldenSpyLevelData:StartLevel(levelId)
self.levelId = levelId
@@ -36,12 +38,71 @@ function GoldenSpyLevelData:StartLevel(levelId)
self.tbSkillData[v[1]] = v[2]
self.tbUsedSkill[v[1]] = 0
end
self.nBuffRefreshCount = self.levelConfig.BuffRefeshCount
end
function GoldenSpyLevelData:RestartCurrentFloor()
if self.tempPointData == nil then
self:InitData()
self:StartLevel(self.levelId)
return
end
self.nCurScore = self.tempPointData.nCurScore
self.tbCatchItem = self.tempPointData.tbCatchItem
self.tbBuff = self.tempPointData.tbBuff
self.tbUsedSkill = self.tempPointData.tbUsedSkill
self.tbSkillData = self.tempPointData.tbSkillData
self.nCompleteTaskCount = self.tempPointData.nCompleteTaskCount
self.nBuffRefreshCount = self.tempPointData.nBuffRefreshCount
local tbList = {}
for i = 1, #self.tempPointData.tbRandomPrefabName do
table.insert(tbList, self.tempPointData.tbRandomPrefabName[i])
end
self.tbRandomPrefabName = tbList
self.floorData:InitData()
self.floorData:StartFloor(self.levelId, self.nCurFloorId)
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)
local tbCatchItem = {}
for k, v in pairs(self.tbCatchItem) do
tbCatchItem[k] = {
itemId = k,
itemCount = v.itemCount
}
end
local tbBuff = {}
for k, v in pairs(self.tbBuff) do
tbBuff[k] = {
buffId = v.buffId,
tbActiveFloor = v.tbActiveFloor,
bActive = v.bActive
}
end
local tbUsedSkill = {}
for k, v in pairs(self.tbUsedSkill) do
tbUsedSkill[k] = v
end
local tbSkillData = {}
for k, v in pairs(self.tbSkillData) do
tbSkillData[k] = v
end
local tbRandomPrefabName = {}
for i = 1, #self.tbRandomPrefabName do
table.insert(tbRandomPrefabName, self.tbRandomPrefabName[i])
end
self.tempPointData = {
nCurScore = self.nCurScore,
tbCatchItem = tbCatchItem,
tbBuff = tbBuff,
tbUsedSkill = tbUsedSkill,
tbSkillData = tbSkillData,
nCompleteTaskCount = self.nCompleteTaskCount,
nBuffRefreshCount = self.nBuffRefreshCount,
tbRandomPrefabName = tbRandomPrefabName
}
end
function GoldenSpyLevelData:GetFloorData()
return self.floorData
@@ -100,21 +161,8 @@ function GoldenSpyLevelData:CatchedItem(nItemId, itemCtrl)
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
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore and buffCfg.Params[1] == itemCfg.ItemType and self:CheckBuffActive(v) then
nScore = nScore + buffCfg.Params[2]
end
end
self.nCurScore = self.nCurScore + nScore
@@ -161,21 +209,8 @@ function GoldenSpyLevelData:RefreshTask()
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
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddTaskWeight and self:CheckBuffActive(v) then
nExWeight = nExWeight + buffCfg.Params[1]
end
end
local tbRandomTaskConfig = {}
@@ -231,24 +266,9 @@ function GoldenSpyLevelData:RefreshTask()
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
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddExScoreFactor and self:CheckBuffActive(v) then
nScore = nScore * (1 + buffCfg.Params[1] / 100.0)
nScore = math.floor(nScore)
end
end
self.taskData = {nScore = nScore, tbItems = tbItems}
@@ -308,35 +328,55 @@ function GoldenSpyLevelData:AddBuff(nBuffId)
if buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddSkillUseCount then
self.tbSkillData[buffCfg.Params[1]] = (self.tbSkillData[buffCfg.Params[1]] or 0) + buffCfg.Params[2]
EventManager.Hit("GoldenSpy_UpdateSkillCount", buffCfg.Params[1], self.tbSkillData[buffCfg.Params[1]])
elseif buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddBuffRefreshCount then
self.nBuffRefreshCount = self.nBuffRefreshCount + buffCfg.Params[1]
end
end
table.insert(self.tbBuff, buffEntity)
if self.taskData ~= nil and 0 < self.taskData.nScore and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddExScoreFactor then
if buffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
if buffEntity.bActive and 0 < table.indexof(buffEntity.tbActiveFloor, self.nCurFloor) then
self.taskData.nScore = self.taskData.nScore * (1 + buffCfg.Params[1] / 100.0)
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
if self.taskData ~= nil and 0 < self.taskData.nScore and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddExScoreFactor and self:CheckBuffActive(buffEntity) 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
if buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore then
EventManager.Hit("GoldenSpy_ItemUpdateScore", self.tbBuff)
end
end
function GoldenSpyLevelData:CheckBuffActive(buffEntity)
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", buffEntity.buffId)
if buffCfg == nil then
return false
end
local bActive = false
if buffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
if buffEntity.bActive and table.indexof(buffEntity.tbActiveFloor, self.nCurFloor) > 0 then
bActive = true
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.DelayBuff then
if buffEntity.bActive and table.indexof(buffEntity.tbActiveFloor, self.nCurFloor) > 0 then
bActive = true
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.PermanentBuff then
if buffEntity.bActive then
bActive = true
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.SkillCountBuff then
end
return bActive
end
function GoldenSpyLevelData:GetRefreshCount()
return self.nBuffRefreshCount
end
function GoldenSpyLevelData:UseRefreshCount()
if self.nBuffRefreshCount <= 0 then
return false
end
self.nBuffRefreshCount = self.nBuffRefreshCount - 1
return true
end
function GoldenSpyLevelData:AddRefreshCount(nCount)
self.nBuffRefreshCount = self.nBuffRefreshCount + nCount
end
function GoldenSpyLevelData:GetSkillData()
return self.tbSkillData
end
@@ -1,5 +1,5 @@
local GoldenSpyLevelSelectCtrl = class("GoldenSpyLevelSelectCtrl", BaseCtrl)
local UIAssetPath = "UI_Activity/_400008/SpriteAtlas/"
local UIAssetPath = "UI_Activity/_%s/SpriteAtlas/"
local PanelTab = {Group = 1, Level = 2}
local GroupState = {
Normal = 1,
@@ -42,6 +42,14 @@ GoldenSpyLevelSelectCtrl._mapNodeConfig = {
img_Pass = {},
go_lockTips = {},
txt_lockTips = {sComponentName = "TMP_Text"},
btnRight = {
sComponentName = "UIButton",
callback = "OnBtnClick_Right"
},
btnLeft = {
sComponentName = "UIButton",
callback = "OnBtnClick_Left"
},
btn_level = {
nCount = 2,
sComponentName = "UIButton",
@@ -85,12 +93,20 @@ function GoldenSpyLevelSelectCtrl:OnEnable()
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
local lastGroupId, lastLevelId = self.GoldenSpyActData:GetLastLevelData()
if lastGroupId ~= 0 then
self._panel.nSelectGroupId = lastGroupId
end
if lastLevelId ~= 0 then
self._panel.nSelectLevelId = lastLevelId
else
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
end
@@ -161,7 +177,7 @@ function GoldenSpyLevelSelectCtrl:InitGroupData()
img_pass.gameObject:SetActive(false)
table.insert(tbPointList, point)
end
self:SetPngSprite(bg, UIAssetPath .. groupCfg.IconPath)
self:SetPngSprite(bg, string.format(UIAssetPath, self.nActivityId) .. groupCfg.IconPath)
NovaAPI.SetTMPText(txt_GroupName, groupCfg.GroupName)
for m, n in ipairs(groupCfg.LevelList) do
local levelData = self.GoldenSpyActData:GetLevelDataById(n)
@@ -177,7 +193,7 @@ function GoldenSpyLevelSelectCtrl:InitGroupData()
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)
self:SetPngSprite(bg_lock, string.format(UIAssetPath, self.nActivityId) .. groupCfg.IconPath)
NovaAPI.SetTMPText(txt_GroupName_Lock, groupCfg.GroupName)
local nIndex = table.indexof(self.tbGroupIdList, v)
if 1 < nIndex then
@@ -217,7 +233,7 @@ function GoldenSpyLevelSelectCtrl:InitLevelData()
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)
self:SetPngSprite(img_level, string.format(UIAssetPath, self.nActivityId) .. levelCfg.IconPath)
NovaAPI.SetTMPText(txt_levelName, levelCfg.LevelName)
local nTotalFloor = #levelCfg.FloorList
NovaAPI.SetTMPText(txt_floorCount, orderedFormat(ConfigTable.GetUIText("GoldenSpy_TotalFloor"), nTotalFloor))
@@ -248,6 +264,18 @@ function GoldenSpyLevelSelectCtrl:InitLevelData()
end
end
self._mapNode.img_Pass.gameObject:SetActive(levelData.bFirstComplete)
local preGroupId = self.GoldenSpyActData:GetPreGroup(self._panel.nSelectGroupId)
local nextGroupId = self.GoldenSpyActData:GetNextGroup(self._panel.nSelectGroupId)
local bCanGoNextGroup = false
if nextGroupId ~= nil then
local groupData = self.GoldenSpyActData:GetLevelGroupDataById(nextGroupId)
local time = CS.ClientManager.Instance.serverTimeStamp
if time >= groupData.nStartTime and self.GoldenSpyActData:CheckPreGroupPassByGroupId(nextGroupId) then
bCanGoNextGroup = true
end
end
self._mapNode.btnRight.gameObject:SetActive(nextGroupId ~= nil and bCanGoNextGroup)
self._mapNode.btnLeft.gameObject:SetActive(preGroupId ~= nil)
end
function GoldenSpyLevelSelectCtrl:GetTimeText(remainTime)
local sTimeStr = ""
@@ -289,7 +317,7 @@ function GoldenSpyLevelSelectCtrl:OnBtnClick_Task()
if mapGroupData ~= nil then
local actData = mapGroupData:GetActivityDataByIndex(AllEnum.ActivityThemeFuncIndex.Task)
if actData ~= nil then
EventManager.Hit(EventId.OpenPanel, PanelId.Task_20102, actData.ActivityId, 4)
EventManager.Hit(EventId.OpenPanel, PanelId.Task_10109, actData.ActivityId, 4)
end
end
end
@@ -326,17 +354,67 @@ end
function GoldenSpyLevelSelectCtrl:OnBtnClick_Go()
self.GoldenSpyActData:StartLevel(self._panel.nSelectGroupId, self._panel.nSelectLevelId)
end
function GoldenSpyLevelSelectCtrl:OnBtnClick_Right()
local nextGroupId = self.GoldenSpyActData:GetNextGroup(self._panel.nSelectGroupId)
if nextGroupId ~= nil then
self._panel.nSelectGroupId = nextGroupId
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
for i = 1, 2 do
local levelCount = #groupCfg.LevelList
self._mapNode.btn_level[i].gameObject:SetActive(i <= levelCount)
self._mapNode.img_select[i].gameObject:SetActive(self._panel.nSelectLevelId == groupCfg.LevelList[i])
end
self:InitLevelData()
self.GoldenSpyActData:EnterGroupSelect(self._panel.nSelectGroupId)
end
end
function GoldenSpyLevelSelectCtrl:OnBtnClick_Left()
local preGroupId = self.GoldenSpyActData:GetPreGroup(self._panel.nSelectGroupId)
if preGroupId ~= nil then
self._panel.nSelectGroupId = preGroupId
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
for i = 1, 2 do
local levelCount = #groupCfg.LevelList
self._mapNode.btn_level[i].gameObject:SetActive(i <= levelCount)
self._mapNode.img_select[i].gameObject:SetActive(self._panel.nSelectLevelId == groupCfg.LevelList[i])
end
self:InitLevelData()
self.GoldenSpyActData:EnterGroupSelect(self._panel.nSelectGroupId)
end
end
function GoldenSpyLevelSelectCtrl:OnEvent_BackHome(nPanelId)
if nPanelId == PanelId.GoldenSpyLevelSelectPanel then
if nPanelId == self._panel._nPanelId then
if self._panel.nPanelTab == PanelTab.Group then
EventManager.Hit(EventId.ClosePanel, PanelId.GoldenSpyLevelSelectPanel)
EventManager.Hit(EventId.ClosePanel, self._panel._nPanelId)
elseif self._panel.nPanelTab == PanelTab.Level then
self:SwitchPanelTab(PanelTab.Group)
end
end
end
function GoldenSpyLevelSelectCtrl:OnEvent_Home(nPanelId)
if nPanelId == PanelId.GoldenSpyLevelSelectPanel then
if nPanelId == self._panel._nPanelId then
PanelManager.Home()
end
end
@@ -16,7 +16,7 @@ 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
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore and buffCfg.Params[1] == self.itemCfg.ItemType and self.floorCtrl.levelCtrl.GoldenSpyLevelData:CheckBuffActive(v) then
nScore = nScore + buffCfg.Params[2]
end
end
@@ -38,29 +38,6 @@ function GoldenSpyNormalItem:GetHitArea()
}
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)
@@ -85,7 +62,7 @@ function GoldenSpyNormalItem:OnEvent_GoldenSpy_ItemUpdateScore(tbBuff)
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
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore and buffCfg.Params[1] == self.itemCfg.ItemType and self.floorCtrl.levelCtrl.GoldenSpyLevelData:CheckBuffActive(v) then
nScore = nScore + buffCfg.Params[2]
end
end
@@ -41,27 +41,38 @@ GoldenSpyResultCtrl._mapNodeConfig = {
},
txt_ttValue = {sComponentName = "TMP_Text"},
img_finish = {},
FinishRoot = {}
FinishRoot = {},
btn_goNext2 = {
sComponentName = "UIButton",
callback = "OnBtnClick_GoNext2"
},
txt_goNext2 = {
sComponentName = "TMP_Text",
sLanguageId = "GoldenSpy_Result_GoNext2"
}
}
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]
self.data = tbParam[1]
end
self.bResult = self.data.bResult
self.nLevelId = self.data.nLevelId
self.nCurFloorId = self.data.nCurFloorId
self.nFloor = self.data.nFloor
self.nTotalFloor = self.data.nTotalFloor
self.nCurScore = self.data.nCurScore
self.finishCallback = self.data.finishCallback
self.goNextCallback = self.data.goNextCallback
self.bSuccess = self.data.bSuccess
self.bCanGoNextLevel = self.data.bCanGoNextLevel
self.goNextLevelCallback = self.data.goNextLevelCallback
self.levelCfg = ConfigTable.GetData("GoldenSpyLevel", self.nLevelId)
self.floorCfg = ConfigTable.GetData("GoldenSpyFloor", self.nCurFloorId)
self._mapNode.GoNextRoot:SetActive(not self.bResult)
self._mapNode.FinishRoot:SetActive(self.bResult)
self:SetFinishActive(self.bResult)
self:SetContent()
if self.bSuccess then
for i, v in ipairs(self._mapNode.txt_title) do
@@ -127,29 +138,46 @@ function GoldenSpyResultCtrl:SetFinishTarget()
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)
function GoldenSpyResultCtrl:SetFinishActive(bActive)
if bActive then
local callback = function(msgData, nextGroupId, nextLevelId)
self._mapNode.FinishRoot:SetActive(true)
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(msgData)
UTILS.OpenReceiveByChangeInfo(msgData)
self.nextGroupId = nextGroupId
self.nextLevelId = nextLevelId
if self.bSuccess and self.nextGroupId ~= nil and self.nextLevelId ~= nil then
self._mapNode.btn_goNext2.gameObject:SetActive(true)
else
self._mapNode.btn_goNext2.gameObject:SetActive(false)
end
cs_coroutine.start(wait)
end
if self.finishCallback ~= nil then
self.finishCallback(callback)
end
else
self._mapNode.FinishRoot:SetActive(false)
end
end
function GoldenSpyResultCtrl:OnBtnClick_Finish()
if self.bResult then
EventManager.Hit(EventId.ClosePanel, self._panel._nPanelId)
else
self.bResult = true
self._mapNode.GoNextRoot:SetActive(not self.bResult)
self._mapNode.FinishRoot:SetActive(self.bResult)
self:SetFinishActive(self.bResult)
end
end
function GoldenSpyResultCtrl:OnBtnClick_GoNext()
EventManager.Hit(EventId.ClosePanel, PanelId.GoldenSpyResultPanel)
EventManager.Hit(EventId.ClosePanel, self._panel._nPanelId)
if self.goNextCallback ~= nil then
self.goNextCallback()
end
end
function GoldenSpyResultCtrl:OnBtnClick_GoNext2()
EventManager.Hit(EventId.ClosePanel, self._panel._nPanelId)
if self.goNextCallback ~= nil then
self.goNextLevelCallback(self.nextGroupId, self.nextLevelId)
end
end
return GoldenSpyResultCtrl
@@ -0,0 +1,55 @@
local GoldenSpyTargetScoreCtrl = class("GoldenSpyTargetScoreCtrl", BaseCtrl)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
GoldenSpyTargetScoreCtrl._mapNodeConfig = {
blur = {},
animator = {
sNodeName = "----SafeAreaRoot----",
sComponentName = "Animator"
},
AnimRoot = {},
UIParticle = {},
btn_close = {
sNodeName = "btn_TargetClose",
sComponentName = "UIButton",
callback = "OnBtnClick_Close"
},
txt_ScoreTitle = {
sComponentName = "TMP_Text",
sLanguageId = "GoldenSpy_Result_GoNextTarget1"
},
txt_Num = {sComponentName = "TMP_Text"},
txt_Num2 = {sComponentName = "TMP_Text"}
}
GoldenSpyTargetScoreCtrl._mapEventConfig = {}
GoldenSpyTargetScoreCtrl._mapRedDotConfig = {}
function GoldenSpyTargetScoreCtrl:Awake()
end
function GoldenSpyTargetScoreCtrl:ShowPanel(nTargetScore, nCurScore)
self.gameObject:SetActive(true)
self._mapNode.AnimRoot:SetActive(false)
self._mapNode.UIParticle:SetActive(false)
self._mapNode.blur:SetActive(true)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.AnimRoot:SetActive(true)
self._mapNode.UIParticle:SetActive(true)
end
cs_coroutine.start(wait)
self._mapNode.animator:Play("open")
self.tbGamepadUINode = {}
GamepadUIManager.EnableGamepadUI("GoldenSpyTargetScoreCtrl", self.tbGamepadUINode)
EventManager.Hit(EventId.TemporaryBlockInput, 1)
NovaAPI.SetTMPText(self._mapNode.txt_Num, nTargetScore)
NovaAPI.SetTMPText(self._mapNode.txt_Num2, ConfigTable.GetUIText("GoldenSpy_Result_GoNextTarget2") .. ":" .. nCurScore)
end
function GoldenSpyTargetScoreCtrl:OnBtnClick_Close()
GamepadUIManager.DisableGamepadUI("GoldenSpyTargetScoreCtrl")
self._mapNode.animator:Play("close")
self:AddTimer(1, 0.15, function()
self.gameObject:SetActive(false)
EventManager.Hit("GoldenSpy_TargetScore_Close")
end, true, true, true)
end
return GoldenSpyTargetScoreCtrl
@@ -1,7 +1,7 @@
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/"
local BuffSpritePath = "UI_Activity/_%s/SpriteAtlas/Buff/"
local ItemSpritePath = "UI_Activity/_%s/SpriteAtlas/Item/"
GoldenSpyToolBoxCtrl._mapNodeConfig = {
txt_toolBox = {
sComponentName = "TMP_Text",
@@ -38,9 +38,11 @@ function GoldenSpyToolBoxCtrl:OnDisable()
end
function GoldenSpyToolBoxCtrl:OnDestroy()
end
function GoldenSpyToolBoxCtrl:Show(tbItem, tbBuff, callback)
function GoldenSpyToolBoxCtrl:Show(tbItem, tbBuff, callback, nActId, tipsPanelId)
self.gameObject:SetActive(true)
self._mapNode.safeAreaRoot:SetActive(false)
self.nActId = nActId
self.nTipsPanelId = tipsPanelId
self:RefreshBuffList(tbBuff)
self:RefreshItemList(tbItem)
self.callback = callback
@@ -73,7 +75,7 @@ function GoldenSpyToolBoxCtrl:OnRefreshBuffGrid(goGrid, gridIndex)
objCtrl = self:BindCtrlByNode(goGrid, "Game.UI.Activity.GoldenSpy.GoldenSpyBuffCellCtrl")
self.mapBuffCellCtrl[nInstanceId] = objCtrl
end
objCtrl:SetData(self.tbBuff[nIndex])
objCtrl:SetData(self.tbBuff[nIndex], self.nActId, self.nTipsPanelId)
end
function GoldenSpyToolBoxCtrl:RefreshItemList(tbItem)
self.tbShowItem = tbItem
@@ -95,7 +97,7 @@ function GoldenSpyToolBoxCtrl:OnRefreshItemGrid(goGrid, gridIndex)
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")
self:SetPngSprite(img_icon, string.format(ItemSpritePath, self.nActId) .. itemCfg.IconPath .. "_s")
NovaAPI.SetTMPText(txt_score, itemScore)
end
function GoldenSpyToolBoxCtrl:OnBtnClick_Close()
@@ -3,7 +3,7 @@ MiningGameGuidePanel._sUIResRootPath = "UI_Activity/"
MiningGameGuidePanel._tbDefine = {
{
sPrefabPath = "_400011/MiningGameGuidePanel.prefab",
sCtrlName = "Game.UI.Activity.Mining.400011.MiningGameGuideCtrl"
sCtrlName = "Game.UI.Activity.Mining.MiningGameGuideCtrl"
}
}
function MiningGameGuidePanel:Awake()
@@ -5,10 +5,11 @@ MiningGamePanel._sUIResRootPath = "UI_Activity/"
MiningGamePanel._tbDefine = {
{
sPrefabPath = "_400011/MiningGamePanel.prefab",
sCtrlName = "Game.UI.Activity.Mining.400011.MiningGameCtrl"
sCtrlName = "Game.UI.Activity.Mining.MiningGameCtrl"
}
}
function MiningGamePanel:Awake()
self.nGuidePanelId = PanelId.MiningGameGuidePanel_400011
end
function MiningGamePanel:OnEnable()
end
@@ -4,7 +4,7 @@ MiningGameQuestPanel._sUIResRootPath = "UI_Activity/"
MiningGameQuestPanel._tbDefine = {
{
sPrefabPath = "_400011/MiningGameQuestPanel.prefab",
sCtrlName = "Game.UI.Activity.Mining.400011.MiningGameQuestCtrl"
sCtrlName = "Game.UI.Activity.Mining.MiningGameQuestCtrl"
}
}
function MiningGameQuestPanel:Awake()
@@ -1,62 +0,0 @@
local MiningStoryCtrl = class("MiningStoryCtrl", BaseCtrl)
MiningStoryCtrl._mapNodeConfig = {
txt_Title = {sComponentName = "TMP_Text"},
loosv = {
sNodeName = "storyList",
sComponentName = "LoopScrollView"
},
btn_Close = {
sComponentName = "UIButton",
callback = "OnBtnClick_ClosePanel"
}
}
MiningStoryCtrl._mapEventConfig = {
MiningStoryFinish = "RefreshData"
}
function MiningStoryCtrl:Init()
self.tbStoryList = {}
self.tbGridCtrl = {}
self.actData = nil
end
function MiningStoryCtrl:Awake(...)
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
end
self:RefreshData()
end
function MiningStoryCtrl:OnDisable()
end
function MiningStoryCtrl:OnDestroy(...)
if not self.tbGridCtrl then
for k, v in pairs(self.tbGridCtrl) do
self:UnBindCtrlByNode(v)
end
end
end
function MiningStoryCtrl:RefreshData(...)
self:Init()
self:GetData()
end
function MiningStoryCtrl:GetData()
self.actData = PlayerData.Activity:GetActivityDataById(self.nActId)
self.tbStoryList = self.actData:GetGroupStoryData()
table.sort(self.tbStoryList, function(a, b)
return a.id < b.id
end)
self._mapNode.loosv:SetAnim(0.1)
self._mapNode.loosv:Init(#self.tbStoryList, self, self.OnGridRefresh)
end
function MiningStoryCtrl:OnGridRefresh(gridGo, gridIndex)
local nIndex = gridIndex + 1
local nInstanceId = gridGo:GetInstanceID()
if not self.tbGridCtrl[nInstanceId] then
self.tbGridCtrl[nInstanceId] = self:BindCtrlByNode(gridGo, "Game.Activity.Mining.400011.MiningStoryCellCtrl")
end
local data = self.tbStoryList[nIndex]
self.tbGridCtrl[nInstanceId]:SetData(data.id, nIndex, data.bIsLock, data.bIsRead)
end
function MiningStoryCtrl:OnBtnClick_ClosePanel()
EventManager.Hit(EventId.ClosePanel, PanelId.MiningGameStory_400002)
end
return MiningStoryCtrl
@@ -1,22 +0,0 @@
local MiningStoryPanel = class("MiningStoryPanel", BasePanel)
MiningStoryPanel._bIsMainPanel = false
MiningStoryPanel._sUIResRootPath = "UI_Activity/"
MiningStoryPanel._tbDefine = {
{
sPrefabPath = "_400011/MiningStoryPanel.prefab",
sCtrlName = "Game.UI.Activity.Mining.400011.MiningStoryCtrl"
}
}
function MiningStoryPanel:Awake()
end
function MiningStoryPanel:OnEnable()
end
function MiningStoryPanel:OnAfterEnter()
end
function MiningStoryPanel:OnDisable()
end
function MiningStoryPanel:OnDestroy()
end
function MiningStoryPanel:OnRelease()
end
return MiningStoryPanel
@@ -1,7 +1,7 @@
local MiningGameCtrl = class("MiningGameCtrl", BaseCtrl)
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
local listPrefabPath = "UI_Activity/_400011/GridCell/"
local assetPath = "UI_Activity/_400011/SpriteAtlas/Sprite/"
local listPrefabPath = "UI_Activity/_%s/GridCell/"
local assetPath = "UI_Activity/_%s/SpriteAtlas/Sprite/"
local signal_typeA = "zs_mining_signal_01"
local signal_typeB = "zs_mining_signal_02"
local signal_typeC = "zs_mining_signal_03"
@@ -89,7 +89,7 @@ function MiningGameCtrl:Awake()
self.miningData = PlayerData.Activity:GetActivityDataById(self.nActId)
if self.miningData:GetIsFirstIn() then
local cb = function()
local DicConfig = ConfigTable.GetData("TopBar", "MiningGame_400011")
local DicConfig = ConfigTable.GetData("TopBar", string.format("MiningGame_%s", self.nActId))
if DicConfig ~= nil then
local dicId = DicConfig.EntryId
if dicId ~= 0 then
@@ -110,7 +110,7 @@ function MiningGameCtrl:OnEnable()
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_MiningEnd"))
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
EventManager.Hit(EventId.ClosePanel, PanelId.MiningGame_400011)
EventManager.Hit(EventId.ClosePanel, self._panel.nPanelId)
NovaAPI.InputEnable()
end
cs_coroutine.start(wait)
@@ -162,14 +162,14 @@ end
function MiningGameCtrl:UpdateLevelData()
self:InitData()
local config = self.miningData:GetMiningCfg()
local prefabPath = listPrefabPath .. config.GridListPrefab .. ".prefab"
local prefabPath = string.format(listPrefabPath, self.nActId) .. config.GridListPrefab .. ".prefab"
if self.gridListCtrl == nil then
for i = 1, 21 do
delChildren(self._mapNode.cellPos[i].transform)
local goCell = self:CreatePrefabInstance(prefabPath, self._mapNode.cellPos[i].transform)
goCell.name = "cell" .. i
end
self.gridListCtrl = self:BindCtrlByNode(self._mapNode.GirdListPrefab, "Game.UI.Activity.Mining.400011.MiningGridListCtrl")
self.gridListCtrl = self:BindCtrlByNode(self._mapNode.GirdListPrefab, "Game.UI.Activity.Mining.MiningGridListCtrl")
self.gridListCtrl:SetData(self.nActId)
end
self:UpdateSupData()
@@ -232,13 +232,13 @@ function MiningGameCtrl:UpdateRewardList()
local img_get = self._mapNode.signal[i].transform:Find("bg_reward/img_get")
local img_signal = self._mapNode.signal[i].transform:Find("bg_reward/img_signal")
if rewardConfig.MiningItemType == GameEnum.miningRewardType.RewardTypeA then
self:SetPngSprite(img_signal:GetComponent("Image"), assetPath .. signal_typeA)
self:SetPngSprite(img_signal:GetComponent("Image"), string.format(assetPath, self.nActId) .. signal_typeA)
elseif rewardConfig.MiningItemType == GameEnum.miningRewardType.RewardTypeB then
self:SetPngSprite(img_signal:GetComponent("Image"), assetPath .. signal_typeB)
self:SetPngSprite(img_signal:GetComponent("Image"), string.format(assetPath, self.nActId) .. signal_typeB)
elseif rewardConfig.MiningItemType == GameEnum.miningRewardType.RewardTypeC then
self:SetPngSprite(img_signal:GetComponent("Image"), assetPath .. signal_typeC)
self:SetPngSprite(img_signal:GetComponent("Image"), string.format(assetPath, self.nActId) .. signal_typeC)
else
self:SetPngSprite(img_signal:GetComponent("Image"), assetPath .. signal_typeD)
self:SetPngSprite(img_signal:GetComponent("Image"), string.format(assetPath, self.nActId) .. signal_typeD)
end
img_signal:GetComponent("Image"):SetNativeSize()
img_get.gameObject:SetActive(rewardData.bIsGet)
@@ -283,7 +283,7 @@ function MiningGameCtrl:CheckPassAllLevel()
self._mapNode.GirdListPrefab:SetActive(not bPassAllLevel)
end
function MiningGameCtrl:OnBtnClick_OpenGuidePanel()
EventManager.Hit(EventId.OpenPanel, PanelId.MiningGameGuidePanel_400011, self.nActId)
EventManager.Hit(EventId.OpenPanel, self._panel.nGuidePanelId, self.nActId)
end
function MiningGameCtrl:OnBtnClick_OpenTask()
if PlayerData.Activity:IsActivityInActivityGroup(self.nActId) then
@@ -42,7 +42,7 @@ function MiningGameGuideCtrl:Awake()
end
self.miningData = PlayerData.Activity:GetActivityDataById(self.nActId)
local idList = self.miningData:GetDicGroupId()
self.cardPrefabPath = "UI_Activity/_400011/CardCell.prefab"
self.cardPrefabPath = string.format("UI_Activity/_%s/CardCell.prefab", self.nActId)
self.CardCtrl = {}
self:InitList(idList)
end
@@ -68,7 +68,7 @@ function MiningGameGuideCtrl:InitList(list)
end
if go ~= nil then
go.name = config.Id
local ctrl = self:BindCtrlByNode(go, "Game.UI.Activity.Mining.400011.MiningGameGuideCardCtrl")
local ctrl = self:BindCtrlByNode(go, "Game.UI.Activity.Mining.MiningGameGuideCardCtrl")
ctrl:SetData(config.Id)
table.insert(self.CardCtrl, ctrl)
end
@@ -63,7 +63,7 @@ function MiningGameQuestCtrl:OnGridRefresh(goGrid, gridIndex)
local nIndex = gridIndex + 1
local nInstanceId = goGrid:GetInstanceID()
if not self.tbGridCtrl[nInstanceId] then
self.tbGridCtrl[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.Activity.Mining.400011.MiningQuestCellCtrl")
self.tbGridCtrl[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.Activity.Mining.MiningQuestCellCtrl")
end
self.tbGridCtrl[nInstanceId]:SetData(self.nActId, self.tbQuestList[nIndex])
end
@@ -13,7 +13,7 @@ local ColumnCount = {
MiningGridListCtrl._mapNodeConfig = {
cell = {
nCount = 21,
sCtrlName = "Game.UI.Activity.Mining.400011.MiningGridCellCtrl"
sCtrlName = "Game.UI.Activity.Mining.MiningGridCellCtrl"
},
reward_Go = {nCount = 3},
reward = {nCount = 3, sComponentName = "Image"}
@@ -15,10 +15,11 @@ ThrowGiftSettleCtrl._mapNodeConfig = {
sActionIconType = "Dark"
},
txtBtnClose = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "ThrowGift_Settle_Close"
},
txtBtnConfirm = {sComponentName = "TMP_Text"},
txtBtnConfirm = {nCount = 2, sComponentName = "TMP_Text"},
TMPSettleScoreTitle = {
sComponentName = "TMP_Text",
sLanguageId = "ThrowGift_Settle_ScoreTitle"
@@ -67,7 +68,9 @@ end
function ThrowGiftSettleCtrl:ShowSettle(bWin, nScore, nGift, nPenguin, bShowPenguin, bNextUnlock, changeInfo, nLevelId)
self.bWin = bWin
GamepadUIManager.EnableGamepadUI("ThrowGiftSettle", self.tbGamepadUINode)
NovaAPI.SetTMPText(self._mapNode.txtBtnConfirm, self.bWin and ConfigTable.GetUIText("ThrowGift_Settle_NextLevel") or ConfigTable.GetUIText("ThrowGift_Settle_Restart"))
local sConfirm = self.bWin and ConfigTable.GetUIText("ThrowGift_Settle_NextLevel") or ConfigTable.GetUIText("ThrowGift_Settle_Restart")
NovaAPI.SetTMPText(self._mapNode.txtBtnConfirm[1], sConfirm)
NovaAPI.SetTMPText(self._mapNode.txtBtnConfirm[2], sConfirm)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
NovaAPI.SetCanvasGroupAlpha(self.canvasGroup, 1)