miduo_client/Assets/ManagedResources/~Lua/Modules/Battle/View/BattleBossInfoPanel.lua

112 lines
4.0 KiB
Lua

require("Base/BasePanel")
local BattleBossInfoPanel = Inherit(BasePanel)
local func
local HeroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
local BossConfig = ConfigManager.GetConfig(ConfigName.MainLevelBossConfig)
local artConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
local bgName
local Live
--初始化组件(用于子类重写)
function BattleBossInfoPanel:InitComponent()
self.btnBack = Util.GetGameObject(self.gameObject,"mask")
self.root = Util.GetGameObject(self.gameObject,"root")
self.nameImg = Util.GetGameObject(self.gameObject,"content/Pos/NameImg"):GetComponent("Image")
self.nameZh = Util.GetGameObject(self.gameObject,"content/Pos/NameZh"):GetComponent("Text")
self.nameOther = Util.GetGameObject(self.gameObject,"content/Pos/NameOther"):GetComponent("Text")
self.posImg = Util.GetGameObject(self.gameObject,"content/Pos/PosImage"):GetComponent("Image")
self.posImgDi = Util.GetGameObject(self.gameObject,"content/Pos/PosImgDi"):GetComponent("Image")
self.posTextZh = Util.GetGameObject(self.gameObject,"content/Pos/PosTextZh"):GetComponent("Text")
self.posTextOther = Util.GetGameObject(self.gameObject,"content/Pos/PosTexOther"):GetComponent("Text")
self.skillText = Util.GetGameObject(self.gameObject,"content/Detail/skill/Text"):GetComponent("Text")
self.talismanText = Util.GetGameObject(self.gameObject,"content/Detail/talisman/Text"):GetComponent("Text")
self.ani1 = Util.GetGameObject(self.gameObject,"ani")
self.ani2 = Util.GetGameObject(self.gameObject,"ani2")
end
--绑定事件(用于子类重写)
function BattleBossInfoPanel:BindEvent()
Util.AddClick(self.btnBack,function ()
PlayUIAnim(self.ani1)
PlayUIAnim(self.ani2)
Timer.New(function ()
self:ClosePanel()
end,0.7):Start()
end)
end
--添加事件监听(用于子类重写)
function BattleBossInfoPanel:AddListener()
end
--移除事件监听(用于子类重写)
function BattleBossInfoPanel:RemoveListener()
end
function BattleBossInfoPanel:OnSortingOrderChange()
end
--界面打开时调用(用于子类重写)
function BattleBossInfoPanel:OnOpen(...)
func = ...
end
-- 打开,重新打开时回调
function BattleBossInfoPanel:OnShow()
Timer.New(function ()
PlayUIAnim(self.ani1)
PlayUIAnim(self.ani2)
Timer.New(function ()
self:ClosePanel()
end,0.7):Start()
end,10):Start()
local data = ConfigManager.GetConfigData(ConfigName.MainLevelConfig,FightPointPassManager.curOpenFight)
local heroData = ConfigManager.GetConfigData(ConfigName.HeroConfig,data.BossPreview)
local bossData = ConfigManager.GetConfigDataByKey(ConfigName.MainLevelBossConfig,"HeroId",data.BossPreview)
--Pos
local GetcurLanguage = 0
self.nameZh.text = heroData.ReadingName
self.posTextZh.text = heroData.HeroLocation
self.nameOther.text = heroData.ReadingName
self.posTextOther.text = heroData.ShowHeroLocation
self.nameZh.gameObject:SetActive(GetcurLanguage == 0)
self.posTextZh.gameObject:SetActive(GetcurLanguage == 0)
self.nameOther.gameObject:SetActive(GetcurLanguage ~= 0)
self.posTextOther.gameObject:SetActive(GetcurLanguage ~= 0)
--Root
bgName = artConfig[HeroConfig[data.BossPreview].Live].Name
local pos = HeroConfig[data.BossPreview].Position
local scale = HeroConfig[data.BossPreview].Scale
if Live then
poolManager:UnLoadLive(bgName, Live)
end
Live = poolManager:LoadLive(bgName, self.root.transform, Vector3.one*scale, Vector2.New(pos[1],pos[2]))
--Bottom
self.skillText.text = bossData.Skilltips
self.talismanText.text = bossData.Treasuretips
end
--界面关闭时调用(用于子类重写)
function BattleBossInfoPanel:OnClose()
if func then
func()
end
if Live then
poolManager:UnLoadLive(bgName, Live)
end
end
--界面销毁时调用(用于子类重写)
function BattleBossInfoPanel:OnDestroy()
end
return BattleBossInfoPanel