Exemplo n.º 1
0
 public MovieScreen(byte[] movieData, MusicType music, Screen nextScreen)
 {
     this.music = music;
     this.nextScreen = nextScreen;
     moviePlayer = new MoviePlayer(movieData, OnMovieFinished);
     AddControl(moviePlayer);
 }
Exemplo n.º 2
0
        public LoadGame(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 game to load", 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;

                if (GameState.GameDataExists(gameId))
                {
                    var data = GameState.LoadGameData(gameId);
                    AddControl(new Button(topRow - 2, 10, 24, 12, $"{gameId}", theme.ButtonScheme, Font.Normal, () => OnLoadGame(data)));
                    AddControl(new ExtendedLabel(topRow, 36, 159, data.Name, Font.Normal, theme.TextScheme));
                    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
                {
                    AddControl(new Button(topRow - 2, 10, 24, 12, $"{gameId}", theme.ButtonScheme, Font.Normal, () => {}));
                }
            }
            AddControl(new Button(172, 120, 80, 16, "CANCEL", theme.ButtonScheme, Font.Normal, OnCancel));
        }
Exemplo n.º 3
0
 public void DoModal(Screen parent)
 {
     ModalParent = parent;
     parent.OnKillFocus();
     parent.AddControl(this);
     GameState.Current.Dispatcher.CaptureFocus(this);
     WindowsSoundEffect.WindowOpen.Play();
     OnSetFocus();
 }
Exemplo n.º 4
0
 public Manufacture(Screen returnToScreen)
 {
     this.returnToScreen = returnToScreen;
     var selectedBase = GameState.SelectedBase;
     AddControl(new Border(0, 0, 320, 200, ColorScheme.Purple, Backgrounds.Workshop, 1));
     AddControl(new Label(8, Label.Center, "CURRENT PRODUCTION", Font.Large, ColorScheme.Purple));
     AddControl(new Label(24, 8, "Engineers Available>", Font.Normal, ColorScheme.Purple));
     AddControl(new DynamicLabel(24, 96, () => selectedBase.EngineersAvailable.FormatNumber(), Font.Normal, ColorScheme.White));
     AddControl(new Label(24, 160, "Engineers Allocated>", Font.Normal, ColorScheme.Purple));
     AddControl(new DynamicLabel(24, 249, () => selectedBase.EngineersAllocated.FormatNumber(), Font.Normal, ColorScheme.White));
     AddControl(new Label(34, 8, "Workshop Space Available>", Font.Normal, ColorScheme.Purple));
     AddControl(new DynamicLabel(34, 124, () => selectedBase.WorkshopSpaceAvailable.FormatNumber(), Font.Normal, ColorScheme.White));
     AddControl(new Label(34, 160, "Current Funds>", Font.Normal, ColorScheme.Purple));
     AddControl(new DynamicLabel(34, 228, () => $"${GameState.Current.Data.Funds.FormatNumber()}", Font.Normal, ColorScheme.White));
     AddControl(new Label(52, 10, "ITEM", Font.Normal, ColorScheme.LightMagenta));
     AddControl(new Label(44, 90, "Engineers", Font.Normal, ColorScheme.LightMagenta));
     AddControl(new Label(52, 90, "Allocated", Font.Normal, ColorScheme.LightMagenta));
     AddControl(new Label(44, 137, "Units", Font.Normal, ColorScheme.LightMagenta));
     AddControl(new Label(52, 137, "Produced", Font.Normal, ColorScheme.LightMagenta));
     AddControl(new Label(44, 180, "Total to", Font.Normal, ColorScheme.LightMagenta));
     AddControl(new Label(52, 180, "Produce", Font.Normal, ColorScheme.LightMagenta));
     AddControl(new Label(44, 223, "Cost", Font.Normal, ColorScheme.LightMagenta));
     AddControl(new Label(52, 223, "per", Font.Normal, ColorScheme.LightMagenta));
     AddControl(new Label(60, 223, "Unit", Font.Normal, ColorScheme.LightMagenta));
     AddControl(new Label(44, 265, "Days/Hours", Font.Normal, ColorScheme.LightMagenta));
     AddControl(new Label(52, 265, "Left", Font.Normal, ColorScheme.LightMagenta));
     AddControl(new ListView<ManufactureProject>(80, 8, 11, selectedBase.ManufactureProjects, ColorScheme.Blue, Palette.GetPalette(1).GetColor(230), OnSelectManufactureProject)
         .AddColumn(1, Alignment.Left, project => "")
         .AddColumn(105, Alignment.Left, project => project.ManufactureType.Metadata().Name)
         .AddColumn(39, Alignment.Left, project => project.EngineersAllocated.FormatNumber())
         .AddColumn(45, Alignment.Left, project => project.UnitsProduced.FormatNumber())
         .AddColumn(27, Alignment.Left, project => project.UnitsToProduce.FormatNumber())
         .AddColumn(47, Alignment.Left, project => $"${project.ManufactureType.Metadata().Cost.FormatNumber()}")
         .AddColumn(24, Alignment.Left, project => project.TimeRemaining));
     AddControl(new Button(176, 8, 148, 16, "New Production", ColorScheme.Blue, Font.Normal, OnNewProduction));
     AddControl(new Button(176, 164, 148, 16, "OK", ColorScheme.Blue, Font.Normal, OnOk));
 }
Exemplo n.º 5
0
 public Research(Screen returnToScreen)
 {
     this.returnToScreen = returnToScreen;
     var selectedBase = GameState.SelectedBase;
     AddControl(new Border(0, 0, 320, 200, ColorScheme.Blue, Backgrounds.Research, 7));
     AddControl(new Label(8, Label.Center, "CURRENT RESEARCH", Font.Large, ColorScheme.Blue));
     AddControl(new Label(24, 8, "Scientists Available>", Font.Normal, ColorScheme.Blue));
     AddControl(new DynamicLabel(24, 97, () => selectedBase.ScientistsAvailable.FormatNumber(), Font.Normal, ColorScheme.White));
     AddControl(new Label(24, 160, "Scientists Allocdated>", Font.Normal, ColorScheme.Blue));
     AddControl(new DynamicLabel(24, 255, () => selectedBase.ScientistsAllocated.FormatNumber(), Font.Normal, ColorScheme.White));
     AddControl(new Label(34, 8, "Laboratory Space Available>", Font.Normal, ColorScheme.Blue));
     AddControl(new DynamicLabel(34, 133, () => selectedBase.LaboratorySpaceAvailable.FormatNumber(), Font.Normal, ColorScheme.White));
     AddControl(new Label(44, 8, "RESEARCH PROJECT", Font.Normal, ColorScheme.Blue));
     AddControl(new Label(44, 115, "SCIENTISTS ALLOCATED", Font.Normal, ColorScheme.Blue));
     AddControl(new Label(44, 250, "PROGRESS", Font.Normal, ColorScheme.Blue));
     var selectionColor = Palette.GetPalette(7).GetColor(230);
     AddControl(new ListView<ResearchProject>(54, 8, 15, GameState.SelectedBase.ResearchProjects, ColorScheme.Purple, selectionColor, OnClickResearch)
         .AddColumn(2, Alignment.Left, research => "")
         .AddColumn(158, Alignment.Left, research => research.GetName())
         .AddColumn(82, Alignment.Left, research => research.ScientistsAllocated.FormatNumber())
         .AddColumn(46, Alignment.Left, research => research.GetProgress().ToString()));
     AddControl(new Button(176, 8, 148, 16, "New Project", ColorScheme.Purple, Font.Normal, OnNewProject));
     AddControl(new Button(176, 164, 148, 16, "OK", ColorScheme.Purple, Font.Normal, OnOk));
 }
Exemplo n.º 6
0
 public void SetScreen(Screen newScreen)
 {
     if (ActiveScreen != null)
     {
         ActiveScreen.OnKillFocus();
         Dispatcher.ReleaseFocus();
     }
     ActiveScreen = newScreen;
     if (ActiveScreen == null)
         return;
     Dispatcher.CaptureFocus(ActiveScreen);
     ActiveScreen.OnSetFocus();
 }
Exemplo n.º 7
0
 protected void SwitchToModal(Screen newModal)
 {
     var currentParent = ModalParent;
     EndModal();
     newModal.DoModal(currentParent);
 }