OvrControllerBehavior2.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774
  1. using System;
  2. using System.Collections;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class OvrControllerBehavior2 : OvrControllerBehavior
  6. {
  7. public override AVRControllerBehavior.BEH_TYPE BehaviourType
  8. {
  9. get
  10. {
  11. return AVRControllerBehavior.BEH_TYPE.NEW;
  12. }
  13. }
  14. public override bool HandCameraMode
  15. {
  16. get
  17. {
  18. return this.m_eMode == OvrControllerBehavior2.OvrControllerMode.CAMERA;
  19. }
  20. set
  21. {
  22. if (value)
  23. {
  24. this.ChangeMode(OvrControllerBehavior2.OvrControllerMode.CAMERA);
  25. }
  26. }
  27. }
  28. public override bool IsHandCameraMode
  29. {
  30. get
  31. {
  32. return this.m_eModeBack == OvrControllerBehavior2.OvrControllerMode.CAMERA;
  33. }
  34. }
  35. public override bool IsHandPenMode
  36. {
  37. get
  38. {
  39. return this.m_eMode == OvrControllerBehavior2.OvrControllerMode.PEN;
  40. }
  41. }
  42. public override bool HandModelVisible
  43. {
  44. get
  45. {
  46. return this.m_bHandModelVisible;
  47. }
  48. set
  49. {
  50. this.m_bHandModelVisible = value;
  51. this.ChangeMode(this.m_eMode);
  52. }
  53. }
  54. public override AVRControllerBehavior.LIMIT_MODE HandLimitMode
  55. {
  56. set
  57. {
  58. if (value == AVRControllerBehavior.LIMIT_MODE.HAND_ONLY)
  59. {
  60. this.ChangeMode(OvrControllerBehavior2.OvrControllerMode.HAND);
  61. }
  62. base.HandLimitMode = value;
  63. }
  64. }
  65. public override bool HandDanceMode
  66. {
  67. get
  68. {
  69. return this.m_bHandDanceMode && this.m_eMode == OvrControllerBehavior2.OvrControllerMode.DANCE;
  70. }
  71. set
  72. {
  73. this.m_bHandDanceMode = value;
  74. if (value)
  75. {
  76. this.ChangeMode(OvrControllerBehavior2.OvrControllerMode.DANCE);
  77. }
  78. else if (!value)
  79. {
  80. if (this.m_eMode == OvrControllerBehavior2.OvrControllerMode.PEN)
  81. {
  82. this.m_eModeBack = OvrControllerBehavior2.OvrControllerMode.HAND;
  83. }
  84. else if (this.m_eMode == OvrControllerBehavior2.OvrControllerMode.DANCE)
  85. {
  86. this.m_eModeBack = OvrControllerBehavior2.OvrControllerMode.HAND;
  87. this.ChangeMode(OvrControllerBehavior2.OvrControllerMode.HAND);
  88. }
  89. }
  90. }
  91. }
  92. public override bool HandVRIKMode
  93. {
  94. get
  95. {
  96. return this.m_bHandVRIKMode;
  97. }
  98. set
  99. {
  100. this.m_bHandVRIKMode = value;
  101. if (value)
  102. {
  103. this.m_bModeHide[5] = false;
  104. this.m_bModeHide[6] = false;
  105. this.m_bModeHide[7] = false;
  106. this.ChangeMode(OvrControllerBehavior2.OvrControllerMode.VRIK_FACE);
  107. }
  108. else if (!value)
  109. {
  110. if (this.m_eMode == OvrControllerBehavior2.OvrControllerMode.PEN)
  111. {
  112. this.m_eModeBack = OvrControllerBehavior2.OvrControllerMode.HAND;
  113. }
  114. else if (this.m_eMode == OvrControllerBehavior2.OvrControllerMode.VRIK_FACE)
  115. {
  116. this.m_eModeBack = OvrControllerBehavior2.OvrControllerMode.HAND;
  117. this.ChangeMode(OvrControllerBehavior2.OvrControllerMode.HAND);
  118. }
  119. this.m_bModeHide[5] = true;
  120. this.m_bModeHide[6] = true;
  121. this.m_bModeHide[7] = true;
  122. }
  123. }
  124. }
  125. public override bool HandYotogiMode
  126. {
  127. get
  128. {
  129. return this.m_bHandYotogiMode && this.m_eMode == OvrControllerBehavior2.OvrControllerMode.YOTOGI;
  130. }
  131. set
  132. {
  133. this.m_bHandYotogiMode = value;
  134. if (value)
  135. {
  136. this.m_bModeHide[8] = false;
  137. this.ChangeMode(OvrControllerBehavior2.OvrControllerMode.YOTOGI);
  138. }
  139. else if (!value)
  140. {
  141. if (this.m_eMode == OvrControllerBehavior2.OvrControllerMode.PEN)
  142. {
  143. this.m_eModeBack = OvrControllerBehavior2.OvrControllerMode.HAND;
  144. }
  145. else if (this.m_eMode == OvrControllerBehavior2.OvrControllerMode.YOTOGI)
  146. {
  147. this.m_eModeBack = OvrControllerBehavior2.OvrControllerMode.HAND;
  148. this.ChangeMode(OvrControllerBehavior2.OvrControllerMode.HAND);
  149. }
  150. this.m_bModeHide[8] = true;
  151. }
  152. }
  153. }
  154. protected override void Awake()
  155. {
  156. base.Awake();
  157. NDebug.Assert(this.m_Pair != null, "Pairコントローラがありません。");
  158. GameMain.Instance.CMSystem.OvrPointerMode = Mathf.Max(Mathf.Min(0, GameMain.Instance.CMSystem.OvrPointerMode), 0);
  159. GameMain.Instance.CMSystem.OvrMoveMode = Mathf.Max(Mathf.Min(2, GameMain.Instance.CMSystem.OvrMoveMode), 0);
  160. this.m_txMode = base.transform.Find("UI/Canvas/Text").GetComponent<Text>();
  161. this.m_goModeCanvas = this.m_txMode.transform.parent.gameObject;
  162. this.m_goHandCamera = base.transform.Find("HandCamera").gameObject;
  163. this.m_HandCamera = this.m_goHandCamera.GetComponent<OvrHandCamera>();
  164. this.m_HandCamera.m_ctrl = this;
  165. this.m_goHandModel = base.transform.Find("HandPlayer").gameObject;
  166. this.m_HandAnim = this.m_goHandModel.GetComponent<OvrHandAnimator>();
  167. NDebug.Assert(this.m_HandAnim != null);
  168. this.m_HandAnim.Init(this.m_buttons);
  169. this.m_HandItem = base.transform.Find("HandItem").GetComponent<OvrHandItemMgr>();
  170. this.m_HandItem.m_ctrl = this;
  171. this.m_HandItem.SetButtons(this.m_buttons);
  172. this.m_HandItem.gameObject.SetActive(false);
  173. this.m_ArcTeleport = base.transform.Find("ArcTeleport").GetComponentInChildren<ArcTeleport>(true);
  174. this.m_ArcTeleport.SetCallBackOnMove(new ArcTeleport.dgOnMove(this.OnWarpMove));
  175. this.m_fCursorLaserEasing = GameMain.Instance.CMSystem.OvrViveCursorLaserEasing;
  176. this.m_trTabletPenRoot = base.transform.Find("UIRay");
  177. NDebug.Assert(this.m_trTabletPenRoot != null, "UIRayが見つかりません。");
  178. this.m_goTabletPen = base.transform.Find("UIRay/Odogu_Styluspen_red").gameObject;
  179. NDebug.Assert(this.m_goTabletPen != null, "UI用タブレットペンモデルが見つかりません。");
  180. OvrUIPen component = this.m_goTabletPen.GetComponent<OvrUIPen>();
  181. if (component != null)
  182. {
  183. component.m_ctrl = this;
  184. }
  185. this.m_bIsInit = true;
  186. }
  187. private void Start()
  188. {
  189. GameMain.Instance.OvrMgr.OvrCamera.m_bWheelToZoom = false;
  190. this.ChangeMode(this.m_eMode);
  191. }
  192. private void OnEnable()
  193. {
  194. this.m_trTabletPenRoot.gameObject.SetActive(true);
  195. this.ChangeMode(this.m_eMode);
  196. }
  197. private void OnDisable()
  198. {
  199. this.m_trTabletPenRoot.gameObject.SetActive(false);
  200. this.m_goTabletPen.SetActive(false);
  201. }
  202. private void ChangeMode(OvrControllerBehavior2.OvrControllerMode f_eNewMode)
  203. {
  204. if (this.m_bIsInit)
  205. {
  206. bool active = false;
  207. bool enabled = false;
  208. bool active2 = false;
  209. bool flag = false;
  210. bool enabled2 = true;
  211. bool active3 = false;
  212. bool isEnableHandUI = false;
  213. bool isEnableHandUI2 = false;
  214. bool isEnableHandUI3 = false;
  215. if (f_eNewMode == OvrControllerBehavior2.OvrControllerMode.HAND || f_eNewMode == OvrControllerBehavior2.OvrControllerMode.YOTOGI)
  216. {
  217. enabled = true;
  218. active = this.m_bHandModelVisible;
  219. }
  220. if (f_eNewMode == OvrControllerBehavior2.OvrControllerMode.CAMERA)
  221. {
  222. active2 = true;
  223. enabled2 = false;
  224. }
  225. if (f_eNewMode == OvrControllerBehavior2.OvrControllerMode.PEN)
  226. {
  227. enabled = true;
  228. flag = true;
  229. }
  230. if (f_eNewMode == OvrControllerBehavior2.OvrControllerMode.ITEM)
  231. {
  232. active3 = true;
  233. }
  234. if (f_eNewMode == OvrControllerBehavior2.OvrControllerMode.VRIK_FACE)
  235. {
  236. enabled = true;
  237. isEnableHandUI = true;
  238. }
  239. if (f_eNewMode == OvrControllerBehavior2.OvrControllerMode.VRIK_HAND)
  240. {
  241. enabled = true;
  242. isEnableHandUI2 = true;
  243. }
  244. if (f_eNewMode == OvrControllerBehavior2.OvrControllerMode.VRIK_OTHER)
  245. {
  246. enabled = true;
  247. isEnableHandUI3 = true;
  248. }
  249. PhotoFaceDataShortcutParent componentInChildren = base.gameObject.GetComponentInChildren<PhotoFaceDataShortcutParent>();
  250. if (componentInChildren != null)
  251. {
  252. componentInChildren.isEnableHandUI = isEnableHandUI;
  253. }
  254. HandSignShortcut componentInChildren2 = base.gameObject.GetComponentInChildren<HandSignShortcut>();
  255. if (componentInChildren2 != null)
  256. {
  257. componentInChildren2.isEnableHandUI = isEnableHandUI2;
  258. }
  259. OtherCommandShortcut componentInChildren3 = base.gameObject.GetComponentInChildren<OtherCommandShortcut>();
  260. if (componentInChildren3 != null)
  261. {
  262. componentInChildren3.isEnableHandUI = isEnableHandUI3;
  263. }
  264. this.m_goHandModel.SetActive(active);
  265. this.m_obj_controller.grip_collider.enabled = enabled;
  266. this.m_goHandCamera.SetActive(active2);
  267. this.m_goTabletPen.SetActive(flag);
  268. this.m_controller.UIRayEnable = flag;
  269. this.m_HandItem.gameObject.SetActive(active3);
  270. GameMain.Instance.OvrMgr.SystemUICamera.SetActiveVirtualCursorObjByNocurrent((!this.m_bHandL) ? UICamera.VCURSOR.RIGHT : UICamera.VCURSOR.LEFT, flag);
  271. this.m_txMode.enabled = enabled2;
  272. this.m_txMode.text = this.m_strMode[(int)f_eNewMode];
  273. }
  274. this.m_eMode = f_eNewMode;
  275. }
  276. private void ChangePointerMode(OvrControllerBehavior2.PointerSubMode f_ePMode)
  277. {
  278. this.ChangeMode(OvrControllerBehavior2.OvrControllerMode.HAND);
  279. }
  280. private void ChangeMoveMode(OvrControllerBehavior2.MoveSubMode f_eSubMode)
  281. {
  282. this.ChangeMode(OvrControllerBehavior2.OvrControllerMode.HAND);
  283. }
  284. private void TouchPadToClick()
  285. {
  286. if (this.m_buttons.GetPressDown(AVRControllerButtons.BTN.VIRTUAL_L_CLICK) || this.m_buttons.GetPressDown(AVRControllerButtons.BTN.VIRTUAL_R_CLICK))
  287. {
  288. this.m_bCursorMoveEnable = false;
  289. GameMain.Instance.OvrMgr.SystemUICamera.SetCurrentCursorSide((!this.m_bHandL) ? UICamera.VCURSOR.RIGHT : UICamera.VCURSOR.LEFT);
  290. if (this.m_buttons.GetPressDown(AVRControllerButtons.BTN.VIRTUAL_L_CLICK))
  291. {
  292. NUty.EmurateMouseButton(2);
  293. this.m_bPressLeft = true;
  294. }
  295. else if (this.m_buttons.GetPressDown(AVRControllerButtons.BTN.VIRTUAL_R_CLICK))
  296. {
  297. NUty.EmurateMouseButton(8);
  298. this.m_bPressLeft = false;
  299. }
  300. if (this.m_coCursorMoveWait != null)
  301. {
  302. base.StopCoroutine(this.m_coCursorMoveWait);
  303. }
  304. this.m_coCursorMoveWait = base.StartCoroutine(this.CoCursorMoveWait());
  305. }
  306. else if (this.m_buttons.GetPressUp(AVRControllerButtons.BTN.VIRTUAL_L_CLICK) || this.m_buttons.GetPressUp(AVRControllerButtons.BTN.VIRTUAL_R_CLICK))
  307. {
  308. if (this.m_bPressLeft)
  309. {
  310. NUty.EmurateMouseButton(4);
  311. }
  312. else
  313. {
  314. GameMain.Instance.OvrMgr.OvrCamera.m_bRightClickUIToggle = false;
  315. NUty.EmurateMouseButton(16);
  316. }
  317. }
  318. }
  319. private IEnumerator CoCursorMoveWait()
  320. {
  321. yield return new WaitForSeconds(0.3f);
  322. this.m_bCursorMoveEnable = true;
  323. yield break;
  324. }
  325. private void TouchPadWheel()
  326. {
  327. float y = this.m_buttons.GetAxis().y;
  328. if (0.1f < Mathf.Abs(y))
  329. {
  330. if (this.m_bWheelFirst)
  331. {
  332. NUty.EmurateMouseWheel((y >= 0f) ? 1 : -1);
  333. this.m_fWheel = 0f;
  334. this.m_bWheelFirst = false;
  335. }
  336. else
  337. {
  338. this.m_fWheel += y * (Time.deltaTime * 5f);
  339. if (this.m_fWheel <= -1f || 1f <= this.m_fWheel)
  340. {
  341. NUty.EmurateMouseWheel((int)this.m_fWheel);
  342. this.m_fWheel = 0f;
  343. }
  344. }
  345. }
  346. else
  347. {
  348. this.m_bWheelFirst = true;
  349. }
  350. }
  351. private void OnWarpMove(Vector3 f_vPosWorld, Vector3 f_vRotWorld)
  352. {
  353. GameMain.Instance.MainCamera.SetFootPos(f_vPosWorld, CameraMain.STAND_SIT.STAND);
  354. GameMain.Instance.MainCamera.SetRealHeadRot(f_vRotWorld, true);
  355. }
  356. public bool IsGrabTablet()
  357. {
  358. return this.m_eMode == OvrControllerBehavior2.OvrControllerMode.PEN && this.m_buttons.GetPress(AVRControllerButtons.BTN.VIRTUAL_GRUB);
  359. }
  360. private void TabletSizeChange()
  361. {
  362. if (this.m_eMode == OvrControllerBehavior2.OvrControllerMode.PEN)
  363. {
  364. if (this.m_Pair.IsGrabTablet())
  365. {
  366. if (this.m_buttons.GetPressDown(AVRControllerButtons.BTN.VIRTUAL_GRUB))
  367. {
  368. this.m_fOtherDistanceOne = Vector3.Distance(this.m_Pair.transform.position, base.transform.position);
  369. this.m_fTabletScaleBef = GameMain.Instance.OvrMgr.OvrCamera.OvrTablet.Size;
  370. this.m_bTabletScaleGrab = true;
  371. }
  372. else if (this.m_buttons.GetPress(AVRControllerButtons.BTN.VIRTUAL_GRUB))
  373. {
  374. if (this.m_bTabletScaleGrab)
  375. {
  376. float num = Vector3.Distance(this.m_Pair.transform.position, base.transform.position) / this.m_fOtherDistanceOne;
  377. GameMain.Instance.OvrMgr.OvrCamera.OvrTablet.Size = this.m_fTabletScaleBef * num;
  378. }
  379. }
  380. else
  381. {
  382. this.m_bTabletScaleGrab = false;
  383. }
  384. }
  385. else
  386. {
  387. this.m_bTabletScaleGrab = false;
  388. }
  389. }
  390. else
  391. {
  392. this.m_bTabletScaleGrab = false;
  393. }
  394. }
  395. protected override void Update()
  396. {
  397. GameMain.Instance.OvrMgr.OvrCamera.m_bRightClickUIToggle = true;
  398. if (OvrIK.IsModeVRIK)
  399. {
  400. if (this.m_goModeCanvas.layer != 17)
  401. {
  402. this.m_goModeCanvas.layer = 17;
  403. }
  404. }
  405. else if (this.m_goModeCanvas.layer != 0)
  406. {
  407. this.m_goModeCanvas.layer = 0;
  408. }
  409. this.m_vMoveCam.x = (this.m_vMoveCam.y = (this.m_vMoveCam.z = (this.m_fRotCam = 0f)));
  410. this.m_vMoveVelocity.x = (this.m_vMoveVelocity.y = (this.m_vMoveVelocity.z = 0f));
  411. this.m_fCamRotNow = 0f;
  412. if (!this.m_controller.HandEnable)
  413. {
  414. return;
  415. }
  416. if (this.m_buttons.GetPressDown(AVRControllerButtons.BTN.VIRTUAL_MENU))
  417. {
  418. this.m_bPressMenuBtnLong = false;
  419. this.m_fMenuPressBeforeTime = Time.realtimeSinceStartup;
  420. }
  421. else if (this.m_buttons.GetPress(AVRControllerButtons.BTN.VIRTUAL_MENU))
  422. {
  423. if (!this.m_bPressMenuBtnLong && Time.realtimeSinceStartup - this.m_fMenuPressBeforeTime > 1f)
  424. {
  425. if (this.m_eMode != OvrControllerBehavior2.OvrControllerMode.HAND)
  426. {
  427. if (this.m_eMode == OvrControllerBehavior2.OvrControllerMode.CAMERA)
  428. {
  429. }
  430. }
  431. this.m_bPressMenuBtnLong = true;
  432. }
  433. }
  434. else if (this.m_buttons.GetPressUp(AVRControllerButtons.BTN.VIRTUAL_MENU))
  435. {
  436. if (!this.m_bPressMenuBtnLong && this.HandLimitMode != AVRControllerBehavior.LIMIT_MODE.HAND_ONLY)
  437. {
  438. int num = (int)this.m_eMode;
  439. do
  440. {
  441. num++;
  442. if (9 <= num)
  443. {
  444. num = 0;
  445. }
  446. }
  447. while (this.m_bModeHide[num] || (num == 3 && !this.m_bHandDanceMode));
  448. this.ChangeMode((OvrControllerBehavior2.OvrControllerMode)num);
  449. this.m_eModeBack = this.m_eMode;
  450. }
  451. }
  452. else if (this.m_buttons.GetPress(AVRControllerButtons.BTN.MENU) && this.m_buttons.GetPressUp(AVRControllerButtons.BTN.GRIP))
  453. {
  454. GameMain.Instance.OvrMgr.OvrCamera.ReCallcOffset();
  455. GameMain.Instance.OvrMgr.OvrCamera.ShowUI(true);
  456. GameMain.Instance.OvrMgr.OvrCamera.UIPosReset(0f);
  457. }
  458. this.m_bTabletArea = GameMain.Instance.OvrMgr.OvrCamera.OvrTablet.IsHitPointerArea(base.transform.position);
  459. if (this.m_bTabletArea && !this.m_ArcTeleport.IsWarpSelecting() && !this.m_bMoveDrawMode && GameMain.Instance.OvrMgr.OvrCamera.IsUIShow)
  460. {
  461. if (this.m_eMode != OvrControllerBehavior2.OvrControllerMode.PEN)
  462. {
  463. this.m_eModeBack = this.m_eMode;
  464. this.ChangeMode(OvrControllerBehavior2.OvrControllerMode.PEN);
  465. }
  466. }
  467. else if (this.m_eMode == OvrControllerBehavior2.OvrControllerMode.PEN)
  468. {
  469. this.ChangeMode(this.m_eModeBack);
  470. }
  471. this.TabletSizeChange();
  472. if (this.m_eMode == OvrControllerBehavior2.OvrControllerMode.PEN)
  473. {
  474. RaycastHit raycastHit;
  475. if (Physics.Raycast(this.m_controller.UIRayTrans.position, this.m_controller.UIRayTrans.rotation * Vector3.forward, out raycastHit, float.PositiveInfinity, 33554432))
  476. {
  477. if (this.m_bCursorMoveEnable)
  478. {
  479. Vector2 textureCoord = raycastHit.textureCoord;
  480. Vector2 a = new Vector2(1280f * (textureCoord.x / 1f), 720f * (textureCoord.y / 1f));
  481. Vector2 vector = GameMain.Instance.OvrMgr.SystemUICamera.GetOvrVirtualMousePos(this.m_bHandL);
  482. Vector2 a2 = a - vector;
  483. Vector2 b = a2 * this.m_fCursorLaserEasing;
  484. Vector2 v = vector + b;
  485. GameMain.Instance.OvrMgr.SystemUICamera.SetOvrVirtualMousePos(this.m_bHandL, v);
  486. }
  487. this.TouchPadToClick();
  488. this.TouchPadWheel();
  489. }
  490. Debug.DrawLine(this.m_controller.UIRayTrans.position, this.m_controller.UIRayTrans.position + base.transform.rotation * (Vector3.forward * 10f), new Color(1f, 0f, 0f));
  491. }
  492. else if (this.m_eMode == OvrControllerBehavior2.OvrControllerMode.HAND)
  493. {
  494. if (GameMain.Instance.CMSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.WARP_DRAW_STEPROT)
  495. {
  496. if (this.HandLimitMode == AVRControllerBehavior.LIMIT_MODE.HAND_ONLY)
  497. {
  498. this.m_ArcTeleport.WarpCancel();
  499. this.m_bMoveDrawMode = false;
  500. }
  501. else
  502. {
  503. bool flag = false;
  504. if (this.HandLimitMode == AVRControllerBehavior.LIMIT_MODE.NO_WARP)
  505. {
  506. this.m_ArcTeleport.WarpCancel();
  507. flag = true;
  508. }
  509. if (this.m_buttons.GetPress(AVRControllerButtons.BTN.VIRTUAL_L_CLICK))
  510. {
  511. if (!this.m_bMoveDrawMode && !flag)
  512. {
  513. this.m_ArcTeleport.WarpSelecting();
  514. }
  515. if (this.m_buttons.GetPressDown(AVRControllerButtons.BTN.TRIGGER))
  516. {
  517. this.m_ArcTeleport.WarpCancel();
  518. this.m_bMoveDrawMode = true;
  519. }
  520. }
  521. else
  522. {
  523. if (!this.m_bMoveDrawMode && !flag)
  524. {
  525. this.m_ArcTeleport.WarpDicide();
  526. }
  527. this.m_bMoveDrawMode = false;
  528. }
  529. }
  530. if (GameMain.Instance.CMSystem.OvrUseSnapRotate)
  531. {
  532. Vector2 axis = this.m_buttons.GetAxis();
  533. if (axis.x < -(1f - (float)GameMain.Instance.CMSystem.OvrUseSnapRotateRate * 0.01f))
  534. {
  535. if (!this.m_bSnapRot)
  536. {
  537. this.m_fCamRotNow = -30f;
  538. this.m_bSnapRot = true;
  539. }
  540. }
  541. else if (1f - (float)GameMain.Instance.CMSystem.OvrUseSnapRotateRate * 0.01f < axis.x)
  542. {
  543. if (!this.m_bSnapRot)
  544. {
  545. this.m_fCamRotNow = 30f;
  546. this.m_bSnapRot = true;
  547. }
  548. }
  549. else
  550. {
  551. this.m_bSnapRot = false;
  552. }
  553. }
  554. else
  555. {
  556. this.m_bSnapRot = false;
  557. }
  558. }
  559. else if (GameMain.Instance.CMSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.DIRECTION && this.HandLimitMode != AVRControllerBehavior.LIMIT_MODE.HAND_ONLY)
  560. {
  561. Vector2 vector2 = this.m_buttons.GetAxis() * GameMain.Instance.CMSystem.SConfig.OvrMoveDirSpeed;
  562. if (this.m_buttons.GetPress(AVRControllerButtons.BTN.TRIGGER) && GameMain.Instance.CMSystem.SConfig.OvrRiftTriggerStickUpDown)
  563. {
  564. this.m_vMoveCam.y = vector2.y;
  565. }
  566. else if (this.m_buttons.GetPress(AVRControllerButtons.BTN.GRIP) && GameMain.Instance.CMSystem.SConfig.OvrRiftGripStickRotate)
  567. {
  568. this.m_fRotCam = vector2.x;
  569. }
  570. else
  571. {
  572. this.m_vMoveCam.x = -vector2.x;
  573. this.m_vMoveCam.z = vector2.y;
  574. }
  575. }
  576. }
  577. else if (this.m_eMode == OvrControllerBehavior2.OvrControllerMode.CAMERA && this.m_buttons.GetPressDown(AVRControllerButtons.BTN.TRIGGER))
  578. {
  579. this.m_HandCamera.Snap();
  580. }
  581. if (this.m_eMode != OvrControllerBehavior2.OvrControllerMode.HAND)
  582. {
  583. this.m_bSnapRot = false;
  584. }
  585. if (this.m_buttons.GetPress(AVRControllerButtons.BTN.STICK_PAD))
  586. {
  587. this.m_fGripTime += Time.deltaTime;
  588. if (this.m_fGripTime >= 1f && !this.m_bGripDown)
  589. {
  590. GameMain.Instance.OvrMgr.OvrCamera.ShowUI(true);
  591. GameMain.Instance.OvrMgr.OvrCamera.UIPosReset(0f);
  592. this.m_bGripDown = true;
  593. }
  594. }
  595. else if (this.m_buttons.GetPressUp(AVRControllerButtons.BTN.STICK_PAD))
  596. {
  597. if (!this.m_bGripDown && this.m_eMode != OvrControllerBehavior2.OvrControllerMode.PEN)
  598. {
  599. GameMain.Instance.OvrMgr.OvrCamera.ToggleUI();
  600. }
  601. this.m_bGripDown = false;
  602. this.m_fGripTime = 0f;
  603. }
  604. }
  605. public override Vector3 GetVelocityHand()
  606. {
  607. Vector3 result = default(Vector3);
  608. if (this.m_eMode == OvrControllerBehavior2.OvrControllerMode.HAND && this.HandLimitMode != AVRControllerBehavior.LIMIT_MODE.HAND_ONLY && !GameMain.Instance.MainCamera.IsFadeOut())
  609. {
  610. if (!this.m_bPressTrigger && this.m_buttons.GetPressDown(AVRControllerButtons.BTN.TRIGGER))
  611. {
  612. this.m_vMoveTugPosBack = base.transform.position;
  613. this.m_bPressTrigger = true;
  614. }
  615. else if (this.m_bPressTrigger && this.m_buttons.GetPress(AVRControllerButtons.BTN.TRIGGER))
  616. {
  617. if (this.m_bMoveDrawMode)
  618. {
  619. if (this.m_goTestObj != null)
  620. {
  621. this.m_goTestObj.transform.position = base.transform.position;
  622. }
  623. Vector3 a = base.transform.position - this.m_vMoveTugPosBack;
  624. result = a * -1f;
  625. }
  626. }
  627. else
  628. {
  629. this.m_bPressTrigger = false;
  630. }
  631. }
  632. else
  633. {
  634. this.m_bPressTrigger = false;
  635. }
  636. return result;
  637. }
  638. public override float GetRotHandY()
  639. {
  640. return this.m_fCamRotNow;
  641. }
  642. protected override void LateUpdate()
  643. {
  644. }
  645. public OvrControllerBehavior2 m_Pair;
  646. private readonly string[] m_strMode = new string[]
  647. {
  648. "HAND",
  649. "CAMERA",
  650. "PEN",
  651. "DANCE",
  652. string.Empty,
  653. string.Empty,
  654. string.Empty,
  655. string.Empty,
  656. "COMMAND"
  657. };
  658. private bool[] m_bModeHide = new bool[]
  659. {
  660. false,
  661. false,
  662. true,
  663. false,
  664. false,
  665. true,
  666. true,
  667. true,
  668. true
  669. };
  670. private readonly string[] m_strPointerMode = new string[]
  671. {
  672. "-LASER"
  673. };
  674. private readonly string[] m_strMoveMode = new string[]
  675. {
  676. "-DIR",
  677. "-DRAW",
  678. "-ARC"
  679. };
  680. [NonSerialized]
  681. private OvrControllerBehavior2.OvrControllerMode m_eMode;
  682. private OvrControllerBehavior2.OvrControllerMode m_eModeBack;
  683. private bool m_bArcNow;
  684. private float m_fGripTime;
  685. private bool m_bGripDown;
  686. private bool m_bMoveDrawMode;
  687. private bool m_bTabletArea;
  688. private float m_fTabletScaleBef;
  689. private float m_fOtherDistanceOne;
  690. private bool m_bTabletScaleGrab;
  691. private bool m_bIsInit;
  692. private bool m_bPressTrigger;
  693. private bool m_bSnapRot;
  694. private float m_fCamRotNow;
  695. private enum OvrControllerMode
  696. {
  697. HAND,
  698. CAMERA,
  699. PEN,
  700. DANCE,
  701. ITEM,
  702. VRIK_FACE,
  703. VRIK_HAND,
  704. VRIK_OTHER,
  705. YOTOGI,
  706. MAX
  707. }
  708. private enum PointerSubMode
  709. {
  710. LASER,
  711. MAX
  712. }
  713. private enum MoveSubMode
  714. {
  715. DIRECTIONAL,
  716. DRAW,
  717. ARC,
  718. MAX
  719. }
  720. private enum TouchSubMode
  721. {
  722. MAN,
  723. WOMAN
  724. }
  725. }