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,330 @@
|
||||
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 and self.nSelectIndex) or self.nCharId ~= self.tbTeam[self.nSelectIndex] 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)
|
||||
else
|
||||
self.attrData:SetCharacter(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()
|
||||
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()
|
||||
local nSelect = PlayerData.Equipment:GetSelectPreset(self.nCharId)
|
||||
local tbSlot = PlayerData.Equipment:GetSlotWithIndex(self.nCharId, nSelect)
|
||||
for i, mapSlot in ipairs(tbSlot) do
|
||||
local bEmpty = mapSlot.nGemIndex == 0
|
||||
self._mapNode.imgEquipment[i].gameObject:SetActive(not bEmpty)
|
||||
self._mapNode.goEquipment[i].gameObject:SetActive(bEmpty)
|
||||
if bEmpty then
|
||||
if not mapSlot.bUnlock then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtEquipmentLock[i], orderedFormat(ConfigTable.GetUIText("Equipment_SlotActiveLevel"), mapSlot.nLevel))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtEquipmentLock[i], ConfigTable.GetUIText("CharEquipment_UnEquip"))
|
||||
end
|
||||
else
|
||||
local nGemId = PlayerData.Equipment:GetGemIdBySlot(self.nCharId, mapSlot.nSlotId)
|
||||
local mapGemCfg = ConfigTable.GetData("CharGem", nGemId)
|
||||
if mapGemCfg then
|
||||
self:SetPngSprite(self._mapNode.imgEquipment[i], mapGemCfg.Icon)
|
||||
end
|
||||
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)
|
||||
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)
|
||||
local tbEquipment = PlayerData.Equipment:GetEquipedGem(self.nCharId)
|
||||
if next(tbEquipment) == nil then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Equipment_CharEquipNone"))
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.EquipmentAttrPreview, self.nCharId)
|
||||
end
|
||||
end
|
||||
return DepotCharInfoCtrl
|
||||
@@ -0,0 +1,299 @@
|
||||
local DepotFateCardCtrl = class("DepotFateCardCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
DepotFateCardCtrl._mapNodeConfig = {
|
||||
rtItemListContent = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
goFateCardItem = {},
|
||||
goDepotItem = {},
|
||||
goItemList = {},
|
||||
FateCardList = {
|
||||
sNodeName = "FateCardList_",
|
||||
nCount = 5
|
||||
},
|
||||
txtFateCard = {
|
||||
sComponentName = "TMP_Text",
|
||||
nCount = 5,
|
||||
sNodeName = "txtFateCard_"
|
||||
},
|
||||
txtHas = {
|
||||
sComponentName = "TMP_Text",
|
||||
nCount = 5,
|
||||
sNodeName = "txtHas_"
|
||||
},
|
||||
txtAll = {
|
||||
sComponentName = "TMP_Text",
|
||||
nCount = 5,
|
||||
sNodeName = "txtAll_"
|
||||
},
|
||||
imgPackageIcon = {
|
||||
sComponentName = "Image",
|
||||
nCount = 5,
|
||||
sNodeName = "imgPackageIcon_"
|
||||
},
|
||||
imgSubIcon = {
|
||||
sComponentName = "Image",
|
||||
nCount = 5,
|
||||
sNodeName = "imgSubIcon_"
|
||||
},
|
||||
rtFateCard = {
|
||||
sComponentName = "Transform",
|
||||
nCount = 5,
|
||||
sNodeName = "rtFateCard_"
|
||||
},
|
||||
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.VampireSurvivor.Depot.DepotFateCardItemCtrl"
|
||||
},
|
||||
txtFateCardName = {sComponentName = "TMP_Text"},
|
||||
imgEffect = {nCount = 3},
|
||||
txtEffect1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "VampireDepot_ReminTime"
|
||||
},
|
||||
txtEffect2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "VampireDepot_ReminTime_None"
|
||||
},
|
||||
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"
|
||||
}
|
||||
}
|
||||
DepotFateCardCtrl._mapEventConfig = {}
|
||||
DepotFateCardCtrl._mapRedDotConfig = {}
|
||||
local item_type = {FateCard = 1, Item = 2}
|
||||
function DepotFateCardCtrl:InitPackage(nLevelId)
|
||||
self.nLevelId = nLevelId
|
||||
local mapLevelData = ConfigTable.GetData("VampireSurvivor", nLevelId)
|
||||
if mapLevelData == nil then
|
||||
return
|
||||
end
|
||||
local tbBundle = mapLevelData.FateCardBundle
|
||||
self.tbBundle = clone(tbBundle)
|
||||
self.tbExFateCard = decodeJson(mapLevelData.SpeciaFateCard)
|
||||
if self.tbExFateCard == nil then
|
||||
self.tbExFateCard = {}
|
||||
end
|
||||
for i = 1, 5 do
|
||||
if self.tbBundle[i] == nil then
|
||||
self._mapNode.FateCardList[i].gameObject:SetActive(false)
|
||||
else
|
||||
local mapBundleCfgData = ConfigTable.GetData("StarTowerBookFateCardBundle", self.tbBundle[i])
|
||||
self.tbFateCardCtrl[i] = {}
|
||||
if mapBundleCfgData ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtFateCard[i], mapBundleCfgData.Name)
|
||||
self:SetPngSprite(self._mapNode.imgPackageIcon[i], mapBundleCfgData.Icon .. AllEnum.FateCardBundleIcon.S)
|
||||
self:SetAtlasSprite(self._mapNode.imgSubIcon[i], "05_language", mapBundleCfgData.Text)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgSubIcon[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function DepotFateCardCtrl:RefreshFateCard(mapFateCard)
|
||||
self.mapFateCard = {}
|
||||
for nId, v in pairs(mapFateCard) do
|
||||
local mapBundleCfgData = ConfigTable.GetData("StarTowerBookFateCard", nId)
|
||||
local nBundleIdx = 0
|
||||
local bEx = false
|
||||
if mapBundleCfgData ~= nil then
|
||||
local nBundleId = mapBundleCfgData.BundleId
|
||||
nBundleIdx = table.indexof(self.tbBundle, nBundleId)
|
||||
end
|
||||
if nBundleIdx < 1 then
|
||||
bEx, nBundleIdx = self:isExFateCard(nId)
|
||||
end
|
||||
if 5 < nBundleIdx or nBundleIdx < 1 then
|
||||
printError("无法获取Bundle索引")
|
||||
nBundleIdx = 1
|
||||
end
|
||||
table.insert(self.mapFateCard, {
|
||||
nTid = nId,
|
||||
nCount = v,
|
||||
bEx = bEx,
|
||||
nBundleIdx = nBundleIdx
|
||||
})
|
||||
end
|
||||
local tbCount = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
}
|
||||
if #self.mapFateCard == 0 then
|
||||
self._mapNode.ItemInfo.gameObject:SetActive(false)
|
||||
self._mapNode.FateCardInfo.gameObject:SetActive(false)
|
||||
self._mapNode.imgEmpty:SetActive(true)
|
||||
self._mapNode.goItemList:SetActive(false)
|
||||
return
|
||||
end
|
||||
self._mapNode.imgEmpty:SetActive(false)
|
||||
self._mapNode.goItemList:SetActive(true)
|
||||
table.sort(self.mapFateCard, function(a, b)
|
||||
if a.nBundleIdx ~= b.nBundleIdx then
|
||||
return a.nBundleIdx < b.nBundleIdx
|
||||
end
|
||||
if a.nCount * b.nCount == 0 and a.nCount + b.nCount ~= 0 then
|
||||
return a.nCount ~= 0
|
||||
end
|
||||
if a.bEx ~= b.bEx then
|
||||
return a.bEx
|
||||
end
|
||||
return a.nTid < b.nTid
|
||||
end)
|
||||
local nFirstId = 0
|
||||
if #self.mapFateCard > 0 then
|
||||
nFirstId = self.mapFateCard[1].nTid
|
||||
end
|
||||
for _, tbItemCtrl in ipairs(self.tbFateCardCtrl) do
|
||||
for _, v in ipairs(tbItemCtrl) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
for k, v in ipairs(self.mapFateCard) do
|
||||
local itemObj
|
||||
local nBundleIdx = v.nBundleIdx
|
||||
local bEx = v.bEx
|
||||
tbCount[nBundleIdx] = tbCount[nBundleIdx] + 1
|
||||
if nil == self.tbFateCardCtrl[nBundleIdx] then
|
||||
self.tbFateCardCtrl[nBundleIdx] = {}
|
||||
end
|
||||
local nIdx = tbCount[nBundleIdx]
|
||||
if self.tbFateCardCtrl[nBundleIdx][nIdx] == nil then
|
||||
itemObj = instantiate(self._mapNode.goFateCardItem, self._mapNode.rtFateCard[nBundleIdx])
|
||||
itemObj.gameObject:SetActive(true)
|
||||
local itemCtrl = self:BindCtrlByNode(itemObj, "Game.UI.VampireSurvivor.Depot.DepotFateCardItemCtrl")
|
||||
itemCtrl:InitFateCard(v.nTid, v.nCount, bEx)
|
||||
table.insert(self.tbFateCardCtrl[nBundleIdx], itemCtrl)
|
||||
else
|
||||
itemObj = self.tbFateCardCtrl[nBundleIdx][nIdx].gameObject
|
||||
itemObj:SetActive(true)
|
||||
self.tbFateCardCtrl[nBundleIdx][nIdx]: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, nBundleIdx, nIdx, k)
|
||||
end
|
||||
btnSelect.onClick:AddListener(func_select)
|
||||
if nFirstId == v.nTid then
|
||||
self:SelectItem(item_type.FateCard, nBundleIdx, nIdx, k)
|
||||
end
|
||||
end
|
||||
for nIdx, tbItem in pairs(self.tbFateCardCtrl) do
|
||||
self._mapNode.FateCardList[nIdx]:SetActive(0 < tbCount[nIdx])
|
||||
NovaAPI.SetTMPText(self._mapNode.txtHas[nIdx], tbCount[nIdx])
|
||||
end
|
||||
end
|
||||
function DepotFateCardCtrl:SelectItem(nType, nBundleIdx, nIndex, nIdx)
|
||||
self._mapNode.ItemInfo.gameObject:SetActive(false)
|
||||
self._mapNode.FateCardInfo.gameObject:SetActive(false)
|
||||
if nil ~= self.nSelectIndex and self.nSelectType == item_type.FateCard then
|
||||
self.tbFateCardCtrl[self.nSelectBundleIdx][self.nSelectIndex]:SetChoose(false)
|
||||
end
|
||||
self.nSelectType = nType
|
||||
self.nSelectBundleIdx = nBundleIdx
|
||||
self.nSelectIndex = nIndex
|
||||
if self.nSelectType == item_type.FateCard then
|
||||
self._mapNode.FateCardInfo.gameObject:SetActive(true)
|
||||
self.tbFateCardCtrl[self.nSelectBundleIdx][self.nSelectIndex]:SetChoose(true)
|
||||
self:SetFateCardInfo(nIdx)
|
||||
end
|
||||
end
|
||||
function DepotFateCardCtrl: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 DepotFateCardCtrl:SetFateCardInfo(nIdx)
|
||||
local mapSelect = self.mapFateCard[nIdx]
|
||||
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.Desc2, fateCardCfg)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtFateCardDesc, sDesc)
|
||||
self._mapNode.goFateCardInfo:InitFateCard(mapSelect.nTid, mapSelect.nCount, false)
|
||||
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 < 0 then
|
||||
self._mapNode.imgEffect[2].gameObject:SetActive(true)
|
||||
else
|
||||
self._mapNode.imgEffect[1].gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtEffectCount, orderedFormat(ConfigTable.GetUIText("VampireDepot_ReminTime_Sec"), mapSelect.nCount))
|
||||
end
|
||||
end
|
||||
end
|
||||
function DepotFateCardCtrl:Awake()
|
||||
self.tbFateCardCtrl = {}
|
||||
self.nSelectIndex = nil
|
||||
self.nSelectType = 0
|
||||
self._mapNode.goFateCardItem.gameObject:SetActive(false)
|
||||
self._mapNode.goDepotItem.gameObject:SetActive(false)
|
||||
end
|
||||
function DepotFateCardCtrl:ClearFateCard()
|
||||
for _, tbItemCtrl in ipairs(self.tbFateCardCtrl) do
|
||||
for _, v in ipairs(tbItemCtrl) do
|
||||
self:UnbindCtrlByNode(v)
|
||||
end
|
||||
end
|
||||
self.tbFateCardCtrl = {}
|
||||
end
|
||||
function DepotFateCardCtrl:OnDestroy()
|
||||
self:ClearFateCard()
|
||||
end
|
||||
function DepotFateCardCtrl:isExFateCard(nFateCardId)
|
||||
for i, tbExFateCard in ipairs(self.tbExFateCard) do
|
||||
if table.indexof(tbExFateCard, nFateCardId) > 0 then
|
||||
return true, i
|
||||
end
|
||||
end
|
||||
return false, 0
|
||||
end
|
||||
return DepotFateCardCtrl
|
||||
@@ -0,0 +1,52 @@
|
||||
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"
|
||||
},
|
||||
ImgMark = {}
|
||||
}
|
||||
DepotFateCardItemCtrl._mapEventConfig = {}
|
||||
DepotFateCardItemCtrl._mapRedDotConfig = {}
|
||||
function DepotFateCardItemCtrl:InitFateCard(nId, nTime, bEx)
|
||||
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(nTime == 0)
|
||||
self._mapNode.txtCount.gameObject:SetActive(false)
|
||||
self._mapNode.imgChoose.gameObject:SetActive(false)
|
||||
self._mapNode.ImgMark:SetActive(bEx)
|
||||
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,91 @@
|
||||
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 = {},
|
||||
imgReommend = {},
|
||||
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.Desc2, 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)
|
||||
self._mapNode.txtFateCardDesc:SetAllDirty()
|
||||
NovaAPI.SetTMPRaycastTarget(self._mapNode.txtFateCardDesc, bEnable)
|
||||
end
|
||||
function FateCardItemCtrl:SetRecommend(bEnable)
|
||||
self._mapNode.imgReommend:SetActive(bEnable)
|
||||
end
|
||||
function FateCardItemCtrl:SetGamePadScrollEnable(bEnable)
|
||||
NovaAPI.SetComponentEnable(self._mapNode.gamePadScroll, bEnable)
|
||||
end
|
||||
return FateCardItemCtrl
|
||||
@@ -0,0 +1,181 @@
|
||||
local VampireDepotCtrl = class("VampireDepotCtrl", BaseCtrl)
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
VampireDepotCtrl._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.VampireSurvivor.Depot.DepotFateCardCtrl"
|
||||
},
|
||||
CharInfo = {
|
||||
sNodeName = "---CharInfo---",
|
||||
sCtrlName = "Game.UI.VampireSurvivor.Depot.DepotCharInfoCtrl"
|
||||
},
|
||||
tog = {
|
||||
nCount = 5,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ChangeTab"
|
||||
},
|
||||
ctrlTog = {
|
||||
nCount = 5,
|
||||
sNodeName = "tog",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
btnBack = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_CloseDepot"
|
||||
},
|
||||
btnHelp = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Dictionary"
|
||||
},
|
||||
txtTitle = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Vampire_Depot_Title"
|
||||
},
|
||||
txt_EmptyTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Vampire_Depot_FateCardEmpty"
|
||||
}
|
||||
}
|
||||
VampireDepotCtrl._mapEventConfig = {
|
||||
VampireDepotOpen = "OnEvent_OpenVampireDepot",
|
||||
RefreshActor2D_Depot = "OnEvent_RefreshActor2D"
|
||||
}
|
||||
VampireDepotCtrl._mapRedDotConfig = {}
|
||||
function VampireDepotCtrl:RefreshTogText()
|
||||
self._mapNode.ctrlTog[1]:SetText(ConfigTable.GetUIText("StarTower_Depot_Char"))
|
||||
self._mapNode.ctrlTog[5]:SetText(ConfigTable.GetUIText("Vampire_Depot_FateCardTog"))
|
||||
end
|
||||
function VampireDepotCtrl: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 VampireDepotCtrl:SwitchTog()
|
||||
self:RefreshList()
|
||||
end
|
||||
function VampireDepotCtrl:RefreshList()
|
||||
self._mapNode.CharInfo.gameObject:SetActive(self.nCurTog == 1)
|
||||
self._mapNode.ItemList.gameObject:SetActive(self.nCurTog == 5)
|
||||
self._mapNode.trActor2D_PNG.gameObject:SetActive(self.nCurTog == 1)
|
||||
self._mapNode.imgActorBg.gameObject:SetActive(self.nCurTog == 1)
|
||||
self._mapNode.imgNoteTogBg.gameObject:SetActive(self.nCurTog == AllEnum.StarTowerDepotTog.Note)
|
||||
if self.nCurTog == 1 then
|
||||
self._mapNode.CharInfo:RefreshCharInfo(self._panel.tbTeam, self._panel.mapCharData)
|
||||
elseif self.nCurTog == 5 then
|
||||
self._mapNode.ItemList:RefreshFateCard(self.mapFateCard)
|
||||
end
|
||||
end
|
||||
function VampireDepotCtrl:Awake()
|
||||
self.canvas = self.gameObject:GetComponent("Canvas")
|
||||
self.nInitSortingOrder = NovaAPI.GetCanvasSortingOrder(self.canvas)
|
||||
self:RefreshTogText()
|
||||
self.nCurTog = nil
|
||||
self.tbCharPotential = {}
|
||||
self._mapNode.goRoot:SetActive(false)
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
end
|
||||
function VampireDepotCtrl:FadeOut()
|
||||
end
|
||||
function VampireDepotCtrl:OnEnable()
|
||||
self._mapNode.ItemList:InitPackage(self._panel.nLevelId)
|
||||
end
|
||||
function VampireDepotCtrl:OnDisable()
|
||||
end
|
||||
function VampireDepotCtrl:OnDestroy()
|
||||
end
|
||||
function VampireDepotCtrl:OnRelease()
|
||||
end
|
||||
function VampireDepotCtrl: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 VampireDepotCtrl:OnBtnClick_CloseDepot()
|
||||
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.CharInfo:Clear()
|
||||
EventManager.Hit("CloseStarTowerDepot")
|
||||
GamepadUIManager.DisableGamepadUI("VampireDepotCtrl")
|
||||
end
|
||||
function VampireDepotCtrl:OnEvent_OpenVampireDepot(mapFateCard, nTog, nParam, callback)
|
||||
self._panel:SetTop(self.canvas)
|
||||
PanelManager.InputDisable()
|
||||
EventManager.Hit("StarTowerSetButtonEnable", false, false)
|
||||
self.callbackClose = callback
|
||||
self.mapFateCard = mapFateCard
|
||||
self.nParam = nParam
|
||||
if nil ~= nTog then
|
||||
self.nCurTog = nTog
|
||||
end
|
||||
self._mapNode.tog[4].gameObject:SetActive(false)
|
||||
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("VampireDepotCtrl", self.tbGamepadUINode, nil, true)
|
||||
end
|
||||
function VampireDepotCtrl:OnEvent_RefreshActor2D(nCharId)
|
||||
Actor2DManager.SetActor2D_PNG(self._mapNode.trActor2D_PNG, PanelId.MainView, nCharId)
|
||||
end
|
||||
function VampireDepotCtrl:OnBtnClick_Dictionary()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DictionaryFR, self:GetPanelId() == PanelId.StarTowerFastBattle)
|
||||
end
|
||||
return VampireDepotCtrl
|
||||
@@ -0,0 +1,827 @@
|
||||
local VampireFateCardSelect = class("VampireFateCardSelect", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local newDayTime = UTILS.GetDayRefreshTimeOffset()
|
||||
VampireFateCardSelect._mapNodeConfig = {
|
||||
blurBg = {},
|
||||
contentRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
animCtrl = {
|
||||
sComponentName = "Animator",
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
imgTitleBg = {},
|
||||
txtTitle = {sComponentName = "TMP_Text"},
|
||||
goCoin = {},
|
||||
btnFateCard = {
|
||||
sComponentName = "NaviButton",
|
||||
nCount = 3,
|
||||
callback = "OnBtnClick_FateCardItem"
|
||||
},
|
||||
rtBtnFateCard = {
|
||||
sNodeName = "btnFateCard",
|
||||
sComponentName = "RectTransform",
|
||||
nCount = 3
|
||||
},
|
||||
goFateCardItem = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.VampireSurvivor.FateCardItemCtrl"
|
||||
},
|
||||
btnConfirm = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Confirm"
|
||||
},
|
||||
btnConfirmReward = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Confirm",
|
||||
sAction = "Confirm"
|
||||
},
|
||||
txtBtnConfirm = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "FateCard_Select_Confirm"
|
||||
},
|
||||
rtBtnConfirm = {
|
||||
sNodeName = "btnConfirm",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
btnAbandon = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Abandon",
|
||||
sAction = "Back"
|
||||
},
|
||||
txtBtnAbandon = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "FateCard_Select_Abandon"
|
||||
},
|
||||
btnDepot = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Depot"
|
||||
},
|
||||
txtClickPre = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Click_Pre"
|
||||
},
|
||||
txtClickSuf = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Click_Suf"
|
||||
},
|
||||
TMPRewardBtnTitle = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Tips_Continue"
|
||||
},
|
||||
imgGlory = {},
|
||||
fxEndPoint = {nCount = 5},
|
||||
depotPoint = {},
|
||||
cardFinishParticle = {nCount = 2},
|
||||
RollButton = {},
|
||||
btnRoll = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Roll"
|
||||
},
|
||||
imgRollCostIcon = {sComponentName = "Image"},
|
||||
txtRollCostCount = {sComponentName = "TMP_Text"},
|
||||
pkgInfo = {
|
||||
sNodeName = "pkgInfo1_",
|
||||
sCtrlName = "Game.UI.VampireSurvivor.VampireFateSelect_packageInfoCtrl",
|
||||
nCount = 5
|
||||
},
|
||||
ActionBar = {
|
||||
sCtrlName = "Game.UI.ActionBar.ActionBarCtrl"
|
||||
}
|
||||
}
|
||||
VampireFateCardSelect._mapEventConfig = {
|
||||
VampireRewardChestFailed = "OnEvent_VampireRewardChestFailed",
|
||||
VampireLevelRewardFailed = "OnEvent_VampireLevelRewardFailed",
|
||||
VampireSelectFateCard = "OnEvent_SelectFateCard",
|
||||
GamepadUIChange = "OnEvent_GamepadUIChange",
|
||||
GamepadUIReopen = "OnEvent_Reopen"
|
||||
}
|
||||
VampireFateCardSelect._mapRedDotConfig = {}
|
||||
function VampireFateCardSelect:Refresh(nEventId, tbFateCard, mapRoll, nCoin, bReward, bAfterRoll)
|
||||
self.bReward = bReward
|
||||
self._mapNode.imgGlory:SetActive(true)
|
||||
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)
|
||||
CS.GameCameraStackManager.Instance:OpenMainCamera()
|
||||
self:HidePanel()
|
||||
if nil ~= self.callback then
|
||||
self.callback(-1, nEventId)
|
||||
end
|
||||
return
|
||||
end
|
||||
self._mapNode.RollButton:SetActive(mapRoll and mapRoll.CanReRoll)
|
||||
self.nEventId = nEventId
|
||||
self.nSelectIdx = 0
|
||||
self.nCoin = nCoin
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRollCostCount, orderedFormat(ConfigTable.GetUIText("Vampire_FateCard_RerollCount") or "", mapRoll.ReRollPrice))
|
||||
self._mapNode.goCoin.gameObject:SetActive(mapRoll.CanReRoll)
|
||||
self.mapRoll = mapRoll
|
||||
self:RefreshFateCardList(tbFateCard, bAfterRoll, bReward)
|
||||
if bReward then
|
||||
self.nSelectIdx = 1
|
||||
self:SelectScroll(self.nSelectIdx)
|
||||
for i, nCount in ipairs(self.tbCount) do
|
||||
self._mapNode.pkgInfo[i]:SetPackageAddMarket(false)
|
||||
self._mapNode.pkgInfo[i]:SetPackageCount(nCount)
|
||||
end
|
||||
local mapBundleInfo = {}
|
||||
for _, mapFateCard in ipairs(self.tbFateCardList) do
|
||||
local nFateCardId = mapFateCard.Id
|
||||
local nBundleIdx, bEx = self:GetFateCardBundleIdx(nFateCardId)
|
||||
if mapBundleInfo[nBundleIdx] == nil then
|
||||
mapBundleInfo[nBundleIdx] = {nCount = 0, nExCount = 0}
|
||||
end
|
||||
if bEx then
|
||||
mapBundleInfo[nBundleIdx].nExCount = mapBundleInfo[nBundleIdx].nExCount + 1
|
||||
else
|
||||
mapBundleInfo[nBundleIdx].nCount = mapBundleInfo[nBundleIdx].nCount + 1
|
||||
end
|
||||
end
|
||||
for nBundleIdx, mapCount in pairs(mapBundleInfo) do
|
||||
if 0 < mapCount.nCount then
|
||||
self._mapNode.pkgInfo[nBundleIdx]:SetPackageAddMarket(true)
|
||||
self._mapNode.pkgInfo[nBundleIdx]:SetPackageCount(self.tbCount[nBundleIdx] + mapCount.nCount)
|
||||
end
|
||||
if 0 < mapCount.nExCount then
|
||||
for i = 1, mapCount.nExCount do
|
||||
self._mapNode.pkgInfo[nBundleIdx]:SetPackageExAdd(self.tbExCount[nBundleIdx] + i)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTitle, bReward and ConfigTable.GetUIText("FateCard_Select_RewardTitle") or ConfigTable.GetUIText("FateCard_Select_Title"))
|
||||
local tbConfig = {}
|
||||
if bReward then
|
||||
tbConfig = {
|
||||
{
|
||||
sAction = "Confirm",
|
||||
sLang = "ActionBar_Confirm"
|
||||
},
|
||||
{
|
||||
sAction = "Scroll",
|
||||
sLang = "ActionBar_Scroll"
|
||||
}
|
||||
}
|
||||
elseif 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"
|
||||
}
|
||||
}
|
||||
else
|
||||
tbConfig = {
|
||||
{
|
||||
sAction = "Confirm",
|
||||
sLang = "ActionBar_Confirm"
|
||||
},
|
||||
{
|
||||
sAction = "Scroll",
|
||||
sLang = "ActionBar_Scroll"
|
||||
},
|
||||
{
|
||||
sAction = "Depot",
|
||||
sLang = "ActionBar_Depot"
|
||||
}
|
||||
}
|
||||
end
|
||||
self._mapNode.ActionBar:InitActionBar(tbConfig)
|
||||
end
|
||||
function VampireFateCardSelect:RefreshFateCardList(tbFateCard, bAfterRoll, bReward)
|
||||
self._mapNode.btnConfirm.gameObject:SetActive(false)
|
||||
self.tbFateCardList = clone(tbFateCard)
|
||||
self.tbRecommend = {}
|
||||
if not bReward then
|
||||
local curPackage = 0
|
||||
local tbRecommend = {}
|
||||
for index, mapFateCardInfo in ipairs(tbFateCard) do
|
||||
local nIdx, bEx = self:GetFateCardBundleIdx(mapFateCardInfo.Id)
|
||||
if not bEx then
|
||||
if curPackage == 0 then
|
||||
curPackage = nIdx
|
||||
table.insert(tbRecommend, index)
|
||||
elseif nIdx == 1 then
|
||||
if curPackage == 1 then
|
||||
table.insert(tbRecommend, index)
|
||||
end
|
||||
elseif nIdx ~= 1 and curPackage == 1 or self.tbCount[curPackage] < self.tbCount[nIdx] then
|
||||
tbRecommend = {}
|
||||
curPackage = nIdx
|
||||
table.insert(tbRecommend, index)
|
||||
elseif self.tbCount[curPackage] == self.tbCount[nIdx] then
|
||||
table.insert(tbRecommend, index)
|
||||
end
|
||||
end
|
||||
end
|
||||
if 0 < #tbRecommend then
|
||||
local random = math.random(1, #tbRecommend)
|
||||
table.insert(self.tbRecommend, tbRecommend[random])
|
||||
end
|
||||
end
|
||||
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 = self.tbFateCardList[k].New
|
||||
v:SetFateCardItem(self.tbFateCardList[k].Id, bNew)
|
||||
v:SetRecommend(0 < table.indexof(self.tbRecommend, k))
|
||||
v:ChangeWordRaycast(false)
|
||||
table.insert(tbCardObj, v)
|
||||
table.insert(tbBtnObj, self._mapNode.btnFateCard[k])
|
||||
end
|
||||
end
|
||||
if not bReward then
|
||||
self:ResetSelect(tbBtnObj, "VampireFateCard_in")
|
||||
local animTime = NovaAPI.GetAnimClipLength(self._mapNode.animCtrl, {
|
||||
"VampireFateCard_in"
|
||||
})
|
||||
self._mapNode.animCtrl:Play("VampireFateCard_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, animTime)
|
||||
end
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_itemCard")
|
||||
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 VampireFateCardSelect:SelectComplete(nEventId, tbFateCard, 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)
|
||||
local nIdx, bEx = self:GetFateCardBundleIdx(self.tbFateCardList[self.nSelectIdx].Id)
|
||||
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")
|
||||
if bEx then
|
||||
self._mapNode.pkgInfo[nIdx]:PlayAnimIn(self.tbExCount[nIdx])
|
||||
end
|
||||
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
|
||||
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
|
||||
if not bSelect then
|
||||
local nAnimLen = 1
|
||||
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
|
||||
else
|
||||
self:Refresh(nEventId, tbFateCard, mapRoll, nCoin, bReward)
|
||||
if bReward then
|
||||
self._mapNode.animCtrl:SetBool("standby1", false)
|
||||
self._mapNode.animCtrl:SetBool("standby2", false)
|
||||
local _, bEx = self:GetFateCardBundleIdx(tbFateCard[1].Id)
|
||||
if bEx then
|
||||
self._mapNode.animCtrl:SetBool("standby1", true)
|
||||
else
|
||||
self._mapNode.animCtrl:SetBool("standby2", true)
|
||||
end
|
||||
self._mapNode.animCtrl:Play("VampireFateCard_in1")
|
||||
end
|
||||
end
|
||||
end
|
||||
function VampireFateCardSelect:MoveConfirmButton(btnCard)
|
||||
local rtBtn = btnCard:GetComponent("RectTransform")
|
||||
self._mapNode.rtBtnConfirm.localPosition = Vector3(rtBtn.localPosition.x + 39, 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 VampireFateCardSelect:HidePanel()
|
||||
self.bOpen = false
|
||||
PanelManager.InputEnable()
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.contentRoot, 0)
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
NovaAPI.SetCanvasSortingOrder(self.canvas, self.nInitSortingOrder)
|
||||
GamepadUIManager.DisableGamepadUI("VampireFateCardSelect")
|
||||
end
|
||||
function VampireFateCardSelect: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)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.contentRoot, 0)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
self.nCoin = 0
|
||||
end
|
||||
function VampireFateCardSelect: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
|
||||
local nLevelId = self._panel.nLevelId
|
||||
local mapLevelCfgData = ConfigTable.GetData("VampireSurvivor", nLevelId)
|
||||
if mapLevelCfgData ~= nil then
|
||||
if mapLevelCfgData.Type == GameEnum.vampireSurvivorType.Turn then
|
||||
local nSeasonId = PlayerData.VampireSurvivor:GetCurSeason()
|
||||
local mapSeason = ConfigTable.GetData("VampireRankSeason", nSeasonId)
|
||||
if mapSeason ~= nil then
|
||||
self.tbBundle = clone(mapSeason.FateCardBundle)
|
||||
self.tbExFateCard = decodeJson(mapSeason.SpeciaFateCard)
|
||||
if self.tbExFateCard == nil then
|
||||
self.tbExFateCard = {}
|
||||
end
|
||||
end
|
||||
else
|
||||
self.tbBundle = clone(mapLevelCfgData.FateCardBundle)
|
||||
self.tbExFateCard = decodeJson(mapLevelCfgData.SpeciaFateCard)
|
||||
if self.tbExFateCard == nil then
|
||||
self.tbExFateCard = {}
|
||||
end
|
||||
end
|
||||
end
|
||||
for i = 1, 5 do
|
||||
if self.tbBundle[i] ~= nil then
|
||||
self._mapNode.pkgInfo[i].gameObject:SetActive(true)
|
||||
self._mapNode.pkgInfo[i]:InitPackage(self.tbBundle[i])
|
||||
else
|
||||
self._mapNode.pkgInfo[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function VampireFateCardSelect:OnDisable()
|
||||
for k, v in ipairs(self._mapNode.btnFateCard) do
|
||||
v.onSelect:RemoveListener(self.handler[k])
|
||||
end
|
||||
end
|
||||
function VampireFateCardSelect:OnBtnClick_Confirm()
|
||||
if nil ~= self.callback then
|
||||
local completeFunc = function(nEventId, tbFateCard, mapRoll, nCoin, bReward, mapCurFateCard)
|
||||
self.tbCount = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
}
|
||||
self.tbExCount = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
}
|
||||
for nFateCardId, _ in pairs(mapCurFateCard) do
|
||||
local nIdx, bEx = self:GetFateCardBundleIdx(nFateCardId)
|
||||
if bEx then
|
||||
self.tbExCount[nIdx] = self.tbExCount[nIdx] + 1
|
||||
else
|
||||
self.tbCount[nIdx] = self.tbCount[nIdx] + 1
|
||||
end
|
||||
end
|
||||
for i = 1, 5 do
|
||||
self._mapNode.pkgInfo[i]:SetPackageCount(self.tbCount[i])
|
||||
self._mapNode.pkgInfo[i]:SetPackageExCount(self.tbExCount[i])
|
||||
self._mapNode.pkgInfo[i]:SetPackageAddMarket(false)
|
||||
end
|
||||
self._mapNode.imgGlory:SetActive(false)
|
||||
self:SelectComplete(nEventId, tbFateCard, mapRoll, nCoin, bReward)
|
||||
end
|
||||
self.callback(self.nSelectIdx, self.nEventId, completeFunc, false, self.bReward)
|
||||
end
|
||||
end
|
||||
function VampireFateCardSelect:OnBtnClick_Roll()
|
||||
if not self.callback then
|
||||
return
|
||||
end
|
||||
local completeFunc = function(nEventId, tbFateCard, mapRoll, nCoin, bReward, mapCurFateCard)
|
||||
self.tbCount = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
}
|
||||
self.tbExCount = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
}
|
||||
for nFateCardId, _ in pairs(mapCurFateCard) do
|
||||
local nIdx, bEx = self:GetFateCardBundleIdx(nFateCardId)
|
||||
if bEx then
|
||||
self.tbExCount[nIdx] = self.tbExCount[nIdx] + 1
|
||||
else
|
||||
self.tbCount[nIdx] = self.tbCount[nIdx] + 1
|
||||
end
|
||||
end
|
||||
for i = 1, 5 do
|
||||
self._mapNode.pkgInfo[i]:SetPackageCount(self.tbCount[i])
|
||||
self._mapNode.pkgInfo[i]:SetPackageExCount(self.tbExCount[i])
|
||||
self._mapNode.pkgInfo[i]:SetPackageAddMarket(false)
|
||||
end
|
||||
self:Refresh(nEventId, tbFateCard, mapRoll, nCoin, bReward, true)
|
||||
end
|
||||
self.callback(self.nSelectIdx, self.nEventId, completeFunc, true)
|
||||
end
|
||||
function VampireFateCardSelect:OnBtnClick_Abandon()
|
||||
local confirm = function()
|
||||
if nil ~= self.callback then
|
||||
self.nSelectIdx = 0
|
||||
local abandonFunc = function(nEventId, tbFateCard)
|
||||
self:SelectComplete(nEventId, tbFateCard)
|
||||
end
|
||||
self.callback(1000, self.nEventId, abandonFunc)
|
||||
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 VampireFateCardSelect:OnBtnSelect_FateCardItem(btn, nIndex)
|
||||
if self.bReward == true then
|
||||
return
|
||||
end
|
||||
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 VampireFateCardSelect:OnBtnClick_FateCardItem(btn, nIndex)
|
||||
if self.bReward == true then
|
||||
return
|
||||
end
|
||||
if nil == self.tbFateCardList[nIndex] or self.nSelectIdx == nIndex then
|
||||
return
|
||||
end
|
||||
for i, nCount in ipairs(self.tbCount) do
|
||||
self._mapNode.pkgInfo[i]:SetPackageAddMarket(false)
|
||||
self._mapNode.pkgInfo[i]:SetPackageCount(nCount)
|
||||
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
|
||||
local mapFatecardInfo = self.tbFateCardList[nIndex]
|
||||
local nBundleIdx, bEx = self:GetFateCardBundleIdx(mapFatecardInfo.Id)
|
||||
if bEx then
|
||||
self._mapNode.pkgInfo[nBundleIdx]:SetPackageExAdd(self.tbExCount[nBundleIdx] + 1)
|
||||
else
|
||||
self._mapNode.pkgInfo[nBundleIdx]:SetPackageAddMarket(true)
|
||||
self._mapNode.pkgInfo[nBundleIdx]:SetPackageCount(self.tbCount[nBundleIdx] + 1)
|
||||
end
|
||||
self:SelectScroll(nIndex)
|
||||
self.nSelectIdx = nIndex
|
||||
end
|
||||
function VampireFateCardSelect:OnBtnClick_Depot()
|
||||
self.bOpenDepot = true
|
||||
CS.GameCameraStackManager.Instance:OpenMainCamera()
|
||||
self._mapNode.contentRoot.gameObject:SetActive(false)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.contentRoot, 0)
|
||||
self._mapNode.blurBg.gameObject:SetActive(false)
|
||||
EventManager.Hit("BattleDepot")
|
||||
end
|
||||
function VampireFateCardSelect:OnEvent_SelectFateCard(nEventId, tbFateCard, callback, mapRoll, nCoin, bReward, mapCurFateCard)
|
||||
self._panel:SetTop(self.canvas)
|
||||
self.callback = callback
|
||||
local bClosePanel = false
|
||||
if not self.bOpen then
|
||||
PanelManager.InputDisable()
|
||||
bClosePanel = true
|
||||
GamepadUIManager.EnableGamepadUI("VampireFateCardSelect", self.tbGamepadUINode)
|
||||
end
|
||||
self.bOpen = true
|
||||
self.bReward = bReward
|
||||
self.tbCount = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
}
|
||||
self.tbExCount = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
}
|
||||
for nFateCardId, _ in pairs(mapCurFateCard) do
|
||||
local nIdx, bEx = self:GetFateCardBundleIdx(nFateCardId)
|
||||
if bEx then
|
||||
self.tbExCount[nIdx] = self.tbExCount[nIdx] + 1
|
||||
else
|
||||
self.tbCount[nIdx] = self.tbCount[nIdx] + 1
|
||||
end
|
||||
end
|
||||
for i = 1, 5 do
|
||||
self._mapNode.pkgInfo[i]:SetPackageCount(self.tbCount[i])
|
||||
self._mapNode.pkgInfo[i]:SetPackageExCount(self.tbExCount[i])
|
||||
self._mapNode.pkgInfo[i]:SetPackageAddMarket(false)
|
||||
end
|
||||
self.nSelectIdx = 0
|
||||
self.tbFateCardList = {}
|
||||
self._mapNode.contentRoot.gameObject:SetActive(true)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.contentRoot, 0)
|
||||
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
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.contentRoot, 1)
|
||||
if bReward then
|
||||
self.bInEnd = false
|
||||
self.bAnimEx = nil
|
||||
if #tbFateCard == 0 then
|
||||
self._mapNode.animCtrl:SetBool("standby1", false)
|
||||
self._mapNode.animCtrl:SetBool("standby2", false)
|
||||
self._mapNode.animCtrl:Play("VampireFateCard_in1")
|
||||
WwiseAudioMgr:PlaySound("ui_vampire_chest_start")
|
||||
local waitIn = function()
|
||||
self.bInEnd = true
|
||||
if self.bAnimEx == nil then
|
||||
return
|
||||
end
|
||||
local sEvent = self.bAnimEx and "ui_vampire_chest_special" or "ui_vampire_chest_normal"
|
||||
WwiseAudioMgr:PlaySound(sEvent)
|
||||
end
|
||||
self:AddTimer(1, 0.6, waitIn, true, true, true, nil)
|
||||
else
|
||||
local _, bEx = self:GetFateCardBundleIdx(tbFateCard[1].Id)
|
||||
self:Refresh(nEventId, tbFateCard, mapRoll, nCoin, bReward)
|
||||
if bEx then
|
||||
self._mapNode.animCtrl:SetBool("standby1", true)
|
||||
else
|
||||
self._mapNode.animCtrl:SetBool("standby2", true)
|
||||
end
|
||||
if self.bInEnd then
|
||||
local sEvent = bEx and "ui_vampire_chest_special" or "ui_vampire_chest_normal"
|
||||
WwiseAudioMgr:PlaySound(sEvent)
|
||||
else
|
||||
self.bAnimEx = bEx
|
||||
end
|
||||
end
|
||||
else
|
||||
self:Refresh(nEventId, tbFateCard, mapRoll, nCoin, bReward)
|
||||
local animTime = NovaAPI.GetAnimClipLength(self._mapNode.animCtrl, {
|
||||
"VampireFateCard_in"
|
||||
})
|
||||
self._mapNode.animCtrl:Play("VampireFateCard_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, animTime)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function VampireFateCardSelect:OnEvent_CloseStarTowerDepot()
|
||||
if self.bOpenDepot then
|
||||
self.bOpenDepot = 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)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.contentRoot, 1)
|
||||
if self.bReward then
|
||||
self._mapNode.animCtrl:Play("VampireFateCard_out")
|
||||
else
|
||||
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
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
end
|
||||
function VampireFateCardSelect:OnEvent_GamepadUIChange(sName, nBeforeType, nAfterType)
|
||||
if sName ~= "VampireFateCardSelect" 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 VampireFateCardSelect:OnEvent_Reopen(sName)
|
||||
if sName ~= "VampireFateCardSelect" 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 VampireFateCardSelect:OnEvent_VampireRewardChestFailed()
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
CS.GameCameraStackManager.Instance:OpenMainCamera()
|
||||
self:HidePanel()
|
||||
if nil ~= self.callback then
|
||||
self.callback(-1, 1)
|
||||
end
|
||||
end
|
||||
function VampireFateCardSelect:OnEvent_VampireLevelRewardFailed()
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
CS.GameCameraStackManager.Instance:OpenMainCamera()
|
||||
self:HidePanel()
|
||||
if nil ~= self.callback then
|
||||
self.callback(-2, 1)
|
||||
end
|
||||
end
|
||||
function VampireFateCardSelect:ResetSelect(tbUI, sAnimName)
|
||||
self.nSelectIdx = 0
|
||||
self.bRecommended = false
|
||||
GamepadUIManager.SetNavigation(tbUI)
|
||||
local animTime = NovaAPI.GetAnimClipLength(self._mapNode.animCtrl, {sAnimName}) + 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
|
||||
end, true, true, true)
|
||||
end
|
||||
function VampireFateCardSelect: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
|
||||
function VampireFateCardSelect:GetFateCardBundleIdx(nFateCardId)
|
||||
local mapCfgData = ConfigTable.GetData("StarTowerBookFateCard", nFateCardId)
|
||||
if mapCfgData == nil then
|
||||
printError("no StarTowerBookFateCard Data:" .. nFateCardId)
|
||||
return 1, false
|
||||
end
|
||||
local nBundleId = mapCfgData.BundleId
|
||||
local nIdx = table.indexof(self.tbBundle, nBundleId)
|
||||
if 0 < nIdx then
|
||||
return nIdx, false
|
||||
end
|
||||
for i, tbExFateCard in ipairs(self.tbExFateCard) do
|
||||
if table.indexof(tbExFateCard, nFateCardId) > 0 then
|
||||
return i, true
|
||||
end
|
||||
end
|
||||
printError("命运卡不在当前关卡卡包中:" .. nFateCardId)
|
||||
return 1, false
|
||||
end
|
||||
return VampireFateCardSelect
|
||||
@@ -0,0 +1,22 @@
|
||||
local VampireFateCardSelectPanel = class("VampireFateCardSelectPanel", BasePanel)
|
||||
VampireFateCardSelectPanel._bIsMainPanel = false
|
||||
VampireFateCardSelectPanel._bAddToBackHistory = false
|
||||
VampireFateCardSelectPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "VampireBattle/VampireFateCardSelectPanel.prefab",
|
||||
sCtrlName = "Game.UI.VampireSurvivor.VampireFateCardSelect"
|
||||
}
|
||||
}
|
||||
function VampireFateCardSelectPanel:Awake()
|
||||
end
|
||||
function VampireFateCardSelectPanel:OnEnable()
|
||||
end
|
||||
function VampireFateCardSelectPanel:OnAfterEnter()
|
||||
end
|
||||
function VampireFateCardSelectPanel:OnDisable()
|
||||
end
|
||||
function VampireFateCardSelectPanel:OnDestroy()
|
||||
end
|
||||
function VampireFateCardSelectPanel:OnRelease()
|
||||
end
|
||||
return VampireFateCardSelectPanel
|
||||
@@ -0,0 +1,77 @@
|
||||
local VampireFateSelect_packageInfoCtrl = class("VampireFateSelect_packageInfoCtrl", BaseCtrl)
|
||||
VampireFateSelect_packageInfoCtrl._mapNodeConfig = {
|
||||
imgElementIcon = {sComponentName = "Image"},
|
||||
TMPName = {sComponentName = "TMP_Text"},
|
||||
TMPCardCount = {sComponentName = "TMP_Text"},
|
||||
imgSelectMark = {},
|
||||
imgMark = {sNodeName = "imgMark1_", nCount = 3},
|
||||
imgMarkAnim = {
|
||||
sNodeName = "imgMark1_",
|
||||
nCount = 3,
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
rtPoints = {}
|
||||
}
|
||||
VampireFateSelect_packageInfoCtrl._mapEventConfig = {}
|
||||
VampireFateSelect_packageInfoCtrl._mapRedDotConfig = {}
|
||||
function VampireFateSelect_packageInfoCtrl:Awake()
|
||||
self.tbBaseBundle = ConfigTable.GetConfigArray("VampireBaseBundle")
|
||||
for i = 1, #self.tbBaseBundle do
|
||||
self.tbBaseBundle[i] = tonumber(self.tbBaseBundle[i])
|
||||
end
|
||||
end
|
||||
function VampireFateSelect_packageInfoCtrl:FadeIn()
|
||||
end
|
||||
function VampireFateSelect_packageInfoCtrl:FadeOut()
|
||||
end
|
||||
function VampireFateSelect_packageInfoCtrl:OnEnable()
|
||||
self.animator = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function VampireFateSelect_packageInfoCtrl:OnDisable()
|
||||
end
|
||||
function VampireFateSelect_packageInfoCtrl:OnDestroy()
|
||||
end
|
||||
function VampireFateSelect_packageInfoCtrl:OnRelease()
|
||||
end
|
||||
function VampireFateSelect_packageInfoCtrl:InitPackage(nBundleId)
|
||||
self.bBaseBundle = false
|
||||
if self.tbBaseBundle ~= nil then
|
||||
self.bBaseBundle = table.indexof(self.tbBaseBundle, nBundleId) > 0
|
||||
end
|
||||
local bActiveExFateCard = PlayerData.VampireSurvivor:GetActiveExFateCard()
|
||||
self._mapNode.rtPoints:SetActive(not self.bBaseBundle and bActiveExFateCard)
|
||||
local mapBundleCfgData = ConfigTable.GetData("StarTowerBookFateCardBundle", nBundleId)
|
||||
if mapBundleCfgData ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPName, mapBundleCfgData.ShortName)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPCardCount, 0)
|
||||
self:SetPngSprite(self._mapNode.imgElementIcon, mapBundleCfgData.Icon)
|
||||
self._mapNode.imgSelectMark:SetActive(false)
|
||||
end
|
||||
end
|
||||
function VampireFateSelect_packageInfoCtrl:SetPackageCount(nCount)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPCardCount, nCount)
|
||||
end
|
||||
function VampireFateSelect_packageInfoCtrl:SetPackageAddMarket(bShow)
|
||||
self._mapNode.imgSelectMark:SetActive(bShow)
|
||||
end
|
||||
function VampireFateSelect_packageInfoCtrl:SetPackageExCount(nCount)
|
||||
self._mapNode.imgMark[1]:SetActive(1 <= nCount)
|
||||
self._mapNode.imgMark[2]:SetActive(2 <= nCount)
|
||||
self._mapNode.imgMark[3]:SetActive(3 <= nCount)
|
||||
end
|
||||
function VampireFateSelect_packageInfoCtrl:SetPackageExAdd(nCount)
|
||||
if nCount < 1 or 3 < nCount then
|
||||
return
|
||||
end
|
||||
self._mapNode.imgMark[nCount]:SetActive(true)
|
||||
self._mapNode.imgMarkAnim[nCount]:Play("imgMark_idle")
|
||||
end
|
||||
function VampireFateSelect_packageInfoCtrl:PlayAnimIn(nCount)
|
||||
self.animator:Play("pkgInfo1_in")
|
||||
if nCount < 1 or 3 < nCount then
|
||||
return
|
||||
end
|
||||
self._mapNode.imgMark[nCount]:SetActive(true)
|
||||
self._mapNode.imgMarkAnim[nCount]:Play("imgMark_in")
|
||||
end
|
||||
return VampireFateSelect_packageInfoCtrl
|
||||
@@ -0,0 +1,44 @@
|
||||
local VampireMenuCtrl = class("VampireMenuCtrl", BaseCtrl)
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
local AdventureModuleHelper = CS.AdventureModuleHelper
|
||||
VampireMenuCtrl._mapNodeConfig = {
|
||||
canvas_group = {
|
||||
sComponentName = "CanvasGroup",
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
btnPause = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtn_Pause"
|
||||
},
|
||||
btnBag = {sComponentName = "NaviButton", callback = "OnBtn_Bag"}
|
||||
}
|
||||
VampireMenuCtrl._mapEventConfig = {
|
||||
InputEnable = "OnEvent_InputEnable",
|
||||
LoadLevelRefresh = "OnEvent_LoadLevelRefresh"
|
||||
}
|
||||
local bOpenMiniMap = false
|
||||
function VampireMenuCtrl:OnEnable()
|
||||
self._mapNode.btnPause.gameObject:SetActive(false)
|
||||
self._mapNode.btnBag.gameObject:SetActive(false)
|
||||
GamepadUIManager.AddGamepadUINode("BattleMenu", self:GetGamepadUINode())
|
||||
end
|
||||
function VampireMenuCtrl:OnEvent_LoadLevelRefresh()
|
||||
self._mapNode.btnBag.gameObject:SetActive(true)
|
||||
self._mapNode.btnPause.gameObject:SetActive(true)
|
||||
end
|
||||
function VampireMenuCtrl:OnDisable()
|
||||
end
|
||||
function VampireMenuCtrl:OnBtn_Pause()
|
||||
EventManager.Hit("BattlePause")
|
||||
end
|
||||
function VampireMenuCtrl:OnBtn_Bag()
|
||||
EventManager.Hit("BattleDepot")
|
||||
end
|
||||
function VampireMenuCtrl: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 VampireMenuCtrl
|
||||
@@ -0,0 +1,115 @@
|
||||
local VampireRoomInfo_ItemTipsCtrl = class("VampireRoomInfo_ItemTipsCtrl", BaseCtrl)
|
||||
VampireRoomInfo_ItemTipsCtrl._mapNodeConfig = {
|
||||
tr_TipContent = {sComponentName = "Transform"},
|
||||
TipPool = {sComponentName = "Transform"},
|
||||
TemplateItemTip = {sComponentName = "GameObject"},
|
||||
TemplateTip = {sComponentName = "GameObject"}
|
||||
}
|
||||
VampireRoomInfo_ItemTipsCtrl._mapEventConfig = {
|
||||
VampireFateCardTips = "OnEvent_ShowTips",
|
||||
VampireEventTips = "OnEvent_ShowEventTips",
|
||||
StarTowerTipsShowEnd = "OnEvent_TipsShowEnd"
|
||||
}
|
||||
VampireRoomInfo_ItemTipsCtrl._mapRedDotConfig = {}
|
||||
function VampireRoomInfo_ItemTipsCtrl:GetItem(nType)
|
||||
if nType == 1 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.VampireSurvivor.VampireRoomInfo_ItemTipsItemCtrl")
|
||||
return TipItem
|
||||
end
|
||||
elseif 0 < #self._tbEventTipPool then
|
||||
local idx = #self._tbEventTipPool
|
||||
TipItem = self._tbEventTipPool[idx]
|
||||
table.remove(self._tbEventTipPool, idx)
|
||||
TipItem.gameObject.transform:SetParent(self._mapNode.tr_TipContent)
|
||||
return TipItem
|
||||
else
|
||||
local itemObj = instantiate(self._mapNode.TemplateTip, self._mapNode.tr_TipContent)
|
||||
itemObj:SetActive(true)
|
||||
TipItem = self:BindCtrlByNode(itemObj, "Game.UI.VampireSurvivor.VampireRoomInfo_ItemTipsEventItemCtrl")
|
||||
return TipItem
|
||||
end
|
||||
end
|
||||
function VampireRoomInfo_ItemTipsCtrl:RecycleItem(itemCtrl, nType)
|
||||
itemCtrl.gameObject.transform:SetParent(self._mapNode.TipPool)
|
||||
if nType == 1 then
|
||||
table.insert(self._tbItemTipPool, itemCtrl)
|
||||
else
|
||||
table.insert(self._tbEventItemTipPool, itemCtrl)
|
||||
end
|
||||
end
|
||||
function VampireRoomInfo_ItemTipsCtrl: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[1])
|
||||
tipItem.gameObject:SetActive(true)
|
||||
table.insert(self._tbTipShow, tipItem)
|
||||
if tipsInfo[1] == 1 then
|
||||
tipItem:Show(tipsInfo[2].nTid, tipsInfo[2].nCount)
|
||||
else
|
||||
tipItem:Show(tipsInfo[2], tipsInfo[3])
|
||||
end
|
||||
else
|
||||
frameCount = frameCount + 1
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
end
|
||||
end
|
||||
end
|
||||
self.showTipsCor = cs_coroutine.start(wait)
|
||||
else
|
||||
print("剧情中无法显示物品提示")
|
||||
end
|
||||
end
|
||||
function VampireRoomInfo_ItemTipsCtrl:Awake()
|
||||
self._mapNode.TemplateItemTip.gameObject:SetActive(false)
|
||||
self.bPause = false
|
||||
self.nMaxTipsCount = 8
|
||||
self._tbItemTipPool = {}
|
||||
self._tbEventItemTipPool = {}
|
||||
self._tbEventTipPool = {}
|
||||
self._tbDiscTipPool = {}
|
||||
self._tbTipShow = {}
|
||||
self._tbTipsQueue = {}
|
||||
self.showTipsCor = nil
|
||||
delChildren(self._mapNode.tr_TipContent)
|
||||
end
|
||||
function VampireRoomInfo_ItemTipsCtrl:OnDisable()
|
||||
if nil ~= self.showTipsCor then
|
||||
cs_coroutine.stop(self.showTipsCor)
|
||||
end
|
||||
self.showTipsCor = nil
|
||||
end
|
||||
function VampireRoomInfo_ItemTipsCtrl:OnEvent_ShowTips(tbTips)
|
||||
for _, v in ipairs(tbTips) do
|
||||
table.insert(self._tbTipsQueue, {1, v})
|
||||
end
|
||||
self:ShowTips()
|
||||
end
|
||||
function VampireRoomInfo_ItemTipsCtrl:OnEvent_ShowEventTips(nType, nMonsterId)
|
||||
table.insert(self._tbTipsQueue, {
|
||||
2,
|
||||
nType,
|
||||
nMonsterId
|
||||
})
|
||||
self:ShowTips()
|
||||
end
|
||||
function VampireRoomInfo_ItemTipsCtrl:OnEvent_TipsShowEnd(itemCtrl, nType)
|
||||
local idx = table.indexof(self._tbTipShow, itemCtrl)
|
||||
table.remove(self._tbTipShow, idx)
|
||||
self:RecycleItem(itemCtrl, nType)
|
||||
self:ShowTips()
|
||||
end
|
||||
return VampireRoomInfo_ItemTipsCtrl
|
||||
@@ -0,0 +1,58 @@
|
||||
local VampireRoomInfo_ItemTipsEventItemCtrl = class("VampireRoomInfo_ItemTipsEventItemCtrl", BaseCtrl)
|
||||
VampireRoomInfo_ItemTipsEventItemCtrl._mapNodeConfig = {
|
||||
imgBg = {sComponentName = "Image"},
|
||||
itemTr = {
|
||||
sNodeName = "imgBg",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
canvasGroup = {
|
||||
sNodeName = "imgBg",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
txtItemName = {
|
||||
sNodeName = "txt_ItemName",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
img_ItemIcon = {sComponentName = "Image"}
|
||||
}
|
||||
VampireRoomInfo_ItemTipsEventItemCtrl._mapEventConfig = {}
|
||||
function VampireRoomInfo_ItemTipsEventItemCtrl:Show(nType, nMonsterId)
|
||||
local str = ConfigTable.GetUIText("VampireEventTips_" .. nType)
|
||||
if nMonsterId ~= nil then
|
||||
local mapMonsterCfg = ConfigTable.GetData("Monster", nMonsterId)
|
||||
if mapMonsterCfg ~= nil then
|
||||
local nFAId = mapMonsterCfg.FAId
|
||||
local mapMonsterFACfg = ConfigTable.GetData("MonsterSkin", nFAId)
|
||||
if mapMonsterFACfg ~= nil then
|
||||
local nMId = mapMonsterFACfg.MonsterManual
|
||||
local mapManualCfg = ConfigTable.GetData("MonsterManual", nMId)
|
||||
if mapManualCfg ~= nil then
|
||||
local sIcon = mapManualCfg.Icon
|
||||
self:SetPngSprite(self._mapNode.img_ItemIcon, sIcon)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemName, str)
|
||||
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 VampireRoomInfo_ItemTipsEventItemCtrl:OnTipItemHide()
|
||||
local nInAnimLen = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"TemplateTip_out"
|
||||
})
|
||||
self.animRoot:Play("TemplateTip_out")
|
||||
self:AddTimer(1, nInAnimLen, function()
|
||||
EventManager.Hit("StarTowerTipsShowEnd", self, 1)
|
||||
end, true, true, true, nil)
|
||||
end
|
||||
function VampireRoomInfo_ItemTipsEventItemCtrl:Awake()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
return VampireRoomInfo_ItemTipsEventItemCtrl
|
||||
@@ -0,0 +1,51 @@
|
||||
local VampireRoomInfo_ItemTipsItemCtrl = class("VampireRoomInfo_ItemTipsItemCtrl", BaseCtrl)
|
||||
VampireRoomInfo_ItemTipsItemCtrl._mapNodeConfig = {
|
||||
imgBg = {sComponentName = "Image"},
|
||||
itemTr = {
|
||||
sNodeName = "imgBg",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
canvasGroup = {
|
||||
sNodeName = "imgBg",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
txtItemName = {
|
||||
sNodeName = "txt_ItemName",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
goFateCardItem = {
|
||||
sCtrlName = "Game.UI.VampireSurvivor.Depot.DepotFateCardItemCtrl"
|
||||
}
|
||||
}
|
||||
VampireRoomInfo_ItemTipsItemCtrl._mapEventConfig = {}
|
||||
function VampireRoomInfo_ItemTipsItemCtrl:Show(nFateCardId, nCount)
|
||||
local mapFateCardCfgData = ConfigTable.GetData("FateCard", nFateCardId)
|
||||
if mapFateCardCfgData == nil then
|
||||
self:OnTipItemHide()
|
||||
return
|
||||
end
|
||||
self._mapNode.goFateCardItem:InitFateCard(nFateCardId, 1)
|
||||
local str = string.format("%s %s", mapFateCardCfgData.Name, ConfigTable.GetUIText("StarTower_FateCard_Unable"))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemName, str)
|
||||
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 VampireRoomInfo_ItemTipsItemCtrl:OnTipItemHide()
|
||||
local nInAnimLen = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"TemplateTip_out"
|
||||
})
|
||||
self.animRoot:Play("TemplateTip_out")
|
||||
self:AddTimer(1, nInAnimLen, function()
|
||||
EventManager.Hit("StarTowerTipsShowEnd", self, 1)
|
||||
end, true, true, true, nil)
|
||||
end
|
||||
function VampireRoomInfo_ItemTipsItemCtrl:Awake()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
return VampireRoomInfo_ItemTipsItemCtrl
|
||||
@@ -0,0 +1,159 @@
|
||||
local VampireRoomInfo_ScoreCtrl = class("VampireRoomInfo_ScoreCtrl", BaseCtrl)
|
||||
VampireRoomInfo_ScoreCtrl._mapNodeConfig = {
|
||||
imgScoreBg = {sComponentName = "Image"},
|
||||
Score = {nCount = 3},
|
||||
TMPScore = {sComponentName = "TMP_Text", nCount = 3},
|
||||
TMPScoreAnim = {
|
||||
sNodeName = "TMPScore",
|
||||
sComponentName = "Animator",
|
||||
nCount = 3
|
||||
},
|
||||
TMPScoreTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Vampire_Score_Title"
|
||||
},
|
||||
imgBonus = {nCount = 3},
|
||||
TMPBonus = {sComponentName = "TMP_Text", nCount = 3},
|
||||
rtFillMask = {
|
||||
sComponentName = "HpBarRectTransform"
|
||||
},
|
||||
rtBonus = {
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
AnimRoot = {sComponentName = "Animator"},
|
||||
UIParticleScore1 = {}
|
||||
}
|
||||
VampireRoomInfo_ScoreCtrl._mapEventConfig = {
|
||||
VampireScoreChange = "OnEvent_VampireScoreChange",
|
||||
VampireBonusKill = "OnEvent_VampireBonusChange",
|
||||
VampireBonusExpire = "OnEvnet_VampireBonusExpire"
|
||||
}
|
||||
VampireRoomInfo_ScoreCtrl._mapRedDotConfig = {}
|
||||
function VampireRoomInfo_ScoreCtrl:Awake()
|
||||
self.tbColor = {}
|
||||
local bSuccess
|
||||
bSuccess, self.tbColor[1] = ColorUtility.TryParseHtmlString("#4c74d6")
|
||||
bSuccess, self.tbColor[2] = ColorUtility.TryParseHtmlString("#EB7057")
|
||||
bSuccess, self.tbColor[3] = ColorUtility.TryParseHtmlString("#ED4564")
|
||||
self.nBonusTime = 0
|
||||
self.tbBonusRank = {}
|
||||
self.tbBonusPower = {}
|
||||
local sBonusConfig = ConfigTable.GetConfigValue("VampireBonusConfig")
|
||||
if sBonusConfig ~= nil then
|
||||
local tbBonusConfig = decodeJson(sBonusConfig)
|
||||
if tbBonusConfig ~= nil then
|
||||
for _, tbData in ipairs(tbBonusConfig) do
|
||||
table.insert(self.tbBonusRank, tbData[1])
|
||||
table.insert(self.tbBonusPower, tbData[2])
|
||||
end
|
||||
end
|
||||
end
|
||||
local sBonusTime = ConfigTable.GetConfigValue("VampireBonusTime")
|
||||
if sBonusTime ~= nil then
|
||||
local nTime = tonumber(sBonusTime)
|
||||
if nTime ~= nil then
|
||||
self.nBonusTime = nTime
|
||||
end
|
||||
end
|
||||
self.nCurScore = 0
|
||||
end
|
||||
function VampireRoomInfo_ScoreCtrl:FadeIn()
|
||||
end
|
||||
function VampireRoomInfo_ScoreCtrl:FadeOut()
|
||||
end
|
||||
function VampireRoomInfo_ScoreCtrl:OnEnable()
|
||||
self._mapNode.Score[1].gameObject:SetActive(true)
|
||||
self._mapNode.Score[2].gameObject:SetActive(false)
|
||||
self._mapNode.Score[3].gameObject:SetActive(false)
|
||||
self._mapNode.UIParticleScore1:SetActive(false)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[1], 0)
|
||||
self._mapNode.imgBonus[1].gameObject:SetActive(true)
|
||||
self._mapNode.imgBonus[2].gameObject:SetActive(false)
|
||||
self._mapNode.imgBonus[3].gameObject:SetActive(false)
|
||||
self._mapNode.TMPBonus[1].gameObject:SetActive(true)
|
||||
self._mapNode.TMPBonus[2].gameObject:SetActive(false)
|
||||
self._mapNode.TMPBonus[3].gameObject:SetActive(false)
|
||||
self.nCurRank = 0
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.rtBonus, 0)
|
||||
end
|
||||
function VampireRoomInfo_ScoreCtrl:OnDisable()
|
||||
end
|
||||
function VampireRoomInfo_ScoreCtrl:OnDestroy()
|
||||
end
|
||||
function VampireRoomInfo_ScoreCtrl:OnRelease()
|
||||
end
|
||||
function VampireRoomInfo_ScoreCtrl:OnEvent_VampireScoreChange(nScore)
|
||||
nScore = math.floor(nScore)
|
||||
if self.nCurRank <= 1 then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[1], nScore)
|
||||
self._mapNode.TMPScoreAnim[1]:Play("rtScoreTMP_in")
|
||||
elseif self.nCurRank < 3 then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[self.nCurRank], nScore)
|
||||
self._mapNode.TMPScoreAnim[2]:Play("rtScoreTMP_in")
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[3], nScore)
|
||||
self._mapNode.TMPScoreAnim[3]:Play("rtScoreTMP_in")
|
||||
end
|
||||
self.nCurScore = nScore
|
||||
end
|
||||
function VampireRoomInfo_ScoreCtrl:OnEvent_VampireBonusChange(nCount)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.rtBonus, 1)
|
||||
self._mapNode.rtFillMask:SetTarget(Vector2(92, 84), 0)
|
||||
self._mapNode.rtFillMask:SetTarget(Vector2(92, 0), self.nBonusTime + 1)
|
||||
local rank = 0
|
||||
for i = 1, #self.tbBonusRank do
|
||||
if nCount >= self.tbBonusRank[i] then
|
||||
rank = i
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
if rank ~= self.nCurRank then
|
||||
self._mapNode.imgScoreBg.color = self.tbColor[rank <= 1 and 1 or rank == 2 and 2 or 3]
|
||||
self._mapNode.UIParticleScore1:SetActive(rank == 1)
|
||||
self._mapNode.Score[1].gameObject:SetActive(rank <= 1)
|
||||
self._mapNode.Score[2].gameObject:SetActive(rank == 2)
|
||||
self._mapNode.Score[3].gameObject:SetActive(3 <= rank)
|
||||
self._mapNode.imgBonus[1].gameObject:SetActive(rank <= 1)
|
||||
self._mapNode.imgBonus[2].gameObject:SetActive(rank == 2)
|
||||
self._mapNode.imgBonus[3].gameObject:SetActive(3 <= rank)
|
||||
self._mapNode.TMPBonus[1].gameObject:SetActive(rank <= 1)
|
||||
self._mapNode.TMPBonus[2].gameObject:SetActive(rank == 2)
|
||||
self._mapNode.TMPBonus[3].gameObject:SetActive(3 <= rank)
|
||||
self.nCurRank = rank
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
if rank == 2 then
|
||||
self._mapNode.AnimRoot:Play("VampireRoomInfoBonus_in")
|
||||
elseif rank == 3 then
|
||||
self._mapNode.AnimRoot:Play("VampireRoomInfoBonus_in1")
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
if self.nCurRank == 0 then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPBonus[1], orderedFormat(ConfigTable.GetUIText("Vampire_Bonus_Title_z") or "", nCount))
|
||||
elseif 1 >= self.nCurRank then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPBonus[1], orderedFormat(ConfigTable.GetUIText("Vampire_Bonus_Title") or "", nCount, self.tbBonusPower[1] / 100))
|
||||
elseif self.nCurRank <= 3 then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPBonus[self.nCurRank], orderedFormat(ConfigTable.GetUIText("Vampire_Bonus_Title") or "", nCount, self.tbBonusPower[self.nCurRank] / 100))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPBonus[3], orderedFormat(ConfigTable.GetUIText("Vampire_Bonus_Title") or "", nCount, self.tbBonusPower[self.nCurRank] / 100))
|
||||
end
|
||||
end
|
||||
function VampireRoomInfo_ScoreCtrl:OnEvnet_VampireBonusExpire()
|
||||
self._mapNode.imgScoreBg.color = self.tbColor[1]
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.rtBonus, 0)
|
||||
self.nCurRank = 0
|
||||
self:OnEvent_VampireScoreChange(self.nCurScore)
|
||||
self._mapNode.Score[1].gameObject:SetActive(true)
|
||||
self._mapNode.Score[2].gameObject:SetActive(false)
|
||||
self._mapNode.Score[3].gameObject:SetActive(false)
|
||||
self._mapNode.imgBonus[1].gameObject:SetActive(true)
|
||||
self._mapNode.imgBonus[2].gameObject:SetActive(false)
|
||||
self._mapNode.imgBonus[3].gameObject:SetActive(false)
|
||||
self._mapNode.TMPBonus[1].gameObject:SetActive(true)
|
||||
self._mapNode.TMPBonus[2].gameObject:SetActive(false)
|
||||
self._mapNode.TMPBonus[3].gameObject:SetActive(false)
|
||||
end
|
||||
return VampireRoomInfo_ScoreCtrl
|
||||
@@ -0,0 +1,265 @@
|
||||
local VampireSettleCtrl = class("VampireSettleCtrl", BaseCtrl)
|
||||
local WwiseManger = CS.WwiseAudioManager.Instance
|
||||
VampireSettleCtrl._mapNodeConfig = {
|
||||
goSuccess = {},
|
||||
goFail = {},
|
||||
TMPLevelName = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
TMPFateCardTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "VampireSettle_FateCardTitle"
|
||||
},
|
||||
TMPFateCardCount = {sComponentName = "TMP_Text"},
|
||||
TMPAreaTitle = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
TMPTotalTitle = {
|
||||
nCount = 3,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "VampireSettle_TotalTitle"
|
||||
},
|
||||
TMPTotalScore = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
TMPFailTitle = {
|
||||
nCount = 3,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "VampireSettle_FailTitle"
|
||||
},
|
||||
TMPInfo = {nCount = 15, sComponentName = "TMP_Text"},
|
||||
TMPScore = {nCount = 15, sComponentName = "TMP_Text"},
|
||||
TMPFinalTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "VampireSettle_FinalTitle"
|
||||
},
|
||||
TMPNewRecord = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "VampireSettle_NewRecord"
|
||||
},
|
||||
imgNewRecordBg = {},
|
||||
TMPFinalScore = {sComponentName = "TMP_Text"},
|
||||
ainmator = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
rtContnet = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
goPass = {nCount = 3},
|
||||
goInfoFail = {nCount = 3},
|
||||
btnScreen = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
blur = {sNodeName = "snapshot"},
|
||||
Mask = {
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
imgSingleBg = {},
|
||||
imgInfoBg = {sNodeName = "imgInfoBgD"},
|
||||
btnDamageResult1 = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ShowDamageResult1"
|
||||
},
|
||||
btnDamageResult2 = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ShowDamageResult2"
|
||||
},
|
||||
btnDamageResult3 = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ShowDamageResult1"
|
||||
}
|
||||
}
|
||||
VampireSettleCtrl._mapEventConfig = {}
|
||||
VampireSettleCtrl._mapRedDotConfig = {}
|
||||
function VampireSettleCtrl:Awake()
|
||||
self._mapNode.rtContnet.localScale = Vector3.zero
|
||||
end
|
||||
function VampireSettleCtrl:FadeIn()
|
||||
end
|
||||
function VampireSettleCtrl:FadeOut()
|
||||
end
|
||||
function VampireSettleCtrl:OnEnable()
|
||||
self._mapNode.Mask.gameObject:SetActive(false)
|
||||
local bSuccess = self._panel._tbParam[1]
|
||||
local nLevelId = self._panel._tbParam[2]
|
||||
local nFateCardCount = self._panel._tbParam[3]
|
||||
local tbArea1 = self._panel._tbParam[4]
|
||||
local tbArea2 = self._panel._tbParam[5]
|
||||
local nTotalScore = self._panel._tbParam[6]
|
||||
local bNew = self._panel._tbParam[7]
|
||||
self.callback = self._panel._tbParam[8]
|
||||
self.tbCharDamageFirst = self._panel._tbParam[9]
|
||||
self.tbCharDamageSecond = self._panel._tbParam[10]
|
||||
self._mapNode.goSuccess:SetActive(bSuccess)
|
||||
self._mapNode.goFail:SetActive(not bSuccess)
|
||||
self._mapNode.imgNewRecordBg:SetActive(bNew)
|
||||
local mapLevelCfgData = ConfigTable.GetData("VampireSurvivor", nLevelId)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPFateCardCount, tostring(nFateCardCount))
|
||||
if mapLevelCfgData ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPLevelName[1], mapLevelCfgData.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPLevelName[2], mapLevelCfgData.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPAreaTitle[1], mapLevelCfgData.Name1)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPAreaTitle[2], mapLevelCfgData.Name2)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPAreaTitle[3], mapLevelCfgData.Name1)
|
||||
else
|
||||
return
|
||||
end
|
||||
if mapLevelCfgData.Mode == GameEnum.vampireSurvivorMode.Double then
|
||||
self._mapNode.imgInfoBg:SetActive(true)
|
||||
self._mapNode.imgSingleBg:SetActive(false)
|
||||
if tbArea1 == nil or tbArea1.KillCount == nil then
|
||||
self._mapNode.goPass[1]:SetActive(false)
|
||||
self._mapNode.goInfoFail[1]:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTotalScore[1], 0)
|
||||
else
|
||||
self._mapNode.goPass[1]:SetActive(true)
|
||||
self._mapNode.goInfoFail[1]:SetActive(false)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPInfo[1], orderedFormat(ConfigTable.GetUIText("VampireSettle_MonsterCount"), tbArea1.KillCount[1]))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[1], tbArea1.KillScore[1])
|
||||
local nBonusScore = 0
|
||||
for i = 5, #tbArea1.KillScore do
|
||||
nBonusScore = nBonusScore + tbArea1.KillScore[i]
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPInfo[2], ConfigTable.GetUIText("VampireSettle_Bonus"))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[2], nBonusScore)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPInfo[3], orderedFormat(ConfigTable.GetUIText("VampireSettle_EliteCount"), tbArea1.KillCount[2] + tbArea1.KillCount[3]))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[3], tbArea1.KillScore[2] + tbArea1.KillScore[3])
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPInfo[4], ConfigTable.GetUIText("VampireSettle_LordCount"))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[4], tbArea1.KillScore[4])
|
||||
if tbArea1.KillScore[4] == 0 then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPInfo[5], ConfigTable.GetUIText("Vampire_BossTime_Fail"))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[5], "---")
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPInfo[5], orderedFormat(ConfigTable.GetUIText("VampireSettle_TimeTitle"), tbArea1.BossTime))
|
||||
local nTimeScore = tbArea1.Score
|
||||
for i = 1, #tbArea1.KillScore do
|
||||
nTimeScore = nTimeScore - tbArea1.KillScore[i]
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[5], nTimeScore)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTotalScore[1], tbArea1.Score)
|
||||
end
|
||||
if tbArea2 == nil or tbArea2.KillCount == nil then
|
||||
self._mapNode.goPass[2]:SetActive(false)
|
||||
self._mapNode.goInfoFail[2]:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTotalScore[2], 0)
|
||||
else
|
||||
self._mapNode.goPass[2]:SetActive(true)
|
||||
self._mapNode.goInfoFail[2]:SetActive(false)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPInfo[6], orderedFormat(ConfigTable.GetUIText("VampireSettle_MonsterCount"), tbArea2.KillCount[1]))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[6], tbArea2.KillScore[1])
|
||||
local nBonusScore = 0
|
||||
for i = 5, #tbArea2.KillScore do
|
||||
nBonusScore = nBonusScore + tbArea2.KillScore[i]
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPInfo[7], ConfigTable.GetUIText("VampireSettle_Bonus"))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[7], nBonusScore)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPInfo[8], orderedFormat(ConfigTable.GetUIText("VampireSettle_EliteCount"), tbArea2.KillCount[2] + tbArea2.KillCount[3]))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[8], tbArea2.KillScore[2] + tbArea2.KillScore[3])
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPInfo[9], ConfigTable.GetUIText("VampireSettle_LordCount"))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[9], tbArea2.KillScore[4])
|
||||
if tbArea2.KillScore[4] == 0 then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPInfo[10], ConfigTable.GetUIText("Vampire_BossTime_Fail"))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[10], "---")
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPInfo[10], orderedFormat(ConfigTable.GetUIText("VampireSettle_TimeTitle"), tbArea2.BossTime))
|
||||
local nTimeScore = tbArea2.Score
|
||||
for i = 1, #tbArea2.KillScore do
|
||||
nTimeScore = nTimeScore - tbArea2.KillScore[i]
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[10], nTimeScore)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTotalScore[2], tbArea2.Score)
|
||||
end
|
||||
else
|
||||
self._mapNode.imgInfoBg:SetActive(false)
|
||||
self._mapNode.imgSingleBg:SetActive(true)
|
||||
if tbArea1 == nil or tbArea1.KillCount == nil then
|
||||
self._mapNode.goPass[3]:SetActive(false)
|
||||
self._mapNode.goInfoFail[3]:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTotalScore[3], 0)
|
||||
else
|
||||
self._mapNode.goPass[3]:SetActive(true)
|
||||
self._mapNode.goInfoFail[3]:SetActive(false)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPInfo[11], orderedFormat(ConfigTable.GetUIText("VampireSettle_MonsterCount"), tbArea1.KillCount[1]))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[11], tbArea1.KillScore[1])
|
||||
local nBonusScore = 0
|
||||
for i = 5, #tbArea1.KillScore do
|
||||
nBonusScore = nBonusScore + tbArea1.KillScore[i]
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPInfo[12], ConfigTable.GetUIText("VampireSettle_Bonus"))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[12], nBonusScore)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPInfo[13], orderedFormat(ConfigTable.GetUIText("VampireSettle_EliteCount"), tbArea1.KillCount[2] + tbArea1.KillCount[3]))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[13], tbArea1.KillScore[2] + tbArea1.KillScore[3])
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPInfo[14], ConfigTable.GetUIText("VampireSettle_LordCount"))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[14], tbArea1.KillScore[4])
|
||||
if tbArea1.KillScore[4] == 0 then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPInfo[15], ConfigTable.GetUIText("Vampire_BossTime_Fail"))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[15], "---")
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPInfo[15], orderedFormat(ConfigTable.GetUIText("VampireSettle_TimeTitle"), tbArea1.BossTime))
|
||||
local nTimeScore = tbArea1.Score
|
||||
for i = 1, #tbArea1.KillScore do
|
||||
nTimeScore = nTimeScore - tbArea1.KillScore[i]
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPScore[15], nTimeScore)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTotalScore[3], tbArea1.Score)
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPFinalScore, FormatWithCommas(nTotalScore))
|
||||
WwiseManger:PostEvent("char_common_all_pause")
|
||||
WwiseManger:PostEvent("mon_common_all_pause")
|
||||
if bSuccess then
|
||||
WwiseManger:PlaySound("ui_infinity_victory")
|
||||
self._mapNode.ainmator:Play("VampireSettle_Success")
|
||||
else
|
||||
self._mapNode.ainmator:Play("VampireSettle_Fail")
|
||||
end
|
||||
self.bCloseable = false
|
||||
local animEnd = function()
|
||||
self.bCloseable = true
|
||||
end
|
||||
self:AddTimer(1, 1.5, animEnd, true, true, true)
|
||||
self._mapNode.blur:SetActive(true)
|
||||
self._mapNode.btnDamageResult1.gameObject:SetActive(self.tbCharDamageFirst ~= nil and #self.tbCharDamageFirst > 0)
|
||||
self._mapNode.btnDamageResult2.gameObject:SetActive(self.tbCharDamageSecond ~= nil and #self.tbCharDamageSecond > 0)
|
||||
self._mapNode.btnDamageResult3.gameObject:SetActive(self.tbCharDamageFirst ~= nil and #self.tbCharDamageFirst > 0)
|
||||
local wait = function()
|
||||
NovaAPI.UIEffectSnapShotCapture(self._mapNode.blur)
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.rtContnet.localScale = Vector3.one
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function VampireSettleCtrl:OnDisable()
|
||||
end
|
||||
function VampireSettleCtrl:OnDestroy()
|
||||
end
|
||||
function VampireSettleCtrl:OnRelease()
|
||||
end
|
||||
function VampireSettleCtrl:OnBtnClick_ShowDamageResult1()
|
||||
if self.tbCharDamageFirst ~= nil and #self.tbCharDamageFirst > 0 then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BattleDamage, self.tbCharDamageFirst)
|
||||
end
|
||||
end
|
||||
function VampireSettleCtrl:OnBtnClick_ShowDamageResult2()
|
||||
if self.tbCharDamageSecond ~= nil and #self.tbCharDamageSecond > 0 then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BattleDamage, self.tbCharDamageSecond)
|
||||
end
|
||||
end
|
||||
function VampireSettleCtrl:OnBtnClick_Close()
|
||||
if not self.bCloseable then
|
||||
return
|
||||
end
|
||||
self.bCloseable = false
|
||||
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.callback ~= nil and type(self.callback) == "function" then
|
||||
self.callback()
|
||||
end
|
||||
end)
|
||||
sequence:SetUpdate(true)
|
||||
end
|
||||
return VampireSettleCtrl
|
||||
@@ -0,0 +1,254 @@
|
||||
local VampireSurvivorPauseCtrl = class("VampireSurvivorPauseCtrl", BaseCtrl)
|
||||
local GameCameraStackManager = CS.GameCameraStackManager.Instance
|
||||
local AdventureModuleHelper = CS.AdventureModuleHelper
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
VampireSurvivorPauseCtrl._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"
|
||||
},
|
||||
btnSettings = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Settings"
|
||||
},
|
||||
btnPopSkill = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Skill"
|
||||
},
|
||||
ActionBar = {
|
||||
sCtrlName = "Game.UI.ActionBar.ActionBarCtrl"
|
||||
},
|
||||
txtGiveUp = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Pause_Btn_EndBattle"
|
||||
},
|
||||
txtBack = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Pause_Btn_ContinueBattle"
|
||||
},
|
||||
txtBtnSkill = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTowerMap_Btn_Skill"
|
||||
},
|
||||
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 = "VampirePause_ScoreTitle"
|
||||
},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
txtLeader = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Leader"
|
||||
},
|
||||
txtScore = {sComponentName = "TMP_Text", nCount = 2},
|
||||
rtQuest = {},
|
||||
TMPQuest = {sComponentName = "TMP_Text", nCount = 3},
|
||||
btnQuestStar = {sComponentName = "Button", nCount = 3},
|
||||
imgBgScore = {nCount = 2},
|
||||
txtSub = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Sub"
|
||||
},
|
||||
t_common_02_ = {nCount = 2},
|
||||
imgBgTime = {},
|
||||
handObj = {},
|
||||
texHandTimeTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainBattle_Time"
|
||||
},
|
||||
texHandTime = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
VampireSurvivorPauseCtrl._mapEventConfig = {
|
||||
OpenVampirePause = "Pause",
|
||||
GamepadUIReopen = "OnEvent_Reopen"
|
||||
}
|
||||
function VampireSurvivorPauseCtrl:Refresh(nTime, nScore)
|
||||
local nMin = math.floor(nTime / 60)
|
||||
local nSec = math.fmod(nTime, 60)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, string.format("%02d:%02d", nMin, nSec))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtScore[1], nScore)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtScore[2], nScore)
|
||||
for i = 1, 3 do
|
||||
self._mapNode.goChar[i]:SetChar(self.tbChar[i])
|
||||
end
|
||||
end
|
||||
function VampireSurvivorPauseCtrl: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 VampireSurvivorPauseCtrl:PlayCloseAni(bGiveUp)
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_out")
|
||||
self._mapNode.aniBlur:SetTrigger("tOut")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
self:AddTimer(1, 0.3, "OnPanelClose", true, true, true, bGiveUp)
|
||||
end
|
||||
function VampireSurvivorPauseCtrl:OnPanelClose(_, bGiveUp)
|
||||
PanelManager.InputEnable()
|
||||
GamepadUIManager.DisableGamepadUI("VampireSurvivorPauseCtrl")
|
||||
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("AbandonVampireSurvivor")
|
||||
end
|
||||
end
|
||||
function VampireSurvivorPauseCtrl:Awake()
|
||||
self._mapNode.safeAreaRoot:SetActive(false)
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, string.format("%02d:%02d", 0, 0))
|
||||
local tbConfig = {
|
||||
{
|
||||
sAction = "Skill",
|
||||
sLang = "StarTowerMap_Btn_Skill"
|
||||
},
|
||||
{
|
||||
sAction = "Settings",
|
||||
sLang = "StarTowerMap_Btn_Settings"
|
||||
}
|
||||
}
|
||||
self._mapNode.ActionBar:InitActionBar(tbConfig)
|
||||
end
|
||||
function VampireSurvivorPauseCtrl:OnEnable()
|
||||
end
|
||||
function VampireSurvivorPauseCtrl:OnDisable()
|
||||
end
|
||||
function VampireSurvivorPauseCtrl:OnDestroy()
|
||||
end
|
||||
function VampireSurvivorPauseCtrl:Pause(nLevelId, tbCharId, nTime, nScore)
|
||||
self.tbChar = tbCharId
|
||||
self.nLevelId = nLevelId
|
||||
EventManager.Hit(EventId.BattleDashboardVisible, false)
|
||||
PanelManager.InputDisable()
|
||||
self:PlayInAni()
|
||||
self:Refresh(nTime, nScore)
|
||||
local mapLevelCfgData = ConfigTable.GetData("VampireSurvivor", self.nLevelId)
|
||||
if mapLevelCfgData == nil or mapLevelCfgData.Type == GameEnum.vampireSurvivorType.Turn then
|
||||
self._mapNode.rtQuest:SetActive(false)
|
||||
self._mapNode.imgBgScore[2]:SetActive(false)
|
||||
self._mapNode.imgBgScore[1]:SetActive(true)
|
||||
else
|
||||
self._mapNode.rtQuest:SetActive(true)
|
||||
self._mapNode.imgBgScore[2]:SetActive(true)
|
||||
self._mapNode.imgBgScore[1]:SetActive(false)
|
||||
local tbQuestId = CacheTable.GetData("_VampireQuestGroup", mapLevelCfgData.FirstQuestGroupId)
|
||||
if tbQuestId == nil then
|
||||
tbQuestId = {}
|
||||
end
|
||||
for i = 1, 3 do
|
||||
self._mapNode.TMPQuest[i].gameObject:SetActive(tbQuestId[i] ~= nil)
|
||||
self._mapNode.btnQuestStar[i].interactable = PlayerData.Quest:GetVampireQuestStatusById(tbQuestId[i]) > 0
|
||||
if tbQuestId[i] ~= nil then
|
||||
local mapQuestCfgData = ConfigTable.GetData("VampireSurvivorQuest", tbQuestId[i])
|
||||
if mapQuestCfgData == nil then
|
||||
self._mapNode.TMPQuest[i].gameObject:SetActive(false)
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPQuest[i], mapQuestCfgData.Title)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
GamepadUIManager.EnableGamepadUI("VampireSurvivorPauseCtrl", self.tbGamepadUINode)
|
||||
end
|
||||
function VampireSurvivorPauseCtrl:OnEvent_Time(nTime)
|
||||
end
|
||||
function VampireSurvivorPauseCtrl:OnBtnClick_GiveUp(btn)
|
||||
local sTip = ""
|
||||
local mapLevelData = ConfigTable.GetData("VampireSurvivor", self.nLevelId)
|
||||
local sName = ""
|
||||
if mapLevelData then
|
||||
sName = mapLevelData.Name
|
||||
end
|
||||
local sAlert = orderedFormat(ConfigTable.GetUIText("VampirePause_Abandon_Tips") or "", sName)
|
||||
sTip = sAlert
|
||||
local confirmCallback = function()
|
||||
self:PlayCloseAni(true)
|
||||
self._mapNode.imgBlocker:SetActive(true)
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = sTip,
|
||||
callbackConfirm = confirmCallback,
|
||||
bBlur = false
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function VampireSurvivorPauseCtrl:OnBtnClick_Close(btn)
|
||||
self:PlayCloseAni(false)
|
||||
end
|
||||
function VampireSurvivorPauseCtrl:OnBtnClick_Char(btn, nIndex)
|
||||
end
|
||||
function VampireSurvivorPauseCtrl:OnBtnClick_Skill(btn)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PopupSkillPanel, self.tbChar)
|
||||
self._mapNode.ActionBar.gameObject:SetActive(false)
|
||||
end
|
||||
function VampireSurvivorPauseCtrl:OnBtnClick_Settings(btn)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BattleSettings)
|
||||
self._mapNode.ActionBar.gameObject:SetActive(false)
|
||||
end
|
||||
function VampireSurvivorPauseCtrl:OnEvent_Reopen(sName)
|
||||
if sName ~= "VampireSurvivorPauseCtrl" then
|
||||
return
|
||||
end
|
||||
self._mapNode.ActionBar.gameObject:SetActive(true)
|
||||
end
|
||||
return VampireSurvivorPauseCtrl
|
||||
@@ -0,0 +1,138 @@
|
||||
local VampireSurvivorRoomInfo = class("VampireSurvivorRoomInfo", BaseCtrl)
|
||||
local nTotalLength = 815
|
||||
local nY = 3.5
|
||||
local nYMask = 27
|
||||
local nLevelBarLength = 215
|
||||
local nLevelBarHeight = 24
|
||||
VampireSurvivorRoomInfo._mapNodeConfig = {
|
||||
ItemTips = {
|
||||
sCtrlName = "Game.UI.VampireSurvivor.VampireRoomInfo_ItemTipsCtrl"
|
||||
},
|
||||
rtScore = {
|
||||
sCtrlName = "Game.UI.VampireSurvivor.VampireRoomInfo_ScoreCtrl"
|
||||
},
|
||||
TeamLevel = {},
|
||||
rtFillMaskLevelBar = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgLevelBar = {sComponentName = "Image"},
|
||||
imgLevelBarAdd = {sComponentName = "Image"},
|
||||
txtLevelCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Reward_Level"
|
||||
},
|
||||
txtLevelHint = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Vampire_RoomInfo_LevelHint"
|
||||
},
|
||||
txtTeamLevel = {sComponentName = "TMP_Text"},
|
||||
canvasGroup = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
rtProgress = {},
|
||||
imgElite = {},
|
||||
imgBoss = {},
|
||||
rtMask = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
rtMarkContent = {sComponentName = "Transform"}
|
||||
}
|
||||
VampireSurvivorRoomInfo._mapEventConfig = {
|
||||
VampireSurvivor_Time = "OnEvent_SetTime",
|
||||
Vampire_Level_Times = "OnEvent_SetLevelProgress",
|
||||
Vampire_Boss_Spawn = "OnEvent_Boss_Spawn",
|
||||
Vampire_Exp_Change = "OnEvent_ExpChange",
|
||||
InputEnable = "OnEvent_InputEnable"
|
||||
}
|
||||
VampireSurvivorRoomInfo._mapRedDotConfig = {}
|
||||
function VampireSurvivorRoomInfo:Awake()
|
||||
end
|
||||
function VampireSurvivorRoomInfo:FadeIn()
|
||||
end
|
||||
function VampireSurvivorRoomInfo:FadeOut()
|
||||
end
|
||||
function VampireSurvivorRoomInfo:OnEnable()
|
||||
self.nCurTime = 0
|
||||
self.nTotalTime = 0
|
||||
self.tbTypeTime = {}
|
||||
self.mapMark = {}
|
||||
self.mapWarnTime = {}
|
||||
self.bStop = false
|
||||
self._mapNode.rtProgress:SetActive(false)
|
||||
self._mapNode.rtFillMaskLevelBar.sizeDelta = Vector2(0, nLevelBarHeight)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTeamLevel, 1)
|
||||
end
|
||||
function VampireSurvivorRoomInfo:OnDisable()
|
||||
self.mapMark = {}
|
||||
self.mapWarnTime = {}
|
||||
delChildren(self._mapNode.rtMarkContent)
|
||||
end
|
||||
function VampireSurvivorRoomInfo:OnDestroy()
|
||||
end
|
||||
function VampireSurvivorRoomInfo:OnRelease()
|
||||
end
|
||||
function VampireSurvivorRoomInfo:OnEvent_SetTime(nTime)
|
||||
if self.bStop then
|
||||
return
|
||||
end
|
||||
local nPersent = nTime / self.nTotalTime
|
||||
if 1 < nPersent then
|
||||
nPersent = 1
|
||||
end
|
||||
local nLength = nPersent * nTotalLength
|
||||
self._mapNode.rtMask.sizeDelta = Vector2(nLength, nYMask)
|
||||
if self.mapWarnTime[nTime] ~= nil then
|
||||
local ani = self.mapWarnTime[nTime]:GetComponent("Animator")
|
||||
ani:Play("Vampire_imgElite_idle")
|
||||
end
|
||||
if self.mapMark[nTime] ~= nil then
|
||||
local ani = self.mapMark[nTime]:GetComponent("Animator")
|
||||
ani:Play("Vampire_imgElite_in")
|
||||
end
|
||||
end
|
||||
function VampireSurvivorRoomInfo:OnEvent_SetLevelProgress(nTotalTime, tbTypeTime)
|
||||
self.bStop = false
|
||||
self._mapNode.rtProgress:SetActive(true)
|
||||
local nCount = tbTypeTime.Count
|
||||
self.nTotalTime = tbTypeTime[nCount - 1]
|
||||
self._mapNode.rtMask.sizeDelta = Vector2(0, nYMask)
|
||||
delChildren(self._mapNode.rtMarkContent)
|
||||
self.mapMark = {}
|
||||
self.mapWarnTime = {}
|
||||
for i = 0, nCount - 1 do
|
||||
local nPersent = tbTypeTime[i] / self.nTotalTime
|
||||
local nLength = nPersent * nTotalLength + 3
|
||||
local goMark
|
||||
if i == nCount - 1 then
|
||||
goMark = instantiate(self._mapNode.imgBoss, self._mapNode.rtMarkContent)
|
||||
else
|
||||
goMark = instantiate(self._mapNode.imgElite, self._mapNode.rtMarkContent)
|
||||
end
|
||||
goMark:SetActive(true)
|
||||
goMark:GetComponent("Image").enabled = true
|
||||
local ani = goMark:GetComponent("Animator")
|
||||
ani.enabled = true
|
||||
local rtGoMark = goMark:GetComponent("RectTransform")
|
||||
rtGoMark.anchoredPosition = Vector2(nLength, nY)
|
||||
self.mapMark[tbTypeTime[i]] = goMark
|
||||
self.mapWarnTime[tbTypeTime[i] - 5] = goMark
|
||||
end
|
||||
end
|
||||
function VampireSurvivorRoomInfo:OnEvent_Boss_Spawn()
|
||||
self._mapNode.rtProgress:SetActive(false)
|
||||
self.bStop = true
|
||||
end
|
||||
function VampireSurvivorRoomInfo:OnEvent_ExpChange(nExp, nAllExp, nLevel, bMaxLevel)
|
||||
if bMaxLevel then
|
||||
self._mapNode.rtFillMaskLevelBar.sizeDelta = Vector2(nLevelBarLength, nLevelBarHeight)
|
||||
else
|
||||
self._mapNode.rtFillMaskLevelBar.sizeDelta = Vector2(nLevelBarLength * (nExp / nAllExp), nLevelBarHeight)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTeamLevel, nLevel)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgLevelBarAdd, Color(1, 1, 1, 0))
|
||||
end
|
||||
function VampireSurvivorRoomInfo:OnEvent_InputEnable(bEnable)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, bEnable and 1 or 0)
|
||||
end
|
||||
return VampireSurvivorRoomInfo
|
||||
@@ -0,0 +1,21 @@
|
||||
local VampireSurvivorSettlelPanel = class("VampireSurvivorSettlelPanel", BasePanel)
|
||||
VampireSurvivorSettlelPanel._bAddToBackHistory = false
|
||||
VampireSurvivorSettlelPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "VampireBattle/VampireSettle.prefab",
|
||||
sCtrlName = "Game.UI.VampireSurvivor.VampireSettleCtrl"
|
||||
}
|
||||
}
|
||||
function VampireSurvivorSettlelPanel:Awake()
|
||||
end
|
||||
function VampireSurvivorSettlelPanel:OnEnable()
|
||||
end
|
||||
function VampireSurvivorSettlelPanel:OnAfterEnter()
|
||||
end
|
||||
function VampireSurvivorSettlelPanel:OnDisable()
|
||||
end
|
||||
function VampireSurvivorSettlelPanel:OnDestroy()
|
||||
end
|
||||
function VampireSurvivorSettlelPanel:OnRelease()
|
||||
end
|
||||
return VampireSurvivorSettlelPanel
|
||||
@@ -0,0 +1,58 @@
|
||||
local VampireSurvivorTimeCtrl = class("VamireSurvivorTimeCtrl", BaseCtrl)
|
||||
VampireSurvivorTimeCtrl._mapNodeConfig = {
|
||||
rtnfo = {},
|
||||
rtChallengeTime = {},
|
||||
TMPChallengeTime = {sComponentName = "TMP_Text"},
|
||||
cgRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "CanvasGroup"
|
||||
}
|
||||
}
|
||||
VampireSurvivorTimeCtrl._mapEventConfig = {
|
||||
VampireSurvivor_Time = "SetTime",
|
||||
Vampire_Level_Times = "OnEvent_SetLevelProgress",
|
||||
Vampire_Boss_Spawn = "OnEvent_Boss_Spawn",
|
||||
VampireBattleEnd = "OnEvent_LevelEnd",
|
||||
InputEnable = "OnEvent_InputEnable"
|
||||
}
|
||||
function VampireSurvivorTimeCtrl:Awake()
|
||||
self._mapNode.rtnfo:SetActive(false)
|
||||
self._mapNode.rtChallengeTime:SetActive(false)
|
||||
self.bStart = false
|
||||
self.nTotlaTime = 0
|
||||
self:SetTime(0)
|
||||
end
|
||||
function VampireSurvivorTimeCtrl:SetTime(nTime)
|
||||
if not self.bStart then
|
||||
return
|
||||
end
|
||||
local nSubTime = self.nTotlaTime - nTime
|
||||
local nMin = math.floor(nSubTime / 60)
|
||||
local nSec = math.fmod(nSubTime, 60)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPChallengeTime, string.format("%02d:%02d", nMin, nSec))
|
||||
end
|
||||
function VampireSurvivorTimeCtrl:OnEvent_SetLevelProgress(nTime)
|
||||
self._mapNode.rtChallengeTime:SetActive(false)
|
||||
self.bStart = false
|
||||
self.nTotlaTime = nTime
|
||||
end
|
||||
function VampireSurvivorTimeCtrl:OnEvent_Boss_Spawn()
|
||||
local waitTime = function()
|
||||
self._mapNode.rtChallengeTime:SetActive(true)
|
||||
end
|
||||
self.warningTimer = self:AddTimer(0, 4, waitTime, true, true, true)
|
||||
self.bStart = true
|
||||
end
|
||||
function VampireSurvivorTimeCtrl:OnEvent_LevelEnd()
|
||||
if self.warningTimer ~= nil then
|
||||
self.warningTimer:Cancel()
|
||||
self.warningTimer = nil
|
||||
end
|
||||
self._mapNode.rtChallengeTime:SetActive(false)
|
||||
self.bStart = false
|
||||
end
|
||||
function VampireSurvivorTimeCtrl:OnEvent_InputEnable(bEnable)
|
||||
print("VampireSurvivorTimeCtrl:OnEvent_InputEnable:" .. tostring(bEnable))
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cgRoot, bEnable == true and 1 or 0)
|
||||
end
|
||||
return VampireSurvivorTimeCtrl
|
||||
Reference in New Issue
Block a user