Ejemplo n.º 1
0
        /// <summary>
        /// Initializes the specified adapter.
        /// </summary>
        /// <param name="application">The application.</param>
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

            GameStorage gameStorage;
            if (WaveServices.Storage.Exists<GameStorage>())
            {
                gameStorage = WaveServices.Storage.Read<GameStorage>();
            }
            else
            {
                gameStorage = new GameStorage();
            }

            Catalog.RegisterItem(gameStorage);

            application.Adapter.DefaultOrientation = DisplayOrientation.Portrait;
            application.Adapter.SupportedOrientations = DisplayOrientation.Portrait;

            ViewportManager vm = WaveServices.ViewportManager;
            vm.Activate(768, 1024, ViewportManager.StretchMode.Uniform);

            // Play background music
            WaveServices.MusicPlayer.Play(new MusicInfo(Directories.SoundsPath + "bg_music.mp3"));
            WaveServices.MusicPlayer.IsRepeat = true;

            WaveServices.ScreenContextManager.To(new ScreenContext(new MainMenuScene()));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScorePanel" /> class.
        /// </summary>
        public ScorePanel()
        {
            this.scores = 1;

            this.gameStorage = Catalog.GetItem<GameStorage>();

            this.entity = new Entity()
                          .AddComponent(new Transform2D()
                          {
                              Y = WaveServices.ViewportManager.TopEdge
                          })
                          .AddComponent(new PanelControl(241, 104))
                          .AddComponent(new PanelControlRenderer())
                           .AddChild(new Image(Directories.TexturePath + "scorePanel.wpk")
                           {
                               DrawOrder = 0.4f,
                           }.Entity);
            this.scoreText = new TextBlock("scoresText")
             {
                 Width = 40,
                 Text = this.Scores.ToString(),
                 FontPath = Directories.FontsPath + "OCR A Std_20.wpk",
                 HorizontalAlignment = HorizontalAlignment.Right,
                 VerticalAlignment = VerticalAlignment.Top,
                 Margin = new Thickness(0, 15, 50, 0),
                 DrawOrder = 0.2f,
             };
            this.entity.AddChild(this.scoreText.Entity);
            this.bestText = new TextBlock("bestText")
             {
                 Width = 40,
                 Text = this.gameStorage.BestScore.ToString(),
                 FontPath = Directories.FontsPath + "OCR A Std_20.wpk",
                 HorizontalAlignment = HorizontalAlignment.Right,
                 VerticalAlignment = VerticalAlignment.Bottom,
                 Margin = new Thickness(0, 0, 50, 5),
                 DrawOrder = 0.2f,
             };
            this.entity.AddChild(this.bestText.Entity);
        }