コード例 #1
0
        private void Start()
        {
            roadButton.interactable       = false;
            settlementButton.interactable = false;
            cityButton.interactable       = false;
            drawCardButton.interactable   = false;

            roadButton.OnClickAsObservable()
            .Subscribe(_ =>
            {
                var p = toPleyerObject.ToPlayer(playerTurnManeger._currentPlayerId.Value);
                cardConsumptionManeger.BuyRoad();
                roadBasePresenter.ShowPossiblePoint(playerTurnManeger._currentPlayerId.Value);
                this.TurnOffAll();
                this.setCount(p);
                isCheck = true;
                uIRestrictionPresenter.TurnOffAll();
                Debug.Log("あ!");
            });
            settlementButton.OnClickAsObservable()
            .Subscribe(_ =>
            {
                var p = toPleyerObject.ToPlayer(playerTurnManeger._currentPlayerId.Value);
                cardConsumptionManeger.BuySettlement();
                pointChildrenPresenter.ShowPossiblePoint(playerTurnManeger._currentPlayerId.Value);
                this.TurnOffAll();
                this.setCount(p);
                isCheck = true;
                uIRestrictionPresenter.TurnOffAll();
                Debug.Log("い!");
            });
            cityButton.OnClickAsObservable()
            .Subscribe(_ =>
            {
                var p = toPleyerObject.ToPlayer(playerTurnManeger._currentPlayerId.Value);
                cardConsumptionManeger.BuyCity();
                pointChildrenPresenter.ShowPossiblePoint(playerTurnManeger._currentPlayerId.Value);
                this.TurnOffAll();
                this.setCount(p);
                isCheck = true;
                uIRestrictionPresenter.TurnOffAll();
                Debug.Log("う!");
            });
            drawCardButton.OnClickAsObservable()
            .Subscribe(_ =>
            {
                drawCard.Draw();
                cardConsumptionManeger.BuyCard();
                this.TurnOffAll();
                Debug.Log("お!");
            });
        }
コード例 #2
0
    public void Run(string[] names)
    {
        Deck = new CardsDeck();

        Console.Clear();
        ShowMenu();
        // Position for username #1 with name in game and chips
        Positions[] positions = new Positions[6];
        positions[0].X = 20;
        positions[0].Y = 8;
        positions[1].X = 60;
        positions[1].Y = 8;
        positions[2].X = 100;
        positions[2].Y = 8;
        positions[3].X = 20;
        positions[3].Y = 27;
        positions[4].X = 60;
        positions[4].Y = 27;
        positions[5].X = 100;
        positions[5].Y = 27;

        for (int i = 0; i < names.Length; i++)
        {
            Player player = new Player(names[i]);

            player.UserName = names[i];
            Players.Add(player);
        }

        // Draw Game table and cards
        DrawCard.Draw(Players, Deck);
        DrawCard.UpdateChips(Players);
        DrawCard.DrawTable(Deck);

        // Create logs of players
        CreateConfig(Players);

        // Loop of game
        GameLoop();
    }
コード例 #3
0
    public void GameLoop()
    {
        bool exit = false;
        int  nIsAbsent;

        do
        {
            do
            {
                ShowExit();
                for (int i = 0; i < Players.Count - 1; i++)
                {
                    //1 Check user input
                    Movements();

                    // Payment of blinds
                    if (Players[i].bigBlind)
                    {
                        int big = 200;
                        Players[i].Chips -= big;
                        pot += big;
                    }

                    if (Players[i].smallBlind)
                    {
                        int small = 100;
                        Players[i].Chips -= small;
                        pot += small;
                    }

                    if (!isAbsent)
                    {
                        //2 Movements
                        if (Index < Players.Count - 1)
                        {
                            Index++;
                            // Sound to inform about the turn of another player
                            Console.Beep(600, 1000);
                            //Update Pot
                            DrawCard.DrawPot(pot);
                            DrawCard.UpdateChips(Players);
                        }
                        else
                        {
                            Index = 0;
                            Console.Beep(600, 1000);
                            //Update Pot
                            DrawCard.DrawPot(pot);
                            DrawCard.UpdateChips(Players);
                        }
                    }
                    else
                    {
                        nIsAbsent = Index;
                        if (Index < Players.Count - 1)
                        {
                            Index++;
                        }
                        else
                        {
                            Index = 0;
                        }
                    }
                    DrawCard.UpdateChips(Players);
                }

                // 3 firsts cards of the middle
                if (allIsPlay)
                {
                    Flop(Deck);
                    allIsPlay = false;
                    for (int i = 0; i < Players.Count; i++)
                    {
                        Movements();

                        if (!isAbsent)
                        {
                            //2 Movements
                            if (Index < Players.Count - 1)
                            {
                                Index++;
                                // Sound to inform about the turn of another player
                                Console.Beep(600, 1000);
                                //Update Pot
                                DrawCard.DrawPot(pot);
                                DrawCard.UpdateChips(Players);
                            }
                            else
                            {
                                Index = 0;
                                Console.Beep(600, 1000);
                                //Update Pot
                                DrawCard.DrawPot(pot);
                                DrawCard.UpdateChips(Players);
                            }
                        }
                        else
                        {
                            nIsAbsent = Index;
                            if (Index < Players.Count - 1)
                            {
                                Index++;
                            }
                            else
                            {
                                Index = 0;
                            }
                        }
                    }
                }
                else
                {
                    allIsPlay = false;
                }

                if (allIsPlay)
                {
                    Turn(Deck);
                    for (int i = 0; i < Players.Count; i++)
                    {
                        Movements();

                        if (Index < Players.Count - 1)
                        {
                            Index++;
                            Console.Beep(600, 1000);
                            DrawCard.DrawPot(pot);
                            DrawCard.UpdateChips(Players);
                        }
                        else
                        {
                            Index = 0;
                            Console.Beep(600, 1000);
                            //Update Pot
                            DrawCard.DrawPot(pot);
                            DrawCard.UpdateChips(Players);
                        }
                    }
                }
                else
                {
                    allIsPlay = false;
                }

                // The last card of the middle
                if (allIsPlay)
                {
                    River(Deck);
                    for (int i = 0; i < Players.Count; i++)
                    {
                        Movements();

                        if (Index < Players.Count - 1)
                        {
                            Index++;
                            Console.Beep(600, 1000);
                            DrawCard.DrawPot(pot);
                            DrawCard.UpdateChips(Players);
                        }
                        else
                        {
                            Index = 0;
                            Console.Beep(600, 1000);
                            //Update Pot
                            DrawCard.DrawPot(pot);
                            DrawCard.UpdateChips(Players);
                        }
                    }
                }
                else
                {
                    allIsPlay = false;
                }
            } while (!allIsPlay);

            for (int timesToShuffle = 0; timesToShuffle < 10; timesToShuffle++)
            {
                Deck.Shuffle();
            }

            // Update cards after the turn
            CheckCards(Players, Deck);
            DrawCard.UpdateChips(Players);
            DrawCard.DrawTable(Deck);
            DrawCard.Draw(Players, Deck);
            //DrawCard.DrawResult(Players);
            pot   = 0;
            Index = 0;
            Deck.Reset();
            round++;
        } while (!exit);
    }