コード例 #1
0
        public CreditsScreen()
        {
            Name  = "Credits";
            State = ScreenState.Inactive;
            Input.setCurrentKeyListener(this);

            Button back = new Button(25, 650, 200, 50, "Back", () =>
            {
                State = ScreenState.Inactive;
                ScreenManager.SetState(ScreenState.Active, "Main");
                return(true);
            });

            back.BackgroundColor = Colors.PrimaryMain;
            back.HighlightColor  = Colors.PrimaryLight;
            back.TextColor       = Colors.TextPrimary;
            back.TextFont        = Fonts.MyFont_24;
            back.CenterText      = true;
            AddWidget(back);

            Array.Sort(Supporters);
        }
コード例 #2
0
        public GameScreen()
        {
            Name  = "Game";
            State = ScreenState.Inactive;

            int centerX = (int)Universal.GameSize.X / 2;

            menuButton = new Button(centerX - 300, 400, 200, 50, "Main Menu", () =>
            {
                State = ScreenState.Inactive;
                ScreenManager.SetState(ScreenState.Active, "Main");
                return(true);
            });
            menuButton.BackgroundColor = Colors.PrimaryMain;
            menuButton.HighlightColor  = Colors.PrimaryLight;
            menuButton.TextColor       = Colors.TextPrimary;
            menuButton.TextFont        = Fonts.MyFont_24;
            menuButton.CenterText      = true;
            menuButton.Visible         = false;
            AddWidget(menuButton);

            resumeButton = new Button(centerX + 100, 400, 200, 50, "Resume", () =>
            {
                PopOverlay();
                resumeButton.Visible = false;
                menuButton.Visible   = false;
                State = ScreenState.Active;
                return(true);
            });
            resumeButton.BackgroundColor = Colors.PrimaryMain;
            resumeButton.HighlightColor  = Colors.PrimaryLight;
            resumeButton.TextColor       = Colors.TextPrimary;
            resumeButton.TextFont        = Fonts.MyFont_24;
            resumeButton.CenterText      = true;
            resumeButton.Visible         = false;
            AddWidget(resumeButton);
        }
コード例 #3
0
        public LevelSelectScreen()
        {
            Name  = "Level_Select";
            State = ScreenState.Inactive;

            int centerX = (int)Universal.GameSize.X / 2;

            int i = 0;
            int x = 100;
            int y = 25;

            Dictionary <string, List <World> > worlds = new Dictionary <string, List <World> >();

            foreach (World world in WorldManager.Worlds)
            {
                List <World> worldsList;
                if (!worlds.TryGetValue(world.Group, out worldsList))
                {
                    worldsList = new List <World>();
                    worlds.Add(world.Group, worldsList);
                }

                worldsList.Add(world);
            }

            foreach (string group in worlds.Keys)
            {
                Label groupLabel = new Label(x, y, 200, 40, group);
                groupLabel.HoverColor      = Colors.TextPrimary;
                groupLabel.BackgroundColor = Colors.Clear;
                groupLabel.TextColor       = Colors.TextPrimary;
                groupLabel.TextFont        = Fonts.MyFont_24;
                AddWidget(groupLabel);

                y += 50;

                foreach (World world in worlds[group])
                {
                    if (i >= 5)
                    {
                        i  = 0;
                        x  = 100;
                        y += 75;
                    }

                    Button btn = new Button(x, y, 200, 50, world.Name, () =>
                    {
                        GameScreen.StartingLevel = world.Id;
                        State = ScreenState.Inactive;
                        ScreenManager.SetState(ScreenState.Active, "Game");
                        return(true);
                    });
                    btn.BackgroundColor = Colors.PrimaryMain;
                    btn.HighlightColor  = Colors.PrimaryLight;
                    btn.TextColor       = Colors.TextPrimary;
                    btn.TextFont        = Fonts.MyFont_24;
                    btn.CenterText      = true;
                    AddWidget(btn);

                    x += 225;
                    i++;
                }

                i  = 0;
                x  = 100;
                y += 100;
            }
        }
コード例 #4
0
        public MainScreen()
        {
            Name  = "Main";
            State = ScreenState.Active;
            Input.setCurrentKeyListener(this);

            int centerX = (int)Universal.GameSize.X / 2;

            Button btn = new Button(centerX - 75, 300, 200, 50, "Play", () =>
            {
                GameScreen.StartingLevel = "world_1";
                State = ScreenState.Inactive;
                ScreenManager.SetState(ScreenState.Active, "Game");
                return(true);
            });

            btn.BackgroundColor = Colors.PrimaryMain;
            btn.HighlightColor  = Colors.PrimaryLight;
            btn.TextColor       = Colors.TextPrimary;
            btn.TextFont        = Fonts.MyFont_24;
            btn.CenterText      = true;
            AddWidget(btn);

            btn = new Button(centerX - 75, 400, 200, 50, "Tutorial", () =>
            {
                GameScreen.StartingLevel = "intro_1";
                State = ScreenState.Inactive;
                ScreenManager.SetState(ScreenState.Active, "Game");
                return(true);
            });
            btn.BackgroundColor = Colors.PrimaryMain;
            btn.HighlightColor  = Colors.PrimaryLight;
            btn.TextColor       = Colors.TextPrimary;
            btn.TextFont        = Fonts.MyFont_24;
            btn.CenterText      = true;
            AddWidget(btn);

            btn = new Button(centerX - 75, 500, 200, 50, "Level Select", () =>
            {
                State = ScreenState.Inactive;
                ScreenManager.SetState(ScreenState.Active, "Level_Select");
                return(true);
            });
            btn.BackgroundColor = Colors.PrimaryMain;
            btn.HighlightColor  = Colors.PrimaryLight;
            btn.TextColor       = Colors.TextPrimary;
            btn.TextFont        = Fonts.MyFont_24;
            btn.CenterText      = true;
            AddWidget(btn);

            btn = new Button(centerX - 75, 600, 200, 50, "Credits", () =>
            {
                State = ScreenState.Inactive;
                ScreenManager.SetState(ScreenState.Active, "Credits");
                return(true);
            });
            btn.BackgroundColor = Colors.PrimaryMain;
            btn.HighlightColor  = Colors.PrimaryLight;
            btn.TextColor       = Colors.TextPrimary;
            btn.TextFont        = Fonts.MyFont_24;
            btn.CenterText      = true;
            AddWidget(btn);
        }