public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        Controller cont = (Controller)target;

        if (GUILayout.Button("Write changes"))
        {
            cont.SaveChanges();
        }

        if (GUILayout.Button("Export map"))
        {
            MapExporter exporter = new MapExporter(MapLoader.Loader, cont.ExportPath);
            exporter.Export();
        }

        if (GUILayout.Button("Print all translated scripts"))
        {
            if (cont.romPersos?.Count > 0)
            {
                foreach (var romPerso in cont.romPersos)
                {
                    Debug.Log("romPerso: " + romPerso.name);
                    romPerso.PrintTranslatedScripts();
                }
            }
        }
    }
Beispiel #2
0
    async Task Init()
    {
        state = State.Loading;
        await loader.LoadWrapper();

        if (state == State.Error)
        {
            return;
        }
        stopwatch.Start();
        state         = State.Initializing;
        detailedState = "Initializing sectors";
        await WaitIfNecessary();

        sectorManager.Init();
        detailedState = "Initializing graphs";
        await WaitIfNecessary();

        graphManager.Init();
        detailedState = "Initializing lights";
        await WaitIfNecessary();

        lightManager.Init();
        detailedState = "Initializing persos";
        await InitPersos();

        sectorManager.InitLights();
        detailedState = "Initializing camera";
        await WaitIfNecessary();

        InitCamera();
        detailedState = "Initializing portals";
        await WaitIfNecessary();

        portalManager.Init();

        /*if (viewCollision)*/
        UpdateViewCollision();
        if (loader.cinematicsManager != null)
        {
            detailedState = "Initializing cinematics";
            await new WaitForEndOfFrame();
            InitCinematics();
        }
        detailedState = "Finished";
        stopwatch.Stop();
        state = State.Finished;
        loadingScreen.Active = false;

        if (ExportAfterLoad)
        {
            MapExporter e = new MapExporter(this.loader, ExportPath);
            e.Export();

            Application.Quit();
        }
    }
Beispiel #3
0
 private void SaveWithFilestream(FileStream stream)
 {
     using (FileStream fileStream = stream)
     {
         try
         {
             defaultMapSaver.Export(fileStream, SceneDocument);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
Beispiel #4
0
    // Autosave

    public void Autosave()
    {
        if (!MapIsLoaded || !SettingsManager.Settings.Autosave)
        {
            return;
        }
        string autosavePath = Application.dataPath + "/autosaves/";

        if (!Directory.Exists(autosavePath))
        {
            Directory.CreateDirectory(autosavePath);
        }
        string fileName = $"AUTOSAVE " + LoadedMap.Name + ".bb";

        MapExporter.Export(LoadedMap, autosavePath + fileName, Map.MapVersion.BrickBuilder);
    }
Beispiel #5
0
    public void SaveMap(string path = null, bool bbData = true)
    {
        if (!MapIsLoaded)
        {
            return;
        }
        if (path == null)
        {
            // show a file dialog
            string savePath = StandaloneFileBrowser.SaveFilePanel("Save Map", "", LoadedMap.Name, SaveMapExtensions);
            // make sure a file was selected
            if (savePath != "")
            {
                path = savePath;
                mapStopwatch.Start();
                string         extension = Path.GetExtension(savePath);
                Map.MapVersion mv        = Map.MapVersion.BrickBuilder;
                if (extension == ".brk")
                {
                    mv = Map.MapVersion.v2;
                }
                MapExporter.Export(LoadedMap, savePath, mv, bbData);
                mapStopwatch.Stop();
                UnityEngine.Debug.Log($"Saved {LoadedMap.Bricks.Count} bricks in " + mapStopwatch.ElapsedMilliseconds + " ms");
            }
        }
        else
        {
            mapStopwatch.Start();
            string         extension = Path.GetExtension(path);
            Map.MapVersion mv        = Map.MapVersion.BrickBuilder;
            if (extension == ".brk")
            {
                mv = Map.MapVersion.v2;
            }
            MapExporter.Export(LoadedMap, path, mv, bbData);
            mapStopwatch.Stop();
            UnityEngine.Debug.Log($"Saved {LoadedMap.Bricks.Count} bricks in " + mapStopwatch.ElapsedMilliseconds + " ms");
        }

        FileHistoryManager.AddToRecents(path);
    }