Example #1
0
        /*
         * Returns an entity of the object
         */
        public Games getEntity()
        {
            Games entity = new Games();

            //Save turn
            entity.totalTurns = totalTurns;
            entity.turns = turns;

            //Save pool
            entity.pool = pot.getMoney();

            //Save players
            Players player1Entity = GlobalVariables.player1.getEntity();
            player1Entity.totalBet = player1TotalBet;
            entity.Players.Add(player1Entity);

            Players player2Entity = GlobalVariables.player2.getEntity();
            player2Entity.totalBet = player2TotalBet;
            entity.Players.Add(player2Entity);

            //Save thrown cards
            foreach(ThrownCards cardEntity in deck.getTrownCardsEntities())
                entity.ThrownCards.Add(cardEntity);

            return entity;
        }
Example #2
0
        /*
         * Modifies this object according the the entity properties
         */
        public void parseGameEntity(Games entity)
        {
            //Load turn
            turns = entity.turns;
            totalTurns = entity.totalTurns;

            //Load pool
            pot.setMoney(entity.pool);

            //Load players
            List<Players> playerEntities = entity.Players.ToList();
            GlobalVariables.player1.parsePlayerEntity(playerEntities[0], deck.getPlayerEntityCards(playerEntities[0]));
            GlobalVariables.player2.parsePlayerEntity(playerEntities[1], deck.getPlayerEntityCards(playerEntities[1]));

            player1TotalBet = playerEntities[0].totalBet;
            player2TotalBet = playerEntities[1].totalBet;

            //Load thrown cards
            List<ThrownCards> thrownCardsEntities = entity.ThrownCards.ToList();
            deck.parseThrownCardEntities(thrownCardsEntities);
        }