コード例 #1
0
ファイル: Player.cs プロジェクト: aneopsy/Powker
        private void DrawPlayerOptions(int moneyToCall)
        {
            var col = 2;

            ConsoleConfig.WriteOnConsole(22, col, "Select action: [");
            col += 16;
            ConsoleConfig.WriteOnConsole(22, col, "C", ConsoleColor.Yellow);
            col++;
            ConsoleConfig.WriteOnConsole(22, col, "]heck/[");
            col += 7;
            ConsoleConfig.WriteOnConsole(22, col, "C", ConsoleColor.Yellow);
            col++;

            var callString = moneyToCall <= 0 ? "]all, [" : "]all(" + moneyToCall + "), [";

            ConsoleConfig.WriteOnConsole(22, col, callString);
            col += callString.Length;
            ConsoleConfig.WriteOnConsole(22, col, "R", ConsoleColor.Yellow);
            col++;
            ConsoleConfig.WriteOnConsole(22, col, "]aise, [");
            col += 8;
            ConsoleConfig.WriteOnConsole(22, col, "F", ConsoleColor.Yellow);
            col++;
            ConsoleConfig.WriteOnConsole(22, col, "]old, [");
            col += 7;
            ConsoleConfig.WriteOnConsole(22, col, "A", ConsoleColor.Yellow);
            col++;
            ConsoleConfig.WriteOnConsole(22, col, "]ll-in");
        }
コード例 #2
0
 public void DrawGameBoard()
 {
     ConsoleConfig.WriteOnConsole(10, 0, "├──────╯", ConsoleColor.Green);
     ConsoleConfig.WriteOnConsole(9, 7, "│", ConsoleColor.Green);
     ConsoleConfig.WriteOnConsole(8, 7, "┬", ConsoleColor.Green);
     ConsoleConfig.DrawBox(25, 16, 13, 4, ConsoleColor.Green, "─│─│╭╮┴┴");
     ConsoleConfig.DrawBox(17, 11, 28, 4, ConsoleColor.Green, "─│─│╭╮╯╰");
 }
コード例 #3
0
        public void ClearMsg()
        {
            ConsoleConfig.WriteOnConsole(21, 0, new string(' ', width), ConsoleColor.White);
            ConsoleConfig.WriteOnConsole(22, 0, new string(' ', width), ConsoleColor.White);
            ConsoleConfig.WriteOnConsole(23, 0, new string(' ', width), ConsoleColor.White);

            ConsoleConfig.WriteOnConsole(25, 1, new string(' ', width - 2), ConsoleColor.White);
        }
コード例 #4
0
        private void DrawSingleCard(int row, int col, Card card)
        {
            var cardColor = this.GetCardColor(card);

            ConsoleConfig.WriteOnConsole(row, col, card.ToCard() + "  ", cardColor, ConsoleColor.White);
            ConsoleConfig.WriteOnConsole(row + 1, col, "    ", cardColor, ConsoleColor.White);
            ConsoleConfig.WriteOnConsole(row + 2, col, "  " + card.ToCard(), cardColor, ConsoleColor.White);
        }
コード例 #5
0
 public PlayerUI(IPlayer player, int row, int width, int commonRow)
     : base(player)
 {
     this.row       = row;
     this.width     = width;
     this.commonRow = commonRow;
     ConsoleConfig.WriteOnConsole(6, 1, "Name: " + player.Name);
 }
コード例 #6
0
        public override void StartRound(IStartRoundContext context)
        {
            this.BoardCards = context.BoardCards;
            this.UpdateCommonRow(context.CurrentPot);

            ConsoleConfig.WriteOnConsole(this.row + 1, this.width / 2 - 5, context.RoundType + "   ");
            base.StartRound(context);
        }
コード例 #7
0
ファイル: Manager.cs プロジェクト: aneopsy/Powker
 private void PrintIncomingMessage(PacketHeader header, Connection connection, string message)
 {
     consoleInterface.ClearMsg();
     if (message == "Your are Connected to Powker! Wait Another Player...")
     {
         ConsoleConfig.WriteOnConsole(6, 55, "Connected");
     }
     consoleInterface.SetMsg(message.ToString());
 }
コード例 #8
0
        private void UpdateCommonRow(int pot)
        {
            this.DrawCommunityCards();

            var potAsString = "Pot: " + pot;

            ConsoleConfig.WriteOnConsole(this.commonRow, this.width - 13, new string(' ', 12));
            ConsoleConfig.WriteOnConsole(this.commonRow, this.width - potAsString.Length - 2, potAsString);
        }
コード例 #9
0
 public static void DrawBox(int x, int y, int w, int h, ConsoleColor color, string border)
 {
     ConsoleConfig.WriteOnConsole(y, x, new string(border[0], w), color);
     ConsoleConfig.WriteOnConsole(y + h, x, new string(border[2], w), color);
     ConsoleConfig.WriteOnConsole(y, x, new string(border[4], 1), color);
     ConsoleConfig.WriteOnConsole(y, x + w - 1, new string(border[5], 1), color);
     ConsoleConfig.WriteOnConsole(y + h, x, new string(border[7], 1), color);
     ConsoleConfig.WriteOnConsole(y + h, x + w - 1, new string(border[6], 1), color);
     for (var i = 1; i < h; i++)
     {
         ConsoleConfig.WriteOnConsole(y + i, x, new string(border[3], 1), color);
         ConsoleConfig.WriteOnConsole(y + i, x + w - 1, new string(border[1], 1), color);
     }
 }
コード例 #10
0
        public override void StartHand(IStartHandContext context)
        {
            this.UpdateCommonRow(0);
            var dealerSymbol = context.FirstPlayerName == this.Player.Name ? "Dealer" : "      ";

            ConsoleConfig.WriteOnConsole(this.row + 1, 1, dealerSymbol, ConsoleColor.Green);

            ConsoleConfig.WriteOnConsole(this.row + 11, 2, "Money: " + context.MoneyLeft.ToString());
            this.DrawSingleCard(this.row + 9, width / 2 - 6, context.FirstCard);
            this.DrawSingleCard(this.row + 9, width / 2 - 1, context.SecondCard);

            DrawSingleHideCard(this.row + 4, width / 2 - 4);
            DrawSingleHideCard(this.row + 4, width / 2 - 9);
            DrawSingleHideCard(this.row + 4, width / 2 + 1);
            DrawSingleHideCard(this.row + 4, width / 2 - 14);
            DrawSingleHideCard(this.row + 4, width / 2 + 6);

            DrawSingleHideCard(this.row + 4, width / 2 + 27);
            DrawSingleHideCard(this.row + 4, width / 2 + 22);

            base.StartHand(context);
        }
コード例 #11
0
        public override PlayerAction GetTurn(ITurnContext context)
        {
            this.UpdateCommonRow(context.CurrentPot);
            ConsoleConfig.WriteOnConsole(this.row + 11, 2, new string(' ', 20));
            ConsoleConfig.WriteOnConsole(this.row + 11, 2, "Money: " + context.MoneyLeft.ToString());

            var action = base.GetTurn(context);

            var lastAction = (PlayerActionType)action.Type + (action.Type == (int)PlayerActionType.Fold
                ? string.Empty
                : "(" + (action.Money + ((context.MoneyToCall < 0) ? 0 : context.MoneyToCall) + ")"));

            ConsoleConfig.WriteOnConsole(this.row + 11, this.width - 26, new string(' ', 25));
            ConsoleConfig.WriteOnConsole(this.row + 11, this.width - 26, "Last act: " + lastAction);

            var moneyAfterAction = action.Type == (int)PlayerActionType.Fold
                ? context.MoneyLeft
                : context.MoneyLeft - action.Money - context.MoneyToCall;

            ConsoleConfig.WriteOnConsole(this.row + 11, 2, new string(' ', 20));
            ConsoleConfig.WriteOnConsole(this.row + 11, 2, "Money: " + context.MoneyLeft.ToString());

            return(action);
        }
コード例 #12
0
 public void SetInput()
 {
     ConsoleConfig.WriteOnConsole(25, 1, new string(' ', width - 2), ConsoleColor.White);
     Console.SetCursorPosition(1, 25);
 }
コード例 #13
0
 private void DrawTitleBox()
 {
     ConsoleConfig.DrawBox(0, 0, this.width, 4, ConsoleColor.Green, "═║═║╔╗╝╚");
     ConsoleConfig.WriteOnConsole(2, width / 2 - ProgramName.Length / 2 - 1, ProgramName, ConsoleColor.Green);
 }
コード例 #14
0
 public void SetMsg(string msg)
 {
     ConsoleConfig.WriteOnConsole(21, 1, msg, ConsoleColor.White);
 }
コード例 #15
0
 private void DrawSingleHideCard(int row, int col)
 {
     ConsoleConfig.WriteOnConsole(row, col, "?   ", ConsoleColor.Gray, ConsoleColor.DarkGray);
     ConsoleConfig.WriteOnConsole(row + 1, col, "    ", ConsoleColor.Gray, ConsoleColor.DarkGray);
     ConsoleConfig.WriteOnConsole(row + 2, col, "   ?", ConsoleColor.Gray, ConsoleColor.DarkGray);
 }