コード例 #1
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);
        }