ssssssssss
parent
8de4272e9f
commit
1637af8dee
|
|
@ -6,12 +6,12 @@
|
|||
* @Copyright Copyright (c) 2019, MagicianJoker
|
||||
--]]
|
||||
local DayRewardItem = require("Modules/FirstRecharge/DayRewardItem")
|
||||
local rechargeConfig=ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
|
||||
local rechargeConfig = ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
|
||||
---@class FirstRechargePanel
|
||||
local FirstRechargePanel = quick_class("FirstRechargePanel", BasePanel)
|
||||
local rechargeId=0
|
||||
local kMaxTab, kMaxDay = 2, 3
|
||||
local isPay=false
|
||||
local rechargeId = 0
|
||||
local kMaxTab, kMaxDay = 3, 3
|
||||
local isPay = false
|
||||
local TextColorDef = {
|
||||
[1] = Color.New(48 / 255, 31 / 255, 33 / 255, 1),
|
||||
[2] = Color.New(246 / 255, 235 / 255, 179 / 255, 1)
|
||||
|
|
@ -38,13 +38,13 @@ local TipConfig = {
|
|||
},
|
||||
}
|
||||
|
||||
local heroImage={
|
||||
[1]="Dragon Ball- (624)",
|
||||
[2]="Dragon Ball- (624)",
|
||||
[3]="Dragon Ball- (624)",
|
||||
[4]="Dragon Ball- (624)",
|
||||
local heroImage = {
|
||||
[1] = "Dragon Ball- (624)",
|
||||
[2] = "Dragon Ball- (624)",
|
||||
[3] = "Dragon Ball- (624)",
|
||||
[4] = "Dragon Ball- (624)",
|
||||
}
|
||||
--
|
||||
--
|
||||
local _MoneyDataNum = {}
|
||||
|
||||
|
||||
|
|
@ -84,18 +84,18 @@ function FirstRechargePanel:InitComponent()
|
|||
self.selectTabs[i] = Util.GetGameObject(self.tabs[i], "selected")
|
||||
self.tabTitles[i] = Util.GetGameObject(self.tabs[i], "title"):GetComponent("Text")
|
||||
self.tabRedPoint[i] = Util.GetGameObject(self.tabs[i], "redPoint")
|
||||
-- self.tabs[i]:GetComponent(Text)
|
||||
self.tabs[i]:SetActive(true)
|
||||
end
|
||||
self.selectTabIndex = -1
|
||||
|
||||
self.rewardDay = Util.GetGameObject(self.transform, "frame/rewardBg/rewardDay")
|
||||
self.rewardGrid = Util.GetGameObject(self.transform, "frame/rewardBg/rewardBg")
|
||||
self.rewardGridPos = self.rewardGrid.transform.localPosition
|
||||
self.rewardGridPos = self.rewardGrid.transform.localPosition
|
||||
self.itemWidth = self.rewardGrid:GetComponent("HorizontalLayoutGroup").spacing
|
||||
self.preList={}
|
||||
self.preList = {}
|
||||
self.dayRewardList = {}
|
||||
for i = 1, 4 do
|
||||
table.insert(self.preList,Util.GetGameObject(self.transform, "frame/tabsContent/tabs_"..i))
|
||||
table.insert(self.preList, Util.GetGameObject(self.transform, "frame/tabsContent/tabs_" .. i))
|
||||
end
|
||||
|
||||
--bottomPart
|
||||
|
|
@ -109,7 +109,6 @@ function FirstRechargePanel:InitComponent()
|
|||
|
||||
BindLightFlash(Util.GetGameObject(self.effect, "saoguang"), Util.GetGameObject(self.frame, "bg_piaodai/Image (3)"))
|
||||
BindLightFlash(Util.GetGameObject(self.effect, "saoguang (1)"), self.reChargeBtn)
|
||||
|
||||
end
|
||||
|
||||
function FirstRechargePanel:BindEvent()
|
||||
|
|
@ -127,7 +126,7 @@ function FirstRechargePanel:BindEvent()
|
|||
self:OnTabClicked(i)
|
||||
end)
|
||||
end
|
||||
Util.AddClick(self.heroPreviewBtn, function()
|
||||
Util.AddClick(self.heroPreviewBtn, function()
|
||||
local fakeId = tonumber(1008)
|
||||
local fdata, fseed = BattleManager.GetFakeBattleData(fakeId)
|
||||
local testFightData = {
|
||||
|
|
@ -141,12 +140,12 @@ function FirstRechargePanel:BindEvent()
|
|||
Util.AddClick(self.tenProBtn, function()
|
||||
local heroId = 0
|
||||
for _, rewardInfo in ConfigPairs(activityRewardConfig) do
|
||||
if rewardInfo.ActivityId == ActivityTypeDef.FirstRecharge then--ActivityTypeDef.AccumulativeRecharge then
|
||||
if rewardInfo.ActivityId == ActivityTypeDef.FirstRecharge then --ActivityTypeDef.AccumulativeRecharge then
|
||||
heroId = rewardInfo.Reward[1][1]
|
||||
break
|
||||
end
|
||||
end
|
||||
UIManager.OpenPanel(UIName.RoleGetInfoPopup, false, heroId,10)
|
||||
UIManager.OpenPanel(UIName.RoleGetInfoPopup, false, heroId, 10)
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
@ -161,8 +160,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)
|
||||
--self.isPlayAnim = true
|
||||
context = context and context or {}
|
||||
self.selectTabIndex = context.tabIndex and context.tabIndex or 1
|
||||
|
|
@ -178,13 +178,13 @@ function FirstRechargePanel:OnOpen(context,_fun)
|
|||
self.effect:SetActive(false)
|
||||
self.ani.enabled = false
|
||||
self.closeBtn:GetComponent("Button").enabled = false
|
||||
-- self.tabs[1]:SetActive(false)
|
||||
Timer.New(function ()
|
||||
-- self.tabs[1]:SetActive(false)
|
||||
Timer.New(function()
|
||||
self.frame:SetActive(true)
|
||||
self.effect:SetActive(true)
|
||||
--self.ani.enabled = true
|
||||
end, qyTime):Start()
|
||||
Timer.New(function ()
|
||||
Timer.New(function()
|
||||
--self.tabs[1]:SetActive(true)
|
||||
self.closeBtn:GetComponent("Button").enabled = true
|
||||
end, qyTime + 1):Start()
|
||||
|
|
@ -194,7 +194,7 @@ function FirstRechargePanel:OnShow()
|
|||
--self.reChargeTips.text = string.format("已充值 %s 元", FirstRechargeManager.GetAccumRechargeValue())
|
||||
self.activityInfo = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.FirstRecharge)
|
||||
local AccumRecharge = 0
|
||||
if not self.activityInfo then
|
||||
if not self.activityInfo then
|
||||
self:ClosePanel()
|
||||
return
|
||||
end
|
||||
|
|
@ -208,13 +208,8 @@ function FirstRechargePanel:OnShow()
|
|||
local money = activityRewardConfig[missInfo.missionId].Values[1][1]
|
||||
--LogError("money===="..money)
|
||||
--local index = FirstRechargeManager.GetFirstRechargeIndexByMoney(money)
|
||||
local index=0
|
||||
if money==10000 then
|
||||
index=1
|
||||
else
|
||||
index=2
|
||||
end
|
||||
if _MoneyDataNum[index]==nil then
|
||||
local index = FirstRechargeManager.GetFirstRechargeIndexByMoney(money)
|
||||
if not _MoneyDataNum[index] then
|
||||
_MoneyDataNum[index] = {}
|
||||
end
|
||||
table.insert(_MoneyDataNum[index], missInfo)
|
||||
|
|
@ -222,17 +217,17 @@ function FirstRechargePanel:OnShow()
|
|||
end
|
||||
|
||||
-- 判断数据
|
||||
local minIndex=1
|
||||
local minIndex = 1
|
||||
for index, dataList in pairs(_MoneyDataNum) do
|
||||
if dataList and #dataList > 0 then
|
||||
-- 排序
|
||||
table.sort(dataList,function(a,b)
|
||||
-- 排序
|
||||
table.sort(dataList, function(a, b)
|
||||
return a.missionId < b.missionId
|
||||
end)
|
||||
local isAll=true
|
||||
local isAll = true
|
||||
for key, value in pairs(dataList) do
|
||||
if value.state~=1 then
|
||||
isAll=false
|
||||
if value.state ~= 1 then
|
||||
isAll = false
|
||||
end
|
||||
end
|
||||
if isAll then
|
||||
|
|
@ -244,27 +239,26 @@ function FirstRechargePanel:OnShow()
|
|||
minIndex = index
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
-- 如果想看的不存在就显示最小的
|
||||
-- if not _MoneyDataNum[self.selectTabIndex] or #_MoneyDataNum[self.selectTabIndex] <= 0 then
|
||||
if self.selectTabIndex==1 then
|
||||
self.selectTabIndex = minIndex
|
||||
end
|
||||
|
||||
-- if not _MoneyDataNum[self.selectTabIndex] or #_MoneyDataNum[self.selectTabIndex] <= 0 then
|
||||
if self.selectTabIndex == 1 then
|
||||
self.selectTabIndex = minIndex
|
||||
end
|
||||
|
||||
--end
|
||||
|
||||
self.reChargeTips.text = Language[10664]..string.format(MoneyUtil.GetMoneyUnitName(),AccumRecharge)--string.format(Language[10665], AccumRecharge)
|
||||
|
||||
self.reChargeTips.text = Language[10664] ..
|
||||
string.format(MoneyUtil.GetMoneyUnitName(), AccumRecharge) --string.format(Language[10665], AccumRecharge)
|
||||
self:OnTabChanged(self.selectTabIndex)
|
||||
for i = 1, kMaxTab do
|
||||
self:SetTabRedPointStatus(i)
|
||||
end
|
||||
|
||||
-- 判断页签切换是否显示
|
||||
Util.GetGameObject(self.transform, "frame/tabsContent"):SetActive(table.nums(_MoneyDataNum)>1)
|
||||
Util.GetGameObject(self.transform, "frame/tabsContent"):SetActive(table.nums(_MoneyDataNum) > 1)
|
||||
end
|
||||
|
||||
function FirstRechargePanel:OnTabClicked(index)
|
||||
|
|
@ -275,31 +269,28 @@ function FirstRechargePanel:OnTabClicked(index)
|
|||
end
|
||||
|
||||
function FirstRechargePanel:OnTabChanged(index)
|
||||
LogError("index==================="..index)
|
||||
self.hero.sprite=self.spLoader:LoadSprite(heroImage[index])
|
||||
LogError("index===================" .. index)
|
||||
self.hero.sprite = self.spLoader:LoadSprite(heroImage[index])
|
||||
for i, select in ipairs(self.selectTabs) do
|
||||
select:SetActive(i == index)
|
||||
end
|
||||
if index==4 then
|
||||
if index == 4 then
|
||||
self.heroPreviewBtn:SetActive(false)
|
||||
else
|
||||
self.heroPreviewBtn:SetActive(true)
|
||||
end
|
||||
local money=0
|
||||
for i, title in ipairs(self.tabTitles) do
|
||||
title.color = i == index and TextColorDef[2] or TextColorDef[1]
|
||||
--local money = FirstRechargeManager.GetFirstRechargeMoneyByIndex(i)
|
||||
if i==1 then
|
||||
title.text ="超值首充"
|
||||
elseif i==2 then
|
||||
title.text ="豪华首充"
|
||||
if i == 1 then
|
||||
title.text = "优选首充"
|
||||
elseif i == 2 then
|
||||
title.text = "尊享首充"
|
||||
elseif i == 3 then
|
||||
title.text = "至臻首充"
|
||||
end
|
||||
end
|
||||
if index==1 then
|
||||
money=10000
|
||||
elseif index==2 then
|
||||
money=20000
|
||||
end
|
||||
|
||||
self.stageImage6.gameObject:SetActive(index == 5)
|
||||
self.stageImage30.gameObject:SetActive(index == 5)
|
||||
self.stageImage100.gameObject:SetActive(index == 5)
|
||||
|
|
@ -308,33 +299,33 @@ function FirstRechargePanel:OnTabChanged(index)
|
|||
self.selectTabIndex = index
|
||||
local AccumRecharge = 0
|
||||
self.offsetIndex = 0
|
||||
|
||||
--local money = FirstRechargeManager.GetFirstRechargeMoneyByIndex(index)
|
||||
rechargeId=money
|
||||
|
||||
|
||||
|
||||
local money = FirstRechargeManager.GetFirstRechargeMoneyByIndex(index)
|
||||
rechargeId = money
|
||||
|
||||
|
||||
local tempData = _MoneyDataNum[index]
|
||||
isPay=false
|
||||
isPay = false
|
||||
for _, missInfo in ipairs(tempData) do
|
||||
if missInfo and missInfo.progress and activityRewardConfig[missInfo.missionId].Values[1][1] == money then
|
||||
AccumRecharge = missInfo.progress
|
||||
LogError("missionInfo.state=="..missInfo.state)
|
||||
LogError("missionInfo.state==" .. missInfo.state)
|
||||
-- if AccumRecharge >= activityRewardConfig[missInfo.missionId].Values[1][1] then
|
||||
-- local day = GetTimePass(FirstRechargeManager.GetRechargeTime())--FirstRechargeManager.GetRechargeTime()
|
||||
-- if missInfo.state ~= 1 and activityRewardConfig[missInfo.missionId].Values[1][2] <= day then
|
||||
-- self.offsetIndex = _
|
||||
-- break
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
if missInfo.state>0 then
|
||||
isPay=true
|
||||
if missInfo.state > 0 then
|
||||
isPay = true
|
||||
end
|
||||
end
|
||||
end
|
||||
if isPay then
|
||||
self.reChargeTxt.text=Language[10514]
|
||||
self.reChargeTxt.text = Language[10514]
|
||||
else
|
||||
self.reChargeTxt.text=rechargeConfig[money].Price..Language[11358]
|
||||
self.reChargeTxt.text = rechargeConfig[money].Price .. Language[11358]
|
||||
end
|
||||
if self.offsetIndex == 0 then
|
||||
self.offsetIndex = 1
|
||||
|
|
@ -345,20 +336,21 @@ function FirstRechargePanel:OnTabChanged(index)
|
|||
vec.x = self.rewardGridPos.x - #tempData * self.itemWidth
|
||||
self.rewardGrid.transform.localPosition = vec
|
||||
local x = self.rewardGridPos.x - (self.offsetIndex - 1) * self.itemWidth
|
||||
local vec2 = Vector3.New(x,self.rewardGridPos.y,self.rewardGridPos.z)
|
||||
local vec2 = Vector3.New(x, self.rewardGridPos.y, self.rewardGridPos.z)
|
||||
-- --self.tween = self.rewardGrid.gameObject.transform:DOLocalMove(vec2, 0.5):OnStart(function() end):OnUpdate(function() --TODO:测试速度
|
||||
-- end):OnComplete(function ()
|
||||
-- --self.rewardGrid.transform.localPosition = vec2
|
||||
-- end):OnComplete(function ()
|
||||
-- --self.rewardGrid.transform.localPosition = vec2
|
||||
-- end)
|
||||
else
|
||||
local x = self.rewardGridPos.x - (self.offsetIndex - 1) * self.itemWidth
|
||||
local vec2 = Vector3.New(x,self.rewardGridPos.y,self.rewardGridPos.z)
|
||||
local vec2 = Vector3.New(x, self.rewardGridPos.y, self.rewardGridPos.z)
|
||||
--self.rewardGrid.transform.localPosition = vec2
|
||||
end
|
||||
end
|
||||
|
||||
function FirstRechargePanel:ShowContent(index)
|
||||
local tempData = {}
|
||||
LogError("sssssssssssssssssssssssssssss" .. tostring(index))
|
||||
for _, missionInfo in ipairs(_MoneyDataNum[index]) do
|
||||
table.insert(tempData, activityRewardConfig[missionInfo.missionId])
|
||||
end
|
||||
|
|
@ -368,17 +360,17 @@ function FirstRechargePanel:ShowContent(index)
|
|||
dayRewardItem.gameObject:SetActive(false)
|
||||
end
|
||||
|
||||
for i = 1,math.max(#self.dayRewardList,#tempData) do
|
||||
for i = 1, math.max(#self.dayRewardList, #tempData) do
|
||||
if not tempData[i] then
|
||||
self.dayRewardList[i].gameObject:SetActive(false)
|
||||
else
|
||||
if not self.dayRewardList[i] then
|
||||
--local go = newObjToParent(self.rewardDay,self.rewardGrid)
|
||||
local go=self.rewardGrid.transform:GetChild(i-1).gameObject
|
||||
self.dayRewardList[i] = DayRewardItem.new(self,go)
|
||||
local go = self.rewardGrid.transform:GetChild(i - 1).gameObject
|
||||
self.dayRewardList[i] = DayRewardItem.new(self, go)
|
||||
end
|
||||
self.dayRewardList[i].gameObject:SetActive(true)
|
||||
self.dayRewardList[i]:SetValue(tempData[i],self.sortingOrder)
|
||||
self.dayRewardList[i]:SetValue(tempData[i], self.sortingOrder)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -394,12 +386,12 @@ end
|
|||
|
||||
function FirstRechargePanel:OnRechargeBtnClicked()
|
||||
if isPay then
|
||||
return
|
||||
return
|
||||
end
|
||||
PayManager.Pay(rechargeId,function()
|
||||
--self:OnShow()
|
||||
self.activityInfo = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.FirstRecharge)
|
||||
_MoneyDataNum = {}
|
||||
PayManager.Pay(rechargeId, function()
|
||||
--self:OnShow()
|
||||
self.activityInfo = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.FirstRecharge)
|
||||
_MoneyDataNum = {}
|
||||
for _, missInfo in ipairs(self.activityInfo.mission) do
|
||||
if missInfo and missInfo.progress then
|
||||
-- 获取充值额度
|
||||
|
|
@ -408,26 +400,21 @@ function FirstRechargePanel:OnRechargeBtnClicked()
|
|||
-- 构建数据
|
||||
local money = activityRewardConfig[missInfo.missionId].Values[1][1]
|
||||
--LogError("money===="..money)
|
||||
--local index = FirstRechargeManager.GetFirstRechargeIndexByMoney(money)
|
||||
local index=0
|
||||
if money==10000 then
|
||||
index=1
|
||||
else
|
||||
index=2
|
||||
end
|
||||
if _MoneyDataNum[index]==nil then
|
||||
local index = FirstRechargeManager.GetFirstRechargeIndexByMoney(money)
|
||||
if _MoneyDataNum[index] == nil then
|
||||
_MoneyDataNum[index] = {}
|
||||
end
|
||||
table.insert(_MoneyDataNum[index], missInfo)
|
||||
end
|
||||
end
|
||||
self.reChargeTips.text = Language[10664]..string.format(MoneyUtil.GetMoneyUnitName(),AccumRecharge)--string.format(Language[10665], AccumRecharge)
|
||||
self.reChargeTips.text = Language[10664] ..
|
||||
string.format(MoneyUtil.GetMoneyUnitName(), AccumRecharge) --string.format(Language[10665], AccumRecharge)
|
||||
self:OnTabChanged(self.selectTabIndex)
|
||||
for i = 1, kMaxTab do
|
||||
self:SetTabRedPointStatus(i)
|
||||
end
|
||||
-- 判断页签切换是否显示
|
||||
Util.GetGameObject(self.transform, "frame/tabsContent"):SetActive(table.nums(_MoneyDataNum)>1)
|
||||
-- 判断页签切换是否显示
|
||||
Util.GetGameObject(self.transform, "frame/tabsContent"):SetActive(table.nums(_MoneyDataNum) > 1)
|
||||
end)
|
||||
--JumpManager.GoJump(36004)
|
||||
-- if not ShopManager.IsActive(SHOP_TYPE.SOUL_STONE_SHOP) then
|
||||
|
|
@ -444,7 +431,6 @@ function FirstRechargePanel:OnRechargeBtnClicked()
|
|||
-- JumpManager.GoJump(36008)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
end
|
||||
|
||||
function FirstRechargePanel:SetTabRedPointStatus(tabIndex)
|
||||
|
|
@ -452,13 +438,14 @@ function FirstRechargePanel:SetTabRedPointStatus(tabIndex)
|
|||
local redPointStatus = FirstRechargeManager.GetRedPointStatus(tabIndex)
|
||||
self.tabRedPoint[tabIndex]:SetActive(redPointStatus)
|
||||
end
|
||||
|
||||
--界面关闭时调用(用于子类重写)
|
||||
function FirstRechargePanel:OnClose()
|
||||
if fun then
|
||||
fun()
|
||||
fun = nil
|
||||
end
|
||||
self.rewardGrid.transform.localPosition = self.rewardGridPos
|
||||
self.rewardGrid.transform.localPosition = self.rewardGridPos
|
||||
end
|
||||
|
||||
function FirstRechargePanel:OnDestroy()
|
||||
|
|
@ -468,4 +455,5 @@ function FirstRechargePanel:OnDestroy()
|
|||
end
|
||||
self.dayRewardList = {}
|
||||
end
|
||||
return FirstRechargePanel
|
||||
|
||||
return FirstRechargePanel
|
||||
|
|
|
|||
Loading…
Reference in New Issue