Initial version - 1.2.0.60
EN: 1.2.0.60 CN: 1.2.0.61 JP: 1.2.0.63 KR: 1.2.0.67
This commit is contained in:
@@ -0,0 +1,181 @@
|
||||
local BuildAttrPreviewCtrl = class("BuildAttrPreviewCtrl", BaseCtrl)
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
BuildAttrPreviewCtrl._mapNodeConfig = {
|
||||
blur = {
|
||||
sNodeName = "t_fullscreen_blur_blue"
|
||||
},
|
||||
aniBlur = {
|
||||
sNodeName = "t_fullscreen_blur_blue",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
btnCloseBg = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Attribute_Title"
|
||||
},
|
||||
window = {},
|
||||
aniWindow = {sNodeName = "window", sComponentName = "Animator"},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Attribute_DescTip"
|
||||
},
|
||||
All = {sNodeName = "--All---"},
|
||||
svAll = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
Cur = {sNodeName = "--Cur---"},
|
||||
svCur = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
txtCurScoreCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Attribute_CurScore"
|
||||
},
|
||||
imgBuildIcon = {sComponentName = "Image"},
|
||||
txtCurScore = {sComponentName = "TMP_Text"},
|
||||
ActionBar = {
|
||||
sCtrlName = "Game.UI.ActionBar.ActionBarCtrl"
|
||||
},
|
||||
btnShortcutClose = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
}
|
||||
}
|
||||
BuildAttrPreviewCtrl._mapEventConfig = {}
|
||||
function BuildAttrPreviewCtrl:Open()
|
||||
self._mapNode.blur:SetActive(true)
|
||||
self:PlayInAni()
|
||||
self._mapNode.All:SetActive(not self.nRankId)
|
||||
self._mapNode.Cur:SetActive(self.nRankId)
|
||||
if self.nRankId then
|
||||
self:RefreshCur()
|
||||
else
|
||||
self:RefreshAll()
|
||||
end
|
||||
end
|
||||
function BuildAttrPreviewCtrl:RefreshCur()
|
||||
local mapCfg = ConfigTable.GetData("StarTowerBuildRank", self.nRankId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
local sScore = "Icon/BuildRank/BuildRank_" .. self.nRankId
|
||||
self:SetPngSprite(self._mapNode.imgBuildIcon, sScore)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCurScore, self.nScore)
|
||||
self.tbRank = PlayerData.Build:GetBuildRank()
|
||||
local nCount = #self.tbRank
|
||||
self._mapNode.svCur.gameObject:SetActive(0 < nCount)
|
||||
if 0 < nCount then
|
||||
self._mapNode.svCur:Init(nCount, self, self.OnGridRefresh_Cur)
|
||||
self._mapNode.svCur:SetScrollGridPos(self.nRankId - 1, 0.1, -1)
|
||||
end
|
||||
end
|
||||
function BuildAttrPreviewCtrl:OnGridRefresh_Cur(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local rtGrid = goGrid.transform:Find("btnGrid/AnimRoot")
|
||||
local imgOn = rtGrid.transform:Find("imgOnBg").gameObject
|
||||
local imgOff = rtGrid.transform:Find("imgOffBg").gameObject
|
||||
local txtDesc = rtGrid.transform:Find("txtDesc"):GetComponent("TMP_Text")
|
||||
local txtLevel = rtGrid.transform:Find("txtLevel"):GetComponent("TMP_Text")
|
||||
local txtScore = rtGrid.transform:Find("txtScore"):GetComponent("TMP_Text")
|
||||
local txtScoreCn = rtGrid.transform:Find("txtScore/imgBg/txtScoreCn"):GetComponent("TMP_Text")
|
||||
local imgSelect = rtGrid.transform:Find("imgSelect").gameObject
|
||||
local imgIcon = rtGrid.transform:Find("imgIcon"):GetComponent("Image")
|
||||
local mapData = self.tbRank[nIndex]
|
||||
local bOn = nIndex == self.nRankId
|
||||
imgSelect:SetActive(bOn)
|
||||
imgOn:SetActive(bOn)
|
||||
imgOff:SetActive(not bOn)
|
||||
NovaAPI.SetTMPText(txtLevel, orderedFormat(ConfigTable.GetUIText("Build_Attribute_Level"), mapData.Level))
|
||||
NovaAPI.SetTMPText(txtScoreCn, ConfigTable.GetUIText("Build_Score"))
|
||||
NovaAPI.SetTMPText(txtScore, mapData.MinGrade)
|
||||
NovaAPI.SetTMPText(txtDesc, UTILS.ParseParamDesc(ConfigTable.GetUIText(mapData.Desc), mapData, nil, nil, "#ec6d21"))
|
||||
local sScore = "Icon/BuildRank/BuildRank_" .. nIndex
|
||||
self:SetPngSprite(imgIcon, sScore)
|
||||
end
|
||||
function BuildAttrPreviewCtrl:RefreshAll()
|
||||
self.tbRank = PlayerData.Build:GetBuildRank()
|
||||
local nCount = #self.tbRank
|
||||
self._mapNode.svAll.gameObject:SetActive(0 < nCount)
|
||||
if 0 < nCount then
|
||||
self._mapNode.svAll:Init(nCount, self, self.OnGridRefresh_All)
|
||||
end
|
||||
end
|
||||
function BuildAttrPreviewCtrl:OnGridRefresh_All(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local rtGrid = goGrid.transform:Find("btnGrid/AnimRoot")
|
||||
local imgOn = rtGrid.transform:Find("imgOnBg").gameObject
|
||||
local imgOff = rtGrid.transform:Find("imgOffBg").gameObject
|
||||
local txtDesc = rtGrid.transform:Find("txtDesc"):GetComponent("TMP_Text")
|
||||
local txtLevel = rtGrid.transform:Find("txtLevel"):GetComponent("TMP_Text")
|
||||
local txtScore = rtGrid.transform:Find("txtScore"):GetComponent("TMP_Text")
|
||||
local txtScoreCn = rtGrid.transform:Find("txtScore/imgBg/txtScoreCn"):GetComponent("TMP_Text")
|
||||
local imgIcon = rtGrid.transform:Find("imgIcon"):GetComponent("Image")
|
||||
local mapData = self.tbRank[nIndex]
|
||||
local bOn = true
|
||||
imgOn:SetActive(bOn)
|
||||
imgOff:SetActive(not bOn)
|
||||
NovaAPI.SetTMPText(txtLevel, orderedFormat(ConfigTable.GetUIText("Build_Attribute_Level"), mapData.Level))
|
||||
NovaAPI.SetTMPText(txtScoreCn, ConfigTable.GetUIText("Build_Score"))
|
||||
NovaAPI.SetTMPText(txtScore, mapData.MinGrade)
|
||||
NovaAPI.SetTMPText(txtDesc, UTILS.ParseParamDesc(ConfigTable.GetUIText(mapData.Desc), mapData, nil, nil, "#ec6d21"))
|
||||
local sScore = "Icon/BuildRank/BuildRank_" .. nIndex
|
||||
self:SetPngSprite(imgIcon, sScore)
|
||||
end
|
||||
function BuildAttrPreviewCtrl:PlayInAni()
|
||||
self._mapNode.window:SetActive(true)
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
function BuildAttrPreviewCtrl:PlayOutAni()
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_out")
|
||||
self._mapNode.aniBlur:SetTrigger("tOut")
|
||||
self:AddTimer(1, 0.2, "Close", true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
end
|
||||
function BuildAttrPreviewCtrl:Close()
|
||||
self._mapNode.window:SetActive(false)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.BuildAttrPreview)
|
||||
end
|
||||
function BuildAttrPreviewCtrl:Awake()
|
||||
self._mapNode.window:SetActive(false)
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.nRankId = tbParam[1]
|
||||
self.nScore = tbParam[2]
|
||||
end
|
||||
self._mapNode.btnShortcutClose.gameObject:SetActive(GamepadUIManager.GetInputState())
|
||||
if GamepadUIManager.GetInputState() then
|
||||
local tbConfig = {
|
||||
{
|
||||
sAction = "Back",
|
||||
sLang = "ActionBar_Back"
|
||||
}
|
||||
}
|
||||
self._mapNode.ActionBar:InitActionBar(tbConfig)
|
||||
end
|
||||
end
|
||||
function BuildAttrPreviewCtrl:OnEnable()
|
||||
if GamepadUIManager.GetInputState() then
|
||||
GamepadUIManager.EnableGamepadUI("BuildAttrPreviewCtrl", self:GetGamepadUINode(), nil, true)
|
||||
end
|
||||
self:Open()
|
||||
end
|
||||
function BuildAttrPreviewCtrl:OnDisable()
|
||||
if GamepadUIManager.GetInputState() then
|
||||
GamepadUIManager.DisableGamepadUI("BuildAttrPreviewCtrl")
|
||||
end
|
||||
end
|
||||
function BuildAttrPreviewCtrl:OnDestroy()
|
||||
end
|
||||
function BuildAttrPreviewCtrl:OnBtnClick_Close()
|
||||
self:PlayOutAni()
|
||||
end
|
||||
return BuildAttrPreviewCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local BuildAttrPreviewPanel = class("BuildAttrPreviewPanel", BasePanel)
|
||||
BuildAttrPreviewPanel._bIsMainPanel = false
|
||||
BuildAttrPreviewPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "StarTowerBuild/BuildAttrPreviewPanel.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.Build.BuildAttrPreviewCtrl"
|
||||
}
|
||||
}
|
||||
function BuildAttrPreviewPanel:Awake()
|
||||
end
|
||||
function BuildAttrPreviewPanel:OnEnable()
|
||||
end
|
||||
function BuildAttrPreviewPanel:OnAfterEnter()
|
||||
end
|
||||
function BuildAttrPreviewPanel:OnDisable()
|
||||
end
|
||||
function BuildAttrPreviewPanel:OnDestroy()
|
||||
end
|
||||
function BuildAttrPreviewPanel:OnRelease()
|
||||
end
|
||||
return BuildAttrPreviewPanel
|
||||
@@ -0,0 +1,42 @@
|
||||
local BuildDiscCtrl = class("BuildDiscCtrl", BaseCtrl)
|
||||
BuildDiscCtrl._mapNodeConfig = {
|
||||
goDiscSkill = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.StarTower.Build.BuildDiscSkillCtrl"
|
||||
},
|
||||
btnDisc = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Disc"
|
||||
},
|
||||
txtDiscName = {sComponentName = "TMP_Text"},
|
||||
imgDiscIcon = {sComponentName = "Image"}
|
||||
}
|
||||
BuildDiscCtrl._mapEventConfig = {}
|
||||
function BuildDiscCtrl:Refresh(tbDisc, nIndex)
|
||||
end
|
||||
function BuildDiscCtrl:Awake()
|
||||
end
|
||||
function BuildDiscCtrl:OnEnable()
|
||||
end
|
||||
function BuildDiscCtrl:OnDisable()
|
||||
end
|
||||
function BuildDiscCtrl:OnDestroy()
|
||||
end
|
||||
function BuildDiscCtrl:OnRelease()
|
||||
end
|
||||
function BuildDiscCtrl:OnBtnClick_Disc(btn)
|
||||
local nIdx = 0
|
||||
local nDiscId = 0
|
||||
local tbAllDisc = {}
|
||||
for nId, v in pairs(self.tbDisc) do
|
||||
nIdx = nIdx + 1
|
||||
if nIdx == self.nIndex then
|
||||
nDiscId = nId
|
||||
end
|
||||
table.insert(tbAllDisc, nId)
|
||||
end
|
||||
if nDiscId ~= 0 then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Disc, nDiscId, tbAllDisc)
|
||||
end
|
||||
end
|
||||
return BuildDiscCtrl
|
||||
@@ -0,0 +1,72 @@
|
||||
local BuildDiscSkillCtrl = class("BuildDiscSkillCtrl", BaseCtrl)
|
||||
BuildDiscSkillCtrl._mapNodeConfig = {
|
||||
btnDiscSkill = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Tips"
|
||||
},
|
||||
goSkillNone = {},
|
||||
imgDiscSkillIcon = {sComponentName = "Image"},
|
||||
imgDiscSkillIconBg = {nCount = 2, sComponentName = "Image"},
|
||||
txtDiscSkillLv = {sComponentName = "TMP_Text", sLanguageId = "Lv"},
|
||||
txtDiscSkillLevel = {sComponentName = "TMP_Text"},
|
||||
goSkillOff = {}
|
||||
}
|
||||
BuildDiscSkillCtrl._mapEventConfig = {}
|
||||
function BuildDiscSkillCtrl:Refresh(mapSkill, card)
|
||||
self.mapSkill = mapSkill
|
||||
self.card = card
|
||||
local bEmpty = not self.mapSkill
|
||||
self._mapNode.goSkillNone:SetActive(bEmpty)
|
||||
self._mapNode.imgDiscSkillIcon.gameObject:SetActive(not bEmpty)
|
||||
self._mapNode.imgDiscSkillIconBg[1].gameObject:SetActive(not bEmpty)
|
||||
self._mapNode.txtDiscSkillLv.gameObject:SetActive(not bEmpty)
|
||||
self._mapNode.goSkillOff:SetActive(not bEmpty)
|
||||
if bEmpty then
|
||||
return
|
||||
end
|
||||
local skillCfg
|
||||
if mapSkill.nType == AllEnum.DiscSkillType.Common then
|
||||
skillCfg = ConfigTable.GetData("DiscCommonSkill", mapSkill.nId)
|
||||
else
|
||||
skillCfg = ConfigTable.GetData("DiscPassiveSkill", mapSkill.nId)
|
||||
end
|
||||
if skillCfg == nil then
|
||||
return
|
||||
end
|
||||
for i = 1, 2 do
|
||||
self:SetPngSprite(self._mapNode.imgDiscSkillIconBg[i], skillCfg.IconBg)
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgDiscSkillIcon, skillCfg.Icon)
|
||||
local bUnlock = mapSkill.nLevel > 0
|
||||
self._mapNode.goSkillOff:SetActive(not bUnlock)
|
||||
self._mapNode.txtDiscSkillLv.gameObject:SetActive(bUnlock)
|
||||
if bUnlock then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDiscSkillLevel, mapSkill.nLevel)
|
||||
end
|
||||
end
|
||||
function BuildDiscSkillCtrl:Awake()
|
||||
end
|
||||
function BuildDiscSkillCtrl:OnEnable()
|
||||
end
|
||||
function BuildDiscSkillCtrl:OnDisable()
|
||||
end
|
||||
function BuildDiscSkillCtrl:OnDestroy()
|
||||
end
|
||||
function BuildDiscSkillCtrl:OnRelease()
|
||||
end
|
||||
function BuildDiscSkillCtrl:OnBtnClick_Tips(btn)
|
||||
if not self.mapSkill then
|
||||
return
|
||||
end
|
||||
local callback = function()
|
||||
local mapData = {
|
||||
nType = self.mapSkill.nType,
|
||||
nSkillId = self.mapSkill.nId,
|
||||
nLevel = self.mapSkill.nLevel,
|
||||
nMaxLevel = self.mapSkill.nMaxLevel
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSkillTips, btn.transform, mapData)
|
||||
end
|
||||
EventManager.Hit("BuildClickDiscSkill", self.card, callback)
|
||||
end
|
||||
return BuildDiscSkillCtrl
|
||||
@@ -0,0 +1,17 @@
|
||||
local BuildSimpleDiscItem = class("BuildSimpleDiscItem", BaseCtrl)
|
||||
BuildSimpleDiscItem._mapNodeConfig = {
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgRarity = {sComponentName = "Image"},
|
||||
imgElement = {sComponentName = "Image"}
|
||||
}
|
||||
BuildSimpleDiscItem._mapEventConfig = {}
|
||||
BuildSimpleDiscItem._mapRedDotConfig = {}
|
||||
function BuildSimpleDiscItem:Init(nDiscId)
|
||||
local mapData = PlayerData.Disc:GetDiscById(nDiscId)
|
||||
local mapCfg = ConfigTable.GetData_Item(nDiscId)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapCfg.Icon .. AllEnum.OutfitIconSurfix.ListGrid)
|
||||
local sFrame = AllEnum.FrameType_New.BoardFrame .. AllEnum.BoardFrameColor[mapCfg.Rarity]
|
||||
self:SetAtlasSprite(self._mapNode.imgRarity, "12_rare", sFrame, true)
|
||||
self:SetAtlasSprite(self._mapNode.imgElement, "12_rare", AllEnum.Star_Element[mapData.nEET].icon)
|
||||
end
|
||||
return BuildSimpleDiscItem
|
||||
@@ -0,0 +1,118 @@
|
||||
local PotentialListItemCtrl = class("PotentialListItemCtrl", BaseCtrl)
|
||||
PotentialListItemCtrl._mapNodeConfig = {
|
||||
txtCharName = {sComponentName = "TMP_Text"},
|
||||
txtHas = {sComponentName = "TMP_Text"},
|
||||
txtAll = {sComponentName = "TMP_Text"},
|
||||
imgHead = {sComponentName = "Image"},
|
||||
imgHeadFrame = {sComponentName = "Image"},
|
||||
rtPotential = {
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
PotentialListItemCtrl._mapEventConfig = {}
|
||||
PotentialListItemCtrl._mapRedDotConfig = {}
|
||||
function PotentialListItemCtrl:Awake()
|
||||
self.tbItemGrid = {}
|
||||
delChildren(self._mapNode.rtPotential)
|
||||
end
|
||||
function PotentialListItemCtrl:OnDisable()
|
||||
for k, v in ipairs(self.tbItemGrid) do
|
||||
local go = v.gameObject
|
||||
self:UnbindCtrlByNode(v)
|
||||
destroy(go)
|
||||
self.tbItemGrid[k] = nil
|
||||
end
|
||||
self.tbItemGrid = {}
|
||||
end
|
||||
function PotentialListItemCtrl:GetAllPotentialCount(nCharId, bMain)
|
||||
local nAllCount = 0
|
||||
local charPotentialCfg = ConfigTable.GetData("CharPotential", nCharId)
|
||||
for _, v in ipairs(charPotentialCfg.CommonPotentialIds) do
|
||||
nAllCount = nAllCount + 1
|
||||
end
|
||||
if bMain then
|
||||
for _, v in ipairs(charPotentialCfg.MasterSpecificPotentialIds) do
|
||||
nAllCount = nAllCount + 1
|
||||
end
|
||||
for _, v in ipairs(charPotentialCfg.MasterNormalPotentialIds) do
|
||||
nAllCount = nAllCount + 1
|
||||
end
|
||||
else
|
||||
for _, v in ipairs(charPotentialCfg.AssistSpecificPotentialIds) do
|
||||
nAllCount = nAllCount + 1
|
||||
end
|
||||
for _, v in ipairs(charPotentialCfg.AssistNormalPotentialIds) do
|
||||
nAllCount = nAllCount + 1
|
||||
end
|
||||
end
|
||||
return nAllCount
|
||||
end
|
||||
function PotentialListItemCtrl:Init(nCharId, nCount, tbPotential, goPotential, bMain)
|
||||
self.nCharId = nCharId
|
||||
local charCfg = ConfigTable.GetData_Character(nCharId)
|
||||
local nCharSkinId = PlayerData.Char:GetCharSkinId(nCharId)
|
||||
local charSkinCfg = ConfigTable.GetData_CharacterSkin(nCharSkinId)
|
||||
local sFrame = AllEnum.FrameType_New.BoardFrame .. AllEnum.BoardFrameColor[charCfg.Grade]
|
||||
self:SetPngSprite(self._mapNode.imgHead, charSkinCfg.Icon .. AllEnum.CharHeadIconSurfix.XXL)
|
||||
self:SetAtlasSprite(self._mapNode.imgHeadFrame, "12_rare", sFrame, true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCharName, charCfg.Name)
|
||||
self.mapPotential = {}
|
||||
local nHas = 0
|
||||
local nHasAdd = 0
|
||||
local tbPotentialAdd = PlayerData.Char:GetCharEnhancedPotential(nCharId)
|
||||
for _, v in ipairs(tbPotential) do
|
||||
local nAddCount = tbPotentialAdd[v.nPotentialId] and tbPotentialAdd[v.nPotentialId] or 0
|
||||
if v.nLevel == 0 then
|
||||
nAddCount = 0
|
||||
end
|
||||
local itemCfg = ConfigTable.GetData_Item(v.nPotentialId)
|
||||
if itemCfg == nil then
|
||||
return
|
||||
end
|
||||
local nSpecial = itemCfg.Stype == GameEnum.itemStype.SpecificPotential and 1 or 0
|
||||
nHas = nHas + v.nLevel
|
||||
nHasAdd = nHasAdd + nAddCount
|
||||
table.insert(self.mapPotential, {
|
||||
nId = v.nPotentialId,
|
||||
nLevel = v.nLevel,
|
||||
nPotentialAdd = nAddCount,
|
||||
nAllLevel = v.nLevel + nAddCount,
|
||||
nSpecial = nSpecial,
|
||||
nRarity = itemCfg.Rarity
|
||||
})
|
||||
end
|
||||
table.sort(self.mapPotential, function(a, b)
|
||||
if a.nSpecial == b.nSpecial then
|
||||
if a.nRarity == b.nRarity then
|
||||
if a.nAllLevel == b.nAllLevel then
|
||||
return a.nId < b.nId
|
||||
end
|
||||
return a.nAllLevel > b.nAllLevel
|
||||
end
|
||||
return a.nRarity < b.nRarity
|
||||
end
|
||||
return a.nSpecial > b.nSpecial
|
||||
end)
|
||||
for _, v in ipairs(self.tbItemGrid) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
for k, v in ipairs(self.mapPotential) do
|
||||
if nil == self.tbItemGrid[k] then
|
||||
local objItem = instantiate(goPotential, self._mapNode.rtPotential)
|
||||
objItem.gameObject:SetActive(true)
|
||||
local itemCtrl = self:BindCtrlByNode(objItem, "Game.UI.StarTower.Depot.DepotPotentialItemCtrl")
|
||||
itemCtrl:InitItem(v.nId, v.nLevel, v.nPotentialAdd, true, true)
|
||||
table.insert(self.tbItemGrid, itemCtrl)
|
||||
else
|
||||
self.tbItemGrid[k].gameObject:SetActive(true)
|
||||
self.tbItemGrid[k]:InitItem(v.nId, v.nLevel, v.nPotentialAdd, true, true)
|
||||
end
|
||||
end
|
||||
if 0 < nHasAdd then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtHas, string.format("%s+%s", nHas, nHasAdd))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtHas, nHas)
|
||||
end
|
||||
self._mapNode.txtAll.gameObject:SetActive(false)
|
||||
end
|
||||
return PotentialListItemCtrl
|
||||
@@ -0,0 +1,654 @@
|
||||
local StarTowerBuildBriefCtrl = class("StarTowerBuildBriefCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
StarTowerBuildBriefCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
BuildList = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
btn_sort_time = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SortTime"
|
||||
},
|
||||
btn_sort_score = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SortScore"
|
||||
},
|
||||
btn_Filter = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_OpenFilter"
|
||||
},
|
||||
btn_DeleteBuild = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SelectDelete"
|
||||
},
|
||||
btn_SetPreference = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SelectPreference"
|
||||
},
|
||||
txt_srot_timeTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RoguelikeBuild_Manage_SortTime"
|
||||
},
|
||||
txt_srot_ScoreTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RoguelikeBuild_Manage_SortScore"
|
||||
},
|
||||
txt_BuildCount = {sComponentName = "TMP_Text"},
|
||||
result1 = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
btnResult1 = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Result1"
|
||||
},
|
||||
rtResultTitle = {},
|
||||
txtBtnDelete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Delete"
|
||||
},
|
||||
btnPreview = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Preview"
|
||||
},
|
||||
txtBtnPreview = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Btn_AttributePreview"
|
||||
},
|
||||
txt_Empty = {sComponentName = "TMP_Text"},
|
||||
EmptyContent = {},
|
||||
ExistContent = {},
|
||||
animExistContent = {
|
||||
sNodeName = "ExistContent",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
ListContent = {},
|
||||
DeleteContent = {},
|
||||
DD_selectDelect = {
|
||||
sNodeName = "tc_dropdown_01",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateDropdownCtrl"
|
||||
},
|
||||
btn_FastSelectDelete = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_FastSelectDeleteBuild"
|
||||
},
|
||||
btn_CloseDelete = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_CloseDelete"
|
||||
},
|
||||
btn_Delete = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_OpenDeleteHint"
|
||||
},
|
||||
txt_FastSelectDelete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RoguelikeBuild_Manage_BtnBatchSelect"
|
||||
},
|
||||
txt_CloseDelete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RoguelikeBuild_Common_BtnClose"
|
||||
},
|
||||
txt_Delete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RoguelikeBuild_Manage_BtnDelete"
|
||||
},
|
||||
txt_SelectCountTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RoguelikeBuild_Manage_SelectedTitle"
|
||||
},
|
||||
txt_SelectCount = {sComponentName = "TMP_Text"},
|
||||
txt_DeleteIncomeTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RoguelikeBuild_Manage_DeleteIncomeTitle"
|
||||
},
|
||||
PreferenceContent = {},
|
||||
btn_ConfirmPreference = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ConfitmPreference"
|
||||
},
|
||||
btn_ClosePreference = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ClosePreference"
|
||||
},
|
||||
txt_PreferenceCountTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RoguelikeBuild_Manage_FilterPreference"
|
||||
},
|
||||
txt_PreferenceCountTitle2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RoguelikeBuild_Manage_SelectedTitle"
|
||||
},
|
||||
txt_PreferenceCount = {sComponentName = "TMP_Text"},
|
||||
txt_ClosePreference = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RoguelikeBuild_Common_BtnClose"
|
||||
},
|
||||
txt_SetPreference = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RoguelikeBuild_Common_BtnConfirm"
|
||||
},
|
||||
ani_DeleteContent = {
|
||||
sNodeName = "DeleteContent",
|
||||
sComponentName = "Animator"
|
||||
}
|
||||
}
|
||||
StarTowerBuildBriefCtrl._mapEventConfig = {}
|
||||
local SortType = {Time = 1, Score = 2}
|
||||
local SortOrder = {Descending = true, Ascending = false}
|
||||
local PanelState = {
|
||||
Normal = 1,
|
||||
Delete = 2,
|
||||
Preference = 3
|
||||
}
|
||||
local BtnTextColor = {
|
||||
[true] = Color(0.3288888888888889, 0.43555555555555553, 0.5422222222222223, 1),
|
||||
[false] = Color(0.7288888888888889, 0.8, 0.8711111111111111, 1)
|
||||
}
|
||||
local FilterGradeIdx = {
|
||||
btn_FilterGradeS = 3,
|
||||
btn_FilterGradeA = 2,
|
||||
btn_FilterGradeB = 1,
|
||||
btn_FilterGradeC = 0
|
||||
}
|
||||
function StarTowerBuildBriefCtrl:RefreshList()
|
||||
if #self._tbAllBuild == 0 then
|
||||
self._mapNode.ExistContent:SetActive(false)
|
||||
self._mapNode.EmptyContent:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_Empty, ConfigTable.GetUIText("RoguelikeBuild_Manage_EmptyList"))
|
||||
return
|
||||
else
|
||||
self._mapNode.ExistContent:SetActive(true)
|
||||
end
|
||||
self.tbCurShow = self:FilterAndSortBuildData()
|
||||
if #self.tbCurShow == 0 then
|
||||
self._mapNode.EmptyContent:SetActive(true)
|
||||
self._mapNode.ListContent:SetActive(false)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_Empty, ConfigTable.GetUIText("RoguelikeBuild_Manage_EmptyFilter"))
|
||||
return
|
||||
else
|
||||
self._mapNode.EmptyContent:SetActive(false)
|
||||
self._mapNode.ListContent:SetActive(true)
|
||||
end
|
||||
self._mapNode.BuildList:Init(#self.tbCurShow, self, self.RefreshBuildGrid)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_BuildCount, string.format("%d/%d", #self._tbAllBuild, ConfigTable.GetConfigNumber("StarTowerBuildNumberMax")))
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:FilterAndSortBuildData()
|
||||
local ret = {}
|
||||
local filterBuild = function(mapBuild)
|
||||
if self.nPanelState == PanelState.Delete and self.mapDelete[mapBuild.nBuildId] ~= nil then
|
||||
table.insert(ret, mapBuild)
|
||||
return
|
||||
end
|
||||
if self.nPanelState == PanelState.Preference then
|
||||
local bCheckIn = self.mapPreferenceCheckIn[mapBuild.nBuildId] ~= nil
|
||||
local bCheckOut = self.mapPreferenceCheckOut[mapBuild.nBuildId] ~= nil
|
||||
if not (not mapBuild.bPreference or bCheckOut) or not mapBuild.bPreference and bCheckIn then
|
||||
table.insert(ret, mapBuild)
|
||||
return
|
||||
end
|
||||
end
|
||||
if #self.FilterGrade > 0 and 0 >= table.indexof(self.FilterGrade, mapBuild.nGrade) then
|
||||
return
|
||||
end
|
||||
if self.FiterPreference ~= self.FilterUnpreference and (not (not self.FiterPreference or mapBuild.bPreference) or self.FilterUnpreference and mapBuild.bPreference) then
|
||||
return
|
||||
end
|
||||
if self.FilterPass ~= self.FilterUnpass and (not (not self.FilterPass or mapBuild.bPass) or self.FilterUnpass and mapBuild.bPass) then
|
||||
return
|
||||
end
|
||||
table.insert(ret, mapBuild)
|
||||
end
|
||||
for _, mapBuild in ipairs(self._tbAllBuild) do
|
||||
filterBuild(mapBuild)
|
||||
end
|
||||
if self.nSortype == SortType.Time then
|
||||
local sortByTime = function(a, b)
|
||||
if self.nPanelState == PanelState.Delete then
|
||||
local bSelecta = self.mapDelete[a.nBuildId] ~= nil
|
||||
local bSelectb = self.mapDelete[b.nBuildId] ~= nil
|
||||
if bSelecta ~= bSelectb then
|
||||
return bSelecta
|
||||
end
|
||||
end
|
||||
if self.nPanelState == PanelState.Preference then
|
||||
local bCheckInA = self.mapPreferenceCheckIn[a.nBuildId] ~= nil
|
||||
local bCheckOutA = self.mapPreferenceCheckOut[a.nBuildId] ~= nil
|
||||
local bSelectA = a.bPreference and not bCheckOutA or not a.bPreference and bCheckInA
|
||||
local bCheckInB = self.mapPreferenceCheckIn[b.nBuildId] ~= nil
|
||||
local bCheckOutB = self.mapPreferenceCheckOut[b.nBuildId] ~= nil
|
||||
local bSelectB = b.bPreference and not bCheckOutB or not b.bPreference and bCheckInB
|
||||
if bSelectA ~= bSelectB then
|
||||
return bSelectA
|
||||
end
|
||||
end
|
||||
if self.nSortOrder == SortOrder.Descending then
|
||||
return a.nBuildId > b.nBuildId
|
||||
else
|
||||
return a.nBuildId < b.nBuildId
|
||||
end
|
||||
end
|
||||
table.sort(ret, sortByTime)
|
||||
else
|
||||
local sortByScore = function(a, b)
|
||||
if self.nPanelState == PanelState.Delete then
|
||||
local bSelecta = self.mapDelete[a.nBuildId] ~= nil
|
||||
local bSelectb = self.mapDelete[b.nBuildId] ~= nil
|
||||
if bSelecta ~= bSelectb then
|
||||
return bSelecta
|
||||
end
|
||||
end
|
||||
if self.nPanelState == PanelState.Preference then
|
||||
local bCheckInA = self.mapPreferenceCheckIn[a.nBuildId] ~= nil
|
||||
local bCheckOutA = self.mapPreferenceCheckOut[a.nBuildId] ~= nil
|
||||
local bSelectA = a.bPreference and not bCheckOutA or not a.bPreference and bCheckInA
|
||||
local bCheckInB = self.mapPreferenceCheckIn[b.nBuildId] ~= nil
|
||||
local bCheckOutB = self.mapPreferenceCheckOut[b.nBuildId] ~= nil
|
||||
local bSelectB = b.bPreference and not bCheckOutB or not b.bPreference and bCheckInB
|
||||
if bSelectA ~= bSelectB then
|
||||
return bSelectA
|
||||
end
|
||||
end
|
||||
if self.nSortOrder == SortOrder.Descending then
|
||||
if a.nScore ~= b.nScore then
|
||||
return a.nScore > b.nScore
|
||||
else
|
||||
return a.nBuildId > b.nBuildId
|
||||
end
|
||||
elseif a.nScore ~= b.nScore then
|
||||
return a.nScore < b.nScore
|
||||
else
|
||||
return a.nBuildId > b.nBuildId
|
||||
end
|
||||
end
|
||||
table.sort(ret, sortByScore)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:RefreshBuildGrid(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local mapData = self.tbCurShow[nIndex]
|
||||
local bSelectDelete = self.mapDelete[mapData.nBuildId] ~= nil
|
||||
local bCheckOut = self.mapPreferenceCheckOut[mapData.nBuildId] ~= nil
|
||||
local bCheckIn = self.mapPreferenceCheckIn[mapData.nBuildId] ~= nil
|
||||
if self.mapListItemCtrl[goGrid] == nil then
|
||||
self.mapListItemCtrl[goGrid] = self:BindCtrlByNode(goGrid, "Game.UI.StarTower.Build.StarTowerBuildBriefItem")
|
||||
self.mapListItemCtrl[goGrid]:Init(self)
|
||||
end
|
||||
self.mapListItemCtrl[goGrid]:RefreshGrid(mapData, self.nPanelState, bSelectDelete, bCheckOut, bCheckIn)
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:OnBuildGridLock(nIdx, itemCtrl)
|
||||
local mapBuild = self.tbCurShow[nIdx]
|
||||
local callback = function()
|
||||
itemCtrl:SetLockState(mapBuild.bLock)
|
||||
if self.nPanelState == PanelState.Delete and mapBuild.bLock and self.mapDelete[mapBuild.nBuildId] ~= nil then
|
||||
self.mapDelete[mapBuild.nBuildId] = nil
|
||||
self.nSelectedDeleteCount = self.nSelectedDeleteCount - 1
|
||||
itemCtrl:SetSelectDeleteState(false)
|
||||
self:SetDeleteResult()
|
||||
end
|
||||
end
|
||||
PlayerData.Build:ChangeBuildLock(mapBuild.nBuildId, not mapBuild.bLock, callback)
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:OnBuildGridPreference(nIdx, itemCtrl)
|
||||
if self.nPanelState ~= PanelState.Normal then
|
||||
self:OnBtnClickGrid(nIdx, itemCtrl)
|
||||
return
|
||||
end
|
||||
local mapBuild = self.tbCurShow[nIdx]
|
||||
local tbPreferenceCheckIn = {}
|
||||
local tbPreferenceCheckOut = {}
|
||||
local callback = function()
|
||||
itemCtrl:SetPreferenceState(mapBuild.bPreference)
|
||||
end
|
||||
if mapBuild.bPreference then
|
||||
table.insert(tbPreferenceCheckOut, mapBuild.nBuildId)
|
||||
else
|
||||
table.insert(tbPreferenceCheckIn, mapBuild.nBuildId)
|
||||
end
|
||||
PlayerData.Build:SetBuildPreference(tbPreferenceCheckIn, tbPreferenceCheckOut, callback)
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:OnBtnClickGrid(nIdx, itemCtrl)
|
||||
local mapBuild = self.tbCurShow[nIdx]
|
||||
if self.nPanelState == PanelState.Delete then
|
||||
if mapBuild.bLock then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("BUILD_01"))
|
||||
return
|
||||
end
|
||||
local bSelectDelete = self.mapDelete[mapBuild.nBuildId] ~= nil
|
||||
if bSelectDelete then
|
||||
self.mapDelete[mapBuild.nBuildId] = nil
|
||||
self.nSelectedDeleteCount = self.nSelectedDeleteCount - 1
|
||||
itemCtrl:SetSelectDeleteState(false)
|
||||
else
|
||||
self.mapDelete[mapBuild.nBuildId] = 0
|
||||
self.nSelectedDeleteCount = self.nSelectedDeleteCount + 1
|
||||
itemCtrl:SetSelectDeleteState(true)
|
||||
end
|
||||
self:SetDeleteResult()
|
||||
elseif self.nPanelState == PanelState.Preference then
|
||||
local bCheckIn = self.mapPreferenceCheckIn[mapBuild.nBuildId] ~= nil
|
||||
local bCheckOut = self.mapPreferenceCheckOut[mapBuild.nBuildId] ~= nil
|
||||
if bCheckIn then
|
||||
self.mapPreferenceCheckIn[mapBuild.nBuildId] = nil
|
||||
itemCtrl:SetSelectPreferenceState(false)
|
||||
self.nPreferenceCount = self.nPreferenceCount - 1
|
||||
elseif bCheckOut then
|
||||
self.mapPreferenceCheckOut[mapBuild.nBuildId] = nil
|
||||
itemCtrl:SetSelectPreferenceState(true)
|
||||
self.nPreferenceCount = self.nPreferenceCount + 1
|
||||
elseif mapBuild.bPreference then
|
||||
self.mapPreferenceCheckOut[mapBuild.nBuildId] = 0
|
||||
itemCtrl:SetSelectPreferenceState(false)
|
||||
self.nPreferenceCount = self.nPreferenceCount - 1
|
||||
else
|
||||
self.mapPreferenceCheckIn[mapBuild.nBuildId] = 0
|
||||
itemCtrl:SetSelectPreferenceState(true)
|
||||
self.nPreferenceCount = self.nPreferenceCount + 1
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_PreferenceCount, string.format("%d/%d", self.nPreferenceCount, #self._tbAllBuild))
|
||||
else
|
||||
local callback = function(mapData)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StarTowerBuildDetail, mapData)
|
||||
self._panel._nFadeInType = 2
|
||||
end
|
||||
PlayerData.Build:GetBuildDetailData(callback, mapBuild.nBuildId)
|
||||
end
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:CalDeleteResult()
|
||||
local ret = 0
|
||||
local bHasRare = false
|
||||
for nBuildId, _ in pairs(self.mapDelete) do
|
||||
local mapBuild = self._mapAllBuild[nBuildId]
|
||||
if mapBuild.mapRank.Rarity == GameEnum.itemRarity.SSR then
|
||||
bHasRare = true
|
||||
end
|
||||
ret = ret + math.floor(math.min(math.max(mapBuild.nScore / tonumber(self.tbCoinRate[1]), tonumber(self.tbCoinRate[2])), tonumber(self.tbCoinRate[3])))
|
||||
end
|
||||
return ret, bHasRare
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:SetDeleteResult()
|
||||
local nCoin = self:CalDeleteResult()
|
||||
local mapCfg = ConfigTable.GetData_Item(self.nDeleteReturnId)
|
||||
if nCoin == 0 then
|
||||
self._mapNode.rtResultTitle.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.rtResultTitle.gameObject:SetActive(true)
|
||||
self._mapNode.result1:SetItem(self.nDeleteReturnId, nil, nCoin, nil, nil, nil, nil, true)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_SelectCount, string.format("%d/%d", self.nSelectedDeleteCount, #self._tbAllBuild))
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:CalPreferenceCount()
|
||||
local ret = 0
|
||||
for _, mapBuild in ipairs(self._tbAllBuild) do
|
||||
if mapBuild.bPreference then
|
||||
ret = ret + 1
|
||||
end
|
||||
end
|
||||
return ret
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:OpenConfirmHint()
|
||||
local nCoin, bHasRare = self:CalDeleteResult()
|
||||
local CheckCallback = function()
|
||||
local sTip = ""
|
||||
if bHasRare then
|
||||
sTip = ConfigTable.GetUIText("BUILD_06")
|
||||
else
|
||||
sTip = ConfigTable.GetUIText("BUILD_02")
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Item,
|
||||
sContent = sTip,
|
||||
tbItem = {
|
||||
[1] = {
|
||||
nTid = self.nDeleteReturnId,
|
||||
nCount = nCoin,
|
||||
bFullShow = true
|
||||
}
|
||||
},
|
||||
callbackConfirm = function()
|
||||
local hasDispatchingBuild = false
|
||||
local callback = function()
|
||||
local GetDataCallback = function(tbBuildData, mapAllBuild)
|
||||
self._mapAllBuild = mapAllBuild
|
||||
self._tbAllBuild = tbBuildData
|
||||
self:RefreshList()
|
||||
if hasDispatchingBuild then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Agent_Build_Same_Cant_Delete"))
|
||||
end
|
||||
end
|
||||
self:OnBtnClick_CloseDelete()
|
||||
PlayerData.Build:GetAllBuildBriefData(GetDataCallback)
|
||||
end
|
||||
local tbDelete = {}
|
||||
for key, _ in pairs(self.mapDelete) do
|
||||
if not PlayerData.Dispatch.IsBuildDispatching(key) then
|
||||
table.insert(tbDelete, key)
|
||||
else
|
||||
hasDispatchingBuild = true
|
||||
end
|
||||
end
|
||||
if 0 < #tbDelete and not hasDispatchingBuild then
|
||||
PlayerData.Build:DeleteBuild(tbDelete, callback)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Agent_Build_Cant_Delete"))
|
||||
end
|
||||
end
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
PlayerData.Build:CheckCoinMax(nCoin, CheckCallback)
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:InitSort()
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_srot_timeTitle, BtnTextColor[self.nSortype == SortType.Time])
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_srot_ScoreTitle, BtnTextColor[self.nSortype == SortType.Score])
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = self.nSortype == SortType.Score and self.nSortOrder == SortOrder.Ascending
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = self.nSortype == SortType.Score and self.nSortOrder == SortOrder.Descending
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = self.nSortype == SortType.Time and self.nSortOrder == SortOrder.Ascending
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = self.nSortype == SortType.Time and self.nSortOrder == SortOrder.Descending
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:FadeIn(bPlayFadeIn)
|
||||
if self._panel._nFadeInType == 1 then
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
self._mapNode.animExistContent:SetTrigger("tIn")
|
||||
if #self._tbAllBuild > 0 then
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.4)
|
||||
end
|
||||
end
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:Awake()
|
||||
self.nDeleteReturnId = ConfigTable.GetConfigNumber("StarTowerBuildDeleteReturnItemId")
|
||||
self._tbAllBuild = {}
|
||||
self.tbCurShow = {}
|
||||
self.mapPreferenceCheckIn = {}
|
||||
self.mapPreferenceCheckOut = {}
|
||||
self.mapDelete = {}
|
||||
self.nSelectedDeleteCount = 0
|
||||
self.FilterGrade = {}
|
||||
self.FiterPreference = false
|
||||
self.FilterUnpreference = false
|
||||
self.FilterPass = false
|
||||
self.FilterUnpass = false
|
||||
self.nSortype = SortType.Score
|
||||
self.nSortOrder = SortOrder.Descending
|
||||
self.nPanelState = PanelState.Normal
|
||||
self:InitSort()
|
||||
self.mapListItemCtrl = {}
|
||||
self.tbCoinRate = ConfigTable.GetConfigArray("StarTowerBuildTransformParas")
|
||||
local tbLanguageId = {
|
||||
"RoguelikeBuild_Manage_DD_N",
|
||||
"RoguelikeBuild_Manage_DD_R",
|
||||
"RoguelikeBuild_Manage_DD_SR",
|
||||
"RoguelikeBuild_Manage_DD_SSR"
|
||||
}
|
||||
self._mapNode.DD_selectDelect:SetList(tbLanguageId, 3)
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:OnEnable()
|
||||
local GetDataCallback = function(tbBuildData, mapAllBuild)
|
||||
self._mapAllBuild = mapAllBuild
|
||||
self._tbAllBuild = tbBuildData
|
||||
self:RefreshList()
|
||||
end
|
||||
PlayerData.Build:GetAllBuildBriefData(GetDataCallback)
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:OnDisable()
|
||||
self.mapPreferenceCheckIn = {}
|
||||
self.mapPreferenceCheckOut = {}
|
||||
self.mapDelete = {}
|
||||
self.nSelectedDeleteCount = 0
|
||||
for nInstanceId, objCtrl in pairs(self.mapListItemCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.mapListItemCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.mapListItemCtrl = {}
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:OnDestroy()
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:OnRelease()
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:FadeOut(callback)
|
||||
local Callback = function()
|
||||
if type(callback) == "function" then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.03, Callback)
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:OnBtnClick_Preview()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BuildAttrPreview)
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:OnBtnClick_SelectDelete()
|
||||
if self.nPanelState == PanelState.Delete then
|
||||
return
|
||||
end
|
||||
self.nPanelState = PanelState.Delete
|
||||
self.mapDelete = {}
|
||||
self.nSelectedDeleteCount = 0
|
||||
self:SetDeleteResult()
|
||||
self._mapNode.DeleteContent:SetActive(true)
|
||||
self._mapNode.animExistContent:Play("RoguelikeBuildPanel_delete_in")
|
||||
self._mapNode.BuildList:ForceRefresh()
|
||||
self._mapNode.ani_DeleteContent:Play("goDismantle_in")
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:OnBtnClick_CloseDelete()
|
||||
self._mapNode.ani_DeleteContent:Play("goDismantle_out")
|
||||
self._mapNode.animExistContent:Play("RoguelikeBuildPanel_delete_out")
|
||||
function Callback()
|
||||
if self._mapNode == nil then
|
||||
return
|
||||
end
|
||||
self.nPanelState = PanelState.Normal
|
||||
self.mapDelete = {}
|
||||
self.nSelectedDeleteCount = 0
|
||||
self._mapNode.DeleteContent:SetActive(false)
|
||||
self:RefreshList()
|
||||
end
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2, Callback)
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:OnBtnClick_SelectPreference()
|
||||
self.nPanelState = PanelState.Preference
|
||||
self.mapPreferenceCheckIn = {}
|
||||
self.mapPreferenceCheckOut = {}
|
||||
self.nPreferenceCount = self:CalPreferenceCount()
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_PreferenceCount, string.format("%d/%d", self.nPreferenceCount, #self._tbAllBuild))
|
||||
self:RefreshList()
|
||||
self._mapNode.PreferenceContent:SetActive(true)
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:OnBtnClick_ClosePreference()
|
||||
local Callback = function()
|
||||
if self._mapNode == nil then
|
||||
return
|
||||
end
|
||||
self.nPanelState = PanelState.Normal
|
||||
self.mapPreferenceCheckIn = {}
|
||||
self.mapPreferenceCheckOut = {}
|
||||
self.nPreferenceCount = 0
|
||||
self._mapNode.PreferenceContent:SetActive(false)
|
||||
self:RefreshList()
|
||||
end
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2, Callback)
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:OnBtnClick_SortTime(btn)
|
||||
if self.nSortype == SortType.Time then
|
||||
self.nSortOrder = not self.nSortOrder
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = self.nSortOrder == SortOrder.Ascending
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = self.nSortOrder == SortOrder.Descending
|
||||
else
|
||||
self.nSortype = SortType.Time
|
||||
self.nSortOrder = SortOrder.Descending
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = false
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = true
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = false
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = false
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_srot_timeTitle, BtnTextColor[self.nSortype == SortType.Time])
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_srot_ScoreTitle, BtnTextColor[self.nSortype == SortType.Score])
|
||||
end
|
||||
self:RefreshList()
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:OnBtnClick_SortScore(btn)
|
||||
if self.nSortype == SortType.Score then
|
||||
self.nSortOrder = not self.nSortOrder
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = self.nSortOrder == SortOrder.Ascending
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = self.nSortOrder == SortOrder.Descending
|
||||
else
|
||||
self.nSortype = SortType.Score
|
||||
self.nSortOrder = SortOrder.Descending
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = false
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = true
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = false
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = false
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_srot_timeTitle, BtnTextColor[self.nSortype == SortType.Time])
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_srot_ScoreTitle, BtnTextColor[self.nSortype == SortType.Score])
|
||||
end
|
||||
self:RefreshList()
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:OnBtnClick_FastSelectDeleteBuild(btn)
|
||||
local filterGrade = self._mapNode.DD_selectDelect:GetValue()
|
||||
if #self.tbCurShow == 0 then
|
||||
return
|
||||
end
|
||||
for _, mapBuild in ipairs(self.tbCurShow) do
|
||||
if mapBuild.mapRank.Rarity >= 4 - filterGrade and not mapBuild.bLock and self.mapDelete[mapBuild.nBuildId] == nil then
|
||||
self.mapDelete[mapBuild.nBuildId] = 0
|
||||
self.nSelectedDeleteCount = self.nSelectedDeleteCount + 1
|
||||
end
|
||||
end
|
||||
self._mapNode.BuildList:ForceRefresh()
|
||||
self:SetDeleteResult()
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:OnBtnClick_ConfitmPreference(btn)
|
||||
local tbCheckIn = {}
|
||||
for key, _ in pairs(self.mapPreferenceCheckIn) do
|
||||
table.insert(tbCheckIn, key)
|
||||
end
|
||||
local tbCheckOut = {}
|
||||
for key, _ in pairs(self.mapPreferenceCheckOut) do
|
||||
table.insert(tbCheckOut, key)
|
||||
end
|
||||
if #tbCheckIn == 0 and #self.mapPreferenceCheckOut == 0 then
|
||||
self:OnBtnClick_ClosePreference()
|
||||
end
|
||||
local callback = function()
|
||||
self:OnBtnClick_ClosePreference()
|
||||
end
|
||||
PlayerData.Build:SetBuildPreference(tbCheckIn, tbCheckOut, callback)
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:OnBtnClick_OpenDeleteHint(btn)
|
||||
if self.nSelectedDeleteCount == 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("BUILD_03"))
|
||||
return
|
||||
end
|
||||
self:OpenConfirmHint()
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:OnBtnClick_OpenFilter(btn)
|
||||
end
|
||||
function StarTowerBuildBriefCtrl:OnBtnClick_Result1(btn)
|
||||
local mapData = {
|
||||
nTid = self.nDeleteReturnId,
|
||||
bShowDepot = true,
|
||||
bShowJumpto = false
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ItemTips, btn.transform, mapData)
|
||||
end
|
||||
return StarTowerBuildBriefCtrl
|
||||
@@ -0,0 +1,214 @@
|
||||
local StarTowerBuildBriefItem = class("StarTowerBuildBriefItem", BaseCtrl)
|
||||
local PanelState = {
|
||||
Normal = 1,
|
||||
Delete = 2,
|
||||
Preference = 3
|
||||
}
|
||||
StarTowerBuildBriefItem._mapNodeConfig = {
|
||||
img_SelectDelete = {},
|
||||
img_SelectPreference = {},
|
||||
btn_LockIcon = {sComponentName = "Button"},
|
||||
btn_grid = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Grid"
|
||||
},
|
||||
btn_Lock = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Lock"
|
||||
},
|
||||
btn_Detail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
btn_Preference = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Preference"
|
||||
},
|
||||
imgRareFrame = {sComponentName = "Image"},
|
||||
imgRareScore = {sComponentName = "Image"},
|
||||
txtBuildName = {sComponentName = "TMP_Text"},
|
||||
imgLike = {},
|
||||
txtLeaderCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Leader"
|
||||
},
|
||||
txtSubCn = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Sub"
|
||||
},
|
||||
imgCharIcon = {nCount = 3, sComponentName = "Image"},
|
||||
imgCharFrame = {nCount = 3, sComponentName = "Image"},
|
||||
txtPotentialCount = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
imgCharElement = {nCount = 3, sComponentName = "Image"},
|
||||
txtChar = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Char_Title"
|
||||
},
|
||||
txtDisc = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_MainDisc_Title"
|
||||
},
|
||||
goDiscItem = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.StarTower.Build.BuildSimpleDiscItem"
|
||||
},
|
||||
btnExport = {sComponentName = "UIButton"},
|
||||
objUnavailable = {},
|
||||
objUnavailableIcon = {sComponentName = "Image"},
|
||||
imgRareScoreMask = {sComponentName = "Image"},
|
||||
texUnavailable = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "InfinityTower_Build_NotAvailable"
|
||||
},
|
||||
imgUnavailable = {},
|
||||
imgBuildUsed = {},
|
||||
txtBuildUsed = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Build_Used"
|
||||
},
|
||||
imgCharUsed = {},
|
||||
txtCharUsed = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Build_Char_Used"
|
||||
}
|
||||
}
|
||||
StarTowerBuildBriefItem._mapEventConfig = {}
|
||||
function StarTowerBuildBriefItem:RefreshGrid(mapData, nPanelState, bSelectDelete, bCheckOut, bCheckIn, nType)
|
||||
self._mapData = mapData
|
||||
self._nType = nType
|
||||
self:RefreshInfo()
|
||||
self:RefreshChar()
|
||||
self:RefreshDisc()
|
||||
if nPanelState == PanelState.Delete then
|
||||
self._mapNode.img_SelectDelete:SetActive(bSelectDelete)
|
||||
self._mapNode.img_SelectPreference:SetActive(false)
|
||||
elseif nPanelState == PanelState.Preference then
|
||||
if bCheckOut then
|
||||
self._mapNode.img_SelectPreference:SetActive(false)
|
||||
elseif bCheckIn then
|
||||
self._mapNode.img_SelectPreference:SetActive(true)
|
||||
else
|
||||
self._mapNode.img_SelectPreference:SetActive(mapData.bPreference)
|
||||
end
|
||||
self._mapNode.img_SelectDelete:SetActive(false)
|
||||
else
|
||||
self._mapNode.img_SelectPreference:SetActive(false)
|
||||
self._mapNode.img_SelectDelete:SetActive(false)
|
||||
end
|
||||
self._mapNode.btnExport.gameObject:SetActive(false)
|
||||
EventManager.Hit("BuildItemExport", self._mapNode.btnExport, self._mapData.nBuildId)
|
||||
if self._nType and self._nType == AllEnum.RegionBossFormationType.InfinityTower or self._nType == AllEnum.RegionBossFormationType.Vampire or self._nType == AllEnum.RegionBossFormationType.JointDrill then
|
||||
local sScore = "Icon/BuildRank/BuildRank_" .. self._mapData.mapRank.Id
|
||||
self:SetPngSprite(self._mapNode.imgRareScoreMask, sScore)
|
||||
local bShowUnavailable = false
|
||||
if self._nType == AllEnum.RegionBossFormationType.InfinityTower or self._nType == AllEnum.RegionBossFormationType.Vampire then
|
||||
bShowUnavailable = not self._mapData.isCanUse
|
||||
else
|
||||
bShowUnavailable = self._mapData.bBuildUsed or self._mapData.bCharUsed
|
||||
end
|
||||
self._mapNode.objUnavailable:SetActive(bShowUnavailable)
|
||||
self._mapNode.imgUnavailable:SetActive(self._mapData.isCanUse)
|
||||
self._mapNode.imgBuildUsed:SetActive(self._mapData.bBuildUsed)
|
||||
self._mapNode.imgCharUsed:SetActive(self._mapData.bCharUsed and not self._mapData.bBuildUsed)
|
||||
local sKey = self._nType == AllEnum.RegionBossFormationType.InfinityTower and "InfinityTower_Build_NotAvailable" or "VampireFormation_Unable"
|
||||
NovaAPI.SetTMPText(self._mapNode.texUnavailable, ConfigTable.GetUIText(sKey))
|
||||
else
|
||||
self._mapNode.objUnavailable:SetActive(false)
|
||||
end
|
||||
end
|
||||
function StarTowerBuildBriefItem:RefreshInfo()
|
||||
local sScore = "Icon/BuildRank/BuildRank_" .. self._mapData.mapRank.Id
|
||||
local sFrame = AllEnum.FrameType_New.BuildRankDB .. AllEnum.FrameColor_New[self._mapData.mapRank.Rarity]
|
||||
self:SetPngSprite(self._mapNode.imgRareScore, sScore)
|
||||
self:SetAtlasSprite(self._mapNode.imgRareFrame, "12_rare", sFrame)
|
||||
if self._mapData.sName == "" or self._mapData.sName == nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuildName, ConfigTable.GetUIText("RoguelikeBuild_EmptyBuildName"))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuildName, self._mapData.sName)
|
||||
end
|
||||
self._mapNode.imgLike:SetActive(self._mapData.bPreference)
|
||||
self._mapNode.btn_LockIcon.interactable = self._mapData.bLock
|
||||
end
|
||||
function StarTowerBuildBriefItem:RefreshChar()
|
||||
for i = 1, 3 do
|
||||
local nCharTid = self._mapData.tbChar[i].nTid
|
||||
local nCharSkinId = PlayerData.Char:GetCharSkinId(nCharTid)
|
||||
local mapCharSkin = ConfigTable.GetData_CharacterSkin(nCharSkinId)
|
||||
local mapCharCfg = ConfigTable.GetData_Character(nCharTid)
|
||||
local sFrame = AllEnum.FrameType_New.BoardFrame .. AllEnum.BoardFrameColor[mapCharCfg.Grade]
|
||||
self:SetPngSprite(self._mapNode.imgCharIcon[i], mapCharSkin.Icon .. AllEnum.CharHeadIconSurfix.XXL)
|
||||
self:SetAtlasSprite(self._mapNode.imgCharFrame[i], "12_rare", sFrame)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPotentialCount[i], self._mapData.tbChar[i].nPotentialCount)
|
||||
self:SetAtlasSprite(self._mapNode.imgCharElement[i], "12_rare", AllEnum.Char_Element[mapCharCfg.EET].icon)
|
||||
end
|
||||
end
|
||||
function StarTowerBuildBriefItem:RefreshDisc()
|
||||
local tbDisc = self._mapData.tbDisc
|
||||
local nIndex = 1
|
||||
for _, nId in ipairs(tbDisc) do
|
||||
if nil ~= self._mapNode.goDiscItem[nIndex] and nIndex <= 3 then
|
||||
self._mapNode.goDiscItem[nIndex]:Init(nId)
|
||||
end
|
||||
nIndex = nIndex + 1
|
||||
end
|
||||
end
|
||||
function StarTowerBuildBriefItem:Init(parentCtrl)
|
||||
self._parentCtrl = parentCtrl
|
||||
end
|
||||
function StarTowerBuildBriefItem:SetLockState(bLock)
|
||||
self._mapNode.btn_LockIcon.interactable = bLock
|
||||
end
|
||||
function StarTowerBuildBriefItem:SetPreferenceState(bPreference)
|
||||
self._mapNode.imgLike:SetActive(bPreference)
|
||||
end
|
||||
function StarTowerBuildBriefItem:SetSelectDeleteState(bSelect)
|
||||
self._mapNode.img_SelectDelete:SetActive(bSelect)
|
||||
end
|
||||
function StarTowerBuildBriefItem:SetSelectPreferenceState(bSelect)
|
||||
self._mapNode.img_SelectPreference:SetActive(bSelect)
|
||||
end
|
||||
function StarTowerBuildBriefItem:Awake()
|
||||
end
|
||||
function StarTowerBuildBriefItem:OnEnable()
|
||||
end
|
||||
function StarTowerBuildBriefItem:OnDisable()
|
||||
end
|
||||
function StarTowerBuildBriefItem:OnDestroy()
|
||||
end
|
||||
function StarTowerBuildBriefItem:OnRelease()
|
||||
end
|
||||
function StarTowerBuildBriefItem:OnBtnClick_Grid(btn)
|
||||
if self._nType then
|
||||
if self._nType == AllEnum.RegionBossFormationType.InfinityTower or self._nType == AllEnum.RegionBossFormationType.Vampire then
|
||||
if not self._mapData.isCanUse then
|
||||
local sKey = self._nType == AllEnum.RegionBossFormationType.InfinityTower and "InfinityTower_Build_NotMeetingCond" or "VampireFormation_UnableTips"
|
||||
local strTips = ConfigTable.GetUIText(sKey)
|
||||
EventManager.Hit(EventId.OpenMessageBox, strTips)
|
||||
return
|
||||
end
|
||||
elseif self._nType == AllEnum.RegionBossFormationType.JointDrill and (self._mapData.bCharUsed or self._mapData.bBuildUsed) then
|
||||
local sKey = "JointDrill_Build_NotMeetingCond"
|
||||
local strTips = ConfigTable.GetUIText(sKey)
|
||||
EventManager.Hit(EventId.OpenMessageBox, strTips)
|
||||
return
|
||||
end
|
||||
end
|
||||
if self._nType and self._nType == AllEnum.RegionBossFormationType.InfinityTower or self._nType == AllEnum.RegionBossFormationType.Vampire then
|
||||
end
|
||||
local nIndex = tonumber(self.gameObject.name) + 1
|
||||
self._parentCtrl:OnBtnClickGrid(nIndex, self)
|
||||
end
|
||||
function StarTowerBuildBriefItem:OnBtnClick_Lock(btn)
|
||||
local nIndex = tonumber(self.gameObject.name) + 1
|
||||
self._parentCtrl:OnBuildGridLock(nIndex, self)
|
||||
end
|
||||
function StarTowerBuildBriefItem:OnBtnClick_Detail(btn)
|
||||
local nIndex = tonumber(self.gameObject.name) + 1
|
||||
self._parentCtrl:OnBuildGridDetail(nIndex, self)
|
||||
end
|
||||
function StarTowerBuildBriefItem:OnBtnClick_Preference(btn)
|
||||
local nIndex = tonumber(self.gameObject.name) + 1
|
||||
self._parentCtrl:OnBuildGridPreference(nIndex, self)
|
||||
end
|
||||
return StarTowerBuildBriefItem
|
||||
@@ -0,0 +1,18 @@
|
||||
local StarTowerBuildBriefPanel = class("StarTowerBuildBriefPanel", BasePanel)
|
||||
StarTowerBuildBriefPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "StarTowerBuild/StarTowerBuildBriefPanel.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.Build.StarTowerBuildBriefCtrl"
|
||||
}
|
||||
}
|
||||
function StarTowerBuildBriefPanel:Awake()
|
||||
end
|
||||
function StarTowerBuildBriefPanel:OnEnable()
|
||||
end
|
||||
function StarTowerBuildBriefPanel:OnDisable()
|
||||
end
|
||||
function StarTowerBuildBriefPanel:OnDestroy()
|
||||
end
|
||||
function StarTowerBuildBriefPanel:OnRelease()
|
||||
end
|
||||
return StarTowerBuildBriefPanel
|
||||
@@ -0,0 +1,258 @@
|
||||
local StarTowerBuildContentCtrl = class("StarTowerBuildContentCtrl", BaseCtrl)
|
||||
StarTowerBuildContentCtrl._mapNodeConfig = {
|
||||
btnPotentialTab = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Potential"
|
||||
},
|
||||
btnDiscTab = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Disc"
|
||||
},
|
||||
txtPotential = {
|
||||
sComponentName = "TMP_Text",
|
||||
nCount = 2,
|
||||
sLanguageId = "StarTower_Build_Potential_Btn"
|
||||
},
|
||||
txtDisc = {
|
||||
sComponentName = "TMP_Text",
|
||||
nCount = 2,
|
||||
sLanguageId = "StarTower_Build_Disc_Btn"
|
||||
},
|
||||
imgOn = {nCount = 2},
|
||||
imgOff = {nCount = 2},
|
||||
svPotential = {},
|
||||
PotentialList = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.StarTower.Build.PotentialListItemCtrl"
|
||||
},
|
||||
rtPotentialContent = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
goEmptyPotential = {},
|
||||
goPotentialList = {},
|
||||
svDisc = {},
|
||||
txtNoteLine = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_NoteSkill_Title"
|
||||
},
|
||||
txtSkillLine = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_DiscSkill_Title"
|
||||
},
|
||||
imgNote = {nCount = 12, sComponentName = "Image"},
|
||||
txtNoteCount = {nCount = 12, sComponentName = "TMP_Text"},
|
||||
imgSkillEmpty = {},
|
||||
rtSkill = {},
|
||||
txtSkillEmpty = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_DiscSkill_Empty"
|
||||
},
|
||||
btnNoteInfo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_NoteInfo"
|
||||
},
|
||||
btnSkill = {
|
||||
nCount = 6,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Skill"
|
||||
},
|
||||
goSkillEmpty = {nCount = 6},
|
||||
imgSkillIconBg = {nCount = 6, sComponentName = "Image"},
|
||||
imgSkillIcon = {nCount = 6, sComponentName = "Image"},
|
||||
txtSkillName = {nCount = 6, sComponentName = "TMP_Text"},
|
||||
txtSkillLevel = {nCount = 6, sComponentName = "TMP_Text"},
|
||||
txtSkillUnactive1_ = {
|
||||
nCount = 6,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_DiscSkill_NotActivated"
|
||||
},
|
||||
txtSkillUnactive2_ = {
|
||||
nCount = 6,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_DiscSkill_NotActivated"
|
||||
},
|
||||
imgLock1_ = {nCount = 6},
|
||||
imgLock2_ = {nCount = 6},
|
||||
PotentialDepotItem = {},
|
||||
goEmptyDisc = {},
|
||||
txt_Empty = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Disc_Skill_Empty"
|
||||
},
|
||||
txt_EmptyPotential = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Potential_Empty"
|
||||
},
|
||||
scPotential = {
|
||||
sNodeName = "svPotential",
|
||||
sComponentName = "UIScrollToClick"
|
||||
},
|
||||
scDisc = {
|
||||
sNodeName = "svDisc",
|
||||
sComponentName = "UIScrollToClick"
|
||||
}
|
||||
}
|
||||
StarTowerBuildContentCtrl._mapEventConfig = {
|
||||
SelectDepotPotential = "OnEvent_SelectDepotPotential"
|
||||
}
|
||||
StarTowerBuildContentCtrl._mapRedDotConfig = {}
|
||||
function StarTowerBuildContentCtrl:Refresh(mapBuild)
|
||||
self.mapBuild = mapBuild
|
||||
self:InitDisc()
|
||||
self:InitPotential()
|
||||
self:SetDefaultTab()
|
||||
end
|
||||
function StarTowerBuildContentCtrl:SetDefaultTab()
|
||||
self.nCurTab = 1
|
||||
for i = 1, 2 do
|
||||
self._mapNode.imgOn[i]:SetActive(i == self.nCurTab)
|
||||
self._mapNode.imgOff[i]:SetActive(i ~= self.nCurTab)
|
||||
end
|
||||
self._mapNode.svPotential:SetActive(self.nCurTab == 1)
|
||||
self._mapNode.svDisc:SetActive(self.nCurTab == 2)
|
||||
end
|
||||
function StarTowerBuildContentCtrl:InitPotential()
|
||||
local tbPotential = self.mapBuild.tbPotentials
|
||||
local tbChar = self.mapBuild.tbChar
|
||||
local bEmpty = true
|
||||
for k, v in ipairs(self._mapNode.PotentialList) do
|
||||
local nCount = tbChar[k].nPotentialCount
|
||||
v.gameObject:SetActive(0 < nCount)
|
||||
if 0 < nCount then
|
||||
bEmpty = false
|
||||
v:Init(tbChar[k].nTid, tbChar[k].nPotentialCount, tbPotential[tbChar[k].nTid], self._mapNode.PotentialDepotItem, k == 1)
|
||||
end
|
||||
end
|
||||
self._mapNode.goEmptyPotential.gameObject:SetActive(bEmpty)
|
||||
self._mapNode.goPotentialList.gameObject:SetActive(not bEmpty)
|
||||
end
|
||||
function StarTowerBuildContentCtrl:InitDisc()
|
||||
local mapTowerCfg = ConfigTable.GetData("StarTower", self.mapBuild.nTowerId)
|
||||
local tbNote = {}
|
||||
if mapTowerCfg ~= nil then
|
||||
local nDropGroup = mapTowerCfg.SubNoteSkillDropGroupId
|
||||
local tbNoteDrop = CacheTable.GetData("_SubNoteSkillDropGroup", nDropGroup)
|
||||
if tbNoteDrop ~= nil then
|
||||
for _, v in ipairs(tbNoteDrop) do
|
||||
table.insert(tbNote, v.SubNoteSkillId)
|
||||
end
|
||||
end
|
||||
end
|
||||
table.sort(tbNote)
|
||||
local exNote = {}
|
||||
for nNoteId, _ in pairs(self.mapBuild.tbNotes) do
|
||||
if table.indexof(tbNote, nNoteId) < 1 then
|
||||
table.insert(exNote, nNoteId)
|
||||
end
|
||||
end
|
||||
table.sort(exNote)
|
||||
for _, nNoteId in ipairs(exNote) do
|
||||
table.insert(tbNote, nNoteId)
|
||||
end
|
||||
local nNoteCount = #tbNote
|
||||
self.tbShowNote = {}
|
||||
for i = 1, 12 do
|
||||
self._mapNode.imgNote[i].gameObject:SetActive(i <= nNoteCount)
|
||||
if i <= nNoteCount then
|
||||
self.tbShowNote[tbNote[i]] = self.mapBuild.tbNotes[tbNote[i]] or 0
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNoteCount[i], self.mapBuild.tbNotes[tbNote[i]] or 0)
|
||||
local mapNoteSkillCfg = ConfigTable.GetData("SubNoteSkill", tbNote[i])
|
||||
if mapNoteSkillCfg then
|
||||
self:SetPngSprite(self._mapNode.imgNote[i], mapNoteSkillCfg.Icon)
|
||||
end
|
||||
end
|
||||
end
|
||||
self.tbSkill = {}
|
||||
local tbDisc = self.mapBuild.tbDisc
|
||||
for k, nId in ipairs(tbDisc) do
|
||||
if k <= 3 then
|
||||
local mapDisc = PlayerData.Disc:GetDiscById(nId)
|
||||
local tbSubSkill = mapDisc:GetAllSubSkill(self.mapBuild.tbNotes)
|
||||
for nSkillIndex, v in ipairs(tbSubSkill) do
|
||||
table.insert(self.tbSkill, {
|
||||
nSkillId = v,
|
||||
nDiscIndex = k,
|
||||
nSkillIndex = nSkillIndex
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
local sort = function(a, b)
|
||||
if a.nDiscIndex ~= b.nDiscIndex then
|
||||
return a.nDiscIndex < b.nDiscIndex
|
||||
elseif a.nSkillIndex ~= b.nSkillIndex then
|
||||
return a.nSkillIndex < b.nSkillIndex
|
||||
end
|
||||
end
|
||||
table.sort(self.tbSkill, sort)
|
||||
local bSkillEmpty = next(self.tbSkill) == nil
|
||||
self._mapNode.rtSkill:SetActive(not bSkillEmpty)
|
||||
self._mapNode.imgSkillEmpty:SetActive(bSkillEmpty)
|
||||
if bSkillEmpty then
|
||||
return
|
||||
end
|
||||
for i = 1, 6 do
|
||||
local mapSkill = self.tbSkill[i]
|
||||
self._mapNode.btnSkill[i].gameObject:SetActive(mapSkill)
|
||||
self._mapNode.goSkillEmpty[i]:SetActive(not mapSkill)
|
||||
if mapSkill then
|
||||
local nId = mapSkill.nSkillId
|
||||
local bActive = 0 < table.indexof(self.mapBuild.tbSecondarySkill, nId)
|
||||
self._mapNode.imgLock1_[i]:SetActive(not bActive)
|
||||
self._mapNode.imgLock2_[i]:SetActive(not bActive)
|
||||
self._mapNode.txtSkillUnactive1_[i].gameObject:SetActive(not bActive)
|
||||
self._mapNode.txtSkillLevel[i].gameObject:SetActive(bActive)
|
||||
local mapCfg = ConfigTable.GetData("SecondarySkill", nId)
|
||||
if mapCfg then
|
||||
self:SetPngSprite(self._mapNode.imgSkillIcon[i], mapCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
self:SetPngSprite(self._mapNode.imgSkillIconBg[i], mapCfg.IconBg .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSkillName[i], mapCfg.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSkillLevel[i], orderedFormat(ConfigTable.GetUIText("Build_DiscSkill_Sub_Level"), mapCfg.Level))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function StarTowerBuildContentCtrl:ChangeTab(nIndex)
|
||||
if self.nCurTab == nIndex then
|
||||
return
|
||||
end
|
||||
for i = 1, 2 do
|
||||
self._mapNode.imgOn[i]:SetActive(i == nIndex)
|
||||
self._mapNode.imgOff[i]:SetActive(i ~= nIndex)
|
||||
end
|
||||
self.nCurTab = nIndex
|
||||
self._mapNode.svPotential:SetActive(self.nCurTab == 1)
|
||||
self._mapNode.svDisc:SetActive(self.nCurTab == 2)
|
||||
end
|
||||
function StarTowerBuildContentCtrl:Awake()
|
||||
self._mapNode.PotentialDepotItem.gameObject:SetActive(false)
|
||||
end
|
||||
function StarTowerBuildContentCtrl:OnDisable()
|
||||
end
|
||||
function StarTowerBuildContentCtrl:OnBtnClick_Potential()
|
||||
self:ChangeTab(1)
|
||||
end
|
||||
function StarTowerBuildContentCtrl:OnBtnClick_Disc()
|
||||
self:ChangeTab(2)
|
||||
end
|
||||
function StarTowerBuildContentCtrl:OnEvent_SelectDepotPotential(nPotentialId, nLevel, nPotentialAdd, btn)
|
||||
local tip = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PotentialDetail, nPotentialId, nLevel, nPotentialAdd)
|
||||
end
|
||||
self._mapNode.scPotential:ScrollToClick(btn.gameObject, 0.1)
|
||||
self:AddTimer(1, 0.1, tip, true, true, true)
|
||||
end
|
||||
function StarTowerBuildContentCtrl:OnEvent_BuildClickDiscSkill(btn, callback)
|
||||
self._mapNode.scDisc:ScrollToClick(btn.gameObject, 0.1)
|
||||
self:AddTimer(1, 0.1, callback, true, true, true)
|
||||
end
|
||||
function StarTowerBuildContentCtrl:OnBtnClick_NoteInfo()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.NoteSkillInfo, self.tbShowNote)
|
||||
end
|
||||
function StarTowerBuildContentCtrl:OnBtnClick_Skill(btn, nIndex)
|
||||
local mapData = {
|
||||
nSkillId = self.tbSkill[nIndex].nSkillId
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSkillTips, btn.transform, mapData)
|
||||
end
|
||||
return StarTowerBuildContentCtrl
|
||||
@@ -0,0 +1,161 @@
|
||||
local StarTowerBuildDetailCtrl = class("StarTowerBuildDetailCtrl", BaseCtrl)
|
||||
StarTowerBuildDetailCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
TMPBuildSaveTime = {sComponentName = "TMP_Text"},
|
||||
btnRename = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Rename"
|
||||
},
|
||||
btn_Preference = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Preference"
|
||||
},
|
||||
btn_PreferenceIcon = {sComponentName = "Button"},
|
||||
txtLike = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Like"
|
||||
},
|
||||
txtBuildLock = {sComponentName = "TMP_Text"},
|
||||
btn_Lock = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Lock"
|
||||
},
|
||||
btn_LockIcon = {sComponentName = "Button"},
|
||||
btnDelete = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_DeleteBuild"
|
||||
},
|
||||
txtBuildDelete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Delete"
|
||||
},
|
||||
ani_root = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
BuildDetail = {
|
||||
sCtrlName = "Game.UI.StarTower.Build.StarTowerBuildDetailItemCtrl"
|
||||
},
|
||||
ContentList = {
|
||||
sCtrlName = "Game.UI.StarTower.Build.StarTowerBuildContentCtrl"
|
||||
}
|
||||
}
|
||||
StarTowerBuildDetailCtrl._mapEventConfig = {}
|
||||
function StarTowerBuildDetailCtrl:InitPanel()
|
||||
if not self.mapBuild.bDetail then
|
||||
print("build数据错误 无详细数据")
|
||||
return
|
||||
end
|
||||
self._mapNode.BuildDetail:Refresh(self.mapBuild)
|
||||
self._mapNode.ContentList:Refresh(self.mapBuild)
|
||||
self._mapNode.btn_PreferenceIcon.interactable = self.mapBuild.bPreference
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtLike, self.mapBuild.bPreference and Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764) or Color(0.5803921568627451, 0.6666666666666666, 0.7529411764705882))
|
||||
self._mapNode.btn_LockIcon.interactable = self.mapBuild.bLock
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuildLock, self.mapBuild.bLock and ConfigTable.GetUIText("RoguelikeBuild_Save_Lock") or ConfigTable.GetUIText("RoguelikeBuild_Save_Unlock"))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtBuildLock, self.mapBuild.bLock and Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764) or Color(0.5803921568627451, 0.6666666666666666, 0.7529411764705882))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPBuildSaveTime, string.format("<color=#5e89b4>保存时间:</color>%s", os.date("%Y/%m/%d %H:%M", math.floor(self.mapBuild.nBuildId / 1.0E9))))
|
||||
end
|
||||
function StarTowerBuildDetailCtrl:OpenConfirmHint()
|
||||
local nCoin = math.floor(math.min(math.max(self.mapBuild.nScore / tonumber(self.tbCoinRate[1]), tonumber(self.tbCoinRate[2])), tonumber(self.tbCoinRate[3])))
|
||||
local CheckCallback = function()
|
||||
local sTip = ""
|
||||
if self.mapBuild.mapRank.Rarity == GameEnum.itemRarity.SSR then
|
||||
sTip = ConfigTable.GetUIText("BUILD_07")
|
||||
else
|
||||
sTip = ConfigTable.GetUIText("BUILD_10")
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Item,
|
||||
sContent = sTip,
|
||||
tbItem = {
|
||||
[1] = {
|
||||
nTid = AllEnum.CoinItemId.FRRewardCurrency,
|
||||
nCount = nCoin
|
||||
}
|
||||
},
|
||||
callbackConfirm = function()
|
||||
local hasDispatchingBuild = false
|
||||
local tbDelete = {}
|
||||
if not PlayerData.Dispatch.IsBuildDispatching(self.mapBuild.nBuildId) then
|
||||
table.insert(tbDelete, self.mapBuild.nBuildId)
|
||||
else
|
||||
hasDispatchingBuild = true
|
||||
end
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.CloesCurPanel)
|
||||
end
|
||||
if 0 < #tbDelete and not hasDispatchingBuild then
|
||||
PlayerData.Build:DeleteBuild(tbDelete, nil, callback)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Agent_Build_Cant_Delete"))
|
||||
end
|
||||
end
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
PlayerData.Build:CheckCoinMax(nCoin, CheckCallback)
|
||||
end
|
||||
function StarTowerBuildDetailCtrl:Awake()
|
||||
self.tbCoinRate = ConfigTable.GetConfigArray("StarTowerBuildTransformParas")
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.mapBuild = tbParam[1]
|
||||
end
|
||||
end
|
||||
function StarTowerBuildDetailCtrl:OnEnable()
|
||||
self:InitPanel()
|
||||
end
|
||||
function StarTowerBuildDetailCtrl:OnDisable()
|
||||
end
|
||||
function StarTowerBuildDetailCtrl:OnDestroy()
|
||||
end
|
||||
function StarTowerBuildDetailCtrl:OnRelease()
|
||||
end
|
||||
function StarTowerBuildDetailCtrl:OnBtnClick_Preference(btn)
|
||||
local tbPreferenceCheckIn = {}
|
||||
local tbPreferenceCheckOut = {}
|
||||
local callback = function()
|
||||
self._mapNode.btn_PreferenceIcon.interactable = self.mapBuild.bPreference
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtLike, self.mapBuild.bPreference and Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764) or Color(0.5803921568627451, 0.6666666666666666, 0.7529411764705882))
|
||||
end
|
||||
if self.mapBuild.bPreference then
|
||||
table.insert(tbPreferenceCheckOut, self.mapBuild.nBuildId)
|
||||
else
|
||||
table.insert(tbPreferenceCheckIn, self.mapBuild.nBuildId)
|
||||
end
|
||||
PlayerData.Build:SetBuildPreference(tbPreferenceCheckIn, tbPreferenceCheckOut, callback)
|
||||
end
|
||||
function StarTowerBuildDetailCtrl:OnBtnClick_Lock(btn)
|
||||
local callback = function()
|
||||
self._mapNode.btn_LockIcon.interactable = self.mapBuild.bLock
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuildLock, self.mapBuild.bLock and ConfigTable.GetUIText("RoguelikeBuild_Save_Lock") or ConfigTable.GetUIText("RoguelikeBuild_Save_Unlock"))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtBuildLock, self.mapBuild.bLock and Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764) or Color(0.5803921568627451, 0.6666666666666666, 0.7529411764705882))
|
||||
end
|
||||
PlayerData.Build:ChangeBuildLock(self.mapBuild.nBuildId, not self.mapBuild.bLock, callback)
|
||||
end
|
||||
function StarTowerBuildDetailCtrl:OnBtnClick_DeleteBuild(btn)
|
||||
if self.mapBuild.bLock then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("BUILD_01"))
|
||||
return
|
||||
end
|
||||
self:OpenConfirmHint()
|
||||
end
|
||||
function StarTowerBuildDetailCtrl:OnBtnClick_Rename(btn)
|
||||
local callback = function(sName)
|
||||
self._mapNode.BuildDetail:SetName(sName)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BuildRename, self.mapBuild, callback)
|
||||
end
|
||||
function StarTowerBuildDetailCtrl:OnBtnClick_CharInfo(btn, nIndex)
|
||||
local nCharTid = self.mapBuild.tbChar[nIndex].nTid
|
||||
local tbChar = {
|
||||
self.mapBuild.tbChar[1].nTid,
|
||||
self.mapBuild.tbChar[2].nTid,
|
||||
self.mapBuild.tbChar[3].nTid
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgPanel, PanelId.CharInfo, nCharTid, tbChar)
|
||||
end
|
||||
return StarTowerBuildDetailCtrl
|
||||
@@ -0,0 +1,163 @@
|
||||
local StarTowerBuildDetailItemCtrl = class("StarTowerBuildDetailItemCtrl", BaseCtrl)
|
||||
StarTowerBuildDetailItemCtrl._mapNodeConfig = {
|
||||
imgRareFrame = {sComponentName = "Image"},
|
||||
imgRareScore = {sComponentName = "Image"},
|
||||
txtScoreCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Score"
|
||||
},
|
||||
txtScore = {sComponentName = "TMP_Text"},
|
||||
txtChar = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Char_Title"
|
||||
},
|
||||
btnLeader = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Leader"
|
||||
},
|
||||
btnSub = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Sub"
|
||||
},
|
||||
imgCharIcon = {nCount = 3, sComponentName = "Image"},
|
||||
imgCharFrame = {nCount = 3, sComponentName = "Image"},
|
||||
txtPotentialCount = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
txtBuildName = {sComponentName = "TMP_Text"},
|
||||
txtDisc = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_MainDisc_Title"
|
||||
},
|
||||
txtLeaderCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Leader"
|
||||
},
|
||||
txtSubCn = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Sub"
|
||||
},
|
||||
imgCharElement = {nCount = 3, sComponentName = "Image"},
|
||||
btnDiscItem = {
|
||||
nCount = 3,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Disc"
|
||||
},
|
||||
goDiscItem = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.StarTower.Build.BuildSimpleDiscItem"
|
||||
},
|
||||
btnDiscDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_DiscDetail"
|
||||
},
|
||||
btnAttr = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Attr"
|
||||
},
|
||||
txtAttr = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
StarTowerBuildDetailItemCtrl._mapEventConfig = {}
|
||||
StarTowerBuildDetailItemCtrl._mapRedDotConfig = {}
|
||||
function StarTowerBuildDetailItemCtrl:Refresh(mapData)
|
||||
self.mapBuild = mapData
|
||||
self:RefreshInfo()
|
||||
self:RefreshChar()
|
||||
self:RefreshDisc()
|
||||
end
|
||||
function StarTowerBuildDetailItemCtrl:RefreshInfo()
|
||||
local sScore = "Icon/BuildRank/BuildRank_" .. self.mapBuild.mapRank.Id
|
||||
local sFrame = AllEnum.FrameType_New.BuildRankDB .. AllEnum.FrameColor_New[self.mapBuild.mapRank.Rarity]
|
||||
self:SetPngSprite(self._mapNode.imgRareScore, sScore)
|
||||
self:SetAtlasSprite(self._mapNode.imgRareFrame, "12_rare", sFrame)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtScore, self.mapBuild.nScore)
|
||||
if self.mapBuild.sName == "" or self.mapBuild.sName == nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuildName, ConfigTable.GetUIText("RoguelikeBuild_EmptyBuildName"))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuildName, self.mapBuild.sName)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtAttr, UTILS.ParseParamDesc(ConfigTable.GetUIText(self.mapBuild.mapRank.Desc), self.mapBuild.mapRank))
|
||||
end
|
||||
function StarTowerBuildDetailItemCtrl:RefreshChar()
|
||||
for i = 1, 3 do
|
||||
local nCharTid = self.mapBuild.tbChar[i].nTid
|
||||
local nCharSkinId = PlayerData.Char:GetCharSkinId(nCharTid)
|
||||
local mapCharSkin = ConfigTable.GetData_CharacterSkin(nCharSkinId)
|
||||
local mapCharCfg = ConfigTable.GetData_Character(nCharTid)
|
||||
local sFrame = AllEnum.FrameType_New.BoardFrame .. AllEnum.BoardFrameColor[mapCharCfg.Grade]
|
||||
self:SetPngSprite(self._mapNode.imgCharIcon[i], mapCharSkin.Icon .. AllEnum.CharHeadIconSurfix.XXL)
|
||||
self:SetAtlasSprite(self._mapNode.imgCharFrame[i], "12_rare", sFrame, true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPotentialCount[i], self.mapBuild.tbChar[i].nPotentialCount)
|
||||
self:SetAtlasSprite(self._mapNode.imgCharElement[i], "12_rare", AllEnum.Char_Element[mapCharCfg.EET].icon)
|
||||
end
|
||||
end
|
||||
function StarTowerBuildDetailItemCtrl:RefreshDisc()
|
||||
local nIndex = 1
|
||||
for _, nId in ipairs(self.mapBuild.tbDisc) do
|
||||
if nil ~= self._mapNode.goDiscItem[nIndex] and nIndex <= 3 then
|
||||
self._mapNode.goDiscItem[nIndex]:Init(nId)
|
||||
end
|
||||
nIndex = nIndex + 1
|
||||
end
|
||||
end
|
||||
function StarTowerBuildDetailItemCtrl:SetName(sName)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuildName, sName)
|
||||
end
|
||||
function StarTowerBuildDetailItemCtrl:Awake()
|
||||
end
|
||||
function StarTowerBuildDetailItemCtrl:FadeIn()
|
||||
end
|
||||
function StarTowerBuildDetailItemCtrl:FadeOut()
|
||||
end
|
||||
function StarTowerBuildDetailItemCtrl:OnEnable()
|
||||
end
|
||||
function StarTowerBuildDetailItemCtrl:OnDisable()
|
||||
end
|
||||
function StarTowerBuildDetailItemCtrl:OnDestroy()
|
||||
end
|
||||
function StarTowerBuildDetailItemCtrl:OnRelease()
|
||||
end
|
||||
function StarTowerBuildDetailItemCtrl:OnBtnClick_Attr()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BuildAttrPreview, self.mapBuild.mapRank.Id, self.mapBuild.nScore)
|
||||
end
|
||||
function StarTowerBuildDetailItemCtrl:OnBtnClick_Disc(btn, nIndex)
|
||||
local nIdx = 0
|
||||
local nDiscId = 0
|
||||
local tbAllDisc = {}
|
||||
for _, nId in ipairs(self.mapBuild.tbDisc) do
|
||||
nIdx = nIdx + 1
|
||||
if nIdx == nIndex then
|
||||
nDiscId = nId
|
||||
end
|
||||
table.insert(tbAllDisc, nId)
|
||||
end
|
||||
if nDiscId ~= 0 then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Disc, nDiscId, tbAllDisc)
|
||||
end
|
||||
end
|
||||
function StarTowerBuildDetailItemCtrl:OnBtnClick_Leader()
|
||||
local tbCharId = {}
|
||||
for _, v in ipairs(self.mapBuild.tbChar) do
|
||||
table.insert(tbCharId, v.nTid)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgPanel, PanelId.CharInfo, tbCharId[1], tbCharId, true)
|
||||
end
|
||||
function StarTowerBuildDetailItemCtrl:OnBtnClick_Sub(btn, nIndex)
|
||||
local tbCharId = {}
|
||||
for _, v in ipairs(self.mapBuild.tbChar) do
|
||||
table.insert(tbCharId, v.nTid)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgPanel, PanelId.CharInfo, tbCharId[nIndex + 1], tbCharId, true)
|
||||
end
|
||||
function StarTowerBuildDetailItemCtrl:OnBtnClick_DiscDetail()
|
||||
local tbDisc = {}
|
||||
local mapDiscData = {}
|
||||
for i = 1, 6 do
|
||||
tbDisc[i] = self.mapBuild.tbDisc[i] or 0
|
||||
if 0 ~= tbDisc[i] then
|
||||
mapDiscData[tbDisc[i]] = PlayerData.Disc:GetDiscById(tbDisc[i])
|
||||
end
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSkill, tbDisc, self.mapBuild.tbNotes, mapDiscData)
|
||||
end
|
||||
return StarTowerBuildDetailItemCtrl
|
||||
@@ -0,0 +1,18 @@
|
||||
local StarTowerBuildDetailPanel = class("StarTowerBuildDetailPanel", BasePanel)
|
||||
StarTowerBuildDetailPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "StarTowerBuild/StarTowerBuildDetailPanel.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.Build.StarTowerBuildDetailCtrl"
|
||||
}
|
||||
}
|
||||
function StarTowerBuildDetailPanel:Awake()
|
||||
end
|
||||
function StarTowerBuildDetailPanel:OnEnable()
|
||||
end
|
||||
function StarTowerBuildDetailPanel:OnDisable()
|
||||
end
|
||||
function StarTowerBuildDetailPanel:OnDestroy()
|
||||
end
|
||||
function StarTowerBuildDetailPanel:OnRelease()
|
||||
end
|
||||
return StarTowerBuildDetailPanel
|
||||
@@ -0,0 +1,232 @@
|
||||
local StarTowerBuildSaveCtrl = class("StarTowerBuildSaveCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
StarTowerBuildSaveCtrl._mapNodeConfig = {
|
||||
goBg = {sNodeName = "---BG---"},
|
||||
goblur = {
|
||||
sNodeName = "t_fullscreen_blur_black"
|
||||
},
|
||||
goBuildContent = {},
|
||||
BuildDetail = {
|
||||
sCtrlName = "Game.UI.StarTower.Build.StarTowerBuildDetailItemCtrl"
|
||||
},
|
||||
ContentList = {
|
||||
sCtrlName = "Game.UI.StarTower.Build.StarTowerBuildContentCtrl"
|
||||
},
|
||||
btnLock = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Lock"
|
||||
},
|
||||
btnPreference = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Preference"
|
||||
},
|
||||
btnSave = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Save"
|
||||
},
|
||||
btnDelete = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Delete"
|
||||
},
|
||||
btnPreferenceIcon = {sComponentName = "Button"},
|
||||
btnRename = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Rename"
|
||||
},
|
||||
btnLockIcon = {sComponentName = "Button"},
|
||||
txtBuildLock = {sComponentName = "TMP_Text"},
|
||||
txtLike = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Like"
|
||||
},
|
||||
txtSave = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Save"
|
||||
},
|
||||
Mask = {
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
goDeleteResult = {},
|
||||
goDeleteAnim = {
|
||||
sNodeName = "goDeleteResult",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RoguelikeBuild_Common_HintTitle"
|
||||
},
|
||||
txtDeleteTip = {sComponentName = "TMP_Text", sLanguageId = "BUILD_08"},
|
||||
imgRewardIcon = {sComponentName = "Image"},
|
||||
txtDeleteRewardCount = {sComponentName = "TMP_Text"},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_DeleteResult"
|
||||
},
|
||||
btnConfirm2 = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_DeleteResult"
|
||||
},
|
||||
txtDeleteBtn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RoguelikeBuild_Common_BtnConfirm"
|
||||
}
|
||||
}
|
||||
StarTowerBuildSaveCtrl._mapEventConfig = {}
|
||||
StarTowerBuildSaveCtrl._mapRedDotConfig = {}
|
||||
function StarTowerBuildSaveCtrl:InitPanel()
|
||||
self._mapNode.goBuildContent:SetActive(true)
|
||||
self._mapNode.BuildDetail:Refresh(self.mapBuild)
|
||||
self._mapNode.ContentList:Refresh(self.mapBuild)
|
||||
self.bLock = self.mapBuild.bLock
|
||||
self._mapNode.btnLockIcon.interactable = self.bLock
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuildLock, self.bLock and ConfigTable.GetUIText("RoguelikeBuild_Save_Lock") or ConfigTable.GetUIText("RoguelikeBuild_Save_Unlock"))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtBuildLock, self.bLock and Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764) or Color(0.5803921568627451, 0.6666666666666666, 0.7529411764705882))
|
||||
end
|
||||
function StarTowerBuildSaveCtrl:InitPanelDelete()
|
||||
self._mapNode.goBuildContent:SetActive(false)
|
||||
self._mapNode.goBg:SetActive(false)
|
||||
self._mapNode.goDeleteResult:SetActive(true)
|
||||
self._mapNode.goDeleteAnim:Play("t_window_04_t_in")
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDeleteRewardCount, string.format("x%d", self.mapBuild))
|
||||
local nDeleteReturnId = ConfigTable.GetConfigNumber("StarTowerBuildDeleteReturnItemId")
|
||||
local mapCfg = ConfigTable.GetData_Item(nDeleteReturnId)
|
||||
if mapCfg ~= nil then
|
||||
self:SetPngSprite(self._mapNode.imgRewardIcon, mapCfg.Icon)
|
||||
end
|
||||
end
|
||||
function StarTowerBuildSaveCtrl:OpenConfirmHint()
|
||||
local nCoin = math.floor(math.min(math.max(self.mapBuild.nScore / tonumber(self.tbCoinRate[1]), tonumber(self.tbCoinRate[2])), tonumber(self.tbCoinRate[3])))
|
||||
local CheckCallback = function()
|
||||
local sTip = ""
|
||||
if self.mapBuild.mapRank.Rarity == GameEnum.itemRarity.SSR then
|
||||
sTip = ConfigTable.GetUIText("BUILD_07")
|
||||
else
|
||||
sTip = ConfigTable.GetUIText("BUILD_10")
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Item,
|
||||
sContent = sTip,
|
||||
tbItem = {
|
||||
[1] = {
|
||||
nTid = AllEnum.CoinItemId.FRRewardCurrency,
|
||||
nCount = nCoin
|
||||
}
|
||||
},
|
||||
callbackConfirm = function()
|
||||
local callback = function(mapChangeInfo)
|
||||
UTILS.OpenReceiveByChangeInfo(mapChangeInfo, function()
|
||||
self:ClosePanel()
|
||||
end)
|
||||
end
|
||||
PlayerData.Build:SaveBuild(self.mapBuild.nBuildId, true, self.bLock, self.bPreference, self.sName, callback)
|
||||
end
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
PlayerData.Build:CheckCoinMax(nCoin, CheckCallback)
|
||||
end
|
||||
function StarTowerBuildSaveCtrl:ClosePanel()
|
||||
if NovaAPI.GetCurrentModuleName() == "MainMenuModuleScene" then
|
||||
EventManager.Hit(EventId.CloesCurPanel)
|
||||
PlayerData.Base:CheckNextDayForSweep()
|
||||
else
|
||||
PanelManager.InputEnable(nil, true)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.Mask, 0)
|
||||
self._mapNode.Mask.gameObject:SetActive(true)
|
||||
local sequence = DOTween.Sequence()
|
||||
sequence:Append(self._mapNode.Mask:DOFade(1, 0.5):SetUpdate(true))
|
||||
sequence:AppendCallback(function()
|
||||
if self.bSuccess then
|
||||
NovaAPI.EnterModule("MainMenuModuleScene", true, 17)
|
||||
else
|
||||
local function levelEndCallback()
|
||||
EventManager.Remove("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
|
||||
NovaAPI.EnterModule("MainMenuModuleScene", true, 17)
|
||||
end
|
||||
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
|
||||
CS.AdventureModuleHelper.LevelStateChanged(true, 0, true)
|
||||
end
|
||||
end)
|
||||
sequence:SetUpdate(true)
|
||||
end
|
||||
end
|
||||
function StarTowerBuildSaveCtrl:Awake()
|
||||
self._mapNode.goBuildContent:SetActive(false)
|
||||
if NovaAPI.GetCurrentModuleName() ~= "MainMenuModuleScene" then
|
||||
PanelManager.InputDisable()
|
||||
end
|
||||
self.tbCoinRate = ConfigTable.GetConfigArray("StarTowerBuildTransformParas")
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.bSuccess = tbParam[1]
|
||||
self.mapBuild = tbParam[2]
|
||||
self.bSweep = tbParam[4]
|
||||
end
|
||||
end
|
||||
function StarTowerBuildSaveCtrl:OnEnable()
|
||||
if NovaAPI.GetCurrentModuleName() ~= "MainMenuModuleScene" then
|
||||
self._mapNode.goBg:SetActive(false)
|
||||
self._mapNode.goblur:SetActive(true)
|
||||
else
|
||||
self._mapNode.goBg:SetActive(true)
|
||||
self._mapNode.goblur:SetActive(false)
|
||||
end
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
if type(self.mapBuild) == "table" then
|
||||
self:InitPanel()
|
||||
else
|
||||
self:InitPanelDelete()
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function StarTowerBuildSaveCtrl:OnDisable()
|
||||
end
|
||||
function StarTowerBuildSaveCtrl:OnDestroy()
|
||||
end
|
||||
function StarTowerBuildSaveCtrl:OnRelease()
|
||||
end
|
||||
function StarTowerBuildSaveCtrl:OnBtnClick_Rename()
|
||||
local callback = function(sName)
|
||||
self._mapNode.BuildDetail:SetName(sName)
|
||||
self.sName = sName
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BuildRename, self.mapBuild, callback, true, self.sName)
|
||||
end
|
||||
function StarTowerBuildSaveCtrl:OnBtnClick_Lock()
|
||||
self.bLock = not self.bLock
|
||||
self._mapNode.btnLockIcon.interactable = self.bLock
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuildLock, self.bLock and ConfigTable.GetUIText("RoguelikeBuild_Save_Lock") or ConfigTable.GetUIText("RoguelikeBuild_Save_Unlock"))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtBuildLock, self.bLock and Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764) or Color(0.5803921568627451, 0.6666666666666666, 0.7529411764705882))
|
||||
end
|
||||
function StarTowerBuildSaveCtrl:OnBtnClick_Preference()
|
||||
self.bPreference = not self.bPreference
|
||||
self._mapNode.btnPreferenceIcon.interactable = self.bPreference
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtLike, self.bPreference and Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764) or Color(0.5803921568627451, 0.6666666666666666, 0.7529411764705882))
|
||||
end
|
||||
function StarTowerBuildSaveCtrl:OnBtnClick_Save(btn)
|
||||
local callback = function()
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("BUILD_09"),
|
||||
callbackConfirm = function()
|
||||
self:ClosePanel()
|
||||
end
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
PlayerData.Build:SaveBuild(self.mapBuild.nBuildId, false, self.bLock, self.bPreference, self.sName, callback)
|
||||
end
|
||||
function StarTowerBuildSaveCtrl:OnBtnClick_Delete()
|
||||
if self.bLock then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Build_LockDelete"))
|
||||
return
|
||||
end
|
||||
self:OpenConfirmHint()
|
||||
end
|
||||
function StarTowerBuildSaveCtrl:OnBtnClick_DeleteResult()
|
||||
self._mapNode.goDeleteResult:SetActive(false)
|
||||
self:ClosePanel()
|
||||
end
|
||||
return StarTowerBuildSaveCtrl
|
||||
@@ -0,0 +1,17 @@
|
||||
local StarTowerBuildSavePanel = class("StarTowerBuildSavePanel", BasePanel)
|
||||
StarTowerBuildSavePanel._bAddToBackHistory = false
|
||||
StarTowerBuildSavePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "StarTowerBuild/StarTowerBuildSavePanel.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.Build.StarTowerBuildSaveCtrl"
|
||||
}
|
||||
}
|
||||
function StarTowerBuildSavePanel:Awake()
|
||||
end
|
||||
function StarTowerBuildSavePanel:OnEnable()
|
||||
end
|
||||
function StarTowerBuildSavePanel:OnDisable()
|
||||
end
|
||||
function StarTowerBuildSavePanel:OnDestroy()
|
||||
end
|
||||
return StarTowerBuildSavePanel
|
||||
@@ -0,0 +1,111 @@
|
||||
local CharPotentialListCtrl = class("CharPotentialListCtrl", BaseCtrl)
|
||||
CharPotentialListCtrl._mapNodeConfig = {
|
||||
txtCharName = {sComponentName = "TMP_Text"},
|
||||
txtHas = {sComponentName = "TMP_Text"},
|
||||
txtAll = {sComponentName = "TMP_Text"},
|
||||
imgHead = {sComponentName = "Image"},
|
||||
imgHeadFrame = {sComponentName = "Image"},
|
||||
PotentialStyle = {nCount = 3},
|
||||
txtPotentialTitle = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
txtPotentialTitle3 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Potential_Build_Common"
|
||||
},
|
||||
rtPotential = {
|
||||
nCount = 3,
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
CharPotentialListCtrl._mapEventConfig = {}
|
||||
CharPotentialListCtrl._mapRedDotConfig = {}
|
||||
function CharPotentialListCtrl:RefreshPotential(nCharId, mapPotential, bShowAll, goPotentialItem, bMaster)
|
||||
self.mapPotential = mapPotential
|
||||
local charCfg = ConfigTable.GetData_Character(nCharId)
|
||||
if nil ~= charCfg then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCharName, charCfg.Name)
|
||||
local nSkinId = PlayerData.Char:GetCharUsedSkinId(nCharId)
|
||||
local skinCfg = ConfigTable.GetData_CharacterSkin(nSkinId)
|
||||
self:SetPngSprite(self._mapNode.imgHead, skinCfg.Icon .. AllEnum.CharHeadIconSurfix.XXL)
|
||||
local sFrame = AllEnum.FrameType_New.BoardFrame .. AllEnum.BoardFrameColor[charCfg.Grade]
|
||||
self:SetAtlasSprite(self._mapNode.imgHeadFrame, "12_rare", sFrame)
|
||||
end
|
||||
local tbPotential = mapPotential
|
||||
local tbBuild1 = tbPotential[GameEnum.potentialBuild.PotentialBuild1] or {}
|
||||
local tbBuild2 = tbPotential[GameEnum.potentialBuild.PotentialBuild2] or {}
|
||||
local tbBuildCommon = tbPotential[GameEnum.potentialBuild.PotentialBuildCommon] or {}
|
||||
self._mapNode.PotentialStyle[1]:SetActive(0 < #tbBuild1)
|
||||
self._mapNode.PotentialStyle[2]:SetActive(0 < #tbBuild2)
|
||||
self._mapNode.PotentialStyle[3]:SetActive(0 < #tbBuildCommon)
|
||||
local nAllCount = #tbBuild1 + #tbBuild2 + #tbBuildCommon
|
||||
NovaAPI.SetTMPText(self._mapNode.txtAll, string.format("/%s", nAllCount))
|
||||
self.nHasCount = 0
|
||||
local nPotentialCount = 1
|
||||
local createPotentialItem = function(tbPotential, rtContent)
|
||||
if 0 < #tbPotential then
|
||||
for k, v in ipairs(tbPotential) do
|
||||
if nil == self.tbPotentialItemCtrl[nPotentialCount] then
|
||||
local itemObj = instantiate(goPotentialItem, rtContent)
|
||||
itemObj.gameObject:SetActive(true)
|
||||
local itemCtrl = self:BindCtrlByNode(itemObj, "Game.UI.StarTower.Depot.DepotPotentialItemCtrl")
|
||||
itemCtrl:InitItem(v.nId, v.nLevel, v.nPotentialAdd, true)
|
||||
table.insert(self.tbPotentialItemCtrl, itemCtrl)
|
||||
else
|
||||
self.tbPotentialItemCtrl[nPotentialCount]:InitItem(v.nId, v.nLevel, v.nPotentialAdd, true)
|
||||
end
|
||||
self.nHasCount = self.nHasCount + v.nUnlock
|
||||
nPotentialCount = nPotentialCount + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
createPotentialItem(tbBuild1, self._mapNode.rtPotential[1])
|
||||
createPotentialItem(tbBuild2, self._mapNode.rtPotential[2])
|
||||
createPotentialItem(tbBuildCommon, self._mapNode.rtPotential[3])
|
||||
NovaAPI.SetTMPText(self._mapNode.txtHas, self.nHasCount)
|
||||
self:SwitchPotentialAll(bShowAll)
|
||||
self:SetPotentialBuildName(nCharId, bMaster)
|
||||
end
|
||||
function CharPotentialListCtrl:SwitchPotentialAll(bShowAll)
|
||||
local nPotentialIndex = 1
|
||||
for nStyle, tbSubMap in ipairs(self.mapPotential) do
|
||||
local bShowStyle = false
|
||||
for k, v in ipairs(tbSubMap) do
|
||||
if bShowAll then
|
||||
bShowStyle = true
|
||||
self.tbPotentialItemCtrl[nPotentialIndex].gameObject:SetActive(true)
|
||||
else
|
||||
local bShow = v.nUnlock > 0
|
||||
self.tbPotentialItemCtrl[nPotentialIndex].gameObject:SetActive(bShow)
|
||||
if bShow then
|
||||
bShowStyle = true
|
||||
end
|
||||
end
|
||||
nPotentialIndex = nPotentialIndex + 1
|
||||
end
|
||||
self._mapNode.PotentialStyle[nStyle]:SetActive(bShowStyle)
|
||||
end
|
||||
self.gameObject:SetActive(bShowAll or 0 < self.nHasCount)
|
||||
end
|
||||
function CharPotentialListCtrl:SetPotentialBuildName(nCharId, bMaster)
|
||||
local charDescCfg = ConfigTable.GetData("CharacterDes", nCharId)
|
||||
if charDescCfg ~= nil then
|
||||
for i = 1, 2 do
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPotentialTitle[i], bMaster and charDescCfg["PotentialMain" .. i] or charDescCfg["PotentialAssistant" .. i])
|
||||
end
|
||||
end
|
||||
end
|
||||
function CharPotentialListCtrl:Awake()
|
||||
self.tbPotentialItemCtrl = {}
|
||||
self.mapPotential = {}
|
||||
end
|
||||
function CharPotentialListCtrl:OnEnable()
|
||||
end
|
||||
function CharPotentialListCtrl:OnDisable()
|
||||
for nInstanceId, objCtrl in pairs(self.tbPotentialItemCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbPotentialItemCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbPotentialItemCtrl = {}
|
||||
end
|
||||
function CharPotentialListCtrl:OnDestroy()
|
||||
end
|
||||
return CharPotentialListCtrl
|
||||
@@ -0,0 +1,376 @@
|
||||
local DepotCharInfoCtrl = class("DepotCharInfoCtrl", BaseCtrl)
|
||||
local AdventureModuleHelper = CS.AdventureModuleHelper
|
||||
local CharacterAttrData = require("GameCore.Data.DataClass.CharacterAttrData")
|
||||
DepotCharInfoCtrl._mapNodeConfig = {
|
||||
goProperty = {
|
||||
nCount = 5,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplatePropertyCtrl"
|
||||
},
|
||||
txtTitleAttr = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot_Info_Property"
|
||||
},
|
||||
btnChar = {
|
||||
nCount = 3,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Char"
|
||||
},
|
||||
imgHead = {nCount = 3, sComponentName = "Image"},
|
||||
goSelect = {nCount = 3},
|
||||
txtLeaderCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Leader"
|
||||
},
|
||||
txtSubCn = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Sub"
|
||||
},
|
||||
btnPopSkill = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Skill"
|
||||
},
|
||||
btnAttrDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
rtInfo = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateCharInfoCtrl"
|
||||
},
|
||||
txtBtnSkill = {sComponentName = "TMP_Text", sLanguageId = "SkillCn"},
|
||||
rtEquipment = {},
|
||||
txtTitleEquipment = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot_Info_Equipment"
|
||||
},
|
||||
btnEquipment = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Equipment"
|
||||
},
|
||||
imgEquipment = {nCount = 3, sComponentName = "Image"},
|
||||
goEquipment = {nCount = 3},
|
||||
txtEquipmentLock = {nCount = 3, sComponentName = "TMP_Text"}
|
||||
}
|
||||
DepotCharInfoCtrl._mapEventConfig = {}
|
||||
DepotCharInfoCtrl._mapRedDotConfig = {}
|
||||
function DepotCharInfoCtrl:RefreshCharInfo(tbTeam, mapCharaData)
|
||||
self.tbTeam = tbTeam
|
||||
self.mapCharData = mapCharaData
|
||||
if not self.nCharId then
|
||||
self.nCharId = self.tbTeam[1]
|
||||
self.nSelectIndex = 1
|
||||
end
|
||||
self:RefreshActorId()
|
||||
self:SwitchChar()
|
||||
self:RefreshChoose()
|
||||
end
|
||||
function DepotCharInfoCtrl:SwitchChar()
|
||||
local mapChar = {
|
||||
nLevel = self.mapCharData[self.nCharId].nLevel,
|
||||
nAdvance = self.mapCharData[self.nCharId].nAdvance
|
||||
}
|
||||
local tbEffect = {}
|
||||
for _, v in ipairs(self.mapCharData[self.nCharId].tbAffinityeffectIds) do
|
||||
table.insert(tbEffect, v)
|
||||
end
|
||||
for _, v in ipairs(self.mapCharData[self.nCharId].tbTalentEffect) do
|
||||
table.insert(tbEffect, v)
|
||||
end
|
||||
for _, v in ipairs(self.mapCharData[self.nCharId].tbEquipmentEffect) do
|
||||
table.insert(tbEffect, v)
|
||||
end
|
||||
local tbRandomAttr = self:GetCharEquipmentRandomAttr()
|
||||
if not self.attrData then
|
||||
self.attrData = CharacterAttrData.new(self.nCharId, {
|
||||
mapChar = mapChar,
|
||||
tbEffect = tbEffect,
|
||||
tbRandomAttr = tbRandomAttr
|
||||
})
|
||||
else
|
||||
self.attrData:SetCharacter(self.nCharId, {
|
||||
mapChar = mapChar,
|
||||
tbEffect = tbEffect,
|
||||
tbRandomAttr = tbRandomAttr
|
||||
})
|
||||
end
|
||||
self:RefreshActor2D()
|
||||
self:RefreshAttribute()
|
||||
self:RefreshInfo()
|
||||
end
|
||||
function DepotCharInfoCtrl:GetCharEquipmentRandomAttr()
|
||||
local tbEquipedGem = self.mapCharData[self.nCharId].tbEquipment
|
||||
if not tbEquipedGem or #tbEquipedGem == 0 then
|
||||
return {}
|
||||
end
|
||||
local tbRandomAttrList = {}
|
||||
for _, mapEquipment in pairs(tbEquipedGem) do
|
||||
local mapRandomAttr = mapEquipment:GetRandomAttr()
|
||||
for k, v in ipairs(mapRandomAttr) do
|
||||
local nAttrId = v.AttrId
|
||||
if nAttrId ~= nil then
|
||||
local nCfgValue = v.CfgValue
|
||||
local nValue = v.Value
|
||||
if nil == tbRandomAttrList[nAttrId] then
|
||||
tbRandomAttrList[nAttrId] = {CfgValue = nCfgValue, Value = nValue}
|
||||
else
|
||||
tbRandomAttrList[nAttrId].CfgValue = tbRandomAttrList[nAttrId].CfgValue + nCfgValue
|
||||
tbRandomAttrList[nAttrId].Value = tbRandomAttrList[nAttrId].Value + nValue
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for _, v in pairs(tbRandomAttrList) do
|
||||
v.CfgValue = clearFloat(v.CfgValue)
|
||||
end
|
||||
return tbRandomAttrList
|
||||
end
|
||||
function DepotCharInfoCtrl:RefreshChoose()
|
||||
for i = 1, 3 do
|
||||
local nCharId = self.tbTeam[i]
|
||||
local charData = self.mapCharData[nCharId]
|
||||
if charData ~= nil then
|
||||
local nCharSkinId = charData.nSkinId
|
||||
local mapCharSkin = ConfigTable.GetData_CharacterSkin(nCharSkinId)
|
||||
self:SetPngSprite(self._mapNode.imgHead[i], mapCharSkin.Icon .. AllEnum.CharHeadIconSurfix.L)
|
||||
self._mapNode.goSelect[i]:SetActive(self.nSelectIndex == i)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DepotCharInfoCtrl:RefreshActor2D()
|
||||
EventManager.Hit("RefreshActor2D_Depot", self.nCharId)
|
||||
end
|
||||
function DepotCharInfoCtrl:RefreshAttribute()
|
||||
local HealthInfo = self.tbActorHealthInfo[self.nCharId]
|
||||
local Info = self.tbActorInfo[self.nCharId]
|
||||
local tbAttr = {}
|
||||
if self.nSelectIndex == 1 then
|
||||
local hp = HealthInfo ~= nil and HealthInfo.hp:AsInt() or 0
|
||||
local hpMax = HealthInfo ~= nil and HealthInfo.hpMax:AsInt() or 0
|
||||
tbAttr = {totalValue = hp, baseValue = hp}
|
||||
self._mapNode.goProperty[1]:SetCharProperty(AllEnum.CharAttr[1], tbAttr, true, hpMax)
|
||||
self._mapNode.goProperty[1].gameObject:SetActive(true)
|
||||
else
|
||||
local hpMax = HealthInfo ~= nil and HealthInfo.hpMax:AsInt() or 0
|
||||
tbAttr = {totalValue = hpMax, baseValue = hpMax}
|
||||
self._mapNode.goProperty[1]:SetCharProperty(AllEnum.CharAttr[1], tbAttr, true)
|
||||
self._mapNode.goProperty[1].gameObject:SetActive(true)
|
||||
end
|
||||
local atk = Info ~= nil and Info.atk:AsInt() or 0
|
||||
tbAttr = {totalValue = atk, baseValue = atk}
|
||||
self._mapNode.goProperty[2]:SetCharProperty(AllEnum.CharAttr[2], tbAttr, true)
|
||||
local def = Info ~= nil and Info.def:AsInt() or 0
|
||||
tbAttr = {totalValue = def, baseValue = def}
|
||||
self._mapNode.goProperty[3]:SetCharProperty(AllEnum.CharAttr[3], tbAttr, true)
|
||||
local critRate = Info ~= nil and Info.critRate:AsFloat() or 0
|
||||
tbAttr = {
|
||||
totalValue = critRate * 100,
|
||||
baseValue = critRate * 100
|
||||
}
|
||||
self._mapNode.goProperty[4]:SetCharProperty(AllEnum.CharAttr[4], tbAttr, false)
|
||||
local critPower = Info ~= nil and Info.critPower:AsFloat() or 0
|
||||
tbAttr = {
|
||||
totalValue = critPower * 100,
|
||||
baseValue = critPower * 100
|
||||
}
|
||||
self._mapNode.goProperty[5]:SetCharProperty(AllEnum.CharAttr[5], tbAttr, false)
|
||||
end
|
||||
function DepotCharInfoCtrl:RefreshActorId()
|
||||
local actorIdCSList = AdventureModuleHelper.GetCurrentGroupPlayers()
|
||||
self.tbActorInfo, self.tbActorHealthInfo, self.tbElementInfo, self.tbSkillCd, self.tbEnergyEfficiency, self.tbEnergyConvRatio = {}, {}, {}, {}, {}, {}
|
||||
for i = 0, actorIdCSList.Count - 1 do
|
||||
local characterId = AdventureModuleHelper.GetCharacterId(actorIdCSList[i])
|
||||
if characterId and 0 < characterId then
|
||||
self.tbActorInfo[characterId] = AdventureModuleHelper.GetEntityInfo(actorIdCSList[i])
|
||||
self.tbActorHealthInfo[characterId] = AdventureModuleHelper.GetEntityHealthInfo(actorIdCSList[i])
|
||||
self.tbElementInfo[characterId] = AdventureModuleHelper.GetEntityElementInfo(actorIdCSList[i])
|
||||
self.tbSkillCd[characterId] = AdventureModuleHelper.GetPlayerSkillCd(actorIdCSList[i])
|
||||
self.tbEnergyEfficiency[characterId] = AdventureModuleHelper.GetPlayerAttributeValue(characterId, GameEnum.playerAttributeType.FRONT_ADD_ENERGY)
|
||||
self.tbEnergyConvRatio[characterId] = AdventureModuleHelper.GetPlayerAttributeValue(characterId, GameEnum.playerAttributeType.ADD_ENERGY)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DepotCharInfoCtrl:RefreshInfo()
|
||||
local mapCfg = ConfigTable.GetData_Character(self.nCharId)
|
||||
local mapChar = self.mapCharData[self.nCharId]
|
||||
if mapChar ~= nil then
|
||||
self._mapNode.rtInfo:Refresh(mapChar, mapCfg)
|
||||
self:RefreshEquipment(mapChar)
|
||||
end
|
||||
end
|
||||
function DepotCharInfoCtrl:RefreshEquipment(mapChar)
|
||||
self.tbEquipment = clone(mapChar.tbEquipment)
|
||||
local tbSlot = PlayerData.Equipment:GetSlotCfgWithIndex()
|
||||
for i, v in ipairs(tbSlot) do
|
||||
local mapEquipment = mapChar.tbEquipmentSlot[v.nSlotId]
|
||||
local bEmpty = mapEquipment == nil
|
||||
self._mapNode.imgEquipment[i].gameObject:SetActive(not bEmpty)
|
||||
self._mapNode.goEquipment[i].gameObject:SetActive(bEmpty)
|
||||
if bEmpty then
|
||||
if mapChar.nLevel < v.nLevel then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtEquipmentLock[i], orderedFormat(ConfigTable.GetUIText("Equipment_SlotActiveLevel"), v.nLevel))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtEquipmentLock[i], ConfigTable.GetUIText("CharEquipment_UnEquip"))
|
||||
end
|
||||
else
|
||||
self:SetPngSprite(self._mapNode.imgEquipment[i], mapEquipment.sIcon)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DepotCharInfoCtrl:Clear()
|
||||
end
|
||||
function DepotCharInfoCtrl:Awake()
|
||||
self.nCharId = nil
|
||||
self.nSelectIndex = nil
|
||||
end
|
||||
function DepotCharInfoCtrl:OnEnable()
|
||||
end
|
||||
function DepotCharInfoCtrl:OnDisable()
|
||||
end
|
||||
function DepotCharInfoCtrl:OnDestroy()
|
||||
end
|
||||
function DepotCharInfoCtrl:OnBtnClick_Char(btn, nIndex)
|
||||
if nIndex == self.nSelectIndex then
|
||||
return
|
||||
end
|
||||
self._mapNode.goSelect[self.nSelectIndex]:SetActive(false)
|
||||
self._mapNode.goSelect[nIndex]:SetActive(true)
|
||||
self.nCharId = self.tbTeam[nIndex]
|
||||
self.nSelectIndex = nIndex
|
||||
self:SwitchChar()
|
||||
end
|
||||
function DepotCharInfoCtrl:OnBtnClick_Skill(btn)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PopupSkillPanel, self.tbTeam, false, {}, self.mapCharData, self.nCharId)
|
||||
end
|
||||
function DepotCharInfoCtrl:OnBtnClick_Detail()
|
||||
local HealthInfo = self.tbActorHealthInfo[self.nCharId]
|
||||
local Info = self.tbActorInfo[self.nCharId]
|
||||
local ElementInfo = self.tbElementInfo[self.nCharId]
|
||||
local SkillCd = self.tbSkillCd[self.nCharId]
|
||||
local EnergyEfficiency = self.tbEnergyEfficiency[self.nCharId]
|
||||
local EnergyConvRatio = self.tbEnergyConvRatio[self.nCharId]
|
||||
local attrList = self.attrData:GetAttrList()
|
||||
for k, v in pairs(AllEnum.CharAttr) do
|
||||
local total, base
|
||||
if v.sKey == "Hp" then
|
||||
total = HealthInfo ~= nil and HealthInfo.hpMax:AsInt() or 0
|
||||
elseif v.sKey == "Atk" then
|
||||
total = Info ~= nil and Info.atk:AsInt() or 0
|
||||
elseif v.sKey == "Def" then
|
||||
total = Info ~= nil and Info.def:AsInt() or 0
|
||||
elseif v.sKey == "CritRate" then
|
||||
total = Info ~= nil and Info.critRate:AsFloat() or 0
|
||||
total = total * 100
|
||||
elseif v.sKey == "CritPower" then
|
||||
total = Info ~= nil and Info.critPower:AsFloat() or 0
|
||||
total = total * 100
|
||||
elseif v.sKey == "Suppress" then
|
||||
total = Info ~= nil and Info.suppressRatio:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "UltraEnergy" then
|
||||
total = SkillCd and SkillCd:GetTotalEnergy() or 0
|
||||
base = total
|
||||
elseif v.sKey == "EnergyEfficiency" then
|
||||
total = EnergyEfficiency
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "EnergyConvRatio" then
|
||||
total = EnergyConvRatio
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "DefPierce" then
|
||||
total = Info ~= nil and Info.defPenetrate:AsInt() or 0
|
||||
base = total
|
||||
elseif v.sKey == "DefIgnore" then
|
||||
total = Info ~= nil and Info.defIgnore:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "WEE" then
|
||||
total = ElementInfo ~= nil and ElementInfo.WEE:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "WEP" then
|
||||
total = ElementInfo ~= nil and ElementInfo.WEP:AsInt() or 0
|
||||
base = total
|
||||
elseif v.sKey == "WEI" then
|
||||
total = ElementInfo ~= nil and ElementInfo.WEI:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "FEE" then
|
||||
total = ElementInfo ~= nil and ElementInfo.FEE:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "FEP" then
|
||||
total = ElementInfo ~= nil and ElementInfo.FEP:AsInt() or 0
|
||||
base = total
|
||||
elseif v.sKey == "FEI" then
|
||||
total = ElementInfo ~= nil and ElementInfo.FEI:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "SEE" then
|
||||
total = ElementInfo ~= nil and ElementInfo.SEE:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "SEP" then
|
||||
total = ElementInfo ~= nil and ElementInfo.SEP:AsInt() or 0
|
||||
base = total
|
||||
elseif v.sKey == "SEI" then
|
||||
total = ElementInfo ~= nil and ElementInfo.SEI:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "AEE" then
|
||||
total = ElementInfo ~= nil and ElementInfo.AEE:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "AEP" then
|
||||
total = ElementInfo ~= nil and ElementInfo.AEP:AsInt() or 0
|
||||
base = total
|
||||
elseif v.sKey == "AEI" then
|
||||
total = ElementInfo ~= nil and ElementInfo.AEI:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "LEE" then
|
||||
total = ElementInfo ~= nil and ElementInfo.LEE:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "LEP" then
|
||||
total = ElementInfo ~= nil and ElementInfo.LEP:AsInt() or 0
|
||||
base = total
|
||||
elseif v.sKey == "LEI" then
|
||||
total = ElementInfo ~= nil and ElementInfo.LEI:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "DEE" then
|
||||
total = ElementInfo ~= nil and ElementInfo.DEE:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
elseif v.sKey == "DEP" then
|
||||
total = ElementInfo ~= nil and ElementInfo.DEP:AsInt() or 0
|
||||
base = total
|
||||
elseif v.sKey == "DEI" then
|
||||
total = ElementInfo ~= nil and ElementInfo.DEI:AsFloat() or 0
|
||||
total = total * 100
|
||||
base = total
|
||||
end
|
||||
if total then
|
||||
attrList[k].totalValue = total
|
||||
end
|
||||
if base then
|
||||
attrList[k].baseValue = base
|
||||
end
|
||||
end
|
||||
local mapCfg = ConfigTable.GetData_Character(self.nCharId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharAttrDetail, attrList, mapCfg.EET)
|
||||
end
|
||||
function DepotCharInfoCtrl:OnBtnClick_Equipment(btn)
|
||||
if next(self.tbEquipment) == nil then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_CharEquipNone"))
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.EquipmentAttrPreview, self.nCharId, self.tbEquipment)
|
||||
end
|
||||
end
|
||||
return DepotCharInfoCtrl
|
||||
@@ -0,0 +1,88 @@
|
||||
local DepotDiscCommonSkillCtrl = class("DepotDiscCommonSkillCtrl", BaseCtrl)
|
||||
DepotDiscCommonSkillCtrl._mapNodeConfig = {
|
||||
txtSkillName = {sComponentName = "TMP_Text"},
|
||||
imgSkillIcon = {sComponentName = "Image"},
|
||||
imgSkillIconBg = {sComponentName = "Image"},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
btnPrevLevel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Prev"
|
||||
},
|
||||
btnNextLevel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Next"
|
||||
},
|
||||
imgPrevOn = {},
|
||||
imgPrevOff = {},
|
||||
imgNextOn = {},
|
||||
imgNextOff = {},
|
||||
goNote = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateDiscMultiNoteCtrl"
|
||||
},
|
||||
txtSkillDesc = {sComponentName = "TMP_Text"},
|
||||
txtNoteTip = {sComponentName = "TMP_Text"},
|
||||
TMP_Link = {
|
||||
sNodeName = "txtSkillDesc",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnLinkClick_Word"
|
||||
}
|
||||
}
|
||||
DepotDiscCommonSkillCtrl._mapEventConfig = {}
|
||||
function DepotDiscCommonSkillCtrl:Refresh(nId, nLayer)
|
||||
self.mapCfg = ConfigTable.GetData("DiscCommonSkill", nId)
|
||||
if not self.mapCfg then
|
||||
return
|
||||
end
|
||||
self.nLayer = 1
|
||||
if nLayer then
|
||||
self.nLayer = nLayer
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgSkillIcon, self.mapCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
self:SetPngSprite(self._mapNode.imgSkillIconBg, self.mapCfg.IconBg .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSkillName, self.mapCfg.Name)
|
||||
self.nMaxLayer = #self.mapCfg.ActiveNoteNum
|
||||
self:RefreshSkill()
|
||||
end
|
||||
function DepotDiscCommonSkillCtrl:RefreshSkill()
|
||||
local sDesc = UTILS.ParseDiscDesc(self.mapCfg.Desc, self.mapCfg, nil, self.nLayer)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSkillDesc, sDesc)
|
||||
self._mapNode.goNote:SetNoteItem(self.mapCfg.ActiveNoteType, self.mapCfg.ActiveNoteNum[self.nLayer])
|
||||
local bMulti = #self.mapCfg.ActiveNoteType > 1
|
||||
if bMulti then
|
||||
local mapNote1 = ConfigTable.GetData("Note", self.mapCfg.ActiveNoteType[1])
|
||||
local mapNote2 = ConfigTable.GetData("Note", self.mapCfg.ActiveNoteType[2])
|
||||
if not mapNote1 or not mapNote2 then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNoteTip, orderedFormat(ConfigTable.GetUIText("Disc_CommonSkill_MultiNoteTip"), mapNote1.Name1, mapNote2.Name1))
|
||||
else
|
||||
local mapNote1 = ConfigTable.GetData("Note", self.mapCfg.ActiveNoteType[1])
|
||||
if not mapNote1 then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNoteTip, orderedFormat(ConfigTable.GetUIText("Disc_CommonSkill_NoteTip"), mapNote1.Name1))
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, orderedFormat(ConfigTable.GetUIText("Disc_CommonSkill_Level"), self.nLayer))
|
||||
self._mapNode.imgPrevOn:SetActive(self.nLayer > 1)
|
||||
self._mapNode.imgPrevOff:SetActive(self.nLayer == 1)
|
||||
self._mapNode.imgNextOn:SetActive(self.nLayer < self.nMaxLayer)
|
||||
self._mapNode.imgNextOff:SetActive(self.nLayer == self.nMaxLayer)
|
||||
end
|
||||
function DepotDiscCommonSkillCtrl:OnBtnClick_Prev()
|
||||
if self.nLayer == 1 then
|
||||
return
|
||||
end
|
||||
self.nLayer = self.nLayer - 1
|
||||
self:RefreshSkill()
|
||||
end
|
||||
function DepotDiscCommonSkillCtrl:OnBtnClick_Next()
|
||||
if self.nLayer == self.nMaxLayer then
|
||||
return
|
||||
end
|
||||
self.nLayer = self.nLayer + 1
|
||||
self:RefreshSkill()
|
||||
end
|
||||
function DepotDiscCommonSkillCtrl:OnLinkClick_Word(link, sWordId)
|
||||
UTILS.ClickWordLink(link, sWordId)
|
||||
end
|
||||
return DepotDiscCommonSkillCtrl
|
||||
@@ -0,0 +1,49 @@
|
||||
local DepotDiscCoreSkillCtrl = class("DepotDiscCoreSkillCtrl", BaseCtrl)
|
||||
DepotDiscCoreSkillCtrl._mapNodeConfig = {
|
||||
txtSkillName = {sComponentName = "TMP_Text"},
|
||||
imgSkillIcon = {sComponentName = "Image"},
|
||||
imgSkillIconBg = {sComponentName = "Image"},
|
||||
NoteLayer = {
|
||||
nCount = 5,
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscNoteLayerCtrl"
|
||||
},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
txtNoteTip = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
DepotDiscCoreSkillCtrl._mapEventConfig = {}
|
||||
function DepotDiscCoreSkillCtrl:Refresh(nId)
|
||||
local mapCfg = ConfigTable.GetData("DiscPassiveSkill", nId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgSkillIcon, mapCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
self:SetPngSprite(self._mapNode.imgSkillIconBg, mapCfg.IconBg .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSkillName, mapCfg.Name)
|
||||
local mapNote = ConfigTable.GetData("Note", mapCfg.MainNote)
|
||||
if not mapNote then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNoteTip, orderedFormat(ConfigTable.GetUIText("Disc_CoreSkill_NoteTip"), mapNote.Name2))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, orderedFormat(ConfigTable.GetUIText("Disc_Skill_LevelLong"), mapCfg.Level))
|
||||
for i = 1, 5 do
|
||||
local bHasLayer = mapCfg["ActiveParam" .. i] and mapCfg["ActiveParam" .. i] ~= ""
|
||||
self._mapNode.NoteLayer[i].gameObject:SetActive(bHasLayer)
|
||||
if bHasLayer then
|
||||
local bLastlayer = mapCfg["ActiveParam" .. i + 1] == nil or mapCfg["ActiveParam" .. i + 1] == ""
|
||||
local sDesc = UTILS.ParseDiscDesc(mapCfg["Desc" .. i], mapCfg)
|
||||
local tbLayerNote = decodeJson(mapCfg["ActiveParam" .. i])
|
||||
local tbNoteId = {}
|
||||
local nNoteCount = 0
|
||||
for k, v in pairs(tbLayerNote) do
|
||||
local nNoteId = tonumber(k)
|
||||
local nCount = tonumber(v)
|
||||
if nNoteId then
|
||||
nNoteCount = nNoteCount + nCount
|
||||
table.insert(tbNoteId, nNoteId)
|
||||
end
|
||||
end
|
||||
self._mapNode.NoteLayer[i]:Refresh(tbNoteId, nNoteCount, sDesc, i, bLastlayer, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
return DepotDiscCoreSkillCtrl
|
||||
@@ -0,0 +1,190 @@
|
||||
local DepotDiscInfoCtrl = class("DepotDiscInfoCtrl", BaseCtrl)
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
DepotDiscInfoCtrl._mapNodeConfig = {
|
||||
goBlur = {},
|
||||
btnBlur = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
goWindow = {},
|
||||
animWindow = {sNodeName = "goWindow", sComponentName = "Animator"},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Disc_Info_Title"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
goDiscItem = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateDiscItemCtrl"
|
||||
},
|
||||
txtDiscName = {sComponentName = "TMP_Text"},
|
||||
txtDiscLevel = {sComponentName = "TMP_Text"},
|
||||
goDiscStar = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
|
||||
},
|
||||
txtPropertyTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Disc_Property_Title"
|
||||
},
|
||||
goProperty = {
|
||||
nCount = 2,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplatePropertyCtrl"
|
||||
},
|
||||
imgDiscEET = {sComponentName = "Image"},
|
||||
imgTag = {nCount = 3},
|
||||
txtTag = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
rtTogTab = {
|
||||
sNodeName = "goTab",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateTogTabCtrl"
|
||||
},
|
||||
btnLeft = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_left"
|
||||
},
|
||||
btnRight = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_right"
|
||||
},
|
||||
goPassiveSkill = {
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscCoreSkillCtrl"
|
||||
},
|
||||
goCommonSkill = {
|
||||
nCount = 2,
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscCommonSkillCtrl"
|
||||
},
|
||||
goCommonNone = {nCount = 2},
|
||||
ActionBar = {
|
||||
sCtrlName = "Game.UI.ActionBar.ActionBarCtrl"
|
||||
},
|
||||
btnShortcutClose = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
}
|
||||
}
|
||||
DepotDiscInfoCtrl._mapEventConfig = {}
|
||||
DepotDiscInfoCtrl._mapRedDotConfig = {}
|
||||
local skill_Tab_type = {passive = 1, common = 2}
|
||||
function DepotDiscInfoCtrl:RefreshDiscInfo(discData)
|
||||
self._mapNode.goDiscItem:Refresh(discData.nId)
|
||||
self.mapDisc = discData
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDiscName, self.mapDisc.sName)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDiscLevel, orderedFormat(ConfigTable.GetUIText("StarTower_Disc_Info_Level"), self.mapDisc.nLevel))
|
||||
self._mapNode.goDiscStar:SetStar(self.mapDisc.nStar, self.mapDisc.nMaxStar)
|
||||
self._mapNode.goPassiveSkill:Refresh(self.mapDisc.nPassiveSkillId, false, self.tbNoteList)
|
||||
local tbCommonSkillId = self.mapDisc.tbCommonSkillId
|
||||
for i = 1, 2 do
|
||||
if tbCommonSkillId[i] then
|
||||
self._mapNode.goCommonSkill[i].gameObject:SetActive(true)
|
||||
local nCurLayer
|
||||
local mapCommonCfg = ConfigTable.GetData("DiscCommonSkill", tbCommonSkillId[i])
|
||||
if mapCommonCfg then
|
||||
nCurLayer = discData:GetCommonLayer(self.tbNoteList, mapCommonCfg)
|
||||
end
|
||||
nCurLayer = nCurLayer == 0 and 1 or nCurLayer
|
||||
self._mapNode.goCommonSkill[i]:Refresh(tbCommonSkillId[i], nCurLayer)
|
||||
self._mapNode.goCommonNone[i]:SetActive(false)
|
||||
else
|
||||
self._mapNode.goCommonSkill[i].gameObject:SetActive(false)
|
||||
self._mapNode.goCommonNone[i]:SetActive(true)
|
||||
end
|
||||
end
|
||||
local tbAttr = self.mapDisc.mapAttrBase
|
||||
local i = 1
|
||||
for _, mapAttachAttr in pairs(AllEnum.AttachAttr) do
|
||||
local mapAttr = tbAttr[mapAttachAttr.sKey]
|
||||
if 0 < mapAttr.Value then
|
||||
self._mapNode.goProperty[i]:SetItemProperty(mapAttr.Key, mapAttr.Value, nil, true)
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
local mapCfg = ConfigTable.GetData("Disc", discData.nId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
local sName = AllEnum.ElementIconType.Icon .. mapCfg.EET
|
||||
self:SetAtlasSprite(self._mapNode.imgDiscEET, "12_rare", sName)
|
||||
for j = 1, 3 do
|
||||
local nTag = self.mapDisc.tbTag[j]
|
||||
if nTag then
|
||||
self._mapNode.imgTag[j]:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTag[j], ConfigTable.GetData("DiscTag", nTag).Title)
|
||||
else
|
||||
self._mapNode.imgTag[j]:SetActive(false)
|
||||
end
|
||||
end
|
||||
self:SwitchTog()
|
||||
end
|
||||
function DepotDiscInfoCtrl:SwitchTog()
|
||||
self._mapNode.rtTogTab:SetState(self.nSkillType == skill_Tab_type.common)
|
||||
if self.nSkillType == skill_Tab_type.passive then
|
||||
for i = 1, 2 do
|
||||
self._mapNode.goCommonSkill[i].gameObject:SetActive(false)
|
||||
self._mapNode.goCommonNone[i]:SetActive(false)
|
||||
end
|
||||
self._mapNode.goPassiveSkill.gameObject:SetActive(self.mapDisc.nPassiveSkillId)
|
||||
else
|
||||
self._mapNode.goPassiveSkill.gameObject:SetActive(false)
|
||||
local tbCommonSkillId = self.mapDisc.tbCommonSkillId
|
||||
for i = 1, 2 do
|
||||
self._mapNode.goCommonSkill[i].gameObject:SetActive(tbCommonSkillId[i])
|
||||
self._mapNode.goCommonNone[i]:SetActive(not tbCommonSkillId[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
function DepotDiscInfoCtrl:OpenDiscInfo(discData, tbNoteList)
|
||||
if GamepadUIManager.GetInputState() then
|
||||
GamepadUIManager.EnableGamepadUI("DepotDiscInfoCtrl", self:GetGamepadUINode(), nil, true)
|
||||
end
|
||||
self.tbNoteList = tbNoteList
|
||||
self.nSkillType = skill_Tab_type.passive
|
||||
self._mapNode.goWindow.gameObject:SetActive(false)
|
||||
self._mapNode.goBlur.gameObject:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.goWindow.gameObject:SetActive(true)
|
||||
self._mapNode.animWindow:Play("t_window_04_t_in")
|
||||
self:RefreshDiscInfo(discData)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function DepotDiscInfoCtrl:Awake()
|
||||
self._mapNode.goBlur.gameObject:SetActive(false)
|
||||
self._mapNode.goWindow.gameObject:SetActive(false)
|
||||
self._mapNode.rtTogTab:SetText(ConfigTable.GetUIText("StarTower_Disc_Common_Skill"), ConfigTable.GetUIText("StarTower_Disc_Passive_Skill"))
|
||||
self._mapNode.btnShortcutClose.gameObject:SetActive(GamepadUIManager.GetInputState())
|
||||
if GamepadUIManager.GetInputState() then
|
||||
local tbConfig = {
|
||||
{
|
||||
sAction = "Back",
|
||||
sLang = "ActionBar_Back"
|
||||
}
|
||||
}
|
||||
self._mapNode.ActionBar:InitActionBar(tbConfig)
|
||||
end
|
||||
end
|
||||
function DepotDiscInfoCtrl:OnBtnClick_left()
|
||||
self.nSkillType = skill_Tab_type.passive
|
||||
self:SwitchTog()
|
||||
end
|
||||
function DepotDiscInfoCtrl:OnBtnClick_right()
|
||||
self.nSkillType = skill_Tab_type.common
|
||||
self:SwitchTog()
|
||||
end
|
||||
function DepotDiscInfoCtrl:OnBtnClick_Close()
|
||||
self._mapNode.goBlur.gameObject:SetActive(false)
|
||||
local nAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.animWindow, {
|
||||
"t_window_04_t_out"
|
||||
})
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
self._mapNode.animWindow:Play("t_window_04_t_out")
|
||||
self:AddTimer(1, nAnimTime, function()
|
||||
self._mapNode.goWindow.gameObject:SetActive(false)
|
||||
if GamepadUIManager.GetInputState() then
|
||||
GamepadUIManager.DisableGamepadUI("DepotDiscInfoCtrl")
|
||||
end
|
||||
end, true, true, true)
|
||||
end
|
||||
return DepotDiscInfoCtrl
|
||||
@@ -0,0 +1,38 @@
|
||||
local DepotDiscMainSkillItemCtrl = class("DepotDiscMainSkillItemCtrl", BaseCtrl)
|
||||
DepotDiscMainSkillItemCtrl._mapNodeConfig = {
|
||||
btnItem = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Item"
|
||||
},
|
||||
imgRareBg = {sComponentName = "Image"},
|
||||
imgIconBg = {sComponentName = "Image"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
goStar = {sComponentName = "Image"},
|
||||
txtDiscSkillName = {sComponentName = "TMP_Text"},
|
||||
imgChoose = {}
|
||||
}
|
||||
DepotDiscMainSkillItemCtrl._mapEventConfig = {
|
||||
SelectDepotDiscSkill = "OnEvent_SelectDepotDiscSkill"
|
||||
}
|
||||
DepotDiscMainSkillItemCtrl._mapRedDotConfig = {}
|
||||
function DepotDiscMainSkillItemCtrl:Refresh(nSkillId, nRarity, nDiscId, nStar)
|
||||
self.nSkillId = nSkillId
|
||||
self.nDiscId = nDiscId
|
||||
local mainSkillCfg = ConfigTable.GetData("MainSkill", nSkillId)
|
||||
if mainSkillCfg == nil then
|
||||
return
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgIconBg, mainSkillCfg.IconBg)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mainSkillCfg.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDiscSkillName, mainSkillCfg.Name)
|
||||
self:SetAtlasSprite(self._mapNode.imgRareBg, "12_rare", AllEnum.FrameType_New.HarmonySkillS .. AllEnum.FrameColor_New[nRarity])
|
||||
self:SetAtlasSprite(self._mapNode.goStar, "12_rare", AllEnum.FrameType_New.DiscLimitS .. AllEnum.FrameColor_New[nRarity] .. "_0" .. nStar + 1)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.goStar)
|
||||
end
|
||||
function DepotDiscMainSkillItemCtrl:OnBtnClick_Item()
|
||||
EventManager.Hit("SelectDepotDiscSkill", self.nDiscId, self.nSkillId)
|
||||
end
|
||||
function DepotDiscMainSkillItemCtrl:OnEvent_SelectDepotDiscSkill(nDiscId, nMainSkillId, nSubSkillId, _)
|
||||
self._mapNode.imgChoose:SetActive(self.nSkillId and self.nSkillId == nMainSkillId)
|
||||
end
|
||||
return DepotDiscMainSkillItemCtrl
|
||||
@@ -0,0 +1,40 @@
|
||||
local DepotDiscNoteLayerCtrl = class("DepotDiscNoteLayerCtrl", BaseCtrl)
|
||||
DepotDiscNoteLayerCtrl._mapNodeConfig = {
|
||||
imgLine = {},
|
||||
goNote = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateDiscMultiNoteCtrl"
|
||||
},
|
||||
txtLayerDesc = {sComponentName = "TMP_Text"},
|
||||
txtLayerName = {sComponentName = "TMP_Text"},
|
||||
TMP_Link = {
|
||||
sNodeName = "txtLayerDesc",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnLinkClick_Word"
|
||||
},
|
||||
canvasGroupBg = {
|
||||
sNodeName = "imgBg",
|
||||
sComponentName = "CanvasGroup"
|
||||
}
|
||||
}
|
||||
DepotDiscNoteLayerCtrl._mapEventConfig = {}
|
||||
function DepotDiscNoteLayerCtrl:Refresh(tbNoteId, nNoteCount, sDesc, nLayer, bLast, bUnLock)
|
||||
self._mapNode.goNote:SetNoteItem(tbNoteId, nNoteCount, not bUnLock)
|
||||
sDesc = sDesc or ""
|
||||
if bUnLock then
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroupBg, 1)
|
||||
else
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroupBg, 0.4)
|
||||
sDesc = sDesc .. ConfigTable.GetUIText("StarTower_Disc_Skill_Lock")
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLayerDesc, sDesc)
|
||||
local sLayer = ConfigTable.GetUIText("Disc_CoreSkill_Base")
|
||||
if 1 < nLayer then
|
||||
sLayer = orderedFormat(ConfigTable.GetUIText("Disc_CoreSkill_Expand"), nLayer - 1)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLayerName, sLayer)
|
||||
self._mapNode.imgLine:SetActive(not bLast)
|
||||
end
|
||||
function DepotDiscNoteLayerCtrl:OnLinkClick_Word(link, sWordId)
|
||||
UTILS.ClickWordLink(link, sWordId)
|
||||
end
|
||||
return DepotDiscNoteLayerCtrl
|
||||
@@ -0,0 +1,153 @@
|
||||
local DepotDiscSkillCtrl = class("DepotDiscSkillCtrl", BaseCtrl)
|
||||
DepotDiscSkillCtrl._mapNodeConfig = {
|
||||
imgNote = {nCount = 9, sComponentName = "Image"},
|
||||
txtNoteCount = {nCount = 9, sComponentName = "TMP_Text"},
|
||||
btnNoteDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_NoteDetail"
|
||||
},
|
||||
goNoteListBtn = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_NoteDetail"
|
||||
},
|
||||
btnDiscDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_DiscDetail"
|
||||
},
|
||||
txtDiscDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Depot_DiscSkillInfo"
|
||||
},
|
||||
txtMainSkillTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_MainSkill_Title"
|
||||
},
|
||||
txtMainSubSkillTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_MainSkill_TitleTip"
|
||||
},
|
||||
txtHarmonySkillTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_SubSkill_Title"
|
||||
},
|
||||
txtHarmonySkillSubTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_SubSkill_TitleTip"
|
||||
},
|
||||
DiscSkillDepotItem = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscMainSkillItemCtrl"
|
||||
},
|
||||
goDiscSkillItem = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateDiscSkillCardCtrl"
|
||||
},
|
||||
goHarmonyGrid = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
HarmonySkillDepotItem = {},
|
||||
svDiscSkill = {sComponentName = "ScrollRect"}
|
||||
}
|
||||
DepotDiscSkillCtrl._mapEventConfig = {
|
||||
SelectDepotDiscSkill = "OnEvent_SelectDepotDiscSkill"
|
||||
}
|
||||
function DepotDiscSkillCtrl:RefreshDiscSkill(mapNote, tbActiveSecondaryIds)
|
||||
local tbDisc = {}
|
||||
local tbSkillIds = {}
|
||||
self.tbMapNote = mapNote
|
||||
if nil == self._panel.tbDisc then
|
||||
return
|
||||
end
|
||||
for i = 1, 9 do
|
||||
self._mapNode.imgNote[i].gameObject:SetActive(false)
|
||||
end
|
||||
for nIdx, nNoteId in ipairs(self._panel.tbShowNote) do
|
||||
if nIdx <= #self._mapNode.imgNote then
|
||||
self._mapNode.imgNote[nIdx].gameObject:SetActive(true)
|
||||
local nNoteId = tonumber(nNoteId)
|
||||
local nNoteCount = mapNote[nNoteId] == nil and 0 or mapNote[nNoteId]
|
||||
local noteCfg = ConfigTable.GetData("SubNoteSkill", nNoteId)
|
||||
self:SetPngSprite(self._mapNode.imgNote[nIdx], noteCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNoteCount[nIdx], nNoteCount)
|
||||
end
|
||||
end
|
||||
local nSubSkillCount = 0
|
||||
local nSortingOrder = self._panel._nIndex * 100 + 99
|
||||
for j = 1, 3 do
|
||||
local nDiscId = self._panel.tbDisc[j]
|
||||
local discData = self._panel.mapDiscData[nDiscId]
|
||||
table.insert(tbDisc, nDiscId)
|
||||
if discData ~= nil then
|
||||
table.insert(tbSkillIds, discData.nMainSkillId)
|
||||
self._mapNode.DiscSkillDepotItem[j]:Refresh(discData.nMainSkillId, discData.nRarity, nDiscId, discData.nStar)
|
||||
local tbSubSkill = discData:GetAllSubSkill(mapNote)
|
||||
for i = nSubSkillCount + 1, nSubSkillCount + #tbSubSkill do
|
||||
local nSkillId = tbSubSkill[i - nSubSkillCount]
|
||||
if nil == self.tbHarmonySkillDepotItemCtrl[i] then
|
||||
local itemObj = instantiate(self._mapNode.HarmonySkillDepotItem, self._mapNode.goHarmonyGrid)
|
||||
itemObj.gameObject:SetActive(true)
|
||||
local itemCtrl = self:BindCtrlByNode(itemObj, "Game.UI.StarTower.Depot.DepotDiscSubSkillItemCtrl")
|
||||
table.insert(self.tbHarmonySkillDepotItemCtrl, itemCtrl)
|
||||
end
|
||||
if nSkillId ~= nil then
|
||||
local mapCfg = ConfigTable.GetData("SecondarySkill", nSkillId)
|
||||
if mapCfg ~= nil and nil ~= self.tbHarmonySkillDepotItemCtrl[i] then
|
||||
self.tbHarmonySkillDepotItemCtrl[i]:SetItem(nSkillId, nDiscId, mapNote, nSortingOrder)
|
||||
elseif nil ~= self.tbHarmonySkillDepotItemCtrl[i] then
|
||||
self.tbHarmonySkillDepotItemCtrl[i]:SetItem(nil)
|
||||
end
|
||||
elseif nil ~= self.tbHarmonySkillDepotItemCtrl[i] then
|
||||
self.tbHarmonySkillDepotItemCtrl[i]:SetItem(nil)
|
||||
end
|
||||
end
|
||||
nSubSkillCount = nSubSkillCount + #tbSubSkill
|
||||
end
|
||||
end
|
||||
if nSubSkillCount < 6 then
|
||||
for i = nSubSkillCount + 1, 6 do
|
||||
if nil == self.tbHarmonySkillDepotItemCtrl[i] then
|
||||
local itemObj = instantiate(self._mapNode.HarmonySkillDepotItem, self._mapNode.goHarmonyGrid)
|
||||
itemObj.gameObject:SetActive(true)
|
||||
local itemCtrl = self:BindCtrlByNode(itemObj, "Game.UI.StarTower.Depot.DepotDiscSubSkillItemCtrl")
|
||||
table.insert(self.tbHarmonySkillDepotItemCtrl, itemCtrl)
|
||||
end
|
||||
self.tbHarmonySkillDepotItemCtrl[i]:SetItem(nil)
|
||||
end
|
||||
end
|
||||
NovaAPI.SetScrollRectVertical(self._mapNode.svDiscSkill, #self.tbHarmonySkillDepotItemCtrl > 6)
|
||||
if PlayerData.Guide:GetGuideState() then
|
||||
EventManager.Hit("Guide_StarTowerDepotDisc", 0 < nSubSkillCount)
|
||||
end
|
||||
if 0 < #tbDisc and 0 < #tbSkillIds then
|
||||
EventManager.Hit("SelectDepotDiscSkill", tbDisc[1], tbSkillIds[1], nil, false)
|
||||
end
|
||||
end
|
||||
function DepotDiscSkillCtrl:Awake()
|
||||
self.tbHarmonySkillDepotItemCtrl = {}
|
||||
end
|
||||
function DepotDiscSkillCtrl:OnEnable()
|
||||
end
|
||||
function DepotDiscSkillCtrl:OnDisable()
|
||||
for i, v in pairs(self.tbHarmonySkillDepotItemCtrl) do
|
||||
self:UnbindCtrlByNode(v)
|
||||
self.tbHarmonySkillDepotItemCtrl[i] = nil
|
||||
end
|
||||
self.tbHarmonySkillDepotItemCtrl = {}
|
||||
end
|
||||
function DepotDiscSkillCtrl:OnDestroy()
|
||||
end
|
||||
function DepotDiscSkillCtrl:OnRelease()
|
||||
end
|
||||
function DepotDiscSkillCtrl:Clear()
|
||||
end
|
||||
function DepotDiscSkillCtrl:OnBtnClick_NoteDetail()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.NoteSkillInfo, self.tbMapNote)
|
||||
end
|
||||
function DepotDiscSkillCtrl:OnEvent_SelectDepotDiscSkill(nDiscId, nMainSkillId, nSubSkillId)
|
||||
local discData = self._panel.mapDiscData[nDiscId]
|
||||
self._mapNode.goDiscSkillItem:Refresh(nDiscId, nMainSkillId, nSubSkillId, discData.nStar)
|
||||
self._mapNode.goDiscSkillItem:ChangeWordRaycast(true)
|
||||
end
|
||||
function DepotDiscSkillCtrl:OnBtnClick_DiscDetail()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSkill, self._panel.tbDisc, self.tbMapNote, self._panel.mapDiscData)
|
||||
end
|
||||
return DepotDiscSkillCtrl
|
||||
@@ -0,0 +1,120 @@
|
||||
local DepotDiscSkillInfoCtrl = class("DepotDiscSkillInfoCtrl", BaseCtrl)
|
||||
DepotDiscSkillInfoCtrl._mapNodeConfig = {
|
||||
canvasGroupInfo = {
|
||||
sNodeName = "goInfo",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
txtLevelMax = {sComponentName = "TMP_Text"},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
NoteLayer = {
|
||||
nCount = 5,
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscNoteLayerCtrl"
|
||||
},
|
||||
CommonSkill = {
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscNoteLayerCtrl"
|
||||
},
|
||||
svLevel = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
imgLock = {}
|
||||
}
|
||||
DepotDiscSkillInfoCtrl._mapEventConfig = {}
|
||||
DepotDiscSkillInfoCtrl._mapRedDotConfig = {}
|
||||
function DepotDiscSkillInfoCtrl:InitNoteSkill(tbSkill)
|
||||
if tbSkill.nType == AllEnum.DiscSkillType.Common then
|
||||
self:InitCommonSkill(tbSkill)
|
||||
else
|
||||
self:InitPassiveSkill(tbSkill)
|
||||
end
|
||||
end
|
||||
function DepotDiscSkillInfoCtrl:InitCommonSkill(mapSkill)
|
||||
self._mapNode.CommonSkill.gameObject:SetActive(true)
|
||||
self._mapNode.txtLevelMax.gameObject:SetActive(false)
|
||||
self._mapNode.txtLevel.gameObject:SetActive(false)
|
||||
for _, v in ipairs(self._mapNode.NoteLayer) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
self.mapCommonCfg = ConfigTable.GetData("DiscCommonSkill", mapSkill.nId)
|
||||
if not self.mapCommonCfg then
|
||||
return
|
||||
end
|
||||
self.nCommonLayer = mapSkill.nLevel
|
||||
local bUnlock = self.nCommonLayer > 0
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, self.mapCommonCfg.Name)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, self.mapCommonCfg.Icon)
|
||||
local nMaxLayer = #self.mapCommonCfg.ActiveNoteNum
|
||||
if 0 < nMaxLayer then
|
||||
self._mapNode.svLevel.gameObject:SetActive(true)
|
||||
self._mapNode.svLevel:Init(nMaxLayer, self, self.OnGridRefresh, self.OnGridBtnClick)
|
||||
self:RefreshCommonSkill()
|
||||
else
|
||||
self._mapNode.svLevel.gameObject:SetActive(false)
|
||||
end
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroupInfo, bUnlock and 1 or 0.35)
|
||||
end
|
||||
function DepotDiscSkillInfoCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local txtNoteLayer = goGrid.transform:Find("btnLevel/AnimRoot/txtNoteLayer"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtNoteLayer, nIndex)
|
||||
end
|
||||
function DepotDiscSkillInfoCtrl:OnGridBtnClick(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
if nIndex == self.nCommonLayer then
|
||||
return
|
||||
end
|
||||
self.nCommonLayer = nIndex
|
||||
self:RefreshCommonSkill()
|
||||
end
|
||||
function DepotDiscSkillInfoCtrl:RefreshCommonSkill()
|
||||
local sDesc = UTILS.ParseDiscDesc(self.mapCommonCfg.Desc, self.mapCommonCfg, nil, self.nCommonLayer)
|
||||
local tbNote = {}
|
||||
for _, v in pairs(self.mapCommonCfg.ActiveNoteType) do
|
||||
tbNote[v] = self.mapCommonCfg.ActiveNoteNum[self.nCommonLayer]
|
||||
end
|
||||
self._mapNode.CommonSkill:Refresh(nil, tbNote, sDesc, self.nCommonLayer > 0)
|
||||
end
|
||||
function DepotDiscSkillInfoCtrl:InitPassiveSkill(mapSkill)
|
||||
self._mapNode.CommonSkill.gameObject:SetActive(false)
|
||||
local skillCfg = ConfigTable.GetData("DiscPassiveSkill", mapSkill.nId)
|
||||
if not skillCfg then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, skillCfg.Name)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, skillCfg.Icon)
|
||||
local nCurActiveLayer = mapSkill.nLevel
|
||||
local nMaxLayer = 0
|
||||
for i = 1, 5 do
|
||||
local bHasLayer = skillCfg["ActiveParam" .. i] and skillCfg["ActiveParam" .. i] ~= ""
|
||||
self._mapNode.NoteLayer[i].gameObject:SetActive(bHasLayer)
|
||||
if bHasLayer then
|
||||
if nMaxLayer == 0 then
|
||||
local bLastlayer = skillCfg["ActiveParam" .. i + 1] == nil or skillCfg["ActiveParam" .. i + 1] == ""
|
||||
if bLastlayer then
|
||||
nMaxLayer = i
|
||||
end
|
||||
end
|
||||
local sDesc = UTILS.ParseDiscDesc(skillCfg["Desc" .. i], skillCfg)
|
||||
local tbLayerNote = decodeJson(skillCfg["ActiveParam" .. i])
|
||||
local tbNote = {}
|
||||
for k, v in pairs(tbLayerNote) do
|
||||
local nNoteId = tonumber(k)
|
||||
local nNoteCount = tonumber(v)
|
||||
if nNoteId then
|
||||
tbNote[nNoteId] = nNoteCount
|
||||
end
|
||||
end
|
||||
self._mapNode.NoteLayer[i]:Refresh(i, tbNote, sDesc, i <= nCurActiveLayer)
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Skill_Lv"), nCurActiveLayer, nMaxLayer))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelMax, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Skill_MaxLv"), nCurActiveLayer, nMaxLayer))
|
||||
local bUnlock = 0 < nCurActiveLayer
|
||||
local bMaxLv = nCurActiveLayer == nMaxLayer
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroupInfo, bUnlock and 1 or 0.4)
|
||||
self._mapNode.imgLock.gameObject:SetActive(not bUnlock)
|
||||
self._mapNode.txtLevelMax.gameObject:SetActive(bMaxLv)
|
||||
self._mapNode.txtLevel.gameObject:SetActive(not bMaxLv)
|
||||
end
|
||||
return DepotDiscSkillInfoCtrl
|
||||
@@ -0,0 +1,137 @@
|
||||
local DepotDiscSkillItemCtrl = class("DepotDiscSkillItemCtrl", BaseCtrl)
|
||||
DepotDiscSkillItemCtrl._mapNodeConfig = {
|
||||
imgNone = {},
|
||||
goInfo = {},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgIconBg = {sComponentName = "Image"},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
txtLevelMax = {sComponentName = "TMP_Text"},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
goNote = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateDiscMultiNoteCtrl"
|
||||
},
|
||||
imgLock = {},
|
||||
imgChoose = {}
|
||||
}
|
||||
DepotDiscSkillItemCtrl._mapEventConfig = {}
|
||||
DepotDiscSkillItemCtrl._mapRedDotConfig = {}
|
||||
function DepotDiscSkillItemCtrl:SetNone()
|
||||
self._mapNode.imgNone:SetActive(true)
|
||||
self._mapNode.goInfo:SetActive(false)
|
||||
end
|
||||
function DepotDiscSkillItemCtrl:SetSkillInfo(skillCfg)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, skillCfg.Name)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, skillCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
self:SetPngSprite(self._mapNode.imgIconBg, skillCfg.IconBg .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
end
|
||||
function DepotDiscSkillItemCtrl:InitDiscSkill(mapSkill)
|
||||
self._mapNode.imgNone:SetActive(false)
|
||||
self._mapNode.goInfo:SetActive(true)
|
||||
if mapSkill.nType == AllEnum.DiscSkillType.Common then
|
||||
self:InitDiscCommonSkill(mapSkill)
|
||||
else
|
||||
self:InitDiscPassiveSkill(mapSkill)
|
||||
end
|
||||
end
|
||||
function DepotDiscSkillItemCtrl:InitDiscCommonSkill(mapSkill)
|
||||
self._mapNode.imgChoose.gameObject:SetActive(false)
|
||||
local skillCfg = ConfigTable.GetData("DiscCommonSkill", mapSkill.nId)
|
||||
if skillCfg == nil then
|
||||
return
|
||||
end
|
||||
self:SetSkillInfo(skillCfg)
|
||||
local nLevel = mapSkill.nLevel
|
||||
local nMaxLevel = mapSkill.nMaxLevel
|
||||
local bMaxLv = nMaxLevel == nLevel
|
||||
self._mapNode.txtLevelMax.gameObject:SetActive(bMaxLv)
|
||||
self._mapNode.txtLevel.gameObject:SetActive(not bMaxLv)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Skill_Lv"), nLevel, nMaxLevel))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelMax, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Skill_MaxLv"), nLevel, nMaxLevel))
|
||||
local bUnlock = mapSkill.nLevel > 0
|
||||
self._mapNode.imgLock.gameObject:SetActive(not bUnlock)
|
||||
local nLayer = nLevel == 0 and 1 or nLevel
|
||||
self._mapNode.goNote:SetNoteItem(skillCfg.ActiveNoteType, skillCfg.ActiveNoteNum[nLayer])
|
||||
end
|
||||
function DepotDiscSkillItemCtrl:InitDiscPassiveSkill(mapSkill)
|
||||
self._mapNode.imgChoose.gameObject:SetActive(false)
|
||||
local skillCfg = ConfigTable.GetData("DiscPassiveSkill", mapSkill.nId)
|
||||
if skillCfg == nil then
|
||||
return
|
||||
end
|
||||
self:SetSkillInfo(skillCfg)
|
||||
local nLevel = mapSkill.nLevel
|
||||
local nMaxLevel = mapSkill.nMaxLevel
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Skill_Lv"), nLevel, nMaxLevel))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelMax, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Skill_MaxLv"), nLevel, nMaxLevel))
|
||||
local bUnlock = 0 < nLevel
|
||||
local bMaxLv = nLevel == nMaxLevel
|
||||
self._mapNode.imgLock.gameObject:SetActive(not bUnlock)
|
||||
self._mapNode.txtLevelMax.gameObject:SetActive(bMaxLv)
|
||||
self._mapNode.txtLevel.gameObject:SetActive(not bMaxLv)
|
||||
local nLayer = nLevel == 0 and 1 or nLevel
|
||||
local tbLayerNote = decodeJson(skillCfg["ActiveParam" .. nLayer])
|
||||
local tbNoteId = {}
|
||||
local nNoteCount = 0
|
||||
for k, v in pairs(tbLayerNote) do
|
||||
local nNoteId = tonumber(k)
|
||||
local nCount = tonumber(v)
|
||||
if nNoteId then
|
||||
nNoteCount = nNoteCount + nCount
|
||||
table.insert(tbNoteId, nNoteId)
|
||||
end
|
||||
end
|
||||
self._mapNode.goNote:SetNoteItem(tbNoteId, nNoteCount)
|
||||
end
|
||||
function DepotDiscSkillItemCtrl:SetSelect(bSelect)
|
||||
self._mapNode.imgChoose.gameObject:SetActive(bSelect)
|
||||
end
|
||||
function DepotDiscSkillItemCtrl:InitDiscSkillTips(tbSkill)
|
||||
if tbSkill.nType == AllEnum.DiscSkillType.Common then
|
||||
self:InitDiscCommonSkillTip(tbSkill)
|
||||
else
|
||||
self:InitDiscPassiveSkillTip(tbSkill)
|
||||
end
|
||||
end
|
||||
function DepotDiscSkillItemCtrl:InitDiscCommonSkillTip(tbSkill)
|
||||
local skillCfg = ConfigTable.GetData("DiscCommonSkill", tbSkill.nId)
|
||||
if skillCfg == nil then
|
||||
return
|
||||
end
|
||||
self:SetSkillInfo(skillCfg)
|
||||
local nLevel = tbSkill.nLevel
|
||||
local bMaxLv = tbSkill.nMaxLevel == nLevel
|
||||
self._mapNode.txtLevelMax.gameObject:SetActive(bMaxLv)
|
||||
self._mapNode.txtLevel.gameObject:SetActive(not bMaxLv)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Skill_Lv"), nLevel, tbSkill.nMaxLevel))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelMax, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Skill_MaxLv"), nLevel, tbSkill.nMaxLevel))
|
||||
local nLayer = nLevel == 0 and 1 or nLevel
|
||||
self._mapNode.goNote:SetNoteItem(skillCfg.ActiveNoteType, skillCfg.ActiveNoteNum[nLayer])
|
||||
end
|
||||
function DepotDiscSkillItemCtrl:InitDiscPassiveSkillTip(mapSkill)
|
||||
local skillCfg = ConfigTable.GetData("DiscPassiveSkill", mapSkill.nId)
|
||||
if skillCfg == nil then
|
||||
return
|
||||
end
|
||||
self:SetSkillInfo(skillCfg)
|
||||
local nLevel = mapSkill.nLevel
|
||||
local nMaxLevel = mapSkill.nMaxLevel
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Skill_Lv"), nLevel, nMaxLevel))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelMax, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Skill_MaxLv"), nLevel, nMaxLevel))
|
||||
local bMaxLv = nLevel == nMaxLevel
|
||||
self._mapNode.txtLevelMax.gameObject:SetActive(bMaxLv)
|
||||
self._mapNode.txtLevel.gameObject:SetActive(not bMaxLv)
|
||||
local nLayer = nLevel == 0 and 1 or nLevel
|
||||
local tbLayerNote = decodeJson(skillCfg["ActiveParam" .. nLayer])
|
||||
local tbNoteId = {}
|
||||
local nNoteCount = 0
|
||||
for k, v in pairs(tbLayerNote) do
|
||||
local nNoteId = tonumber(k)
|
||||
local nCount = tonumber(v)
|
||||
if nNoteId then
|
||||
nNoteCount = nNoteCount + nCount
|
||||
table.insert(tbNoteId, nNoteId)
|
||||
end
|
||||
end
|
||||
self._mapNode.goNote:SetNoteItem(tbNoteId, nNoteCount)
|
||||
end
|
||||
return DepotDiscSkillItemCtrl
|
||||
@@ -0,0 +1,109 @@
|
||||
local DepotDiscSubSkillItem = class("DepotDiscSubSkillItem", BaseCtrl)
|
||||
DepotDiscSubSkillItem._mapNodeConfig = {
|
||||
btnItem = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Item"
|
||||
},
|
||||
imgIconBg = {sComponentName = "Image"},
|
||||
imgSkillIcon = {sComponentName = "Image"},
|
||||
txtSkillName = {sComponentName = "TMP_Text"},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
txtActivated = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_DiscSkill_MaxLevel"
|
||||
},
|
||||
imgChoose = {},
|
||||
canvasChoose = {sNodeName = "imgChoose", sComponentName = "Canvas"},
|
||||
goNoteList = {},
|
||||
goNote = {nCount = 3, sComponentName = "Image"},
|
||||
txtHas = {nCount = 3, sComponentName = "TMP_Text"}
|
||||
}
|
||||
DepotDiscSubSkillItem._mapEventConfig = {
|
||||
SelectDepotDiscSkill = "OnEvent_SelectDepotDiscSkill"
|
||||
}
|
||||
function DepotDiscSubSkillItem:SetItem(nSkillId, nDiscId, mapNote, nOrderInLayer)
|
||||
if nSkillId == nil then
|
||||
self._mapNode.btnItem.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
self._mapNode.btnItem.gameObject:SetActive(true)
|
||||
self.nSkillId = nSkillId
|
||||
self.nDiscId = nDiscId
|
||||
local subSkillCfg = ConfigTable.GetData("SecondarySkill", nSkillId)
|
||||
if subSkillCfg == nil then
|
||||
return
|
||||
end
|
||||
local tbGroup = CacheTable.GetData("_SecondarySkill", subSkillCfg.GroupId)
|
||||
local maxLevel = #tbGroup
|
||||
self:SetPngSprite(self._mapNode.imgIconBg, subSkillCfg.IconBg)
|
||||
self:SetPngSprite(self._mapNode.imgSkillIcon, subSkillCfg.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSkillName, subSkillCfg.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, ConfigTable.GetUIText("Skill_Level") .. subSkillCfg.Level)
|
||||
local bAvtive = self:CheckSkillActive(subSkillCfg, mapNote)
|
||||
if not bAvtive then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, ConfigTable.GetUIText("StarTower_Depot_DiscSkill_NotActivated"))
|
||||
end
|
||||
local nNoteIndex = 1
|
||||
local bMax = maxLevel <= subSkillCfg.Level
|
||||
if not bMax then
|
||||
local nNextSkillId = bAvtive and nSkillId + 1 or nSkillId
|
||||
local nextSubSkillCfg = ConfigTable.GetData("SecondarySkill", nNextSkillId)
|
||||
if nextSubSkillCfg == nil then
|
||||
self._mapNode.goNoteList:SetActive(false)
|
||||
self._mapNode.txtActivated.gameObject:SetActive(true)
|
||||
return
|
||||
end
|
||||
local tbActiveNote = decodeJson(nextSubSkillCfg.NeedSubNoteSkills)
|
||||
for k, v in pairs(tbActiveNote) do
|
||||
local nNoteId = tonumber(k)
|
||||
local nNoteMax = tonumber(v)
|
||||
local nNoteHas = mapNote[nNoteId] or 0
|
||||
local noteCfg = ConfigTable.GetData("SubNoteSkill", nNoteId)
|
||||
if noteCfg ~= nil then
|
||||
self._mapNode.goNote[nNoteIndex].gameObject:SetActive(true)
|
||||
self:SetPngSprite(self._mapNode.goNote[nNoteIndex], noteCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
local sHasStr = ""
|
||||
if nNoteMax <= nNoteHas then
|
||||
sHasStr = "<color=#0ABEC5>" .. nNoteHas .. "</color>"
|
||||
else
|
||||
sHasStr = "<color=#5E89B4>" .. nNoteHas .. "</color>"
|
||||
bMax = false
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtHas[nNoteIndex], sHasStr .. "<color=#264278>/" .. nNoteMax .. "</color>")
|
||||
end
|
||||
nNoteIndex = nNoteIndex + 1
|
||||
end
|
||||
end
|
||||
self._mapNode.goNoteList:SetActive(not bMax)
|
||||
self._mapNode.txtActivated.gameObject:SetActive(bMax)
|
||||
if nil ~= nOrderInLayer then
|
||||
NovaAPI.SetCanvasSortingOrder(self._mapNode.canvasChoose, nOrderInLayer)
|
||||
end
|
||||
end
|
||||
function DepotDiscSubSkillItem:CheckSkillActive(subSkillCfg, mapNote)
|
||||
if subSkillCfg.Level == 1 then
|
||||
local tbActiveNote = decodeJson(subSkillCfg.NeedSubNoteSkills)
|
||||
for k, v in pairs(tbActiveNote) do
|
||||
local nNoteId = tonumber(k)
|
||||
local nNoteMax = tonumber(v)
|
||||
local nNoteHas = mapNote[nNoteId] or 0
|
||||
local noteCfg = ConfigTable.GetData("SubNoteSkill", nNoteId)
|
||||
if noteCfg ~= nil and nNoteMax > nNoteHas then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
function DepotDiscSubSkillItem:OnBtnClick_Item()
|
||||
EventManager.Hit("SelectDepotDiscSkill", self.nDiscId, nil, self.nSkillId)
|
||||
end
|
||||
function DepotDiscSubSkillItem:OnEvent_SelectDepotDiscSkill(nDiscId, nMainSkillId, nSubSkillId, _)
|
||||
self._mapNode.imgChoose:SetActive(self.nSkillId == nSubSkillId)
|
||||
end
|
||||
function DepotDiscSubSkillItem:OnEnable()
|
||||
for i, v in ipairs(self._mapNode.goNote) do
|
||||
self._mapNode.goNote[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
return DepotDiscSubSkillItem
|
||||
@@ -0,0 +1,51 @@
|
||||
local DepotFateCardItemCtrl = class("DepotFateCardItemCtrl", BaseCtrl)
|
||||
DepotFateCardItemCtrl._mapNodeConfig = {
|
||||
imgRare = {sComponentName = "Image"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
txtCount = {sComponentName = "TMP_Text"},
|
||||
imgChoose = {},
|
||||
imgUnable = {},
|
||||
txtUnable = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_FateCard_Unable"
|
||||
}
|
||||
}
|
||||
DepotFateCardItemCtrl._mapEventConfig = {}
|
||||
DepotFateCardItemCtrl._mapRedDotConfig = {}
|
||||
function DepotFateCardItemCtrl:InitFateCard(nId, nCount)
|
||||
self.nId = nId
|
||||
local itemCfg = ConfigTable.GetData_Item(nId)
|
||||
if nil == itemCfg then
|
||||
printError(string.format("获取Item表格配置失败!!!id = [%s]", nId))
|
||||
return
|
||||
end
|
||||
local sFrame = AllEnum.FrameType_New.FateCardS .. AllEnum.FrameColor_New[itemCfg.Rarity]
|
||||
self:SetAtlasSprite(self._mapNode.imgRare, "12_rare", sFrame)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, itemCfg.Icon2)
|
||||
self._mapNode.imgUnable.gameObject:SetActive(nCount <= 0)
|
||||
self._mapNode.txtCount.gameObject:SetActive(0 < nCount and nCount < 999)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCount, "")
|
||||
self._mapNode.imgChoose.gameObject:SetActive(false)
|
||||
end
|
||||
function DepotFateCardItemCtrl:SetChoose(bChoose)
|
||||
self._mapNode.imgChoose.gameObject:SetActive(bChoose)
|
||||
end
|
||||
function DepotFateCardItemCtrl:Awake()
|
||||
end
|
||||
function DepotFateCardItemCtrl:FadeIn()
|
||||
end
|
||||
function DepotFateCardItemCtrl:FadeOut()
|
||||
end
|
||||
function DepotFateCardItemCtrl:OnEnable()
|
||||
end
|
||||
function DepotFateCardItemCtrl:OnDisable()
|
||||
end
|
||||
function DepotFateCardItemCtrl:OnDestroy()
|
||||
end
|
||||
function DepotFateCardItemCtrl:OnRelease()
|
||||
end
|
||||
function DepotFateCardItemCtrl:OnBtnClick_AAA()
|
||||
end
|
||||
function DepotFateCardItemCtrl:OnEvent_AAA()
|
||||
end
|
||||
return DepotFateCardItemCtrl
|
||||
@@ -0,0 +1,289 @@
|
||||
local DepotItemListCtrl = class("DepotItemListCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
DepotItemListCtrl._mapNodeConfig = {
|
||||
rtItemListContent = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
goFateCardItem = {},
|
||||
goDepotItem = {},
|
||||
txtFateCard = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot_FateCard_Title"
|
||||
},
|
||||
txtItem = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot_Item_Title"
|
||||
},
|
||||
goItemList = {},
|
||||
FateCardList = {},
|
||||
rtFateCard = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
ItemList = {},
|
||||
rtItem = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
ItemInfo = {
|
||||
sNodeName = "---ItemInfo---"
|
||||
},
|
||||
goItemL = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
txtItemName = {sComponentName = "TMP_Text"},
|
||||
txtCountCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot_Info_QTY"
|
||||
},
|
||||
txtItemCount = {sComponentName = "TMP_Text"},
|
||||
txtDescribeTitle1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot_Info_Desc"
|
||||
},
|
||||
txtItemDesc = {sComponentName = "TMP_Text"},
|
||||
Content = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
FateCardInfo = {
|
||||
sNodeName = "---FateCardInfo---"
|
||||
},
|
||||
goFateCardInfo = {
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotFateCardItemCtrl"
|
||||
},
|
||||
txtFateCardName = {sComponentName = "TMP_Text"},
|
||||
imgEffect = {nCount = 3},
|
||||
txtEffect1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_FateCard_Effect_Count"
|
||||
},
|
||||
txtEffect2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_FateCard_Effect"
|
||||
},
|
||||
txtEffect3 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_FateCard_Unable"
|
||||
},
|
||||
txtEffectCount = {sComponentName = "TMP_Text"},
|
||||
txtDescribeTitle2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Depot_Describe"
|
||||
},
|
||||
txtFateCardDesc = {sComponentName = "TMP_Text"},
|
||||
imgEmpty = {},
|
||||
txt_EmptyTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Item_List_Empty"
|
||||
}
|
||||
}
|
||||
DepotItemListCtrl._mapEventConfig = {}
|
||||
DepotItemListCtrl._mapRedDotConfig = {}
|
||||
local item_type = {FateCard = 1, Item = 2}
|
||||
function DepotItemListCtrl:RefreshItemList(mapFateCard, mapItem, nParam)
|
||||
self._mapNode.ItemInfo.gameObject:SetActive(false)
|
||||
self._mapNode.FateCardInfo.gameObject:SetActive(false)
|
||||
local bFateCard = mapFateCard ~= nil and next(mapFateCard) ~= nil
|
||||
self._mapNode.FateCardList.gameObject:SetActive(bFateCard)
|
||||
if bFateCard then
|
||||
self:RefreshFateCard(mapFateCard)
|
||||
end
|
||||
local bItem = mapItem ~= nil and next(mapItem) ~= nil
|
||||
self._mapNode.ItemList.gameObject:SetActive(bItem)
|
||||
if bItem then
|
||||
self:RefreshItem(mapItem)
|
||||
end
|
||||
self._mapNode.goItemList.gameObject:SetActive(bFateCard or bItem)
|
||||
self._mapNode.imgEmpty.gameObject:SetActive(not bFateCard and not bItem)
|
||||
local nSelectType, nSelectIndex
|
||||
if bFateCard then
|
||||
nSelectType = item_type.FateCard
|
||||
nSelectIndex = 1
|
||||
elseif bItem then
|
||||
nSelectType = item_type.Item
|
||||
nSelectIndex = 1
|
||||
end
|
||||
if nil ~= nParam then
|
||||
local mapItemCfg = ConfigTable.GetData_Item(nParam)
|
||||
if mapItemCfg ~= nil then
|
||||
if mapItemCfg.Stype == GameEnum.itemStype.FateCard then
|
||||
nSelectType = item_type.FateCard
|
||||
for k, v in ipairs(self.mapFateCard) do
|
||||
if v.nTid == nParam then
|
||||
nSelectIndex = k
|
||||
break
|
||||
end
|
||||
end
|
||||
else
|
||||
nSelectType = item_type.Item
|
||||
for k, v in ipairs(self.mapItem) do
|
||||
if v.nTid == nParam then
|
||||
nSelectIndex = k
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if nil ~= nSelectType then
|
||||
self:SelectItem(nSelectType, nSelectIndex)
|
||||
end
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rtItemListContent)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function DepotItemListCtrl:RefreshFateCard(mapFateCard)
|
||||
self.mapFateCard = {}
|
||||
for nId, v in pairs(mapFateCard) do
|
||||
local nCount = math.max(v[1], v[2])
|
||||
nCount = nCount == -1 and 999 or nCount
|
||||
table.insert(self.mapFateCard, {
|
||||
nTid = nId,
|
||||
nCount = nCount,
|
||||
nSort = 0 < nCount and 1 or 0
|
||||
})
|
||||
end
|
||||
table.sort(self.mapFateCard, function(a, b)
|
||||
if a.nSort == b.nSort then
|
||||
if a.nCount == b.nCount then
|
||||
return a.nTid < b.nTid
|
||||
end
|
||||
return a.nCount < b.nCount
|
||||
end
|
||||
return a.nSort > b.nSort
|
||||
end)
|
||||
for _, v in ipairs(self.tbFateCardCtrl) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
for k, v in ipairs(self.mapFateCard) do
|
||||
local itemObj
|
||||
if nil == self.tbFateCardCtrl[k] then
|
||||
itemObj = instantiate(self._mapNode.goFateCardItem, self._mapNode.rtFateCard)
|
||||
itemObj.gameObject:SetActive(true)
|
||||
local itemCtrl = self:BindCtrlByNode(itemObj, "Game.UI.StarTower.Depot.DepotFateCardItemCtrl")
|
||||
itemCtrl:InitFateCard(v.nTid, v.nCount)
|
||||
table.insert(self.tbFateCardCtrl, itemCtrl)
|
||||
else
|
||||
itemObj = self.tbFateCardCtrl[k].gameObject
|
||||
itemObj:SetActive(true)
|
||||
self.tbFateCardCtrl[k]:InitFateCard(v.nTid, v.nCount)
|
||||
end
|
||||
local btnSelect = itemObj.transform:Find("btnItem"):GetComponent("UIButton")
|
||||
btnSelect.onClick:RemoveAllListeners()
|
||||
local func_select = function()
|
||||
self:SelectItem(item_type.FateCard, k)
|
||||
end
|
||||
btnSelect.onClick:AddListener(func_select)
|
||||
end
|
||||
end
|
||||
function DepotItemListCtrl:RefreshItem(mapItem)
|
||||
self.mapItem = {}
|
||||
for nId, v in pairs(mapItem) do
|
||||
local itemCfg = ConfigTable.GetData_Item(nId)
|
||||
if itemCfg ~= nil and itemCfg.Stype ~= GameEnum.itemStype.SubNoteSkill then
|
||||
table.insert(self.mapItem, {nTid = nId, nCount = v})
|
||||
end
|
||||
end
|
||||
for _, v in ipairs(self.tbItemCtrl) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
for k, v in ipairs(self.mapItem) do
|
||||
local itemObj
|
||||
if nil == self.tbItemCtrl[k] then
|
||||
itemObj = instantiate(self._mapNode.goDepotItem, self._mapNode.rtItem)
|
||||
itemObj.gameObject:SetActive(true)
|
||||
local itemCtrl = self:BindCtrlByNode(itemObj, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
itemCtrl:SetItem(v.nTid, nil, v.nCount, nil, nil, nil, nil, true)
|
||||
table.insert(self.tbItemCtrl, itemCtrl)
|
||||
else
|
||||
itemObj = self.tbItemCtrl[k].gameObject
|
||||
itemObj:SetActive(true)
|
||||
self.tbItemCtrl[k]:SetItem(v.nTid, nil, v.nCount, nil, nil, nil, nil, true)
|
||||
end
|
||||
local btnSelect = itemObj.transform:Find("btnItem"):GetComponent("UIButton")
|
||||
btnSelect.onClick:RemoveAllListeners()
|
||||
local func_select = function()
|
||||
self:SelectItem(item_type.Item, k)
|
||||
end
|
||||
btnSelect.onClick:AddListener(func_select)
|
||||
end
|
||||
end
|
||||
function DepotItemListCtrl:SelectItem(nType, nIndex)
|
||||
self._mapNode.ItemInfo.gameObject:SetActive(false)
|
||||
self._mapNode.FateCardInfo.gameObject:SetActive(false)
|
||||
if nil ~= self.nSelectIndex then
|
||||
if self.nSelectType == item_type.FateCard then
|
||||
self.tbFateCardCtrl[self.nSelectIndex]:SetChoose(false)
|
||||
elseif self.nSelectType == item_type.Item then
|
||||
self.tbItemCtrl[self.nSelectIndex]:SetSelect(false)
|
||||
end
|
||||
end
|
||||
self.nSelectType = nType
|
||||
self.nSelectIndex = nIndex
|
||||
if self.nSelectType == item_type.FateCard then
|
||||
self._mapNode.FateCardInfo.gameObject:SetActive(true)
|
||||
self.tbFateCardCtrl[self.nSelectIndex]:SetChoose(true)
|
||||
self:SetFateCardInfo()
|
||||
elseif self.nSelectType == item_type.Item then
|
||||
self._mapNode.ItemInfo.gameObject:SetActive(true)
|
||||
self.tbItemCtrl[self.nSelectIndex]:SetSelect(true)
|
||||
self:SetItemInfo()
|
||||
end
|
||||
end
|
||||
function DepotItemListCtrl:SetItemInfo()
|
||||
local mapSelect = self.mapItem[self.nSelectIndex]
|
||||
local mapCfg = ConfigTable.GetData_Item(mapSelect.nTid)
|
||||
self._mapNode.goItemL:SetItem(mapSelect.nTid)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemCount, mapSelect.nCount)
|
||||
if mapCfg ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemName, mapCfg.Title)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemDesc, mapCfg.Desc)
|
||||
end
|
||||
end
|
||||
function DepotItemListCtrl:SetFateCardInfo()
|
||||
local mapSelect = self.mapFateCard[self.nSelectIndex]
|
||||
if nil ~= mapSelect then
|
||||
local itemCfg = ConfigTable.GetData_Item(mapSelect.nTid)
|
||||
local fateCardCfg = ConfigTable.GetData("FateCard", mapSelect.nTid)
|
||||
if nil == fateCardCfg then
|
||||
printError(string.format("获取FateCard表格配置失败!!!id = [%s]", mapSelect.nTid))
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtFateCardName, fateCardCfg.Name)
|
||||
local sDesc = UTILS.ParseParamDesc(fateCardCfg.Desc, fateCardCfg)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtFateCardDesc, sDesc)
|
||||
self._mapNode.goFateCardInfo:InitFateCard(mapSelect.nTid, mapSelect.nCount)
|
||||
for _, v in ipairs(self._mapNode.imgEffect) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
if mapSelect.nCount <= 0 then
|
||||
self._mapNode.imgEffect[3].gameObject:SetActive(true)
|
||||
elseif mapSelect.nCount == 999 then
|
||||
self._mapNode.imgEffect[2].gameObject:SetActive(true)
|
||||
else
|
||||
self._mapNode.imgEffect[1].gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtEffectCount, orderedFormat(ConfigTable.GetUIText("StarTower_FateCard_Effect_Count_Value"), mapSelect.nCount))
|
||||
end
|
||||
end
|
||||
end
|
||||
function DepotItemListCtrl:Clear()
|
||||
end
|
||||
function DepotItemListCtrl:Awake()
|
||||
self.tbFateCardCtrl = {}
|
||||
self.tbItemCtrl = {}
|
||||
self.nSelectIndex = nil
|
||||
self.nSelectType = 0
|
||||
self._mapNode.goFateCardItem.gameObject:SetActive(false)
|
||||
self._mapNode.goDepotItem.gameObject:SetActive(false)
|
||||
end
|
||||
function DepotItemListCtrl:OnDestroy()
|
||||
for _, v in ipairs(self.tbFateCardCtrl) do
|
||||
self:UnbindCtrlByNode(v)
|
||||
end
|
||||
self.tbFateCardCtrl = {}
|
||||
for _, v in ipairs(self.tbItemCtrl) do
|
||||
self:UnbindCtrlByNode(v)
|
||||
end
|
||||
self.tbItemCtrl = {}
|
||||
end
|
||||
return DepotItemListCtrl
|
||||
@@ -0,0 +1,167 @@
|
||||
local DepotNoteCtrl = class("DepotNoteCtrl", BaseCtrl)
|
||||
DepotNoteCtrl._mapNodeConfig = {
|
||||
goDiscNoteItem = {
|
||||
nCount = 5,
|
||||
sCtrlName = "Game.UI.StarTower.Note.NoteCountItemCtrl"
|
||||
},
|
||||
btnDiscItem = {
|
||||
nCount = 3,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_DiscItem"
|
||||
},
|
||||
goDiscItem = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateDiscItemCtrl"
|
||||
},
|
||||
btnPassiveSkill = {
|
||||
nCount = 3,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_PassiveSkill"
|
||||
},
|
||||
ctrlPassiveSkill = {
|
||||
nCount = 3,
|
||||
sNodeName = "btnPassiveSkill",
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscSkillItemCtrl"
|
||||
},
|
||||
btnCommonSkill1_ = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Common1"
|
||||
},
|
||||
ctrlCommonSkill1_ = {
|
||||
nCount = 2,
|
||||
sNodeName = "btnCommonSkill1_",
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscSkillItemCtrl"
|
||||
},
|
||||
btnCommonSkill2_ = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Common2"
|
||||
},
|
||||
ctrlCommonSkill2_ = {
|
||||
nCount = 2,
|
||||
sNodeName = "btnCommonSkill2_",
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscSkillItemCtrl"
|
||||
},
|
||||
btnCommonSkill3_ = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Common3"
|
||||
},
|
||||
ctrlCommonSkill3_ = {
|
||||
nCount = 2,
|
||||
sNodeName = "btnCommonSkill3_",
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscSkillItemCtrl"
|
||||
}
|
||||
}
|
||||
DepotNoteCtrl._mapEventConfig = {}
|
||||
DepotNoteCtrl._mapRedDotConfig = {}
|
||||
function DepotNoteCtrl:InitDisc()
|
||||
for k, nId in ipairs(self._panel.tbDisc) do
|
||||
local mapDisc = self._panel.mapDiscData[nId]
|
||||
if mapDisc ~= nil then
|
||||
self._mapNode.goDiscItem[k]:Refresh(nId, mapDisc.nStar, mapDisc.nMaxStar, mapDisc.nLevel, mapDisc.tbShowNote)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DepotNoteCtrl:RefreshNoteList(tbNoteList)
|
||||
if self.bInit then
|
||||
return
|
||||
end
|
||||
self.bInit = true
|
||||
self.tbPassiveSkill = {}
|
||||
self.tbCommomSkill = {}
|
||||
self.tbNoteList = tbNoteList
|
||||
for k, v in ipairs(self._mapNode.goDiscNoteItem) do
|
||||
local nNoteId = self._panel.tbShowNote[k]
|
||||
local nCount = tbNoteList[nNoteId] or 0
|
||||
v:Init(nCount)
|
||||
end
|
||||
for k, nId in ipairs(self._panel.tbDisc) do
|
||||
local discData = self._panel.mapDiscData[nId]
|
||||
self._mapNode.ctrlPassiveSkill[k]:SetNone()
|
||||
for i = 1, 2 do
|
||||
self._mapNode["ctrlCommonSkill" .. k .. "_"][i]:SetNone()
|
||||
end
|
||||
if discData then
|
||||
if discData.nPassiveSkillId then
|
||||
local mapPassiveCfg = ConfigTable.GetData("DiscPassiveSkill", discData.nPassiveSkillId)
|
||||
if mapPassiveCfg then
|
||||
local nCurLayer = discData:GetPassiveLayer(tbNoteList, mapPassiveCfg)
|
||||
local mapData = {
|
||||
nType = AllEnum.DiscSkillType.Passive,
|
||||
nId = discData.nPassiveSkillId,
|
||||
nLevel = nCurLayer,
|
||||
nMaxLevel = discData.nPassiveSkillMaxLayer
|
||||
}
|
||||
self._mapNode.ctrlPassiveSkill[k]:InitDiscSkill(mapData)
|
||||
self.tbPassiveSkill[k] = mapData
|
||||
end
|
||||
end
|
||||
for i, nCommonSkillId in ipairs(discData.tbCommonSkillId) do
|
||||
if nCommonSkillId then
|
||||
local mapCommonCfg = ConfigTable.GetData("DiscCommonSkill", nCommonSkillId)
|
||||
if mapCommonCfg then
|
||||
local nCurLayer = discData:GetCommonLayer(tbNoteList, mapCommonCfg)
|
||||
local mapData = {
|
||||
nType = AllEnum.DiscSkillType.Common,
|
||||
nId = nCommonSkillId,
|
||||
nLevel = nCurLayer,
|
||||
nMaxLevel = #mapCommonCfg.ActiveNoteNum
|
||||
}
|
||||
self._mapNode["ctrlCommonSkill" .. k .. "_"][i]:InitDiscSkill(mapData)
|
||||
if not self.tbCommomSkill[k] then
|
||||
self.tbCommomSkill[k] = {}
|
||||
end
|
||||
self.tbCommomSkill[k][i] = mapData
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function DepotNoteCtrl:OpenTips(mapSelect, btn)
|
||||
if not mapSelect then
|
||||
return
|
||||
end
|
||||
local mapData = {
|
||||
nType = mapSelect.nType,
|
||||
nSkillId = mapSelect.nId,
|
||||
nLevel = mapSelect.nLevel,
|
||||
nMaxLevel = mapSelect.nMaxLevel
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSkillTips, btn.transform, mapData)
|
||||
end
|
||||
function DepotNoteCtrl:Clear()
|
||||
self.bInit = false
|
||||
end
|
||||
function DepotNoteCtrl:Awake()
|
||||
self.bInit = false
|
||||
end
|
||||
function DepotNoteCtrl:OnEnable()
|
||||
for k, v in ipairs(self._panel.tbShowNote) do
|
||||
if nil ~= self._mapNode.goDiscNoteItem[k] then
|
||||
self._mapNode.goDiscNoteItem[k]:InitNote(v)
|
||||
end
|
||||
end
|
||||
self:InitDisc()
|
||||
end
|
||||
function DepotNoteCtrl:OnDisable()
|
||||
end
|
||||
function DepotNoteCtrl:OnDestroy()
|
||||
end
|
||||
function DepotNoteCtrl:OnRelease()
|
||||
end
|
||||
function DepotNoteCtrl:OnBtnClick_PassiveSkill(btn, nIndex)
|
||||
self:OpenTips(self.tbPassiveSkill[nIndex], btn)
|
||||
end
|
||||
function DepotNoteCtrl:OnBtnClick_Common1(btn, nIndex)
|
||||
self:OpenTips(self.tbCommomSkill[1][nIndex], btn)
|
||||
end
|
||||
function DepotNoteCtrl:OnBtnClick_Common2(btn, nIndex)
|
||||
self:OpenTips(self.tbCommomSkill[2][nIndex], btn)
|
||||
end
|
||||
function DepotNoteCtrl:OnBtnClick_Common3(btn, nIndex)
|
||||
self:OpenTips(self.tbCommomSkill[3][nIndex], btn)
|
||||
end
|
||||
return DepotNoteCtrl
|
||||
@@ -0,0 +1,241 @@
|
||||
local DepotPotentialCtrl = class("DepotPotentialCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
DepotPotentialCtrl._mapNodeConfig = {
|
||||
goEmpty = {},
|
||||
PotentialCardRoot = {},
|
||||
PotentialCard = {
|
||||
sCtrlName = "Game.UI.StarTower.Potential.PotentialCardItemCtrl"
|
||||
},
|
||||
CharList = {},
|
||||
PotentialList = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.StarTower.Depot.CharPotentialListCtrl"
|
||||
},
|
||||
PotentialDepotItem = {},
|
||||
rtPotentialContent = {
|
||||
sNodeName = "PotentialContent",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
goSwitchFull = {},
|
||||
btnSwitchFull = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SwitchFull"
|
||||
},
|
||||
SwitchFullOn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot_Potential_ALL"
|
||||
},
|
||||
SwitchFullOff = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot_Potential_Has"
|
||||
},
|
||||
txtPotentialEmpty = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot_PotentialEmpty"
|
||||
},
|
||||
switch_des = {},
|
||||
switch_img_bg = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
switch_name = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Potential_Change_Desc"
|
||||
},
|
||||
btnSwitch_on = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SetDes"
|
||||
},
|
||||
btnSwitch_off = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SetSimpleDes"
|
||||
}
|
||||
}
|
||||
DepotPotentialCtrl._mapEventConfig = {
|
||||
SelectDepotPotential = "OnEvent_SelectDepotPotential"
|
||||
}
|
||||
DepotPotentialCtrl._mapRedDotConfig = {}
|
||||
function DepotPotentialCtrl:RefreshPotential(mapAllPotential, mapPotential)
|
||||
if self.bInit then
|
||||
return
|
||||
end
|
||||
self.bInit = true
|
||||
self.mapPotential = {}
|
||||
self.mapAllPotential = {}
|
||||
self.nSelectId = nil
|
||||
for k, v in ipairs(mapAllPotential) do
|
||||
local nCharId = v.nCharId
|
||||
local tbDepotPotential = mapPotential[nCharId]
|
||||
for nId, nLevel in pairs(tbDepotPotential) do
|
||||
self.mapPotential[nId] = {nLevel = nLevel}
|
||||
end
|
||||
local tbPotentialAdd = self._panel.mapPotentialAddLevel[nCharId]
|
||||
local tbSortList = {}
|
||||
for style, tb in ipairs(v.tbPotential) do
|
||||
tbSortList[style] = {}
|
||||
for _, v in ipairs(v.tbPotential[style]) do
|
||||
local nUnlock = tbDepotPotential[v.nId] ~= nil and 1 or 0
|
||||
local nAddCount = tbPotentialAdd[v.nId] and tbPotentialAdd[v.nId] or 0
|
||||
local nLevel = tbDepotPotential[v.nId] or 0
|
||||
if nLevel == 0 then
|
||||
nAddCount = 0
|
||||
end
|
||||
local itemCfg = ConfigTable.GetData_Item(v.nId)
|
||||
if itemCfg == nil then
|
||||
return
|
||||
end
|
||||
local nSpecial = itemCfg.Stype == GameEnum.itemStype.SpecificPotential and 1 or 0
|
||||
table.insert(tbSortList[style], {
|
||||
nId = v.nId,
|
||||
nLevel = nLevel,
|
||||
nPotentialAdd = nAddCount,
|
||||
nAllLevel = nLevel + nAddCount,
|
||||
nSpecial = nSpecial,
|
||||
nRarity = itemCfg.Rarity,
|
||||
nUnlock = nUnlock
|
||||
})
|
||||
end
|
||||
table.sort(tbSortList[style], function(a, b)
|
||||
if a.nUnlock == b.nUnlock then
|
||||
if a.nSpecial == b.nSpecial then
|
||||
if a.nRarity == b.nRarity then
|
||||
if a.nAllLevel == b.nAllLevel then
|
||||
return a.nId < b.nId
|
||||
end
|
||||
return a.nAllLevel > b.nAllLevel
|
||||
end
|
||||
return a.nRarity < b.nRarity
|
||||
end
|
||||
return a.nSpecial > b.nSpecial
|
||||
end
|
||||
return a.nUnlock > b.nUnlock
|
||||
end)
|
||||
if self.nSelectId == nil then
|
||||
self.nSelectId = tbSortList[1][1].nId
|
||||
end
|
||||
table.insert(self.mapAllPotential, {
|
||||
nCharId = nCharId,
|
||||
tbPotential = tbSortList[style]
|
||||
})
|
||||
end
|
||||
self._mapNode.PotentialList[k]:RefreshPotential(nCharId, tbSortList, self.bPotentialAll, self._mapNode.PotentialDepotItem, k == 1)
|
||||
end
|
||||
self:SwitchPotentialAll()
|
||||
EventManager.Hit("SelectDepotPotential", self.nSelectId)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rtPotentialContent)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
self:InitSwitch()
|
||||
end
|
||||
function DepotPotentialCtrl:SwitchPotentialAll()
|
||||
self._mapNode.btnSwitchFull[1].gameObject:SetActive(not self.bPotentialAll)
|
||||
self._mapNode.btnSwitchFull[2].gameObject:SetActive(self.bPotentialAll)
|
||||
self._mapNode.rtPotentialContent.anchoredPosition = Vector2(0, 0)
|
||||
for k, v in ipairs(self._mapNode.PotentialList) do
|
||||
v:SwitchPotentialAll(self.bPotentialAll)
|
||||
end
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rtPotentialContent)
|
||||
local bEmpty = false
|
||||
if not self.bPotentialAll then
|
||||
bEmpty = true
|
||||
for _, v in pairs(self.mapPotential) do
|
||||
bEmpty = bEmpty and 0 >= v.nLevel
|
||||
end
|
||||
end
|
||||
self._mapNode.goEmpty.gameObject:SetActive(bEmpty)
|
||||
self._mapNode.CharList.gameObject:SetActive(not bEmpty)
|
||||
self._mapNode.PotentialCardRoot.gameObject:SetActive(not bEmpty)
|
||||
self._mapNode.switch_des:SetActive(not bEmpty)
|
||||
if not self.bPotentialAll then
|
||||
self._mapNode.PotentialCard.gameObject:SetActive(self.nSelectId ~= nil and self.mapPotential[self.nSelectId] ~= nil)
|
||||
if self.mapPotential[self.nSelectId] == nil then
|
||||
self.nSelectId = nil
|
||||
for _, v in ipairs(self.mapAllPotential) do
|
||||
for _, data in ipairs(v.tbPotential) do
|
||||
if 0 < data.nLevel then
|
||||
self.nSelectId = data.nId
|
||||
EventManager.Hit("SelectDepotPotential", self.nSelectId)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if nil == self.nSelectId then
|
||||
if next(self.mapAllPotential) and next(self.mapAllPotential[1].tbPotential) then
|
||||
self.nSelectId = self.mapAllPotential[1].tbPotential[1].nId
|
||||
EventManager.Hit("SelectDepotPotential", self.nSelectId)
|
||||
else
|
||||
self._mapNode.PotentialCardRoot.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DepotPotentialCtrl:InitSwitch()
|
||||
local bSimple = PlayerData.StarTower:GetPotentialDescSimple()
|
||||
self._mapNode.btnSwitch_on.gameObject:SetActive(bSimple)
|
||||
self._mapNode.btnSwitch_off.gameObject:SetActive(not bSimple)
|
||||
end
|
||||
function DepotPotentialCtrl:Clear()
|
||||
self.bInit = false
|
||||
self.nSelectId = nil
|
||||
self.bPotentialAll = true
|
||||
self._mapNode.PotentialDepotItem.gameObject:SetActive(false)
|
||||
self._mapNode.PotentialCard.gameObject:SetActive(false)
|
||||
end
|
||||
function DepotPotentialCtrl:Awake()
|
||||
self.bInit = false
|
||||
self.bPotentialAll = true
|
||||
local bPa = LocalData.GetPlayerLocalData("PotentialAllSwitch")
|
||||
if nil ~= bPa then
|
||||
self.bPotentialAll = bPa
|
||||
end
|
||||
self.nSelectId = nil
|
||||
self._mapNode.PotentialDepotItem.gameObject:SetActive(false)
|
||||
self._mapNode.PotentialCard.gameObject:SetActive(false)
|
||||
end
|
||||
function DepotPotentialCtrl:OnEnable()
|
||||
end
|
||||
function DepotPotentialCtrl:OnDisable()
|
||||
end
|
||||
function DepotPotentialCtrl:OnDestroy()
|
||||
end
|
||||
function DepotPotentialCtrl:OnRelease()
|
||||
end
|
||||
function DepotPotentialCtrl:OnBtnClick_SetSimpleDes(...)
|
||||
PlayerData.StarTower:SetPotentialDescSimple(true)
|
||||
EventManager.Hit("SelectDepotPotential", self.nSelectId)
|
||||
self._mapNode.btnSwitch_on.gameObject:SetActive(true)
|
||||
self._mapNode.btnSwitch_off.gameObject:SetActive(false)
|
||||
end
|
||||
function DepotPotentialCtrl:OnBtnClick_SetDes(...)
|
||||
PlayerData.StarTower:SetPotentialDescSimple(false)
|
||||
EventManager.Hit("SelectDepotPotential", self.nSelectId)
|
||||
self._mapNode.btnSwitch_on.gameObject:SetActive(false)
|
||||
self._mapNode.btnSwitch_off.gameObject:SetActive(true)
|
||||
end
|
||||
function DepotPotentialCtrl:OnBtnClick_SwitchFull()
|
||||
self.bPotentialAll = not self.bPotentialAll
|
||||
LocalData.SetPlayerLocalData("PotentialAllSwitch", self.bPotentialAll)
|
||||
self:SwitchPotentialAll()
|
||||
end
|
||||
function DepotPotentialCtrl:OnEvent_SelectDepotPotential(nPotentialId)
|
||||
self._mapNode.PotentialCard.gameObject:SetActive(true)
|
||||
local nLevel = 0
|
||||
if nil ~= self.mapPotential[nPotentialId] then
|
||||
nLevel = self.mapPotential[nPotentialId].nLevel or 0
|
||||
end
|
||||
nLevel = nLevel == 0 and 1 or nLevel
|
||||
self.nSelectId = nPotentialId
|
||||
local potentialCfg = ConfigTable.GetData("Potential", nPotentialId)
|
||||
if nil ~= potentialCfg then
|
||||
local nCharId = potentialCfg.CharId
|
||||
local nPotentialAddLv = self._panel.mapPotentialAddLevel[nCharId][nPotentialId] or 0
|
||||
local bSimple = PlayerData.StarTower:GetPotentialDescSimple()
|
||||
self._mapNode.PotentialCard:SetPotentialItem(nPotentialId, nLevel, nil, bSimple, nil, nPotentialAddLv, AllEnum.PotentialCardType.StarTower)
|
||||
self._mapNode.PotentialCard:ChangeWordRaycast(true)
|
||||
end
|
||||
end
|
||||
return DepotPotentialCtrl
|
||||
@@ -0,0 +1,87 @@
|
||||
local DepotPotentialItemCtrl = class("DepotPotentialItemCtrl", BaseCtrl)
|
||||
DepotPotentialItemCtrl._mapNodeConfig = {
|
||||
btnItem = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Item"
|
||||
},
|
||||
canvasGroup = {
|
||||
sNodeName = "goNormal",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
goNormal = {},
|
||||
imgRare = {sComponentName = "Image"},
|
||||
goIcon = {
|
||||
sCtrlName = "Game.UI.StarTower.Potential.PotentialIconCtrl"
|
||||
},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
txtLevelValue = {sComponentName = "TMP_Text"},
|
||||
goSpecial = {},
|
||||
imgSpIcon = {sComponentName = "Image"},
|
||||
txtSpName = {sComponentName = "TMP_Text"},
|
||||
imgChoose = {},
|
||||
imgLock = {},
|
||||
txtLock = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot_Potential_Lock"
|
||||
},
|
||||
imgMask = {}
|
||||
}
|
||||
DepotPotentialItemCtrl._mapEventConfig = {
|
||||
SelectDepotPotential = "OnEvent_SelectDepotPotential"
|
||||
}
|
||||
DepotPotentialItemCtrl._mapRedDotConfig = {}
|
||||
local level_txt_color = {
|
||||
[1] = "#264278",
|
||||
[2] = "#2c5fd5"
|
||||
}
|
||||
function DepotPotentialItemCtrl:InitItem(nPotentialId, nLevel, nPotentialAdd, bShowAdd, bHideChoose)
|
||||
self.nPotentialId = nPotentialId
|
||||
self.nLevel = nLevel
|
||||
self.nPotentialAdd = nPotentialAdd
|
||||
self.bHideChoose = bHideChoose
|
||||
local itemCfg = ConfigTable.GetData_Item(nPotentialId)
|
||||
local potentialCfg = ConfigTable.GetData("Potential", nPotentialId)
|
||||
if nil == potentialCfg or nil == itemCfg then
|
||||
return
|
||||
end
|
||||
self._mapNode.imgLock.gameObject:SetActive(nLevel <= 0)
|
||||
self._mapNode.imgMask.gameObject:SetActive(nLevel <= 0)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, 1)
|
||||
local bSpecial = itemCfg.Stype == GameEnum.itemStype.SpecificPotential
|
||||
self._mapNode.goNormal.gameObject:SetActive(not bSpecial)
|
||||
self._mapNode.goSpecial.gameObject:SetActive(bSpecial)
|
||||
if not bSpecial then
|
||||
self:SetNormalPotential(itemCfg, potentialCfg, bShowAdd)
|
||||
else
|
||||
self:SetSpecialPotential(itemCfg, potentialCfg)
|
||||
end
|
||||
self._mapNode.imgChoose.gameObject:SetActive(false)
|
||||
end
|
||||
function DepotPotentialItemCtrl:SetNormalPotential(itemCfg, potentialCfg, bShowAdd)
|
||||
local sFrame = AllEnum.FrameType_New.PotentialS .. AllEnum.FrameColor_New[itemCfg.Rarity]
|
||||
self:SetAtlasSprite(self._mapNode.imgRare, "12_rare", sFrame)
|
||||
self._mapNode.goIcon:SetIcon(potentialCfg.Id)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, itemCfg.Title)
|
||||
local nPotentialAdd = self.nPotentialAdd
|
||||
if not bShowAdd then
|
||||
nPotentialAdd = 0
|
||||
end
|
||||
local sColor = nPotentialAdd == 0 and level_txt_color[1] or level_txt_color[2]
|
||||
local _, color = ColorUtility.TryParseHtmlString(sColor)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelValue, self.nLevel + nPotentialAdd)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtLevelValue, color)
|
||||
end
|
||||
function DepotPotentialItemCtrl:SetSpecialPotential(itemCfg, potentialCfg)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSpName, itemCfg.Title)
|
||||
self:SetPngSprite(self._mapNode.imgSpIcon, itemCfg.Icon .. AllEnum.PotentialIconSurfix.A)
|
||||
end
|
||||
function DepotPotentialItemCtrl:OnBtnClick_Item()
|
||||
EventManager.Hit("SelectDepotPotential", self.nPotentialId, self.nLevel, self.nPotentialAdd, self._mapNode.btnItem)
|
||||
end
|
||||
function DepotPotentialItemCtrl:OnEvent_SelectDepotPotential(nId)
|
||||
if self.bHideChoose then
|
||||
return
|
||||
end
|
||||
self._mapNode.imgChoose:SetActive(self.nPotentialId == nId)
|
||||
end
|
||||
return DepotPotentialItemCtrl
|
||||
@@ -0,0 +1,237 @@
|
||||
local StarTowerDepotCtrl = class("StarTowerDepotCtrl", BaseCtrl)
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
StarTowerDepotCtrl._mapNodeConfig = {
|
||||
trActor2D_PNG = {
|
||||
sNodeName = "----Actor2D_PNG----",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
animActor2D = {
|
||||
sNodeName = "----Actor2D_PNG----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
imgActorBg = {},
|
||||
animActorBg = {sNodeName = "imgActorBg", sComponentName = "Animator"},
|
||||
goBlur = {
|
||||
sNodeName = "t_fullscreen_blur_01"
|
||||
},
|
||||
aniBlur = {
|
||||
sNodeName = "t_fullscreen_blur_01",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
goRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
aniRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
imgNoteTogBg = {},
|
||||
imgEmpty = {},
|
||||
ItemList = {
|
||||
sNodeName = "---ItemList---",
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotItemListCtrl"
|
||||
},
|
||||
CharInfo = {
|
||||
sNodeName = "---CharInfo---",
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotCharInfoCtrl"
|
||||
},
|
||||
Potential = {
|
||||
sNodeName = "---Potential---",
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotPotentialCtrl"
|
||||
},
|
||||
DiscSkill = {
|
||||
sNodeName = "---DiscSkill---",
|
||||
sCtrlName = "Game.UI.StarTower.Depot.DepotDiscSkillCtrl"
|
||||
},
|
||||
tog = {
|
||||
nCount = 4,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ChangeTab"
|
||||
},
|
||||
ctrlTog = {
|
||||
nCount = 4,
|
||||
sNodeName = "tog",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
btnBack = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_CloseStarTowerDepot"
|
||||
},
|
||||
btnHelp = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Dictionary"
|
||||
},
|
||||
txtTitle = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Depot"
|
||||
},
|
||||
txt_EmptyTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "FRDepot_EmptyItem"
|
||||
}
|
||||
}
|
||||
StarTowerDepotCtrl._mapEventConfig = {
|
||||
OpenStarTowerDepot = "OnEvent_OpenStarTowerDepot",
|
||||
RefreshActor2D_Depot = "OnEvent_RefreshActor2D",
|
||||
Guide_SelectDepotTog = "OnEvent_SelectDepotTog"
|
||||
}
|
||||
StarTowerDepotCtrl._mapRedDotConfig = {}
|
||||
function StarTowerDepotCtrl:InitAllPotential()
|
||||
self.mapAllPotential = {}
|
||||
for k, nCharId in ipairs(self._panel.tbTeam) do
|
||||
local tbData = {
|
||||
nCharId = nCharId,
|
||||
tbPotential = {}
|
||||
}
|
||||
local charPotentialCfg = PlayerData.Char:GetCharPotentialList(nCharId)
|
||||
if charPotentialCfg ~= nil then
|
||||
if k == 1 then
|
||||
tbData.tbPotential = charPotentialCfg.master
|
||||
else
|
||||
tbData.tbPotential = charPotentialCfg.assist
|
||||
end
|
||||
end
|
||||
table.insert(self.mapAllPotential, tbData)
|
||||
end
|
||||
end
|
||||
function StarTowerDepotCtrl:RefreshTogText()
|
||||
self._mapNode.ctrlTog[1]:SetText(ConfigTable.GetUIText("StarTower_Depot_Potential"))
|
||||
self._mapNode.ctrlTog[2]:SetText(ConfigTable.GetUIText("StarTower_Depot_Note"))
|
||||
self._mapNode.ctrlTog[3]:SetText(ConfigTable.GetUIText("StarTower_Depot_Char"))
|
||||
self._mapNode.ctrlTog[4]:SetText(ConfigTable.GetUIText("StarTower_Depot_Bag"))
|
||||
end
|
||||
function StarTowerDepotCtrl:SetDefaultTog()
|
||||
if nil == self.nCurTog then
|
||||
self.nCurTog = AllEnum.StarTowerDepotTog.CharInfo
|
||||
end
|
||||
for i = 1, 4 do
|
||||
self._mapNode.ctrlTog[i]:SetDefault(i == self.nCurTog)
|
||||
end
|
||||
self:SwitchTog()
|
||||
end
|
||||
function StarTowerDepotCtrl:SwitchTog()
|
||||
self:RefreshList()
|
||||
end
|
||||
function StarTowerDepotCtrl:RefreshList()
|
||||
self._mapNode.CharInfo.gameObject:SetActive(self.nCurTog == AllEnum.StarTowerDepotTog.CharInfo)
|
||||
self._mapNode.Potential.gameObject:SetActive(self.nCurTog == AllEnum.StarTowerDepotTog.Potential)
|
||||
self._mapNode.DiscSkill.gameObject:SetActive(self.nCurTog == AllEnum.StarTowerDepotTog.DiscSkill)
|
||||
self._mapNode.ItemList.gameObject:SetActive(self.nCurTog == AllEnum.StarTowerDepotTog.ItemList)
|
||||
self._mapNode.trActor2D_PNG.gameObject:SetActive(self.nCurTog == AllEnum.StarTowerDepotTog.CharInfo)
|
||||
self._mapNode.imgActorBg.gameObject:SetActive(self.nCurTog == AllEnum.StarTowerDepotTog.CharInfo)
|
||||
self._mapNode.imgNoteTogBg.gameObject:SetActive(self.nCurTog == AllEnum.StarTowerDepotTog.DiscSkill)
|
||||
if self.nCurTog == AllEnum.StarTowerDepotTog.CharInfo then
|
||||
self._mapNode.CharInfo:RefreshCharInfo(self._panel.tbTeam, self._panel.mapCharData)
|
||||
elseif self.nCurTog == AllEnum.StarTowerDepotTog.Potential then
|
||||
self._mapNode.Potential:RefreshPotential(self.mapAllPotential, self.mapPotential)
|
||||
elseif self.nCurTog == AllEnum.StarTowerDepotTog.DiscSkill then
|
||||
EventManager.Hit("Guide_PassiveCheck_Msg", "Guide_OpenStarTowerDepot")
|
||||
self._mapNode.DiscSkill:RefreshDiscSkill(self.mapNote, self.tbActiveSecondaryIds)
|
||||
elseif self.nCurTog == AllEnum.StarTowerDepotTog.ItemList then
|
||||
self._mapNode.ItemList:RefreshItemList(self.mapFateCard, self.mapItem, self.nParam)
|
||||
self.nParam = nil
|
||||
end
|
||||
end
|
||||
function StarTowerDepotCtrl:Awake()
|
||||
if self:GetPanelId() == PanelId.StarTowerFastBattle then
|
||||
self._mapNode.tog[3].gameObject:SetActive(false)
|
||||
self._mapNode.CharInfo.gameObject:SetActive(false)
|
||||
end
|
||||
self.canvas = self.gameObject:GetComponent("Canvas")
|
||||
self.nInitSortingOrder = NovaAPI.GetCanvasSortingOrder(self.canvas)
|
||||
self:RefreshTogText()
|
||||
self:InitAllPotential()
|
||||
self.nCurTog = nil
|
||||
self.tbCharPotential = {}
|
||||
self._mapNode.goRoot:SetActive(false)
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
end
|
||||
function StarTowerDepotCtrl:FadeOut()
|
||||
end
|
||||
function StarTowerDepotCtrl:OnEnable()
|
||||
end
|
||||
function StarTowerDepotCtrl:OnDisable()
|
||||
end
|
||||
function StarTowerDepotCtrl:OnDestroy()
|
||||
end
|
||||
function StarTowerDepotCtrl:OnRelease()
|
||||
end
|
||||
function StarTowerDepotCtrl:OnBtnClick_ChangeTab(btn, nIndex)
|
||||
if nIndex == self.nCurTog then
|
||||
return
|
||||
end
|
||||
self._mapNode.ctrlTog[nIndex]:SetTrigger(true)
|
||||
self._mapNode.ctrlTog[self.nCurTog]:SetTrigger(false)
|
||||
self.nCurTog = nIndex
|
||||
self:SwitchTog()
|
||||
end
|
||||
function StarTowerDepotCtrl:OnBtnClick_CloseStarTowerDepot()
|
||||
PanelManager.InputEnable()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", true, true)
|
||||
NovaAPI.SetCanvasSortingOrder(self.canvas, self.nInitSortingOrder)
|
||||
CS.GameCameraStackManager.Instance:OpenMainCamera()
|
||||
EventManager.Hit(EventId.BattleDashboardVisible, true)
|
||||
self.nCurTog = nil
|
||||
if self.callbackClose then
|
||||
self.callbackClose()
|
||||
end
|
||||
self._mapNode.goRoot:SetActive(false)
|
||||
self._mapNode.goBlur:SetActive(false)
|
||||
self._mapNode.trActor2D_PNG.gameObject:SetActive(false)
|
||||
self._mapNode.imgActorBg.gameObject:SetActive(false)
|
||||
self._mapNode.imgNoteTogBg.gameObject:SetActive(false)
|
||||
self._mapNode.Potential:Clear()
|
||||
self._mapNode.DiscSkill:Clear()
|
||||
self._mapNode.CharInfo:Clear()
|
||||
self._mapNode.ItemList:Clear()
|
||||
EventManager.Hit("CloseStarTowerDepot")
|
||||
GamepadUIManager.DisableGamepadUI("StarTowerDepotCtrl")
|
||||
end
|
||||
function StarTowerDepotCtrl:OnEvent_OpenStarTowerDepot(mapPotential, mapNote, mapFateCard, mapItem, tbActiveSecondaryIds, nTog, nParam, callback)
|
||||
self._panel:SetTop(self.canvas)
|
||||
PanelManager.InputDisable()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
self.callbackClose = callback
|
||||
self.mapPotential = mapPotential
|
||||
self.mapNote = mapNote
|
||||
self.mapFateCard = mapFateCard
|
||||
self.mapItem = mapItem
|
||||
self.tbActiveSecondaryIds = tbActiveSecondaryIds
|
||||
self.nParam = nParam
|
||||
if nil ~= nTog then
|
||||
self.nCurTog = nTog
|
||||
end
|
||||
self._mapNode.goBlur:SetActive(true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.33)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
CS.GameCameraStackManager.Instance:CloseMainCamera(0.1)
|
||||
self:SetDefaultTog()
|
||||
self._mapNode.goRoot:SetActive(true)
|
||||
self._mapNode.aniRoot:Play("depot_t_in")
|
||||
if self.nCurTog == AllEnum.StarTowerDepotTog.CharInfo then
|
||||
self._mapNode.animActor2D:Play("Actor2D_PNG_down_in", 0, 0)
|
||||
self._mapNode.animActorBg:Play("imgActorBg_in", 0, 0)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
GamepadUIManager.EnableGamepadUI("StarTowerDepotCtrl", self.tbGamepadUINode, nil, true)
|
||||
end
|
||||
function StarTowerDepotCtrl:OnEvent_RefreshActor2D(nCharId)
|
||||
Actor2DManager.SetActor2D_PNG(self._mapNode.trActor2D_PNG, PanelId.MainView, nCharId)
|
||||
end
|
||||
function StarTowerDepotCtrl:OnEvent_SelectDepotTog(nTog)
|
||||
if nTog == self.nCurTog then
|
||||
return
|
||||
end
|
||||
self._mapNode.ctrlTog[nTog]:SetTrigger(true)
|
||||
self._mapNode.ctrlTog[self.nCurTog]:SetTrigger(false)
|
||||
self.nCurTog = nTog
|
||||
self:SwitchTog()
|
||||
end
|
||||
function StarTowerDepotCtrl:OnBtnClick_Dictionary()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DictionaryFR, self:GetPanelId() == PanelId.StarTowerFastBattle)
|
||||
end
|
||||
return StarTowerDepotCtrl
|
||||
@@ -0,0 +1,36 @@
|
||||
local DiscNoteSkillItemCtrl = class("DiscNoteSkillItemCtrl", BaseCtrl)
|
||||
DiscNoteSkillItemCtrl._mapNodeConfig = {
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
txtDesc = {sComponentName = "TMP_Text"},
|
||||
txtLastLevel = {sComponentName = "TMP_Text"},
|
||||
txtCurLevel = {sComponentName = "TMP_Text"},
|
||||
imgCritical = {},
|
||||
txtCritical = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Disc_Skill_Active_Critical_Text"
|
||||
}
|
||||
}
|
||||
DiscNoteSkillItemCtrl._mapEventConfig = {}
|
||||
DiscNoteSkillItemCtrl._mapRedDotConfig = {}
|
||||
function DiscNoteSkillItemCtrl:Awake()
|
||||
end
|
||||
function DiscNoteSkillItemCtrl:OnEnable()
|
||||
end
|
||||
function DiscNoteSkillItemCtrl:OnDisable()
|
||||
end
|
||||
function DiscNoteSkillItemCtrl:OnDestroy()
|
||||
end
|
||||
function DiscNoteSkillItemCtrl:SetSkillItem(nNoteId, nCurLevel, nLastLevel, bLucky)
|
||||
local mapCfg = ConfigTable.GetData("SubNoteSkill", nNoteId)
|
||||
if mapCfg ~= nil then
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapCfg.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, mapCfg.Name)
|
||||
local sDesc = UTILS.ParseDesc(mapCfg, nil, nil, false, nCurLevel)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDesc, sDesc)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLastLevel, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Tips_Skill_Lv"), nLastLevel))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCurLevel, orderedFormat(ConfigTable.GetUIText("StarTower_Depot_Note_Tips_Skill_Lv"), nCurLevel))
|
||||
self._mapNode.imgCritical.gameObject:SetActive(bLucky)
|
||||
end
|
||||
end
|
||||
return DiscNoteSkillItemCtrl
|
||||
@@ -0,0 +1,394 @@
|
||||
local DiscSkillActiveCtrl = class("DiscSkillActiveCtrl", BaseCtrl)
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
local WwiseManger = CS.WwiseAudioManager.Instance
|
||||
DiscSkillActiveCtrl._mapNodeConfig = {
|
||||
blurBg = {},
|
||||
contentRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
animRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
btnBg = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_BtnBg"
|
||||
},
|
||||
btnShortcutBg = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_BtnBg",
|
||||
sAction = "Confirm"
|
||||
},
|
||||
cgSkillList = {
|
||||
sNodeName = "goSkillList",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
btnDepot = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Depot"
|
||||
},
|
||||
txtTitle = {sComponentName = "TMP_Text"},
|
||||
goAllNoteList = {},
|
||||
imgNote = {sComponentName = "Image", nCount = 9},
|
||||
goNoteList = {},
|
||||
noteListSv = {sComponentName = "ScrollRect"},
|
||||
goNoteItem = {},
|
||||
noteContent = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
btnNoteList = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_BtnBg"
|
||||
},
|
||||
goSkillList = {},
|
||||
skillListSv = {sComponentName = "ScrollRect"},
|
||||
goSkillItem = {},
|
||||
skillContent = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
btnSkillList = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_BtnBg"
|
||||
},
|
||||
goSkillCard = {},
|
||||
goNoteCardItem = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateDiscSkillCardCtrl"
|
||||
},
|
||||
ScrollView = {
|
||||
sComponentName = "GamepadScroll"
|
||||
},
|
||||
imgIconBgEffect = {sComponentName = "Image"},
|
||||
imgIconEffect = {sComponentName = "Image"},
|
||||
imgCornerBgEffect = {sComponentName = "Image"},
|
||||
txtTips = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Tips_Continue"
|
||||
},
|
||||
txtClickPre = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Click_Pre"
|
||||
},
|
||||
txtClickSuf = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Click_Suf"
|
||||
},
|
||||
Tips = {
|
||||
sCtrlName = "Game.UI.StarTower.DiscTips.StarTowerTipsCtrl"
|
||||
}
|
||||
}
|
||||
DiscSkillActiveCtrl._mapEventConfig = {
|
||||
StarTowerShowDiscSkill = "OnEvent_ShowDiscSkillActive",
|
||||
OpenNoteDepot = "OnEvent_OpenNoteDepot",
|
||||
GamepadUIReopen = "OnEvent_Reopen",
|
||||
StarTowerDiscTips = "OnEvent_StarTowerDiscTips"
|
||||
}
|
||||
DiscSkillActiveCtrl._mapRedDotConfig = {}
|
||||
local panel_stage_note = 1
|
||||
local panel_stage_skill = 2
|
||||
local panel_stage_skill_upgrade = 3
|
||||
function DiscSkillActiveCtrl:InitNoteSkillList()
|
||||
for k, v in ipairs(self._mapNode.imgNote) do
|
||||
v.gameObject:SetActive(self._panel.tbShowNote[k] ~= nil)
|
||||
if self._panel.tbShowNote[k] ~= nil then
|
||||
local mapNoteCfg = ConfigTable.GetData("SubNoteSkill", self._panel.tbShowNote[k])
|
||||
if nil ~= mapNoteCfg then
|
||||
self:SetPngSprite(v, mapNoteCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscSkillActiveCtrl:ShowNoteList(tbParam, callback)
|
||||
self._mapNode.Tips.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTitle, ConfigTable.GetUIText("StarTower_Disc_Skill_Active_1"))
|
||||
self._panel:SetTop(self.canvas)
|
||||
local bCloseCamera = false
|
||||
if not self.bOpen then
|
||||
PanelManager.InputDisable()
|
||||
bCloseCamera = true
|
||||
GamepadUIManager.EnableGamepadUI("DiscSkillActiveCtrl", self.tbGamepadUINode)
|
||||
end
|
||||
self.bOpen = true
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
self.callback = callback
|
||||
self._mapNode.blurBg.gameObject:SetActive(true)
|
||||
self._mapNode.btnBg.gameObject:SetActive(true)
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
if bCloseCamera then
|
||||
CS.GameCameraStackManager.Instance:CloseMainCamera(0.1)
|
||||
end
|
||||
self._mapNode.contentRoot.gameObject:SetActive(true)
|
||||
self._mapNode.goNoteList.gameObject:SetActive(true)
|
||||
self._mapNode.goSkillList.gameObject:SetActive(false)
|
||||
self._mapNode.goSkillCard.gameObject:SetActive(false)
|
||||
self.nPanelStage = panel_stage_note
|
||||
self:RefreshAllNoteList(tbParam.tbNoteChange)
|
||||
self:RefreshNoteSkill(tbParam.tbNoteChange)
|
||||
NovaAPI.SetVerticalNormalizedPosition(self._mapNode.noteListSv, 1)
|
||||
NovaAPI.SetVerticalNormalizedPosition(self._mapNode.skillListSv, 1)
|
||||
WwiseManger:PlaySound("ui_roguelike_phonograph_mus")
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function DiscSkillActiveCtrl:RefreshAllNoteList(tbNoteChange)
|
||||
for k, v in ipairs(self._mapNode.imgNote) do
|
||||
local nNoteId = self._panel.tbShowNote[k]
|
||||
v.gameObject:SetActive(nNoteId ~= nil)
|
||||
if nNoteId ~= nil then
|
||||
local tmpCount = v.gameObject.transform:Find("txtNoteCount"):GetComponent("TMP_Text")
|
||||
local imgArrow = v.gameObject.transform:Find("imgArrow")
|
||||
NovaAPI.SetTMPText(tmpCount, self.tbNoteList[nNoteId] or 0)
|
||||
imgArrow.gameObject:SetActive(tbNoteChange[nNoteId] ~= nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscSkillActiveCtrl:RefreshNoteSkill(tbNoteChange)
|
||||
local tbNoteSkill = {}
|
||||
for nId, v in pairs(tbNoteChange) do
|
||||
table.insert(tbNoteSkill, {
|
||||
nNoteId = nId,
|
||||
nCount = v.nCount,
|
||||
bLucky = v.bLucky
|
||||
})
|
||||
end
|
||||
table.sort(tbNoteSkill, function(a, b)
|
||||
return a.nNoteId < b.nNoteId
|
||||
end)
|
||||
for _, v in ipairs(self.tbNoteSkillItemCtrl) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
local tbCtrl = {}
|
||||
for k, v in ipairs(tbNoteSkill) do
|
||||
local objCtrl = self.tbNoteSkillItemCtrl[k]
|
||||
if objCtrl == nil then
|
||||
local objItem = instantiate(self._mapNode.goNoteItem, self._mapNode.noteContent)
|
||||
objCtrl = self:BindCtrlByNode(objItem, "Game.UI.StarTower.DiscTips.DiscNoteSkillItemCtrl")
|
||||
table.insert(self.tbNoteSkillItemCtrl, objCtrl)
|
||||
end
|
||||
objCtrl.gameObject:SetActive(false)
|
||||
local nCurLevel = self.tbNoteList[v.nNoteId] or 0
|
||||
objCtrl:SetSkillItem(v.nNoteId, nCurLevel, nCurLevel - v.nCount, v.bLucky)
|
||||
table.insert(tbCtrl, objCtrl)
|
||||
end
|
||||
local nIndex = 1
|
||||
if 0 < #tbCtrl then
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
self:AddTimer(#tbCtrl, 0.08, function()
|
||||
local objCtrl = tbCtrl[nIndex]
|
||||
nIndex = nIndex + 1
|
||||
if objCtrl ~= nil then
|
||||
objCtrl.gameObject:SetActive(true)
|
||||
end
|
||||
if nIndex > #tbCtrl then
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
self._mapNode.txtTips[1].gameObject:SetActive(true)
|
||||
self._mapNode.txtTips[2].gameObject:SetActive(true)
|
||||
EventManager.Hit("Guide_PassiveCheck_Msg", "Guide_OpenDiscSkillActive")
|
||||
end
|
||||
end, true, true, true)
|
||||
else
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
end
|
||||
self._mapNode.txtTips[1].gameObject:SetActive(false)
|
||||
self._mapNode.txtTips[2].gameObject:SetActive(false)
|
||||
end
|
||||
function DiscSkillActiveCtrl:RefreshDiscSkill(tbSkillList)
|
||||
WwiseManger:PlaySound("ui_roguelike_phonograph_mus")
|
||||
self._mapNode.goNoteList.gameObject:SetActive(false)
|
||||
self._mapNode.goSkillList.gameObject:SetActive(true)
|
||||
self._mapNode.goSkillCard.gameObject:SetActive(false)
|
||||
local tbCtrl = {}
|
||||
if tbSkillList ~= nil then
|
||||
for _, v in ipairs(self.tbSkillItemCtrl) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
for k, v in ipairs(tbSkillList) do
|
||||
local objCtrl = self.tbSkillItemCtrl[k]
|
||||
if objCtrl == nil then
|
||||
local objItem = instantiate(self._mapNode.goSkillItem, self._mapNode.skillContent)
|
||||
objCtrl = self:BindCtrlByNode(objItem, "Game.UI.StarTower.DiscTips.DiscSkillItemCtrl")
|
||||
table.insert(self.tbSkillItemCtrl, objCtrl)
|
||||
end
|
||||
objCtrl.gameObject:SetActive(false)
|
||||
objCtrl:SetSkillItem(v.nSkillId, v.tbChangeNote, self.tbNoteList, v.bActive)
|
||||
table.insert(tbCtrl, objCtrl)
|
||||
end
|
||||
end
|
||||
local nIndex = 1
|
||||
if 0 < #tbCtrl then
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
self:AddTimer(#tbCtrl, 0.08, function()
|
||||
local objCtrl = tbCtrl[nIndex]
|
||||
nIndex = nIndex + 1
|
||||
if objCtrl ~= nil then
|
||||
objCtrl.gameObject:SetActive(true)
|
||||
objCtrl:PlayAnim()
|
||||
end
|
||||
if nIndex > #tbCtrl then
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
self._mapNode.txtTips[1].gameObject:SetActive(true)
|
||||
self._mapNode.txtTips[2].gameObject:SetActive(true)
|
||||
end
|
||||
end, true, true, true)
|
||||
self._mapNode.txtTips[1].gameObject:SetActive(false)
|
||||
self._mapNode.txtTips[2].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function DiscSkillActiveCtrl:ShowDiscUpgradeCard()
|
||||
self._mapNode.txtTips[1].gameObject:SetActive(false)
|
||||
self._mapNode.txtTips[2].gameObject:SetActive(false)
|
||||
self._mapNode.animRoot:Play("DiscSkillActive_Card", 0, 0)
|
||||
local nAnimLen = NovaAPI.GetAnimClipLength(self._mapNode.animRoot, {
|
||||
"DiscSkillActive_Card"
|
||||
})
|
||||
self:AddTimer(1, nAnimLen, function()
|
||||
self._mapNode.txtTips[1].gameObject:SetActive(true)
|
||||
self._mapNode.txtTips[2].gameObject:SetActive(true)
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLen)
|
||||
WwiseManger:PlaySound("ui_roguelike_outfit_select")
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTitle, ConfigTable.GetUIText("StarTower_Disc_Skill_Active_2"))
|
||||
self._mapNode.goSkillCard.gameObject:SetActive(true)
|
||||
self._mapNode.goNoteList.gameObject:SetActive(false)
|
||||
self._mapNode.goSkillList.gameObject:SetActive(false)
|
||||
local mapData = table.remove(self.tbSkillActive, 1)
|
||||
if mapData ~= nil then
|
||||
self.nSkillId = mapData.nSkillId
|
||||
self._mapNode.goNoteCardItem:Refresh(mapData.nDiscId, nil, self.nSkillId)
|
||||
self._mapNode.goNoteCardItem:ChangeWordRaycast(true)
|
||||
NovaAPI.SetComponentEnable(self._mapNode.ScrollView, true)
|
||||
local mapSkillCfg = ConfigTable.GetData("SecondarySkill", self.nSkillId)
|
||||
if mapSkillCfg ~= nil then
|
||||
self:SetPngSprite(self._mapNode.imgIconEffect, mapSkillCfg.Icon)
|
||||
self:SetPngSprite(self._mapNode.imgIconBgEffect, mapSkillCfg.IconBg)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscSkillActiveCtrl:HidePanel()
|
||||
self.bOpen = false
|
||||
GamepadUIManager.DisableGamepadUI("DiscSkillActiveCtrl")
|
||||
EventManager.Hit("StarTowerSetButtonEnable", true, true)
|
||||
PanelManager.InputEnable()
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
self._mapNode.btnBg.gameObject:SetActive(false)
|
||||
NovaAPI.SetCanvasSortingOrder(self.canvas, self.nInitSortingOrder)
|
||||
CS.GameCameraStackManager.Instance:OpenMainCamera()
|
||||
if nil ~= self.callback then
|
||||
self.callback()
|
||||
end
|
||||
end
|
||||
function DiscSkillActiveCtrl:ReopenPanel()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(true)
|
||||
self._mapNode.btnBg.gameObject:SetActive(true)
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
CS.GameCameraStackManager.Instance:CloseMainCamera(0.1)
|
||||
self._mapNode.contentRoot.gameObject:SetActive(true)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function DiscSkillActiveCtrl:Awake()
|
||||
self.nType = 0
|
||||
self.bOpen = false
|
||||
self.tbNoteSkillItemCtrl = {}
|
||||
self.tbSkillItemCtrl = {}
|
||||
self.canvas = self.gameObject:GetComponent("Canvas")
|
||||
self.nInitSortingOrder = NovaAPI.GetCanvasSortingOrder(self.canvas)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.btnBg.gameObject:SetActive(false)
|
||||
self._mapNode.goSkillItem.gameObject:SetActive(false)
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
end
|
||||
function DiscSkillActiveCtrl:OnEnable()
|
||||
self.nPanelStage = 0
|
||||
self:InitNoteSkillList()
|
||||
end
|
||||
function DiscSkillActiveCtrl:OnDisable()
|
||||
for _, v in ipairs(self.tbNoteSkillItemCtrl) do
|
||||
self:UnbindCtrlByNode(v)
|
||||
end
|
||||
self.tbNoteSkillItemCtrl = {}
|
||||
for _, v in ipairs(self.tbSkillItemCtrl) do
|
||||
self:UnbindCtrlByNode(v)
|
||||
end
|
||||
self.tbSkillItemCtrl = {}
|
||||
end
|
||||
function DiscSkillActiveCtrl:OnBtnClick_BtnBg()
|
||||
if self.nPanelStage == panel_stage_note then
|
||||
if self.tbParam.tbSkill ~= nil and next(self.tbParam.tbSkill) ~= nil then
|
||||
self.nPanelStage = panel_stage_skill
|
||||
self:RefreshDiscSkill(self.tbParam.tbSkill)
|
||||
return
|
||||
else
|
||||
self.nPanelStage = 0
|
||||
end
|
||||
elseif self.nPanelStage == panel_stage_skill then
|
||||
if 0 < #self.tbSkillActive then
|
||||
self.nPanelStage = panel_stage_skill_upgrade
|
||||
self:ShowDiscUpgradeCard()
|
||||
return
|
||||
else
|
||||
self.nPanelStage = 0
|
||||
end
|
||||
elseif self.nPanelStage == panel_stage_skill_upgrade then
|
||||
if #self.tbSkillActive == 0 then
|
||||
self.nPanelStage = 0
|
||||
else
|
||||
self:ShowDiscUpgradeCard()
|
||||
return
|
||||
end
|
||||
end
|
||||
if self.nPanelStage == 0 then
|
||||
self:HidePanel()
|
||||
end
|
||||
end
|
||||
function DiscSkillActiveCtrl:OnBtnClick_Depot()
|
||||
self.bDepotOpen = true
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
CS.GameCameraStackManager.Instance:OpenMainCamera()
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
self._mapNode.btnBg.gameObject:SetActive(false)
|
||||
EventManager.Hit(EventId.StarTowerDepot, AllEnum.StarTowerDepotTog.DiscSkill)
|
||||
end
|
||||
function DiscSkillActiveCtrl:OnEvent_ShowDiscSkillActive(tbParam, tbNoteList, callback)
|
||||
self.tbParam = tbParam
|
||||
self.tbNoteList = tbNoteList
|
||||
self.tbSkillActive = tbParam.tbDiscSkillAct
|
||||
self:ShowNoteList(tbParam, callback)
|
||||
end
|
||||
function DiscSkillActiveCtrl:OnEvent_StarTowerDiscTips(tbTips)
|
||||
self._mapNode.Tips.gameObject:SetActive(true)
|
||||
self._mapNode.Tips:StartShowTips(tbTips)
|
||||
end
|
||||
function DiscSkillActiveCtrl:OnEvent_OpenNoteDepot()
|
||||
if self._mapNode.contentRoot.gameObject.activeSelf == false then
|
||||
return
|
||||
end
|
||||
self.bDepotOpen = true
|
||||
CS.GameCameraStackManager.Instance:OpenMainCamera()
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
self._mapNode.btnBg.gameObject:SetActive(false)
|
||||
end
|
||||
function DiscSkillActiveCtrl:OnEvent_Reopen(sName)
|
||||
if sName ~= "DiscSkillActiveCtrl" then
|
||||
return
|
||||
end
|
||||
if self.bDepotOpen then
|
||||
self.bDepotOpen = false
|
||||
self:ReopenPanel()
|
||||
end
|
||||
end
|
||||
return DiscSkillActiveCtrl
|
||||
@@ -0,0 +1,93 @@
|
||||
local DiscSkillItemCtrl = class("DiscSkillItemCtrl", BaseCtrl)
|
||||
DiscSkillItemCtrl._mapNodeConfig = {
|
||||
btnSkillItem = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SkillItem"
|
||||
},
|
||||
imgIconBg = {sComponentName = "Image"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
goSkillNote = {nCount = 3, sComponentName = "Image"},
|
||||
imgSkillNote = {nCount = 3, sComponentName = "Image"},
|
||||
animSkillNote = {
|
||||
nCount = 3,
|
||||
sNodeName = "goSkillNote",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
txtNoteCount = {nCount = 3, sComponentName = "TMP_Text"}
|
||||
}
|
||||
DiscSkillItemCtrl._mapEventConfig = {}
|
||||
DiscSkillItemCtrl._mapRedDotConfig = {}
|
||||
function DiscSkillItemCtrl:Awake()
|
||||
end
|
||||
function DiscSkillItemCtrl:OnEnable()
|
||||
end
|
||||
function DiscSkillItemCtrl:OnDisable()
|
||||
end
|
||||
function DiscSkillItemCtrl:OnDestroy()
|
||||
end
|
||||
function DiscSkillItemCtrl:SetSkillItem(nSkillId, tbChangeNote, tbNoteList, bActive)
|
||||
self.tbPlayAnim = {}
|
||||
self.nSkillId = nSkillId
|
||||
local mapCfg = ConfigTable.GetData("SecondarySkill", nSkillId)
|
||||
if mapCfg ~= nil then
|
||||
self:SetPngSprite(self._mapNode.imgIconBg, mapCfg.IconBg)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapCfg.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, mapCfg.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, ConfigTable.GetUIText("Skill_Level") .. mapCfg.Level)
|
||||
local tbActiveNote = decodeJson(mapCfg.NeedSubNoteSkills)
|
||||
local tbGroup = CacheTable.GetData("_SecondarySkill", mapCfg.GroupId)
|
||||
local maxLevel = #tbGroup
|
||||
local bMax = maxLevel <= mapCfg.Level
|
||||
if not bMax and bActive then
|
||||
local nNextSkillId = nSkillId + 1
|
||||
local mapNextCfg = ConfigTable.GetData("SecondarySkill", nNextSkillId)
|
||||
if mapNextCfg ~= nil then
|
||||
tbActiveNote = decodeJson(mapNextCfg.NeedSubNoteSkills)
|
||||
end
|
||||
elseif not bActive and mapCfg.Level == 1 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, ConfigTable.GetUIText("StarTower_Depot_DiscSkill_NotActivated"))
|
||||
end
|
||||
for _, v in ipairs(self._mapNode.goSkillNote) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
local nIndex = 1
|
||||
for k, v in pairs(tbActiveNote) do
|
||||
local nNoteId = tonumber(k)
|
||||
local nNoteCount = tonumber(v)
|
||||
self._mapNode.goSkillNote[nIndex].gameObject:SetActive(true)
|
||||
local mapNoteCfg = ConfigTable.GetData("SubNoteSkill", nNoteId)
|
||||
if mapNoteCfg ~= nil then
|
||||
self:SetPngSprite(self._mapNode.goSkillNote[nIndex], mapNoteCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
self:SetPngSprite(self._mapNode.imgSkillNote[nIndex], mapNoteCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
local sLevelStr = "StarTower_Depot_Note_Change_1"
|
||||
self.tbPlayAnim[nIndex] = tbChangeNote[nNoteId] ~= nil
|
||||
local nCurCount = tbNoteList[nNoteId] or 0
|
||||
if tbChangeNote[nNoteId] ~= nil then
|
||||
if nNoteCount > nCurCount then
|
||||
sLevelStr = "StarTower_Depot_Note_Change_2"
|
||||
else
|
||||
sLevelStr = "StarTower_Depot_Note_Change_3"
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNoteCount[nIndex], orderedFormat(ConfigTable.GetUIText(sLevelStr), nCurCount, nNoteCount))
|
||||
end
|
||||
nIndex = nIndex + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscSkillItemCtrl:PlayAnim()
|
||||
for k, v in ipairs(self._mapNode.animSkillNote) do
|
||||
if self.tbPlayAnim[k] then
|
||||
v:Play("imgSkillNote_in", 0, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DiscSkillItemCtrl:OnBtnClick_SkillItem(btn)
|
||||
local mapData = {
|
||||
nSkillId = self.nSkillId
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSkillTips, btn.transform, mapData)
|
||||
end
|
||||
return DiscSkillItemCtrl
|
||||
@@ -0,0 +1,68 @@
|
||||
local StarTowerAffinityTipsItem = class("StarTowerAffinityTipsItem", BaseCtrl)
|
||||
StarTowerAffinityTipsItem._mapNodeConfig = {
|
||||
imgBg = {sComponentName = "Image"},
|
||||
itemTr = {
|
||||
sNodeName = "imgBg",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
canvasGroup = {
|
||||
sNodeName = "imgBg",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
imgItemIcon = {
|
||||
sNodeName = "img_ItemIcon",
|
||||
sComponentName = "Image"
|
||||
},
|
||||
itemIconTr = {
|
||||
sNodeName = "img_ItemIcon",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtItemName = {
|
||||
sNodeName = "txt_ItemName",
|
||||
sComponentName = "TMP_Text"
|
||||
}
|
||||
}
|
||||
StarTowerAffinityTipsItem._mapEventConfig = {}
|
||||
function StarTowerAffinityTipsItem:Show(nNpcId, nAffinity)
|
||||
local mapNpcCfg = ConfigTable.GetData("StarTowerNPC", nNpcId)
|
||||
self:SetPngSprite(self._mapNode.imgBg, "UI/big_sprites/rare_vestige_obtain_6")
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgBg)
|
||||
if nAffinity == 0 then
|
||||
self:SetAtlasSprite(self._mapNode.imgItemIcon, "10_ico", "icon_favorability_01")
|
||||
self._mapNode.itemIconTr.localScale = Vector3.one
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemName, ConfigTable.GetUIText("StarTowerNPCAffinity_MaxCount"))
|
||||
else
|
||||
if mapNpcCfg ~= nil then
|
||||
self:SetPngSprite(self._mapNode.imgItemIcon, mapNpcCfg.Head)
|
||||
self._mapNode.itemIconTr.localScale = Vector3.one * 0.25
|
||||
self._mapNode.itemIconTr.anchoredPosition = Vector2(38.8, 4.3)
|
||||
else
|
||||
self:SetAtlasSprite(self._mapNode.imgItemIcon, "10_ico", "icon_favorability_01")
|
||||
self._mapNode.itemIconTr.localScale = Vector3.one
|
||||
self._mapNode.itemIconTr.anchoredPosition = Vector2(36.3, 0)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemName, orderedFormat(ConfigTable.GetUIText("StarTowerNPCAffinity_Increase"), nAffinity))
|
||||
end
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgItemIcon)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, 0)
|
||||
self._mapNode.itemTr.anchoredPosition = Vector2(0, 0)
|
||||
local nInAnimLen = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"TemplateTip_in"
|
||||
})
|
||||
self:AddTimer(1, nInAnimLen + 1, function()
|
||||
self:OnTipItemHide()
|
||||
end, true, true, true, nil)
|
||||
end
|
||||
function StarTowerAffinityTipsItem:OnTipItemHide()
|
||||
local nInAnimLen = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"TemplateTip_out"
|
||||
})
|
||||
self.animRoot:Play("TemplateTip_out")
|
||||
self:AddTimer(1, nInAnimLen, function()
|
||||
EventManager.Hit("StarTowerTipsShowEnd", self, AllEnum.StarTowerTipsType.NPCAffinity)
|
||||
end, true, true, true, nil)
|
||||
end
|
||||
function StarTowerAffinityTipsItem:Awake()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
return StarTowerAffinityTipsItem
|
||||
@@ -0,0 +1,47 @@
|
||||
local StarTowerDiscTipsItem = class("StarTowerDiscTipsItem", BaseCtrl)
|
||||
StarTowerDiscTipsItem._mapNodeConfig = {
|
||||
itemTr = {
|
||||
sNodeName = "imgBg",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
canvasGroup = {
|
||||
sNodeName = "imgBg",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
imgDiscIcon = {sComponentName = "Image"},
|
||||
imgSkillIcon = {sComponentName = "Image"},
|
||||
txtDisc = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
StarTowerDiscTipsItem._mapEventConfig = {}
|
||||
function StarTowerDiscTipsItem:Show(nSkillId)
|
||||
local mapSkillCfg
|
||||
mapSkillCfg = ConfigTable.GetData("SecondarySkill", nSkillId)
|
||||
if mapSkillCfg == nil then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDisc, orderedFormat(ConfigTable.GetUIText("StarTower_DiscTips"), mapSkillCfg.Name))
|
||||
self:SetPngSprite(self._mapNode.imgDiscIcon, mapSkillCfg.IconBg)
|
||||
self:SetPngSprite(self._mapNode.imgSkillIcon, mapSkillCfg.Icon)
|
||||
self._mapNode.itemTr.anchoredPosition = Vector2(0, 0)
|
||||
local nInAnimLen = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"TemplateTip_in"
|
||||
})
|
||||
self.animRoot:Play("TemplateTip_in", 0, 0)
|
||||
self:AddTimer(1, nInAnimLen + 1, function()
|
||||
local handleTweener = self._mapNode.itemTr:DOAnchorPosY(60, 0.2):SetUpdate(true)
|
||||
handleTweener.onComplete = dotween_callback_handler(self, self.OnTipItemHide)
|
||||
end, true, true, true, nil)
|
||||
end
|
||||
function StarTowerDiscTipsItem:OnTipItemHide()
|
||||
local nInAnimLen = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"TemplateTip_out"
|
||||
})
|
||||
self.animRoot:Play("TemplateTip_out", 0, 0)
|
||||
self:AddTimer(1, nInAnimLen, function()
|
||||
EventManager.Hit("StarTowerTipsShowEnd", self, AllEnum.StarTowerTipsType.DiscTip)
|
||||
end, true, true, true, nil)
|
||||
end
|
||||
function StarTowerDiscTipsItem:Awake()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
return StarTowerDiscTipsItem
|
||||
@@ -0,0 +1,47 @@
|
||||
local StarTowerFateCardTipsItem = class("StarTowerFateCardTipsItem", BaseCtrl)
|
||||
StarTowerFateCardTipsItem._mapNodeConfig = {
|
||||
itemTr = {
|
||||
sNodeName = "imgBg",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgFrame = {
|
||||
sNodeName = "imgSkillFrame",
|
||||
sComponentName = "Image"
|
||||
},
|
||||
imgSkillIcon = {
|
||||
sNodeName = "imgSkillIcon",
|
||||
sComponentName = "Image"
|
||||
},
|
||||
txtFateCard = {sComponentName = "TMP_Text"},
|
||||
imgBg = {sComponentName = "Image"}
|
||||
}
|
||||
StarTowerFateCardTipsItem._mapEventConfig = {}
|
||||
function StarTowerFateCardTipsItem:Show(nFateCardId)
|
||||
local fateCardCfg = ConfigTable.GetData_Item(nFateCardId)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtFateCard, orderedFormat(ConfigTable.GetUIText("StarTower_FateCard_Tips_1") or "", fateCardCfg.Title))
|
||||
self:SetPngSprite(self._mapNode.imgSkillIcon, fateCardCfg.Icon2)
|
||||
self:SetSprite_FrameColor(self._mapNode.imgBg, fateCardCfg.Rarity, "rare_vestige_obtain_", true)
|
||||
local sFrame = AllEnum.FrameType_New.FateCardS .. fateCardCfg.Rarity
|
||||
self:SetAtlasSprite(self._mapNode.imgFrame, "12_rare", sFrame)
|
||||
self._mapNode.itemTr.anchoredPosition = Vector2(0, 0)
|
||||
local nInAnimLen = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"TemplateTip_in"
|
||||
})
|
||||
self:AddTimer(1, nInAnimLen + 1, function()
|
||||
local handleTweener = self._mapNode.itemTr:DOAnchorPosY(60, 0.2):SetUpdate(true)
|
||||
handleTweener.onComplete = dotween_callback_handler(self, self.OnTipItemHide)
|
||||
end, true, true, true, nil)
|
||||
end
|
||||
function StarTowerFateCardTipsItem:OnTipItemHide()
|
||||
local nInAnimLen = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"TemplateTip_out"
|
||||
})
|
||||
self.animRoot:Play("TemplateTip_out")
|
||||
self:AddTimer(1, nInAnimLen, function()
|
||||
EventManager.Hit("StarTowerTipsShowEnd", self, AllEnum.StarTowerTipsType.FateCardTip)
|
||||
end, true, true, true, nil)
|
||||
end
|
||||
function StarTowerFateCardTipsItem:Awake()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
return StarTowerFateCardTipsItem
|
||||
@@ -0,0 +1,53 @@
|
||||
local StarTowerItemTipsItem = class("StarTowerItemTipsItem", BaseCtrl)
|
||||
StarTowerItemTipsItem._mapNodeConfig = {
|
||||
imgBg = {sComponentName = "Image"},
|
||||
itemTr = {
|
||||
sNodeName = "imgBg",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
canvasGroup = {
|
||||
sNodeName = "imgBg",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
imgItemIcon = {
|
||||
sNodeName = "img_ItemIcon",
|
||||
sComponentName = "Image"
|
||||
},
|
||||
txtItemName = {
|
||||
sNodeName = "txt_ItemName",
|
||||
sComponentName = "TMP_Text"
|
||||
}
|
||||
}
|
||||
StarTowerItemTipsItem._mapEventConfig = {}
|
||||
function StarTowerItemTipsItem:Show(nTid, nCount)
|
||||
local mapItemCfg = ConfigTable.GetData_Item(nTid)
|
||||
self:SetSprite_FrameColor(self._mapNode.imgBg, mapItemCfg.Rarity, "rare_vestige_obtain_", true)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgBg)
|
||||
if mapItemCfg.Type == GameEnum.itemType.Disc then
|
||||
self:SetPngSprite(self._mapNode.imgItemIcon, mapItemCfg.Icon .. AllEnum.OutfitIconSurfix.Item)
|
||||
else
|
||||
self:SetPngSprite(self._mapNode.imgItemIcon, mapItemCfg.Icon)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemName, string.format("[%s]", mapItemCfg.Title) .. "×" .. nCount)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, 0)
|
||||
self._mapNode.itemTr.anchoredPosition = Vector2(0, 0)
|
||||
local nInAnimLen = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"TemplateTip_in"
|
||||
})
|
||||
self:AddTimer(1, nInAnimLen + 1, function()
|
||||
self:OnTipItemHide()
|
||||
end, true, true, true, nil)
|
||||
end
|
||||
function StarTowerItemTipsItem:OnTipItemHide()
|
||||
local nInAnimLen = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"TemplateTip_out"
|
||||
})
|
||||
self.animRoot:Play("TemplateTip_out")
|
||||
self:AddTimer(1, nInAnimLen, function()
|
||||
EventManager.Hit("StarTowerTipsShowEnd", self, AllEnum.StarTowerTipsType.ItemTip)
|
||||
end, true, true, true, nil)
|
||||
end
|
||||
function StarTowerItemTipsItem:Awake()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
return StarTowerItemTipsItem
|
||||
@@ -0,0 +1,46 @@
|
||||
local StarTowerNoteTipsItem = class("StarTowerNoteTipsItem", BaseCtrl)
|
||||
StarTowerNoteTipsItem._mapNodeConfig = {
|
||||
itemTr = {
|
||||
sNodeName = "imgBg",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
canvasGroup = {
|
||||
sNodeName = "imgBg",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
imgNoteIcon = {sComponentName = "Image"},
|
||||
txtNote = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
StarTowerNoteTipsItem._mapEventConfig = {}
|
||||
function StarTowerNoteTipsItem:Show(nNoteId, nCount)
|
||||
local mapNoteCfg = ConfigTable.GetData("SubNoteSkill", nNoteId)
|
||||
if mapNoteCfg == nil then
|
||||
return
|
||||
end
|
||||
local sName = mapNoteCfg.Name
|
||||
local sTip = orderedFormat(ConfigTable.GetUIText("StarTower_Note_Reduce_Tip") or "", math.abs(nCount), sName)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNote, sTip)
|
||||
self:SetPngSprite(self._mapNode.imgNoteIcon, mapNoteCfg.Icon)
|
||||
self._mapNode.itemTr.anchoredPosition = Vector2(0, 0)
|
||||
local nInAnimLen = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"TemplateTip_in"
|
||||
})
|
||||
self.animRoot:Play("TemplateTip_in", 0, 0)
|
||||
self:AddTimer(1, nInAnimLen + 1, function()
|
||||
local handleTweener = self._mapNode.itemTr:DOAnchorPosY(60, 0.2):SetUpdate(true)
|
||||
handleTweener.onComplete = dotween_callback_handler(self, self.OnTipItemHide)
|
||||
end, true, true, true, nil)
|
||||
end
|
||||
function StarTowerNoteTipsItem:OnTipItemHide()
|
||||
local nInAnimLen = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"TemplateTip_out"
|
||||
})
|
||||
self.animRoot:Play("TemplateTip_out", 0, 0)
|
||||
self:AddTimer(1, nInAnimLen, function()
|
||||
EventManager.Hit("StarTowerTipsShowEnd", self, AllEnum.StarTowerTipsType.NoteTip)
|
||||
end, true, true, true, nil)
|
||||
end
|
||||
function StarTowerNoteTipsItem:Awake()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
return StarTowerNoteTipsItem
|
||||
@@ -0,0 +1,170 @@
|
||||
local StarTowerTipsCtrl = class("StarTowerTipsCtrl", BaseCtrl)
|
||||
StarTowerTipsCtrl._mapNodeConfig = {
|
||||
tr_TipContent = {sComponentName = "Transform"},
|
||||
TipPool = {sComponentName = "Transform"},
|
||||
TemplateDiscTip = {sComponentName = "GameObject"},
|
||||
TemplateItemTip = {sComponentName = "GameObject"},
|
||||
TemplateFateCardTip = {sComponentName = "GameObject"},
|
||||
TemplateNoteTip = {sComponentName = "GameObject"}
|
||||
}
|
||||
StarTowerTipsCtrl._mapEventConfig = {
|
||||
StarTowerBattleRewardTips = "OnEvent_ShowTips",
|
||||
StarTowerTipsShowEnd = "OnEvent_TipsShowEnd"
|
||||
}
|
||||
StarTowerTipsCtrl._mapRedDotConfig = {}
|
||||
function StarTowerTipsCtrl:GetItem(nTipType)
|
||||
local TipItem
|
||||
if nTipType == AllEnum.StarTowerTipsType.ItemTip then
|
||||
if #self._tbItemTipPool > 0 then
|
||||
local idx = #self._tbItemTipPool
|
||||
TipItem = self._tbItemTipPool[idx]
|
||||
table.remove(self._tbItemTipPool, idx)
|
||||
TipItem.gameObject.transform:SetParent(self._mapNode.tr_TipContent)
|
||||
return TipItem
|
||||
else
|
||||
local itemObj = instantiate(self._mapNode.TemplateItemTip, self._mapNode.tr_TipContent)
|
||||
itemObj:SetActive(true)
|
||||
TipItem = self:BindCtrlByNode(itemObj, "Game.UI.StarTower.DiscTips.StarTowerItemTipsItem")
|
||||
return TipItem
|
||||
end
|
||||
elseif nTipType == AllEnum.StarTowerTipsType.FateCardTip then
|
||||
if 0 < #self._tbFateCardTipPool then
|
||||
local idx = #self._tbFateCardTipPool
|
||||
TipItem = self._tbFateCardTipPool[idx]
|
||||
table.remove(self._tbFateCardTipPool, idx)
|
||||
TipItem.gameObject.transform:SetParent(self._mapNode.tr_TipContent)
|
||||
return TipItem
|
||||
else
|
||||
local itemObj = instantiate(self._mapNode.TemplateFateCardTip, self._mapNode.tr_TipContent)
|
||||
itemObj:SetActive(true)
|
||||
TipItem = self:BindCtrlByNode(itemObj, "Game.UI.StarTower.DiscTips.StarTowerFateCardTipsItem")
|
||||
return TipItem
|
||||
end
|
||||
elseif nTipType == AllEnum.StarTowerTipsType.DiscTip then
|
||||
if 0 < #self._tbDiscTipPool then
|
||||
local idx = #self._tbDiscTipPool
|
||||
TipItem = self._tbDiscTipPool[idx]
|
||||
table.remove(self._tbDiscTipPool, idx)
|
||||
TipItem.gameObject.transform:SetParent(self._mapNode.tr_TipContent)
|
||||
return TipItem
|
||||
else
|
||||
local itemObj = instantiate(self._mapNode.TemplateDiscTip, self._mapNode.tr_TipContent)
|
||||
itemObj:SetActive(true)
|
||||
TipItem = self:BindCtrlByNode(itemObj, "Game.UI.StarTower.DiscTips.StarTowerDiscTipsItem")
|
||||
return TipItem
|
||||
end
|
||||
elseif nTipType == AllEnum.StarTowerTipsType.NoteTip then
|
||||
if 0 < #self._tbNoteTipPool then
|
||||
local idx = #self._tbNoteTipPool
|
||||
TipItem = self._tbNoteTipPool[idx]
|
||||
table.remove(self._tbNoteTipPool, idx)
|
||||
TipItem.gameObject.transform:SetParent(self._mapNode.tr_TipContent)
|
||||
return TipItem
|
||||
else
|
||||
local itemObj = instantiate(self._mapNode.TemplateNoteTip, self._mapNode.tr_TipContent)
|
||||
itemObj:SetActive(true)
|
||||
TipItem = self:BindCtrlByNode(itemObj, "Game.UI.StarTower.DiscTips.StarTowerNoteTipsItem")
|
||||
return TipItem
|
||||
end
|
||||
elseif nTipType == AllEnum.StarTowerTipsType.NPCAffinity then
|
||||
if 0 < #self._tbAffinityTipPool then
|
||||
local idx = #self._tbAffinityTipPool
|
||||
TipItem = self._tbAffinityTipPool[idx]
|
||||
table.remove(self._tbAffinityTipPool, idx)
|
||||
TipItem.gameObject.transform:SetParent(self._mapNode.tr_TipContent)
|
||||
return TipItem
|
||||
else
|
||||
local itemObj = instantiate(self._mapNode.TemplateItemTip, self._mapNode.tr_TipContent)
|
||||
itemObj:SetActive(true)
|
||||
TipItem = self:BindCtrlByNode(itemObj, "Game.UI.StarTower.DiscTips.StarTowerAffinityTipsItem")
|
||||
return TipItem
|
||||
end
|
||||
end
|
||||
end
|
||||
function StarTowerTipsCtrl:RecycleItem(itemCtrl, nTipType)
|
||||
itemCtrl.gameObject.transform:SetParent(self._mapNode.TipPool)
|
||||
if nTipType == AllEnum.StarTowerTipsType.DiscTip then
|
||||
table.insert(self._tbDiscTipPool, itemCtrl)
|
||||
elseif nTipType == AllEnum.StarTowerTipsType.ItemTip then
|
||||
table.insert(self._tbItemTipPool, itemCtrl)
|
||||
elseif nTipType == AllEnum.StarTowerTipsType.FateCardTip then
|
||||
table.insert(self._tbFateCardTipPool, itemCtrl)
|
||||
elseif nTipType == AllEnum.StarTowerTipsType.NoteTip then
|
||||
table.insert(self._tbNoteTipPool, itemCtrl)
|
||||
elseif nTipType == AllEnum.StarTowerTipsType.NPCAffinity then
|
||||
table.insert(self._tbAffinityTipPool, itemCtrl)
|
||||
end
|
||||
end
|
||||
function StarTowerTipsCtrl:ShowTips()
|
||||
if not self.bPause then
|
||||
local wait = function()
|
||||
local frameCount = 0
|
||||
while #self._tbTipShow < self.nMaxTipsCount and 0 < #self._tbTipsQueue do
|
||||
if 4 <= frameCount then
|
||||
frameCount = 0
|
||||
local tipsInfo = table.remove(self._tbTipsQueue, 1)
|
||||
local tipItem = self:GetItem(tipsInfo.nTipType)
|
||||
tipItem.gameObject:SetActive(true)
|
||||
table.insert(self._tbTipShow, tipItem)
|
||||
if tipsInfo.nTipType == AllEnum.StarTowerTipsType.DiscTip then
|
||||
tipItem:Show(tipsInfo.nSkillId)
|
||||
elseif tipsInfo.nTipType == AllEnum.StarTowerTipsType.ItemTip then
|
||||
tipItem:Show(tipsInfo.nTid, tipsInfo.nCount)
|
||||
elseif tipsInfo.nTipType == AllEnum.StarTowerTipsType.FateCardTip then
|
||||
tipItem:Show(tipsInfo.nFateCardId)
|
||||
elseif tipsInfo.nTipType == AllEnum.StarTowerTipsType.NoteTip then
|
||||
tipItem:Show(tipsInfo.nNoteId, tipsInfo.nCount)
|
||||
elseif tipsInfo.nTipType == AllEnum.StarTowerTipsType.NPCAffinity then
|
||||
tipItem:Show(tipsInfo.nNPCId, tipsInfo.nAffinity)
|
||||
end
|
||||
else
|
||||
frameCount = frameCount + 1
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
end
|
||||
end
|
||||
end
|
||||
self.showTipsCor = cs_coroutine.start(wait)
|
||||
else
|
||||
print("剧情中无法显示物品提示")
|
||||
end
|
||||
end
|
||||
function StarTowerTipsCtrl:Awake()
|
||||
self._mapNode.TemplateDiscTip.gameObject:SetActive(false)
|
||||
self._mapNode.TemplateItemTip.gameObject:SetActive(false)
|
||||
self._mapNode.TemplateFateCardTip.gameObject:SetActive(false)
|
||||
self._mapNode.TemplateNoteTip.gameObject:SetActive(false)
|
||||
self.bPause = false
|
||||
self.nMaxTipsCount = 8
|
||||
self._tbItemTipPool = {}
|
||||
self._tbDiscTipPool = {}
|
||||
self._tbFateCardTipPool = {}
|
||||
self._tbNoteTipPool = {}
|
||||
self._tbAffinityTipPool = {}
|
||||
self._tbTipShow = {}
|
||||
self._tbTipsQueue = {}
|
||||
self.showTipsCor = nil
|
||||
delChildren(self._mapNode.tr_TipContent)
|
||||
end
|
||||
function StarTowerTipsCtrl:OnDisable()
|
||||
if nil ~= self.showTipsCor then
|
||||
cs_coroutine.stop(self.showTipsCor)
|
||||
end
|
||||
self.showTipsCor = nil
|
||||
end
|
||||
function StarTowerTipsCtrl:StartShowTips(tbTips)
|
||||
for _, v in ipairs(tbTips) do
|
||||
table.insert(self._tbTipsQueue, v)
|
||||
end
|
||||
self:ShowTips()
|
||||
end
|
||||
function StarTowerTipsCtrl:OnEvent_TipsShowEnd(itemCtrl, nTipType)
|
||||
if #self._tbTipShow > 0 then
|
||||
local idx = table.indexof(self._tbTipShow, itemCtrl)
|
||||
if idx <= #self._tbTipShow and idx ~= 0 then
|
||||
table.remove(self._tbTipShow, idx)
|
||||
self:RecycleItem(itemCtrl, nTipType)
|
||||
self:ShowTips()
|
||||
end
|
||||
end
|
||||
end
|
||||
return StarTowerTipsCtrl
|
||||
@@ -0,0 +1,87 @@
|
||||
local FateCardItemCtrl = class("FateCardItemCtrl", BaseCtrl)
|
||||
FateCardItemCtrl._mapNodeConfig = {
|
||||
imgRareBg = {sComponentName = "Image"},
|
||||
imgFateCard = {sComponentName = "Image"},
|
||||
txtFateCard = {sComponentName = "TMP_Text"},
|
||||
txtFateCardDesc = {sComponentName = "TMP_Text"},
|
||||
TMP_Link = {
|
||||
sNodeName = "txtFateCardDesc",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnBtnClick_Word"
|
||||
},
|
||||
animCtrl = {sNodeName = "AnimRoot", sComponentName = "Animator"},
|
||||
db_SSR = {},
|
||||
imgRareBgSSR = {},
|
||||
imgRareBgSR = {},
|
||||
imgRareBgR = {},
|
||||
imgNew = {},
|
||||
txtNew = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Book_New_Text"
|
||||
},
|
||||
N = {},
|
||||
SR = {},
|
||||
SSR = {},
|
||||
ScrollView = {sComponentName = "ScrollRect"},
|
||||
gamePadScroll = {
|
||||
sNodeName = "ScrollView",
|
||||
sComponentName = "GamepadScroll"
|
||||
}
|
||||
}
|
||||
FateCardItemCtrl._mapEventConfig = {}
|
||||
FateCardItemCtrl._mapRedDotConfig = {}
|
||||
function FateCardItemCtrl:SetFateCardItem(nId, bNew)
|
||||
self._mapNode.imgNew.gameObject:SetActive(bNew)
|
||||
local itemCfg = ConfigTable.GetData_Item(nId)
|
||||
if nil == itemCfg then
|
||||
printError(string.format("获取Item表格配置失败!!!id = [%s]", nId))
|
||||
return
|
||||
end
|
||||
self.itemCfg = itemCfg
|
||||
local fateCardCfg = ConfigTable.GetData("FateCard", nId)
|
||||
if nil == fateCardCfg then
|
||||
printError(string.format("获取FateCard表格配置失败!!!id = [%s]", nId))
|
||||
return
|
||||
end
|
||||
local sFrame = AllEnum.FrameType_New.FateCard .. AllEnum.FrameColor_New[itemCfg.Rarity]
|
||||
self:SetAtlasSprite(self._mapNode.imgRareBg, "12_rare", sFrame)
|
||||
self:SetPngSprite(self._mapNode.imgFateCard, itemCfg.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtFateCard, fateCardCfg.Name)
|
||||
local sDesc = UTILS.ParseParamDesc(fateCardCfg.Desc, fateCardCfg)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtFateCardDesc, sDesc)
|
||||
self._mapNode.db_SSR.gameObject:SetActive(itemCfg.Rarity == GameEnum.itemRarity.SSR)
|
||||
self._mapNode.imgRareBgSSR.gameObject:SetActive(itemCfg.Rarity == GameEnum.itemRarity.SSR)
|
||||
self._mapNode.imgRareBgSR.gameObject:SetActive(itemCfg.Rarity == GameEnum.itemRarity.SR)
|
||||
self._mapNode.imgRareBgR.gameObject:SetActive(itemCfg.Rarity == GameEnum.itemRarity.R)
|
||||
NovaAPI.SetVerticalNormalizedPosition(self._mapNode.ScrollView, 1)
|
||||
end
|
||||
function FateCardItemCtrl:ActiveRollEffect()
|
||||
if not self.itemCfg then
|
||||
return
|
||||
end
|
||||
self._mapNode.SSR:SetActive(self.itemCfg.Rarity == GameEnum.itemRarity.SSR)
|
||||
self._mapNode.SR:SetActive(self.itemCfg.Rarity == GameEnum.itemRarity.SR)
|
||||
self._mapNode.N:SetActive(self.itemCfg.Rarity == GameEnum.itemRarity.R or self.itemCfg.Rarity == GameEnum.itemRarity.N)
|
||||
end
|
||||
function FateCardItemCtrl:PlayAnim(sAnimName)
|
||||
self._mapNode.animCtrl:Play(sAnimName)
|
||||
end
|
||||
function FateCardItemCtrl:Awake()
|
||||
end
|
||||
function FateCardItemCtrl:OnEnable()
|
||||
end
|
||||
function FateCardItemCtrl:OnDisable()
|
||||
end
|
||||
function FateCardItemCtrl:OnDestroy()
|
||||
end
|
||||
function FateCardItemCtrl:OnBtnClick_Word(link, sWordId)
|
||||
UTILS.ClickWordLink(link, sWordId)
|
||||
end
|
||||
function FateCardItemCtrl:ChangeWordRaycast(bEnable)
|
||||
NovaAPI.TMPSetAllDirty(self._mapNode.txtFateCardDesc)
|
||||
NovaAPI.SetTMPRaycastTarget(self._mapNode.txtFateCardDesc, bEnable)
|
||||
end
|
||||
function FateCardItemCtrl:SetGamePadScrollEnable(bEnable)
|
||||
NovaAPI.SetComponentEnable(self._mapNode.gamePadScroll, bEnable)
|
||||
end
|
||||
return FateCardItemCtrl
|
||||
@@ -0,0 +1,575 @@
|
||||
local FateCardSelectCtrl = class("FateCardSelectCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local newDayTime = UTILS.GetDayRefreshTimeOffset()
|
||||
FateCardSelectCtrl._mapNodeConfig = {
|
||||
blurBg = {},
|
||||
contentRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
animCtrl = {
|
||||
sComponentName = "Animator",
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
imgTitleBg = {},
|
||||
txtTitle = {sComponentName = "TMP_Text"},
|
||||
imgCoinBg = {},
|
||||
imgCoin = {sComponentName = "Image"},
|
||||
txtCoinCount = {sComponentName = "TMP_Text"},
|
||||
btnFateCard = {
|
||||
sComponentName = "NaviButton",
|
||||
nCount = 3,
|
||||
callback = "OnBtnClick_FateCardItem"
|
||||
},
|
||||
rtBtnFateCard = {
|
||||
sNodeName = "btnFateCard",
|
||||
sComponentName = "RectTransform",
|
||||
nCount = 3
|
||||
},
|
||||
goFateCardItem = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.StarTower.FateCard.FateCardItemCtrl"
|
||||
},
|
||||
btnConfirm = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Confirm"
|
||||
},
|
||||
txtBtnConfirm = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "FateCard_Select_Confirm"
|
||||
},
|
||||
rtBtnConfirm = {
|
||||
sNodeName = "btnConfirm",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
btnAbandon = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Abandon"
|
||||
},
|
||||
btnDepot = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Depot"
|
||||
},
|
||||
fxEndPoint = {},
|
||||
depotPoint = {},
|
||||
cardFinishParticle = {nCount = 2},
|
||||
RollButton = {},
|
||||
btnRoll = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Roll"
|
||||
},
|
||||
imgRollCostIcon = {sComponentName = "Image"},
|
||||
txtRollCostCount = {sComponentName = "TMP_Text"},
|
||||
ActionBar = {
|
||||
sCtrlName = "Game.UI.ActionBar.ActionBarCtrl"
|
||||
}
|
||||
}
|
||||
FateCardSelectCtrl._mapEventConfig = {
|
||||
StarTowerSelectFateCard = "OnEvent_StarTowerSelectFateCard",
|
||||
RefreshStarTowerCoin = "OnEvent_SetCoin",
|
||||
GamepadUIChange = "OnEvent_GamepadUIChange",
|
||||
GamepadUIReopen = "OnEvent_Reopen"
|
||||
}
|
||||
FateCardSelectCtrl._mapRedDotConfig = {}
|
||||
function FateCardSelectCtrl:Refresh(nEventId, tbFateCard, tbNewIds, mapRoll, nCoin, bReward, bAfterRoll)
|
||||
self.bReward = bReward
|
||||
if tbFateCard == nil or #tbFateCard == 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("StarTower_FateCard_Select_Empty_Tip"))
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
self._mapNode.btnConfirm.gameObject:SetActive(false)
|
||||
EventManager.Hit("StarTowerSetButtonEnable", true, false)
|
||||
CS.GameCameraStackManager.Instance:OpenMainCamera()
|
||||
self:HidePanel()
|
||||
return
|
||||
end
|
||||
self._mapNode.RollButton:SetActive(mapRoll and mapRoll.CanReRoll)
|
||||
self.nEventId = nEventId
|
||||
self.nSelectIdx = 0
|
||||
self.nCoin = nCoin
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, self:ThousandsNumber(self.nCoin))
|
||||
self.mapRoll = mapRoll
|
||||
self:RefreshCoin(nCoin, mapRoll)
|
||||
self:RefreshFateCardList(tbFateCard, tbNewIds, bAfterRoll)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTitle, bReward and ConfigTable.GetUIText("FateCard_Select_RewardTitle") or ConfigTable.GetUIText("FateCard_Select_Title"))
|
||||
local tbConfig = {}
|
||||
if mapRoll and mapRoll.CanReRoll then
|
||||
tbConfig = {
|
||||
{
|
||||
sAction = "Confirm",
|
||||
sLang = "ActionBar_Confirm"
|
||||
},
|
||||
{
|
||||
sAction = "Roll",
|
||||
sLang = "ActionBar_Reroll"
|
||||
},
|
||||
{
|
||||
sAction = "Scroll",
|
||||
sLang = "ActionBar_Scroll"
|
||||
},
|
||||
{
|
||||
sAction = "Depot",
|
||||
sLang = "ActionBar_Depot"
|
||||
},
|
||||
{
|
||||
sAction = "Back",
|
||||
sLang = "ActionBar_SkipReward"
|
||||
}
|
||||
}
|
||||
else
|
||||
tbConfig = {
|
||||
{
|
||||
sAction = "Confirm",
|
||||
sLang = "ActionBar_Confirm"
|
||||
},
|
||||
{
|
||||
sAction = "Scroll",
|
||||
sLang = "ActionBar_Scroll"
|
||||
},
|
||||
{
|
||||
sAction = "Depot",
|
||||
sLang = "ActionBar_Depot"
|
||||
},
|
||||
{
|
||||
sAction = "Back",
|
||||
sLang = "ActionBar_SkipReward"
|
||||
}
|
||||
}
|
||||
end
|
||||
self._mapNode.ActionBar:InitActionBar(tbConfig)
|
||||
end
|
||||
function FateCardSelectCtrl:RefreshCoin(nCoin, mapRoll)
|
||||
if not mapRoll or not mapRoll.CanReRoll then
|
||||
return
|
||||
end
|
||||
self:SetSprite_Coin(self._mapNode.imgRollCostIcon, AllEnum.CoinItemId.FixedRogCurrency)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRollCostCount, mapRoll.ReRollPrice)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtRollCostCount, nCoin < mapRoll.ReRollPrice and Red_Unable or Blue_Normal)
|
||||
end
|
||||
function FateCardSelectCtrl:RefreshFateCardList(tbFateCard, tbNewIds, bAfterRoll)
|
||||
self._mapNode.btnConfirm.gameObject:SetActive(false)
|
||||
self.tbFateCardList = clone(tbFateCard)
|
||||
local tbCardObj, tbBtnObj = {}, {}
|
||||
for k, v in ipairs(self._mapNode.goFateCardItem) do
|
||||
v.gameObject:SetActive(false)
|
||||
self._mapNode.btnFateCard[k].gameObject:SetActive(self.tbFateCardList[k] ~= nil)
|
||||
if self.tbFateCardList[k] ~= nil then
|
||||
local bNew = false
|
||||
if tbNewIds ~= nil then
|
||||
for _, nId in ipairs(tbNewIds) do
|
||||
if nId == self.tbFateCardList[k] then
|
||||
bNew = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
v:SetFateCardItem(self.tbFateCardList[k], bNew)
|
||||
v:ChangeWordRaycast(false)
|
||||
table.insert(tbCardObj, v)
|
||||
table.insert(tbBtnObj, self._mapNode.btnFateCard[k])
|
||||
end
|
||||
end
|
||||
self:ResetSelect(tbBtnObj)
|
||||
local animTime = NovaAPI.GetAnimClipLength(self._mapNode.animCtrl, {
|
||||
"PotentialSelectPanel_in"
|
||||
})
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, animTime)
|
||||
if self.bReward then
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_luckeyCard_active")
|
||||
else
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_itemCard")
|
||||
end
|
||||
if 0 < #tbCardObj then
|
||||
local wait = function()
|
||||
local frameCount = 0
|
||||
while 0 < #tbCardObj do
|
||||
if 4 <= frameCount then
|
||||
local cardObj = table.remove(tbCardObj, 1)
|
||||
if cardObj ~= nil then
|
||||
cardObj.gameObject:SetActive(true)
|
||||
if bAfterRoll then
|
||||
cardObj:PlayAnim("tc_newperk_card_RollEffect")
|
||||
cardObj:ActiveRollEffect()
|
||||
else
|
||||
cardObj:PlayAnim("tc_newperk_card_in")
|
||||
end
|
||||
end
|
||||
frameCount = 0
|
||||
else
|
||||
frameCount = frameCount + 1
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
end
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
end
|
||||
function FateCardSelectCtrl:SelectComplete(nEventId, tbFateCard, tbNewIds, mapRoll, nCoin, bReward)
|
||||
if nEventId == nil or nEventId == 0 then
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
self._mapNode.btnConfirm.gameObject:SetActive(false)
|
||||
EventManager.Hit("StarTowerSetButtonEnable", true, false)
|
||||
CS.GameCameraStackManager.Instance:OpenMainCamera()
|
||||
local bSelect = false
|
||||
for k, v in ipairs(self._mapNode.goFateCardItem) do
|
||||
if k == self.nSelectIdx then
|
||||
bSelect = true
|
||||
local animCtrl = v.gameObject:GetComponent("Animator")
|
||||
animCtrl:Play("tc_newperk_card_out")
|
||||
local fxRoot = v.gameObject.transform:Find("FX")
|
||||
local fx = v.gameObject.transform:Find("FX/glow")
|
||||
local OutAnimFinish = function()
|
||||
local beginPos = fxRoot.transform.position
|
||||
local controlPos = Vector3(3, 5, 0)
|
||||
local bType1 = PanelManager.CheckPanelOpen(PanelId.StarTowerShop) or self:GetPanelId() == PanelId.StarTowerFastBattle
|
||||
local endPos, goCardFx
|
||||
if bType1 then
|
||||
endPos = self._mapNode.depotPoint.transform.position
|
||||
goCardFx = self._mapNode.cardFinishParticle[1]
|
||||
else
|
||||
endPos = self._mapNode.fxEndPoint.transform.position
|
||||
goCardFx = self._mapNode.cardFinishParticle[2]
|
||||
end
|
||||
local wait = function()
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_card_flyby")
|
||||
local totalMoveTime = 0.3
|
||||
local moveTime = 0
|
||||
local normalizedTime = 0
|
||||
while normalizedTime < 1 do
|
||||
moveTime = moveTime + CS.UnityEngine.Time.unscaledDeltaTime
|
||||
normalizedTime = moveTime / totalMoveTime
|
||||
normalizedTime = normalizedTime <= 1 and normalizedTime or 1
|
||||
local x, y, z = UTILS.GetBezierPointByT(beginPos, controlPos, endPos, normalizedTime)
|
||||
local angleZ = 100 * normalizedTime * 2
|
||||
angleZ = angleZ <= 100 and angleZ or 100
|
||||
fxRoot.transform.localEulerAngles = Vector3(0, 0, angleZ)
|
||||
fxRoot.transform.position = Vector3(x, y, z)
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
end
|
||||
goCardFx.gameObject:SetActive(true)
|
||||
fx.gameObject:SetActive(false)
|
||||
coroutine.yield(CS.UnityEngine.WaitForSecondsRealtime(0.5))
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
self:HidePanel()
|
||||
fxRoot.transform.position = beginPos
|
||||
fxRoot.transform.localEulerAngles = Vector3(0, 0, 0)
|
||||
fx.gameObject:SetActive(true)
|
||||
if nil ~= self.callback then
|
||||
self.callback(-1, nEventId)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
self:SetAnimationCallback(animCtrl, OutAnimFinish)
|
||||
else
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
self._mapNode.animCtrl:Play("PotentialSelectPanel_out")
|
||||
if not bSelect then
|
||||
local nAnimLen = NovaAPI.GetAnimClipLength(self._mapNode.animCtrl, {
|
||||
"PotentialSelectPanel_out"
|
||||
})
|
||||
self:AddTimer(1, nAnimLen, function()
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
self:HidePanel()
|
||||
if nil ~= self.callback then
|
||||
self.callback(-1, nEventId)
|
||||
end
|
||||
end, true, true, true, nil)
|
||||
end
|
||||
EventManager.Hit("Guide_FateCard_SelectComplete")
|
||||
else
|
||||
self:Refresh(nEventId, tbFateCard, tbNewIds, mapRoll, nCoin, bReward)
|
||||
if bReward then
|
||||
self._mapNode.animCtrl:Play("VampireFateCard_in1")
|
||||
end
|
||||
end
|
||||
end
|
||||
function FateCardSelectCtrl:MoveConfirmButton(btnCard)
|
||||
local rtBtn = btnCard:GetComponent("RectTransform")
|
||||
self._mapNode.rtBtnConfirm.localPosition = Vector3(rtBtn.localPosition.x, self.btnConfirmPosY, 0)
|
||||
if self._mapNode.btnConfirm.gameObject.activeSelf == false then
|
||||
self._mapNode.btnConfirm.gameObject:SetActive(true)
|
||||
else
|
||||
local animCtrl = self._mapNode.btnConfirm.transform:Find("AnimRoot"):GetComponent("Animator")
|
||||
animCtrl:Play("btnConfirm_in", 0, 0)
|
||||
end
|
||||
end
|
||||
function FateCardSelectCtrl:HidePanel()
|
||||
self.bOpen = false
|
||||
PanelManager.InputEnable()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", true, true)
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
NovaAPI.SetCanvasSortingOrder(self.canvas, self.nInitSortingOrder)
|
||||
GamepadUIManager.DisableGamepadUI("FateCardSelectCtrl")
|
||||
end
|
||||
function FateCardSelectCtrl:Awake()
|
||||
self.bOpen = false
|
||||
self.canvas = self.gameObject:GetComponent("Canvas")
|
||||
self.nInitSortingOrder = NovaAPI.GetCanvasSortingOrder(self.canvas)
|
||||
self.btnConfirmPosY = self._mapNode.rtBtnConfirm.localPosition.y
|
||||
self.bOpenDepot = false
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
self._mapNode.btnDepot.gameObject:SetActive(self._panel.nStarTowerId ~= 999)
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
self.nCoin = 0
|
||||
self:SetSprite_Coin(self._mapNode.imgCoin, AllEnum.CoinItemId.FixedRogCurrency)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, self.nCoin)
|
||||
end
|
||||
function FateCardSelectCtrl:OnEnable()
|
||||
self.handler = {}
|
||||
for k, v in ipairs(self._mapNode.btnFateCard) do
|
||||
self.handler[k] = ui_handler(self, self.OnBtnSelect_FateCardItem, v, k)
|
||||
v.onSelect:AddListener(self.handler[k])
|
||||
end
|
||||
end
|
||||
function FateCardSelectCtrl:OnDisable()
|
||||
for k, v in ipairs(self._mapNode.btnFateCard) do
|
||||
v.onSelect:RemoveListener(self.handler[k])
|
||||
end
|
||||
end
|
||||
function FateCardSelectCtrl:OnBtnClick_Confirm()
|
||||
if nil ~= self.callback then
|
||||
local completeFunc = function(nEventId, tbFateCard, tbNewIds, mapRoll, nCoin, bReward)
|
||||
self:SelectComplete(nEventId, tbFateCard, tbNewIds, mapRoll, nCoin, bReward)
|
||||
end
|
||||
self.callback(self.nSelectIdx, self.nEventId, completeFunc)
|
||||
end
|
||||
end
|
||||
function FateCardSelectCtrl:OnBtnClick_Roll()
|
||||
if not self.callback then
|
||||
return
|
||||
end
|
||||
if self.nCoin < self.mapRoll.ReRollPrice then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("StarTower_ReRoll_NotEnoughCoin"))
|
||||
return
|
||||
end
|
||||
local completeFunc = function(nEventId, tbFateCard, tbNewIds, mapRoll, nCoin, bReward)
|
||||
self:Refresh(nEventId, tbFateCard, tbNewIds, mapRoll, nCoin, bReward, true)
|
||||
end
|
||||
self.callback(self.nSelectIdx, self.nEventId, completeFunc, true)
|
||||
end
|
||||
function FateCardSelectCtrl:OnBtnClick_Abandon()
|
||||
local confirm = function()
|
||||
if nil ~= self.callback then
|
||||
self.nSelectIdx = 0
|
||||
local abandonFunc = function(nEventId, tbFateCard, tbNewIds)
|
||||
self:SelectComplete(nEventId, tbFateCard, tbNewIds)
|
||||
end
|
||||
self.callback(1000, self.nEventId, abandonFunc)
|
||||
end
|
||||
if self.bReward then
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_perk_active_stop")
|
||||
end
|
||||
end
|
||||
local TipsTime = LocalData.GetPlayerLocalData("FateCard_Tips_Time")
|
||||
local _tipDay = 0
|
||||
if TipsTime ~= nil then
|
||||
_tipDay = tonumber(TipsTime)
|
||||
end
|
||||
local curTimeStamp = CS.ClientManager.Instance.serverTimeStampWithTimeZone
|
||||
local fixedTimeStamp = curTimeStamp + newDayTime * 3600
|
||||
local nYear = tonumber(os.date("!%Y", fixedTimeStamp))
|
||||
local nMonth = tonumber(os.date("!%m", fixedTimeStamp))
|
||||
local nDay = tonumber(os.date("!%d", fixedTimeStamp))
|
||||
local nowD = nYear * 366 + nMonth * 31 + nDay
|
||||
if nowD == _tipDay then
|
||||
confirm()
|
||||
else
|
||||
local isSelectAgain = false
|
||||
local confirmCallback = function()
|
||||
if isSelectAgain then
|
||||
local _curTimeStamp = CS.ClientManager.Instance.serverTimeStampWithTimeZone
|
||||
local _fixedTimeStamp = _curTimeStamp + newDayTime * 3600
|
||||
local _nYear = tonumber(os.date("!%Y", _fixedTimeStamp))
|
||||
local _nMonth = tonumber(os.date("!%m", _fixedTimeStamp))
|
||||
local _nDay = tonumber(os.date("!%d", _fixedTimeStamp))
|
||||
local _nowD = _nYear * 366 + _nMonth * 31 + _nDay
|
||||
LocalData.SetPlayerLocalData("FateCard_Tips_Time", tostring(_nowD))
|
||||
end
|
||||
confirm()
|
||||
end
|
||||
local againCallback = function(isSelect)
|
||||
isSelectAgain = isSelect
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = orderedFormat(ConfigTable.GetUIText("FateCard_AbandonTip")),
|
||||
callbackConfirm = confirmCallback,
|
||||
callbackAgain = againCallback
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
end
|
||||
function FateCardSelectCtrl:OnBtnSelect_FateCardItem(btn, nIndex)
|
||||
local nUIType = GamepadUIManager.GetCurUIType()
|
||||
if nUIType ~= AllEnum.GamepadUIType.Other and nUIType ~= AllEnum.GamepadUIType.Mouse or self.bRecommended then
|
||||
self:OnBtnClick_FateCardItem(btn, nIndex)
|
||||
end
|
||||
end
|
||||
function FateCardSelectCtrl:OnBtnClick_FateCardItem(btn, nIndex)
|
||||
if nil == self.tbFateCardList[nIndex] or self.nSelectIdx == nIndex then
|
||||
return
|
||||
end
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_xintiao_slide")
|
||||
self:MoveConfirmButton(btn)
|
||||
for k, v in ipairs(self._mapNode.goFateCardItem) do
|
||||
if k == nIndex then
|
||||
v:PlayAnim("tc_newperk_card_switch_up")
|
||||
v:ChangeWordRaycast(true)
|
||||
elseif k == self.nSelectIdx then
|
||||
v:PlayAnim("tc_newperk_card_switch_down")
|
||||
v:ChangeWordRaycast(false)
|
||||
end
|
||||
end
|
||||
self:SelectScroll(nIndex)
|
||||
self.nSelectIdx = nIndex
|
||||
end
|
||||
function FateCardSelectCtrl:OnBtnClick_Depot()
|
||||
self.bOpenDepot = true
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
CS.GameCameraStackManager.Instance:OpenMainCamera()
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
EventManager.Hit(EventId.StarTowerDepot, AllEnum.StarTowerDepotTog.ItemList)
|
||||
end
|
||||
function FateCardSelectCtrl:OnEvent_StarTowerSelectFateCard(nEventId, tbFateCard, tbNewIds, callback, mapRoll, nCoin, bReward)
|
||||
self._panel:SetTop(self.canvas)
|
||||
self.callback = callback
|
||||
local bClosePanel = false
|
||||
if not self.bOpen then
|
||||
PanelManager.InputDisable()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
bClosePanel = true
|
||||
GamepadUIManager.EnableGamepadUI("FateCardSelectCtrl", self.tbGamepadUINode)
|
||||
end
|
||||
self.bOpen = true
|
||||
self.nSelectIdx = 0
|
||||
self.tbFateCardList = {}
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(true)
|
||||
self._mapNode.cardFinishParticle[1].gameObject:SetActive(false)
|
||||
self._mapNode.cardFinishParticle[2].gameObject:SetActive(false)
|
||||
self._mapNode.RollButton:SetActive(false)
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
if bClosePanel then
|
||||
CS.GameCameraStackManager.Instance:CloseMainCamera(0.1)
|
||||
end
|
||||
self._mapNode.contentRoot.gameObject:SetActive(true)
|
||||
if bReward then
|
||||
self._mapNode.animCtrl:Play("VampireFateCard_in1")
|
||||
else
|
||||
self._mapNode.animCtrl:Play("PotentialSelectPanel_in")
|
||||
end
|
||||
self:Refresh(nEventId, tbFateCard, tbNewIds, mapRoll, nCoin, bReward)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function FateCardSelectCtrl:OnEvent_CloseStarTowerDepot()
|
||||
if self.bOpenDepot then
|
||||
self.bOpenDepot = false
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(true)
|
||||
local nSelect = self.nSelectIdx ~= 0 and self.nSelectIdx or 1
|
||||
GamepadUIManager.SetSelectedUI(self._mapNode.btnFateCard[nSelect].gameObject)
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
CS.GameCameraStackManager.Instance:CloseMainCamera(0.1)
|
||||
self._mapNode.contentRoot.gameObject:SetActive(true)
|
||||
if self.nSelectIdx == 0 and GamepadUIManager.GetCurUIType() ~= AllEnum.GamepadUIType.Other then
|
||||
self.nSelectIdx = 1
|
||||
self:MoveConfirmButton(self._mapNode.btnFateCard[self.nSelectIdx])
|
||||
end
|
||||
for k, v in ipairs(self._mapNode.goFateCardItem) do
|
||||
if k == self.nSelectIdx then
|
||||
v:PlayAnim("tc_newperk_card_switch_up")
|
||||
v:ChangeWordRaycast(true)
|
||||
self:SelectScroll(self.nSelectIdx)
|
||||
end
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
end
|
||||
function FateCardSelectCtrl:OnEvent_GamepadUIChange(sName, nBeforeType, nAfterType)
|
||||
if sName ~= "FateCardSelectCtrl" then
|
||||
return
|
||||
end
|
||||
if nBeforeType == AllEnum.GamepadUIType.Other or nBeforeType == AllEnum.GamepadUIType.Mouse then
|
||||
local nSelect = self.nSelectIdx ~= 0 and self.nSelectIdx or 1
|
||||
GamepadUIManager.ClearSelectedUI()
|
||||
GamepadUIManager.SetSelectedUI(self._mapNode.btnFateCard[nSelect].gameObject)
|
||||
end
|
||||
end
|
||||
function FateCardSelectCtrl:OnEvent_Reopen(sName)
|
||||
if sName ~= "FateCardSelectCtrl" then
|
||||
return
|
||||
end
|
||||
if self.bOpenDepot then
|
||||
self:OnEvent_CloseStarTowerDepot()
|
||||
else
|
||||
if self.nSelectIdx == 0 and GamepadUIManager.GetCurUIType() ~= AllEnum.GamepadUIType.Other then
|
||||
self.nSelectIdx = 1
|
||||
end
|
||||
if self.nSelectIdx == 0 then
|
||||
return
|
||||
end
|
||||
GamepadUIManager.SetSelectedUI(self._mapNode.btnFateCard[self.nSelectIdx].gameObject)
|
||||
self._mapNode.goFateCardItem[self.nSelectIdx]:ChangeWordRaycast(true)
|
||||
self:SelectScroll(self.nSelectIdx)
|
||||
end
|
||||
end
|
||||
function FateCardSelectCtrl:OnEvent_SetCoin(nCount)
|
||||
if self.mapRoll ~= nil and self.mapRoll.CanReRoll and nCount then
|
||||
if nCount > self.nCoin then
|
||||
local twCoin = DOTween.To(function()
|
||||
return self.nCoin
|
||||
end, function(v)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, self:ThousandsNumber(math.floor(v)))
|
||||
end, nCount, 1)
|
||||
local _cb = function()
|
||||
self.nCoin = nCount
|
||||
end
|
||||
twCoin.onComplete = dotween_callback_handler(self, _cb)
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, self:ThousandsNumber(nCount))
|
||||
self.nCoin = nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
function FateCardSelectCtrl:ResetSelect(tbUI)
|
||||
self.nSelectIdx = 0
|
||||
self.bRecommended = false
|
||||
GamepadUIManager.SetNavigation(tbUI)
|
||||
local animTime = NovaAPI.GetAnimClipLength(self._mapNode.animCtrl, {
|
||||
"PotentialSelectPanel_in"
|
||||
}) + 0.1
|
||||
self:AddTimer(1, animTime, function()
|
||||
if self.nSelectIdx == 0 then
|
||||
GamepadUIManager.ClearSelectedUI()
|
||||
GamepadUIManager.SetSelectedUI(self._mapNode.btnFateCard[1].gameObject)
|
||||
if GamepadUIManager.GetCurUIType() == AllEnum.GamepadUIType.Mouse then
|
||||
self:OnBtnClick_FateCardItem(self._mapNode.btnFateCard[1].gameObject, 1)
|
||||
end
|
||||
end
|
||||
EventManager.Hit("Guide_PassiveCheck_Msg", "Guide_FateCardSelect")
|
||||
end, true, true, true)
|
||||
end
|
||||
function FateCardSelectCtrl:SelectScroll(nIndex)
|
||||
for _, v in ipairs(self._mapNode.goFateCardItem) do
|
||||
v:SetGamePadScrollEnable(false)
|
||||
end
|
||||
if nIndex then
|
||||
self._mapNode.goFateCardItem[nIndex]:SetGamePadScrollEnable(true)
|
||||
end
|
||||
end
|
||||
return FateCardSelectCtrl
|
||||
@@ -0,0 +1,29 @@
|
||||
local FateCardSimpleItemCtrl = class("FateCardSimpleItemCtrl", BaseCtrl)
|
||||
FateCardSimpleItemCtrl._mapNodeConfig = {
|
||||
imgRarity = {sComponentName = "Image"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
txtCount = {sComponentName = "TMP_Text"},
|
||||
txtCardId = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
FateCardSimpleItemCtrl._mapEventConfig = {}
|
||||
FateCardSimpleItemCtrl._mapRedDotConfig = {}
|
||||
function FateCardSimpleItemCtrl:SetFateCardItem(nId, nCount)
|
||||
self._mapNode.txtCardId.gameObject:SetActive(false)
|
||||
local itemCfg = ConfigTable.GetData_Item(nId)
|
||||
if nil == itemCfg then
|
||||
printError(string.format("获取Item表格配置失败!!!id = [%s]", nId))
|
||||
return
|
||||
end
|
||||
local fateCardCfg = ConfigTable.GetData("FateCard", nId)
|
||||
if nil == fateCardCfg then
|
||||
printError(string.format("获取FateCard表格配置失败!!!id = [%s]", nId))
|
||||
return
|
||||
end
|
||||
local sFrame = AllEnum.FrameType_New.FateCardS .. AllEnum.FrameColor_New[itemCfg.Rarity]
|
||||
self:SetAtlasSprite(self._mapNode.imgRarity, "12_rare", sFrame)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, itemCfg.Icon2)
|
||||
self._mapNode.txtCount.gameObject:SetActive(fateCardCfg.ActiveNumber ~= -1)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCount, nCount)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCardId, nId)
|
||||
end
|
||||
return FateCardSimpleItemCtrl
|
||||
@@ -0,0 +1,82 @@
|
||||
local NoteCardItemCtrl = class("NoteCardItemCtrl", BaseCtrl)
|
||||
NoteCardItemCtrl._mapNodeConfig = {
|
||||
imgNoteIcon = {sComponentName = "Image"},
|
||||
txtNoteDesc = {sComponentName = "TMP_Text"},
|
||||
NoteLoop = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
red = {},
|
||||
green = {},
|
||||
blue = {},
|
||||
yellow = {},
|
||||
purple = {},
|
||||
white = {},
|
||||
NoteBurst = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
burst_red = {},
|
||||
burst_green = {},
|
||||
burst_blue = {},
|
||||
burst_yellow = {},
|
||||
burst_purple = {},
|
||||
burst_white = {}
|
||||
}
|
||||
NoteCardItemCtrl._mapEventConfig = {}
|
||||
NoteCardItemCtrl._mapRedDotConfig = {}
|
||||
function NoteCardItemCtrl:SetNoteCardItem(nId, tbNote, tbShowNote)
|
||||
local noteCfg = CacheTable.GetData("_NoteDropGroup", nId)
|
||||
if nil == noteCfg then
|
||||
printError(string.format("获取音符掉落表配置失败!!!id = [%s]", nId))
|
||||
return
|
||||
end
|
||||
self._mapNode.NoteBurst.gameObject:SetActive(false)
|
||||
self._mapNode.NoteLoop.gameObject:SetActive(false)
|
||||
local childCount = self._mapNode.NoteLoop.childCount
|
||||
for i = 1, childCount do
|
||||
self._mapNode.NoteLoop:GetChild(i - 1).gameObject:SetActive(false)
|
||||
end
|
||||
childCount = self._mapNode.NoteBurst.childCount
|
||||
for i = 1, childCount do
|
||||
self._mapNode.NoteBurst:GetChild(i - 1).gameObject:SetActive(false)
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgNoteIcon, noteCfg.Icon)
|
||||
local sDesc = ""
|
||||
local nIndex = 0
|
||||
for k, v in ipairs(tbNote) do
|
||||
if v ~= 0 then
|
||||
local sIcon = ""
|
||||
local nNoteId = tbShowNote[k]
|
||||
if nil == nNoteId then
|
||||
nNoteId = 0
|
||||
end
|
||||
local noteCfg = ConfigTable.GetData("Note", nNoteId)
|
||||
sIcon = noteCfg.Style5
|
||||
local typeCfg = AllEnum.NoteTypeCfg[k]
|
||||
if nil ~= typeCfg then
|
||||
local sName = ConfigTable.GetUIText(typeCfg.sLanguage)
|
||||
if nIndex == 0 then
|
||||
sDesc = sDesc .. orderedFormat(ConfigTable.GetUIText("StarTower_Note_Desc"), v, sIcon, sName)
|
||||
else
|
||||
sDesc = sDesc .. "\n" .. orderedFormat(ConfigTable.GetUIText("StarTower_Note_Desc"), v, sIcon, sName)
|
||||
end
|
||||
nIndex = nIndex + 1
|
||||
local sFxName = typeCfg.sFxName
|
||||
self._mapNode[sFxName].gameObject:SetActive(true)
|
||||
self._mapNode["burst_" .. sFxName].gameObject:SetActive(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNoteDesc, sDesc)
|
||||
self:PlayAnim("NoteCard_in")
|
||||
end
|
||||
function NoteCardItemCtrl:Awake()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function NoteCardItemCtrl:PlayAnim(sAnimName)
|
||||
if nil ~= self.animRoot then
|
||||
local nAnimLen = NovaAPI.GetAnimClipLength(self.animRoot, {sAnimName})
|
||||
self.animRoot:Play(sAnimName)
|
||||
return nAnimLen
|
||||
end
|
||||
end
|
||||
return NoteCardItemCtrl
|
||||
@@ -0,0 +1,86 @@
|
||||
local NoteCountItemCtrl = class("NoteCountItemCtrl", BaseCtrl)
|
||||
NoteCountItemCtrl._mapNodeConfig = {
|
||||
imgNoteBg = {sComponentName = "Image"},
|
||||
imgNote = {sComponentName = "Image"},
|
||||
txtNoteCount = {sComponentName = "TMP_Text"},
|
||||
red = {},
|
||||
green = {},
|
||||
blue = {},
|
||||
yellow = {},
|
||||
purple = {},
|
||||
goNoteFx = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgNote_red = {},
|
||||
imgNote_yellow = {},
|
||||
imgNote_green = {},
|
||||
imgNote_blue = {},
|
||||
imgNote_purple = {}
|
||||
}
|
||||
NoteCountItemCtrl._mapEventConfig = {}
|
||||
NoteCountItemCtrl._mapRedDotConfig = {}
|
||||
function NoteCountItemCtrl:InitNote(nId)
|
||||
self.nId = nId
|
||||
local noteCfg = ConfigTable.GetData("Note", nId)
|
||||
if not noteCfg then
|
||||
return
|
||||
end
|
||||
self.nNoteType = noteCfg.Note
|
||||
self:SetPngSprite(self._mapNode.imgNoteBg, noteCfg.Style2)
|
||||
self:SetPngSprite(self._mapNode.imgNote, noteCfg.Style1)
|
||||
end
|
||||
function NoteCountItemCtrl:Init(nCount, nAllCount)
|
||||
self:RefreshCount(nCount, nAllCount)
|
||||
end
|
||||
function NoteCountItemCtrl:ResetNoteFx()
|
||||
self._mapNode.red.gameObject:SetActive(false)
|
||||
self._mapNode.green.gameObject:SetActive(false)
|
||||
self._mapNode.blue.gameObject:SetActive(false)
|
||||
self._mapNode.yellow.gameObject:SetActive(false)
|
||||
self._mapNode.purple.gameObject:SetActive(false)
|
||||
self._mapNode.imgNote_red.gameObject:SetActive(false)
|
||||
self._mapNode.imgNote_yellow.gameObject:SetActive(false)
|
||||
self._mapNode.imgNote_green.gameObject:SetActive(false)
|
||||
self._mapNode.imgNote_blue.gameObject:SetActive(false)
|
||||
self._mapNode.imgNote_purple.gameObject:SetActive(false)
|
||||
end
|
||||
function NoteCountItemCtrl:RefreshCount(nCount, nAllCount)
|
||||
local nFillAmount = 1
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.imgNote, nFillAmount)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNoteCount, nCount)
|
||||
local typeCfg = AllEnum.NoteTypeCfg[self.nNoteType]
|
||||
local sFxName = typeCfg.sFxName
|
||||
nFillAmount = math.min(nFillAmount, 1)
|
||||
nFillAmount = math.max(nFillAmount, 0)
|
||||
for i = 0, self._mapNode.goNoteFx.childCount - 1 do
|
||||
local trChild = self._mapNode.goNoteFx:GetChild(i)
|
||||
trChild.gameObject:SetActive(false)
|
||||
end
|
||||
self._mapNode["imgNote_" .. sFxName].gameObject:SetActive(true)
|
||||
local nMax = -0.5
|
||||
local nMin = 0.5
|
||||
local nFillMax = 1
|
||||
local nFillMin = 0
|
||||
local nValue = (nFillAmount - nFillMin) / (nFillMax - nFillMin) * (nMax - nMin) + nMin
|
||||
GameUIUtils.SetUIMaterialAnimationTexValue2(self._mapNode["imgNote_" .. sFxName].gameObject, 1, 1, 0, nValue)
|
||||
end
|
||||
function NoteCountItemCtrl:Awake()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
self._mapNode.red.gameObject:SetActive(false)
|
||||
self._mapNode.green.gameObject:SetActive(false)
|
||||
self._mapNode.blue.gameObject:SetActive(false)
|
||||
self._mapNode.yellow.gameObject:SetActive(false)
|
||||
self._mapNode.purple.gameObject:SetActive(false)
|
||||
for i = 0, self._mapNode.goNoteFx.childCount - 1 do
|
||||
local trChild = self._mapNode.goNoteFx:GetChild(i)
|
||||
trChild.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function NoteCountItemCtrl:PlayChangeAnim()
|
||||
self:ResetNoteFx()
|
||||
local typeCfg = AllEnum.NoteTypeCfg[self.nNoteType]
|
||||
local sFxName = typeCfg.sFxName
|
||||
self._mapNode[sFxName].gameObject:SetActive(true)
|
||||
self.animRoot:Play("NoteItem_up", 0, 0)
|
||||
end
|
||||
return NoteCountItemCtrl
|
||||
@@ -0,0 +1,329 @@
|
||||
local NoteSelectCtrl = class("NoteSelectCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
NoteSelectCtrl._mapNodeConfig = {
|
||||
blurBg = {},
|
||||
contentRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
animRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
btnDepot = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Depot"
|
||||
},
|
||||
txtTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Note_Select_Title"
|
||||
},
|
||||
btnNote = {
|
||||
sComponentName = "NaviButton",
|
||||
nCount = 3,
|
||||
callback = "OnBtnClick_Note"
|
||||
},
|
||||
rtBtnNote = {
|
||||
sNodeName = "btnNote",
|
||||
sComponentName = "RectTransform",
|
||||
nCount = 3
|
||||
},
|
||||
noteCardItem = {
|
||||
nCount = 3,
|
||||
sNodeName = "btnNote",
|
||||
sCtrlName = "Game.UI.StarTower.Note.NoteCardItemCtrl"
|
||||
},
|
||||
btnConfirm = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Confirm",
|
||||
sAction = "Confirm"
|
||||
},
|
||||
txtBtnConfirm = {
|
||||
nCount = 3,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Note_Select_Confirm"
|
||||
},
|
||||
rtBtnConfirm = {
|
||||
sNodeName = "btnConfirm",
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
NoteSelectCtrl._mapEventConfig = {
|
||||
StarTowerSelectNote = "OnEvent_StarTowerSelectNote",
|
||||
GamepadUIChange = "OnEvent_GamepadUIChange",
|
||||
OpenNoteDepot = "OnEvent_OpenNoteDepot",
|
||||
GamepadUIReopen = "OnEvent_Reopen"
|
||||
}
|
||||
NoteSelectCtrl._mapRedDotConfig = {}
|
||||
local card_item_pos = {
|
||||
[1] = {3},
|
||||
[2] = {-352, 352},
|
||||
[3] = {
|
||||
-552,
|
||||
3,
|
||||
557
|
||||
}
|
||||
}
|
||||
function NoteSelectCtrl:Refresh(nEventId, tbNoteList, mapNoteSelect)
|
||||
self._mapNode.btnConfirm.gameObject:SetActive(false)
|
||||
if mapNoteSelect == nil or #mapNoteSelect == 0 then
|
||||
printError("音符选择列表为空!!!")
|
||||
return
|
||||
end
|
||||
self.nEventId = nEventId
|
||||
self.nSelectIdx = 0
|
||||
self:RefreshNoteSelect(mapNoteSelect)
|
||||
end
|
||||
function NoteSelectCtrl:RefreshNoteSelect(mapNoteSelect)
|
||||
self.tbNoteSelect = mapNoteSelect
|
||||
local tbBtnObj = {}
|
||||
local posCfg = card_item_pos[#mapNoteSelect]
|
||||
for k, v in ipairs(self._mapNode.noteCardItem) do
|
||||
self._mapNode.btnNote[k].gameObject:SetActive(self.tbNoteSelect[k] ~= nil)
|
||||
if self.tbNoteSelect[k] ~= nil then
|
||||
local posY = self._mapNode.rtBtnNote[k].anchoredPosition.y
|
||||
self._mapNode.rtBtnNote[k].anchoredPosition = Vector2(posCfg[k], posY)
|
||||
v:SetNoteCardItem(self.tbNoteSelect[k].Idx, self.tbNoteSelect[k].List, self.tbShowNote)
|
||||
table.insert(tbBtnObj, self._mapNode.btnNote[k])
|
||||
end
|
||||
end
|
||||
self:ResetSelect(tbBtnObj)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.5)
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_phonograph_pop")
|
||||
end
|
||||
function NoteSelectCtrl:RefreshNoteList(tbNoteList)
|
||||
self.tbNoteList = clone(tbNoteList)
|
||||
for k, v in ipairs(self._mapNode.goNoteItem) do
|
||||
local nNoteId = self.tbShowNote[k]
|
||||
local nCount = self.tbNoteList[nNoteId] or 0
|
||||
v:Init(nCount)
|
||||
end
|
||||
end
|
||||
function NoteSelectCtrl:ResetNoteFx()
|
||||
for k, v in ipairs(self._mapNode.goNoteItem) do
|
||||
v:ResetNoteFx()
|
||||
end
|
||||
end
|
||||
function NoteSelectCtrl:SelectComplete(nEventId, tbNoteList, mapNoteSelect)
|
||||
if nEventId == nil or nEventId == 0 then
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
EventManager.Hit("StarTowerSetButtonEnable", true, false)
|
||||
for _, v in ipairs(self._mapNode.noteCardItem) do
|
||||
v:PlayAnim("NoteCard_out")
|
||||
end
|
||||
local nAnimLen = NovaAPI.GetAnimClipLength(self._mapNode.animRoot, {
|
||||
"NoteSelect_out"
|
||||
})
|
||||
self._mapNode.animRoot:Play("NoteSelect_out")
|
||||
self:AddTimer(1, nAnimLen, function()
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
self:HidePanel()
|
||||
if nil ~= self.callback then
|
||||
self.callback(-1, nEventId)
|
||||
end
|
||||
end, true, true, true, nil)
|
||||
else
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
local nAnimLen = 0
|
||||
for _, v in ipairs(self._mapNode.noteCardItem) do
|
||||
nAnimLen = v:PlayAnim("NoteCard_out")
|
||||
end
|
||||
self:AddTimer(1, nAnimLen, function()
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
self:Refresh(nEventId, tbNoteList, mapNoteSelect)
|
||||
end, true, true, true, nil)
|
||||
end
|
||||
end
|
||||
function NoteSelectCtrl:MoveConfirmButton(btnCard)
|
||||
local rtBtn = btnCard:GetComponent("RectTransform")
|
||||
self._mapNode.rtBtnConfirm.anchoredPosition = Vector2(rtBtn.anchoredPosition.x, self.btnConfirmPosY)
|
||||
if self._mapNode.btnConfirm.gameObject.activeSelf == false then
|
||||
self._mapNode.btnConfirm.gameObject:SetActive(true)
|
||||
else
|
||||
local animCtrl = self._mapNode.btnConfirm.transform:Find("AnimRoot"):GetComponent("Animator")
|
||||
animCtrl:Play("btnConfirm_in", 0, 0)
|
||||
end
|
||||
end
|
||||
function NoteSelectCtrl:ReopenPanel()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
EventManager.Hit("SetStarTowerNoteTop", true)
|
||||
self._mapNode.blurBg.gameObject:SetActive(true)
|
||||
local nSelect = self.nSelectIdx ~= 0 and self.nSelectIdx or 1
|
||||
GamepadUIManager.SetSelectedUI(self._mapNode.btnNote[nSelect].gameObject)
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
CS.GameCameraStackManager.Instance:CloseMainCamera(0.1)
|
||||
self._mapNode.contentRoot.gameObject:SetActive(true)
|
||||
if self.nSelectIdx == 0 and GamepadUIManager.GetCurUIType() ~= AllEnum.GamepadUIType.Other then
|
||||
self.nSelectIdx = 1
|
||||
self:MoveConfirmButton(self._mapNode.btnNote[self.nSelectIdx])
|
||||
end
|
||||
if self.nSelectIdx ~= 0 then
|
||||
local cardItem = self._mapNode.noteCardItem[self.nSelectIdx]
|
||||
cardItem:PlayAnim("NoteCard_select")
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function NoteSelectCtrl:HidePanel()
|
||||
self.bOpen = false
|
||||
PanelManager.InputEnable()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", true, true)
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
CS.GameCameraStackManager.Instance:OpenMainCamera()
|
||||
NovaAPI.SetCanvasSortingOrder(self.canvas, self.nInitSortingOrder)
|
||||
EventManager.Hit("SetStarTowerNoteTop", false)
|
||||
GamepadUIManager.DisableGamepadUI("NoteSelectCtrl")
|
||||
end
|
||||
function NoteSelectCtrl:Awake()
|
||||
self.bOpen = false
|
||||
self.canvas = self.gameObject:GetComponent("Canvas")
|
||||
self.nInitSortingOrder = NovaAPI.GetCanvasSortingOrder(self.canvas)
|
||||
self.btnConfirmPosY = self._mapNode.rtBtnConfirm.anchoredPosition.y
|
||||
self.tbShowNote = {}
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
end
|
||||
function NoteSelectCtrl:OnEnable()
|
||||
self.handler = {}
|
||||
for k, v in ipairs(self._mapNode.btnNote) do
|
||||
self.handler[k] = ui_handler(self, self.OnBtnClick_Note, v, k)
|
||||
v.onSelect:AddListener(self.handler[k])
|
||||
end
|
||||
end
|
||||
function NoteSelectCtrl:OnDisable()
|
||||
for k, v in ipairs(self._mapNode.btnNote) do
|
||||
v.onSelect:RemoveListener(self.handler[k])
|
||||
end
|
||||
end
|
||||
function NoteSelectCtrl:OnBtnClick_Depot()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
CS.GameCameraStackManager.Instance:OpenMainCamera()
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
EventManager.Hit(EventId.StarTowerDepot, AllEnum.StarTowerDepotTog.Note)
|
||||
end
|
||||
function NoteSelectCtrl:OnBtnClick_Confirm()
|
||||
if self.nSelectIdx ~= 0 and self.callback ~= nil then
|
||||
local cardItem = self._mapNode.noteCardItem[self.nSelectIdx]
|
||||
local nAnimLen = cardItem:PlayAnim("NoteCard_give")
|
||||
self:AddTimer(1, nAnimLen, function()
|
||||
local completeFunc = function(nEventId, tbNoteList, mapNoteSelect)
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
self:SelectComplete(nEventId, tbNoteList, mapNoteSelect)
|
||||
end
|
||||
self.callback(self.nSelectIdx, self.nEventId, completeFunc)
|
||||
end, true, true, true, nil)
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
self._mapNode.btnConfirm.gameObject:SetActive(false)
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_phonograph_confirm")
|
||||
end
|
||||
end
|
||||
function NoteSelectCtrl:OnBtnClick_Note(btn, nIndex)
|
||||
if nil == self.tbNoteSelect[nIndex] or nIndex == self.nSelectIdx then
|
||||
return
|
||||
end
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_xintiao_slide")
|
||||
self:MoveConfirmButton(btn)
|
||||
if self.nSelectIdx ~= 0 then
|
||||
local lastItem = self._mapNode.noteCardItem[self.nSelectIdx]
|
||||
lastItem:PlayAnim("NoteCard_unselect")
|
||||
end
|
||||
local cardItem = self._mapNode.noteCardItem[nIndex]
|
||||
cardItem:PlayAnim("NoteCard_select")
|
||||
self.nSelectIdx = nIndex
|
||||
end
|
||||
function NoteSelectCtrl:OnEvent_RefreshNoteCount(tbNoteList)
|
||||
if self._mapNode.contentRoot.gameObject.activeSelf == false or self.tbNoteList == nil then
|
||||
return
|
||||
end
|
||||
local tbChange = {}
|
||||
for k, v in pairs(tbNoteList) do
|
||||
if v ~= self.tbNoteList[k] then
|
||||
tbChange[k] = v - self.tbNoteList[k]
|
||||
end
|
||||
end
|
||||
for k, v in ipairs(self._mapNode.goNoteItem) do
|
||||
local nNoteId = self.tbShowNote[k]
|
||||
local nCount = tbChange[nNoteId] or 0
|
||||
if 0 < nCount then
|
||||
v:PlayChangeAnim()
|
||||
end
|
||||
end
|
||||
if next(tbChange) ~= nil then
|
||||
self._mapNode.animNoteLine:Play("Noteline_burst", 0, 0)
|
||||
end
|
||||
end
|
||||
function NoteSelectCtrl:OnEvent_StarTowerSelectNote(nEventId, tbNoteList, mapNoteSelect, callback)
|
||||
self._panel:SetTop(self.canvas)
|
||||
local bCloseCamera = false
|
||||
if not self.bOpen then
|
||||
PanelManager.InputDisable()
|
||||
bCloseCamera = true
|
||||
GamepadUIManager.EnableGamepadUI("NoteSelectCtrl", self.tbGamepadUINode)
|
||||
end
|
||||
self.bOpen = true
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
EventManager.Hit("SetStarTowerNoteTop", true)
|
||||
self.nSelectIdx = 0
|
||||
self.tbNoteSelect = {}
|
||||
self.callback = callback
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(true)
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
if bCloseCamera then
|
||||
CS.GameCameraStackManager.Instance:CloseMainCamera(0.1)
|
||||
end
|
||||
self._mapNode.contentRoot.gameObject:SetActive(true)
|
||||
self._mapNode.animRoot:Play("NoteSelect_in")
|
||||
self:Refresh(nEventId, tbNoteList, mapNoteSelect)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function NoteSelectCtrl:OnEvent_GamepadUIChange(sName, nBeforeType, nAfterType)
|
||||
if sName ~= "NoteSelectCtrl" then
|
||||
return
|
||||
end
|
||||
if nBeforeType == AllEnum.GamepadUIType.Other or nBeforeType == AllEnum.GamepadUIType.Mouse then
|
||||
local nSelect = self.nSelectIdx ~= 0 and self.nSelectIdx or 1
|
||||
GamepadUIManager.SetSelectedUI(self._mapNode.btnNote[nSelect].gameObject)
|
||||
end
|
||||
end
|
||||
function NoteSelectCtrl:OnEvent_Reopen(sName)
|
||||
if sName ~= "NoteSelectCtrl" then
|
||||
return
|
||||
end
|
||||
self:ReopenPanel()
|
||||
end
|
||||
function NoteSelectCtrl:ResetSelect(tbUI)
|
||||
GamepadUIManager.SetNavigation(tbUI)
|
||||
local nUIType = GamepadUIManager.GetCurUIType()
|
||||
if nUIType ~= AllEnum.GamepadUIType.Other then
|
||||
local animTime = NovaAPI.GetAnimClipLength(self._mapNode.animRoot, {
|
||||
"NoteSelect_in"
|
||||
})
|
||||
self:AddTimer(1, animTime, function()
|
||||
self.nSelectIdx = 1
|
||||
self:MoveConfirmButton(self._mapNode.btnNote[self.nSelectIdx])
|
||||
self._mapNode.noteCardItem[self.nSelectIdx]:PlayAnim("NoteCard_select")
|
||||
GamepadUIManager.SetSelectedUI(self._mapNode.btnNote[self.nSelectIdx].gameObject)
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
function NoteSelectCtrl:OnEvent_OpenNoteDepot()
|
||||
if self._mapNode.contentRoot.gameObject.activeSelf == false then
|
||||
return
|
||||
end
|
||||
self.bNoteDepotOpen = true
|
||||
CS.GameCameraStackManager.Instance:OpenMainCamera()
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
end
|
||||
return NoteSelectCtrl
|
||||
@@ -0,0 +1,151 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local NPCFavorLevelUpCtrl = class("NPCFavorLevelUpCtrl", BaseCtrl)
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
NPCFavorLevelUpCtrl._mapNodeConfig = {
|
||||
trActor2D_PNG = {
|
||||
sNodeName = "----Actor2D_PNG----",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
aniActor2D_PNG = {
|
||||
sNodeName = "----Actor2D_PNG----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
got_fullscreen_blur_black = {
|
||||
sNodeName = "t_fullscreen_blur_black",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
btnsnapshot = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtn_ClickClose"
|
||||
},
|
||||
rtBg = {
|
||||
sNodeName = "goBg",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
goLevelUp = {},
|
||||
TMPRewardTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "NPCFavor_LevelUp_RewardTitle"
|
||||
},
|
||||
affinityLevel = {
|
||||
sCtrlName = "Game.UI.StarTower.NpcAffinityLevelUp.TemplateAffinityLevelCtrl"
|
||||
},
|
||||
affinityLevelBefore = {
|
||||
sCtrlName = "Game.UI.StarTower.NpcAffinityLevelUp.TemplateAffinityLevelCtrl"
|
||||
},
|
||||
trContent = {
|
||||
sNodeName = "--Content--",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
btnSkipAnim = {
|
||||
sNodeName = "btnSkipAnim",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_SkipAnim"
|
||||
},
|
||||
aniSafeRoot = {
|
||||
sNodeName = "----SafeRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
goSafeRoot = {
|
||||
sNodeName = "----SafeRoot----",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
rtItem = {
|
||||
sNodeName = "tc_item_",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl",
|
||||
nCount = 3
|
||||
},
|
||||
btnItem = {
|
||||
sComponentName = "UIButton",
|
||||
nCount = 3,
|
||||
callback = "OnBtn_ClickItem"
|
||||
}
|
||||
}
|
||||
NPCFavorLevelUpCtrl._mapEventConfig = {}
|
||||
function NPCFavorLevelUpCtrl:Awake()
|
||||
end
|
||||
function NPCFavorLevelUpCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
self.tbLevelUpList = tbParam[1]
|
||||
self.closeCallback = tbParam[2]
|
||||
self._mapNode.got_fullscreen_blur_black:SetActive(true)
|
||||
self:RefreshPanel()
|
||||
end
|
||||
function NPCFavorLevelUpCtrl:RefreshPanel(bNext)
|
||||
if bNext == nil then
|
||||
end
|
||||
if self.tbLevelUpList ~= nil and #self.tbLevelUpList > 0 then
|
||||
local data = table.remove(self.tbLevelUpList, 1)
|
||||
self.curNPCId = data.NPCId
|
||||
self.affinityLevel = data.affinityLevel
|
||||
self.affinityLevelBefore = data.affinityLevelBefore
|
||||
self.tbItem = data.Items
|
||||
end
|
||||
self._mapNode.aniSafeRoot.speed = 1
|
||||
self._mapNode.aniActor2D_PNG.speed = 1
|
||||
self._mapNode.goSafeRoot:SetActive(true)
|
||||
CS.WwiseAudioManager.Instance:PostEvent("ui_charInfo_favour_up")
|
||||
local nSkinId = ConfigTable.GetData("StarTowerNPC", self.curNPCId).NPCSkin
|
||||
if not bNext then
|
||||
self._mapNode.aniSafeRoot:Play("NpcFavourLevelUpPanel_in")
|
||||
else
|
||||
self._mapNode.aniSafeRoot:Play("NpcFavourLevelUpPanel_Next_in")
|
||||
end
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
Actor2DManager.SetBoardNPC2D_PNG(self._mapNode.trActor2D_PNG, PanelId.NPCAffinityLevelUp, self.curNPCId, nSkinId)
|
||||
if not bNext then
|
||||
self._mapNode.aniActor2D_PNG:Play("Actor2D_PNG_NpcFavour")
|
||||
else
|
||||
self._mapNode.aniActor2D_PNG:Play("Actor2D_PNG_NpcFavour_in")
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
self._mapNode.affinityLevel:SetInfo(self.affinityLevel, self.curNPCId)
|
||||
self._mapNode.affinityLevelBefore:SetInfo(self.affinityLevelBefore, self.curNPCId)
|
||||
for i = 1, 3 do
|
||||
if self.tbItem[i] ~= nil then
|
||||
self._mapNode.btnItem[i].gameObject:SetActive(true)
|
||||
self._mapNode.rtItem[i]:SetItem(self.tbItem[i].Tid, nil, self.tbItem[i].Qty)
|
||||
else
|
||||
self._mapNode.btnItem[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
self._mapNode.btnSkipAnim.gameObject:SetActive(true)
|
||||
end
|
||||
function NPCFavorLevelUpCtrl:OnBtn_SkipAnim()
|
||||
self._mapNode.aniSafeRoot.speed = 1000
|
||||
self._mapNode.aniActor2D_PNG.speed = 1000
|
||||
self._mapNode.btnSkipAnim.gameObject:SetActive(false)
|
||||
end
|
||||
function NPCFavorLevelUpCtrl:OnBtn_ClickClose()
|
||||
if self.bClose == true then
|
||||
return
|
||||
end
|
||||
if self.tbLevelUpList ~= nil and #self.tbLevelUpList > 0 then
|
||||
self:RefreshPanel(true)
|
||||
return
|
||||
end
|
||||
self.bClose = true
|
||||
local WaitAnim = function()
|
||||
if self.closeCallback ~= nil then
|
||||
self.closeCallback()
|
||||
end
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.NPCAffinityLevelUp)
|
||||
end
|
||||
self._mapNode.aniSafeRoot.speed = 1
|
||||
self._mapNode.aniActor2D_PNG.speed = 1
|
||||
self._mapNode.aniActor2D_PNG:Play("Actor2D_PNG_NpcFavour_Out")
|
||||
self._mapNode.aniSafeRoot:Play("NpcFavourLevelUpPanel_Next_out")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.35)
|
||||
self:AddTimer(1, 0.35, WaitAnim, true, true, true)
|
||||
end
|
||||
function NPCFavorLevelUpCtrl:OnBtn_ClickItem(btn, nIdx)
|
||||
if self.tbItem[nIdx] == nil then
|
||||
return
|
||||
end
|
||||
UTILS.ClickItemGridWithTips(self.tbItem[nIdx].Tid, btn.transform, false, true, false)
|
||||
end
|
||||
return NPCFavorLevelUpCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local NPCFavorLevelUpPanel = class("NPCFavorLevelUpPanel", BasePanel)
|
||||
NPCFavorLevelUpPanel._bIsMainPanel = false
|
||||
NPCFavorLevelUpPanel._sSortingLayerName = AllEnum.SortingLayerName.UI_Top
|
||||
NPCFavorLevelUpPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "StarTower/NPCFavourLevelUpPanel.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.NpcAffinityLevelUp.NPCFavorLevelUpCtrl"
|
||||
}
|
||||
}
|
||||
function NPCFavorLevelUpPanel:Awake()
|
||||
end
|
||||
function NPCFavorLevelUpPanel:OnEnable()
|
||||
end
|
||||
function NPCFavorLevelUpPanel:OnDisable()
|
||||
end
|
||||
function NPCFavorLevelUpPanel:OnDestroy()
|
||||
end
|
||||
function NPCFavorLevelUpPanel:OnRelease()
|
||||
end
|
||||
return NPCFavorLevelUpPanel
|
||||
@@ -0,0 +1,19 @@
|
||||
local TemplateAffinityLevelCtrl = class("TemplateAffinityLevelCtrl", BaseCtrl)
|
||||
TemplateAffinityLevelCtrl._mapNodeConfig = {
|
||||
imgHeart = {sComponentName = "Image"},
|
||||
txtLevel = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
TemplateAffinityLevelCtrl._mapEventConfig = {}
|
||||
function TemplateAffinityLevelCtrl:SetInfo(nLevel, NpcId)
|
||||
local mapNpc = ConfigTable.GetData("StarTowerNPC", NpcId)
|
||||
if mapNpc ~= nil then
|
||||
local nGroupId = mapNpc.AffinityGroupId
|
||||
local nId = nGroupId * 100 + nLevel
|
||||
local mapAffinityCfgData = ConfigTable.GetData("NPCAffinityGroup", nId)
|
||||
if mapAffinityCfgData ~= nil then
|
||||
self:SetPngSprite(self._mapNode.imgHeart, mapAffinityCfgData.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, nLevel)
|
||||
end
|
||||
end
|
||||
end
|
||||
return TemplateAffinityLevelCtrl
|
||||
@@ -0,0 +1,696 @@
|
||||
local NpcOptionCtrl = class("NpcOptionCtrl", BaseCtrl)
|
||||
local Path = require("path")
|
||||
local Offset = CS.Actor2DOffsetData
|
||||
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
|
||||
local ResTypeAny = GameResourceLoader.ResType.Any
|
||||
local ResType = GameResourceLoader.ResType
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
NpcOptionCtrl._mapNodeConfig = {
|
||||
goBlur = {sNodeName = "blurBg"},
|
||||
imgMask = {},
|
||||
goContent = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
TMPChoose = {nCount = 4, sComponentName = "TMP_Text"},
|
||||
TMPChooseDisable = {nCount = 4, sComponentName = "TMP_Text"},
|
||||
TMPFuncDisable = {nCount = 4, sComponentName = "TMP_Text"},
|
||||
TMPFunc = {nCount = 4, sComponentName = "TMP_Text"},
|
||||
TMP_Title = {sComponentName = "TMP_Text"},
|
||||
imgBgDisable = {nCount = 4},
|
||||
imgIconLeave = {nCount = 4},
|
||||
imgIconEnable = {nCount = 4},
|
||||
rtChoice = {nCount = 4, sNodeName = "rtChoose"},
|
||||
btnChoose = {
|
||||
nCount = 4,
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Select"
|
||||
},
|
||||
Select = {nCount = 4},
|
||||
imgBody = {sComponentName = "Image"},
|
||||
imgFace = {sComponentName = "Image"},
|
||||
imgFunc = {nCount = 4},
|
||||
rtCharacter = {},
|
||||
rtPanel = {},
|
||||
rtSelect = {},
|
||||
canvasSelect = {
|
||||
sNodeName = "rtSelectOption",
|
||||
sComponentName = "Canvas"
|
||||
},
|
||||
rtTitle = {sComponentName = "Canvas"},
|
||||
rtTalk = {},
|
||||
imgTalkNameBg = {sComponentName = "Image"},
|
||||
rubyTmp_Talk = {
|
||||
sComponentName = "RubyTextMeshProUGUI"
|
||||
},
|
||||
txtName_Talk = {sComponentName = "TMP_Text"},
|
||||
btnTalk = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Talk"
|
||||
},
|
||||
btnShortcutTalk = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Talk"
|
||||
},
|
||||
animWaiting = {
|
||||
sNodeName = "goWaitingAnim",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
sv_Dialog_1L = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Talk"
|
||||
},
|
||||
ainPanel = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
TMPShowTitle = {sComponentName = "TMP_Text"},
|
||||
ButtonBack = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtn_Close"
|
||||
},
|
||||
btnBag = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtn_Depot"
|
||||
},
|
||||
BtnBg = {},
|
||||
imgCoinBg = {},
|
||||
imgCoin = {sComponentName = "Image"},
|
||||
txtCoinCount = {sComponentName = "TMP_Text"},
|
||||
ActionBar = {
|
||||
sCtrlName = "Game.UI.ActionBar.ActionBarCtrl"
|
||||
},
|
||||
goAllNoteList = {
|
||||
sNodeName = "goNoteListBtn"
|
||||
},
|
||||
btnNoteDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_NoteDetail"
|
||||
},
|
||||
goNoteListBtn = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_NoteDetail"
|
||||
},
|
||||
imgNote = {sComponentName = "Image", nCount = 9}
|
||||
}
|
||||
NpcOptionCtrl._mapEventConfig = {
|
||||
RefreshStarTowerCoin = "OnEvent_SetCoin",
|
||||
GamepadUIChange = "OnEvent_GamepadUIChange",
|
||||
GamepadUIReopen = "OnEvent_Reopen"
|
||||
}
|
||||
NpcOptionCtrl._mapRedDotConfig = {}
|
||||
function NpcOptionCtrl:Awake()
|
||||
self.PanelOffset = Vector3.zero
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
self.nCoin = 0
|
||||
self:SetSprite_Coin(self._mapNode.imgCoin, AllEnum.CoinItemId.FixedRogCurrency)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, self.nCoin)
|
||||
end
|
||||
function NpcOptionCtrl:FadeIn()
|
||||
end
|
||||
function NpcOptionCtrl:FadeOut()
|
||||
end
|
||||
function NpcOptionCtrl:OnEnable()
|
||||
self.bShowNote = false
|
||||
self._mapNode.goAllNoteList.gameObject:SetActive(false)
|
||||
self.nSelectIdx = 0
|
||||
self.nNoteEventId = 0
|
||||
self._mapNode.rtPanel.transform.localPosition = self.PanelOffset
|
||||
PanelManager.InputDisable()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
GamepadUIManager.EnableGamepadUI("NpcOptionCtrl", self.tbGamepadUINode)
|
||||
local canvas = self.gameObject:GetComponent("Canvas")
|
||||
local nInitSortingOrder = NovaAPI.GetCanvasSortingOrder(canvas)
|
||||
NovaAPI.SetCanvasSortingOrder(self._mapNode.canvasSelect, nInitSortingOrder + 10)
|
||||
local nId = CS.UnityEngine.SortingLayer.NameToID(AllEnum.SortingLayerName.UI)
|
||||
NovaAPI.SetCanvasSortingId(self._mapNode.canvasSelect, nId)
|
||||
NovaAPI.SetCanvasSortingId(self._mapNode.rtTitle, nId)
|
||||
NovaAPI.SetCanvasSortingOrder(self._mapNode.rtTitle, nInitSortingOrder + 10)
|
||||
local tbParams = self:GetPanelParam()
|
||||
if type(tbParams) == "table" then
|
||||
self.nType = tbParams[1]
|
||||
local nEventId = tbParams[2]
|
||||
local tbNpcOption = tbParams[3]
|
||||
local nNpcSkinId = tbParams[4]
|
||||
self.callback = tbParams[5]
|
||||
self.bUnabledIdx = tbParams[6]
|
||||
local tableEventId = tbParams[7]
|
||||
local nTalkId = tbParams[8]
|
||||
self.nEventAction = tbParams[9]
|
||||
self.bOnlyTalk = tbParams[10]
|
||||
self.bSweep = tbParams[11]
|
||||
self.nCoin = tbParams[12]
|
||||
self.nStarTowerId = tbParams[13]
|
||||
self.tbNote = tbParams[14]
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, self:ThousandsNumber(self.nCoin))
|
||||
self._mapNode.imgMask.gameObject:SetActive(false)
|
||||
self._mapNode.goContent.gameObject:SetActive(false)
|
||||
self._mapNode.goBlur.gameObject:SetActive(true)
|
||||
canvas.enabled = false
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
NovaAPI.UIEffectSnapShotCapture(self._mapNode.goSnapShot)
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
canvas.enabled = true
|
||||
self._mapNode.imgMask.gameObject:SetActive(true)
|
||||
self._mapNode.goContent.gameObject:SetActive(true)
|
||||
if self.bOnlyTalk then
|
||||
self:RefreshTalkOnly(nNpcSkinId, nTalkId)
|
||||
elseif self.nType == 1 then
|
||||
self:Refresh(nEventId, tableEventId, tbNpcOption, self.bUnabledIdx, nNpcSkinId, nTalkId, self.nEventAction)
|
||||
else
|
||||
self:RefreshHighDanger(nEventId, nNpcSkinId, nTalkId)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
self.handler = {}
|
||||
for k, v in ipairs(self._mapNode.btnChoose) do
|
||||
self.handler[k] = ui_handler(self, self.OnBtnSelect_Select, v, k)
|
||||
v.onSelect:AddListener(self.handler[k])
|
||||
end
|
||||
end
|
||||
function NpcOptionCtrl:Refresh(nCaseId, nEventId, tbNpcOption, tbUnselect, nNpcSkinId, nTalkId, nActionId)
|
||||
local mapTalkData
|
||||
if 0 < nTalkId then
|
||||
mapTalkData = ConfigTable.GetData("StarTowerTalk", nTalkId)
|
||||
end
|
||||
for i = 1, 4 do
|
||||
self._mapNode.imgFunc[i]:SetActive(true)
|
||||
end
|
||||
local sFace = "002"
|
||||
if mapTalkData ~= nil then
|
||||
sFace = mapTalkData.Face
|
||||
local _b, _color = ColorUtility.TryParseHtmlString(mapTalkData.Color)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgTalkNameBg, _color)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName_Talk, mapTalkData.Name)
|
||||
NovaAPI.SetText_RubyTMP(self._mapNode.rubyTmp_Talk, mapTalkData.Content)
|
||||
self._mapNode.ainPanel:Play("NpcOptionTalk_in")
|
||||
WwiseAudioMgr:WwiseVoice_PlayInAVG(mapTalkData.Voice)
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_event_enter")
|
||||
self._mapNode.BtnBg:SetActive(false)
|
||||
self:SetCoinActive(false)
|
||||
self:SelectTalk()
|
||||
else
|
||||
if self.nType == 1 then
|
||||
self._mapNode.ainPanel:Play("NpcOptionSelect_in")
|
||||
else
|
||||
self._mapNode.ainPanel:Play("NpcOptionSelectRed_in")
|
||||
end
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_event_dialog")
|
||||
self._mapNode.BtnBg:SetActive(true)
|
||||
self:SetCoinActive(true)
|
||||
end
|
||||
self.nNoteEventId = nEventId
|
||||
self.nEventId = nCaseId
|
||||
if tbNpcOption == nil then
|
||||
printError("Npc事件为空")
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.NpcOptionPanel)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
return
|
||||
end
|
||||
local tbBtnObj = {}
|
||||
local bFirst = true
|
||||
local mapEventAction
|
||||
self._mapNode.TMPShowTitle:SetText("")
|
||||
if nActionId ~= 0 then
|
||||
mapEventAction = ConfigTable.GetData("StarTowerEventAction", nActionId)
|
||||
if mapEventAction ~= nil then
|
||||
self._mapNode.TMPShowTitle:SetText(mapEventAction.Desc)
|
||||
end
|
||||
end
|
||||
for i = 1, 4 do
|
||||
self._mapNode.TMPChoose[i]:SetText("")
|
||||
self._mapNode.TMPChooseDisable[i]:SetText("")
|
||||
if tbNpcOption[i] ~= nil then
|
||||
local mapResultCfgData = ConfigTable.GetData("EventOptions", tbNpcOption[i])
|
||||
if mapResultCfgData == nil then
|
||||
printError("ResultCfgData Missing:" .. tbNpcOption[i])
|
||||
self._mapNode.rtChoice[i]:SetActive(false)
|
||||
else
|
||||
if mapEventAction ~= nil then
|
||||
local nOptionActionId = tbNpcOption[i] * 10000 + mapEventAction.Group
|
||||
local mapOptionAction = ConfigTable.GetData("StarTowerEventOptionAction", nOptionActionId)
|
||||
if mapOptionAction ~= nil then
|
||||
self._mapNode.TMPChoose[i]:SetText(mapOptionAction.Desc)
|
||||
self._mapNode.TMPChooseDisable[i]:SetText(mapOptionAction.Desc)
|
||||
end
|
||||
end
|
||||
self._mapNode.TMPFunc[i]:SetText(mapResultCfgData.Desc)
|
||||
self._mapNode.TMPFuncDisable[i]:SetText(mapResultCfgData.Desc)
|
||||
if 0 < table.indexof(tbUnselect, i - 1) then
|
||||
self._mapNode.imgBgDisable[i]:SetActive(true)
|
||||
self._mapNode.btnChoose[i].interactable = false
|
||||
else
|
||||
self._mapNode.imgBgDisable[i]:SetActive(false)
|
||||
self._mapNode.btnChoose[i].interactable = true
|
||||
if bFirst then
|
||||
bFirst = false
|
||||
self.nSelectIdx = i
|
||||
end
|
||||
table.insert(tbBtnObj, self._mapNode.btnChoose[i])
|
||||
end
|
||||
self._mapNode.imgIconLeave[i]:SetActive(mapResultCfgData.IgnoreInterActive)
|
||||
self._mapNode.imgIconEnable[i]:SetActive(not mapResultCfgData.IgnoreInterActive)
|
||||
self._mapNode.rtChoice[i]:SetActive(true)
|
||||
self._mapNode.Select[i]:SetActive(false)
|
||||
end
|
||||
else
|
||||
self._mapNode.rtChoice[i]:SetActive(false)
|
||||
end
|
||||
end
|
||||
GamepadUIManager.SetNavigation(tbBtnObj, false)
|
||||
if mapTalkData == nil then
|
||||
self:SelectChoose()
|
||||
end
|
||||
local GetName = function(sPortrait, Face)
|
||||
local sFileFullName = Path.basename(sPortrait)
|
||||
local sFileExtName = Path.extension(sPortrait)
|
||||
local sFileName = string.gsub(sFileFullName, sFileExtName, "")
|
||||
sFileName = string.gsub(sFileName, "_a", "")
|
||||
local sBodyName = string.format("%s_%s", sFileName, "001")
|
||||
local sFaceName = string.format("%s_%s", sFileName, Face)
|
||||
return sBodyName, sFaceName
|
||||
end
|
||||
local GetSprite = function(sPortrait, sName)
|
||||
local _sPath = string.format("%s/atlas_png/a/%s.png", Path.dirname(sPortrait), sName)
|
||||
return self:LoadAsset(_sPath, typeof(Sprite))
|
||||
end
|
||||
local mapSkinData = ConfigTable.GetData("NPCSkin", nNpcSkinId)
|
||||
if mapSkinData == nil then
|
||||
return
|
||||
end
|
||||
local sAssetPath = mapSkinData.Portrait
|
||||
local sBodyName, sFaceName = GetName(sAssetPath, sFace)
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgBody, GetSprite(sAssetPath, sBodyName))
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgFace, GetSprite(sAssetPath, sFaceName))
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local offsetAsset = self:LoadOffset(mapSkinData.Offset)
|
||||
local mapOffset = Actor2DManager.GetMapPanelConfig(PanelId.NpcOptionPanel)
|
||||
local finalReuse = mapOffset.nReuse
|
||||
local s, x, y = offsetAsset:GetOffsetData(finalReuse, 1, true, 0, 0)
|
||||
local v3Pos = Vector3(x * 100, y * 100, 0)
|
||||
local v3Scale = Vector3(s, s, 1)
|
||||
self._mapNode.rtCharacter.transform.localPosition = v3Pos
|
||||
self._mapNode.rtCharacter.transform.localScale = v3Scale
|
||||
if mapEventAction ~= nil then
|
||||
self._mapNode.TMP_Title.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMP_Title, mapEventAction.Desc)
|
||||
else
|
||||
self._mapNode.TMP_Title.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function NpcOptionCtrl:RefreshHighDanger(nEventId, nNpcSkinId, nTalkId)
|
||||
self.nEventId = nEventId
|
||||
self.nSelectIdx = 1
|
||||
local mapTalkData = ConfigTable.GetData("StarTowerTalk", nTalkId)
|
||||
local sFace = "002"
|
||||
if mapTalkData ~= nil then
|
||||
sFace = mapTalkData.Face
|
||||
local _b, _color = ColorUtility.TryParseHtmlString(mapTalkData.Color)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgTalkNameBg, _color)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName_Talk, mapTalkData.Name)
|
||||
NovaAPI.SetText_RubyTMP(self._mapNode.rubyTmp_Talk, mapTalkData.Content)
|
||||
self._mapNode.ainPanel:Play("NpcOptionTalk_in")
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_event_enter")
|
||||
self._mapNode.BtnBg:SetActive(false)
|
||||
self:SetCoinActive(false)
|
||||
self:SelectTalk()
|
||||
else
|
||||
if self.nType == 1 then
|
||||
self._mapNode.ainPanel:Play("NpcOptionSelect_in")
|
||||
else
|
||||
self._mapNode.ainPanel:Play("NpcOptionSelectRed_in")
|
||||
end
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_event_dialog")
|
||||
self._mapNode.BtnBg:SetActive(true)
|
||||
self:SetCoinActive(true)
|
||||
self:SelectChoose()
|
||||
end
|
||||
for i = 1, 4 do
|
||||
self._mapNode.imgFunc[i]:SetActive(false)
|
||||
end
|
||||
self._mapNode.rtChoice[1]:SetActive(true)
|
||||
self._mapNode.rtChoice[2]:SetActive(true)
|
||||
self._mapNode.rtChoice[3]:SetActive(false)
|
||||
self._mapNode.rtChoice[4]:SetActive(false)
|
||||
self._mapNode.TMPChoose[1]:SetText(ConfigTable.GetUIText("StarTower_Npc_EnterHighDanger"))
|
||||
self._mapNode.imgBgDisable[1]:SetActive(false)
|
||||
self._mapNode.imgIconLeave[1]:SetActive(false)
|
||||
self._mapNode.imgIconEnable[1]:SetActive(true)
|
||||
self._mapNode.TMPChoose[2]:SetText(ConfigTable.GetUIText("StarTower_Npc_Leave"))
|
||||
self._mapNode.imgBgDisable[2]:SetActive(false)
|
||||
self._mapNode.imgIconLeave[2]:SetActive(true)
|
||||
self._mapNode.imgIconEnable[2]:SetActive(false)
|
||||
for i = 1, 4 do
|
||||
self._mapNode.Select[i]:SetActive(false)
|
||||
end
|
||||
GamepadUIManager.SetNavigation({
|
||||
self._mapNode.btnChoose[1],
|
||||
self._mapNode.btnChoose[2]
|
||||
}, false)
|
||||
local GetName = function(sPortrait, Face)
|
||||
local sFileFullName = Path.basename(sPortrait)
|
||||
local sFileExtName = Path.extension(sPortrait)
|
||||
local sFileName = string.gsub(sFileFullName, sFileExtName, "")
|
||||
sFileName = string.gsub(sFileName, "_a", "")
|
||||
local sBodyName = string.format("%s_%s", sFileName, "001")
|
||||
local sFaceName = string.format("%s_%s", sFileName, Face)
|
||||
return sBodyName, sFaceName
|
||||
end
|
||||
local GetSprite = function(sPortrait, sName)
|
||||
local _sPath = string.format("%s/atlas_png/a/%s.png", Path.dirname(sPortrait), sName)
|
||||
return self:LoadAsset(_sPath, typeof(Sprite))
|
||||
end
|
||||
local mapSkinData = ConfigTable.GetData("NPCSkin", nNpcSkinId)
|
||||
if mapSkinData == nil then
|
||||
return
|
||||
end
|
||||
local sAssetPath = mapSkinData.Portrait
|
||||
local sBodyName, sFaceName = GetName(sAssetPath, sFace)
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgBody, GetSprite(sAssetPath, sBodyName))
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgFace, GetSprite(sAssetPath, sFaceName))
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local offsetAsset = self:LoadOffset(mapSkinData.Offset)
|
||||
local mapOffset = Actor2DManager.GetMapPanelConfig(PanelId.NpcOptionPanel)
|
||||
local finalReuse = mapOffset.nReuse
|
||||
local s, x, y = offsetAsset:GetOffsetData(finalReuse, 1, true, 0, 0)
|
||||
local v3Pos = Vector3(x * 100, y * 100, 0)
|
||||
local v3Scale = Vector3(s, s, 1)
|
||||
self._mapNode.rtCharacter.transform.localPosition = v3Pos
|
||||
self._mapNode.rtCharacter.transform.localScale = v3Scale
|
||||
self._mapNode.TMP_Title.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMP_Title, ConfigTable.GetUIText("StarTower_Npc_EnterHighDangerTitle"))
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_event_enter")
|
||||
end
|
||||
function NpcOptionCtrl:RefreshTalkOnly(nNpcSkinId, nTalkId)
|
||||
local mapTalkData = ConfigTable.GetData("StarTowerTalk", nTalkId)
|
||||
local sFace = "002"
|
||||
if mapTalkData ~= nil then
|
||||
sFace = mapTalkData.Face
|
||||
local _b, _color = ColorUtility.TryParseHtmlString(mapTalkData.Color)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgTalkNameBg, _color)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName_Talk, mapTalkData.Name)
|
||||
NovaAPI.SetText_RubyTMP(self._mapNode.rubyTmp_Talk, mapTalkData.Content)
|
||||
self._mapNode.ainPanel:Play("NpcOptionTalk_in")
|
||||
WwiseAudioMgr:WwiseVoice_PlayInAVG(mapTalkData.Voice)
|
||||
self._mapNode.BtnBg:SetActive(false)
|
||||
self:SetCoinActive(false)
|
||||
self:SelectTalk()
|
||||
else
|
||||
local wait = function()
|
||||
printError("NPC Talk Data Missing:" .. nTalkId)
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.NpcOptionPanel)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
local GetName = function(sPortrait, Face)
|
||||
local sFileFullName = Path.basename(sPortrait)
|
||||
local sFileExtName = Path.extension(sPortrait)
|
||||
local sFileName = string.gsub(sFileFullName, sFileExtName, "")
|
||||
sFileName = string.gsub(sFileName, "_a", "")
|
||||
local sBodyName = string.format("%s_%s", sFileName, "001")
|
||||
local sFaceName = string.format("%s_%s", sFileName, Face)
|
||||
return sBodyName, sFaceName
|
||||
end
|
||||
local GetSprite = function(sPortrait, sName)
|
||||
local _sPath = string.format("%s/atlas_png/a/%s.png", Path.dirname(sPortrait), sName)
|
||||
return self:LoadAsset(_sPath, typeof(Sprite))
|
||||
end
|
||||
local mapSkinData = ConfigTable.GetData("NPCSkin", nNpcSkinId)
|
||||
if mapSkinData == nil then
|
||||
return
|
||||
end
|
||||
local sAssetPath = mapSkinData.Portrait
|
||||
local sBodyName, sFaceName = GetName(sAssetPath, sFace)
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgBody, GetSprite(sAssetPath, sBodyName))
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgFace, GetSprite(sAssetPath, sFaceName))
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local offsetAsset = self:LoadOffset(mapSkinData.Offset)
|
||||
local mapOffset = Actor2DManager.GetMapPanelConfig(PanelId.NpcOptionPanel)
|
||||
local finalReuse = mapOffset.nReuse
|
||||
local s, x, y = offsetAsset:GetOffsetData(finalReuse, 1, true, 0, 0)
|
||||
local v3Pos = Vector3(x * 100, y * 100, 0)
|
||||
local v3Scale = Vector3(s, s, 1)
|
||||
self._mapNode.rtCharacter.transform.localPosition = v3Pos
|
||||
self._mapNode.rtCharacter.transform.localScale = v3Scale
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_event_enter")
|
||||
end
|
||||
function NpcOptionCtrl:RefreshNoteList()
|
||||
self.bShowNote = true
|
||||
self._mapNode.goAllNoteList:SetActive(true)
|
||||
local tbShowNote = {}
|
||||
local mapCfg = ConfigTable.GetData("StarTower", self.nStarTowerId)
|
||||
if mapCfg ~= nil then
|
||||
local nDropGroup = mapCfg.SubNoteSkillDropGroupId
|
||||
local tbNoteDrop = CacheTable.GetData("_SubNoteSkillDropGroup", nDropGroup)
|
||||
if tbNoteDrop ~= nil then
|
||||
for _, v in ipairs(tbNoteDrop) do
|
||||
table.insert(tbShowNote, v.SubNoteSkillId)
|
||||
end
|
||||
end
|
||||
end
|
||||
table.sort(tbShowNote, function(a, b)
|
||||
return a < b
|
||||
end)
|
||||
for k, v in ipairs(self._mapNode.imgNote) do
|
||||
local nNoteId = tbShowNote[k]
|
||||
v.gameObject:SetActive(nNoteId ~= nil)
|
||||
if nNoteId ~= nil then
|
||||
local mapNoteCfg = ConfigTable.GetData("SubNoteSkill", nNoteId)
|
||||
if nil ~= mapNoteCfg then
|
||||
self:SetPngSprite(v, mapNoteCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
end
|
||||
local tmpCount = v.gameObject.transform:Find("txtNoteCount"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(tmpCount, self.tbNote[nNoteId] or 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
function NpcOptionCtrl:SetCoinActive(bActive)
|
||||
self._mapNode.imgCoinBg:SetActive(bActive)
|
||||
end
|
||||
function NpcOptionCtrl:OnDisable()
|
||||
for k, v in ipairs(self._mapNode.btnChoose) do
|
||||
v.onSelect:RemoveListener(self.handler[k])
|
||||
end
|
||||
end
|
||||
function NpcOptionCtrl:OnDestroy()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", true, true)
|
||||
end
|
||||
function NpcOptionCtrl:OnRelease()
|
||||
end
|
||||
function NpcOptionCtrl:ClosePanel(bOnlyTalk, nSelectIdx, nEventId)
|
||||
local callback = function()
|
||||
GamepadUIManager.DisableGamepadUI("NpcOptionCtrl")
|
||||
PanelManager.InputEnable()
|
||||
if self.callback ~= nil and not bOnlyTalk then
|
||||
self.callback(nSelectIdx, nEventId)
|
||||
end
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.NpcOptionPanel)
|
||||
end
|
||||
if bOnlyTalk then
|
||||
self._mapNode.ainPanel:Play("NpcOptionTalk_out")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.4, callback)
|
||||
else
|
||||
if self.nType == 1 then
|
||||
self._mapNode.ainPanel:Play("NpcOptionSelect_out")
|
||||
else
|
||||
self._mapNode.ainPanel:Play("NpcOptionSelectRed_out")
|
||||
end
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.5, callback)
|
||||
end
|
||||
end
|
||||
function NpcOptionCtrl:OnBtn_Close()
|
||||
local callback = function()
|
||||
GamepadUIManager.DisableGamepadUI("NpcOptionCtrl")
|
||||
PanelManager.InputEnable()
|
||||
if self.bSweep and self.callback ~= nil then
|
||||
self.callback(-1, -1, true)
|
||||
end
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.NpcOptionPanel)
|
||||
end
|
||||
if self.nType == 1 then
|
||||
self._mapNode.ainPanel:Play("NpcOptionSelect_out")
|
||||
else
|
||||
self._mapNode.ainPanel:Play("NpcOptionSelectRed_out")
|
||||
end
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.5, callback)
|
||||
end
|
||||
function NpcOptionCtrl:OnBtn_Depot()
|
||||
self.bOpenDepot = true
|
||||
self.gameObject:SetActive(false)
|
||||
local nTog = self.bShowNote and AllEnum.StarTowerDepotTog.DiscSkill or AllEnum.StarTowerDepotTog.Potential
|
||||
EventManager.Hit(EventId.StarTowerDepot, nTog)
|
||||
end
|
||||
function NpcOptionCtrl:OnBtnClick_Select(btn)
|
||||
local nIdx = table.indexof(self._mapNode.btnChoose, btn)
|
||||
if table.indexof(self.bUnabledIdx, nIdx - 1) > 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, "不可选选项")
|
||||
return
|
||||
end
|
||||
self:ClosePanel(false, nIdx, self.nEventId)
|
||||
end
|
||||
function NpcOptionCtrl:OnBtnSelect_Select(btn, nIndex)
|
||||
if self.nSelectIdx == nIndex then
|
||||
return
|
||||
end
|
||||
for k, v in ipairs(self._mapNode.Select) do
|
||||
if k == nIndex then
|
||||
if GamepadUIManager.GetCurUIType() ~= AllEnum.GamepadUIType.Other and GamepadUIManager.GetCurUIType() ~= AllEnum.GamepadUIType.Mouse then
|
||||
v:SetActive(true)
|
||||
else
|
||||
v:SetActive(false)
|
||||
end
|
||||
elseif k == self.nSelectIdx then
|
||||
v:SetActive(false)
|
||||
end
|
||||
end
|
||||
self.nSelectIdx = nIndex
|
||||
end
|
||||
function NpcOptionCtrl:OnBtnClick_NoteDetail()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.NoteSkillInfo, self.tbNote)
|
||||
end
|
||||
function NpcOptionCtrl:OnBtnClick_Talk(btn)
|
||||
self.bSelectTalk = false
|
||||
if self.bOnlyTalk then
|
||||
self:ClosePanel(true)
|
||||
return
|
||||
end
|
||||
if self.nType == 1 then
|
||||
self._mapNode.ainPanel:Play("NpcOptionSelect_in")
|
||||
else
|
||||
self._mapNode.ainPanel:Play("NpcOptionSelectRed_in")
|
||||
end
|
||||
if self.nEventAction ~= 0 then
|
||||
local mapEventAction = ConfigTable.GetData("StarTowerEventAction", self.nEventAction)
|
||||
if mapEventAction ~= nil and mapEventAction.TrigVoice ~= "" then
|
||||
WwiseAudioMgr:WwiseVoice_PlayInAVG(mapEventAction.TrigVoice)
|
||||
end
|
||||
end
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_event_dialog")
|
||||
self._mapNode.BtnBg:SetActive(true)
|
||||
local mapEventCfg = ConfigTable.GetData("StarTowerEvent", self.nNoteEventId)
|
||||
if mapEventCfg ~= nil and mapEventCfg.EventResType == GameEnum.towerEventResType.SubNoteSkill then
|
||||
self:RefreshNoteList()
|
||||
end
|
||||
self:SetCoinActive(true)
|
||||
self:SelectChoose()
|
||||
end
|
||||
function NpcOptionCtrl:LoadOffset(sPath)
|
||||
return self:LoadAsset(sPath, typeof(Offset))
|
||||
end
|
||||
function NpcOptionCtrl:OnEvent_SetCoin(nCount)
|
||||
if nCount then
|
||||
if nCount > self.nCoin then
|
||||
local twCoin = DOTween.To(function()
|
||||
return self.nCoin
|
||||
end, function(v)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, self:ThousandsNumber(math.floor(v)))
|
||||
end, nCount, 1)
|
||||
local _cb = function()
|
||||
self.nCoin = nCount
|
||||
end
|
||||
twCoin.onComplete = dotween_callback_handler(self, _cb)
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, self:ThousandsNumber(nCount))
|
||||
self.nCoin = nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
function NpcOptionCtrl:OnEvent_CloseStarTowerDepot()
|
||||
if self.bOpenDepot then
|
||||
self.bOpenDepot = false
|
||||
local nSelect = self.nSelectIdx ~= 0 and self.nSelectIdx or 1
|
||||
GamepadUIManager.SetSelectedUI(self._mapNode.btnChoose[nSelect].gameObject)
|
||||
self.gameObject:SetActive(true)
|
||||
if self.nType == 1 then
|
||||
self._mapNode.ainPanel:Play("NpcOptionSelect_in")
|
||||
else
|
||||
self._mapNode.ainPanel:Play("NpcOptionSelectRed_in")
|
||||
end
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_event_dialog")
|
||||
self._mapNode.BtnBg:SetActive(true)
|
||||
self:SetCoinActive(true)
|
||||
self:SelectChoose()
|
||||
end
|
||||
end
|
||||
function NpcOptionCtrl:OnEvent_GamepadUIChange(sName, nBeforeType, nAfterType)
|
||||
if sName ~= "NpcOptionCtrl" then
|
||||
return
|
||||
end
|
||||
local bNeedSelect = nBeforeType == AllEnum.GamepadUIType.Other and nAfterType ~= AllEnum.GamepadUIType.Mouse or nBeforeType == AllEnum.GamepadUIType.Mouse and nAfterType ~= AllEnum.GamepadUIType.Other
|
||||
if bNeedSelect then
|
||||
if self.bSelectTalk then
|
||||
GamepadUIManager.SetSelectedUI(self._mapNode.btnShortcutTalk.gameObject)
|
||||
else
|
||||
for k, v in ipairs(self._mapNode.btnChoose) do
|
||||
if k == self.nSelectIdx then
|
||||
self._mapNode.Select[k]:SetActive(true)
|
||||
GamepadUIManager.SetSelectedUI(self._mapNode.btnChoose[self.nSelectIdx].gameObject)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
for k, v in ipairs(self._mapNode.btnChoose) do
|
||||
self._mapNode.Select[k]:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function NpcOptionCtrl:OnEvent_Reopen(sName)
|
||||
if sName ~= "NpcOptionCtrl" then
|
||||
return
|
||||
end
|
||||
self:OnEvent_CloseStarTowerDepot()
|
||||
end
|
||||
function NpcOptionCtrl:SelectTalk()
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.animWaiting:SetTrigger("tManual")
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
local tbConfig = {
|
||||
{
|
||||
sAction = "Confirm",
|
||||
sLang = "ActionBar_NextDialogue"
|
||||
}
|
||||
}
|
||||
self._mapNode.ActionBar:InitActionBar(tbConfig)
|
||||
self.bSelectTalk = true
|
||||
GamepadUIManager.SetSelectedUI(self._mapNode.btnShortcutTalk.gameObject)
|
||||
end
|
||||
function NpcOptionCtrl:SelectChoose()
|
||||
local tbConfig = {
|
||||
{
|
||||
sAction = "Confirm",
|
||||
sLang = "ActionBar_Confirm"
|
||||
},
|
||||
{
|
||||
sAction = "Depot",
|
||||
sLang = "ActionBar_Depot"
|
||||
},
|
||||
{
|
||||
sAction = "Back",
|
||||
sLang = "ActionBar_Back"
|
||||
}
|
||||
}
|
||||
self._mapNode.ActionBar:InitActionBar(tbConfig)
|
||||
local nUIType = GamepadUIManager.GetCurUIType()
|
||||
if nUIType ~= AllEnum.GamepadUIType.Other and nUIType ~= AllEnum.GamepadUIType.Mouse then
|
||||
if self.nSelectIdx ~= 0 then
|
||||
self._mapNode.Select[self.nSelectIdx]:SetActive(true)
|
||||
GamepadUIManager.SetSelectedUI(self._mapNode.btnChoose[self.nSelectIdx].gameObject)
|
||||
end
|
||||
else
|
||||
for k, v in ipairs(self._mapNode.btnChoose) do
|
||||
self._mapNode.Select[k]:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
return NpcOptionCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local NpcOptionPanel = class("NpcOptionPanel", BasePanel)
|
||||
NpcOptionPanel._bIsMainPanel = false
|
||||
NpcOptionPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "StarTower/NpcOptionPanel.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.NpcOption.NpcOptionCtrl"
|
||||
}
|
||||
}
|
||||
function NpcOptionPanel:Awake()
|
||||
end
|
||||
function NpcOptionPanel:OnEnable()
|
||||
end
|
||||
function NpcOptionPanel:OnAfterEnter()
|
||||
end
|
||||
function NpcOptionPanel:OnDisable()
|
||||
end
|
||||
function NpcOptionPanel:OnDestroy()
|
||||
end
|
||||
function NpcOptionPanel:OnRelease()
|
||||
end
|
||||
return NpcOptionPanel
|
||||
@@ -0,0 +1,222 @@
|
||||
local PotentialCardItemCtrl = class("PotentialCardItemCtrl", BaseCtrl)
|
||||
PotentialCardItemCtrl._mapNodeConfig = {
|
||||
db_SSR = {},
|
||||
goPotentialNormal = {},
|
||||
imgRare_Gold = {},
|
||||
imgRare_RainBow = {},
|
||||
goIcon = {
|
||||
sCtrlName = "Game.UI.StarTower.Potential.PotentialIconCtrl"
|
||||
},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
imgCharBg = {},
|
||||
imgCharIcon = {sComponentName = "Image"},
|
||||
imgCharSpBg = {},
|
||||
imgCharSpIcon = {sComponentName = "Image"},
|
||||
Content = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtDesc = {sComponentName = "TMP_Text"},
|
||||
TMP_Link1 = {
|
||||
sNodeName = "txtDesc",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnBtnClick_Word"
|
||||
},
|
||||
txtLevelValue = {sComponentName = "TMP_Text"},
|
||||
txtLevel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Potential_Level"
|
||||
},
|
||||
imgArrow = {},
|
||||
goUpgrade = {},
|
||||
txtUpLevelValue = {sComponentName = "TMP_Text"},
|
||||
goPotentialSpecial = {},
|
||||
imgSpIcon = {sComponentName = "Image"},
|
||||
txtSpName = {sComponentName = "TMP_Text"},
|
||||
SpContent = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtSpDesc = {sComponentName = "TMP_Text"},
|
||||
TMP_Link2 = {
|
||||
sNodeName = "txtSpDesc",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnBtnClick_Word"
|
||||
},
|
||||
animCtrl = {sComponentName = "Animator", sNodeName = "AnimRoot"},
|
||||
imgReommend = {},
|
||||
imgNew = {},
|
||||
txtNew = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Book_New_Text"
|
||||
},
|
||||
N = {},
|
||||
SR = {},
|
||||
SSR = {},
|
||||
BgEffect = {},
|
||||
ArrowEffect = {}
|
||||
}
|
||||
PotentialCardItemCtrl._mapEventConfig = {}
|
||||
PotentialCardItemCtrl._mapRedDotConfig = {}
|
||||
local level_txt_color = {
|
||||
[1] = "#44587f",
|
||||
[2] = "#4e76d4"
|
||||
}
|
||||
function PotentialCardItemCtrl:SetPotentialItem(nTid, nLevel, nNextLevel, bSimpleDesc, bShowChar, nPotentialAddLevel, nShowType, bNew, bLucky)
|
||||
self.nTid = nTid
|
||||
self.nLevel = nLevel
|
||||
self.nNextLevel = nNextLevel
|
||||
self.nShowType = nShowType or AllEnum.PotentialCardType.CharInfo
|
||||
self.nPotentialAddLevel = nPotentialAddLevel or 0
|
||||
self.bLucky = bLucky
|
||||
self._mapNode.imgNew.gameObject:SetActive(bNew)
|
||||
self._mapNode.ArrowEffect:SetActive(self.bLucky)
|
||||
local itemCfg = ConfigTable.GetData_Item(nTid)
|
||||
if nil == itemCfg then
|
||||
printError(string.format("获取道具表配置失败!!!id = [%s])", nTid))
|
||||
return
|
||||
end
|
||||
self.itemCfg = itemCfg
|
||||
local potentialCfg = ConfigTable.GetData("Potential", nTid)
|
||||
if nil == potentialCfg then
|
||||
return
|
||||
end
|
||||
self._mapNode.db_SSR:SetActive(itemCfg.Rarity == GameEnum.itemRarity.SSR)
|
||||
local bSpecial = itemCfg.Stype == GameEnum.itemStype.SpecificPotential
|
||||
self._mapNode.goPotentialNormal.gameObject:SetActive(not bSpecial)
|
||||
self._mapNode.goPotentialSpecial.gameObject:SetActive(bSpecial)
|
||||
if not bSpecial then
|
||||
self:SetNormalCard(itemCfg, potentialCfg, bShowChar)
|
||||
else
|
||||
self:SetSpecialCard(itemCfg, potentialCfg, bShowChar)
|
||||
end
|
||||
self:ChangeDesc(bSimpleDesc)
|
||||
self:ChangeWordRaycast(false)
|
||||
return bSpecial
|
||||
end
|
||||
function PotentialCardItemCtrl:SetNormalCard(itemCfg, potentialCfg, bShowChar)
|
||||
self._mapNode.imgCharBg.gameObject:SetActive(bShowChar)
|
||||
local nCharId = potentialCfg.CharId
|
||||
if bShowChar then
|
||||
local nCharSkinId = PlayerData.Char:GetCharSkinId(nCharId)
|
||||
local mapCharSkin = ConfigTable.GetData_CharacterSkin(nCharSkinId)
|
||||
self:SetPngSprite(self._mapNode.imgCharIcon, mapCharSkin.Icon .. AllEnum.CharHeadIconSurfix.S)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, itemCfg.Title)
|
||||
local nColor = AllEnum.FrameColor_New[itemCfg.Rarity]
|
||||
if nColor == "4" then
|
||||
self._mapNode.imgRare_Gold.gameObject:SetActive(true)
|
||||
self._mapNode.imgRare_RainBow.gameObject:SetActive(false)
|
||||
elseif nColor == "5" then
|
||||
self._mapNode.imgRare_Gold.gameObject:SetActive(false)
|
||||
self._mapNode.imgRare_RainBow.gameObject:SetActive(true)
|
||||
else
|
||||
self._mapNode.imgRare_Gold.gameObject:SetActive(false)
|
||||
self._mapNode.imgRare_RainBow.gameObject:SetActive(false)
|
||||
end
|
||||
self._mapNode.goIcon:SetIcon(potentialCfg.Id)
|
||||
local bUpgrade = self.nNextLevel ~= nil and self.nLevel ~= self.nNextLevel
|
||||
self._mapNode.imgArrow.gameObject:SetActive(bUpgrade)
|
||||
self._mapNode.goUpgrade.gameObject:SetActive(bUpgrade)
|
||||
if self.nPotentialAddLevel > 0 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelValue, self.nLevel .. "<color=#4e76d4>+" .. self.nPotentialAddLevel .. "</color>")
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelValue, self.nLevel)
|
||||
end
|
||||
if bUpgrade then
|
||||
if self.nPotentialAddLevel > 0 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtUpLevelValue, self.nNextLevel .. "<color=#4e76d4>+" .. self.nPotentialAddLevel .. "</color>")
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtUpLevelValue, self.nNextLevel)
|
||||
end
|
||||
end
|
||||
end
|
||||
function PotentialCardItemCtrl:SetSpecialCard(itemCfg, potentialCfg, bShowChar)
|
||||
self._mapNode.imgCharSpBg.gameObject:SetActive(bShowChar)
|
||||
local nCharId = potentialCfg.CharId
|
||||
if bShowChar then
|
||||
local nCharSkinId = PlayerData.Char:GetCharSkinId(nCharId)
|
||||
local mapCharSkin = ConfigTable.GetData_CharacterSkin(nCharSkinId)
|
||||
self:SetPngSprite(self._mapNode.imgCharSpIcon, mapCharSkin.Icon .. AllEnum.CharHeadIconSurfix.S)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSpName, itemCfg.Title)
|
||||
self:SetPngSprite(self._mapNode.imgSpIcon, itemCfg.Icon .. AllEnum.PotentialIconSurfix.A)
|
||||
end
|
||||
function PotentialCardItemCtrl:ChangeDesc(bSimpleDesc)
|
||||
local potentialCfg = ConfigTable.GetData("Potential", self.nTid)
|
||||
if nil == potentialCfg then
|
||||
printError(string.format("获取潜能表配置失败!!!id = [%s])", self.nTid))
|
||||
return
|
||||
end
|
||||
local nLevel = self.nLevel + self.nPotentialAddLevel
|
||||
local nNextLevel
|
||||
if self.nNextLevel ~= nil and self.nNextLevel ~= self.nLevel then
|
||||
nNextLevel = self.nNextLevel + self.nPotentialAddLevel
|
||||
end
|
||||
local nDescLevel
|
||||
if self.nShowType == AllEnum.PotentialCardType.Book or self.nShowType == AllEnum.PotentialCardType.CharInfo then
|
||||
nDescLevel = self.nLevel
|
||||
else
|
||||
nDescLevel = nLevel
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDesc, UTILS.ParseDesc(potentialCfg, GameEnum.levelTypeData.Exclusive, nNextLevel, bSimpleDesc, nDescLevel))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSpDesc, UTILS.ParseDesc(potentialCfg, GameEnum.levelTypeData.Exclusive, nNextLevel, bSimpleDesc, nDescLevel))
|
||||
self._mapNode.Content.anchoredPosition = Vector2(0, 0)
|
||||
self._mapNode.SpContent.anchoredPosition = Vector2(0, 0)
|
||||
end
|
||||
function PotentialCardItemCtrl:ActiveRollEffect()
|
||||
if not self.itemCfg then
|
||||
return
|
||||
end
|
||||
self._mapNode.SSR:SetActive(self.itemCfg.Rarity == GameEnum.itemRarity.SSR)
|
||||
self._mapNode.SR:SetActive(self.itemCfg.Rarity == GameEnum.itemRarity.SR)
|
||||
self._mapNode.N:SetActive(self.itemCfg.Rarity == GameEnum.itemRarity.N)
|
||||
end
|
||||
function PotentialCardItemCtrl:CloseBgEffect()
|
||||
self._mapNode.BgEffect:SetActive(false)
|
||||
end
|
||||
function PotentialCardItemCtrl:PlayAnim(sAnimName)
|
||||
self._mapNode.animCtrl:Play(sAnimName)
|
||||
self._mapNode.BgEffect:SetActive(self.bLucky and sAnimName == "tc_newperk_card_in")
|
||||
end
|
||||
function PotentialCardItemCtrl:OnEnable()
|
||||
end
|
||||
function PotentialCardItemCtrl:OnDisable()
|
||||
end
|
||||
function PotentialCardItemCtrl:OnDestroy()
|
||||
end
|
||||
function PotentialCardItemCtrl:OnBtnClick_Word(link, sWordId)
|
||||
local potentialCfg = ConfigTable.GetData("Potential", self.nTid)
|
||||
local nLevel = self.nLevel
|
||||
local nNextLevel = self.nNextLevel
|
||||
local nType = potentialCfg.BranchType
|
||||
local nCharId = potentialCfg.CharId
|
||||
local tbSkillLevel
|
||||
if self.nShowType == AllEnum.PotentialCardType.StarTower then
|
||||
tbSkillLevel = self._panel:GetSkillLevel(nCharId)
|
||||
elseif self.nShowType == AllEnum.PotentialCardType.CharInfo or self.nShowType == AllEnum.PotentialCardType.Book or self.nShowType == AllEnum.PotentialCardType.Detial then
|
||||
tbSkillLevel = PlayerData.Char:GetSkillLevel(nCharId)
|
||||
end
|
||||
if nType == GameEnum.BranchType.Master then
|
||||
nLevel = tbSkillLevel[GameEnum.skillSlotType.B]
|
||||
nNextLevel = nil
|
||||
elseif nType == GameEnum.BranchType.Assist then
|
||||
nLevel = tbSkillLevel[GameEnum.skillSlotType.C]
|
||||
nNextLevel = nil
|
||||
end
|
||||
local mapData = {
|
||||
nPerkId = 0,
|
||||
nCount = 0,
|
||||
bWordTip = true,
|
||||
sWordId = sWordId,
|
||||
nLevel = nLevel,
|
||||
nNextLevel = nNextLevel
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PerkTips, link, mapData)
|
||||
end
|
||||
function PotentialCardItemCtrl:ChangeWordRaycast(bEnable)
|
||||
NovaAPI.SetTMPRaycastTarget(self._mapNode.txtDesc, bEnable)
|
||||
NovaAPI.SetTMPRaycastTarget(self._mapNode.txtSpDesc, bEnable)
|
||||
end
|
||||
function PotentialCardItemCtrl:SetRecommend(bEnable)
|
||||
self._mapNode.imgReommend:SetActive(bEnable)
|
||||
end
|
||||
return PotentialCardItemCtrl
|
||||
@@ -0,0 +1,24 @@
|
||||
local PotentialIconCtrl = class("PotentialIconCtrl", BaseCtrl)
|
||||
PotentialIconCtrl._mapNodeConfig = {
|
||||
imgIcon = {nCount = 3, sComponentName = "Image"}
|
||||
}
|
||||
PotentialIconCtrl._mapEventConfig = {}
|
||||
PotentialIconCtrl._mapRedDotConfig = {}
|
||||
function PotentialIconCtrl:SetIcon(nId)
|
||||
local itemCfg = ConfigTable.GetData_Item(nId)
|
||||
if nil == itemCfg then
|
||||
printError("获取Item表配置失败!!!id = " .. nId)
|
||||
return
|
||||
end
|
||||
local _, color = ColorUtility.TryParseHtmlString(AllEnum.PotentialRarityCfg[itemCfg.Rarity].sColor)
|
||||
local nCornerType = ConfigTable.GetData("Potential", nId).Corner
|
||||
self._mapNode.imgIcon[1].gameObject:SetActive(nCornerType ~= 0)
|
||||
self._mapNode.imgIcon[2].gameObject:SetActive(nCornerType ~= 0)
|
||||
if nCornerType ~= 0 then
|
||||
NovaAPI.SetImageColor(self._mapNode.imgIcon[1], color)
|
||||
self:SetPngSprite(self._mapNode.imgIcon[1], AllEnum.PotentialCornerIcon[nCornerType].sIconB)
|
||||
self:SetPngSprite(self._mapNode.imgIcon[2], AllEnum.PotentialCornerIcon[nCornerType].sIconA)
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgIcon[3], itemCfg.Icon .. AllEnum.PotentialIconSurfix.A)
|
||||
end
|
||||
return PotentialIconCtrl
|
||||
@@ -0,0 +1,220 @@
|
||||
local PotentialLevelUpCtrl = class("PotentialLevelUpCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
PotentialLevelUpCtrl._mapNodeConfig = {
|
||||
blurBg = {},
|
||||
menuBg = {},
|
||||
btnMask = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_MaskBg"
|
||||
},
|
||||
contentRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
animCtrl = {
|
||||
sComponentName = "Animator",
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
btnDepot = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Depot"
|
||||
},
|
||||
imgUpgradeTitle = {},
|
||||
imgSelectTitle = {},
|
||||
txtUpgrade = {sComponentName = "TMP_Text"},
|
||||
txtTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Potential_LevelUp_Title"
|
||||
},
|
||||
txtCloseTips = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Potential_LevelUp_Click"
|
||||
},
|
||||
goChangeDesc = {},
|
||||
btnPotential = {sComponentName = "NaviButton", nCount = 3},
|
||||
rtBtnPotential = {
|
||||
sNodeName = "btnPotential",
|
||||
sComponentName = "RectTransform",
|
||||
nCount = 3
|
||||
},
|
||||
potentialCard = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.StarTower.Potential.PotentialCardItemCtrl"
|
||||
},
|
||||
ScrollView = {
|
||||
nCount = 3,
|
||||
sComponentName = "GamepadScroll"
|
||||
},
|
||||
btnConfirm = {sComponentName = "NaviButton"},
|
||||
txtBtnConfirm = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Potential_Select_Confirm"
|
||||
},
|
||||
rtBtnConfirm = {
|
||||
sNodeName = "btnConfirm",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
depotPoint = {},
|
||||
cardFinishParticle = {},
|
||||
ActionBar = {
|
||||
sCtrlName = "Game.UI.ActionBar.ActionBarCtrl"
|
||||
}
|
||||
}
|
||||
PotentialLevelUpCtrl._mapEventConfig = {
|
||||
ShowPotentialLevelUp = "OnEvent_ShowPotentialLevelUp",
|
||||
GamepadUIReopen = "OnEvent_Reopen"
|
||||
}
|
||||
PotentialLevelUpCtrl._mapRedDotConfig = {}
|
||||
function PotentialLevelUpCtrl:Refresh(tbPotential)
|
||||
if tbPotential == nil or #tbPotential == 0 then
|
||||
return
|
||||
end
|
||||
self._mapNode.imgUpgradeTitle.gameObject:SetActive(false)
|
||||
self._mapNode.imgSelectTitle.gameObject:SetActive(true)
|
||||
self._mapNode.btnConfirm.gameObject:SetActive(false)
|
||||
self._mapNode.goChangeDesc.gameObject:SetActive(false)
|
||||
self:RefreshPotentialList(tbPotential)
|
||||
end
|
||||
function PotentialLevelUpCtrl:RefreshPotentialList(tbPotential)
|
||||
local tbCardObj = {}
|
||||
local bSimple = PlayerData.StarTower:GetPotentialDescSimple()
|
||||
for k, v in ipairs(self._mapNode.potentialCard) do
|
||||
v.gameObject:SetActive(false)
|
||||
self._mapNode.btnPotential[k].gameObject:SetActive(tbPotential[k] ~= nil)
|
||||
if tbPotential[k] ~= nil then
|
||||
local nTid = tbPotential[k].nId
|
||||
local potentialCfg = ConfigTable.GetData("Potential", nTid)
|
||||
if nil ~= potentialCfg then
|
||||
local nCharId = potentialCfg.CharId
|
||||
local nPotentialAddLv = self._panel.mapPotentialAddLevel[nCharId][nTid] or 0
|
||||
v:SetPotentialItem(nTid, tbPotential[k].nLevel, tbPotential[k].nNextLevel, bSimple, true, nPotentialAddLv, AllEnum.PotentialCardType.StarTower)
|
||||
table.insert(tbCardObj, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
if 0 < #tbCardObj then
|
||||
local wait = function()
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
local frameCount = 0
|
||||
while 0 < #tbCardObj do
|
||||
if 4 <= frameCount then
|
||||
local cardObj = table.remove(tbCardObj, 1)
|
||||
if cardObj ~= nil then
|
||||
cardObj.gameObject:SetActive(true)
|
||||
cardObj:PlayAnim("tc_newperk_card_in")
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_xintiao_select")
|
||||
end
|
||||
frameCount = 0
|
||||
else
|
||||
frameCount = frameCount + 1
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
end
|
||||
end
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
end
|
||||
function PotentialLevelUpCtrl:HidePanel()
|
||||
PanelManager.InputEnable()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", true, true)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.btnMask.gameObject:SetActive(false)
|
||||
NovaAPI.SetCanvasSortingOrder(self.canvas, self.nInitSortingOrder)
|
||||
GamepadUIManager.DisableGamepadUI("PotentialLevelUpCtrl")
|
||||
if nil ~= self.callback then
|
||||
self.callback()
|
||||
end
|
||||
end
|
||||
function PotentialLevelUpCtrl:Awake()
|
||||
self.canvas = self.gameObject:GetComponent("Canvas")
|
||||
self.nInitSortingOrder = NovaAPI.GetCanvasSortingOrder(self.canvas)
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
self._mapNode.menuBg.gameObject:SetActive(false)
|
||||
self._mapNode.txtCloseTips.gameObject:SetActive(true)
|
||||
self._mapNode.btnMask.gameObject:SetActive(false)
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
end
|
||||
function PotentialLevelUpCtrl:OnEnable()
|
||||
end
|
||||
function PotentialLevelUpCtrl:OnDisable()
|
||||
end
|
||||
function PotentialLevelUpCtrl:OnBtnClick_MaskBg()
|
||||
self:HidePanel()
|
||||
end
|
||||
function PotentialLevelUpCtrl:OnBtnClick_Depot()
|
||||
self.bOpenDepot = true
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
CS.GameCameraStackManager.Instance:OpenMainCamera()
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
self._mapNode.btnMask.gameObject:SetActive(false)
|
||||
EventManager.Hit(EventId.StarTowerDepot, AllEnum.StarTowerDepotTog.Potential)
|
||||
end
|
||||
function PotentialLevelUpCtrl:OnEvent_CloseStarTowerDepot()
|
||||
if self.bOpenDepot then
|
||||
self.bOpenDepot = false
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.contentRoot.gameObject:SetActive(true)
|
||||
self._mapNode.btnMask.gameObject:SetActive(true)
|
||||
if self.nSelectIdx ~= 0 then
|
||||
for k, v in ipairs(self._mapNode.potentialCard) do
|
||||
if k == self.nSelectIdx then
|
||||
v:PlayAnim("tc_newperk_card_switch_up")
|
||||
v:ChangeWordRaycast(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
end
|
||||
function PotentialLevelUpCtrl:OnEvent_ShowPotentialLevelUp(tbPotential, callback)
|
||||
self._panel:SetTop(self.canvas)
|
||||
if self._mapNode.blurBg.gameObject.activeSelf == false then
|
||||
PanelManager.InputDisable()
|
||||
end
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
GamepadUIManager.EnableGamepadUI("PotentialLevelUpCtrl", self.tbGamepadUINode)
|
||||
self.callback = callback
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(true)
|
||||
self._mapNode.btnMask.gameObject:SetActive(true)
|
||||
self._mapNode.menuBg.gameObject:SetActive(false)
|
||||
self._mapNode.cardFinishParticle:SetActive(false)
|
||||
self._mapNode.btnConfirm.gameObject:SetActive(false)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.contentRoot.gameObject:SetActive(true)
|
||||
self._mapNode.animCtrl:Play("PotentialSelectPanel_in")
|
||||
self:Refresh(tbPotential)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
local tbConfig = {
|
||||
{
|
||||
sAction = "Confirm",
|
||||
sLang = "ActionBar_Confirm"
|
||||
},
|
||||
{
|
||||
sAction = "Scroll",
|
||||
sLang = "ActionBar_Scroll"
|
||||
},
|
||||
{
|
||||
sAction = "Depot",
|
||||
sLang = "ActionBar_Depot"
|
||||
}
|
||||
}
|
||||
self._mapNode.ActionBar:InitActionBar(tbConfig)
|
||||
end
|
||||
function PotentialLevelUpCtrl:OnEvent_Reopen(sName)
|
||||
if sName ~= "PotentialLevelUpCtrl" then
|
||||
return
|
||||
end
|
||||
self:OnEvent_CloseStarTowerDepot()
|
||||
end
|
||||
return PotentialLevelUpCtrl
|
||||
@@ -0,0 +1,693 @@
|
||||
local PotentialSelectCtrl = class("PotentialSelectCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
PotentialSelectCtrl._mapNodeConfig = {
|
||||
blurBg = {},
|
||||
menuBg = {},
|
||||
contentRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
animCtrl = {
|
||||
sComponentName = "Animator",
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
txtCloseTips = {},
|
||||
btnMask = {},
|
||||
imgCoinBg = {},
|
||||
imgCoin = {sComponentName = "Image"},
|
||||
txtCoinCount = {sComponentName = "TMP_Text"},
|
||||
btnDepot = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Depot"
|
||||
},
|
||||
imgUpgradeTitle = {},
|
||||
imgSelectTitle = {},
|
||||
txtUpgrade = {sComponentName = "TMP_Text"},
|
||||
txtTitle = {sComponentName = "TMP_Text"},
|
||||
goChangeDesc = {},
|
||||
txtChange = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Potential_Change_Desc"
|
||||
},
|
||||
btnChangeDesc = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_ChangeDesc"
|
||||
},
|
||||
goOpen = {},
|
||||
goOff = {},
|
||||
btnPotential = {
|
||||
sComponentName = "NaviButton",
|
||||
nCount = 3,
|
||||
callback = "OnBtnClick_PotentialItem"
|
||||
},
|
||||
rtBtnPotential = {
|
||||
sNodeName = "btnPotential",
|
||||
sComponentName = "RectTransform",
|
||||
nCount = 3
|
||||
},
|
||||
potentialCard = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.StarTower.Potential.PotentialCardItemCtrl"
|
||||
},
|
||||
ScrollView = {
|
||||
nCount = 3,
|
||||
sComponentName = "GamepadScroll"
|
||||
},
|
||||
SpScrollView = {
|
||||
nCount = 3,
|
||||
sComponentName = "GamepadScroll"
|
||||
},
|
||||
btnConfirm = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Confirm"
|
||||
},
|
||||
txtBtnConfirm = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Potential_Select_Confirm"
|
||||
},
|
||||
rtBtnConfirm = {
|
||||
sNodeName = "btnConfirm",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
depotPoint = {},
|
||||
cardFinishParticle = {},
|
||||
RollButton = {},
|
||||
btnRoll = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Roll"
|
||||
},
|
||||
imgRollCostIcon = {sComponentName = "Image"},
|
||||
txtRollCostCount = {sComponentName = "TMP_Text"},
|
||||
ActionBar = {
|
||||
sCtrlName = "Game.UI.ActionBar.ActionBarCtrl"
|
||||
}
|
||||
}
|
||||
PotentialSelectCtrl._mapEventConfig = {
|
||||
StarTowerPotentialSelect = "OnEvent_StarTowerPotentialSelect",
|
||||
RefreshStarTowerCoin = "OnEvent_SetCoin",
|
||||
GamepadUIChange = "OnEvent_GamepadUIChange",
|
||||
GamepadUIReopen = "OnEvent_Reopen"
|
||||
}
|
||||
PotentialSelectCtrl._mapRedDotConfig = {}
|
||||
function PotentialSelectCtrl:Refresh(nEventId, tbPotential, mapPotential, nType, nLevel, tbNewIds, mapRoll, nCoin, tbLuckyIds, bAfterRoll, tbRecommend)
|
||||
self.nEventId = nEventId
|
||||
if tbPotential == nil or #tbPotential == 0 then
|
||||
local completeFunc = function(nEventId, tbPotential, mapPotential, nType, nLevel, tbNewIds, mapRoll, nCoin, tbLuckyIds, tbRecommend)
|
||||
self:SelectComplete(nEventId, tbPotential, mapPotential, nType, nLevel, tbNewIds, mapRoll, nCoin, tbLuckyIds, tbRecommend)
|
||||
end
|
||||
self.callback(1000, nEventId, completeFunc)
|
||||
traceback("潜能卡选择列表为空!!!")
|
||||
return
|
||||
end
|
||||
local bSpecial = false
|
||||
local itemCfg = ConfigTable.GetData_Item(tbPotential[1].Id)
|
||||
if itemCfg then
|
||||
bSpecial = itemCfg.Stype == GameEnum.itemStype.SpecificPotential
|
||||
end
|
||||
if bSpecial and mapRoll then
|
||||
mapRoll.CanReRoll = false
|
||||
end
|
||||
self.nSelectIdx = 0
|
||||
self.nPanelType = nType
|
||||
self._mapNode.imgUpgradeTitle.gameObject:SetActive(nType == 1)
|
||||
self._mapNode.imgSelectTitle.gameObject:SetActive(nType ~= 1)
|
||||
if nType == 0 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTitle, ConfigTable.GetUIText("StarTower_Potential_Select_Title_1"))
|
||||
elseif nType == 1 then
|
||||
if nLevel ~= nil and nLevel ~= 0 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtUpgrade, orderedFormat(ConfigTable.GetUIText("Potential_Select_Title"), nLevel))
|
||||
end
|
||||
elseif nType == 2 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTitle, ConfigTable.GetUIText("StarTower_Potential_Select_Title_2"))
|
||||
else
|
||||
self._mapNode.imgSelectTitle.gameObject:SetActive(false)
|
||||
end
|
||||
self._mapNode.RollButton:SetActive(mapRoll and mapRoll.CanReRoll and nType ~= 2)
|
||||
self._mapNode.btnConfirm.gameObject:SetActive(false)
|
||||
self.nCoin = nCoin
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, self:ThousandsNumber(self.nCoin))
|
||||
self.mapRoll = mapRoll
|
||||
self:RefreshCoin(nCoin, mapRoll)
|
||||
self:RefreshPotentialList(tbPotential, mapPotential, tbNewIds, tbLuckyIds, bAfterRoll, tbRecommend)
|
||||
self:SetSimpleState()
|
||||
self:PlayCharVoice(tbPotential)
|
||||
local tbConfig = {}
|
||||
if mapRoll and mapRoll.CanReRoll then
|
||||
tbConfig = {
|
||||
{
|
||||
sAction = "Confirm",
|
||||
sLang = "ActionBar_Confirm"
|
||||
},
|
||||
{
|
||||
sAction = "Roll",
|
||||
sLang = "ActionBar_Reroll"
|
||||
},
|
||||
{
|
||||
sAction = "Scroll",
|
||||
sLang = "ActionBar_Scroll"
|
||||
},
|
||||
{
|
||||
sAction = "Depot",
|
||||
sLang = "ActionBar_Depot"
|
||||
},
|
||||
{
|
||||
sAction = "Switch",
|
||||
sLang = "ActionBar_ChangeDesc"
|
||||
}
|
||||
}
|
||||
else
|
||||
tbConfig = {
|
||||
{
|
||||
sAction = "Confirm",
|
||||
sLang = "ActionBar_Confirm"
|
||||
},
|
||||
{
|
||||
sAction = "Scroll",
|
||||
sLang = "ActionBar_Scroll"
|
||||
},
|
||||
{
|
||||
sAction = "Depot",
|
||||
sLang = "ActionBar_Depot"
|
||||
},
|
||||
{
|
||||
sAction = "Switch",
|
||||
sLang = "ActionBar_ChangeDesc"
|
||||
}
|
||||
}
|
||||
end
|
||||
if self._panel.nStarTowerId == 999 then
|
||||
tbConfig = {
|
||||
{
|
||||
sAction = "Confirm",
|
||||
sLang = "ActionBar_Confirm"
|
||||
},
|
||||
{
|
||||
sAction = "Scroll",
|
||||
sLang = "ActionBar_Scroll"
|
||||
},
|
||||
{
|
||||
sAction = "Switch",
|
||||
sLang = "ActionBar_ChangeDesc"
|
||||
}
|
||||
}
|
||||
end
|
||||
self._mapNode.ActionBar:InitActionBar(tbConfig)
|
||||
end
|
||||
function PotentialSelectCtrl:RefreshCoin(nCoin, mapRoll)
|
||||
if not mapRoll or not mapRoll.CanReRoll then
|
||||
return
|
||||
end
|
||||
self:SetSprite_Coin(self._mapNode.imgRollCostIcon, AllEnum.CoinItemId.FixedRogCurrency)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRollCostCount, mapRoll.ReRollPrice)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtRollCostCount, nCoin < mapRoll.ReRollPrice and Red_Unable or Blue_Normal)
|
||||
end
|
||||
function PotentialSelectCtrl:RefreshPotentialList(tbPotential, mapPotential, tbNewIds, tbLuckyIds, bAfterRoll, tbRecommendParam)
|
||||
local tbRecommend = {}
|
||||
if 0 < #tbRecommendParam then
|
||||
table.insert(tbRecommend, tbRecommendParam[1])
|
||||
end
|
||||
self.bSpecialPotential = false
|
||||
self.tbPotential = {}
|
||||
self.nRecommendIdx = 1
|
||||
for _, v in ipairs(tbPotential) do
|
||||
local bNew, bLucky = false, false
|
||||
local nCurLevel = mapPotential[v.Id]
|
||||
local nAddLevel = v.Count
|
||||
local nNextLevel = nCurLevel + nAddLevel
|
||||
local mapCfg = ConfigTable.GetData("Potential", v.Id)
|
||||
if mapCfg ~= nil then
|
||||
local nMaxLevel = PlayerData.StarTower:GetPotentialMaxLevelWithEquipment()
|
||||
nNextLevel = math.min(nNextLevel, nMaxLevel)
|
||||
end
|
||||
if nCurLevel == 0 then
|
||||
nCurLevel = nAddLevel
|
||||
end
|
||||
if tbNewIds ~= nil then
|
||||
for _, nId in ipairs(tbNewIds) do
|
||||
if nId == v.Id then
|
||||
bNew = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if tbLuckyIds ~= nil then
|
||||
for _, nId in ipairs(tbLuckyIds) do
|
||||
if nId == v.Id then
|
||||
bLucky = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
table.insert(self.tbPotential, {
|
||||
nId = v.Id,
|
||||
nLevel = nCurLevel,
|
||||
nNextLevel = nNextLevel,
|
||||
bNew = bNew,
|
||||
bLucky = bLucky
|
||||
})
|
||||
end
|
||||
local tbCardObj, tbBtnObj = {}, {}
|
||||
for k, v in ipairs(self._mapNode.potentialCard) do
|
||||
v.gameObject:SetActive(false)
|
||||
self._mapNode.btnPotential[k].gameObject:SetActive(self.tbPotential[k] ~= nil)
|
||||
if self.tbPotential[k] ~= nil then
|
||||
local nTid = self.tbPotential[k].nId
|
||||
local potentialCfg = ConfigTable.GetData("Potential", nTid)
|
||||
if nil ~= potentialCfg then
|
||||
local nCharId = potentialCfg.CharId
|
||||
local nPotentialAddLv = self._panel.mapPotentialAddLevel[nCharId][nTid] or 0
|
||||
local data = self.tbPotential[k]
|
||||
local bSpecial = v:SetPotentialItem(nTid, data.nLevel, data.nNextLevel, self.bSimple, true, nPotentialAddLv, AllEnum.PotentialCardType.StarTower, data.bNew, data.bLucky)
|
||||
local bRec = 0 < table.indexof(tbRecommend, nTid)
|
||||
v:SetRecommend(bRec)
|
||||
if bRec then
|
||||
self.nRecommendIdx = k
|
||||
end
|
||||
v:ChangeWordRaycast(false)
|
||||
table.insert(tbCardObj, v)
|
||||
table.insert(tbBtnObj, self._mapNode.btnPotential[k])
|
||||
self.bSpecialPotential = self.bSpecialPotential or bSpecial
|
||||
end
|
||||
end
|
||||
end
|
||||
self:ResetSelect(tbBtnObj)
|
||||
local nCardAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.potentialCard[1].animCtrl, {
|
||||
"tc_newperk_card_in"
|
||||
})
|
||||
local nPanelAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.animCtrl, {
|
||||
"PotentialSelectPanel_in"
|
||||
})
|
||||
local nAnimTime = nCardAnimTime > nPanelAnimTime and nCardAnimTime or nPanelAnimTime
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
if self.nPanelType == 2 then
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_shop_slotMachine")
|
||||
else
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_xintiao_select")
|
||||
end
|
||||
if 0 < #tbCardObj then
|
||||
local wait = function()
|
||||
local frameCount = 0
|
||||
while 0 < #tbCardObj do
|
||||
if 4 <= frameCount then
|
||||
local cardObj = table.remove(tbCardObj, 1)
|
||||
if cardObj ~= nil then
|
||||
cardObj.gameObject:SetActive(true)
|
||||
if bAfterRoll then
|
||||
cardObj:PlayAnim("tc_newperk_card_RollEffect")
|
||||
cardObj:ActiveRollEffect()
|
||||
else
|
||||
cardObj:PlayAnim("tc_newperk_card_in")
|
||||
end
|
||||
end
|
||||
frameCount = 0
|
||||
else
|
||||
frameCount = frameCount + 1
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
end
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
end
|
||||
function PotentialSelectCtrl:SetSimpleState()
|
||||
self._mapNode.goOff.gameObject:SetActive(not self.bSimple)
|
||||
self._mapNode.goOpen.gameObject:SetActive(self.bSimple)
|
||||
end
|
||||
function PotentialSelectCtrl:PlayCharVoice(tbPotential)
|
||||
local nCharId = 0
|
||||
for k, v in ipairs(tbPotential) do
|
||||
local nId = v.Id
|
||||
local potentialCfg = ConfigTable.GetData("Potential", nId)
|
||||
if nil == potentialCfg then
|
||||
printError(string.format("获取潜能表配置失败!!!id = [%s])", nId))
|
||||
return
|
||||
end
|
||||
nCharId = potentialCfg.CharId
|
||||
break
|
||||
end
|
||||
local bMainChar = self._panel:CheckMainChar(nCharId)
|
||||
local sVoiceKey = ""
|
||||
if bMainChar then
|
||||
sVoiceKey = "perk"
|
||||
else
|
||||
sVoiceKey = "subPerk"
|
||||
end
|
||||
PlayerData.Voice:PlayCharVoice(sVoiceKey, nCharId)
|
||||
end
|
||||
function PotentialSelectCtrl:SelectComplete(nEventId, tbPotential, mapPotential, nType, nLevel, tbNewIds, mapRoll, nCoin, tbLuckyIds, tbRecommend)
|
||||
if nEventId == 0 then
|
||||
if self.bSkip then
|
||||
self:HidePanel()
|
||||
if nil ~= self.callback then
|
||||
self.callback(nEventId, -1)
|
||||
end
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
self._mapNode.menuBg.gameObject:SetActive(true)
|
||||
self._mapNode.btnConfirm.gameObject:SetActive(false)
|
||||
EventManager.Hit("StarTowerSetButtonEnable", true, false)
|
||||
CS.GameCameraStackManager.Instance:OpenMainCamera()
|
||||
for k, v in ipairs(self._mapNode.potentialCard) do
|
||||
if k == self.nSelectIdx then
|
||||
local animCtrl = v.gameObject:GetComponent("Animator")
|
||||
animCtrl:Play("tc_newperk_card_out")
|
||||
local fxRoot = v.gameObject.transform:Find("FX")
|
||||
local fx = v.gameObject.transform:Find("FX/glow")
|
||||
local OutAnimFinish = function()
|
||||
local beginPos = fxRoot.transform.position
|
||||
local controlPos = Vector3(3, 5, 0)
|
||||
local endPos = self._mapNode.depotPoint.transform.position
|
||||
local wait = function()
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_card_flyby")
|
||||
local totalMoveTime = 0.3
|
||||
local moveTime = 0
|
||||
local normalizedTime = 0
|
||||
while normalizedTime < 1 do
|
||||
moveTime = moveTime + CS.UnityEngine.Time.unscaledDeltaTime
|
||||
normalizedTime = moveTime / totalMoveTime
|
||||
normalizedTime = normalizedTime <= 1 and normalizedTime or 1
|
||||
local x, y, z = UTILS.GetBezierPointByT(beginPos, controlPos, endPos, normalizedTime)
|
||||
local angleZ = 100 * normalizedTime * 2
|
||||
angleZ = angleZ <= 100 and angleZ or 100
|
||||
fxRoot.transform.localEulerAngles = Vector3(0, 0, angleZ)
|
||||
fxRoot.transform.position = Vector3(x, y, z)
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
end
|
||||
self._mapNode.cardFinishParticle:SetActive(true)
|
||||
fx.gameObject:SetActive(false)
|
||||
coroutine.yield(CS.UnityEngine.WaitForSecondsRealtime(0.5))
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
self:HidePanel()
|
||||
fxRoot.transform.position = beginPos
|
||||
fxRoot.transform.localEulerAngles = Vector3(0, 0, 0)
|
||||
fx.gameObject:SetActive(true)
|
||||
if nil ~= self.callback then
|
||||
self.callback(nEventId, -1)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
self:SetAnimationCallback(animCtrl, OutAnimFinish)
|
||||
else
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
self._mapNode.animCtrl:Play("PotentialSelectPanel_out")
|
||||
EventManager.Hit("Guide_Potential_SelectComplete")
|
||||
else
|
||||
self:Refresh(nEventId, tbPotential, mapPotential, nType, nLevel, tbNewIds, mapRoll, nCoin, tbLuckyIds, false, tbRecommend)
|
||||
end
|
||||
end
|
||||
function PotentialSelectCtrl:MoveConfirmButton(btnCard)
|
||||
local rtBtn = btnCard:GetComponent("RectTransform")
|
||||
self._mapNode.rtBtnConfirm.localPosition = Vector3(rtBtn.localPosition.x, self.btnConfirmPosY, 0)
|
||||
if self._mapNode.btnConfirm.gameObject.activeSelf == false then
|
||||
self._mapNode.btnConfirm.gameObject:SetActive(true)
|
||||
else
|
||||
local animCtrl = self._mapNode.btnConfirm.transform:Find("AnimRoot"):GetComponent("Animator")
|
||||
animCtrl:Play("btnConfirm_in", 0, 0)
|
||||
end
|
||||
end
|
||||
function PotentialSelectCtrl:HidePanel()
|
||||
self.bOpen = false
|
||||
if not self.bSkip then
|
||||
PanelManager.InputEnable()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", true, true)
|
||||
end
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
NovaAPI.SetCanvasSortingOrder(self.canvas, self.nInitSortingOrder)
|
||||
GamepadUIManager.DisableGamepadUI("PotentialSelectCtrl")
|
||||
end
|
||||
function PotentialSelectCtrl:Awake()
|
||||
self.nRecommendIdx = 1
|
||||
self.canvas = self.gameObject:GetComponent("Canvas")
|
||||
self.nInitSortingOrder = NovaAPI.GetCanvasSortingOrder(self.canvas)
|
||||
self.btnConfirmPosY = self._mapNode.rtBtnConfirm.localPosition.y
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
self._mapNode.menuBg.gameObject:SetActive(false)
|
||||
self._mapNode.btnDepot.gameObject:SetActive(self._panel.nStarTowerId ~= 999)
|
||||
self._mapNode.imgCoinBg.gameObject:SetActive(self._panel.nStarTowerId ~= 999)
|
||||
self._mapNode.txtCloseTips.gameObject:SetActive(false)
|
||||
self._mapNode.btnMask.gameObject:SetActive(false)
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
self.nCoin = 0
|
||||
self:SetSprite_Coin(self._mapNode.imgCoin, AllEnum.CoinItemId.FixedRogCurrency)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, self.nCoin)
|
||||
end
|
||||
function PotentialSelectCtrl:OnEnable()
|
||||
self.handler = {}
|
||||
for k, v in ipairs(self._mapNode.btnPotential) do
|
||||
self.handler[k] = ui_handler(self, self.OnBtnSelect_PotentialItem, v, k)
|
||||
v.onSelect:AddListener(self.handler[k])
|
||||
end
|
||||
if self._panel.nStarTowerId ~= nil and self._panel.nStarTowerId == 999 then
|
||||
self._mapNode.btnDepot.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.btnDepot.gameObject:SetActive(true)
|
||||
end
|
||||
end
|
||||
function PotentialSelectCtrl:OnDisable()
|
||||
for k, v in ipairs(self._mapNode.btnPotential) do
|
||||
v.onSelect:RemoveListener(self.handler[k])
|
||||
end
|
||||
end
|
||||
function PotentialSelectCtrl:OnBtnClick_Depot()
|
||||
self.bOpenDepot = true
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
CS.GameCameraStackManager.Instance:OpenMainCamera()
|
||||
for k, v in ipairs(self._mapNode.potentialCard) do
|
||||
v:ChangeWordRaycast(false)
|
||||
end
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
EventManager.Hit(EventId.StarTowerDepot, AllEnum.StarTowerDepotTog.Potential)
|
||||
end
|
||||
function PotentialSelectCtrl:OnBtnClick_ChangeDesc()
|
||||
self.bSimple = not self.bSimple
|
||||
PlayerData.StarTower:SetPotentialDescSimple(self.bSimple)
|
||||
self:SetSimpleState()
|
||||
for _, v in ipairs(self._mapNode.potentialCard) do
|
||||
v:ChangeDesc(self.bSimple)
|
||||
end
|
||||
end
|
||||
function PotentialSelectCtrl:OnBtnClick_Confirm()
|
||||
if self.nSelectIdx ~= 0 and self.callback ~= nil then
|
||||
local completeFunc = function(nEventId, tbPotential, mapPotential, nType, nLevel, tbNewIds, mapRoll, nCoin, tbLuckyIds, tbRecommend)
|
||||
self:SelectComplete(nEventId, tbPotential, mapPotential, nType, nLevel, tbNewIds, mapRoll, nCoin, tbLuckyIds, tbRecommend)
|
||||
if nType == 2 then
|
||||
PlayerData.Voice:PlayCharVoice("thankLvup", 9133)
|
||||
end
|
||||
end
|
||||
self.callback(self.nSelectIdx, self.nEventId, completeFunc)
|
||||
end
|
||||
end
|
||||
function PotentialSelectCtrl:OnBtnClick_Roll()
|
||||
if not self.callback then
|
||||
return
|
||||
end
|
||||
if self.nCoin < self.mapRoll.ReRollPrice then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("StarTower_ReRoll_NotEnoughCoin"))
|
||||
return
|
||||
end
|
||||
local completeFunc = function(nEventId, tbPotential, mapPotential, nType, nLevel, tbNewIds, mapRoll, nCoin, tbLuckyIds, tbRecommend)
|
||||
self:Refresh(nEventId, tbPotential, mapPotential, nType, nLevel, tbNewIds, mapRoll, nCoin, tbLuckyIds, true, tbRecommend)
|
||||
end
|
||||
self.callback(self.nSelectIdx, self.nEventId, completeFunc, true)
|
||||
end
|
||||
function PotentialSelectCtrl:OnBtnSelect_PotentialItem(btn, nIndex)
|
||||
local nUIType = GamepadUIManager.GetCurUIType()
|
||||
if nUIType ~= AllEnum.GamepadUIType.Other and nUIType ~= AllEnum.GamepadUIType.Mouse or self.bRecommended then
|
||||
self:OnBtnClick_PotentialItem(btn, nIndex)
|
||||
end
|
||||
end
|
||||
function PotentialSelectCtrl:OnBtnClick_PotentialItem(btn, nIndex)
|
||||
if nil == self.tbPotential[nIndex] or self.nSelectIdx == nIndex then
|
||||
return
|
||||
end
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_xintiao_slide")
|
||||
self:MoveConfirmButton(btn)
|
||||
for k, v in ipairs(self._mapNode.potentialCard) do
|
||||
if k == nIndex then
|
||||
v:PlayAnim("tc_newperk_card_switch_up")
|
||||
v:ChangeWordRaycast(true)
|
||||
elseif k == self.nSelectIdx then
|
||||
v:PlayAnim("tc_newperk_card_switch_down")
|
||||
v:ChangeWordRaycast(false)
|
||||
end
|
||||
end
|
||||
self:SelectScroll(nIndex)
|
||||
self.nSelectIdx = nIndex
|
||||
end
|
||||
function PotentialSelectCtrl:OnEvent_StarTowerPotentialSelect(nEventId, tbPotential, mapPotential, nType, nLevel, tbNewIds, callback, mapRoll, nCoin, tbLuckyIds, tbRecommend)
|
||||
self.callback = callback
|
||||
if tbPotential == nil or #tbPotential == 0 then
|
||||
self.bSkip = true
|
||||
local completeFunc = function(nEventId, tbPotential, mapPotential, nType, nLevel, tbNewIds, tbRecommend)
|
||||
self:SelectComplete(nEventId, tbPotential, mapPotential, nType, nLevel, tbNewIds, tbRecommend)
|
||||
end
|
||||
self.callback(1000, nEventId, completeFunc)
|
||||
traceback("潜能卡选择列表为空!!!")
|
||||
return
|
||||
end
|
||||
self._panel:SetTop(self.canvas)
|
||||
self.bSkip = false
|
||||
local bCloseCamera = false
|
||||
if not self.bOpen then
|
||||
PanelManager.InputDisable()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
bCloseCamera = true
|
||||
GamepadUIManager.EnableGamepadUI("PotentialSelectCtrl", self.tbGamepadUINode)
|
||||
end
|
||||
self.bOpen = true
|
||||
self.tbPotential = {}
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(true)
|
||||
self._mapNode.menuBg.gameObject:SetActive(false)
|
||||
self._mapNode.cardFinishParticle:SetActive(false)
|
||||
self._mapNode.RollButton:SetActive(false)
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
if bCloseCamera then
|
||||
CS.GameCameraStackManager.Instance:CloseMainCamera(0.1)
|
||||
end
|
||||
self._mapNode.contentRoot.gameObject:SetActive(true)
|
||||
self._mapNode.animCtrl:Play("PotentialSelectPanel_in")
|
||||
self:Refresh(nEventId, tbPotential, mapPotential, nType, nLevel, tbNewIds, mapRoll, nCoin, tbLuckyIds, false, tbRecommend)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
self._mapNode.btnConfirm.gameObject:SetActive(false)
|
||||
self.nSelectIdx = 0
|
||||
self.bSimple = PlayerData.StarTower:GetPotentialDescSimple()
|
||||
end
|
||||
function PotentialSelectCtrl:OnEvent_CloseStarTowerDepot()
|
||||
if self.bOpenDepot then
|
||||
self.bOpenDepot = false
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(true)
|
||||
local nSelect = self.nSelectIdx ~= 0 and self.nSelectIdx or 1
|
||||
GamepadUIManager.SetSelectedUI(self._mapNode.btnPotential[nSelect].gameObject)
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
CS.GameCameraStackManager.Instance:CloseMainCamera(0.1)
|
||||
self._mapNode.contentRoot.gameObject:SetActive(true)
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
for k, v in ipairs(self._mapNode.potentialCard) do
|
||||
v:CloseBgEffect()
|
||||
end
|
||||
if self.nSelectIdx == 0 and GamepadUIManager.GetCurUIType() ~= AllEnum.GamepadUIType.Other then
|
||||
self.nSelectIdx = 1
|
||||
self:MoveConfirmButton(self._mapNode.btnPotential[self.nSelectIdx])
|
||||
end
|
||||
if self.nSelectIdx ~= 0 then
|
||||
for k, v in ipairs(self._mapNode.potentialCard) do
|
||||
if k == self.nSelectIdx then
|
||||
v:PlayAnim("tc_newperk_card_switch_up")
|
||||
v:ChangeWordRaycast(true)
|
||||
self:SelectScroll(self.nSelectIdx)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
end
|
||||
function PotentialSelectCtrl:OnEvent_GamepadUIChange(sName, nBeforeType, nAfterType)
|
||||
if sName ~= "PotentialSelectCtrl" then
|
||||
return
|
||||
end
|
||||
if nBeforeType == AllEnum.GamepadUIType.Other or nBeforeType == AllEnum.GamepadUIType.Mouse then
|
||||
local nSelect = self.nSelectIdx ~= 0 and self.nSelectIdx or self.nRecommendIdx
|
||||
GamepadUIManager.ClearSelectedUI()
|
||||
GamepadUIManager.SetSelectedUI(self._mapNode.btnPotential[nSelect].gameObject)
|
||||
end
|
||||
end
|
||||
function PotentialSelectCtrl:OnEvent_Reopen(sName)
|
||||
if sName ~= "PotentialSelectCtrl" then
|
||||
return
|
||||
end
|
||||
if self.bOpenDepot then
|
||||
self:OnEvent_CloseStarTowerDepot()
|
||||
else
|
||||
if self.nSelectIdx == 0 and GamepadUIManager.GetCurUIType() ~= AllEnum.GamepadUIType.Other then
|
||||
self.nSelectIdx = 1
|
||||
end
|
||||
if self.nSelectIdx == 0 then
|
||||
return
|
||||
end
|
||||
GamepadUIManager.SetSelectedUI(self._mapNode.btnPotential[self.nSelectIdx].gameObject)
|
||||
self._mapNode.potentialCard[self.nSelectIdx]:ChangeWordRaycast(true)
|
||||
self:SelectScroll(self.nSelectIdx)
|
||||
end
|
||||
end
|
||||
function PotentialSelectCtrl:OnEvent_SetCoin(nCount)
|
||||
if self.mapRoll ~= nil and self.mapRoll.CanReRoll and nCount then
|
||||
if nCount > self.nCoin then
|
||||
local twCoin = DOTween.To(function()
|
||||
return self.nCoin
|
||||
end, function(v)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, self:ThousandsNumber(math.floor(v)))
|
||||
end, nCount, 1)
|
||||
local _cb = function()
|
||||
self.nCoin = nCount
|
||||
end
|
||||
twCoin.onComplete = dotween_callback_handler(self, _cb)
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, self:ThousandsNumber(nCount))
|
||||
self.nCoin = nCount
|
||||
end
|
||||
end
|
||||
end
|
||||
function PotentialSelectCtrl:ResetSelect(tbUI)
|
||||
self.nSelectIdx = 0
|
||||
local nRecommendedIdx = 0
|
||||
self.bRecommended = nRecommendedIdx ~= 0
|
||||
GamepadUIManager.SetNavigation(tbUI)
|
||||
local nCardAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.potentialCard[1].animCtrl, {
|
||||
"tc_newperk_card_in"
|
||||
})
|
||||
local nPanelAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.animCtrl, {
|
||||
"PotentialSelectPanel_in"
|
||||
})
|
||||
local nAnimTime = nCardAnimTime > nPanelAnimTime and nCardAnimTime or nPanelAnimTime
|
||||
nAnimTime = nAnimTime + 0.4
|
||||
self:AddTimer(1, nAnimTime, function()
|
||||
if self.nSelectIdx == 0 then
|
||||
local nSelect = nRecommendedIdx == 0 and 1 or nRecommendedIdx
|
||||
GamepadUIManager.ClearSelectedUI()
|
||||
GamepadUIManager.SetSelectedUI(self._mapNode.btnPotential[nSelect].gameObject)
|
||||
if GamepadUIManager.GetCurUIType() == AllEnum.GamepadUIType.Mouse then
|
||||
self:OnBtnClick_PotentialItem(self._mapNode.btnPotential[nSelect].gameObject, nSelect)
|
||||
end
|
||||
end
|
||||
if self._panel.nStarTowerId ~= 999 then
|
||||
if self.bSpecialPotential then
|
||||
EventManager.Hit("Guide_PassiveCheck_Msg", "Guide_PotentialSelectSpecial")
|
||||
else
|
||||
EventManager.Hit("Guide_PassiveCheck_Msg", "Guide_PotentialSelect")
|
||||
end
|
||||
end
|
||||
end, true, true, true)
|
||||
end
|
||||
function PotentialSelectCtrl:SelectScroll(nIndex)
|
||||
for _, v in ipairs(self._mapNode.ScrollView) do
|
||||
NovaAPI.SetComponentEnable(v, false)
|
||||
end
|
||||
if nIndex then
|
||||
NovaAPI.SetComponentEnable(self._mapNode.ScrollView[nIndex], true)
|
||||
end
|
||||
for _, v in ipairs(self._mapNode.SpScrollView) do
|
||||
NovaAPI.SetComponentEnable(v, false)
|
||||
end
|
||||
if nIndex then
|
||||
NovaAPI.SetComponentEnable(self._mapNode.SpScrollView[nIndex], true)
|
||||
end
|
||||
end
|
||||
return PotentialSelectCtrl
|
||||
@@ -0,0 +1,136 @@
|
||||
local StarTowerBossChallenge = class("StarTowerBossChallenge", BaseCtrl)
|
||||
local colorWhite = Color(1, 1, 1, 1)
|
||||
local colorRed = Color(0.8470588235294118, 0.3137254901960784, 0.32941176470588235)
|
||||
StarTowerBossChallenge._mapNodeConfig = {
|
||||
rtnfo = {},
|
||||
TMPDesc = {sComponentName = "TMP_Text"},
|
||||
TMPComplete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Complete"
|
||||
},
|
||||
TMPChallengeTime = {sComponentName = "TMP_Text"},
|
||||
rtChallengeTime = {},
|
||||
animatorTime = {
|
||||
sNodeName = "rtChallengeTime",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
AnimatorInfo = {sNodeName = "rtnfo", sComponentName = "Animator"}
|
||||
}
|
||||
StarTowerBossChallenge._mapEventConfig = {}
|
||||
function StarTowerBossChallenge:Awake()
|
||||
self.AnimatorRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function StarTowerBossChallenge:FadeIn()
|
||||
end
|
||||
function StarTowerBossChallenge:FadeOut()
|
||||
end
|
||||
function StarTowerBossChallenge:OnEnable()
|
||||
end
|
||||
function StarTowerBossChallenge:OnDisable()
|
||||
end
|
||||
function StarTowerBossChallenge:OnDestroy()
|
||||
EventManager.Remove("StarTower_Start_Battle", self, self.OnEvent_StartBattle)
|
||||
EventManager.Remove("Roguelike_BossMonster_CountUp", self, self.OnEvent_SpecialMode_Count)
|
||||
EventManager.Remove("OnEvent_ShowRtChallengeTime", self, self.ShowRtChallengeTime)
|
||||
end
|
||||
function StarTowerBossChallenge:OnRelease()
|
||||
end
|
||||
function StarTowerBossChallenge:SetTime(nTime)
|
||||
local nMin = math.floor(nTime / 60)
|
||||
local nSec = math.fmod(nTime, 60)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPChallengeTime, string.format("%02d:%02d", nMin, nSec))
|
||||
end
|
||||
function StarTowerBossChallenge:StartEvent(tbTime)
|
||||
self.tbTime = tbTime
|
||||
self.nState = 1
|
||||
self.nAllState = #tbTime
|
||||
self.maxRewardTime = tbTime[self.nAllState]
|
||||
self.bEnd = false
|
||||
self._mapNode.rtnfo:SetActive(false)
|
||||
self._mapNode.rtChallengeTime:SetActive(false)
|
||||
self._mapNode.TMPDesc.gameObject:SetActive(false)
|
||||
self._mapNode.TMPComplete.gameObject:SetActive(false)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPChallengeTime, "00:00")
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorWhite)
|
||||
local nStateDesc = 1
|
||||
local nextStateTime = self.tbTime[self.nState]
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDesc, orderedFormat(ConfigTable.GetUIText("StarTower_BossChallenge"), nextStateTime, ConfigTable.GetUIText("FRBattleInfo_Box" .. nStateDesc)))
|
||||
EventManager.Add("StarTower_Start_Battle", self, self.OnEvent_StartBattle)
|
||||
EventManager.Add("Roguelike_BossMonster_CountUp", self, self.OnEvent_SpecialMode_Count)
|
||||
EventManager.Add("OnEvent_ShowRtChallengeTime", self, self.ShowRtChallengeTime)
|
||||
end
|
||||
function StarTowerBossChallenge:OnEvent_StartBattle()
|
||||
self._mapNode.rtnfo:SetActive(true)
|
||||
self._mapNode.TMPDesc.gameObject:SetActive(true)
|
||||
end
|
||||
function StarTowerBossChallenge:OnEvent_SpecialMode_Count(nTime)
|
||||
local nCurTime = nTime
|
||||
local nextStateTime = 0
|
||||
if self.tbTime[self.nState] then
|
||||
nextStateTime = self.tbTime[self.nState]
|
||||
end
|
||||
if 0 < nextStateTime and nextStateTime - nCurTime <= 5 then
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorRed)
|
||||
self._mapNode.animatorTime:Play("BossChallengeTime_show")
|
||||
else
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorWhite)
|
||||
end
|
||||
if nCurTime == nextStateTime then
|
||||
self:StageChange()
|
||||
end
|
||||
if 0 <= nCurTime then
|
||||
self:SetTime(nCurTime)
|
||||
else
|
||||
self._mapNode.rtChallengeTime:SetActive(false)
|
||||
end
|
||||
end
|
||||
function StarTowerBossChallenge:StageChange()
|
||||
if self.bEnd then
|
||||
return
|
||||
end
|
||||
self.nState = self.nState + 1
|
||||
local callback = function()
|
||||
if self.bEnd then
|
||||
self._mapNode.TMPDesc.gameObject:SetActive(false)
|
||||
self._mapNode.TMPComplete.gameObject:SetActive(true)
|
||||
return
|
||||
end
|
||||
self._mapNode.AnimatorInfo:Play("StarTowerRoomInfoBossRtnfo_switch", 0, 0)
|
||||
if self.nState > self.nAllState then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDesc, ConfigTable.GetUIText("StarTower_BossChallenge_Min"))
|
||||
else
|
||||
local nextStateTime = self.tbTime[self.nState]
|
||||
local nStateDesc = 2
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDesc, orderedFormat(ConfigTable.GetUIText("StarTower_BossChallenge_Zero"), nextStateTime, ConfigTable.GetUIText("StarTower_RoomInfo_Box" .. nStateDesc)))
|
||||
end
|
||||
self._mapNode.TMPDesc.gameObject:SetActive(true)
|
||||
self.AnimatorRoot:Play("StarTowerBossChallenge_trail")
|
||||
end
|
||||
self:AddTimer(1, 0.7, callback, true, true, true)
|
||||
end
|
||||
function StarTowerBossChallenge:Success()
|
||||
self._mapNode.TMPDesc.gameObject:SetActive(false)
|
||||
self._mapNode.TMPComplete.gameObject:SetActive(true)
|
||||
self.bEnd = true
|
||||
self._mapNode.rtChallengeTime:SetActive(false)
|
||||
self._mapNode.AnimatorInfo:Play("StarTowerRoomInfoBossRtnfo_Finish", 0, 0)
|
||||
self:AddTimer(1, 3, function()
|
||||
self:EventEnd()
|
||||
end, true, true, true)
|
||||
end
|
||||
function StarTowerBossChallenge:EventEnd()
|
||||
EventManager.Remove("StarTower_Start_Battle", self, self.OnEvent_StartBattle)
|
||||
EventManager.Remove("Roguelike_BossMonster_CountUp", self, self.OnEvent_SpecialMode_Count)
|
||||
EventManager.Remove("OnEvent_ShowRtChallengeTime", self, self.ShowRtChallengeTime)
|
||||
local nAnimLength = NovaAPI.GetAnimClipLength(self._mapNode.AnimatorInfo, {
|
||||
"StarTowerRoomInfoBossRtnfo_out"
|
||||
})
|
||||
self._mapNode.AnimatorInfo:Play("StarTowerRoomInfoBossRtnfo_out", 0, 0)
|
||||
self:AddTimer(1, nAnimLength, function()
|
||||
self.gameObject:SetActive(false)
|
||||
end, true, true, true)
|
||||
end
|
||||
function StarTowerBossChallenge:ShowRtChallengeTime()
|
||||
self._mapNode.rtChallengeTime:SetActive(true)
|
||||
end
|
||||
return StarTowerBossChallenge
|
||||
@@ -0,0 +1,354 @@
|
||||
local StarTowerMapCtrl = class("StarTowerMapCtrl", BaseCtrl)
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
StarTowerMapCtrl._mapNodeConfig = {
|
||||
blurBg = {},
|
||||
sv = {
|
||||
sComponentName = "LoopScrollView",
|
||||
callback = "OnScrollRectValueChanged"
|
||||
},
|
||||
svGamepad = {
|
||||
sNodeName = "sv",
|
||||
sComponentName = "GamepadScroll"
|
||||
},
|
||||
safeAreaRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
Title = {},
|
||||
txtTitle = {sComponentName = "TMP_Text"},
|
||||
txtdifficulty = {sComponentName = "TMP_Text"},
|
||||
btnTempLeave = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Leave"
|
||||
},
|
||||
btnBack = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnGiveUp = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_GiveUp"
|
||||
},
|
||||
btnResetTop = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ResetUp"
|
||||
},
|
||||
btnResetBot = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ResetDown"
|
||||
},
|
||||
btnPopSkill = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Skill"
|
||||
},
|
||||
btnSettings = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Settings"
|
||||
},
|
||||
goHorrorRoom = {},
|
||||
rtHorrorRoom = {
|
||||
sNodeName = "goHorrorRoom",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
goRankTime = {},
|
||||
txtBattleTimeCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Battle_Time"
|
||||
},
|
||||
txtBattleTimeSec = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Battle_Time_Sec"
|
||||
},
|
||||
txtBattleTime = {sComponentName = "TMP_Text"},
|
||||
txtBtnGiveup = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTowerMap_Btn_GiveUp"
|
||||
},
|
||||
txtBtnLeave = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTowerMap_Btn_Leave"
|
||||
},
|
||||
txtBtnSkill = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTowerMap_Btn_Skill"
|
||||
},
|
||||
ActionBar = {
|
||||
sCtrlName = "Game.UI.ActionBar.ActionBarCtrl"
|
||||
}
|
||||
}
|
||||
StarTowerMapCtrl._mapEventConfig = {
|
||||
OpenStarTowerMap = "OnEvent_OpenStarTowerMap",
|
||||
RefreshCheckGridStatus = "OnEvent_RefreshCheckGridStatus",
|
||||
StartClientRankTimer = "OnEvent_StartClientRankTimer",
|
||||
ResetClientRankTimer = "OnEvent_ResetClientRankTimer",
|
||||
GamepadUIChange = "OnEvent_GamepadUIChange"
|
||||
}
|
||||
function StarTowerMapCtrl:Refresh(tbStageInfo, nCurLayer, nStarTowerId, bHorrorRoom, nTime)
|
||||
self.nTime = nTime and nTime or 0
|
||||
self.bRank = nTime ~= nil
|
||||
if self.bRank then
|
||||
self._mapNode.goRankTime.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBattleTime, nTime + self.nClientRankTime)
|
||||
else
|
||||
self._mapNode.goRankTime.gameObject:SetActive(false)
|
||||
end
|
||||
if nStarTowerId == 999 then
|
||||
self._mapNode.Title.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.Title.gameObject:SetActive(true)
|
||||
local mapStarTower = ConfigTable.GetData("StarTower", nStarTowerId)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTitle, mapStarTower.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtdifficulty, ConfigTable.GetUIText("Diffculty_" .. tostring(mapStarTower.Difficulty)))
|
||||
end
|
||||
self.tbStageInfo = tbStageInfo
|
||||
self.curLayer = nCurLayer
|
||||
if self.curLayer == nil then
|
||||
return
|
||||
end
|
||||
if bHorrorRoom then
|
||||
self._mapNode.sv.gameObject:SetActive(false)
|
||||
self._mapNode.goHorrorRoom.gameObject:SetActive(true)
|
||||
self:ShowHorrorRoom()
|
||||
else
|
||||
self._mapNode.sv.gameObject:SetActive(true)
|
||||
self._mapNode.goHorrorRoom.gameObject:SetActive(false)
|
||||
self.nCurCount = #self.tbStageInfo
|
||||
self._mapNode.sv:Init(self.nCurCount, self, self.OnGridRefresh)
|
||||
self._mapNode.sv:SetCheckGirdIndex(self.nCurCount - self.curLayer)
|
||||
if self.curLayer <= 2 then
|
||||
self._mapNode.sv:SetScrollPos(0)
|
||||
elseif self.nCurCount - self.curLayer <= 4 then
|
||||
self._mapNode.sv:SetScrollPos(1)
|
||||
else
|
||||
self._mapNode.sv:SetScrollPos(1)
|
||||
local index = self.nCurCount - self.curLayer
|
||||
self._mapNode.sv:SetScrollGridPos(index, 0, 0)
|
||||
end
|
||||
self.nPos = self._mapNode.sv:GetScrollPos()
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self.bVertical = self._mapNode.sv.vertical
|
||||
if not self.bVertical then
|
||||
self._mapNode.btnResetTop.gameObject:SetActive(false)
|
||||
for i = 1, 2 do
|
||||
self._mapNode.btnResetBot[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
end
|
||||
function StarTowerMapCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
nIndex = self.nCurCount - nIndex + 1
|
||||
local mapData = self.tbStageInfo[nIndex]
|
||||
local roomType = mapData.RoomType
|
||||
local rtGrid = goGrid:GetComponent("RectTransform")
|
||||
NovaAPI.SetCanvasGroupAlpha(rtGrid:GetComponent("CanvasGroup"), 1)
|
||||
rtGrid:Find("L/Stair").gameObject:SetActive(nIndex ~= 1)
|
||||
rtGrid:Find("R/Stair").gameObject:SetActive(nIndex ~= 1)
|
||||
local Node
|
||||
if nIndex % 2 == 1 then
|
||||
Node = rtGrid:Find("L"):GetComponent("RectTransform")
|
||||
Node.gameObject:SetActive(true)
|
||||
rtGrid:Find("R").gameObject:SetActive(false)
|
||||
else
|
||||
Node = rtGrid:Find("R"):GetComponent("RectTransform")
|
||||
Node.gameObject:SetActive(true)
|
||||
rtGrid:Find("L").gameObject:SetActive(false)
|
||||
end
|
||||
if nIndex == self.curLayer then
|
||||
Node:GetComponent("RectTransform"):Find("MapNode").gameObject:SetActive(false)
|
||||
local CurMapNode = Node:Find("CurMapNode"):GetComponent("RectTransform")
|
||||
CurMapNode.gameObject:SetActive(true)
|
||||
local txtCurLevel = CurMapNode:Find("imgMapIconBg/txtLevelNum"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtCurLevel, orderedFormat(ConfigTable.GetUIText("StarTower_Level_Title_Layer") or "", tostring(nIndex) .. "/" .. tostring(self.nTotalLevel)))
|
||||
local txtCurLevelName = CurMapNode:Find("imgMapIconBg/txtLevelName"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtCurLevelName, ConfigTable.GetUIText(AllEnum.StarTowerRoomName[roomType].Language))
|
||||
local imgMapIcon = CurMapNode:Find("imgMapIconBg/imgMapIcon"):GetComponent("Image")
|
||||
self:SetAtlasSprite(imgMapIcon, "10_ico", AllEnum.StarTowerRoomName[roomType].Icon)
|
||||
else
|
||||
Node:GetComponent("RectTransform"):Find("CurMapNode").gameObject:SetActive(false)
|
||||
local MapNode = Node:Find("MapNode"):GetComponent("RectTransform")
|
||||
MapNode.gameObject:SetActive(true)
|
||||
local imgPlatform = MapNode:Find("imgPlatform"):GetComponent("Image")
|
||||
local imgMapIcon = MapNode:Find("imgMapIcon"):GetComponent("Image")
|
||||
local _, color = ColorUtility.TryParseHtmlString(AllEnum.StarTowerRoomName[roomType].Color)
|
||||
NovaAPI.SetImageColor(imgPlatform, color)
|
||||
self:SetAtlasSprite(imgMapIcon, "10_ico", AllEnum.StarTowerRoomName[roomType].Icon)
|
||||
local txtLevel = MapNode:Find("txtLevelNum"):GetComponent("Text")
|
||||
local txtLevelName = MapNode:Find("txtLevelName"):GetComponent("Text")
|
||||
if mapData.Floor ~= -1 and mapData.Stage ~= -1 then
|
||||
NovaAPI.SetText(txtLevel, tostring(mapData.Stage) .. "-" .. tostring(mapData.Floor))
|
||||
NovaAPI.SetTextColor(txtLevel, color)
|
||||
NovaAPI.SetText(txtLevelName, ConfigTable.GetUIText(AllEnum.StarTowerRoomName[roomType].Language))
|
||||
NovaAPI.SetTextColor(txtLevelName, color)
|
||||
if nIndex < self.curLayer then
|
||||
NovaAPI.SetCanvasGroupAlpha(rtGrid:GetComponent("CanvasGroup"), 0.5)
|
||||
end
|
||||
else
|
||||
NovaAPI.SetText(txtLevel, "")
|
||||
NovaAPI.SetText(txtLevelName, "")
|
||||
end
|
||||
end
|
||||
end
|
||||
function StarTowerMapCtrl:ShowHorrorRoom()
|
||||
self._mapNode.goHorrorRoom.gameObject:SetActive(true)
|
||||
local MapNode = self._mapNode.rtHorrorRoom:Find("CurMapNode"):GetComponent("RectTransform")
|
||||
local imgPlatform = MapNode:Find("imgPlatform"):GetComponent("Image")
|
||||
local imgMapIcon = MapNode:Find("imgMapIconBg/imgMapIcon"):GetComponent("Image")
|
||||
self:SetAtlasSprite(imgMapIcon, "10_ico", AllEnum.StarTowerRoomName[GameEnum.starTowerRoomType.HorrorRoom].Icon)
|
||||
local txtLevel = MapNode:Find("imgMapIconBg/txtLevelNum"):GetComponent("TMP_Text")
|
||||
local txtLevelName = MapNode:Find("imgMapIconBg/txtLevelName"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtLevel, ConfigTable.GetUIText("StarTower_HorrorRoom_Layer"))
|
||||
NovaAPI.SetTMPText(txtLevelName, ConfigTable.GetUIText("StarTower_Enter_HorrorRoomName"))
|
||||
end
|
||||
function StarTowerMapCtrl:RefreshBottomBtn()
|
||||
local nUIType = GamepadUIManager.GetCurUIType()
|
||||
if nUIType == AllEnum.GamepadUIType.Other then
|
||||
self.nBottomIndex = 1
|
||||
else
|
||||
self.nBottomIndex = 2
|
||||
end
|
||||
self:OnScrollRectValueChanged()
|
||||
end
|
||||
function StarTowerMapCtrl:Awake()
|
||||
self.nTime = 0
|
||||
self.nClientRankTime = 0
|
||||
self.nPos = 0
|
||||
self._mapNode.safeAreaRoot:SetActive(false)
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
self.nBottomIndex = 1
|
||||
local tbConfig = {
|
||||
{
|
||||
sAction = "Back",
|
||||
sLang = "ActionBar_Back"
|
||||
},
|
||||
{
|
||||
sAction = "Giveup",
|
||||
sLang = "ActionBar_GiveUp"
|
||||
},
|
||||
{
|
||||
sAction = "Leave",
|
||||
sLang = "ActionBar_Leave"
|
||||
},
|
||||
{
|
||||
sAction = "Skill",
|
||||
sLang = "ActionBar_Skill"
|
||||
},
|
||||
{
|
||||
sAction = "Settings",
|
||||
sLang = "ActionBar_Settings"
|
||||
}
|
||||
}
|
||||
self._mapNode.ActionBar:InitActionBar(tbConfig)
|
||||
end
|
||||
function StarTowerMapCtrl:OnEnable()
|
||||
self.tbStageInfo = nil
|
||||
end
|
||||
function StarTowerMapCtrl:OnDisable()
|
||||
end
|
||||
function StarTowerMapCtrl:OnDestroy()
|
||||
end
|
||||
function StarTowerMapCtrl:OnEvent_OpenStarTowerMap(tbStageInfo, nCurLayer, nStarTowerId, tbChar, bHorrorRoom, nTime, mapCharData, nTotalLevel)
|
||||
PanelManager.InputDisable()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
GamepadUIManager.EnableGamepadUI("StarTowerMapCtrl", self.tbGamepadUINode)
|
||||
self.tbChar = tbChar
|
||||
self.mapCharData = mapCharData
|
||||
self.nTotalLevel = nTotalLevel
|
||||
self._mapNode.blurBg:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.safeAreaRoot:SetActive(true)
|
||||
self:Refresh(tbStageInfo, nCurLayer, nStarTowerId, bHorrorRoom, nTime)
|
||||
self:RefreshBottomBtn()
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function StarTowerMapCtrl:OnEvent_RefreshCheckGridStatus(nStatus)
|
||||
self.nStatus = nStatus
|
||||
end
|
||||
function StarTowerMapCtrl:OnBtnClick_Close(btn)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
self:AddTimer(1, 0.2, "OnPanelClose", true, true, true, false)
|
||||
EventManager.Hit(EventId.BattleDashboardVisible, true)
|
||||
end
|
||||
function StarTowerMapCtrl:OnBtnClick_Leave(btn)
|
||||
EventManager.Hit(EventId.StarTowerLeave)
|
||||
end
|
||||
function StarTowerMapCtrl:OnPanelClose(_, bGiveUp)
|
||||
PanelManager.InputEnable()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", true, true)
|
||||
GamepadUIManager.DisableGamepadUI("StarTowerMapCtrl")
|
||||
self._mapNode.safeAreaRoot:SetActive(false)
|
||||
self._mapNode.blurBg:SetActive(false)
|
||||
if bGiveUp then
|
||||
EventManager.Hit("AbandonStarTower")
|
||||
end
|
||||
end
|
||||
function StarTowerMapCtrl:OnBtnClick_GiveUp(btn)
|
||||
local sContent
|
||||
if self.bRank then
|
||||
sContent = ConfigTable.GetUIText("StarTower_Ranking_Abandon_Tip")
|
||||
else
|
||||
sContent = ConfigTable.GetUIText("StarTower_Pause_Tips")
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = sContent or "",
|
||||
callbackConfirm = function()
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
self:AddTimer(1, 0.2, "OnPanelClose", true, true, true, true)
|
||||
end
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function StarTowerMapCtrl:OnBtnClick_ResetUp(btn)
|
||||
self._mapNode.sv:SetScrollPos(1, 0.8)
|
||||
end
|
||||
function StarTowerMapCtrl:OnBtnClick_ResetDown(btn)
|
||||
if self.nStatus == 1 then
|
||||
self._mapNode.sv:SetScrollPos(self.nPos, 0.8)
|
||||
end
|
||||
end
|
||||
function StarTowerMapCtrl:OnBtnClick_Skill(btn)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PopupSkillPanel, self.tbChar, false, {}, self.mapCharData)
|
||||
end
|
||||
function StarTowerMapCtrl:OnBtnClick_Settings(btn)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BattleSettings)
|
||||
end
|
||||
function StarTowerMapCtrl:OnScrollRectValueChanged()
|
||||
if self.bVertical == nil then
|
||||
return
|
||||
end
|
||||
local nPos = self._mapNode.sv.verticalNormalizedPosition
|
||||
self._mapNode.btnResetTop.gameObject:SetActive(nPos < 0.99 and self.bVertical)
|
||||
for i = 1, 2 do
|
||||
if i == self.nBottomIndex then
|
||||
self._mapNode.btnResetBot[i].gameObject:SetActive(nPos > self.nPos and self.bVertical)
|
||||
else
|
||||
self._mapNode.btnResetBot[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function StarTowerMapCtrl:OnEvent_StartClientRankTimer()
|
||||
if nil == self.rankTimer then
|
||||
self.rankTimer = self:AddTimer(0, 1, function()
|
||||
self.nClientRankTime = self.nClientRankTime + 1
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBattleTime, self.nTime + self.nClientRankTime)
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
function StarTowerMapCtrl:OnEvent_ResetClientRankTimer()
|
||||
if nil ~= self.rankTimer then
|
||||
self.rankTimer:Cancel()
|
||||
end
|
||||
self.rankTimer = nil
|
||||
self.nClientRankTime = 0
|
||||
end
|
||||
function StarTowerMapCtrl:OnEvent_GamepadUIChange(sName, nBeforeType, nAfterType)
|
||||
self:RefreshBottomBtn()
|
||||
end
|
||||
return StarTowerMapCtrl
|
||||
@@ -0,0 +1,221 @@
|
||||
local StarTowerMenuCtrl = class("StarTowerMenuCtrl", BaseCtrl)
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
StarTowerMenuCtrl._mapNodeConfig = {
|
||||
contentRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
canvasGroup = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
btnBagPotential = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_BagPotential"
|
||||
},
|
||||
btnBagDisc = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_BagDisc"
|
||||
},
|
||||
btnMap = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Map"
|
||||
},
|
||||
rtBuildScore = {},
|
||||
imgRankIcon = {sComponentName = "Image"},
|
||||
TMPBuildScore = {sComponentName = "TMP_Text"},
|
||||
TMPBuildScoreTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StartowerFastBattle_BuildScore"
|
||||
},
|
||||
aniBuildSweep = {
|
||||
sNodeName = "rtBuildScore",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
cgCoin = {
|
||||
sNodeName = "imgCoinBg",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
imgCoin = {sComponentName = "Image"},
|
||||
txtCoinCount = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
StarTowerMenuCtrl._mapEventConfig = {
|
||||
LEVEL_ON_TELEPORTER_TRIGGER_RUN = "OnEvent_LevelTeleporter",
|
||||
RefreshStarTowerCoin = "OnEvent_SetCoin",
|
||||
ShowStarTowerCoin = "OnEvent_Show",
|
||||
StarTowerSetButtonEnable = "OnEvent_StarTowerSetButtonEnable",
|
||||
InputEnable = "OnEvent_InputEnable",
|
||||
StarTowerRefreshBuildScore = "OnEvent_SetBuildLevel"
|
||||
}
|
||||
function StarTowerMenuCtrl:Awake()
|
||||
self.bOpen = false
|
||||
self.tbSequence = {}
|
||||
self.nCoin = 0
|
||||
self.gameObject:SetActive(true)
|
||||
self._mapNode.rtBuildScore:SetActive(true)
|
||||
self._mapNode.rtBuildScore:SetActive(false)
|
||||
self:SetSprite_Coin(self._mapNode.imgCoin, AllEnum.CoinItemId.FixedRogCurrency)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, self.nCoin)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cgCoin, 0)
|
||||
end
|
||||
function StarTowerMenuCtrl:OnEnable()
|
||||
if self._panel.nStarTowerId == 999 then
|
||||
self:OnEvent_StarTowerSetButtonEnable(false, false)
|
||||
self._mapNode.btnBagDisc.gameObject:SetActive(false)
|
||||
self._mapNode.btnBagPotential.gameObject:SetActive(false)
|
||||
self._mapNode.btnMap.gameObject:SetActive(false)
|
||||
self._mapNode.rtBuildScore:SetActive(false)
|
||||
else
|
||||
EventManager.Hit("StarTowerSetButtonEnable", true, true)
|
||||
end
|
||||
GamepadUIManager.AddGamepadUINode("BattleMenu", self:GetGamepadUINode())
|
||||
end
|
||||
function StarTowerMenuCtrl:OnDisable()
|
||||
end
|
||||
function StarTowerMenuCtrl:OnBtnClick_BagPotential()
|
||||
EventManager.Hit(EventId.StarTowerDepot, AllEnum.StarTowerDepotTog.Potential)
|
||||
end
|
||||
function StarTowerMenuCtrl:OnBtnClick_BagDisc()
|
||||
EventManager.Hit(EventId.StarTowerDepot, AllEnum.StarTowerDepotTog.DiscSkill)
|
||||
end
|
||||
function StarTowerMenuCtrl:OnBtnClick_Map()
|
||||
EventManager.Hit(EventId.BattleDashboardVisible, false)
|
||||
EventManager.Hit(EventId.StarTowerMap)
|
||||
end
|
||||
function StarTowerMenuCtrl:OnEvent_SetCoin(nCount)
|
||||
if nCount then
|
||||
if nCount > self.nCoin then
|
||||
local twCoin = DOTween.To(function()
|
||||
return self.nCoin
|
||||
end, function(v)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, self:ThousandsNumber(math.floor(v)))
|
||||
end, nCount, 1)
|
||||
local _cb = function()
|
||||
self.nCoin = nCount
|
||||
end
|
||||
twCoin.onComplete = dotween_callback_handler(self, _cb)
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, self:ThousandsNumber(nCount))
|
||||
end
|
||||
else
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cgCoin, 0)
|
||||
self.bOpen = false
|
||||
return
|
||||
end
|
||||
if not self.bOpen then
|
||||
local tweener1 = self._mapNode.cgCoin:DOFade(1, 1)
|
||||
local tweener2 = self._mapNode.cgCoin:DOFade(0, 1)
|
||||
local sequence = DOTween.Sequence()
|
||||
sequence:Append(tweener1)
|
||||
sequence:AppendInterval(3)
|
||||
sequence:Append(tweener2)
|
||||
table.insert(self.tbSequence, sequence)
|
||||
end
|
||||
end
|
||||
function StarTowerMenuCtrl:OnEvent_SetBuildLevel(nScore)
|
||||
local GetAnimName = function(nRank)
|
||||
if nRank <= 5 then
|
||||
return "BuildScore_Green"
|
||||
elseif nRank <= 10 then
|
||||
return "BuildScore_Green"
|
||||
elseif nRank <= 20 then
|
||||
return "BuildScore_Blue"
|
||||
elseif nRank <= 30 then
|
||||
return "BuildScore_Gold"
|
||||
elseif nRank <= 40 then
|
||||
return "BuildScore_RainBow"
|
||||
end
|
||||
end
|
||||
if not self.bOpen then
|
||||
return
|
||||
end
|
||||
self.nScore = nScore
|
||||
local nLastScore = tonumber(NovaAPI.GetTMPText(self._mapNode.TMPBuildScore))
|
||||
local nAfterScore = nScore
|
||||
if nAfterScore ~= nLastScore then
|
||||
local twCoin = DOTween.To(function()
|
||||
return nLastScore
|
||||
end, function(score)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPBuildScore, math.floor(score))
|
||||
end, nAfterScore, 1)
|
||||
local _cb = function()
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPBuildScore, nAfterScore)
|
||||
end
|
||||
twCoin.onComplete = dotween_callback_handler(self, _cb)
|
||||
end
|
||||
local mapBeforeRank = PlayerData.Build:CalBuildRank(nLastScore)
|
||||
local rank = PlayerData.Build:CalBuildRank(nAfterScore)
|
||||
local wait = function()
|
||||
local imagePath = "Icon/BuildRank/BuildRank_" .. rank.Id
|
||||
self:SetPngSprite(self._mapNode.imgRankIcon, imagePath)
|
||||
end
|
||||
if rank.Id ~= mapBeforeRank.Id then
|
||||
local sAnimName = GetAnimName(rank.Id)
|
||||
self._mapNode.aniBuildSweep:Play(sAnimName)
|
||||
self:AddTimer(1, 0.1, wait, true, true, true)
|
||||
else
|
||||
wait()
|
||||
end
|
||||
end
|
||||
function StarTowerMenuCtrl:OnEvent_Show(bShow, nCount, nScore)
|
||||
self.nScore = nScore
|
||||
if nCount then
|
||||
self.nCoin = nCount
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, self:ThousandsNumber(nCount))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, 0)
|
||||
end
|
||||
if bShow and not self.bOpen then
|
||||
if 0 < #self.tbSequence then
|
||||
for _, sequence in pairs(self.tbSequence) do
|
||||
sequence:Kill()
|
||||
end
|
||||
self.tbSequence = {}
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cgCoin, 1)
|
||||
else
|
||||
self._mapNode.cgCoin:DOFade(1, 1)
|
||||
end
|
||||
self._mapNode.rtBuildScore:SetActive(true)
|
||||
local rank = PlayerData.Build:CalBuildRank(nScore)
|
||||
local imagePath = "Icon/BuildRank/BuildRank_" .. rank.Id
|
||||
self:SetPngSprite(self._mapNode.imgRankIcon, imagePath)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPBuildScore, math.floor(nScore))
|
||||
self.bOpen = true
|
||||
elseif not bShow and self.bOpen then
|
||||
if 0 < #self.tbSequence then
|
||||
for _, sequence in pairs(self.tbSequence) do
|
||||
sequence:Kill()
|
||||
end
|
||||
self.tbSequence = {}
|
||||
end
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cgCoin, 0)
|
||||
self._mapNode.rtBuildScore:SetActive(false)
|
||||
self.bOpen = false
|
||||
end
|
||||
end
|
||||
function StarTowerMenuCtrl:OnEvent_StarTowerSetButtonEnable(bShow, bEnable)
|
||||
if self._panel.nStarTowerId == 999 then
|
||||
bEnable = false
|
||||
bShow = false
|
||||
end
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, bShow == true and 1 or 0)
|
||||
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.canvasGroup, bShow == true)
|
||||
NovaAPI.SetCanvasGroupInteractable(self._mapNode.canvasGroup, bShow == true)
|
||||
self._mapNode.btnBagDisc.interactable = bEnable == true
|
||||
self._mapNode.btnBagPotential.interactable = bEnable == true
|
||||
self._mapNode.btnMap.interactable = bEnable == true
|
||||
end
|
||||
function StarTowerMenuCtrl:OnEvent_LevelTeleporter()
|
||||
self:OnEvent_StarTowerSetButtonEnable(false, false)
|
||||
end
|
||||
function StarTowerMenuCtrl:OnEvent_InputEnable(bEnable)
|
||||
if self._panel.nStarTowerId == 999 then
|
||||
bEnable = false
|
||||
end
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, bEnable == true and 1 or 0)
|
||||
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.canvasGroup, bEnable == true)
|
||||
NovaAPI.SetCanvasGroupInteractable(self._mapNode.canvasGroup, bEnable == true)
|
||||
self._mapNode.btnBagDisc.interactable = bEnable == true
|
||||
self._mapNode.btnBagPotential.interactable = bEnable == true
|
||||
self._mapNode.btnMap.interactable = bEnable == true
|
||||
end
|
||||
return StarTowerMenuCtrl
|
||||
@@ -0,0 +1,179 @@
|
||||
local StarTowerNoteCtrl = class("StarTowerNoteCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
StarTowerNoteCtrl._mapNodeConfig = {
|
||||
contentRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
canvasGroup = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "CanvasGroup"
|
||||
}
|
||||
}
|
||||
StarTowerNoteCtrl._mapEventConfig = {
|
||||
RefreshNoteCount = "OnEvent_RefreshNoteCount",
|
||||
StarTowerEventInteract = "OnEvent_StarTowerEventInteract",
|
||||
InitStarTowerNote = "OnEvent_InitStarTowerNote"
|
||||
}
|
||||
StarTowerNoteCtrl._mapRedDotConfig = {}
|
||||
function StarTowerNoteCtrl:InitPanel()
|
||||
end
|
||||
function StarTowerNoteCtrl:Awake()
|
||||
self.canvas = self.gameObject:GetComponent("Canvas")
|
||||
self.mapNoteCount = {}
|
||||
end
|
||||
function StarTowerNoteCtrl:OnEnable()
|
||||
self:InitPanel()
|
||||
end
|
||||
function StarTowerNoteCtrl:OnEvent_RefreshNoteCount(mapNote, mapChange, mapChangeSecondarySkill, bManual)
|
||||
local tbChange = {}
|
||||
local tbLose = {}
|
||||
local bChange = false
|
||||
if next(self.mapNoteCount) == nil then
|
||||
for k, v in pairs(mapNote) do
|
||||
if 0 < v then
|
||||
bChange = true
|
||||
tbChange[k] = {nCount = v, bLucky = false}
|
||||
end
|
||||
end
|
||||
else
|
||||
for k, v in pairs(mapNote) do
|
||||
local nLastCount = self.mapNoteCount[k] or 0
|
||||
if v > nLastCount then
|
||||
local bLucky = false
|
||||
if mapChange ~= nil and 0 < mapChange[k].LuckyLevel then
|
||||
bLucky = true
|
||||
end
|
||||
bChange = true
|
||||
tbChange[k] = {
|
||||
nCount = v - nLastCount,
|
||||
bLucky = bLucky
|
||||
}
|
||||
elseif v < nLastCount then
|
||||
tbLose[k] = {
|
||||
nCount = v - nLastCount
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
self.mapNoteCount = clone(mapNote)
|
||||
local tbTips = {}
|
||||
if mapChangeSecondarySkill ~= nil then
|
||||
for _, v1 in ipairs(mapChangeSecondarySkill) do
|
||||
local bShowTips = false
|
||||
for _, v2 in ipairs(mapChangeSecondarySkill) do
|
||||
if v1.Active == false then
|
||||
bShowTips = true
|
||||
if v2.Active == true then
|
||||
local mapCfg1 = ConfigTable.GetData("SecondarySkill", v1.SecondaryId)
|
||||
local mapCfg2 = ConfigTable.GetData("SecondarySkill", v2.SecondaryId)
|
||||
if mapCfg1 ~= nil and mapCfg2 ~= nil and mapCfg1.GroupId == mapCfg2.GroupId then
|
||||
bShowTips = false
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if bShowTips then
|
||||
table.insert(tbTips, {
|
||||
nSkillId = v1.SecondaryId,
|
||||
nTipType = AllEnum.StarTowerTipsType.DiscTip
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
if 0 < #tbTips then
|
||||
EventManager.Hit("StarTowerDiscTips", tbTips)
|
||||
end
|
||||
local tbNoteReduceTips = {}
|
||||
for nNoteId, data in pairs(tbLose) do
|
||||
local nCount = math.abs(data.nCount)
|
||||
table.insert(tbNoteReduceTips, {
|
||||
nNoteId = nNoteId,
|
||||
nCount = nCount,
|
||||
nTipType = AllEnum.StarTowerTipsType.NoteTip
|
||||
})
|
||||
end
|
||||
if 0 < #tbNoteReduceTips then
|
||||
if not bChange then
|
||||
self:AddTimer(1, 0.5, function()
|
||||
EventManager.Hit("ShowDiscLoseTips", tbNoteReduceTips)
|
||||
end, true, true)
|
||||
else
|
||||
EventManager.Hit("StarTowerDiscTips", tbNoteReduceTips)
|
||||
end
|
||||
end
|
||||
local tbDiscSkillChange = {}
|
||||
local tbDiscSkillAct = {}
|
||||
for i = 1, 3 do
|
||||
local nDiscId = self._panel.tbDisc[i]
|
||||
local discData = self._panel.mapDiscData[nDiscId]
|
||||
if discData ~= nil then
|
||||
local tbSkill = discData:GetAllSubSkill(self.mapNoteCount)
|
||||
if tbSkill ~= nil then
|
||||
for _, nSkillId in ipairs(tbSkill) do
|
||||
local bSkillChange = false
|
||||
local bActive = true
|
||||
local changeNoteList = {}
|
||||
local mapCfg = ConfigTable.GetData("SecondarySkill", nSkillId)
|
||||
if mapCfg ~= nil then
|
||||
local tbNote = decodeJson(mapCfg.NeedSubNoteSkills)
|
||||
for k, v in pairs(tbNote) do
|
||||
local nNoteId = tonumber(k)
|
||||
local nNeedCount = tonumber(v)
|
||||
if tbChange[nNoteId] ~= nil then
|
||||
bSkillChange = true
|
||||
changeNoteList[nNoteId] = tbChange[nNoteId]
|
||||
end
|
||||
local nCount = self.mapNoteCount[nNoteId] or 0
|
||||
if nNeedCount > nCount then
|
||||
bActive = false
|
||||
end
|
||||
end
|
||||
end
|
||||
if bSkillChange then
|
||||
table.insert(tbDiscSkillChange, {
|
||||
nDiscId = nDiscId,
|
||||
nSkillId = nSkillId,
|
||||
tbChangeNote = changeNoteList,
|
||||
bActive = bActive
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
if mapChangeSecondarySkill ~= nil then
|
||||
local tbSecondarySkillGroupId = discData.tbSubSkillGroupId
|
||||
for _, v in ipairs(tbSecondarySkillGroupId) do
|
||||
for _, data in ipairs(mapChangeSecondarySkill) do
|
||||
local mapSecSkill = ConfigTable.GetData("SecondarySkill", data.SecondaryId)
|
||||
if mapSecSkill ~= nil and data.Active == true and mapSecSkill.GroupId == v then
|
||||
table.insert(tbDiscSkillAct, {
|
||||
nDiscId = nDiscId,
|
||||
nSkillId = data.SecondaryId
|
||||
})
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if bChange and not bManual then
|
||||
table.sort(tbDiscSkillChange, function(a, b)
|
||||
return a.nSkillId < b.nSkillId
|
||||
end)
|
||||
local tbParam = {
|
||||
tbSkill = tbDiscSkillChange,
|
||||
tbNoteChange = tbChange,
|
||||
tbDiscSkillAct = tbDiscSkillAct
|
||||
}
|
||||
EventManager.Hit("DiscSkillActive", tbParam)
|
||||
end
|
||||
end
|
||||
function StarTowerNoteCtrl:OnEvent_StarTowerEventInteract(mapNoteChange, mapItemChange, mapPotentialChange, tbChangeFateCard, mapChangeSecondarySkill)
|
||||
end
|
||||
function StarTowerNoteCtrl:OnEvent_InitStarTowerNote(mapNote)
|
||||
if mapNote ~= nil then
|
||||
self.mapNoteCount = clone(mapNote)
|
||||
end
|
||||
end
|
||||
return StarTowerNoteCtrl
|
||||
@@ -0,0 +1,140 @@
|
||||
local StarTowerPanel = class("StarTowerPanel", BasePanel)
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
StarTowerPanel.OpenMinMap = false
|
||||
StarTowerPanel._bAddToBackHistory = false
|
||||
StarTowerPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Battle/BattleDashboard.prefab",
|
||||
sCtrlName = "Game.UI.Battle.BattleDashboardCtrl"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "Battle/AdventureMainUI/AdventureMainUI.prefab",
|
||||
sCtrlName = "Game.UI.Battle.MainBattleCtrl"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "Battle/SkillHintIndicators.prefab",
|
||||
sCtrlName = "Game.UI.Battle.SkillHintIndicator.HintIndicators"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "FixedRoguelikeEx/FRIndicators.prefab",
|
||||
sCtrlName = "Game.UI.FixedRoguelikeEx.FRIndicators"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "StarTower/StarTowerMenu.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.StarTowerMenuCtrl"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "StarTower/StarTowerRoomInfo.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.StarTowerRoomInfo"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "StarTower/PotentialSelectPanel.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.Potential.PotentialSelectCtrl"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "StarTower/PotentialLevelUpPanel.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.Potential.PotentialLevelUpCtrl"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "StarTower/FateCardSelectPanel.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.FateCard.FateCardSelectCtrl"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "StarTower/DiscSkillActivePanel.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.DiscTips.DiscSkillActiveCtrl"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "StarTower/StarTowerNotePanel.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.StarTowerNoteCtrl"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "StarTower/StarTowerMapPanel.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.StarTowerMapCtrl"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "StarTower/StarTowerDepotPanel.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.Depot.StarTowerDepotCtrl"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "Battle/SubSkillDisplay.prefab",
|
||||
sCtrlName = "Game.UI.Battle.SubSkillDisplay.SubSkillDisplayCtrl"
|
||||
}
|
||||
}
|
||||
function StarTowerPanel:SetTop(goCanvas)
|
||||
local nTopLayer = 0
|
||||
if nil ~= self.trUIRoot then
|
||||
local nChildCount = self.trUIRoot.childCount
|
||||
local trChild
|
||||
for i = 1, nChildCount do
|
||||
trChild = self.trUIRoot:GetChild(i - 1)
|
||||
nTopLayer = math.max(nTopLayer, NovaAPI.GetCanvasSortingOrder(trChild:GetComponent("Canvas")))
|
||||
end
|
||||
end
|
||||
if 0 < nTopLayer then
|
||||
NovaAPI.SetCanvasSortingOrder(goCanvas, nTopLayer + 1)
|
||||
end
|
||||
end
|
||||
function StarTowerPanel:CheckMainChar(nCharId)
|
||||
if self.tbTeam ~= nil then
|
||||
for k, v in ipairs(self.tbTeam) do
|
||||
if v == nCharId then
|
||||
return k == 1
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
function StarTowerPanel:GetSkillLevel(nCharId)
|
||||
local mapChar = self.mapCharData[nCharId]
|
||||
local tbList = {}
|
||||
tbList[GameEnum.skillSlotType.NORMAL] = mapChar and mapChar.tbSkillLvs[1] or 1
|
||||
tbList[GameEnum.skillSlotType.B] = mapChar and mapChar.tbSkillLvs[2] or 1
|
||||
tbList[GameEnum.skillSlotType.C] = mapChar and mapChar.tbSkillLvs[3] or 1
|
||||
tbList[GameEnum.skillSlotType.D] = mapChar and mapChar.tbSkillLvs[4] or 1
|
||||
return tbList
|
||||
end
|
||||
function StarTowerPanel:Awake()
|
||||
self.BattleType = GameEnum.worldLevelType.StarTower
|
||||
self.trUIRoot = GameObject.Find("---- UI ----").transform
|
||||
self.tbTeam = self._tbParam[1]
|
||||
self.tbDisc = self._tbParam[2]
|
||||
self.mapCharData = self._tbParam[3]
|
||||
self.mapDiscData = self._tbParam[4]
|
||||
self.mapPotentialAddLevel = self._tbParam[5]
|
||||
self.nStarTowerId = self._tbParam[6]
|
||||
self.nLastStarTowerId = self._tbParam[7]
|
||||
self.tbShowNote = {}
|
||||
local mapCfg = ConfigTable.GetData("StarTower", self.nStarTowerId)
|
||||
if mapCfg ~= nil then
|
||||
local nDropGroup = mapCfg.SubNoteSkillDropGroupId
|
||||
local tbNoteDrop = CacheTable.GetData("_SubNoteSkillDropGroup", nDropGroup)
|
||||
if tbNoteDrop ~= nil then
|
||||
for _, v in ipairs(tbNoteDrop) do
|
||||
table.insert(self.tbShowNote, v.SubNoteSkillId)
|
||||
end
|
||||
end
|
||||
end
|
||||
table.sort(self.tbShowNote, function(a, b)
|
||||
return a < b
|
||||
end)
|
||||
GamepadUIManager.EnterAdventure()
|
||||
GamepadUIManager.EnableGamepadUI("BattleMenu", {})
|
||||
end
|
||||
function StarTowerPanel:OnEnable()
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Hud, false, true)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.MainlineFormation)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.MainlineFormationDisc)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.RegionBossFormation)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function StarTowerPanel:OnAfterEnter()
|
||||
EventManager.Hit(EventId.SubSkillDisplayInit, self.tbTeam)
|
||||
end
|
||||
function StarTowerPanel:OnDisable()
|
||||
GamepadUIManager.DisableGamepadUI("BattleMenu")
|
||||
GamepadUIManager.QuitAdventure()
|
||||
end
|
||||
return StarTowerPanel
|
||||
@@ -0,0 +1,128 @@
|
||||
local StarTowerProloguePanel = class("StarTowerProloguePanel", BasePanel)
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
StarTowerProloguePanel.OpenMinMap = false
|
||||
StarTowerProloguePanel._bAddToBackHistory = false
|
||||
StarTowerProloguePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "RoguelikeItemTip/RoguelikeItemTipPanel.prefab",
|
||||
sCtrlName = "Game.UI.RoguelikeItemTips.RoguelikeItemTipsCtrl"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "Battle/BattleDashboard.prefab",
|
||||
sCtrlName = "Game.UI.Battle.BattleDashboardCtrl"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "Battle/AdventureMainUI/AdventureMainUI.prefab",
|
||||
sCtrlName = "Game.UI.Battle.MainBattleCtrl"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "Battle/SkillHintIndicators.prefab",
|
||||
sCtrlName = "Game.UI.Battle.SkillHintIndicator.HintIndicators"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "Battle/SubSkillDisplay.prefab",
|
||||
sCtrlName = "Game.UI.Battle.SubSkillDisplay.SubSkillDisplayCtrl"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "StarTower/StarTowerMenu.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.StarTowerMenuCtrl"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "StarTower/StarTowerRoomInfo.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.StarTowerRoomInfo"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "StarTower/PotentialSelectPanel.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.Potential.PotentialSelectCtrl"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "StarTower/FateCardSelectPanel.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.FateCard.FateCardSelectCtrl"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "GuideProloguel/GuideProloguelPanel.prefab",
|
||||
sCtrlName = "Game.UI.GuideProloguel.GuideProloguelCtrl"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "Battle/AdventureMainUI/BattlePopupTips.prefab",
|
||||
sCtrlName = "Game.UI.Battle.BattlePopupTipsCtrl"
|
||||
}
|
||||
}
|
||||
function StarTowerProloguePanel:SetTop(goCanvas)
|
||||
local nTopLayer = 0
|
||||
if nil ~= self.trUIRoot then
|
||||
local nChildCount = self.trUIRoot.childCount
|
||||
local trChild
|
||||
for i = 1, nChildCount do
|
||||
trChild = self.trUIRoot:GetChild(i - 1)
|
||||
nTopLayer = math.max(nTopLayer, NovaAPI.GetCanvasSortingOrder(trChild:GetComponent("Canvas")))
|
||||
end
|
||||
end
|
||||
if 0 < nTopLayer then
|
||||
NovaAPI.SetCanvasSortingOrder(goCanvas, nTopLayer + 1)
|
||||
end
|
||||
end
|
||||
function StarTowerProloguePanel:CheckMainChar(nCharId)
|
||||
if self.tbTeam ~= nil then
|
||||
for k, v in ipairs(self.tbTeam) do
|
||||
if v == nCharId then
|
||||
return k == 1
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
function StarTowerProloguePanel:GetSkillLevel(nCharId)
|
||||
local mapChar = self.mapCharData[nCharId]
|
||||
local tbList = {}
|
||||
tbList[GameEnum.skillSlotType.NORMAL] = mapChar and mapChar.tbSkillLvs[1] or 1
|
||||
tbList[GameEnum.skillSlotType.B] = mapChar and mapChar.tbSkillLvs[2] or 1
|
||||
tbList[GameEnum.skillSlotType.C] = mapChar and mapChar.tbSkillLvs[3] or 1
|
||||
tbList[GameEnum.skillSlotType.D] = mapChar and mapChar.tbSkillLvs[4] or 1
|
||||
return tbList
|
||||
end
|
||||
function StarTowerProloguePanel:Awake()
|
||||
self.BattleType = GameEnum.worldLevelType.PrologueBattleLevel
|
||||
self.trUIRoot = GameObject.Find("---- UI ----").transform
|
||||
self.tbTeam = self._tbParam[1]
|
||||
self.tbDisc = self._tbParam[2]
|
||||
self.mapCharData = self._tbParam[3]
|
||||
self.mapDiscData = self._tbParam[4]
|
||||
self.mapPotentialAddLevel = self._tbParam[5]
|
||||
self.nStarTowerId = self._tbParam[6]
|
||||
self.nLastStarTowerId = self._tbParam[7]
|
||||
self.tbShowNote = {}
|
||||
EventManager.Add(EventId.HideProloguePanle, self, self.SetProloguePanleVisible)
|
||||
GamepadUIManager.EnterAdventure()
|
||||
GamepadUIManager.EnableGamepadUI("BattleMenu", {})
|
||||
end
|
||||
function StarTowerProloguePanel:OnEnable()
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Hud)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.MainlineFormation)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.MainlineFormationDisc)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.RegionBossFormation)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function StarTowerProloguePanel:OnAfterEnter()
|
||||
EventManager.Hit(EventId.SubSkillDisplayInit, self.tbTeam)
|
||||
end
|
||||
function StarTowerProloguePanel:OnDisable()
|
||||
EventManager.Remove(EventId.HideProloguePanle, self, self.SetProloguePanleVisible)
|
||||
GamepadUIManager.DisableGamepadUI("BattleMenu")
|
||||
GamepadUIManager.QuitAdventure()
|
||||
end
|
||||
function StarTowerProloguePanel:SetProloguePanleVisible(bVisible)
|
||||
local SetVisible = function(_tb)
|
||||
for k, ctrlObjInstance in pairs(_tb) do
|
||||
ctrlObjInstance.gameObject:SetActive(bVisible == true)
|
||||
end
|
||||
end
|
||||
SetVisible(self._tbObjCtrl)
|
||||
SetVisible(self._tbObjChildCtrl)
|
||||
SetVisible(self._tbObjDyncChildCtrl)
|
||||
NovaAPI.DispatchEventWithData("BlockTouchEffect", nil, {bVisible})
|
||||
end
|
||||
return StarTowerProloguePanel
|
||||
@@ -0,0 +1,385 @@
|
||||
local StarTowerResultCtrl = class("StarTowerResultCtrl", BaseCtrl)
|
||||
local ModuleManager = require("GameCore.Module.ModuleManager")
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
StarTowerResultCtrl._mapNodeConfig = {
|
||||
normalBg = {sNodeName = "NormalBg"},
|
||||
imgBlurredBg = {},
|
||||
goComplete = {sComponentName = "GameObject"},
|
||||
goFailed = {sComponentName = "GameObject"},
|
||||
goSweep = {sComponentName = "GameObject"},
|
||||
Mask = {
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
txtFloorProcess = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
txtPerkCount = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
txtTimeValue = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
ButtonClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txt_RogueLevelName = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
FixedRoguelikeRewardGachaPanel = {
|
||||
sCtrlName = "Game.UI.FixedRoguelikeEx.FixedRoguelikeRewardGachaCtrl"
|
||||
},
|
||||
goRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
uiEffectBg = {sComponentName = "GameObject"},
|
||||
txtFloorTitle = {
|
||||
nCount = 3,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "FixedRoguelike_RoomCount"
|
||||
},
|
||||
txtPerkTitle = {
|
||||
nCount = 3,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "FixedRoguelike_PerkCount"
|
||||
},
|
||||
txtTimeTitle = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Result_Time_Title"
|
||||
},
|
||||
goRelicListSuc = {},
|
||||
goRankList = {},
|
||||
TMPHardTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Result_Difficulty_Title"
|
||||
},
|
||||
TMPHard = {sComponentName = "TMP_Text"},
|
||||
imgNewRecord = {},
|
||||
TMPFinalScoreTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Result_FinalScore_Title"
|
||||
},
|
||||
TMPFinalScore = {sComponentName = "TMP_Text"},
|
||||
TMPTimeScoreTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Result_TimeScore_Title"
|
||||
},
|
||||
TMPTimeScore = {sComponentName = "TMP_Text"},
|
||||
TMPHardScore = {sComponentName = "TMP_Text"},
|
||||
TMPHardScoreTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Result_BaseScore_Title"
|
||||
},
|
||||
txtRankTimeTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Battle_Time"
|
||||
},
|
||||
txtTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Result_Fail_Tip"
|
||||
},
|
||||
txtTipShadow = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Result_Fail_Tip"
|
||||
},
|
||||
txtRankTime = {sComponentName = "TMP_Text"},
|
||||
goMainlineNameSuc = {},
|
||||
imgSweepResult = {sComponentName = "Image"},
|
||||
UIParticle_Sweep = {},
|
||||
txtClickToContinue = {
|
||||
nCount = 3,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Tips_Continue"
|
||||
},
|
||||
imgSweepResultTitle = {}
|
||||
}
|
||||
StarTowerResultCtrl._mapEventConfig = {
|
||||
CloseRewardGacha = "OnEvent_CloseGacha"
|
||||
}
|
||||
function StarTowerResultCtrl:Refresh(teamMemberid, mapResult)
|
||||
local curFloor = 1
|
||||
if mapResult.nFloor then
|
||||
curFloor = mapResult.nFloor
|
||||
end
|
||||
local nStage = 1
|
||||
if mapResult.nStage then
|
||||
nStage = mapResult.nStage
|
||||
end
|
||||
local nTime = mapResult.nTime or 0
|
||||
for _, v in ipairs(self._mapNode.txtTimeValue) do
|
||||
NovaAPI.SetTMPText(v, orderedFormat(ConfigTable.GetUIText("StarTower_Result_Time") or "", nTime))
|
||||
end
|
||||
local perkCount = mapResult.nPerkCount
|
||||
local nRoguelikeId = mapResult.nRoguelikeId
|
||||
self.tbBonus = mapResult.tbBonus
|
||||
for k, v in pairs(mapResult.tbPresents) do
|
||||
mapResult.tbPresents[k] = {nTid = v, nCount = 1}
|
||||
end
|
||||
for k, v in pairs(mapResult.tbOutfit) do
|
||||
mapResult.tbOutfit[k] = {nTid = v, nCount = 1}
|
||||
end
|
||||
self.mapDisplayChangeInfo = {
|
||||
tbRes = mapResult.tbRes,
|
||||
tbPresents = mapResult.tbPresents,
|
||||
tbOutfit = mapResult.tbOutfit,
|
||||
tbItem = mapResult.tbItem,
|
||||
tbRarityCount = mapResult.tbRarityCount
|
||||
}
|
||||
self.mapChangeInfo = mapResult.mapChangeInfo
|
||||
local mapRoguelike = ConfigTable.GetData("StarTower", nRoguelikeId)
|
||||
self.nDifficulty = mapRoguelike.Difficulty
|
||||
local sName = orderedFormat(ConfigTable.GetUIText("Dungeon_Difficulty") or "", mapRoguelike.Name, ConfigTable.GetUIText("Diffculty_" .. self.nDifficulty))
|
||||
self:SetLevelName(sName)
|
||||
local sProcess = orderedFormat(ConfigTable.GetUIText("StarTower_Level_Title_Layer") or "", curFloor)
|
||||
self:SetFloorProcess(sProcess)
|
||||
self:SetPerkCount(tostring(perkCount))
|
||||
if teamMemberid == nil then
|
||||
teamMemberid = {103}
|
||||
end
|
||||
self._mapNode.goRelicListSuc.gameObject:SetActive(not self.bRanking)
|
||||
self._mapNode.goRankList:SetActive(self.bRanking)
|
||||
if self.bRanking then
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTimeTitle[2], ConfigTable.GetUIText("StarTower_Result_Time_Title"))
|
||||
end
|
||||
WwiseAudioMgr:PostEvent("ui_loading_combatSFX_mute", nil, false)
|
||||
WwiseAudioMgr:PostEvent("char_common_all_pause")
|
||||
WwiseAudioMgr:PostEvent("mon_common_all_pause")
|
||||
WwiseAudioMgr:PostEvent("rouguelike_outfit_resetVV")
|
||||
WwiseAudioMgr:SetState("level", "None")
|
||||
self.tbTeamMemberList = teamMemberid
|
||||
local nAnimTime
|
||||
if self.bSweep then
|
||||
self._mapNode.imgSweepResultTitle.gameObject:SetActive(self.bSuccess)
|
||||
if self.bSuccess then
|
||||
self:SetAtlasSprite(self._mapNode.imgSweepResult, "05_language", "zs_battle_result_2")
|
||||
self._mapNode.UIParticle_Sweep:SetActive(true)
|
||||
WwiseAudioMgr:SetState("system", "victory2")
|
||||
else
|
||||
WwiseAudioMgr:StopDiscMusic()
|
||||
WwiseAudioMgr:SetState("system", "defeat")
|
||||
self:SetAtlasSprite(self._mapNode.imgSweepResult, "05_language", "zs_battle_result_4")
|
||||
self._mapNode.UIParticle_Sweep:SetActive(false)
|
||||
end
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgSweepResult)
|
||||
self._mapNode.goRoot:SetActive(true)
|
||||
self._mapNode.goFailed:SetActive(false)
|
||||
self._mapNode.goComplete:SetActive(false)
|
||||
self._mapNode.goSweep:SetActive(true)
|
||||
nAnimTime = 3
|
||||
elseif self.bSuccess then
|
||||
self._mapNode.goRoot:SetActive(true)
|
||||
self._mapNode.goFailed:SetActive(false)
|
||||
self._mapNode.goComplete:SetActive(true)
|
||||
self._mapNode.goSweep:SetActive(false)
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_victory")
|
||||
WwiseAudioMgr:SetState("system", "victory2")
|
||||
nAnimTime = 4
|
||||
else
|
||||
WwiseAudioMgr:StopDiscMusic()
|
||||
WwiseAudioMgr:SetState("system", "defeat")
|
||||
PanelManager.InputDisable()
|
||||
self._mapNode.imgBlurredBg:SetActive(true)
|
||||
self._mapNode.goRoot:SetActive(false)
|
||||
self._mapNode.goFailed:SetActive(true)
|
||||
self._mapNode.goComplete:SetActive(false)
|
||||
self._mapNode.goSweep:SetActive(false)
|
||||
nAnimTime = 3
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.goRoot:SetActive(true)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
self._mapNode.Mask.gameObject:SetActive(false)
|
||||
self:AddTimer(1, nAnimTime, "PlayAnim", true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
if mapResult.tbAffinities ~= nil and 0 < #mapResult.tbAffinities and mapResult.tbAffinities ~= nil then
|
||||
for k, v in pairs(mapResult.tbAffinities) do
|
||||
PlayerData.Char:ChangeCharAffinityValue(v)
|
||||
end
|
||||
end
|
||||
self.tbNpcAffinity = {}
|
||||
local tbAffinity = mapResult.mapNPCAffinity
|
||||
if tbAffinity ~= nil then
|
||||
for _, mapReward in ipairs(tbAffinity) do
|
||||
local nNpcId = mapReward.Change.NPCId
|
||||
local mapCurNpcAffinity = PlayerData.StarTower:GetNpcAffinityData(nNpcId)
|
||||
local nBeforExp = mapCurNpcAffinity.nTotalExp - mapReward.Change.Increase
|
||||
local nBeforeLevel = 0
|
||||
local mapNpc = ConfigTable.GetData("StarTowerNPC", nNpcId)
|
||||
if mapNpc ~= nil then
|
||||
local nGroupId = mapNpc.AffinityGroupId
|
||||
for i = 0, mapCurNpcAffinity.nMaxLevel do
|
||||
local nId = nGroupId * 100 + i
|
||||
local mapAffinityCfgData = ConfigTable.GetData("NPCAffinityGroup", nId)
|
||||
if mapAffinityCfgData ~= nil and nBeforExp >= mapAffinityCfgData.AffinityValue then
|
||||
nBeforeLevel = mapAffinityCfgData.Level
|
||||
end
|
||||
end
|
||||
if mapCurNpcAffinity.Level ~= nBeforeLevel then
|
||||
table.insert(self.tbNpcAffinity, {
|
||||
NPCId = nNpcId,
|
||||
affinityLevel = mapCurNpcAffinity.Level,
|
||||
affinityLevelBefore = nBeforeLevel,
|
||||
Items = mapReward.Items
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function StarTowerResultCtrl:ProcessResult(mapResult)
|
||||
local tbReward = {}
|
||||
for _, mapInfo in ipairs(mapResult.tbRes) do
|
||||
table.insert(tbReward, {
|
||||
id = mapInfo.nTid,
|
||||
count = mapInfo.nCount
|
||||
})
|
||||
end
|
||||
for _, mapInfo in ipairs(mapResult.tbItem) do
|
||||
table.insert(tbReward, {
|
||||
id = mapInfo.nTid,
|
||||
count = mapInfo.nCount
|
||||
})
|
||||
end
|
||||
return tbReward
|
||||
end
|
||||
function StarTowerResultCtrl:Awake()
|
||||
EventManager.Hit(EventId.AvgBubbleShutDown)
|
||||
self._mapNode.goRoot:SetActive(false)
|
||||
end
|
||||
function StarTowerResultCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
local mapResult = tbParam[1]
|
||||
local teamMemberid = tbParam[2]
|
||||
self.bSuccess = mapResult.bSuccess
|
||||
self.mapBuild = mapResult.mapBuild
|
||||
self.bRanking = mapResult.bRanking
|
||||
self.bSweep = mapResult.bSweep
|
||||
self.tbTowerRewards = mapResult.tbRewards
|
||||
self._mapNode.imgBlurredBg.gameObject:SetActive(false)
|
||||
if not ModuleManager.GetIsAdventure() then
|
||||
self._mapNode.goRoot:SetActive(false)
|
||||
self._mapNode.normalBg:SetActive(true)
|
||||
self._mapNode.imgBlurredBg:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
self._mapNode.goRoot:SetActive(true)
|
||||
self:Refresh(teamMemberid, mapResult)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
else
|
||||
self._mapNode.normalBg.gameObject:SetActive(false)
|
||||
self:Refresh(teamMemberid, mapResult)
|
||||
end
|
||||
self.bProcessingClose = false
|
||||
end
|
||||
function StarTowerResultCtrl:OnDisable()
|
||||
end
|
||||
function StarTowerResultCtrl:PlayAnim()
|
||||
PlayerData.SideBanner:TryOpenSideBanner()
|
||||
local rankUpCallback = function()
|
||||
local callback = function()
|
||||
self:OpenReward()
|
||||
end
|
||||
self.bOpenUpgrade = self.bOpenUpgrade or PlayerData.Base:TryOpenWorldClassUpgrade(callback)
|
||||
end
|
||||
rankUpCallback()
|
||||
end
|
||||
function StarTowerResultCtrl:SetLevelName(sName)
|
||||
for _, v in ipairs(self._mapNode.txt_RogueLevelName) do
|
||||
NovaAPI.SetTMPText(v, sName)
|
||||
end
|
||||
end
|
||||
function StarTowerResultCtrl:SetFloorProcess(sProcess)
|
||||
for _, v in ipairs(self._mapNode.txtFloorProcess) do
|
||||
NovaAPI.SetTMPText(v, sProcess)
|
||||
end
|
||||
end
|
||||
function StarTowerResultCtrl:SetPerkCount(sPerk)
|
||||
for _, v in ipairs(self._mapNode.txtPerkCount) do
|
||||
NovaAPI.SetTMPText(v, sPerk)
|
||||
end
|
||||
end
|
||||
function StarTowerResultCtrl:ClosePanel()
|
||||
if self.bProcessingClose then
|
||||
return
|
||||
end
|
||||
self.bProcessingClose = true
|
||||
if not self.bSuccess and not self.bSweep then
|
||||
PanelManager.InputEnable(nil, true)
|
||||
end
|
||||
if self.mapBuild ~= nil then
|
||||
if self.mapBuild.BuildCoin ~= nil and self.mapBuild.BuildCoin > 0 then
|
||||
local nLimit = PlayerData.StarTower:GetStarTowerRewardLimit()
|
||||
local nCur = PlayerData.StarTower:GetStarTowerTicket()
|
||||
if nLimit < self.mapBuild.BuildCoin + nCur then
|
||||
local sTip = ConfigTable.GetUIText("BUILD_12")
|
||||
EventManager.Hit(EventId.OpenMessageBox, sTip)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StarTowerBuildSave, self.bSuccess, self.mapBuild.BuildCoin, nil, self.bSweep)
|
||||
return
|
||||
end
|
||||
elseif self.mapBuild.Brief ~= nil then
|
||||
PlayerData.Build:CacheRogueBuild(self.mapBuild)
|
||||
local buildDetailcallback = function(mapBuild)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StarTowerBuildSave, self.bSuccess, mapBuild, self.tbBonus, self.bSweep)
|
||||
end
|
||||
PlayerData.Build:GetBuildDetailData(buildDetailcallback, self.mapBuild.Brief.Id)
|
||||
return
|
||||
end
|
||||
end
|
||||
if NovaAPI.GetCurrentModuleName() == "MainMenuModuleScene" then
|
||||
EventManager.Hit(EventId.CloesCurPanel)
|
||||
EventManager.Hit("CloseRoguelikeResultCtrlEx")
|
||||
else
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.Mask, 0)
|
||||
self._mapNode.Mask.gameObject:SetActive(true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.5)
|
||||
local sequence = DOTween.Sequence()
|
||||
sequence:Append(self._mapNode.Mask:DOFade(1, 0.5):SetUpdate(true))
|
||||
sequence:AppendCallback(function()
|
||||
if self.bSuccess then
|
||||
NovaAPI.EnterModule("MainMenuModuleScene", true, 17)
|
||||
else
|
||||
local function levelEndCallback()
|
||||
EventManager.Remove("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
|
||||
NovaAPI.EnterModule("MainMenuModuleScene", true, 17)
|
||||
end
|
||||
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
|
||||
CS.AdventureModuleHelper.LevelStateChanged(true, 0, true)
|
||||
end
|
||||
end)
|
||||
sequence:SetUpdate(true)
|
||||
end
|
||||
end
|
||||
function StarTowerResultCtrl:OpenReward()
|
||||
self._mapNode.uiEffectBg:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
if PlayerData.nCurGameType ~= AllEnum.WorldMapNodeType.FixedRoguelike then
|
||||
self:OnEvent_CloseGacha()
|
||||
else
|
||||
self._mapNode.FixedRoguelikeRewardGachaPanel:ShowReward(self.mapDisplayChangeInfo)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function StarTowerResultCtrl:OnBtnClick_Close(btn)
|
||||
local AffiniftyCallback = function()
|
||||
if self.bOpenUpgrade then
|
||||
self:ClosePanel()
|
||||
else
|
||||
self:OpenReward()
|
||||
end
|
||||
end
|
||||
if #self.tbNpcAffinity > 0 then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.NPCAffinityLevelUp, self.tbNpcAffinity, AffiniftyCallback)
|
||||
else
|
||||
AffiniftyCallback()
|
||||
end
|
||||
end
|
||||
function StarTowerResultCtrl:OnEvent_CloseGacha()
|
||||
local callback = function()
|
||||
self:ClosePanel()
|
||||
end
|
||||
UTILS.OpenReceiveByDisplayItem(self.tbTowerRewards, self.mapChangeInfo, callback)
|
||||
end
|
||||
return StarTowerResultCtrl
|
||||
@@ -0,0 +1,17 @@
|
||||
local StarTowerResultPanel = class("StarTowerResultPanel", BasePanel)
|
||||
StarTowerResultPanel._bAddToBackHistory = false
|
||||
StarTowerResultPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "StarTower/StarTowerResultPanel.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.StarTowerResultCtrl"
|
||||
}
|
||||
}
|
||||
function StarTowerResultPanel:Awake()
|
||||
end
|
||||
function StarTowerResultPanel:OnEnable()
|
||||
end
|
||||
function StarTowerResultPanel:OnDisable()
|
||||
end
|
||||
function StarTowerResultPanel:OnDestroy()
|
||||
end
|
||||
return StarTowerResultPanel
|
||||
@@ -0,0 +1,595 @@
|
||||
local StarTowerRoomInfo = class("StarTowerRoomInfo", BaseCtrl)
|
||||
StarTowerRoomInfo._mapNodeConfig = {
|
||||
contentRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
canvasGroup = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
Title = {},
|
||||
txtLevelTitle = {sComponentName = "TMP_Text"},
|
||||
txtLevelLayer = {sComponentName = "TMP_Text"},
|
||||
TeamLevel = {},
|
||||
imgLevelBar = {sComponentName = "Image"},
|
||||
imgLevelBarAdd = {sComponentName = "Image"},
|
||||
txtLevelCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Reward_Level"
|
||||
},
|
||||
txtTeamLevel = {sComponentName = "TMP_Text"},
|
||||
Tips = {
|
||||
sCtrlName = "Game.UI.StarTower.DiscTips.StarTowerTipsCtrl"
|
||||
},
|
||||
IconSuccessAni = {
|
||||
sNodeName = "IconSuccess",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
ImgIconSuccess = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
IconSuccess = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
BossChallenge = {
|
||||
sCtrlName = "Game.UI.StarTower.RoomInfo.StarTowerBossChallengeCtrl"
|
||||
}
|
||||
}
|
||||
StarTowerRoomInfo._mapEventConfig = {
|
||||
ShowStarTowerLevelTitle = "OnEvent_ShowLevelTitle",
|
||||
ShowStarTowerRoomInfo = "OnEvent_ShowRoomInfo",
|
||||
ShowBattleReward = "OnEvent_ShowBattleReward",
|
||||
RefreshFateCard = "OnEvent_RefreshFateCard",
|
||||
FateCardCountChange = "OnEvent_FateCardCountChange",
|
||||
StarTowerSetButtonEnable = "OnEvent_StarTowerSetButtonEnable",
|
||||
InputEnable = "OnEvent_InputEnable",
|
||||
OpenBossTime = "OnEvent_OpenBossTime",
|
||||
CloseBossTime = "OnEvent_CloseBossTime",
|
||||
StarTowerEventInteract = "OnEvent_StarTowerEventInteract",
|
||||
StarTowerShopInteract = "OnEvent_StarTowerShopInteract",
|
||||
RefreshStarTowerCoin = "OnEvent_SetCoin",
|
||||
StarTowerShowReward = "OnEvent_StarTowerShowReward",
|
||||
ShowShopStrengthFx = "OnEvent_ShowShopStrengthFx",
|
||||
ShowNPCAffinity = "OnEvent_AffinityTips",
|
||||
ShowDiscLoseTips = "OnEvent_DiscLoseTips"
|
||||
}
|
||||
function StarTowerRoomInfo:GetTeamNeedExpByLevel(nGroupId, nLevel)
|
||||
local bMaxLevel = false
|
||||
local nNeedExp = 0
|
||||
if CacheTable.GetData("_StarTowerTeamExpGroup", nGroupId) ~= nil then
|
||||
local nMaxLevel = #CacheTable.GetData("_StarTowerTeamExpGroup", nGroupId)
|
||||
bMaxLevel = nLevel >= nMaxLevel
|
||||
if nLevel < nMaxLevel then
|
||||
local expCfg = CacheTable.GetData("_StarTowerTeamExpGroup", nGroupId)[nLevel + 1]
|
||||
nNeedExp = expCfg.NeedExp
|
||||
end
|
||||
end
|
||||
return nNeedExp, bMaxLevel
|
||||
end
|
||||
function StarTowerRoomInfo:RefreshLevel()
|
||||
local nAllExp, bMaxLevel = self:GetTeamNeedExpByLevel(1, self.nTeamLevel)
|
||||
if bMaxLevel then
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.imgLevelBar, 1)
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.imgLevelBarAdd, 1)
|
||||
else
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.imgLevelBar, self.nExp / nAllExp)
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.imgLevelBarAdd, self.nExp / nAllExp)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTeamLevel, self.nTeamLevel)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgLevelBarAdd, Color(1, 1, 1, 0))
|
||||
end
|
||||
function StarTowerRoomInfo:RefreshFateCard()
|
||||
self.tbFateCard = {}
|
||||
for k, v in pairs(self.mapFateCard) do
|
||||
local nCount = math.max(v[1], v[2])
|
||||
if 0 < nCount then
|
||||
table.insert(self.tbFateCard, {
|
||||
nId = k,
|
||||
nCount = nCount,
|
||||
nSort = 0 < nCount and 1 or 0
|
||||
})
|
||||
end
|
||||
end
|
||||
table.sort(self.tbFateCard, function(a, b)
|
||||
if a.nSort == b.nSort then
|
||||
if a.nCount == b.nCount then
|
||||
return a.nId < b.nId
|
||||
end
|
||||
return a.nCount < b.nCount
|
||||
end
|
||||
return a.nSort > b.nSort
|
||||
end)
|
||||
if #self.tbFateCard > 0 then
|
||||
self._mapNode.FateCard.gameObject:SetActive(true)
|
||||
for k, v in ipairs(self._mapNode.goFateCardItem) do
|
||||
v.gameObject:SetActive(self.tbFateCard[k] ~= nil)
|
||||
if self.tbFateCard[k] ~= nil then
|
||||
v:SetFateCardItem(self.tbFateCard[k].nId, self.tbFateCard[k].nCount)
|
||||
end
|
||||
end
|
||||
else
|
||||
self._mapNode.FateCard.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function StarTowerRoomInfo:ShowTips(mapItem)
|
||||
local tbTips = {}
|
||||
if next(mapItem) ~= nil then
|
||||
for nId, nCount in pairs(mapItem) do
|
||||
table.insert(tbTips, {
|
||||
bSkill = false,
|
||||
nTid = nId,
|
||||
nCount = nCount,
|
||||
nTipType = AllEnum.StarTowerTipsType.ItemTip
|
||||
})
|
||||
end
|
||||
end
|
||||
self._mapNode.Tips:StartShowTips(tbTips)
|
||||
end
|
||||
function StarTowerRoomInfo:ShowTipsAffinity(nNpcId, nAffinity)
|
||||
local tbTips = {}
|
||||
table.insert(tbTips, {
|
||||
nNPCId = nNpcId,
|
||||
nAffinity = nAffinity,
|
||||
nTipType = AllEnum.StarTowerTipsType.NPCAffinity
|
||||
})
|
||||
self._mapNode.Tips:StartShowTips(tbTips)
|
||||
end
|
||||
function StarTowerRoomInfo:ShowLevelChange(nLevelChange, nExpChange)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgLevelBarAdd, Color(1, 1, 1, 0))
|
||||
local nTime = 0
|
||||
local sequence = DOTween.Sequence()
|
||||
if nLevelChange ~= nil and 0 < nLevelChange then
|
||||
local nCurLv = self.nTeamLevel
|
||||
self.nTeamLevel = self.nTeamLevel + nLevelChange
|
||||
for i = 1, nLevelChange do
|
||||
nTime = nTime + 0.2
|
||||
sequence:Append(NovaAPI.ImageDoFillAmount(self._mapNode.imgLevelBar, 1, 0.2), false)
|
||||
sequence:Join(NovaAPI.ImageDoFillAmount(self._mapNode.imgLevelBarAdd, 1, 0.2), false)
|
||||
sequence:Join(NovaAPI.ImageDoColor(self._mapNode.imgLevelBarAdd, Color(1, 1, 1, 1), 0.2), false)
|
||||
sequence:AppendCallback(function()
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.imgLevelBar, 0)
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.imgLevelBarAdd, 0)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgLevelBarAdd, Color(1, 1, 1, 0))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTeamLevel, nCurLv + i)
|
||||
CS.AdventureModuleHelper.PlayTeamUpgradeFX()
|
||||
end)
|
||||
sequence:SetUpdate(true)
|
||||
end
|
||||
end
|
||||
self.nExp = nExpChange
|
||||
if 0 < nExpChange then
|
||||
nTime = nTime + 0.2
|
||||
local nAllExp = self:GetTeamNeedExpByLevel(1, self.nTeamLevel)
|
||||
sequence:Append(NovaAPI.ImageDoFillAmount(self._mapNode.imgLevelBar, nExpChange / nAllExp, 0.2, true))
|
||||
sequence:Join(NovaAPI.ImageDoFillAmount(self._mapNode.imgLevelBarAdd, nExpChange / nAllExp, 0.2, true))
|
||||
sequence:Join(NovaAPI.ImageDoColor(self._mapNode.imgLevelBarAdd, Color(1, 1, 1, 1), 0.2, true))
|
||||
sequence:Append(NovaAPI.ImageDoColor(self._mapNode.imgLevelBarAdd, Color(1, 1, 1, 0), 0.2, true))
|
||||
sequence:AppendCallback(function()
|
||||
NovaAPI.SetImageColor(self._mapNode.imgLevelBarAdd, Color(1, 1, 1, 0))
|
||||
end)
|
||||
sequence:SetUpdate(true)
|
||||
end
|
||||
return nTime
|
||||
end
|
||||
function StarTowerRoomInfo:FateCardChange(mapFateCard)
|
||||
local nFailureCount = 0
|
||||
local nFailureId = 0
|
||||
for _, v in ipairs(mapFateCard) do
|
||||
local nId = v[1]
|
||||
if v[4] == -1 then
|
||||
self.mapFateCard[nId] = nil
|
||||
nFailureCount = nFailureCount + 1
|
||||
nFailureId = nId
|
||||
printLog("移除命运卡" .. nId)
|
||||
elseif v[4] == 0 then
|
||||
self.mapFateCard[nId] = {
|
||||
v[2],
|
||||
v[3]
|
||||
}
|
||||
printLog(string.format("命运卡层数变化 id = [%s] 层数[%s]", nId, math.max(v[2], v[3])))
|
||||
elseif v[4] == 1 then
|
||||
printLog("新获得命运卡" .. nId)
|
||||
self.mapFateCard[nId] = {
|
||||
v[2],
|
||||
v[3]
|
||||
}
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
function StarTowerRoomInfo:PlayEnterRoomCharVoice(nLevel, nRoomType)
|
||||
if self._panel.nStarTowerId == 999 then
|
||||
return
|
||||
end
|
||||
local sVoiceKey = ""
|
||||
if nLevel == 1 then
|
||||
local tbPool = {"chat"}
|
||||
if self._panel.nLastStarTowerId ~= 0 then
|
||||
local mapLastCfg = ConfigTable.GetData("StarTower", self._panel.nLastStarTowerId)
|
||||
local mapCurCfg = ConfigTable.GetData("StarTower", self._panel.nStarTowerId)
|
||||
if mapCurCfg.Difficulty > mapLastCfg.Difficulty then
|
||||
table.insert(tbPool, "chatLvUp")
|
||||
end
|
||||
if mapCurCfg.GroupId ~= mapLastCfg.GroupId then
|
||||
table.insert(tbPool, "chatNext")
|
||||
end
|
||||
end
|
||||
local tbSortPool = {}
|
||||
for _, v in ipairs(tbPool) do
|
||||
local mapVoiceCfg = ConfigTable.GetData("CharacterVoiceControl", v)
|
||||
local nPriority = mapVoiceCfg.priority
|
||||
table.insert(tbSortPool, {sKey = v, nPriority = nPriority})
|
||||
end
|
||||
table.sort(tbSortPool, function(a, b)
|
||||
return a.nPriority > b.nPriority
|
||||
end)
|
||||
sVoiceKey = tbSortPool[1].sKey
|
||||
elseif nRoomType == GameEnum.starTowerRoomType.ShopRoom then
|
||||
local bRes = 1 < math.random(1, 2)
|
||||
if bRes then
|
||||
local mapData = PlayerData.Char:GetCharAffinityData(9133)
|
||||
if mapData ~= nil then
|
||||
local nAffLevel = mapData.Level
|
||||
local tbPoolNpc = {}
|
||||
for i = 3, 1, -1 do
|
||||
local tbFavorability = ConfigTable.GetConfigArray("NpcFavorabilityRange" .. i)
|
||||
if tbFavorability ~= nil and nAffLevel <= tbFavorability[2] and nAffLevel >= tbFavorability[1] then
|
||||
table.insert(tbPoolNpc, "event_lv" .. i)
|
||||
end
|
||||
end
|
||||
if 0 < #tbPoolNpc then
|
||||
PlayerData.Voice:PlayCharVoice(tbPoolNpc[math.random(1, #tbPoolNpc)], 9133)
|
||||
return
|
||||
end
|
||||
end
|
||||
else
|
||||
sVoiceKey = "shopRoom"
|
||||
end
|
||||
elseif nRoomType == GameEnum.starTowerRoomType.EventRoom then
|
||||
sVoiceKey = "eventRoom"
|
||||
end
|
||||
if sVoiceKey ~= "" then
|
||||
PlayerData.Voice:PlayCharVoice(sVoiceKey, 0)
|
||||
end
|
||||
end
|
||||
function StarTowerRoomInfo:PlayBattleResultVoice()
|
||||
PlayerData.Voice:PlayCharVoice("battleClear", 0)
|
||||
end
|
||||
function StarTowerRoomInfo:Awake()
|
||||
self.mapNoteCount = {}
|
||||
self.mapFateCard = {}
|
||||
end
|
||||
function StarTowerRoomInfo:OnEnable()
|
||||
self._mapNode.TeamLevel.gameObject:SetActive(false)
|
||||
self._mapNode.Tips.gameObject:SetActive(false)
|
||||
self._mapNode.IconSuccess.gameObject:SetActive(false)
|
||||
self._mapNode.Title.gameObject:SetActive(false)
|
||||
self._mapNode.BossChallenge.gameObject:SetActive(false)
|
||||
end
|
||||
function StarTowerRoomInfo:OnEvent_ShowRoomInfo(bShow, nTeamLevel, nExp, mapNote, mapFateCard)
|
||||
self:OnEvent_StarTowerSetButtonEnable(_, bShow)
|
||||
self._mapNode.TeamLevel.gameObject:SetActive(bShow)
|
||||
self._mapNode.Tips.gameObject:SetActive(bShow)
|
||||
EventManager.Hit("ShowRoomInfoNote", bShow, mapNote)
|
||||
if bShow then
|
||||
self.nTeamLevel = nTeamLevel
|
||||
self.nExp = nExp
|
||||
self:RefreshLevel()
|
||||
self.mapNoteCount = mapNote
|
||||
self:OnEvent_RefreshFateCard(mapFateCard)
|
||||
else
|
||||
end
|
||||
end
|
||||
function StarTowerRoomInfo:OnEvent_ShowBattleReward(nLevelChange, nExpChange, mapFateCard, mapNoteChange, mapItem, callback)
|
||||
local nTime = 0
|
||||
if 0 < nLevelChange then
|
||||
nTime = nTime + nLevelChange * 0.2
|
||||
end
|
||||
if 0 < nExpChange then
|
||||
nTime = nTime + 0.2
|
||||
end
|
||||
if mapNoteChange ~= nil and next(mapNoteChange) ~= nil then
|
||||
nTime = nTime + 0.2
|
||||
end
|
||||
self:ShowLevelChange(nLevelChange, nExpChange)
|
||||
nTime = math.max(nTime, 2)
|
||||
self:AddTimer(1, nTime + 0.5, function()
|
||||
self:ShowTips(mapItem)
|
||||
end, true, true)
|
||||
EventManager.Hit("ShowRoomInfoNote", true)
|
||||
EventManager.Hit("StarTowerSetButtonEnable", true, false)
|
||||
local showFinishCall = function()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", true, true)
|
||||
end
|
||||
if callback ~= nil and type(callback) == "function" then
|
||||
callback(nTime, showFinishCall)
|
||||
end
|
||||
self:PlayBattleResultVoice()
|
||||
CS.WwiseAudioManager.Instance:SetState("combat", "explore")
|
||||
end
|
||||
function StarTowerRoomInfo:OnEvent_ShowLevelTitle(nLevel, nTotalLevel, nRoomType)
|
||||
local delayShowTitle = function()
|
||||
self._mapNode.Title.gameObject:SetActive(true)
|
||||
local sTitle = ConfigTable.GetUIText(AllEnum.StarTowerRoomName[nRoomType].Language)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelTitle, sTitle)
|
||||
local sLayer = ""
|
||||
if nRoomType == GameEnum.starTowerRoomType.HorrorRoom or nRoomType == GameEnum.starTowerRoomType.DangerRoom then
|
||||
sLayer = "?"
|
||||
else
|
||||
sLayer = orderedFormat("{0}/{1}", nLevel, nTotalLevel)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelLayer, orderedFormat(ConfigTable.GetUIText("StarTower_Level_Title_Layer") or "", sLayer))
|
||||
self:AddTimer(1, 2, function()
|
||||
self._mapNode.Title.gameObject:SetActive(false)
|
||||
end, true, true, true)
|
||||
end
|
||||
self:AddTimer(1, 0.5, delayShowTitle, true, true, true)
|
||||
local nVoiceDelay = ConfigTable.GetConfigNumber("StarTowerPlayerVoiceDelay")
|
||||
self:AddTimer(1, nVoiceDelay, function()
|
||||
self:PlayEnterRoomCharVoice(nLevel, nRoomType)
|
||||
end, true, true, true)
|
||||
end
|
||||
function StarTowerRoomInfo:OnEvent_IconSuccessAni(rtTransform, callback)
|
||||
self._mapNode.IconSuccess.gameObject:SetActive(true)
|
||||
self._mapNode.ImgIconSuccess.gameObject:SetActive(true)
|
||||
self._mapNode.IconSuccessAni:Play("ImgIconSuccess_in")
|
||||
CS.WwiseAudioManager.Instance:PostEvent("ui_roguelike_feedback_clean")
|
||||
local TweenAnim = function()
|
||||
local tweener = self._mapNode.ImgIconSuccess:DOMove(rtTransform.position, 0.3):SetUpdate(true)
|
||||
local _cb = function()
|
||||
self._mapNode.ImgIconSuccess.gameObject:SetActive(false)
|
||||
self._mapNode.ImgIconSuccess.anchoredPosition = Vector2.zero
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
tweener.onComplete = dotween_callback_handler(self, _cb)
|
||||
end
|
||||
self:AddTimer(1, 0.6, TweenAnim, true, true, true)
|
||||
local EndCallback = function()
|
||||
self._mapNode.IconSuccess.gameObject:SetActive(false)
|
||||
end
|
||||
self:AddTimer(1, 3, EndCallback, true, true, true)
|
||||
end
|
||||
function StarTowerRoomInfo:OnEvent_RefreshFateCard(mapFateCard)
|
||||
local mapFateCardChange = {}
|
||||
local nFateCardId = 0
|
||||
if next(self.mapFateCard) ~= nil then
|
||||
for id, v in pairs(mapFateCard) do
|
||||
if nil ~= self.mapFateCard[id] and v[2] == 0 and 0 < self.mapFateCard[id][2] then
|
||||
table.insert(mapFateCardChange, id)
|
||||
nFateCardId = id
|
||||
end
|
||||
end
|
||||
end
|
||||
if 0 < nFateCardId then
|
||||
local fateCardCfg = ConfigTable.GetData_Item(nFateCardId)
|
||||
local tbTips = {}
|
||||
for _, id in ipairs(mapFateCardChange) do
|
||||
table.insert(tbTips, {
|
||||
nFateCardId = id,
|
||||
nTipType = AllEnum.StarTowerTipsType.FateCardTip
|
||||
})
|
||||
end
|
||||
self._mapNode.Tips:StartShowTips(tbTips)
|
||||
end
|
||||
self.mapFateCard = mapFateCard
|
||||
end
|
||||
function StarTowerRoomInfo:OnEvent_FateCardCountChange(nFateCardId)
|
||||
if nil ~= self.mapFateCard[nFateCardId] then
|
||||
self.mapFateCard[nFateCardId][1] = self.mapFateCard[nFateCardId][1] - 1
|
||||
if self.mapFateCard[nFateCardId][1] == 0 then
|
||||
local tbTips = {}
|
||||
table.insert(tbTips, {
|
||||
nFateCardId = nFateCardId,
|
||||
nTipType = AllEnum.StarTowerTipsType.FateCardTip
|
||||
})
|
||||
self._mapNode.Tips:StartShowTips(tbTips)
|
||||
end
|
||||
end
|
||||
end
|
||||
function StarTowerRoomInfo:OnEvent_AffinityTips(nNpcId, nAffinity)
|
||||
self:ShowTipsAffinity(nNpcId, nAffinity)
|
||||
end
|
||||
function StarTowerRoomInfo:OnEvent_DiscLoseTips(tbTips)
|
||||
self._mapNode.Tips:StartShowTips(tbTips)
|
||||
end
|
||||
function StarTowerRoomInfo:OnEvent_InputEnable(bEnable)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, bEnable == true and 1 or 0)
|
||||
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.canvasGroup, bEnable == true)
|
||||
NovaAPI.SetCanvasGroupInteractable(self._mapNode.canvasGroup, bEnable == true)
|
||||
end
|
||||
function StarTowerRoomInfo:OnEvent_StarTowerSetButtonEnable(bShow, bEnable)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, bShow == true and 1 or 0)
|
||||
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.canvasGroup, bEnable == true)
|
||||
NovaAPI.SetCanvasGroupInteractable(self._mapNode.canvasGroup, bEnable == true)
|
||||
end
|
||||
function StarTowerRoomInfo:OnEvent_OpenBossTime(nStage, nType, callback)
|
||||
local nStarTowerId = self._panel.nStarTowerId
|
||||
if CacheTable.GetData("_StarTowerLimitReward", nStarTowerId) == nil then
|
||||
printError("StarTowerLimitReward表中找不到星塔配置!!!星塔id = " .. tostring(nStarTowerId))
|
||||
return
|
||||
elseif CacheTable.GetData("_StarTowerLimitReward", nStarTowerId)[nStage] == nil then
|
||||
printError("StarTowerLimitReward表中找不到星塔stage配置!!! stage = " .. tostring(nStage))
|
||||
return
|
||||
end
|
||||
local mapData = CacheTable.GetData("_StarTowerLimitReward", nStarTowerId)[nStage][nType]
|
||||
if mapData == nil then
|
||||
return
|
||||
end
|
||||
self._mapNode.BossChallenge:StartEvent(mapData.TimeLimit, 2)
|
||||
self._mapNode.BossChallenge.gameObject:SetActive(true)
|
||||
self.nEventId = 99
|
||||
end
|
||||
function StarTowerRoomInfo:OnEvent_CloseBossTime(bSuccess)
|
||||
if self.nEventId == 99 then
|
||||
if bSuccess then
|
||||
self._mapNode.BossChallenge:Success()
|
||||
else
|
||||
self._mapNode.BossChallenge:EventEnd()
|
||||
end
|
||||
self.nEventId = nil
|
||||
end
|
||||
end
|
||||
function StarTowerRoomInfo:OnEvent_StarTowerEventInteract(mapNoteChange, mapItemChange, mapPotentialChange, tbChangeFateCard, mapChangeSecondarySkill)
|
||||
local tbRewardList = {}
|
||||
if mapItemChange ~= nil then
|
||||
for nTid, nCount in pairs(mapItemChange) do
|
||||
local itemCfg = ConfigTable.GetData_Item(nTid)
|
||||
if itemCfg ~= nil and itemCfg.Stype ~= GameEnum.itemStype.SubNoteSkill then
|
||||
if nCount < 0 then
|
||||
local sIcon = string.gsub(itemCfg.Icon2, "Icon/ZZZOther/", "")
|
||||
local sTip = orderedFormat(ConfigTable.GetUIText("StarTower_Coin_Reduce_Tip") or "", math.abs(nCount), sIcon)
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sContent = sTip
|
||||
})
|
||||
elseif 0 < nCount then
|
||||
local nHasCount = self.nCoinCount or 0
|
||||
table.insert(tbRewardList, {
|
||||
id = nTid,
|
||||
count = nCount,
|
||||
nHasCount = nHasCount
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if 0 < #tbRewardList then
|
||||
local mapReward = {
|
||||
tbReward = tbRewardList,
|
||||
tbSpReward = {},
|
||||
tbSrc = {},
|
||||
tbDst = {}
|
||||
}
|
||||
EventManager.Hit("StarTowerReward", mapReward)
|
||||
end
|
||||
if next(mapPotentialChange) ~= nil then
|
||||
local tbPotential = {}
|
||||
local tbConsumePotential = {}
|
||||
for nId, v in pairs(mapPotentialChange) do
|
||||
if v.nNextLevel < v.nLevel then
|
||||
table.insert(tbConsumePotential, {
|
||||
nId = nId,
|
||||
nLevel = v.nLevel,
|
||||
nNextLevel = v.nNextLevel
|
||||
})
|
||||
else
|
||||
table.insert(tbPotential, {
|
||||
nId = nId,
|
||||
nLevel = v.nLevel,
|
||||
nNextLevel = v.nNextLevel
|
||||
})
|
||||
end
|
||||
end
|
||||
if 0 < #tbConsumePotential then
|
||||
local sTips = ""
|
||||
for k, v in ipairs(tbConsumePotential) do
|
||||
local itemCfg = ConfigTable.GetData_Item(v.nId)
|
||||
if itemCfg ~= nil then
|
||||
sTips = sTips .. itemCfg.Title
|
||||
if k ~= #tbConsumePotential then
|
||||
sTips = sTips .. "、"
|
||||
end
|
||||
end
|
||||
end
|
||||
sTips = orderedFormat(ConfigTable.GetUIText("StarTower_Potential_Consume_Tips") or "", sTips)
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sContent = sTips
|
||||
})
|
||||
end
|
||||
if 0 < #tbPotential then
|
||||
EventManager.Hit("PotentialLevelUp", tbPotential)
|
||||
end
|
||||
end
|
||||
local tbRemove = {}
|
||||
local tbAdd = {}
|
||||
if nil ~= tbChangeFateCard then
|
||||
for _, v in ipairs(tbChangeFateCard) do
|
||||
local nId = v[1]
|
||||
if v[4] == -1 then
|
||||
table.insert(tbRemove, nId)
|
||||
elseif v[4] == 2 then
|
||||
table.insert(tbAdd, nId)
|
||||
end
|
||||
end
|
||||
if 0 < #tbRemove then
|
||||
local sName = ""
|
||||
for k, v in ipairs(tbRemove) do
|
||||
local mapFateCardCfg = ConfigTable.GetData("FateCard", v)
|
||||
if mapFateCardCfg ~= nil then
|
||||
sName = sName .. mapFateCardCfg.Name
|
||||
if k < #tbRemove then
|
||||
sName = sName .. "、"
|
||||
end
|
||||
end
|
||||
end
|
||||
local sTip = orderedFormat(ConfigTable.GetUIText("StarTower_FateCard_Remove") or "", sName)
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sContent = sTip
|
||||
})
|
||||
end
|
||||
if 0 < #tbAdd then
|
||||
local sName = ""
|
||||
for k, v in ipairs(tbAdd) do
|
||||
local mapFateCardCfg = ConfigTable.GetData("FateCard", v)
|
||||
if mapFateCardCfg ~= nil then
|
||||
sName = sName .. mapFateCardCfg.Name
|
||||
if k < #tbAdd then
|
||||
sName = sName .. "、"
|
||||
end
|
||||
end
|
||||
end
|
||||
local sTip = orderedFormat(ConfigTable.GetUIText("StarTower_FateCard_Add") or "", sName)
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sContent = sTip
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
function StarTowerRoomInfo:OnEvent_StarTowerShopInteract(mapNoteChange)
|
||||
local tbRewardList = {}
|
||||
local tbNoteReduceTips = {}
|
||||
for nNoteId, mapChangeInfo in pairs(mapNoteChange) do
|
||||
if mapChangeInfo.Qty < 0 then
|
||||
table.insert(tbNoteReduceTips, {
|
||||
nNoteId = nNoteId,
|
||||
nNoteId = mapChangeInfo.Qty,
|
||||
nTipType = AllEnum.StarTowerTipsType.NoteTip
|
||||
})
|
||||
elseif mapChangeInfo.Qty > 0 then
|
||||
end
|
||||
end
|
||||
if 0 < #tbNoteReduceTips then
|
||||
EventManager.Hit("StarTowerDiscTips", tbNoteReduceTips)
|
||||
end
|
||||
end
|
||||
function StarTowerRoomInfo:OnEvent_SetCoin(nCount)
|
||||
self.nCoinCount = nCount
|
||||
end
|
||||
function StarTowerRoomInfo:OnEvent_StarTowerShowReward(mapReward, callback)
|
||||
if mapReward ~= nil then
|
||||
UTILS.OpenReceiveByReward(mapReward, callback)
|
||||
end
|
||||
end
|
||||
function StarTowerRoomInfo:OnEvent_ShowShopStrengthFx(tbParam, callback)
|
||||
local nCost = tbParam.nCost
|
||||
EventManager.Hit(EventId.OpenMessageBox, orderedFormat(ConfigTable.GetUIText("StarTower_StrengthHint"), nCost))
|
||||
CS.AdventureModuleHelper.PlayTeamUpgradeFX()
|
||||
NovaAPI.InputDisable()
|
||||
self:AddTimer(1, 0.5, function()
|
||||
NovaAPI.InputEnable()
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end, true, true, true)
|
||||
end
|
||||
function StarTowerRoomInfo:OnEvent_InitStarTowerNote(mapNote)
|
||||
if mapNote ~= nil then
|
||||
self.mapNoteCount = clone(mapNote)
|
||||
end
|
||||
end
|
||||
return StarTowerRoomInfo
|
||||
@@ -0,0 +1,746 @@
|
||||
local GameCameraStackManager = CS.GameCameraStackManager.Instance
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local BubbleVoiceManager = require("Game.Actor2D.BubbleVoiceManager")
|
||||
local LocalSettingData = require("GameCore.Data.LocalSettingData")
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
local StarTowerShopCtrl = class("StarTowerShopCtrl", BaseCtrl)
|
||||
local _, GrayColor = ColorUtility.TryParseHtmlString("#94aac0")
|
||||
StarTowerShopCtrl._mapNodeConfig = {
|
||||
t_fullscreen_blur_blue = {},
|
||||
aniBlur = {
|
||||
sNodeName = "t_fullscreen_blur_blue",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
rawImgActor2D = {
|
||||
sNodeName = "----Actor2D----",
|
||||
sComponentName = "RawImage"
|
||||
},
|
||||
trActor2D_PNG = {
|
||||
sNodeName = "----Actor2D_PNG----",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
btnActor = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Actor"
|
||||
},
|
||||
safeAreaRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
srGoodsList = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
srBgList = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
trGoodsList = {
|
||||
sNodeName = "srGoodsList",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
ButtonBack = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtn_CloseShop"
|
||||
},
|
||||
btnBag = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtn_Depot"
|
||||
},
|
||||
goBuyPanel = {},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Shop_TitleBuy"
|
||||
},
|
||||
txtPriceCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Shop_UnitPrice"
|
||||
},
|
||||
aniBuyPanel = {
|
||||
sNodeName = "goBuyPanelAnimRoot",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
txtGoodsName = {sComponentName = "TMP_Text"},
|
||||
imgGoodsTalentBg = {sComponentName = "Image"},
|
||||
txtDesc = {sComponentName = "TMP_Text"},
|
||||
imgBuyDiscount = {},
|
||||
txtBuyDiscount = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Shop_Discount"
|
||||
},
|
||||
imgGoodsIcon = {sComponentName = "Image"},
|
||||
imgGoodsCharIcon = {sComponentName = "Image"},
|
||||
imgCharEdgeGoods = {},
|
||||
imgTickets = {sComponentName = "Image"},
|
||||
goBubble = {},
|
||||
txtBuy = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "FixedRoguelike_ShopBuy"
|
||||
},
|
||||
txtCurResume = {sComponentName = "TMP_Text"},
|
||||
goOrigin = {},
|
||||
txtOrigin = {sComponentName = "TMP_Text"},
|
||||
ButtonClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_CloseBuy"
|
||||
},
|
||||
ButtonConfirm = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtn_Confirm",
|
||||
sAction = "Confirm"
|
||||
},
|
||||
btnShortcutClose = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtn_CloseBuy"
|
||||
},
|
||||
sv = {
|
||||
sComponentName = "GamepadScroll"
|
||||
},
|
||||
TMPLink = {
|
||||
sNodeName = "txtDesc",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnLinkClick_Word"
|
||||
},
|
||||
btnBlur = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtn_CloseBuy"
|
||||
},
|
||||
imgCoin = {sComponentName = "Image"},
|
||||
txtCoinCount = {sComponentName = "TMP_Text"},
|
||||
RollButton = {},
|
||||
goRollCoin = {},
|
||||
btnRoll = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Roll"
|
||||
},
|
||||
imgRollBtn = {sComponentName = "Image"},
|
||||
imgRollCostIcon = {sComponentName = "Image"},
|
||||
txtRollCostCount = {sComponentName = "TMP_Text"},
|
||||
txtRemainRoll = {sComponentName = "TMP_Text"},
|
||||
ActionBar = {
|
||||
sCtrlName = "Game.UI.ActionBar.ActionBarCtrl"
|
||||
},
|
||||
goNoteHint = {},
|
||||
TMPNoteHintTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "STShop_OutfitNoteHintTitle"
|
||||
},
|
||||
TMPOutfitSkillInfoTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "STShop_OutfitSkillInfoTitle"
|
||||
},
|
||||
TMPNoteHintCount = {sComponentName = "TMP_Text"},
|
||||
imgIconNoteHint = {sComponentName = "Image"},
|
||||
imgOutfitSkillBg = {},
|
||||
lstOutfitSkillInfo = {
|
||||
sComponentName = "LoopScrollView"
|
||||
}
|
||||
}
|
||||
StarTowerShopCtrl._mapEventConfig = {
|
||||
OpenFixedRoguelikeShopBuyPanel = "OnEvent_OpenBuy",
|
||||
GamepadUIChange = "OnEvent_GamepadUIChange",
|
||||
StarTowerShoopSelectGoods = "OnEvent_SelectGoods",
|
||||
GamepadUIReopen = "OnEvent_Reopen",
|
||||
RefreshStarTowerCoin = "OnEvent_RefreshCoin",
|
||||
[EventId.ShowBubbleVoiceText] = "OnEvent_ShowBubbleVoiceText"
|
||||
}
|
||||
function StarTowerShopCtrl:Refresh()
|
||||
self._mapNode.RollButton:SetActive(self.mapRoll and self.mapRoll.CanReRoll)
|
||||
local nCount = #self.tbGoods
|
||||
if nCount < 5 then
|
||||
nCount = 5
|
||||
end
|
||||
self._mapNode.srGoodsList:Init(nCount, self, self.OnGridRefresh)
|
||||
local nBgCount = math.ceil(nCount / 4)
|
||||
self._mapNode.srBgList:Init(nBgCount, self, self.OnGridRefresh_Bg)
|
||||
NovaAPI.SetScrollRectVertical(self._mapNode.srBgList, false)
|
||||
self:SelectGoods()
|
||||
self:RefreshCoin()
|
||||
self:RefreshActionBar()
|
||||
end
|
||||
function StarTowerShopCtrl:RefreshActionBar()
|
||||
local tbConfig = {}
|
||||
if self.mapRoll and self.mapRoll.CanReRoll then
|
||||
tbConfig = {
|
||||
{
|
||||
sAction = "Roll",
|
||||
sLang = "ActionBar_Reroll"
|
||||
},
|
||||
{
|
||||
sAction = "Depot",
|
||||
sLang = "ActionBar_Depot"
|
||||
},
|
||||
{
|
||||
sAction = "Back",
|
||||
sLang = "ActionBar_Back"
|
||||
},
|
||||
{
|
||||
sAction = "Confirm",
|
||||
sLang = "ActionBar_Check"
|
||||
}
|
||||
}
|
||||
else
|
||||
tbConfig = {
|
||||
{
|
||||
sAction = "Depot",
|
||||
sLang = "ActionBar_Depot"
|
||||
},
|
||||
{
|
||||
sAction = "Back",
|
||||
sLang = "ActionBar_Back"
|
||||
},
|
||||
{
|
||||
sAction = "Confirm",
|
||||
sLang = "ActionBar_Check"
|
||||
}
|
||||
}
|
||||
end
|
||||
self._mapNode.ActionBar:InitActionBar(tbConfig)
|
||||
end
|
||||
function StarTowerShopCtrl:RefreshCoin()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, self:ThousandsNumber(self.nCoin))
|
||||
if not self.mapRoll or not self.mapRoll.CanReRoll then
|
||||
return
|
||||
end
|
||||
local bAble = self.mapRoll.ReRollTimes > 0
|
||||
NovaAPI.SetImageColor(self._mapNode.imgRollBtn, bAble and Blue_Normal or GrayColor)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRemainRoll, orderedFormat(ConfigTable.GetUIText("StarTower_Select_RemainRoll"), self.mapRoll.ReRollTimes))
|
||||
self:SetSprite_Coin(self._mapNode.imgRollCostIcon, AllEnum.CoinItemId.FixedRogCurrency)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRollCostCount, self.mapRoll.ReRollPrice)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtRollCostCount, self.nCoin < self.mapRoll.ReRollPrice and Red_Unable or Blue_Normal)
|
||||
self._mapNode.goRollCoin:SetActive(bAble)
|
||||
local white = Color(1, 1, 1)
|
||||
local gray = Color(1, 1, 1, 0.6)
|
||||
local trRoot = self._mapNode.btnRoll.gameObject:GetComponent("Transform"):Find("AnimRoot")
|
||||
if trRoot then
|
||||
local Xbox = trRoot:Find("Xbox")
|
||||
if Xbox then
|
||||
local icon = Xbox:Find("imgAction")
|
||||
if icon then
|
||||
NovaAPI.SetImageColor(icon:GetComponent("Image"), bAble and white or gray)
|
||||
end
|
||||
end
|
||||
local PS = trRoot:Find("PS")
|
||||
if PS then
|
||||
local icon = PS:Find("imgAction")
|
||||
if icon then
|
||||
NovaAPI.SetImageColor(icon:GetComponent("Image"), bAble and white or gray)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function StarTowerShopCtrl:PlayEnterShopNPCVoice()
|
||||
local mapCurCfg = ConfigTable.GetData("StarTower", self.nStarTowerId)
|
||||
if nil == mapCurCfg then
|
||||
return
|
||||
end
|
||||
local nFloorNum = 0
|
||||
for i = 1, #mapCurCfg.FloorNum do
|
||||
nFloorNum = nFloorNum + mapCurCfg.FloorNum[i]
|
||||
end
|
||||
if self.nCurLevel == nFloorNum then
|
||||
self.nCurVoiceId = PlayerData.Voice:PlayCharVoice("final", self.nNPCId, nil, true)
|
||||
return
|
||||
end
|
||||
local sVoiceKey = ""
|
||||
local tbPool = {"greet_npc"}
|
||||
if mapCurCfg.GroupId == 1 then
|
||||
table.insert(tbPool, "Tower_typeA")
|
||||
elseif mapCurCfg.GroupId == 2 then
|
||||
table.insert(tbPool, "Tower_typeB")
|
||||
elseif mapCurCfg.GroupId == 3 then
|
||||
table.insert(tbPool, "Tower_typeC")
|
||||
end
|
||||
if nil ~= self.tbGoods then
|
||||
for p, v in pairs(self.tbGoods) do
|
||||
if 0 < v.nDiscount then
|
||||
table.insert(tbPool, "onsale")
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
sVoiceKey = tbPool[math.random(1, #tbPool)]
|
||||
if sVoiceKey ~= "" then
|
||||
self.nCurVoiceId = PlayerData.Voice:PlayCharVoice(sVoiceKey, self.nNPCId, nil, true)
|
||||
end
|
||||
end
|
||||
function StarTowerShopCtrl:OnGridRefresh_Bg(goGrid, gridIndex)
|
||||
end
|
||||
function StarTowerShopCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local mapGoods = self.tbGoods[nIndex]
|
||||
if not self.mapGoodCtrl then
|
||||
self.mapGoodCtrl = {}
|
||||
end
|
||||
if self.mapGoodCtrl[goGrid] == nil then
|
||||
self.mapGoodCtrl[goGrid] = self:BindCtrlByNode(goGrid, "Game.UI.StarTower.StarTowerShop.StarTowerShopGridCtrl")
|
||||
end
|
||||
self.mapGoodCtrl[goGrid]:RefreshGrid(mapGoods, self.nCoin)
|
||||
end
|
||||
function StarTowerShopCtrl:Clear()
|
||||
self.tbGoods = nil
|
||||
self.tbGoodsList = nil
|
||||
self.tbBuyGridList = nil
|
||||
end
|
||||
function StarTowerShopCtrl:OpenBuyPanel(bOpen, mapGoods, bUnable, bQuit)
|
||||
if not bOpen then
|
||||
if bQuit then
|
||||
self._mapNode.t_fullscreen_blur_blue:SetActive(false)
|
||||
self._mapNode.goBuyPanel:SetActive(false)
|
||||
GamepadUIManager.DisableGamepadUI("BuyPanel")
|
||||
else
|
||||
self._mapNode.aniBuyPanel:Play("t_window_04_t_out")
|
||||
self._mapNode.aniBlur:SetTrigger("tOut")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self._mapNode.t_fullscreen_blur_blue:SetActive(false)
|
||||
self._mapNode.goBuyPanel:SetActive(false)
|
||||
GamepadUIManager.DisableGamepadUI("BuyPanel")
|
||||
self:SelectGoods()
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
end
|
||||
return
|
||||
end
|
||||
GamepadUIManager.EnableGamepadUI("BuyPanel", self.tbGoodsGamepadUINode)
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_shop_scan")
|
||||
self._mapNode.t_fullscreen_blur_blue:SetActive(true)
|
||||
self._mapNode.goBuyPanel:SetActive(true)
|
||||
self._mapNode.aniBuyPanel:Play("t_window_04_t_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
local mapGoodCfgData = ConfigTable.GetData("StarTowerShopGoods", mapGoods.Idx)
|
||||
if mapGoodCfgData == nil then
|
||||
printError("StarTowerShopGoods Missing" .. mapGoods.Idx)
|
||||
return
|
||||
end
|
||||
local nItemTid
|
||||
if mapGoods.nType == 2 then
|
||||
nItemTid = mapGoods.nGoodsId
|
||||
else
|
||||
nItemTid = mapGoodCfgData.ShowItem
|
||||
end
|
||||
local mapItem = ConfigTable.GetData_Item(nItemTid)
|
||||
if mapItem == nil then
|
||||
return
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgTickets, ConfigTable.GetData_Item(AllEnum.CoinItemId.FixedRogCurrency).Icon)
|
||||
self:SetPngSprite(self._mapNode.imgGoodsIcon, mapItem.Icon)
|
||||
local sPath = AllEnum.FrameType_New.Item .. AllEnum.FrameColor_New[mapItem.Rarity]
|
||||
self._mapNode.imgGoodsTalentBg.gameObject:SetActive(false)
|
||||
if mapGoods.nCharId ~= nil and mapGoods.nCharId > 0 then
|
||||
local nCharSkinId = PlayerData.Char:GetCharSkinId(mapGoods.nCharId)
|
||||
self:SetPngSprite(self._mapNode.imgGoodsCharIcon, ConfigTable.GetData_CharacterSkin(nCharSkinId).Icon .. AllEnum.CharHeadIconSurfix.S)
|
||||
self._mapNode.imgGoodsCharIcon.gameObject:SetActive(true)
|
||||
self._mapNode.imgCharEdgeGoods.gameObject:SetActive(true)
|
||||
else
|
||||
self._mapNode.imgGoodsCharIcon.gameObject:SetActive(false)
|
||||
self._mapNode.imgCharEdgeGoods.gameObject:SetActive(false)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDesc, mapItem.Desc)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtGoodsName, mapItem.Title)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCurResume, 0 < mapGoods.nDiscount and mapGoods.nDiscount or mapGoods.Price)
|
||||
self.mapBuy = {
|
||||
nSid = mapGoods.nSid,
|
||||
sName = mapItem.Title,
|
||||
sValue = "",
|
||||
sDesc = mapItem.Desc
|
||||
}
|
||||
self._mapNode.imgBuyDiscount:SetActive(0 < mapGoods.nDiscount)
|
||||
self._mapNode.goOrigin:SetActive(0 < mapGoods.nDiscount)
|
||||
if 0 < mapGoods.nDiscount then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtOrigin, mapGoods.Price)
|
||||
end
|
||||
if mapGoods.nType == 2 then
|
||||
self:SetNoteInfo(mapGoods.nGoodsId)
|
||||
else
|
||||
self._mapNode.imgOutfitSkillBg:SetActive(false)
|
||||
self._mapNode.goNoteHint:SetActive(false)
|
||||
end
|
||||
end
|
||||
function StarTowerShopCtrl:OpenShop(tbGoodsList, nCoin)
|
||||
if tbGoodsList == nil then
|
||||
printError("商品数据为空")
|
||||
return
|
||||
end
|
||||
self._mapNode.safeAreaRoot:SetActive(true)
|
||||
self._mapNode.RollButton:SetActive(false)
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_shopPanel_enter")
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_shop_window")
|
||||
self.tbGoods = self:SortGoods(tbGoodsList)
|
||||
self.nCoin = nCoin
|
||||
self:Refresh()
|
||||
end
|
||||
function StarTowerShopCtrl:SortGoods(tbGoodsList)
|
||||
local tbTypeSort = {
|
||||
[1] = 1,
|
||||
[2] = 2,
|
||||
[3] = 4,
|
||||
[4] = 3
|
||||
}
|
||||
local func_sort = function(a, b)
|
||||
if tbTypeSort[a.nType] ~= tbTypeSort[b.nType] then
|
||||
return tbTypeSort[a.nType] < tbTypeSort[b.nType]
|
||||
elseif a.nDiscount ~= b.nDiscount then
|
||||
return a.nDiscount > b.nDiscount
|
||||
else
|
||||
return a.nSid < b.nSid
|
||||
end
|
||||
end
|
||||
table.sort(tbGoodsList, func_sort)
|
||||
return tbGoodsList
|
||||
end
|
||||
function StarTowerShopCtrl:OpenPanel()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
local tbGoodsList = tbParam[1]
|
||||
self.nCoin = tbParam[2]
|
||||
self.BuyCallback = tbParam[3]
|
||||
self.nCaseId = tbParam[4]
|
||||
self.mapRoll = tbParam[5]
|
||||
self.tbOutfitId = tbParam[6]
|
||||
self.mapNoteCount = tbParam[7]
|
||||
self.nStarTowerId = tbParam[8]
|
||||
self.nCurLevel = tbParam[9]
|
||||
self:OpenShop(tbGoodsList, self.nCoin)
|
||||
end
|
||||
CS.GameCameraStackManager.Instance:CloseMainCamera(0.1)
|
||||
local bUseL2D = LocalSettingData.mapData.UseLive2D
|
||||
self._mapNode.rawImgActor2D.transform.localScale = bUseL2D == true and Vector3.one or Vector3.zero
|
||||
self._mapNode.trActor2D_PNG.localScale = bUseL2D == true and Vector3.zero or Vector3.one
|
||||
if bUseL2D == true then
|
||||
Actor2DManager.SetBoardNPC2D(self:GetPanelId(), self._mapNode.rawImgActor2D, self.nNPCId)
|
||||
else
|
||||
Actor2DManager.SetBoardNPC2D_PNG(self._mapNode.trActor2D_PNG, self:GetPanelId(), self.nNPCId)
|
||||
end
|
||||
self:PlayEnterShopNPCVoice()
|
||||
end
|
||||
function StarTowerShopCtrl:OnEvent_AvgVoiceEnd(nDuration)
|
||||
end
|
||||
function StarTowerShopCtrl:OnEvent_ShowBubbleVoiceText(nCharId, nId)
|
||||
local mapVoDirectoryData = ConfigTable.GetData("VoDirectory", nId)
|
||||
if mapVoDirectoryData == nil then
|
||||
printError("VoDirectory未找到数据id:" .. nId)
|
||||
return
|
||||
end
|
||||
BubbleVoiceManager.PlayFixedBubbleAnim(self._mapNode.goBubble, mapVoDirectoryData.voResource)
|
||||
end
|
||||
function StarTowerShopCtrl:Awake()
|
||||
self.mapGoodCtrl = nil
|
||||
self:Clear()
|
||||
self._mapNode.safeAreaRoot:SetActive(false)
|
||||
self:SetSprite_Coin(self._mapNode.imgCoin, AllEnum.CoinItemId.FixedRogCurrency)
|
||||
self.nNPCId = 9133
|
||||
self.nCurVoiceId = 0
|
||||
self.tbShopGamepadUINode = {
|
||||
[1] = {
|
||||
mapNode = self._mapNode.btnBag,
|
||||
sComponentName = "NaviButton"
|
||||
},
|
||||
[2] = {
|
||||
mapNode = self._mapNode.ButtonBack,
|
||||
sComponentName = "NaviButton"
|
||||
},
|
||||
[3] = {
|
||||
mapNode = self._mapNode.btnRoll,
|
||||
sComponentName = "NaviButton"
|
||||
}
|
||||
}
|
||||
self.tbGoodsGamepadUINode = {
|
||||
[1] = {
|
||||
mapNode = self._mapNode.btnShortcutClose,
|
||||
sComponentName = "NaviButton"
|
||||
},
|
||||
[2] = {
|
||||
mapNode = self._mapNode.ButtonConfirm,
|
||||
sComponentName = "NaviButton",
|
||||
sAction = "Confirm"
|
||||
},
|
||||
[3] = {
|
||||
mapNode = self._mapNode.sv,
|
||||
sComponentName = "GamepadScroll",
|
||||
sAction = "Scroll"
|
||||
}
|
||||
}
|
||||
end
|
||||
function StarTowerShopCtrl:OnEnable()
|
||||
PanelManager.InputDisable()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
self:AddTimer(1, 0.1, "OpenPanel", true, true, true)
|
||||
GamepadUIManager.EnableGamepadUI("StarTowerShopCtrl", self.tbShopGamepadUINode)
|
||||
PlayerData.Voice:StartBoardFreeTimer(self.nNPCId)
|
||||
EventManager.Add(EventId.AvgVoiceEnd, self, self.OnEvent_AvgVoiceEnd)
|
||||
end
|
||||
function StarTowerShopCtrl:OnDisable()
|
||||
if self.mapGoodCtrl then
|
||||
for nInstanceId, objCtrl in pairs(self.mapGoodCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.mapGoodCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.mapGoodCtrl = {}
|
||||
end
|
||||
CS.GameCameraStackManager.Instance:OpenMainCamera()
|
||||
Actor2DManager.UnsetBoardNPC2D()
|
||||
BubbleVoiceManager.StopBubbleAnim()
|
||||
PlayerData.Voice:ClearTimer()
|
||||
EventManager.Remove(EventId.AvgVoiceEnd, self, self.OnEvent_AvgVoiceEnd)
|
||||
end
|
||||
function StarTowerShopCtrl:OnDestroy()
|
||||
self.mapGoodCtrl = nil
|
||||
self:Clear()
|
||||
end
|
||||
function StarTowerShopCtrl:OnBtn_CloseShop()
|
||||
PanelManager.InputEnable()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", true, true)
|
||||
GamepadUIManager.DisableGamepadUI("StarTowerShopCtrl")
|
||||
self:Clear()
|
||||
EventManager.Hit("CloseFRShopPanel")
|
||||
EventManager.Hit("ReplayShopRoomBGM")
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.StarTowerShop)
|
||||
local mapData = PlayerData.Char:GetCharAffinityData(self.nNPCId)
|
||||
if mapData == nil then
|
||||
return
|
||||
end
|
||||
local nLevel = mapData.Level
|
||||
local tbPool = {}
|
||||
for i = 3, 1, -1 do
|
||||
local tbFavorability = ConfigTable.GetConfigArray("NpcFavorabilityRange" .. i)
|
||||
if tbFavorability ~= nil and nLevel <= tbFavorability[2] and nLevel >= tbFavorability[1] then
|
||||
table.insert(tbPool, "chat_lv" .. i)
|
||||
end
|
||||
end
|
||||
if 0 < #tbPool then
|
||||
PlayerData.Voice:PlayCharVoice(tbPool[math.random(1, #tbPool)], self.nNPCId, nil, true)
|
||||
end
|
||||
end
|
||||
function StarTowerShopCtrl:OnEvent_OpenBuy(mapGoods, bUnable)
|
||||
self:OpenBuyPanel(true, mapGoods, bUnable)
|
||||
end
|
||||
function StarTowerShopCtrl:OnEvent_CloseStarTowerDepot()
|
||||
if self.bOpenDepot then
|
||||
self.bOpenDepot = false
|
||||
CS.GameCameraStackManager.Instance:CloseMainCamera(0.1)
|
||||
self.gameObject:SetActive(true)
|
||||
self:SelectGoods()
|
||||
end
|
||||
end
|
||||
function StarTowerShopCtrl:OnBtn_CloseBuy()
|
||||
self:OpenBuyPanel(false)
|
||||
end
|
||||
function StarTowerShopCtrl:OnBtn_Confirm()
|
||||
local callback = function(nCoin)
|
||||
self:OpenBuyPanel(false, nil, nil, true)
|
||||
for _, mapGoods in pairs(self.tbGoods) do
|
||||
if mapGoods.nSid == self.mapBuy.nSid then
|
||||
mapGoods.bSoldOut = true
|
||||
end
|
||||
end
|
||||
self.nCoin = nCoin
|
||||
self:Refresh()
|
||||
self.nCurVoiceId = PlayerData.Voice:PlayCharVoice("thank_npc", self.nNPCId, nil, true)
|
||||
end
|
||||
if self.BuyCallback ~= nil and type(self.BuyCallback) == "function" then
|
||||
if type(self.nCaseId) == "table" then
|
||||
printError("星塔商店购买时,caseId 变成table了,他的内容是:")
|
||||
local function printTableHelper(t, indent)
|
||||
indent = indent or 0
|
||||
for k, v in pairs(t) do
|
||||
local formatting = string.rep(" ", indent) .. tostring(k) .. ": "
|
||||
if type(v) == "table" then
|
||||
printError(formatting)
|
||||
printTableHelper(v, indent + 4)
|
||||
else
|
||||
printError(formatting .. tostring(v))
|
||||
end
|
||||
end
|
||||
end
|
||||
printTableHelper(self.nCaseId, 0)
|
||||
end
|
||||
self.BuyCallback(self.nCaseId, self.mapBuy.nSid, callback)
|
||||
end
|
||||
end
|
||||
function StarTowerShopCtrl:OnBtn_UnableConfirm()
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("FIXEDROGUE_00"))
|
||||
end
|
||||
function StarTowerShopCtrl:OnBtn_Depot()
|
||||
self.bOpenDepot = true
|
||||
CS.GameCameraStackManager.Instance:OpenMainCamera()
|
||||
self.gameObject:SetActive(false)
|
||||
EventManager.Hit(EventId.StarTowerDepot, AllEnum.StarTowerDepotTog.Potential)
|
||||
end
|
||||
function StarTowerShopCtrl:OnBtnClick_Roll()
|
||||
if self.mapRoll.ReRollTimes <= 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("StarTower_ReRoll_NotEnoughCount"))
|
||||
return
|
||||
end
|
||||
if self.nCoin < self.mapRoll.ReRollPrice then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("StarTower_ReRoll_NotEnoughCoin"))
|
||||
return
|
||||
end
|
||||
local callback = function(nCoin, tbGoodsList, mapRoll)
|
||||
self.nCoin = nCoin
|
||||
self.tbGoods = self:SortGoods(tbGoodsList)
|
||||
self.mapRoll = mapRoll
|
||||
self:Refresh()
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
bPositive = true,
|
||||
sContent = ConfigTable.GetUIText("StarTower_Shop_ReRollSuccess")
|
||||
})
|
||||
end
|
||||
if self.BuyCallback ~= nil and type(self.BuyCallback) == "function" then
|
||||
self.BuyCallback(self.nCaseId, nil, callback, true)
|
||||
end
|
||||
end
|
||||
function StarTowerShopCtrl:OnLinkClick_Word(link, sWordId)
|
||||
UTILS.ClickWordLink(link, sWordId)
|
||||
end
|
||||
function StarTowerShopCtrl:OnBtnClick_Actor(btn)
|
||||
self.nCurVoiceId = PlayerData.Voice:PlayBoardNPCClickVoice(self.nNPCId)
|
||||
end
|
||||
function StarTowerShopCtrl:OnEvent_SelectGoods(nIndex)
|
||||
self.nSelectIdx = nIndex
|
||||
end
|
||||
function StarTowerShopCtrl:OnEvent_RefreshCoin(nCoin)
|
||||
self.nCoin = nCoin
|
||||
self:Refresh()
|
||||
end
|
||||
function StarTowerShopCtrl:OnEvent_GamepadUIChange(sName, nBeforeType, nAfterType)
|
||||
if sName ~= "StarTowerShopCtrl" then
|
||||
return
|
||||
end
|
||||
local bNeedSelect = nBeforeType == AllEnum.GamepadUIType.Other and nAfterType ~= AllEnum.GamepadUIType.Mouse or nBeforeType == AllEnum.GamepadUIType.Mouse and nAfterType ~= AllEnum.GamepadUIType.Other
|
||||
if bNeedSelect then
|
||||
self:SelectGoods()
|
||||
else
|
||||
GamepadUIManager.ClearSelectedUI()
|
||||
end
|
||||
end
|
||||
function StarTowerShopCtrl:OnEvent_Reopen(sName)
|
||||
if sName == "StarTowerShopCtrl" then
|
||||
if self.bOpenDepot then
|
||||
self:OnEvent_CloseStarTowerDepot()
|
||||
else
|
||||
self:SelectGoods()
|
||||
end
|
||||
end
|
||||
end
|
||||
function StarTowerShopCtrl:SelectGoods()
|
||||
local nShowIndex = self._mapNode.srGoodsList:GetFirsetGridIndex()
|
||||
if not self.nSelectIdx then
|
||||
self.nSelectIdx = nShowIndex
|
||||
end
|
||||
local goSelect = self._mapNode.trGoodsList:Find("ViewPort/Content/" .. self.nSelectIdx)
|
||||
if goSelect then
|
||||
GamepadUIManager.SetSelectedUI(goSelect:Find("ButtonBuy").gameObject)
|
||||
self.mapGoodCtrl[goSelect.gameObject]:SetSelect(true)
|
||||
else
|
||||
goSelect = self._mapNode.trGoodsList:Find("ViewPort/Content/" .. nShowIndex)
|
||||
if goSelect then
|
||||
GamepadUIManager.SetSelectedUI(goSelect:Find("ButtonBuy").gameObject)
|
||||
self.mapGoodCtrl[goSelect.gameObject]:SetSelect(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
function StarTowerShopCtrl:SetNoteInfo(nNoteId)
|
||||
local nCurCount = self.mapNoteCount[nNoteId] == nil and 0 or self.mapNoteCount[nNoteId]
|
||||
local tbOutfitId = {}
|
||||
for i = 1, 3 do
|
||||
if self.tbOutfitId[i] ~= 0 then
|
||||
table.insert(tbOutfitId, self.tbOutfitId[i])
|
||||
end
|
||||
end
|
||||
local tbSkill = PlayerData.Disc:GetDiscSkillByNote(tbOutfitId, self.mapNoteCount, nNoteId)
|
||||
local bShowInfo = false
|
||||
local nMaxNote = 0
|
||||
self.tbShowInfo = {}
|
||||
for _, mapData in ipairs(tbSkill) do
|
||||
local tbNoteInfo = {}
|
||||
local bCurrShow = false
|
||||
for nTid, nCount in pairs(mapData.tbNote) do
|
||||
table.insert(tbNoteInfo, {nTid, nCount})
|
||||
if nTid == nNoteId then
|
||||
nMaxNote = math.max(nMaxNote, nCount)
|
||||
if nCurCount < nMaxNote then
|
||||
bShowInfo = true
|
||||
bCurrShow = true
|
||||
end
|
||||
end
|
||||
end
|
||||
local sort = function(a, b)
|
||||
if a[1] == nNoteId or b[1] == nNoteId then
|
||||
return a[1] == nNoteId
|
||||
end
|
||||
return a[1] > b[1]
|
||||
end
|
||||
if bCurrShow then
|
||||
table.sort(tbNoteInfo, sort)
|
||||
table.insert(self.tbShowInfo, {
|
||||
nId = mapData.nId,
|
||||
tbNote = tbNoteInfo
|
||||
})
|
||||
end
|
||||
end
|
||||
if bShowInfo == true then
|
||||
self._mapNode.goNoteHint:SetActive(true)
|
||||
if nCurCount >= nMaxNote then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPNoteHintCount, string.format("%d/%d", nCurCount, nMaxNote))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPNoteHintCount, string.format("<color=#08d3d4>%d</color>/%d", nCurCount, nMaxNote))
|
||||
end
|
||||
local mapNote = ConfigTable.GetData("SubNoteSkill", nNoteId)
|
||||
if mapNote ~= nil then
|
||||
self:SetPngSprite(self._mapNode.imgIconNoteHint, mapNote.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
end
|
||||
else
|
||||
self._mapNode.goNoteHint:SetActive(false)
|
||||
end
|
||||
if 0 < #self.tbShowInfo then
|
||||
self._mapNode.imgOutfitSkillBg:SetActive(true)
|
||||
self._mapNode.lstOutfitSkillInfo:Init(#self.tbShowInfo, self, self.OnDiscSkillInfoGridRefresh)
|
||||
else
|
||||
self._mapNode.imgOutfitSkillBg:SetActive(false)
|
||||
end
|
||||
end
|
||||
function StarTowerShopCtrl:OnDiscSkillInfoGridRefresh(goGrid, nIdx)
|
||||
local mapSkill = self.tbShowInfo[nIdx + 1]
|
||||
local tbNoteCount = {}
|
||||
local tbimgIconCount = {}
|
||||
local TMPSkillTitle = goGrid.transform:Find("btnGrid/AnimRoot/TMPSkillTitle"):GetComponent("TMP_Text")
|
||||
local imgIcon = goGrid.transform:Find("btnGrid/AnimRoot/imgIconBg/imgIcon"):GetComponent("Image")
|
||||
local imgIconBg = goGrid.transform:Find("btnGrid/AnimRoot/imgIconBg"):GetComponent("Image")
|
||||
tbNoteCount[1] = goGrid.transform:Find("btnGrid/AnimRoot/TMPNoteCount1"):GetComponent("TMP_Text")
|
||||
tbNoteCount[2] = goGrid.transform:Find("btnGrid/AnimRoot/TMPNoteCount2"):GetComponent("TMP_Text")
|
||||
tbNoteCount[3] = goGrid.transform:Find("btnGrid/AnimRoot/TMPNoteCount3"):GetComponent("TMP_Text")
|
||||
tbimgIconCount[1] = goGrid.transform:Find("btnGrid/AnimRoot/TMPNoteCount1/imgIconCount1"):GetComponent("Image")
|
||||
tbimgIconCount[2] = goGrid.transform:Find("btnGrid/AnimRoot/TMPNoteCount2/imgIconCount2"):GetComponent("Image")
|
||||
tbimgIconCount[3] = goGrid.transform:Find("btnGrid/AnimRoot/TMPNoteCount3/imgIconCount3"):GetComponent("Image")
|
||||
local mapSkillCfg = ConfigTable.GetData("SecondarySkill", mapSkill.nId)
|
||||
if mapSkillCfg == nil then
|
||||
goGrid:SetActive(false)
|
||||
return
|
||||
else
|
||||
goGrid:SetActive(true)
|
||||
end
|
||||
NovaAPI.SetTMPText(TMPSkillTitle, mapSkillCfg.Name)
|
||||
self:SetPngSprite(imgIcon, mapSkillCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
self:SetPngSprite(imgIconBg, mapSkillCfg.IconBg .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
for i = 1, 3 do
|
||||
if mapSkill.tbNote[i] ~= nil then
|
||||
tbNoteCount[i].gameObject:SetActive(true)
|
||||
tbimgIconCount[i].gameObject:SetActive(true)
|
||||
local mapNote = ConfigTable.GetData("SubNoteSkill", mapSkill.tbNote[i][1])
|
||||
if mapNote ~= nil then
|
||||
self:SetPngSprite(tbimgIconCount[i], mapNote.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
end
|
||||
local nCurCount = self.mapNoteCount[mapSkill.tbNote[i][1]] == nil and 0 or self.mapNoteCount[mapSkill.tbNote[i][1]]
|
||||
if nCurCount >= mapSkill.tbNote[i][2] then
|
||||
NovaAPI.SetTMPText(tbNoteCount[i], string.format("%d/%d", nCurCount, mapSkill.tbNote[i][2]))
|
||||
else
|
||||
NovaAPI.SetTMPText(tbNoteCount[i], string.format("<color=#08d3d4>%d</color>/%d", nCurCount, mapSkill.tbNote[i][2]))
|
||||
end
|
||||
else
|
||||
tbNoteCount[i].gameObject:SetActive(false)
|
||||
tbimgIconCount[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
return StarTowerShopCtrl
|
||||
@@ -0,0 +1,154 @@
|
||||
local StarTowerShopGridCtrl = class("StarTowerShopGridCtrl", BaseCtrl)
|
||||
local colorGray = Color(0.5176470588235295, 0.5176470588235295, 0.5176470588235295, 1)
|
||||
local colorBlack = Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764, 1)
|
||||
local colorRed = Color(0.996078431372549, 0.23921568627450981, 0.3607843137254902, 1)
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
StarTowerShopGridCtrl._mapNodeConfig = {
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgIconMask = {sComponentName = "Image"},
|
||||
imgCharIcon = {sComponentName = "Image"},
|
||||
imgPriceBgMask = {},
|
||||
imgEmpty = {},
|
||||
txtEmpty = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "FixedRoguelike_Empty"
|
||||
},
|
||||
TMPName = {sComponentName = "TMP_Text"},
|
||||
imgCoinIcon = {sComponentName = "Image"},
|
||||
imgCharEdge = {sComponentName = "Image"},
|
||||
TMPPrice = {sComponentName = "TMP_Text"},
|
||||
ButtonBuy = {sComponentName = "NaviButton", callback = "OnBtn_Buy"},
|
||||
imgDiscount = {},
|
||||
txtDiscount = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Shop_Discount"
|
||||
},
|
||||
goOrigin = {},
|
||||
txtOrigin = {sComponentName = "TMP_Text"},
|
||||
Select = {}
|
||||
}
|
||||
StarTowerShopGridCtrl._mapEventConfig = {}
|
||||
function StarTowerShopGridCtrl:RefreshGrid(mapGoods, nHasCoin)
|
||||
self.mapGoods = mapGoods
|
||||
if mapGoods == nil then
|
||||
self._mapNode.ButtonBuy.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
self._mapNode.ButtonBuy.gameObject:SetActive(true)
|
||||
local mapGoodCfgData = ConfigTable.GetData("StarTowerShopGoods", mapGoods.Idx)
|
||||
if mapGoodCfgData == nil then
|
||||
printError("StarTowerShopGoods Missing" .. mapGoods.Idx)
|
||||
return
|
||||
end
|
||||
local nItemTid
|
||||
if mapGoods.nType == 2 then
|
||||
nItemTid = mapGoods.nGoodsId
|
||||
else
|
||||
nItemTid = mapGoodCfgData.ShowItem
|
||||
end
|
||||
local mapItem = ConfigTable.GetData_Item(nItemTid)
|
||||
if mapItem == nil then
|
||||
return
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapItem.Icon)
|
||||
self:SetPngSprite(self._mapNode.imgIconMask, mapItem.Icon)
|
||||
local nPrice = mapGoods.nDiscount > 0 and mapGoods.nDiscount or mapGoods.Price
|
||||
if mapGoods.nCharId ~= nil and 0 < mapGoods.nCharId then
|
||||
self._mapNode.imgCharEdge.gameObject:SetActive(true)
|
||||
local nCharSkinId = PlayerData.Char:GetCharSkinId(mapGoods.nCharId)
|
||||
self:SetPngSprite(self._mapNode.imgCharIcon, ConfigTable.GetData_CharacterSkin(nCharSkinId).Icon .. AllEnum.CharHeadIconSurfix.S)
|
||||
else
|
||||
self._mapNode.imgCharEdge.gameObject:SetActive(false)
|
||||
end
|
||||
local mapItemCoin = ConfigTable.GetData_Item(AllEnum.CoinItemId.FixedRogCurrency)
|
||||
if mapItemCoin == nil then
|
||||
return
|
||||
end
|
||||
if 0 < mapGoodCfgData.ShowItemNum then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPName, orderedFormat(ConfigTable.GetUIText("Startower_ShopItemTitleWithNumber") or "", mapItem.Title, mapGoodCfgData.ShowItemNum))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPName, mapItem.Title)
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgCoinIcon, mapItemCoin.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPPrice, nPrice)
|
||||
self.bBuy = nHasCoin >= nPrice and not mapGoods.bSoldOut
|
||||
self.bUnable = nHasCoin < nPrice
|
||||
self.bEmpty = mapGoods.bSoldOut
|
||||
if mapGoods.bSoldOut then
|
||||
self._mapNode.imgEmpty:SetActive(true)
|
||||
self._mapNode.imgIconMask.gameObject:SetActive(true)
|
||||
self._mapNode.imgPriceBgMask:SetActive(true)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgCharEdge, colorGray)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgCharIcon, colorGray)
|
||||
else
|
||||
self._mapNode.imgEmpty:SetActive(false)
|
||||
self._mapNode.imgIconMask.gameObject:SetActive(false)
|
||||
self._mapNode.imgPriceBgMask:SetActive(false)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgCharEdge, Color(1, 1, 1, 1))
|
||||
NovaAPI.SetImageColor(self._mapNode.imgCharIcon, Color(1, 1, 1, 1))
|
||||
end
|
||||
if self.bUnable then
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPPrice, colorRed)
|
||||
else
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPPrice, colorBlack)
|
||||
end
|
||||
self._mapNode.imgDiscount:SetActive(mapGoods.nDiscount > 0 and mapGoods.bSoldOut == false)
|
||||
self._mapNode.goOrigin:SetActive(mapGoods.nDiscount > 0)
|
||||
if mapGoods.nDiscount > 0 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtOrigin, mapGoods.Price)
|
||||
end
|
||||
end
|
||||
function StarTowerShopGridCtrl:SetSelect(bShow)
|
||||
local nUIType = GamepadUIManager.GetCurUIType()
|
||||
if nUIType ~= AllEnum.GamepadUIType.Other and nUIType ~= AllEnum.GamepadUIType.Mouse then
|
||||
self._mapNode.Select:SetActive(bShow)
|
||||
end
|
||||
end
|
||||
function StarTowerShopGridCtrl:Awake()
|
||||
end
|
||||
function StarTowerShopGridCtrl:OnEnable()
|
||||
self.handler = ui_handler(self, self.OnBtn_Select, self._mapNode.ButtonBuy)
|
||||
self._mapNode.ButtonBuy.onSelect:AddListener(self.handler)
|
||||
self.handler2 = ui_handler(self, self.OnBtn_Deselect, self._mapNode.ButtonBuy)
|
||||
self._mapNode.ButtonBuy.onDeselect:AddListener(self.handler2)
|
||||
end
|
||||
function StarTowerShopGridCtrl:OnDisable()
|
||||
if self._mapNode.ButtonBuy ~= 0 then
|
||||
self._mapNode.ButtonBuy.onSelect:RemoveListener(self.handler)
|
||||
self._mapNode.ButtonBuy.onDeselect:RemoveListener(self.handler2)
|
||||
end
|
||||
end
|
||||
function StarTowerShopGridCtrl:OnDestroy()
|
||||
end
|
||||
function StarTowerShopGridCtrl:OnBtn_Select(btn)
|
||||
EventManager.Hit("StarTowerShoopSelectGoods", tonumber(self.gameObject.name))
|
||||
local nUIType = GamepadUIManager.GetCurUIType()
|
||||
if nUIType ~= AllEnum.GamepadUIType.Other and nUIType ~= AllEnum.GamepadUIType.Mouse then
|
||||
WwiseAudioMgr:PlaySound("ui_common_click_select")
|
||||
self._mapNode.Select:SetActive(true)
|
||||
else
|
||||
self._mapNode.Select:SetActive(false)
|
||||
end
|
||||
end
|
||||
function StarTowerShopGridCtrl:OnBtn_Deselect(btn)
|
||||
self._mapNode.Select:SetActive(false)
|
||||
end
|
||||
function StarTowerShopGridCtrl:OnBtn_Buy(btn)
|
||||
if self.bBuy then
|
||||
EventManager.Hit("OpenFixedRoguelikeShopBuyPanel", self.mapGoods, self.bUnable)
|
||||
elseif self.bEmpty then
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "ui_roguelike_shop_unableConfirm",
|
||||
sContent = ConfigTable.GetUIText("FIXEDROGUE_01")
|
||||
})
|
||||
elseif self.bUnable then
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "ui_roguelike_shop_unableConfirm",
|
||||
sContent = ConfigTable.GetUIText("FIXEDROGUE_00")
|
||||
})
|
||||
end
|
||||
end
|
||||
return StarTowerShopGridCtrl
|
||||
@@ -0,0 +1,9 @@
|
||||
local StarTowerShopPanel = class("StarTowerShopPanel", BasePanel)
|
||||
StarTowerShopPanel._bIsMainPanel = false
|
||||
StarTowerShopPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "StarTower/StarTowerShopPanel.prefab",
|
||||
sCtrlName = "Game.UI.StarTower.StarTowerShop.StarTowerShopCtrl"
|
||||
}
|
||||
}
|
||||
return StarTowerShopPanel
|
||||
Reference in New Issue
Block a user