zhangjiannan 2025-05-22 16:28:15 +08:00
parent 42f824de9b
commit 028684e43b
1 changed files with 68 additions and 65 deletions

View File

@ -13,13 +13,14 @@ local this = FirstRechargePanel
local kMaxTab, kMaxDay = 2, 3 local kMaxTab, kMaxDay = 2, 3
local TextColorDef = { local TextColorDef = {
[1] = Color.New(255 / 255, 255 / 255, 255 / 255, 76/255), [1] = Color.New(255 / 255, 255 / 255, 255 / 255, 76 / 255),
[2] = Color.New(255 / 255, 255 / 255, 255 / 255, 204/255) [2] = Color.New(255 / 255, 255 / 255, 255 / 255, 204 / 255)
} }
local orginLayer local orginLayer
local activityRewardConfig = ConfigManager.GetConfig(ConfigName.ActivityRewardConfig) local activityRewardConfig = ConfigManager.GetConfig(ConfigName.ActivityRewardConfig)
local artResourcesConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig) local artResourcesConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
local specialConfig = ConfigManager.GetConfig(ConfigName.SpecialConfig) local specialConfig = ConfigManager.GetConfig(ConfigName.SpecialConfig)
local heroNum = 0
local thread = nil --协程 local thread = nil --协程
-- --显示英雄ID -- --显示英雄ID
-- local showHeroIDs = { -- local showHeroIDs = {
@ -30,7 +31,7 @@ local thread = nil --协程
-- local showHeroId = 10042 -- local showHeroId = 10042
--当前显示英雄的下标 --当前显示英雄的下标
local showHeroIndex = 0 local showHeroIndex = 0
local shift = {}--档位 local shift = {} --档位
function FirstRechargePanel:InitComponent() function FirstRechargePanel:InitComponent()
orginLayer = 0 orginLayer = 0
@ -43,7 +44,7 @@ function FirstRechargePanel:InitComponent()
this.pro = Util.GetGameObject(this.lihuiInfo, "pro"):GetComponent("Image") this.pro = Util.GetGameObject(this.lihuiInfo, "pro"):GetComponent("Image")
self.closeBtn = Util.GetGameObject(self.transform, "closeBtn") self.closeBtn = Util.GetGameObject(self.transform, "closeBtn")
this.Btnback = Util.GetGameObject(this.transform, "Btnback") this.Btnback = Util.GetGameObject(this.transform, "Btnback")
self.tabs = {} self.tabs = {}
self.selectTabs = {} self.selectTabs = {}
@ -74,7 +75,7 @@ function FirstRechargePanel:InitComponent()
self.dayRewardList = {} self.dayRewardList = {}
for i = 1, kMaxDay do for i = 1, kMaxDay do
self.dayRewardList[i] = DayRewardItem.new(self,self.transform:Find("frame/rewardBg/rewardDay" .. i)) self.dayRewardList[i] = DayRewardItem.new(self, self.transform:Find("frame/rewardBg/rewardDay" .. i))
end end
--bottomPart --bottomPart
@ -93,7 +94,7 @@ function FirstRechargePanel:BindEvent()
Util.AddClick(self.closeBtn, function() Util.AddClick(self.closeBtn, function()
self:ClosePanel() self:ClosePanel()
end) end)
Util.AddClick(this.Btnback, function() Util.AddClick(this.Btnback, function()
self:ClosePanel() self:ClosePanel()
end) end)
Util.AddClick(self.reChargeBtn, function() Util.AddClick(self.reChargeBtn, function()
@ -114,8 +115,9 @@ function FirstRechargePanel:OnSortingOrderChange()
self.dayRewardList[i]:OnSortingOrderChange(self.sortingOrder) self.dayRewardList[i]:OnSortingOrderChange(self.sortingOrder)
end end
end end
local fun = nil local fun = nil
function FirstRechargePanel:OnOpen(context,_fun) function FirstRechargePanel:OnOpen(context, _fun)
context = context and context or {} context = context and context or {}
self.selectTabIndex = context.tabIndex and context.tabIndex or 1 self.selectTabIndex = context.tabIndex and context.tabIndex or 1
fun = _fun fun = _fun
@ -130,13 +132,13 @@ function FirstRechargePanel:OnShow()
AccumRecharge = missInfo.progress AccumRecharge = missInfo.progress
end end
end end
--根据渠道配置界面显示充值金额或充值积分 --根据渠道配置界面显示充值金额或充值积分
if GetChannelConfig().RechargeNum_Mode == 1 then if GetChannelConfig().RechargeNum_Mode == 1 then
self.reChargeTips.text = string.format(GetLanguageStrById(50420), AccumRecharge/1000) self.reChargeTips.text = string.format(GetLanguageStrById(50420), AccumRecharge / 1000)
else else
self.reChargeTips.text = string.format(GetLanguageStrById(10663), AccumRecharge/100) self.reChargeTips.text = string.format(GetLanguageStrById(10663), AccumRecharge / 100)
end end
if AccumRecharge/1000 >= 100 then if AccumRecharge / 1000 >= 100 then
self.reChargeBtn:SetActive(false) self.reChargeBtn:SetActive(false)
else else
self.reChargeBtn:SetActive(true) self.reChargeBtn:SetActive(true)
@ -150,13 +152,13 @@ function FirstRechargePanel:OnShow()
-- Util.GetGameObject(self.oneLihuiInfo,"name"):GetComponent("Text").text = GetLanguageStrById(this.oneHeroData.ReadingName) -- Util.GetGameObject(self.oneLihuiInfo,"name"):GetComponent("Text").text = GetLanguageStrById(this.oneHeroData.ReadingName)
-- Util.GetGameObject(self.oneLihuiInfo,"pro"):GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(this.oneHeroData.PropertyName)) -- Util.GetGameObject(self.oneLihuiInfo,"pro"):GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(this.oneHeroData.PropertyName))
SetHeroData(GetHeroId()) --SetHeroData(GetHeroId())
--随机英雄 --随机英雄
--thread = coroutine.start(function () thread = coroutine.start(function()
--for i = 1, 10, 0 do for i = 1, 10, 0 do
--SetHeroData(GetHeroId()) SetHeroData(GetHeroId())
--end end
--end) end)
end end
function SetHeroData(heroId) function SetHeroData(heroId)
@ -172,45 +174,44 @@ function SetHeroData(heroId)
this.liveNode = LoadHerolive(this.heroData, this.lihui.transform) this.liveNode = LoadHerolive(this.heroData, this.lihui.transform)
--随机英雄 --随机英雄
--[[ if heroNum > 1 then
local stopV3 = Vector3.New(this.heroData.Position[1], this.heroData.Position[2],0) local stopV3 = Vector3.New(this.heroData.Position[1], this.heroData.Position[2], 0)
local startV3 = Vector3.New(this.heroData.Position[1], this.heroData.Position[2],0) local startV3 = Vector3.New(this.heroData.Position[1], this.heroData.Position[2], 0)
local endV3 = Vector3.New(this.heroData.Position[1], this.heroData.Position[2],0) local endV3 = Vector3.New(this.heroData.Position[1], this.heroData.Position[2], 0)
startV3.x = 1000 startV3.x = 1000
endV3.x = -1000 endV3.x = -1000
DoTween.To( DoTween.To(
DG.Tweening.Core.DOGetter_UnityEngine_Vector3( DG.Tweening.Core.DOGetter_UnityEngine_Vector3(
function() function()
return this.liveNode.transform.localPosition return this.liveNode.transform.localPosition
end end
), ),
DG.Tweening.Core.DOSetter_UnityEngine_Vector3( DG.Tweening.Core.DOSetter_UnityEngine_Vector3(
function(progress) function(progress)
this.liveNode.transform.localPosition = progress this.liveNode.transform.localPosition = progress
end end
), ),
stopV3, stopV3,
0.3 0.3
):SetEase(Ease.InQuad) ):SetEase(Ease.InQuad)
coroutine.wait(3) coroutine.wait(3)
DoTween.To( DoTween.To(
DG.Tweening.Core.DOGetter_UnityEngine_Vector3( DG.Tweening.Core.DOGetter_UnityEngine_Vector3(
function() function()
return this.liveNode.transform.localPosition return this.liveNode.transform.localPosition
end end
), ),
DG.Tweening.Core.DOSetter_UnityEngine_Vector3( DG.Tweening.Core.DOSetter_UnityEngine_Vector3(
function(progress) function(progress)
this.liveNode.transform.localPosition = progress this.liveNode.transform.localPosition = progress
end end
), ),
endV3, endV3,
0.3 0.3
):SetEase(Ease.InQuad) ):SetEase(Ease.InQuad)
]] end
coroutine.wait(0.3) coroutine.wait(0.3)
end end
@ -228,7 +229,7 @@ function GetHeroId()
if showHeroIndex > #showHeroIDs then if showHeroIndex > #showHeroIDs then
showHeroIndex = 1 showHeroIndex = 1
end end
heroNum = #showHeroIDs
return showHeroIDs[showHeroIndex] return showHeroIDs[showHeroIndex]
end end
@ -259,8 +260,8 @@ function FirstRechargePanel:ShowContent(index)
local tempData = {} local tempData = {}
for _, rewardInfo in ConfigPairs(activityRewardConfig) do for _, rewardInfo in ConfigPairs(activityRewardConfig) do
if rewardInfo.ActivityId == ActivityTypeDef.FirstRecharge and if rewardInfo.ActivityId == ActivityTypeDef.FirstRecharge and
-- rewardInfo.Values[1][2] == IndexValueDef[index] then -- rewardInfo.Values[1][2] == IndexValueDef[index] then
rewardInfo.Values[1][2] == shift[index] then rewardInfo.Values[1][2] == shift[index] then
table.insert(tempData, rewardInfo) table.insert(tempData, rewardInfo)
end end
end end
@ -289,14 +290,15 @@ function FirstRechargePanel:SetTabRedPointStatus(tabIndex)
end end
self.tabRedPoint[tabIndex]:SetActive(redPointStatus) self.tabRedPoint[tabIndex]:SetActive(redPointStatus)
end end
--界面关闭时调用(用于子类重写) --界面关闭时调用(用于子类重写)
function FirstRechargePanel:OnClose() function FirstRechargePanel:OnClose()
if FirstRechargeManager.GetFirstRewardState() then if FirstRechargeManager.GetFirstRewardState() then
local AgainRechargePanelisEject = PlayerPrefs.GetInt(PlayerManager.uid .. "AgainRechargePanelisEject") == 0 local AgainRechargePanelisEject = PlayerPrefs.GetInt(PlayerManager.uid .. "AgainRechargePanelisEject") == 0
if AgainRechargePanelisEject then if AgainRechargePanelisEject then
PlayerPrefs.SetInt(PlayerManager.uid .. "AgainRechargePanelisEject", 1) PlayerPrefs.SetInt(PlayerManager.uid .. "AgainRechargePanelisEject", 1)
UIManager.OpenPanel(UIName.AgainRechargePanel) UIManager.OpenPanel(UIName.AgainRechargePanel)
end end
end end
if thread then if thread then
coroutine.stop(thread) coroutine.stop(thread)
@ -318,6 +320,7 @@ function FirstRechargePanel:OnClose()
-- this.Onelive = nil -- this.Onelive = nil
-- end -- end
end end
--界面销毁时调用(用于子类重写) --界面销毁时调用(用于子类重写)
function FirstRechargePanel:OnDestroy() function FirstRechargePanel:OnDestroy()
if this.liveNode then if this.liveNode then
@ -327,4 +330,4 @@ function FirstRechargePanel:OnDestroy()
end end
end end
return FirstRechargePanel return FirstRechargePanel