示例#1
0
        /// <summary>
        /// Makes move on the table, and flips the active player. A Move can be created using GetMove(command).
        /// </summary>
        public void MakeMove(Move move)
        {
            _moveNo++;
            if (move == null)
            {
                throw new NullReferenceException();
            }
            currentMove = move;
            switch (move.MoveType)
            {
            case MoveTypes.Throwaway:
                GetActivePlayer().RemoveCard(move.CardPlayed);
                CardsOnTable.Add(move.CardPlayed);
                break;

            case MoveTypes.Pickup:
                GetActivePlayer().RemoveCard(move.CardPlayed);
                GetActivePlayer().AddCardsToLocalDeck(move.CardsPickedUp.Concat(new List <byte> {
                    move.CardPlayed
                }).ToList());
                CardsOnTable.RemoveAll(x => move.CardsPickedUp.Contains(x));
                break;

            case MoveTypes.Build: break;

            case MoveTypes.Capture: break;

            default: throw new Exception(Errorstr.NoMove());
            }
            FlipActivePlayer();
        }
示例#2
0
    /// <summary>
    /// Places a card in the game scene
    /// </summary>
    /// <param name="xcoord">X coordinate of the card object</param>
    /// <param name="ycoord">Y coordinate of the card object</param>
    /// <param name="card">The card information to be set on the created object</param>
    /// <param name="sips">Number of sips associated with flipping the card. 0 for cards that have other functions</param>
    /// <param name="type">The type of action there is to be taken which flipping the card</param>
    private void PlaceCard(float xcoord, float ycoord, Card card, int sips, CardType type)
    {
        var cardObj    = Instantiate(Resources.Load("CardTemplate") as GameObject, new Vector3(xcoord, ycoord), Quaternion.identity) as GameObject;
        var cardObjTop = cardObj.GetComponent <CardObject>();

        cardObjTop.SetCardInfo(card, sips, type);
        CardsOnTable.Add(cardObj);
    }
示例#3
0
 public void OnHitMade(ServiceCard movedCard, int gameId, int playerId)
 {
     if (_gameId == gameId)
     {
         Card c = serviseCardToCard(movedCard);
         referToView(c);
         MoveNr += 1;
         CardsOnTable.Add(c);
         setPlayerActionColor();
     }
 }
示例#4
0
 public void OnNotifyMove_UI(ServiceCard movedCard, int gameId, long playerId, long nextHit)
 {
     if (_gameId == gameId)
     {
         Card c = serviseCardToCard(movedCard);
         referToView(c);
         MoveNr += 1;
         CardsOnTable.Add(c);
         HitIndex = nextHit;
         setPlayerActionColor();
     }
 }
示例#5
0
 public void OnHitMade_UI(ServiceCard movedCard, int gameId, long playerId)
 {
     Trace.WriteLine("VIEW: OnHitMade called()");
     if (_gameId == gameId)
     {
         Card c = serviseCardToCard(movedCard);
         referToView(c);
         MoveNr += 1;
         CardsOnTable.Add(c);
         setPlayerActionColor();
     }
 }
示例#6
0
        /// <summary>
        /// выдать следуюшую карту на стол
        /// </summary>
        public void GetNextCardOnTable()
        {
            if (CardsOnTable.Count < 5)
            {
                Random r = new Random();

                int index = r.Next(0, Deck.Cards.Count);
                CardsOnTable.Add(Deck.Cards[index]);
                Deck.DropCard(index);
            }
            else
            {
                throw new Exception();
            }
        }
示例#7
0
        /// <summary>
        /// поставит на стол 3 карты
        /// </summary>
        public void GetFlop()
        {
            Random r = new Random();

            int index = r.Next(0, Deck.Cards.Count);

            CardsOnTable.Add(Deck.Cards[index]);
            Deck.DropCard(index);

            index = r.Next(0, Deck.Cards.Count);
            CardsOnTable.Add(Deck.Cards[index]);
            Deck.DropCard(index);

            index = r.Next(0, Deck.Cards.Count);
            CardsOnTable.Add(Deck.Cards[index]);
            Deck.DropCard(index);
        }