miduo_client/Assets/ManagedResources/~Lua/Modules/DiffMonster/DiffMonsterPreviewSecretBox...

92 lines
3.5 KiB
Lua
Raw Normal View History

2025-03-14 11:58:20 +08:00
---秘盒招募异妖预览
2020-05-09 13:31:21 +08:00
require("Base/BasePanel")
DiffMonsterPreviewSecretBoxPanel = Inherit(BasePanel)
2024-09-06 10:38:56 +08:00
local this = DiffMonsterPreviewSecretBoxPanel
2020-05-09 13:31:21 +08:00
2024-09-06 10:38:56 +08:00
this.liveName = nil
this.livePre = nil
2020-05-09 13:31:21 +08:00
local kInitLevel = 1
--初始化组件(用于子类重写)
function DiffMonsterPreviewSecretBoxPanel:InitComponent()
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New()
2024-09-06 10:38:56 +08:00
this.backBtn = Util.GetGameObject(self.gameObject, "BackBtn")
this.liveRoot = Util.GetGameObject(self.gameObject, "LiveRoot")
this.intelligenceImage = Util.GetGameObject(self.gameObject, "IntelligenceBg"):GetComponent("Image")
2020-05-09 13:31:21 +08:00
this.intelligenceValue = Util.GetGameObject(self.gameObject, "IntelligenceBg/Value"):GetComponent("Text")
2024-09-06 10:38:56 +08:00
this.name = Util.GetGameObject(self.gameObject, "Name/Text"):GetComponent("Text")
2020-05-09 13:31:21 +08:00
this.skillInfo = Util.GetGameObject(self.gameObject, "SkillInfo")
this.skillIcon = Util.GetGameObject(self.skillInfo, "SkillBg/SkillIcon"):GetComponent("Image")
this.skillName = Util.GetGameObject(self.skillInfo, "SkillNameBg/SkillName"):GetComponent("Text")
this.skillDesc = Util.GetGameObject(self.skillInfo, "SkillDesc"):GetComponent("Text")
end
--绑定事件(用于子类重写)
function DiffMonsterPreviewSecretBoxPanel:BindEvent()
2024-09-06 10:38:56 +08:00
Util.AddClick(this.backBtn, function()
2020-05-09 13:31:21 +08:00
self:ClosePanel()
end)
end
--添加事件监听(用于子类重写)
function DiffMonsterPreviewSecretBoxPanel:AddListener()
end
--移除事件监听(用于子类重写)
function DiffMonsterPreviewSecretBoxPanel:RemoveListener()
end
--界面打开时调用(用于子类重写)
function DiffMonsterPreviewSecretBoxPanel:OnOpen(...)
2024-09-06 10:38:56 +08:00
local itemdata = {}
table.insert(itemdata, SecretBoxManager.StarDifferDemonsId[1])
local diffId = DiffMonsterManager.GetDiffMonsterByComponentId(itemdata[1]) --获取异妖ID
2020-05-09 13:31:21 +08:00
2024-09-06 10:38:56 +08:00
local scale = Vector3.New(PokemonEffectConfig[diffId].scale, PokemonEffectConfig[diffId].scale,
PokemonEffectConfig[diffId].scale)
this.liveName = PokemonEffectConfig[diffId].live
this.livePre = poolManager:LoadLive(this.liveName, this.liveRoot.transform, scale, Vector3.New(0, 0, 0))
2020-05-09 13:31:21 +08:00
2024-09-06 10:38:56 +08:00
local data = ConfigManager.GetConfigData(ConfigName.DifferDemonsConfig, diffId)
2020-05-09 13:31:21 +08:00
2024-09-06 10:38:56 +08:00
this.intelligenceImage.sprite = GetQuantityImage(this.spLoader, data.Aptitude)
this.intelligenceValue.text = data.Aptitude
this.name.text = GetLanguageStrById(data.Name)
2020-05-09 13:31:21 +08:00
this:SetSkillInfo(diffId)
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function DiffMonsterPreviewSecretBoxPanel:OnShow()
end
--界面关闭时调用(用于子类重写)
function DiffMonsterPreviewSecretBoxPanel:OnClose()
if this.liveName then
poolManager:UnLoadLive(this.liveName, this.livePre)
2024-09-06 10:38:56 +08:00
this.liveName = nil
this.livePre = nil
2020-05-09 13:31:21 +08:00
end
end
--界面销毁时调用(用于子类重写)
function DiffMonsterPreviewSecretBoxPanel:OnDestroy()
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2020-05-09 13:31:21 +08:00
end
--设置技能信息
function this:SetSkillInfo(id)
2024-09-06 10:38:56 +08:00
local pokemon = DiffMonsterManager.GetSinglePokemonData(id)
2020-05-09 13:31:21 +08:00
local skillId = pokemon.pokemonUpLvConfigList[kInitLevel].configData.SkillId
local skillConfig = ConfigManager.TryGetConfigData(ConfigName.SkillConfig, skillId)
if skillConfig then
2021-04-21 13:12:04 +08:00
this.skillIcon.sprite = this.spLoader:LoadSprite(GetResourcePath(skillConfig.Icon))
2021-01-26 17:08:39 +08:00
this.skillName.text = GetLanguageStrById(skillConfig.Name)
2020-05-09 13:31:21 +08:00
this.skillDesc.text = GetSkillConfigDesc(skillConfig)
end
end
2021-04-21 13:12:04 +08:00
return DiffMonsterPreviewSecretBoxPanel