Esempio n. 1
0
        public HudScene(ScreenSpace screen, NumberFactory numberFactory)
        {
            var view   = screen.Viewport;
            var center = view.Width / 2f;
            var left   = view.Left;
            var top    = view.Top;
            var right  = view.Right;

            pointsNumber = numberFactory.CreateNumber(this, left, top, 0.05f, Alignment.Left, 0,
                                                      DefaultColors.Gray);
            levelCaption = new Sprite("LevelCaption",
                                      Rectangle.FromCenter(center, top + 0.02f, 0.07f, 0.03f));
            levelCaption.Color = DefaultColors.Yellow;
            // ReSharper disable DoNotCallOverridableMethodsInConstructor
            Add(levelCaption);
            levelNumber = numberFactory.CreateNumber(this, center, levelCaption.DrawArea.Bottom, 0.022f,
                                                     Alignment.Center, 2, DefaultColors.Gray);
            var offsets = new[, ] {
                { 0.108f, 0.025f }, { 0.083f, 0.033f }, { 0.05f, 0.05f }
            };

            errorIcons = new Sprite[3];
            for (int i = 0; i < errorIcons.Length; i++)
            {
                Add(errorIcons[i] = new Sprite("ErrorIcon",
                                               new Rectangle(right - offsets[i, 0], top, offsets[i, 1], offsets[i, 1])));
            }
            foreach (var control in Controls.FindAll(x => x is Sprite))
            {
                control.RenderLayer = (int)GameRenderLayer.Hud;
            }
        }
Esempio n. 2
0
 public PointsTip(NumberFactory numberFactory, Vector2D center, int value)
 {
     Time   = GlobalTime.Current.Milliseconds;
     number = numberFactory.CreateNumber(null, center.X, center.Y, 0.02f, Alignment.Center, 0,
                                         DefaultColors.Yellow, GameRenderLayer.Points);
     number.Show(value);
     plus             = new Sprite("Plus", Rectangle.FromCenter(center.X - 0.01f - number.Width / 2f, center.Y + number.Height / 2f, 0.01f, 0.01f));
     plus.RenderLayer = (int)GameRenderLayer.Points;
     plus.Color       = DefaultColors.Yellow;
 }
Esempio n. 3
0
 public Match(ScreenSpace screen, NumberFactory numberFactory, LogoFactory logoFactory)
     : base(Rectangle.Zero)
 {
     this.screen      = screen;
     this.logoFactory = logoFactory;
     hud   = new HudScene(screen, numberFactory);
     pause = new PausePage(screen);
     pause.Hide();
     Slice      = new Slice();
     PointsTips = new List <PointsTip>();
     ErrorFlags = new List <ErrorFlag>();
     HideScore();
     screen.ViewportSizeChanged += RefreshSize;
     RefreshSize();
 }
Esempio n. 4
0
 public GameLogic(ScreenSpace screen, NumberFactory numberFactory)
 {
     this.numberFactory = numberFactory;
     this.screen        = screen;
     waveTimeout        = GameSettings.InitialWaveTimeout;
 }