Inheritance: ScriptableWizard
    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();
                }
            }
        }
    }
Exemple #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();
        }
    }
Exemple #3
0
    void SnapGround()
    {
        MapExporter mapExporter = (MapExporter)target;

        GroundExporter[] groundExporter = mapExporter.gameObject.GetComponentsInChildren <GroundExporter> ();
        for (int i = 0; i < groundExporter.Length; i++)
        {
            groundExporter[i].SnapGround();
        }
    }
Exemple #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);
    }
Exemple #5
0
    public void Copy(Brick[] bricks)
    {
        Clipboard.bricks = new BrickData[bricks.Length];
        for (int i = 0; i < bricks.Length; i++)
        {
            BrickData b = new BrickData(bricks[i]);
            if (SettingsManager.Settings.CopySuffix)
            {
                b.Name = b.Name + " - Copy";
            }
            Clipboard.bricks[i] = b;
        }

        string bricksToCopy = SettingsManager.Settings.CopyToWorkshopFormat ? MapExporter.ExportBRKFromBricklist(Clipboard) : JsonUtility.ToJson(Clipboard);

        Helper.CopyToClipboard(bricksToCopy);
    }
Exemple #6
0
    MapDataSO GetOrCreateMapDataSO()
    {
        MapExporter mapExporter = (MapExporter)target;
        MapDataSO   mapDataSO   = (MapDataSO)AssetDatabase.LoadAssetAtPath(ResourcePaths.GetMapPathFromAssets(mapExporter.m_MapName), typeof(MapDataSO));

        if (mapDataSO == null)
        {
            mapDataSO = ScriptableObject.CreateInstance <MapDataSO> ();

            AssetDatabase.CreateAsset(mapDataSO, ResourcePaths.GetMapPathFromAssets(mapExporter.m_MapName) + ".asset");

            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }

        return(mapDataSO);
    }
Exemple #7
0
    void ExportMap()
    {
        MapExporter mapExporter = (MapExporter)target;

        if (string.IsNullOrEmpty(mapExporter.m_MapName))
        {
            Debug.LogError("Cannot save a map without Name");
            return;
        }
        MapDataSO mapDataSO = GetOrCreateMapDataSO();

        mapDataSO.m_MapDataInfo = mapExporter.CreateMapDataInfo();

        //AssetDatabase.AddObjectToAsset (mapDataSO, PATH_MAP_EXPORT);
        EditorUtility.SetDirty(mapDataSO);
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
    }
Exemple #8
0
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        MapExporter window = (MapExporter)EditorWindow.GetWindow(typeof(MapExporter));

        window.minSize = window.maxSize = new Vector2(800, 500);

        dataPath = Application.dataPath + "/Resources/Maps";

        Terrain t = FindObjectOfType <Terrain>();

        if (t != null)
        {
            mapSize = t.terrainData.size.x + "x" + t.terrainData.size.z;
        }

        window.Show();
    }
    private void OnGUI()
    {
        SetupStyle();

        //UI Content
        GUILayout.BeginVertical();
        if (BaseSetupUI())
        {
            GUILayout.Label("Scene Objects", bigLabel);

            showCore = EditorGUILayout.Foldout(showCore, "Core");
            if (showCore)
            {
                CoreUI();
            }

            gameplay = EditorGUILayout.Foldout(gameplay, "Gameplay");
            if (gameplay)
            {
                GameplayUI();
            }

            showFX = EditorGUILayout.Foldout(showFX, "FX");
            if (showFX)
            {
                FXUI();
            }

            showMisc = EditorGUILayout.Foldout(showMisc, "Misc");
            if (showMisc)
            {
                MiscUI();
            }


            //Export Section
            EditorGUILayout.Space();
            MapExporter.RunGUI();
        }


        GUILayout.EndVertical();
    }
Exemple #10
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);
    }
Exemple #11
0
        /// <summary>
        /// Initializes the editor
        /// </summary>
        private void InitializeEditor()
        {
            // events
            Move       += editorViewport.OnEditorMoves;
            Activated  += editorViewport.OnEditorGotFocus;
            Deactivate += editorViewport.OnEditorLostFocus;
            Disposed   += EditorForm_Dispose;

            editorViewport.OnViewportFocus      += OnViewportFocus;
            textureSelector.ApplyButton.Click   += OnApplySelectedTexture;
            textureSelector.ReplaceButton.Click += OnReplaceSelectedTexture;

            creationButtonsPanel.OnCreationButtonPressed = HandleGeometryBarItems;
            solidProperties.OnPropertiesChanged          = OnSolidPropertiesChanged;
            textureProperties.OnPropertiesChanged        = OnTexturePropertiesChanged;
            textureProperties.OnJustify = OnTexturePropertiesJustifyClicked;

            // initialization
            EditorSettings    = new EditorSettings();
            RubberBand        = new RubberBand();
            Selection         = new MapObjectGroup();
            CopyBoard         = new MapObjectGroup();
            CurrentTool       = new SolidManipulationTool();
            defaultMapSaver   = new RuneMapExporter();
            defaultMapLoader  = new RuneMapImporter();
            TextureCollection = new TextureCollection(EditorSettings.TextureFolder);

            if (!DesignMode)
            {
                EditorSettings.Load();
                SetupSolidFactory();
                solidProperties.UpdateProperties(Selection);
                editorViewport.SetController(this);
                textureSelector.TextureCollection = TextureCollection;
                CurrentTool.Initialize(this);

                Rotate = GeneralUtility.CreateCursor(Resources.rotate, 16, 16);
                NewDocument();
            }
        }
Exemple #12
0
        private void Init()
        {
            tacMapHub.On <Marker <MapId>, bool>("AddOrUpdateMarker", (msg, _) =>
                                                armaHub.Clients.Group(armaChannel).SendAsync("Callback", "AddTacMapMarker", MapExporter.GetMarkerData(msg.id, msg.data)));

            tacMapHub.On <Marker <MapId>, bool>("RemoveMarker", (msg, _) =>
                                                armaHub.Clients.Group(armaChannel).SendAsync("Callback", "RemoveTacMapMarker", MapExporter.GetMarkerData(msg.id, msg.data)));

            tacMapHub.Reconnected += async info => { await SayHello(); };
        }