miduo_client/Assets/ManagedResources/~Lua/Modules/Operating/ContinuityRechargePage.lua

84 lines
3.5 KiB
Lua
Raw Normal View History

2020-08-25 15:46:38 +08:00
--[[
2020-05-09 13:31:21 +08:00
* @ClassName ContinuityRechargePage
* @Description
* @Date 2019/8/2 16:45
* @Author MagicianJoker, fengliudianshao@outlook.com
* @Copyright Copyright (c) 2019, MagicianJoker
--]]
local ContinuityRechargeItem = require("Modules/Operating/ContinuityRechargeItem")
--积天豪礼
---@class ContinuityRechargePage
local ContinuityRechargePage = quick_class("ContinuityRechargePage")
local isPlayAnim = true
2020-05-09 13:31:21 +08:00
local sortingOrder = 0
2021-01-27 16:12:39 +08:00
local continuityTaskList = {}
2020-05-09 13:31:21 +08:00
function ContinuityRechargePage:ctor(mainPanel, gameObject)
self.mainPanel = mainPanel
self.gameObject = gameObject
sortingOrder = 0
self.conditionDesc = Util.GetGameObject(self.gameObject, "condition"):GetComponent("Text")
self.continuityTaskContent = Util.GetGameObject(self.gameObject, "taskList/viewPort/content")
self.continuityTaskItem = Util.GetGameObject(self.continuityTaskContent, "itemPro")
self.effect = Util.GetGameObject(self.gameObject, "UI_effect_OperatingPanel_normal")
2021-02-24 14:04:32 +08:00
local image = Util.GetGameObject(self.gameObject, "Image")
self.title1 = Util.GetGameObject(image, "title1"):GetComponent("Text")
2020-05-09 13:31:21 +08:00
self.continuityTaskItem:SetActive(false)
end
function ContinuityRechargePage:OnShow(_sortingOrder)
2021-02-24 14:04:32 +08:00
if GetCurLanguage() == 1 then
SetTextVerTial(self.title1,Vector3.New(38.295,152,0))
elseif GetCurLanguage() == 2 then
SetTextVerTial(self.title1,Vector3.New(172.5,152,0))
end
isPlayAnim = true
2020-05-09 13:31:21 +08:00
Util.AddParticleSortLayer( self.effect, _sortingOrder - sortingOrder)
sortingOrder = _sortingOrder
Game.GlobalEvent:AddEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, self.RefreshPanel, self)
2020-05-15 16:52:35 +08:00
Game.GlobalEvent:AddEvent(GameEvent.Activity.ContinueRechargeRefresh, self.RefreshPanel, self)
2020-05-09 13:31:21 +08:00
self.gameObject:SetActive(true)
self:RefreshPanel()
end
--层级重设 防特效穿透
function ContinuityRechargePage:OnSortingOrderChange(cursortingOrder)
Util.AddParticleSortLayer( self.effect, cursortingOrder - sortingOrder)
sortingOrder = cursortingOrder
2021-01-27 16:12:39 +08:00
for i, v in pairs(continuityTaskList) do
2020-05-09 13:31:21 +08:00
v:OnSortingOrderChange(cursortingOrder)
end
end
function ContinuityRechargePage:OnHide()
Game.GlobalEvent:RemoveEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, self.RefreshPanel, self)
2020-05-15 16:52:35 +08:00
Game.GlobalEvent:RemoveEvent(GameEvent.Activity.ContinueRechargeRefresh, self.RefreshPanel, self)
2020-05-09 13:31:21 +08:00
self.gameObject:SetActive(false)
end
function ContinuityRechargePage:RefreshPanel()
2021-01-27 16:12:39 +08:00
local actRewardConfigs = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId", ActivityTypeDef.ContinuityRecharge)
2020-05-09 13:31:21 +08:00
self.conditionDesc.text = actRewardConfigs[1].Values[1][1]
--Log("连续充值刷新"..ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.ContinuityRecharge).value)
for i, actRewardInfo in ipairs(actRewardConfigs) do
2021-01-27 16:12:39 +08:00
if not continuityTaskList[i] then
continuityTaskList[i] = ContinuityRechargeItem.create(self.continuityTaskItem, self.continuityTaskContent)
continuityTaskList[i]:Init(actRewardInfo,sortingOrder)
end
continuityTaskList[i]:SetValue()
2020-05-09 13:31:21 +08:00
end
2021-01-27 16:12:39 +08:00
table.walk(continuityTaskList, function(continuityTaskItem)
2020-05-09 13:31:21 +08:00
continuityTaskItem:TrySetLastSibling()
end)
2021-01-27 16:12:39 +08:00
end
--界面关闭时调用(用于子类重写)
function ContinuityRechargePage:OnClose()
end
--界面销毁时调用(用于子类重写)
function ContinuityRechargePage:OnDestroy()
sortingOrder = 0
continuityTaskList = {}
2020-05-09 13:31:21 +08:00
end
2020-06-23 18:36:24 +08:00
return ContinuityRechargePage