80 lines
2.6 KiB
Lua
80 lines
2.6 KiB
Lua
----- 归元弹窗 -----
|
||
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/Viewport/Content")
|
||
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
|
||
data=v.dynamicId
|
||
break
|
||
end
|
||
NetManager.HeroRetureEvent(data, function(msg)
|
||
HeroManager.ResetHero(data)
|
||
PopupTipPanel.ShowTip("神将归元成功,等级重置为1级")
|
||
parent:ClosePanel()
|
||
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function ()
|
||
ResolvePanel.SwitchView(2)
|
||
end,0,nil,nil,1)
|
||
end)
|
||
end)
|
||
end
|
||
|
||
function this:AddListener()
|
||
end
|
||
|
||
function this:RemoveListener()
|
||
end
|
||
|
||
function this:OnShow(_parent,...)
|
||
parent=_parent
|
||
sortingOrder =_parent.sortingOrder
|
||
local args = {...}
|
||
dropList = args[1]
|
||
selectHeroData=args[2]
|
||
this.root.transform:GetComponent("RectTransform"):DOAnchorPosX(0, 0)
|
||
|
||
this.titleText.text="确认归元"
|
||
--返还比
|
||
local num=tonumber(ConfigManager.GetConfigData(ConfigName.SpecialConfig,34).Value)/100
|
||
this.bodyText.text = "归元神将会返还所有的升级材料,神将重置为1级,此操作不可逆,是否确认归元?\n\n\t\t\t\t\t\t\t归元后获得:"--string.format("归元神将会返还所有的升级材料,神将重置为1级,此操作不可逆,是否确认归元?\n\n\t\t\t\t\t\t\t归元后获得:", num, "%")
|
||
|
||
local _data={}
|
||
for i=1,#dropList do
|
||
_data[i] = {dropList[i].id,dropList[i].num,nil,dropList[i].star}
|
||
end
|
||
FindFairyManager.ResetItemView(this.root,this.root.transform,itemList,8,1,sortingOrder,false,_data)
|
||
end
|
||
|
||
function this:OnClose()
|
||
end
|
||
|
||
function this:OnDestroy()
|
||
end
|
||
|
||
return this |