Ejemplo n.º 1
0
 public NewBaseNamePrompt(Func<string, Screen> action)
 {
     this.action = action;
     AddControl(new Border(60, 32, 192, 80, ColorScheme.Aqua, Backgrounds.Title, 0));
     AddControl(new Label(76, Label.CenterOf(32, 192), "Base Name?", Font.Large, ColorScheme.Aqua));
     baseName = new Edit(106, 54, 137, "", Font.Large, ColorScheme.Aqua, OnEditBaseName);
     AddControl(baseName);
 }
Ejemplo n.º 2
0
        public SaveGame(Screen returnToScreen)
        {
            this.returnToScreen = returnToScreen;
            var theme = CurrentTheme;
            AddControl(new Border(0, 0, 320, 200, theme.BorderScheme, theme.Background, theme.BackgroundPalette));
            AddControl(new Label(8, Label.Center, "Select save position", Font.Large, theme.HeaderScheme));
            AddControl(new Label(24, 36, "Name", Font.Normal, theme.HeaderScheme));
            AddControl(new Label(24, 195, "Time", Font.Normal, theme.HeaderScheme));
            AddControl(new Label(24, 225, "Date", Font.Normal, theme.HeaderScheme));

            var nextTopRow = 34;
            foreach (var gameId in Enumerable.Range(1, 10))
            {
                var topRow = nextTopRow;
                nextTopRow += 14;

                var localGameId = gameId;
                if (GameState.GameDataExists(gameId))
                {
                    var data = GameState.LoadGameData(gameId);
                    var edit = new ExtendedEdit(topRow, 36, 159, data.Name, Font.Normal, theme.TextScheme, name => OnSaveGame(localGameId, name));
                    AddControl(new Button(topRow - 2, 10, 24, 12, $"{gameId}", theme.ButtonScheme, Font.Normal, () => OnClickSave(edit)));
                    AddControl(edit);
                    AddControl(new Label(topRow, 195, data.Time.ToString("H:mm"), Font.Normal, theme.TextScheme));
                    AddControl(new Label(topRow, 225, data.Time.Day.FormatOrdinal(), Font.Normal, theme.TextScheme));
                    AddControl(new Label(topRow, 255, data.Time.ToString("MMM"), Font.Normal, theme.TextScheme));
                    AddControl(new Label(topRow, 285, data.Time.ToString("yyyy"), Font.Normal, theme.TextScheme));
                }
                else
                {
                    var edit = new Edit(topRow, 36, 159, "", Font.Normal, theme.TextScheme, name => OnSaveGame(localGameId, name));
                    AddControl(new Button(topRow - 2, 10, 24, 12, $"{gameId}", theme.ButtonScheme, Font.Normal, () => OnClickSave(edit)));
                    AddControl(edit);
                }
            }
            AddControl(new Button(172, 120, 80, 16, "CANCEL", theme.ButtonScheme, Font.Normal, OnCancel));
        }
Ejemplo n.º 3
0
 private static void OnClickSave(Edit nameEdit)
 {
     nameEdit.BeginEdit();
 }