105 lines
3.7 KiB
Lua
105 lines
3.7 KiB
Lua
|
----- 公会技能重置弹窗 -----
|
||
|
local this = {}
|
||
|
--传入父脚本模块
|
||
|
local parent
|
||
|
--层级
|
||
|
local sortingOrder = 0
|
||
|
--传入不定参
|
||
|
local _args = {}
|
||
|
--传入选择英雄计算返回奖励数据列表
|
||
|
local dropList = {}
|
||
|
--item容器
|
||
|
local itemList = {}
|
||
|
local resetIndex = 1
|
||
|
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||
|
local fun = nil
|
||
|
local item,num
|
||
|
function this:InitComponent(gameObject)
|
||
|
this.titleText = Util.GetGameObject(gameObject, "TitleText"):GetComponent("Text")
|
||
|
this.infoText = Util.GetGameObject(gameObject, "Body/infoText"):GetComponent("Text")
|
||
|
this.cancelBtn = Util.GetGameObject(gameObject, "CancelBtn")
|
||
|
this.resetBtn = Util.GetGameObject(gameObject, "resetBtn")
|
||
|
--滚动条根节点
|
||
|
this.root = Util.GetGameObject(gameObject, "Root")
|
||
|
end
|
||
|
|
||
|
function this:BindEvent()
|
||
|
Util.AddClick(this.cancelBtn,function()
|
||
|
parent:ClosePanel()
|
||
|
end)
|
||
|
Util.AddClick(this.resetBtn,function()
|
||
|
if BagManager.GetItemCountById(item) < num then
|
||
|
PopupTipPanel.ShowTip("妖晶不足!")
|
||
|
return
|
||
|
end
|
||
|
NetManager.ResetGuildSkillRequest(resetIndex,function(msg)
|
||
|
|
||
|
PopupTipPanel.ShowTip("所选公会技能已重置,公会贡献和金币已返还!")
|
||
|
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function ()
|
||
|
if fun then
|
||
|
fun()
|
||
|
fun = nil
|
||
|
end
|
||
|
parent:ClosePanel()
|
||
|
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]
|
||
|
resetIndex=_args[3]
|
||
|
fun = _args[4]
|
||
|
this.root.transform:GetComponent("RectTransform"):DOAnchorPosX(0, 0)
|
||
|
this.titleText.text="确认重置"
|
||
|
--返还比
|
||
|
item,num = ShopManager.CalculateCostCountByShopId(SHOP_TYPE.FUNCTION_SHOP, 10028, 1)
|
||
|
local buyNum = ShopManager.GetShopItemHadBuyTimes(SHOP_TYPE.FUNCTION_SHOP, 10028)
|
||
|
--LogError("item num oldNum buyNum "..item.." "..num.." "..buyNum)
|
||
|
local str1 = "<color=#FFD376>".. num .."</color>"
|
||
|
local str2 = "<color=#FFD376>".. ConfigManager.GetConfigData(ConfigName.ItemConfig,item).Name .."</color>"
|
||
|
local str3 = "<color=#FFD376>"..GuildSkillType[resetIndex].."职业</color>"
|
||
|
local str4 = "<color=#FFD376>"..ConfigManager.GetConfigData(ConfigName.SpecialConfig,46).Value/100 .."%</color>"
|
||
|
local str5 = ""
|
||
|
for i = 1, #dropList do
|
||
|
if str5 == "" then
|
||
|
str5 = ConfigManager.GetConfigData(ConfigName.ItemConfig,dropList[i].id).Name
|
||
|
else
|
||
|
str5 = str5 + "和"..ConfigManager.GetConfigData(ConfigName.ItemConfig,dropList[i].id).Name
|
||
|
end
|
||
|
end
|
||
|
str5 = "<color=#FFD376>".. str5 .."</color>"
|
||
|
|
||
|
local str = ""
|
||
|
if buyNum == 0 then
|
||
|
str = "首次重置只需要消耗"..str1..str2..",重置后"..str3.."所有技能将被清空等级(变为未激活状态),请慎重考虑!同时将返还消耗的"..str4..str5 .."。"
|
||
|
else
|
||
|
str = "本次重置需要消耗"..str1..str2..",重置后"..str3.."所有技能将被清空等级(变为未激活状态),请慎重考虑!同时将返还消耗的"..str4..str5 .."。"
|
||
|
end
|
||
|
this.infoText.text = str
|
||
|
local _data={}
|
||
|
for i=1,#dropList do
|
||
|
_data[i]={dropList[i].id,dropList[i].num}
|
||
|
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
|