Пример #1
0
    public IEnumerator Initialize(string assetPath)
    {
        ActionProgressBar.UpdateProgress("Loading Asset Bundles...", 0f);

        yield return(null);

        if (!string.IsNullOrEmpty(assetPath))
        {
            Debug.Log("Loading Bundles...");

            FileSystem.Backend = new AssetBundleBackend(assetPath);
            if (!FileSystem.Backend.isError)
            {
                bundlePath = assetPath;

                GameManifest.Load();
            }
            else
            {
                Debug.Log("Error Loading Bundles: " + FileSystem.Backend.loadingError);
            }
        }

        terrainManager = gameObject.GetOrAddComponent <TerrainManager>();
        prefabManager  = gameObject.GetOrAddComponent <PrefabManager>();
        pathManager    = gameObject.GetOrAddComponent <PathManager>();

        ActionProgressBar.Close();
        Debug.Log("Ready!");
    }
Пример #2
0
    private IEnumerator SaveMap(string filename)
    {
        WorldSerialization blob = new WorldSerialization();

        ActionProgressBar.UpdateProgress("Saving Terrain", 0f);
        yield return(null);

        yield return(null);

        terrainManager.Save(ref blob);

        ActionProgressBar.UpdateProgress("Saving Prefabs", 0.33f);
        yield return(null);

        yield return(null);

        prefabManager.Save(ref blob);

        ActionProgressBar.UpdateProgress("Saving Paths", 0.66f);
        yield return(null);

        yield return(null);

        pathManager.Save(ref blob);

        ActionProgressBar.UpdateProgress("Saving File", 0.95f);
        yield return(null);

        yield return(null);

        blob.Save(filename);

        ActionProgressBar.Close();
    }
Пример #3
0
    private void OnPreprocessAsset()
    {
        Selection.objects = new Object[0];

        WriteTextureMaps();

        WritePathData();

        UnloadAssetBundles();

        ActionProgressBar.Close();
    }
Пример #4
0
    private static void OnScriptsReloaded()
    {
        if (WorldManager.Instance == null)
        {
            WorldManager.Instance = GameObject.FindObjectOfType <WorldManager>();
        }

        if (WorldManager.Instance != null && !string.IsNullOrEmpty(PlayerPrefs.GetString("RustInstallPath")))
        {
            WorldManager.Instance.ValidateFileSystem();
        }

        ActionProgressBar.Close();
    }
Пример #5
0
    public IEnumerator CreateNew(int size, int splat, int biome)
    {
        yield return(EditorCoroutineUtility.StartCoroutine(Cleanup(), this));

        ActionProgressBar.UpdateProgress("Creating New World Data...", 0f);
        yield return(null);

        yield return(null);

        world = World.NewDataFromSize(size, splat, biome);

        EditorCoroutineUtility.StartCoroutine(LoadMap(world), this);

        ActionProgressBar.Close();

        Debug.Log("World Loaded!");
    }
Пример #6
0
    private IEnumerator LoadMap(string filename)
    {
        yield return(EditorCoroutineUtility.StartCoroutine(Cleanup(), this));

        WorldSerialization blob = new WorldSerialization();

        ActionProgressBar.UpdateProgress("Loading Map...", 0f);
        yield return(null);

        yield return(null);

        blob.Load(filename);

        world = World.WorldToTerrain(blob);

        yield return(EditorCoroutineUtility.StartCoroutine(LoadMap(world), this));

        ActionProgressBar.Close();

        Debug.Log("World Loaded!");
    }
Пример #7
0
    public IEnumerator Cleanup()
    {
        ActionProgressBar.UpdateProgress("Cleaning Map Contents", 0f);
        yield return(null);

        yield return(null);

        if (terrainManager)
        {
            ActionProgressBar.UpdateProgress("Destroying Terrain", 0f);
            yield return(null);

            yield return(null);

            terrainManager.Cleanup();
        }

        if (prefabManager)
        {
            ActionProgressBar.UpdateProgress("Destroying Prefabs", 0.33f);
            yield return(null);

            yield return(null);

            prefabManager.Cleanup();
        }

        if (pathManager)
        {
            ActionProgressBar.UpdateProgress("Destroying Paths", 0.66f);
            yield return(null);

            yield return(null);

            pathManager.Cleanup();
        }

        ActionProgressBar.Close();
    }