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

91 lines
2.5 KiB
Lua
Raw Normal View History

2021-04-21 13:12:04 +08:00
----- 装备批量出售 -----
2020-07-07 15:20:43 +08:00
local this = {}
--传入父脚本模块
local parent
--传入特效层级
local sortingOrder=0
local _args={}
--传入选择宝器计算返回奖励数据列表
local dropList = {}
--item容器
local itemList = {}
--传入选择英雄
2020-07-10 18:29:38 +08:00
local selectEquipsData
2020-07-07 15:20:43 +08:00
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
function this:InitComponent(gameObject)
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New()
2020-07-07 15:20:43 +08:00
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
this.bodyText=Util.GetGameObject(gameObject,"BodyText"):GetComponent("Text")
2020-07-10 18:29:38 +08:00
this.BodyText2=Util.GetGameObject(gameObject,"BodyText2")
2020-07-07 15:20:43 +08:00
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()
2020-07-11 16:21:15 +08:00
local data = {}
for k,v in ipairs(selectEquipsData) do
local equip = {}
equip.itemId = v.id
equip.itemNum = v.num
table.insert(data,equip)
end
NetManager.UseAndPriceItemRequest(1, data, function(msg)
2020-07-10 18:29:38 +08:00
parent:ClosePanel()
UIManager.OpenPanel(UIName.RewardItemPopup,msg,1,function ()
BagManager.OnShowTipDropNumZero(msg)
end)
end)
2020-07-07 15:20:43 +08:00
end)
end
function this:AddListener()
end
function this:RemoveListener()
end
function this:OnShow(_parent,...)
parent=_parent
sortingOrder =_parent.sortingOrder
local args = {...}
2020-07-10 18:29:38 +08:00
selectEquipsData=args[1]
dropList = EquipManager.GetEquipRewardList(selectEquipsData)
2021-03-02 16:53:12 +08:00
this.titleText.text=Language[11538]
2020-07-07 15:20:43 +08:00
--返还比
2020-07-10 18:29:38 +08:00
local num = 0
local isShow=false
for k,v in ipairs(selectEquipsData) do
num = num + v.num
if v.itemConfig.Quantity > 4 and not isShow then
isShow=true
end
end
2021-03-02 16:53:12 +08:00
this.bodyText.text=string.format(Language[11539],num)
this.BodyText2:GetComponent("Text").text=Language[11540]
2020-07-10 18:29:38 +08:00
this.BodyText2.gameObject:SetActive(isShow)
2020-07-07 15:20:43 +08:00
local data={}
2020-07-10 18:29:38 +08:00
local index = 1
2020-07-07 15:20:43 +08:00
for i, v in pairs(dropList) do
2020-07-10 18:29:38 +08:00
data[index]={i,v}
index = index + 1
2020-07-07 15:20:43 +08:00
end
2020-07-10 18:29:38 +08:00
2020-07-07 15:20:43 +08:00
FindFairyManager.ResetItemView(this.root,this.root.transform,itemList,4,1,sortingOrder,false,data)
end
function this:OnClose()
end
function this:OnDestroy()
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2020-07-07 15:20:43 +08:00
end
return this