Exemple #1
0
        public GameField()
        {
            InitializeComponent();
            Id = Guid.NewGuid();
            Items.Add(Id, this);

            Start = new StartForm(this);
            Start.ShowDialog();

            if (Start.IsFinish)
                return;

            SetNames(Start);
            SetScore();
            ShowPlayers(Start);
            lblActivePlayer.Text = Player.GetByActiveIndex(Game.ActivePlayer) + "!";

            Sector sector;
            foreach (var sec in Game.SectorMatrix)
            {
                sector = new Sector(Game, sec);
                Controls.Add(sector);
                sector.MouseClick += OnSectorMouseClick;
                foreach (var ball in Sector.BallMatrix)
                {
                    BallPoint bp = new BallPoint(sector, ball);
                    bp.Click += OnBallPointClick;
                    sector.Controls.Add(bp);
                }
            }
            IsBallNotSector = true;
            MinimumSize = new Size(SectorCount * FieldStep + FieldLeft, SectorCount * FieldStep + FieldTop);
        }
Exemple #2
0
        public void CreatePlayers(StartForm start)
        {
            switch (PlayerCount)
            {
                case 8:
                    CreatePlayer(start.Player8Name, start.Player8Color, PlayerCount);
                    goto case 7;
                case 7:
                    CreatePlayer(start.Player7Name, start.Player7Color, PlayerCount);
                    goto case 6;
                case 6:
                    CreatePlayer(start.Player6Name, start.Player6Color, PlayerCount);
                    goto case 5;
                case 5:
                    CreatePlayer(start.Player5Name, start.Player5Color, PlayerCount);
                    goto case 4;
                case 4:
                    CreatePlayer(start.Player4Name, start.Player4Color, PlayerCount);
                    goto case 3;
                case 3:
                    CreatePlayer(start.Player3Name, start.Player3Color, PlayerCount);
                    goto default;
                default:
                    CreatePlayer(start.Player2Name, start.Player2Color, PlayerCount);
                    CreatePlayer(start.Player1Name, start.Player1Color, PlayerCount-1);

                    Player player = new Player(this, "WhiteBalls", BallPoint.BallColor.white);
                    //AddPlayer(player);
                    break;
            }
        }
Exemple #3
0
 private void ShowPlayers(StartForm start)
 {
     switch (start.PlayerCount)
     {
         case 3:
             pnlPlayers3.Visible = true;
             pnlPlayers4.Visible = false;
             pnlPlayers5.Visible = false;
             pnlPlayers6.Visible = false;
             pnlPlayers7.Visible = false;
             pnlPlayers8.Visible = false;
             break;
         case 4:
             pnlPlayers3.Visible = true;
             pnlPlayers4.Visible = true;
             pnlPlayers5.Visible = false;
             pnlPlayers6.Visible = false;
             pnlPlayers7.Visible = false;
             pnlPlayers8.Visible = false;
             break;
         case 5:
             pnlPlayers3.Visible = true;
             pnlPlayers4.Visible = true;
             pnlPlayers5.Visible = true;
             pnlPlayers6.Visible = false;
             pnlPlayers7.Visible = false;
             pnlPlayers8.Visible = false;
             break;
         case 6:
             pnlPlayers3.Visible = true;
             pnlPlayers4.Visible = true;
             pnlPlayers5.Visible = true;
             pnlPlayers6.Visible = true;
             pnlPlayers7.Visible = false;
             pnlPlayers8.Visible = false;
             break;
         case 7:
             pnlPlayers3.Visible = true;
             pnlPlayers4.Visible = true;
             pnlPlayers5.Visible = true;
             pnlPlayers6.Visible = true;
             pnlPlayers7.Visible = true;
             pnlPlayers8.Visible = false;
             break;
         case 8:
             pnlPlayers3.Visible = true;
             pnlPlayers4.Visible = true;
             pnlPlayers5.Visible = true;
             pnlPlayers6.Visible = true;
             pnlPlayers7.Visible = true;
             pnlPlayers8.Visible = true;
             break;
         default: //2
             pnlPlayers3.Visible = false;
             pnlPlayers4.Visible = false;
             pnlPlayers5.Visible = false;
             pnlPlayers6.Visible = false;
             pnlPlayers7.Visible = false;
             pnlPlayers8.Visible = false;
             break;
     }
 }
Exemple #4
0
 private void SetNames(StartForm start)
 {
     lblName1.Text = start.Player1Name;
     lblName2.Text = start.Player2Name;
     lblName3.Text = start.Player3Name;
     lblName4.Text = start.Player4Name;
     lblName5.Text = start.Player5Name;
     lblName6.Text = start.Player6Name;
     lblName7.Text = start.Player7Name;
     lblName8.Text = start.Player8Name;
 }