コード例 #1
0
ファイル: PlayerBox.cs プロジェクト: YangStillWater/HuaXueSha
        public PlayerBox(Player player)
        {
            Player = player;

            lbCards = new ListBox();
            lbCards.Name = "cardList";
            lbCards.Top = 10;
            lbCards.Left = 5;
            lbCards.Width = 100;
            lbCards.Height = 120;
            cardsSource = new BindingSource(player.Cards, null);
            lbCards.DataSource = cardsSource;

            lblBlood = new Label();
            lblBlood.Text = player.Blood.ToString();
            lblBlood.Top = 130;

            lblGear = new Label();
            lblGear.Text = player.Gear?.ToString();
            lblGear.Top = 150;

            lblArmor = new Label();
            lblArmor.Text = player.Armor?.ToString();
            lblArmor.Top = 170;

            this.Text = player.name;
            this.Name = "groupbox";
            this.Height = 200;
            this.Width = 120;

            this.Controls.Add(lbCards);
            this.Controls.Add(lblBlood);
            this.Controls.Add(lblGear);
            this.Controls.Add(lblArmor);
        }
コード例 #2
0
ファイル: GameSystems.cs プロジェクト: RP422/A5TicTacToe
        protected void GameLoop()
        {
            int indexOfCurrentPlayer = 0;
            activePlayer = players[indexOfCurrentPlayer];

            while (!GameOver())
            {
                Console.WriteLine("Here is the board:");
                PrintBoard();

                TakeTurn(activePlayer);
                //select the other player
                indexOfCurrentPlayer = (indexOfCurrentPlayer == 0) ? 1 : 0;
                activePlayer = players[indexOfCurrentPlayer];

                //Added this slight delay for user experience.  Without it it's harder to notice the board repaint
                //try commenting it out and check out the difference.  Which do you prefer?
                System.Threading.Thread.Sleep(300);

                Console.Clear();
            }
        }
コード例 #3
0
ファイル: CardRules.cs プロジェクト: YangStillWater/HuaXueSha
 public void Respond()
 {
     offenderCard = _gctx.cardDress.VirtualCard;
     foreach (var t in _gctx.targets)
     {
         currentTarget = t;
         RespondOne();
     }
 }
コード例 #4
0
ファイル: CardRules.cs プロジェクト: YangStillWater/HuaXueSha
        public void PlainResult()
        {
            if (_gctx.targets.Any())
            {
                currentTarget = _gctx.targets.First();

                OnTolerateResult(this, new EventArgs());
                if (offenderCard is Glucose)
                {
                    currentTarget.AddBlood();
                }
            }
        }
コード例 #5
0
 public void TurnToNextPlayer()
 {
     int index = players.IndexOf(currentPlayer);
     if (players.IndexOf(currentPlayer) < players.Count - 1)
     {
         currentPlayer = players[++index];
     }
     else
     {
         round++;
         currentPlayer = players.First();
     }
 }
コード例 #6
0
 public void TurnToFirstPlayer()
 {
     currentPlayer = players.First();
 }
コード例 #7
0
ファイル: GameSystems.cs プロジェクト: RP422/A5TicTacToe
 protected void TakeTurn(Player activePlayer)
 {
     int[] position = PiecePlacement(activePlayer);
     board.setSquare(position[0], position[1], activePlayer.Token);
 }
コード例 #8
0
ファイル: GameSystems.cs プロジェクト: RP422/A5TicTacToe
        private int[] PiecePlacement(Player activePlayer)
        {
            //you need to be using the .NET framework 4.6 for this line to work (C# 6)
            Console.WriteLine();
            Console.WriteLine($"{activePlayer.Name}, it's your turn:");
            Console.WriteLine("Make your move by entering the number of the sqaure you'd like to take:");
            PrintBoardMap();
            Console.Write("Enter the number: ");

            //todo: Prevent returning a location that's already been used

            return ConvertToArrayLocation(Console.ReadLine());
        }