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

103 lines
3.5 KiB
Lua
Raw Normal View History

2020-08-25 15:46:38 +08:00
----- 公会技能重置弹窗 -----
2020-05-09 13:31:21 +08:00
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")
2020-06-13 11:47:13 +08:00
this.cancelBtn = Util.GetGameObject(gameObject, "cancelBtn")
2020-05-09 13:31:21 +08:00
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
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip(Language[10497])
2020-05-09 13:31:21 +08:00
return
end
NetManager.ResetGuildSkillRequest(resetIndex,function(msg)
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip(Language[11553])
2020-06-18 20:39:29 +08:00
ShopManager.AddShopItemBuyNum(SHOP_TYPE.FUNCTION_SHOP, 10028, 1)
2020-05-09 13:31:21 +08:00
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
2020-05-25 19:16:23 +08:00
function this:OnShow(_parent,...)
parent=_parent
sortingOrder =_parent.sortingOrder
2020-05-09 13:31:21 +08:00
local args = {...}
2020-05-25 19:16:23 +08:00
dropList = args[1]
resetIndex=args[2]
fun = args[3]
2020-05-09 13:31:21 +08:00
this.root.transform:GetComponent("RectTransform"):DOAnchorPosX(0, 0)
2021-03-02 16:53:12 +08:00
this.titleText.text=Language[11554]
2020-05-09 13:31:21 +08:00
--返还比
item,num = ShopManager.CalculateCostCountByShopId(SHOP_TYPE.FUNCTION_SHOP, 10028, 1)
local buyNum = ShopManager.GetShopItemHadBuyTimes(SHOP_TYPE.FUNCTION_SHOP, 10028)
local str1 = "<color=#FFD376>".. num .."</color>"
2021-01-26 17:08:39 +08:00
local str2 = "<color=#FFD376>".. GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.ItemConfig,item).Name) .."</color>"
2021-03-02 16:53:12 +08:00
local str3 = "<color=#FFD376>"..GuildSkillType[resetIndex]..Language[11555]
2020-05-25 19:16:23 +08:00
local str4 = "<color=#FFD376>"..tonumber(ConfigManager.GetConfigData(ConfigName.SpecialConfig,46).Value)/100 .."%</color>"
2020-05-09 13:31:21 +08:00
local str5 = ""
for i = 1, #dropList do
2020-06-03 19:09:01 +08:00
--LogError("dropList[i].id "..dropList[i].id)
2020-05-09 13:31:21 +08:00
if str5 == "" then
2021-01-26 17:08:39 +08:00
str5 = GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.ItemConfig,dropList[i].id).Name)
2020-05-09 13:31:21 +08:00
else
2021-03-02 16:53:12 +08:00
str5 = str5 .. Language[11556]..GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.ItemConfig,dropList[i].id).Name)
2020-05-09 13:31:21 +08:00
end
end
str5 = "<color=#FFD376>".. str5 .."</color>"
local str = ""
2020-06-13 11:47:13 +08:00
--LogError("item num oldNum buyNum "..item.." "..num.." "..buyNum)
2020-05-09 13:31:21 +08:00
if buyNum == 0 then
2021-03-02 16:53:12 +08:00
str = Language[11557]..str1..str2..Language[11558]..str3..Language[11559]..str4..str5 ..""
2020-05-09 13:31:21 +08:00
else
2021-03-02 16:53:12 +08:00
str = Language[11560]..str1..str2..Language[11558]..str3..Language[11559]..str4..str5 ..""
2020-05-09 13:31:21 +08:00
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
2020-06-23 18:36:24 +08:00
return this