using UnityEngine;
using Wizard.Battle.View;
using Wizard.Battle.View.Vfx;

public class ChangeAffiliationVfx : SequentialVfxPlayer
{
	private readonly IBattleCardView _view;

	public ChangeAffiliationVfx(BattleCardBase card, CardBasePrm.ClanType clan)
	{
		ChangeAffiliationVfx changeAffiliationVfx = this;
		GameObject effectGameObject = null;
		_view = card.BattleCardView;
		if ((card.IsPlayer || GameMgr.GetIns().IsAdminWatch || !card.IsInHand) && clan != CardBasePrm.ClanType.NONE)
		{
			Register(new WaitLoadEffectAndSetSeVfx("cmn_card_classchange_1", "se_cmn_card_classchange_1", delegate(GameObject e)
			{
				effectGameObject = e;
			}));
			Register(new PlayEffectAndSeVfx(delegate
			{
				effectGameObject.GetComponent<Effect>().ChangeParticleColor(changeAffiliationVfx.GetClanColor(clan));
				return effectGameObject;
			}, _view.Transform));
			Register(WaitVfx.Create(0.3f));
		}
	}

	private VfxBase ChangeEffectColor(Effect effect, Color color)
	{
		return InstantVfx.Create(delegate
		{
			effect.ChangeParticleColor(color);
		});
	}

	private Color GetClanColor(CardBasePrm.ClanType clan)
	{
		return clan switch
		{
			CardBasePrm.ClanType.ALL => Color.white, 
			CardBasePrm.ClanType.MIN => new Color(0.2f, 1f, 0.8f), 
			CardBasePrm.ClanType.ROYAL => new Color(1f, 0.9f, 0.5f), 
			CardBasePrm.ClanType.WITCH => new Color(0.7f, 0.5f, 1f), 
			CardBasePrm.ClanType.DRAGON => new Color(1f, 0.5f, 0f), 
			CardBasePrm.ClanType.NECRO => new Color(0.5f, 0.4f, 1f), 
			CardBasePrm.ClanType.VAMPIRE => new Color(1f, 0.2f, 0.2f), 
			CardBasePrm.ClanType.BISHOP => new Color(0.5f, 0.7f, 1f), 
			_ => Color.white, 
		};
	}
}
