using SC.XR.Unity; using SC.XR.Unity.Module_InputSystem; using SC.XR.Unity.Module_InputSystem.InputDeviceHand; using UnityEngine; public class Module_DockPanel : MonoBehaviour { bool _isProfileOn=false; bool _isBoundingBoxOn=false; bool _isHandJointOn=false; bool _isPinOn=true; bool _isBoundingBoxOntemp = false; HandModelType _tempModelType; int _HandJointIndex = 0; public Renderer[] _Backplates; Material _HandIcon; Texture2D _HandMeshTex; Texture2D _HandJointTex; Follower _follower; GameObject _performanceSamplerObj; // Start is called before the first frame update void Start() { InitState(); } private void Update() { DeterBoundingbox(); } void InitState() { _follower = GetComponent(); _isPinOn = _follower.StopFollower; _Backplates[3].enabled = !_isPinOn; _isBoundingBoxOn = API_Module_AddBorder.IsEnableFunc(); _Backplates[1].enabled = _isBoundingBoxOn; _HandIcon = Resources.Load("Materials/HandJoint") as Material; _HandMeshTex = Resources.Load("Textures/IconHandMesh") as Texture2D; _HandJointTex = Resources.Load("Textures/IconHandJoint") as Texture2D; if (API_Module_SDKConfiguration.HasKey("Module_InputSystem", "HandModelType")) { System.Enum.TryParse(API_Module_SDKConfiguration.GetString("Module_InputSystem", "HandModelType", "EffectHand"), false, out _tempModelType); } if (API_Module_SDKConfiguration.HasKey("Module_InputSystem", "ActiveGGT26Dof")) { _isHandJointOn = API_Module_SDKConfiguration.GetBool("Module_InputSystem", "ActiveGGT26Dof", 0); } if (_isHandJointOn) { _HandJointIndex = 1; _Backplates[2].enabled = _isHandJointOn; } if (_tempModelType==HandModelType.CubeHand) { _HandIcon.SetTexture("_MainTex", _HandJointTex); } else { _HandIcon.SetTexture("_MainTex", _HandMeshTex); } } public void ToggleHandJoint() { _HandJointIndex++; if (_HandJointIndex==1|| _HandJointIndex == 3) { _isHandJointOn = !_isHandJointOn; if (_isHandJointOn) { API_GSXR_Module_InputSystem.GSXR_Enable_InputDevice(InputDeviceType.GGT26Dof); } else { _HandJointIndex = 0; API_GSXR_Module_InputSystem.GSXR_Disable_InputDevice(InputDeviceType.GGT26Dof); } _Backplates[2].enabled = _isHandJointOn; } else if (_HandJointIndex==2) { if (_tempModelType == HandModelType.CubeHand) { _HandIcon.SetTexture("_MainTex", _HandMeshTex); _tempModelType = HandModelType.EffectHand; if (API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTLeft.inputDeviceGGT26DofPartUI.modelGGT26Dof.gameObject.activeSelf) { API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTLeft.inputDeviceGGT26DofPartUI.modelGGT26Dof.HandModelChange(HandModelType.EffectHand); } if (API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDeviceGGT26DofPartUI.modelGGT26Dof.gameObject.activeSelf) { API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDeviceGGT26DofPartUI.modelGGT26Dof.HandModelChange(HandModelType.EffectHand); } } else { _HandIcon.SetTexture("_MainTex", _HandJointTex); _tempModelType = HandModelType.CubeHand; if (API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTLeft.inputDeviceGGT26DofPartUI.modelGGT26Dof.gameObject.activeSelf) { API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTLeft.inputDeviceGGT26DofPartUI.modelGGT26Dof.HandModelChange(HandModelType.CubeHand); } if (API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDeviceGGT26DofPartUI.modelGGT26Dof.gameObject.activeSelf) { API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight.inputDeviceGGT26DofPartUI.modelGGT26Dof.HandModelChange(HandModelType.CubeHand); } } } } void DeterBoundingbox() { _isBoundingBoxOntemp = API_Module_AddBorder.IsEnableFunc(); if (_isBoundingBoxOn!= _isBoundingBoxOntemp) { _isBoundingBoxOn = _isBoundingBoxOntemp; _Backplates[1].enabled = _isBoundingBoxOn; } } public void ToggleBoundingBox() { _isBoundingBoxOn = !_isBoundingBoxOn; _Backplates[1].enabled = _isBoundingBoxOn; if (_isBoundingBoxOn) { API_Module_AddBorder.OpenFunc(); } else { API_Module_AddBorder.CloseFunc(); } } public void TogglePin() { _isPinOn = !_isPinOn; _Backplates[3].enabled = !_isPinOn; _follower.StopFollower = _isPinOn; } public void ToggleProfile() { _isProfileOn = !_isProfileOn; ProfileController(); } void ProfileController() { if (_isProfileOn) { if (_performanceSamplerObj == null) { _performanceSamplerObj = Instantiate(Resources.Load("UIPrefabs/PerformanceSampler")); } else { _performanceSamplerObj.SetActive(true); } _Backplates[0].enabled = true; } else { _performanceSamplerObj.SetActive(false); _Backplates[0].enabled=false; } } }