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,269 @@
|
||||
local GachaCoverCtrl_CharUp = class("GachaCoverCtrl_CharUp", BaseCtrl)
|
||||
GachaCoverCtrl_CharUp._mapNodeConfig = {
|
||||
root = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
imgTimeBg = {},
|
||||
imgFirstTenShowBg = {},
|
||||
Guarantee = {},
|
||||
GuaranteeGet = {},
|
||||
imgGuaranteeHeadShow = {},
|
||||
imgGuaranteeHeadMask = {},
|
||||
imgGuaranteeBg = {},
|
||||
TMPCountDown = {sComponentName = "TMP_Text"},
|
||||
TMPRemianCount = {sComponentName = "TMP_Text"},
|
||||
TMPFirstTenTip = {sComponentName = "TMP_Text"},
|
||||
TMPGuaranteeRemianCount = {sComponentName = "TMP_Text"},
|
||||
TMPGuaranteeRemainTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GachaCover_GuaranteeRemainTip"
|
||||
},
|
||||
TMPGuaranteeGetTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GachaCover_GuaranteeGetTip"
|
||||
},
|
||||
TMPGuaranteeGetOver = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GachaCover_GuaranteeGetOverTip"
|
||||
},
|
||||
btnCharIcon = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ShowCharUpSubDetail"
|
||||
},
|
||||
itemChar = {
|
||||
nCount = 2,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
btnUpCharDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ShowCharUpMainDetail"
|
||||
},
|
||||
btnGuaranteeCanGet = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GuaranteeGet"
|
||||
},
|
||||
imgGuaranteeCharHead = {sComponentName = "Image"}
|
||||
}
|
||||
GachaCoverCtrl_CharUp._mapEventConfig = {}
|
||||
function GachaCoverCtrl_CharUp:Awake()
|
||||
end
|
||||
function GachaCoverCtrl_CharUp:FadeIn()
|
||||
end
|
||||
function GachaCoverCtrl_CharUp:FadeOut()
|
||||
end
|
||||
function GachaCoverCtrl_CharUp:OnEnable()
|
||||
local btnDetail1, btnDetail2, btnDetail3, btnDetail4
|
||||
local function func_MarkAllNode(trRoot)
|
||||
local nChildCount = trRoot.childCount - 1
|
||||
for i = 0, nChildCount do
|
||||
local trChild = trRoot:GetChild(i)
|
||||
if trChild.name == "btnDetail1" then
|
||||
btnDetail1 = trChild
|
||||
end
|
||||
if trChild.name == "btnDetail2" then
|
||||
btnDetail2 = trChild
|
||||
end
|
||||
if trChild.name == "btnDetail3" then
|
||||
btnDetail3 = trChild
|
||||
end
|
||||
if trChild.name == "btnDetail4" then
|
||||
btnDetail4 = trChild
|
||||
end
|
||||
if trChild.childCount > 0 then
|
||||
func_MarkAllNode(trChild)
|
||||
end
|
||||
end
|
||||
end
|
||||
func_MarkAllNode(self._mapNode.root)
|
||||
local callback1 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 1)
|
||||
end
|
||||
local callback2 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 2)
|
||||
end
|
||||
local callback3 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 3)
|
||||
end
|
||||
local callback4 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 4)
|
||||
end
|
||||
if btnDetail1 ~= nil then
|
||||
local btn = btnDetail1:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback1)
|
||||
end
|
||||
end
|
||||
if btnDetail2 ~= nil then
|
||||
local btn = btnDetail2:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback2)
|
||||
end
|
||||
end
|
||||
if btnDetail3 ~= nil then
|
||||
local btn = btnDetail3:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback3)
|
||||
end
|
||||
end
|
||||
if btnDetail4 ~= nil then
|
||||
local btn = btnDetail4:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback4)
|
||||
end
|
||||
end
|
||||
self.tbMainCharId = {}
|
||||
self.tbSubCharId = {}
|
||||
end
|
||||
function GachaCoverCtrl_CharUp:OnDisable()
|
||||
end
|
||||
function GachaCoverCtrl_CharUp:OnDestroy()
|
||||
end
|
||||
function GachaCoverCtrl_CharUp:OnRelease()
|
||||
end
|
||||
function GachaCoverCtrl_CharUp:PlayInAnim()
|
||||
local anim = self.gameObject.transform:GetComponent("Animator")
|
||||
anim:SetTrigger("tIn")
|
||||
end
|
||||
function GachaCoverCtrl_CharUp:SetCover(nId)
|
||||
self.nId = nId
|
||||
local nAupMissing = PlayerData.Gacha:GetAupMissTimesById(nId)
|
||||
local bFirstTenReward = PlayerData.Gacha:GetRecvFirstTenReward(nId)
|
||||
local mapGachaData = ConfigTable.GetData("Gacha", nId)
|
||||
if mapGachaData ~= nil then
|
||||
local nStorage = mapGachaData.StorageId
|
||||
local mapStorage = ConfigTable.GetData("GachaStorage", nStorage)
|
||||
local nRewardCount = 0
|
||||
if mapStorage ~= nil then
|
||||
local nMaxMissing = mapStorage.AUpGuaranteeTimes
|
||||
local nSum = nMaxMissing - nAupMissing
|
||||
local text = orderedFormat(ConfigTable.GetUIText("GachaCover_RemainCount"), nSum)
|
||||
local mapReward = decodeJson(mapStorage.GiveItems)
|
||||
if mapReward ~= nil then
|
||||
for _, nCount in pairs(mapReward) do
|
||||
nRewardCount = tonumber(nCount) or 0
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPRemianCount, text)
|
||||
end
|
||||
if bFirstTenReward then
|
||||
self._mapNode.imgFirstTenShowBg:SetActive(true)
|
||||
local text = orderedFormat(ConfigTable.GetUIText("GachaCover_OneRewardTip"), nRewardCount)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPFirstTenTip, text)
|
||||
else
|
||||
self._mapNode.imgFirstTenShowBg:SetActive(true)
|
||||
local text = orderedFormat(ConfigTable.GetUIText("GachaCover_FirstTenTip"), nRewardCount * 10 * mapGachaData.FirstTenShow, mapGachaData.FirstTenShow)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPFirstTenTip, text)
|
||||
end
|
||||
self:RefreshGuaranteeReward()
|
||||
local sTimeStr = mapGachaData.EndTime
|
||||
if sTimeStr ~= "" then
|
||||
self._mapNode.imgTimeBg:SetActive(true)
|
||||
local nEndTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(sTimeStr)
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local remainTime = nEndTime - curTime
|
||||
if 86400 <= remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Energy_LeftTime_Day"), day, hour)
|
||||
elseif 3600 <= remainTime then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Energy_LeftTime_Hour"), hour, min)
|
||||
else
|
||||
sTimeStr = ConfigTable.GetUIText("Energy_LeftTime_LessThenHour")
|
||||
end
|
||||
local text = orderedFormat(ConfigTable.GetUIText("GachaCover_TimeCountDown"), sTimeStr)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPCountDown, text)
|
||||
else
|
||||
self._mapNode.imgTimeBg:SetActive(false)
|
||||
end
|
||||
local mapPkgData = ConfigTable.Get("GachaPkg")
|
||||
if mapPkgData ~= nil then
|
||||
ForEachTableLine(mapPkgData, function(mapData)
|
||||
if mapData.PkgId == mapGachaData.ATypeUpPkg then
|
||||
table.insert(self.tbMainCharId, mapData.GoodsId)
|
||||
elseif mapData.PkgId == mapGachaData.BTypeUpPkg then
|
||||
table.insert(self.tbSubCharId, mapData.GoodsId)
|
||||
end
|
||||
end)
|
||||
end
|
||||
for i = 1, 2 do
|
||||
self._mapNode.itemChar[i]:SetItem(self.tbSubCharId[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
function GachaCoverCtrl_CharUp:EnableCover()
|
||||
end
|
||||
function GachaCoverCtrl_CharUp:DisableCover()
|
||||
end
|
||||
function GachaCoverCtrl_CharUp:RefreshGuaranteeReward()
|
||||
self._mapNode.imgGuaranteeBg:SetActive(false)
|
||||
self._mapNode.Guarantee:SetActive(false)
|
||||
self._mapNode.GuaranteeGet:SetActive(false)
|
||||
self._mapNode.imgGuaranteeHeadShow:SetActive(false)
|
||||
self._mapNode.imgGuaranteeHeadMask:SetActive(false)
|
||||
self._mapNode.btnGuaranteeCanGet.gameObject:SetActive(false)
|
||||
local bGuaranteeReward = PlayerData.Gacha:GetRecvGuaranteeReward(self.nId)
|
||||
local nGachaTotalTimes = PlayerData.Gacha:GetGachaTotalTimes(self.nId)
|
||||
local mapGachaData = ConfigTable.GetData("Gacha", self.nId)
|
||||
if mapGachaData == nil or mapGachaData.GuaranteeTid == 0 then
|
||||
return
|
||||
end
|
||||
local mapCfg = ConfigTable.GetData_Item(mapGachaData.GuaranteeTid)
|
||||
if mapCfg == nil then
|
||||
return
|
||||
end
|
||||
if mapCfg.Type == GameEnum.itemType.Disc then
|
||||
self:SetPngSprite(self._mapNode.imgGuaranteeCharHead, mapCfg.Icon .. AllEnum.OutfitIconSurfix.Item)
|
||||
elseif mapCfg.Type == GameEnum.itemType.Char then
|
||||
local mapCfgData_Char = ConfigTable.GetData_Character(mapGachaData.GuaranteeTid)
|
||||
local mapCfgData_Skin = ConfigTable.GetData_CharacterSkin(mapCfgData_Char.DefaultSkinId)
|
||||
self:SetPngSprite(self._mapNode.imgGuaranteeCharHead, mapCfgData_Skin.Icon .. AllEnum.CharHeadIconSurfix.S)
|
||||
elseif mapCfg.Type == GameEnum.itemType.CharacterSkin then
|
||||
local mapCfgData_Skin = ConfigTable.GetData_CharacterSkin(mapGachaData.GuaranteeTid)
|
||||
self:SetPngSprite(self._mapNode.imgGuaranteeCharHead, mapCfgData_Skin.Icon .. AllEnum.CharHeadIconSurfix.S)
|
||||
end
|
||||
self._mapNode.imgGuaranteeBg:SetActive(true)
|
||||
if bGuaranteeReward then
|
||||
self._mapNode.GuaranteeGet:SetActive(true)
|
||||
self._mapNode.imgGuaranteeHeadMask:SetActive(true)
|
||||
elseif nGachaTotalTimes >= mapGachaData.GuaranteeTimes then
|
||||
self._mapNode.btnGuaranteeCanGet.gameObject:SetActive(true)
|
||||
self._mapNode.imgGuaranteeHeadShow:SetActive(true)
|
||||
else
|
||||
self._mapNode.Guarantee:SetActive(true)
|
||||
local text = orderedFormat(ConfigTable.GetUIText("GachaCover_GuaranteeRemainCount"), mapGachaData.GuaranteeTimes - nGachaTotalTimes)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPGuaranteeRemianCount, text)
|
||||
end
|
||||
end
|
||||
function GachaCoverCtrl_CharUp:OnBtnClick_ShowCharUpMainDetail()
|
||||
if #self.tbMainCharId < 1 then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgTrialPanel, PanelId.CharInfoTrial, self.tbMainCharId[1], self.tbMainCharId, true)
|
||||
end
|
||||
function GachaCoverCtrl_CharUp:OnBtnClick_ShowCharUpSubDetail(btn, nIdx)
|
||||
if self.tbSubCharId[nIdx] == nil then
|
||||
return
|
||||
end
|
||||
local nDetailCharId = self.tbSubCharId[nIdx]
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgTrialPanel, PanelId.CharInfoTrial, nDetailCharId)
|
||||
end
|
||||
function GachaCoverCtrl_CharUp:OnBtnClick_GuaranteeGet()
|
||||
local GachaCallback = function(mapData)
|
||||
self:RefreshGuaranteeReward()
|
||||
UTILS.OpenReceiveByChangeInfo(mapData)
|
||||
end
|
||||
PlayerData.Gacha:SendGachaGuaranteeRewardReq(self.nId, GachaCallback)
|
||||
end
|
||||
return GachaCoverCtrl_CharUp
|
||||
@@ -0,0 +1,196 @@
|
||||
local GachaCoverCtrl_DiscUp = class("GachaCoverCtrl_DiscUp", BaseCtrl)
|
||||
GachaCoverCtrl_DiscUp._mapNodeConfig = {
|
||||
root = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
imgTimeBg = {},
|
||||
TMPCountDown = {sComponentName = "TMP_Text"},
|
||||
TMPRemianCount = {sComponentName = "TMP_Text"},
|
||||
btnUpDiscDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ShowDiscUpMainDetail"
|
||||
},
|
||||
imgOutfit = {sComponentName = "Image", nCount = 3}
|
||||
}
|
||||
GachaCoverCtrl_DiscUp._mapEventConfig = {}
|
||||
function GachaCoverCtrl_DiscUp:Awake()
|
||||
end
|
||||
function GachaCoverCtrl_DiscUp:FadeIn()
|
||||
end
|
||||
function GachaCoverCtrl_DiscUp:FadeOut()
|
||||
end
|
||||
function GachaCoverCtrl_DiscUp:OnEnable()
|
||||
local btnDetail1, btnDetail2, btnDetail3, btnDetail4
|
||||
local function func_MarkAllNode(trRoot)
|
||||
local nChildCount = trRoot.childCount - 1
|
||||
for i = 0, nChildCount do
|
||||
local trChild = trRoot:GetChild(i)
|
||||
if trChild.name == "btnDetail1" then
|
||||
btnDetail1 = trChild
|
||||
end
|
||||
if trChild.name == "btnDetail2" then
|
||||
btnDetail2 = trChild
|
||||
end
|
||||
if trChild.name == "btnDetail3" then
|
||||
btnDetail3 = trChild
|
||||
end
|
||||
if trChild.name == "btnDetail4" then
|
||||
btnDetail4 = trChild
|
||||
end
|
||||
if trChild.childCount > 0 then
|
||||
func_MarkAllNode(trChild)
|
||||
end
|
||||
end
|
||||
end
|
||||
func_MarkAllNode(self._mapNode.root)
|
||||
local callback1 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 1)
|
||||
end
|
||||
local callback2 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 2)
|
||||
end
|
||||
local callback3 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 3)
|
||||
end
|
||||
local callback4 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 4)
|
||||
end
|
||||
if btnDetail1 ~= nil then
|
||||
local btn = btnDetail1:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback1)
|
||||
end
|
||||
end
|
||||
if btnDetail2 ~= nil then
|
||||
local btn = btnDetail2:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback2)
|
||||
end
|
||||
end
|
||||
if btnDetail3 ~= nil then
|
||||
local btn = btnDetail3:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback3)
|
||||
end
|
||||
end
|
||||
if btnDetail4 ~= nil then
|
||||
local btn = btnDetail4:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback4)
|
||||
end
|
||||
end
|
||||
self.tbMainDiscId = {}
|
||||
self.tbSubDiscId = {}
|
||||
end
|
||||
function GachaCoverCtrl_DiscUp:OnDisable()
|
||||
end
|
||||
function GachaCoverCtrl_DiscUp:OnDestroy()
|
||||
end
|
||||
function GachaCoverCtrl_DiscUp:OnRelease()
|
||||
end
|
||||
function GachaCoverCtrl_DiscUp:PlayInAnim()
|
||||
local anim = self.gameObject.transform:GetComponent("Animator")
|
||||
anim:SetTrigger("tIn")
|
||||
end
|
||||
function GachaCoverCtrl_DiscUp:SetCover(nId)
|
||||
local nAupMissing = PlayerData.Gacha:GetAupMissTimesById(nId)
|
||||
local mapGachaData = ConfigTable.GetData("Gacha", nId)
|
||||
if mapGachaData ~= nil then
|
||||
local nStorage = mapGachaData.StorageId
|
||||
local mapStorage = ConfigTable.GetData("GachaStorage", nStorage)
|
||||
if mapStorage ~= nil then
|
||||
local nMaxMissing = mapStorage.AUpGuaranteeTimes
|
||||
local nSum = nMaxMissing - nAupMissing
|
||||
local text = orderedFormat(ConfigTable.GetUIText("GachaCover_DiscRemainCount"), nSum)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPRemianCount, text)
|
||||
end
|
||||
local sTimeStr = mapGachaData.EndTime
|
||||
if sTimeStr ~= "" then
|
||||
self._mapNode.imgTimeBg:SetActive(true)
|
||||
local nEndTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(sTimeStr)
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local remainTime = nEndTime - curTime
|
||||
if 86400 <= remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Energy_LeftTime_Day"), day, hour)
|
||||
elseif 3600 <= remainTime then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Energy_LeftTime_Hour"), hour, min)
|
||||
else
|
||||
sTimeStr = ConfigTable.GetUIText("Energy_LeftTime_LessThenHour")
|
||||
end
|
||||
local text = orderedFormat(ConfigTable.GetUIText("GachaCover_TimeCountDown"), sTimeStr)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPCountDown, text)
|
||||
else
|
||||
self._mapNode.imgTimeBg:SetActive(false)
|
||||
end
|
||||
local mapPkgData = ConfigTable.Get("GachaPkg")
|
||||
if mapPkgData ~= nil then
|
||||
ForEachTableLine(mapPkgData, function(mapData)
|
||||
if mapData.PkgId == mapGachaData.ATypeUpPkg then
|
||||
table.insert(self.tbMainDiscId, mapData.GoodsId)
|
||||
elseif mapData.PkgId == mapGachaData.BTypeUpPkg then
|
||||
table.insert(self.tbSubDiscId, mapData.GoodsId)
|
||||
end
|
||||
end)
|
||||
end
|
||||
if self.tbMainDiscId[1] ~= nil then
|
||||
local cfgDataItem = ConfigTable.GetData_Item(self.tbMainDiscId[1])
|
||||
local cfgDataDisc = ConfigTable.GetData("Disc", self.tbMainDiscId[1])
|
||||
if cfgDataItem ~= nil and cfgDataDisc ~= nil then
|
||||
self:SetPngSprite(self._mapNode.imgOutfit[2], cfgDataItem.Icon .. AllEnum.OutfitIconSurfix.Item)
|
||||
local imgProperty = self._mapNode.imgOutfit[2].transform:Find("imgProperty"):GetComponent("Image")
|
||||
local sName = AllEnum.ElementIconType.Icon .. cfgDataDisc.EET
|
||||
self:SetAtlasSprite(imgProperty, "12_rare", sName)
|
||||
local imgStar = self._mapNode.imgOutfit[2].transform:Find("imgRare"):GetComponent("Image")
|
||||
self:SetSprite_FrameColor(imgStar, 1, AllEnum.FrameType_New.Text)
|
||||
end
|
||||
end
|
||||
if self.tbSubDiscId[1] ~= nil then
|
||||
local cfgDataItem = ConfigTable.GetData_Item(self.tbSubDiscId[1])
|
||||
local cfgDataDisc = ConfigTable.GetData("Disc", self.tbSubDiscId[1])
|
||||
if cfgDataItem ~= nil and cfgDataDisc ~= nil then
|
||||
self:SetPngSprite(self._mapNode.imgOutfit[1], cfgDataItem.Icon .. AllEnum.OutfitIconSurfix.Item)
|
||||
local imgProperty = self._mapNode.imgOutfit[1].transform:Find("imgProperty"):GetComponent("Image")
|
||||
local sName = AllEnum.ElementIconType.Icon .. cfgDataDisc.EET
|
||||
self:SetAtlasSprite(imgProperty, "12_rare", sName)
|
||||
local imgStar = self._mapNode.imgOutfit[1].transform:Find("imgRare"):GetComponent("Image")
|
||||
self:SetSprite_FrameColor(imgStar, 2, AllEnum.FrameType_New.Text)
|
||||
end
|
||||
end
|
||||
if self.tbSubDiscId[2] ~= nil then
|
||||
local cfgDataItem = ConfigTable.GetData_Item(self.tbSubDiscId[2])
|
||||
local cfgDataDisc = ConfigTable.GetData("Disc", self.tbSubDiscId[2])
|
||||
if cfgDataItem ~= nil and cfgDataDisc ~= nil then
|
||||
self:SetPngSprite(self._mapNode.imgOutfit[3], cfgDataItem.Icon .. AllEnum.OutfitIconSurfix.Item)
|
||||
local imgProperty = self._mapNode.imgOutfit[3].transform:Find("imgProperty"):GetComponent("Image")
|
||||
local sName = AllEnum.ElementIconType.Icon .. cfgDataDisc.EET
|
||||
self:SetAtlasSprite(imgProperty, "12_rare", sName)
|
||||
local imgStar = self._mapNode.imgOutfit[3].transform:Find("imgRare"):GetComponent("Image")
|
||||
self:SetSprite_FrameColor(imgStar, 2, AllEnum.FrameType_New.Text)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function GachaCoverCtrl_DiscUp:EnableCover()
|
||||
end
|
||||
function GachaCoverCtrl_DiscUp:DisableCover()
|
||||
end
|
||||
function GachaCoverCtrl_DiscUp:OnBtnClick_ShowDiscUpMainDetail()
|
||||
if #self.tbMainDiscId < 1 then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSample, self.tbMainDiscId[1])
|
||||
end
|
||||
return GachaCoverCtrl_DiscUp
|
||||
@@ -0,0 +1,113 @@
|
||||
local GachaCoverCtrl_NewBie = class("GachaCoverCtrl_NewBie", BaseCtrl)
|
||||
GachaCoverCtrl_NewBie._mapNodeConfig = {
|
||||
root = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
imgRateUpPanel = {},
|
||||
TMPSummonText = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_NewBieSummonNum"
|
||||
},
|
||||
TMPSummonTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_NewBieSummonTip"
|
||||
}
|
||||
}
|
||||
GachaCoverCtrl_NewBie._mapEventConfig = {}
|
||||
function GachaCoverCtrl_NewBie:Awake()
|
||||
end
|
||||
function GachaCoverCtrl_NewBie:FadeIn()
|
||||
end
|
||||
function GachaCoverCtrl_NewBie:FadeOut()
|
||||
end
|
||||
function GachaCoverCtrl_NewBie:OnEnable()
|
||||
local btnDetail1, btnDetail2, btnDetail3, btnDetail4
|
||||
local function func_MarkAllNode(trRoot)
|
||||
local nChildCount = trRoot.childCount - 1
|
||||
for i = 0, nChildCount do
|
||||
local trChild = trRoot:GetChild(i)
|
||||
if trChild.name == "btnDetail1" then
|
||||
btnDetail1 = trChild
|
||||
end
|
||||
if trChild.name == "btnDetail2" then
|
||||
btnDetail2 = trChild
|
||||
end
|
||||
if trChild.name == "btnDetail3" then
|
||||
btnDetail3 = trChild
|
||||
end
|
||||
if trChild.name == "btnDetail4" then
|
||||
btnDetail4 = trChild
|
||||
end
|
||||
if trChild.childCount > 0 then
|
||||
func_MarkAllNode(trChild)
|
||||
end
|
||||
end
|
||||
end
|
||||
func_MarkAllNode(self._mapNode.root)
|
||||
local callback1 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 1)
|
||||
end
|
||||
local callback2 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 2)
|
||||
end
|
||||
local callback3 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 3)
|
||||
end
|
||||
local callback4 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 4)
|
||||
end
|
||||
if btnDetail1 ~= nil then
|
||||
local btn = btnDetail1:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback1)
|
||||
end
|
||||
end
|
||||
if btnDetail2 ~= nil then
|
||||
local btn = btnDetail2:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback2)
|
||||
end
|
||||
end
|
||||
if btnDetail3 ~= nil then
|
||||
local btn = btnDetail3:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback3)
|
||||
end
|
||||
end
|
||||
if btnDetail4 ~= nil then
|
||||
local btn = btnDetail4:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback4)
|
||||
end
|
||||
end
|
||||
end
|
||||
function GachaCoverCtrl_NewBie:OnDisable()
|
||||
end
|
||||
function GachaCoverCtrl_NewBie:OnDestroy()
|
||||
end
|
||||
function GachaCoverCtrl_NewBie:OnRelease()
|
||||
end
|
||||
function GachaCoverCtrl_NewBie:PlayInAnim()
|
||||
local anim = self.gameObject.transform:GetComponent("Animator")
|
||||
anim:SetTrigger("tIn")
|
||||
end
|
||||
function GachaCoverCtrl_NewBie:SetCover(nId)
|
||||
local newbie = ConfigTable.GetData("GachaNewbie", nId)
|
||||
if newbie == nil then
|
||||
return
|
||||
end
|
||||
local newbieData = PlayerData.Gacha:GetGachaNewbieData(nId)
|
||||
if newbieData == nil then
|
||||
return
|
||||
end
|
||||
local nTotalCount = newbie.SpinCount
|
||||
local remainCount = nTotalCount - newbieData.Times
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPSummonText, orderedFormat(ConfigTable.GetUIText("Gacha_NewBieSummonNum"), remainCount))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPSummonTip, orderedFormat(ConfigTable.GetUIText("Gacha_NewBieSummonTip"), nTotalCount, 1))
|
||||
end
|
||||
function GachaCoverCtrl_NewBie:EnableCover()
|
||||
end
|
||||
function GachaCoverCtrl_NewBie:DisableCover()
|
||||
end
|
||||
return GachaCoverCtrl_NewBie
|
||||
@@ -0,0 +1,101 @@
|
||||
local GachaCoverCtrl_PermanentCharUp = class("GachaCoverCtrl_PermanentCharUp", BaseCtrl)
|
||||
GachaCoverCtrl_PermanentCharUp._mapNodeConfig = {
|
||||
root = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
TMPRemianCount = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
GachaCoverCtrl_PermanentCharUp._mapEventConfig = {}
|
||||
function GachaCoverCtrl_PermanentCharUp:Awake()
|
||||
end
|
||||
function GachaCoverCtrl_PermanentCharUp:FadeIn()
|
||||
end
|
||||
function GachaCoverCtrl_PermanentCharUp:FadeOut()
|
||||
end
|
||||
function GachaCoverCtrl_PermanentCharUp:OnEnable()
|
||||
local btnDetail1, btnDetail2, btnDetail3, btnDetail4
|
||||
local function func_MarkAllNode(trRoot)
|
||||
local nChildCount = trRoot.childCount - 1
|
||||
for i = 0, nChildCount do
|
||||
local trChild = trRoot:GetChild(i)
|
||||
if trChild.name == "btnDetail1" then
|
||||
btnDetail1 = trChild
|
||||
end
|
||||
if trChild.name == "btnDetail2" then
|
||||
btnDetail2 = trChild
|
||||
end
|
||||
if trChild.name == "btnDetail3" then
|
||||
btnDetail3 = trChild
|
||||
end
|
||||
if trChild.name == "btnDetail4" then
|
||||
btnDetail4 = trChild
|
||||
end
|
||||
if trChild.childCount > 0 then
|
||||
func_MarkAllNode(trChild)
|
||||
end
|
||||
end
|
||||
end
|
||||
func_MarkAllNode(self._mapNode.root)
|
||||
local callback1 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 1)
|
||||
end
|
||||
local callback2 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 2)
|
||||
end
|
||||
local callback3 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 3)
|
||||
end
|
||||
local callback4 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 4)
|
||||
end
|
||||
if btnDetail1 ~= nil then
|
||||
local btn = btnDetail1:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback1)
|
||||
end
|
||||
end
|
||||
if btnDetail2 ~= nil then
|
||||
local btn = btnDetail2:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback2)
|
||||
end
|
||||
end
|
||||
if btnDetail3 ~= nil then
|
||||
local btn = btnDetail3:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback3)
|
||||
end
|
||||
end
|
||||
if btnDetail4 ~= nil then
|
||||
local btn = btnDetail4:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback4)
|
||||
end
|
||||
end
|
||||
end
|
||||
function GachaCoverCtrl_PermanentCharUp:OnDisable()
|
||||
end
|
||||
function GachaCoverCtrl_PermanentCharUp:OnDestroy()
|
||||
end
|
||||
function GachaCoverCtrl_PermanentCharUp:OnRelease()
|
||||
end
|
||||
function GachaCoverCtrl_PermanentCharUp:PlayInAnim()
|
||||
local anim = self.gameObject.transform:GetComponent("Animator")
|
||||
anim:SetTrigger("tIn")
|
||||
end
|
||||
function GachaCoverCtrl_PermanentCharUp:SetCover(nId)
|
||||
local nAupMissing = PlayerData.Gacha:GetAMissTimesById(nId)
|
||||
local mapGachaData = ConfigTable.GetData("Gacha", nId)
|
||||
if mapGachaData ~= nil then
|
||||
local nMaxMissing = mapGachaData.ATypeGuaranteeTimes
|
||||
local nSum = nMaxMissing - nAupMissing
|
||||
local text = orderedFormat(ConfigTable.GetUIText("GachaCover_Guarantee_Char"), nSum)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPRemianCount, text)
|
||||
end
|
||||
end
|
||||
function GachaCoverCtrl_PermanentCharUp:EnableCover()
|
||||
end
|
||||
function GachaCoverCtrl_PermanentCharUp:DisableCover()
|
||||
end
|
||||
return GachaCoverCtrl_PermanentCharUp
|
||||
@@ -0,0 +1,101 @@
|
||||
local GachaCoverCtrl_PermanentDiscUp = class("GachaCoverCtrl_PermanentDiscUp", BaseCtrl)
|
||||
GachaCoverCtrl_PermanentDiscUp._mapNodeConfig = {
|
||||
root = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
TMPRemianCount = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
GachaCoverCtrl_PermanentDiscUp._mapEventConfig = {}
|
||||
function GachaCoverCtrl_PermanentDiscUp:Awake()
|
||||
end
|
||||
function GachaCoverCtrl_PermanentDiscUp:FadeIn()
|
||||
end
|
||||
function GachaCoverCtrl_PermanentDiscUp:FadeOut()
|
||||
end
|
||||
function GachaCoverCtrl_PermanentDiscUp:OnEnable()
|
||||
local btnDetail1, btnDetail2, btnDetail3, btnDetail4
|
||||
local function func_MarkAllNode(trRoot)
|
||||
local nChildCount = trRoot.childCount - 1
|
||||
for i = 0, nChildCount do
|
||||
local trChild = trRoot:GetChild(i)
|
||||
if trChild.name == "btnDetail1" then
|
||||
btnDetail1 = trChild
|
||||
end
|
||||
if trChild.name == "btnDetail2" then
|
||||
btnDetail2 = trChild
|
||||
end
|
||||
if trChild.name == "btnDetail3" then
|
||||
btnDetail3 = trChild
|
||||
end
|
||||
if trChild.name == "btnDetail4" then
|
||||
btnDetail4 = trChild
|
||||
end
|
||||
if trChild.childCount > 0 then
|
||||
func_MarkAllNode(trChild)
|
||||
end
|
||||
end
|
||||
end
|
||||
func_MarkAllNode(self._mapNode.root)
|
||||
local callback1 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 1)
|
||||
end
|
||||
local callback2 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 2)
|
||||
end
|
||||
local callback3 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 3)
|
||||
end
|
||||
local callback4 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 4)
|
||||
end
|
||||
if btnDetail1 ~= nil then
|
||||
local btn = btnDetail1:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback1)
|
||||
end
|
||||
end
|
||||
if btnDetail2 ~= nil then
|
||||
local btn = btnDetail2:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback2)
|
||||
end
|
||||
end
|
||||
if btnDetail3 ~= nil then
|
||||
local btn = btnDetail3:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback3)
|
||||
end
|
||||
end
|
||||
if btnDetail4 ~= nil then
|
||||
local btn = btnDetail4:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback4)
|
||||
end
|
||||
end
|
||||
end
|
||||
function GachaCoverCtrl_PermanentDiscUp:OnDisable()
|
||||
end
|
||||
function GachaCoverCtrl_PermanentDiscUp:OnDestroy()
|
||||
end
|
||||
function GachaCoverCtrl_PermanentDiscUp:OnRelease()
|
||||
end
|
||||
function GachaCoverCtrl_PermanentDiscUp:PlayInAnim()
|
||||
local anim = self.gameObject.transform:GetComponent("Animator")
|
||||
anim:SetTrigger("tIn")
|
||||
end
|
||||
function GachaCoverCtrl_PermanentDiscUp:SetCover(nId)
|
||||
local nAupMissing = PlayerData.Gacha:GetAMissTimesById(nId)
|
||||
local mapGachaData = ConfigTable.GetData("Gacha", nId)
|
||||
if mapGachaData ~= nil then
|
||||
local nMaxMissing = mapGachaData.ATypeGuaranteeTimes
|
||||
local nSum = nMaxMissing - nAupMissing
|
||||
local text = orderedFormat(ConfigTable.GetUIText("GachaCover_Guarantee_Disc"), nSum)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPRemianCount, text)
|
||||
end
|
||||
end
|
||||
function GachaCoverCtrl_PermanentDiscUp:EnableCover()
|
||||
end
|
||||
function GachaCoverCtrl_PermanentDiscUp:DisableCover()
|
||||
end
|
||||
return GachaCoverCtrl_PermanentDiscUp
|
||||
@@ -0,0 +1,88 @@
|
||||
local GachaCoverCtrl = class("GachaCoverCtrl", BaseCtrl)
|
||||
GachaCoverCtrl._mapNodeConfig = {
|
||||
root = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Transform"
|
||||
}
|
||||
}
|
||||
GachaCoverCtrl._mapEventConfig = {}
|
||||
function GachaCoverCtrl:Awake()
|
||||
end
|
||||
function GachaCoverCtrl:FadeIn()
|
||||
end
|
||||
function GachaCoverCtrl:FadeOut()
|
||||
end
|
||||
function GachaCoverCtrl:OnEnable()
|
||||
local btnDetail1, btnDetail2, btnDetail3, btnDetail4
|
||||
local function func_MarkAllNode(trRoot)
|
||||
local nChildCount = trRoot.childCount - 1
|
||||
for i = 0, nChildCount do
|
||||
local trChild = trRoot:GetChild(i)
|
||||
if trChild.name == "btnDetail1" then
|
||||
btnDetail1 = trChild
|
||||
end
|
||||
if trChild.name == "btnDetail2" then
|
||||
btnDetail2 = trChild
|
||||
end
|
||||
if trChild.name == "btnDetail3" then
|
||||
btnDetail3 = trChild
|
||||
end
|
||||
if trChild.name == "btnDetail4" then
|
||||
btnDetail4 = trChild
|
||||
end
|
||||
if trChild.childCount > 0 then
|
||||
func_MarkAllNode(trChild)
|
||||
end
|
||||
end
|
||||
end
|
||||
func_MarkAllNode(self._mapNode.root)
|
||||
local callback1 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 1)
|
||||
end
|
||||
local callback2 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 2)
|
||||
end
|
||||
local callback3 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 3)
|
||||
end
|
||||
local callback4 = function()
|
||||
EventManager.Hit("GachaPoolDetail", 4)
|
||||
end
|
||||
if btnDetail1 ~= nil then
|
||||
local btn = btnDetail1:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback1)
|
||||
end
|
||||
end
|
||||
if btnDetail2 ~= nil then
|
||||
local btn = btnDetail2:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback2)
|
||||
end
|
||||
end
|
||||
if btnDetail3 ~= nil then
|
||||
local btn = btnDetail3:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback3)
|
||||
end
|
||||
end
|
||||
if btnDetail4 ~= nil then
|
||||
local btn = btnDetail4:GetComponent("UIButton")
|
||||
if btn ~= nil then
|
||||
btn.onClick:AddListener(callback4)
|
||||
end
|
||||
end
|
||||
end
|
||||
function GachaCoverCtrl:OnDisable()
|
||||
end
|
||||
function GachaCoverCtrl:OnDestroy()
|
||||
end
|
||||
function GachaCoverCtrl:OnRelease()
|
||||
end
|
||||
function GachaCoverCtrl:PlayInAnim()
|
||||
local anim = self.gameObject.transform:GetComponent("Animator")
|
||||
anim:SetTrigger("tIn")
|
||||
end
|
||||
function GachaCoverCtrl:SetCover(nId)
|
||||
end
|
||||
return GachaCoverCtrl
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,190 @@
|
||||
local GachaGuaranteeCtrl = class("GachaGuaranteeCtrl", BaseCtrl)
|
||||
GachaGuaranteeCtrl._mapNodeConfig = {
|
||||
GridSmallOutfit = {},
|
||||
GridSmall = {},
|
||||
TMPGuaranteeTitle = {sComponentName = "TMP_Text"},
|
||||
TMPGuarantee = {sComponentName = "TMP_Text"},
|
||||
TMPPoolDesc = {sComponentName = "TMP_Text"},
|
||||
rtGuaranteeItems = {sComponentName = "Transform"},
|
||||
Content = {}
|
||||
}
|
||||
GachaGuaranteeCtrl._mapEventConfig = {}
|
||||
GachaGuaranteeCtrl._mapRedDotConfig = {}
|
||||
function GachaGuaranteeCtrl:Awake()
|
||||
end
|
||||
function GachaGuaranteeCtrl:FadeIn()
|
||||
end
|
||||
function GachaGuaranteeCtrl:FadeOut()
|
||||
end
|
||||
function GachaGuaranteeCtrl:OnEnable()
|
||||
end
|
||||
function GachaGuaranteeCtrl:OnDisable()
|
||||
delChildren(self._mapNode.rtGuaranteeItems)
|
||||
end
|
||||
function GachaGuaranteeCtrl:OnDestroy()
|
||||
end
|
||||
function GachaGuaranteeCtrl:OnRelease()
|
||||
end
|
||||
function GachaGuaranteeCtrl:Refresh(nPoolId)
|
||||
local mapPoolCfgData = ConfigTable.GetData("Gacha", nPoolId)
|
||||
if mapPoolCfgData == nil then
|
||||
self._mapNode.Content:SetActive(false)
|
||||
return
|
||||
end
|
||||
local nStrogeId = mapPoolCfgData.StorageId
|
||||
local mapStorageTypeCfgData = ConfigTable.GetData("GachaType", nStrogeId)
|
||||
local mapStorageCfgData = ConfigTable.GetData("GachaStorage", nStrogeId)
|
||||
if mapStorageTypeCfgData == nil or mapStorageCfgData == nil then
|
||||
self._mapNode.Content:SetActive(false)
|
||||
return
|
||||
end
|
||||
local GetContent = function(nItmeId)
|
||||
local ret = ""
|
||||
local mapCfgData = ConfigTable.GetData_Item(nItmeId)
|
||||
if mapCfgData ~= nil then
|
||||
if mapCfgData.Type == GameEnum.itemType.Char then
|
||||
local mapCharCfg = ConfigTable.GetData_Character(nItmeId)
|
||||
if mapCharCfg ~= nil then
|
||||
ret = string.format("%s·%s", ConfigTable.GetUIText("T_Element_Attr_" .. mapCharCfg.EET), mapCharCfg.Name)
|
||||
end
|
||||
elseif mapCfgData.Type == GameEnum.itemType.Disc then
|
||||
local mapDiscCfg = ConfigTable.GetData("Disc", nItmeId)
|
||||
if mapDiscCfg ~= nil then
|
||||
ret = string.format("%s·%s", ConfigTable.GetUIText("T_Element_Attr_" .. mapDiscCfg.EET), mapCfgData.Title)
|
||||
end
|
||||
end
|
||||
end
|
||||
return ret
|
||||
end
|
||||
self._mapNode.Content:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPGuaranteeTitle, orderedFormat(mapStorageTypeCfgData.Desc9, mapPoolCfgData.Name))
|
||||
local tbSSRUpChar = {}
|
||||
local tbSSRUpOutfit = {}
|
||||
local tbSRUpChar = {}
|
||||
local tbSRUpOutfit = {}
|
||||
local tbSSRChar = {}
|
||||
local tbSSROutfit = {}
|
||||
local tbSRChar = {}
|
||||
local tbSROutfit = {}
|
||||
local tbROutfit = {}
|
||||
local tbUpItemList, tbItemList = PlayerData.Gacha:GetPoolProbDetail(nPoolId)
|
||||
for _, v in pairs(tbUpItemList) do
|
||||
local itemConfig = ConfigTable.GetData_Item(v.nGoodsId)
|
||||
if itemConfig.Type == GameEnum.itemType.Char then
|
||||
if itemConfig.Rarity == GameEnum.itemRarity.SSR then
|
||||
table.insert(tbSSRUpChar, v.nGoodsId)
|
||||
table.insert(tbSSRChar, v.nGoodsId)
|
||||
else
|
||||
table.insert(tbSRUpChar, v.nGoodsId)
|
||||
table.insert(tbSRChar, v.nGoodsId)
|
||||
end
|
||||
elseif itemConfig.Rarity == GameEnum.itemRarity.SSR then
|
||||
table.insert(tbSSRUpOutfit, v.nGoodsId)
|
||||
table.insert(tbSSROutfit, v.nGoodsId)
|
||||
else
|
||||
table.insert(tbSRUpOutfit, v.nGoodsId)
|
||||
table.insert(tbSROutfit, v.nGoodsId)
|
||||
end
|
||||
end
|
||||
for _, v in pairs(tbItemList) do
|
||||
local itemConfig = ConfigTable.GetData_Item(v.nGoodsId)
|
||||
if itemConfig.Type == GameEnum.itemType.Char then
|
||||
if itemConfig.Rarity == GameEnum.itemRarity.SSR then
|
||||
table.insert(tbSSRChar, v.nGoodsId)
|
||||
else
|
||||
table.insert(tbSRChar, v.nGoodsId)
|
||||
end
|
||||
elseif itemConfig.Rarity == GameEnum.itemRarity.SSR then
|
||||
table.insert(tbSSROutfit, v.nGoodsId)
|
||||
elseif itemConfig.Rarity == GameEnum.itemRarity.SR then
|
||||
table.insert(tbSROutfit, v.nGoodsId)
|
||||
else
|
||||
table.insert(tbROutfit, v.nGoodsId)
|
||||
end
|
||||
end
|
||||
local nCount = 0
|
||||
local upItemName = ""
|
||||
if nStrogeId == GameEnum.gachaStorageType.DiscCardPool or nStrogeId == GameEnum.gachaStorageType.CharacterCardPool then
|
||||
local nAupMissing = PlayerData.Gacha:GetAMissTimesById(nPoolId)
|
||||
local nMaxMissing = mapPoolCfgData.ATypeGuaranteeTimes
|
||||
local nSum = nMaxMissing - nAupMissing
|
||||
nCount = nSum
|
||||
else
|
||||
local nAupMissing = PlayerData.Gacha:GetAupMissTimesById(nPoolId)
|
||||
local nMaxMissing = mapStorageCfgData.AUpGuaranteeTimes
|
||||
local nSum = nMaxMissing - nAupMissing
|
||||
nCount = nSum
|
||||
if 0 < #tbSSRUpChar then
|
||||
upItemName = GetContent(tbSSRUpChar[1])
|
||||
elseif 0 < #tbSSRUpOutfit then
|
||||
upItemName = GetContent(tbSSROutfit[1])
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPGuarantee, orderedFormat(mapStorageTypeCfgData.Desc10, nCount))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPPoolDesc, orderedFormat(mapStorageTypeCfgData.Desc11, mapPoolCfgData.Name, upItemName))
|
||||
local SetCharGrid = function(goGrid, nTid)
|
||||
goGrid:SetActive(true)
|
||||
local mapCharCfgData = ConfigTable.GetData_Item(nTid)
|
||||
local mapCharCfg = ConfigTable.GetData_Character(nTid)
|
||||
local mapCharSkin = ConfigTable.GetData_CharacterSkin(mapCharCfg.DefaultSkinId)
|
||||
local sFrame = AllEnum.FrameType_New.BoardFrame .. AllEnum.BoardFrameColor[mapCharCfg.Grade]
|
||||
local imgIcon = goGrid.transform:Find("AnimRoot/rtScaleRoot/tc_char_03/imgIconBg/imgItemIcon"):GetComponent("Image")
|
||||
local imgRare = goGrid.transform:Find("AnimRoot/rtScaleRoot/tc_char_03/imgItemRare"):GetComponent("Image")
|
||||
local imgElement = goGrid.transform:Find("AnimRoot/rtScaleRoot/tc_char_03/imgElement"):GetComponent("Image")
|
||||
local TMPName = goGrid.transform:Find("AnimRoot/TMPName"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(TMPName, mapCharCfgData.Title)
|
||||
self:SetPngSprite(imgIcon, mapCharSkin.Icon .. AllEnum.CharHeadIconSurfix.XXL)
|
||||
self:SetAtlasSprite(imgElement, "12_rare", AllEnum.Star_Element[mapCharCfg.EET].icon)
|
||||
self:SetAtlasSprite(imgRare, "12_rare", sFrame)
|
||||
local btnGrid = goGrid:GetComponent("UIButton")
|
||||
if btnGrid ~= nil then
|
||||
local ui_func = ui_handler(self, self.OnBtnClick_ShowCharInfo, goGrid, nTid)
|
||||
btnGrid.onClick:AddListener(ui_func)
|
||||
end
|
||||
end
|
||||
local SetOutfitGrid = function(goGrid, nTid)
|
||||
goGrid:SetActive(true)
|
||||
local mapItemCfgData = ConfigTable.GetData_Item(nTid)
|
||||
local imgIcon = goGrid.transform:Find("AnimRoot/rtScaleRoot/imgIcon"):GetComponent("Image")
|
||||
local imgRare = goGrid.transform:Find("AnimRoot/rtScaleRoot/imgRare"):GetComponent("Image")
|
||||
local imgElement = goGrid.transform:Find("AnimRoot/rtScaleRoot/imgElement"):GetComponent("Image")
|
||||
local mapDiscCfgData = ConfigTable.GetData("Disc", nTid)
|
||||
local TMPName = goGrid.transform:Find("AnimRoot/TMPName"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(TMPName, mapItemCfgData.Title)
|
||||
self:SetPngSprite(imgIcon, mapItemCfgData.Icon .. AllEnum.OutfitIconSurfix.Item)
|
||||
self:SetAtlasSprite(imgElement, "12_rare", AllEnum.Star_Element[mapDiscCfgData.EET].icon)
|
||||
self:SetSprite_FrameColor(imgRare, mapItemCfgData.Rarity, AllEnum.FrameType_New.Item)
|
||||
local btnGrid = goGrid:GetComponent("UIButton")
|
||||
if btnGrid ~= nil then
|
||||
local ui_func = ui_handler(self, self.OnBtnClick_ShowDiscInfo, goGrid, nTid)
|
||||
btnGrid.onClick:AddListener(ui_func)
|
||||
end
|
||||
end
|
||||
delChildren(self._mapNode.rtGuaranteeItems)
|
||||
if nStrogeId == GameEnum.gachaStorageType.DiscCardPool or nStrogeId == GameEnum.gachaStorageType.CharacterCardPool then
|
||||
for _, nTid in ipairs(tbSSRChar) do
|
||||
local goGrid = instantiate(self._mapNode.GridSmall, self._mapNode.rtGuaranteeItems)
|
||||
SetCharGrid(goGrid, nTid)
|
||||
end
|
||||
for _, nTid in ipairs(tbSSROutfit) do
|
||||
local goGrid = instantiate(self._mapNode.GridSmallOutfit, self._mapNode.rtGuaranteeItems)
|
||||
SetOutfitGrid(goGrid, nTid)
|
||||
end
|
||||
else
|
||||
for _, nTid in ipairs(tbSSRUpChar) do
|
||||
local goGrid = instantiate(self._mapNode.GridSmall, self._mapNode.rtGuaranteeItems)
|
||||
SetCharGrid(goGrid, nTid)
|
||||
end
|
||||
for _, nTid in ipairs(tbSSRUpOutfit) do
|
||||
local goGrid = instantiate(self._mapNode.GridSmallOutfit, self._mapNode.rtGuaranteeItems)
|
||||
SetOutfitGrid(goGrid, nTid)
|
||||
end
|
||||
end
|
||||
end
|
||||
function GachaGuaranteeCtrl:OnBtnClick_ShowCharInfo(btn, nCharId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgTrialPanel, PanelId.CharInfoTrial, nCharId)
|
||||
end
|
||||
function GachaGuaranteeCtrl:OnBtnClick_ShowDiscInfo(btn, nDiscId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSample, nDiscId)
|
||||
end
|
||||
return GachaGuaranteeCtrl
|
||||
@@ -0,0 +1,293 @@
|
||||
local GachaHistotyCtrl = class("GachaHistotyCtrl", BaseCtrl)
|
||||
GachaHistotyCtrl._mapNodeConfig = {
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Recruit_history"
|
||||
},
|
||||
TMPDesc = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GachaHistory_Desc"
|
||||
},
|
||||
DD_PoolSelect = {
|
||||
sComponentName = "TMP_Dropdown",
|
||||
callback = "OnDD_SelectPool"
|
||||
},
|
||||
imgBtnPerv = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_PrevPage"
|
||||
},
|
||||
imgBtnNext = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_NextPage"
|
||||
},
|
||||
TMPPage = {sComponentName = "TMP_Text"},
|
||||
TMPType = {sComponentName = "TMP_Text", nCount = 5},
|
||||
TMPName = {sComponentName = "TMP_Text", nCount = 5},
|
||||
TMPTag = {sComponentName = "TMP_Text", nCount = 5},
|
||||
TMPTime = {sComponentName = "TMP_Text", nCount = 5},
|
||||
ImgRare = {sComponentName = "Image", nCount = 5},
|
||||
imgTypeIconChar = {nCount = 5},
|
||||
imgTypeIconDisc = {nCount = 5},
|
||||
btnCloseScreen = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
rtGachaHistory = {sComponentName = "Animator"},
|
||||
imgDDUp = {},
|
||||
imgDDDown = {},
|
||||
TMPTypeTitle = {
|
||||
sNodeName = "TMPType",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GachaHistory_Type"
|
||||
},
|
||||
TMPRareTitle = {
|
||||
sNodeName = "TMPRare",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GachaHistory_Rank"
|
||||
},
|
||||
TMPNameTitle = {
|
||||
sNodeName = "TMPNameHistoryTitle",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GachaHistory_Name"
|
||||
},
|
||||
TMPTagTitle = {
|
||||
sNodeName = "TMPTag",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GachaHistory_Tag"
|
||||
},
|
||||
TMPTimeTitle = {
|
||||
sNodeName = "TMPTime",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GachaHistory_Time"
|
||||
},
|
||||
imgDown = {sComponentName = "Image"},
|
||||
imgPrev = {sComponentName = "Image"},
|
||||
rtEmpty = {},
|
||||
TMPEmpty = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Recruit_history_empty"
|
||||
},
|
||||
txtBtnGuarantee = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GachaHistory_Guarantee"
|
||||
},
|
||||
txtBtnHistory = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GachaHistory_History"
|
||||
},
|
||||
rtContentHistory = {},
|
||||
rtGachaGuarantee = {
|
||||
sCtrlName = "Game.UI.GachaEx.GachaGuaranteeCtrl"
|
||||
},
|
||||
btn_Guarantee = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Guarantee"
|
||||
},
|
||||
btn_History = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_History"
|
||||
}
|
||||
}
|
||||
GachaHistotyCtrl._mapEventConfig = {
|
||||
DropdownOpenState = "OnEvent_Open"
|
||||
}
|
||||
function GachaHistotyCtrl:Awake()
|
||||
local tbOpenedPool = PlayerData.Gacha:GetOpenedPool()
|
||||
self.tbStrogeId = {}
|
||||
for _, nPoolId in ipairs(tbOpenedPool) do
|
||||
local mapPoolCfgData = ConfigTable.GetData("Gacha", nPoolId)
|
||||
if table.indexof(self.tbStrogeId, mapPoolCfgData.StorageId) < 1 and mapPoolCfgData.StorageId ~= GameEnum.gachaStorageType.BeginnerCardPool then
|
||||
table.insert(self.tbStrogeId, mapPoolCfgData.StorageId)
|
||||
end
|
||||
end
|
||||
self._mapNode.DD_PoolSelect:ClearOptions()
|
||||
local List_String = CS.System.Collections.Generic.List(CS.System.String)
|
||||
local lst = List_String()
|
||||
for _, value in pairs(self.tbStrogeId) do
|
||||
local str = ""
|
||||
local mapGachaStorage = ConfigTable.GetData("GachaStorage", value)
|
||||
if mapGachaStorage ~= nil then
|
||||
str = mapGachaStorage.Name
|
||||
end
|
||||
lst:Add(str)
|
||||
end
|
||||
self._mapNode.DD_PoolSelect:AddOptions(lst)
|
||||
self._mapNode.DD_PoolSelect.value = 0
|
||||
end
|
||||
function GachaHistotyCtrl:FadeIn()
|
||||
end
|
||||
function GachaHistotyCtrl:FadeOut()
|
||||
end
|
||||
function GachaHistotyCtrl:OnEnable()
|
||||
end
|
||||
function GachaHistotyCtrl:OnDisable()
|
||||
end
|
||||
function GachaHistotyCtrl:OnDestroy()
|
||||
end
|
||||
function GachaHistotyCtrl:OnRelease()
|
||||
end
|
||||
function GachaHistotyCtrl:OpenPanel(nStrogeId, nPoolId)
|
||||
self.bInit = false
|
||||
self._mapNode.rtContentHistory:SetActive(false)
|
||||
self._mapNode.rtGachaGuarantee.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtWindowTitle, ConfigTable.GetUIText("GachaHistory_Guarantee"))
|
||||
for nIdx, value in ipairs(self.tbStrogeId) do
|
||||
if value == nStrogeId then
|
||||
self._mapNode.DD_PoolSelect.value = nIdx - 1
|
||||
break
|
||||
end
|
||||
end
|
||||
self.gameObject:SetActive(true)
|
||||
self:Refresh()
|
||||
self._mapNode.rtGachaGuarantee:Refresh(nPoolId)
|
||||
self._mapNode.rtGachaHistory:Play("t_window_04_t_in")
|
||||
self.bInit = true
|
||||
end
|
||||
function GachaHistotyCtrl:Refresh()
|
||||
local nIdx = self._mapNode.DD_PoolSelect.value + 1
|
||||
self.curPool = self.tbStrogeId[nIdx]
|
||||
local GetDataCallback = function(tbData)
|
||||
self.tbAllHistory = tbData
|
||||
self.tbPage = {}
|
||||
local nPage = 1
|
||||
for i = #self.tbAllHistory, 1, -1 do
|
||||
for j = #self.tbAllHistory[i].Ids, 1, -1 do
|
||||
if self.tbPage[nPage] == nil then
|
||||
self.tbPage[nPage] = {}
|
||||
end
|
||||
if #self.tbPage[nPage] >= 5 then
|
||||
nPage = nPage + 1
|
||||
self.tbPage[nPage] = {}
|
||||
end
|
||||
table.insert(self.tbPage[nPage], {
|
||||
self.tbAllHistory[i].Ids[j],
|
||||
self.tbAllHistory[i].Time,
|
||||
self.tbAllHistory[i].Gid
|
||||
})
|
||||
end
|
||||
end
|
||||
self.nTotalPage = nPage
|
||||
if self.nTotalPage > 0 then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPPage, string.format("%d/%d", 1, self.nTotalPage))
|
||||
self.nCurPage = 1
|
||||
self:RefreshPage(self.nCurPage)
|
||||
else
|
||||
self.nCurPage = 0
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPPage, string.format("%d/%d", 0, 0))
|
||||
self:RefreshPage(0)
|
||||
end
|
||||
if #self.tbAllHistory > 0 then
|
||||
self._mapNode.rtEmpty:SetActive(false)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgPrev, Color(1, 1, 1, 1))
|
||||
NovaAPI.SetImageColor(self._mapNode.imgDown, Color(1, 1, 1, 1))
|
||||
else
|
||||
self._mapNode.rtEmpty:SetActive(true)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgPrev, Color(1, 1, 1, 0.7))
|
||||
NovaAPI.SetImageColor(self._mapNode.imgDown, Color(1, 1, 1, 0.7))
|
||||
end
|
||||
end
|
||||
PlayerData.Gacha:GetGachaHistory(self.curPool, GetDataCallback)
|
||||
end
|
||||
function GachaHistotyCtrl:RefreshPage(nPage)
|
||||
local tbPage = self.tbPage[nPage]
|
||||
if tbPage == nil then
|
||||
for i = 1, 5 do
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPType[i], "")
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPName[i], "")
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTag[i], "")
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTime[i], "")
|
||||
self._mapNode.ImgRare[i].gameObject:SetActive(false)
|
||||
self._mapNode.imgTypeIconChar[i].gameObject:SetActive(false)
|
||||
self._mapNode.imgTypeIconDisc[i].gameObject:SetActive(false)
|
||||
end
|
||||
return
|
||||
end
|
||||
for i = 1, 5 do
|
||||
local tbData = tbPage[i]
|
||||
if tbData == nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPType[i], "")
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPName[i], "")
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTag[i], "")
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTime[i], "")
|
||||
self._mapNode.ImgRare[i].gameObject:SetActive(false)
|
||||
self._mapNode.imgTypeIconChar[i].gameObject:SetActive(false)
|
||||
self._mapNode.imgTypeIconDisc[i].gameObject:SetActive(false)
|
||||
else
|
||||
local mapItemCfgData = ConfigTable.GetData_Item(tbData[1])
|
||||
if mapItemCfgData == nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPType[i], "")
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPName[i], "")
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTag[i], "")
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTime[i], "")
|
||||
self._mapNode.ImgRare[i].gameObject:SetActive(false)
|
||||
self._mapNode.imgTypeIconChar[i].gameObject:SetActive(false)
|
||||
self._mapNode.imgTypeIconDisc[i].gameObject:SetActive(false)
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPType[i], mapItemCfgData.Type == GameEnum.itemType.Char and ConfigTable.GetUIText("RoleCn") or ConfigTable.GetUIText("ItemStye_Outfit"))
|
||||
self._mapNode.imgTypeIconChar[i].gameObject:SetActive(mapItemCfgData.Type == GameEnum.itemType.Char)
|
||||
self._mapNode.imgTypeIconDisc[i].gameObject:SetActive(mapItemCfgData.Type ~= GameEnum.itemType.Char)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPName[i], mapItemCfgData.Title)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTime[i], os.date("%Y/%m/%d %H:%M", tbData[2]))
|
||||
self._mapNode.ImgRare[i].gameObject:SetActive(true)
|
||||
self:SetSprite_FrameColor(self._mapNode.ImgRare[i], mapItemCfgData.Rarity, AllEnum.FrameType_New.Text)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.ImgRare[i])
|
||||
local mapGacha = ConfigTable.GetData("Gacha", tbData[3])
|
||||
if mapGacha ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTag[i], mapGacha.Name)
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTag[i], tbData[3])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function GachaHistotyCtrl:OnDD_SelectPool()
|
||||
if not self.bInit then
|
||||
return
|
||||
end
|
||||
self:Refresh()
|
||||
end
|
||||
function GachaHistotyCtrl:OnEvent_Open(bOpen)
|
||||
self._mapNode.imgDDUp:SetActive(bOpen)
|
||||
self._mapNode.imgDDDown:SetActive(not bOpen)
|
||||
local sSound = bOpen and "ui_common_menu_open" or "ui_common_menu_close"
|
||||
CS.WwiseAudioManager.Instance:PlaySound(sSound)
|
||||
end
|
||||
function GachaHistotyCtrl:OnBtnClick_NextPage()
|
||||
if self.nCurPage >= self.nTotalPage then
|
||||
return
|
||||
end
|
||||
self.nCurPage = self.nCurPage + 1
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPPage, string.format("%d/%d", self.nCurPage, self.nTotalPage))
|
||||
self:RefreshPage(self.nCurPage)
|
||||
end
|
||||
function GachaHistotyCtrl:OnBtnClick_PrevPage()
|
||||
if self.nCurPage <= 1 then
|
||||
return
|
||||
end
|
||||
self.nCurPage = self.nCurPage - 1
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPPage, string.format("%d/%d", self.nCurPage, self.nTotalPage))
|
||||
self:RefreshPage(self.nCurPage)
|
||||
end
|
||||
function GachaHistotyCtrl:OnBtnClick_Close()
|
||||
local Close = function()
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
self._mapNode.rtGachaHistory:Play("t_window_04_t_out")
|
||||
self:AddTimer(1, 0.2, Close, true, true, true)
|
||||
end
|
||||
function GachaHistotyCtrl:OnBtnClick_History()
|
||||
self._mapNode.rtContentHistory:SetActive(true)
|
||||
self._mapNode.rtGachaGuarantee.gameObject:SetActive(false)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtWindowTitle, ConfigTable.GetUIText("Recruit_history"))
|
||||
end
|
||||
function GachaHistotyCtrl:OnBtnClick_Guarantee()
|
||||
self._mapNode.rtContentHistory:SetActive(false)
|
||||
self._mapNode.rtGachaGuarantee.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtWindowTitle, ConfigTable.GetUIText("GachaHistory_Guarantee"))
|
||||
end
|
||||
return GachaHistotyCtrl
|
||||
@@ -0,0 +1,316 @@
|
||||
local GachaInfoCtrl = class("GachaInfoCtrl", BaseCtrl)
|
||||
AllEnum = require("GameCore.Common.AllEnum")
|
||||
GachaInfoCtrl._mapNodeConfig = {
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Recruit_info"
|
||||
},
|
||||
GridBig = {},
|
||||
GridOutfit = {},
|
||||
GridSmallOutfit = {},
|
||||
GridSmall = {},
|
||||
rtSSRList = {sComponentName = "Transform"},
|
||||
rtSRList = {sComponentName = "Transform"},
|
||||
rtAllSSRList = {sComponentName = "Transform"},
|
||||
rtAllSRList = {sComponentName = "Transform"},
|
||||
rtAllRList = {sComponentName = "Transform"},
|
||||
rtSSRContnet = {},
|
||||
rtSRContnet = {},
|
||||
rtUPContent = {},
|
||||
rtAllSSRContnet = {},
|
||||
rtAllSRContnet = {},
|
||||
rtAllRContnet = {},
|
||||
TMPPoolDes = {sComponentName = "TMP_Text"},
|
||||
TMPRandomInfo = {sComponentName = "TMP_Text"},
|
||||
TMPRepeatInfo = {sComponentName = "TMP_Text"},
|
||||
TMPUPTitle = {sComponentName = "TMP_Text"},
|
||||
TMPUPSSRTitle = {sComponentName = "TMP_Text"},
|
||||
TMPUPSRTitle = {sComponentName = "TMP_Text"},
|
||||
TMPAllTitle = {sComponentName = "TMP_Text"},
|
||||
TMPAllSSRTitle = {sComponentName = "TMP_Text"},
|
||||
TMPAllSRTitle = {sComponentName = "TMP_Text"},
|
||||
TMPAllRTitle = {sComponentName = "TMP_Text"},
|
||||
TMPPoolDesTitle = {sComponentName = "TMP_Text"},
|
||||
TMPRandomInfoTitle = {sComponentName = "TMP_Text"},
|
||||
TMPRepeatInfoTitle = {sComponentName = "TMP_Text"},
|
||||
btnCloseScreen = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
rtPoolInfo = {sComponentName = "Animator"},
|
||||
btn_ProbDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_OpenProbInfo"
|
||||
},
|
||||
txt_Prob = {sComponentName = "TMP_Text", sLanguageId = "Gacha_Prob"},
|
||||
svInfo = {sComponentName = "ScrollRect"}
|
||||
}
|
||||
GachaInfoCtrl._mapEventConfig = {}
|
||||
function GachaInfoCtrl:Awake()
|
||||
end
|
||||
function GachaInfoCtrl:FadeIn()
|
||||
end
|
||||
function GachaInfoCtrl:FadeOut()
|
||||
end
|
||||
function GachaInfoCtrl:OnEnable()
|
||||
end
|
||||
function GachaInfoCtrl:OnDisable()
|
||||
end
|
||||
function GachaInfoCtrl:OnDestroy()
|
||||
end
|
||||
function GachaInfoCtrl:OnRelease()
|
||||
end
|
||||
function GachaInfoCtrl:Refresh(nGachaId)
|
||||
NovaAPI.SetVerticalNormalizedPosition(self._mapNode.svInfo, 1)
|
||||
local mapGachaPoolCfgData = ConfigTable.GetData("Gacha", nGachaId)
|
||||
if mapGachaPoolCfgData == nil then
|
||||
printError("Gacha Missing:" .. nGachaId)
|
||||
return
|
||||
end
|
||||
local mapGachaCfgData = ConfigTable.GetData("GachaType", mapGachaPoolCfgData.GachaType)
|
||||
if mapGachaCfgData == nil then
|
||||
printError("GachaType Missing:" .. mapGachaPoolCfgData.GachaType)
|
||||
return
|
||||
end
|
||||
local tbSSRUpChar = {}
|
||||
local tbSSRUpOutfit = {}
|
||||
local tbSRUpChar = {}
|
||||
local tbSRUpOutfit = {}
|
||||
local tbSSRChar = {}
|
||||
local tbSSROutfit = {}
|
||||
local tbSRChar = {}
|
||||
local tbSROutfit = {}
|
||||
local tbROutfit = {}
|
||||
local tbUpItemList, tbItemList = PlayerData.Gacha:GetPoolProbDetail(nGachaId)
|
||||
for _, v in pairs(tbUpItemList) do
|
||||
local itemConfig = ConfigTable.GetData_Item(v.nGoodsId)
|
||||
if itemConfig.Type == GameEnum.itemType.Char then
|
||||
if itemConfig.Rarity == GameEnum.itemRarity.SSR then
|
||||
table.insert(tbSSRUpChar, v.nGoodsId)
|
||||
table.insert(tbSSRChar, v.nGoodsId)
|
||||
else
|
||||
table.insert(tbSRUpChar, v.nGoodsId)
|
||||
table.insert(tbSRChar, v.nGoodsId)
|
||||
end
|
||||
elseif itemConfig.Rarity == GameEnum.itemRarity.SSR then
|
||||
table.insert(tbSSRUpOutfit, v.nGoodsId)
|
||||
table.insert(tbSSROutfit, v.nGoodsId)
|
||||
else
|
||||
table.insert(tbSRUpOutfit, v.nGoodsId)
|
||||
table.insert(tbSROutfit, v.nGoodsId)
|
||||
end
|
||||
end
|
||||
for _, v in pairs(tbItemList) do
|
||||
local itemConfig = ConfigTable.GetData_Item(v.nGoodsId)
|
||||
if itemConfig.Type == GameEnum.itemType.Char then
|
||||
if itemConfig.Rarity == GameEnum.itemRarity.SSR then
|
||||
table.insert(tbSSRChar, v.nGoodsId)
|
||||
else
|
||||
table.insert(tbSRChar, v.nGoodsId)
|
||||
end
|
||||
elseif itemConfig.Rarity == GameEnum.itemRarity.SSR then
|
||||
table.insert(tbSSROutfit, v.nGoodsId)
|
||||
elseif itemConfig.Rarity == GameEnum.itemRarity.SR then
|
||||
table.insert(tbSROutfit, v.nGoodsId)
|
||||
else
|
||||
table.insert(tbROutfit, v.nGoodsId)
|
||||
end
|
||||
end
|
||||
delChildren(self._mapNode.rtAllRList)
|
||||
delChildren(self._mapNode.rtAllSRList)
|
||||
delChildren(self._mapNode.rtAllSSRList)
|
||||
delChildren(self._mapNode.rtSRList)
|
||||
delChildren(self._mapNode.rtSSRList)
|
||||
local SetCharGrid = function(goGrid, nTid)
|
||||
goGrid:SetActive(true)
|
||||
local mapCharCfgData = ConfigTable.GetData_Item(nTid)
|
||||
local mapCharCfg = ConfigTable.GetData_Character(nTid)
|
||||
local mapCharSkin = ConfigTable.GetData_CharacterSkin(mapCharCfg.DefaultSkinId)
|
||||
local sFrame = AllEnum.FrameType_New.BoardFrame .. AllEnum.BoardFrameColor[mapCharCfg.Grade]
|
||||
local imgIcon = goGrid.transform:Find("AnimRoot/rtScaleRoot/tc_char_03/imgIconBg/imgItemIcon"):GetComponent("Image")
|
||||
local imgRare = goGrid.transform:Find("AnimRoot/rtScaleRoot/tc_char_03/imgItemRare"):GetComponent("Image")
|
||||
local imgElement = goGrid.transform:Find("AnimRoot/rtScaleRoot/tc_char_03/imgElement"):GetComponent("Image")
|
||||
local TMPName = goGrid.transform:Find("AnimRoot/TMPName"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(TMPName, mapCharCfgData.Title)
|
||||
self:SetPngSprite(imgIcon, mapCharSkin.Icon .. AllEnum.CharHeadIconSurfix.XXL)
|
||||
self:SetAtlasSprite(imgElement, "12_rare", AllEnum.Star_Element[mapCharCfg.EET].icon)
|
||||
self:SetAtlasSprite(imgRare, "12_rare", sFrame)
|
||||
local btnGrid = goGrid:GetComponent("UIButton")
|
||||
if btnGrid ~= nil then
|
||||
local ui_func = ui_handler(self, self.OnBtnClick_ShowCharInfo, goGrid, nTid)
|
||||
btnGrid.onClick:AddListener(ui_func)
|
||||
end
|
||||
end
|
||||
local SetOutfitGrid = function(goGrid, nTid)
|
||||
goGrid:SetActive(true)
|
||||
local mapItemCfgData = ConfigTable.GetData_Item(nTid)
|
||||
local imgIcon = goGrid.transform:Find("AnimRoot/rtScaleRoot/imgIcon"):GetComponent("Image")
|
||||
local imgRare = goGrid.transform:Find("AnimRoot/rtScaleRoot/imgRare"):GetComponent("Image")
|
||||
local imgElement = goGrid.transform:Find("AnimRoot/rtScaleRoot/imgElement"):GetComponent("Image")
|
||||
local mapDiscCfgData = ConfigTable.GetData("Disc", nTid)
|
||||
local TMPName = goGrid.transform:Find("AnimRoot/TMPName"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(TMPName, mapItemCfgData.Title)
|
||||
self:SetPngSprite(imgIcon, mapItemCfgData.Icon .. AllEnum.OutfitIconSurfix.Item)
|
||||
self:SetAtlasSprite(imgElement, "12_rare", AllEnum.Star_Element[mapDiscCfgData.EET].icon)
|
||||
self:SetSprite_FrameColor(imgRare, mapItemCfgData.Rarity, AllEnum.FrameType_New.Item)
|
||||
local btnGrid = goGrid:GetComponent("UIButton")
|
||||
if btnGrid ~= nil then
|
||||
local ui_func = ui_handler(self, self.OnBtnClick_ShowDiscInfo, goGrid, nTid)
|
||||
btnGrid.onClick:AddListener(ui_func)
|
||||
end
|
||||
end
|
||||
if #tbSSRUpChar + #tbSSRUpOutfit == 0 then
|
||||
self._mapNode.rtSSRContnet:SetActive(false)
|
||||
else
|
||||
self._mapNode.rtSSRContnet:SetActive(true)
|
||||
for _, nTid in ipairs(tbSSRUpChar) do
|
||||
local goGrid = instantiate(self._mapNode.GridBig, self._mapNode.rtSSRList)
|
||||
SetCharGrid(goGrid, nTid)
|
||||
end
|
||||
for _, nTid in ipairs(tbSSRUpOutfit) do
|
||||
local goGrid = instantiate(self._mapNode.GridOutfit, self._mapNode.rtSSRList)
|
||||
SetOutfitGrid(goGrid, nTid)
|
||||
end
|
||||
end
|
||||
if #tbSRUpOutfit + #tbSRUpChar == 0 then
|
||||
self._mapNode.rtSSRContnet:SetActive(false)
|
||||
else
|
||||
self._mapNode.rtSSRContnet:SetActive(true)
|
||||
self._mapNode.rtSSRContnet:SetActive(true)
|
||||
for _, nTid in ipairs(tbSRUpChar) do
|
||||
local goGrid = instantiate(self._mapNode.GridBig, self._mapNode.rtSRList)
|
||||
SetCharGrid(goGrid, nTid)
|
||||
end
|
||||
for _, nTid in ipairs(tbSRUpOutfit) do
|
||||
local goGrid = instantiate(self._mapNode.GridOutfit, self._mapNode.rtSRList)
|
||||
SetOutfitGrid(goGrid, nTid)
|
||||
end
|
||||
end
|
||||
if #tbSRUpOutfit + #tbSRUpChar + #tbSSRUpChar + #tbSSRUpOutfit == 0 then
|
||||
self._mapNode.rtUPContent:SetActive(false)
|
||||
else
|
||||
self._mapNode.rtUPContent:SetActive(true)
|
||||
end
|
||||
if #tbSSRChar + #tbSSROutfit == 0 then
|
||||
self._mapNode.rtAllSSRContnet:SetActive(false)
|
||||
else
|
||||
self._mapNode.rtAllSSRContnet:SetActive(true)
|
||||
for _, nTid in ipairs(tbSSRChar) do
|
||||
local goGrid = instantiate(self._mapNode.GridSmall, self._mapNode.rtAllSSRList)
|
||||
SetCharGrid(goGrid, nTid)
|
||||
end
|
||||
for _, nTid in ipairs(tbSSROutfit) do
|
||||
local goGrid = instantiate(self._mapNode.GridSmallOutfit, self._mapNode.rtAllSSRList)
|
||||
SetOutfitGrid(goGrid, nTid)
|
||||
end
|
||||
end
|
||||
if #tbSRChar + #tbSROutfit == 0 then
|
||||
self._mapNode.rtAllSRContnet:SetActive(false)
|
||||
else
|
||||
self._mapNode.rtAllSRContnet:SetActive(true)
|
||||
for _, nTid in ipairs(tbSRChar) do
|
||||
local goGrid = instantiate(self._mapNode.GridSmall, self._mapNode.rtAllSRList)
|
||||
SetCharGrid(goGrid, nTid)
|
||||
end
|
||||
for _, nTid in ipairs(tbSROutfit) do
|
||||
local goGrid = instantiate(self._mapNode.GridSmallOutfit, self._mapNode.rtAllSRList)
|
||||
SetOutfitGrid(goGrid, nTid)
|
||||
end
|
||||
end
|
||||
if tbROutfit == 0 then
|
||||
self._mapNode.rtAllSRContnet:SetActive(false)
|
||||
else
|
||||
self._mapNode.rtAllSRContnet:SetActive(true)
|
||||
for _, nTid in ipairs(tbROutfit) do
|
||||
local goGrid = instantiate(self._mapNode.GridSmallOutfit, self._mapNode.rtAllRList)
|
||||
SetOutfitGrid(goGrid, nTid)
|
||||
end
|
||||
end
|
||||
local tbContent = {}
|
||||
tbContent[1] = mapGachaPoolCfgData.Name
|
||||
local tbMainItem = {}
|
||||
local tbSubItem = {}
|
||||
local mapPkgData = ConfigTable.Get("GachaPkg")
|
||||
if mapPkgData ~= nil then
|
||||
ForEachTableLine(mapPkgData, function(mapData)
|
||||
if mapData.PkgId == mapGachaPoolCfgData.ATypeUpPkg then
|
||||
table.insert(tbMainItem, mapData.GoodsId)
|
||||
elseif mapData.PkgId == mapGachaPoolCfgData.BTypeUpPkg then
|
||||
table.insert(tbSubItem, mapData.GoodsId)
|
||||
end
|
||||
end)
|
||||
end
|
||||
local GetContent = function(nItmeId)
|
||||
local ret = ""
|
||||
local mapCfgData = ConfigTable.GetData_Item(nItmeId)
|
||||
if mapCfgData ~= nil then
|
||||
if mapCfgData.Type == GameEnum.itemType.Char then
|
||||
local mapCharCfg = ConfigTable.GetData_Character(nItmeId)
|
||||
if mapCharCfg ~= nil then
|
||||
ret = string.format("%s·%s", ConfigTable.GetUIText("T_Element_Attr_" .. mapCharCfg.EET), mapCharCfg.Name)
|
||||
end
|
||||
elseif mapCfgData.Type == GameEnum.itemType.Disc then
|
||||
local mapDiscCfg = ConfigTable.GetData("Disc", nItmeId)
|
||||
if mapDiscCfg ~= nil then
|
||||
ret = string.format("%s·%s", ConfigTable.GetUIText("T_Element_Attr_" .. mapDiscCfg.EET), mapCfgData.Title)
|
||||
end
|
||||
end
|
||||
end
|
||||
return ret
|
||||
end
|
||||
if tbMainItem[1] ~= nil then
|
||||
local nItemId = tbMainItem[1]
|
||||
tbContent[2] = GetContent(nItemId)
|
||||
end
|
||||
if tbSubItem[1] ~= nil then
|
||||
tbContent[3] = GetContent(tbSubItem[1])
|
||||
end
|
||||
if tbSubItem[2] ~= nil then
|
||||
tbContent[4] = GetContent(tbSubItem[2])
|
||||
end
|
||||
local subContent = function(sContent)
|
||||
return (sContent:gsub("{(%d+)}", function(index)
|
||||
index = tonumber(index) + 1
|
||||
return tbContent[index] == nil and "" or tbContent[index]
|
||||
end))
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPUPTitle, mapGachaCfgData.Title4)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPUPSSRTitle, mapGachaCfgData.Desc4)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPUPSRTitle, mapGachaCfgData.Desc5)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPAllTitle, mapGachaCfgData.Title5)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPAllSSRTitle, mapGachaCfgData.Desc6)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPAllSRTitle, mapGachaCfgData.Desc7)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPAllRTitle, mapGachaCfgData.Desc8)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPPoolDes, subContent(mapGachaCfgData.Desc1))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPPoolDesTitle, mapGachaCfgData.Title1)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPRandomInfo, subContent(mapGachaCfgData.Desc2))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPRandomInfoTitle, mapGachaCfgData.Title2)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPRepeatInfo, mapGachaCfgData.Desc3)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPRepeatInfoTitle, mapGachaCfgData.Title3)
|
||||
self._mapNode.btn_ProbDetail.gameObject:SetActive(mapGachaPoolCfgData.StorageId ~= GameEnum.gachaStorageType.BeginnerCardPool)
|
||||
end
|
||||
function GachaInfoCtrl:OpenInfo()
|
||||
self.gameObject:SetActive(true)
|
||||
self._mapNode.rtPoolInfo:Play("t_window_04_t_in")
|
||||
end
|
||||
function GachaInfoCtrl:OnBtnClick_Close()
|
||||
local Close = function()
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
self._mapNode.rtPoolInfo:Play("t_window_04_t_out")
|
||||
self:AddTimer(1, 0.2, Close, true, true, true)
|
||||
end
|
||||
function GachaInfoCtrl:OnBtnClick_ShowCharInfo(btn, nCharId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgTrialPanel, PanelId.CharInfoTrial, nCharId)
|
||||
end
|
||||
function GachaInfoCtrl:OnBtnClick_ShowDiscInfo(btn, nDiscId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSample, nDiscId)
|
||||
end
|
||||
function GachaInfoCtrl:OnBtnClick_OpenProbInfo()
|
||||
EventManager.Hit("GachaOpenProbInfo")
|
||||
end
|
||||
return GachaInfoCtrl
|
||||
@@ -0,0 +1,151 @@
|
||||
local GachaNewBieObtainResultCtrl = class("GachaNewBieObtainResultCtrl", BaseCtrl)
|
||||
GachaNewBieObtainResultCtrl._mapNodeConfig = {
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_NewBieObtainTitle"
|
||||
},
|
||||
txtBtnCancel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_NewBieObtainCancel"
|
||||
},
|
||||
txtBtnOk = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_NewBieObtainOk"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnCancel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnConfirm1 = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Confirm"
|
||||
},
|
||||
rtItem = {
|
||||
sNodeName = "item",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl",
|
||||
nCount = 10
|
||||
},
|
||||
imgRec = {sNodeName = "imgRec_", nCount = 10},
|
||||
rtItemText = {
|
||||
sNodeName = "item_name",
|
||||
sComponentName = "TMP_Text",
|
||||
nCount = 10
|
||||
},
|
||||
btnItem = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Item",
|
||||
nCount = 10
|
||||
},
|
||||
CloseButton = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
}
|
||||
}
|
||||
GachaNewBieObtainResultCtrl._mapEventConfig = {}
|
||||
function GachaNewBieObtainResultCtrl:Awake()
|
||||
end
|
||||
function GachaNewBieObtainResultCtrl:FadeIn()
|
||||
end
|
||||
function GachaNewBieObtainResultCtrl:FadeOut()
|
||||
end
|
||||
function GachaNewBieObtainResultCtrl:OnEnable()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
self.bClose = true
|
||||
end
|
||||
function GachaNewBieObtainResultCtrl:OnDisable()
|
||||
end
|
||||
function GachaNewBieObtainResultCtrl:OnDestroy()
|
||||
end
|
||||
function GachaNewBieObtainResultCtrl:OnBtnClick_Item(btn, nIndex)
|
||||
if self.items == nil then
|
||||
return
|
||||
end
|
||||
local item = self.items[nIndex]
|
||||
if item == nil then
|
||||
return
|
||||
end
|
||||
local mapItemCfgData = ConfigTable.GetData_Item(item)
|
||||
if mapItemCfgData == nil then
|
||||
return
|
||||
end
|
||||
if mapItemCfgData.Type == nil then
|
||||
return
|
||||
end
|
||||
if mapItemCfgData.Type == GameEnum.itemType.Disc then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSample, item)
|
||||
elseif mapItemCfgData.Type == GameEnum.itemType.Char then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgTrialPanel, PanelId.CharInfoTrial, item)
|
||||
end
|
||||
end
|
||||
function GachaNewBieObtainResultCtrl:OnBtnClick_Close()
|
||||
if self.bClose then
|
||||
return
|
||||
end
|
||||
local Close = function()
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
self.animRoot:Play("t_window_04_t_out")
|
||||
self:AddTimer(1, 0.2, Close, true, true, true)
|
||||
self.bClose = true
|
||||
end
|
||||
function GachaNewBieObtainResultCtrl:OnBtnClick_Confirm()
|
||||
if self.bClose then
|
||||
return
|
||||
end
|
||||
local CheckNew = function(nTid)
|
||||
local mapItemCfgData = ConfigTable.GetData_Item(nTid)
|
||||
if mapItemCfgData == nil then
|
||||
return false
|
||||
end
|
||||
if mapItemCfgData.Type == GameEnum.itemType.Char then
|
||||
local mapChar = PlayerData.Char:GetCharDataByTid(nTid)
|
||||
return mapChar == nil
|
||||
elseif mapItemCfgData.Type == GameEnum.itemType.Disc then
|
||||
local mapDisc = PlayerData.Disc:GetDiscById(nTid)
|
||||
return mapDisc == nil
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
local tbItemId = {}
|
||||
local tbNew = {}
|
||||
for _, v in ipairs(self.items) do
|
||||
local bNewHandBood = CheckNew(v)
|
||||
local bNew = bNewHandBood and table.indexof(tbItemId, v) < 1
|
||||
table.insert(tbItemId, v)
|
||||
table.insert(tbNew, bNew)
|
||||
end
|
||||
local Callback = function(mapData)
|
||||
EventManager.Hit("GachaNewbieObtainRecordOver", mapData, self.items, tbNew)
|
||||
end
|
||||
PlayerData.Gacha:SendGachaNewbieObtainReq(self.curPoolId, self.idx, Callback)
|
||||
self.bClose = true
|
||||
end
|
||||
function GachaNewBieObtainResultCtrl:SetItems(id, idx, items)
|
||||
self.idx = idx
|
||||
self.curPoolId = id
|
||||
self.items = items
|
||||
for idx, v in ipairs(items) do
|
||||
if v ~= 0 then
|
||||
local mapCfg = ConfigTable.GetData_Item(v)
|
||||
NovaAPI.SetTMPText(self._mapNode.rtItemText[idx], mapCfg.Title)
|
||||
self._mapNode.rtItem[idx].gameObject:SetActive(true)
|
||||
self._mapNode.rtItem[idx]:SetItem(v)
|
||||
local mapItemCfg = ConfigTable.GetData_Item(v)
|
||||
self._mapNode.imgRec[idx]:SetActive(mapItemCfg ~= nil and mapItemCfg.Rarity == GameEnum.itemRarity.SSR)
|
||||
else
|
||||
self._mapNode.rtItem[idx].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self.animRoot:Play("t_window_04_t_in")
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
self.bClose = false
|
||||
end
|
||||
return GachaNewBieObtainResultCtrl
|
||||
@@ -0,0 +1,51 @@
|
||||
local GachaNewBieRecordItemCtrl = class("GachaNewBieRecordItemCtrl", BaseCtrl)
|
||||
GachaNewBieRecordItemCtrl._mapNodeConfig = {
|
||||
rtItem = {
|
||||
sNodeName = "item",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl",
|
||||
nCount = 10
|
||||
},
|
||||
imgRec = {sNodeName = "imgRec_", nCount = 10},
|
||||
txt_line = {sComponentName = "TMP_Text"},
|
||||
select = {},
|
||||
imgSelect = {},
|
||||
TMPSelectTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_NewBieSelect"
|
||||
}
|
||||
}
|
||||
GachaNewBieRecordItemCtrl._mapEventConfig = {}
|
||||
function GachaNewBieRecordItemCtrl:Awake()
|
||||
end
|
||||
function GachaNewBieRecordItemCtrl:FadeIn()
|
||||
end
|
||||
function GachaNewBieRecordItemCtrl:FadeOut()
|
||||
end
|
||||
function GachaNewBieRecordItemCtrl:OnEnable()
|
||||
end
|
||||
function GachaNewBieRecordItemCtrl:OnDisable()
|
||||
end
|
||||
function GachaNewBieRecordItemCtrl:OnDestroy()
|
||||
end
|
||||
function GachaNewBieRecordItemCtrl:SetItems(items, idx)
|
||||
if idx == 0 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_line, ConfigTable.GetUIText("Gacha_NewBieSaveItemCurrent"))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_line, orderedFormat(ConfigTable.GetUIText("Gacha_NewBieSaveItem") or "", idx))
|
||||
end
|
||||
for idx, v in ipairs(items) do
|
||||
if v ~= 0 then
|
||||
self._mapNode.rtItem[idx].gameObject:SetActive(true)
|
||||
self._mapNode.rtItem[idx]:SetItem(v)
|
||||
local mapItemCfg = ConfigTable.GetData_Item(v)
|
||||
self._mapNode.imgRec[idx]:SetActive(mapItemCfg ~= nil and mapItemCfg.Rarity == GameEnum.itemRarity.SSR)
|
||||
else
|
||||
self._mapNode.rtItem[idx].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function GachaNewBieRecordItemCtrl:SetSelect(bSelect)
|
||||
self._mapNode.select.gameObject:SetActive(bSelect)
|
||||
self._mapNode.imgSelect.gameObject:SetActive(bSelect)
|
||||
end
|
||||
return GachaNewBieRecordItemCtrl
|
||||
@@ -0,0 +1,90 @@
|
||||
local GachaNewBieReplaceResultCtrl = class("GachaNewBieReplaceResultCtrl", BaseCtrl)
|
||||
GachaNewBieReplaceResultCtrl._mapNodeConfig = {
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_NewBieReplaceTitle"
|
||||
},
|
||||
txtBtnCancel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_NewBieReplaceCancel"
|
||||
},
|
||||
txtBtnOk = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_NewBieReplaceOk"
|
||||
},
|
||||
GachaNewBieShowRecordItemC = {
|
||||
sCtrlName = "Game.UI.GachaEx.GachaNewBieShowRecordItemCtrl"
|
||||
},
|
||||
GachaNewBieShowRecordItem = {
|
||||
sCtrlName = "Game.UI.GachaEx.GachaNewBieShowRecordItemCtrl"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnCancel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnConfirm1 = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Confirm"
|
||||
},
|
||||
CloseButton = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
}
|
||||
}
|
||||
GachaNewBieReplaceResultCtrl._mapEventConfig = {}
|
||||
function GachaNewBieReplaceResultCtrl:Awake()
|
||||
end
|
||||
function GachaNewBieReplaceResultCtrl:FadeIn()
|
||||
end
|
||||
function GachaNewBieReplaceResultCtrl:FadeOut()
|
||||
end
|
||||
function GachaNewBieReplaceResultCtrl:OnEnable()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
self.bClose = true
|
||||
end
|
||||
function GachaNewBieReplaceResultCtrl:OnDisable()
|
||||
end
|
||||
function GachaNewBieReplaceResultCtrl:OnDestroy()
|
||||
end
|
||||
function GachaNewBieReplaceResultCtrl:OnBtnClick_Close()
|
||||
if self.bClose then
|
||||
return
|
||||
end
|
||||
local Close = function()
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
self.animRoot:Play("t_window_04_t_out")
|
||||
self:AddTimer(1, 0.2, Close, true, true, true)
|
||||
self.bClose = true
|
||||
end
|
||||
function GachaNewBieReplaceResultCtrl:OnBtnClick_Confirm()
|
||||
if self.bClose then
|
||||
return
|
||||
end
|
||||
local Callback = function(mapData)
|
||||
EventManager.Hit("GachaNewbieReplaceRecordOver")
|
||||
end
|
||||
PlayerData.Gacha:SendGachaNewbieSaveReq(self.curPoolId, self.idx, Callback)
|
||||
self.bClose = true
|
||||
end
|
||||
function GachaNewBieReplaceResultCtrl:SetItems(id, idx)
|
||||
self.curPoolId = id
|
||||
self.idx = idx
|
||||
local newbieData = PlayerData.Gacha:GetGachaNewbieData(self.curPoolId)
|
||||
if newbieData == nil then
|
||||
return
|
||||
end
|
||||
self._mapNode.GachaNewBieShowRecordItemC:SetItems(newbieData.Temp, 0)
|
||||
self._mapNode.GachaNewBieShowRecordItem:SetItems(newbieData.Cards[idx], idx)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self.animRoot:Play("t_window_04_t_in")
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
self.bClose = false
|
||||
end
|
||||
return GachaNewBieReplaceResultCtrl
|
||||
@@ -0,0 +1,119 @@
|
||||
local GachaNewBieSaveRecordCtrl = class("GachaNewBieSaveRecordCtrl", BaseCtrl)
|
||||
GachaNewBieSaveRecordCtrl._mapNodeConfig = {
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_NewBieSaveRecordTitle"
|
||||
},
|
||||
txtBtnCancel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_NewBieSaveRecordCancel"
|
||||
},
|
||||
txtBtnOk = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_NewBieSaveRecordOk"
|
||||
},
|
||||
txtReplaceTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_NewBieSaveRecordTip"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnCancel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnConfirm1 = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Confirm"
|
||||
},
|
||||
GachaNewBieShowRecordItemC = {
|
||||
sCtrlName = "Game.UI.GachaEx.GachaNewBieShowRecordItemCtrl"
|
||||
},
|
||||
GachaNewBieRecordItem = {
|
||||
sCtrlName = "Game.UI.GachaEx.GachaNewBieRecordItemCtrl",
|
||||
nCount = 5
|
||||
},
|
||||
btnItem = {
|
||||
sNodeName = "GachaNewBieRecordItem",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Item",
|
||||
nCount = 5
|
||||
},
|
||||
CloseButton = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
}
|
||||
}
|
||||
GachaNewBieSaveRecordCtrl._mapEventConfig = {}
|
||||
function GachaNewBieSaveRecordCtrl:Awake()
|
||||
end
|
||||
function GachaNewBieSaveRecordCtrl:FadeIn()
|
||||
end
|
||||
function GachaNewBieSaveRecordCtrl:FadeOut()
|
||||
end
|
||||
function GachaNewBieSaveRecordCtrl:OnEnable()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
self.bClose = true
|
||||
end
|
||||
function GachaNewBieSaveRecordCtrl:OnDisable()
|
||||
end
|
||||
function GachaNewBieSaveRecordCtrl:OnDestroy()
|
||||
end
|
||||
function GachaNewBieSaveRecordCtrl:OnBtnClick_Close()
|
||||
if self.bClose then
|
||||
return
|
||||
end
|
||||
local Close = function()
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
self.animRoot:Play("t_window_04_t_out")
|
||||
self:AddTimer(1, 0.2, Close, true, true, true)
|
||||
self.bClose = true
|
||||
end
|
||||
function GachaNewBieSaveRecordCtrl:OnBtnClick_Confirm()
|
||||
if self.bClose then
|
||||
return
|
||||
end
|
||||
EventManager.Hit("GachaNewbieReplaceRecord", self.selectIdx)
|
||||
end
|
||||
function GachaNewBieSaveRecordCtrl:OnBtnClick_Item(btn, nIndex)
|
||||
if self.selectIdx == nIndex then
|
||||
return
|
||||
end
|
||||
self._mapNode.GachaNewBieRecordItem[self.selectIdx]:SetSelect(false)
|
||||
self._mapNode.GachaNewBieRecordItem[nIndex]:SetSelect(true)
|
||||
self.selectIdx = nIndex
|
||||
end
|
||||
function GachaNewBieSaveRecordCtrl:SetItems(id)
|
||||
self.curPoolId = id
|
||||
local newbie = ConfigTable.GetData("GachaNewbie", self.curPoolId)
|
||||
if newbie == nil then
|
||||
return
|
||||
end
|
||||
local newbieData = PlayerData.Gacha:GetGachaNewbieData(self.curPoolId)
|
||||
if newbieData == nil then
|
||||
return
|
||||
end
|
||||
local c = tostring(#newbieData.Cards) .. "/" .. tostring(newbie.SaveCount)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtReplaceTip, orderedFormat(ConfigTable.GetUIText("Gacha_NewBieSaveRecordTip") or "", c))
|
||||
self._mapNode.GachaNewBieShowRecordItemC:SetItems(newbieData.Temp, 0)
|
||||
self.selectIdx = 1
|
||||
for idx, card in ipairs(newbieData.Cards) do
|
||||
self._mapNode.GachaNewBieRecordItem[idx].gameObject:SetActive(true)
|
||||
self._mapNode.GachaNewBieRecordItem[idx]:SetItems(card, idx)
|
||||
if self.selectIdx == idx then
|
||||
self._mapNode.GachaNewBieRecordItem[idx]:SetSelect(true)
|
||||
else
|
||||
self._mapNode.GachaNewBieRecordItem[idx]:SetSelect(false)
|
||||
end
|
||||
end
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self.animRoot:Play("t_window_04_t_in")
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
self.bClose = false
|
||||
end
|
||||
return GachaNewBieSaveRecordCtrl
|
||||
@@ -0,0 +1,149 @@
|
||||
local GachaNewBieShowRecordCtrl = class("GachaNewBieShowRecordCtrl", BaseCtrl)
|
||||
GachaNewBieShowRecordCtrl._mapNodeConfig = {
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_NewBieShowTitle"
|
||||
},
|
||||
txtBtnCancel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_NewBieShowCancel"
|
||||
},
|
||||
txtBtnOk = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_NewBieShowOk"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnCancel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnConfirm1 = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Confirm"
|
||||
},
|
||||
GachaNewBieRecordItem = {
|
||||
sCtrlName = "Game.UI.GachaEx.GachaNewBieRecordItemCtrl",
|
||||
nCount = 5
|
||||
},
|
||||
GachaNewBieRecordItemC = {
|
||||
sCtrlName = "Game.UI.GachaEx.GachaNewBieRecordItemCtrl"
|
||||
},
|
||||
btnItem = {
|
||||
sNodeName = "GachaNewBieRecordItem",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Item",
|
||||
nCount = 5
|
||||
},
|
||||
btnItemC = {
|
||||
sNodeName = "GachaNewBieRecordItemC",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_ItemC"
|
||||
},
|
||||
CloseButton = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
}
|
||||
}
|
||||
GachaNewBieShowRecordCtrl._mapEventConfig = {}
|
||||
function GachaNewBieShowRecordCtrl:Awake()
|
||||
end
|
||||
function GachaNewBieShowRecordCtrl:FadeIn()
|
||||
end
|
||||
function GachaNewBieShowRecordCtrl:FadeOut()
|
||||
end
|
||||
function GachaNewBieShowRecordCtrl:OnEnable()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
self.bClose = true
|
||||
end
|
||||
function GachaNewBieShowRecordCtrl:OnDisable()
|
||||
end
|
||||
function GachaNewBieShowRecordCtrl:OnDestroy()
|
||||
end
|
||||
function GachaNewBieShowRecordCtrl:OnBtnClick_Close()
|
||||
if self.bClose then
|
||||
return
|
||||
end
|
||||
local Close = function()
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
self.animRoot:Play("t_window_04_t_out")
|
||||
self:AddTimer(1, 0.2, Close, true, true, true)
|
||||
self.bClose = true
|
||||
end
|
||||
function GachaNewBieShowRecordCtrl:OnBtnClick_Confirm()
|
||||
if self.bClose then
|
||||
return
|
||||
end
|
||||
local newbieData = PlayerData.Gacha:GetGachaNewbieData(self.curPoolId)
|
||||
if newbieData == nil then
|
||||
return
|
||||
end
|
||||
local items = {}
|
||||
if self.selectIdx == 0 then
|
||||
items = newbieData.Temp
|
||||
elseif self.selectIdx > 0 then
|
||||
items = newbieData.Cards[self.selectIdx]
|
||||
end
|
||||
EventManager.Hit("GachaNewbieObtainRecord", self.selectIdx, items)
|
||||
end
|
||||
function GachaNewBieShowRecordCtrl:OnBtnClick_Item(btn, nIndex)
|
||||
if self.selectIdx == nIndex then
|
||||
return
|
||||
end
|
||||
if self.selectIdx == 0 then
|
||||
self._mapNode.GachaNewBieRecordItemC:SetSelect(false)
|
||||
elseif self.selectIdx > 0 then
|
||||
self._mapNode.GachaNewBieRecordItem[self.selectIdx]:SetSelect(false)
|
||||
end
|
||||
self._mapNode.GachaNewBieRecordItem[nIndex]:SetSelect(true)
|
||||
self.selectIdx = nIndex
|
||||
end
|
||||
function GachaNewBieShowRecordCtrl:OnBtnClick_ItemC()
|
||||
if self.selectIdx == 0 then
|
||||
return
|
||||
end
|
||||
if self.selectIdx > 0 then
|
||||
self._mapNode.GachaNewBieRecordItem[self.selectIdx]:SetSelect(false)
|
||||
end
|
||||
self._mapNode.GachaNewBieRecordItemC:SetSelect(true)
|
||||
self.selectIdx = 0
|
||||
end
|
||||
function GachaNewBieShowRecordCtrl:SetPoolId(id)
|
||||
self.curPoolId = id
|
||||
local newbieData = PlayerData.Gacha:GetGachaNewbieData(self.curPoolId)
|
||||
if newbieData == nil then
|
||||
return
|
||||
end
|
||||
self.selectIdx = -1
|
||||
if newbieData.Temp == nil or #newbieData.Temp == 0 then
|
||||
self._mapNode.GachaNewBieRecordItemC.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.GachaNewBieRecordItemC.gameObject:SetActive(true)
|
||||
self._mapNode.GachaNewBieRecordItemC:SetItems(newbieData.Temp, 0)
|
||||
self._mapNode.GachaNewBieRecordItemC:SetSelect(true)
|
||||
self.selectIdx = 0
|
||||
end
|
||||
for i = 1, 5 do
|
||||
self._mapNode.GachaNewBieRecordItem[i].gameObject:SetActive(false)
|
||||
end
|
||||
for idx, card in ipairs(newbieData.Cards) do
|
||||
self._mapNode.GachaNewBieRecordItem[idx].gameObject:SetActive(true)
|
||||
self._mapNode.GachaNewBieRecordItem[idx]:SetItems(card, idx)
|
||||
if self.selectIdx < 0 then
|
||||
self._mapNode.GachaNewBieRecordItem[idx]:SetSelect(true)
|
||||
self.selectIdx = idx
|
||||
else
|
||||
self._mapNode.GachaNewBieRecordItem[idx]:SetSelect(false)
|
||||
end
|
||||
end
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self.animRoot:Play("t_window_04_t_in")
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
self.bClose = false
|
||||
end
|
||||
return GachaNewBieShowRecordCtrl
|
||||
@@ -0,0 +1,41 @@
|
||||
local GachaNewBieShowRecordItemCtrl = class("GachaNewBieShowRecordItemCtrl", BaseCtrl)
|
||||
GachaNewBieShowRecordItemCtrl._mapNodeConfig = {
|
||||
rtItem = {
|
||||
sNodeName = "item",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl",
|
||||
nCount = 10
|
||||
},
|
||||
imgRec = {sNodeName = "imgRec_", nCount = 10},
|
||||
txt_line = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
GachaNewBieShowRecordItemCtrl._mapEventConfig = {}
|
||||
function GachaNewBieShowRecordItemCtrl:Awake()
|
||||
end
|
||||
function GachaNewBieShowRecordItemCtrl:FadeIn()
|
||||
end
|
||||
function GachaNewBieShowRecordItemCtrl:FadeOut()
|
||||
end
|
||||
function GachaNewBieShowRecordItemCtrl:OnEnable()
|
||||
end
|
||||
function GachaNewBieShowRecordItemCtrl:OnDisable()
|
||||
end
|
||||
function GachaNewBieShowRecordItemCtrl:OnDestroy()
|
||||
end
|
||||
function GachaNewBieShowRecordItemCtrl:SetItems(items, idx)
|
||||
if idx == 0 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_line, ConfigTable.GetUIText("Gacha_NewBieSaveItemCurrent"))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_line, orderedFormat(ConfigTable.GetUIText("Gacha_NewBieSaveItem") or "", idx))
|
||||
end
|
||||
for idx, v in ipairs(items) do
|
||||
if v ~= 0 then
|
||||
self._mapNode.rtItem[idx].gameObject:SetActive(true)
|
||||
self._mapNode.rtItem[idx]:SetItem(v)
|
||||
local mapItemCfg = ConfigTable.GetData_Item(v)
|
||||
self._mapNode.imgRec[idx]:SetActive(mapItemCfg ~= nil and mapItemCfg.Rarity == GameEnum.itemRarity.SSR)
|
||||
else
|
||||
self._mapNode.rtItem[idx].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
return GachaNewBieShowRecordItemCtrl
|
||||
@@ -0,0 +1,179 @@
|
||||
local GachaNewBieShowResultCtrl = class("GachaNewBieShowResultCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
GachaNewBieShowResultCtrl._mapNodeConfig = {
|
||||
Item = {
|
||||
sCtrlName = "Game.UI.GachaEx.GachaShowResultGrid",
|
||||
nCount = 10
|
||||
},
|
||||
txt_newbie_result_save = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_NewBieSaveResult"
|
||||
},
|
||||
txt_newbie_result_summon = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_NewBieResultSummonAgain"
|
||||
},
|
||||
txt_newbie_result_summon_remain = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_NewBieRecordResultRemain"
|
||||
},
|
||||
txt_newbie_result_record = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_NewBieRecordResult"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btn_newbie_save = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Save"
|
||||
},
|
||||
btn_newbie_summon = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Summon"
|
||||
},
|
||||
btn_newbie_record = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Record"
|
||||
}
|
||||
}
|
||||
GachaNewBieShowResultCtrl._mapEventConfig = {
|
||||
Guide_GachaStart = "OnEvent_Guide_GachaStart"
|
||||
}
|
||||
function GachaNewBieShowResultCtrl:Awake()
|
||||
self.remainCount = -1
|
||||
end
|
||||
function GachaNewBieShowResultCtrl:FadeIn()
|
||||
end
|
||||
function GachaNewBieShowResultCtrl:FadeOut()
|
||||
end
|
||||
function GachaNewBieShowResultCtrl:OnEnable()
|
||||
self.GuideBlock = false
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
function GachaNewBieShowResultCtrl:OnDisable()
|
||||
end
|
||||
function GachaNewBieShowResultCtrl:OnDestroy()
|
||||
end
|
||||
function GachaNewBieShowResultCtrl:OnRelease()
|
||||
end
|
||||
function GachaNewBieShowResultCtrl:RefreshInfo()
|
||||
if self.curPoolId == nil then
|
||||
return
|
||||
end
|
||||
local newbie = ConfigTable.GetData("GachaNewbie", self.curPoolId)
|
||||
if newbie == nil then
|
||||
return
|
||||
end
|
||||
local newbieData = PlayerData.Gacha:GetGachaNewbieData(self.curPoolId)
|
||||
if newbieData == nil then
|
||||
return
|
||||
end
|
||||
local c = tostring(#newbieData.Cards) .. "/" .. tostring(newbie.SaveCount)
|
||||
local nTotalCount = newbie.SpinCount
|
||||
local remainCount = nTotalCount - newbieData.Times
|
||||
if #newbieData.Temp == 0 or remainCount == 0 then
|
||||
self._mapNode.btn_newbie_save.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.btn_newbie_save.gameObject:SetActive(true)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_newbie_result_record, orderedFormat(ConfigTable.GetUIText("Gacha_NewBieRecordResult") or "", c))
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_newbie_result_summon_remain, orderedFormat(ConfigTable.GetUIText("Gacha_NewBieRecordResultRemain") or "", remainCount))
|
||||
if remainCount <= 0 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_newbie_result_summon, ConfigTable.GetUIText("Gacha_Newbie_BtnShowRecord"))
|
||||
end
|
||||
self.remainCount = remainCount
|
||||
end
|
||||
function GachaNewBieShowResultCtrl:ShowResult(tbReward, poolId)
|
||||
self.curPoolId = poolId
|
||||
WwiseAudioMgr:PlaySound("ui_recuit_gacha_result")
|
||||
self:RefreshInfo()
|
||||
self.curStep = 1
|
||||
local nDelayTime = 0
|
||||
self.hasSSR = false
|
||||
for i = 1, 10 do
|
||||
if tbReward[i] ~= nil then
|
||||
self._mapNode.Item[i].gameObject:SetActive(true)
|
||||
local itemTime = self._mapNode.Item[i]:Refresh(tbReward[i].id, tbReward[i].bNew, nDelayTime)
|
||||
local mapItemCfg = ConfigTable.GetData_Item(tbReward[i].id)
|
||||
nDelayTime = nDelayTime + itemTime
|
||||
if mapItemCfg ~= nil and mapItemCfg.Rarity == GameEnum.itemRarity.SSR then
|
||||
self.hasSSR = true
|
||||
end
|
||||
else
|
||||
self._mapNode.Item[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
local AllCardShowCallback = function()
|
||||
self.curStep = 2
|
||||
self.delayTimer = nil
|
||||
for i = 1, 10 do
|
||||
self._mapNode.Item[i]:ShowAllCardEnd()
|
||||
end
|
||||
EventManager.Hit("Guide_GachaFinish")
|
||||
self:BlockJump(0.5)
|
||||
end
|
||||
self.delayTimer = self:AddTimer(1, nDelayTime, AllCardShowCallback, true, true, nil, nil)
|
||||
end
|
||||
function GachaNewBieShowResultCtrl:BlockJump(nTime)
|
||||
self.bBlockJump = true
|
||||
local unBlockJump = function()
|
||||
self.bBlockJump = false
|
||||
end
|
||||
self:AddTimer(1, nTime, unBlockJump, true, true, nil, nil)
|
||||
end
|
||||
function GachaNewBieShowResultCtrl:OnBtnClick_Close()
|
||||
if self.bBlockJump then
|
||||
return
|
||||
end
|
||||
if self.curStep == 1 then
|
||||
for i = 1, 10 do
|
||||
self._mapNode.Item[i]:JumpDelay()
|
||||
end
|
||||
if self.delayTimer ~= nil then
|
||||
self.delayTimer:Cancel(true)
|
||||
end
|
||||
else
|
||||
self.gameObject:SetActive(false)
|
||||
WwiseAudioMgr:SetState("recruit_rarity", "None")
|
||||
for i = 1, 10 do
|
||||
self._mapNode.Item[i].gameObject:SetActive(false)
|
||||
end
|
||||
PlayerData.Item:TryOpenFragmentsOverflow(function()
|
||||
PlayerData.Phone:CheckNewChat()
|
||||
end)
|
||||
end
|
||||
end
|
||||
function GachaNewBieShowResultCtrl:OnBtnClick_Save()
|
||||
if self.GuideBlock then
|
||||
return
|
||||
end
|
||||
EventManager.Hit("GachaNewbieSaveRecord")
|
||||
self.hasSSR = false
|
||||
end
|
||||
function GachaNewBieShowResultCtrl:OnBtnClick_Summon()
|
||||
local ConfirmCallback = function()
|
||||
EventManager.Hit("GachaNewbieSpin")
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = ConfigTable.GetUIText("Gacha_Newbie_RecordSSRHint"),
|
||||
callbackConfirm = ConfirmCallback,
|
||||
bDisableSnap = false
|
||||
}
|
||||
if self.remainCount == 0 then
|
||||
self:OnBtnClick_Record()
|
||||
elseif self.hasSSR then
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
else
|
||||
ConfirmCallback()
|
||||
end
|
||||
end
|
||||
function GachaNewBieShowResultCtrl:OnBtnClick_Record()
|
||||
EventManager.Hit("GachaNewbieRecord")
|
||||
end
|
||||
function GachaNewBieShowResultCtrl:OnEvent_Guide_GachaStart(bBlock)
|
||||
self.GuideBlock = bBlock
|
||||
end
|
||||
return GachaNewBieShowResultCtrl
|
||||
@@ -0,0 +1,18 @@
|
||||
local GachaPanel = class("GachaPanel", BasePanel)
|
||||
GachaPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "GachaEx/GachaPanel.prefab",
|
||||
sCtrlName = "Game.UI.GachaEx.GachaCtrl"
|
||||
}
|
||||
}
|
||||
function GachaPanel:Awake()
|
||||
end
|
||||
function GachaPanel:OnEnable()
|
||||
end
|
||||
function GachaPanel:OnDisable()
|
||||
end
|
||||
function GachaPanel:OnDestroy()
|
||||
end
|
||||
function GachaPanel:OnRelease()
|
||||
end
|
||||
return GachaPanel
|
||||
@@ -0,0 +1,111 @@
|
||||
local GachaPreviewCtrl = class("GachaPreviewCtrl", BaseCtrl)
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
GachaPreviewCtrl._mapNodeConfig = {
|
||||
rtCharinfo = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateCharInfoCtrl"
|
||||
},
|
||||
TopBarPanel = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
RimgL2d = {sComponentName = "RawImage"},
|
||||
btnSkill = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Skill"
|
||||
},
|
||||
btnPerk = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Perk"
|
||||
},
|
||||
btnHeartStone = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_HeartStone"
|
||||
},
|
||||
TMPSkill = {
|
||||
sComponentName = "TMP_Text",
|
||||
nCount = 2,
|
||||
sLanguageId = "SelectMember_Skill"
|
||||
},
|
||||
TMPPerk = {
|
||||
sComponentName = "TMP_Text",
|
||||
nCount = 2,
|
||||
sLanguageId = "Perk_Exclusive"
|
||||
},
|
||||
TMPHeartStone = {
|
||||
sComponentName = "TMP_Text",
|
||||
nCount = 2,
|
||||
sLanguageId = "HeartStone"
|
||||
},
|
||||
imgTab = {nCount = 3},
|
||||
rtSkillList = {
|
||||
sCtrlName = "Game.UI.GachaEx.GachaPreview.SkillListCtrl"
|
||||
},
|
||||
rtExPerkList = {
|
||||
sCtrlName = "Game.UI.GachaEx.GachaPreview.PerkListCtrl"
|
||||
},
|
||||
rtHeartStoneList = {
|
||||
sCtrlName = "Game.UI.GachaEx.GachaPreview.HeartStoneListCtrl"
|
||||
}
|
||||
}
|
||||
GachaPreviewCtrl._mapEventConfig = {}
|
||||
function GachaPreviewCtrl:Awake()
|
||||
end
|
||||
function GachaPreviewCtrl:FadeIn()
|
||||
end
|
||||
function GachaPreviewCtrl:FadeOut()
|
||||
end
|
||||
function GachaPreviewCtrl:OnEnable()
|
||||
self.curTab = 1
|
||||
local tbParam = self:GetPanelParam()
|
||||
self.nCharId = tbParam[1]
|
||||
if self.nCharId == nil then
|
||||
return
|
||||
end
|
||||
self._mapNode.rtSkillList:Refresh(self.nCharId)
|
||||
self._mapNode.rtCharinfo:Refresh({
|
||||
nLevel = self:CalCharMaxLevel(self.nCharId)
|
||||
}, ConfigTable.GetData_Character(self.nCharId))
|
||||
self._mapNode.rtSkillList.gameObject:SetActive(true)
|
||||
self._mapNode.rtExPerkList:SetShow(false)
|
||||
self._mapNode.rtHeartStoneList.gameObject:SetActive(false)
|
||||
for i = 1, 3 do
|
||||
self._mapNode.imgTab[i]:SetActive(i == self.curTab)
|
||||
end
|
||||
local mapCharCfgData = ConfigTable.GetData_Character(self.nCharId)
|
||||
Actor2DManager.SetActor2D(self:GetPanelId(), self._mapNode.RimgL2d, self.nCharId, mapCharCfgData.AdvanceSkinId)
|
||||
end
|
||||
function GachaPreviewCtrl:CalCharMaxLevel(nCharId)
|
||||
local nMaxLevel = 0
|
||||
local mapCharCfgData = ConfigTable.GetData_Character(nCharId)
|
||||
local forEach = function(mapData)
|
||||
if mapData.Grade == mapCharCfgData.Grade and tonumber(mapData.LvLimit) > nMaxLevel then
|
||||
nMaxLevel = tonumber(mapData.LvLimit)
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.CharRaritySequence, forEach)
|
||||
return nMaxLevel
|
||||
end
|
||||
function GachaPreviewCtrl:OnDisable()
|
||||
Actor2DManager.UnsetActor2D()
|
||||
end
|
||||
function GachaPreviewCtrl:OnDestroy()
|
||||
end
|
||||
function GachaPreviewCtrl:OnRelease()
|
||||
end
|
||||
function GachaPreviewCtrl:OnBtnClick_Skill()
|
||||
if self.curTab == 1 then
|
||||
return
|
||||
end
|
||||
self.curTab = 1
|
||||
for i = 1, 3 do
|
||||
self._mapNode.imgTab[i]:SetActive(i == self.curTab)
|
||||
end
|
||||
self._mapNode.rtSkillList.gameObject:SetActive(true)
|
||||
self._mapNode.rtExPerkList:SetShow(false)
|
||||
self._mapNode.rtHeartStoneList.gameObject:SetActive(false)
|
||||
end
|
||||
function GachaPreviewCtrl:OnBtnClick_Perk()
|
||||
end
|
||||
function GachaPreviewCtrl:OnBtnClick_HeartStone()
|
||||
end
|
||||
return GachaPreviewCtrl
|
||||
@@ -0,0 +1,19 @@
|
||||
local GachaPreviewPanel = class("GachaPreviewPanel", BasePanel)
|
||||
GachaPreviewPanel._bIsMainPanel = false
|
||||
GachaPreviewPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "GachaEx/GachaCharInfoPanel.prefab",
|
||||
sCtrlName = "Game.UI.GachaEx.GachaPreview.GachaPreviewCtrl"
|
||||
}
|
||||
}
|
||||
function GachaPreviewPanel:Awake()
|
||||
end
|
||||
function GachaPreviewPanel:OnEnable()
|
||||
end
|
||||
function GachaPreviewPanel:OnDisable()
|
||||
end
|
||||
function GachaPreviewPanel:OnDestroy()
|
||||
end
|
||||
function GachaPreviewPanel:OnRelease()
|
||||
end
|
||||
return GachaPreviewPanel
|
||||
@@ -0,0 +1,127 @@
|
||||
local HeartStoneListCtrl = class("HeartStoneListCtrl", BaseCtrl)
|
||||
local HeartStoneTypeEnum = {
|
||||
[1] = {
|
||||
HeartStoneIndex = 1,
|
||||
icon = "zs_heartstone_lv_a",
|
||||
selecticon = "zs_heartstone_1"
|
||||
},
|
||||
[2] = {
|
||||
HeartStoneIndex = 2,
|
||||
icon = "zs_heartstone_lv_b",
|
||||
selecticon = "zs_heartstone_2"
|
||||
},
|
||||
[3] = {
|
||||
HeartStoneIndex = 3,
|
||||
icon = "zs_heartstone_lv_c",
|
||||
selecticon = "zs_heartstone_3"
|
||||
},
|
||||
[4] = {
|
||||
HeartStoneIndex = 4,
|
||||
icon = "zs_heartstone_lv_d",
|
||||
selecticon = "zs_heartstone_4"
|
||||
},
|
||||
[5] = {
|
||||
HeartStoneIndex = 5,
|
||||
icon = "zs_heartstone_lv_e",
|
||||
selecticon = "zs_heartstone_5"
|
||||
},
|
||||
[6] = {
|
||||
HeartStoneIndex = 6,
|
||||
icon = "zs_heartstone_lv_f",
|
||||
selecticon = "zs_heartstone_6"
|
||||
},
|
||||
[7] = {
|
||||
HeartStoneIndex = 7,
|
||||
icon = "zs_heartstone_lv_g",
|
||||
selecticon = "zs_heartstone_7"
|
||||
},
|
||||
[8] = {
|
||||
HeartStoneIndex = 8,
|
||||
icon = "zs_heartstone_lv_h",
|
||||
selecticon = "zs_heartstone_8"
|
||||
},
|
||||
[9] = {
|
||||
HeartStoneIndex = 9,
|
||||
icon = "zs_heartstone_lv_i",
|
||||
selecticon = "zs_heartstone_9"
|
||||
},
|
||||
[10] = {
|
||||
HeartStoneIndex = 10,
|
||||
icon = "zs_heartstone_lv_j",
|
||||
selecticon = "zs_heartstone_10"
|
||||
},
|
||||
[11] = {
|
||||
HeartStoneIndex = 11,
|
||||
icon = "zs_heartstone_lv_k",
|
||||
selecticon = "zs_heartstone_11"
|
||||
},
|
||||
[12] = {
|
||||
HeartStoneIndex = 12,
|
||||
icon = "zs_heartstone_lv_l",
|
||||
selecticon = "zs_heartstone_12"
|
||||
},
|
||||
[13] = {
|
||||
HeartStoneIndex = 13,
|
||||
icon = "zs_heartstone_lv_m",
|
||||
selecticon = "zs_heartstone_13"
|
||||
},
|
||||
[14] = {
|
||||
HeartStoneIndex = 14,
|
||||
icon = "zs_heartstone_lv_n",
|
||||
selecticon = "zs_heartstone_14"
|
||||
},
|
||||
[15] = {
|
||||
HeartStoneIndex = 15,
|
||||
icon = "zs_heartstone_lv_o",
|
||||
selecticon = "zs_heartstone_15"
|
||||
},
|
||||
[16] = {
|
||||
HeartStoneIndex = 16,
|
||||
icon = "zs_heartstone_lv_p",
|
||||
selecticon = "zs_heartstone_16"
|
||||
}
|
||||
}
|
||||
HeartStoneListCtrl._mapNodeConfig = {
|
||||
rtHeartStoneGrid = {nCount = 6, sComponentName = "Transform"}
|
||||
}
|
||||
HeartStoneListCtrl._mapEventConfig = {}
|
||||
function HeartStoneListCtrl:Awake()
|
||||
end
|
||||
function HeartStoneListCtrl:FadeIn()
|
||||
end
|
||||
function HeartStoneListCtrl:FadeOut()
|
||||
end
|
||||
function HeartStoneListCtrl:OnEnable()
|
||||
end
|
||||
function HeartStoneListCtrl:OnDisable()
|
||||
end
|
||||
function HeartStoneListCtrl:OnDestroy()
|
||||
end
|
||||
function HeartStoneListCtrl:OnRelease()
|
||||
end
|
||||
function HeartStoneListCtrl:Refresh(nCharId)
|
||||
self.nCharId = nCharId
|
||||
local HeartStoneType = ConfigTable.GetData_Character(self.nCharId).HeartStone
|
||||
self.mapHeartStoneType = HeartStoneTypeEnum[HeartStoneType]
|
||||
local rootPath = "Icon/ZZZOther/"
|
||||
local sybolType = 3
|
||||
for i = 1, 6 do
|
||||
local SymbolPath = rootPath .. self.mapHeartStoneType.icon .. tostring(i) .. tostring(sybolType)
|
||||
self:SetGrid(self._mapNode.rtHeartStoneGrid[i], self.nCharId * 100 + i, SymbolPath)
|
||||
end
|
||||
end
|
||||
function HeartStoneListCtrl:SetGrid(rtGrid, nHeartStoneId, sPath)
|
||||
local mapHeartStone = ConfigTable.GetData("CharacterHeartStone", nHeartStoneId)
|
||||
if mapHeartStone == nil then
|
||||
rtGrid.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
rtGrid.gameObject:SetActive(true)
|
||||
local imgIcon = rtGrid:Find("imgTitleBg/imgHeartStoneIcon"):GetComponent("Image")
|
||||
local TMPTitle = rtGrid:Find("imgTitleBg/TMPTitle"):GetComponent("TMP_Text")
|
||||
local TMPDesc = rtGrid:Find("srHeartStoneDesc/TMPDesc"):GetComponent("TMP_Text")
|
||||
self:SetPngSprite(imgIcon, sPath)
|
||||
NovaAPI.SetTMPText(TMPTitle, orderedFormat(ConfigTable.GetUIText("HeartStone_Level"), mapHeartStone.Level))
|
||||
NovaAPI.SetTMPText(TMPDesc, mapHeartStone.Desc)
|
||||
end
|
||||
return HeartStoneListCtrl
|
||||
@@ -0,0 +1,72 @@
|
||||
local SkillListGridCtrl = class("SkillListGridCtrl", BaseCtrl)
|
||||
local ConfigData = require("GameCore.Data.ConfigData")
|
||||
local minHeight = 178.84
|
||||
local defaultWidth = 673
|
||||
SkillListGridCtrl._mapNodeConfig = {
|
||||
imgPerkIcon = {sComponentName = "Image"},
|
||||
TMPPerkTitle = {sComponentName = "TMP_Text"},
|
||||
TMPDesc = {sComponentName = "TMP_Text"},
|
||||
rtTMPDesc = {
|
||||
sNodeName = "TMPDesc",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgDescBg = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
TMP_Link = {
|
||||
sNodeName = "TMPDesc",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnBtnClick_Word"
|
||||
}
|
||||
}
|
||||
SkillListGridCtrl._mapEventConfig = {}
|
||||
function SkillListGridCtrl:Awake()
|
||||
end
|
||||
function SkillListGridCtrl:FadeIn()
|
||||
end
|
||||
function SkillListGridCtrl:FadeOut()
|
||||
end
|
||||
function SkillListGridCtrl:OnEnable()
|
||||
end
|
||||
function SkillListGridCtrl:OnDisable()
|
||||
end
|
||||
function SkillListGridCtrl:OnDestroy()
|
||||
end
|
||||
function SkillListGridCtrl:OnRelease()
|
||||
end
|
||||
function SkillListGridCtrl:SetPerk(nPerkId)
|
||||
if nPerkId == 0 or nPerkId == nil then
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
local perkCfgData = ConfigTable.GetData_Perk(nPerkId)
|
||||
local perkItemCfgData = ConfigTable.GetData_Item(nPerkId)
|
||||
if perkCfgData == nil or perkItemCfgData == nil then
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
local skillId = perkCfgData.EffectGroupId * 100 + 1
|
||||
local mapSkill = ConfigTable.GetData("PerkPassiveSkill", skillId)
|
||||
if mapSkill == nil then
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
self.gameObject:SetActive(true)
|
||||
local sDesc = UTILS.SubDesc(mapSkill.Desc)
|
||||
NovaAPI.SetTMPSourceText(self._mapNode.TMPDesc, sDesc)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPPerkTitle, perkItemCfgData.Title)
|
||||
self:SetPngSprite(self._mapNode.imgPerkIcon, perkItemCfgData.Icon)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
local height = self._mapNode.rtTMPDesc.sizeDelta.y
|
||||
if height < minHeight then
|
||||
height = minHeight
|
||||
end
|
||||
self._mapNode.imgDescBg.sizeDelta = Vector2(defaultWidth, height)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function SkillListGridCtrl:OnBtnClick_Word(link, sWordId)
|
||||
UTILS.ClickWordLink(link, sWordId)
|
||||
end
|
||||
return SkillListGridCtrl
|
||||
@@ -0,0 +1,81 @@
|
||||
local PerkListCtrl = class("PerkListCtrl", BaseCtrl)
|
||||
PerkListCtrl._mapNodeConfig = {
|
||||
tog = {
|
||||
sComponentName = "UIButton",
|
||||
nCount = 2,
|
||||
callback = "OnBtnClick_Tog"
|
||||
},
|
||||
togCtrl = {
|
||||
sNodeName = "tog",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl",
|
||||
nCount = 2
|
||||
},
|
||||
rtExPerkGrid = {
|
||||
nCount = 4,
|
||||
sCtrlName = "Game.UI.GachaEx.GachaPreview.PerkGridCtrl"
|
||||
}
|
||||
}
|
||||
PerkListCtrl._mapEventConfig = {}
|
||||
function PerkListCtrl:Awake()
|
||||
self.curTog = 1
|
||||
self.canvasGroup = self.gameObject:GetComponent("CanvasGroup")
|
||||
end
|
||||
function PerkListCtrl:FadeIn()
|
||||
end
|
||||
function PerkListCtrl:FadeOut()
|
||||
end
|
||||
function PerkListCtrl:OnEnable()
|
||||
for i = 1, 2 do
|
||||
self._mapNode.togCtrl[i]:SetDefault(i == self.curTog)
|
||||
end
|
||||
self._mapNode.togCtrl[1]:SetText(ConfigTable.GetUIText("Build_Leader"))
|
||||
self._mapNode.togCtrl[2]:SetText(ConfigTable.GetUIText("Build_Sub"))
|
||||
end
|
||||
function PerkListCtrl:OnDisable()
|
||||
end
|
||||
function PerkListCtrl:OnDestroy()
|
||||
end
|
||||
function PerkListCtrl:OnRelease()
|
||||
end
|
||||
function PerkListCtrl:SetShow(bShow)
|
||||
if bShow then
|
||||
NovaAPI.SetCanvasGroupAlpha(self.canvasGroup, 1)
|
||||
NovaAPI.SetCanvasGroupBlocksRaycasts(self.canvasGroup, true)
|
||||
else
|
||||
NovaAPI.SetCanvasGroupAlpha(self.canvasGroup, 0)
|
||||
NovaAPI.SetCanvasGroupBlocksRaycasts(self.canvasGroup, false)
|
||||
end
|
||||
end
|
||||
function PerkListCtrl:Refresh(nCharId)
|
||||
self.nCharId = nCharId
|
||||
local mapCharCfgData = ConfigTable.GetData_Character(nCharId)
|
||||
if mapCharCfgData == nil then
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
if #mapCharCfgData.Weapons < 1 then
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
local nWeaponId = mapCharCfgData.Weapons[#mapCharCfgData.Weapons]
|
||||
local mapWeaponCfgData = ConfigTable.GetData("Weapon", nWeaponId)
|
||||
local tbPerks
|
||||
if self.curTog == 1 then
|
||||
tbPerks = mapWeaponCfgData.MasterSpecificPerkIds
|
||||
else
|
||||
tbPerks = mapWeaponCfgData.AssistSpecificPerkIds
|
||||
end
|
||||
for index = 1, 4 do
|
||||
self._mapNode.rtExPerkGrid[index]:SetPerk(tbPerks[index])
|
||||
end
|
||||
end
|
||||
function PerkListCtrl:OnBtnClick_Tog(tog)
|
||||
local togIdx = table.indexof(self._mapNode.tog, tog)
|
||||
if togIdx ~= self.curTog then
|
||||
self._mapNode.togCtrl[togIdx]:SetTrigger(true)
|
||||
self._mapNode.togCtrl[self.curTog]:SetTrigger(false)
|
||||
self.curTog = togIdx
|
||||
self:Refresh(self.nCharId)
|
||||
end
|
||||
end
|
||||
return PerkListCtrl
|
||||
@@ -0,0 +1,64 @@
|
||||
local SkillListCtrl = class("SkillListCtrl", BaseCtrl)
|
||||
SkillListCtrl._mapNodeConfig = {
|
||||
rtSkillGrid = {
|
||||
nCount = 4,
|
||||
sCtrlName = "Game.UI.GachaEx.GachaPreview.SkillListGridCtrl"
|
||||
},
|
||||
txtTalentTitle = {sComponentName = "TMP_Text"},
|
||||
imgTalentBg = {sComponentName = "Image"},
|
||||
imgTalent = {sComponentName = "Image"},
|
||||
txtTalentName = {sComponentName = "TMP_Text"},
|
||||
TMPDescTalent = {sComponentName = "TMP_Text"},
|
||||
TMP_Link = {
|
||||
sNodeName = "TMPDescTalent",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnBtnClick_Word"
|
||||
}
|
||||
}
|
||||
SkillListCtrl._mapEventConfig = {}
|
||||
function SkillListCtrl:Awake()
|
||||
end
|
||||
function SkillListCtrl:FadeIn()
|
||||
end
|
||||
function SkillListCtrl:FadeOut()
|
||||
end
|
||||
function SkillListCtrl:OnEnable()
|
||||
end
|
||||
function SkillListCtrl:OnDisable()
|
||||
end
|
||||
function SkillListCtrl:OnDestroy()
|
||||
end
|
||||
function SkillListCtrl:OnRelease()
|
||||
end
|
||||
function SkillListCtrl:Refresh(nCharId)
|
||||
local mapCharCfgData = ConfigTable.GetData_Character(nCharId)
|
||||
if mapCharCfgData == nil then
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
local mapSkillNormal = ConfigTable.GetData_Skill(mapCharCfgData.NormalAtkId)
|
||||
local mapSkillMain = ConfigTable.GetData_Skill(mapCharCfgData.SkillId)
|
||||
local mapSkillAssist = ConfigTable.GetData_Skill(mapCharCfgData.AssistSkillId)
|
||||
local mapSkillUltra = ConfigTable.GetData_Skill(mapCharCfgData.UltimateId)
|
||||
local mapSkillTalent = ConfigTable.GetData_Skill(mapCharCfgData.TalentSkillId)
|
||||
local nNormalMaxLevel = PlayerData.Char:GetCharSkillMaxLevel(nCharId, 1)
|
||||
local nMainMaxLevel = PlayerData.Char:GetCharSkillMaxLevel(nCharId, 2)
|
||||
local nAssistMaxLevel = PlayerData.Char:GetCharSkillMaxLevel(nCharId, 3)
|
||||
local nUltraMaxLevel = PlayerData.Char:GetCharSkillMaxLevel(nCharId, 4)
|
||||
self._mapNode.rtSkillGrid[1]:SetSkill(mapSkillNormal.Id, nNormalMaxLevel, nCharId, 1)
|
||||
self._mapNode.rtSkillGrid[2]:SetSkill(mapSkillMain.Id, nMainMaxLevel, nCharId, 2)
|
||||
self._mapNode.rtSkillGrid[3]:SetSkill(mapSkillAssist.Id, nAssistMaxLevel, nCharId, 3)
|
||||
self._mapNode.rtSkillGrid[4]:SetSkill(mapSkillUltra.Id, nUltraMaxLevel, nCharId, 4)
|
||||
if nil ~= mapSkillTalent then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTalentName, mapSkillTalent.Title)
|
||||
local _, color = ColorUtility.TryParseHtmlString(AllEnum.SkillElementColor[mapCharCfgData.EET])
|
||||
NovaAPI.SetImageColor(self._mapNode.imgTalentBg, color)
|
||||
local sDesc = UTILS.ParseDesc(mapSkillTalent)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDescTalent, sDesc)
|
||||
self:SetPngSprite(self._mapNode.imgTalent, mapSkillTalent.Icon)
|
||||
end
|
||||
end
|
||||
function SkillListCtrl:OnBtnClick_Word(link, sWordId)
|
||||
UTILS.ClickWordLink(link, sWordId)
|
||||
end
|
||||
return SkillListCtrl
|
||||
@@ -0,0 +1,94 @@
|
||||
local SkillListGridCtrl = class("SkillListGridCtrl", BaseCtrl)
|
||||
local ConfigData = require("GameCore.Data.ConfigData")
|
||||
SkillListGridCtrl._mapNodeConfig = {
|
||||
imgSkillIconBg = {sComponentName = "Image"},
|
||||
imgzsIcon = {sComponentName = "Image"},
|
||||
imgIconSkill = {sComponentName = "Image"},
|
||||
imgSkillTypeBg = {sComponentName = "Image"},
|
||||
txtSkillType = {sComponentName = "TMP_Text"},
|
||||
imgSkillType = {sComponentName = "Image"},
|
||||
TMPTitle = {sComponentName = "TMP_Text"},
|
||||
txtSkillLevel = {sComponentName = "TMP_Text"},
|
||||
imgEnergyInfoBg = {},
|
||||
imgCDInfoBg = {},
|
||||
srSkillDesc = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
TMPCDTitle = {sComponentName = "TMP_Text", sLanguageId = "Talent_CD"},
|
||||
TMPCD = {sComponentName = "TMP_Text"},
|
||||
TMPEnergyTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Talent_Cost"
|
||||
},
|
||||
TMPEnergy = {sComponentName = "TMP_Text"},
|
||||
TMPDesc = {sComponentName = "TMP_Text"},
|
||||
rtTMPDesc = {
|
||||
sComponentName = "RectTransform",
|
||||
sNodeName = "TMPDesc"
|
||||
},
|
||||
TMP_Link = {
|
||||
sNodeName = "TMPDesc",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnBtnClick_Word"
|
||||
}
|
||||
}
|
||||
SkillListGridCtrl._mapEventConfig = {}
|
||||
function SkillListGridCtrl:Awake()
|
||||
end
|
||||
function SkillListGridCtrl:FadeIn()
|
||||
end
|
||||
function SkillListGridCtrl:FadeOut()
|
||||
end
|
||||
function SkillListGridCtrl:OnEnable()
|
||||
end
|
||||
function SkillListGridCtrl:OnDisable()
|
||||
end
|
||||
function SkillListGridCtrl:OnDestroy()
|
||||
end
|
||||
function SkillListGridCtrl:OnRelease()
|
||||
end
|
||||
function SkillListGridCtrl:SetSkill(nSkillId, nLevel, nCharId, nType)
|
||||
local mapCharCfgData = ConfigTable.GetData_Character(nCharId)
|
||||
local mapCfgDataSkill = ConfigTable.GetData_Skill(nSkillId)
|
||||
local nCD = FormatNum(mapCfgDataSkill.SkillCD * ConfigData.IntFloatPrecision)
|
||||
local nCost = FormatNum(mapCfgDataSkill.UltraEnergy * ConfigData.IntFloatPrecision)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSkillLevel, ConfigTable.GetUIText("Skill_Level") .. nLevel)
|
||||
self:SetAtlasSprite(self._mapNode.imgSkillIconBg, "12_rare", AllEnum.ElementIconType.SkillEx .. mapCharCfgData.EET)
|
||||
self:SetPngSprite(self._mapNode.imgIconSkill, mapCfgDataSkill.Icon)
|
||||
local skillShowCfg = AllEnum.SkillTypeShow[nType]
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSkillType, ConfigTable.GetUIText(skillShowCfg.sLanguageId))
|
||||
self:SetAtlasSprite(self._mapNode.imgzsIcon, "10_ico", "zs_character_skill_" .. skillShowCfg.bgIconIndex)
|
||||
local _, color = ColorUtility.TryParseHtmlString(AllEnum.SkillElementBgColor[mapCharCfgData.EET])
|
||||
NovaAPI.SetImageColor(self._mapNode.imgzsIcon, Color(color.r, color.g, color.b, 0.19607843137254902))
|
||||
local skillTypeIconIdx = skillShowCfg.iconIndex
|
||||
self:SetAtlasSprite(self._mapNode.imgSkillType, "05_language", "zs_character_skill_text_" .. skillTypeIconIdx)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgSkillType)
|
||||
local _, _color = ColorUtility.TryParseHtmlString(skillShowCfg.bgColor)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgSkillTypeBg, _color)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTitle, mapCfgDataSkill.Title)
|
||||
local sCD = tostring(nCD) .. ConfigTable.GetUIText("Talent_Sec")
|
||||
local sCost = tostring(nCost)
|
||||
if nCD <= 0 then
|
||||
sCD = ConfigTable.GetUIText("Skill_NoCD")
|
||||
end
|
||||
if nCost <= 0 then
|
||||
sCost = ConfigTable.GetUIText("Skill_NoCost")
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPCD, sCD)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPEnergy, sCost)
|
||||
local bVisibleCD, bVisibleCost = false, false
|
||||
if mapCfgDataSkill.Type == GameEnum.skillType.NORMAL then
|
||||
bVisibleCD, bVisibleCost = false, false
|
||||
elseif mapCfgDataSkill.Type == GameEnum.skillType.SKILL or mapCfgDataSkill.Type == GameEnum.skillType.SUPPORT then
|
||||
bVisibleCD, bVisibleCost = true, false
|
||||
elseif mapCfgDataSkill.Type == GameEnum.skillType.ULTIMATE then
|
||||
bVisibleCD, bVisibleCost = true, true
|
||||
end
|
||||
self._mapNode.imgEnergyInfoBg:SetActive(bVisibleCost)
|
||||
self._mapNode.imgCDInfoBg:SetActive(bVisibleCD)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDesc, UTILS.ParseDesc(mapCfgDataSkill))
|
||||
end
|
||||
function SkillListGridCtrl:OnBtnClick_Word(link, sWordId)
|
||||
UTILS.ClickWordLink(link, sWordId)
|
||||
end
|
||||
return SkillListGridCtrl
|
||||
@@ -0,0 +1,184 @@
|
||||
local GachaProbInfoCtrl = class("GachaProbInfoCtrl", BaseCtrl)
|
||||
local cellCount = 6
|
||||
GachaProbInfoCtrl._mapNodeConfig = {
|
||||
txtWindowTitle = {sComponentName = "TMP_Text", sLanguageId = "Gacha_Prob"},
|
||||
btnCloseScreen = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
rtProbInfo = {sComponentName = "Animator"},
|
||||
btn_PoolInfo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_OpenPoolInfo"
|
||||
},
|
||||
txt_PoolInfo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Recruit_info"
|
||||
},
|
||||
btn_Left = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_PrePage"
|
||||
},
|
||||
btn_Right = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_NextPage"
|
||||
},
|
||||
txt_Page = {sComponentName = "TMP_Text"},
|
||||
ProbCell = {nCount = 6},
|
||||
title_type = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GachaHistory_Type"
|
||||
},
|
||||
title_rarity = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GachaHistory_Rank"
|
||||
},
|
||||
title_name = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GachaHistory_Name"
|
||||
},
|
||||
title_prob = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_ProbValue"
|
||||
},
|
||||
title_poolName = {sComponentName = "TMP_Text"},
|
||||
title_poolTime = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
GachaProbInfoCtrl._mapEventConfig = {}
|
||||
function GachaProbInfoCtrl:Awake()
|
||||
end
|
||||
function GachaProbInfoCtrl:FadeIn()
|
||||
end
|
||||
function GachaProbInfoCtrl:FadeOut()
|
||||
end
|
||||
function GachaProbInfoCtrl:OnEnable()
|
||||
end
|
||||
function GachaProbInfoCtrl:OnDisable()
|
||||
end
|
||||
function GachaProbInfoCtrl:OnDestroy()
|
||||
end
|
||||
function GachaProbInfoCtrl:OnRelease()
|
||||
end
|
||||
function GachaProbInfoCtrl:InitData()
|
||||
self.nCurPage = 1
|
||||
self.nTotalPage = 0
|
||||
self.upItemList = {}
|
||||
self.itemList = {}
|
||||
end
|
||||
function GachaProbInfoCtrl:OpenInfo()
|
||||
self.gameObject:SetActive(true)
|
||||
self._mapNode.rtProbInfo:Play("t_window_04_t_in")
|
||||
end
|
||||
function GachaProbInfoCtrl:Refresh(nPoolId)
|
||||
self:InitData()
|
||||
local upItemList, itemList = PlayerData.Gacha:GetPoolProbDetail(nPoolId)
|
||||
self.upItemList = upItemList
|
||||
self.itemList = itemList
|
||||
self.nTotalPage = math.ceil((#self.upItemList + #self.itemList) / cellCount)
|
||||
self:RefreshPage(self.nCurPage)
|
||||
local gachaConfig = ConfigTable.GetData("Gacha", nPoolId)
|
||||
NovaAPI.SetTMPText(self._mapNode.title_poolName, gachaConfig.Name)
|
||||
local bHideTimeText = gachaConfig.StartTime == ""
|
||||
self._mapNode.title_poolTime.gameObject:SetActive(not bHideTimeText)
|
||||
if bHideTimeText == false then
|
||||
local nStartTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(gachaConfig.StartTime)
|
||||
local nEndTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(gachaConfig.EndTime)
|
||||
local sStartTime = os.date("%Y-%m-%d %H:%M:%S", nStartTime)
|
||||
local sEndTime = os.date("%Y-%m-%d %H:%M:%S", nEndTime)
|
||||
local sTime = ConfigTable.GetUIText("Gacha_Prob_Time") .. sStartTime .. "~" .. sEndTime
|
||||
NovaAPI.SetTMPText(self._mapNode.title_poolTime, sTime)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_Page, self.nCurPage .. "/" .. self.nTotalPage)
|
||||
end
|
||||
function GachaProbInfoCtrl:RefreshPage(nPage)
|
||||
local min = (nPage - 1) * cellCount + 1
|
||||
local max = nPage * cellCount
|
||||
local dataMax = math.min(max, #self.upItemList + #self.itemList)
|
||||
local nCellIndex = 1
|
||||
for i = min, max do
|
||||
if i > dataMax then
|
||||
self._mapNode.ProbCell[nCellIndex]:SetActive(false)
|
||||
nCellIndex = nCellIndex + 1
|
||||
else
|
||||
local bIsUp, data
|
||||
if i <= #self.upItemList then
|
||||
data = self.upItemList[i]
|
||||
bIsUp = true
|
||||
else
|
||||
data = self.itemList[i - #self.upItemList]
|
||||
bIsUp = false
|
||||
end
|
||||
local itemConfig = ConfigTable.GetData_Item(data.nGoodsId)
|
||||
local cell = self._mapNode.ProbCell[nCellIndex]
|
||||
local txtType = cell.transform:Find("txtType")
|
||||
local img_char = cell.transform:Find("img_type_char")
|
||||
local img_outfit = cell.transform:Find("img_type_outfit")
|
||||
local str
|
||||
if itemConfig.Type == GameEnum.itemType.Char then
|
||||
str = ConfigTable.GetUIText("ItemStype_3")
|
||||
else
|
||||
str = ConfigTable.GetUIText("ItemStye_Outfit")
|
||||
end
|
||||
img_char.gameObject:SetActive(itemConfig.Type == GameEnum.itemType.Char)
|
||||
img_outfit.gameObject:SetActive(itemConfig.Type == GameEnum.itemType.Disc)
|
||||
NovaAPI.SetTMPText(txtType:GetComponent("TMP_Text"), str)
|
||||
local SSR = cell.transform:Find("ssr")
|
||||
local SR = cell.transform:Find("sr")
|
||||
local R = cell.transform:Find("r")
|
||||
SSR.gameObject:SetActive(itemConfig.Rarity == GameEnum.itemRarity.SSR)
|
||||
SR.gameObject:SetActive(itemConfig.Rarity == GameEnum.itemRarity.SR)
|
||||
R.gameObject:SetActive(itemConfig.Rarity == GameEnum.itemRarity.R)
|
||||
local up = cell.transform:Find("up")
|
||||
local bg_up = cell.transform:Find("bg_Up")
|
||||
up.gameObject:SetActive(bIsUp)
|
||||
bg_up.gameObject:SetActive(bIsUp)
|
||||
local txt_name = cell.transform:Find("txt_name")
|
||||
NovaAPI.SetTMPText(txt_name:GetComponent("TMP_Text"), itemConfig.Title)
|
||||
local txt_prob = cell.transform:Find("txt_prob")
|
||||
NovaAPI.SetTMPText(txt_prob:GetComponent("TMP_Text"), string.format("%.5f", data.nProbValue) .. "%")
|
||||
self._mapNode.ProbCell[nCellIndex]:SetActive(true)
|
||||
local line = cell.transform:Find("img_line")
|
||||
if dataMax < i + 1 then
|
||||
line.gameObject:SetActive(false)
|
||||
else
|
||||
line.gameObject:SetActive(true)
|
||||
end
|
||||
nCellIndex = nCellIndex + 1
|
||||
end
|
||||
end
|
||||
self._mapNode.btn_Left.gameObject:SetActive(1 < self.nCurPage)
|
||||
self._mapNode.btn_Right.gameObject:SetActive(self.nCurPage < self.nTotalPage)
|
||||
end
|
||||
function GachaProbInfoCtrl:OnBtnClick_Close()
|
||||
local Close = function()
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
self._mapNode.rtProbInfo:Play("t_window_04_t_out")
|
||||
self:AddTimer(1, 0.2, Close, true, true, true)
|
||||
end
|
||||
function GachaProbInfoCtrl:OnBtnClick_OpenPoolInfo()
|
||||
EventManager.Hit("GachaOpenPoolInfo")
|
||||
end
|
||||
function GachaProbInfoCtrl:OnBtnClick_PrePage()
|
||||
if self.nCurPage > 1 then
|
||||
self.nCurPage = self.nCurPage - 1
|
||||
self:RefreshPage(self.nCurPage)
|
||||
self._mapNode.btn_Left.gameObject:SetActive(self.nCurPage > 1)
|
||||
self._mapNode.btn_Right.gameObject:SetActive(self.nCurPage < self.nTotalPage)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_Page, self.nCurPage .. "/" .. self.nTotalPage)
|
||||
end
|
||||
end
|
||||
function GachaProbInfoCtrl:OnBtnClick_NextPage()
|
||||
if self.nCurPage < self.nTotalPage then
|
||||
self.nCurPage = self.nCurPage + 1
|
||||
self:RefreshPage(self.nCurPage)
|
||||
self._mapNode.btn_Left.gameObject:SetActive(self.nCurPage > 1)
|
||||
self._mapNode.btn_Right.gameObject:SetActive(self.nCurPage < self.nTotalPage)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_Page, self.nCurPage .. "/" .. self.nTotalPage)
|
||||
end
|
||||
end
|
||||
return GachaProbInfoCtrl
|
||||
@@ -0,0 +1,522 @@
|
||||
local GachaShowCtrl = class("GachaShowCtrl", BaseCtrl)
|
||||
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
|
||||
local ResTypeAny = GameResourceLoader.ResType.Any
|
||||
local ResType = GameResourceLoader.ResType
|
||||
local WwiseManger = CS.WwiseAudioManager
|
||||
local GachaShowResRoot = "UI/GachaEx/Sprites_Show/"
|
||||
local PlayablesPlayStatePlaying = CS.UnityEngine.Playables.PlayState.Playing
|
||||
local Offset = CS.Actor2DOffsetData
|
||||
local typeof = typeof
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local BubbleVoiceManager = require("Game.Actor2D.BubbleVoiceManager")
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local mapOutfitAnimName = {
|
||||
[1] = "GachaShow_Outfit_SSR",
|
||||
[2] = "GachaShow_Outfit_SR",
|
||||
[3] = "GachaShow_Outfit_R",
|
||||
[4] = "GachaShow_Outfit_N",
|
||||
[5] = "GachaShow_Outfit_N"
|
||||
}
|
||||
local mapOutfitAnimTime = {
|
||||
[1] = 0.6,
|
||||
[2] = 0.6,
|
||||
[3] = 0.6,
|
||||
[4] = 0.6,
|
||||
[5] = 0.6
|
||||
}
|
||||
GachaShowCtrl._mapNodeConfig = {
|
||||
imgBgRare = {sComponentName = "Image"},
|
||||
BgRare = {
|
||||
sComponentName = "SpriteRenderer"
|
||||
},
|
||||
BgRare1 = {
|
||||
sComponentName = "SpriteRenderer"
|
||||
},
|
||||
goCharContent = {
|
||||
sNodeName = "----Char----",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
rImgL2D = {sComponentName = "RawImage"},
|
||||
OffScreen2DCamera = {
|
||||
sNodeName = "OffScreen3DCamera",
|
||||
sComponentName = "Camera"
|
||||
},
|
||||
L2DRoot = {sNodeName = "L2D", sComponentName = "Transform"},
|
||||
rtSSRWord = {},
|
||||
TMP_Word1 = {sComponentName = "TMP_Text"},
|
||||
goOutfitContent = {
|
||||
sNodeName = "----Outfit----"
|
||||
},
|
||||
imgBgOutfit = {sComponentName = "Image"},
|
||||
imgOutfit = {sComponentName = "Image"},
|
||||
imgOutfitRare = {sComponentName = "Image"},
|
||||
goInfoContent = {
|
||||
sNodeName = "----Info----"
|
||||
},
|
||||
animInfoContent = {
|
||||
sNodeName = "----Info----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
rtItemTips = {},
|
||||
imgItemIcon = {sComponentName = "Image"},
|
||||
TMP_ItemCount = {sComponentName = "TMP_Text"},
|
||||
TMP_ItemTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GachaItemTIpsTitle"
|
||||
},
|
||||
rtItemTips2 = {},
|
||||
imgItemIcon2 = {sComponentName = "Image"},
|
||||
TMP_ItemCount2 = {sComponentName = "TMP_Text"},
|
||||
TMP_ItemTitle2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Gacha_GiveItemTitle"
|
||||
},
|
||||
imgTitleRare = {sComponentName = "Image"},
|
||||
imgTitleBg = {sComponentName = "Image"},
|
||||
imgRareIcon = {sComponentName = "Image"},
|
||||
TMP_Title = {sComponentName = "TMP_Text"},
|
||||
TMP_Word = {sComponentName = "TMP_Text"},
|
||||
ImgNew = {},
|
||||
btnJumpStep = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_JumpStep"
|
||||
},
|
||||
btnJumpAll = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_JumpAll"
|
||||
},
|
||||
animWord = {sNodeName = "rtSSRWord", sComponentName = "Animator"},
|
||||
SSROutfitShow = {},
|
||||
animSSROutfitShow = {
|
||||
sNodeName = "SSROutfitShow",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
imgBgOutfitShow = {sComponentName = "Image"},
|
||||
imgOutfitMask = {},
|
||||
liveDiscCtrl = {
|
||||
sNodeName = "goLiveDisc",
|
||||
sCtrlName = "Game.UI.Disc.LiveDiscCtrl"
|
||||
},
|
||||
rtOffScreen = {
|
||||
sNodeName = "Live2D_OffScreen_Renderer",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
rtTitle = {
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
actor2dNode = {
|
||||
sNodeName = "----Actor2D_Node----",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
rtPreviewShow = {
|
||||
sNodeName = "---ShowPreview---"
|
||||
},
|
||||
rtPreviewItems = {
|
||||
sNodeName = "rtPreviewItem_",
|
||||
nCount = 10
|
||||
}
|
||||
}
|
||||
GachaShowCtrl._mapEventConfig = {}
|
||||
function GachaShowCtrl:Awake()
|
||||
end
|
||||
function GachaShowCtrl:FadeIn()
|
||||
end
|
||||
function GachaShowCtrl:FadeOut()
|
||||
end
|
||||
function GachaShowCtrl:OnEnable()
|
||||
self.animatorRoot = self.gameObject:GetComponent("Animator")
|
||||
self.gameObject:SetActive(false)
|
||||
self._mapNode.rtPreviewShow:SetActive(false)
|
||||
self._mapNode.rtOffScreen.localScale = Vector3(1 / Settings.CANVAS_SCALE, 1 / Settings.CANVAS_SCALE, 1 / Settings.CANVAS_SCALE)
|
||||
self.timerStep = nil
|
||||
end
|
||||
function GachaShowCtrl:OnDisable()
|
||||
self._mapNode.OffScreen2DCamera.targetTexture = nil
|
||||
NovaAPI.SetTexture(self._mapNode.rImgL2D, nil)
|
||||
if self.rtCharL2d ~= nil then
|
||||
GameUIUtils.ReleaseRenderTexture(self.rtCharL2d)
|
||||
self.rtCharL2d = nil
|
||||
end
|
||||
if self.goL2D ~= nil then
|
||||
if self.goL2D.trL2DIns ~= nil then
|
||||
Actor2DManager.UnSetActor2DWithRender(self.goL2D)
|
||||
end
|
||||
self.goL2D = nil
|
||||
end
|
||||
end
|
||||
function GachaShowCtrl:OnDestroy()
|
||||
end
|
||||
function GachaShowCtrl:OnRelease()
|
||||
end
|
||||
function GachaShowCtrl:ShowPreview()
|
||||
self._mapNode.rtPreviewShow:SetActive(true)
|
||||
for i = 1, 10 do
|
||||
if self.tbItems[i] == nil then
|
||||
self._mapNode.rtPreviewItems[i]:SetActive(false)
|
||||
else
|
||||
self._mapNode.rtPreviewItems[i]:SetActive(true)
|
||||
local mapItemCfgData = ConfigTable.GetData_Item(self.tbItems[i].id)
|
||||
if mapItemCfgData == nil then
|
||||
self._mapNode.rtPreviewItems[i]:SetActive(false)
|
||||
else
|
||||
local rtR = self._mapNode.rtPreviewItems[i].transform:Find("imgR")
|
||||
local rtSR = self._mapNode.rtPreviewItems[i].transform:Find("imgSR")
|
||||
local rtSSR = self._mapNode.rtPreviewItems[i].transform:Find("imgSSR")
|
||||
if rtR ~= nil then
|
||||
rtR.gameObject:SetActive(mapItemCfgData.Rarity > 2)
|
||||
end
|
||||
if rtSR ~= nil then
|
||||
rtSR.gameObject:SetActive(mapItemCfgData.Rarity == 2)
|
||||
end
|
||||
if rtSSR ~= nil then
|
||||
rtSSR.gameObject:SetActive(mapItemCfgData.Rarity == 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function GachaShowCtrl:ShowResults(tbItems, mapTrans)
|
||||
self.tbItems = tbItems
|
||||
self.curIdx = 1
|
||||
self.bJumpAll = false
|
||||
self.bShowPreview = false
|
||||
local ShowResult = function()
|
||||
self.showPreviewTimer = nil
|
||||
self.bShowPreview = false
|
||||
self._mapNode.rtPreviewShow:SetActive(false)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.rtTitle, 1)
|
||||
self:ShowItem(self.tbItems[self.curIdx])
|
||||
end
|
||||
local ShowPreview = function()
|
||||
self:ShowPreview()
|
||||
self.showPreviewTimer = self:AddTimer(1, 1, ShowResult, true, true, true)
|
||||
self.bShowPreview = true
|
||||
end
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
if 1 < #tbItems then
|
||||
ShowPreview()
|
||||
else
|
||||
ShowResult()
|
||||
end
|
||||
end
|
||||
self.gameObject:SetActive(true)
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function GachaShowCtrl:ShowItem(mapItem)
|
||||
self.curStep = 1
|
||||
self.nTid = mapItem.id
|
||||
self.bNew = mapItem.bNew
|
||||
local mapItemCfgData = ConfigTable.GetData_Item(mapItem.id)
|
||||
self.bChar = mapItemCfgData.Type == GameEnum.itemType.Char
|
||||
if mapItem.rewardItem ~= nil and #mapItem.rewardItem > 0 then
|
||||
local mapRewardItemCfgData = ConfigTable.GetData_Item(mapItem.rewardItem[1].Tid)
|
||||
if mapRewardItemCfgData == nil then
|
||||
printError("item ID missing:" .. mapItem.rewardItem[1].Tid)
|
||||
self._mapNode.rtItemTips:SetActive(false)
|
||||
else
|
||||
local nRewardItemCount = mapItem.rewardItem[1].Qty
|
||||
self._mapNode.rtItemTips:SetActive(true)
|
||||
self:SetPngSprite(self._mapNode.imgItemIcon, mapRewardItemCfgData.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMP_ItemCount, string.format("×%d", tostring(nRewardItemCount)))
|
||||
end
|
||||
else
|
||||
self._mapNode.rtItemTips:SetActive(false)
|
||||
end
|
||||
if mapItem.exItem ~= nil and 0 < #mapItem.exItem then
|
||||
local mapRewardItemCfgData = ConfigTable.GetData_Item(mapItem.exItem[1].Tid)
|
||||
if mapRewardItemCfgData == nil then
|
||||
printError("item ID missing:" .. mapItem.exItem[1].Tid)
|
||||
self._mapNode.rtItemTips2:SetActive(false)
|
||||
else
|
||||
local nRewardItemCount = mapItem.exItem[1].Qty
|
||||
self._mapNode.rtItemTips2:SetActive(true)
|
||||
self:SetPngSprite(self._mapNode.imgItemIcon2, mapRewardItemCfgData.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMP_ItemCount2, string.format("×%d", tostring(nRewardItemCount)))
|
||||
end
|
||||
else
|
||||
self._mapNode.rtItemTips2:SetActive(false)
|
||||
end
|
||||
if self.bChar or mapItemCfgData.Rarity == GameEnum.itemRarity.SSR then
|
||||
WwiseManger.Instance:SetState("recruit_rarity", "SSR")
|
||||
else
|
||||
WwiseManger.Instance:SetState("recruit_rarity", "R")
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMP_Title, mapItemCfgData.Title)
|
||||
local bgSprite = self:LoadPngGacha(GachaShowResRoot .. "bg_gacha_character_" .. AllEnum.FrameColor_New[mapItemCfgData.Rarity])
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgBgRare, bgSprite)
|
||||
NovaAPI.SetSpriteRendererSprite(self._mapNode.BgRare, bgSprite)
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgRareIcon, self:LoadPngGacha(GachaShowResRoot .. "rare_character_gacha_" .. AllEnum.FrameColor_New[mapItemCfgData.Rarity]))
|
||||
if self.bChar then
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgTitleBg, self:LoadPngGacha(GachaShowResRoot .. "zs_gacha_name"))
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgTitleRare, self:LoadPngGacha(GachaShowResRoot .. "zs_gacha_name_" .. AllEnum.FrameColor_New[mapItemCfgData.Rarity]))
|
||||
else
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgTitleBg, self:LoadPngGacha(GachaShowResRoot .. "zs_gacha_name_outfit"))
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgTitleRare, self:LoadPngGacha(GachaShowResRoot .. "zs_gacha_name_outfit_" .. AllEnum.FrameColor_New[mapItemCfgData.Rarity]))
|
||||
end
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgRareIcon)
|
||||
self._mapNode.ImgNew:SetActive(self.bNew)
|
||||
if self.bChar then
|
||||
self:SetCharacter(mapItem.id)
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMP_Word, "")
|
||||
self:SetOutfit(mapItem.id)
|
||||
end
|
||||
end
|
||||
function GachaShowCtrl:LoadPngGacha(sPath)
|
||||
return self:LoadAsset(sPath .. ".png", typeof(Sprite))
|
||||
end
|
||||
function GachaShowCtrl:LoadOffset(sPath)
|
||||
return self:LoadAsset(sPath, typeof(Offset))
|
||||
end
|
||||
function GachaShowCtrl:SetOutfit(nOutfitTid)
|
||||
self._mapNode.goCharContent.gameObject:SetActive(false)
|
||||
self._mapNode.goOutfitContent:SetActive(true)
|
||||
local mapItemCfgData = ConfigTable.GetData_Item(nOutfitTid)
|
||||
local mapOutfitCfgData = ConfigTable.GetData("Disc", nOutfitTid)
|
||||
self._mapNode.imgOutfitMask:SetActive(false)
|
||||
self._mapNode.liveDiscCtrl:SetDiscActive(true, mapOutfitCfgData.DiscBg ~= "")
|
||||
self._mapNode.liveDiscCtrl:SetRawImage(mapOutfitCfgData.DiscBg, mapItemCfgData.Rarity)
|
||||
self._mapNode.liveDiscCtrl:SetClickCallback(function()
|
||||
self:OnBtnClick_JumpStep()
|
||||
end)
|
||||
if mapItemCfgData.Rarity == GameEnum.itemRarity.SSR then
|
||||
self:SetPngSprite(self._mapNode.imgBgOutfitShow, mapOutfitCfgData.DiscBg .. AllEnum.DiscBgSurfix.Image)
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgBgOutfit, mapOutfitCfgData.DiscBg .. AllEnum.DiscBgSurfix.Image)
|
||||
self._mapNode.imgBgOutfit.gameObject:SetActive(true)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgBgOutfit)
|
||||
self._mapNode.goInfoContent:SetActive(false)
|
||||
if mapItemCfgData.Rarity == GameEnum.itemRarity.SSR and self.bNew then
|
||||
self._mapNode.SSROutfitShow:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.animSSROutfitShow:Play("SSROutfitShow_in")
|
||||
WwiseAudioMgr:PlaySound("ui_recuit_gacha_disk_SSR_glass")
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
self.timerStep = self:AddTimer(1, 2.7, "ShowSSRAnimEndOutfit", true, true, nil, mapItemCfgData.Rarity)
|
||||
else
|
||||
self:ShowSSRAnimEndOutfit(0, mapItemCfgData.Rarity)
|
||||
end
|
||||
self:BlockJump(0.5)
|
||||
end
|
||||
function GachaShowCtrl:SetCharacter(nCharTid)
|
||||
if self.goL2D ~= nil then
|
||||
if self.goL2D.trL2DIns ~= nil then
|
||||
Actor2DManager.UnSetActor2DWithRender(self.goL2D)
|
||||
end
|
||||
self.goL2D = nil
|
||||
end
|
||||
self._mapNode.goCharContent.gameObject:SetActive(true)
|
||||
self._mapNode.goOutfitContent:SetActive(false)
|
||||
self._mapNode.goInfoContent:SetActive(false)
|
||||
local mapCharCfgData = ConfigTable.GetData_Character(nCharTid)
|
||||
local mapSkinData = ConfigTable.GetData_CharacterSkin(mapCharCfgData.DefaultSkinId)
|
||||
NovaAPI.SetSpriteRendererSprite(self._mapNode.BgRare1, self:LoadPngGacha(mapSkinData.Bg))
|
||||
local sPath = string.format("Actor2D/Character/%d/atlas_png/a/%d_001.png", mapCharCfgData.DefaultSkinId, mapCharCfgData.DefaultSkinId)
|
||||
if mapSkinData.L2D ~= nil and mapSkinData.L2D ~= "" then
|
||||
local bSetSuccess, nT, nAnimLength, tbRenderer = Actor2DManager.SetActor2DWithRender(PanelId.GachaSpin, self._mapNode.rImgL2D, nCharTid, mapCharCfgData.DefaultSkinId, nil, self._mapNode.actor2dNode)
|
||||
self.goL2D = tbRenderer
|
||||
local voice = "gachaNew"
|
||||
if not self.bNew then
|
||||
voice = "gacha"
|
||||
end
|
||||
local nId = PlayerData.Voice:PlayCharVoice(voice, nCharTid)
|
||||
local mapVoiceCfgData = ConfigTable.GetData("VoDirectory", nId)
|
||||
if nil ~= mapVoiceCfgData then
|
||||
local tbStr = BubbleVoiceManager.GetBubbleText(mapVoiceCfgData.voResource)
|
||||
local str = ""
|
||||
if tbStr ~= nil then
|
||||
str = tbStr[1] .. tbStr[2] .. tbStr[3] .. tbStr[4]
|
||||
str = string.gsub(str, "==RT==", "\n")
|
||||
str = string.gsub(str, "==PLAYER_NAME==", PlayerData.Base:GetPlayerNickName())
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMP_Word, str)
|
||||
end
|
||||
if mapCharCfgData.Grade == GameEnum.characterGrade.SSR then
|
||||
self._mapNode.rtSSRWord:SetActive(true)
|
||||
self._mapNode.animWord:Play("SSRWord_in")
|
||||
WwiseAudioMgr:PlaySound("ui_recuit_gacha_SSR_glass")
|
||||
self.timerStep = self:AddTimer(1, 1.7, "ShowSSRWordEnd", true, true, true, nil)
|
||||
self:BlockJump(0.5)
|
||||
if mapVoiceCfgData ~= nil then
|
||||
local tbStr = BubbleVoiceManager.GetBubbleText(mapVoiceCfgData.voResource)
|
||||
local str = ""
|
||||
if tbStr ~= nil then
|
||||
str = tbStr[1] .. tbStr[2] .. tbStr[3] .. tbStr[4]
|
||||
str = string.gsub(str, "==RT==", "\n")
|
||||
str = string.gsub(str, "==PLAYER_NAME==", PlayerData.Base:GetPlayerNickName())
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMP_Word1, str)
|
||||
end
|
||||
else
|
||||
self._mapNode.rtSSRWord:SetActive(false)
|
||||
self:ShowSSRWordEnd(0, nId)
|
||||
end
|
||||
if self.goL2D ~= nil and self.goL2D.trL2DIns ~= nil then
|
||||
Actor2DManager.PlayL2DAnim(self.goL2D.trL2DIns.transform, "idle", true, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function GachaShowCtrl:ShowSSRWordEnd(_, nId)
|
||||
self:BlockJump(1.2)
|
||||
self._mapNode.rtSSRWord:SetActive(false)
|
||||
local mapCharCfgData = ConfigTable.GetData_Character(self.nTid)
|
||||
if self.goL2D.trL2DIns == nil or mapCharCfgData == nil then
|
||||
self._mapNode.goInfoContent:SetActive(true)
|
||||
self.curStep = 3
|
||||
return
|
||||
end
|
||||
if mapCharCfgData.Grade == GameEnum.characterGrade.SSR then
|
||||
self.animatorRoot:Play("GachaShow_SSR")
|
||||
WwiseAudioMgr:PlaySound("ui_recuit_gacha_SSR_show")
|
||||
self.timerStep = self:AddTimer(1, 0.6, "ShowSSRAnimEnd", true, true, nil, nil)
|
||||
else
|
||||
WwiseAudioMgr:PlaySound("ui_recuit_gacha_SR_long")
|
||||
self.animatorRoot:Play("GachaShow_SR")
|
||||
self.timerStep = self:AddTimer(1, 1.2, "ShowSSRAnimEnd", true, true, nil, nId)
|
||||
goto lbl_75
|
||||
self._mapNode.goInfoContent:SetActive(true)
|
||||
self.curStep = 3
|
||||
end
|
||||
::lbl_75::
|
||||
end
|
||||
function GachaShowCtrl:ShowSSRAnimEnd(_, nId)
|
||||
self:BlockJump(1)
|
||||
if nId ~= nil then
|
||||
local mapVoiceCfgData = ConfigTable.GetData("VoDirectory", nId)
|
||||
if mapVoiceCfgData ~= nil then
|
||||
local tbStr = BubbleVoiceManager.GetBubbleText(mapVoiceCfgData.voResource)
|
||||
local str = ""
|
||||
if tbStr ~= nil then
|
||||
str = tbStr[1] .. tbStr[2] .. tbStr[3] .. tbStr[4]
|
||||
str = string.gsub(str, "==RT==", "\n")
|
||||
str = string.gsub(str, "==PLAYER_NAME==", PlayerData.Base:GetPlayerNickName())
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMP_Word, str)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMP_Word1, str)
|
||||
end
|
||||
end
|
||||
self._mapNode.goInfoContent:SetActive(true)
|
||||
self._mapNode.animInfoContent:Play("Info_rtTitle_in")
|
||||
if self.bNew then
|
||||
self:AddTimer(1, 0.4, function()
|
||||
WwiseAudioMgr:PlaySound("ui_recuit_gacha_new")
|
||||
end, true, true, true)
|
||||
end
|
||||
self.curStep = 3
|
||||
end
|
||||
function GachaShowCtrl:ShowSSRAnimEndOutfit(_, nRarity)
|
||||
self:BlockJump(0.5)
|
||||
self._mapNode.SSROutfitShow:SetActive(false)
|
||||
self.curStep = 2
|
||||
self.animatorRoot:Play(mapOutfitAnimName[nRarity])
|
||||
self.timerStep = self:AddTimer(1, mapOutfitAnimTime[nRarity], "ShowSSRAnimEnd", true, true, nil, nil)
|
||||
if nRarity == GameEnum.itemRarity.SSR then
|
||||
WwiseAudioMgr:PlaySound("ui_recuit_gacha_disk_SSR_show")
|
||||
elseif nRarity == GameEnum.itemRarity.SR then
|
||||
WwiseAudioMgr:PlaySound("ui_recuit_gacha_disk_SR_show")
|
||||
else
|
||||
WwiseAudioMgr:PlaySound("ui_recuit_gacha_N")
|
||||
end
|
||||
end
|
||||
function GachaShowCtrl:OnBtnClick_JumpStep()
|
||||
if self.bBlockJump or self.bShowPreview then
|
||||
return
|
||||
end
|
||||
print("jump step")
|
||||
WwiseAudioMgr:WwiseVoice_Stop(2)
|
||||
if self.curStep ~= 3 then
|
||||
self.timerStep:Cancel(true)
|
||||
return
|
||||
end
|
||||
if self.bJumpAll then
|
||||
self:OnBtnClick_JumpAll()
|
||||
return
|
||||
end
|
||||
if self.curIdx == #self.tbItems then
|
||||
self.gameObject:SetActive(false)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.rtTitle, 0)
|
||||
if self.goL2D ~= nil then
|
||||
if self.goL2D.trL2DIns ~= nil then
|
||||
Actor2DManager.UnSetActor2DWithRender(self.goL2D)
|
||||
end
|
||||
self.goL2D = nil
|
||||
end
|
||||
WwiseManger.Instance:SetState("recruit_rarity", "R")
|
||||
EventManager.Hit("GachaShowItemEnd")
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgBgOutfit, nil)
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgOutfit, nil)
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgOutfitRare, nil)
|
||||
self._mapNode.liveDiscCtrl:ReleaseRawImage()
|
||||
self._mapNode.liveDiscCtrl:ClearClickCallback()
|
||||
if self.goL2D ~= nil then
|
||||
if self.goL2D.trL2DIns ~= nil then
|
||||
Actor2DManager.UnSetActor2DWithRender(self.goL2D)
|
||||
end
|
||||
self.goL2D = nil
|
||||
end
|
||||
else
|
||||
self.curIdx = self.curIdx + 1
|
||||
self:ShowItem(self.tbItems[self.curIdx])
|
||||
end
|
||||
end
|
||||
function GachaShowCtrl:OnBtnClick_JumpAll()
|
||||
if self.bBlockJump then
|
||||
return
|
||||
end
|
||||
if self.bShowPreview then
|
||||
if self.showPreviewTimer ~= nil then
|
||||
self.showPreviewTimer:Cancel(true)
|
||||
end
|
||||
return
|
||||
end
|
||||
print("Jump all")
|
||||
WwiseAudioMgr:WwiseVoice_Stop(2)
|
||||
self.bJumpAll = true
|
||||
if self.timerStep ~= nil then
|
||||
local bStep = self.curStep ~= 3
|
||||
self.timerStep:Cancel(bStep)
|
||||
if bStep then
|
||||
return
|
||||
end
|
||||
end
|
||||
for i = self.curIdx + 1, #self.tbItems do
|
||||
local mapItemCfgData = ConfigTable.GetData_Item(self.tbItems[i].id)
|
||||
if self.tbItems[i].bForceJump ~= true and (mapItemCfgData.Rarity == GameEnum.itemRarity.SSR or self.tbItems[i].bNew and mapItemCfgData.Rarity ~= GameEnum.itemRarity.R) then
|
||||
self.curIdx = i
|
||||
self:ShowItem(self.tbItems[self.curIdx])
|
||||
return
|
||||
end
|
||||
end
|
||||
self.gameObject:SetActive(false)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.rtTitle, 0)
|
||||
if self.goL2D ~= nil then
|
||||
if self.goL2D.trL2DIns ~= nil then
|
||||
Actor2DManager.UnSetActor2DWithRender(self.goL2D)
|
||||
end
|
||||
self.goL2D = nil
|
||||
end
|
||||
WwiseManger.Instance:SetState("recruit_rarity", "R")
|
||||
EventManager.Hit("GachaShowItemEnd")
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgBgOutfit, nil)
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgOutfit, nil)
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgOutfitRare, nil)
|
||||
self._mapNode.liveDiscCtrl:ReleaseRawImage()
|
||||
self._mapNode.liveDiscCtrl:ClearClickCallback()
|
||||
if self.goL2D ~= nil then
|
||||
if self.goL2D.trL2DIns ~= nil then
|
||||
Actor2DManager.UnSetActor2DWithRender(self.goL2D)
|
||||
end
|
||||
self.goL2D = nil
|
||||
end
|
||||
end
|
||||
function GachaShowCtrl:BlockJump(nTime)
|
||||
self.bBlockJump = true
|
||||
local unBlockJump = function()
|
||||
self.bBlockJump = false
|
||||
end
|
||||
self:AddTimer(1, nTime, unBlockJump, true, true, nil, nil)
|
||||
end
|
||||
return GachaShowCtrl
|
||||
@@ -0,0 +1,132 @@
|
||||
local GachaShowResultCtrl = class("GachaShowResultCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
GachaShowResultCtrl._mapNodeConfig = {
|
||||
Item = {
|
||||
sCtrlName = "Game.UI.GachaEx.GachaShowResultGrid",
|
||||
nCount = 10
|
||||
},
|
||||
rtItem = {sNodeName = "rtItem_", nCount = 3},
|
||||
imgItemIcon = {sComponentName = "Image", nCount = 3},
|
||||
TMPItemCount = {sComponentName = "TMP_Text", nCount = 3},
|
||||
TMPTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "GachaItemTIpsTitle"
|
||||
},
|
||||
btnClose = {
|
||||
nCount = 2,
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
imgItemsBg = {}
|
||||
}
|
||||
GachaShowResultCtrl._mapEventConfig = {}
|
||||
function GachaShowResultCtrl:Awake()
|
||||
end
|
||||
function GachaShowResultCtrl:FadeIn()
|
||||
end
|
||||
function GachaShowResultCtrl:FadeOut()
|
||||
end
|
||||
function GachaShowResultCtrl:OnEnable()
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
function GachaShowResultCtrl:OnDisable()
|
||||
end
|
||||
function GachaShowResultCtrl:OnDestroy()
|
||||
end
|
||||
function GachaShowResultCtrl:OnRelease()
|
||||
end
|
||||
function GachaShowResultCtrl:ShowResult(tbReward, mapRewardItem, tbGiveItems)
|
||||
WwiseAudioMgr:PlaySound("ui_recuit_gacha_result")
|
||||
self.curStep = 1
|
||||
self._mapNode.imgItemsBg:SetActive(false)
|
||||
local nDelayTime = 0
|
||||
for i = 1, 10 do
|
||||
if tbReward[i] ~= nil then
|
||||
self._mapNode.Item[i].gameObject:SetActive(true)
|
||||
local itemTime = self._mapNode.Item[i]:Refresh(tbReward[i].id, tbReward[i].bNew, nDelayTime)
|
||||
nDelayTime = nDelayTime + itemTime
|
||||
else
|
||||
self._mapNode.Item[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
local AllCardShowCallback = function()
|
||||
self.curStep = 2
|
||||
self.delayTimer = nil
|
||||
local tbItem = {}
|
||||
for nTid, nQty in pairs(mapRewardItem) do
|
||||
table.insert(tbItem, {nTid = nTid, nQty = nQty})
|
||||
end
|
||||
local bRewardActive = false
|
||||
for i = 1, 3 do
|
||||
if tbItem[i] ~= nil then
|
||||
self._mapNode.rtItem[i].gameObject:SetActive(true)
|
||||
local mapItemCfgData = ConfigTable.GetData_Item(tbItem[i].nTid)
|
||||
if mapItemCfgData == nil then
|
||||
printError("ItemDataMisssing:" .. tbItem[i].nTid)
|
||||
self._mapNode.rtItem[i].gameObject:SetActive(false)
|
||||
else
|
||||
self:SetPngSprite(self._mapNode.imgItemIcon[i], mapItemCfgData.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPItemCount[i], string.format("×%d", tbItem[i].nQty))
|
||||
bRewardActive = true
|
||||
end
|
||||
else
|
||||
self._mapNode.rtItem[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
if tbGiveItems[1] ~= nil then
|
||||
self._mapNode.rtItem[3].gameObject:SetActive(true)
|
||||
local mapItemCfgData = ConfigTable.GetData_Item(tbGiveItems[1].Tid)
|
||||
if mapItemCfgData == nil then
|
||||
printError("ItemDataMisssing:" .. tbGiveItems[1].Tid)
|
||||
self._mapNode.rtItem[3].gameObject:SetActive(false)
|
||||
else
|
||||
self:SetPngSprite(self._mapNode.imgItemIcon[3], mapItemCfgData.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPItemCount[3], string.format("×%d", tbGiveItems[1].Qty))
|
||||
bRewardActive = true
|
||||
end
|
||||
else
|
||||
self._mapNode.rtItem[3].gameObject:SetActive(false)
|
||||
end
|
||||
self._mapNode.imgItemsBg:SetActive(bRewardActive)
|
||||
for i = 1, 10 do
|
||||
self._mapNode.Item[i]:ShowAllCardEnd()
|
||||
end
|
||||
local wait = function()
|
||||
local animtorItemContent = self._mapNode.imgItemsBg:GetComponent("Animator")
|
||||
animtorItemContent:Play("GachaShowResult_imgItemsBg_in")
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
self:BlockJump(0.5)
|
||||
end
|
||||
self.delayTimer = self:AddTimer(1, nDelayTime, AllCardShowCallback, true, true, nil, nil)
|
||||
end
|
||||
function GachaShowResultCtrl:BlockJump(nTime)
|
||||
self.bBlockJump = true
|
||||
local unBlockJump = function()
|
||||
self.bBlockJump = false
|
||||
end
|
||||
self:AddTimer(1, nTime, unBlockJump, true, true, nil, nil)
|
||||
end
|
||||
function GachaShowResultCtrl:OnBtnClick_Close()
|
||||
if self.bBlockJump then
|
||||
return
|
||||
end
|
||||
if self.curStep == 1 then
|
||||
for i = 1, 10 do
|
||||
self._mapNode.Item[i]:JumpDelay()
|
||||
end
|
||||
if self.delayTimer ~= nil then
|
||||
self.delayTimer:Cancel(true)
|
||||
end
|
||||
else
|
||||
self.gameObject:SetActive(false)
|
||||
WwiseAudioMgr:SetState("recruit_rarity", "None")
|
||||
for i = 1, 10 do
|
||||
self._mapNode.Item[i].gameObject:SetActive(false)
|
||||
end
|
||||
PlayerData.Item:TryOpenFragmentsOverflow(function()
|
||||
PlayerData.Phone:CheckNewChat()
|
||||
end)
|
||||
end
|
||||
end
|
||||
return GachaShowResultCtrl
|
||||
@@ -0,0 +1,180 @@
|
||||
local GachaShowResultGrid = class("GachaShowResultGrid", BaseCtrl)
|
||||
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
|
||||
local ResType = GameResourceLoader.ResType
|
||||
local GachaShowResRoot = "UI/GachaEx/Sprites_Show/"
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local typeof = typeof
|
||||
local mapCharAnimName = {
|
||||
[GameEnum.itemRarity.SSR] = "GachaShowResultItem_rtChar_SSR_in",
|
||||
[GameEnum.itemRarity.SR] = "GachaShowResultItem_rtChar_SR_in"
|
||||
}
|
||||
local mapOutfitAnimName = {
|
||||
[GameEnum.itemRarity.SSR] = "GachaShowResultItem_outfit_SSR_in",
|
||||
[GameEnum.itemRarity.SR] = "GachaShowResultItem_outfit_SR_in",
|
||||
[GameEnum.itemRarity.R] = "GachaShowResultItem_outfit_R_in",
|
||||
[GameEnum.itemRarity.M] = "GachaShowResultItem_outfit_N_in",
|
||||
[GameEnum.itemRarity.N] = "GachaShowResultItem_outfit_N_in"
|
||||
}
|
||||
GachaShowResultGrid._mapNodeConfig = {
|
||||
rtOutfit = {},
|
||||
imgOutfitBg = {sComponentName = "Image"},
|
||||
imgOutfit = {sComponentName = "Image"},
|
||||
imgOutfitIcon = {sComponentName = "Image"},
|
||||
rtChar = {},
|
||||
imgCharBg = {sComponentName = "Image"},
|
||||
imgChar = {sComponentName = "Image"},
|
||||
animChar = {sNodeName = "imgChar", sComponentName = "Animator"},
|
||||
animItem = {
|
||||
sNodeName = "resultItemRoot",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
imgItem = {sComponentName = "Image"},
|
||||
imgNewChar = {},
|
||||
imgNewOutfit = {},
|
||||
imgRare = {sComponentName = "Image"},
|
||||
imgPoint1 = {},
|
||||
imgPoint2 = {},
|
||||
resultItem = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl",
|
||||
nCount = 2
|
||||
},
|
||||
btnItem = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickBtn_ShowDetail"
|
||||
}
|
||||
}
|
||||
GachaShowResultGrid._mapEventConfig = {}
|
||||
function GachaShowResultGrid:OnEnable()
|
||||
self.animatorRoot = self.gameObject:GetComponent("Animator")
|
||||
self.canvasGroup = self.gameObject:GetComponent("CanvasGroup")
|
||||
end
|
||||
function GachaShowResultGrid:Refresh(nTid, bNew, nDelayTime)
|
||||
self.nTid = nTid
|
||||
self._mapNode.animItem:Play("empty")
|
||||
NovaAPI.SetCanvasGroupAlpha(self.canvasGroup, 0)
|
||||
self._mapNode.imgNewChar:SetActive(bNew)
|
||||
self._mapNode.imgNewOutfit:SetActive(bNew)
|
||||
local mapItemCfgData = ConfigTable.GetData_Item(nTid)
|
||||
if mapItemCfgData == nil then
|
||||
printError("ItemData missing:" .. nTid)
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
local delayCallback = function()
|
||||
NovaAPI.SetCanvasGroupAlpha(self.canvasGroup, 1)
|
||||
if self.sAnimName ~= nil and self.sAnimName ~= nil then
|
||||
self.animatorRoot:Play(self.sAnimName)
|
||||
end
|
||||
if mapItemCfgData.Rarity == GameEnum.itemRarity.SSR then
|
||||
WwiseAudioMgr:PlaySound("ui_recuit_gacha_result_SSR")
|
||||
elseif mapItemCfgData.Rarity == GameEnum.itemRarity.SR then
|
||||
WwiseAudioMgr:PlaySound("ui_recuit_gacha_result_SR")
|
||||
end
|
||||
self.delayTimer = nil
|
||||
end
|
||||
if mapItemCfgData.Type == GameEnum.itemType.Disc then
|
||||
self.nItemType = GameEnum.itemType.Disc
|
||||
local mapOutfitCfgData = ConfigTable.GetData("Disc", nTid)
|
||||
if mapOutfitCfgData == nil then
|
||||
printError("Outfit Data missing:" .. nTid)
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
self._mapNode.rtOutfit:SetActive(true)
|
||||
self._mapNode.rtChar:SetActive(false)
|
||||
self:SetPngSprite(self._mapNode.imgOutfit, mapItemCfgData.Icon .. AllEnum.OutfitIconSurfix.Gacha)
|
||||
NovaAPI.SetImageSprite(self._mapNode.imgOutfitBg, Settings.AB_ROOT_PATH .. GachaShowResRoot .. "db_gacha_Outfit_" .. AllEnum.FrameColor_New[mapItemCfgData.Rarity] .. ".png")
|
||||
NovaAPI.SetImageSprite(self._mapNode.imgRare, Settings.AB_ROOT_PATH .. GachaShowResRoot .. "rare_character_gacha_" .. AllEnum.FrameColor_New[mapItemCfgData.Rarity] .. ".png")
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgRare)
|
||||
self.sAnimName = mapOutfitAnimName[mapItemCfgData.Rarity]
|
||||
if bNew then
|
||||
self._mapNode.resultItem[1].gameObject:SetActive(false)
|
||||
self._mapNode.resultItem[2].gameObject:SetActive(false)
|
||||
self.bShowItem = false
|
||||
else
|
||||
self._mapNode.resultItem[1].gameObject:SetActive(false)
|
||||
self._mapNode.resultItem[2].gameObject:SetActive(false)
|
||||
self._mapNode.resultItem[1]:SetItem(mapOutfitCfgData.TransformItemId, nil, nil, nil, false, false, false, true, false)
|
||||
self.bShowItem = true
|
||||
end
|
||||
elseif mapItemCfgData.Type == GameEnum.itemType.Char then
|
||||
self.nItemType = GameEnum.itemType.Char
|
||||
local mapCharCfgData = ConfigTable.GetData_Character(nTid)
|
||||
if mapCharCfgData == nil then
|
||||
printError("Char Data missing:" .. nTid)
|
||||
self.gameObject:SetActive(false)
|
||||
return 0
|
||||
end
|
||||
self._mapNode.rtOutfit:SetActive(false)
|
||||
self._mapNode.rtChar:SetActive(true)
|
||||
local mapCfgDataCharSkin = ConfigTable.GetData_CharacterSkin(mapCharCfgData.DefaultSkinId)
|
||||
self:SetPngSprite(self._mapNode.imgChar, mapCfgDataCharSkin.Icon .. AllEnum.CharHeadIconSurfix.GC)
|
||||
NovaAPI.SetImageSprite(self._mapNode.imgCharBg, Settings.AB_ROOT_PATH .. GachaShowResRoot .. "db_gacha_character_" .. AllEnum.FrameColor_New[mapItemCfgData.Rarity] .. ".png")
|
||||
NovaAPI.SetImageSprite(self._mapNode.imgRare, Settings.AB_ROOT_PATH .. GachaShowResRoot .. "rare_character_gacha_" .. AllEnum.FrameColor_New[mapItemCfgData.Rarity] .. ".png")
|
||||
self._mapNode.imgPoint1:SetActive(mapItemCfgData.Rarity ~= 1)
|
||||
self._mapNode.imgPoint2:SetActive(mapItemCfgData.Rarity == 1)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgRare)
|
||||
if bNew then
|
||||
self._mapNode.resultItem[1].gameObject:SetActive(false)
|
||||
self._mapNode.resultItem[2].gameObject:SetActive(false)
|
||||
self.bShowItem = false
|
||||
else
|
||||
self._mapNode.resultItem[1].gameObject:SetActive(false)
|
||||
self._mapNode.resultItem[2].gameObject:SetActive(false)
|
||||
self._mapNode.resultItem[1]:SetItem(mapCharCfgData.FragmentsId, nil, mapCharCfgData.TransformQty, nil, false, false, false, true, false)
|
||||
self.bShowItem = true
|
||||
end
|
||||
self.sAnimName = mapCharAnimName[mapItemCfgData.Rarity]
|
||||
else
|
||||
printError("Item Type Error:" .. mapItemCfgData.Type)
|
||||
self.gameObject:SetActive(false)
|
||||
self.bShowItem = false
|
||||
return 0
|
||||
end
|
||||
if 0 < nDelayTime then
|
||||
self.delayTimer = self:AddTimer(1, nDelayTime, delayCallback, true, true, nil, nil)
|
||||
else
|
||||
delayCallback()
|
||||
end
|
||||
if mapItemCfgData.Rarity == GameEnum.itemRarity.SSR then
|
||||
return 0.35
|
||||
else
|
||||
return 0.1
|
||||
end
|
||||
end
|
||||
function GachaShowResultGrid:LoadPngGacha(sPath)
|
||||
return self:LoadAsset(sPath .. ".png", typeof(Sprite))
|
||||
end
|
||||
function GachaShowResultGrid:ShowAllCardEnd()
|
||||
if self.bShowItem == true then
|
||||
local mapItemCfgData = ConfigTable.GetData_Item(self.nTid)
|
||||
if mapItemCfgData.Type == GameEnum.itemType.Char then
|
||||
self._mapNode.animItem:Play("resultItemRoot_Char")
|
||||
else
|
||||
self._mapNode.animItem:Play("resultItemRoot_Outfit")
|
||||
end
|
||||
self._mapNode.resultItem[1].gameObject:SetActive(true)
|
||||
WwiseAudioMgr:PlaySound("ui_recuit_gacha_result_crystal")
|
||||
else
|
||||
self._mapNode.animItem:Play("empty")
|
||||
end
|
||||
end
|
||||
function GachaShowResultGrid:JumpDelay()
|
||||
if self.delayTimer ~= nil then
|
||||
self.delayTimer:Cancel(true)
|
||||
end
|
||||
end
|
||||
function GachaShowResultGrid:OnClickBtn_ShowDetail()
|
||||
if PlayerData.Guide:GetGuideState() then
|
||||
return
|
||||
end
|
||||
if self.nItemType == nil then
|
||||
return
|
||||
end
|
||||
if self.nItemType == GameEnum.itemType.Disc then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSample, self.nTid)
|
||||
elseif self.nItemType == GameEnum.itemType.Char then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgTrialPanel, PanelId.CharInfoTrial, self.nTid)
|
||||
end
|
||||
end
|
||||
return GachaShowResultGrid
|
||||
Reference in New Issue
Block a user