コード例 #1
0
        protected virtual void Start()
        {
            m_parentDialog = GetComponentInParent <Dialog>();
            if (m_parentDialog != null)
            {
                m_parentDialog.IsOkVisible     = false;
                m_parentDialog.IsCancelVisible = true;
                m_parentDialog.CancelText      = m_localization.GetString("ID_RTEditor_SettingsDialog_Close", "Close");
            }

            if (m_uiSettingsHeader != null)
            {
                m_uiSettingsHeader.Init(null, null, null, null, m_localization.GetString("ID_RTEditor_SettingsDialog_UISettings", "UI Settings"));
            }

            if (m_sceneSettingsHeader != null)
            {
                m_sceneSettingsHeader.Init(null, null, null, null, m_localization.GetString("ID_RTEditor_SettingsDialog_SceneSettings", "Scene Settings"));
            }

            if (m_sceneNavigationSettingsHeader != null)
            {
                m_sceneNavigationSettingsHeader.Init(null, null, null, null, m_localization.GetString("ID_RTEditor_SettingsDialog_SceneNavigationSettings", "Scene Navigation Settings"));
            }

            if (m_measurementHeader != null)
            {
                m_measurementHeader.Init(null, null, null, null, m_localization.GetString("ID_RTEditor_SettingsDialog_MeasurementSettings", "Measurement Settings"));
            }

            if (m_isGridVisibleEditor != null)
            {
                m_isGridVisibleEditor.Init(m_settings, m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.IsGridVisible), null, m_localization.GetString("ID_RTEditor_SettingsDialog_IsGridVisible", "Is Grid Visible"));
            }

            if (m_gridOpacityEditor != null)
            {
                m_gridOpacityEditor.Init(m_settings, m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.GridOpacity), null, m_localization.GetString("ID_RTEditor_SettingsDialog_GridOpacity", "Grid Opacity"));
            }

            if (m_gridZTest != null)
            {
                m_gridZTest.Init(m_settings, m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.GridZTest), null, m_localization.GetString("ID_RTEditor_SettingsDialog_GridZTest", "Grid Z Test"));
            }

            if (m_snapToGridEditor != null)
            {
                m_snapToGridEditor.Init(m_settings, m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.IsGridEnabled), null, m_localization.GetString("ID_RTEditor_SettingsDialog_SnapToGrid", "Snap To Grid"));
            }

            if (m_gridSizeEditor != null)
            {
                m_gridSizeEditor.Min = 0.1f;
                m_gridSizeEditor.Max = 8;
                m_gridSizeEditor.Init(m_settings, m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.GridSize), null, m_localization.GetString("ID_RTEditor_SettingsDialog_GridSize", "Grid Size"));
            }

            if (m_uiAutoScaleEditor != null)
            {
                m_uiAutoScaleEditor.Init(this, this, Strong.PropertyInfo((SettingsDialog x) => x.UIAutoScale), null, m_localization.GetString("ID_RTEditor_SettingsDialog_UIAutoScale", "UI Auto Scale"));
            }

            if (m_uiScaleEditor != null)
            {
                m_uiScaleEditor.Min = 0.5f;
                m_uiScaleEditor.Max = 3;
                m_uiScaleEditor.Init(m_settings, m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.UIScale), null, m_localization.GetString("ID_RTEditor_SettingsDialog_UIScale", "UI Scale"),
                                     () => { },
                                     () => { },
                                     () =>
                {
                    m_settings.EndEditUIScale();
                    if (m_parentDialog != null)
                    {
                        StartCoroutine(CoEndEditUIScale());
                    }
                });
                if (UIAutoScale)
                {
                    m_uiScaleEditor.gameObject.SetActive(false);
                }
            }

            if (m_freeMovementSmoothSpeedEditor != null)
            {
                m_freeMovementSmoothSpeedEditor.Min = 1.0f;
                m_freeMovementSmoothSpeedEditor.Max = 100.0f;
                m_freeMovementSmoothSpeedEditor.Init(m_settings, m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.FreeMovementSmoothSpeed), null, m_localization.GetString("ID_RTEditor_SettingsDialog_FreeMovementSmoothSpeed", "Movement Smooth Speed"));
            }

            if (m_freeRotationSmoothSpeedEditor != null)
            {
                m_freeRotationSmoothSpeedEditor.Min = 1.0f;
                m_freeRotationSmoothSpeedEditor.Max = 100.0f;
                m_freeRotationSmoothSpeedEditor.Init(m_settings, m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.FreeRotationSmoothSpeed), null, m_localization.GetString("ID_RTEditor_SettingsDialog_FreeRotationSmoothSpeed", "Rotation Smooth Speed"));
            }

            if (m_rotationInvertXEditor != null)
            {
                m_rotationInvertXEditor.Init(m_settings, m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.RotationInvertX), null, m_localization.GetString("ID_RTEditor_SettingsDialog_RotationInvertX", "Rotation Invert X"));
            }

            if (m_rotationInvertYEditor != null)
            {
                m_rotationInvertYEditor.Init(m_settings, m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.RotationInvertY), null, m_localization.GetString("ID_RTEditor_SettingsDialog_RotationInvertY", "Rotation Invert Y"));
            }

            if (m_zoomSpeedEditor != null)
            {
                m_zoomSpeedEditor.Min = 1.0f;
                m_zoomSpeedEditor.Max = 100.0f;
                m_zoomSpeedEditor.Init(m_settings, m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.ZoomSpeed), null, m_localization.GetString("ID_RTEditor_SettingsDialog_ZoomSpeed", "Zoom Speed"));
            }

            if (m_constantZoomSpeedEditor != null)
            {
                m_constantZoomSpeedEditor.Init(m_settings, m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.ConstantZoomSpeed), null, m_localization.GetString("ID_RTEditor_SettingsDialog_ConstantZoomSpeed", "Constant Zoom Speed"));
            }

            if (m_measurementSystemEditor != null)
            {
                m_measurementSystemEditor.Init(m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.SystemOfMeasurement), m_localization.GetString("ID_RTEditor_SettingsDialog_SystemOfMeasurement", "System Of Measurement"));
            }

            if (m_graphicsHeader != null)
            {
                m_graphicsHeader.gameObject.SetActive(RenderPipelineInfo.Type != RPType.Standard);
                m_graphicsHeader.Init(null, null, null, null, m_localization.GetString("ID_RTEditor_SettingsDialog_GraphicsSettings", "Graphics Settings"));
            }

            if (m_graphicsQualityEditor != null)
            {
                m_graphicsQualityEditor.gameObject.SetActive(RenderPipelineInfo.Type != RPType.Standard);
                m_graphicsQualityEditor.Init(m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.GraphicsQuality), m_localization.GetString("ID_RTEditor_SettingsDialog_GraphicsQuality", "Quality"));
            }

            if (m_lightSettingsHeader != null)
            {
                m_lightSettingsHeader.Init(null, null, null, null, m_localization.GetString("ID_RTEditor_SettingsDialog_DefaultLightSettings", "Default Light Settings"));
            }

            if (m_lightColorEditor != null)
            {
                m_lightColorEditor.Init(m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.LightColor), m_localization.GetString("ID_RTEditor_SettingsDialog_LightColor", "Light Color"));
            }

            if (m_lightIntensityEditor != null)
            {
                m_lightIntensityEditor.Init(m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.LightIntensity), m_localization.GetString("ID_RTEditor_SettingsDialog_LightIntensity", "Light Intensity"));
            }

            if (m_shadowTypeEditor != null)
            {
                m_shadowTypeEditor.Init(m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.ShadowType), m_localization.GetString("ID_RTEditor_SettingsDialog_ShadowType", "Shadow Type"));
            }

            if (m_shadowStrengthEditor != null)
            {
                m_shadowStrengthEditor.Min = 0;
                m_shadowStrengthEditor.Max = 1;
                m_shadowStrengthEditor.Init(m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.ShadowStrength), m_localization.GetString("ID_RTEditor_SettingsDialog_ShadowStrenth", "Shadow Strength"));
            }

            m_customSettings.Clear();
            for (int i = 0; i < m_settings.CustomSettings.Count; ++i)
            {
                GameObject prefab = m_settings.CustomSettings[i];
                if (prefab != null)
                {
                    GameObject customSettings = Instantiate(prefab);
                    customSettings.transform.SetParent(m_panel, false);
                    customSettings.transform.SetSiblingIndex(m_panel.childCount - 2);
                    m_customSettings.Add(customSettings);
                }
            }

            UnityEventHelper.AddListener(m_resetButton, btn => btn.onClick, OnResetClick);
        }
コード例 #2
0
        protected virtual void Start()
        {
            m_parentDialog = GetComponentInParent <Dialog>();
            if (m_parentDialog != null)
            {
                m_parentDialog.IsOkVisible     = true;
                m_parentDialog.OkText          = m_localization.GetString("ID_RTEditor_SettingsDialog_Reset", "Reset");
                m_parentDialog.Ok             += OnResetClick;
                m_parentDialog.IsCancelVisible = true;
                m_parentDialog.CancelText      = m_localization.GetString("ID_RTEditor_SettingsDialog_Cancel", "Cancel");
            }

            if (m_uiSettingsHeader != null)
            {
                m_uiSettingsHeader.Init(null, null, null, null, m_localization.GetString("ID_RTEditor_SettingsDialog_UISettings", "UI Settings"));
            }

            if (m_sceneSettingsHeader != null)
            {
                m_sceneSettingsHeader.Init(null, null, null, null, m_localization.GetString("ID_RTEditor_SettingsDialog_SceneSettings", "Scene Settings"));
            }

            if (m_sceneNavigationSettingsHeader != null)
            {
                m_sceneNavigationSettingsHeader.Init(null, null, null, null, m_localization.GetString("ID_RTEditor_SettingsDialog_SceneNavigationSettings", "Scene Navigation Settings"));
            }

            if (m_isGridVisibleEditor != null)
            {
                m_isGridVisibleEditor.Init(m_settings, m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.IsGridVisible), null, m_localization.GetString("ID_RTEditor_SettingsDialog_IsGridVisible", "Is Grid Visible"));
            }

            if (m_gridZTest != null)
            {
                m_gridZTest.Init(m_settings, m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.GridZTest), null, m_localization.GetString("ID_RTEditor_SettingsDialog_GridZTest", "Grid Z Test"));
            }

            if (m_snapToGridEditor != null)
            {
                m_snapToGridEditor.Init(m_settings, m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.IsGridEnabled), null, m_localization.GetString("ID_RTEditor_SettingsDialog_SnapToGrid", "Snap To Grid"));
            }

            if (m_gridSizeEditor != null)
            {
                m_gridSizeEditor.Min = 0.1f;
                m_gridSizeEditor.Max = 8;
                m_gridSizeEditor.Init(m_settings, m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.GridSize), null, m_localization.GetString("ID_RTEditor_SettingsDialog_GridSize", "Grid Size"));
            }

            if (m_uiAutoScaleEditor != null)
            {
                m_uiAutoScaleEditor.Init(this, this, Strong.PropertyInfo((SettingsDialog x) => x.UIAutoScale), null, m_localization.GetString("ID_RTEditor_SettingsDialog_UIAutoScale", "UI Auto Scale"));
            }

            if (m_uiScaleEditor != null)
            {
                m_uiScaleEditor.Min = 0.5f;
                m_uiScaleEditor.Max = 3;
                m_uiScaleEditor.Init(m_settings, m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.UIScale), null, m_localization.GetString("ID_RTEditor_SettingsDialog_UIScale", "UI Scale"),
                                     () => { },
                                     () => { },
                                     () =>
                {
                    m_settings.EndEditUIScale();
                    if (m_parentDialog != null)
                    {
                        StartCoroutine(CoEndEditUIScale());
                    }
                });
                if (UIAutoScale)
                {
                    m_uiScaleEditor.gameObject.SetActive(false);
                }
            }

            if (m_zoomSpeedEditor != null)
            {
                m_zoomSpeedEditor.Min = 1.0f;
                m_zoomSpeedEditor.Max = 100.0f;
                m_zoomSpeedEditor.Init(m_settings, m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.ZoomSpeed), null, m_localization.GetString("ID_RTEditor_SettingsDialog_ZoomSpeed", "Zoom Speed"));
            }

            if (m_constantZoomSpeedEditor != null)
            {
                m_constantZoomSpeedEditor.Init(m_settings, m_settings, Strong.PropertyInfo((ISettingsComponent x) => x.ConstantZoomSpeed), null, m_localization.GetString("ID_RTEditor_SettingsDialog_ConstantZoomSpeed", "Constant Zoom Speed"));
            }
        }