public void ImportFromPath(string path) { Dictionary <string, SavedActorPrefab> prefabs = SceneActorLibrary.ReadPrefabsFromDir(path); if (prefabs.Count == 0) { popups.Show("No actors found!", "Ok"); return; } bool containsOverrides = false; foreach (var entry in prefabs) { if (sceneActorLibrary.Exists(entry.Key)) { containsOverrides = true; } } if (containsOverrides) { popups.ShowThreeButtons( "Actor(s) already exists in your library.", "Overwrite", () => { sceneActorLibrary.PutPrefabs(prefabs, true); popups.Show( $"Actor(s) was successfully imported. Check your custom actors!", "Ok" ); }, "Duplicate", () => { sceneActorLibrary.PutPrefabs(prefabs); popups.Show( $"Actor(s) was successfully imported. Check your custom actors!", "Ok" ); }, "Cancel", () => { }); } else { sceneActorLibrary.PutPrefabs(prefabs); popups.Show( $"Actor(s) was successfully imported. Check your custom actors!", "Ok" ); } }
protected override void DoImport(WorkshopItem item) { Dictionary <string, SavedActorPrefab> prefabs = SceneActorLibrary.ReadPrefabsFromDir(item.InstalledLocalFolder, item); bool containsOverrides = false; foreach (var entry in prefabs) { if (sceneActorLibrary.Exists(entry.Key)) { containsOverrides = true; } } if (containsOverrides) { popups.ShowThreeButtons( "This actor already exists in your library.", "Overwrite", () => { sceneActorLibrary.PutPrefabs(prefabs, true); popups.Show( $"{item.Name} was successfully imported. Check your custom actors!", "Ok" ); }, "Duplicate", () => { sceneActorLibrary.PutPrefabs(prefabs); popups.Show( $"{item.Name} was successfully imported. Check your custom actors!", "Ok" ); }, "Cancel", () => { }); } else { sceneActorLibrary.PutPrefabs(prefabs); popups.Show( $"{item.Name} was successfully imported. Check your custom actors!", "Ok" ); } }