【连购礼包】提交
parent
73d0e79bb1
commit
bc69e64b81
|
@ -1,5 +1,5 @@
|
||||||
require("Base/BasePanel")
|
require("Base/BasePanel")
|
||||||
local ContinueGiftPanel = Inherit(BasePanel)
|
local ContinuePackagePanel = Inherit(BasePanel)
|
||||||
local rechargeConfig = ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
|
local rechargeConfig = ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
|
||||||
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||||||
local artResourcesConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
|
local artResourcesConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
|
||||||
|
@ -9,7 +9,7 @@ local BTNS = {
|
||||||
[3] = {bg1 = "b_baibao_andi",bg2 = "b_baibao_liangdi",text1 = "b_baibao_chaozhitehui-a",text2 = "b_baibao_chaozhitehui",title = "b_baibao_chaozhitehui-b"},
|
[3] = {bg1 = "b_baibao_andi",bg2 = "b_baibao_liangdi",text1 = "b_baibao_chaozhitehui-a",text2 = "b_baibao_chaozhitehui",title = "b_baibao_chaozhitehui-b"},
|
||||||
}
|
}
|
||||||
|
|
||||||
function ContinueGiftPanel:InitComponent()
|
function ContinuePackagePanel:InitComponent()
|
||||||
self.spLoader = SpriteLoader.New()
|
self.spLoader = SpriteLoader.New()
|
||||||
self.scrollItem = Util.GetGameObject(self.gameObject, "Bg/scroll")
|
self.scrollItem = Util.GetGameObject(self.gameObject, "Bg/scroll")
|
||||||
self.itemPre = Util.GetGameObject(self.gameObject, "Bg/scroll/ItemPre")
|
self.itemPre = Util.GetGameObject(self.gameObject, "Bg/scroll/ItemPre")
|
||||||
|
@ -35,7 +35,7 @@ function ContinueGiftPanel:InitComponent()
|
||||||
end
|
end
|
||||||
|
|
||||||
--绑定事件(用于子类重写)
|
--绑定事件(用于子类重写)
|
||||||
function ContinueGiftPanel:BindEvent()
|
function ContinuePackagePanel:BindEvent()
|
||||||
for i = 1, self.backArena.transform.childCount do
|
for i = 1, self.backArena.transform.childCount do
|
||||||
Util.AddOnceClick(self.backArena.transform:GetChild(i-1).gameObject, function()
|
Util.AddOnceClick(self.backArena.transform:GetChild(i-1).gameObject, function()
|
||||||
self:ClosePanel()
|
self:ClosePanel()
|
||||||
|
@ -45,46 +45,46 @@ function ContinueGiftPanel:BindEvent()
|
||||||
Util.AddOnceClick(self.btnList[j], function()
|
Util.AddOnceClick(self.btnList[j], function()
|
||||||
if self.curPage ~= j then
|
if self.curPage ~= j then
|
||||||
self.curPage = j
|
self.curPage = j
|
||||||
ContinueGiftPanel:Refresh(true,true)
|
ContinuePackagePanel:Refresh(true,true)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--添加事件监听(用于子类重写)
|
--添加事件监听(用于子类重写)
|
||||||
function ContinueGiftPanel:AddListener()
|
function ContinuePackagePanel:AddListener()
|
||||||
Game.GlobalEvent:AddEvent(GameEvent.Activity.OnActivityProgressStateChange,self.Refresh,self)
|
Game.GlobalEvent:AddEvent(GameEvent.Activity.OnActivityProgressStateChange,self.Refresh,self)
|
||||||
end
|
end
|
||||||
|
|
||||||
--移除事件监听(用于子类重写)
|
--移除事件监听(用于子类重写)
|
||||||
function ContinueGiftPanel:RemoveListener()
|
function ContinuePackagePanel:RemoveListener()
|
||||||
Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnActivityProgressStateChange,self.Refresh,self)
|
Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnActivityProgressStateChange,self.Refresh,self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ContinueGiftPanel:OnSortingOrderChange()
|
function ContinuePackagePanel:OnSortingOrderChange()
|
||||||
end
|
end
|
||||||
local fun
|
local fun
|
||||||
--界面打开时调用(用于子类重写)
|
--界面打开时调用(用于子类重写)
|
||||||
function ContinueGiftPanel:OnOpen(_linkActId, _fun)
|
function ContinuePackagePanel:OnOpen(_linkActId, _fun)
|
||||||
self.linkActId = _linkActId
|
self.linkActId = _linkActId
|
||||||
self.fun = _fun
|
self.fun = _fun
|
||||||
end
|
end
|
||||||
|
|
||||||
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
||||||
function ContinueGiftPanel:OnShow()
|
function ContinuePackagePanel:OnShow()
|
||||||
ContinueGiftPanel:Refresh(true,true)
|
ContinuePackagePanel:Refresh(true,true)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ContinueGiftPanel:Refresh(isTop,isAni)
|
function ContinuePackagePanel:Refresh(isTop,isAni)
|
||||||
self.actData = CommonActPageManager.GetData(ActivityTypeDef.ContinueGift,self.linkActId)
|
self.actData = CommonActPageManager.GetData(ActivityTypeDef.ContinuePackage,self.linkActId)
|
||||||
self:SetBtns()
|
self:SetBtns()
|
||||||
self:SetRewardShow(isTop,isAni)
|
self:SetRewardShow(isTop,isAni)
|
||||||
self:SetTime()
|
self:SetTime()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ContinueGiftPanel:SetBtns()
|
function ContinuePackagePanel:SetBtns()
|
||||||
self.title.sprite = self.spLoader:LoadSprite(BTNS[self.curPage].title)
|
self.title.sprite = self.spLoader:LoadSprite(BTNS[self.curPage].title)
|
||||||
for i = 1, 3 do
|
for i = 1, 3 do
|
||||||
if #self.actData.rewards[i] <= 0 then
|
if not self.actData.rewards[i] or #self.actData.rewards[i] <= 0 then
|
||||||
self.btnList[i]:SetActive(false)
|
self.btnList[i]:SetActive(false)
|
||||||
else
|
else
|
||||||
self.btnList[i]:SetActive(true)
|
self.btnList[i]:SetActive(true)
|
||||||
|
@ -99,7 +99,7 @@ function ContinueGiftPanel:SetBtns()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ContinueGiftPanel:SetRewardShow(isTop,isAni)
|
function ContinuePackagePanel:SetRewardShow(isTop,isAni)
|
||||||
-- 显示
|
-- 显示
|
||||||
self.scrollView:SetData(self.actData.rewards[self.curPage], function (index, item)
|
self.scrollView:SetData(self.actData.rewards[self.curPage], function (index, item)
|
||||||
if self.actData.rewards[self.curPage][index].otherData.Type == self.curPage then
|
if self.actData.rewards[self.curPage][index].otherData.Type == self.curPage then
|
||||||
|
@ -108,7 +108,7 @@ function ContinueGiftPanel:SetRewardShow(isTop,isAni)
|
||||||
end,not isTop,not isAni)
|
end,not isTop,not isAni)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ContinueGiftPanel:ShowSingleHero(go,data,index)
|
function ContinuePackagePanel:ShowSingleHero(go,data,index)
|
||||||
local grid = Util.GetGameObject(go, "Grid")
|
local grid = Util.GetGameObject(go, "Grid")
|
||||||
local btnGet = Util.GetGameObject(go, "btnGet")
|
local btnGet = Util.GetGameObject(go, "btnGet")
|
||||||
local btnText = Util.GetGameObject(go, "btnGet/Text"):GetComponent("Text")
|
local btnText = Util.GetGameObject(go, "btnGet/Text"):GetComponent("Text")
|
||||||
|
@ -134,7 +134,7 @@ function ContinueGiftPanel:ShowSingleHero(go,data,index)
|
||||||
self.itemViewList[go][i].gameObject:SetActive(true)
|
self.itemViewList[go][i].gameObject:SetActive(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- LogBlue("data.progress:"..tostring(data.progress))
|
LogBlue("Id:"..tostring(data.missionId).." state:"..tostring(data.state).." progress:"..tostring(data.progress))
|
||||||
Util.SetGray(btnGet,false)
|
Util.SetGray(btnGet,false)
|
||||||
buyDayImg:SetActive(false)
|
buyDayImg:SetActive(false)
|
||||||
btnText.gameObject:SetActive(false)
|
btnText.gameObject:SetActive(false)
|
||||||
|
@ -142,12 +142,12 @@ function ContinueGiftPanel:ShowSingleHero(go,data,index)
|
||||||
if data.otherData.GoodType == 1 then--直购
|
if data.otherData.GoodType == 1 then--直购
|
||||||
btnText.gameObject:SetActive(true)
|
btnText.gameObject:SetActive(true)
|
||||||
btnText.text = string.format("%s 元",data.otherData.Price)
|
btnText.text = string.format("%s 元",data.otherData.Price)
|
||||||
if data.progress == 8 then
|
if data.state == 8 then
|
||||||
btnImg.sprite = self.spLoader:LoadSprite("s_slbz_1anniuhuise")
|
btnImg.sprite = self.spLoader:LoadSprite("s_slbz_1anniuhuise")
|
||||||
btnText.text = Language[10514]
|
btnText.text = Language[10514]
|
||||||
elseif data.progress == 3 then
|
elseif data.state == 3 then
|
||||||
Util.SetGray(btnGet,true)
|
Util.SetGray(btnGet,true)
|
||||||
elseif data.progress == 2 then
|
elseif data.state == 2 then
|
||||||
Util.SetGray(btnGet,true)
|
Util.SetGray(btnGet,true)
|
||||||
buyDayImg:SetActive(true)
|
buyDayImg:SetActive(true)
|
||||||
buyDayText.text = string.format("%s日后可购",data.otherData.canBuyDay)
|
buyDayText.text = string.format("%s日后可购",data.otherData.canBuyDay)
|
||||||
|
@ -156,23 +156,23 @@ function ContinueGiftPanel:ShowSingleHero(go,data,index)
|
||||||
obj:SetActive(true)
|
obj:SetActive(true)
|
||||||
icon.sprite = self.spLoader:LoadSprite(GetSpriteNameByItemId(data.otherData.Price[1]))
|
icon.sprite = self.spLoader:LoadSprite(GetSpriteNameByItemId(data.otherData.Price[1]))
|
||||||
cost.text = data.otherData.Price[2]
|
cost.text = data.otherData.Price[2]
|
||||||
if data.progress == 8 then
|
if data.state == 8 then
|
||||||
obj:SetActive(false)
|
obj:SetActive(false)
|
||||||
btnText.gameObject:SetActive(true)
|
btnText.gameObject:SetActive(true)
|
||||||
btnImg.sprite = self.spLoader:LoadSprite("s_slbz_1anniuhuise")
|
btnImg.sprite = self.spLoader:LoadSprite("s_slbz_1anniuhuise")
|
||||||
btnText.text = Language[10514]
|
btnText.text = Language[10514]
|
||||||
elseif data.progress == 3 then
|
elseif data.state == 3 then
|
||||||
Util.SetGray(btnGet,true)
|
Util.SetGray(btnGet,true)
|
||||||
elseif data.progress == 2 then
|
elseif data.state == 2 then
|
||||||
Util.SetGray(btnGet,true)
|
Util.SetGray(btnGet,true)
|
||||||
buyDayImg:SetActive(true)
|
buyDayImg:SetActive(true)
|
||||||
buyDayText.text = string.format("%s日后可购",data.otherData.canBuyDay)
|
buyDayText.text = string.format("%s日后可购",data.otherData.canBuyDay)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- LogYellow("GoodId:"..tostring(data.otherData.GoodId).." progress:"..tostring(data.progress))
|
-- LogYellow("GoodId:"..tostring(data.otherData.GoodId).." state:"..tostring(data.state))
|
||||||
Util.AddOnceClick(btnGet,function ()
|
Util.AddOnceClick(btnGet,function ()
|
||||||
if data.progress == 1 then
|
if data.state == 1 then
|
||||||
-- PayManager.Pay(data.otherData.GoodId, function(id)
|
-- PayManager.Pay(data.otherData.GoodId, function(id)
|
||||||
-- FirstRechargeManager.RefreshAccumRechargeValue(data.otherData.GoodId)
|
-- FirstRechargeManager.RefreshAccumRechargeValue(data.otherData.GoodId)
|
||||||
-- OperatingManager.SetHadBuyGoodsId({data.otherData.GoodId})
|
-- OperatingManager.SetHadBuyGoodsId({data.otherData.GoodId})
|
||||||
|
@ -180,15 +180,15 @@ function ContinueGiftPanel:ShowSingleHero(go,data,index)
|
||||||
-- self:Refresh(false,false)
|
-- self:Refresh(false,false)
|
||||||
-- end)
|
-- end)
|
||||||
PopupTipPanel.ShowTip("购买")
|
PopupTipPanel.ShowTip("购买")
|
||||||
elseif data.progress == 3 then
|
elseif data.state == 3 then
|
||||||
PopupTipPanel.ShowTip("请先购买上一礼包,即可解锁此礼包")
|
PopupTipPanel.ShowTip("请先购买上一礼包,即可解锁此礼包")
|
||||||
elseif data.progress == 2 then
|
elseif data.state == 2 then
|
||||||
PopupTipPanel.ShowTip("礼包尚未开启,请耐心等待")
|
PopupTipPanel.ShowTip("礼包尚未开启,请耐心等待")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ContinueGiftPanel:SetTime()
|
function ContinuePackagePanel:SetTime()
|
||||||
if self.timer then
|
if self.timer then
|
||||||
self.timer:Stop()
|
self.timer:Stop()
|
||||||
self.timer = nil
|
self.timer = nil
|
||||||
|
@ -205,7 +205,7 @@ function ContinueGiftPanel:SetTime()
|
||||||
self.timer:Start()
|
self.timer:Start()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ContinueGiftPanel:OnClose()
|
function ContinuePackagePanel:OnClose()
|
||||||
if self.timer then
|
if self.timer then
|
||||||
self.timer:Stop()
|
self.timer:Stop()
|
||||||
self.timer = nil
|
self.timer = nil
|
||||||
|
@ -218,9 +218,9 @@ function ContinueGiftPanel:OnClose()
|
||||||
end
|
end
|
||||||
|
|
||||||
--界面销毁时调用(用于子类重写)
|
--界面销毁时调用(用于子类重写)
|
||||||
function ContinueGiftPanel:OnDestroy()
|
function ContinuePackagePanel:OnDestroy()
|
||||||
self.spLoader:Destroy()
|
self.spLoader:Destroy()
|
||||||
self.itemViewList = {}
|
self.itemViewList = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
return ContinueGiftPanel
|
return ContinuePackagePanel
|
|
@ -1048,7 +1048,8 @@ function this:TabBtnAction(id,actType,data)
|
||||||
elseif id == ActivityTypeDef.ChaoFanRuSheng then
|
elseif id == ActivityTypeDef.ChaoFanRuSheng then
|
||||||
UIManager.OpenPanel(UIName.ActivityMainPanel,id)
|
UIManager.OpenPanel(UIName.ActivityMainPanel,id)
|
||||||
elseif id == ActivityTypeDef.TeHuiShenZhuang then
|
elseif id == ActivityTypeDef.TeHuiShenZhuang then
|
||||||
UIManager.OpenPanel(UIName.TeHuiShenZhuangPanel)
|
-- UIManager.OpenPanel(UIName.TeHuiShenZhuangPanel)
|
||||||
|
UIManager.OpenPanel(UIName.ContinuePackagePanel,8601)
|
||||||
elseif id == ActivityTypeDef.ShanHeShiLian then--山河试炼
|
elseif id == ActivityTypeDef.ShanHeShiLian then--山河试炼
|
||||||
UIManager.OpenPanel(UIName.FightLevelTrialPanel)
|
UIManager.OpenPanel(UIName.FightLevelTrialPanel)
|
||||||
elseif id == 78 then
|
elseif id == 78 then
|
||||||
|
|
|
@ -6,6 +6,7 @@ this.TaSuiLingXiaoHistoryDmg = 0
|
||||||
this.DynamicActType = 0
|
this.DynamicActType = 0
|
||||||
|
|
||||||
function this.Initialize()
|
function this.Initialize()
|
||||||
|
this.args = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
--初始化活动的特殊数据(每个活动有单独处理方式,不需要单独处理就不用单独写)
|
--初始化活动的特殊数据(每个活动有单独处理方式,不需要单独处理就不用单独写)
|
||||||
|
@ -315,60 +316,35 @@ local TypeUpdateFunc = {
|
||||||
local rechargeConfig = ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
|
local rechargeConfig = ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
|
||||||
local goodsConfig = ConfigManager.GetConfig(ConfigName.GoodsConfig)
|
local goodsConfig = ConfigManager.GetConfig(ConfigName.GoodsConfig)
|
||||||
local tempDataList = {}
|
local tempDataList = {}
|
||||||
-- for i = 1, #curData.rewards do
|
for i = 1, #curData.rewards do
|
||||||
-- for j = 1, #configData do
|
for j = 1, #configData do
|
||||||
-- if curData.rewards[i].missionId == configData[j].Id then
|
if curData.rewards[i].missionId == configData[j].Id then
|
||||||
-- local tempData = {}
|
local tempData = {}
|
||||||
-- tempData.missionId = configData[j].Id
|
tempData.missionId = configData[j].Id
|
||||||
-- tempData.progress = curData.rewards[i].progress
|
tempData.progress = curData.rewards[i].progress
|
||||||
-- tempData.state = curData.rewards[i].state
|
tempData.state = curData.rewards[i].state
|
||||||
-- tempData.otherData = {}
|
tempData.otherData = {}
|
||||||
-- tempData.otherData.GoodId = configData[j].GoodId
|
tempData.otherData.GoodId = configData[j].GoodId
|
||||||
-- tempData.otherData.canBuyDay = configData[j].BuyDay - curData.value
|
tempData.otherData.canBuyDay = configData[j].BuyDay - curData.value
|
||||||
-- tempData.otherData.GoodType = configData[j].GoodType
|
tempData.otherData.GoodType = configData[j].GoodType
|
||||||
-- if configData[j].GoodType == 1 then
|
tempData.otherData.Type = configData[j].Type
|
||||||
-- tempData.otherData.Name = rechargeConfig[configData[j].GoodId].Name
|
if configData[j].GoodType == 1 then
|
||||||
-- tempData.otherData.Reward = rechargeConfig[configData[j].GoodId].RewardShow
|
tempData.otherData.Name = rechargeConfig[configData[j].GoodId].Name
|
||||||
-- tempData.otherData.Price = rechargeConfig[configData[j].GoodId].Price
|
tempData.otherData.Reward = rechargeConfig[configData[j].GoodId].RewardShow
|
||||||
-- elseif configData[j].GoodType == 2 then
|
tempData.otherData.Price = rechargeConfig[configData[j].GoodId].Price
|
||||||
-- tempData.otherData.Name = goodsConfig[configData[j].GoodId].GoodsName
|
elseif configData[j].GoodType == 2 then
|
||||||
-- tempData.otherData.Reward = goodsConfig[configData[j].GoodId].Goods
|
tempData.otherData.Name = goodsConfig[configData[j].GoodId].GoodsName
|
||||||
-- tempData.otherData.Price = goodsConfig[configData[j].GoodId].Price
|
tempData.otherData.Reward = goodsConfig[configData[j].GoodId].Goods
|
||||||
-- end
|
tempData.otherData.Price = goodsConfig[configData[j].GoodId].Price
|
||||||
-- if not tempDataList[configData[j].Type] then
|
end
|
||||||
-- tempDataList[configData[j].Type] = {}
|
if not tempDataList[configData[j].Type] then
|
||||||
-- end
|
tempDataList[configData[j].Type] = {}
|
||||||
-- table.insert(tempDataList[configData[j].Type],tempData)
|
end
|
||||||
-- end
|
table.insert(tempDataList[configData[j].Type],tempData)
|
||||||
-- end
|
end
|
||||||
-- end
|
|
||||||
-- curData.rewards = tempDataList
|
|
||||||
|
|
||||||
curData.rewards = {}
|
|
||||||
for j = 1, #configData do
|
|
||||||
local data = {}
|
|
||||||
data.missionId = configData[j].Id
|
|
||||||
data.progress = 2
|
|
||||||
data.state = 0
|
|
||||||
data.otherData = {}
|
|
||||||
data.otherData.GoodId = configData[j].GoodId
|
|
||||||
data.otherData.canBuyDay = configData[j].BuyDay - curData.value
|
|
||||||
data.otherData.GoodType = configData[j].GoodType
|
|
||||||
data.otherData.Type = configData[j].Type
|
|
||||||
if configData[j].GoodType == 1 then
|
|
||||||
data.otherData.Name = rechargeConfig[configData[j].GoodId].Name
|
|
||||||
data.otherData.Reward = rechargeConfig[configData[j].GoodId].RewardShow
|
|
||||||
data.otherData.Price = rechargeConfig[configData[j].GoodId].Price
|
|
||||||
elseif configData[j].GoodType == 2 then
|
|
||||||
data.otherData.Name = goodsConfig[configData[j].GoodId].GoodsName
|
|
||||||
data.otherData.Reward = goodsConfig[configData[j].GoodId].Goods
|
|
||||||
data.otherData.Price = goodsConfig[configData[j].GoodId].Price
|
|
||||||
end
|
end
|
||||||
if not curData.rewards[configData[j].Type] then
|
|
||||||
curData.rewards[configData[j].Type] = {}
|
|
||||||
end
|
|
||||||
table.insert(curData.rewards[configData[j].Type],data)
|
|
||||||
end
|
end
|
||||||
|
curData.rewards = tempDataList
|
||||||
for index, value in ipairs(curData.rewards) do
|
for index, value in ipairs(curData.rewards) do
|
||||||
table.sort(value,function (a,b)
|
table.sort(value,function (a,b)
|
||||||
return a.missionId < b.missionId
|
return a.missionId < b.missionId
|
||||||
|
@ -600,7 +576,8 @@ end
|
||||||
|
|
||||||
--==============================以下为通用逻辑=====================================
|
--==============================以下为通用逻辑=====================================
|
||||||
--对外的接口,获取活动信息
|
--对外的接口,获取活动信息
|
||||||
function this.GetData(actType)
|
function this.GetData(actType,...)
|
||||||
|
this.args = {...}
|
||||||
if dataList[actType] then
|
if dataList[actType] then
|
||||||
dataList[actType] = nil
|
dataList[actType] = nil
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue