ConfigVRCtrl.cs 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144
  1. using System;
  2. using System.Collections.Generic;
  3. using Kasizuki;
  4. using UnityEngine;
  5. public class ConfigVRCtrl : NGUIWindow
  6. {
  7. public static ConfigVRCtrl instance
  8. {
  9. get
  10. {
  11. Transform transform = null;
  12. GameObject gameObject = GameObject.Find("SystemUI Root");
  13. if (gameObject)
  14. {
  15. transform = gameObject.transform;
  16. }
  17. else
  18. {
  19. NDebug.Assert("SystemUI Rootが見つかりません", false);
  20. }
  21. if (ConfigVRCtrl.m_Instance == null)
  22. {
  23. Transform transform2 = transform.Find("ConfigVR");
  24. if (transform2 != null)
  25. {
  26. ConfigVRCtrl.m_Instance = transform2.GetComponent<ConfigVRCtrl>();
  27. }
  28. }
  29. if (ConfigVRCtrl.m_Instance == null)
  30. {
  31. string path = "SystemUI/Config/Prefab/ConfigVR";
  32. GameObject gameObject2 = Resources.Load<GameObject>(path);
  33. if (gameObject2 == null)
  34. {
  35. NDebug.Assert("[ConfigVRCtrl] VRコンフィグUIのプレハブが存在しません", false);
  36. }
  37. ConfigVRCtrl.m_Instance = UnityEngine.Object.Instantiate<GameObject>(gameObject2).GetComponent<ConfigVRCtrl>();
  38. ConfigVRCtrl.m_Instance.transform.SetParent(transform, false);
  39. ConfigVRCtrl.m_Instance.transform.localPosition = new Vector3(0f, -11f, 0f);
  40. ConfigVRCtrl.m_Instance.transform.localRotation = Quaternion.identity;
  41. ConfigVRCtrl.m_Instance.transform.localScale = Vector3.one;
  42. }
  43. if (ConfigVRCtrl.m_Instance == null)
  44. {
  45. NDebug.Assert("[ConfigVRCtrl] VRコンフィグUIのインスタンス取得に失敗しました", false);
  46. }
  47. return ConfigVRCtrl.m_Instance;
  48. }
  49. }
  50. public static bool IsOpen()
  51. {
  52. return ConfigVRCtrl.instance != null && ConfigVRCtrl.instance.gameObject.activeSelf;
  53. }
  54. public static void Open(Action onClickOK = null)
  55. {
  56. if (ConfigVRCtrl.IsOpen())
  57. {
  58. Debug.Log("[ConfigVRCtrl] VRConfigは既に開かれています。");
  59. return;
  60. }
  61. ConfigVRCtrl component = ConfigVRCtrl.instance.GetComponent<ConfigVRCtrl>();
  62. NGUIWindow component2 = ConfigVRCtrl.instance.GetComponent<NGUIWindow>();
  63. component.onClickOK = onClickOK;
  64. component.LoadConfigData();
  65. component2.Open(0.25f, null);
  66. }
  67. public static void Close(bool isExecutionOK = true)
  68. {
  69. ConfigVRCtrl component = ConfigVRCtrl.instance.GetComponent<ConfigVRCtrl>();
  70. NGUIWindow component2 = ConfigVRCtrl.instance.GetComponent<NGUIWindow>();
  71. component2.Close(0.25f, delegate
  72. {
  73. UnityEngine.Object.Destroy(ConfigVRCtrl.instance.gameObject);
  74. });
  75. if (isExecutionOK && component.onClickOK != null)
  76. {
  77. component.onClickOK();
  78. }
  79. }
  80. private Dictionary<ConfigVRCtrl.TypeItem, ConfigVRCtrl.ParentItem> dicItem
  81. {
  82. get
  83. {
  84. return this.m_DicItem;
  85. }
  86. set
  87. {
  88. this.m_DicItem = value;
  89. }
  90. }
  91. private CMSystem cmSystem
  92. {
  93. get
  94. {
  95. return GameMain.Instance.CMSystem;
  96. }
  97. }
  98. private void Log(object message)
  99. {
  100. Debug.Log(message);
  101. }
  102. public Action onClickOK { get; set; }
  103. public Action onClickChangeConfig { get; set; }
  104. protected override void Awake()
  105. {
  106. base.Awake();
  107. this.SetupAllUI();
  108. this.LoadConfigData();
  109. this.ItemSwitchingOfDevice();
  110. }
  111. private void SetupAllUI()
  112. {
  113. base.cachedObjectDic.CacheChildObject<UIButton>(base.gameObject, "OK", "ButtonOK");
  114. EventDelegate.Add(base.cachedObjectDic.GetCache<UIButton>("ButtonOK").onClick, delegate()
  115. {
  116. ConfigVRCtrl.Close(true);
  117. });
  118. base.cachedObjectDic.CacheChildObject<UIButton>(base.gameObject, "Change Normal", "ButtonChange");
  119. EventDelegate.Add(base.cachedObjectDic.GetCache<UIButton>("ButtonChange").onClick, delegate()
  120. {
  121. ConfigVRCtrl.Close(true);
  122. BaseMgr<ConfigMgr>.Instance.OpenConfigPanel();
  123. });
  124. base.cachedObjectDic.CacheChildObject<UISprite>(base.gameObject, "BG", "Background");
  125. base.cachedObjectDic.CacheChildObject<UILabel>(base.gameObject, "label notes", "注意書き");
  126. base.cachedObjectDic.GetCache<UILabel>("注意書き").gameObject.SetActive(!GameMain.Instance.VRMode);
  127. UIGrid uigrid = base.cachedObjectDic.CacheChildObject<UIGrid>(base.gameObject, "DataList/ScrollView/Grid", "Parent Grid");
  128. this.dicItem = new Dictionary<ConfigVRCtrl.TypeItem, ConfigVRCtrl.ParentItem>();
  129. this.SetupCommonUI(uigrid.gameObject);
  130. this.SetupViveUI(uigrid.gameObject);
  131. this.SetupOculusTouchUI(uigrid.gameObject);
  132. this.SetupHMDOnlyUI(uigrid.gameObject);
  133. this.Setup2DModeUI(uigrid.gameObject);
  134. }
  135. private void SetupCommonUI(GameObject parentItem)
  136. {
  137. this.dicItem.Add(ConfigVRCtrl.TypeItem.CommonEyeHeight, this.SetupSlider(parentItem, "common eye height", ConfigVRCtrl.COMMON_EYE_HEIGHT_VALUE.x, ConfigVRCtrl.COMMON_EYE_HEIGHT_VALUE.y, delegate(float value)
  138. {
  139. this.cmSystem.VRCameraHeightStand = value;
  140. this.Log("身長 : " + this.cmSystem.VRCameraHeightStand);
  141. }));
  142. this.dicItem.Add(ConfigVRCtrl.TypeItem.CommonSitHeight, this.SetupSlider(parentItem, "common sitting height", ConfigVRCtrl.COMMON_SITTING_HEIGHT_VALUE.x, ConfigVRCtrl.COMMON_SITTING_HEIGHT_VALUE.y, delegate(float value)
  143. {
  144. this.cmSystem.VRCameraHeightSit = value;
  145. this.Log("座高 : " + this.cmSystem.VRCameraHeightSit);
  146. }));
  147. this.dicItem.Add(ConfigVRCtrl.TypeItem.CommonCameraMoveSpeed, this.SetupSlider(parentItem, "common camera move speed", ConfigVRCtrl.COMMON_CAMERA_MOVE_VALUE.x, ConfigVRCtrl.COMMON_CAMERA_MOVE_VALUE.y, delegate(float value)
  148. {
  149. this.cmSystem.VRCameraMoveSpeedKey = value;
  150. this.Log("カメラ移動速度(キーボード) : " + this.cmSystem.VRCameraMoveSpeedKey);
  151. }));
  152. this.dicItem.Add(ConfigVRCtrl.TypeItem.CommonCameraRotSpeed, this.SetupSlider(parentItem, "common camera rot speed", ConfigVRCtrl.COMMON_CAMERA_ROT_VALUE.x, ConfigVRCtrl.COMMON_CAMERA_ROT_VALUE.y, delegate(float value)
  153. {
  154. this.cmSystem.VRCameraRotSpeedKey = value;
  155. this.Log("カメラ回転速度(キーボード) : " + this.cmSystem.VRCameraRotSpeedKey);
  156. }));
  157. this.dicItem.Add(ConfigVRCtrl.TypeItem.CommonShowDesktopScreen, this.SetupButton(parentItem, "common show desktop screen", delegate(bool isLeft)
  158. {
  159. if (isLeft && !GameMain.Instance.BgMgr.isShowDesktopScreen)
  160. {
  161. GameMain.Instance.BgMgr.SetShowDesktopScreen(true);
  162. }
  163. else if (!isLeft && GameMain.Instance.BgMgr.isShowDesktopScreen)
  164. {
  165. GameMain.Instance.BgMgr.SetShowDesktopScreen(false);
  166. }
  167. this.Log("デスクトップスクリーンの表示 + " + GameMain.Instance.BgMgr.isShowDesktopScreen);
  168. }));
  169. }
  170. private void SetupViveUI(GameObject parentItem)
  171. {
  172. this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveFloorHeightType, this.SetupButton(parentItem, "vive floor height", delegate(bool isLeft)
  173. {
  174. this.cmSystem.OvrCameraHeightType = ((!isLeft) ? CMSystem.OVR_CAM_HEIGHT_TYPE.VR : CMSystem.OVR_CAM_HEIGHT_TYPE.REAL);
  175. this.Log("Vive\u3000床の高さ検出法 : " + this.cmSystem.OvrCameraHeightType.ToString());
  176. }));
  177. this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveMoveMode, this.SetupButton(parentItem, "vive move mode", delegate(bool isLeft)
  178. {
  179. this.cmSystem.SConfig.OvrMoveType = ((!isLeft) ? CMSystem.SerializeConfig.OVR_MOVE_TYPE.DIRECTION : CMSystem.SerializeConfig.OVR_MOVE_TYPE.WARP_DRAW_STEPROT);
  180. this.Log("Vive\u3000移動方法 : " + this.cmSystem.SConfig.OvrMoveType);
  181. if (isLeft)
  182. {
  183. this.SetItemShowFlag(ConfigVRCtrl.TypeItem.ViveSnapRotateEnable, true);
  184. this.SetItemShowFlag(ConfigVRCtrl.TypeItem.ViveSnapRotateRate, true);
  185. this.SetItemShowFlag(ConfigVRCtrl.TypeItem.ViveOldRotatePad, false);
  186. this.SetItemShowFlag(ConfigVRCtrl.TypeItem.ViveOldMovePad, false);
  187. this.SetItemShowFlag(ConfigVRCtrl.TypeItem.ViveOldMoveRotatePadAriaRate, false);
  188. }
  189. else
  190. {
  191. this.SetItemShowFlag(ConfigVRCtrl.TypeItem.ViveSnapRotateEnable, false);
  192. this.SetItemShowFlag(ConfigVRCtrl.TypeItem.ViveSnapRotateRate, false);
  193. this.SetItemShowFlag(ConfigVRCtrl.TypeItem.ViveOldRotatePad, true);
  194. this.SetItemShowFlag(ConfigVRCtrl.TypeItem.ViveOldMovePad, true);
  195. this.SetItemShowFlag(ConfigVRCtrl.TypeItem.ViveOldMoveRotatePadAriaRate, true);
  196. }
  197. }));
  198. this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveSnapRotateEnable, this.SetupButton(parentItem, "vive use snap rotate", delegate(bool isLeft)
  199. {
  200. this.cmSystem.OvrUseSnapRotate = isLeft;
  201. this.Log("Vive\u3000パッド端で回転 : " + this.cmSystem.OvrUseSnapRotate);
  202. }));
  203. this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveSnapRotateRate, this.SetupSlider(parentItem, "vive use snap rotate rate", ConfigVRCtrl.VR_CAMERA_SNAP_ROT_VALUE.x, ConfigVRCtrl.VR_CAMERA_SNAP_ROT_VALUE.y, delegate(float value)
  204. {
  205. this.cmSystem.OvrUseSnapRotateRate = (int)value;
  206. this.Log("Vive\u3000パッド端の回転量 : " + this.cmSystem.OvrUseSnapRotateRate);
  207. }));
  208. this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveOldRotatePad, this.SetupButton(parentItem, "vive old rotate pad", delegate(bool isLeft)
  209. {
  210. this.cmSystem.SConfig.OvrViveSmoothRotatePadAreaUse = isLeft;
  211. this.Log("Vive\u3000(スムーズ移動)パッド左右端で回転 : " + this.cmSystem.SConfig.OvrViveSmoothRotatePadAreaUse);
  212. }));
  213. this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveOldMovePad, this.SetupButton(parentItem, "vive old move pad", delegate(bool isLeft)
  214. {
  215. this.cmSystem.SConfig.OvrViveSmoothupDownPadAreaUse = isLeft;
  216. this.Log("Vive\u3000(スムーズ移動)パッド上下端で上下 : " + this.cmSystem.SConfig.OvrViveSmoothupDownPadAreaUse);
  217. }));
  218. this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveOldMoveRotatePadAriaRate, this.SetupSlider(parentItem, "vive old rotate pad aria rate", 10f, 80f, delegate(float value)
  219. {
  220. this.cmSystem.SConfig.OvrViveSmoothRotatePadAriaRate = value;
  221. this.Log("Vive\u3000(スムーズ移動)端の領域 : " + this.cmSystem.SConfig.OvrViveSmoothRotatePadAriaRate);
  222. }));
  223. this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveDDTouchToClick, this.SetupButton(parentItem, "vive dd touch to click", delegate(bool isLeft)
  224. {
  225. this.cmSystem.SConfig.OvrDDTouchToClick = isLeft;
  226. this.Log("Vive\u3000デスクトップスクリーンに触れるとクリック : " + this.cmSystem.SConfig.OvrDDTouchToClick);
  227. }));
  228. this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveOvrTabletFrameHideWhenMsgWndVisible, this.SetupButton(parentItem, "vive OvrTabletFrameHideWhenMsgWndVisible", delegate(bool isLeft)
  229. {
  230. this.cmSystem.SConfig.OvrTabletFrameHideWhenMsgWndVisible = isLeft;
  231. this.Log("Vive\u3000メッセージ中タブレット枠を非表示 : " + this.cmSystem.SConfig.OvrTabletFrameHideWhenMsgWndVisible);
  232. }));
  233. this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveHandCollisionToHair, this.SetupButton(parentItem, "vive hand collision to hair", delegate(bool isLeft)
  234. {
  235. this.cmSystem.SConfig.OvrHandHitToHair = isLeft;
  236. this.Log("Vive\u3000手の髪への当たり判定 : " + this.cmSystem.SConfig.OvrHandHitToHair);
  237. }));
  238. this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveHandCollisionToSkirt, this.SetupMultiButton(parentItem, "vive hand collision to skirt", delegate(int index)
  239. {
  240. CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT ovrHandHitToSkirt;
  241. if (index == 0)
  242. {
  243. ovrHandHitToSkirt = CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT.OFF;
  244. }
  245. else if (index == 1)
  246. {
  247. ovrHandHitToSkirt = CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT.ON;
  248. }
  249. else
  250. {
  251. ovrHandHitToSkirt = CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT.GRAB;
  252. }
  253. this.cmSystem.SConfig.OvrHandHitToSkirt = ovrHandHitToSkirt;
  254. this.Log("Vive\u3000手のスカートへの当たり判定 : " + this.cmSystem.SConfig.OvrHandHitToSkirt);
  255. }));
  256. }
  257. private void SetupOculusTouchUI(GameObject parentItem)
  258. {
  259. this.dicItem.Add(ConfigVRCtrl.TypeItem.TouchMoveMode, this.SetupButton(parentItem, "touch move mode", delegate(bool isLeft)
  260. {
  261. this.cmSystem.SConfig.OvrMoveType = ((!isLeft) ? CMSystem.SerializeConfig.OVR_MOVE_TYPE.DIRECTION : CMSystem.SerializeConfig.OVR_MOVE_TYPE.WARP_DRAW_STEPROT);
  262. this.Log("Touch\u3000移動方法 : " + this.cmSystem.SConfig.OvrMoveType);
  263. if (isLeft)
  264. {
  265. this.SetItemShowFlag(ConfigVRCtrl.TypeItem.TouchSnapRotateEnable, true);
  266. this.SetItemShowFlag(ConfigVRCtrl.TypeItem.TouchSnapRotateRate, true);
  267. this.SetItemShowFlag(ConfigVRCtrl.TypeItem.TouchOldMoveStick, false);
  268. this.SetItemShowFlag(ConfigVRCtrl.TypeItem.TouchOldRotateStick, false);
  269. }
  270. else
  271. {
  272. this.SetItemShowFlag(ConfigVRCtrl.TypeItem.TouchSnapRotateEnable, false);
  273. this.SetItemShowFlag(ConfigVRCtrl.TypeItem.TouchSnapRotateRate, false);
  274. this.SetItemShowFlag(ConfigVRCtrl.TypeItem.TouchOldMoveStick, true);
  275. this.SetItemShowFlag(ConfigVRCtrl.TypeItem.TouchOldRotateStick, true);
  276. }
  277. }));
  278. this.dicItem.Add(ConfigVRCtrl.TypeItem.TouchSnapRotateEnable, this.SetupButton(parentItem, "touch use snap rotate", delegate(bool isLeft)
  279. {
  280. this.cmSystem.OvrUseSnapRotate = isLeft;
  281. this.Log("Touch\u3000スティック傾けで回転 : " + this.cmSystem.OvrUseSnapRotate);
  282. }));
  283. this.dicItem.Add(ConfigVRCtrl.TypeItem.TouchSnapRotateRate, this.SetupSlider(parentItem, "touch use snap rotate rate", ConfigVRCtrl.VR_CAMERA_SNAP_ROT_VALUE.x, ConfigVRCtrl.VR_CAMERA_SNAP_ROT_VALUE.y, delegate(float value)
  284. {
  285. this.cmSystem.OvrUseSnapRotateRate = (int)value;
  286. this.Log("Touch\u3000スティック傾けの回転量 : " + this.cmSystem.OvrUseSnapRotateRate);
  287. }));
  288. this.dicItem.Add(ConfigVRCtrl.TypeItem.TouchOldMoveStick, this.SetupButton(parentItem, "touch old move stick", delegate(bool isLeft)
  289. {
  290. this.cmSystem.SConfig.OvrRiftTriggerStickUpDown = isLeft;
  291. this.Log("Touch\u3000(スムーズ移動)グリップとスティックで回転 : " + this.cmSystem.SConfig.OvrRiftTriggerStickUpDown);
  292. }));
  293. this.dicItem.Add(ConfigVRCtrl.TypeItem.TouchOldRotateStick, this.SetupButton(parentItem, "touch old rotate stick", delegate(bool isLeft)
  294. {
  295. this.cmSystem.SConfig.OvrRiftGripStickRotate = isLeft;
  296. this.Log("Touch\u3000(スムーズ移動)トリガーとスティックで上下 : " + this.cmSystem.SConfig.OvrRiftGripStickRotate);
  297. }));
  298. this.dicItem.Add(ConfigVRCtrl.TypeItem.TouchDDTouchToClick, this.SetupButton(parentItem, "touch dd touch to click", delegate(bool isLeft)
  299. {
  300. this.cmSystem.SConfig.OvrDDTouchToClick = isLeft;
  301. this.Log("Touch\u3000デスクトップスクリーンに触れるとクリック : " + this.cmSystem.SConfig.OvrDDTouchToClick);
  302. }));
  303. this.dicItem.Add(ConfigVRCtrl.TypeItem.TouchOvrTabletFrameHideWhenMsgWndVisible, this.SetupButton(parentItem, "touch OvrTabletFrameHideWhenMsgWndVisible", delegate(bool isLeft)
  304. {
  305. this.cmSystem.SConfig.OvrTabletFrameHideWhenMsgWndVisible = isLeft;
  306. this.Log("Touch\u3000メッセージ中タブレット枠を非表示 : " + this.cmSystem.SConfig.OvrTabletFrameHideWhenMsgWndVisible);
  307. }));
  308. this.dicItem.Add(ConfigVRCtrl.TypeItem.TouchHandCollisionToHair, this.SetupButton(parentItem, "touch hand collision to hair", delegate(bool isLeft)
  309. {
  310. this.cmSystem.SConfig.OvrHandHitToHair = isLeft;
  311. this.Log("Touch\u3000手の髪への当たり判定 : " + this.cmSystem.SConfig.OvrHandHitToHair);
  312. }));
  313. this.dicItem.Add(ConfigVRCtrl.TypeItem.TouchHandCollisionToSkirt, this.SetupMultiButton(parentItem, "touch hand collision to skirt", delegate(int index)
  314. {
  315. CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT ovrHandHitToSkirt;
  316. if (index == 0)
  317. {
  318. ovrHandHitToSkirt = CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT.OFF;
  319. }
  320. else if (index == 1)
  321. {
  322. ovrHandHitToSkirt = CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT.ON;
  323. }
  324. else
  325. {
  326. ovrHandHitToSkirt = CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT.GRAB;
  327. }
  328. this.cmSystem.SConfig.OvrHandHitToSkirt = ovrHandHitToSkirt;
  329. this.Log("Touch\u3000手のスカートへの当たり判定 : " + this.cmSystem.SConfig.OvrHandHitToSkirt);
  330. }));
  331. }
  332. private void SetupHMDOnlyUI(GameObject parentItem)
  333. {
  334. this.dicItem.Add(ConfigVRCtrl.TypeItem.HMDOnlyCameraPlaneMovement, this.SetupButton(parentItem, "no touch plane movement", delegate(bool isLeft)
  335. {
  336. this.cmSystem.VRCameraPlaneMove = isLeft;
  337. this.Log("HMDのみ\u3000カメラの平行移動 : " + this.cmSystem.VRCameraPlaneMove);
  338. }));
  339. this.dicItem.Add(ConfigVRCtrl.TypeItem.HMDOnlyMouseRotateEnable, this.SetupButton(parentItem, "no touch mouse rot enable", delegate(bool isLeft)
  340. {
  341. this.cmSystem.OvrMouseRot = isLeft;
  342. this.Log("HMDのみ\u3000マウスでカメラ回転 : " + this.cmSystem.OvrMouseRot);
  343. }));
  344. this.dicItem.Add(ConfigVRCtrl.TypeItem.HMDOnlyMouseRotateSpeed, this.SetupSlider(parentItem, "no touch mouse rot speed", ConfigVRCtrl.VR_CAMERA_MOUSE_ROT_VALUE.x, ConfigVRCtrl.VR_CAMERA_MOUSE_ROT_VALUE.y, delegate(float value)
  345. {
  346. this.cmSystem.VRCameraRotSpeedMouse = value;
  347. this.Log("HMDのみ\u3000マウスのカメラ回転速度 : " + this.cmSystem.VRCameraRotSpeedMouse);
  348. }));
  349. }
  350. private void Setup2DModeUI(GameObject parentItem)
  351. {
  352. this.dicItem.Add(ConfigVRCtrl.TypeItem.DummyMouseRotateSpeed, this.SetupSlider(parentItem, "2d mouse rot speed", ConfigVRCtrl.VR_CAMERA_MOUSE_ROT_VALUE.x, ConfigVRCtrl.VR_CAMERA_MOUSE_ROT_VALUE.y, delegate(float value)
  353. {
  354. this.cmSystem.VRCameraRotSpeedMouse = value;
  355. this.Log("2Dモード\u3000マウスのカメラ回転速度 : " + this.cmSystem.VRCameraRotSpeedMouse);
  356. }));
  357. this.dicItem.Add(ConfigVRCtrl.TypeItem.DummyMouseRotateInverse, this.SetupButton(parentItem, "2d mouse rot inverse", delegate(bool isLeft)
  358. {
  359. this.cmSystem.VRCamRotDownUp = isLeft;
  360. this.Log("2Dモード\u3000マウスのカメラ反転 : " + this.cmSystem.VRCamRotDownUp);
  361. }));
  362. this.dicItem.Add(ConfigVRCtrl.TypeItem.DummyCameraPlaneMovement, this.SetupButton(parentItem, "2d plane movement", delegate(bool isLeft)
  363. {
  364. this.cmSystem.VRCameraPlaneMove = isLeft;
  365. this.Log("2Dモード\u3000カメラの平行移動 : " + this.cmSystem.VRCameraPlaneMove);
  366. }));
  367. this.dicItem.Add(ConfigVRCtrl.TypeItem.DummyShowMan, this.SetupButton(parentItem, "2d show man", delegate(bool isLeft)
  368. {
  369. this.cmSystem.VRManShow = isLeft;
  370. this.Log("2Dモード\u3000男の表示 : " + this.cmSystem.VRManShow);
  371. }));
  372. this.dicItem.Add(ConfigVRCtrl.TypeItem.DummyCameraFov, this.SetupSlider(parentItem, "2d camera field of view", ConfigVRCtrl.VR2D_CAMERA_FOV_VALUE.x, ConfigVRCtrl.VR2D_CAMERA_FOV_VALUE.y, delegate(float value)
  373. {
  374. this.cmSystem.VRCameraFov = value;
  375. this.Log("2Dモード\u3000カメラの画角 : " + this.cmSystem.VRCameraFov);
  376. }));
  377. Collider[] componentsInChildren = this.dicItem[ConfigVRCtrl.TypeItem.DummyCameraFov].GetComponentsInChildren<Collider>();
  378. foreach (Collider collider in componentsInChildren)
  379. {
  380. UIEventTrigger uieventTrigger = collider.gameObject.AddComponent<UIEventTrigger>();
  381. EventDelegate.Add(uieventTrigger.onPress, delegate()
  382. {
  383. UISprite cache = base.cachedObjectDic.GetCache<UISprite>("Background");
  384. TweenAlpha.Begin(cache.gameObject, 0.25f, 0.25f);
  385. });
  386. EventDelegate.Add(uieventTrigger.onRelease, delegate()
  387. {
  388. UISprite cache = base.cachedObjectDic.GetCache<UISprite>("Background");
  389. TweenAlpha.Begin(cache.gameObject, 0.25f, 1f);
  390. });
  391. }
  392. }
  393. private ConfigVRCtrl.ParentSlider SetupSlider(GameObject parent, string objName, float min, float max, Action<float> onValueChanged)
  394. {
  395. ConfigVRCtrl.ParentSlider parentSlider = UTY.GetChildObject(parent, objName, false).AddComponent<ConfigVRCtrl.ParentSlider>();
  396. parentSlider.min = min;
  397. parentSlider.max = max;
  398. ConfigVRCtrl.ParentSlider parentSlider2 = parentSlider;
  399. parentSlider2.onValueChanged = (Action<float>)Delegate.Combine(parentSlider2.onValueChanged, onValueChanged);
  400. return parentSlider;
  401. }
  402. private ConfigVRCtrl.ParentButton SetupButton(GameObject parent, string objName, Action<bool> onClickIsLeft)
  403. {
  404. ConfigVRCtrl.ParentButton parentButton = UTY.GetChildObject(parent, objName, false).AddComponent<ConfigVRCtrl.ParentButton>();
  405. ConfigVRCtrl.ParentButton parentButton2 = parentButton;
  406. parentButton2.onClickIsLeft = (Action<bool>)Delegate.Combine(parentButton2.onClickIsLeft, onClickIsLeft);
  407. return parentButton;
  408. }
  409. private ConfigVRCtrl.ParentMultiButton SetupMultiButton(GameObject parent, string objName, Action<int> onClickButtonIndex)
  410. {
  411. ConfigVRCtrl.ParentMultiButton parentMultiButton = UTY.GetChildObject(parent, objName, false).AddComponent<ConfigVRCtrl.ParentMultiButton>();
  412. ConfigVRCtrl.ParentMultiButton parentMultiButton2 = parentMultiButton;
  413. parentMultiButton2.onClick = (Action<int>)Delegate.Combine(parentMultiButton2.onClick, onClickButtonIndex);
  414. return parentMultiButton;
  415. }
  416. private void ItemSwitchingOfDevice()
  417. {
  418. if (this.dicItem == null)
  419. {
  420. Debug.Log("[ConfigVRCtrl] まだ項目の初期化は行っていません");
  421. return;
  422. }
  423. GameMain.VRDeviceType vrdeviceTypeID = GameMain.Instance.VRDeviceTypeID;
  424. Dictionary<ConfigVRCtrl.TypeItem, bool> dictionary = new Dictionary<ConfigVRCtrl.TypeItem, bool>();
  425. Array values = Enum.GetValues(typeof(ConfigVRCtrl.TypeItem));
  426. for (int i = 0; i < values.Length; i++)
  427. {
  428. dictionary.Add((ConfigVRCtrl.TypeItem)values.GetValue(i), false);
  429. }
  430. dictionary[ConfigVRCtrl.TypeItem.CommonCameraMoveSpeed] = true;
  431. dictionary[ConfigVRCtrl.TypeItem.CommonCameraRotSpeed] = true;
  432. dictionary[ConfigVRCtrl.TypeItem.CommonEyeHeight] = true;
  433. dictionary[ConfigVRCtrl.TypeItem.CommonSitHeight] = true;
  434. dictionary[ConfigVRCtrl.TypeItem.CommonShowDesktopScreen] = true;
  435. if (vrdeviceTypeID == GameMain.VRDeviceType.NON)
  436. {
  437. dictionary[ConfigVRCtrl.TypeItem.DummyCameraFov] = true;
  438. dictionary[ConfigVRCtrl.TypeItem.DummyCameraPlaneMovement] = true;
  439. dictionary[ConfigVRCtrl.TypeItem.DummyMouseRotateInverse] = true;
  440. dictionary[ConfigVRCtrl.TypeItem.DummyMouseRotateSpeed] = true;
  441. dictionary[ConfigVRCtrl.TypeItem.DummyShowMan] = true;
  442. }
  443. else if (vrdeviceTypeID == GameMain.VRDeviceType.RIFT)
  444. {
  445. dictionary[ConfigVRCtrl.TypeItem.HMDOnlyCameraPlaneMovement] = true;
  446. dictionary[ConfigVRCtrl.TypeItem.HMDOnlyMouseRotateEnable] = true;
  447. dictionary[ConfigVRCtrl.TypeItem.HMDOnlyMouseRotateSpeed] = true;
  448. }
  449. else if (vrdeviceTypeID == GameMain.VRDeviceType.FOVE)
  450. {
  451. dictionary[ConfigVRCtrl.TypeItem.HMDOnlyCameraPlaneMovement] = true;
  452. dictionary[ConfigVRCtrl.TypeItem.HMDOnlyMouseRotateEnable] = true;
  453. dictionary[ConfigVRCtrl.TypeItem.HMDOnlyMouseRotateSpeed] = true;
  454. }
  455. else if (vrdeviceTypeID == GameMain.VRDeviceType.VIVE)
  456. {
  457. dictionary[ConfigVRCtrl.TypeItem.ViveFloorHeightType] = true;
  458. dictionary[ConfigVRCtrl.TypeItem.ViveMoveMode] = true;
  459. dictionary[ConfigVRCtrl.TypeItem.ViveSnapRotateEnable] = (this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.WARP_DRAW_STEPROT);
  460. dictionary[ConfigVRCtrl.TypeItem.ViveSnapRotateRate] = (this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.WARP_DRAW_STEPROT);
  461. dictionary[ConfigVRCtrl.TypeItem.ViveOldRotatePad] = (this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.DIRECTION);
  462. dictionary[ConfigVRCtrl.TypeItem.ViveOldMovePad] = (this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.DIRECTION);
  463. dictionary[ConfigVRCtrl.TypeItem.ViveOldMoveRotatePadAriaRate] = (this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.DIRECTION);
  464. dictionary[ConfigVRCtrl.TypeItem.ViveDDTouchToClick] = false;
  465. dictionary[ConfigVRCtrl.TypeItem.ViveOvrTabletFrameHideWhenMsgWndVisible] = true;
  466. dictionary[ConfigVRCtrl.TypeItem.ViveHandCollisionToHair] = true;
  467. dictionary[ConfigVRCtrl.TypeItem.ViveHandCollisionToSkirt] = true;
  468. }
  469. else if (vrdeviceTypeID == GameMain.VRDeviceType.RIFT_TOUCH)
  470. {
  471. dictionary[ConfigVRCtrl.TypeItem.TouchMoveMode] = true;
  472. dictionary[ConfigVRCtrl.TypeItem.TouchSnapRotateEnable] = (this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.WARP_DRAW_STEPROT);
  473. dictionary[ConfigVRCtrl.TypeItem.TouchSnapRotateRate] = (this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.WARP_DRAW_STEPROT);
  474. dictionary[ConfigVRCtrl.TypeItem.TouchOldRotateStick] = (this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.DIRECTION);
  475. dictionary[ConfigVRCtrl.TypeItem.TouchOldMoveStick] = (this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.DIRECTION);
  476. dictionary[ConfigVRCtrl.TypeItem.TouchDDTouchToClick] = false;
  477. dictionary[ConfigVRCtrl.TypeItem.TouchOvrTabletFrameHideWhenMsgWndVisible] = true;
  478. dictionary[ConfigVRCtrl.TypeItem.TouchHandCollisionToHair] = true;
  479. dictionary[ConfigVRCtrl.TypeItem.TouchHandCollisionToSkirt] = true;
  480. }
  481. dictionary[ConfigVRCtrl.TypeItem.DummyShowMan] = false;
  482. foreach (KeyValuePair<ConfigVRCtrl.TypeItem, bool> keyValuePair in dictionary)
  483. {
  484. this.dicItem[keyValuePair.Key].gameObject.SetActive(keyValuePair.Value);
  485. }
  486. UIGrid cache = base.cachedObjectDic.GetCache<UIGrid>("Parent Grid");
  487. cache.Reposition();
  488. }
  489. private void SetItemShowFlag(ConfigVRCtrl.TypeItem type, bool isShow)
  490. {
  491. if (this.dicItem == null)
  492. {
  493. Debug.Log("[ConfigVRCtrl] まだ項目の初期化は行っていません");
  494. return;
  495. }
  496. if (this.dicItem[type].gameObject.activeSelf == isShow)
  497. {
  498. return;
  499. }
  500. this.dicItem[type].gameObject.SetActive(isShow);
  501. UIGrid cache = base.cachedObjectDic.GetCache<UIGrid>("Parent Grid");
  502. cache.Reposition();
  503. }
  504. private void LoadConfigData()
  505. {
  506. if (this.dicItem == null)
  507. {
  508. Debug.Log("[ConfigVRCtrl] まだ項目の初期化は行っていません");
  509. return;
  510. }
  511. foreach (KeyValuePair<ConfigVRCtrl.TypeItem, ConfigVRCtrl.ParentItem> keyValuePair in this.dicItem)
  512. {
  513. switch (keyValuePair.Key)
  514. {
  515. case ConfigVRCtrl.TypeItem.CommonEyeHeight:
  516. keyValuePair.Value.Set(this.cmSystem.VRCameraHeightStand);
  517. break;
  518. case ConfigVRCtrl.TypeItem.CommonSitHeight:
  519. keyValuePair.Value.Set(this.cmSystem.VRCameraHeightSit);
  520. break;
  521. case ConfigVRCtrl.TypeItem.CommonCameraMoveSpeed:
  522. keyValuePair.Value.Set(this.cmSystem.VRCameraMoveSpeedKey);
  523. break;
  524. case ConfigVRCtrl.TypeItem.CommonCameraRotSpeed:
  525. keyValuePair.Value.Set(this.cmSystem.VRCameraRotSpeedKey);
  526. break;
  527. case ConfigVRCtrl.TypeItem.CommonShowDesktopScreen:
  528. keyValuePair.Value.Set(GameMain.Instance.BgMgr.isShowDesktopScreen);
  529. break;
  530. case ConfigVRCtrl.TypeItem.ViveFloorHeightType:
  531. keyValuePair.Value.Set(this.cmSystem.OvrCameraHeightType == CMSystem.OVR_CAM_HEIGHT_TYPE.REAL);
  532. break;
  533. case ConfigVRCtrl.TypeItem.ViveSnapRotateEnable:
  534. keyValuePair.Value.Set(this.cmSystem.OvrUseSnapRotate);
  535. break;
  536. case ConfigVRCtrl.TypeItem.ViveSnapRotateRate:
  537. keyValuePair.Value.Set((float)this.cmSystem.OvrUseSnapRotateRate);
  538. break;
  539. case ConfigVRCtrl.TypeItem.ViveMoveMode:
  540. keyValuePair.Value.Set(this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.WARP_DRAW_STEPROT);
  541. break;
  542. case ConfigVRCtrl.TypeItem.ViveOldRotatePad:
  543. keyValuePair.Value.Set(this.cmSystem.SConfig.OvrViveSmoothRotatePadAreaUse);
  544. break;
  545. case ConfigVRCtrl.TypeItem.ViveOldMovePad:
  546. keyValuePair.Value.Set(this.cmSystem.SConfig.OvrViveSmoothupDownPadAreaUse);
  547. break;
  548. case ConfigVRCtrl.TypeItem.ViveOldMoveRotatePadAriaRate:
  549. keyValuePair.Value.Set(this.cmSystem.SConfig.OvrViveSmoothRotatePadAriaRate);
  550. break;
  551. case ConfigVRCtrl.TypeItem.ViveDDTouchToClick:
  552. keyValuePair.Value.Set(this.cmSystem.SConfig.OvrDDTouchToClick);
  553. break;
  554. case ConfigVRCtrl.TypeItem.ViveOvrTabletFrameHideWhenMsgWndVisible:
  555. keyValuePair.Value.Set(this.cmSystem.SConfig.OvrTabletFrameHideWhenMsgWndVisible);
  556. break;
  557. case ConfigVRCtrl.TypeItem.ViveHandCollisionToHair:
  558. keyValuePair.Value.Set(this.cmSystem.SConfig.OvrHandHitToHair);
  559. break;
  560. case ConfigVRCtrl.TypeItem.ViveHandCollisionToSkirt:
  561. if (this.cmSystem.SConfig.OvrHandHitToSkirt == CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT.OFF)
  562. {
  563. keyValuePair.Value.Set(0);
  564. }
  565. else if (this.cmSystem.SConfig.OvrHandHitToSkirt == CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT.ON)
  566. {
  567. keyValuePair.Value.Set(1);
  568. }
  569. else
  570. {
  571. keyValuePair.Value.Set(2);
  572. }
  573. break;
  574. case ConfigVRCtrl.TypeItem.TouchSnapRotateEnable:
  575. keyValuePair.Value.Set(this.cmSystem.OvrUseSnapRotate);
  576. break;
  577. case ConfigVRCtrl.TypeItem.TouchSnapRotateRate:
  578. keyValuePair.Value.Set((float)this.cmSystem.OvrUseSnapRotateRate);
  579. break;
  580. case ConfigVRCtrl.TypeItem.TouchMoveMode:
  581. keyValuePair.Value.Set(this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.WARP_DRAW_STEPROT);
  582. break;
  583. case ConfigVRCtrl.TypeItem.TouchOldRotateStick:
  584. keyValuePair.Value.Set(this.cmSystem.SConfig.OvrRiftGripStickRotate);
  585. break;
  586. case ConfigVRCtrl.TypeItem.TouchOldMoveStick:
  587. keyValuePair.Value.Set(this.cmSystem.SConfig.OvrRiftTriggerStickUpDown);
  588. break;
  589. case ConfigVRCtrl.TypeItem.TouchDDTouchToClick:
  590. keyValuePair.Value.Set(this.cmSystem.SConfig.OvrDDTouchToClick);
  591. break;
  592. case ConfigVRCtrl.TypeItem.TouchOvrTabletFrameHideWhenMsgWndVisible:
  593. keyValuePair.Value.Set(this.cmSystem.SConfig.OvrTabletFrameHideWhenMsgWndVisible);
  594. break;
  595. case ConfigVRCtrl.TypeItem.TouchHandCollisionToHair:
  596. keyValuePair.Value.Set(this.cmSystem.SConfig.OvrHandHitToHair);
  597. break;
  598. case ConfigVRCtrl.TypeItem.TouchHandCollisionToSkirt:
  599. if (this.cmSystem.SConfig.OvrHandHitToSkirt == CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT.OFF)
  600. {
  601. keyValuePair.Value.Set(0);
  602. }
  603. else if (this.cmSystem.SConfig.OvrHandHitToSkirt == CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT.ON)
  604. {
  605. keyValuePair.Value.Set(1);
  606. }
  607. else
  608. {
  609. keyValuePair.Value.Set(2);
  610. }
  611. break;
  612. case ConfigVRCtrl.TypeItem.HMDOnlyCameraPlaneMovement:
  613. keyValuePair.Value.Set(this.cmSystem.VRCameraPlaneMove);
  614. break;
  615. case ConfigVRCtrl.TypeItem.HMDOnlyMouseRotateEnable:
  616. keyValuePair.Value.Set(this.cmSystem.OvrMouseRot);
  617. break;
  618. case ConfigVRCtrl.TypeItem.HMDOnlyMouseRotateSpeed:
  619. keyValuePair.Value.Set(this.cmSystem.VRCameraRotSpeedMouse);
  620. break;
  621. case ConfigVRCtrl.TypeItem.DummyMouseRotateSpeed:
  622. keyValuePair.Value.Set(this.cmSystem.VRCameraRotSpeedMouse);
  623. break;
  624. case ConfigVRCtrl.TypeItem.DummyMouseRotateInverse:
  625. keyValuePair.Value.Set(this.cmSystem.VRCamRotDownUp);
  626. break;
  627. case ConfigVRCtrl.TypeItem.DummyCameraPlaneMovement:
  628. keyValuePair.Value.Set(this.cmSystem.VRCameraPlaneMove);
  629. break;
  630. case ConfigVRCtrl.TypeItem.DummyShowMan:
  631. keyValuePair.Value.Set(this.cmSystem.VRManShow);
  632. break;
  633. case ConfigVRCtrl.TypeItem.DummyCameraFov:
  634. keyValuePair.Value.Set(this.cmSystem.VRCameraFov);
  635. break;
  636. default:
  637. Debug.LogError("[ConfigVRCtrl] 種類「" + keyValuePair.Key + "」のセッターがない");
  638. NDebug.Assert("[ConfigVRCtrl] 種類「" + keyValuePair.Key + "」のセッターがない", false);
  639. break;
  640. }
  641. }
  642. }
  643. private void OnApplicationQuit()
  644. {
  645. this.m_IsQuittingApplication = true;
  646. }
  647. private void OnDestroy()
  648. {
  649. if (this.m_IsQuittingApplication)
  650. {
  651. return;
  652. }
  653. if (ConfigVRCtrl.instance != null && ConfigVRCtrl.instance == this)
  654. {
  655. ConfigVRCtrl.m_Instance = null;
  656. }
  657. if (this.dicItem != null)
  658. {
  659. this.dicItem.Clear();
  660. this.dicItem = null;
  661. }
  662. this.onClickOK = null;
  663. }
  664. private static ConfigVRCtrl m_Instance;
  665. private static readonly Vector2 COMMON_EYE_HEIGHT_VALUE = new Vector2(1.5f, 1.8f);
  666. private static readonly Vector2 COMMON_SITTING_HEIGHT_VALUE = new Vector2(0.7f, 1f);
  667. private static readonly Vector2 COMMON_CAMERA_MOVE_VALUE = new Vector2(0f, 1f);
  668. private static readonly Vector2 COMMON_CAMERA_ROT_VALUE = new Vector2(0f, 1f);
  669. private static readonly Vector2 VR_CAMERA_SNAP_ROT_VALUE = new Vector2(10f, 80f);
  670. private static readonly Vector2 VR_CAMERA_MOUSE_ROT_VALUE = new Vector2(0f, 1f);
  671. private static readonly Vector2 VR2D_CAMERA_FOV_VALUE = new Vector2(30f, 60f);
  672. private Dictionary<ConfigVRCtrl.TypeItem, ConfigVRCtrl.ParentItem> m_DicItem;
  673. private bool m_IsQuittingApplication;
  674. private abstract class ParentItem : MonoBehaviour
  675. {
  676. public UILabel label
  677. {
  678. get
  679. {
  680. return this.m_Label;
  681. }
  682. }
  683. protected virtual void Awake()
  684. {
  685. this.m_Label = UTY.GetChildObject(base.gameObject, "name", false).GetComponent<UILabel>();
  686. if (this.m_Label == null)
  687. {
  688. string message = "[ConfigVRCtrl] " + base.gameObject.name + "/nameに、\nUILabel のコンポーネントがありませんでした";
  689. NDebug.Assert(message, false);
  690. Debug.LogError(message);
  691. }
  692. }
  693. public abstract void Set(object value);
  694. private UILabel m_Label;
  695. }
  696. private class ParentSlider : ConfigVRCtrl.ParentItem
  697. {
  698. public UISlider slider
  699. {
  700. get
  701. {
  702. return this.m_Slider;
  703. }
  704. private set
  705. {
  706. this.m_Slider = value;
  707. }
  708. }
  709. public float normalizedValue
  710. {
  711. get
  712. {
  713. return this.slider.value;
  714. }
  715. set
  716. {
  717. this.slider.value = value;
  718. }
  719. }
  720. public float min
  721. {
  722. get
  723. {
  724. return this.m_Min;
  725. }
  726. set
  727. {
  728. this.m_Min = value;
  729. }
  730. }
  731. public float max
  732. {
  733. get
  734. {
  735. return this.m_Max;
  736. }
  737. set
  738. {
  739. this.m_Max = value;
  740. }
  741. }
  742. public float value
  743. {
  744. get
  745. {
  746. return Mathf.Lerp(this.min, this.max, this.normalizedValue);
  747. }
  748. set
  749. {
  750. this.normalizedValue = Mathf.InverseLerp(this.min, this.max, value);
  751. }
  752. }
  753. public Action<float> onValueChanged { get; set; }
  754. public Action onDragFinished { get; set; }
  755. protected override void Awake()
  756. {
  757. base.Awake();
  758. GameObject childObject = UTY.GetChildObject(base.gameObject, "slider", false);
  759. this.slider = childObject.GetComponent<UISlider>();
  760. if (this.slider == null)
  761. {
  762. string message = string.Concat(new string[]
  763. {
  764. "[ConfigVRCtrl] ",
  765. base.gameObject.name,
  766. "/",
  767. childObject.name,
  768. "に、\nUISlider のコンポーネントがありませんでした"
  769. });
  770. NDebug.Assert(message, false);
  771. Debug.LogError(message);
  772. }
  773. EventDelegate.Add(this.slider.onChange, delegate()
  774. {
  775. if (this.onValueChanged != null)
  776. {
  777. this.onValueChanged(this.value);
  778. }
  779. });
  780. UISlider slider = this.slider;
  781. slider.onDragFinished = (UIProgressBar.OnDragFinished)Delegate.Combine(slider.onDragFinished, new UIProgressBar.OnDragFinished(delegate()
  782. {
  783. if (this.onDragFinished != null)
  784. {
  785. this.onDragFinished();
  786. }
  787. }));
  788. }
  789. public override void Set(object value)
  790. {
  791. this.value = (float)value;
  792. }
  793. private UISlider m_Slider;
  794. private float m_Min;
  795. private float m_Max = 1f;
  796. }
  797. private class ParentButton : ConfigVRCtrl.ParentItem
  798. {
  799. public UIButton buttonRight
  800. {
  801. get
  802. {
  803. return this.m_ButtonRight;
  804. }
  805. private set
  806. {
  807. this.m_ButtonRight = value;
  808. }
  809. }
  810. public UIButton buttonLeft
  811. {
  812. get
  813. {
  814. return this.m_ButtonLeft;
  815. }
  816. private set
  817. {
  818. this.m_ButtonLeft = value;
  819. }
  820. }
  821. public Action<bool> onClickIsLeft { get; set; }
  822. protected override void Awake()
  823. {
  824. base.Awake();
  825. GameObject childObject = UTY.GetChildObject(base.gameObject, "button right", false);
  826. this.buttonRight = childObject.GetComponent<UIButton>();
  827. if (this.buttonRight == null)
  828. {
  829. string message = string.Concat(new string[]
  830. {
  831. "[ConfigVRCtrl] ",
  832. base.gameObject.name,
  833. "/",
  834. childObject.name,
  835. "に、\nUIButton のコンポーネントがありませんでした"
  836. });
  837. NDebug.Assert(message, false);
  838. Debug.LogError(message);
  839. }
  840. childObject = UTY.GetChildObject(base.gameObject, "button left", false);
  841. this.buttonLeft = childObject.GetComponent<UIButton>();
  842. if (this.buttonLeft == null)
  843. {
  844. string message2 = string.Concat(new string[]
  845. {
  846. "[ConfigVRCtrl] ",
  847. base.gameObject.name,
  848. "/",
  849. childObject.name,
  850. "に、\nUIButton のコンポーネントがありませんでした"
  851. });
  852. NDebug.Assert(message2, false);
  853. Debug.LogError(message2);
  854. }
  855. EventDelegate.Add(this.buttonRight.onClick, delegate()
  856. {
  857. if (this.onClickIsLeft != null)
  858. {
  859. this.onClickIsLeft(false);
  860. }
  861. this.OnClickButton(false);
  862. });
  863. EventDelegate.Add(this.buttonLeft.onClick, delegate()
  864. {
  865. if (this.onClickIsLeft != null)
  866. {
  867. this.onClickIsLeft(true);
  868. }
  869. this.OnClickButton(true);
  870. });
  871. }
  872. private void OnClickButton(bool isLeft)
  873. {
  874. this.buttonLeft.defaultColor = ((!isLeft) ? ConfigVRCtrl.ParentButton.ButtonDefaultColor : ConfigVRCtrl.ParentButton.ButtonClickedColor);
  875. this.buttonRight.defaultColor = (isLeft ? ConfigVRCtrl.ParentButton.ButtonDefaultColor : ConfigVRCtrl.ParentButton.ButtonClickedColor);
  876. }
  877. public void Emulate(bool isLeft)
  878. {
  879. UIButton uibutton = (!isLeft) ? this.buttonRight : this.buttonLeft;
  880. EventDelegate.Execute(uibutton.onClick);
  881. }
  882. public override void Set(object value)
  883. {
  884. this.Emulate((bool)value);
  885. }
  886. private static Color ButtonDefaultColor = new Color(1f, 1f, 1f, 0.5f);
  887. private static Color ButtonClickedColor = Color.white;
  888. private UIButton m_ButtonRight;
  889. private UIButton m_ButtonLeft;
  890. }
  891. private class ParentMultiButton : ConfigVRCtrl.ParentItem
  892. {
  893. public UIButton buttonRight
  894. {
  895. get
  896. {
  897. return this.m_ButtonRight;
  898. }
  899. private set
  900. {
  901. this.m_ButtonRight = value;
  902. }
  903. }
  904. public UIButton buttonLeft
  905. {
  906. get
  907. {
  908. return this.m_ButtonLeft;
  909. }
  910. private set
  911. {
  912. this.m_ButtonLeft = value;
  913. }
  914. }
  915. public UIButton buttonCenter
  916. {
  917. get
  918. {
  919. return this.m_ButtonCenter;
  920. }
  921. private set
  922. {
  923. this.m_ButtonCenter = value;
  924. }
  925. }
  926. public Action<int> onClick { get; set; }
  927. protected override void Awake()
  928. {
  929. base.Awake();
  930. GameObject childObject = UTY.GetChildObject(base.gameObject, "button right", false);
  931. this.buttonRight = childObject.GetComponent<UIButton>();
  932. if (this.buttonRight == null)
  933. {
  934. string message = string.Concat(new string[]
  935. {
  936. "[ConfigVRCtrl] ",
  937. base.gameObject.name,
  938. "/",
  939. childObject.name,
  940. "に、\nUIButton のコンポーネントがありませんでした"
  941. });
  942. NDebug.Assert(message, false);
  943. Debug.LogError(message);
  944. }
  945. childObject = UTY.GetChildObject(base.gameObject, "button left", false);
  946. this.buttonLeft = childObject.GetComponent<UIButton>();
  947. if (this.buttonLeft == null)
  948. {
  949. string message2 = string.Concat(new string[]
  950. {
  951. "[ConfigVRCtrl] ",
  952. base.gameObject.name,
  953. "/",
  954. childObject.name,
  955. "に、\nUIButton のコンポーネントがありませんでした"
  956. });
  957. NDebug.Assert(message2, false);
  958. Debug.LogError(message2);
  959. }
  960. childObject = UTY.GetChildObject(base.gameObject, "button center", false);
  961. this.buttonCenter = childObject.GetComponent<UIButton>();
  962. if (this.buttonCenter == null)
  963. {
  964. string message3 = string.Concat(new string[]
  965. {
  966. "[ConfigVRCtrl] ",
  967. base.gameObject.name,
  968. "/",
  969. childObject.name,
  970. "に、\nUIButton のコンポーネントがありませんでした"
  971. });
  972. NDebug.Assert(message3, false);
  973. Debug.LogError(message3);
  974. }
  975. EventDelegate.Add(this.buttonRight.onClick, delegate()
  976. {
  977. if (this.onClick != null)
  978. {
  979. this.onClick(0);
  980. }
  981. this.OnClickButton(0);
  982. });
  983. EventDelegate.Add(this.buttonLeft.onClick, delegate()
  984. {
  985. if (this.onClick != null)
  986. {
  987. this.onClick(1);
  988. }
  989. this.OnClickButton(1);
  990. });
  991. EventDelegate.Add(this.buttonCenter.onClick, delegate()
  992. {
  993. if (this.onClick != null)
  994. {
  995. this.onClick(2);
  996. }
  997. this.OnClickButton(2);
  998. });
  999. }
  1000. private void OnClickButton(int index)
  1001. {
  1002. this.buttonRight.defaultColor = ((index != 0) ? ConfigVRCtrl.ParentMultiButton.ButtonDefaultColor : ConfigVRCtrl.ParentMultiButton.ButtonClickedColor);
  1003. this.buttonLeft.defaultColor = ((index != 1) ? ConfigVRCtrl.ParentMultiButton.ButtonDefaultColor : ConfigVRCtrl.ParentMultiButton.ButtonClickedColor);
  1004. this.buttonCenter.defaultColor = ((index != 2) ? ConfigVRCtrl.ParentMultiButton.ButtonDefaultColor : ConfigVRCtrl.ParentMultiButton.ButtonClickedColor);
  1005. }
  1006. public void Emulate(int index)
  1007. {
  1008. UIButton uibutton;
  1009. if (index == 0)
  1010. {
  1011. uibutton = this.buttonRight;
  1012. }
  1013. else if (index == 1)
  1014. {
  1015. uibutton = this.buttonLeft;
  1016. }
  1017. else
  1018. {
  1019. uibutton = this.buttonCenter;
  1020. }
  1021. EventDelegate.Execute(uibutton.onClick);
  1022. }
  1023. public override void Set(object value)
  1024. {
  1025. this.Emulate((int)value);
  1026. }
  1027. private static Color ButtonDefaultColor = new Color(1f, 1f, 1f, 0.5f);
  1028. private static Color ButtonClickedColor = Color.white;
  1029. private UIButton m_ButtonRight;
  1030. private UIButton m_ButtonLeft;
  1031. private UIButton m_ButtonCenter;
  1032. }
  1033. private enum TypeItem
  1034. {
  1035. CommonEyeHeight,
  1036. CommonSitHeight,
  1037. CommonCameraMoveSpeed,
  1038. CommonCameraRotSpeed,
  1039. CommonShowDesktopScreen,
  1040. ViveFloorHeightType,
  1041. ViveSnapRotateEnable,
  1042. ViveSnapRotateRate,
  1043. ViveMoveMode,
  1044. ViveOldRotatePad,
  1045. ViveOldMovePad,
  1046. ViveOldMoveRotatePadAriaRate,
  1047. ViveDDTouchToClick,
  1048. ViveOvrTabletFrameHideWhenMsgWndVisible,
  1049. ViveHandCollisionToHair,
  1050. ViveHandCollisionToSkirt,
  1051. TouchSnapRotateEnable,
  1052. TouchSnapRotateRate,
  1053. TouchMoveMode,
  1054. TouchOldRotateStick,
  1055. TouchOldMoveStick,
  1056. TouchDDTouchToClick,
  1057. TouchOvrTabletFrameHideWhenMsgWndVisible,
  1058. TouchHandCollisionToHair,
  1059. TouchHandCollisionToSkirt,
  1060. HMDOnlyCameraPlaneMovement,
  1061. HMDOnlyMouseRotateEnable,
  1062. HMDOnlyMouseRotateSpeed,
  1063. DummyMouseRotateSpeed,
  1064. DummyMouseRotateInverse,
  1065. DummyCameraPlaneMovement,
  1066. DummyShowMan,
  1067. DummyCameraFov
  1068. }
  1069. }