Beispiel #1
0
 public void StoryModeButtons()
 {
     BackButton = new StandardButton(new Rectangle(380, 635, 130, 55));
     Buttons.Add(BackButton);
     ContinueButton = new StandardButton(new Rectangle(330, 620, 240, 70));
     Buttons.Add(ContinueButton);
 }
Beispiel #2
0
 public void PauseButtons()
 {
     ResumeButton = new StandardButton(new Rectangle(257, 350, 170, 55));
     Buttons.Add(ResumeButton);
     PauseMenuButton = new StandardButton(new Rectangle(487, 350, 220, 55));
     Buttons.Add(PauseMenuButton);
 }
Beispiel #3
0
        private void InitializeControls()
        {
            var buttonsX = Width / 2 - 10;

            startNewGameButton = new StandardButton(20)
            {
                Position = new Point(buttonsX, 16),
                Text     = "Start New Game"
            };
            startNewGameButton.Click += (sender, args) => StartNewGame?.Invoke(this, EventArgs.Empty);
            Add(startNewGameButton);

            backToMenuButton = new StandardButton(20)
            {
                Position = new Point(buttonsX, 20),
                Text     = "Back t0 Menu"
            };
            backToMenuButton.Click += (sender, args) => ExitToMenu?.Invoke(this, EventArgs.Empty);
            Add(backToMenuButton);

            exitGameButton = new StandardButton(20)
            {
                Position = new Point(buttonsX, 24),
                Text     = "Ex1t Game"
            };
            exitGameButton.Click += (sender, args) => Exit?.Invoke(this, EventArgs.Empty);
            Add(exitGameButton);
        }
        private void InitializeControls()
        {
            removeSpellButton = new StandardButton(25)
            {
                Position = new Point(Width - 57, 16),
                Text     = "[R] Remove from Library"
            };
            removeSpellButton.Click += (sender, args) => RemoveSpell?.Invoke(this, EventArgs.Empty);
            Add(removeSpellButton);

            editSpellButton = new StandardButton(25)
            {
                Position = new Point(Width - 57, 13),
                Text     = "[E] Edit Spell"
            };
            editSpellButton.Click += (sender, args) => EditSpell?.Invoke(this, EventArgs.Empty);
            Add(editSpellButton);

            spellDetails = new SpellDetailsControl(57, Height - 10)
            {
                Position = new Point(Width - 58, 3)
            };
            Add(spellDetails);

            var scrollBarTheme = new ScrollBarTheme
            {
                Normal = new Cell(DefaultForeground, DefaultBackground)
            };
            var scrollBar = new ScrollBar(Orientation.Vertical, Height - 6)
            {
                Position = new Point(Width - 60, 5),
                Theme    = scrollBarTheme
            };

            Add(scrollBar);
            spellsList = new CustomListBox <SpellListBoxItem>(Width - 61, Height - 6, scrollBar)
            {
                Position = new Point(1, 5)
            };
            spellsList.SelectionChanged += spellsListBox_SelectedItemChanged;
            Add(spellsList);

            var textBoxTheme = new TextBoxTheme
            {
                Normal  = new Cell(Color.White, Color.FromNonPremultiplied(66, 66, 66, 255)),
                Focused = new Cell(Color.White, Color.FromNonPremultiplied(66, 66, 66, 255))
            };

            filterTextBox = new TextBox(Width - 69)
            {
                Position  = new Point(10, 3),
                Theme     = textBoxTheme,
                MaxLength = Width - 70
            };
            Add(filterTextBox);

            UpdateSpellDetails();
        }
Beispiel #5
0
        private void InitializeControls()
        {
            Print(2, 1, "Cheats");

            var closeButton = new StandardButton(15)
            {
                Position = new Point(Width - 17, Height - 4),
                Text     = "[ESC] Close",
            };

            closeButton.Click += (sender, args) => Exit?.Invoke(this, EventArgs.Empty);
            Add(closeButton);

            var levelUp = new StandardButton(20)
            {
                Text     = "Level Up",
                Position = new Point(2, 3)
            };

            levelUp.Click += (sender, args) => CheatLevelUp?.Invoke(this, EventArgs.Empty);
            Add(levelUp);

            var heal = new StandardButton(20)
            {
                Text     = "Heal",
                Position = new Point(2, 7)
            };

            heal.Click += (sender, args) => CheatHeal?.Invoke(this, EventArgs.Empty);
            Add(heal);

            var restoreMana = new StandardButton(20)
            {
                Text     = "Restore Mana",
                Position = new Point(2, 11)
            };

            restoreMana.Click += (sender, args) => CheatRestoreMana?.Invoke(this, EventArgs.Empty);
            Add(restoreMana);

            var restoreStamina = new StandardButton(20)
            {
                Text     = "Restore Stamina",
                Position = new Point(2, 15)
            };

            restoreStamina.Click += (sender, args) => CheatRestoreStamina?.Invoke(this, EventArgs.Empty);
            Add(restoreStamina);

            var restoreStats = new StandardButton(20)
            {
                Text     = "Restore Stats",
                Position = new Point(2, 19)
            };

            restoreStats.Click += (sender, args) => CheatRestoreStats?.Invoke(this, EventArgs.Empty);
            Add(restoreStats);
        }
Beispiel #6
0
 public void GameOverButtons()
 {
     SaveScoreButton = new StandardButton(new Rectangle(300, 350, 260, 70));
     Buttons.Add(SaveScoreButton);
     MainMenuButton = new StandardButton(new Rectangle(230, 460, 185, 55));
     Buttons.Add(MainMenuButton);
     QuitButton = new StandardButton(new Rectangle(460, 460, 190, 55));
     Buttons.Add(QuitButton);
 }
 private void InitializeControls()
 {
     closeButton = new StandardButton(15)
     {
         Position = new Point(Width - 17, Height - 4),
         Text     = "[ESC] Close"
     };
     closeButton.Click += (sender, args) => OnExit();
     Add(closeButton);
 }
Beispiel #8
0
 private void InitializeControls()
 {
     closeButton = new StandardButton(15)
     {
         Position = new Point(Width - 17, Height - 4),
         Text     = "[ESC] Close"
     };
     closeButton.Click += (sender, args) => Exit?.Invoke(this, EventArgs.Empty);
     Add(closeButton);
 }
Beispiel #9
0
 public void LevelSelectorButtons()
 {
     LevelOneButton = new StandardButton(new Rectangle(300, 100, 300, 55));
     Buttons.Add(LevelOneButton);
     LevelTwoButton = new StandardButton(new Rectangle(300, 170, 300, 55));
     Buttons.Add(LevelTwoButton);
     LevelThreeButton = new StandardButton(new Rectangle(300, 240, 300, 55));
     Buttons.Add(LevelThreeButton);
     SelectorBackButton = new StandardButton(new Rectangle(400, 635, 110, 50));
     Buttons.Add(SelectorBackButton);
 }
Beispiel #10
0
        private void InitializeControls()
        {
            var xPosition = GetLabelPosition();

            gameLabel = new GameLogoControl
            {
                Position = new Point(xPosition, 4)
            };
            Add(gameLabel);

            startGameButton = new StandardButton(20)
            {
                Position = new Point(xPosition - 2, 9),
                Text     = "Start Game"
            };
            startGameButton.Click += (sender, args) => StartGame?.Invoke(this, EventArgs.Empty);
            Add(startGameButton);

            continueGameButton = new StandardButton(20)
            {
                Position = new Point(xPosition - 2, 13),
                Text     = "C0nt1nue Game"
            };
            continueGameButton.Click += (sender, args) => ContinueGame?.Invoke(this, EventArgs.Empty);
            Add(continueGameButton);

            spellsLibraryButton = new StandardButton(20)
            {
                Position = new Point(xPosition - 2, 17),
                Text     = "Spells L1brary"
            };
            spellsLibraryButton.Click += (sender, args) => ShowSpellLibrary?.Invoke(this, EventArgs.Empty);
            Add(spellsLibraryButton);

            settingsButton = new StandardButton(20)
            {
                Position = new Point(xPosition - 2, 21),
                Text     = "Sett1ngs"
            };
            settingsButton.Click += (sender, args) => ShowSettings?.Invoke(this, EventArgs.Empty);
            Add(settingsButton);

            exitButton = new StandardButton(20)
            {
                Position = new Point(xPosition - 2, 25),
                Text     = "Ex1t"
            };
            exitButton.Click += (sender, args) => Exit?.Invoke(this, EventArgs.Empty);
            Add(exitButton);
        }
Beispiel #11
0
        private void InitializeControls()
        {
            okButton = new StandardButton(20)
            {
                Position = new Point(3, Height - 4),
                Text     = "OK"
            };
            okButton.Click += (sender, args) => Ok?.Invoke(this, EventArgs.Empty);
            Add(okButton);

            cancelButton = new StandardButton(20)
            {
                Position = new Point(27, Height - 4),
                Text     = "Cancel"
            };
            cancelButton.Click += (sender, args) => Cancel?.Invoke(this, EventArgs.Empty);
            Add(cancelButton);

            launchEditorButton = new StandardButton(40)
            {
                Position = new Point(3, 12),
                Text     = "Launch Code Editor"
            };
            launchEditorButton.Click += (sender, args) => LaunchEditor?.Invoke(this, EventArgs.Empty);
            Add(launchEditorButton);

            var textBoxTheme = new TextBoxTheme
            {
                Normal  = new Cell(Color.White, Color.FromNonPremultiplied(66, 66, 66, 255)),
                Focused = new Cell(Color.White, Color.FromNonPremultiplied(66, 66, 66, 255))
            };

            spellNameTextBox = new TextBox(60)
            {
                Position  = new Point(3, 5),
                Theme     = textBoxTheme,
                MaxLength = 50
            };
            Add(spellNameTextBox);

            manaCostTextBox = new TextBox(15)
            {
                Position     = new Point(3, 8),
                IsNumeric    = true,
                AllowDecimal = false,
                Theme        = textBoxTheme,
                MaxLength    = 10
            };
            Add(manaCostTextBox);
        }
Beispiel #12
0
        private void InitializeControls()
        {
            okButton = new StandardButton(20)
            {
                Position = new Point(3, Height - 4),
                Text     = "OK"
            };
            okButton.Click += (sender, args) => Ok?.Invoke(this, EventArgs.Empty);
            Add(okButton);

            DoForAllStats((y, stat) =>
            {
                AddStatSelector(6, y, stat);
            });
        }
Beispiel #13
0
        private void AddStatSelector(int x, int y, PlayerStats stat)
        {
            var button = new StandardButton(3)
            {
                Text     = "+",
                Position = new Point(x + maxStatNameLength + 7, y - 1)
            };

            button.Click += (sender, args) =>
            {
                SelectedStat = stat;
                StatSelected?.Invoke(this, EventArgs.Empty);
            };
            Add(button);
        }
Beispiel #14
0
 public void MainMenuButtons()
 {
     PlayButton = new StandardButton(new Rectangle(610, 20, 260, 120));
     Buttons.Add(PlayButton);
     ScoreButton = new StandardButton(new Rectangle(610, 150, 260, 70));
     Buttons.Add(ScoreButton);
     AboutNogardButton = new StandardButton(new Rectangle(610, 230, 260, 60));
     Buttons.Add(AboutNogardButton);
     InstuctionsButton = new StandardButton(new Rectangle(610, 300, 260, 60));
     Buttons.Add(InstuctionsButton);
     ExitButton = new StandardButton(new Rectangle(690, 370, 90, 55));
     Buttons.Add(ExitButton);
     MapButton = new StandardButton(new Rectangle(10, 635, 210, 55));
     Buttons.Add(MapButton);
 }
        private void BuildChildElements()
        {
            var assignInputsLbl = new Label()
            {
                Text           = $"Assign inputs to: {HotkeyDefinition.Name}",
                Location       = new Point(40, 35),
                ShowShadow     = true,
                AutoSizeWidth  = true,
                AutoSizeHeight = true,
                Parent         = this
            };

            var unbindBttn = new StandardButton()
            {
                Text     = "Unbind",
                Location = new Point(275, 85),
                Width    = 70,
                Height   = 25,
                Parent   = this
            };

            var cancelBttn = new StandardButton()
            {
                Text     = "Cancel",
                Location = new Point(275, 140),
                Width    = 70,
                Height   = 25,
                Parent   = this
            };

            var overwriteBttn = new StandardButton()
            {
                Text   = "Overwrite",
                Width  = 105,
                Height = 25,
                Parent = this
            };

            overwriteBttn.Location = new Point(cancelBttn.Left - 8 - overwriteBttn.Width, cancelBttn.Top);

            unbindBttn.LeftMouseButtonReleased += delegate {
                HotkeyDefinition.Keys.Clear();
                Invalidate();
            };
        }
Beispiel #16
0
        private void InitializeControls()
        {
            closeButton = new StandardButton(15)
            {
                Position = new Point(Width - 17, Height - 4),
                Text     = "[ESC] Cancel"
            };
            closeButton.Click += (sender, args) => OnExit();
            Add(closeButton);

            okButton = new StandardButton(15)
            {
                Position = new Point(Width - 37, Height - 4),
                Text     = "[ENTER] OK"
            };
            okButton.Click += (sender, args) => Ok?.Invoke(this, EventArgs.Empty);
            Add(okButton);
        }
Beispiel #17
0
        private void InitializeControls()
        {
            var xPosition = GetLabelPosition();

            gameLabel = new GameLogoControl
            {
                Position = new Point(xPosition, 4)
            };
            Add(gameLabel);

            continueGameButton = new StandardButton(20)
            {
                Position = new Point(xPosition - 2, 9),
                Text     = "C0nt1nue Game"
            };
            continueGameButton.Click += (sender, args) => ContinueGame?.Invoke(this, EventArgs.Empty);
            Add(continueGameButton);

            startGameButton = new StandardButton(20)
            {
                Position = new Point(xPosition - 2, 13),
                Text     = "Start New Game"
            };
            startGameButton.Click += (sender, args) => StartNewGame?.Invoke(this, EventArgs.Empty);
            Add(startGameButton);

            exitToMenuButton = new StandardButton(20)
            {
                Position = new Point(xPosition - 2, 17),
                Text     = "Ex1t t0 Menu"
            };
            exitToMenuButton.Click += (sender, args) => ExitToMenu?.Invoke(this, EventArgs.Empty);
            Add(exitToMenuButton);

            exitButton = new StandardButton(20)
            {
                Position = new Point(xPosition - 2, 21),
                Text     = "Ex1t"
            };
            exitButton.Click += (sender, args) => Exit?.Invoke(this, EventArgs.Empty);
            Add(exitButton);
        }
Beispiel #18
0
        public void SetActionModel(IEnumerable <WebActionNode> actionModel)
        {
            LayoutRoot.Children.Clear();

            foreach (WebActionNode action in actionModel)
            {
                //TODO: what if there are children?
                if (action is WebDropDownButtonAction)
                {
                    var theButton = new DropDownButton(_dispatcher, action as WebDropDownButtonAction, _desiredIconSize);

                    _buttonLookup.Add(action.Identifier, theButton);
                    theButton.RegisterOnMouseEnter(OnMouseEnter);
                    theButton.RegisterOnMouseLeave(OnMouseLeave);

                    LayoutRoot.Children.Add(theButton);
                }
                else if (action is WebDropDownAction)
                {
                    var theButton = new LayoutDropDown(_dispatcher, action as WebDropDownAction, _desiredIconSize);

                    _buttonLookup.Add(action.Identifier, theButton);
                    theButton.RegisterOnMouseEnter(OnMouseEnter);
                    theButton.RegisterOnMouseLeave(OnMouseLeave);

                    LayoutRoot.Children.Add(theButton);
                }
                else
                {
                    var theButton = new StandardButton(_dispatcher, action as WebClickAction, _desiredIconSize);

                    _buttonLookup.Add(action.Identifier, theButton);
                    theButton.RegisterOnMouseEnter(OnMouseEnter);
                    theButton.RegisterOnMouseLeave(OnMouseLeave);

                    LayoutRoot.Children.Add(theButton);
                }
            }

            OnActionModelChanged();
        }
Beispiel #19
0
        private void InitializeControls()
        {
            browseForLauncherButton = new StandardButton(20)
            {
                Position = new Point(2, 6),
                Text     = "[B] Browse"
            };
            browseForLauncherButton.Click += (sender, args) => BrowseEditor?.Invoke(this, EventArgs.Empty);
            Add(browseForLauncherButton);

            closeButton = new StandardButton(20)
            {
                Position = new Point(2, Height - 4),
                Text     = "[ESC] Close"
            };
            closeButton.Click += (sender, args) => Exit?.Invoke(this, EventArgs.Empty);
            Add(closeButton);

            prevFontSizeButton = new Button(1)
            {
                Position = new Point(13, 10),
                Text     = "<",
                CanFocus = false,
            };
            prevFontSizeButton.Click += (sender, args) => DecreaseFontSize?.Invoke(this, EventArgs.Empty);
            Add(prevFontSizeButton);

            nextFontSizeButton = new Button(1)
            {
                Position = new Point(21, 10),
                Text     = ">",
                CanFocus = false
            };
            nextFontSizeButton.Click += (sender, args) => IncreaseFontSize?.Invoke(this, EventArgs.Empty);
            Add(nextFontSizeButton);
        }
Beispiel #20
0
        protected override void Build(Panel buildPanel)
        {
            var info = new Label()
            {
                Size   = buildPanel.Size / new Point(1, 2),
                Parent = buildPanel,
                Text   = Strings.GameServices.ModulesService.NoModules_Info,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Middle,
                Font = GameService.Content.GetFont(ContentService.FontFace.Menomonia, ContentService.FontSize.Size18, ContentService.FontStyle.Italic),
            };

            var openDir = new StandardButton()
            {
                Text     = Strings.GameServices.ModulesService.NoModules_OpenFolder,
                Parent   = buildPanel,
                Width    = 200,
                Location = new Point(buildPanel.Size.X / 2 - 100, info.Bottom - 100),
            };

            openDir.Click += delegate {
                Process.Start("explorer.exe", $"/open, \"{DirectoryUtil.BasePath + "\\modules"}\\\"");
            };
        }
        public static void BuildSingleModuleSettings(Panel buildPanel, object module)
        {
            if (!(module is ModuleManager cModuleMan)) return;

            var moduleText = new Label() {
                Text           = "Manage Modules",
                Location       = new Point(24, 0),
                AutoSizeHeight = true,
                AutoSizeWidth  = true,
                StrokeText     = true,
                Parent         = buildPanel
            };

            var moduleHeader = new Image() {
                Texture  = GameService.Content.GetTexture("358411"),
                Location = new Point(0,   moduleText.Bottom - 6),
                Size     = new Point(875, 110),
                Parent   = buildPanel
            };

            var moduleName = new Label() {
                Text           = cModuleMan.Manifest.Name,
                Font           = GameService.Content.DefaultFont32,
                AutoSizeHeight = true,
                AutoSizeWidth  = true,
                StrokeText     = true,
                Location       = new Point(moduleText.Left, moduleText.Bottom),
                Parent         = buildPanel
            };

            var moduleVersion = new Label() {
                Text              = $"v{cModuleMan.Manifest.Version}",
                Height            = moduleName.Height - 6,
                VerticalAlignment = VerticalAlignment.Bottom,
                AutoSizeWidth     = true,
                StrokeText        = true,
                Font              = GameService.Content.DefaultFont12,
                Location          = new Point(moduleName.Right + 8, moduleName.Top),
                Parent            = buildPanel
            };

            var moduleState = new Label() {
                Text              = cModuleMan.State.Enabled ? "Enabled" : "Disabled",
                Height            = moduleName.Height - 6,
                VerticalAlignment = VerticalAlignment.Bottom,
                AutoSizeWidth     = true,
                StrokeText        = true,
                Font              = GameService.Content.DefaultFont12,
                TextColor         = cModuleMan.State.Enabled ? Color.FromNonPremultiplied(0, 255, 25, 255) : Color.Red,
                Location          = new Point(moduleVersion.Right + 8, moduleName.Top),
                Parent            = buildPanel
            };

            // Author & Contributors
            if (cModuleMan.Manifest.Author != null) {
                // Author
                var authorImage = new Image() {
                    Texture  = GameService.Content.GetTexture("733268"),
                    Location = new Point(moduleName.Left, moduleName.Bottom),
                    Size     = new Point(32,              32),
                    Parent   = buildPanel
                };

                var authorName = new Label() {
                    Text           = cModuleMan.Manifest.Author.Name,
                    Font           = GameService.Content.DefaultFont16,
                    AutoSizeWidth  = true,
                    AutoSizeHeight = true,
                    StrokeText     = true,
                    Parent         = buildPanel
                };

                authorName.Location = new Point(authorImage.Right + 2, authorImage.Bottom - authorName.Height);

                var authoredBy = new Label() {
                    Text              = "Authored by",
                    Height            = authorImage.Height - authorName.Height,
                    AutoSizeWidth     = true,
                    StrokeText        = true,
                    VerticalAlignment = VerticalAlignment.Bottom,
                    Font              = GameService.Content.DefaultFont12,
                    Location          = new Point(authorImage.Right + 2, authorImage.Top),
                    Parent            = buildPanel
                };

            } else if (cModuleMan.Manifest.Contributors.Any()) {
                // TODO: Draw out contributors
            }

            // Enable & disable module

            var enableButton = new StandardButton() {
                Location = new Point(buildPanel.Right - 192, moduleHeader.Top + moduleHeader.Height / 4 - StandardButton.STANDARD_CONTROL_HEIGHT / 2),
                Text     = "Enable Module",
                Enabled  = !cModuleMan.State.Enabled,
                Parent   = buildPanel
            };

            var disableButton = new StandardButton() {
                Location = new Point(buildPanel.Right - 192, enableButton.Bottom + 2),
                Text     = "Disable Module",
                Enabled  = cModuleMan.State.Enabled,
                Parent   = buildPanel
            };

            enableButton.Click += delegate {
                enableButton.Enabled = false;
                disableButton.Enabled = false;

                cModuleMan.Enabled = true;

                moduleState.Text      = "Loading";
                moduleState.TextColor = Control.StandardColors.Yellow;

                cModuleMan.ModuleInstance.ModuleLoaded += delegate {
                    enableButton.Enabled  = !cModuleMan.Enabled;
                    disableButton.Enabled = cModuleMan.Enabled;

                    moduleState.Text      = cModuleMan.State.Enabled ? "Enabled" : "Disabled";
                    moduleState.TextColor = cModuleMan.State.Enabled ? Color.FromNonPremultiplied(0, 255, 25, 255) : Color.Red;
                };
            };

            disableButton.Click += delegate {
                enableButton.Enabled = false;
                disableButton.Enabled = false;

                cModuleMan.Enabled = false;

                enableButton.Enabled  = !cModuleMan.Enabled;
                disableButton.Enabled = cModuleMan.Enabled;

                moduleState.Text      = cModuleMan.State.Enabled ? "Enabled" : "Disabled";
                moduleState.TextColor = cModuleMan.State.Enabled ? Color.FromNonPremultiplied(0, 255, 25, 255) : Color.Red;
            };

            // Settings Menu
            var settingsMenu = new ContextMenuStrip();

            var settingsButton = new GlowButton() {
                Location = new Point(enableButton.Right + 12, enableButton.Top),

                Icon       = GameService.Content.GetTexture(@"common\157109"),
                ActiveIcon = GameService.Content.GetTexture(@"common\157110"),

                BasicTooltipText = "Options",

                Parent = buildPanel
            };

            settingsButton.Click += delegate { settingsMenu.Show(settingsButton); };

            var viewModuleLogs = settingsMenu.AddMenuItem("View Module Logs");

            if (cModuleMan.Manifest.Directories.Any()) {
                var directoriesMenu = settingsMenu.AddMenuItem("Directories");
                var subDirectoriesMenu = new ContextMenuStrip();

                foreach (var directory in cModuleMan.Manifest.Directories) {
                    subDirectoriesMenu.AddMenuItem($"Explore '{directory}'");
                }

                directoriesMenu.Submenu = subDirectoriesMenu;
            }

            var deleteModule = settingsMenu.AddMenuItem("Delete Module");

            // Collapse Sections

            var collapsePanel = new FlowPanel() {
                Size          = new Point(buildPanel.Width, buildPanel.Height - moduleName.Bottom + 32 + 4),
                Location      = new Point(0,                moduleName.Bottom + 32                     + 4),
                CanScroll     = true,
                Parent        = buildPanel
            };

            // Description

            var descriptionPanel = new Panel() {
                Size       = new Point(collapsePanel.ContentRegion.Width, 155),
                CanScroll  = true,
                Location = new Point(0, moduleName.Bottom + 32 + 4),
                Title      = "Description",
                ShowBorder = true,
                Parent     = collapsePanel
            };

            var descriptionLabel = new Label() {
                Text           = cModuleMan.Manifest.Description,
                Location       = new Point(8, 8),
                Width          = descriptionPanel.Width - 16,
                AutoSizeHeight = true,
                WrapText       = true,
                Parent         = descriptionPanel
            };

            // Permissions

            var permissionPanel = new FlowPanel() {
                Size                 = descriptionPanel.Size,
                CanScroll            = true,
                Location             = new Point(0, descriptionPanel.Bottom + Panel.MenuStandard.ControlOffset.Y),
                PadLeftBeforeControl = true,
                PadTopBeforeControl  = true,
                ControlPadding       = new Vector2(10),
                Title                = "Permissions",
                ShowBorder           = true,
                Parent               = collapsePanel
            };

            foreach (var perm in cModuleMan.Manifest.ApiPermissions) {
                var permCheckbox = new Checkbox() {
                    Text   = perm.Key.ToString(),
                    Parent = permissionPanel,
                    Width  = permissionPanel.Width / 3
                };
            }
        }
Beispiel #22
0
    /// <summary>
    /// 使用该函数前必须使用 BeginWindows 和 EndWindows 包裹才能显示
    /// </summary>
    /// <param name="rect"></param>
    /// <param name="label"></param>
    /// <param name="fun"></param>
    /// <param name="isDrag"></param>
    /// <returns></returns>
    public static StandardButton MessageBox(Rect rect, string label, Action <Rect> fun, StandardButton button = StandardButton.OK | StandardButton.No, bool isDrag = true)
    {
        rect = GUILayout.Window(0, rect, id => {
            GUI.enabled = true;
            fun.Invoke(rect);
            GUILayout.FlexibleSpace();
            if (button == StandardButton.OK)
            {
                if (GUILayout.Button("Ok"))
                {
                    b = StandardButton.OK;
                }
            }
            else if (button == StandardButton.No)
            {
                if (GUILayout.Button("No"))
                {
                    b = StandardButton.No;
                }
            }
            else if (button == StandardButton.Cancel)
            {
                if (GUILayout.Button("Cancel"))
                {
                    b = StandardButton.Cancel;
                }
            }
            else if (button == (StandardButton.OK | StandardButton.No))
            {
                QEditorLayout.Horizontal(e => {
                    if (GUILayout.Button("Ok"))
                    {
                        b = StandardButton.OK;
                    }
                    if (GUILayout.Button("No"))
                    {
                        b = StandardButton.No;
                    }
                });
            }
            else if (button == (StandardButton.OK | StandardButton.Cancel))
            {
                QEditorLayout.Horizontal(e => {
                    if (GUILayout.Button("Ok"))
                    {
                        b = StandardButton.OK;
                    }
                    if (GUILayout.Button("Cancel"))
                    {
                        b = StandardButton.Cancel;
                    }
                });
            }
            else if (button == (StandardButton.OK | StandardButton.No | StandardButton.Cancel))
            {
                QEditorLayout.Horizontal(e => {
                    if (GUILayout.Button("Ok"))
                    {
                        b = StandardButton.OK;
                    }
                    if (GUILayout.Button("No"))
                    {
                        b = StandardButton.No;
                    }
                    if (GUILayout.Button("Cancel"))
                    {
                        b = StandardButton.Cancel;
                    }
                });
            }

            GUI.FocusWindow(id);
            GUI.BringWindowToFront(id);
            if (isDrag)
            {
                GUI.DragWindow(new Rect(0, 0, 10000, 20));
            }
            if (QEditorEvent.IsKeyDown())
            {
                if (QEditorEvent.GetKeyCode(KeyCode.Return))
                {
                    b = StandardButton.OK;
                }
                else if (QEditorEvent.GetKeyCode(KeyCode.Escape))
                {
                    b = StandardButton.Cancel;
                }
            }
        }, label);



        GUI.enabled = false;

        return(b);
    }
Beispiel #23
0
        public void Initialize()
        {
            closeButton = new StandardButton(15)
            {
                Position = new Point(Width - 17, Height - 4),
                Text     = "[ESC] Close"
            };
            closeButton.Click += (sender, args) => Exit?.Invoke(this, EventArgs.Empty);
            Add(closeButton);

            editSpellButton = new StandardButton(25)
            {
                Position = new Point(Width - 57, 13),
                Text     = "[E] Edit Spell"
            };
            editSpellButton.Click += (sender, args) => EditSpell?.Invoke(this, EventArgs.Empty);
            Add(editSpellButton);

            castSpellButton = new StandardButton(25)
            {
                Position = new Point(Width - 57, 16),
                Text     = "[C] Cast Spell"
            };
            castSpellButton.Click += (sender, args) => CastSpell?.Invoke(this, EventArgs.Empty);
            Add(castSpellButton);

            removeSpellButton = new StandardButton(25)
            {
                Position = new Point(Width - 57, 19),
                Text     = "[R] Remove Spell"
            };
            removeSpellButton.Click += (sender, args) => RemoveSpell?.Invoke(this, EventArgs.Empty);
            Add(removeSpellButton);

            scribeSpellButton = new StandardButton(25)
            {
                Position = new Point(Width - 57, 22),
                Text     = "[G] Write Scroll"
            };
            scribeSpellButton.Click += (sender, args) => ScribeSpell?.Invoke(this, EventArgs.Empty);
            Add(scribeSpellButton);

            saveToLibraryButton = new StandardButton(25)
            {
                Position = new Point(Width - 30, 16),
                Text     = "[T] Save to Library"
            };
            saveToLibraryButton.Click += (sender, args) => SaveToLibrary?.Invoke(this, EventArgs.Empty);
            Add(saveToLibraryButton);

            loadFromLibraryButton = new StandardButton(25)
            {
                Position = new Point(Width - 30, 13),
                Text     = "[L] Load from Library"
            };
            loadFromLibraryButton.Click += (sender, args) => LoadFromLibrary?.Invoke(this, EventArgs.Empty);
            Add(loadFromLibraryButton);

            spellDetails = new SpellDetailsControl(57, Height - 10, PlayerMana)
            {
                Position = new Point(Width - 58, 3)
            };
            Add(spellDetails);

            var scrollBarTheme = new ScrollBarTheme
            {
                Normal = new Cell(DefaultForeground, DefaultBackground)
            };
            var scrollBar = new ScrollBar(Orientation.Vertical, Height - 4)
            {
                Position = new Point(Width - 60, 3),
                Theme    = scrollBarTheme
            };

            Add(scrollBar);
            spellsListBox = new CustomListBox <SpellListBoxItem>(Width - 61, Height - 4, scrollBar)
            {
                Position = new Point(1, 3)
            };
            spellsListBox.SelectionChanged += spellsListBox_SelectedItemChanged;
            Add(spellsListBox);

            RefreshSpells();

            UpdateSpellDetails();
        }
Beispiel #24
0
        public LcarsInputBox(string prompt, string title, string defaultResponse, int posX, int posY)
        {
            BackColor       = Color.Black;
            ForeColor       = Color.Orange;
            Size            = new Size(400, 200);
            FormBorderStyle = FormBorderStyle.None;
            if (posX == -1)
            {
                posX = Screen.AllScreens[0].Bounds.Width / 2 - 200;
            }
            if (posY == -1)
            {
                posY = Screen.AllScreens[0].Bounds.Height / 2 - 100;
            }

            StartPosition = FormStartPosition.Manual;
            Location      = new Point(posX, posY);

            TextButton titleBar = new TextButton();

            titleBar.Width     = 390;
            titleBar.Height    = 30;
            titleBar.Location  = new Point(5, 5);
            titleBar.Text      = title;
            titleBar.Clickable = true;
            Controls.Add(titleBar);

            TextButton bottomBar = new TextButton();

            bottomBar.Width     = 390;
            bottomBar.Top       = 195 - bottomBar.Height;
            bottomBar.Left      = 5;
            bottomBar.Text      = "";
            bottomBar.Clickable = false;
            Controls.Add(bottomBar);

            RichTextBox txtPrompt = new RichTextBox();

            txtPrompt.Width       = 390;
            txtPrompt.Height      = 65;
            txtPrompt.Top         = titleBar.Bottom + 7;
            txtPrompt.Left        = 5;
            txtPrompt.Text        = prompt;
            txtPrompt.BackColor   = Color.Black;
            txtPrompt.ForeColor   = Color.Orange;
            txtPrompt.BorderStyle = BorderStyle.None;
            txtPrompt.Font        = FontProvider.Lcars(14);
            txtPrompt.ReadOnly    = true;
            txtPrompt.WordWrap    = true;
            Controls.Add(txtPrompt);

            inputBox.Left      = 10;
            inputBox.Width     = 380;
            inputBox.Top       = txtPrompt.Bottom + 7;
            inputBox.BackColor = Color.Black;
            inputBox.ForeColor = Color.Orange;
            inputBox.Font      = FontProvider.Lcars(14);
            inputBox.Text      = defaultResponse;
            inputBox.TabIndex  = 0;
            inputBox.Focus();
            Controls.Add(inputBox);

            StandardButton okButton = new StandardButton();

            okButton.Height          = bottomBar.Height;
            okButton.Top             = bottomBar.Top - 7 - okButton.Height;
            okButton.Width           = 70;
            okButton.Left            = 325;
            okButton.ColorFunction   = LcarsColorFunction.PrimaryFunction;
            okButton.Text            = "OK";
            okButton.ButtonTextAlign = ContentAlignment.MiddleCenter;
            Controls.Add(okButton);
            okButton.Click += Ok_Click;

            StandardButton cancelButton = new StandardButton();

            cancelButton.Height          = bottomBar.Height;
            cancelButton.Top             = bottomBar.Top - 7 - cancelButton.Height;
            cancelButton.Width           = 70;
            cancelButton.Left            = 248;
            cancelButton.ColorFunction   = LcarsColorFunction.CriticalFunction;
            cancelButton.Text            = "Cancel";
            cancelButton.ButtonTextAlign = ContentAlignment.MiddleCenter;
            Controls.Add(cancelButton);
            cancelButton.Click += Cancel_Click;
            KeyPreview          = true;
            KeyDown            += Me_KeyDown;

            titleBar.MouseDown += Title_MouseDown;
            titleBar.MouseMove += Title_MouseMove;

            inputBox.Select();
        }
Beispiel #25
0
        private Panel BuildTemplatePanel(Rectangle rect)
        {
            var btPanel = new Panel()
            {
                CanScroll = false,
                Size      = rect.Size,
            };

            int topOffset = Panel.MenuStandard.ControlOffset.Y;

            var menuSection = new Panel
            {
                Title      = "Build Templates",
                ShowBorder = true,
                Size       = Panel.MenuStandard.Size - new Point(0, 2 * topOffset + Panel.MenuStandard.ControlOffset.Y + 57),
                Location   = new Point(Panel.MenuStandard.PanelOffset.X, topOffset + 37),
                Parent     = btPanel
            };

            var scrollPanel = new Panel
            {
                CanScroll = true,
                Parent    = menuSection,
                Size      = new Point(menuSection.Size.X, menuSection.ContentRegion.Size.Y),
            };
            //Adhesive.Binding.CreateOneWayBinding(() => scrollPanel.Size, () => menuSection.ContentRegion, c => c.Size);

            var buildTemplates = new Menu
            {
                //Height = menuSection.ContentRegion.Size.Y - 40,
                MenuItemHeight = 40,
                Parent         = scrollPanel,
                CanSelect      = true,
                Size           = scrollPanel.Size,
            };
            //Adhesive.Binding.CreateOneWayBinding(() => buildTemplates.Size, () => scrollPanel.ContentRegion, c => c.Size);

            var newButton = new StandardButton
            {
                Parent = btPanel,
                Text   = "New Template",
                Width  = menuSection.ContentRegion.Width - 10,
                Left   = menuSection.ContentRegion.Left + Panel.MenuStandard.PanelOffset.X,
                Top    = menuSection.Bottom + 3,
            };


            var _templates = new ObservableCollection <Template>();

            _templates.CollectionChanged += (sender, args) => {
                if (args.Action != System.Collections.Specialized.NotifyCollectionChangedAction.Add)
                {
                    return;
                }
                Template t  = (Template)args.NewItems[0];
                var      bt = buildTemplates.AddMenuItem(t.Name, t.Icon);
                bt.Click += delegate
                {
                    _tplPanel.Template = t;
                };
                var ctxMenu = new ContextMenuStrip();
                ctxMenu.AddMenuItem("Copy Chatcode").Click += (s, a) => System.Windows.Forms.Clipboard.SetText(t.Value);
                bt.Menu = ctxMenu;
                Adhesive.Binding.CreateOneWayBinding(() => bt.Text, () => t.Name);
            };
            Func <string, Template> findTplByName = name => _templates.SingleOrDefault(t => t.Name == name);

            foreach (var t in
                     Directory
                     .GetFiles(_templatePath, "*.txt", SearchOption.TopDirectoryOnly)
                     .Select(f => new Template(Path.GetFileNameWithoutExtension(f)))
                     )
            {
                _templates.Add(t);
            }

            newButton.Click += delegate
            {
                var toAdd = new Template("[New Template]");
                _templates.Add(toAdd);
                buildTemplates.Select((MenuItem)buildTemplates.Children.SingleOrDefault(t => ((MenuItem)t).Text == toAdd.Name));
                _tplPanel.Template = toAdd;
            };


            if (_templates.Count > 0)
            {
                buildTemplates.Select((MenuItem)buildTemplates.Children.First());
            }
            else
            {
                var toAdd = new Template("[New Template]");
                _templates.Add(toAdd);
                buildTemplates.Select((MenuItem)buildTemplates.Children.SingleOrDefault(t => ((MenuItem)t).Text == toAdd.Name));
            }


            GameService.Overlay.QueueMainThreadUpdate((gameTime) => {
                var searchBox = new TextBox()
                {
                    PlaceholderText = "Search",
                    Width           = menuSection.ContentRegion.Width,
                    Location        = new Point(menuSection.ContentRegion.Left + Panel.MenuStandard.PanelOffset.X, TextBox.ControlStandard.ControlOffset.Y),
                    Parent          = btPanel
                };

                searchBox.TextChanged += delegate(object sender, EventArgs args) {
                    foreach (MenuItem mi in buildTemplates.GetDescendants())
                    {
                        mi.MenuItemHeight = 40;
                        if (!mi.Text.ToLower().Contains(searchBox.Text.ToLower()))
                        {
                            mi.MenuItemHeight = 0;
                        }
                    }
                };
            });

            var tmp = findTplByName(buildTemplates.SelectedMenuItem.Text);

            // Main panel
            _tplPanel = new TemplateDetails(tmp)
            {
                Location = new Point(menuSection.Right + Panel.ControlStandard.ControlOffset.X, Panel.ControlStandard.ControlOffset.Y),
                Size     = new Point(btPanel.ContentRegion.Width - menuSection.Right - Control.ControlStandard.ControlOffset.X, rect.Height - 2 * Panel.ControlStandard.ControlOffset.Y),
                Parent   = btPanel,
            };


            return(btPanel);
        }
Beispiel #26
0
        private void InitializeControls()
        {
            closeButton = new StandardButton(15)
            {
                Position = new Point(Width - 17, Height - 4),
                Text     = "[ESC] Close"
            };
            closeButton.Click += (sender, args) => Exit?.Invoke(this, EventArgs.Empty);
            Add(closeButton);

            itemDetails = new ItemDetailsControl(52, Height - 10, Player)
            {
                Position = new Point(Width - 53, 3)
            };
            Add(itemDetails);

            filterAllButton = new StandardButton(5)
            {
                Position      = new Point(2, 3),
                DisabledColor = Color.Blue,
                Text          = "All"
            };
            filterAllButton.Click += (sender, args) => ChangeFilter(FilterType.All);
            Add(filterAllButton);

            filterWeaponButton = new StandardButton(5)
            {
                Position      = new Point(7, 3),
                DisabledColor = Color.Blue,
                Text          = "─┼ ".ConvertGlyphs()
            };
            filterWeaponButton.Click += (sender, args) => ChangeFilter(FilterType.Weapon);
            Add(filterWeaponButton);

            filterArmorButton = new StandardButton(5)
            {
                Position      = new Point(12, 3),
                DisabledColor = Color.Blue,
                Text          = "╭█╮".ConvertGlyphs()
            };
            filterArmorButton.Click += (sender, args) => ChangeFilter(FilterType.Armor);
            Add(filterArmorButton);

            filterUsableButton = new StandardButton(5)
            {
                Position      = new Point(17, 3),
                DisabledColor = Color.Blue,
                Text          = " ▲ ".ConvertGlyphs()
            };
            filterUsableButton.Click += (sender, args) => ChangeFilter(FilterType.Usable);
            Add(filterUsableButton);

            filterOtherButton = new StandardButton(5)
            {
                Position      = new Point(22, 3),
                DisabledColor = Color.Blue,
                Text          = " ? ".ConvertGlyphs()
            };
            filterOtherButton.Click += (sender, args) => ChangeFilter(FilterType.Other);
            Add(filterOtherButton);

            var scrollBarTheme = new ScrollBarTheme
            {
                Normal = new Cell(DefaultForeground, DefaultBackground)
            };
            var itemListScroll = new ScrollBar(Orientation.Vertical, Height - 4)
            {
                Position = new Point(Width - 55, 6),
                Theme    = scrollBarTheme,
                CanFocus = false
            };

            Add(itemListScroll);
            itemsList = new CustomListBox <InventoryStackItem>(Width - 56, Height - 4, itemListScroll)
            {
                Position = new Point(1, 6)
            };
            itemsList.SelectionChanged += itemsListBox_SelectedItemChanged;
            Add(itemsList);

            RefreshFilterButtonsState();
        }
Beispiel #27
0
        private void InitializeControls()
        {
#if DEBUG
            var cheatsButton = new StandardButton(3)
            {
                Text     = "*",
                Position = new Point(Width - 39, 37)
            };
            cheatsButton.Click += (sender, args) => OpenCheats?.Invoke(this, EventArgs.Empty);
            Add(cheatsButton);
#endif

            var playerStatsControl = new PlayerStatsVisualControl(
                new Rectangle(Width - 40, 1, 39, 65),
                Game);
            AddVisualControl(playerStatsControl);

            gameArea = new GameAreaControl(Game)
            {
                Position = new Point(1, 1)
            };
            Add(gameArea);

            journalScroll = new ScrollBar(Orientation.Vertical, 9)
            {
                Position = new Point(1, Height - 10),
                CanFocus = false,
                Theme    = new ScrollBarTheme
                {
                    Normal = new Cell(Color.White, Color.Black)
                }
            };
            Add(journalScroll);

            journalBox = new JournalBoxControl(Width - 3, 10, journalScroll, Game.Journal)
            {
                Position = new Point(2, Height - 11)
            };
            Add(journalBox);


            openInventoryButton = new StandardButton(30)
            {
                Position = new Point(Width - 39, 22),
                Text     = "[I] Inventory"
            };
            openInventoryButton.Click += (sender, args) => OpenInventory?.Invoke(this, EventArgs.Empty);
            Add(openInventoryButton);

            openSpellBookButton = new StandardButton(30)
            {
                Position = new Point(Width - 39, 25),
                Text     = "[C] Spell Book"
            };
            openSpellBookButton.Click    += (sender, args) => OpenSpellBook?.Invoke(this, EventArgs.Empty);
            openSpellBookButton.IsEnabled = true;
            Add(openSpellBookButton);

            showItemsOnFloorButton = new StandardButton(30)
            {
                Position = new Point(Width - 39, 28),
                Text     = "[G] Check Floor"
            };
            showItemsOnFloorButton.Click += (sender, args) => OpenGroundView?.Invoke(this, EventArgs.Empty);
            Add(showItemsOnFloorButton);

            openPlayerStatsButton = new StandardButton(30)
            {
                Position = new Point(Width - 39, 31),
                Text     = "[V] Player Status"
            };
            openPlayerStatsButton.Click += (sender, args) => OpenPlayerStats?.Invoke(this, EventArgs.Empty);
            Add(openPlayerStatsButton);
        }
Beispiel #28
0
        private Panel BuildHomePanel(WindowBase wndw)
        {
            var tdPanel = new Panel()
            {
                CanScroll = false,
                Size      = wndw.ContentRegion.Size
            };


            int topOffset = 40 + Panel.MenuStandard.ControlOffset.Y;

            var menuSection = new Panel
            {
                Title      = "Event Categories",
                ShowBorder = true,
                Size       = Panel.MenuStandard.Size - new Point(0, +topOffset + Panel.MenuStandard.ControlOffset.Y),
                Location   = new Point(Panel.MenuStandard.PanelOffset.X, topOffset),
                Parent     = tdPanel
            };
            var mainPanel = new FlowPanel()
            {
                FlowDirection = ControlFlowDirection.LeftToRight,
                Location      = new Point(menuSection.Right + Panel.MenuStandard.ControlOffset.X, menuSection.Top),
                Size          = new Point(tdPanel.Right - menuSection.Right - (Control.ControlStandard.ControlOffset.X * 2), menuSection.Height),
                CanScroll     = false,
                Parent        = tdPanel,
            };
            var taskPanel = new FlowPanel()
            {
                FlowDirection  = ControlFlowDirection.LeftToRight,
                ControlPadding = new Vector2(8, 8),
                //Location = new Point(menuSection.Right + Panel.MenuStandard.ControlOffset.X, menuSection.Top),
                Size      = new Point(tdPanel.Right - menuSection.Right - (Control.ControlStandard.ControlOffset.X * 2), menuSection.Height - 70),
                CanScroll = true,
                Parent    = mainPanel,
            };

            GameService.Overlay.QueueMainThreadUpdate((gameTime) => {
                var searchBox = new TextBox()
                {
                    PlaceholderText = "Filter Tasks",
                    Width           = menuSection.Width,
                    Location        = new Point(menuSection.Left, TextBox.Standard.ControlOffset.Y),
                    Parent          = tdPanel
                };

                searchBox.TextChanged += delegate(object sender, EventArgs args) {
                    taskPanel.FilterChildren <DetailsButton>(db => db.Text.ToLower().Contains(searchBox.Text.ToLower()));
                };
            });

            foreach (var task in tdTask.Tasks)
            {
                var es2 = new DetailsButton
                {
                    Parent           = taskPanel,
                    BasicTooltipText = task.Category,
                    Text             = task.Description,
                    IconSize         = DetailsIconSize.Small,
                    ShowVignette     = false,
                    HighlightType    = DetailsHighlightType.LightHighlight,
                    ShowToggleButton = true
                };

                if (task.Texture.HasTexture)
                {
                    es2.Icon = task.Texture;
                }
                _displayedTasks.Add(es2);
            }

            var actionPanel = new FlowPanel()
            {
                Size           = new Point(taskPanel.Width, 50),
                CanScroll      = false,
                FlowDirection  = ControlFlowDirection.LeftToRight,
                ShowBorder     = false,
                Parent         = mainPanel,
                ControlPadding = new Vector2(8, 8)

                                 //BackgroundColor = Microsoft.Xna.Framework.Color.Black
            };
            var newTaskButton = new StandardButton
            {
                Parent = actionPanel,
                Text   = "New Task"
            };

            //Create new panel to switch to
            var newtaskPanel = BuildNewTaskPanel(wndw);

            newTaskButton.LeftMouseButtonReleased += delegate { wndw.Navigate(newtaskPanel, true); };

            //Add categories
            var taskCategories = new Menu
            {
                Size           = menuSection.ContentRegion.Size,
                MenuItemHeight = 40,
                Parent         = menuSection,
                CanSelect      = true
            };

            List <IGrouping <string, tdTask> > submetas = tdTask.Tasks.GroupBy(e => e.Category).ToList();

            var evAll = taskCategories.AddMenuItem(EC_ALLEVENTS);

            evAll.Select();
            evAll.Click += delegate {
                taskPanel.FilterChildren <DetailsButton>(db => true);
            };
            foreach (IGrouping <string, tdTask> e in submetas)
            {
                var ev = taskCategories.AddMenuItem(e.Key);
                ev.Click += delegate {
                    taskPanel.FilterChildren <DetailsButton>(db => string.Equals(db.BasicTooltipText, e.Key));
                };
            }
            return(tdPanel);
        }
Beispiel #29
0
        private Panel BuildComposerPanel(WindowBase wndw)
        {
            var cPanel = new Panel()
            {
                CanScroll = false,
                Size      = wndw.ContentRegion.Size
            };
            var backButton = new BackButton(wndw)
            {
                Text     = "Musician",
                NavTitle = "Composer",
                Parent   = cPanel,
                Location = new Point(20, 20),
            };
            var composerPanel = new Panel()
            {
                Location  = new Point(Panel.LEFT_MARGIN + 20, Panel.BOTTOM_MARGIN + backButton.Bottom),
                Size      = new Point(cPanel.Size.X - 50 - Panel.LEFT_MARGIN, cPanel.Size.Y - 50 - Panel.BOTTOM_MARGIN),
                Parent    = cPanel,
                CanScroll = false
            };
            var titleTextBox = new TextBox
            {
                Size            = new Point(150, 20),
                Location        = new Point(0, 20),
                PlaceholderText = "Title",
                Parent          = composerPanel
            };
            var titleArtistLabel = new Label
            {
                Size     = new Point(20, 20),
                Location = new Point(titleTextBox.Left + titleTextBox.Width + 20, titleTextBox.Top),
                Text     = " - ",
                Parent   = composerPanel
            };
            var artistTextBox = new TextBox
            {
                Size            = new Point(150, 20),
                Location        = new Point(titleArtistLabel.Left + titleArtistLabel.Width + 20, titleArtistLabel.Top),
                PlaceholderText = "Artist",
                Parent          = composerPanel
            };
            var userLabel = new Label
            {
                Size     = new Point(150, 20),
                Location = new Point(0, titleTextBox.Top + 20 + Panel.BOTTOM_MARGIN),
                Text     = "Created by",
                Parent   = composerPanel
            };

            // TODO: Make this a non-editable Label and get account name from ApiService.
            var userTextBox = new TextBox
            {
                Size            = new Point(150, 20),
                Location        = new Point(titleArtistLabel.Left + titleArtistLabel.Width + 20, userLabel.Top),
                PlaceholderText = "User (Nekres.1038)",
                Parent          = composerPanel
            };
            var ddInstrumentSelection = new Dropdown()
            {
                Parent   = composerPanel,
                Location = new Point(0, userTextBox.Top + 20 + Panel.BOTTOM_MARGIN),
                Width    = 150,
            };

            foreach (string item in Instruments)
            {
                ddInstrumentSelection.Items.Add(item);
            }
            var ddAlgorithmSelection = new Dropdown()
            {
                Parent   = composerPanel,
                Location = new Point(titleArtistLabel.Left + titleArtistLabel.Width + 20, ddInstrumentSelection.Top),
                Width    = 150,
            };

            ddAlgorithmSelection.Items.Add("Favor Notes");
            ddAlgorithmSelection.Items.Add("Favor Chords");
            var tempoLabel = new Label()
            {
                Parent   = composerPanel,
                Location = new Point(0, ddInstrumentSelection.Top + 22 + Panel.BOTTOM_MARGIN),
                Size     = new Point(150, 20),
                Text     = "Beats per minute:"
            };
            var tempoCounterBox = new CounterBox()
            {
                Parent     = composerPanel,
                Location   = new Point(titleArtistLabel.Left + titleArtistLabel.Width + 20, tempoLabel.Top),
                ValueWidth = 50,
                MaxValue   = 200,
                MinValue   = 40,
                Numerator  = 5,
                Value      = 90
            };
            var meterLabel = new Label()
            {
                Parent   = composerPanel,
                Location = new Point(0, tempoLabel.Top + 22 + Panel.BOTTOM_MARGIN),
                Size     = new Point(150, 20),
                Text     = "Notes per beat:"
            };
            var meterCounterBox = new CounterBox()
            {
                Parent      = composerPanel,
                Location    = new Point(titleArtistLabel.Left + titleArtistLabel.Width + 20, meterLabel.Top),
                ValueWidth  = 50,
                MaxValue    = 16,
                MinValue    = 1,
                Prefix      = @"1\",
                Exponential = true,
                Value       = 1
            };
            var notationTextBox = new TextBox
            {
                Size            = new Point(composerPanel.Width, composerPanel.Height - 300),
                Location        = new Point(0, meterCounterBox.Top + 22 + Panel.BOTTOM_MARGIN),
                PlaceholderText = "",
                Parent          = composerPanel
            };

            // TODO: Upload button. Upload method that validates music sheet (=> valid account name etc.)
            var saveBttn = new StandardButton()
            {
                Text     = "Save",
                Location = new Point(composerPanel.Width - 128 - Panel.RIGHT_MARGIN, notationTextBox.Bottom + 5),
                Width    = 128,
                Height   = 26,
                Parent   = composerPanel
            };

            saveBttn.LeftMouseButtonReleased   += (sender, args) => {
                // TODO: Save the notation as XML locally.
            };
            backButton.LeftMouseButtonReleased += (object sender, MouseEventArgs e) => { wndw.NavigateHome(); };
            return(cPanel);
        }
Beispiel #30
0
        private void InitializeControls()
        {
            checkScrollButton = new StandardButton(20)
            {
                Position = new Point(Width - 30, 40),
                Text     = "[C] Check Scroll"
            };
            checkScrollButton.Click += (sender, args) => CheckScroll?.Invoke(this, EventArgs.Empty);
            Add(checkScrollButton);

            useItemButton = new StandardButton(20)
            {
                Position = new Point(Width - 52, 40),
                Text     = "[U] Use"
            };
            useItemButton.Click += (sender, args) => UseItem?.Invoke(this, EventArgs.Empty);
            Add(useItemButton);

            equipItemButton = new StandardButton(20)
            {
                Position = new Point(Width - 52, 40),
                Text     = "[E] Equip"
            };
            equipItemButton.Click += (sender, args) => EquipItem?.Invoke(this, EventArgs.Empty);
            Add(equipItemButton);

            equipLeftHoldableButton = new StandardButton(20)
            {
                Position = new Point(Width - 52, 40),
                Text     = "[Z] Equip Left"
            };
            equipLeftHoldableButton.Click += (sender, args) => EquipHoldableItemLeft?.Invoke(this, EventArgs.Empty);
            Add(equipLeftHoldableButton);

            equipRightHoldableButton = new StandardButton(20)
            {
                Position = new Point(Width - 31, 40),
                Text     = "[X] Equip Right"
            };
            equipRightHoldableButton.Click += (sender, args) => EquipHoldableItemRight?.Invoke(this, EventArgs.Empty);
            Add(equipRightHoldableButton);

            takeOffItemButton = new StandardButton(20)
            {
                Position = new Point(Width - 52, 40),
                Text     = "[T] Take Off"
            };
            takeOffItemButton.Click += (sender, args) => TakeOffItem?.Invoke(this, EventArgs.Empty);
            Add(takeOffItemButton);

            dropItemButton = new StandardButton(20)
            {
                Position = new Point(Width - 52, 43),
                Text     = "[D] Drop"
            };
            dropItemButton.Click += (sender, args) => DropItem?.Invoke(this, EventArgs.Empty);
            Add(dropItemButton);

            dropAllItemsButton = new StandardButton(20)
            {
                Position = new Point(Width - 52, 46),
                Text     = "[A] Drop All"
            };
            dropAllItemsButton.Click += (sender, args) => DropStack?.Invoke(this, EventArgs.Empty);
            Add(dropAllItemsButton);
        }