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

96 lines
3.3 KiB
Lua
Raw Normal View History

2021-04-21 13:12:04 +08:00
----- 归元弹窗 -----
2020-08-07 12:22:10 +08:00
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)
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New()
2020-08-07 12:22:10 +08:00
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
table.insert(data,v.dynamicId)
end
NetManager.EspecialEquipBackRequest(data, function(msg)
local oldPowerNum = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
2020-08-07 12:22:10 +08:00
for i = 1, #data do
HeroManager.SetTalismanLv(data[i], 1)
end
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip(Language[11611])
2020-08-07 12:22:10 +08:00
parent:ClosePanel()
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function ()
-- ResolvePanel.SwitchView(3,true,true)
local mainFormationHeroList = FormationManager.GetAllMainFormationHeroId()
if mainFormationHeroList[data[1]] then
local newPowerNum = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
if oldPowerNum ~= newPowerNum then
UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldPowerNum,newValue = newPowerNum})
end
end
Game.GlobalEvent:DispatchEvent(GameEvent.Role.UpdateTalismanInfoPanel)
2020-08-07 12:22:10 +08:00
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)
2021-03-02 16:53:12 +08:00
this.titleText.text=Language[11612]
2020-08-06 10:38:55 +08:00
local heroReadingName = ReadingName
for key, value in pairs(selectHeroData) do
heroReadingName = GetLanguageStrById(value.heroConfig.ReadingName)
2020-08-06 10:38:55 +08:00
end
2020-08-07 12:22:10 +08:00
--返还比
2020-08-06 10:38:55 +08:00
-- local num=tonumber(ConfigManager.GetConfigData(ConfigName.SpecialConfig,34).Value)/100
2022-08-10 16:44:44 +08:00
this.bodyText.text = string.format("<color=#00FF66>%s</color>的法宝会重置为<color=#00FF66>1</color>阶\n返还<color=#00FF66>进阶消耗</color>的材料,",heroReadingName)
2020-08-07 12:22:10 +08:00
local _data={}
for i=1,#dropList do
_data[i] = {dropList[i].id,dropList[i].num,nil,dropList[i].star}
end
ResetItemView(this.root,this.root.transform,itemList,8,1,sortingOrder,false,_data)
2020-08-07 12:22:10 +08:00
end
function this:OnClose()
end
function this:OnDestroy()
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2020-08-07 12:22:10 +08:00
end
return this