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