123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908 |
- using System;
- using System.Collections;
- using UnityEngine;
- using UnityEngine.UI;
- using Valve.VR;
- public class ViveControllerBehavior2 : ViveControllerBehavior
- {
- public override AVRControllerBehavior.BEH_TYPE BehaviourType
- {
- get
- {
- return AVRControllerBehavior.BEH_TYPE.NEW;
- }
- }
- public override bool HandCameraMode
- {
- get
- {
- return this.m_eMode == ViveControllerBehavior2.OvrControllerMode.CAMERA;
- }
- set
- {
- if (value)
- {
- this.ChangeMode(ViveControllerBehavior2.OvrControllerMode.CAMERA);
- }
- }
- }
- public override bool IsHandCameraMode
- {
- get
- {
- return this.m_eModeBack == ViveControllerBehavior2.OvrControllerMode.CAMERA;
- }
- }
- public override bool IsHandPenMode
- {
- get
- {
- return this.m_eMode == ViveControllerBehavior2.OvrControllerMode.PEN;
- }
- }
- public override bool HandModelVisible
- {
- get
- {
- return this.m_bHandModelVisible;
- }
- set
- {
- this.m_bHandModelVisible = value;
- this.ChangeMode(this.m_eMode);
- }
- }
- public override AVRControllerBehavior.LIMIT_MODE HandLimitMode
- {
- set
- {
- if (value == AVRControllerBehavior.LIMIT_MODE.HAND_ONLY)
- {
- this.ChangeMode(ViveControllerBehavior2.OvrControllerMode.HAND);
- }
- base.HandLimitMode = value;
- }
- }
- public override bool HandDanceMode
- {
- get
- {
- return this.m_bHandDanceMode && this.m_eMode == ViveControllerBehavior2.OvrControllerMode.DANCE;
- }
- set
- {
- this.m_bHandDanceMode = value;
- if (value)
- {
- this.ChangeMode(ViveControllerBehavior2.OvrControllerMode.DANCE);
- }
- else if (!value)
- {
- if (this.m_eMode == ViveControllerBehavior2.OvrControllerMode.PEN)
- {
- this.m_eModeBack = ViveControllerBehavior2.OvrControllerMode.HAND;
- }
- else if (this.m_eMode == ViveControllerBehavior2.OvrControllerMode.DANCE)
- {
- this.m_eModeBack = ViveControllerBehavior2.OvrControllerMode.HAND;
- this.ChangeMode(ViveControllerBehavior2.OvrControllerMode.HAND);
- }
- }
- }
- }
- public override bool HandVRIKMode
- {
- get
- {
- return this.m_bHandVRIKMode;
- }
- set
- {
- this.m_bHandVRIKMode = value;
- if (value)
- {
- this.m_bModeHide[5] = false;
- this.m_bModeHide[6] = false;
- this.m_bModeHide[7] = false;
- this.ChangeMode(ViveControllerBehavior2.OvrControllerMode.VRIK_FACE);
- }
- else if (!value)
- {
- if (this.m_eMode == ViveControllerBehavior2.OvrControllerMode.PEN)
- {
- this.m_eModeBack = ViveControllerBehavior2.OvrControllerMode.HAND;
- }
- else if (this.m_eMode == ViveControllerBehavior2.OvrControllerMode.VRIK_FACE)
- {
- this.m_eModeBack = ViveControllerBehavior2.OvrControllerMode.HAND;
- this.ChangeMode(ViveControllerBehavior2.OvrControllerMode.HAND);
- }
- this.m_bModeHide[5] = true;
- this.m_bModeHide[6] = true;
- this.m_bModeHide[7] = true;
- }
- }
- }
- public override bool HandYotogiMode
- {
- get
- {
- return this.m_bHandYotogiMode && this.m_eMode == ViveControllerBehavior2.OvrControllerMode.YOTOGI;
- }
- set
- {
- this.m_bHandYotogiMode = value;
- if (value)
- {
- this.m_bModeHide[8] = false;
- this.ChangeMode(ViveControllerBehavior2.OvrControllerMode.YOTOGI);
- }
- else if (!value)
- {
- if (this.m_eMode == ViveControllerBehavior2.OvrControllerMode.PEN)
- {
- this.m_eModeBack = ViveControllerBehavior2.OvrControllerMode.HAND;
- }
- else if (this.m_eMode == ViveControllerBehavior2.OvrControllerMode.YOTOGI)
- {
- this.m_eModeBack = ViveControllerBehavior2.OvrControllerMode.HAND;
- this.ChangeMode(ViveControllerBehavior2.OvrControllerMode.HAND);
- }
- this.m_bModeHide[8] = true;
- }
- }
- }
- protected override void Awake()
- {
- base.Awake();
- NDebug.Assert(this.m_Pair != null, "Pairコントローラがありません。");
- GameMain.Instance.CMSystem.OvrPointerMode = Mathf.Max(Mathf.Min(0, GameMain.Instance.CMSystem.OvrPointerMode), 0);
- GameMain.Instance.CMSystem.OvrMoveMode = Mathf.Max(Mathf.Min(2, GameMain.Instance.CMSystem.OvrMoveMode), 0);
- OvrMgr.OvrObject ovr_obj = GameMain.Instance.OvrMgr.ovr_obj;
- this.m_trackedObject = base.GetComponent<SteamVR_TrackedObject>();
- this.m_txMode = base.transform.Find("UI/Canvas/Text").GetComponent<Text>();
- this.m_goHandCamera = base.transform.Find("HandCamera").gameObject;
- this.m_HandCamera = this.m_goHandCamera.GetComponent<OvrHandCamera>();
- this.m_HandCamera.m_ctrl = this;
- this.m_trTrackedDeviceParent = base.transform.parent.Find("Tracked Devices");
- this.m_TrackObjs = this.m_trTrackedDeviceParent.GetComponentsInChildren<SteamVR_TrackedObject>(true);
- this.m_ArcTeleport = base.transform.Find("ArcTeleport").GetComponentInChildren<ArcTeleport>(true);
- this.m_ArcTeleport.SetCallBackOnMove(new ArcTeleport.dgOnMove(this.OnWarpMove));
- this.m_HandItem = base.transform.Find("HandItem").GetComponent<OvrHandItemMgr>();
- this.m_HandItem.m_ctrl = this;
- this.m_HandItem.SetButtons(this.m_buttons);
- this.m_HandItem.gameObject.SetActive(false);
- this.m_goManHand = base.transform.Find("HandPlayer").gameObject;
- NDebug.Assert(this.m_goManHand != null, "HandPlayer 男の手が見つかりません。");
- this.m_goManHand.GetComponent<ViveHandAnimator>().Init(this.m_buttons);
- this.m_fCursorLaserEasing = GameMain.Instance.CMSystem.OvrViveCursorLaserEasing;
- this.m_trTabletPenRoot = base.transform.Find("UIRay");
- NDebug.Assert(this.m_trTabletPenRoot != null, "UIRayが見つかりません。");
- this.m_goTabletPen = base.transform.Find("UIRay/Odogu_Styluspen_red").gameObject;
- NDebug.Assert(this.m_goTabletPen != null, "UI用タブレットペンモデルが見つかりません。");
- OvrUIPen component = this.m_goTabletPen.GetComponent<OvrUIPen>();
- if (component != null)
- {
- component.m_ctrl = this;
- }
- this.m_goManHand.SetActive(false);
- this.m_bIsInit = true;
- }
- private void Start()
- {
- GameMain.Instance.OvrMgr.OvrCamera.m_bWheelToZoom = false;
- this.ChangeMode(this.m_eMode);
- }
- private void OnEnable()
- {
- this.m_trTabletPenRoot.gameObject.SetActive(true);
- this.ChangeMode(this.m_eMode);
- }
- private void OnDisable()
- {
- this.m_trTabletPenRoot.gameObject.SetActive(false);
- this.m_goTabletPen.SetActive(false);
- this.m_goManHand.SetActive(false);
- }
- private void ChangeMode(ViveControllerBehavior2.OvrControllerMode f_eNewMode)
- {
- if (this.m_bIsInit)
- {
- bool flag = false;
- bool active = false;
- bool enabled = false;
- bool active2 = false;
- bool flag2 = false;
- bool enabled2 = true;
- bool active3 = false;
- bool isEnableHandUI = false;
- bool isEnableHandUI2 = false;
- bool isEnableHandUI3 = false;
- if (f_eNewMode == ViveControllerBehavior2.OvrControllerMode.HAND || f_eNewMode == ViveControllerBehavior2.OvrControllerMode.YOTOGI)
- {
- enabled = true;
- if (this.m_bHandModelVisible)
- {
- if (this.m_eHandSubMode == ViveControllerBehavior2.HandSubMode.CONTROLLER)
- {
- flag = true;
- active = false;
- }
- else
- {
- flag = false;
- active = true;
- }
- }
- else
- {
- flag = false;
- active = false;
- }
- }
- if (f_eNewMode == ViveControllerBehavior2.OvrControllerMode.CAMERA)
- {
- active2 = true;
- enabled2 = false;
- }
- if (f_eNewMode == ViveControllerBehavior2.OvrControllerMode.PEN)
- {
- enabled = true;
- flag2 = true;
- }
- if (f_eNewMode == ViveControllerBehavior2.OvrControllerMode.ITEM)
- {
- active3 = true;
- }
- if (f_eNewMode == ViveControllerBehavior2.OvrControllerMode.VRIK_FACE)
- {
- enabled = true;
- isEnableHandUI = true;
- }
- if (f_eNewMode == ViveControllerBehavior2.OvrControllerMode.VRIK_HAND)
- {
- enabled = true;
- isEnableHandUI2 = true;
- }
- if (f_eNewMode == ViveControllerBehavior2.OvrControllerMode.VRIK_OTHER)
- {
- enabled = true;
- isEnableHandUI3 = true;
- }
- if (flag)
- {
- foreach (SteamVR_TrackedObject steamVR_TrackedObject in this.m_TrackObjs)
- {
- if (steamVR_TrackedObject.index == this.m_trackedObject.index)
- {
- steamVR_TrackedObject.gameObject.transform.localScale = new Vector3(1f, 1f, 1f);
- }
- }
- }
- else
- {
- foreach (SteamVR_TrackedObject steamVR_TrackedObject2 in this.m_TrackObjs)
- {
- if (steamVR_TrackedObject2.index == this.m_trackedObject.index)
- {
- steamVR_TrackedObject2.gameObject.transform.localScale = new Vector3(0f, 0f, 0f);
- }
- }
- }
- PhotoFaceDataShortcutParent componentInChildren = base.gameObject.GetComponentInChildren<PhotoFaceDataShortcutParent>();
- if (componentInChildren != null)
- {
- componentInChildren.isEnableHandUI = isEnableHandUI;
- }
- HandSignShortcut componentInChildren2 = base.gameObject.GetComponentInChildren<HandSignShortcut>();
- if (componentInChildren2 != null)
- {
- componentInChildren2.isEnableHandUI = isEnableHandUI2;
- }
- OtherCommandShortcut componentInChildren3 = base.gameObject.GetComponentInChildren<OtherCommandShortcut>();
- if (componentInChildren3 != null)
- {
- componentInChildren3.isEnableHandUI = isEnableHandUI3;
- }
- this.m_obj_controller.grip_collider.enabled = enabled;
- this.m_goHandCamera.SetActive(active2);
- this.m_goTabletPen.SetActive(flag2);
- this.m_controller.UIRayEnable = flag2;
- this.m_HandItem.gameObject.SetActive(active3);
- GameMain.Instance.OvrMgr.SystemUICamera.SetActiveVirtualCursorObjByNocurrent((!this.m_bHandL) ? UICamera.VCURSOR.RIGHT : UICamera.VCURSOR.LEFT, flag2);
- this.m_goManHand.SetActive(active);
- this.m_txMode.enabled = enabled2;
- this.m_txMode.text = this.m_strMode[(int)f_eNewMode];
- }
- this.m_eMode = f_eNewMode;
- }
- private void ChangePointerMode(ViveControllerBehavior2.PointerSubMode f_ePMode)
- {
- this.ChangeMode(ViveControllerBehavior2.OvrControllerMode.HAND);
- }
- private void ChangeMoveMode(ViveControllerBehavior2.MoveSubMode f_eSubMode)
- {
- GameMain.Instance.CMSystem.OvrMoveMode = (int)f_eSubMode;
- this.ChangeMode(ViveControllerBehavior2.OvrControllerMode.HAND);
- }
- private void ChangeHandMode(ViveControllerBehavior2.HandSubMode f_eSubMode)
- {
- this.m_eHandSubMode = f_eSubMode;
- this.ChangeMode(ViveControllerBehavior2.OvrControllerMode.HAND);
- }
- private void TouchPadToClick()
- {
- if (this.m_buttons.GetPressDown(AVRControllerButtons.BTN.VIRTUAL_L_CLICK) || this.m_buttons.GetPressDown(AVRControllerButtons.BTN.VIRTUAL_R_CLICK))
- {
- this.m_bCursorMoveEnable = false;
- GameMain.Instance.OvrMgr.SystemUICamera.SetCurrentCursorSide((!this.m_bHandL) ? UICamera.VCURSOR.RIGHT : UICamera.VCURSOR.LEFT);
- if (this.m_buttons.GetPressDown(AVRControllerButtons.BTN.VIRTUAL_L_CLICK))
- {
- NUty.EmurateMouseButton(2);
- this.m_bPressLeft = true;
- }
- else if (this.m_buttons.GetPressDown(AVRControllerButtons.BTN.VIRTUAL_R_CLICK))
- {
- NUty.EmurateMouseButton(8);
- this.m_bPressLeft = false;
- }
- if (this.m_coCursorMoveWait != null)
- {
- base.StopCoroutine(this.m_coCursorMoveWait);
- }
- this.m_coCursorMoveWait = base.StartCoroutine(this.CoCursorMoveWait());
- }
- else if (this.m_buttons.GetPressUp(AVRControllerButtons.BTN.VIRTUAL_L_CLICK) || this.m_buttons.GetPressUp(AVRControllerButtons.BTN.VIRTUAL_R_CLICK))
- {
- if (this.m_bPressLeft)
- {
- NUty.EmurateMouseButton(4);
- }
- else
- {
- GameMain.Instance.OvrMgr.OvrCamera.m_bRightClickUIToggle = false;
- NUty.EmurateMouseButton(16);
- }
- }
- }
- private IEnumerator CoCursorMoveWait()
- {
- yield return new WaitForSeconds(0.3f);
- this.m_bCursorMoveEnable = true;
- yield break;
- }
- private void TouchPadWheel()
- {
- if (this.m_device.GetTouchDown(4294967296UL))
- {
- this.m_fTrackPadBefY = this.m_device.GetAxis(EVRButtonId.k_EButton_Axis0).y;
- }
- else if (this.m_device.GetTouch(4294967296UL))
- {
- Vector2 axis = this.m_device.GetAxis(EVRButtonId.k_EButton_Axis0);
- float num = axis.y - this.m_fTrackPadBefY;
- if (0.1f < Mathf.Abs(num))
- {
- NUty.EmurateMouseWheel((int)(num * 10f));
- this.m_fTrackPadBefY = axis.y;
- }
- }
- }
- private void OnWarpMove(Vector3 f_vPosWorld, Vector3 f_vRotWorld)
- {
- GameMain.Instance.MainCamera.SetFootPos(f_vPosWorld, CameraMain.STAND_SIT.STAND);
- GameMain.Instance.MainCamera.SetRealHeadRot(f_vRotWorld, true);
- }
- public bool IsGrabTablet()
- {
- return this.m_eMode == ViveControllerBehavior2.OvrControllerMode.PEN && this.m_buttons.GetPress(AVRControllerButtons.BTN.TRIGGER);
- }
- private void TabletSizeChange()
- {
- if (this.m_eMode == ViveControllerBehavior2.OvrControllerMode.PEN)
- {
- if (this.m_Pair.IsGrabTablet())
- {
- if (this.m_buttons.GetPressDown(AVRControllerButtons.BTN.TRIGGER))
- {
- this.m_fOtherDistanceOne = Vector3.Distance(this.m_Pair.transform.position, base.transform.position);
- this.m_fTabletScaleBef = GameMain.Instance.OvrMgr.OvrCamera.OvrTablet.Size;
- this.m_bTabletScaleGrab = true;
- }
- else if (this.m_buttons.GetPress(AVRControllerButtons.BTN.TRIGGER))
- {
- if (this.m_bTabletScaleGrab)
- {
- float num = Vector3.Distance(this.m_Pair.transform.position, base.transform.position) / this.m_fOtherDistanceOne;
- GameMain.Instance.OvrMgr.OvrCamera.OvrTablet.Size = this.m_fTabletScaleBef * num;
- }
- }
- else
- {
- this.m_bTabletScaleGrab = false;
- }
- }
- else
- {
- this.m_bTabletScaleGrab = false;
- }
- }
- else
- {
- this.m_bTabletScaleGrab = false;
- }
- }
- protected override void Update()
- {
- GameMain.Instance.OvrMgr.OvrCamera.m_bRightClickUIToggle = true;
- if (OvrIK.IsModeVRIK)
- {
- if (this.m_goModeCanvas.layer != 17)
- {
- this.m_goModeCanvas.layer = 17;
- }
- }
- else if (this.m_goModeCanvas.layer != 0)
- {
- this.m_goModeCanvas.layer = 0;
- }
- this.m_device = SteamVR_Controller.Input((int)this.m_trackedObject.index);
- this.m_vMoveCam.x = (this.m_vMoveCam.y = (this.m_vMoveCam.z = (this.m_fRotCam = 0f)));
- this.m_vMoveVelocity.x = (this.m_vMoveVelocity.y = (this.m_vMoveVelocity.z = 0f));
- this.m_fCamRotNow = 0f;
- if (this.m_device.GetPressDown(2UL))
- {
- this.m_bPressMenuBtnLong = false;
- this.m_fMenuPressBeforeTime = Time.realtimeSinceStartup;
- }
- else if (this.m_device.GetPress(2UL))
- {
- if (!this.m_bPressMenuBtnLong && Time.realtimeSinceStartup - this.m_fMenuPressBeforeTime > 1f)
- {
- if (this.m_eMode == ViveControllerBehavior2.OvrControllerMode.HAND)
- {
- ViveControllerBehavior2.HandSubMode handSubMode = this.m_eHandSubMode + 1;
- if (handSubMode >= ViveControllerBehavior2.HandSubMode.MAX)
- {
- handSubMode = ViveControllerBehavior2.HandSubMode.CONTROLLER;
- }
- this.ChangeHandMode(handSubMode);
- }
- else if (this.m_eMode == ViveControllerBehavior2.OvrControllerMode.CAMERA)
- {
- }
- this.m_bPressMenuBtnLong = true;
- }
- }
- else if (this.m_device.GetPressUp(2UL) && !this.m_bPressMenuBtnLong)
- {
- if (this.m_device.GetPress(4UL))
- {
- GameMain.Instance.OvrMgr.OvrCamera.ReCallcOffset();
- GameMain.Instance.OvrMgr.OvrCamera.ShowUI(true);
- GameMain.Instance.OvrMgr.OvrCamera.UIPosReset(0f);
- }
- else if (this.HandLimitMode != AVRControllerBehavior.LIMIT_MODE.HAND_ONLY)
- {
- int num = (int)this.m_eMode;
- do
- {
- num++;
- if (num == 3 && !this.m_bHandDanceMode)
- {
- num++;
- }
- if (9 <= num)
- {
- num = 0;
- }
- }
- while (this.m_bModeHide[num]);
- this.ChangeMode((ViveControllerBehavior2.OvrControllerMode)num);
- this.m_eModeBack = this.m_eMode;
- }
- }
- this.m_bTabletArea = GameMain.Instance.OvrMgr.OvrCamera.OvrTablet.IsHitPointerArea(base.transform.position);
- if (this.m_bTabletArea && !this.m_ArcTeleport.IsWarpSelecting() && !this.m_bMoveDrawMode && GameMain.Instance.OvrMgr.OvrCamera.IsUIShow)
- {
- if (this.m_eMode != ViveControllerBehavior2.OvrControllerMode.PEN)
- {
- this.m_eModeBack = this.m_eMode;
- this.ChangeMode(ViveControllerBehavior2.OvrControllerMode.PEN);
- }
- }
- else if (this.m_eMode == ViveControllerBehavior2.OvrControllerMode.PEN)
- {
- this.ChangeMode(this.m_eModeBack);
- }
- this.TabletSizeChange();
- if (this.m_eMode == ViveControllerBehavior2.OvrControllerMode.PEN)
- {
- RaycastHit raycastHit;
- if (Physics.Raycast(this.m_controller.UIRayTrans.position, this.m_controller.UIRayTrans.rotation * Vector3.forward, out raycastHit, float.PositiveInfinity, 33554432))
- {
- if (this.m_bCursorMoveEnable)
- {
- Vector2 textureCoord = raycastHit.textureCoord;
- Vector2 a = new Vector2(1280f * (textureCoord.x / 1f), 720f * (textureCoord.y / 1f));
- Vector2 vector = GameMain.Instance.OvrMgr.SystemUICamera.GetOvrVirtualMousePos(this.m_bHandL);
- Vector2 a2 = a - vector;
- Vector2 b = a2 * this.m_fCursorLaserEasing;
- Vector2 v = vector + b;
- GameMain.Instance.OvrMgr.SystemUICamera.SetOvrVirtualMousePos(this.m_bHandL, v);
- }
- this.TouchPadToClick();
- this.TouchPadWheel();
- }
- }
- else if (this.m_eMode == ViveControllerBehavior2.OvrControllerMode.HAND)
- {
- if (GameMain.Instance.CMSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.WARP_DRAW_STEPROT)
- {
- if (GameMain.Instance.CMSystem.OvrUseSnapRotate)
- {
- bool pressDown = this.m_device.GetPressDown(4294967296UL);
- Vector2 axis = this.m_buttons.GetAxis();
- if (pressDown && axis.x < -(1f - (float)GameMain.Instance.CMSystem.OvrUseSnapRotateRate * 0.01f))
- {
- if (!this.m_bSnapRot)
- {
- this.m_fCamRotNow = -30f;
- this.m_bSnapRot = true;
- }
- }
- else if (pressDown && 1f - (float)GameMain.Instance.CMSystem.OvrUseSnapRotateRate * 0.01f < axis.x)
- {
- if (!this.m_bSnapRot)
- {
- this.m_fCamRotNow = 30f;
- this.m_bSnapRot = true;
- }
- }
- else if (!this.m_device.GetPress(4294967296UL))
- {
- this.m_bSnapRot = false;
- }
- }
- else
- {
- this.m_bSnapRot = false;
- }
- if (this.HandLimitMode == AVRControllerBehavior.LIMIT_MODE.HAND_ONLY)
- {
- this.m_ArcTeleport.WarpCancel();
- this.m_bMoveDrawMode = false;
- }
- else
- {
- bool flag = false;
- if (this.HandLimitMode == AVRControllerBehavior.LIMIT_MODE.NO_WARP)
- {
- this.m_ArcTeleport.WarpCancel();
- flag = true;
- }
- if (this.m_device.GetPress(4294967296UL))
- {
- if (!this.m_bMoveDrawMode && !this.m_bSnapRot && !flag)
- {
- this.m_ArcTeleport.WarpSelecting();
- }
- if (this.m_device.GetPressDown(8589934592UL))
- {
- this.m_ArcTeleport.WarpCancel();
- this.m_bMoveDrawMode = true;
- }
- }
- else
- {
- if (!this.m_bMoveDrawMode && !this.m_bSnapRot && !flag)
- {
- this.m_ArcTeleport.WarpDicide();
- }
- this.m_bMoveDrawMode = false;
- }
- }
- }
- else if (GameMain.Instance.CMSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.DIRECTION && this.HandLimitMode != AVRControllerBehavior.LIMIT_MODE.HAND_ONLY)
- {
- Vector2 vector2 = this.m_buttons.GetAxis() * GameMain.Instance.CMSystem.SConfig.OvrMoveDirSpeed;
- if (this.m_device.GetPressDown(4294967296UL))
- {
- Vector2 axis2 = this.m_buttons.GetAxis();
- if (GameMain.Instance.CMSystem.SConfig.OvrViveSmoothRotatePadAreaUse)
- {
- if (axis2.x < -(1f - GameMain.Instance.CMSystem.SConfig.OvrViveSmoothRotatePadAriaRate * 0.01f))
- {
- this.m_bSmoothRot = true;
- }
- else if (1f - GameMain.Instance.CMSystem.SConfig.OvrViveSmoothRotatePadAriaRate * 0.01f < axis2.x)
- {
- this.m_bSmoothRot = true;
- }
- else
- {
- this.m_bSmoothRot = false;
- }
- }
- else
- {
- this.m_bSmoothRot = false;
- }
- if (GameMain.Instance.CMSystem.SConfig.OvrViveSmoothupDownPadAreaUse)
- {
- if (axis2.y < -(1f - GameMain.Instance.CMSystem.SConfig.OvrViveSmoothUpDownPadAriaRate * 0.01f))
- {
- this.m_bSmoothUpDown = true;
- }
- else if (1f - GameMain.Instance.CMSystem.SConfig.OvrViveSmoothUpDownPadAriaRate * 0.01f < axis2.y)
- {
- this.m_bSmoothUpDown = true;
- }
- else
- {
- this.m_bSmoothUpDown = false;
- }
- }
- else
- {
- this.m_bSmoothUpDown = false;
- }
- }
- if (this.m_device.GetPress(4294967296UL))
- {
- if (this.m_device.GetTouch(8589934592UL) || this.m_bSmoothUpDown)
- {
- this.m_vMoveCam.y = vector2.y;
- }
- else if (this.m_bSmoothRot)
- {
- this.m_fRotCam = vector2.x;
- }
- else
- {
- this.m_vMoveCam.x = -vector2.x;
- this.m_vMoveCam.z = vector2.y;
- }
- }
- }
- }
- else if (this.m_eMode == ViveControllerBehavior2.OvrControllerMode.CAMERA && this.m_device.GetTouchDown(8589934592UL))
- {
- this.m_HandCamera.Snap();
- }
- if (this.m_eMode != ViveControllerBehavior2.OvrControllerMode.HAND)
- {
- this.m_bSnapRot = false;
- this.m_bSmoothRot = false;
- this.m_bSmoothUpDown = false;
- }
- if (this.m_device.GetPress(4UL))
- {
- this.m_fGripTime += Time.deltaTime;
- if (this.m_fGripTime >= 1f && !this.m_bGripDown)
- {
- GameMain.Instance.OvrMgr.OvrCamera.ShowUI(true);
- GameMain.Instance.OvrMgr.OvrCamera.UIPosReset(0f);
- this.m_bGripDown = true;
- }
- }
- else if (this.m_device.GetPressUp(4UL))
- {
- if (!this.m_bGripDown && this.m_eMode != ViveControllerBehavior2.OvrControllerMode.PEN)
- {
- GameMain.Instance.OvrMgr.OvrCamera.ToggleUI();
- }
- this.m_bGripDown = false;
- this.m_fGripTime = 0f;
- }
- }
- public override Vector3 GetVelocityHand()
- {
- Vector3 result = default(Vector3);
- if (this.m_device != null && this.m_eMode == ViveControllerBehavior2.OvrControllerMode.HAND && this.HandLimitMode != AVRControllerBehavior.LIMIT_MODE.HAND_ONLY && !GameMain.Instance.MainCamera.IsFadeOut())
- {
- if (!this.m_bPressTrigger && this.m_device.GetTouchDown(8589934592UL))
- {
- this.m_vMoveTugPosBack = base.transform.position;
- this.m_bPressTrigger = true;
- }
- else if (this.m_bPressTrigger && this.m_device.GetTouch(8589934592UL))
- {
- if (this.m_bMoveDrawMode)
- {
- if (this.m_goTestObj != null)
- {
- this.m_goTestObj.transform.position = base.transform.position;
- }
- Vector3 a = base.transform.position - this.m_vMoveTugPosBack;
- result = a * -1f;
- }
- }
- else
- {
- this.m_bPressTrigger = false;
- }
- }
- else
- {
- this.m_bPressTrigger = false;
- }
- return result;
- }
- public override float GetRotHandY()
- {
- return this.m_fCamRotNow;
- }
- protected override void LateUpdate()
- {
- }
- public ViveControllerBehavior2 m_Pair;
- private readonly string[] m_strMode = new string[]
- {
- "HAND",
- "CAMERA",
- "PEN",
- "DANCE",
- string.Empty,
- string.Empty,
- string.Empty,
- string.Empty,
- "COMMAND"
- };
- private bool[] m_bModeHide = new bool[]
- {
- false,
- false,
- true,
- false,
- false,
- true,
- true,
- true,
- true
- };
- private readonly string[] m_strPointerMode = new string[]
- {
- "-LASER"
- };
- private readonly string[] m_strMoveMode = new string[]
- {
- "-DIR",
- "-DRAW",
- "-ARC"
- };
- private ViveControllerBehavior2.OvrControllerMode[][] m_aryModeLimit = new ViveControllerBehavior2.OvrControllerMode[][]
- {
- new ViveControllerBehavior2.OvrControllerMode[]
- {
- ViveControllerBehavior2.OvrControllerMode.HAND,
- ViveControllerBehavior2.OvrControllerMode.CAMERA,
- ViveControllerBehavior2.OvrControllerMode.ITEM
- },
- new ViveControllerBehavior2.OvrControllerMode[]
- {
- ViveControllerBehavior2.OvrControllerMode.DANCE
- },
- new ViveControllerBehavior2.OvrControllerMode[]
- {
- ViveControllerBehavior2.OvrControllerMode.HAND,
- ViveControllerBehavior2.OvrControllerMode.CAMERA,
- ViveControllerBehavior2.OvrControllerMode.ITEM,
- ViveControllerBehavior2.OvrControllerMode.VRIK_FACE,
- ViveControllerBehavior2.OvrControllerMode.VRIK_HAND
- }
- };
- [NonSerialized]
- private ViveControllerBehavior2.OvrControllerMode m_eMode;
- private ViveControllerBehavior2.OvrControllerMode m_eModeBack;
- private ViveControllerBehavior2.HandSubMode m_eHandSubMode = ViveControllerBehavior2.HandSubMode.MAN_HAND;
- private bool m_bWheelFirst;
- private float m_fWheel;
- private bool m_bArcNow;
- private float m_fGripTime;
- private bool m_bGripDown;
- private bool m_bMoveDrawMode;
- private bool m_bTabletArea;
- private float m_fTabletScaleBef;
- private float m_fOtherDistanceOne;
- private bool m_bTabletScaleGrab;
- private bool m_bIsInit;
- private bool m_bPressTrigger;
- private bool m_bSnapRot;
- private float m_fCamRotNow;
- private bool m_bSmoothRot;
- private bool m_bSmoothUpDown;
- private enum OvrControllerMode
- {
- HAND,
- CAMERA,
- PEN,
- DANCE,
- ITEM,
- VRIK_FACE,
- VRIK_HAND,
- VRIK_OTHER,
- YOTOGI,
- MAX
- }
- private enum PointerSubMode
- {
- LASER,
- MAX
- }
- private enum MoveSubMode
- {
- DIRECTIONAL,
- DRAW,
- ARC,
- MAX
- }
- private enum TouchSubMode
- {
- MAN,
- WOMAN
- }
- private enum HandSubMode
- {
- CONTROLLER,
- MAN_HAND,
- MAX
- }
- }
|