using System;
using UnityEngine;

public class OvrController : AVRController
{
	public override bool IsHandCameraMode
	{
		get
		{
			return this.m_CtrlBehNow.IsHandCameraMode;
		}
	}

	public override bool HandCameraMode
	{
		get
		{
			return this.m_CtrlBehNow.HandCameraMode;
		}
		set
		{
			if (value)
			{
				this.m_CtrlBehNow.HandCameraMode = true;
			}
		}
	}

	public override bool IsHandPenMode
	{
		get
		{
			return this.m_CtrlBehNow.IsHandPenMode;
		}
	}

	public override AVRControllerBehavior.LIMIT_MODE HandLimitMode
	{
		get
		{
			return this.m_CtrlBehNow.HandLimitMode;
		}
		set
		{
			this.m_CtrlBehNow.HandLimitMode = value;
		}
	}

	public override bool HandDanceMode
	{
		get
		{
			return this.m_CtrlBehNow.HandDanceMode;
		}
		set
		{
			this.m_CtrlBehNow.HandDanceMode = value;
		}
	}

	public override bool HandModelVisible
	{
		get
		{
			return this.m_CtrlBehNow.HandModelVisible;
		}
		set
		{
			this.m_CtrlBehNow.HandModelVisible = value;
		}
	}

	public override bool HandVRIKMode
	{
		get
		{
			return this.m_CtrlBehNow.HandVRIKMode;
		}
		set
		{
			this.m_CtrlBehNow.HandVRIKMode = value;
		}
	}

	public override bool HandYotogiMode
	{
		get
		{
			return this.m_CtrlBehNow.HandYotogiMode;
		}
		set
		{
			this.m_CtrlBehNow.HandYotogiMode = value;
		}
	}

	public override void Init()
	{
		base.Init();
		this.m_CtrlBehOld = base.GetComponent<OvrControllerBehavior>();
		this.m_CtrlBehOld.Init(this);
		this.m_CtrlBehNew = base.GetComponent<OvrControllerBehavior2>();
		this.m_CtrlBehNew.Init(this);
	}

	private void EnableHandHitChara(bool f_bEnable)
	{
		if (base.HandEnable != f_bEnable)
		{
			if (f_bEnable)
			{
				int maidCount = GameMain.Instance.CharacterMgr.GetMaidCount();
				for (int i = 0; i < maidCount; i++)
				{
					Maid maid = GameMain.Instance.CharacterMgr.GetMaid(i);
					if (maid != null && maid.body0)
					{
						if (this.m_bHandL)
						{
							maid.body0.m_trHandHitL = this.m_trHandHit;
						}
						else
						{
							maid.body0.m_trHandHitR = this.m_trHandHit;
						}
					}
				}
			}
			else
			{
				int maidCount2 = GameMain.Instance.CharacterMgr.GetMaidCount();
				for (int j = 0; j < maidCount2; j++)
				{
					Maid maid2 = GameMain.Instance.CharacterMgr.GetMaid(j);
					if (maid2 != null && maid2.body0)
					{
						maid2.body0.m_trHandHitL = null;
						maid2.body0.m_trHandHitR = null;
					}
				}
			}
		}
		base.HandEnable = f_bEnable;
	}

	protected void Update()
	{
		if ((OVRInput.GetActiveController() & OVRInput.Controller.LTouch) == OVRInput.Controller.None && (OVRInput.GetActiveController() & OVRInput.Controller.RTouch) == OVRInput.Controller.None)
		{
			base.transform.localScale = new Vector3(0f, 0f, 0f);
			this.EnableHandHitChara(false);
			return;
		}
		base.transform.localScale = new Vector3(1f, 1f, 1f);
		this.EnableHandHitChara(true);
	}
}
