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:
SL1900
2025-12-03 01:00:00 +09:00
commit 5e0d58cfad
3595 changed files with 9373562 additions and 0 deletions
@@ -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 = self._panel.mapCharData[nCharId].nSkinId
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,358 @@
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()
if not self.attrData then
self.attrData = CharacterAttrData.new(self.nCharId, {
mapChar = self.mapCharData[self.nCharId]
})
else
self.attrData:SetCharacter(self.nCharId, {
mapChar = self.mapCharData[self.nCharId]
})
end
self:RefreshActor2D()
self:RefreshAttribute()
self:RefreshInfo()
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()
if self._panel.bBattle then
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)
else
local attrList = self.attrData:GetAttrList()
local PropertyIndexList = {
1,
2,
3,
4,
5
}
local PropertySimpleList = {
true,
true,
true,
false,
false
}
for i = 1, 5 do
local index = PropertyIndexList[i]
local mapCharAttr = AllEnum.CharAttr[index]
self._mapNode.goProperty[i]:SetCharProperty(mapCharAttr, attrList[index], PropertySimpleList[i])
end
end
end
function DepotCharInfoCtrl:RefreshActorId()
if not self._panel.bBattle then
return
end
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)
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
self._mapNode.rtEquipment:SetActive(false)
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)
end
function DepotCharInfoCtrl:OnBtnClick_Detail()
local attrList = self.attrData:GetAttrList()
if self._panel.bBattle then
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]
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
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, nIndex)
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,148 @@
local DepotDiscSkillCtrl = class("DepotDiscSkillCtrl", BaseCtrl)
DepotDiscSkillCtrl._mapNodeConfig = {
imgNote = {nCount = 9, sComponentName = "Image"},
txtNoteCount = {nCount = 9, sComponentName = "TMP_Text"},
goNoteListBtn = {
sComponentName = "UIButton",
callback = "OnBtnClick_NoteDetail"
},
btnNoteDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_NoteDetail"
},
btnDiscDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_DiscDetail"
},
txtDiscDetail = {
sComponentName = "TMP_Text",
sLanguageId = "Depot_Btn_Info"
},
txtMainSkillTitle = {
sComponentName = "TMP_Text",
sLanguageId = "Disc_MainSkill_Title"
},
txtMainSkillTitleTip = {
sComponentName = "TMP_Text",
sLanguageId = "Disc_MainSkill_TitleTip"
},
txtHarmonySkillTitle = {
sComponentName = "TMP_Text",
sLanguageId = "Disc_SubSkill_Title"
},
txtHarmonySkillTitleTip = {
sComponentName = "TMP_Text",
sLanguageId = "Disc_SubSkill_TitleTip"
},
DiscSkillDepotItem = {nCount = 3},
goDiscSkillItem = {
sCtrlName = "Game.UI.TemplateEx.TemplateDiscSkillCardCtrl"
},
goHarmonyGrid = {
sComponentName = "RectTransform"
},
HarmonySkillDepotItem = {},
subSkillEmpty = {}
}
DepotDiscSkillCtrl._mapEventConfig = {
SelectDepotDiscSkill = "OnEvent_SelectDepotDiscSkill"
}
function DepotDiscSkillCtrl:RefreshDiscSkill(mapNote)
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
if next(mapNote) == nil then
self._mapNode.goNoteListBtn.gameObject:SetActive(false)
else
self._mapNode.goNoteListBtn.gameObject:SetActive(true)
local nNoteIdx = 1
for k, v in ipairsSorted(mapNote) do
self._mapNode.imgNote[nNoteIdx].gameObject:SetActive(true)
local nNoteId = tonumber(k)
local nNoteCount = tonumber(v)
local noteCfg = ConfigTable.GetData("SubNoteSkill", nNoteId)
self:SetPngSprite(self._mapNode.imgNote[nNoteIdx], noteCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
NovaAPI.SetTMPText(self._mapNode.txtNoteCount[nNoteIdx], nNoteCount)
nNoteIdx = nNoteIdx + 1
end
end
local nSubSkillCount = 1
local nSortingOrder = self._panel._nIndex * 100 + 99
for i = 1, 3 do
local nDiscId = self._panel.tbDisc[i]
local discData = self._panel.mapDiscData[nDiscId]
table.insert(tbDisc, nDiscId)
if discData ~= nil then
table.insert(tbSkillIds, discData.nMainSkillId)
local objCtrl = self:BindCtrlByNode(self._mapNode.DiscSkillDepotItem[i].gameObject, "Game.UI.StarTower.Depot.DepotDiscMainSkillItemCtrl")
objCtrl:Refresh(discData.nMainSkillId, discData.nRarity, nDiscId, discData.nStar)
local tbSubSkill = discData:GetAllSubSkill(mapNote)
for _, nSkillId in pairs(tbSubSkill) do
local mapCfg = ConfigTable.GetData("SecondarySkill", nSkillId)
if mapCfg ~= nil and nil == self.tbHarmonySkillDepotItemCtrl[nSubSkillCount] 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)
itemCtrl:SetItem(nSkillId, nDiscId, mapNote, nSortingOrder)
elseif nil ~= mapCfg then
self.tbHarmonySkillDepotItemCtrl[nSubSkillCount]:SetItem(nSkillId, nDiscId, mapNote, nSortingOrder)
end
nSubSkillCount = nSubSkillCount + 1
end
end
end
if nSubSkillCount - 1 < 6 then
for i = 1, 7 - nSubSkillCount do
if not self.tbEmpty[i] then
local itemObj = instantiate(self._mapNode.subSkillEmpty, self._mapNode.goHarmonyGrid)
itemObj.gameObject:SetActive(true)
self.tbEmpty[i] = true
end
end
end
if PlayerData.Guide:GetGuideState() then
EventManager.Hit("Guide_StarTowerDepotDisc", 1 < 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 = {}
self.tbEmpty = {}
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 = {}
self.tbEmpty = {}
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,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.TrialBattle.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] or {}
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,79 @@
local TrialBattlePanel = class("TrialBattlePanel", BasePanel)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
TrialBattlePanel.OpenMinMap = true
TrialBattlePanel._bAddToBackHistory = false
TrialBattlePanel._tbDefine = {
{
sPrefabPath = "RoguelikeItemTip/RoguelikeItemTipPanel.prefab",
sCtrlName = "Game.UI.RoguelikeItemTips.RoguelikeItemTipsCtrl"
},
{
sPrefabPath = "Battle/BattleDashboard.prefab",
sCtrlName = "Game.UI.Battle.BattleDashboardCtrl"
},
{
sPrefabPath = "Play_TrialBattle/TrialMenu.prefab",
sCtrlName = "Game.UI.TrialBattle.TrialMenuCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/AdventureMainUI.prefab",
sCtrlName = "Game.UI.Battle.MainBattleCtrl"
},
{
sPrefabPath = "GuideProloguel/GuideProloguelPanel.prefab",
sCtrlName = "Game.UI.GuideProloguel.GuideProloguelCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/BattlePopupTips.prefab",
sCtrlName = "Game.UI.Battle.BattlePopupTipsCtrl"
},
{
sPrefabPath = "Play_TrialBattle/TrialInfo.prefab",
sCtrlName = "Game.UI.TrialBattle.TrialInfoCtrl"
},
{
sPrefabPath = "Battle/SkillHintIndicators.prefab",
sCtrlName = "Game.UI.Battle.SkillHintIndicator.HintIndicators"
},
{
sPrefabPath = "FixedRoguelikeEx/FRIndicators.prefab",
sCtrlName = "Game.UI.FixedRoguelikeEx.FRIndicators"
},
{
sPrefabPath = "Play_TrialBattle/TrialPausePanel.prefab",
sCtrlName = "Game.UI.TrialBattle.TrialPauseCtrl"
},
{
sPrefabPath = "Battle/SubSkillDisplay.prefab",
sCtrlName = "Game.UI.Battle.SubSkillDisplay.SubSkillDisplayCtrl"
}
}
function TrialBattlePanel:Awake()
GamepadUIManager.EnterAdventure()
GamepadUIManager.EnableGamepadUI("BattleMenu", {})
self.BattleType = GameEnum.worldLevelType.Dynamic
self.DynamicType = GameEnum.dynamicLevelType.Trial
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]
end
function TrialBattlePanel: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.RegionBossFormation)
EventManager.Hit(EventId.ClosePanel, PanelId.TrialFormation)
end
cs_coroutine.start(wait)
end
function TrialBattlePanel:OnAfterEnter()
EventManager.Hit(EventId.SubSkillDisplayInit, self._tbParam[1])
end
function TrialBattlePanel:OnDisable()
GamepadUIManager.DisableGamepadUI("BattleMenu")
GamepadUIManager.QuitAdventure()
end
return TrialBattlePanel
+212
View File
@@ -0,0 +1,212 @@
local TrialDepotCtrl = class("TrialDepotCtrl", BaseCtrl)
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
TrialDepotCtrl._mapNodeConfig = {
TopBar = {
sNodeName = "TopBarPanel",
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
},
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 = {},
CharInfo = {
sNodeName = "---CharInfo---",
sCtrlName = "Game.UI.TrialBattle.DepotCharInfoCtrl"
},
Potential = {
sNodeName = "---Potential---",
sCtrlName = "Game.UI.TrialBattle.DepotPotentialCtrl"
},
DiscSkill = {
sNodeName = "---DiscSkill---",
sCtrlName = "Game.UI.TrialBattle.DepotDiscSkillCtrl"
},
tog = {
nCount = 3,
sComponentName = "UIButton",
callback = "OnBtnClick_ChangeTab"
},
ctrlTog = {
nCount = 3,
sNodeName = "tog",
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
},
txt_EmptyTitle = {
sComponentName = "TMP_Text",
sLanguageId = "FRDepot_EmptyItem"
},
btnShortcutClose = {
sComponentName = "NaviButton",
callback = "OnBtnClick_Close"
}
}
TrialDepotCtrl._mapEventConfig = {
RefreshActor2D_Depot = "OnEvent_RefreshActor2D",
Guide_SelectDepotTog = "OnEvent_SelectDepotTog",
[EventId.UIBackConfirm] = "OnEvent_Close"
}
TrialDepotCtrl._mapRedDotConfig = {}
function TrialDepotCtrl: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 TrialDepotCtrl: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"))
end
function TrialDepotCtrl:SetDefaultTog()
if nil == self.nCurTog then
self.nCurTog = AllEnum.StarTowerDepotTog.Potential
end
for i = 1, 3 do
self._mapNode.ctrlTog[i]:SetDefault(i == self.nCurTog)
end
self:SwitchTog()
end
function TrialDepotCtrl:SwitchTog()
self:RefreshList()
end
function TrialDepotCtrl: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.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_OpenTrialDepot")
self._mapNode.DiscSkill:RefreshDiscSkill(self.mapNote)
end
end
function TrialDepotCtrl:Awake()
self:RefreshTogText()
self:InitAllPotential()
self.nCurTog = nil
self._mapNode.goRoot:SetActive(false)
self.tbGamepadUINode = self:GetGamepadUINode()
end
function TrialDepotCtrl:FadeOut()
end
function TrialDepotCtrl:OnEnable()
self:OnEvent_OpenTrialDepot(self._panel.mapPotential, self._panel.mapNote)
end
function TrialDepotCtrl:OnDisable()
end
function TrialDepotCtrl:OnDestroy()
end
function TrialDepotCtrl:OnRelease()
end
function TrialDepotCtrl: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 TrialDepotCtrl:OnBtnClick_Close()
self:OnEvent_Close(self._panel._nPanelId)
end
function TrialDepotCtrl:OnEvent_Close(nPanelId)
if self._panel._nPanelId ~= nPanelId then
return
end
if self._panel.bBattle then
PanelManager.InputEnable()
EventManager.Hit("TrialSetButtonEnable", true, true)
CS.GameCameraStackManager.Instance:OpenMainCamera()
EventManager.Hit(EventId.BattleDashboardVisible, true)
GamepadUIManager.DisableGamepadUI("TrialDepotCtrl")
end
self.nCurTog = nil
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()
EventManager.Hit(EventId.ClosePanel, PanelId.TrialDepot)
end
function TrialDepotCtrl:OnEvent_OpenTrialDepot(mapPotential, mapNote)
if self._panel.bBattle then
PanelManager.InputDisable()
EventManager.Hit("TrialSetButtonEnable", false, false)
GamepadUIManager.EnableGamepadUI("TrialDepotCtrl", self.tbGamepadUINode, nil, true)
end
self.mapPotential = mapPotential
self.mapNote = mapNote
self._mapNode.goBlur:SetActive(true)
EventManager.Hit(EventId.TemporaryBlockInput, 0.33)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
if self._panel.bBattle then
CS.GameCameraStackManager.Instance:CloseMainCamera(0.1)
end
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)
end
function TrialDepotCtrl:OnEvent_RefreshActor2D(nCharId)
Actor2DManager.SetActor2D_PNG(self._mapNode.trActor2D_PNG, PanelId.MainView, nCharId)
end
function TrialDepotCtrl: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
return TrialDepotCtrl
@@ -0,0 +1,34 @@
local TrialDepotPanel = class("TrialDepotPanel", BasePanel)
TrialDepotPanel._bIsMainPanel = false
TrialDepotPanel._tbDefine = {
{
sPrefabPath = "Play_TrialBattle/TrialDepotPanel.prefab",
sCtrlName = "Game.UI.TrialBattle.TrialDepotCtrl"
}
}
function TrialDepotPanel:Awake()
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.mapPotential = self._tbParam[6]
self.mapNote = self._tbParam[7]
self.bBattle = self._tbParam[8]
end
function TrialDepotPanel:OnEnable()
end
function TrialDepotPanel:OnAfterEnter()
end
function TrialDepotPanel:OnDisable()
end
function TrialDepotPanel: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
return TrialDepotPanel
+161
View File
@@ -0,0 +1,161 @@
local TrialInfoCtrl = class("TrialInfoCtrl", BaseCtrl)
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
TrialInfoCtrl._mapNodeConfig = {
Challenge = {},
canvasGroup = {
sNodeName = "----SafeAreaRoot----",
sComponentName = "CanvasGroup"
},
txtTitle = {
sComponentName = "TMP_Text",
sLanguageId = "Trial_QuestList"
},
rtList = {sComponentName = "Transform"},
goQuest = {},
aniQuest = {sNodeName = "goQuest", sComponentName = "Animator"}
}
TrialInfoCtrl._mapEventConfig = {
OpenTrialInfo = "OnEvent_OpenUI",
TrialLevelEnd = "OnEvent_CloseUI",
InputEnable = "OnEvent_InputEnable",
TrialBattleEnd = "OnEvent_BattleEnd",
TaskLevel_InitTask = "RefreshQuest",
TaskLevel_UpdateTaskTargetProcess = "UpdateTarget"
}
function TrialInfoCtrl:Awake()
self.nCurQuest = nil
self.nNextQuest = nil
self.tbTargetCount = {}
self.tbTargetProcess = {}
end
function TrialInfoCtrl:OnEnable()
self._mapNode.Challenge.gameObject:SetActive(false)
self.bBattleEnd = false
end
function TrialInfoCtrl:OnDisable()
end
function TrialInfoCtrl:OnDestroy()
end
function TrialInfoCtrl:RefreshQuest(nQuestId)
local mapQuest = ConfigTable.GetData("LevelQuest", nQuestId)
if not mapQuest then
return
end
local tbTarget = mapQuest.LevelQuestTargetIds
if not self.tbTargetCount[nQuestId] then
self.tbTargetCount[nQuestId] = {
nCur = 0,
nMax = #tbTarget
}
end
if not self.tbTargetProcess[nQuestId] then
self.tbTargetProcess[nQuestId] = {}
for _, v in ipairs(tbTarget) do
self.tbTargetProcess[nQuestId][v] = {nCur = 0, nMax = 0}
end
end
if self.nCurQuest then
if self.nCurQuest ~= nQuestId then
self.nNextQuest = nQuestId
end
return
else
self.nCurQuest = nQuestId
end
self.tbTagetNode = {}
delChildren(self._mapNode.rtList)
for _, v in ipairs(tbTarget) do
local mapTarget = ConfigTable.GetData("LevelQuestTarget", v)
if mapTarget then
local goItemObj = instantiate(self._mapNode.goQuest, self._mapNode.rtList)
goItemObj:SetActive(true)
self.tbTagetNode[v] = {}
self.tbTagetNode[v].imgOff = goItemObj.transform:Find("goReach/imgOff").gameObject
self.tbTagetNode[v].imgOn = goItemObj.transform:Find("goReach/imgOn").gameObject
self.tbTagetNode[v].txtDesc = goItemObj.transform:Find("txtDesc"):GetComponent("TMP_Text")
self.tbTagetNode[v].ani = goItemObj.transform:GetComponent("Animator")
self.tbTagetNode[v].sPrefix = UTILS.ParseLevelQuestTargetDesc(mapTarget.QuestDes, mapTarget)
local sSuffix = ""
if 0 < self.tbTargetProcess[nQuestId][v].nCur then
sSuffix = "<color=#2be1f1>(" .. self.tbTargetProcess[nQuestId][v].nCur .. "/" .. self.tbTargetProcess[nQuestId][v].nMax .. ")</color>"
else
sSuffix = UTILS.GetLevelQuestTargetProcess(mapTarget)
end
local bComplete = false
if 0 < self.tbTargetProcess[nQuestId][v].nCur then
bComplete = self.tbTargetProcess[nQuestId][v].nCur >= self.tbTargetProcess[nQuestId][v].nMax
end
self.tbTagetNode[v].imgOff:SetActive(not bComplete)
self.tbTagetNode[v].imgOn:SetActive(bComplete)
NovaAPI.SetTMPText(self.tbTagetNode[v].txtDesc, self.tbTagetNode[v].sPrefix .. sSuffix)
end
end
end
function TrialInfoCtrl:UpdateTarget(nQuestId, nTargetId, nCur, nMax)
nCur = nCur:AsInt()
nMax = nMax:AsInt()
local bComplete = nCur >= nMax
self.tbTargetProcess[nQuestId][nTargetId].nCur = nCur
self.tbTargetProcess[nQuestId][nTargetId].nMax = nMax
if bComplete then
self.tbTargetCount[nQuestId].nCur = self.tbTargetCount[nQuestId].nCur + 1
end
if nQuestId ~= self.nCurQuest then
return
end
if self.tbTargetCount[nQuestId].nCur == self.tbTargetCount[nQuestId].nMax then
self:SetTimer()
end
if not self.tbTagetNode[nTargetId] then
return
end
self.tbTagetNode[nTargetId].imgOff:SetActive(not bComplete)
self.tbTagetNode[nTargetId].imgOn:SetActive(bComplete)
local sSuffix = "<color=#2be1f1>(" .. nCur .. "/" .. nMax .. ")</color>"
NovaAPI.SetTMPText(self.tbTagetNode[nTargetId].txtDesc, self.tbTagetNode[nTargetId].sPrefix .. sSuffix)
if bComplete then
self.tbTagetNode[nTargetId].ani:Play("TrialInfo_Quest_on")
WwiseAudioMgr:PostEvent("ui_tip_complete")
end
end
function TrialInfoCtrl:SetTimer()
if self.timer ~= nil then
self.timer:Cancel()
end
local nAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.aniQuest, {
"TrialInfo_Quest_on"
})
local countdown = function()
self.nCurQuest = nil
if self.nNextQuest then
self:RefreshQuest(self.nNextQuest)
end
end
self.timer = self:AddTimer(1, nAnimTime + 0.5, countdown, true, true, false)
end
function TrialInfoCtrl:ClearTimer()
if self.timer ~= nil then
self.timer:Cancel()
end
self.timer = nil
end
function TrialInfoCtrl:OnEvent_OpenUI(nQuestId)
self._mapNode.Challenge.gameObject:SetActive(true)
if nQuestId then
self:RefreshQuest(nQuestId)
end
end
function TrialInfoCtrl:OnEvent_CloseUI()
end
function TrialInfoCtrl:OnEvent_InputEnable(bEnable)
if self.bBattleEnd == true then
return
end
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, bEnable == true and 1 or 0)
NovaAPI.SetCanvasGroupInteractable(self._mapNode.canvasGroup, bEnable == true)
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.canvasGroup, bEnable == true)
end
function TrialInfoCtrl:OnEvent_BattleEnd()
self.bBattleEnd = true
end
return TrialInfoCtrl
+44
View File
@@ -0,0 +1,44 @@
local TrialMenuCtrl = class("TrialMenuCtrl", BaseCtrl)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
TrialMenuCtrl._mapNodeConfig = {
canvas_group = {
sNodeName = "----SafeAreaRoot----",
sComponentName = "CanvasGroup"
},
btnPause = {
sComponentName = "NaviButton",
callback = "OnBtn_Pause"
},
btnBag = {sComponentName = "NaviButton", callback = "OnBtn_Bag"}
}
TrialMenuCtrl._mapEventConfig = {
TrialSetButtonEnable = "OnEvent_TrialSetButtonEnable",
InputEnable = "OnEvent_InputEnable"
}
function TrialMenuCtrl:OnEnable()
GamepadUIManager.AddGamepadUINode("BattleMenu", self:GetGamepadUINode())
end
function TrialMenuCtrl:OnDisable()
end
function TrialMenuCtrl:OnBtn_Pause()
EventManager.Hit("BattlePause")
EventManager.Hit(EventId.PasueAvgBubble, true)
end
function TrialMenuCtrl:OnBtn_Bag()
EventManager.Hit("TrialDepot")
end
function TrialMenuCtrl:OnEvent_TrialSetButtonEnable(bShow, bEnable)
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvas_group, bShow == true and 1 or 0)
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.canvas_group, bShow == true)
NovaAPI.SetCanvasGroupInteractable(self._mapNode.canvas_group, bShow == true)
self._mapNode.btnPause.interactable = bEnable == true
self._mapNode.btnBag.interactable = bEnable == true
end
function TrialMenuCtrl:OnEvent_InputEnable(bEnable)
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvas_group, bEnable == true and 1 or 0)
NovaAPI.SetCanvasGroupInteractable(self._mapNode.canvas_group, bEnable == true)
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.canvas_group, bEnable == true)
self._mapNode.btnPause.interactable = bEnable == true
self._mapNode.btnBag.interactable = bEnable == true
end
return TrialMenuCtrl
+256
View File
@@ -0,0 +1,256 @@
local TrialPauseCtrl = class("TrialPauseCtrl", BaseCtrl)
local GameCameraStackManager = CS.GameCameraStackManager.Instance
local AdventureModuleHelper = CS.AdventureModuleHelper
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
TrialPauseCtrl._mapNodeConfig = {
goBlur = {
sNodeName = "t_fullscreen_blur_01"
},
aniBlur = {
sNodeName = "t_fullscreen_blur_01",
sComponentName = "Animator"
},
safeAreaRoot = {
sNodeName = "----SafeAreaRoot----"
},
imgBlocker = {},
btnBgClose = {
sComponentName = "Button",
callback = "OnBtnClick_Close"
},
aniWindow = {
sNodeName = "PauseWindow",
sComponentName = "Animator"
},
txtWindowTitle = {
sComponentName = "TMP_Text",
sLanguageId = "MainBattle_Pause"
},
btnClose = {
sComponentName = "UIButton",
callback = "OnBtnClick_Close"
},
btnGiveUp = {
sComponentName = "NaviButton",
callback = "OnBtnClick_GiveUp",
sAction = "Giveup"
},
btnBack = {
sComponentName = "NaviButton",
callback = "OnBtnClick_Close",
sAction = "Back"
},
btnPopSkill = {
sComponentName = "NaviButton",
callback = "OnBtnClick_Skill",
sAction = "Skill"
},
ActionBar = {
sCtrlName = "Game.UI.ActionBar.ActionBarCtrl"
},
txtGiveUp = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "Trial_Btn_EndTrial"
},
txtBack = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "Pause_Btn_ContinueBattle"
},
txtBtnSkill = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "Trial_Btn_PauseSkill"
},
txtBtnSettings = {
sComponentName = "TMP_Text",
sLanguageId = "StarTowerMap_Btn_Settings"
},
btnChar = {
nCount = 3,
sComponentName = "UIButton",
callback = "OnBtnClick_Char"
},
goChar = {
nCount = 3,
sNodeName = "btnChar",
sCtrlName = "Game.UI.TemplateEx.TemplateCharCtrl"
},
txtSubTitle1 = {
sComponentName = "TMP_Text",
sLanguageId = "MainBattle_Time"
},
txtSubTitle2 = {
sComponentName = "TMP_Text",
sLanguageId = "MainBattle_Task"
},
txtTime = {sComponentName = "TMP_Text"},
txtLeader = {
sComponentName = "TMP_Text",
sLanguageId = "Build_Leader"
},
txtSub = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "Build_Sub"
},
txtCurTrial = {
nCount = 3,
sComponentName = "TMP_Text",
sLanguageId = "Trial_CurTrialChar"
},
goCurTrial = {nCount = 3},
rtList = {
sNodeName = "ContentTarget",
sComponentName = "Transform"
},
goQuest = {}
}
TrialPauseCtrl._mapEventConfig = {
Trial_Time = "OnEvent_Time",
OpenTrialPause = "Pause",
GamepadUIReopen = "OnEvent_Reopen",
TaskLevel_InitTask = "RefreshQuest",
TaskLevel_UpdateTaskTargetProcess = "UpdateTarget",
OpenTrialInfo = "OnEvent_OpenUI"
}
function TrialPauseCtrl:Refresh()
for i = 1, 3 do
self._mapNode.goChar[i]:SetChar(self.tbChar[i])
self._mapNode.goCurTrial[i]:SetActive(self.tbChar[i] == self.nCurCharId)
end
end
function TrialPauseCtrl:RefreshQuest(nQuestId)
local mapQuest = ConfigTable.GetData("LevelQuest", nQuestId)
if not mapQuest then
return
end
local tbTarget = mapQuest.LevelQuestTargetIds
self.tbTagetNode = {}
delChildren(self._mapNode.rtList)
for _, v in ipairs(tbTarget) do
local mapTarget = ConfigTable.GetData("LevelQuestTarget", v)
if mapTarget then
local goItemObj = instantiate(self._mapNode.goQuest, self._mapNode.rtList)
goItemObj:SetActive(true)
self.tbTagetNode[v] = {}
self.tbTagetNode[v].imgOff = goItemObj.transform:Find("goReach/imgOff").gameObject
self.tbTagetNode[v].imgOn = goItemObj.transform:Find("goReach/imgOn").gameObject
self.tbTagetNode[v].txtDesc = goItemObj.transform:Find("txtDesc"):GetComponent("TMP_Text")
self.tbTagetNode[v].sPrefix = UTILS.ParseLevelQuestTargetDesc(mapTarget.QuestDes, mapTarget)
self.tbTagetNode[v].sSuffix = UTILS.GetLevelQuestTargetProcess(mapTarget)
self.tbTagetNode[v].imgOff:SetActive(true)
self.tbTagetNode[v].imgOn:SetActive(false)
NovaAPI.SetTMPText(self.tbTagetNode[v].txtDesc, self.tbTagetNode[v].sPrefix .. self.tbTagetNode[v].sSuffix)
end
end
end
function TrialPauseCtrl:UpdateTarget(nQuestId, nTargetId, nCur, nMax)
if not self.tbTagetNode[nTargetId] then
return
end
nCur = nCur:AsInt()
nMax = nMax:AsInt()
local bComplete = nCur >= nMax
self.tbTagetNode[nTargetId].imgOff:SetActive(not bComplete)
self.tbTagetNode[nTargetId].imgOn:SetActive(bComplete)
local sSuffix = "<color=#2be1f1>(" .. nCur .. "/" .. nMax .. ")</color>"
NovaAPI.SetTMPText(self.tbTagetNode[nTargetId].txtDesc, self.tbTagetNode[nTargetId].sPrefix .. sSuffix)
end
function TrialPauseCtrl:PlayInAni()
self._mapNode.goBlur:SetActive(true)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.safeAreaRoot:SetActive(true)
self._mapNode.aniWindow:Play("t_window_04_t_in")
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
end
cs_coroutine.start(wait)
end
function TrialPauseCtrl:PlayCloseAni(bGiveUp)
self._mapNode.aniWindow:Play("t_window_04_t_out")
self._mapNode.aniBlur:SetTrigger("tOut")
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
self:AddTimer(1, 0.2, "OnPanelClose", true, true, true, bGiveUp)
end
function TrialPauseCtrl:OnPanelClose(_, bGiveUp)
PanelManager.InputEnable()
GamepadUIManager.DisableGamepadUI("TrialPauseCtrl")
EventManager.Hit(EventId.BattleDashboardVisible, true)
self._mapNode.safeAreaRoot:SetActive(false)
self._mapNode.goBlur:SetActive(false)
self._mapNode.imgBlocker:SetActive(false)
if bGiveUp then
EventManager.Hit(EventId.AbandonBattle)
end
end
function TrialPauseCtrl:Awake()
self._mapNode.safeAreaRoot:SetActive(false)
self.tbGamepadUINode = self:GetGamepadUINode()
NovaAPI.SetTMPText(self._mapNode.txtTime, string.format("%02d:%02d", 0, 0))
end
function TrialPauseCtrl:OnEnable()
end
function TrialPauseCtrl:OnDisable()
end
function TrialPauseCtrl:OnDestroy()
end
function TrialPauseCtrl:Pause(tbCharId, mapCharData, nCurCharId)
self.tbChar = tbCharId
self.mapCharData = mapCharData
self.nCurCharId = nCurCharId
EventManager.Hit(EventId.BattleDashboardVisible, false)
PanelManager.InputDisable()
self:PlayInAni()
self:Refresh()
GamepadUIManager.EnableGamepadUI("TrialPauseCtrl", self.tbGamepadUINode)
end
function TrialPauseCtrl:OnEvent_Time(nTime)
local nMin = math.floor(nTime / 60)
local nSec = math.fmod(nTime, 60)
NovaAPI.SetTMPText(self._mapNode.txtTime, string.format("%02d:%02d", nMin, nSec))
end
function TrialPauseCtrl:OnEvent_OpenUI(nQuestId)
if nQuestId then
self:RefreshQuest(nQuestId)
end
end
function TrialPauseCtrl:OnBtnClick_GiveUp(btn)
local confirmCallback = function()
self:PlayCloseAni(true)
self._mapNode.imgBlocker:SetActive(true)
end
local bReceived = PlayerData.Trial:CheckGroupReceived()
if bReceived then
confirmCallback()
else
local msg = {
nType = AllEnum.MessageBox.Confirm,
sContent = ConfigTable.GetUIText("Trial_Pause_GiveUpTips"),
callbackConfirm = confirmCallback,
bBlur = false
}
EventManager.Hit(EventId.OpenMessageBox, msg)
end
end
function TrialPauseCtrl:OnBtnClick_Close(btn)
self:PlayCloseAni(false)
end
function TrialPauseCtrl:OnBtnClick_Char(btn, nIndex)
end
function TrialPauseCtrl:OnBtnClick_Skill(btn)
EventManager.Hit(EventId.OpenPanel, PanelId.PopupSkillPanel, self.tbChar, false, {}, self.mapCharData)
self._mapNode.ActionBar.gameObject:SetActive(false)
end
function TrialPauseCtrl:OnBtnClick_Settings(btn)
EventManager.Hit(EventId.OpenPanel, PanelId.BattleSettings)
self._mapNode.ActionBar.gameObject:SetActive(false)
end
function TrialPauseCtrl:OnEvent_Reopen(sName)
if sName ~= "TrialPauseCtrl" then
return
end
self._mapNode.ActionBar.gameObject:SetActive(true)
end
return TrialPauseCtrl
+297
View File
@@ -0,0 +1,297 @@
local TrialResultCtrl = class("TrialResultCtrl", BaseCtrl)
local WwiseManger = CS.WwiseAudioManager.Instance
TrialResultCtrl._mapNodeConfig = {
imgBlurredBg = {},
goComplete = {sComponentName = "GameObject"},
animComplete = {sNodeName = "goComplete", sComponentName = "Animator"},
goFailed = {sComponentName = "GameObject"},
Mask = {
sComponentName = "CanvasGroup"
},
txtMainlineName = {nCount = 2, sComponentName = "TMP_Text"},
ButtonClose = {
nCount = 2,
sComponentName = "UIButton",
callback = "OnBtnClick_Retry"
},
goRoot = {
sNodeName = "----SafeAreaRoot----"
},
goWorldLevel = {},
imgExp = {sComponentName = "Image"},
txtRank = {sComponentName = "TMP_Text"},
txtRankEn = {
sComponentName = "TMP_Text",
sLanguageId = "MainView_RANK"
},
txtWorldExp = {sComponentName = "TMP_Text"},
imgExpBg = {},
txtGetWorldExp = {sComponentName = "TMP_Text"},
goRankArrow = {},
goStarList = {},
getStar = {nCount = 3, sComponentName = "Transform"},
txtTip = {
sComponentName = "TMP_Text",
sLanguageId = "Trial_Result_Fail_Tip"
},
txtTipShadow = {
sComponentName = "TMP_Text",
sLanguageId = "Trial_Result_Fail_Tip"
},
txtExp = {
sComponentName = "TMP_Text",
sLanguageId = "WorldClass_ExpTips"
},
txtMaxLevel = {
sComponentName = "TMP_Text",
sLanguageId = "Battle_Result_Max_Level"
},
goGacha = {},
animGacha = {
sNodeName = "goGachaItem",
sComponentName = "Animator"
},
imgFull = {sComponentName = "Image"},
imgSplitB = {sComponentName = "Image"},
imgSplitC = {sComponentName = "Image"},
imgSplitD = {sComponentName = "Image"},
txtAllTime = {sComponentName = "TMP_Text"},
txtTimeTitle = {
sComponentName = "TMP_Text",
sLanguageId = "Trial_TimeCount_All"
},
btnClose = {
sComponentName = "UIButton",
callback = "OnBtnClick_Close"
},
txtBtnClose = {
sComponentName = "TMP_Text",
sLanguageId = "Trial_Btn_Complete"
},
btnRetry = {
sComponentName = "UIButton",
callback = "OnBtnClick_Retry"
},
txtBtnRetry = {
sComponentName = "TMP_Text",
sLanguageId = "Trial_Btn_Restart"
},
btnNext = {
sComponentName = "UIButton",
callback = "OnBtnClick_Next"
},
txtBtnNext = {
sComponentName = "TMP_Text",
sLanguageId = "Trial_Btn_NextTrial"
},
imgHead = {sComponentName = "Image"},
btnDamageResult = {
nCount = 2,
sComponentName = "UIButton",
callback = "OnBtnClick_ShowDamageResult"
},
txtClickToContinue = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "Tips_Continue"
},
buttonList = {}
}
TrialResultCtrl._mapEventConfig = {}
local starGachaCfg = {
[1] = {
iconPath = "icon_roguegacha_03%s",
animName = "BattleResultgoGacha_r"
},
[2] = {
iconPath = "icon_roguegacha_02%s",
animName = "BattleResultgoGacha_sr"
},
[3] = {
iconPath = "icon_roguegacha_01%s",
animName = "BattleResultgoGacha_ssr"
}
}
function TrialResultCtrl:Awake()
self.canvas = self.gameObject:GetComponent("Canvas")
EventManager.Hit(EventId.AvgBubbleShutDown)
NovaAPI.SetComponentEnable(self.canvas, false)
self._mapNode.goGacha.gameObject:SetActive(false)
self._mapNode.buttonList:SetActive(false)
end
function TrialResultCtrl:OnEnable()
local tbParam = self:GetPanelParam()
self.bSuccess = tbParam[1] == true
local nLevelTime = tbParam[2]
local tbChar = tbParam[3]
self.nActId = tbParam[4]
self.mapChangeInfo = tbParam[5]
self.tbCharDamage = tbParam[6]
for i = 1, 2 do
self._mapNode.btnDamageResult[i].gameObject:SetActive(self.tbCharDamage ~= nil and #self.tbCharDamage > 0)
end
nLevelTime = math.floor(nLevelTime)
NovaAPI.SetTMPText(self._mapNode.txtAllTime, orderedFormat(ConfigTable.GetUIText("StarTower_Result_Time") or "", nLevelTime))
self.nNextGroup = PlayerData.Trial:GetNextUnreceiveGroup()
self._mapNode.btnNext.gameObject:SetActive(self.nNextGroup)
if self.nNextGroup then
local mapGroup = ConfigTable.GetData("TrialGroup", self.nNextGroup)
if mapGroup then
local mapTrial = ConfigTable.GetData("TrialCharacter", mapGroup.TrialChar)
if mapTrial then
local nCharSkinId = ConfigTable.GetData_Character(mapTrial.CharId).AdvanceSkinId
local mapCharSkin = ConfigTable.GetData_CharacterSkin(nCharSkinId)
if mapCharSkin then
self:SetPngSprite(self._mapNode.imgHead, mapCharSkin.Icon .. AllEnum.CharHeadIconSurfix.S)
end
end
end
end
local sTitle = PlayerData.Trial:GetLevelTitle()
for _, v in ipairs(self._mapNode.txtMainlineName) do
NovaAPI.SetTMPText(v, sTitle)
end
local tbTeamMemberId = tbChar
local tbRoleId = {}
for i = 1, #tbTeamMemberId do
if tbTeamMemberId[i] ~= nil and 0 < tbTeamMemberId[i] then
table.insert(tbRoleId, tbTeamMemberId[i])
end
end
if #tbRoleId == 0 then
table.insert(tbRoleId, 112)
end
WwiseManger:PostEvent("ui_loading_combatSFX_mute", nil, false)
WwiseManger:PostEvent("char_common_all_pause")
WwiseManger:PostEvent("mon_common_all_pause")
WwiseManger:SetState("level", "None")
WwiseManger:SetState("combat", "None")
local nAnimTime
if self.bSuccess then
self._mapNode.goRoot.gameObject:SetActive(true)
self._mapNode.goFailed:SetActive(false)
self._mapNode.imgBlurredBg.gameObject:SetActive(false)
self._mapNode.goComplete:SetActive(true)
WwiseManger:PlaySound("ui_roguelike_victory")
WwiseManger:SetState("system", "victory")
nAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.animComplete, {
"BattleResultPanel_victory_out"
})
self._mapNode.animComplete:Play("TrialResultPanel_victory_out")
self:AddTimer(1, 3, function()
self._mapNode.buttonList:SetActive(true)
end, true, true, true)
else
WwiseManger:SetState("system", "defeat")
CS.AdventureModuleHelper.PauseLogic()
self._mapNode.goRoot.gameObject:SetActive(false)
self._mapNode.imgBlurredBg.gameObject:SetActive(true)
self._mapNode.goFailed:SetActive(true)
self._mapNode.goComplete:SetActive(false)
nAnimTime = 3
end
self._mapNode.Mask.gameObject:SetActive(false)
self._mapNode.ButtonClose[1].gameObject:SetActive(false)
self._mapNode.ButtonClose[2].gameObject:SetActive(false)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.goRoot.gameObject:SetActive(true)
if not self.bSuccess then
self._mapNode.ButtonClose[1].gameObject:SetActive(true)
self._mapNode.ButtonClose[2].gameObject:SetActive(true)
end
NovaAPI.SetComponentEnable(self.canvas, true)
end
cs_coroutine.start(wait)
self:AddTimer(1, nAnimTime, "PlayAnim", true, true, true)
EventManager.Hit(EventId.TemporaryBlockInput, 3)
PlayerData.Voice:PlayBattleResultVoice(tbRoleId, self.bSuccess)
self.bProcessingClose = false
end
function TrialResultCtrl:OnDisable()
PlayerData.Trial:SetSettlementState(false)
PlayerData.Voice:StopCharVoice()
end
function TrialResultCtrl:PlayAnim()
PlayerData.SideBanner:TryOpenSideBanner()
local callback = function()
self:OpenReward()
end
self.bOpenUpgrade = PlayerData.Base:TryOpenWorldClassUpgrade(callback)
end
function TrialResultCtrl:ClosePanel()
if self.bProcessingClose then
return
end
self.bProcessingClose = true
CS.AdventureModuleHelper.ResumeLogic()
if NovaAPI.GetCurrentModuleName() == "MainMenuModuleScene" then
EventManager.Hit(EventId.CloesCurPanel)
PlayerData.Base:OnBackToMainMenuModule()
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)
self._mapNode.imgBlurredBg:SetActive(false)
else
local function levelEndCallback()
EventManager.Remove("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
NovaAPI.EnterModule("MainMenuModuleScene", true, 17)
self._mapNode.imgBlurredBg:SetActive(false)
end
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
CS.AdventureModuleHelper.LevelStateChanged(true, 0, true)
end
end)
sequence:SetUpdate(true)
end
end
function TrialResultCtrl:RefreshGacha()
local sIconPath = "UI/big_sprites/"
local gachaCfg = starGachaCfg[3]
if nil ~= gachaCfg then
self:SetPngSprite(self._mapNode.imgFull, sIconPath .. string.format(gachaCfg.iconPath, "a"))
self:SetPngSprite(self._mapNode.imgSplitB, sIconPath .. string.format(gachaCfg.iconPath, "b"))
self:SetPngSprite(self._mapNode.imgSplitC, sIconPath .. string.format(gachaCfg.iconPath, "c"))
self:SetPngSprite(self._mapNode.imgSplitD, sIconPath .. string.format(gachaCfg.iconPath, "d"))
self._mapNode.animGacha:Play(gachaCfg.animName)
end
end
function TrialResultCtrl:Close()
if self.bOpenUpgrade then
self:ClosePanel()
else
self:OpenReward()
end
end
function TrialResultCtrl:OnBtnClick_Close(btn)
PlayerData.Trial:SetSelectTrialGroup()
EventManager.Hit(EventId.ClosePanel, PanelId.TrialLevelSelect)
self:Close()
end
function TrialResultCtrl:OnBtnClick_Retry(btn)
self:Close()
end
function TrialResultCtrl:OnBtnClick_Next(btn)
PlayerData.Trial:SetSelectTrialGroup(self.nNextGroup)
self:Close()
end
function TrialResultCtrl:OnBtnClick_ShowDamageResult()
EventManager.Hit(EventId.OpenPanel, PanelId.BattleDamage, self.tbCharDamage)
end
function TrialResultCtrl:OpenReward()
if self.mapChangeInfo and next(self.mapChangeInfo) ~= nil then
local callback = function()
self:ClosePanel()
end
UTILS.OpenReceiveByChangeInfo(self.mapChangeInfo, callback)
else
self:ClosePanel()
end
end
return TrialResultCtrl
@@ -0,0 +1,17 @@
local TrialResultPanel = class("TrialResultPanel", BasePanel)
TrialResultPanel._bAddToBackHistory = false
TrialResultPanel._tbDefine = {
{
sPrefabPath = "Play_TrialBattle/TrialResultPanel.prefab",
sCtrlName = "Game.UI.TrialBattle.TrialResultCtrl"
}
}
function TrialResultPanel:Awake()
end
function TrialResultPanel:OnEnable()
end
function TrialResultPanel:OnDisable()
end
function TrialResultPanel:OnDestroy()
end
return TrialResultPanel