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