Exemplo n.º 1
0
 private void loadDeck(DeckComponent deck)
 {
     this.current_deck.Clear();
     if (deck != null)
     {
         Archetypes archetypes = Finder.FindOrThrow <Archetypes>();
         Directory.CreateDirectory("decks");
         foreach (KeyValuePair <DeckID, DeckComponent> keyValuePair in Finder.FindOrThrow <Decks>().get_All())
         {
             Pile pile2;
             if (keyValuePair.Key != null && keyValuePair.Value.get_Piles().TryGetValue(Constants.K(), out pile2))
             {
                 string to_write = "";
                 foreach (KeyValuePair <ArchetypeID, int> keyValuePair2 in pile2)
                 {
                     to_write = string.Concat(new object[]
                     {
                         to_write,
                         archetypes.get_All()[keyValuePair2.Key].GetOne <NameData>().get_Name(),
                         " ",
                         keyValuePair2.Value,
                         "\r\n"
                     });
                 }
                 File.WriteAllText(Path.Combine("decks", keyValuePair.Value.get_Name() + ".txt"), to_write);
             }
         }
         Pile pile3;
         if (deck.get_Piles().TryGetValue(Constants.K(), out pile3))
         {
             foreach (KeyValuePair <ArchetypeID, int> keyValuePair3 in pile3)
             {
                 ArchetypeComponent archetypeComponent;
                 if (this.local_collection_avatars.get_All().TryGetValue(keyValuePair3.Key, out archetypeComponent))
                 {
                     this.tryToMove(keyValuePair3.Key, keyValuePair3.Value);
                 }
                 else
                 {
                     Debug.LogError(Constants.Fx() + keyValuePair3.Key);
                 }
             }
         }
         foreach (global::H.L l in this.current_deck.get_Stacks())
         {
             l.GetOne <global::g.p>().MarkAsRead();
         }
         ArchetypeComponent avatar = deck.GetAvatar(this.local_collection_avatars);
         this.deck_avatars.SetAvatar(avatar);
     }
     if (deck != null)
     {
         this.deck_name.SetName(deck.GetOne <DeckNameData>().get_Name(), deck.GetOne <global::E.y>().get_HasAutoName());
     }
     this.deck_editor_saver.set_UnsavedChanges(false);
 }
        private void updatePlayButton(DeckComponent deck)
        {
            bool flag = false;

            if (deck != null)
            {
                flag = deck.GetOne <global::H.d>().IsValidFor(DeckFormat.Standard);
                File.WriteAllText("deck_selection.txt", deck.get_Name());
            }
            this.playButton.interactable = (this.getCanPlay() && deck != null && flag && this.provider.get_Data() != null && !this.provider.get_Data().GetOne <global::D.y>().A);
            if (deck == null)
            {
                this.playButtonTooltip.set_TooltipString(global::L.LT(Constants.OT()));
                return;
            }
            this.playButtonTooltip.set_TooltipString((!flag) ? global::L.LT(Constants.Ot()) : string.Empty);
        }