private static void AssingType(FolderTypeName type, RainbowFolder folder) { FolderIconPair icons = FolderTypesStorage.Instance.GetIconsByType(type); folder.SmallIcon = icons.SmallIcon; folder.LargeIcon = icons.LargeIcon; folder.IsIconCustom = false; }
private static void AssingPlatform(FolderPlatformName platform, RainbowFolder folder) { FolderIconPair icons = FolderPlatformsStorage.Instance.GetIconsByType(platform); folder.SmallIcon = icons.SmallIcon; folder.LargeIcon = icons.LargeIcon; folder.IsIconCustom = false; }
//--------------------------------------------------------------------- // Helpers //--------------------------------------------------------------------- private static void Colorize(FolderColorName color, RainbowFolder folder) { FolderIconPair icons = FolderColorsStorage.Instance.GetIconsByColor(color); folder.SmallIcon = icons.SmallIcon; folder.LargeIcon = icons.LargeIcon; folder.IsIconCustom = false; }
private static void AssignTag(FolderTagName tag, RainbowFolder folder) { FolderIconPair icons = FolderTagsStorage.Instance.GetIconsByTag(tag); folder.SmallIcon = icons.SmallIcon; folder.LargeIcon = icons.LargeIcon; folder.IsIconCustom = false; }
private static void ChangeSelectedFoldersIcons(FolderIconPair icons) { Selection.assetGUIDs.ToList().ForEach( assetGuid => { var assetPath = AssetDatabase.GUIDToAssetPath(assetGuid); if (!AssetDatabase.IsValidFolder(assetPath)) { return; } var folder = AssetDatabase.LoadAssetAtPath <DefaultAsset>(assetPath); var path = AssetDatabase.GetAssetPath(folder); RainbowFoldersSettings.Instance.ChangeFolderIconsByPath(path, icons); } ); }
public static void ChangeFolderIconsByPath(this RainbowFoldersSettings settings, string path, FolderIconPair icons) { Undo.RecordObject(settings, "Modify Rainbow Folder Settings"); var folders = settings.Folders; var folder = folders.SingleOrDefault(x => x.Key == path); if (folder == null) { folders.Add(new RainbowFolder { Key = path, Type = RainbowFolder.KeyType.Path, SmallIcon = icons.SmallIcon, LargeIcon = icons.LargeIcon }); } else { folder.SmallIcon = icons.SmallIcon; folder.LargeIcon = icons.LargeIcon; } EditorUtility.SetDirty(settings); }
private static void ChangeSelectedFoldersIcons(FolderIconPair icons) { Selection.assetGUIDs.ToList().ForEach( assetGuid => { var assetPath = AssetDatabase.GUIDToAssetPath(assetGuid); if (AssetDatabase.IsValidFolder(assetPath)) { var folder = AssetDatabase.LoadAssetAtPath<DefaultAsset>(assetPath); var path = AssetDatabase.GetAssetPath(folder); RainbowFoldersSettings.Instance.ChangeFolderIconsByPath(path, icons); } else { // Can't colorize other assets } } ); }
public static void ChangeFolderIconsByPath(this RainbowFoldersSettings settings, string path, FolderIconPair icons) { Undo.RecordObject(settings, "Modify Rainbow Folder Settings"); var folders = settings.Folders; var folder = folders.SingleOrDefault(x => x.Key == path); if (folder == null) { folders.Add(new RainbowFolder { Key = path, Type = RainbowFolder.KeyType.Path, SmallIcon = icons.SmallIcon, LargeIcon = icons.LargeIcon }); } else { folder.SmallIcon = icons.SmallIcon; folder.LargeIcon = icons.LargeIcon; } EditorUtility.SetDirty(settings); }
private static void AssingPlatform(FolderPlatformName platform) { FolderIconPair icons = FolderPlatformsStorage.Instance.GetIconsByType(platform); ChangeSelectedFoldersIcons(icons); }
private static void AssingType(FolderTypeName type) { FolderIconPair icons = FolderTypesStorage.Instance.GetIconsByType(type); ChangeSelectedFoldersIcons(icons); }
private static void AssignTag(FolderTagName tag) { FolderIconPair icons = FolderTagsStorage.Instance.GetIconsByTag(tag); ChangeSelectedFoldersIcons(icons); }
//--------------------------------------------------------------------- // Helpers //--------------------------------------------------------------------- private static void Colorize(FolderColorName color) { FolderIconPair icons = FolderColorsStorage.Instance.GetIconsByColor(color); ChangeSelectedFoldersIcons(icons); }