public void LoadDeck(string deckName)
 {
     ClearDeckHolderPanel();
     deckHolder = DeckHolder.LoadDeck(deckName);
     deckNameInputField.text = deckName;
     CardsInDeck.Clear();
     CardsInDeck.AddRange(deckHolder.Cards);
     for (int i = 0; i < deckHolder.Cards.Length; i++)
     {
         Card       card       = (Card)Activator.CreateInstance(Type.GetType("DuelMasters.Cards." + deckHolder.Cards[i]), fakeGame.CurrentDuelistTurn);
         GameObject cardInDeck = Instantiate(cardInDeckPrefab, DeckHolderPanel);
         cardInDeck.GetComponentsInChildren <Image>()[1].sprite = Resources.Load <Sprite>("Cards/Artwork/" + card.OriginalName);
         cardInDeck.GetComponentInChildren <Text>().text        = card.OriginalName;
         DeckRemoveableCard removeableCard = cardInDeck.AddComponent <DeckRemoveableCard>();
         removeableCard.Collection = this;
         removeableCard.Name       = card.GetType().Name;
     }
     LoadPage();
     SetViewDeck();
 }
    public void Init()
    {
        if (NetworkManager.networkSceneName == "Game")
        {
            selectableToDestroy = new List <SelectableID>();
            AvailableZone availableZone = FindObjectOfType <AvailableZone>();
            if (isLocalPlayer)
            {
                LocalPlayer   = this;
                allCards      = new List <CardNetworkData>();
                SelectedCards = new List <CardNetworkData>();
                stepButton    = GameObject.FindGameObjectWithTag("NextStep").GetComponent <Button>();
                stepButton.onClick.AddListener(NextStep);
                stepText  = stepButton.GetComponentInChildren <Text>();
                taskPanel = GameObject.FindGameObjectWithTag("TaskPanel").transform;
                GameObject cardView  = GameObject.FindGameObjectWithTag("CardView");
                Text[]     cardTexts = cardView.GetComponentsInChildren <Text>();
                View = new CardView(cardView.GetComponent <Image>(), cardTexts[0], cardTexts[1]);
                cardTexts[1].transform.parent.gameObject.SetActive(false); // TO REMOVE!
                finishedButton = GameObject.FindGameObjectWithTag("FinishedButton").GetComponent <Button>();
                finishedButton.onClick.AddListener(FinishedSelection);
                gameOverPanel = GameObject.FindGameObjectWithTag("GameOver");

                View.SetActive(false);
                finishedButton.gameObject.SetActive(false);
                taskPanel.parent.gameObject.SetActive(false);
                gameOverPanel.SetActive(false);

                AvailableZone.Zones zones = availableZone.LocalZones;
                Deck       = zones.Deck;
                Hand       = zones.Hand;
                ShieldZone = zones.ShieldZone;
                ManaZone   = zones.ManaZone;
                BattleZone = zones.BattleZone;
                Graveyard  = zones.Graveyard;
                CmdBeginDuel();
            }
            else
            {
                AvailableZone.Zones zones = availableZone.GetZones();
                Deck       = zones.Deck;
                Hand       = zones.Hand;
                ShieldZone = zones.ShieldZone;
                ManaZone   = zones.ManaZone;
                BattleZone = zones.BattleZone;
                Graveyard  = zones.Graveyard;

                ShieldZone.parent.gameObject.AddComponent <AttackPlayerDroppable>().Owner = this;
            }
        }
        else if (NetworkManager.networkSceneName == "Lobby")
        {
            if (isLocalPlayer)
            {
                LocalPlayer = this;
                readyText   = GameObject.FindGameObjectWithTag("ReadyButton").GetComponentInChildren <Text>();
                readyText.GetComponentInParent <Button>().onClick.AddListener(() => CmdSetReady(!ready, DeckHolder.LoadDeck(deckDropdown.options[deckDropdown.value].text).Cards));

                deckDropdown = GameObject.FindGameObjectWithTag("DeckDropdown").GetComponent <Dropdown>();
                deckDropdown.ClearOptions();
                Directory.CreateDirectory(DeckHolder.DeckPath);
                string[] deckPaths = Directory.GetFiles(DeckHolder.DeckPath);
                string[] deckNames = new string[deckPaths.Length];
                for (int i = 0; i < deckNames.Length; i++)
                {
                    deckNames[i] = Path.GetFileNameWithoutExtension(deckPaths[i]);
                }
                List <Dropdown.OptionData> optionDatas = new List <Dropdown.OptionData>(deckNames.Length);
                foreach (string deckName in deckNames)
                {
                    optionDatas.Add(new Dropdown.OptionData(deckName));
                }
                deckDropdown.AddOptions(optionDatas);
            }
        }
    }