Exemple #1
0
    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"
                );
        }
    }
Exemple #2
0
    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"
                );
        }
    }
Exemple #3
0
    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"
                );
        }
    }
Exemple #4
0
    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");
        }
    }