miduo_client/Assets/ManagedResources/~Lua/Modules/Expedition/View/ExpeditionMonsterInfo_Greed...

134 lines
5.3 KiB
Lua

----- 远征贪婪节点弹窗 -----
local this = {}
--传入父脚本模块
local parent
--传入特效层级
local sortingOrder=0
local fun
--item容器
local itemList = {}
local monsterData = {}
local rewardData = {}
local curNodeConFig
local type = 1 --1 前往 2 放弃
local ExpeSetting = ConfigManager.GetConfig(ConfigName.ExpeditionSetting)
function this:InitComponent(gameObject)
this.spLoader = SpriteLoader.New()
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
this.power = Util.GetGameObject(gameObject, "Power/Value"):GetComponent("Text")
this.sureBtn=Util.GetGameObject(gameObject,"sureBtn")
this.sureBtnText=Util.GetGameObject(gameObject,"sureBtn/Text"):GetComponent("Text")
--滚动条根节点
this.root = Util.GetGameObject(gameObject, "Root")
this.backBtn=Util.GetGameObject(gameObject,"BackBtn")
this.live2dRoot=Util.GetGameObject(gameObject,"live2dRoot")
end
function this:BindEvent()
Util.AddClick(this.sureBtn, function()
this:BtnClickEvent()
end)
Util.AddClick(this.backBtn, function()
parent:ClosePanel()
end)
end
function this:BtnClickEvent()
if type == 1 then
parent:ClosePanel()
elseif type == 2 then
parent:ClosePanel()
UIManager.OpenPanel(UIName.FormationPanelV2, FORMATION_TYPE.EXPEDITION, monsterData)
end
end
function this:AddListener()
end
function this:RemoveListener()
end
function this:OnShow(_parent,...)
parent=_parent
sortingOrder = _parent.sortingOrder
--不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参
local args = {...}
monsterData = args[1]
type = args[2]
fun = args[3]
--组数据
rewardData = {}
local curRewardData = {}
curNodeConFig = ConfigManager.TryGetConfigData(ConfigName.ExpeditionNodeConfig,monsterData.type)
local Reward = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.ExpeditionFloorConfig,"Floor",ExpeditionManager.expeditionLeve,"FloorLay",monsterData.lay - 1)
if Reward and Reward.Reward and #Reward.Reward > 0 then
for i = 1, #Reward.Reward do
local rewardGroupConfig = ConfigManager.TryGetConfigData(ConfigName.RewardGroup,ExpeSetting[1].SpecialReward)--Reward.Reward[i])
if rewardGroupConfig and #rewardGroupConfig.ShowItem > 0 then
for j = 1, #rewardGroupConfig.ShowItem do
local v = rewardGroupConfig.ShowItem[j]
if v[1] ~= 55 then--瑶池魔妖 不显示圣物特殊处理
if curRewardData[v[1]] then
curRewardData[v[1]] = {v[1],curRewardData[v[1]][2] + v[2]}
else
curRewardData[v[1]] = {v[1],v[2]}
end
end
end
end
end
end
for i, v in pairs(curRewardData) do
if curNodeConFig and curNodeConFig.Reward and curNodeConFig.Reward > 0 then
v = {v[1],math.floor(v[2] * curNodeConFig.Reward)}
end
table.insert(rewardData,v)
end
this:FormationAdapter()
end
-- 编队数据匹配
function this:FormationAdapter()
if type == 1 then
this.sureBtnText.text = Language[10555]
elseif type == 2 then
this.sureBtnText.text = Language[10556]
end
this.titleText.text=Language[10557]
if monsterData == nil then LogError(Language[10558]) return end
--LogError("monsterData.bossTeaminfo.hero "..#monsterData.bossTeaminfo.hero)
this.power.text = monsterData.bossTeaminfo.totalForce
local monsterCongig = {}
if monsterData.bossTeaminfo.hero and #monsterData.bossTeaminfo.hero > 1 then
-- local monsterGroup = ConfigManager.TryGetConfigData(ConfigName.MonsterGroup,monsterData.bossTeaminfo.teamInfo)
-- monsterCongig = ConfigManager.TryGetConfigData(ConfigName.HeroConfig,monsterData.bossTeaminfo.teamInfo)
-- if monsterGroup and monsterGroup.Contents and #monsterGroup.Contents > 0 then
-- if monsterGroup.Contents[1] and monsterGroup.Contents[1][1] then
-- monsterCongig = ConfigManager.TryGetConfigData(ConfigName.MonsterConfig,monsterGroup.Contents[1][1])
-- end
-- end
-- if not monsterCongig then return end
--if not monsterCongig then LogError("无 monsterCongig") return end
--monsterData.bossTeaminfo.hero[i].remainHp monsterCongig.Level
monsterCongig = ConfigManager.TryGetConfigData(ConfigName.HeroConfig,monsterData.bossTeaminfo.hero[2].heroTid)--monsterGroup.getHero)
if not monsterCongig then return end
local heroConfig = monsterCongig
this.LiveName = GetResourcePath(heroConfig.Live)
this.LiveGO = poolManager:LoadLive(this.LiveName, this.live2dRoot.transform,
Vector3.one * heroConfig.Scale, Vector3.New(heroConfig.Position[1],heroConfig.Position[2],0))
end
ResetItemView(this.root,this.root.transform,itemList,5,1,sortingOrder,false,rewardData)
end
function this:OnClose()
if fun then
fun()
fun = nil
end
if this.LiveName then
poolManager:UnLoadLive(this.LiveName,this.LiveGO )
this.LiveName= nil
end
end
function this:OnDestroy()
this.spLoader:Destroy()
end
return this