void OnStateDataChanged(UIStateData data) { m_DialogButtonImage.enabled = data.activeDialog == DialogType.CameraOptions; m_DialogButton.interactable = data.toolbarsEnabled; if (m_CurrentCameraOptionData != data.cameraOptionData) { int cameraProjectionTypeIndex = 0; switch (data.cameraOptionData.cameraProjectionType) { case CameraProjectionType.Perspective: cameraProjectionTypeIndex = 0; break; case CameraProjectionType.Orthographic: cameraProjectionTypeIndex = 1; break; } m_CameraTypeDropdown.SetValueWithoutNotify(cameraProjectionTypeIndex); int cameraViewTypeIndex = 0; switch (data.cameraOptionData.cameraViewType) { case CameraViewType.Default: cameraViewTypeIndex = -1; break; case CameraViewType.Top: cameraViewTypeIndex = 0; break; case CameraViewType.Left: cameraViewTypeIndex = 1; break; case CameraViewType.Right: cameraViewTypeIndex = 2; break; } if (cameraViewTypeIndex != -1) { m_CameraViewDropdown.SetValueWithoutNotify(cameraViewTypeIndex); } m_JoysticksToggle.on = data.cameraOptionData.enableJoysticks; var joystickPreferenceIndex = data.cameraOptionData.joystickPreference == JoystickPreference.RightHanded ? 0 : 1; m_JoystickPreferenceSwitch.activePropertyIndex = joystickPreferenceIndex; m_NavigationAutoToggle.on = data.cameraOptionData.enableAutoNavigationSpeed; m_NavigationSpeedControl.SetValue(data.cameraOptionData.navigationSpeed); m_CurrentCameraOptionData = data.cameraOptionData; } }
#pragma warning restore 0649 void Start() { DrawCustomGizmos(); m_CameraOptionData = UIStateManager.current.stateData.cameraOptionData; }