コード例 #1
0
        private void UpdateScale(int newScale)
        {
            m_Scale = newScale;
            m_ScaleValueLabel.text = newScale.ToString();
            m_ScaleSlider.SetValueWithoutNotify(newScale);

            OnStateChanged();
        }
コード例 #2
0
        void RefreshSubFields()
        {
            var intNewValue = (int)(value * 100);

            mSlider.SetValueWithoutNotify(intNewValue);
            if (mSlider.elementPanel != null)
            {
                mSlider.OnViewDataReady(); // Hack to force update the slide handle position.
            }
            mField.SetValueWithoutNotify(intNewValue);
        }
コード例 #3
0
ファイル: MixtureSettingsView.cs プロジェクト: jjmac/Mixture
        public void RefreshSettingsValues()
        {
            outputSizeMode?.SetValueWithoutNotify(settings.sizeMode);
            outputDimension?.SetValueWithoutNotify(settings.dimension);
            outputChannels?.SetValueWithoutNotify(settings.outputChannels);
            outputPrecision?.SetValueWithoutNotify(settings.outputPrecision);
            wrapMode?.SetValueWithoutNotify(settings.wrapMode);
            filterMode?.SetValueWithoutNotify(settings.filterMode);
            potSize?.SetValueWithoutNotify(settings.potSize);

            outputWidth?.SetValueWithoutNotify(settings.width);
            outputWidthScale?.SetValueWithoutNotify(SizeScaleToInt(settings.widthScale));
            outputHeight?.SetValueWithoutNotify(settings.height);
            outputHeightScale?.SetValueWithoutNotify(SizeScaleToInt(settings.heightScale));
            outputDepth?.SetValueWithoutNotify(settings.depth);
            outputDepthScale?.SetValueWithoutNotify(SizeScaleToInt(settings.depthScale));

            doubleBuffered?.SetValueWithoutNotify(settings.doubleBuffered);

            refreshMode?.SetValueWithoutNotify(settings.refreshMode);
            period?.SetValueWithoutNotify(settings.period);
        }
コード例 #4
0
        private void Init(SimulatorJsonSerialization states)
        {
            InitPlayerSettings(states);

            bool overrideDefaultPlayerSettings = (states != null) ? states.overrideDefaultPlayerSettings : false;

            m_OverrideDefaultPlayerSettings = m_RootElement.Q <Toggle>("override-default-player-settings");
            m_OverrideDefaultPlayerSettings.RegisterValueChangedCallback(SetOverridePlayerSettings);
            m_OverrideDefaultPlayerSettings.SetValueWithoutNotify(overrideDefaultPlayerSettings);
            UpdateOverridePlayerSettingsStatus();

            m_CustomizedPlayerSettingsElement = m_RootElement.Q <VisualElement>("customized-player-settings");

            m_StartInFullscreen = m_RootElement.Q <Toggle>("android-start-in-fullscreen");
            m_StartInFullscreen.SetValueWithoutNotify(m_CustomizedPlayerSettings.androidStartInFullscreen);
            m_StartInFullscreen.RegisterValueChangedCallback((evt) => { m_CustomizedPlayerSettings.androidStartInFullscreen = evt.newValue; });

            m_ResolutionScalingMode = m_RootElement.Q <EnumField>("resolution-scaling-mode");
            m_ResolutionScalingMode.Init(ResolutionScalingMode.Disabled);
            m_ResolutionScalingMode.RegisterValueChangedCallback(SetResolutionScalingMode);
            m_ResolutionScalingMode.SetValueWithoutNotify(m_CustomizedPlayerSettings.resolutionScalingMode);

            #region DPI
            m_DpiContainer = m_RootElement.Q <VisualElement>("dpi-container");

            m_DpiSlider = m_DpiContainer.Q <SliderInt>("dpi-slider");
            m_DpiSlider.RegisterValueChangedCallback(SyncDpiField);
            m_DpiSlider.SetValueWithoutNotify(m_CustomizedPlayerSettings.targetDpi);

            m_DpiField = m_DpiContainer.Q <IntegerField>("dpi-field");
            m_DpiField.RegisterValueChangedCallback(SyncDpiSlider);
            m_DpiField.RegisterCallback <KeyDownEvent>(OnDpiFieldKeyDown);
            m_DpiField.SetValueWithoutNotify(m_CustomizedPlayerSettings.targetDpi);
            #endregion

            #region Orientation
            m_DefaultOrientation = m_RootElement.Q <EnumField>("default-screen-orientation");
            m_DefaultOrientation.Init(UIOrientation.AutoRotation);
            m_DefaultOrientation.RegisterValueChangedCallback(SetDefaultOrientation);
            m_DefaultOrientation.SetValueWithoutNotify(m_CustomizedPlayerSettings.defaultOrientation);

            m_AllowedOrienations = m_RootElement.Q <Foldout>("allowed-orientations");

            m_AllowedPortrait = m_AllowedOrienations.Q <Toggle>("orientation-allow-portrait");
            m_AllowedPortrait.SetValueWithoutNotify(m_CustomizedPlayerSettings.allowedPortrait);
            m_AllowedPortrait.RegisterValueChangedCallback((evt) => { m_CustomizedPlayerSettings.allowedPortrait = evt.newValue; });

            m_AllowedPortraitUpsideDown = m_AllowedOrienations.Q <Toggle>("orientation-allow-portrait-upside-down");
            m_AllowedPortraitUpsideDown.SetValueWithoutNotify(m_CustomizedPlayerSettings.allowedPortraitUpsideDown);
            m_AllowedPortraitUpsideDown.RegisterValueChangedCallback((evt) => { m_CustomizedPlayerSettings.allowedPortraitUpsideDown = evt.newValue; });

            m_AllowedLandscapeLeft = m_AllowedOrienations.Q <Toggle>("orientation-allow-landscape-left");
            m_AllowedLandscapeLeft.SetValueWithoutNotify(m_CustomizedPlayerSettings.allowedLandscapeLeft);
            m_AllowedLandscapeLeft.RegisterValueChangedCallback((evt) => { m_CustomizedPlayerSettings.allowedLandscapeLeft = evt.newValue; });

            m_AllowedLandscapeRight = m_AllowedOrienations.Q <Toggle>("orientation-allow-landscape-right");
            m_AllowedLandscapeRight.SetValueWithoutNotify(m_CustomizedPlayerSettings.allowedLandscapeRight);
            m_AllowedLandscapeRight.RegisterValueChangedCallback((evt) => { m_CustomizedPlayerSettings.allowedLandscapeRight = evt.newValue; });
            #endregion

            #region Graphics API
            m_AutoGraphicsAPI = m_RootElement.Q <Toggle>("auto-graphics-api");
            m_AutoGraphicsAPI.SetValueWithoutNotify(m_CustomizedPlayerSettings.autoGraphicsAPI);
            m_AutoGraphicsAPI.RegisterValueChangedCallback(SetAutoGraphicsAPI);

            m_GraphicsAPIPlaceholder = m_RootElement.Q <VisualElement>("graphics-api-placeholder");
            m_GraphicsAPIPlaceholder.SetEnabled(!m_CustomizedPlayerSettings.autoGraphicsAPI);
            #endregion

            UpdateCustomizedPlayerSettings(m_OverrideDefaultPlayerSettings.value);
            UpdateStartInFullScreen();
            UpdateResolutionScalingMode(m_CustomizedPlayerSettings.resolutionScalingMode);
            UpdateAllowedOrientations(m_CustomizedPlayerSettings.defaultOrientation);
            UpdateGraphicsAPI();
        }
コード例 #5
0
 private void SyncDpiSlider(ChangeEvent <int> evt)
 {
     m_CustomizedPlayerSettings.targetDpi = GetValidDpi(evt.newValue);
     m_DpiSlider.SetValueWithoutNotify(m_CustomizedPlayerSettings.targetDpi);
 }