コード例 #1
0
 public static void setTileBrush(int index)
 {
     currentBrushIndex = index;
     currentBrushType  = brushTypes.standardBrush;
     currentTile       = currentTileSetObjects[index];
     tileRotation      = 0f;
     YuME_brushFunctions.updateBrushTile();
     selectedTool = toolIcons.brushTool;
 }
コード例 #2
0
    static void drawCustomBrushButtons(int index)
    {
        Texture2D  previewImage  = AssetPreview.GetAssetPreview(currentCustomBrushes[index]);
        GUIContent buttonContent = new GUIContent(previewImage);

        bool isActive = false;

        if (currentTile.name == currentCustomBrushes[index].name)
        {
            isActive = true;
        }

        EditorGUILayout.BeginVertical();

        bool isToggleDown = GUILayout.Toggle(isActive, buttonContent, GUI.skin.button);

        if (isToggleDown == true && isActive == false)
        {
            currentTile      = currentCustomBrushes[index];
            currentBrushType = brushTypes.customBrush;
            tileRotation     = 0f;
            YuME_brushFunctions.updateBrushTile();
            selectedTool = toolIcons.brushTool;
        }

        if (GUILayout.Button("Delete Brush"))
        {
            if (EditorUtility.DisplayDialog("Delete Custom Brush?", "Are you sure you want to delete the custom brush prefab from the project", "Delete", "No"))
            {
                string destinationPath = availableTileSets[currentTileSetIndex].customBrushDestinationFolder + "/" + currentCustomBrushes[index].name + ".prefab";
                AssetDatabase.DeleteAsset(destinationPath);
                loadCustomBrushes();
            }
        }

        EditorGUILayout.EndVertical();
    }