示例#1
0
        public void Init()
        {
            _tooltipLabel = new Label
            {
                Transform           = new Transform2(new Vector2(1270, 124), new Size2(500, 60)),
                BackgroundColor     = Color.Transparent,
                HorizontalAlignment = HorizontalAlignment.Right,
                TextColor           = UiStyle.TextLightPurple
            };

            _confirmationVisuals = new List <IVisual>();
            _confirmationBranch  = new ClickUIBranch("Confirm", 3);
            AddConfirmationButton(UiButtons.MenuRed("Quit", new Vector2(960 - 360 - 100, 500), Confirm));
            AddConfirmationButton(UiButtons.MenuRed("Cancel", new Vector2(960 + 0 + 100, 500), Cancel));
            _confirmationBranch.Add(new ScreenClickable(() => { }));

            _clickables = new List <VisualClickableUIElement>();
            AddIconButton(() => Scene.NavigateTo(GameResources.DilemmasSceneName), "Icons/Dilemmas", "Dilemmas");
            AddIconButton(() => Scene.NavigateTo(GameResources.DialogueMemoriesScene), "Icons/Conversations", "Conversations");
            AddIconButton(() => Scene.NavigateTo(GameResources.OptionsSceneName), "Icons/Options", "Options");
            AddIconButton(() => Scene.NavigateTo(GameResources.SaveLoadSceneName), "Icons/Save", "Save / Load");
            AddIconButton(OpenConfirmationMenu, "Icons/ExitToMenu", "Main Menu");
            HudBranch = new ClickUIBranch("HUD", 2);
            _clickables.ForEach(x => HudBranch.Add(x));
            _newIcon = new ImageBox
            {
                Transform = new Transform2(new Size2(43, 43)),
                Image     = "UI/NewRedIconBorderless"
            };

            Event.SubscribeForever(EventSubscription.Create <ActiveElementChanged>(UpdateTooltip, this));
        }
示例#2
0
        private void AddAudioOptions()
        {
            var colX        = XPos(0.75f);
            var iconYOffset = 14;
            var margin      = 10;
            var iconWidth   = 48;

            Add(UiLabels.Option("Audio", new Vector2(colX, Height(0))));

            Add(UiButtons.SmallIcon("Icons/MinusGreen", new Vector2(colX, Height(1) + iconYOffset), () =>
            {
                CurrentOptions.Update((x) => x.SoundVolume = Math.Max(x.SoundVolume - 0.1f, 0));
                _soundVolume.Text = GetSoundVolumeText();
            }));
            _soundVolume = VolumeLabel(GetSoundVolumeText(), new Vector2(colX + iconWidth + margin, Height(1)), Color.White);
            Add(_soundVolume);
            Add(UiButtons.SmallIcon("Icons/PlusGreen", new Vector2(colX + 240 + iconWidth + margin * 2, Height(1) + iconYOffset), () =>
            {
                CurrentOptions.Update((x) => x.SoundVolume = Math.Min(x.SoundVolume + 0.1f, 1));
                _soundVolume.Text = GetSoundVolumeText();
            }));

            Add(UiButtons.SmallIcon("Icons/MinusGreen", new Vector2(colX, Height(2) + iconYOffset), () =>
            {
                CurrentOptions.Update((x) => x.MusicVolume = Math.Max(x.MusicVolume - 0.1f, 0));
                _musicVolume.Text = GetMusicVolumeText();
            }));
            _musicVolume = VolumeLabel(GetMusicVolumeText(), new Vector2(colX + iconWidth + margin, Height(2)), Color.White);
            Add(_musicVolume);
            Add(UiButtons.SmallIcon("Icons/PlusGreen", new Vector2(colX + 240 + iconWidth + margin * 2, Height(2) + iconYOffset), () =>
            {
                CurrentOptions.Update((x) => x.MusicVolume = Math.Min(x.MusicVolume + 0.1f, 1));
                _musicVolume.Text = GetMusicVolumeText();
            }));
        }
示例#3
0
 protected override void OnInit()
 {
     Audio.PlayMusic("MainTheme", 1);
     CurrentGameState.Reset();
     Add(UiButtons.Menu("Start Game", new Vector2(colX, Height(0)), () => Scene.NavigateTo(GameResources.PickNameSceneName)));
     Add(UiButtons.Menu("Continue Game", new Vector2(colX, Height(1)), () => Scene.NavigateTo(GameResources.SaveLoadSceneName)));
     Add(UiButtons.Menu("Credits", new Vector2(colX, Height(2)), () => Scene.NavigateTo(GameResources.CreditsSceneName)));
     Add(UiButtons.Menu("Options", new Vector2(colX, Height(3)), () => Scene.NavigateTo(GameResources.OptionsSceneName)));
     Add(UiButtons.Menu("Exit Game", new Vector2(colX, Height(4)), () => CurrentGame.TheGame.Exit()));
 }
示例#4
0
        protected override void OnInit()
        {
            _headerText = UiLabels.HeaderLabel("Options", Color.White);
            Add(UiButtons.Back(() => Scene.NavigateTo(CurrentGameState.CurrentLocation)));

            _startingY = UI.OfScreenHeight(0.15f);
            AddGameplayOptions();
            AddDisplayOptions();
            AddAudioOptions();
            AddResetControls();
        }
示例#5
0
 public void Init()
 {
     _clickUI = new ClickUI();
     _credits = UiButtons.Menu("Credits", new Vector2(UI.OfScreenWidth(0.5f) - 180, 900), () => Scene.NavigateTo(GameResources.CreditsSceneName));
     _chatBox = new ChatBox("", 1670, DefaultFont.Value, CurrentOptions.MillisPerTextCharacter, 32)
     {
         SoundsEnabled = false
     };
     _clickUI.Add(_credits);
     _clickUI.Add(new ScreenClickable(_chatBox.CompletelyDisplayMessage));
     CalculateLinchPins();
     GenerateWallOfText();
 }
示例#6
0
        private void AddGameplayOptions()
        {
            var colX = XPos(0.25f);

            Add(UiLabels.Option("Gameplay", new Vector2(colX, Height(0))));
            Add(UiButtons.Menu("Text: Slow", new Vector2(colX, Height(1)), () => CurrentOptions.Update(x => x.MillisPerTextCharacter    = 45)));
            Add(UiButtons.Menu("Text: Normal", new Vector2(colX, Height(2)), () => CurrentOptions.Update(x => x.MillisPerTextCharacter  = 30)));
            Add(UiButtons.Menu("Text: Fast", new Vector2(colX, Height(3)), () => CurrentOptions.Update(x => x.MillisPerTextCharacter    = 15)));
            Add(UiButtons.Menu("Text: Instant", new Vector2(colX, Height(4)), () => CurrentOptions.Update(x => x.MillisPerTextCharacter = 0)));

            _tutorialsToggle = UiButtons.Menu(GetTutorialText(), new Vector2(colX, Height(6)), ToggleTutorials);
            Add(_tutorialsToggle);
        }
示例#7
0
        private void AddResetControls()
        {
            var rowY = UI.OfScreenHeight(0.8f);

            Add(UiLabels.Option("Resets", new Vector2(XPos(0.5f), Height(0, rowY))));
            Add(UiButtons.Menu("Reset Options", new Vector2(XPos(0.50f), Height(1, rowY)), () =>
            {
                CurrentOptions.UpdateDisplay(x => CurrentOptions.Reset());
                _tutorialsToggle.Text = GetTutorialText();
                _soundVolume.Text     = GetSoundVolumeText();
                _musicVolume.Text     = GetMusicVolumeText();
            }));
        }
示例#8
0
        private void AddDisplayOptions()
        {
            var colX = XPos(0.50f);

            Add(UiLabels.Option("Display", new Vector2(colX, Height(0))));
            Add(UiButtons.Menu("Toggle FullScreen", new Vector2(colX, Height(1)), () => CurrentOptions.UpdateDisplay(x => x.IsFullscreen = !x.IsFullscreen)));

            Add(UiButtons.Menu("960x540", new Vector2(colX, Height(3)), () => CurrentOptions.UpdateDisplay(x => x.Scale = 0.5f),
                               () => !CurrentOptions.IsFullscreen));
            Add(UiButtons.Menu("1440x810", new Vector2(colX, Height(4)), () => CurrentOptions.UpdateDisplay(x => x.Scale = 0.75f),
                               () => !CurrentOptions.IsFullscreen));
            Add(UiButtons.Menu("1920x1080", new Vector2(colX, Height(5)), () => CurrentOptions.UpdateDisplay(x => x.Scale = 1),
                               () => !CurrentOptions.IsFullscreen));
        }
示例#9
0
        protected override void OnInit()
        {
            _playerCharacter = new PlayerCharacterView(() => true);
            var header = UiLabels.FullWidthHeaderLabel("New Game", Color.White);

            header.Transform.Location = new Vector2(header.Transform.Location.X, 158);
            Add(header);

            _keyboard = new KeyboardTyping(GameResources.DefaultPlayerCharacterName);
            Add(_keyboard);
            var yStart = 331;

            Add(new Label {
                Text = "Character Name", Transform = new Transform2(new Vector2(758, yStart), new Size2(400, 50))
            });
            Add(new ColoredRectangle {
                Color = Color.FromNonPremultiplied(31, 185, 219, 199), Transform = new Transform2(new Vector2(758, yStart + 60 - 2), new Size2(404, 79))
            });
            _textboxLabel = new Label {
                Text = GameResources.DefaultPlayerCharacterName, Transform = new Transform2(new Vector2(760, yStart + 60), new Size2(400, 75)), BackgroundColor = Color.FromNonPremultiplied(25, 75, 110, 255)
            };
            Add(_textboxLabel);

            yStart = 541;
            Add(new Label {
                Text = "Difficulty", Transform = new Transform2(new Vector2(860, yStart), new Size2(200, 50))
            });
            Add(new ColoredRectangle {
                Color = Color.FromNonPremultiplied(31, 185, 219, 199), Transform = new Transform2(new Vector2(758, yStart + 60 - 2), new Size2(404, 79))
            });
            _shouldGuideLabel = new Label {
                Text = "Guide Me a Little", Transform = new Transform2(new Vector2(760, yStart + 60), new Size2(400, 75)), BackgroundColor = Color.FromNonPremultiplied(25, 75, 110, 255)
            };
            Add(_shouldGuideLabel);
            Add(UiButtons.MenuSmallBlue("Guide Me", new Vector2(700, yStart + 170), () =>
            {
                CurrentGameState.ShowObjectives = true;
                _shouldGuideLabel.Text          = "Guide Me a Little";
            }));
            Add(UiButtons.MenuSmallBlue("I'm A Pro", new Vector2(980, yStart + 170), () =>
            {
                CurrentGameState.ShowObjectives = false;
                _shouldGuideLabel.Text          = "I Know What I'm Doing";
            }));

            Input.On(Control.Start, StartGame);
            Add(UiButtons.Menu("Begin", new Vector2(780, 900), StartGame));
        }
示例#10
0
 protected override void OnInit()
 {
     Add(UiButtons.Back(() => Scene.NavigateTo(GameResources.DilemmasSceneName)));
     _header = UiLabels.FullWidthHeaderLabel(_dilemmaDescription, Color.White);
     _deductions.ForEachIndex((d, i) =>
     {
         var position = Position(i);
         var button   = d.CreateButton(position);
         AddUi(button);
         AddVisual(button);
         if (d.IsNew)
         {
             AddVisual(d.CreateNewIndicator(position));
         }
     });
 }
示例#11
0
        protected override void OnInit()
        {
            Audio.PlayMusic("Pondering", 0.78f);
            _header = UiLabels.FullWidthHeaderLabel("Current Investigation", Color.White);

            Add(UiButtons.Back(() => Scene.NavigateTo(CurrentGameState.CurrentLocation)));
            if (GameObjects.Dilemmas.HasTheory)
            {
                Add(UiButtons.MenuRed("Resolve", new Vector2(UI.OfScreenWidth(0.5f) - 180, 980), () => Scene.NavigateTo(GameResources.EndingSceneName)));
            }

            GameObjects.Dilemmas.GetActiveDilemmas().ForEach(d =>
            {
                Add(d.CreateButton());
                d.GetVisuals().ForEach(AddVisual);
            });
            Add(new DilemmasTutorial());
        }
示例#12
0
 public VisualClickableUIElement CreateButton(Vector2 position)
 {
     return(new ImageTextButton(new Transform2(position, UiButtons.PonderingSize()), () =>
     {
         _clearPriorDeduction();
         Event.Publish(new ThoughtGained(_thought));
         Scene.NavigateTo("Dilemmas");
     }, GameResources.GetPonderText(_thought), "Pondering/DilemmaCard", "Pondering/DilemmaCard-Hover", "Pondering/DilemmaCard-Press")
     {
         OnEnter = () =>
         {
             if (!CurrentGameState.HasViewedItem(_thought))
             {
                 Event.Publish(new ItemViewed(_thought));
             }
         }
     });
 }
示例#13
0
        protected override void OnInit()
        {
            _savingEnabled    = CurrentGameState.CurrentLocation != GameResources.MainMenuSceneName;
            _headerText       = UiLabels.FullWidthHeaderLabel("Game", Color.White);
            _changeModeButton = UiButtons.MenuSmallBlue("Load", new Vector2(840, 960),
                                                        () => SetMode(_mode == SaveMode.Save ? SaveMode.Load : SaveMode.Save));
            if (_savingEnabled)
            {
                Add(_changeModeButton);
            }
            SetMode(_savingEnabled ? SaveMode.Save : SaveMode.Load);
            Add(UiButtons.BackBlue(() => Scene.NavigateTo(CurrentGameState.CurrentLocation)));

            var positions = new[] { new Vector2(320, 200), new Vector2(1120, 200), new Vector2(320, 600), new Vector2(1120, 600), };

            for (var i = 0; i < 4; i++)
            {
                var s = new SaveSlotView(positions[i], SaveSlot.Create(i), () => _mode);
                s.Init();
                AddUi(s);
            }
        }
示例#14
0
 protected Dilemma(Vector2 position, string dilemma, params Deduction[] deductions)
 {
     _transform  = new Transform2(position, UiButtons.PonderingSize());
     _dilemma    = dilemma;
     _deductions = deductions;
 }
示例#15
0
 private void AddIconButton(Action onClick, string name, string tooltip)
 {
     _clickables.Add(UiButtons.Icon(new Vector2(1920 - 102, 12 + _clickables.Count * 106), name, onClick, tooltip));
 }