using System.Linq;
using UnityEngine;
using Wizard.Battle.Touch;
using Wizard.Battle.View.Vfx;

public class WatchTouchControl : NetworkTouchControl
{
	private const float IDLE_TIME = 20f;

	private const int IDLE_EMOTE_KIND = 3;

	private Coroutine idleTimeCoroutine;

	private ClassCharaPrm.EmotionType _previousEmotionType;

	public new bool notAttackFlag { private get; set; }

	public new bool notEmoteFlag { private get; set; }

	public new bool notDragPlayCardFlag { private get; set; }

	public new bool notEvolCardFlag { private get; set; }

	public WatchTouchControl(BattleManagerBase battleMgr, BattleCamera battleCamera, BackGroundBase backGround)
		: base(battleMgr, battleCamera, backGround)
	{
		notAttackFlag = true;
		notEmoteFlag = true;
		notDragPlayCardFlag = true;
		notEvolCardFlag = true;
	}

	protected override bool IsFeasibleAttack()
	{
		if (notAttackFlag)
		{
			return false;
		}
		return base.IsFeasibleAttack();
	}

	protected override bool IsFeasibleEmote()
	{
		if (notEmoteFlag)
		{
			return false;
		}
		return base.IsFeasibleEmote();
	}

	protected override bool IsFeasiblePlayCard()
	{
		if (notDragPlayCardFlag)
		{
			return false;
		}
		return base.IsFeasiblePlayCard();
	}

	protected override bool IsFeasibleEvol()
	{
		if (notEvolCardFlag)
		{
			return false;
		}
		return base.IsFeasibleEvol();
	}

	protected override void StopDraggingArrow()
	{
	}

	protected override BattleCardBase GetHitCardFromRayCastHit(RaycastHit hit)
	{
		GameObject cardRootGameObject = hit.collider.gameObject.transform.parent.gameObject;
		BattleCardBase battleCardBase = base.BattlePlayer.FindCardFromGameObject(cardRootGameObject);
		if (battleCardBase != null)
		{
			return battleCardBase;
		}
		battleCardBase = base.BattlePlayer.BattleView.GetSelectCardList().FirstOrDefault((BattleCardBase s) => s.BattleCardView.GameObject == cardRootGameObject);
		if (battleCardBase != null)
		{
			return battleCardBase;
		}
		BattleCardBase battleCardBase2 = base.BattleEnemy.FindCardFromGameObject(cardRootGameObject);
		if (battleCardBase2 != null)
		{
			return battleCardBase2;
		}
		battleCardBase2 = base.BattleEnemy.BattleView.GetSelectCardList().FirstOrDefault((BattleCardBase s) => s.BattleCardView.GameObject == cardRootGameObject);
		if (battleCardBase2 != null)
		{
			return battleCardBase2;
		}
		return null;
	}

	protected override void WatchChoiceDetail(BattleCardBase hitCard, ParallelVfxPlayer parallelVfx)
	{
		if (hitCard != null && !hitCard.IsInHand && !hitCard.IsInDeck && !hitCard.IsInplay && !hitCard.IsDead)
		{
			_hitCard = hitCard;
			SelectCardProcessor touchProcessor = new SelectCardProcessor(_battleMgr, _hitCard, _inputMgr, _pressedCard != null);
			parallelVfx.Register(RegisterTouchProcessor(touchProcessor));
			if (hitCard.BattleCardView.Transform.localScale.x >= 1f)
			{
				StartOpenHandDetail(_hitCard, right: false);
			}
		}
	}

	protected override void HideAlert()
	{
		_alertCard = null;
	}

	protected override bool IsShowingAlert()
	{
		return false;
	}
}
