Beispiel #1
0
        internal GSMenu(Vector2 center, int width, int height) : base(center, width, height)
        {
            Console.WriteLine("UIScale: " + Settings.UIScale);
            Console.WriteLine("Entering Menu!");

            UI.Add(new UITextObject(new Rectangle(-128, 10, 256, 128), Anchor.Top, GameState.canvas, "SETTINGS", Color.Black, font, textAlignment.Center, 3.0f, false));

            UI.Add(new UITextObject(new Rectangle(-384, -192, 256, 64), Anchor.Center, GameState.canvas, "RESOLUTION", Color.Black, font, textAlignment.Left, 1f, false));
            UI.Add(new UITextObject(new Rectangle(-384, -64, 256, 64), Anchor.Center, GameState.canvas, "WINDOW MODE", Color.Black, font, textAlignment.Left, 1f, false));
            UI.Add(new UITextObject(new Rectangle(-384, 64, 256, 64), Anchor.Center, GameState.canvas, "UI SIZE", Color.Black, font, textAlignment.Left, 1f, false));

            UI.Add(new UITextObject(new Rectangle(0, -192, 256, 64), Anchor.Center, GameState.canvas, "MASTER VOLUME", Color.Black, font, textAlignment.Left, 1f, false));
            UI.Add(new UITextObject(new Rectangle(0, -64, 256, 64), Anchor.Center, GameState.canvas, "MUSIC VOLUME", Color.Black, font, textAlignment.Left, 1f, false));
            UI.Add(new UITextObject(new Rectangle(0, 64, 256, 64), Anchor.Center, GameState.canvas, "EFFECT VOLUME", Color.Black, font, textAlignment.Left, 1f, false));

            UI.Add(resolutionButton = new CycleButton <Point>(new Rectangle(-184, -192, 128, 32), Anchor.Center, GameState.canvas, resolutionOptions, resolutionLabels));
            UI.Add(windowModeButton = new CycleButton <bool>(new Rectangle(-184, -64, 128, 32), Anchor.Center, GameState.canvas, new bool[] { false, true }, new string[] { "windowed", "fullscreen" }));
            UI.Add(UIScaleButton    = new CycleButton <float>(new Rectangle(-184, 64, 128, 32), Anchor.Center, GameState.canvas, uiScaleOptions, uiScaleLabels));

            UI.Add(masterVolumeButton = new CycleButton <float>(new Rectangle(224, -192, 128, 32), Anchor.Center, GameState.canvas, volumeOptions, volumeLabels));
            UI.Add(musicVolumeButton  = new CycleButton <float>(new Rectangle(224, -64, 128, 32), Anchor.Center, GameState.canvas, volumeOptions, volumeLabels));
            UI.Add(effectVolumeButton = new CycleButton <float>(new Rectangle(224, 64, 128, 32), Anchor.Center, GameState.canvas, volumeOptions, volumeLabels));

            UI.Add(exitGameButton = new UIButton(new Rectangle(16, -96, 64, 32), "views/menu/wood_button_2", "", Anchor.Bottom, GameState.canvas));
            new UITextObject(exitGameButton, "EXIT", Color.Black, font, textAlignment.Center, 1.0f, false);

            UI.Add(continueButton = new UIButton(new Rectangle(-80, -96, 64, 32), "views/menu/wood_button_2", "", Anchor.Bottom, GameState.canvas));
            new UITextObject(continueButton, "APPLY", Color.Black, font, textAlignment.Center, 1.0f, false);

            resolutionButton.SetCurrentValue(Settings.Resolution);
            windowModeButton.SetCurrentValue(Settings.FullScreen);
            UIScaleButton.SetCurrentValue(Settings.UIScale);
            masterVolumeButton.SetCurrentValue(Settings.MasterVolume);
            musicVolumeButton.SetCurrentValue(Settings.MusicVolume);
            effectVolumeButton.SetCurrentValue(Settings.EffectVolume);

            continueButton.OnMouseUp += StartHandler;
            exitGameButton.OnMouseUp += ExitHandler;
        }
        public void setUpButtons()
        {
            Texture2DExtended buttonTexture = new Texture2DExtended(Vocalization.ModHelper, Path.Combine("Content", "Graphics", "SliderButton.png"));
            Button            bar           = new Button(new Rectangle(this.xPositionOnScreen + 100, this.yPositionOnScreen + 220, 200, 40), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("Content", "Graphics", "SliderBar.png")), new Rectangle(0, 0, 100, 10), 2f);
            //Texture2DExtended barTexture = new Texture2DExtended(Vocalization.ModHelper, Vocalization.Manifest, Path.Combine("Content", "Graphics", "SliderBar.png"));
            Rectangle sourceRect = new Rectangle(0, 0, 4, 16);

            this.sliderButton = new SliderButton("Slider", "Volume", new Rectangle(this.xPositionOnScreen + 100, this.yPositionOnScreen + 220, 4, 16), buttonTexture, bar, sourceRect, 2f, new SliderInformation(SliderStyle.Horizontal, (int)(Vocalization.config.voiceVolume * 100), 1), new StardustCore.Animations.Animation(sourceRect), Color.White, Color.Black, new StardustCore.UIUtilities.MenuComponents.Delegates.Functionality.ButtonFunctionality(null, null, null), false, null, true);

            Button        english    = new Button(LanguageName.English.ToString(), "English", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 0, 174, 39), 1f);
            Button        spanish    = new Button(LanguageName.Spanish.ToString(), "Spanish", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 2, 174, 39), 1f);
            Button        portuguese = new Button(LanguageName.Portuguese.ToString(), "Brazillian Portuguese", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 4, 174, 39), 1f);
            Button        russian    = new Button(LanguageName.Russian.ToString(), "Russian", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 6, 174, 39), 1f);
            Button        chinese    = new Button(LanguageName.Chinese.ToString(), "Chinese", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 8, 174, 39), 1f);
            Button        japanese   = new Button(LanguageName.Japanese.ToString(), "Japanese", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 10, 174, 39), 1f);
            Button        german     = new Button(LanguageName.German.ToString(), "German", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 12, 174, 39), 1f);
            List <Button> buttons    = new List <Button>
            {
                english,
                spanish,
                portuguese,
                russian,
                chinese,
                japanese,
                german
            };

            this.languages = new CycleButton(new Rectangle(this.xPositionOnScreen + 100, this.yPositionOnScreen + 75, 174, 39), buttons, new Rectangle(0, 0, 174, 39), 1f);

            for (int i = 0; i < this.languages.buttons.Count; i++)
            {
                if (Vocalization.config.translationInfo.CurrentTranslation == (LanguageName)Enum.Parse(typeof(LanguageName), this.languages.buttons.ElementAt(i).name))
                {
                    this.languages.buttonIndex = i;
                }
            }
        }
Beispiel #3
0
        public void setUpButtons()
        {
            Texture2DExtended buttonTexture = new Texture2DExtended(Vocalization.ModHelper, Vocalization.Manifest, Path.Combine("Content", "Graphics", "SliderButton.png"));
            Button            bar           = new Button(new Rectangle(this.xPositionOnScreen + 100, this.yPositionOnScreen + 220, 200, 40), new Texture2DExtended(Vocalization.ModHelper, Vocalization.Manifest, Path.Combine("Content", "Graphics", "SliderBar.png")), new Rectangle(0, 0, 100, 10), 2f);
            //Texture2DExtended barTexture = new Texture2DExtended(Vocalization.ModHelper, Vocalization.Manifest, Path.Combine("Content", "Graphics", "SliderBar.png"));
            Rectangle sourceRect = new Rectangle(0, 0, 4, 16);

            this.sliderButton = new SliderButton("Slider", "Volume", new Rectangle(this.xPositionOnScreen + 100, this.yPositionOnScreen + 220, 4, 16), buttonTexture, bar, sourceRect, 2f, new SliderInformation(SliderStyle.Horizontal, (int)(Vocalization.config.voiceVolume * 100), 1), new StardustCore.Animations.Animation(sourceRect), Color.White, Color.Black, new StardustCore.UIUtilities.MenuComponents.Delegates.Functionality.ButtonFunctionality(null, null, null), false, null, true);

            Button        English    = new Button("EnglishButton", "English", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Vocalization.Manifest, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 0, 174, 39), 1f);
            Button        Spanish    = new Button("SpanishButton", "Spanish", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Vocalization.Manifest, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 2, 174, 39), 1f);
            Button        Portuguese = new Button("PortugueseButton", "Brazillian Portuguese", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Vocalization.Manifest, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 4, 174, 39), 1f);
            Button        Russian    = new Button("RussianButton", "Russian", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Vocalization.Manifest, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 6, 174, 39), 1f);
            Button        Chinese    = new Button("ChineseButton", "Chinese", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Vocalization.Manifest, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 8, 174, 39), 1f);
            Button        Japanese   = new Button("JapaneseButton", "Japanese", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Vocalization.Manifest, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 10, 174, 39), 1f);
            Button        German     = new Button("GermanButton", "German", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Vocalization.Manifest, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 12, 174, 39), 1f);
            List <Button> buttons    = new List <Button>();

            buttons.Add(English);
            buttons.Add(Spanish);
            buttons.Add(Portuguese);
            buttons.Add(Russian);
            buttons.Add(Chinese);
            buttons.Add(Japanese);
            buttons.Add(German);

            languages = new CycleButton(new Rectangle(this.xPositionOnScreen + 100, this.yPositionOnScreen + 75, 174, 39), buttons, new Rectangle(0, 0, 174, 39), 1f);

            for (int i = 0; i < languages.buttons.Count; i++)
            {
                if (Vocalization.config.translationInfo.currentTranslation == languages.buttons.ElementAt(i).label)
                {
                    languages.buttonIndex = i;
                }
            }
        }
Beispiel #4
0
        public ConstructionSiteView()
        {
            this.Background = new BackgroundTexture(GalaxyTextures.Get.PanelBackground, 6);
            this.Position.FixedSize(360, 116);

            this.title = new GuiText
            {
                Margins    = new Vector2(8, 4),
                TextColor  = Color.Black,
                TextHeight = 12
            };
            this.title.Position.WrapContent().Then.ParentRelative(-1, 1).UseMargins();
            this.AddChild(this.title);

            this.projectButton = new GuiButton
            {
                BackgroundHover  = new BackgroundTexture(GalaxyTextures.Get.ButtonHover, 9),
                BackgroundNormal = new BackgroundTexture(GalaxyTextures.Get.ButtonNormal, 9),
                Padding          = 10,
                Margins          = new Vector2(8, 8),
                TextColor        = Color.Black,
                TextHeight       = 12,
                ClickCallback    = projectButton_Click
            };
            this.projectButton.Position.FixedSize(88, 88).ParentRelative(-1, -1).UseMargins();
            this.AddChild(this.projectButton);

            this.detailsButton = new GuiButton
            {
                BackgroundHover  = new BackgroundTexture(GalaxyTextures.Get.ButtonHover, 9),
                BackgroundNormal = new BackgroundTexture(GalaxyTextures.Get.ButtonNormal, 9),
                Padding          = 10,
                Margins          = new Vector2(8, 8),
                TextColor        = Color.Black,
                TextHeight       = 12,
                Text             = context["SiteDetails"].Text(),
                ClickCallback    = detailsButton_Click
            };
            this.detailsButton.Position.WrapContent().Then.ParentRelative(1, -1).UseMargins();
            this.AddChild(this.detailsButton);

            this.investmentSlider = new GuiSlider
            {
                Margins       = new Vector2(8, 0),
                ScrollStep    = 0.05f,
                SlideCallback = investmentSlider_Change
            };
            this.investmentSlider.Position.FixedSize(150, 15).RelativeTo(this.projectButton, 1, 1, -1, 1).UseMargins().StretchRightTo(this, 1);
            this.AddChild(this.investmentSlider);

            this.estimationLabel = new GuiText
            {
                Margins    = new Vector2(0, 8),
                TextColor  = Color.Black,
                TextHeight = 12
            };
            this.estimationLabel.Position.WrapContent().Then.RelativeTo(this.investmentSlider, -1, -1, -1, 1).UseMargins();
            this.AddChild(this.estimationLabel);

            this.policyToggle = new CycleButton <PolicyInfo>
            {
                BackgroundHover  = new BackgroundTexture(GalaxyTextures.Get.ToggleHover, 8),
                BackgroundNormal = new BackgroundTexture(GalaxyTextures.Get.ToggleNormal, 8),
                Padding          = 4,
                Margins          = new Vector2(8, 0),
                CycleCallback    = x =>
                {
                    this.controller.Policy      = x;
                    this.investmentSlider.Value = (float)this.controller.DesiredSpendingRatio;
                    this.resetView();
                    this.scene.ResetTooltipContents();
                },
                ItemImage = x => GalaxyTextures.Get.Sprite(x.Id + "Policy"),
                Tooltip   = new DynamicTooltip("FormMain", () => this.controller.Policy.Id + "PolicyTooltip")
            };
            this.policyToggle.Position.FixedSize(32, 32).RelativeTo(this.projectButton, 1, -1, -1, -1).UseMargins();
            this.AddChild(this.policyToggle);

            this.policyName = new GuiText
            {
                Margins    = new Vector2(8, 0),
                TextColor  = Color.Black,
                TextHeight = 12
            };
            this.policyName.Position.WrapContent().Then.RelativeTo(this.policyToggle, 1, 0, -1, 0).UseMargins();
            this.AddChild(this.policyName);
        }