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

100 lines
4.2 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 = {}
local _MoneyConfig = {
[MoneyType.RMB] = Language[12282],
[MoneyType.USD] = Language[12283]
}
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")
self.image = Util.GetGameObject(self.gameObject, "Image")
self.title1 = Util.GetGameObject(self.image, "title1"):GetComponent("Text")
self.continuityTaskItem:SetActive(false)
self.obj = Util.GetGameObject(self.image, "obj")
if not self.moneyNum then
self.moneyNum = SubUIManager.Open(SubUIConfig.MoneyNumView, self.image.transform,
math.round(MoneyUtil.GetMoney(2000)) , MoneyNumViewType.Image_Horizontal, "ArtFont_2_cfont", 42, 0.7, Vector2.New(118, 161), Vector2.New(-30, -50), MoneyNumViewImageType.Big_1)
self.moneyNum:SetOffsetPosition(Vector2.New(0, -450))
end
end
function ContinuityRechargePage:OnShow(_sortingOrder)
self.title1.text = _MoneyConfig[MoneyUtil.MT]
if GetCurLanguage() == 1 then
SetTextVerTial(self.title1,Vector3.New(38.295,152,0))
self.image.transform.localPosition = Vector2.New(-354,403)
elseif GetCurLanguage() == 2 then
SetTextVerTial(self.title1,Vector3.New(172.5,152,0))
self.obj.transform.localPosition = Vector2.New(-60,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