miduo_client/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_ResolveDismant...

81 lines
2.4 KiB
Lua
Raw Normal View History

2020-05-09 13:31:21 +08:00
----- 献祭弹窗 -----
local this = {}
--传入父脚本模块
local parent
--传入特效层级
local sortingOrder=0
local _args={}
--传入选择英雄计算返回奖励数据列表
local dropList = {}
--item容器
local itemList = {}
--传入选择英雄
local selectHeroData
local heroConfig=ConfigManager.GetConfig(ConfigName.HeroConfig)
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
function this:InitComponent(gameObject)
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
this.bodyText=Util.GetGameObject(gameObject,"BodyText"):GetComponent("Text")
this.cancelBtn=Util.GetGameObject(gameObject,"CancelBtn")
this.confirmBtn=Util.GetGameObject(gameObject,"ConfirmBtn")
--滚动条根节点
this.root = Util.GetGameObject(gameObject, "Root")
end
function this:BindEvent()
Util.AddClick(this.cancelBtn,function()
parent:ClosePanel()
end)
Util.AddClick(this.confirmBtn,function()
local data={}
for k,v in pairs(selectHeroData) do
table.insert(data,v.dynamicId)
end
NetManager.UseAndPriceItemRequest(3, data, function(msg)
HeroManager.DeleteHeroDatas(data)
parent:ClosePanel()
UIManager.OpenPanel(UIName.RewardItemPopup,msg,1,function ()
ResolvePanel.SwitchView(2)
end)
end)
end)
end
function this:AddListener()
end
function this:RemoveListener()
end
function this:OnShow(...)
local args = {...}
parent=args[1]
sortingOrder = parent.sortingOrder
--不定参中包含的不定参 _args[1]为面板类型 _args[2]之后为打开面板后传入的不定参
_args = args[2]
dropList = _args[2]
selectHeroData=_args[3]
this.titleText.text="确认献祭"
--返还比
local num=tonumber(ConfigManager.GetConfigData(ConfigName.SpecialConfig,35).Value)/100
this.bodyText.text=string.format( "献祭猎妖师会获得心火明晶,若猎妖师已升级,突破或进阶,还会返还%s%s消耗的金币、成长护符和梦魇妖壶是否确定献祭所选猎妖师\n\n\t\t\t\t\t\t\t献祭后获得:",num,"%")
local data={}
for i, v in pairs(dropList) do
data[i]={v.id,v.num}
end
FindFairyManager.ResetItemView(this.root,this.root.transform,itemList,4,1,sortingOrder,false,data)
end
function this:OnClose()
end
function this:OnDestroy()
end
return this