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

84 lines
3.5 KiB
Lua

--[[
* @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
local sortingOrder = 0
local continuityTaskList = {}
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")
local image = Util.GetGameObject(self.gameObject, "Image")
self.title1 = Util.GetGameObject(image, "title1"):GetComponent("Text")
self.continuityTaskItem:SetActive(false)
end
function ContinuityRechargePage:OnShow(_sortingOrder)
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
Util.AddParticleSortLayer( self.effect, _sortingOrder - sortingOrder)
sortingOrder = _sortingOrder
Game.GlobalEvent:AddEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, self.RefreshPanel, self)
Game.GlobalEvent:AddEvent(GameEvent.Activity.ContinueRechargeRefresh, self.RefreshPanel, self)
self.gameObject:SetActive(true)
self:RefreshPanel()
end
--层级重设 防特效穿透
function ContinuityRechargePage:OnSortingOrderChange(cursortingOrder)
Util.AddParticleSortLayer( self.effect, cursortingOrder - sortingOrder)
sortingOrder = cursortingOrder
for i, v in pairs(continuityTaskList) do
v:OnSortingOrderChange(cursortingOrder)
end
end
function ContinuityRechargePage:OnHide()
Game.GlobalEvent:RemoveEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, self.RefreshPanel, self)
Game.GlobalEvent:RemoveEvent(GameEvent.Activity.ContinueRechargeRefresh, self.RefreshPanel, self)
self.gameObject:SetActive(false)
end
function ContinuityRechargePage:RefreshPanel()
local actRewardConfigs = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId", ActivityTypeDef.ContinuityRecharge)
self.conditionDesc.text = actRewardConfigs[1].Values[1][1]
--Log("连续充值刷新"..ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.ContinuityRecharge).value)
for i, actRewardInfo in ipairs(actRewardConfigs) do
if not continuityTaskList[i] then
continuityTaskList[i] = ContinuityRechargeItem.create(self.continuityTaskItem, self.continuityTaskContent)
continuityTaskList[i]:Init(actRewardInfo,sortingOrder)
end
continuityTaskList[i]:SetValue()
end
table.walk(continuityTaskList, function(continuityTaskItem)
continuityTaskItem:TrySetLastSibling()
end)
end
--界面关闭时调用(用于子类重写)
function ContinuityRechargePage:OnClose()
end
--界面销毁时调用(用于子类重写)
function ContinuityRechargePage:OnDestroy()
sortingOrder = 0
continuityTaskList = {}
end
return ContinuityRechargePage