五星成长礼提交

dev_chengFeng
jiaoyangna 2020-08-19 22:03:47 +08:00
parent 87141ee852
commit fa1f5a7c35
6 changed files with 982 additions and 312 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -346,7 +346,8 @@ end
--第七种 升级限时礼包
function PatFacePanel:OnShowOb7Data()
UIManager.OpenPanel(UIName.UpGradePackagePanel,function() self:ClosePanel() end)
OperatingManager.upGradePackagePanelType = 1
UIManager.OpenPanel(UIName.UpGradePackagePanel,function() self:ClosePanel() end)
end
function PatFacePanel:JumpBtnClickEvent()
if openPanle then

View File

@ -1314,19 +1314,14 @@ function this.TimeFormat()
--限时折扣
local giftList = {}
giftList = this:GetInfoList()
if giftList ~= 0 then
local conditon = false
for i = 1, #giftList do
if giftList[i].dynamicBuyTimes ~= 0 then
conditon = true
break
end
if #giftList > 0 then
this.upGradePackageBtn:SetActive(true)
this.upGradePackageTime.text = TimeToHMS(giftList[1].endTime-GetTimeStamp())
if giftList[1].endTime-GetTimeStamp() < 1 then
OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, giftList[1].goodsId)
end
if conditon then
this.upGradePackageBtn:SetActive(true)
this.upGradePackageTime.text = TimeToHMS(giftList[1].endTime-GetTimeStamp())
end
else
this.upGradePackageBtn:SetActive(false)
end
--轮转活动,乾坤宝盒
@ -1348,7 +1343,15 @@ function this:GetInfoList()
local infoList2 = ConfigManager.GetAllConfigsDataByKey(ConfigName.RechargeCommodityConfig,"ShowType",21)
for index, value in pairs(infoList) do
for i = 1, #infoList2 do
if infoList2[i].Id == value.goodsId then
if infoList2[i].Id == value.goodsId and value.dynamicBuyTimes > 0 then
table.insert(giftList,value)
end
end
end
infoList2 = ConfigManager.GetAllConfigsDataByKey(ConfigName.RechargeCommodityConfig,"ShowType",8)
for index, value in pairs(infoList) do
for i = 1, #infoList2 do
if infoList2[i].Id == value.goodsId and value.dynamicBuyTimes > 0 then
table.insert(giftList,value)
end
end
@ -1406,8 +1409,8 @@ function this.RefreshGiftBtnShow()
local isOpen_328 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_328)
this.upperMonthCardBtn:SetActive(isOpen_128 or isOpen_328)
local isOpen_upgrade = OperatingManager.IsBaseOpen(GoodsTypeDef.UpgradePackage)
this.upGradePackageBtn:SetActive(isOpen_upgrade)
-- local isOpen_upgrade = OperatingManager.IsBaseOpen(GoodsTypeDef.UpgradePackage)
-- this.upGradePackageBtn:SetActive(isOpen_upgrade)
end
--后台推送

View File

@ -18,6 +18,8 @@ local luxuryConfig = ConfigManager.GetConfig(ConfigName.LuxuryFundConfig)
--后端数据 goodsId;//商品id buyTimes; //购买次数 startTime;//开始时间 endTime; //结束时间 dynamicBuyTimes; //可购买次数
local giftGoodsInfo
this.upGradePackagePanelType = 1
this.upGradePackagePanelIndex = 1
--初始化
function this.Initialize()
Game.GlobalEvent:AddEvent(GameEvent.Player.OnLevelChange, function()

View File

@ -11,21 +11,25 @@ local curGiftList = {}
local curGiftId = nil
local curEndTime = 0
local curIndex
local curType
local fun--回调
local rechargeData
local activityType = {
[1] = {name = "等级礼包",timePos = Vector3.New(0,-255.6,0),price = true,comp = "bg1",showType = 21},
[2] = {name = "五星成长礼",timePos = Vector3.New(0,-567,0),price = false,comp = "bg2",showType = 8},
}
--初始化组件(用于子类重写)
function this:InitComponent()
this.btnClose = Util.GetGameObject(self.gameObject,"show/btnBack")
this.btnBuy = Util.GetGameObject(self.gameObject,"show/Button")
this.grid = Util.GetGameObject(self.gameObject,"show/rewards/Grid")
this.endTime = Util.GetGameObject(self.gameObject,"show/endTime"):GetComponent("Text")
this.price = Util.GetGameObject(self.gameObject,"show/Button/Text"):GetComponent("Text")
this.price = Util.GetGameObject(self.gameObject,"show/price/Text1"):GetComponent("Text")
this.arrowsLeft = Util.GetGameObject(self.gameObject,"show/arrows/left")
this.arrowsRight = Util.GetGameObject(self.gameObject,"show/arrows/right")
this.UI_effect_DailyRechargePanel_particle = Util.GetGameObject(self.gameObject, "UI_effect_DailyRechargePanel_particle")
this.times = Util.GetGameObject(self.gameObject,"bg/timesLeft"):GetComponent("Text")
this.Text = Util.GetGameObject(self.gameObject,"bg/hero/Image/Text"):GetComponent("Text")
this.UI_effect_DailyRechargePanel_particle = Util.GetGameObject(self.gameObject, "bg1/UI_effect_DailyRechargePanel_particle")
this.times = Util.GetGameObject(self.gameObject,"show/timesLeft"):GetComponent("Text")
this.tip = Util.GetGameObject(self.gameObject,"show/tip"):GetComponent("Text")
end
--绑定事件(用于子类重写)
@ -41,49 +45,54 @@ function this:BindEvent()
NetManager.RequestBuyGiftGoods(curGiftId, function()
FirstRechargeManager.RefreshAccumRechargeValue(curGiftId)
CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包的红点检测
curGiftList[curIndex].dynamicBuyTimes = curGiftList[curIndex].dynamicBuyTimes - 1
rechargeData.dynamicBuyTimes = rechargeData.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:ClosePanel()
else
if curIndex then
self:Refresh(curIndex)
-- LogGreen("没换界面")
else
if not not curGiftList[curIndex-1] then
self:Refresh(curIndex-1)
-- LogRed("界面-1")
elseif not not curGiftList[curIndex+1] then
self:Refresh(curIndex+1)
-- LogBlue("界面+1")
end
end
if rechargeData.dynamicBuyTimes == 0 then
OperatingManager.SetHadBuyGoodsId({curGiftId})
OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, curGiftId)
end
-- end
this:Refresh()
end)
end
end)
Util.AddClick(this.arrowsLeft,function()
self:Refresh(curIndex-1)
curIndex = curIndex - 1
if curGiftList[curType][curIndex] then
else
curType = curType == 1 and (LengthOfTable(activityType)) or (curType - 1)
for i = curType,1,-1 do
if curGiftList[i] and #curGiftList[i] > 0 then
curType = i
curIndex = #curGiftList[i]
break
end
end
end
OperatingManager.upGradePackagePanelType = curType
OperatingManager.upGradePackagePanelIndex = curIndex
this:Refresh()
end)
Util.AddClick(this.arrowsRight,function()
self:Refresh(curIndex+1)
curIndex = curIndex + 1
if curGiftList[curType][curIndex] then
else
curType = curType == (LengthOfTable(activityType)) and 1 or (curType + 1)
for i = curType,(LengthOfTable(activityType)) do
if curGiftList[i] and #curGiftList[i] > 0 then
curType = i
curIndex = 1
break
end
end
end
OperatingManager.upGradePackagePanelType = curType
OperatingManager.upGradePackagePanelIndex = curIndex
this:Refresh()
end)
end
@ -109,56 +118,88 @@ end
--获取(自己拼凑)礼包数据
function this:GetInfoList()
-- body
local list={}
local infoList = OperatingManager.GetGiftGoodsInfoList(GoodsTypeDef.DirectPurchaseGift)--拿取所有类型5礼包信息(包含需要的礼包)
local infoList2 = ConfigManager.GetAllConfigsDataByKey(ConfigName.RechargeCommodityConfig,"ShowType",21)
for index, value in pairs(infoList) do
for i = 1, #infoList2 do
if infoList2[i].Id == value.goodsId then
table.insert(list,value)
local num = 0
for k,v in pairs(activityType) do
curGiftList[k] = {}
local infoList2 = ConfigManager.GetAllConfigsDataByKey(ConfigName.RechargeCommodityConfig,"ShowType",v.showType)
for index, value in pairs(infoList) do
for i = 1, #infoList2 do
if infoList2[i].Id == value.goodsId and value.dynamicBuyTimes > 0 then
table.insert(curGiftList[k],value)
num = num + 1
end
end
end
end
curGiftList = list
return num
end
function this:OnShow()
local index = 1
this:Refresh(index)
function this:OnShow()
this:Refresh()
end
function this:Refresh(index)
curIndex = index
function this:SetCurTypeAndIndex()
curType = OperatingManager.upGradePackagePanelType and OperatingManager.upGradePackagePanelType or 1
curIndex = OperatingManager.upGradePackagePanelIndex and OperatingManager.upGradePackagePanelIndex or 1
if curGiftList[curType] and #curGiftList[curType] > 0 and curGiftList[curType][curIndex] then
elseif curGiftList[curType] and #curGiftList[curType] > 0 and (not curGiftList[curType][curIndex]) then
curIndex = ##curGiftList[curType]
return curGiftList[curType][curIndex]
else
for k,v in pairs(curGiftList) do
for i = 1 ,#v do
curType = k
curIndex = i
return curGiftList[curType][curIndex]
end
end
end
return curGiftList[curType][curIndex]
end
function this:Refresh()
local num = self:GetInfoList()
if num < 1 then
this:OnClose()
return
end
rechargeData = this:SetCurTypeAndIndex()
for k,v in pairs(activityType) do
Util.GetGameObject(self.gameObject,v.comp):SetActive(false)
end
Util.GetGameObject(self.gameObject,activityType[curType].comp):SetActive(true)
rechargeNum= VipManager.GetChargedNum()
self:GetInfoList()
this.Text.text = Language[12000]..PlayerManager.level..Language[12001]
this.arrowsLeft:SetActive(not not curGiftList[curIndex-1])
this.arrowsRight:SetActive(not not curGiftList[curIndex+1])
curGiftId = curGiftList[curIndex].goodsId
curEndTime = curGiftList[curIndex].endTime
this.tip.text = curType == 1 and Language[12000]..PlayerManager.level..Language[12001] or ""
this.arrowsLeft:SetActive(num > 1)
this.arrowsRight:SetActive(num > 1)
curGiftId = rechargeData.goodsId
curEndTime = rechargeData.endTime
this.endTime.text = Language[11496]..TimeToHMS(curEndTime-GetTimeStamp())
this:SetGfitShow()
this:SetTime()
this.endTime.gameObject:GetComponent("RectTransform").localPosition = activityType[curType].timePos
this:SetGfitShow(rechargeData)
this:SetTime(rechargeData)
end
--设置奖励
local _ItemViewList = {}
function this:SetGfitShow()
function this:SetGfitShow(rechargeData)
for i=1, #RechargeConfig[curGiftId].RewardShow do
if not _ItemViewList[i] then
local view = SubUIManager.Open(SubUIConfig.ItemView,this.grid.transform)
_ItemViewList[i] = view
end
_ItemViewList[i]:OnOpen(false,RechargeConfig[curGiftId].RewardShow[i],1,false)
_ItemViewList[i]:OnOpen(false,RechargeConfig[curGiftId].RewardShow[i],0.95,false)
_ItemViewList[i].gameObject:SetActive(true)
end
this.times.text = Language[10535]..curGiftList[curIndex].dynamicBuyTimes..Language[10054]
this.times.text = Language[10535]..rechargeData.dynamicBuyTimes..Language[10054]
this.price.gameObject:SetActive(activityType[curType].price)
this.price.text = RechargeConfig[curGiftId].Price..Language[10538]
end
--设置剩余时间,取剩余时间最短的礼包(第一个礼包的剩余时间)
--设置剩余时间,取剩余时间最短的礼包
function this:SetTime()
if self.localTimer then
self.localTimer:Stop()
@ -169,23 +210,7 @@ function this:SetTime()
--时间到了之后
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:ClosePanel()
else
if curIndex then
self:Refresh(curIndex)
else
if not not curGiftList[curIndex-1] then
self:Refresh(curIndex-1)
elseif not not curGiftList[curIndex+1] then
self:Refresh(curIndex+1)
end
end
end
this:Refresh()
end
this.endTime.text = Language[11496]..TimeToHMS(curEndTime-GetTimeStamp())
end,1,-1,true)