public AllocationManager(Animation anim, StateType type, AllocationManager previous = null)
        {
            this.anim = anim;
            this.type = type;
            RootWidget root = anim.AnimLayer.RootWidget;
            deckCards = new PlayingCardListAllocator(this, root.DeckPlaceholder);
            graveyardCards = new PlayingCardListAllocator(this, root.GraveyardPlaceholder);
            selectionCards = new PlayingCardListAllocator(this, root.SelectionPlaceholder);

            IGame game = ConnectionManager.Game;

            int count = game.Players.Count;
            playerHands = new Dictionary<int, PlayingCardListAllocator>(count);
            playerTables = new Dictionary<int, PlayingCardListAllocator>(count);
            playerLifePoints = new Dictionary<int, LifePointsCardAllocator>(count);
            playerRoles = new Dictionary<int, RoleCardAllocator>(count);
            foreach(IPublicPlayerView player in game.Players)
            {
                int playerId = player.ID;
                playerHands.Add(playerId, new PlayingCardListAllocator(this, root.GetPlayerHandPlaceholder(playerId)));
                playerTables.Add(playerId, new PlayingCardListAllocator(this, root.GetPlayerTablePlaceholder(playerId)));
                playerLifePoints.Add(playerId, new LifePointsCardAllocator(this, root.GetPlayerCharacterPlaceholder(playerId), anim.GetPlayerCharacterAnimator(playerId)));
                playerRoles.Add(playerId, new RoleCardAllocator(this, root.GetPlayerRolePlaceholder(playerId), anim.GetPlayerRoleAnimator(playerId)));
            }
            playingCardZoom = new CardZoomAllocator(this, anim.AnimLayer, anim.GetPlayingCardZoomAnimator());
            roleCardZoom = new CardZoomAllocator(this, anim.AnimLayer, anim.GetRoleCardZoomAnimator());
            characterCardZoom = new CardZoomAllocator(this, anim.AnimLayer, anim.GetCharacterCardZoomAnimator());

            if(previous != null)
            {
                int thisPlayerId = 0;
                if(ConnectionManager.PlayerGameControl != null)
                    thisPlayerId = ConnectionManager.PlayerGameControl.PrivatePlayerView.ID;
                List<PlayingCardAnimator> lastGraveyard = previous.graveyardCards.Animators;
                if(lastGraveyard.Count != 0)
                {
                    PlayingCardAnimator prev = lastGraveyard[lastGraveyard.Count - 1];
                    PlayingCardAnimator a = anim.GetPlayingCardAnimator(prev.ID);
                    a.GetState(type).Update(prev.GetState(previous.type));
                    this.graveyardCards.Animators.Add(a);
                }

                UpdateList(this.selectionCards, previous.selectionCards, previous.type);

                foreach(int id in previous.playerHands.Keys)
                    UpdateList(this.playerHands[id], previous.playerHands[id], previous.type, type == StateType.End && id != thisPlayerId);

                foreach(int id in previous.playerTables.Keys)
                    UpdateList(this.playerTables[id], previous.playerTables[id], previous.type);

                foreach(int id in previous.playerLifePoints.Keys)
                    this.playerLifePoints[id].LifePoints = previous.playerLifePoints[id].LifePoints;

                this.playingCardZoom.Visible = previous.playingCardZoom.Visible;
                this.roleCardZoom.Visible = previous.roleCardZoom.Visible;
                this.characterCardZoom.Visible = previous.characterCardZoom.Visible;
            }
        }
 private void UpdateList(PlayingCardListAllocator target, PlayingCardListAllocator source, StateType sourceType, bool hideCards = false)
 {
     foreach(PlayingCardAnimator prev in source.Animators)
     {
         PlayingCardAnimator a = anim.GetPlayingCardAnimator(prev.ID);
         if(!hideCards)
             a.GetState(type).Update(prev.GetState(sourceType));
         target.Animators.Add(a);
     }
 }