Exemplo n.º 1
0
        public MainMenu(MainStage stage)
            : base(stage)
        {
            Visible = true;
            _stage = stage;
            var logo = new Sprite {Frame = SkidiGame.ResourceManager.GetFrame("logo")};
            logo.Size *= SkidiBirdGame.Scale;

            Add(new GridLayout(SkidiGame.ScreenBounds, (int)(24 * SkidiBirdGame.Scale))
            {
                new Row(1f)
                {
                    new HColumn(1f)
                    {
                        HorizontalAlign = HorizontalAlign.Left,
                        VerticalAlign = VerticalAlign.Top,
                        Items = { new Buttons.SoundSwitch() }
                    }
                }
            });

            Add(new GridLayout(SkidiGame.ScreenBounds, 12)
            {
                Rows =
                {
                    new Row(.5f)
                    {
                        new HColumn(1f) {logo}
                    },
                    new Row(.3f)
                    {
                        new HColumn(1f) { new Buttons.PlayButton(PlayBtnClick) }
                    }
                }
            });
        }
Exemplo n.º 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)));
        }