/// <summary>
        /// Add the UI for our options.
        /// </summary>
        public override void LoadContent()
        {
            CheckShouldLoad();

            Vector2 screenDimensions = ScreenManager.Instance.ScreenDimensions;
            float   padding          = Size.Y * 0.2f;

            MusicVolumeSlider = AddChild(new Slider(OptionsManager.MusicVolume, "Music Volume", new Vector2(0, -Size.Y * 0.5f + padding)));
            MusicVolumeSlider.OnValueChanged   += SyncMusicVolume;
            MusicVolumeSlider.InfoLabel.Colour  = Color.White;
            MusicVolumeSlider.ValueLabel.Colour = Color.White;

            SFXVolumeSlider = MusicVolumeSlider.AddChild(new Slider(OptionsManager.SFXVolume, "SFX Volume", new Vector2(0, padding)));
            SFXVolumeSlider.InfoLabel.Colour  = Color.White;
            SFXVolumeSlider.ValueLabel.Colour = Color.White;

            Button fullScreenButton = SFXVolumeSlider.AddChild(new Button(OptionsManager.IsFullScreen.ToString(),
                                                                          new Vector2(0, padding),
                                                                          AssetManager.DefaultNarrowButtonTextureAsset,
                                                                          AssetManager.DefaultNarrowButtonHighlightedTextureAsset));

            fullScreenButton.ClickableModule.OnLeftClicked += SyncOptionsIsFullScreen;

            FullScreenLabel        = fullScreenButton.AddChild(new Label("Fullscreen", Vector2.Zero));
            FullScreenLabel.Colour = Color.White;

            base.LoadContent();
        }
Пример #2
0
        /// <summary>
        /// Adds UI to alter the UI.
        /// </summary>
        protected override void AddInitialUI()
        {
            base.AddInitialUI();

            float padding = ScreenDimensions.Y * 0.1f;

            Label titleLabel = AddScreenUIObject(new Label("Options", new Vector2(ScreenCentre.X, ScreenDimensions.Y * 0.1f)));

            MusicVolumeSlider = titleLabel.AddChild(new Slider(OptionsManager.MusicVolume, "Music Volume", new Vector2(0, padding)));
            MusicVolumeSlider.OnValueChanged += SyncMusicVolume;

            SFXVolumeSlider = MusicVolumeSlider.AddChild(new Slider(OptionsManager.SFXVolume, "SFX Volume", new Vector2(0, padding)));

            Button fullScreenButton = SFXVolumeSlider.AddChild(new Button(OptionsManager.IsFullScreen.ToString(),
                                                                          new Vector2(0, padding),
                                                                          AssetManager.DefaultNarrowButtonTextureAsset,
                                                                          AssetManager.DefaultNarrowButtonHighlightedTextureAsset));

            fullScreenButton.ClickableModule.OnLeftClicked += SyncOptionsIsFullScreen;

            FullScreenLabel = fullScreenButton.AddChild(new Label("Fullscreen", Vector2.Zero));
        }