using Cute;
using Wizard.Battle.View.Vfx;

namespace Wizard.Battle.Sound;

public class LeaderSoundManager
{
	public VfxBase CreateLoadResouceVfx(string voiceId, bool isSe = false)
	{
		if (BattleManagerBase.GetIns() == null || BattleManagerBase.GetIns().IsRecovery)
		{
			return NullVfx.GetInstance();
		}
		string text = (isSe ? "s/se_" : "v/vo_") + voiceId + ".acb";
		if (!Toolbox.ResourcesManager.BattleListAssetPathList.Contains(text))
		{
			return new WaitLoadResourceVfx(text);
		}
		return NullVfx.GetInstance();
	}

	public VfxBase CreatePlayVfx(string voiceId, bool forcePlay = false)
	{
		if (BattleManagerBase.GetIns() == null || BattleManagerBase.GetIns().IsRecovery)
		{
			return NullVfx.GetInstance();
		}
		return InstantVfx.Create(delegate
		{
			GameMgr.GetIns().GetSoundMgr().PlayVoiceByKey(voiceId, forcePlay);
		});
	}

	public VfxBase CreatePlaySeVfx(string seId)
	{
		if (BattleManagerBase.GetIns() == null || BattleManagerBase.GetIns().IsRecovery)
		{
			return NullVfx.GetInstance();
		}
		return InstantVfx.Create(delegate
		{
			GameMgr.GetIns().GetSoundMgr().PlaySeByStr(seId, 0f, 0L);
		});
	}

	public VfxBase CreateLoadAndPlayEvolveSeVfx(string skinId, string suffiix)
	{
		string text = skinId + "_000_evo" + suffiix;
		return SequentialVfxPlayer.Create(CreateLoadResouceVfx(text, isSe: true), CreatePlaySeVfx("se_" + text));
	}
}
