コード例 #1
0
ファイル: GamePlayer.cs プロジェクト: Ninelya/pentago
 public GamePlayer(Game game, Player player)
 {
     Id = Guid.NewGuid();
     Items.Add(Id, this);
     Game = game;
     Player = player;
 }
コード例 #2
0
ファイル: Game.cs プロジェクト: Ninelya/pentago
 private void SetLineToZero(Player player, string dimention)
 {
     switch (dimention)
     {
         case "h":
             player.HorizLine = 0;
             break;
         case "v":
             player.VertLine = 0;
             break;
         case "dl":
             player.DiagLeftLine = 0;
             break;
         case "dr":
             player.DiagRightLine = 0;
             break;
     }
 }
コード例 #3
0
ファイル: Game.cs プロジェクト: Ninelya/pentago
 private void IncLine(Player player, string dimention)
 {
     switch (dimention)
     {
         case "h":
             player.HorizLine++;
             if (player.MaxHLine < player.HorizLine)
                 player.MaxHLine = player.HorizLine;
             break;
         case "v":
             player.VertLine++;
             if (player.MaxVLine < player.VertLine)
                 player.MaxVLine = player.VertLine;
             break;
         case "dl":
             player.DiagLeftLine++;
             if (player.MaxDLLine < player.DiagLeftLine)
                 player.MaxDLLine = player.DiagLeftLine;
             break;
         case "dr":
             player.DiagRightLine++;
             if (player.MaxDRLine < player.DiagRightLine)
                 player.MaxDRLine = player.DiagRightLine;
             break;
     }
 }
コード例 #4
0
ファイル: Game.cs プロジェクト: Ninelya/pentago
 private void CreatePlayer(string name, BallPoint.BallColor color, int count)
 {
     Player player = new Player(this, name, color);
     AddPlayer(player);
     player.ActiveIndex = count;
 }
コード例 #5
0
ファイル: Game.cs プロジェクト: Ninelya/pentago
        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;
            }
        }
コード例 #6
0
ファイル: Game.cs プロジェクト: Ninelya/pentago
        public bool AddPlayer(Player player)
        {
            bool isNotConnected = true;

            foreach (Player p in this.Players)
                if (p == player)
                    isNotConnected = false;

            if (isNotConnected)
                new GamePlayer(this, player);

            return isNotConnected;
        }