【新将来袭、降妖夺宝】重构提交
parent
6ca32cdde3
commit
958f2774e5
|
@ -5,12 +5,12 @@ local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|||
local artConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
|
||||
local artResourcesConfig =ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
|
||||
local SpiritAnimalConfig = ConfigManager.GetConfig(ConfigName.SpiritAnimal)
|
||||
local globalActive = ConfigManager.GetConfig(ConfigName.GlobalActivity)
|
||||
|
||||
local activityId = 0
|
||||
local singleRecruit = nil
|
||||
local tenRecruit = nil
|
||||
local sortingOrder = 0
|
||||
local parent
|
||||
local freeTime= 0 --免费抽取次数
|
||||
local showData = {}
|
||||
local rewardData = {}
|
||||
|
@ -85,16 +85,39 @@ end
|
|||
function XiangYaoDuoBao:OnSortingOrderChange()
|
||||
end
|
||||
|
||||
function XiangYaoDuoBao:OnShow(_sortingOrder,_parent)
|
||||
local actId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.XiangYaoDuoBao)
|
||||
if not actId or actId <= 0 then return end
|
||||
parent = _parent
|
||||
Util.AddParticleSortLayer(self.effect1, _sortingOrder - sortingOrder)
|
||||
Util.AddParticleSortLayer(self.effect2, _sortingOrder - sortingOrder)
|
||||
sortingOrder = sortingOrder
|
||||
--界面打开时调用(用于子类重写)
|
||||
function XiangYaoDuoBao:OnOpen(_activityConfig,_index,parent)
|
||||
self.actConfig = _activityConfig
|
||||
self.pageIndex = _index
|
||||
self.parent = parent
|
||||
end
|
||||
|
||||
function XiangYaoDuoBao:OnShow(_sortingOrder)
|
||||
self.sortingOrder = _sortingOrder
|
||||
Util.SetParticleSortLayer(self.effect1,self.sortingOrder + 1)
|
||||
Util.AddParticleSortLayer(self.effect2,self.sortingOrder + 1)
|
||||
self.gameObject:SetActive(true)
|
||||
|
||||
this:Refresh()
|
||||
self.actId = self.actConfig.ActId
|
||||
self.actType = self.actConfig.ActiveType > 0 and self.actConfig.ActiveType or self.actConfig.FunType
|
||||
if self.actConfig.IfBack == 1 then
|
||||
if self.actConfig.ActiveType > 0 then
|
||||
local id = ActivityGiftManager.IsActivityTypeOpen(self.actConfig.ActiveType)
|
||||
if id and id > 0 then
|
||||
self.actId = id
|
||||
local actConfig = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.ActivityGroups,"ActId",globalActive[id].ShowArt,"PageType",self.actConfig.PageType,"ActiveType",self.actConfig.ActiveType)
|
||||
if not actConfig then
|
||||
actConfig = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.ActivityGroups,"ActId",id,"PageType",self.actConfig.PageType,"ActiveType",self.actConfig.ActiveType)
|
||||
end
|
||||
if actConfig then
|
||||
self.actConfig = actConfig
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
self:Refresh()
|
||||
end
|
||||
|
||||
function XiangYaoDuoBao:Refresh()
|
||||
|
@ -106,9 +129,9 @@ function XiangYaoDuoBao:Refresh()
|
|||
tenRecruit = array[2]
|
||||
|
||||
CheckRedPointStatus(RedPointType.XiangYaoDuoBao)
|
||||
this:refreshBtnShow()--刷新按钮显示
|
||||
this:TimeCountDown()--时间
|
||||
this:SetData()--加载界面数据立绘+进度条
|
||||
self:refreshBtnShow()--刷新按钮显示
|
||||
self:TimeCountDown()--时间
|
||||
self:SetData()--加载界面数据立绘+进度条
|
||||
end
|
||||
|
||||
function XiangYaoDuoBao:SetData()
|
||||
|
@ -134,14 +157,14 @@ function XiangYaoDuoBao:SetData()
|
|||
Util.GetGameObject(item, "num/Text"):GetComponent("Text").text = LSrewardData[i].Reward[1][2]
|
||||
Util.GetGameObject(item, "Text"):GetComponent("Text").text = LSrewardData[i].Values[1][1]
|
||||
|
||||
Util.GetGameObject(item, "icon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(artConfig[itemConfig[rewardData[i].iconId].ResourceID].Name)
|
||||
Util.GetGameObject(item, "icon"):GetComponent("Image").sprite = self.spLoader:LoadSprite(artConfig[itemConfig[rewardData[i].iconId].ResourceID].Name)
|
||||
Util.GetGameObject(item, "red"):SetActive(rewardData[i].state == 1)
|
||||
local btn = Util.GetGameObject(item, "icon")
|
||||
Util.AddOnceClick(btn,function ()
|
||||
if rewardData[i].state == 1 then
|
||||
NetManager.GetActivityRewardRequest(rewardData[i].missionId,activityId,function (drop)
|
||||
UIManager.OpenPanel(UIName.RewardItemPopup, drop, 1,function ()
|
||||
this:Refresh()
|
||||
self:Refresh()
|
||||
end)
|
||||
end)
|
||||
else
|
||||
|
@ -221,11 +244,11 @@ function XiangYaoDuoBao:refreshBtnShow()
|
|||
local recruitOne = function()
|
||||
RoleLiveGOGraphic.AnimationState:SetAnimation(0, "hit1", true)
|
||||
self.effect1:SetActive(true)
|
||||
self.mainPanel.mask:SetActive(true)
|
||||
self.parent.mask:SetActive(true)
|
||||
Timer.New(function ()
|
||||
RoleLiveGOGraphic.AnimationState:SetAnimation(0, "idle", true)
|
||||
self.effect1:SetActive(false)
|
||||
self.mainPanel.mask:SetActive(false)
|
||||
self.parent.mask:SetActive(false)
|
||||
RecruitManager.RecruitRequest(singleRecruit.Id, function(msg)
|
||||
PrivilegeManager.RefreshPrivilegeUsedTimes(maxtimesId,1)--记录抽卡次数
|
||||
if not isFree and d[1] == 16 then
|
||||
|
@ -254,11 +277,11 @@ function XiangYaoDuoBao:refreshBtnShow()
|
|||
local recruitTen = function()
|
||||
RoleLiveGOGraphic.AnimationState:SetAnimation(0, "hit3", true)
|
||||
self.effect2:SetActive(true)
|
||||
self.mainPanel.mask:SetActive(true)
|
||||
self.parent.mask:SetActive(true)
|
||||
Timer.New(function ()
|
||||
RoleLiveGOGraphic.AnimationState:SetAnimation(0, "idle", true)
|
||||
self.effect2:SetActive(false)
|
||||
self.mainPanel.mask:SetActive(false)
|
||||
self.parent.mask:SetActive(false)
|
||||
RecruitManager.RecruitRequest(tenRecruit.Id, function(msg)
|
||||
PrivilegeManager.RefreshPrivilegeUsedTimes(maxtimesId,10)--记录抽卡次数
|
||||
if d[1] == 16 then
|
||||
|
@ -310,13 +333,13 @@ function XiangYaoDuoBao:TimeCountDown()
|
|||
if timeDown < 1 then
|
||||
self.timer:Stop()
|
||||
self.timer = nil
|
||||
this:Refresh()
|
||||
self:Refresh()
|
||||
return
|
||||
end
|
||||
if timeDown2 < 1 then
|
||||
self.timer:Stop()
|
||||
self.timer = nil
|
||||
parent:ClosePanel()
|
||||
self.parent:ClosePanel()
|
||||
return
|
||||
end
|
||||
timeDown = timeDown - 1
|
||||
|
@ -327,7 +350,7 @@ function XiangYaoDuoBao:TimeCountDown()
|
|||
self.timer:Start()
|
||||
end
|
||||
|
||||
function XiangYaoDuoBao:OnHide()
|
||||
function XiangYaoDuoBao:OnClose()
|
||||
if Live then
|
||||
poolManager:UnLoadLive(bgName, Live)
|
||||
end
|
||||
|
@ -345,7 +368,6 @@ function XiangYaoDuoBao:OnDestroy()
|
|||
poolManager:UnLoadLive(bgName, Live)
|
||||
end
|
||||
Live = nil
|
||||
ActivityDetail.OnDestroy()
|
||||
end
|
||||
|
||||
--添加事件监听(用于子类重写)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
local XinJiangLaiXi = {}
|
||||
local sortingOrder = 0
|
||||
local globalActive = ConfigManager.GetConfig(ConfigName.GlobalActivity)
|
||||
|
||||
function XinJiangLaiXi:New(gameObject)
|
||||
local b = {}
|
||||
|
@ -17,7 +17,7 @@ function XinJiangLaiXi:InitComponent()
|
|||
self.storeBtn = Util.GetGameObject(self.gameObject, "storeBtn")
|
||||
self.helpBtn = Util.GetGameObject(self.gameObject, "helpBtn")
|
||||
self.helpPosition=self.helpBtn:GetComponent("RectTransform").localPosition
|
||||
self.scrollItem = Util.GetGameObject(self.gameObject, "scroller/grid")
|
||||
self.scrollItem = Util.GetGameObject(self.gameObject, "layout/scroller/grid")
|
||||
self.liveRoot = Util.GetGameObject(self.gameObject, "bg/liveRoot")
|
||||
self.tip1 = Util.GetGameObject(self.gameObject, "layout/Text1"):GetComponent("Text")
|
||||
self.tip2 = Util.GetGameObject(self.gameObject, "layout/Text2"):GetComponent("Text")
|
||||
|
@ -28,9 +28,9 @@ function XinJiangLaiXi:InitComponent()
|
|||
self.btnBack = Util.GetGameObject(self.mainPanel,"bg/btnBack")
|
||||
self.bottomBar = Util.GetGameObject(self.mainPanel,"bg/bottomBar")
|
||||
|
||||
self.shop = Util.GetGameObject(self.gameObject,"shop")
|
||||
self.shopBack = Util.GetGameObject(self.shop,"shopBack/btnBack")
|
||||
self.content = Util.GetGameObject(self.shop,"content")
|
||||
-- self.shop = Util.GetGameObject(self.gameObject,"shop")
|
||||
-- self.shopBack = Util.GetGameObject(self.shop,"shopBack/btnBack")
|
||||
-- self.content = Util.GetGameObject(self.shop,"content")
|
||||
|
||||
self.allData={}
|
||||
self.itemsGrid = {}--item重复利用
|
||||
|
@ -67,9 +67,7 @@ function XinJiangLaiXi:BindEvent()
|
|||
PrivilegeManager.RefreshPrivilegeUsedTimes(2012, 1)--更新特权
|
||||
local fightData = BattleManager.GetBattleServerData(msg,0)
|
||||
UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.XINJIANG,function ()
|
||||
UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1,function ()
|
||||
self:Refresh()
|
||||
end)
|
||||
UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1)
|
||||
end)
|
||||
end)
|
||||
else
|
||||
|
@ -115,22 +113,39 @@ function XinJiangLaiXi:OnSortingOrderChange()
|
|||
end
|
||||
|
||||
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
||||
function XinJiangLaiXi:OnShow(_sortingOrder,_parent)
|
||||
local actId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.XinJiangLaiXi)
|
||||
if not actId or actId <= 0 then return end
|
||||
sortingOrder = _sortingOrder
|
||||
XinJiangLaiXi:Refresh()
|
||||
function XinJiangLaiXi:OnShow(_sortingOrder)
|
||||
self.sortingOrder = _sortingOrder
|
||||
|
||||
self.actId = self.actConfig.ActId
|
||||
self.actType = self.actConfig.ActiveType > 0 and self.actConfig.ActiveType or self.actConfig.FunType
|
||||
if self.actConfig.IfBack == 1 then
|
||||
if self.actConfig.ActiveType > 0 then
|
||||
local id = ActivityGiftManager.IsActivityTypeOpen(self.actConfig.ActiveType)
|
||||
if id and id > 0 then
|
||||
self.actId = id
|
||||
local actConfig = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.ActivityGroups,"ActId",globalActive[id].ShowArt,"PageType",self.actConfig.PageType,"ActiveType",self.actConfig.ActiveType)
|
||||
if not actConfig then
|
||||
actConfig = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.ActivityGroups,"ActId",id,"PageType",self.actConfig.PageType,"ActiveType",self.actConfig.ActiveType)
|
||||
end
|
||||
if actConfig then
|
||||
self.actConfig = actConfig
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self:Refresh()
|
||||
end
|
||||
|
||||
function XinJiangLaiXi:Refresh()
|
||||
CheckRedPointStatus(RedPointType.XinJiangLaiXi)
|
||||
self.allData = DynamicActivityManager.XinJiangBuildData()
|
||||
XinJiangLaiXi:OnShowData()
|
||||
XinJiangLaiXi:SetTime()
|
||||
self:OnShowData()
|
||||
self:SetTime()
|
||||
end
|
||||
|
||||
function XinJiangLaiXi:OnShowData()
|
||||
self.shop:SetActive(false)
|
||||
-- self.shop:SetActive(false)
|
||||
if not self.itemsGrid then
|
||||
self.itemsGrid = {}
|
||||
end
|
||||
|
@ -143,7 +158,7 @@ function XinJiangLaiXi:OnShowData()
|
|||
self.itemsGrid[i] = SubUIManager.Open(SubUIConfig.ItemView,self.scrollItem.transform)
|
||||
end
|
||||
self.itemsGrid[i].gameObject:SetActive(true)
|
||||
self.itemsGrid[i]:OnOpen(false, self.allData.reward[i], 1,false,false,false,sortingOrder)
|
||||
self.itemsGrid[i]:OnOpen(false, self.allData.reward[i], 1,false,false,false,self.sortingOrder)
|
||||
end
|
||||
|
||||
if self.LiveObj then
|
||||
|
@ -180,13 +195,16 @@ function XinJiangLaiXi:SetTime()
|
|||
self.timer:Start()
|
||||
end
|
||||
|
||||
--界面打开时调用(用于子类重写)
|
||||
function XinJiangLaiXi:OnOpen()
|
||||
|
||||
end
|
||||
|
||||
function XinJiangLaiXi:OnClose()
|
||||
|
||||
if self.timer then
|
||||
self.timer:Stop()
|
||||
self.timer = nil
|
||||
end
|
||||
if self.shopView then
|
||||
self.shopView = SubUIManager.Close(self.shopView)
|
||||
self.shopView = nil
|
||||
end
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
|
||||
--界面销毁时调用(用于子类重写)
|
||||
|
@ -200,20 +218,7 @@ function XinJiangLaiXi:OnDestroy()
|
|||
poolManager:UnLoadLive(self.LiveObj.name,self.LiveObj)
|
||||
self.LiveObj = nil
|
||||
end
|
||||
sortingOrder = 0
|
||||
self.itemsGrid = {}
|
||||
end
|
||||
|
||||
function XinJiangLaiXi:OnHide()
|
||||
if self.timer then
|
||||
self.timer:Stop()
|
||||
self.timer = nil
|
||||
end
|
||||
if self.shopView then
|
||||
self.shopView = SubUIManager.Close(self.shopView)
|
||||
self.shopView = nil
|
||||
end
|
||||
sortingOrder = 0
|
||||
end
|
||||
|
||||
return XinJiangLaiXi
|
|
@ -200,6 +200,7 @@ end
|
|||
|
||||
--界面销毁时调用(用于子类重写)
|
||||
function SurpriseBox:OnDestroy()
|
||||
self.spLoader:Destroy()
|
||||
self.viewList = {}
|
||||
self.itemList = {}
|
||||
self.lightList = {}
|
||||
|
|
Loading…
Reference in New Issue