private void OnBehaviorsLoaded(WorkshopItem item, Dictionary <string, Behaviors.Behavior> behaviors) { bool containsOverrides = false; foreach (var entry in behaviors) { if (behaviorSystem.EmbeddedBehaviorExists(entry.Key)) { containsOverrides = true; } } if (containsOverrides) { popups.ShowThreeButtons( "Some cards in this pack already exist in your library.", "Overwrite", () => { behaviorSystem.PutBehaviors(behaviors, true); popups.Show( $"{item.Name} was successfully imported. Check your card library!", "Ok" ); }, "Duplicate", () => { behaviorSystem.PutBehaviors(behaviors); popups.Show( $"{item.Name} was successfully imported. Check your card library!", "Ok" ); }, "Cancel", () => { }); } else { behaviorSystem.PutBehaviors(behaviors); popups.Show( $"{item.Name} was successfully imported. Check your card library!", "Ok" ); } }
private void OnBehaviorsLoaded(Dictionary <string, Behaviors.Behavior> behaviors) { if (behaviors.Count == 0) { popups.Show("No cards found.", "Ok"); return; } bool containsOverrides = false; foreach (var entry in behaviors) { if (behaviorSystem.EmbeddedBehaviorExists(entry.Key)) { containsOverrides = true; } } if (containsOverrides) { popups.ShowThreeButtons( "Some cards already exist in the library.", "Overwrite", () => { behaviorSystem.PutBehaviors(behaviors, true); popups.Show($"{behaviors.Count} cards imported!", "Ok"); }, "Duplicate", () => { behaviorSystem.PutBehaviors(behaviors); popups.Show($"{behaviors.Count} cards imported!", "Ok"); }, "Cancel", () => { }); } else { behaviorSystem.PutBehaviors(behaviors); popups.Show($"{behaviors.Count} cards imported!", "Ok"); } }