超值返利提交

dev_chengFeng
jiaoyangna 2021-12-16 18:41:30 +08:00
parent c1f0e0f78b
commit 19a1e1b7ca
4 changed files with 624 additions and 1252 deletions

View File

@ -1379,6 +1379,8 @@ ActivityTypeDef = {
ContinuePackage = 87, -- 连购礼包
Incarnation = 86,--抽卡变身卡
jingjishilian = 88,
chaozhifanli = 90,
}
--活动结束需要处理面板关闭类型
ActivityTypePanel = {

View File

@ -1,31 +1,24 @@
require("Base/BasePanel")
local ContinuePackagePanel = Inherit(BasePanel)
local PremiumRebatePanel = Inherit(BasePanel)
local this = PremiumRebatePanel
local rechargeConfig = ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local artResourcesConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
local activityRewardConfig = ConfigManager.GetConfig(ConfigName.ActivityRewardConfig)
local TabBox = require("Modules/Common/TabBox")
local tabs = {}
local BTNS = {
[1] = {bg1 = "b_baibao_andi",bg2 = "b_baibao_liangdi",text1 = "b_baibao_liangouhaoli-a",text2 = "b_baibao_liangouhaoli",title = "b_baibao_liangouhaoli-b"},
[2] = {bg1 = "b_baibao_andi",bg2 = "b_baibao_liangdi",text1 = "b_baibao_meiritehui-a",text2 = "b_baibao_meiritehui",title = "b_baibao_meiritehui-b"},
[3] = {bg1 = "b_baibao_andi",bg2 = "b_baibao_liangdi",text1 = "b_baibao_chaozhitehui-a",text2 = "b_baibao_chaozhitehui",title = "b_baibao_chaozhitehui-b"},
[1] = {bg1 = "b_baibao_andi",bg2 = "b_baibao_liangdi",text1 = "6\n",showType = 48,},
[2] = {bg1 = "b_baibao_andi",bg2 = "b_baibao_liangdi",text1 = "30\n",showType = 49,},
}
local btnType = {
LianGou = 1,
Meiri = 2,
ChaoZhi = 3,
}
function ContinuePackagePanel:InitComponent()
local curPage = 1
function PremiumRebatePanel:InitComponent()
self.spLoader = SpriteLoader.New()
self.backBtn = Util.GetGameObject(self.gameObject, "closeBtn")
self.itemPre = Util.GetGameObject(self.gameObject, "Bg/ItemPre")
self.scrollItem = Util.GetGameObject(self.gameObject, "Bg/scroll")
self.itemPre = Util.GetGameObject(self.gameObject, "Bg/scroll/ItemPre")
self.backArena = Util.GetGameObject(self.gameObject, "backArena")
self.itemPre:SetActive(false)
self.leftTime = Util.GetGameObject(self.gameObject, "Bg/time/leftTime"):GetComponent("Text")
self.title = Util.GetGameObject(self.gameObject, "Bg/NameBg/Image"):GetComponent("Image")
self.btnList = {}
for i = 1, 3 do
self.btnList[i] = Util.GetGameObject(self.gameObject, "Bg/btns/btn"..i)
end
self.leftTime = Util.GetGameObject(self.gameObject, "Bg/time"):GetComponent("Text")
self.tabbox = Util.GetGameObject(self.gameObject, "bg/tabbox")
local rootHight = self.scrollItem.transform.rect.height
local width = self.scrollItem.transform.rect.width
@ -34,225 +27,150 @@ function ContinuePackagePanel:InitComponent()
self.scrollView.moveTween.MomentumAmount = 1
self.scrollView.moveTween.Strength = 2
self.scrollView.elastic = false
self.itemViewList = {}
self.sortingOrder = 0
self.curPage = btnType.LianGou
end
--绑定事件(用于子类重写)
function ContinuePackagePanel:BindEvent()
for i = 1, self.backArena.transform.childCount do
Util.AddOnceClick(self.backArena.transform:GetChild(i-1).gameObject, function()
self:ClosePanel()
end)
end
for j = 1, 3 do
Util.AddOnceClick(self.btnList[j], function()
if self.curPage ~= j then
self.curPage = j
ContinuePackagePanel:Refresh(true,true)
end
end)
function PremiumRebatePanel:BindEvent()
Util.AddOnceClick(self.backBtn, function()
self:ClosePanel()
end)
-- 初始化Tab管理器
self.PageTabCtrl = TabBox.New()
self.PageTabCtrl:SetTabAdapter(self.PageTabAdapter)
self.PageTabCtrl:SetTabIsLockCheck(self.PageTabIsLockCheck)
self.PageTabCtrl:SetChangeTabCallBack(self.OnPageTabChange)
end
function PremiumRebatePanel.PageTabAdapter(tab, index, status)
local select = Util.GetGameObject(tab, "select")
local title = Util.GetGameObject(tab, "title"):GetComponent("Text")
title.text = self.spLoader:LoadSprite(BTNS[index].text1)
if status == "select" then
select.gameObject:SetActive(true)
else
select.gameObject:SetActive(false)
end
end
function PremiumRebatePanel.PageTabIsLockCheck()
return true
end
function PremiumRebatePanel.OnPageTabChange(index)
if curPage == index then
return
end
curPage = index
this:Refresh(false,false)
end
--添加事件监听(用于子类重写)
function ContinuePackagePanel:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Activity.OnActivityProgressStateChange,self.Refresh,self)
function PremiumRebatePanel:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Activity.OnActivityProgressStateChange,self.OnShow,self)
end
--移除事件监听(用于子类重写)
function ContinuePackagePanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnActivityProgressStateChange,self.Refresh,self)
function PremiumRebatePanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnActivityProgressStateChange,self.OnShow,self)
end
function ContinuePackagePanel:OnSortingOrderChange()
function PremiumRebatePanel:OnSortingOrderChange()
end
local fun
--界面打开时调用(用于子类重写)
function ContinuePackagePanel:OnOpen(_linkActId, _fun)
self.linkActId = _linkActId
self.fun = _fun
function PremiumRebatePanel:OnOpen()
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function ContinuePackagePanel:OnShow()
ContinuePackagePanel:Refresh(true,true)
function PremiumRebatePanel:OnShow()
self.actData = ActivityGiftManager.GetActivityInfo(ActivityTypeDef.chaozhifanli)
self.actConfigData = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId",ActivityTypeDef.chaozhifanli)
self:Refresh(true,true)
end
function ContinuePackagePanel:Refresh(isTop,isAni)
self.actData = CommonActPageManager.GetData(ActivityTypeDef.ContinuePackage,self.linkActId)
self:SetBtns()
function PremiumRebatePanel:Refresh(isTop,isAni)
self.giftData = DynamicActivityManager.GetGiftDataByType({DataType.Direct,5,BTNS[curPage].showType})
self:SetRewardShow(isTop,isAni)
self:SetTime()
end
function ContinuePackagePanel:SetBtns()
self.title.sprite = self.spLoader:LoadSprite(BTNS[self.curPage].title)
for i = 1, 3 do
if not self.actData.rewards[i] or #self.actData.rewards[i] <= 0 then
self.btnList[i]:SetActive(false)
else
self.btnList[i]:SetActive(true)
if self.curPage == i then
Util.GetGameObject(self.btnList[i],"Image"):GetComponent("Image").sprite = self.spLoader:LoadSprite(BTNS[i].text2)
self.btnList[i]:GetComponent("Image").sprite = self.spLoader:LoadSprite(BTNS[i].bg2)
else
Util.GetGameObject(self.btnList[i],"Image"):GetComponent("Image").sprite = self.spLoader:LoadSprite(BTNS[i].text1)
self.btnList[i]:GetComponent("Image").sprite = self.spLoader:LoadSprite(BTNS[i].bg1)
end
end
end
end
function ContinuePackagePanel:SetRewardShow(isTop,isAni)
function PremiumRebatePanel:SetRewardShow(isTop,isAni)
-- 显示
self.scrollView:SetData(self.actData.rewards[self.curPage], function (index, item)
if self.actData.rewards[self.curPage][index].otherData.Type == self.curPage then
self:ShowSingleHero(item, self.actData.rewards[self.curPage][index],index)
end
self.scrollView:SetData(self.giftData, function (index, item)
self:ShowSingleHero(item, self.giftData[index],index)
end,not isTop,not isAni)
end
function ContinuePackagePanel:ShowSingleHero(go,data,index)
function PremiumRebatePanel:ShowSingleHero(go,_data,index)
local title = Util.GetGameObject(go, "title"):GetComponent("Text")
local grid = Util.GetGameObject(go, "Grid")
local btnGet = Util.GetGameObject(go, "btnGet")
local btnText = Util.GetGameObject(go, "btnGet/Text"):GetComponent("Text")
local btnImg = Util.GetGameObject(go, "btnGet"):GetComponent("Image")
local buyDayImg = Util.GetGameObject(go, "bugDay")
local buyDayText = Util.GetGameObject(buyDayImg, "Text"):GetComponent("Text")
local obj = Util.GetGameObject(btnGet, "Obj")
local icon = Util.GetGameObject(obj, "icon"):GetComponent("Image")
local cost = Util.GetGameObject(obj, "cost"):GetComponent("Text")
local canBuyTime = Util.GetGameObject(go, "times"):GetComponent("Text")
local missionConfigData = self.actConfigData[(curPage - 1)*15 + index]
title.text = missionConfigData.ContentsShow
if not self.itemViewList[go] then
self.itemViewList[go] = {}
end
for k,v in ipairs(self.itemViewList[go]) do
v.gameObject:SetActive(false)
end
for i = 1, #data.otherData.Reward do
local rewardData = data.otherData.Reward[i]
for i = 1, #_data.data.shows do
if not self.itemViewList[go][i] then
self.itemViewList[go][i] = SubUIManager.Open(SubUIConfig.ItemView, grid.transform)
self.itemViewList[go][i] = SubUIManager.Open(SubUIConfig.ItemView,self.grid.transform)
self.itemViewList[go][i].gameObject:SetActive(false)
end
self.itemViewList[go][i]:OnOpen(false, rewardData, 0.9,false,false,false,self.sortingOrder)
self.itemViewList[go][i]:OnOpen(false, {_data.data.shows[i][1],_data.data.shows[i][2],_data.data.shows[i][3]}, 0.9,false,false,false,self.sortingOrder)
self.itemViewList[go][i].gameObject:SetActive(true)
end
-- LogBlue("Id:"..tostring(data.missionId).." state:"..tostring(data.state).." progress:"..tostring(data.progress))
Util.SetGray(btnGet,false)
buyDayImg:SetActive(false)
btnText.gameObject:SetActive(false)
obj:SetActive(false)
canBuyTime.text = string.format( "剩余:%s次",data.progress)
canBuyTime.gameObject:SetActive(self.curPage ~= btnType.LianGou)--第一页连购好礼不显示剩余次数
btnImg.sprite = self.spLoader:LoadSprite("s_slbz_anniu")
if data.otherData.GoodType == 1 then--直购
btnText.gameObject:SetActive(true)
btnText.text = string.format("%s 元",data.otherData.Price)
if data.state == 8 then
btnImg.sprite = self.spLoader:LoadSprite("s_slbz_1anniuhuise")
btnText.text = Language[10514]
canBuyTime.text = ""
elseif data.state == 3 then
Util.SetGray(btnGet,true)
elseif data.state == 2 then
Util.SetGray(btnGet,true)
buyDayImg:SetActive(true)
buyDayText.text = string.format("%s日后可购",data.otherData.canBuyDay)
end
elseif data.otherData.GoodType == 2 then--商品
obj:SetActive(true)
icon.sprite = self.spLoader:LoadSprite(GetSpriteNameByItemId(data.otherData.Price[1]))
cost.text = data.otherData.Price[2]
if data.state == 8 then
obj:SetActive(false)
btnText.gameObject:SetActive(true)
btnImg.sprite = self.spLoader:LoadSprite("s_slbz_1anniuhuise")
btnText.text = Language[10514]
canBuyTime.text = ""
elseif data.state == 3 then
Util.SetGray(btnGet,true)
elseif data.state == 2 then
Util.SetGray(btnGet,true)
buyDayImg:SetActive(true)
buyDayText.text = string.format("%s日后可购",data.otherData.canBuyDay)
end
end
Util.AddOnceClick(btnGet,function ()
if data.state == 1 then
if data.otherData.GoodType == 1 then--直购
PayManager.Pay(data.otherData.GoodId, function(id)
FirstRechargeManager.RefreshAccumRechargeValue(data.otherData.GoodId)
OperatingManager.SetHadBuyGoodsId({data.otherData.GoodId})
-- OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, data.otherData.GoodId)
btnText.gameObject:SetActive(true)
btnText.text = string.format("%s 元",_data.data.price)
local missionData = self.actData.mission[(curPage - 1)*15 + index]
if missionData then
if missionData.state == 0 then
Util.SetGray(btnGet,false)
Util.AddOnceClick(btnGet,function ()
PayManager.Pay(_data.data.shopData.goodsId, function(id)
FirstRechargeManager.RefreshAccumRechargeValue(_data.data.shopData.goodsId)
OperatingManager.SetHadBuyGoodsId({_data.data.shopData.goodsId})
missionData.state = 0
self:ShowSingleHero(go,_data,index)
self:Refresh(false,false)
end)
elseif data.otherData.GoodType == 2 then--商品
NetManager.ContinueBuyItemRequest(data.otherData.GoodId,function (drop)
UIManager.OpenPanel(UIName.RewardItemPopup,drop,1,function()
self:Refresh(false,false)
end)
end)
end
elseif data.state == 3 then
PopupTipPanel.ShowTip("请先购买上一礼包,即可解锁此礼包")
elseif data.state == 2 then
PopupTipPanel.ShowTip("礼包尚未开启,请耐心等待")
end)
else
Util.SetGray(btnGet,true)
btnText.text = "已购买"
end
end)
else
Util.SetGray(btnGet,true)
PopupTipPanel.ShowTip("累计购买X天后才可购买")
end
end
function ContinuePackagePanel:SetTime()
function PremiumRebatePanel:SetTime()
end
function PremiumRebatePanel:OnClose()
if self.timer then
self.timer:Stop()
self.timer = nil
end
local time = self.actData.endTime - GetTimeStamp()
local leftTime = time - 86280
if self.curPage == btnType.Meiri and leftTime > 0 then--如果是每日特惠显示每日倒计时
time = CalculateSecondsNowTo_N_OClock(24)
end
--每日特惠处理
self.leftTime.text = Language[10512]..TimeToFelaxible(time)
if self.curPage == btnType.Meiri then
self.leftTime.text = Language[10023]..TimeToFelaxible(time)
end
self.timer = Timer.New(function ()
if time <= 0 then
if self.curPage == btnType.Meiri and leftTime > 0 then
self:Refresh(false,false)
return
end
self:ClosePanel()
end
self.leftTime.text = Language[10512]..TimeToFelaxible(time)
if self.curPage == btnType.Meiri then
self.leftTime.text = Language[10023]..TimeToFelaxible(time)
end
time = time -1
end, 1, -1, true)
self.timer:Start()
end
function ContinuePackagePanel:OnClose()
if self.timer then
self.timer:Stop()
self.timer = nil
end
self.sortingOrder = 0
if self.fun then
self.fun()
self.fun = nil
end
end
--界面销毁时调用(用于子类重写)
function ContinuePackagePanel:OnDestroy()
function PremiumRebatePanel:OnDestroy()
self.spLoader:Destroy()
self.itemViewList = {}
end
return ContinuePackagePanel
return PremiumRebatePanel

View File

@ -728,7 +728,7 @@ function this.CreatSingleData(shopData,DataTypeIndex,buyType)
if data.shopItemData.DailyUpdate == 7 then
data.tipImageText = Language[11699]
elseif data.shopItemData.DailyUpdate == 15 then
data.tipImageText = Language[11700]
data.tipImageText = Language[11700]
elseif data.shopItemData.DailyUpdate == 30 then
data.tipImageText = Language[11357]
elseif shopData.goodsId == 9107 then