Example #1
0
    void mainGUI()
    {
        if (Event.current != null)
        {
            // ----------------------------------------------------------------------------------------------------
            // ----- Check Keyboard and Mouse Shortcuts
            // ----------------------------------------------------------------------------------------------------

            YuME_keyboardShortcuts.checkKeyboardShortcuts(Event.current);
            YuME_mouseShorcuts.checkMouseShortcuts(Event.current);

            SceneView.RepaintAll();
        }

        EditorGUILayout.Space();

        GUILayout.Label(editorData.mapEditorHeader);

        EditorGUILayout.BeginVertical("box");

        if (GUILayout.Button("Get the full version of YuME", GUILayout.Height(30)))
        {
            Application.OpenURL("http://u3d.as/DrF");
        }

        EditorGUILayout.BeginHorizontal();

        toolEnabled = GUILayout.Toggle(toolEnabled, "Enable YuME", "Button", GUILayout.Height(30));

        if (_toolEnabled != toolEnabled)
        {
            if (!toolEnabled)
            {
                YuTools_Utils.showUnityGrid(true);
                YuME_tileFunctions.restoreIsolatedGridTiles();
                YuME_tileFunctions.restoreIsolatedLayerTiles();
            }
            else
            {
                setTileBrush(0);
                YuTools_Utils.showUnityGrid(false);
            }

            SceneView.RepaintAll();
        }

        _toolEnabled = toolEnabled;

        openConfig = GUILayout.Toggle(openConfig, editorData.configButton, "Button", GUILayout.Width(30), GUILayout.Height(30));

        if (openConfig == true)
        {
            YuME_editorConfig editorConfig = EditorWindow.GetWindow <YuME_editorConfig>(true, "Editor Config");
            editorConfig.titleContent.text = "Editor Config";
        }

        openConfig = false;

        EditorGUILayout.EndHorizontal();
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical("box");
        gridDimensions = EditorGUILayout.Vector2Field("Grid Dimensions", gridDimensions);
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical("box");
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Grid Height: " + gridHeight.ToString());
        GUILayout.Label("Brush Size: (" + brushSize.x.ToString() + "," + brushSize.y.ToString() + "," + brushSize.z.ToString() + ")");
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical("box");
        EditorGUILayout.LabelField("Pick The Tile Set To Use", EditorStyles.boldLabel);
        currentTileSetIndex = EditorGUILayout.Popup("Choose Tileset", currentTileSetIndex, tileSetNames);

        if (currentTileSetIndex != _currentTileSetIndex)
        {
            loadPreviewTiles();
        }

        if (GUILayout.Button("Reload Available Tilesets", GUILayout.Height(30)))
        {
            importTileSets(true);
            loadCustomBrushes();
            loadPreviewTiles(); // this is in the wrong place - it needs to be triggered when the user picks a new tileset
        }

        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical("box");

        string[] buttonLabels = new string[] { "Tileset Brushes", "Custom Brushes" };

        brushPallete = (brushOptions)GUILayout.SelectionGrid(
            (int)brushPallete,
            buttonLabels,
            2,
            EditorStyles.toolbarButton
            );

        EditorGUILayout.EndVertical();

        drawTilePreviews();

        EditorGUILayout.BeginVertical("box");

        EditorGUILayout.LabelField("Tile Previw Columns", EditorStyles.boldLabel);
        tilePreviewColumnWidth = EditorGUILayout.IntSlider(tilePreviewColumnWidth, 1, 10);

        EditorGUILayout.EndVertical();

        updateGridColors();
        YuME_sceneGizmoFunctions.displayGizmoGrid();

        _currentTileSetIndex = currentTileSetIndex;
    }
Example #2
0
    static void Initialize()
    {
        YuME_editorConfig editorConfig = EditorWindow.GetWindow <YuME_editorConfig>(true, "Editor Config");

        editorConfig.titleContent.text = "Editor Config";
    }