using System.Collections.Generic;
using UnityEngine;
using Wizard.Battle.UI;
using Wizard.Battle.View.Vfx;

public class ClassInformationUIController
{
	private List<IClassInfomationUI> _classInformationUIList;

	public ClassInformationUIController(List<IClassInfomationUI> classInformationUIList)
	{
		_classInformationUIList = classInformationUIList;
	}

	public void SetUpEvent(BattlePlayerBase player)
	{
		for (int i = 0; i < _classInformationUIList.Count; i++)
		{
			if (_classInformationUIList[i] != null)
			{
				_classInformationUIList[i].SetUpEvent(player);
			}
		}
	}

	public VfxBase LoadResources(Transform parent, bool isPlayer)
	{
		ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
		for (int i = 0; i < _classInformationUIList.Count; i++)
		{
			parallelVfxPlayer.Register(_classInformationUIList[i].LoadResources(parent, isPlayer));
		}
		return parallelVfxPlayer;
	}

	public void ShowInfomation(bool playEffect = true)
	{
		for (int i = 0; i < _classInformationUIList.Count; i++)
		{
			if (_classInformationUIList[i] != null)
			{
				_classInformationUIList[i].ShowInfomation(playEffect);
			}
		}
	}

	public void NewReplayUpdateInfomation(NetworkBattleReceiver.ClassInfoUiInfo classInfo)
	{
		for (int i = 0; i < _classInformationUIList.Count; i++)
		{
			if (_classInformationUIList[i] != null)
			{
				_classInformationUIList[i].NewReplayUpdateInfomation(classInfo);
			}
		}
	}

	public bool HaveSpecificClassInformationUi(CardBasePrm.ClanType clanType)
	{
		for (int i = 0; i < _classInformationUIList.Count; i++)
		{
			switch (clanType)
			{
			case CardBasePrm.ClanType.MIN:
				if (_classInformationUIList[i] is ElfInfomationUI)
				{
					return true;
				}
				break;
			case CardBasePrm.ClanType.ROYAL:
				if (_classInformationUIList[i] is RoyalInfomationUI)
				{
					return true;
				}
				break;
			case CardBasePrm.ClanType.WITCH:
				if (_classInformationUIList[i] is WitchInfomationUI)
				{
					return true;
				}
				break;
			case CardBasePrm.ClanType.DRAGON:
				if (_classInformationUIList[i] is DragonInfomationUI)
				{
					return true;
				}
				break;
			case CardBasePrm.ClanType.NECRO:
				if (_classInformationUIList[i] is NecromanceInfomationUI)
				{
					return true;
				}
				break;
			case CardBasePrm.ClanType.VAMPIRE:
				if (_classInformationUIList[i] is VampireInfomationUI)
				{
					return true;
				}
				break;
			case CardBasePrm.ClanType.BISHOP:
				if (_classInformationUIList[i] is BishopInfomationUI)
				{
					return true;
				}
				break;
			case CardBasePrm.ClanType.NEMESIS:
				if (_classInformationUIList[i] is NemesisInfomationUI)
				{
					return true;
				}
				break;
			}
		}
		return false;
	}

	public void HideInfomation()
	{
		for (int i = 0; i < _classInformationUIList.Count; i++)
		{
			if (_classInformationUIList[i] != null)
			{
				_classInformationUIList[i].HideInfomation();
			}
		}
	}

	public void HideOtherInfomation()
	{
		for (int i = 0; i < _classInformationUIList.Count; i++)
		{
			if (_classInformationUIList[i] != null)
			{
				_classInformationUIList[i].HideOtherInfomation();
			}
		}
	}

	public void HideAllInfomation()
	{
		for (int i = 0; i < _classInformationUIList.Count; i++)
		{
			if (_classInformationUIList[i] != null)
			{
				_classInformationUIList[i].HideAllInfomation();
			}
		}
	}

	public void Recovery()
	{
		for (int i = 0; i < _classInformationUIList.Count; i++)
		{
			if (_classInformationUIList[i] != null)
			{
				_classInformationUIList[i].Recovery();
			}
		}
	}

	public void SetIsSelect(bool isSelect)
	{
		for (int i = 0; i < _classInformationUIList.Count; i++)
		{
			if (_classInformationUIList[i] != null)
			{
				_classInformationUIList[i].SetIsSelect(isSelect);
			}
		}
	}

	public void SetInCardFocus(bool inCardFocus)
	{
		for (int i = 0; i < _classInformationUIList.Count; i++)
		{
			if (_classInformationUIList[i] != null)
			{
				_classInformationUIList[i].SetInCardFocus(inCardFocus);
			}
		}
	}

	public void SetTouchable(bool isTouchable)
	{
		for (int i = 0; i < _classInformationUIList.Count; i++)
		{
			if (_classInformationUIList[i] != null)
			{
				_classInformationUIList[i].SetTouchable(isTouchable);
			}
		}
	}

	public void SetClassInformationUiPosition(bool isPlayer)
	{
		for (int i = 0; i < _classInformationUIList.Count; i++)
		{
			if (_classInformationUIList[i] != null)
			{
				(_classInformationUIList[i] as ClassInfomationUIBase).SetClassInformationUiPosition(isPlayer);
			}
		}
	}

	public void UpdateStatusPanelOnBattle(bool isPlayer)
	{
		for (int i = 0; i < _classInformationUIList.Count; i++)
		{
			if (_classInformationUIList[i] != null)
			{
				(_classInformationUIList[i] as ClassInfomationUIBase).UpdateStatusPanelOnBattle(isPlayer);
			}
		}
	}

	public void UpdateInfomation()
	{
		for (int i = 0; i < _classInformationUIList.Count; i++)
		{
			if (_classInformationUIList[i] != null)
			{
				(_classInformationUIList[i] as ClassInfomationUIBase).UpdateInfomation();
			}
		}
	}
}
