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); }
protected override IEnumerator execute() { DeckEditScene scene = Finder.FindOrThrow <DeckEditScene>(); EditDeckProvider sceneProvider = DataProvider.Get <EditDeckProvider>(); CommandExecutor executor = Finder.FindOrThrow <CommandExecutor>(); bool flag = true; LocalizedString failure = null; if (flag && scene.get_Tutorial() != null) { global::h.L request = new global::h.L(); Coroutine coroutine; scene.get_Tutorial().EndorseRequest(request, out coroutine); if (coroutine != null) { yield return(coroutine); } flag = !request.get_Denied(); request = null; } if (flag) { if (scene.get_Validator().IsSaveValid(out failure)) { SaveDeckToServer save = new SaveDeckToServer(this.deckSave.editor.AsSerializableDeck()); yield return(executor.Execute(save)); if (save.get_Success()) { DeckComponent deckComponent = Finder.FindOrThrow <Decks>().get_All()[save.get_SavedDeck().A]; if (!scene.get_Validator().DeckMeetsMinimumCount()) { DataComposition dataComposition = global::h.o.Create(global::L.LT(Constants.FN()), global::L.LT(Constants.Fn(), new object[] { scene.get_Validator().DeckCountMinimum() }), false, new string[] { Constants.FO() }); dataComposition.Add <global::e.b>(new global::e.b(Constants.Fo())); ShowDialog command = new ShowDialog(this.dialogPrefab, dataComposition); yield return(executor.Execute(command)); } this.Success = true; this.deckSave.set_UnsavedChanges(false); Archetypes archetypes = Finder.FindOrThrow <Archetypes>(); Pile pile; if (deckComponent != null && deckComponent.get_Piles().TryGetValue(Constants.K(), out pile)) { string text = ""; foreach (KeyValuePair <ArchetypeID, int> keyValuePair2 in pile) { text = string.Concat(new object[] { text, archetypes.get_All()[keyValuePair2.Key].GetOne <NameData>().get_Name(), " ", keyValuePair2.Value, "\r\n" }); } File.WriteAllText(Path.Combine("decks", deckComponent.get_Name() + ".txt"), text); } deckComponent = null; pile = null; deckComponent = null; pile = null; } else { DataComposition dataComposition2 = global::h.o.Create(global::L.LT(Constants.FP()), global::L.LT(Constants.Fp()), false, new string[] { global::L.LT(Constants.FO()) }); dataComposition2.Add <global::e.b>(new global::e.b(Constants.Fo())); ShowDialog command2 = new ShowDialog(this.dialogPrefab, dataComposition2); yield return(executor.Execute(command2)); yield return(executor.Execute(new ChangeScene(sceneProvider.get_SceneToExitTo()))); } save = null; } } else { this.Success = false; if (failure != null) { yield return(executor.Execute(new FailFeedbackCommand(failure))); } } yield break; yield break; }