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

105 lines
3.1 KiB
Lua
Raw Normal View History

2020-07-06 19:11:15 +08:00
----- 宝器分解弹窗 -----
local this = {}
--传入父脚本模块
local parent
--传入特效层级
local sortingOrder=0
local _args={}
--传入选择宝器计算返回奖励数据列表
local dropList = {}
--item容器
local itemList = {}
--传入选择英雄
local selectEquipTreasureData
2020-07-11 16:21:15 +08:00
local selectEquipTreasureDataDid
2020-07-06 19:11:15 +08:00
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")
2020-07-16 10:49:01 +08:00
this.bodyText2=Util.GetGameObject(gameObject,"BodyText2")
2020-07-11 16:21:15 +08:00
this.tipText=Util.GetGameObject(gameObject,"tipText"):GetComponent("Text")
2020-07-06 19:11:15 +08:00
this.cancelBtn=Util.GetGameObject(gameObject,"CancelBtn")
this.confirmBtn=Util.GetGameObject(gameObject,"ConfirmBtn")
--滚动条根节点
2020-07-16 10:49:01 +08:00
this.root = Util.GetGameObject(gameObject, "Root/Viewport/Content")
2020-07-06 19:11:15 +08:00
end
function this:BindEvent()
Util.AddClick(this.cancelBtn,function()
parent:ClosePanel()
end)
2020-07-11 16:21:15 +08:00
Util.AddClick(this.confirmBtn,function()
NetManager.UseAndPriceItemRequest(4,selectEquipTreasureDataDid,function (drop)
this.SendBackResolveReCallBack(drop)
end)
end)
end
function this.SendBackResolveReCallBack(drop)
local isShowReward=false
if drop.itemlist~=nil and #drop.itemlist>0 then
for i = 1, #drop.itemlist do
if drop.itemlist[i].itemNum>0 then
isShowReward=true
break
end
end
end
if isShowReward then
UIManager.OpenPanel(UIName.RewardItemPopup,drop,1,function ()
BagManager.OnShowTipDropNumZero(drop)
end)
else
BagManager.OnShowTipDropNumZero(drop)
end
for k, v in ipairs(selectEquipTreasureDataDid) do
EquipTreasureManager.RemoveTreasureByIdDyn(v)
end
ResolvePanel.SwitchView(3)
parent:ClosePanel()
2020-07-06 19:11:15 +08:00
end
function this:AddListener()
end
function this:RemoveListener()
end
function this:OnShow(_parent,...)
parent=_parent
sortingOrder =_parent.sortingOrder
local args = {...}
dropList = args[1]
selectEquipTreasureData=args[2]
2020-07-11 16:21:15 +08:00
this.titleText.text="宝物分解"
2020-07-06 19:11:15 +08:00
--返还比
2020-07-11 16:21:15 +08:00
local isEquipShowSure = false
selectEquipTreasureDataDid = {}
local data = {}
for k, v in pairs(selectEquipTreasureData) do
table.insert(selectEquipTreasureDataDid,k)
2020-07-16 10:49:01 +08:00
if v.quantity>4 then
2020-07-11 16:21:15 +08:00
isEquipShowSure=true
end
end
2020-07-16 10:49:01 +08:00
this.bodyText.text="宝物将分解为宝魂若宝物已强化或精炼分解后将清空强化和精炼等级并100%返还养成材料。"
this.bodyText2.gameObject:SetActive(isEquipShowSure)
2020-07-11 16:21:15 +08:00
this.tipText.text = "分解后获得:"
2020-07-06 19:11:15 +08:00
local data={}
2020-07-16 10:49:01 +08:00
local index = 1
2020-07-06 19:11:15 +08:00
for i, v in pairs(dropList) do
2020-07-16 10:49:01 +08:00
data[index]={v.id,v.num}
index = index + 1
2020-07-06 19:11:15 +08:00
end
2020-07-16 10:49:01 +08:00
FindFairyManager.ResetItemView(this.root,this.root.transform,itemList,#data,1,sortingOrder,false,data)
2020-07-06 19:11:15 +08:00
end
function this:OnClose()
end
function this:OnDestroy()
end
return this