public void RPC_CleanCardData(int playerPhotonId, int cardInstId)
        {
            NetworkPrint p          = multiplayManager.GetPlayer(playerPhotonId);
            PlayerHolder thisPlayer = p.ThisPlayer;
            Card         card       = p.ThisPlayer.CardManager.SearchCard(cardInstId);
            string       cardOwner  = thisPlayer.PlayerProfile.UniqueId;

            //After Refactoring, Try to reduce below codes
            if (thisPlayer.CardManager.CheckCardContainer(Player.CardContainer.Field, card))
            {
                thisPlayer.CardManager.fieldCards.Remove(card.GetCardData.UniqueId);
                Debug.LogFormat("CardGraveyard, {0}'s {1} is removed from fieldCard", cardOwner, card.GetCardData.Name);
            }
            if (thisPlayer.CardManager.CheckCardContainer(Player.CardContainer.Hand, card))
            {
                thisPlayer.CardManager.handCards.Remove(card.GetCardData.UniqueId);
                Debug.LogFormat("CardGraveyard, {0}'s {1} is removed from handCards", cardOwner, card.GetCardData.Name);
            }
            if (thisPlayer.CardManager.CheckCardContainer(Player.CardContainer.Attack, card))
            {
                thisPlayer.CardManager.attackingCards.Remove(card.GetCardData.UniqueId);
                Debug.LogFormat("CardGraveyard, {0}'s {1} is removed from attackingCards", cardOwner, card.GetCardData.Name);
            }
            card.PhysicalCondition.GetOriginFieldLocation().GetComponentInParent <Area>().SetIsPlaced(false);
            card.CardCondition.IsDead = true;
            card.PhysicalCondition.gameObject.SetActive(false);
            card.PhysicalCondition.gameObject.GetComponentInChildren <PhysicalAttribute>().enabled = false;
            //Debug.LogWarningFormat("PutCardToGrave: {0} is deleted from all lists",c.Data.Name);
        }
        private void RPC_SetCardDead(int cardInstId, int playerPhotonId)
        {
            NetworkPrint p         = multiplayManager.GetPlayer(playerPhotonId);
            PlayerHolder cardOwner = p.ThisPlayer;
            Card         card      = p.ThisPlayer.CardManager.SearchCard(cardInstId);

            if (card == null)
            {
                Debug.LogError("COULDN'T FIND CARDINSTANCE");
                return;
            }
            cardOwner.CardManager.deadCards.Add(card.GetCardData.UniqueId);          //dead card should be added here.
            for (int i = 0; i < 2; i++)
            {
                if (card.User == Setting.gameController.GetPlayer(i))
                {
                    cardOwner = Setting.gameController.GetPlayer(i);
                    Debug.LogFormat("This dead card's owner is " + cardOwner);
                }
            }
            if (cardOwner == null)
            {
                Debug.LogError("CARD OWNER IS NULL");
                return;
            }
            //Should check owner to move card to graveyard
            photonView.RPC("RPC_CleanCardData", PhotonTargets.All, card.GetCardData.UniqueId, cardOwner.InGameData.PhotonId);
        }
        private void SetOpponentClient()
        {
            if (Players.Count > 1)
            {
                NetworkPrint clientPrint = CheckClientPrint();
                clientPrint.SetProfile();

                Debug.Log("****** ClientPlayer Profile is ready ******");
            }
        }
        public void AddPlayer(NetworkPrint nw_print)
        {
            Debug.Log("Add Network Print");
            if (nw_print.IsLocal)
            {
                Debug.Log("Local network print");
            }

            Debug.LogWarning("Player is Added " + nw_print);
            _Players.Add(nw_print);
            nw_print.transform.parent = MultiplayerReferences;
        }
        public void RPC_PlayerCreatesCard(int photonId, int cardId, string cardName)
        {
            Card c = GC.ResourceManager.GetCardInstFromDeck(cardName);

            if (c == null)
            {
                Debug.LogError("CardNameNotFound: " + cardName);
            }
            c.GetCardData.SetUniqueId = cardId;
            NetworkPrint p = GetPlayer(photonId);

            p.ThisPlayer.CardManager.AddCardInDeck(c);
        }
        public void RPC_PlayerCanUseCard_Master(int photonId)
        {
            NetworkPrint nw_Player = GetPlayer(photonId);

            if (GC.CurrentPlayer == nw_Player.ThisPlayer)
            {
                photonView.RPC("RPC_PlayerCanUseCard", PhotonTargets.All, photonId);
            }
            else
            {
                Debug.Log("RPC_PlayerCanUseCard_Error: This turn player is different with current player");
                return;
            }
        }
        private NetworkPrint CheckClientPrint()
        {
            NetworkPrint ret = null;

            Debug.Log("Players count: " + Players.Count);
            foreach (NetworkPrint v in Players)
            {
                if (!v.IsLocal)               // This is NetworkPrint for client
                {
                    ret = v;
                    Debug.Log("Client Network Print ID is " + ret.PlayerProfile.Name);
                }
            }
            return(ret);
        }
        public void RPC_PlayerCanUseCard(int photonId)
        {
            NetworkPrint nw_Player = GetPlayer(photonId);

            foreach (int cardId in nw_Player.ThisPlayer.CardManager.fieldCards)
            {
                Card c = nw_Player.ThisPlayer.CardManager.SearchCard(cardId);
                if (c.CardCondition.CanUse == false)
                {
                    c.CardCondition.CanUse = true;
                    Debug.LogFormat("PlayerCanUseCard: {0} can use {1} to Attack ",
                                    nw_Player.ThisPlayer.PlayerProfile.UniqueId, c.GetCardData.Name);
                }
            }
        }
        public void PlayerPicksCardFromDeck(PlayerHolder playerHolder)
        {
            Debug.Log("PlayerPicksCard");
            NetworkPrint p = GetPlayer(playerHolder.InGameData.PhotonId);

            for (int i = 0; i < p.PlayerProfile._DeckToPlay.Cards.Length; i++)
            {
                p.AddCardToDeck(p.PlayerProfile._DeckToPlay.Cards[i]);
            }
            Card c = null;

            if (p.CardDeck.Count != 0)
            {
                c = p.CardDeck[0];
                p.CardDeck.RemoveAt(0);
                Debug.Log("Draw card");
                photonView.RPC("RPC_PlayerPickCard", PhotonTargets.All, c.GetCardData.UniqueId, p.photonId);
            }
            else
            {
                Debug.Log("There is no card in deck");
            }
        }
        public void RPC_SyncPlayerHealth(int photonId, int health)
        {
            NetworkPrint nw_player = GetPlayer(photonId);

            nw_player.ThisPlayer.InGameData.Health = health;
        }