miduo_client/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_Onhook.lua

116 lines
3.9 KiB
Lua
Raw Normal View History

2020-08-25 15:46:38 +08:00
----- 献祭弹窗 -----
2020-06-03 19:09:01 +08:00
local this = {}
--传入父脚本模块
local parent
--传入特效层级
local sortingOrder=0
local fun
local itemList = {}
--传入选择英雄
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
this.timer = Timer.New()
function this:InitComponent(gameObject)
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New()
2020-06-03 19:09:01 +08:00
this.backBtn=Util.GetGameObject(gameObject,"bg/backBtn")
this.Root=Util.GetGameObject(gameObject,"Root")
this.proPre=Util.GetGameObject(gameObject,"proPre")
2021-05-27 15:35:10 +08:00
this.shengxingIma=Util.GetGameObject(gameObject,"bg/shengxing"):GetComponent("Image")
2020-06-03 19:09:01 +08:00
itemList = {}
end
function this:BindEvent()
Util.AddClick(this.backBtn,function()
parent:ClosePanel()
end)
end
function this:AddListener()
end
function this:RemoveListener()
end
function this:OnShow(_parent,...)
FightPointPassManager.SetIsOpenRewardUpTip(false)
parent=_parent
sortingOrder = _parent.sortingOrder
--不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参
local _args = {...}
2021-05-22 14:08:34 +08:00
local data = _args[1]
fun = _args[2]
2021-05-27 15:35:10 +08:00
this.shengxingIma = Util.LoadSprite(data.title)
2020-06-03 19:09:01 +08:00
--itemList
2021-05-22 14:08:34 +08:00
if data then
for i = 1, math.max(#itemList, #data.itemList) do
if not itemList[i] then
itemList[i] = {}
itemList[i].go = newObject(this.proPre)
itemList[i].go.transform:SetParent(this.Root.transform)
itemList[i].go.transform.localScale = Vector3.one
itemList[i].go.transform.localPosition = Vector3.zero
2021-05-26 09:51:41 +08:00
itemList[i].add = Util.GetGameObject(itemList[i].go,"Image (1)")
2021-05-22 14:08:34 +08:00
itemList[i].icon = Util.GetGameObject(itemList[i].go,"Image"):GetComponent("Image")
itemList[i].proName = Util.GetGameObject(itemList[i].go, "proName"):GetComponent("Text")
itemList[i].proValue = Util.GetGameObject(itemList[i].go, "proValue"):GetComponent("Text")
itemList[i].nextproValue = Util.GetGameObject(itemList[i].go, "nextproValue"):GetComponent("Text")
2020-06-03 19:09:01 +08:00
end
2021-05-22 14:08:34 +08:00
itemList[i].go.gameObject:SetActive(false)
2020-06-03 19:09:01 +08:00
end
2021-05-22 14:08:34 +08:00
for i = 1, #data.itemList do
2021-05-25 21:40:41 +08:00
local go = itemList[i].go
2020-06-03 19:09:01 +08:00
go.gameObject:SetActive(true)
2021-05-22 14:08:34 +08:00
if not data.itemList[i].icon then
itemList[i].icon.gameObject:SetActive(false)
2020-06-08 20:18:49 +08:00
else
2021-05-22 14:08:34 +08:00
itemList[i].icon.gameObject:SetActive(true)
itemList[i].icon.sprite = SetIcon(self.spLoader, data.itemList[i].icon)
2020-06-08 20:18:49 +08:00
end
2021-05-22 14:08:34 +08:00
itemList[i].proName.text = data.itemList[i].proName
2021-05-26 09:51:41 +08:00
if not data.itemList[i].proValue and not data.itemList[i].proValue1 then
itemList[i].add.gameObject:SetActive(false)
else
itemList[i].add.gameObject:SetActive(true)
end
if not data.itemList[i].proValue then
itemList[i].proValue.gameObject:SetActive(false)
else
itemList[i].proValue.gameObject:SetActive(true)
itemList[i].proValue.text = data.itemList[i].proValue
end
if not data.itemList[i].proValue1 then
itemList[i].nextproValue.gameObject:SetActive(false)
else
itemList[i].nextproValue.gameObject:SetActive(true)
itemList[i].nextproValue.text = data.itemList[i].proValue1
end
2020-06-03 19:09:01 +08:00
end
end
2021-05-25 21:40:41 +08:00
if this.timer then
this.timer:Stop()
this.timer = nil
2020-06-03 19:09:01 +08:00
end
2021-05-25 21:40:41 +08:00
this.timer = Timer.New(function()
parent:ClosePanel()
2021-05-26 20:53:18 +08:00
end,5):Start()
2020-06-03 19:09:01 +08:00
end
function this:OnClose()
if this.timer then
this.timer:Stop()
this.timer = nil
end
end
function this:OnDestroy()
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2020-06-03 19:09:01 +08:00
itemList = {}
if this.timer then
this.timer:Stop()
this.timer = nil
end
end
2021-04-21 13:12:04 +08:00
return this