【升星有礼】重构提交
parent
11934333fc
commit
a277f4578c
|
@ -453,4 +453,5 @@ SubUIConfig = {
|
||||||
[25] = { name = "FuXingGaoZhaoPanel", assetName = "FuXingGaoZhaoPanel", script = "Modules/FuXingGaoZhao/FuXingGaoZhaoPanel" },
|
[25] = { name = "FuXingGaoZhaoPanel", assetName = "FuXingGaoZhaoPanel", script = "Modules/FuXingGaoZhao/FuXingGaoZhaoPanel" },
|
||||||
[26] = { name = "NiuQiChongTianPanel", assetName = "NiuQiChongTianPanel", script = "Modules/NiuQiChongTian/NiuQiChongTianPanel" },
|
[26] = { name = "NiuQiChongTianPanel", assetName = "NiuQiChongTianPanel", script = "Modules/NiuQiChongTian/NiuQiChongTianPanel" },
|
||||||
[27] = {name = "TimeLimitUpHero",assetName = "TimeLimitUpHero",script = "Modules/DynamicActivity/TimeLimitUpHero"}, --限时英雄up界面
|
[27] = {name = "TimeLimitUpHero",assetName = "TimeLimitUpHero",script = "Modules/DynamicActivity/TimeLimitUpHero"}, --限时英雄up界面
|
||||||
|
[29] = {name = "page15",assetName = "page15",script = "Modules/DynamicActivity/ShengXingYouLi"},--升星有礼
|
||||||
}
|
}
|
|
@ -1,27 +1,27 @@
|
||||||
local ShengXingYouLi = quick_class("ShengXingYouLi")
|
local ShengXingYouLi = quick_class("ShengXingYouLi")
|
||||||
local actData={}
|
local actData={}
|
||||||
local itemsGrid = {}--item重复利用
|
local itemsGrid = {}--item重复利用
|
||||||
local this=ShengXingYouLi
|
|
||||||
local parent
|
|
||||||
local activityId
|
local activityId
|
||||||
function ShengXingYouLi:ctor(mainPanel, gameObject)
|
|
||||||
self.mainPanel = mainPanel
|
function ShengXingYouLi:New(gameObject)
|
||||||
self.gameObject = gameObject
|
local b = {}
|
||||||
self:InitComponent(gameObject)
|
b.gameObject = gameObject
|
||||||
self:BindEvent()
|
b.transform = gameObject.transform
|
||||||
|
setmetatable(b, { __index = ShengXingYouLi })
|
||||||
|
return b
|
||||||
end
|
end
|
||||||
|
|
||||||
function ShengXingYouLi:InitComponent(gameObject)
|
function ShengXingYouLi:InitComponent()
|
||||||
this.spLoader = SpriteLoader.New()
|
self.spLoader = SpriteLoader.New()
|
||||||
this.time = Util.GetGameObject(gameObject, "tiao/time"):GetComponent("Text")
|
self.time = Util.GetGameObject(self.gameObject, "tiao/time"):GetComponent("Text")
|
||||||
this.itemPre = Util.GetGameObject(gameObject, "ItemPre3")
|
self.itemPre = Util.GetGameObject(self.gameObject, "ItemPre3")
|
||||||
this.scrollItem = Util.GetGameObject(gameObject, "scrollItem")
|
self.scrollItem = Util.GetGameObject(self.gameObject, "scrollItem")
|
||||||
local rootHight = this.scrollItem.transform.rect.height
|
local rootHight = self.scrollItem.transform.rect.height
|
||||||
local width = this.scrollItem.transform.rect.width
|
local width = self.scrollItem.transform.rect.width
|
||||||
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, this.scrollItem.transform,
|
self.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, self.scrollItem.transform,
|
||||||
this.itemPre, nil, Vector2.New(width, rootHight), 1, 1, Vector2.New(0, 35))
|
self.itemPre, nil, Vector2.New(width, rootHight), 1, 1, Vector2.New(0, 35))
|
||||||
this.ScrollView.moveTween.MomentumAmount = 1
|
self.ScrollView.moveTween.MomentumAmount = 1
|
||||||
this.ScrollView.moveTween.Strength = 2
|
self.ScrollView.moveTween.Strength = 2
|
||||||
end
|
end
|
||||||
|
|
||||||
--绑定事件(用于子类重写)
|
--绑定事件(用于子类重写)
|
||||||
|
@ -37,25 +37,43 @@ function ShengXingYouLi:RemoveListener()
|
||||||
end
|
end
|
||||||
local sortingOrder = 0
|
local sortingOrder = 0
|
||||||
--界面打开时调用(用于子类重写)
|
--界面打开时调用(用于子类重写)
|
||||||
function ShengXingYouLi:OnOpen()
|
function ShengXingYouLi:OnOpen(_activityConfig,_index,parent)
|
||||||
|
self.actConfig = _activityConfig
|
||||||
|
self.pageIndex = _index
|
||||||
|
self.parent = parent
|
||||||
end
|
end
|
||||||
|
|
||||||
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
||||||
function ShengXingYouLi:OnShow(_sortingOrder,_parent)
|
function ShengXingYouLi:OnShow(_sortingOrder)
|
||||||
parent = _parent
|
|
||||||
sortingOrder = _sortingOrder
|
sortingOrder = _sortingOrder
|
||||||
this:OnShowData(true,true)
|
self.gameObject:SetActive(true)
|
||||||
this:SetTime()
|
|
||||||
|
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 config = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.ActivityGroups,"PageType",self.actConfig.PageType,"ActiveType",self.actConfig.ActiveType,"ActId",id)
|
||||||
|
if config then
|
||||||
|
self.actConfig = config
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self:OnShowData(true,true)
|
||||||
|
self:SetTime()
|
||||||
end
|
end
|
||||||
function ShengXingYouLi:OnShowData(isTop,isAni)
|
function ShengXingYouLi:OnShowData(isTop,isAni)
|
||||||
actData={}
|
actData={}
|
||||||
actData = DynamicActivityManager.ShengXingYouLiGetData()
|
actData = DynamicActivityManager.ShengXingYouLiGetData()
|
||||||
activityId = actData.activityId
|
activityId = actData.activityId
|
||||||
if actData.mission then
|
if actData.mission then
|
||||||
this.SortData(actData.mission)
|
self:SortData(actData.mission)
|
||||||
this.ScrollView:SetData(actData.mission, function (index, go)
|
self.ScrollView:SetData(actData.mission, function (index, go)
|
||||||
this.SingleDataShow(go, actData.mission[index])
|
self:SingleDataShow(go, actData.mission[index])
|
||||||
end,not isTop,not isAni)
|
end,not isTop,not isAni)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -64,7 +82,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
--刷新每一条的显示数据
|
--刷新每一条的显示数据
|
||||||
function this.SingleDataShow(pre,value)
|
function ShengXingYouLi:SingleDataShow(pre,value)
|
||||||
if pre==nil or value==nil then
|
if pre==nil or value==nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -126,7 +144,7 @@ function this.SingleDataShow(pre,value)
|
||||||
if canDo == 1 then
|
if canDo == 1 then
|
||||||
NetManager.GetActivityRewardRequest(sData.missionId,activityId,function (drop)
|
NetManager.GetActivityRewardRequest(sData.missionId,activityId,function (drop)
|
||||||
UIManager.OpenPanel(UIName.RewardItemPopup, drop, 1,function ()
|
UIManager.OpenPanel(UIName.RewardItemPopup, drop, 1,function ()
|
||||||
this:OnShowData(false,false)
|
self:OnShowData(false,false)
|
||||||
CheckRedPointStatus(RedPointType.ShengXingYouLi)
|
CheckRedPointStatus(RedPointType.ShengXingYouLi)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
@ -139,7 +157,7 @@ function this.SingleDataShow(pre,value)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function this.SortData(tempData)
|
function ShengXingYouLi:SortData(tempData)
|
||||||
if tempData==nil then
|
if tempData==nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -159,13 +177,13 @@ function ShengXingYouLi:SetTime()
|
||||||
end
|
end
|
||||||
local endTime = actData.endTime--ActivityGiftManager.GetTaskEndTime(ActivityTypeDef.DynamicAct_Treasure)
|
local endTime = actData.endTime--ActivityGiftManager.GetTaskEndTime(ActivityTypeDef.DynamicAct_Treasure)
|
||||||
local timeDown = endTime - GetTimeStamp()
|
local timeDown = endTime - GetTimeStamp()
|
||||||
this.time.text = Language[10470]..TimeToDHMS(timeDown)
|
self.time.text = Language[10470]..TimeToDHMS(timeDown)
|
||||||
self.timer = Timer.New(function()
|
self.timer = Timer.New(function()
|
||||||
this.time.text = Language[10470]..TimeToDHMS(timeDown)
|
self.time.text = Language[10470]..TimeToDHMS(timeDown)
|
||||||
if timeDown < 1 then
|
if timeDown < 1 then
|
||||||
self.timer:Stop()
|
self.timer:Stop()
|
||||||
self.timer = nil
|
self.timer = nil
|
||||||
parent:ClosePanel()
|
self.parent:ClosePanel()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
timeDown = timeDown - 1
|
timeDown = timeDown - 1
|
||||||
|
@ -174,12 +192,6 @@ function ShengXingYouLi:SetTime()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ShengXingYouLi:OnClose()
|
function ShengXingYouLi:OnClose()
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
--界面销毁时调用(用于子类重写)
|
|
||||||
function ShengXingYouLi:OnDestroy()
|
|
||||||
this.spLoader:Destroy()
|
|
||||||
if self.timer then
|
if self.timer then
|
||||||
self.timer:Stop()
|
self.timer:Stop()
|
||||||
self.timer = nil
|
self.timer = nil
|
||||||
|
@ -187,7 +199,9 @@ function ShengXingYouLi:OnDestroy()
|
||||||
sortingOrder = 0
|
sortingOrder = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function ShengXingYouLi:OnHide()
|
--界面销毁时调用(用于子类重写)
|
||||||
|
function ShengXingYouLi:OnDestroy()
|
||||||
|
self.spLoader:Destroy()
|
||||||
if self.timer then
|
if self.timer then
|
||||||
self.timer:Stop()
|
self.timer:Stop()
|
||||||
self.timer = nil
|
self.timer = nil
|
||||||
|
|
Loading…
Reference in New Issue