1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144 |
- using System;
- using System.Collections.Generic;
- using Kasizuki;
- using UnityEngine;
- public class ConfigVRCtrl : NGUIWindow
- {
- public static ConfigVRCtrl instance
- {
- get
- {
- Transform transform = null;
- GameObject gameObject = GameObject.Find("SystemUI Root");
- if (gameObject)
- {
- transform = gameObject.transform;
- }
- else
- {
- NDebug.Assert("SystemUI Rootが見つかりません", false);
- }
- if (ConfigVRCtrl.m_Instance == null)
- {
- Transform transform2 = transform.Find("ConfigVR");
- if (transform2 != null)
- {
- ConfigVRCtrl.m_Instance = transform2.GetComponent<ConfigVRCtrl>();
- }
- }
- if (ConfigVRCtrl.m_Instance == null)
- {
- string path = "SystemUI/Config/Prefab/ConfigVR";
- GameObject gameObject2 = Resources.Load<GameObject>(path);
- if (gameObject2 == null)
- {
- NDebug.Assert("[ConfigVRCtrl] VRコンフィグUIのプレハブが存在しません", false);
- }
- ConfigVRCtrl.m_Instance = UnityEngine.Object.Instantiate<GameObject>(gameObject2).GetComponent<ConfigVRCtrl>();
- ConfigVRCtrl.m_Instance.transform.SetParent(transform, false);
- ConfigVRCtrl.m_Instance.transform.localPosition = new Vector3(0f, -11f, 0f);
- ConfigVRCtrl.m_Instance.transform.localRotation = Quaternion.identity;
- ConfigVRCtrl.m_Instance.transform.localScale = Vector3.one;
- }
- if (ConfigVRCtrl.m_Instance == null)
- {
- NDebug.Assert("[ConfigVRCtrl] VRコンフィグUIのインスタンス取得に失敗しました", false);
- }
- return ConfigVRCtrl.m_Instance;
- }
- }
- public static bool IsOpen()
- {
- return ConfigVRCtrl.instance != null && ConfigVRCtrl.instance.gameObject.activeSelf;
- }
- public static void Open(Action onClickOK = null)
- {
- if (ConfigVRCtrl.IsOpen())
- {
- Debug.Log("[ConfigVRCtrl] VRConfigは既に開かれています。");
- return;
- }
- ConfigVRCtrl component = ConfigVRCtrl.instance.GetComponent<ConfigVRCtrl>();
- NGUIWindow component2 = ConfigVRCtrl.instance.GetComponent<NGUIWindow>();
- component.onClickOK = onClickOK;
- component.LoadConfigData();
- component2.Open(0.25f, null);
- }
- public static void Close(bool isExecutionOK = true)
- {
- ConfigVRCtrl component = ConfigVRCtrl.instance.GetComponent<ConfigVRCtrl>();
- NGUIWindow component2 = ConfigVRCtrl.instance.GetComponent<NGUIWindow>();
- component2.Close(0.25f, delegate
- {
- UnityEngine.Object.Destroy(ConfigVRCtrl.instance.gameObject);
- });
- if (isExecutionOK && component.onClickOK != null)
- {
- component.onClickOK();
- }
- }
- private Dictionary<ConfigVRCtrl.TypeItem, ConfigVRCtrl.ParentItem> dicItem
- {
- get
- {
- return this.m_DicItem;
- }
- set
- {
- this.m_DicItem = value;
- }
- }
- private CMSystem cmSystem
- {
- get
- {
- return GameMain.Instance.CMSystem;
- }
- }
- private void Log(object message)
- {
- Debug.Log(message);
- }
- public Action onClickOK { get; set; }
- public Action onClickChangeConfig { get; set; }
- protected override void Awake()
- {
- base.Awake();
- this.SetupAllUI();
- this.LoadConfigData();
- this.ItemSwitchingOfDevice();
- }
- private void SetupAllUI()
- {
- base.cachedObjectDic.CacheChildObject<UIButton>(base.gameObject, "OK", "ButtonOK");
- EventDelegate.Add(base.cachedObjectDic.GetCache<UIButton>("ButtonOK").onClick, delegate()
- {
- ConfigVRCtrl.Close(true);
- });
- base.cachedObjectDic.CacheChildObject<UIButton>(base.gameObject, "Change Normal", "ButtonChange");
- EventDelegate.Add(base.cachedObjectDic.GetCache<UIButton>("ButtonChange").onClick, delegate()
- {
- ConfigVRCtrl.Close(true);
- BaseMgr<ConfigMgr>.Instance.OpenConfigPanel();
- });
- base.cachedObjectDic.CacheChildObject<UISprite>(base.gameObject, "BG", "Background");
- base.cachedObjectDic.CacheChildObject<UILabel>(base.gameObject, "label notes", "注意書き");
- base.cachedObjectDic.GetCache<UILabel>("注意書き").gameObject.SetActive(!GameMain.Instance.VRMode);
- UIGrid uigrid = base.cachedObjectDic.CacheChildObject<UIGrid>(base.gameObject, "DataList/ScrollView/Grid", "Parent Grid");
- this.dicItem = new Dictionary<ConfigVRCtrl.TypeItem, ConfigVRCtrl.ParentItem>();
- this.SetupCommonUI(uigrid.gameObject);
- this.SetupViveUI(uigrid.gameObject);
- this.SetupOculusTouchUI(uigrid.gameObject);
- this.SetupHMDOnlyUI(uigrid.gameObject);
- this.Setup2DModeUI(uigrid.gameObject);
- }
- private void SetupCommonUI(GameObject parentItem)
- {
- 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)
- {
- this.cmSystem.VRCameraHeightStand = value;
- this.Log("身長 : " + this.cmSystem.VRCameraHeightStand);
- }));
- 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)
- {
- this.cmSystem.VRCameraHeightSit = value;
- this.Log("座高 : " + this.cmSystem.VRCameraHeightSit);
- }));
- 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)
- {
- this.cmSystem.VRCameraMoveSpeedKey = value;
- this.Log("カメラ移動速度(キーボード) : " + this.cmSystem.VRCameraMoveSpeedKey);
- }));
- 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)
- {
- this.cmSystem.VRCameraRotSpeedKey = value;
- this.Log("カメラ回転速度(キーボード) : " + this.cmSystem.VRCameraRotSpeedKey);
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.CommonShowDesktopScreen, this.SetupButton(parentItem, "common show desktop screen", delegate(bool isLeft)
- {
- if (isLeft && !GameMain.Instance.BgMgr.isShowDesktopScreen)
- {
- GameMain.Instance.BgMgr.SetShowDesktopScreen(true);
- }
- else if (!isLeft && GameMain.Instance.BgMgr.isShowDesktopScreen)
- {
- GameMain.Instance.BgMgr.SetShowDesktopScreen(false);
- }
- this.Log("デスクトップスクリーンの表示 + " + GameMain.Instance.BgMgr.isShowDesktopScreen);
- }));
- }
- private void SetupViveUI(GameObject parentItem)
- {
- this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveFloorHeightType, this.SetupButton(parentItem, "vive floor height", delegate(bool isLeft)
- {
- this.cmSystem.OvrCameraHeightType = ((!isLeft) ? CMSystem.OVR_CAM_HEIGHT_TYPE.VR : CMSystem.OVR_CAM_HEIGHT_TYPE.REAL);
- this.Log("Vive\u3000床の高さ検出法 : " + this.cmSystem.OvrCameraHeightType.ToString());
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveMoveMode, this.SetupButton(parentItem, "vive move mode", delegate(bool isLeft)
- {
- this.cmSystem.SConfig.OvrMoveType = ((!isLeft) ? CMSystem.SerializeConfig.OVR_MOVE_TYPE.DIRECTION : CMSystem.SerializeConfig.OVR_MOVE_TYPE.WARP_DRAW_STEPROT);
- this.Log("Vive\u3000移動方法 : " + this.cmSystem.SConfig.OvrMoveType);
- if (isLeft)
- {
- this.SetItemShowFlag(ConfigVRCtrl.TypeItem.ViveSnapRotateEnable, true);
- this.SetItemShowFlag(ConfigVRCtrl.TypeItem.ViveSnapRotateRate, true);
- this.SetItemShowFlag(ConfigVRCtrl.TypeItem.ViveOldRotatePad, false);
- this.SetItemShowFlag(ConfigVRCtrl.TypeItem.ViveOldMovePad, false);
- this.SetItemShowFlag(ConfigVRCtrl.TypeItem.ViveOldMoveRotatePadAriaRate, false);
- }
- else
- {
- this.SetItemShowFlag(ConfigVRCtrl.TypeItem.ViveSnapRotateEnable, false);
- this.SetItemShowFlag(ConfigVRCtrl.TypeItem.ViveSnapRotateRate, false);
- this.SetItemShowFlag(ConfigVRCtrl.TypeItem.ViveOldRotatePad, true);
- this.SetItemShowFlag(ConfigVRCtrl.TypeItem.ViveOldMovePad, true);
- this.SetItemShowFlag(ConfigVRCtrl.TypeItem.ViveOldMoveRotatePadAriaRate, true);
- }
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveSnapRotateEnable, this.SetupButton(parentItem, "vive use snap rotate", delegate(bool isLeft)
- {
- this.cmSystem.OvrUseSnapRotate = isLeft;
- this.Log("Vive\u3000パッド端で回転 : " + this.cmSystem.OvrUseSnapRotate);
- }));
- 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)
- {
- this.cmSystem.OvrUseSnapRotateRate = (int)value;
- this.Log("Vive\u3000パッド端の回転量 : " + this.cmSystem.OvrUseSnapRotateRate);
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveOldRotatePad, this.SetupButton(parentItem, "vive old rotate pad", delegate(bool isLeft)
- {
- this.cmSystem.SConfig.OvrViveSmoothRotatePadAreaUse = isLeft;
- this.Log("Vive\u3000(スムーズ移動)パッド左右端で回転 : " + this.cmSystem.SConfig.OvrViveSmoothRotatePadAreaUse);
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveOldMovePad, this.SetupButton(parentItem, "vive old move pad", delegate(bool isLeft)
- {
- this.cmSystem.SConfig.OvrViveSmoothupDownPadAreaUse = isLeft;
- this.Log("Vive\u3000(スムーズ移動)パッド上下端で上下 : " + this.cmSystem.SConfig.OvrViveSmoothupDownPadAreaUse);
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveOldMoveRotatePadAriaRate, this.SetupSlider(parentItem, "vive old rotate pad aria rate", 10f, 80f, delegate(float value)
- {
- this.cmSystem.SConfig.OvrViveSmoothRotatePadAriaRate = value;
- this.Log("Vive\u3000(スムーズ移動)端の領域 : " + this.cmSystem.SConfig.OvrViveSmoothRotatePadAriaRate);
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveDDTouchToClick, this.SetupButton(parentItem, "vive dd touch to click", delegate(bool isLeft)
- {
- this.cmSystem.SConfig.OvrDDTouchToClick = isLeft;
- this.Log("Vive\u3000デスクトップスクリーンに触れるとクリック : " + this.cmSystem.SConfig.OvrDDTouchToClick);
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveOvrTabletFrameHideWhenMsgWndVisible, this.SetupButton(parentItem, "vive OvrTabletFrameHideWhenMsgWndVisible", delegate(bool isLeft)
- {
- this.cmSystem.SConfig.OvrTabletFrameHideWhenMsgWndVisible = isLeft;
- this.Log("Vive\u3000メッセージ中タブレット枠を非表示 : " + this.cmSystem.SConfig.OvrTabletFrameHideWhenMsgWndVisible);
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveHandCollisionToHair, this.SetupButton(parentItem, "vive hand collision to hair", delegate(bool isLeft)
- {
- this.cmSystem.SConfig.OvrHandHitToHair = isLeft;
- this.Log("Vive\u3000手の髪への当たり判定 : " + this.cmSystem.SConfig.OvrHandHitToHair);
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.ViveHandCollisionToSkirt, this.SetupMultiButton(parentItem, "vive hand collision to skirt", delegate(int index)
- {
- CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT ovrHandHitToSkirt;
- if (index == 0)
- {
- ovrHandHitToSkirt = CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT.OFF;
- }
- else if (index == 1)
- {
- ovrHandHitToSkirt = CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT.ON;
- }
- else
- {
- ovrHandHitToSkirt = CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT.GRAB;
- }
- this.cmSystem.SConfig.OvrHandHitToSkirt = ovrHandHitToSkirt;
- this.Log("Vive\u3000手のスカートへの当たり判定 : " + this.cmSystem.SConfig.OvrHandHitToSkirt);
- }));
- }
- private void SetupOculusTouchUI(GameObject parentItem)
- {
- this.dicItem.Add(ConfigVRCtrl.TypeItem.TouchMoveMode, this.SetupButton(parentItem, "touch move mode", delegate(bool isLeft)
- {
- this.cmSystem.SConfig.OvrMoveType = ((!isLeft) ? CMSystem.SerializeConfig.OVR_MOVE_TYPE.DIRECTION : CMSystem.SerializeConfig.OVR_MOVE_TYPE.WARP_DRAW_STEPROT);
- this.Log("Touch\u3000移動方法 : " + this.cmSystem.SConfig.OvrMoveType);
- if (isLeft)
- {
- this.SetItemShowFlag(ConfigVRCtrl.TypeItem.TouchSnapRotateEnable, true);
- this.SetItemShowFlag(ConfigVRCtrl.TypeItem.TouchSnapRotateRate, true);
- this.SetItemShowFlag(ConfigVRCtrl.TypeItem.TouchOldMoveStick, false);
- this.SetItemShowFlag(ConfigVRCtrl.TypeItem.TouchOldRotateStick, false);
- }
- else
- {
- this.SetItemShowFlag(ConfigVRCtrl.TypeItem.TouchSnapRotateEnable, false);
- this.SetItemShowFlag(ConfigVRCtrl.TypeItem.TouchSnapRotateRate, false);
- this.SetItemShowFlag(ConfigVRCtrl.TypeItem.TouchOldMoveStick, true);
- this.SetItemShowFlag(ConfigVRCtrl.TypeItem.TouchOldRotateStick, true);
- }
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.TouchSnapRotateEnable, this.SetupButton(parentItem, "touch use snap rotate", delegate(bool isLeft)
- {
- this.cmSystem.OvrUseSnapRotate = isLeft;
- this.Log("Touch\u3000スティック傾けで回転 : " + this.cmSystem.OvrUseSnapRotate);
- }));
- 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)
- {
- this.cmSystem.OvrUseSnapRotateRate = (int)value;
- this.Log("Touch\u3000スティック傾けの回転量 : " + this.cmSystem.OvrUseSnapRotateRate);
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.TouchOldMoveStick, this.SetupButton(parentItem, "touch old move stick", delegate(bool isLeft)
- {
- this.cmSystem.SConfig.OvrRiftTriggerStickUpDown = isLeft;
- this.Log("Touch\u3000(スムーズ移動)グリップとスティックで回転 : " + this.cmSystem.SConfig.OvrRiftTriggerStickUpDown);
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.TouchOldRotateStick, this.SetupButton(parentItem, "touch old rotate stick", delegate(bool isLeft)
- {
- this.cmSystem.SConfig.OvrRiftGripStickRotate = isLeft;
- this.Log("Touch\u3000(スムーズ移動)トリガーとスティックで上下 : " + this.cmSystem.SConfig.OvrRiftGripStickRotate);
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.TouchDDTouchToClick, this.SetupButton(parentItem, "touch dd touch to click", delegate(bool isLeft)
- {
- this.cmSystem.SConfig.OvrDDTouchToClick = isLeft;
- this.Log("Touch\u3000デスクトップスクリーンに触れるとクリック : " + this.cmSystem.SConfig.OvrDDTouchToClick);
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.TouchOvrTabletFrameHideWhenMsgWndVisible, this.SetupButton(parentItem, "touch OvrTabletFrameHideWhenMsgWndVisible", delegate(bool isLeft)
- {
- this.cmSystem.SConfig.OvrTabletFrameHideWhenMsgWndVisible = isLeft;
- this.Log("Touch\u3000メッセージ中タブレット枠を非表示 : " + this.cmSystem.SConfig.OvrTabletFrameHideWhenMsgWndVisible);
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.TouchHandCollisionToHair, this.SetupButton(parentItem, "touch hand collision to hair", delegate(bool isLeft)
- {
- this.cmSystem.SConfig.OvrHandHitToHair = isLeft;
- this.Log("Touch\u3000手の髪への当たり判定 : " + this.cmSystem.SConfig.OvrHandHitToHair);
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.TouchHandCollisionToSkirt, this.SetupMultiButton(parentItem, "touch hand collision to skirt", delegate(int index)
- {
- CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT ovrHandHitToSkirt;
- if (index == 0)
- {
- ovrHandHitToSkirt = CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT.OFF;
- }
- else if (index == 1)
- {
- ovrHandHitToSkirt = CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT.ON;
- }
- else
- {
- ovrHandHitToSkirt = CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT.GRAB;
- }
- this.cmSystem.SConfig.OvrHandHitToSkirt = ovrHandHitToSkirt;
- this.Log("Touch\u3000手のスカートへの当たり判定 : " + this.cmSystem.SConfig.OvrHandHitToSkirt);
- }));
- }
- private void SetupHMDOnlyUI(GameObject parentItem)
- {
- this.dicItem.Add(ConfigVRCtrl.TypeItem.HMDOnlyCameraPlaneMovement, this.SetupButton(parentItem, "no touch plane movement", delegate(bool isLeft)
- {
- this.cmSystem.VRCameraPlaneMove = isLeft;
- this.Log("HMDのみ\u3000カメラの平行移動 : " + this.cmSystem.VRCameraPlaneMove);
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.HMDOnlyMouseRotateEnable, this.SetupButton(parentItem, "no touch mouse rot enable", delegate(bool isLeft)
- {
- this.cmSystem.OvrMouseRot = isLeft;
- this.Log("HMDのみ\u3000マウスでカメラ回転 : " + this.cmSystem.OvrMouseRot);
- }));
- 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)
- {
- this.cmSystem.VRCameraRotSpeedMouse = value;
- this.Log("HMDのみ\u3000マウスのカメラ回転速度 : " + this.cmSystem.VRCameraRotSpeedMouse);
- }));
- }
- private void Setup2DModeUI(GameObject parentItem)
- {
- 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)
- {
- this.cmSystem.VRCameraRotSpeedMouse = value;
- this.Log("2Dモード\u3000マウスのカメラ回転速度 : " + this.cmSystem.VRCameraRotSpeedMouse);
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.DummyMouseRotateInverse, this.SetupButton(parentItem, "2d mouse rot inverse", delegate(bool isLeft)
- {
- this.cmSystem.VRCamRotDownUp = isLeft;
- this.Log("2Dモード\u3000マウスのカメラ反転 : " + this.cmSystem.VRCamRotDownUp);
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.DummyCameraPlaneMovement, this.SetupButton(parentItem, "2d plane movement", delegate(bool isLeft)
- {
- this.cmSystem.VRCameraPlaneMove = isLeft;
- this.Log("2Dモード\u3000カメラの平行移動 : " + this.cmSystem.VRCameraPlaneMove);
- }));
- this.dicItem.Add(ConfigVRCtrl.TypeItem.DummyShowMan, this.SetupButton(parentItem, "2d show man", delegate(bool isLeft)
- {
- this.cmSystem.VRManShow = isLeft;
- this.Log("2Dモード\u3000男の表示 : " + this.cmSystem.VRManShow);
- }));
- 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)
- {
- this.cmSystem.VRCameraFov = value;
- this.Log("2Dモード\u3000カメラの画角 : " + this.cmSystem.VRCameraFov);
- }));
- Collider[] componentsInChildren = this.dicItem[ConfigVRCtrl.TypeItem.DummyCameraFov].GetComponentsInChildren<Collider>();
- foreach (Collider collider in componentsInChildren)
- {
- UIEventTrigger uieventTrigger = collider.gameObject.AddComponent<UIEventTrigger>();
- EventDelegate.Add(uieventTrigger.onPress, delegate()
- {
- UISprite cache = base.cachedObjectDic.GetCache<UISprite>("Background");
- TweenAlpha.Begin(cache.gameObject, 0.25f, 0.25f);
- });
- EventDelegate.Add(uieventTrigger.onRelease, delegate()
- {
- UISprite cache = base.cachedObjectDic.GetCache<UISprite>("Background");
- TweenAlpha.Begin(cache.gameObject, 0.25f, 1f);
- });
- }
- }
- private ConfigVRCtrl.ParentSlider SetupSlider(GameObject parent, string objName, float min, float max, Action<float> onValueChanged)
- {
- ConfigVRCtrl.ParentSlider parentSlider = UTY.GetChildObject(parent, objName, false).AddComponent<ConfigVRCtrl.ParentSlider>();
- parentSlider.min = min;
- parentSlider.max = max;
- ConfigVRCtrl.ParentSlider parentSlider2 = parentSlider;
- parentSlider2.onValueChanged = (Action<float>)Delegate.Combine(parentSlider2.onValueChanged, onValueChanged);
- return parentSlider;
- }
- private ConfigVRCtrl.ParentButton SetupButton(GameObject parent, string objName, Action<bool> onClickIsLeft)
- {
- ConfigVRCtrl.ParentButton parentButton = UTY.GetChildObject(parent, objName, false).AddComponent<ConfigVRCtrl.ParentButton>();
- ConfigVRCtrl.ParentButton parentButton2 = parentButton;
- parentButton2.onClickIsLeft = (Action<bool>)Delegate.Combine(parentButton2.onClickIsLeft, onClickIsLeft);
- return parentButton;
- }
- private ConfigVRCtrl.ParentMultiButton SetupMultiButton(GameObject parent, string objName, Action<int> onClickButtonIndex)
- {
- ConfigVRCtrl.ParentMultiButton parentMultiButton = UTY.GetChildObject(parent, objName, false).AddComponent<ConfigVRCtrl.ParentMultiButton>();
- ConfigVRCtrl.ParentMultiButton parentMultiButton2 = parentMultiButton;
- parentMultiButton2.onClick = (Action<int>)Delegate.Combine(parentMultiButton2.onClick, onClickButtonIndex);
- return parentMultiButton;
- }
- private void ItemSwitchingOfDevice()
- {
- if (this.dicItem == null)
- {
- Debug.Log("[ConfigVRCtrl] まだ項目の初期化は行っていません");
- return;
- }
- GameMain.VRDeviceType vrdeviceTypeID = GameMain.Instance.VRDeviceTypeID;
- Dictionary<ConfigVRCtrl.TypeItem, bool> dictionary = new Dictionary<ConfigVRCtrl.TypeItem, bool>();
- Array values = Enum.GetValues(typeof(ConfigVRCtrl.TypeItem));
- for (int i = 0; i < values.Length; i++)
- {
- dictionary.Add((ConfigVRCtrl.TypeItem)values.GetValue(i), false);
- }
- dictionary[ConfigVRCtrl.TypeItem.CommonCameraMoveSpeed] = true;
- dictionary[ConfigVRCtrl.TypeItem.CommonCameraRotSpeed] = true;
- dictionary[ConfigVRCtrl.TypeItem.CommonEyeHeight] = true;
- dictionary[ConfigVRCtrl.TypeItem.CommonSitHeight] = true;
- dictionary[ConfigVRCtrl.TypeItem.CommonShowDesktopScreen] = true;
- if (vrdeviceTypeID == GameMain.VRDeviceType.NON)
- {
- dictionary[ConfigVRCtrl.TypeItem.DummyCameraFov] = true;
- dictionary[ConfigVRCtrl.TypeItem.DummyCameraPlaneMovement] = true;
- dictionary[ConfigVRCtrl.TypeItem.DummyMouseRotateInverse] = true;
- dictionary[ConfigVRCtrl.TypeItem.DummyMouseRotateSpeed] = true;
- dictionary[ConfigVRCtrl.TypeItem.DummyShowMan] = true;
- }
- else if (vrdeviceTypeID == GameMain.VRDeviceType.RIFT)
- {
- dictionary[ConfigVRCtrl.TypeItem.HMDOnlyCameraPlaneMovement] = true;
- dictionary[ConfigVRCtrl.TypeItem.HMDOnlyMouseRotateEnable] = true;
- dictionary[ConfigVRCtrl.TypeItem.HMDOnlyMouseRotateSpeed] = true;
- }
- else if (vrdeviceTypeID == GameMain.VRDeviceType.FOVE)
- {
- dictionary[ConfigVRCtrl.TypeItem.HMDOnlyCameraPlaneMovement] = true;
- dictionary[ConfigVRCtrl.TypeItem.HMDOnlyMouseRotateEnable] = true;
- dictionary[ConfigVRCtrl.TypeItem.HMDOnlyMouseRotateSpeed] = true;
- }
- else if (vrdeviceTypeID == GameMain.VRDeviceType.VIVE)
- {
- dictionary[ConfigVRCtrl.TypeItem.ViveFloorHeightType] = true;
- dictionary[ConfigVRCtrl.TypeItem.ViveMoveMode] = true;
- dictionary[ConfigVRCtrl.TypeItem.ViveSnapRotateEnable] = (this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.WARP_DRAW_STEPROT);
- dictionary[ConfigVRCtrl.TypeItem.ViveSnapRotateRate] = (this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.WARP_DRAW_STEPROT);
- dictionary[ConfigVRCtrl.TypeItem.ViveOldRotatePad] = (this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.DIRECTION);
- dictionary[ConfigVRCtrl.TypeItem.ViveOldMovePad] = (this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.DIRECTION);
- dictionary[ConfigVRCtrl.TypeItem.ViveOldMoveRotatePadAriaRate] = (this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.DIRECTION);
- dictionary[ConfigVRCtrl.TypeItem.ViveDDTouchToClick] = false;
- dictionary[ConfigVRCtrl.TypeItem.ViveOvrTabletFrameHideWhenMsgWndVisible] = true;
- dictionary[ConfigVRCtrl.TypeItem.ViveHandCollisionToHair] = true;
- dictionary[ConfigVRCtrl.TypeItem.ViveHandCollisionToSkirt] = true;
- }
- else if (vrdeviceTypeID == GameMain.VRDeviceType.RIFT_TOUCH)
- {
- dictionary[ConfigVRCtrl.TypeItem.TouchMoveMode] = true;
- dictionary[ConfigVRCtrl.TypeItem.TouchSnapRotateEnable] = (this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.WARP_DRAW_STEPROT);
- dictionary[ConfigVRCtrl.TypeItem.TouchSnapRotateRate] = (this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.WARP_DRAW_STEPROT);
- dictionary[ConfigVRCtrl.TypeItem.TouchOldRotateStick] = (this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.DIRECTION);
- dictionary[ConfigVRCtrl.TypeItem.TouchOldMoveStick] = (this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.DIRECTION);
- dictionary[ConfigVRCtrl.TypeItem.TouchDDTouchToClick] = false;
- dictionary[ConfigVRCtrl.TypeItem.TouchOvrTabletFrameHideWhenMsgWndVisible] = true;
- dictionary[ConfigVRCtrl.TypeItem.TouchHandCollisionToHair] = true;
- dictionary[ConfigVRCtrl.TypeItem.TouchHandCollisionToSkirt] = true;
- }
- dictionary[ConfigVRCtrl.TypeItem.DummyShowMan] = false;
- foreach (KeyValuePair<ConfigVRCtrl.TypeItem, bool> keyValuePair in dictionary)
- {
- this.dicItem[keyValuePair.Key].gameObject.SetActive(keyValuePair.Value);
- }
- UIGrid cache = base.cachedObjectDic.GetCache<UIGrid>("Parent Grid");
- cache.Reposition();
- }
- private void SetItemShowFlag(ConfigVRCtrl.TypeItem type, bool isShow)
- {
- if (this.dicItem == null)
- {
- Debug.Log("[ConfigVRCtrl] まだ項目の初期化は行っていません");
- return;
- }
- if (this.dicItem[type].gameObject.activeSelf == isShow)
- {
- return;
- }
- this.dicItem[type].gameObject.SetActive(isShow);
- UIGrid cache = base.cachedObjectDic.GetCache<UIGrid>("Parent Grid");
- cache.Reposition();
- }
- private void LoadConfigData()
- {
- if (this.dicItem == null)
- {
- Debug.Log("[ConfigVRCtrl] まだ項目の初期化は行っていません");
- return;
- }
- foreach (KeyValuePair<ConfigVRCtrl.TypeItem, ConfigVRCtrl.ParentItem> keyValuePair in this.dicItem)
- {
- switch (keyValuePair.Key)
- {
- case ConfigVRCtrl.TypeItem.CommonEyeHeight:
- keyValuePair.Value.Set(this.cmSystem.VRCameraHeightStand);
- break;
- case ConfigVRCtrl.TypeItem.CommonSitHeight:
- keyValuePair.Value.Set(this.cmSystem.VRCameraHeightSit);
- break;
- case ConfigVRCtrl.TypeItem.CommonCameraMoveSpeed:
- keyValuePair.Value.Set(this.cmSystem.VRCameraMoveSpeedKey);
- break;
- case ConfigVRCtrl.TypeItem.CommonCameraRotSpeed:
- keyValuePair.Value.Set(this.cmSystem.VRCameraRotSpeedKey);
- break;
- case ConfigVRCtrl.TypeItem.CommonShowDesktopScreen:
- keyValuePair.Value.Set(GameMain.Instance.BgMgr.isShowDesktopScreen);
- break;
- case ConfigVRCtrl.TypeItem.ViveFloorHeightType:
- keyValuePair.Value.Set(this.cmSystem.OvrCameraHeightType == CMSystem.OVR_CAM_HEIGHT_TYPE.REAL);
- break;
- case ConfigVRCtrl.TypeItem.ViveSnapRotateEnable:
- keyValuePair.Value.Set(this.cmSystem.OvrUseSnapRotate);
- break;
- case ConfigVRCtrl.TypeItem.ViveSnapRotateRate:
- keyValuePair.Value.Set((float)this.cmSystem.OvrUseSnapRotateRate);
- break;
- case ConfigVRCtrl.TypeItem.ViveMoveMode:
- keyValuePair.Value.Set(this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.WARP_DRAW_STEPROT);
- break;
- case ConfigVRCtrl.TypeItem.ViveOldRotatePad:
- keyValuePair.Value.Set(this.cmSystem.SConfig.OvrViveSmoothRotatePadAreaUse);
- break;
- case ConfigVRCtrl.TypeItem.ViveOldMovePad:
- keyValuePair.Value.Set(this.cmSystem.SConfig.OvrViveSmoothupDownPadAreaUse);
- break;
- case ConfigVRCtrl.TypeItem.ViveOldMoveRotatePadAriaRate:
- keyValuePair.Value.Set(this.cmSystem.SConfig.OvrViveSmoothRotatePadAriaRate);
- break;
- case ConfigVRCtrl.TypeItem.ViveDDTouchToClick:
- keyValuePair.Value.Set(this.cmSystem.SConfig.OvrDDTouchToClick);
- break;
- case ConfigVRCtrl.TypeItem.ViveOvrTabletFrameHideWhenMsgWndVisible:
- keyValuePair.Value.Set(this.cmSystem.SConfig.OvrTabletFrameHideWhenMsgWndVisible);
- break;
- case ConfigVRCtrl.TypeItem.ViveHandCollisionToHair:
- keyValuePair.Value.Set(this.cmSystem.SConfig.OvrHandHitToHair);
- break;
- case ConfigVRCtrl.TypeItem.ViveHandCollisionToSkirt:
- if (this.cmSystem.SConfig.OvrHandHitToSkirt == CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT.OFF)
- {
- keyValuePair.Value.Set(0);
- }
- else if (this.cmSystem.SConfig.OvrHandHitToSkirt == CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT.ON)
- {
- keyValuePair.Value.Set(1);
- }
- else
- {
- keyValuePair.Value.Set(2);
- }
- break;
- case ConfigVRCtrl.TypeItem.TouchSnapRotateEnable:
- keyValuePair.Value.Set(this.cmSystem.OvrUseSnapRotate);
- break;
- case ConfigVRCtrl.TypeItem.TouchSnapRotateRate:
- keyValuePair.Value.Set((float)this.cmSystem.OvrUseSnapRotateRate);
- break;
- case ConfigVRCtrl.TypeItem.TouchMoveMode:
- keyValuePair.Value.Set(this.cmSystem.SConfig.OvrMoveType == CMSystem.SerializeConfig.OVR_MOVE_TYPE.WARP_DRAW_STEPROT);
- break;
- case ConfigVRCtrl.TypeItem.TouchOldRotateStick:
- keyValuePair.Value.Set(this.cmSystem.SConfig.OvrRiftGripStickRotate);
- break;
- case ConfigVRCtrl.TypeItem.TouchOldMoveStick:
- keyValuePair.Value.Set(this.cmSystem.SConfig.OvrRiftTriggerStickUpDown);
- break;
- case ConfigVRCtrl.TypeItem.TouchDDTouchToClick:
- keyValuePair.Value.Set(this.cmSystem.SConfig.OvrDDTouchToClick);
- break;
- case ConfigVRCtrl.TypeItem.TouchOvrTabletFrameHideWhenMsgWndVisible:
- keyValuePair.Value.Set(this.cmSystem.SConfig.OvrTabletFrameHideWhenMsgWndVisible);
- break;
- case ConfigVRCtrl.TypeItem.TouchHandCollisionToHair:
- keyValuePair.Value.Set(this.cmSystem.SConfig.OvrHandHitToHair);
- break;
- case ConfigVRCtrl.TypeItem.TouchHandCollisionToSkirt:
- if (this.cmSystem.SConfig.OvrHandHitToSkirt == CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT.OFF)
- {
- keyValuePair.Value.Set(0);
- }
- else if (this.cmSystem.SConfig.OvrHandHitToSkirt == CMSystem.SerializeConfig.OVR_HAND_TO_SKIRT.ON)
- {
- keyValuePair.Value.Set(1);
- }
- else
- {
- keyValuePair.Value.Set(2);
- }
- break;
- case ConfigVRCtrl.TypeItem.HMDOnlyCameraPlaneMovement:
- keyValuePair.Value.Set(this.cmSystem.VRCameraPlaneMove);
- break;
- case ConfigVRCtrl.TypeItem.HMDOnlyMouseRotateEnable:
- keyValuePair.Value.Set(this.cmSystem.OvrMouseRot);
- break;
- case ConfigVRCtrl.TypeItem.HMDOnlyMouseRotateSpeed:
- keyValuePair.Value.Set(this.cmSystem.VRCameraRotSpeedMouse);
- break;
- case ConfigVRCtrl.TypeItem.DummyMouseRotateSpeed:
- keyValuePair.Value.Set(this.cmSystem.VRCameraRotSpeedMouse);
- break;
- case ConfigVRCtrl.TypeItem.DummyMouseRotateInverse:
- keyValuePair.Value.Set(this.cmSystem.VRCamRotDownUp);
- break;
- case ConfigVRCtrl.TypeItem.DummyCameraPlaneMovement:
- keyValuePair.Value.Set(this.cmSystem.VRCameraPlaneMove);
- break;
- case ConfigVRCtrl.TypeItem.DummyShowMan:
- keyValuePair.Value.Set(this.cmSystem.VRManShow);
- break;
- case ConfigVRCtrl.TypeItem.DummyCameraFov:
- keyValuePair.Value.Set(this.cmSystem.VRCameraFov);
- break;
- default:
- Debug.LogError("[ConfigVRCtrl] 種類「" + keyValuePair.Key + "」のセッターがない");
- NDebug.Assert("[ConfigVRCtrl] 種類「" + keyValuePair.Key + "」のセッターがない", false);
- break;
- }
- }
- }
- private void OnApplicationQuit()
- {
- this.m_IsQuittingApplication = true;
- }
- private void OnDestroy()
- {
- if (this.m_IsQuittingApplication)
- {
- return;
- }
- if (ConfigVRCtrl.instance != null && ConfigVRCtrl.instance == this)
- {
- ConfigVRCtrl.m_Instance = null;
- }
- if (this.dicItem != null)
- {
- this.dicItem.Clear();
- this.dicItem = null;
- }
- this.onClickOK = null;
- }
- private static ConfigVRCtrl m_Instance;
- private static readonly Vector2 COMMON_EYE_HEIGHT_VALUE = new Vector2(1.5f, 1.8f);
- private static readonly Vector2 COMMON_SITTING_HEIGHT_VALUE = new Vector2(0.7f, 1f);
- private static readonly Vector2 COMMON_CAMERA_MOVE_VALUE = new Vector2(0f, 1f);
- private static readonly Vector2 COMMON_CAMERA_ROT_VALUE = new Vector2(0f, 1f);
- private static readonly Vector2 VR_CAMERA_SNAP_ROT_VALUE = new Vector2(10f, 80f);
- private static readonly Vector2 VR_CAMERA_MOUSE_ROT_VALUE = new Vector2(0f, 1f);
- private static readonly Vector2 VR2D_CAMERA_FOV_VALUE = new Vector2(30f, 60f);
- private Dictionary<ConfigVRCtrl.TypeItem, ConfigVRCtrl.ParentItem> m_DicItem;
- private bool m_IsQuittingApplication;
- private abstract class ParentItem : MonoBehaviour
- {
- public UILabel label
- {
- get
- {
- return this.m_Label;
- }
- }
- protected virtual void Awake()
- {
- this.m_Label = UTY.GetChildObject(base.gameObject, "name", false).GetComponent<UILabel>();
- if (this.m_Label == null)
- {
- string message = "[ConfigVRCtrl] " + base.gameObject.name + "/nameに、\nUILabel のコンポーネントがありませんでした";
- NDebug.Assert(message, false);
- Debug.LogError(message);
- }
- }
- public abstract void Set(object value);
- private UILabel m_Label;
- }
- private class ParentSlider : ConfigVRCtrl.ParentItem
- {
- public UISlider slider
- {
- get
- {
- return this.m_Slider;
- }
- private set
- {
- this.m_Slider = value;
- }
- }
- public float normalizedValue
- {
- get
- {
- return this.slider.value;
- }
- set
- {
- this.slider.value = value;
- }
- }
- public float min
- {
- get
- {
- return this.m_Min;
- }
- set
- {
- this.m_Min = value;
- }
- }
- public float max
- {
- get
- {
- return this.m_Max;
- }
- set
- {
- this.m_Max = value;
- }
- }
- public float value
- {
- get
- {
- return Mathf.Lerp(this.min, this.max, this.normalizedValue);
- }
- set
- {
- this.normalizedValue = Mathf.InverseLerp(this.min, this.max, value);
- }
- }
- public Action<float> onValueChanged { get; set; }
- public Action onDragFinished { get; set; }
- protected override void Awake()
- {
- base.Awake();
- GameObject childObject = UTY.GetChildObject(base.gameObject, "slider", false);
- this.slider = childObject.GetComponent<UISlider>();
- if (this.slider == null)
- {
- string message = string.Concat(new string[]
- {
- "[ConfigVRCtrl] ",
- base.gameObject.name,
- "/",
- childObject.name,
- "に、\nUISlider のコンポーネントがありませんでした"
- });
- NDebug.Assert(message, false);
- Debug.LogError(message);
- }
- EventDelegate.Add(this.slider.onChange, delegate()
- {
- if (this.onValueChanged != null)
- {
- this.onValueChanged(this.value);
- }
- });
- UISlider slider = this.slider;
- slider.onDragFinished = (UIProgressBar.OnDragFinished)Delegate.Combine(slider.onDragFinished, new UIProgressBar.OnDragFinished(delegate()
- {
- if (this.onDragFinished != null)
- {
- this.onDragFinished();
- }
- }));
- }
- public override void Set(object value)
- {
- this.value = (float)value;
- }
- private UISlider m_Slider;
- private float m_Min;
- private float m_Max = 1f;
- }
- private class ParentButton : ConfigVRCtrl.ParentItem
- {
- public UIButton buttonRight
- {
- get
- {
- return this.m_ButtonRight;
- }
- private set
- {
- this.m_ButtonRight = value;
- }
- }
- public UIButton buttonLeft
- {
- get
- {
- return this.m_ButtonLeft;
- }
- private set
- {
- this.m_ButtonLeft = value;
- }
- }
- public Action<bool> onClickIsLeft { get; set; }
- protected override void Awake()
- {
- base.Awake();
- GameObject childObject = UTY.GetChildObject(base.gameObject, "button right", false);
- this.buttonRight = childObject.GetComponent<UIButton>();
- if (this.buttonRight == null)
- {
- string message = string.Concat(new string[]
- {
- "[ConfigVRCtrl] ",
- base.gameObject.name,
- "/",
- childObject.name,
- "に、\nUIButton のコンポーネントがありませんでした"
- });
- NDebug.Assert(message, false);
- Debug.LogError(message);
- }
- childObject = UTY.GetChildObject(base.gameObject, "button left", false);
- this.buttonLeft = childObject.GetComponent<UIButton>();
- if (this.buttonLeft == null)
- {
- string message2 = string.Concat(new string[]
- {
- "[ConfigVRCtrl] ",
- base.gameObject.name,
- "/",
- childObject.name,
- "に、\nUIButton のコンポーネントがありませんでした"
- });
- NDebug.Assert(message2, false);
- Debug.LogError(message2);
- }
- EventDelegate.Add(this.buttonRight.onClick, delegate()
- {
- if (this.onClickIsLeft != null)
- {
- this.onClickIsLeft(false);
- }
- this.OnClickButton(false);
- });
- EventDelegate.Add(this.buttonLeft.onClick, delegate()
- {
- if (this.onClickIsLeft != null)
- {
- this.onClickIsLeft(true);
- }
- this.OnClickButton(true);
- });
- }
- private void OnClickButton(bool isLeft)
- {
- this.buttonLeft.defaultColor = ((!isLeft) ? ConfigVRCtrl.ParentButton.ButtonDefaultColor : ConfigVRCtrl.ParentButton.ButtonClickedColor);
- this.buttonRight.defaultColor = (isLeft ? ConfigVRCtrl.ParentButton.ButtonDefaultColor : ConfigVRCtrl.ParentButton.ButtonClickedColor);
- }
- public void Emulate(bool isLeft)
- {
- UIButton uibutton = (!isLeft) ? this.buttonRight : this.buttonLeft;
- EventDelegate.Execute(uibutton.onClick);
- }
- public override void Set(object value)
- {
- this.Emulate((bool)value);
- }
- private static Color ButtonDefaultColor = new Color(1f, 1f, 1f, 0.5f);
- private static Color ButtonClickedColor = Color.white;
- private UIButton m_ButtonRight;
- private UIButton m_ButtonLeft;
- }
- private class ParentMultiButton : ConfigVRCtrl.ParentItem
- {
- public UIButton buttonRight
- {
- get
- {
- return this.m_ButtonRight;
- }
- private set
- {
- this.m_ButtonRight = value;
- }
- }
- public UIButton buttonLeft
- {
- get
- {
- return this.m_ButtonLeft;
- }
- private set
- {
- this.m_ButtonLeft = value;
- }
- }
- public UIButton buttonCenter
- {
- get
- {
- return this.m_ButtonCenter;
- }
- private set
- {
- this.m_ButtonCenter = value;
- }
- }
- public Action<int> onClick { get; set; }
- protected override void Awake()
- {
- base.Awake();
- GameObject childObject = UTY.GetChildObject(base.gameObject, "button right", false);
- this.buttonRight = childObject.GetComponent<UIButton>();
- if (this.buttonRight == null)
- {
- string message = string.Concat(new string[]
- {
- "[ConfigVRCtrl] ",
- base.gameObject.name,
- "/",
- childObject.name,
- "に、\nUIButton のコンポーネントがありませんでした"
- });
- NDebug.Assert(message, false);
- Debug.LogError(message);
- }
- childObject = UTY.GetChildObject(base.gameObject, "button left", false);
- this.buttonLeft = childObject.GetComponent<UIButton>();
- if (this.buttonLeft == null)
- {
- string message2 = string.Concat(new string[]
- {
- "[ConfigVRCtrl] ",
- base.gameObject.name,
- "/",
- childObject.name,
- "に、\nUIButton のコンポーネントがありませんでした"
- });
- NDebug.Assert(message2, false);
- Debug.LogError(message2);
- }
- childObject = UTY.GetChildObject(base.gameObject, "button center", false);
- this.buttonCenter = childObject.GetComponent<UIButton>();
- if (this.buttonCenter == null)
- {
- string message3 = string.Concat(new string[]
- {
- "[ConfigVRCtrl] ",
- base.gameObject.name,
- "/",
- childObject.name,
- "に、\nUIButton のコンポーネントがありませんでした"
- });
- NDebug.Assert(message3, false);
- Debug.LogError(message3);
- }
- EventDelegate.Add(this.buttonRight.onClick, delegate()
- {
- if (this.onClick != null)
- {
- this.onClick(0);
- }
- this.OnClickButton(0);
- });
- EventDelegate.Add(this.buttonLeft.onClick, delegate()
- {
- if (this.onClick != null)
- {
- this.onClick(1);
- }
- this.OnClickButton(1);
- });
- EventDelegate.Add(this.buttonCenter.onClick, delegate()
- {
- if (this.onClick != null)
- {
- this.onClick(2);
- }
- this.OnClickButton(2);
- });
- }
- private void OnClickButton(int index)
- {
- this.buttonRight.defaultColor = ((index != 0) ? ConfigVRCtrl.ParentMultiButton.ButtonDefaultColor : ConfigVRCtrl.ParentMultiButton.ButtonClickedColor);
- this.buttonLeft.defaultColor = ((index != 1) ? ConfigVRCtrl.ParentMultiButton.ButtonDefaultColor : ConfigVRCtrl.ParentMultiButton.ButtonClickedColor);
- this.buttonCenter.defaultColor = ((index != 2) ? ConfigVRCtrl.ParentMultiButton.ButtonDefaultColor : ConfigVRCtrl.ParentMultiButton.ButtonClickedColor);
- }
- public void Emulate(int index)
- {
- UIButton uibutton;
- if (index == 0)
- {
- uibutton = this.buttonRight;
- }
- else if (index == 1)
- {
- uibutton = this.buttonLeft;
- }
- else
- {
- uibutton = this.buttonCenter;
- }
- EventDelegate.Execute(uibutton.onClick);
- }
- public override void Set(object value)
- {
- this.Emulate((int)value);
- }
- private static Color ButtonDefaultColor = new Color(1f, 1f, 1f, 0.5f);
- private static Color ButtonClickedColor = Color.white;
- private UIButton m_ButtonRight;
- private UIButton m_ButtonLeft;
- private UIButton m_ButtonCenter;
- }
- private enum TypeItem
- {
- CommonEyeHeight,
- CommonSitHeight,
- CommonCameraMoveSpeed,
- CommonCameraRotSpeed,
- CommonShowDesktopScreen,
- ViveFloorHeightType,
- ViveSnapRotateEnable,
- ViveSnapRotateRate,
- ViveMoveMode,
- ViveOldRotatePad,
- ViveOldMovePad,
- ViveOldMoveRotatePadAriaRate,
- ViveDDTouchToClick,
- ViveOvrTabletFrameHideWhenMsgWndVisible,
- ViveHandCollisionToHair,
- ViveHandCollisionToSkirt,
- TouchSnapRotateEnable,
- TouchSnapRotateRate,
- TouchMoveMode,
- TouchOldRotateStick,
- TouchOldMoveStick,
- TouchDDTouchToClick,
- TouchOvrTabletFrameHideWhenMsgWndVisible,
- TouchHandCollisionToHair,
- TouchHandCollisionToSkirt,
- HMDOnlyCameraPlaneMovement,
- HMDOnlyMouseRotateEnable,
- HMDOnlyMouseRotateSpeed,
- DummyMouseRotateSpeed,
- DummyMouseRotateInverse,
- DummyCameraPlaneMovement,
- DummyShowMan,
- DummyCameraFov
- }
- }
|