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