五星成长礼修改提交
parent
905d77b0c6
commit
1f7b161087
File diff suppressed because it is too large
Load Diff
|
@ -87,8 +87,8 @@ local type = {
|
||||||
livePos = Vector2(274.5, -408.1),
|
livePos = Vector2(274.5, -408.1),
|
||||||
liveSize = Vector2(1612, 1802),
|
liveSize = Vector2(1612, 1802),
|
||||||
tipBg = "r_Dungeon_juqingdian",
|
tipBg = "r_Dungeon_juqingdian",
|
||||||
resetTime = string.format("<color=#BA9AC2>%s</color>",specialConfig[66].Value),
|
resetTime = string.format("<color=#DB9A9A>%s</color>",specialConfig[75].Value),
|
||||||
tip = string.format("<color=#BA9AC2>%s</color>",specialConfig[67].Value),
|
tip = string.format("<color=#DB9A9A>%s</color>",specialConfig[76].Value),
|
||||||
redPointType = RedPointType.People_Mirror
|
redPointType = RedPointType.People_Mirror
|
||||||
},
|
},
|
||||||
default = {id = -1,bg = "r_Dungeon_rendi_01"}
|
default = {id = -1,bg = "r_Dungeon_rendi_01"}
|
||||||
|
|
|
@ -3,6 +3,19 @@ HeroStarFeedPage = {}
|
||||||
|
|
||||||
local this = HeroStarFeedPage
|
local this = HeroStarFeedPage
|
||||||
|
|
||||||
|
local RechargeConfig = ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)--整表数据
|
||||||
|
local upgradeConfig = ConfigManager.GetAllConfigsDataByKey(ConfigName.RechargeCommodityConfig,"ShowType",8)--五档奖励数据
|
||||||
|
|
||||||
|
local rechargeNum = 0
|
||||||
|
local cursortingOrder = 0
|
||||||
|
local curGiftList = {}
|
||||||
|
local curGiftId = 0
|
||||||
|
local curEndTime = 0
|
||||||
|
local curIndex
|
||||||
|
local fun--回调
|
||||||
|
--设置奖励
|
||||||
|
local _ItemViewList = {}
|
||||||
|
|
||||||
function HeroStarFeedPage:New(super, gameObject)
|
function HeroStarFeedPage:New(super, gameObject)
|
||||||
local _o
|
local _o
|
||||||
_o = _o or {}
|
_o = _o or {}
|
||||||
|
@ -11,19 +24,19 @@ function HeroStarFeedPage:New(super, gameObject)
|
||||||
_o.fatherClass = super
|
_o.fatherClass = super
|
||||||
_o.gameObject = gameObject
|
_o.gameObject = gameObject
|
||||||
_o:InitComponent(gameObject)
|
_o:InitComponent(gameObject)
|
||||||
|
|
||||||
return _o
|
return _o
|
||||||
end
|
end
|
||||||
|
|
||||||
--- 组件初始化, 跟主面板一起生成
|
--- 组件初始化, 跟主面板一起生成
|
||||||
function HeroStarFeedPage:InitComponent(gameObject)
|
function HeroStarFeedPage:InitComponent(gameObject)
|
||||||
self.rewardGrid = Util.GetGameObject(gameObject, "downLayout/rect/grid")
|
self.btnClose = Util.GetGameObject(self.gameObject,"show/btnBack")
|
||||||
self.itemPre = Util.GetGameObject(gameObject, "downLayout/item")
|
self.btnBuy = Util.GetGameObject(self.gameObject,"show/buy")
|
||||||
|
self.grid = Util.GetGameObject(self.gameObject,"show/rewards/Grid")
|
||||||
self.rewardItemList = {}
|
self.endTime = Util.GetGameObject(self.gameObject,"show/endTime/text"):GetComponent("Text")
|
||||||
self.timeList = {}
|
self.price = Util.GetGameObject(self.btnBuy,"Text"):GetComponent("Text")
|
||||||
self.isClose = true
|
self.arrowsLeft = Util.GetGameObject(self.gameObject,"show/arrows/left")
|
||||||
|
self.arrowsRight = Util.GetGameObject(self.gameObject,"show/arrows/right")
|
||||||
|
self.times = Util.GetGameObject(self.gameObject,"show/timesLeft"):GetComponent("Text")
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroStarFeedPage:OnSortingOrderChange(parentSorting)
|
function HeroStarFeedPage:OnSortingOrderChange(parentSorting)
|
||||||
|
@ -31,19 +44,63 @@ function HeroStarFeedPage:OnSortingOrderChange(parentSorting)
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroStarFeedPage:BindEvent()
|
function HeroStarFeedPage:BindEvent()
|
||||||
|
Util.AddClick(self.btnClose,function()
|
||||||
|
self:OnClose()
|
||||||
|
end)
|
||||||
|
|
||||||
|
Util.AddClick(self.btnBuy,function()
|
||||||
|
if AppConst.isSDKLogin then
|
||||||
|
PayManager.Pay({ Id = curGiftId })
|
||||||
|
else
|
||||||
|
NetManager.RequestBuyGiftGoods(curGiftId, function()
|
||||||
|
FirstRechargeManager.RefreshAccumRechargeValue(curGiftId)
|
||||||
|
CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包的红点检测
|
||||||
|
curGiftList[curIndex].dynamicBuyTimes = curGiftList[curIndex].dynamicBuyTimes - 1
|
||||||
|
--判断可购买次数是否为零,是剔除礼包信息
|
||||||
|
-- for i = 1, #curGiftList do
|
||||||
|
if curGiftList[curIndex].dynamicBuyTimes == 0 then
|
||||||
|
OperatingManager.SetHadBuyGoodsId({curGiftId})
|
||||||
|
OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, curGiftId)
|
||||||
|
if curGiftList[curIndex-1] then
|
||||||
|
curIndex = curIndex -1
|
||||||
|
-- LogBlue("QWEQWEQWEWQ")
|
||||||
|
-- elseif curGiftList[curIndex+1] then
|
||||||
|
-- curIndex = curIndex +1
|
||||||
|
-- LogRed("ZXCZXCZX")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- end
|
||||||
|
--判断是否有礼包
|
||||||
|
self:GetInfoList()
|
||||||
|
if #curGiftList == 0 then
|
||||||
|
self:OnClose()
|
||||||
|
else
|
||||||
|
if curIndex then
|
||||||
|
self:FreshRewardShow(curIndex)
|
||||||
|
-- LogGreen("没换界面")
|
||||||
|
else
|
||||||
|
if curGiftList[curIndex-1] then
|
||||||
|
self:FreshRewardShow(curIndex - 1)
|
||||||
|
elseif curGiftList[curIndex+1] then
|
||||||
|
self:FreshRewardShow(curIndex + 1)
|
||||||
|
-- LogRed("界面-1")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
Util.AddClick(self.arrowsLeft,function()
|
||||||
|
self:FreshRewardShow(curIndex-1)
|
||||||
|
end)
|
||||||
|
|
||||||
|
Util.AddClick(self.arrowsRight,function()
|
||||||
|
self:FreshRewardShow(curIndex+1)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function HeroStarFeedPage:AddListener()
|
|
||||||
Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, self.RechargeSuccessFunc, self)
|
|
||||||
end
|
|
||||||
|
|
||||||
function HeroStarFeedPage:RemoveListener()
|
|
||||||
Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, self.RechargeSuccessFunc, self)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 充值成功回调
|
-- 充值成功回调
|
||||||
function HeroStarFeedPage:RechargeSuccessFunc(id)
|
function HeroStarFeedPage:RechargeSuccessFunc(id)
|
||||||
FirstRechargeManager.RefreshAccumRechargeValue(id)
|
FirstRechargeManager.RefreshAccumRechargeValue(id)
|
||||||
|
@ -52,185 +109,116 @@ function HeroStarFeedPage:RechargeSuccessFunc(id)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function HeroStarFeedPage:AddListener()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--移除事件监听(用于子类重写)
|
||||||
|
function HeroStarFeedPage:RemoveListener()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--- 这玩意点击购买之后外面会刷4遍,……,自己不主动退出。就不让他刷新
|
--- 这玩意点击购买之后外面会刷4遍,……,自己不主动退出。就不让他刷新
|
||||||
function HeroStarFeedPage:OnShow()
|
function HeroStarFeedPage:OnShow()
|
||||||
if not self.isClose then return end
|
if not self.isClose then return end
|
||||||
--Log("self.isClose "..tostring(self.isClose))
|
local index = 1
|
||||||
self:FreshRewardShow()
|
self:FreshRewardShow(index)
|
||||||
self:SetTimeStart()
|
|
||||||
self.isClose = false
|
self.isClose = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroStarFeedPage:SetTimeStart()
|
--获取(自己拼凑)礼包数据
|
||||||
--- 启动一个通用定时器
|
function HeroStarFeedPage:GetInfoList()
|
||||||
self.timer = nil
|
-- body
|
||||||
self.timer = Timer.New(function ()
|
local list={}
|
||||||
for i = 1 , #self.timeList do
|
local infoList = OperatingManager.GetGiftGoodsInfoList(GoodsTypeDef.DirectPurchaseGift)--拿取所有类型5礼包信息(包含需要的礼包)
|
||||||
local value = self.timeList[i]
|
for index, value in pairs(infoList) do
|
||||||
if value then
|
for i = 1, #upgradeConfig do
|
||||||
local duration = value.endTime - PlayerManager.serverTime
|
if upgradeConfig[i].Id == value.goodsId then
|
||||||
if value.isActive then
|
table.insert(list,value)
|
||||||
if duration >= 0 then
|
end
|
||||||
value.timeComp.text = Language[10541] .. TimeToDHMS(duration) .. ")"
|
end
|
||||||
|
end
|
||||||
|
curGiftList = list
|
||||||
|
end
|
||||||
|
|
||||||
|
function HeroStarFeedPage:FreshRewardShow(index)
|
||||||
|
curIndex = index
|
||||||
|
rechargeNum= VipManager.GetChargedNum()
|
||||||
|
self:GetInfoList()
|
||||||
|
self.arrowsLeft:SetActive(not (not curGiftList[curIndex-1]))
|
||||||
|
self.arrowsRight:SetActive(not (not curGiftList[curIndex+1]))
|
||||||
|
curGiftId = curGiftList[curIndex].goodsId
|
||||||
|
curEndTime = curGiftList[curIndex].endTime
|
||||||
|
self.endTime.text = Language[11496]..TimeToHMS(curEndTime-GetTimeStamp())
|
||||||
|
self:SetGfitShow()
|
||||||
|
self:SetTime()
|
||||||
|
end
|
||||||
|
|
||||||
|
--设置剩余时间,取剩余时间最短的礼包(第一个礼包的剩余时间)
|
||||||
|
function this:SetTime()
|
||||||
|
if self.localTimer then
|
||||||
|
self.localTimer:Stop()
|
||||||
|
self.localTimer = nil
|
||||||
|
end
|
||||||
|
self.localTimer = Timer.New(function()
|
||||||
|
-- curEndTime= curEndTime-1
|
||||||
|
--时间到了之后
|
||||||
|
if curEndTime-GetTimeStamp() < 0 then
|
||||||
|
OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, curGiftId)
|
||||||
|
if curGiftList[curIndex-1] then
|
||||||
|
curIndex = curIndex -1
|
||||||
|
end
|
||||||
|
self:GetInfoList()
|
||||||
|
if #curGiftList == 0 then
|
||||||
|
self:OnClose()
|
||||||
|
else
|
||||||
|
if curIndex then
|
||||||
|
self:FreshRewardShow(curIndex)
|
||||||
else
|
else
|
||||||
-- 从激活状态到结束状态
|
if not not curGiftList[curIndex-1] then
|
||||||
Log(Language[10542])
|
self:FreshRewardShow(curIndex-1)
|
||||||
value.timeComp.text = ""
|
elseif not not curGiftList[curIndex+1] then
|
||||||
table.remove(self.timeList, i)
|
self:FreshRewardShow(curIndex+1)
|
||||||
OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, value.id)
|
end
|
||||||
self:FreshRewardShow()
|
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
|
||||||
value.timeComp.text = ""
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
this.endTime.text = Language[11496]..TimeToHMS(curEndTime-GetTimeStamp())
|
||||||
end, 1, -1, true)
|
end,1,-1,true)
|
||||||
self.timer:Start()
|
self.localTimer:Start()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function HeroStarFeedPage:SetGfitShow()
|
||||||
function HeroStarFeedPage:FreshRewardShow()
|
for i=1, #RechargeConfig[curGiftId].RewardShow do
|
||||||
---没有激活的礼包直接回到主界面
|
if not _ItemViewList[i] then
|
||||||
local hasActiveGift = OperatingManager.IsHeroGiftActive()
|
local view = SubUIManager.Open(SubUIConfig.ItemView,self.grid.transform)
|
||||||
|
_ItemViewList[i] = view
|
||||||
if not hasActiveGift then
|
|
||||||
if AppConst.isSDKLogin then
|
|
||||||
UIManager.OpenPanel(UIName.ExpertPanel)
|
|
||||||
else
|
|
||||||
CallBackOnPanelClose(UIName.RewardItemPopup, function()
|
|
||||||
UIManager.OpenPanel(UIName.ExpertPanel)
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
_ItemViewList[i]:OnOpen(false,RechargeConfig[curGiftId].RewardShow[i],1,false)
|
||||||
return
|
_ItemViewList[i].gameObject:SetActive(true)
|
||||||
end
|
end
|
||||||
|
self.times.text = Language[10535]..curGiftList[curIndex].dynamicBuyTimes..Language[10054]
|
||||||
|
self.price.text = RechargeConfig[curGiftId].Price..Language[10538]
|
||||||
local shopData = OperatingManager.GetGiftShowData()
|
|
||||||
|
|
||||||
for i = 1, #shopData do
|
|
||||||
|
|
||||||
-- 重新组的数据,检查到上一个是有数据的条目时,隐藏, 然后需要清除缓存,
|
|
||||||
if shopData[i].leftBuyTime <= 0 then
|
|
||||||
if self.rewardItemList[i] then
|
|
||||||
self.rewardItemList[i]:SetActive(false)
|
|
||||||
table.remove( self.rewardItemList, i)
|
|
||||||
end
|
|
||||||
break
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local info = shopData[i]
|
|
||||||
if not self.rewardItemList[i] then
|
|
||||||
self.rewardItemList[i] = newObjToParent(self.itemPre, self.rewardGrid)
|
|
||||||
self.rewardItemList[i]:SetActive(true)
|
|
||||||
end
|
|
||||||
|
|
||||||
local item = self.rewardItemList[i]
|
|
||||||
|
|
||||||
local giftName = Util.GetGameObject(item, "titleImage/root/desc"):GetComponent("Text")
|
|
||||||
local leftTime = Util.GetGameObject(item, "titleImage/root/leftTime"):GetComponent("Text")
|
|
||||||
local btnBuy = Util.GetGameObject(item, "getRewardBtn")
|
|
||||||
local buyRed = Util.GetGameObject(btnBuy, "redPoint")
|
|
||||||
local buyText = Util.GetGameObject(btnBuy, "Text"):GetComponent("Text")
|
|
||||||
local leftNum = Util.GetGameObject(item, "left"):GetComponent("Text")
|
|
||||||
local grid = Util.GetGameObject(item, "scroll/content")
|
|
||||||
|
|
||||||
leftTime.text = ""
|
|
||||||
-- if not self.timeList[info.id] then
|
|
||||||
self.timeList[i] = {}
|
|
||||||
self.timeList[i].id = info.id
|
|
||||||
self.timeList[i].timeComp = leftTime
|
|
||||||
self.timeList[i].isActive = false
|
|
||||||
self.timeList[i].endTime = 0
|
|
||||||
-- end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- 设置购买按钮信息
|
|
||||||
giftName.text = info.name
|
|
||||||
|
|
||||||
local leftTime = info.leftBuyTime
|
|
||||||
leftNum.gameObject:SetActive(leftTime > 0)
|
|
||||||
leftNum.text = Language[10535] .. leftTime
|
|
||||||
Util.SetGray(btnBuy, leftTime == 0)
|
|
||||||
local str = leftTime > 0 and info.price .. Language[10538] or Language[10543]
|
|
||||||
buyText.text = str
|
|
||||||
self.timeList[i].isActive = leftTime > 0
|
|
||||||
self.timeList[i].endTime = leftTime > 0 and info.endTime or 0
|
|
||||||
|
|
||||||
|
|
||||||
self:SetRewardData(item, info, grid)
|
|
||||||
|
|
||||||
--- 注册购买函数
|
|
||||||
Util.AddOnceClick(btnBuy, function ()
|
|
||||||
if leftTime < 1 then
|
|
||||||
PopupTipPanel.ShowTip(Language[10544])
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if AppConst.isSDKLogin then
|
|
||||||
PayManager.Pay({ Id = info.id })
|
|
||||||
else
|
|
||||||
NetManager.RequestBuyGiftGoods(info.id, function(msg)
|
|
||||||
self:RechargeSuccessFunc(info.id)
|
|
||||||
Log(Language[10545])
|
|
||||||
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function this:SetRewardData(item, info, grid)
|
|
||||||
--- 设置奖励内容
|
|
||||||
--- 当前的礼包内容
|
|
||||||
local curGiftData = info.rewardData
|
|
||||||
|
|
||||||
if self.rewardItemList[item] then
|
|
||||||
for i = 1, 4 do
|
|
||||||
self.rewardItemList[item][i].gameObject:SetActive(false)
|
|
||||||
end
|
|
||||||
for i = 1, #curGiftData do
|
|
||||||
if self.rewardItemList[item][i] then
|
|
||||||
self.rewardItemList[item][i]:OnOpen(false, {curGiftData[i][1],curGiftData[i][2]}, 0.75)
|
|
||||||
self.rewardItemList[item][i].gameObject:SetActive(true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
self.rewardItemList[item]={}
|
|
||||||
for i = 1, 4 do
|
|
||||||
self.rewardItemList[item][i] = SubUIManager.Open(SubUIConfig.ItemView, grid.transform)
|
|
||||||
self.rewardItemList[item][i].gameObject:SetActive(false)
|
|
||||||
|
|
||||||
end
|
|
||||||
for i = 1, #curGiftData do
|
|
||||||
self.rewardItemList[item][i]:OnOpen(false, {curGiftData[i][1],curGiftData[i][2]}, 0.75)
|
|
||||||
self.rewardItemList[item][i].gameObject:SetActive(true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function HeroStarFeedPage:OnClose()
|
function HeroStarFeedPage:OnClose()
|
||||||
Log("HeroStarFeedPage:OnClose()")
|
Log("HeroStarFeedPage:OnClose()")
|
||||||
if self.timer then
|
if self.localTimer then
|
||||||
self.timer:Stop()
|
self.localTimer:Stop()
|
||||||
self.timer = nil
|
self.localTimer = nil
|
||||||
end
|
end
|
||||||
self.isClose = true
|
self.isClose = true
|
||||||
self.timeList = {}
|
self.gameObject:SetActive(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroStarFeedPage:OnDestroy()
|
function HeroStarFeedPage:OnDestroy()
|
||||||
self.rewardItemList = {}
|
cursortingOrder = 0
|
||||||
|
_ItemViewList = {}
|
||||||
|
if self.localTimer then
|
||||||
|
self.localTimer:Stop()
|
||||||
|
self.localTimer = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue