public MultiplayerOverScreen(FacetManager mgr, Field winner, Field loser)
     : this(mgr)
 {
     this.winner = winner;
     this.loser = loser;
     Score = winner.Score;
 }
 public SelectionBox(Field field, Rectangle area)
     : base(field.Facet)
 {
     Field = field;
     Area = area;
     Initialize();
 }
 public StatusDisplay(Field field, Point center)
     : base(field.Facet)
 {
     this.Field = field;
     this.Score = field.Score;
     this.game = field.Facet;
     this.Center = center;
     Initialize();
 }
Beispiel #4
0
        public Block(Field field, int column, int row, int type)
            : base(field.Facet)
        {
            this.column = column;
            this.row = row;
            this.type = type;
            this.field = field;
            _area = new Rectangle(field.Area.X + column  * Width,
                                 field.Area.Y + (row+1) * Height,
                                 Width, Height);

            flavor = FLAVOR_NORMAL;
            if (Util.Random.Next(42) < 1)
                flavor = FLAVOR_BOMB;
        }
Beispiel #5
0
        public TopBar(Field field, Rectangle area)
            : base(field.Facet)
        {
            Field = field;
            LoadContent();
            int diff = image.Width - area.Width;
            this.Area = new Rectangle()
            {
                X = area.X - diff / 2 - 1,
                Y = area.Y - 8,
                Width = image.Width,
                Height = image.Height
            };

            selection = new List<Block>(Field.SelectedBlocks);
        }
        private void layoutComponents()
        {
            Timer timer = new Timer(this);
            Field field;

            Point scenter;
            components.Add(timer);
            Rectangle tsa = FacetManager.GraphicsDevice.Viewport.TitleSafeArea;

            if (SinglePlayer)
            {
                int x = tsa.Center.X - Field.Width / 2;
                int y = tsa.Y;
                field = new Field(this, x, y);
                field.Player = InputManager.ActivePlayer;
                field.LoadContent();
                field.Level = level;
                components.Add(field);
                fields.Add(field);

                scenter = new Point(
                    (field.Area.Right + tsa.Right) / 2,
                    (tsa.Bottom - Layout.BottomBuffer - Layout.StatusOneHeight / 2)
                    );

                StatusDisplay status = new StatusDisplay(field, scenter);
                components.Add(status);
                Rectangle boxarea = new Rectangle(status.Area.X + Block.Width / 2, status.Area.Y - Block.Height * 2, status.Area.Width, Block.Height * 2);
                SelectionBox box = new SelectionBox(field, boxarea);
                components.Add(box);

                timer.Center = new Point(
                    (field.Area.Left + tsa.Left) / 2,
                    (tsa.Top + status.Area.Top) / 2);
                TutManager = new TutorialManager(this, SinglePlayerField.Area);
                CueTutorialMessage(TutorialManager.TutorialEvent.Intro, field.Target);
            }
            else
            {
                // 1 Player
                int x = tsa.X;
                int y = tsa.Y;
                field = new Field(this, x, y);
                field.Player = InputManager.ActivePlayer;
                field.LoadContent();
                components.Add(field);
                fields.Add(field);

                scenter = new Point(tsa.Center.X, tsa.Top + Layout.StatusOneHeight / 2);
                StatusDisplay status = new StatusDisplay(field, scenter);
                components.Add(status);

                Rectangle boxarea = new Rectangle(field.Area.Right, field.Area.Y, Block.Width * 9, Block.Height);
                boxarea.X += (field.Area.Width - boxarea.Width) / 2;
                SelectionBox box = new SelectionBox(field, boxarea);
                components.Add(box);

                // 2 Player
                x = tsa.Right - Field.Width;
                y = y;

                field = new Field(this, x, y);
                field.Player = null;
                field.LoadContent();
                components.Add(field);
                fields.Add(field);

                scenter = new Point(tsa.Center.X, tsa.Bottom - Layout.StatusTwoHeight / 2);
                status = new StatusDisplay(field, scenter);
                components.Add(status);

                boxarea = new Rectangle(field.Area.X - Block.Width * 7, field.Area.Bottom, Block.Width * 9, Block.Height);
                boxarea.X += (field.Area.Width - boxarea.Width) / 2;
                box = new SelectionBox(field, boxarea);
                components.Add(box);

                timer.Center = tsa.Center;
            }
        }
        public void GameOver(Field field)
        {
            if (SinglePlayer)
            {
                SoundManager.StopBGM();
                FacetManager.ReplaceMeWith(
                    new GameOverScreen(SinglePlayerField),
                    new FadeTransition(2000)
                    );

            }
            else
            {
                Field loser = field;
                Field winner = fields[loser.Player == InputManager.ActivePlayer ? 1 : 0];

                FacetManager.ReplaceMeWith(
                    new MultiplayerOverScreen(FacetManager, winner, loser),
                    new FadeTransition(2000)
                    );
            }
            foreach (Field f in fields)
            {
                GamePad.SetVibration(f.Player.GetValueOrDefault(PlayerIndex.One), 0, 0);
            }
        }
Beispiel #8
0
 public Group(Field field, int row, int column)
 {
     blocks = new List<Block>();
     this.field = field;
     num = field.tiles[row][column].Number;
     if (num != 0)
         recursiveFill(row, column, Direction.None);
 }
 public GameOverScreen(Field lostGame)
     : base(lostGame.Facet.FacetManager)
 {
     Score = lostGame.Score;
     Player = lostGame.Player.Value;
 }