Beispiel #1
0
        public GameOverMenu(Background bg) : base(bg, "dialog")
        {
            var ui = new GridLayout(new Rectangle(Point.Zero, Size.ToPoint()), 12)
            {
                Scale = SkidiBirdGame.Scale,
                Rows =
                {
                    new Row(40)
                    {
                        new HColumn(1f)
                        {
                            VerticalAlign = VerticalAlign.Top,
                            Items = {Label.FromResource("GameOver")}
                        }
                    },
                    new Row(50)
                    {
                        new HColumn(.5f)
                        {
                            HorizontalAlign = HorizontalAlign.Right,
                            Items = {Label.FromResource("Score")}
                        },
                        new HColumn(-1f)
                        {
                            (_scoresLb = new Label("0"))
                        }
                    },
                    new Row(50)
                    {
                        new HColumn(.5f)
                        {
                            HorizontalAlign = HorizontalAlign.Right,
                            Items = {Label.FromResource("HighScore")}
                        },
                        new HColumn(-1f)
                        {
                            (_highScoresLb = new Label("0"))
                        }
                    },
                    new Row(-1)
                    {
                        new HColumn(1f)
                        {
                            Spacing = 24,
                            Items = {
                                new Buttons.SmallButton("ic_restart", RestartClick),
                                new Buttons.SmallButton("ic_exit", ExitClick)
                            }
                        }
                    }
                }
            };

            Add(ui);
        }
Beispiel #2
0
        public PlayScene(MainStage stage) : base(stage)
        {
            using (var settings = SkidiGame.SettingsStorage.Read())
            {
                _highScore = settings.ReadInt("HighScore");
            }

            UpdateEvent.Subscribe(this, Update);
            AddInput();

            Position = new Vector2(0, SkidiGame.ScreenBounds.Height);
            Visible = false;

            Add(CreateGround());

            Add((_player = new Skidi()));
            Add((_eagle = new Eagle()));

            Add((_emmiter = new ParticleEmmiter()));

            var ui = new Grid(36)
            {
                new Row(.2f)
                {
                    new VColumn(.5f)
                    {
                        HorizontalAlign = HorizontalAlign.Left,
                        Items = { (_scoreLb = new Label("0")) }
                    },
                    new VColumn(.5f)
                    {
                        HorizontalAlign = HorizontalAlign.Right,
                        Items = { new Buttons.PauseButton(OnPauseClick) }
                    }
                },
                new Row(.2f),
                new Row(-1)
                {
                    new VColumn(1f)
                    {
#if WINDOWS_APP
                        (_hintLb = Label.FromResource(SkidiBirdGame.IsMouseEnabled ? "StartHintKb" : "StartHint"))
#else
                        (_hintLb = Label.FromResource("StartHint"))
#endif
                    }
                }
            };
            Add(ui);
            _hintLb.RunAction(HintAnimation);

            var bg = new Background(SkidiGame.ScreenBounds, SkidiGame.ResourceManager.GetFrame("$px"))
            {
                Color = Color.Black,
                Visible = false,
                Alpha = .7f
            };

            stage.UiLayer.Add(bg);
            stage.UiLayer.Add((_pauseMenu = new PauseMenu(bg)));
            stage.UiLayer.Add((_gameOverMenu = new GameOverMenu(bg)));
        }