Files
test/Assets/PerfectWorld/Scripts/Vfx/A3DSkillGfxComposerMan.cs
2025-11-17 18:04:31 +07:00

69 lines
1.7 KiB
C#

using System.Collections.Generic;
using BrewMonster.Network;
using BrewMonster.Scripts;
namespace BrewMonster
{
public class A3DSkillGfxComposerMan
{
private readonly Dictionary<int, A3DSkillGfxComposer> m_ComposerMap = new Dictionary<int, A3DSkillGfxComposer>();
public bool LoadOneComposer(int nSkillID, string szPath)
{
if (m_ComposerMap.ContainsKey(nSkillID))
return false;
var composer = new A3DSkillGfxComposer();
if (!composer.Load(szPath))
{
// failed to load
return false;
}
// In original C++: composer->Init(g_pGame->GetGameRun()->GetWorld()->GetSkillGfxMan()->GetPtr());
// Not wired in Unity yet; keep placeholder init to allow future hookup.
composer.Init(A3DSkillGfxMan.Instance);
m_ComposerMap[nSkillID] = composer;
return true;
}
public void Release()
{
// If A3DSkillGfxComposer needs disposal later, do it here
m_ComposerMap.Clear();
}
public void Play(
int nSkillID,
int nHostID,
int nCastTargetID,
List<TARGET_DATA> Targets,
bool bIsGoblinSkill = false)
{
if (!m_ComposerMap.TryGetValue(nSkillID, out var composer) || composer == null)
return;
// Forward to composer (stubbed for now if Play not implemented)
try
{
// Provide a minimal default fly time estimation behavior when composer has no fly time configured
// Real effect triggering should be implemented inside composer.Play
composer.Play(nHostID, nCastTargetID, Targets, bIsGoblinSkill);
}
catch (System.MissingMethodException)
{
BMLogger.LogWarning("A3DSkillGfxComposer.Play is not implemented yet.");
}
}
public A3DSkillGfxComposer GetSkillGfxComposer(int skill)
{
return m_ComposerMap.TryGetValue(skill, out var composer) ? composer : null;
}
}
}