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
|
||||
Reference in New Issue
Block a user