Exemplo n.º 1
0
    void OnGUI_UpgradeBrushes()
    {
        RotorzEditorGUI.Title("Step 2: Upgrade Brushes");

        if (RtsBrushDatabaseWrapper.Instance.records.Count == 0)
        {
            OnGUI_UpgradeNoBrushes();
            return;
        }

        if (_brushUpgrader == null)
        {
            _brushUpgrader = new RtsBrushUpgradeUtility();
        }

        GUILayout.Label("Existing brushes will not be removed automatically.", _boldWrapStyle);
        GUILayout.Space(5);
        GUILayout.Label("An asset will be generated that maps existing brushes to their upgraded counterparts which is used when upgrading tile systems. If map asset is deleted this wizard restart.", EditorStyles.wordWrappedLabel);
        GUILayout.Space(5);
        EditorGUILayout.HelpBox("Do not remove older version of extension nor existing brushes folder 'Assets/TilePrefabs' until you have upgraded all of your tile systems.", MessageType.Warning, true);

        GUILayout.Space(5);
        GUILayout.BeginHorizontal();
        GUILayout.Space(15);
        GUILayout.BeginVertical();
        _brushUpgrader.useProceduralTilesets = GUILayout.Toggle(_brushUpgrader.useProceduralTilesets, "Use procedural tilesets / atlas brushes");
        _brushUpgrader.useNewAssets          = GUILayout.Toggle(_brushUpgrader.useNewAssets, "Use newer smooth platform brushes.");
        GUILayout.EndVertical();
        GUILayout.EndHorizontal();

        GUILayout.Space(5);
        GUILayout.Label("Please click 'Upgrade Brushes' to proceed.", EditorStyles.wordWrappedLabel);

        GUILayout.Space(10);

        GUILayout.BeginHorizontal();

        if (GUILayout.Button("Go Back", GUILayout.Height(24)))
        {
            _hasWelcomed = false;
            GUIUtility.ExitGUI();
        }

        if (GUILayout.Button("Upgrade Brushes", GUILayout.Height(24)))
        {
            _brushUpgrader.UpgradeBrushes();

            ToolUtility.RepaintPaletteWindows();
            GUIUtility.ExitGUI();
        }

        GUILayout.EndHorizontal();
    }
    static void Menu_RTS_Brushes_RescanBrushes()
    {
        // Refresh asset database.
        AssetDatabase.Refresh();

        // Automatically detect new brushes.
        BrushDatabase.Instance.Rescan(RefreshPreviews.ClearCache);

        // Repaint windows that may have been affected.
        ToolUtility.RepaintPaletteWindows();
        DesignerWindow.RepaintWindow();
    }