初始化仓库
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
namespace UnityGameFramework.Editor.ResourceTools
|
||||
{
|
||||
public enum AssetSorterType : byte
|
||||
{
|
||||
Path,
|
||||
Name,
|
||||
Guid,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5463b22a6a4019146a38f7b80dbe6fa7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace UnityGameFramework.Editor.ResourceTools
|
||||
{
|
||||
internal sealed partial class ResourceEditor : EditorWindow
|
||||
{
|
||||
private enum MenuState : byte
|
||||
{
|
||||
Normal,
|
||||
Add,
|
||||
Rename,
|
||||
Remove,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32b00a6c44b75494f8576b42717b1f1f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,164 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Editor.ResourceTools
|
||||
{
|
||||
internal sealed partial class ResourceEditor : EditorWindow
|
||||
{
|
||||
private sealed class ResourceFolder
|
||||
{
|
||||
private static Texture s_CachedIcon = null;
|
||||
|
||||
private readonly List<ResourceFolder> m_Folders;
|
||||
private readonly List<ResourceItem> m_Items;
|
||||
|
||||
public ResourceFolder(string name, ResourceFolder folder)
|
||||
{
|
||||
m_Folders = new List<ResourceFolder>();
|
||||
m_Items = new List<ResourceItem>();
|
||||
|
||||
Name = name;
|
||||
Folder = folder;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public ResourceFolder Folder
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public string FromRootPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return Folder == null ? string.Empty : (Folder.Folder == null ? Name : Utility.Text.Format("{0}/{1}", Folder.FromRootPath, Name));
|
||||
}
|
||||
}
|
||||
|
||||
public int Depth
|
||||
{
|
||||
get
|
||||
{
|
||||
return Folder != null ? Folder.Depth + 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static Texture Icon
|
||||
{
|
||||
get
|
||||
{
|
||||
if (s_CachedIcon == null)
|
||||
{
|
||||
s_CachedIcon = AssetDatabase.GetCachedIcon("Assets");
|
||||
}
|
||||
|
||||
return s_CachedIcon;
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
m_Folders.Clear();
|
||||
m_Items.Clear();
|
||||
}
|
||||
|
||||
public ResourceFolder[] GetFolders()
|
||||
{
|
||||
return m_Folders.ToArray();
|
||||
}
|
||||
|
||||
public ResourceFolder GetFolder(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new GameFrameworkException("Resource folder name is invalid.");
|
||||
}
|
||||
|
||||
foreach (ResourceFolder folder in m_Folders)
|
||||
{
|
||||
if (folder.Name == name)
|
||||
{
|
||||
return folder;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public ResourceFolder AddFolder(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new GameFrameworkException("Resource folder name is invalid.");
|
||||
}
|
||||
|
||||
ResourceFolder folder = GetFolder(name);
|
||||
if (folder != null)
|
||||
{
|
||||
throw new GameFrameworkException("Resource folder is already exist.");
|
||||
}
|
||||
|
||||
folder = new ResourceFolder(name, this);
|
||||
m_Folders.Add(folder);
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
||||
public ResourceItem[] GetItems()
|
||||
{
|
||||
return m_Items.ToArray();
|
||||
}
|
||||
|
||||
public ResourceItem GetItem(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new GameFrameworkException("Resource item name is invalid.");
|
||||
}
|
||||
|
||||
foreach (ResourceItem item in m_Items)
|
||||
{
|
||||
if (item.Name == name)
|
||||
{
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void AddItem(string name, Resource resource)
|
||||
{
|
||||
ResourceItem item = GetItem(name);
|
||||
if (item != null)
|
||||
{
|
||||
throw new GameFrameworkException("Resource item is already exist.");
|
||||
}
|
||||
|
||||
item = new ResourceItem(name, resource, this);
|
||||
m_Items.Add(item);
|
||||
m_Items.Sort(ResourceItemComparer);
|
||||
}
|
||||
|
||||
private int ResourceItemComparer(ResourceItem a, ResourceItem b)
|
||||
{
|
||||
return a.Name.CompareTo(b.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8cb7e55dc8f5c0b4c8bdad2802a24162
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,159 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Editor.ResourceTools
|
||||
{
|
||||
internal sealed partial class ResourceEditor : EditorWindow
|
||||
{
|
||||
private sealed class ResourceItem
|
||||
{
|
||||
private static Texture s_CachedUnknownIcon = null;
|
||||
private static Texture s_CachedAssetIcon = null;
|
||||
private static Texture s_CachedSceneIcon = null;
|
||||
|
||||
public ResourceItem(string name, Resource resource, ResourceFolder folder)
|
||||
{
|
||||
if (resource == null)
|
||||
{
|
||||
throw new GameFrameworkException("Resource is invalid.");
|
||||
}
|
||||
|
||||
if (folder == null)
|
||||
{
|
||||
throw new GameFrameworkException("Resource folder is invalid.");
|
||||
}
|
||||
|
||||
Name = name;
|
||||
Resource = resource;
|
||||
Folder = folder;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public Resource Resource
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public ResourceFolder Folder
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public string FromRootPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return Folder.Folder == null ? Name : Utility.Text.Format("{0}/{1}", Folder.FromRootPath, Name);
|
||||
}
|
||||
}
|
||||
|
||||
public int Depth
|
||||
{
|
||||
get
|
||||
{
|
||||
return Folder != null ? Folder.Depth + 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public Texture Icon
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Resource.IsLoadFromBinary)
|
||||
{
|
||||
Asset asset = Resource.GetFirstAsset();
|
||||
if (asset != null)
|
||||
{
|
||||
Texture texture = AssetDatabase.GetCachedIcon(AssetDatabase.GUIDToAssetPath(asset.Guid));
|
||||
return texture != null ? texture : CachedUnknownIcon;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (Resource.AssetType)
|
||||
{
|
||||
case AssetType.Asset:
|
||||
return CachedAssetIcon;
|
||||
|
||||
case AssetType.Scene:
|
||||
return CachedSceneIcon;
|
||||
}
|
||||
}
|
||||
|
||||
return CachedUnknownIcon;
|
||||
}
|
||||
}
|
||||
|
||||
private static Texture CachedUnknownIcon
|
||||
{
|
||||
get
|
||||
{
|
||||
if (s_CachedUnknownIcon == null)
|
||||
{
|
||||
string iconName = null;
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
iconName = "GameObject Icon";
|
||||
#else
|
||||
iconName = "Prefab Icon";
|
||||
#endif
|
||||
s_CachedUnknownIcon = GetIcon(iconName);
|
||||
}
|
||||
|
||||
return s_CachedUnknownIcon;
|
||||
}
|
||||
}
|
||||
|
||||
private static Texture CachedAssetIcon
|
||||
{
|
||||
get
|
||||
{
|
||||
if (s_CachedAssetIcon == null)
|
||||
{
|
||||
string iconName = null;
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
iconName = "Prefab Icon";
|
||||
#else
|
||||
iconName = "PrefabNormal Icon";
|
||||
#endif
|
||||
s_CachedAssetIcon = GetIcon(iconName);
|
||||
}
|
||||
|
||||
return s_CachedAssetIcon;
|
||||
}
|
||||
}
|
||||
|
||||
private static Texture CachedSceneIcon
|
||||
{
|
||||
get
|
||||
{
|
||||
if (s_CachedSceneIcon == null)
|
||||
{
|
||||
s_CachedSceneIcon = GetIcon("SceneAsset Icon");
|
||||
}
|
||||
|
||||
return s_CachedSceneIcon;
|
||||
}
|
||||
}
|
||||
|
||||
private static Texture GetIcon(string iconName)
|
||||
{
|
||||
return EditorGUIUtility.IconContent(iconName).image;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f2127e06af00f84294606afa2dfc494
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 956e53f5acdcb4c40a8ecc68d943dde0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
namespace UnityGameFramework.Editor.ResourceTools
|
||||
{
|
||||
/// <summary>
|
||||
/// ResourceEditor 配置路径属性。
|
||||
/// </summary>
|
||||
public sealed class ResourceEditorConfigPathAttribute : ConfigPathAttribute
|
||||
{
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af287b4a1d99d3946b1aab8f70c78964
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,679 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Editor.ResourceTools
|
||||
{
|
||||
public sealed class ResourceEditorController
|
||||
{
|
||||
private const string DefaultSourceAssetRootPath = "Assets";
|
||||
|
||||
private readonly string m_ConfigurationPath;
|
||||
private readonly ResourceCollection m_ResourceCollection;
|
||||
private readonly List<string> m_SourceAssetSearchPaths;
|
||||
private readonly List<string> m_SourceAssetSearchRelativePaths;
|
||||
private readonly Dictionary<string, SourceAsset> m_SourceAssets;
|
||||
private SourceFolder m_SourceAssetRoot;
|
||||
private string m_SourceAssetRootPath;
|
||||
private string m_SourceAssetUnionTypeFilter;
|
||||
private string m_SourceAssetUnionLabelFilter;
|
||||
private string m_SourceAssetExceptTypeFilter;
|
||||
private string m_SourceAssetExceptLabelFilter;
|
||||
private AssetSorterType m_AssetSorter;
|
||||
|
||||
public ResourceEditorController()
|
||||
{
|
||||
m_ConfigurationPath = Type.GetConfigurationPath<ResourceEditorConfigPathAttribute>() ?? Utility.Path.GetRegularPath(Path.Combine(Application.dataPath, "GameFramework/Configs/ResourceEditor.xml"));
|
||||
m_ResourceCollection = new ResourceCollection();
|
||||
m_ResourceCollection.OnLoadingResource += delegate (int index, int count)
|
||||
{
|
||||
if (OnLoadingResource != null)
|
||||
{
|
||||
OnLoadingResource(index, count);
|
||||
}
|
||||
};
|
||||
|
||||
m_ResourceCollection.OnLoadingAsset += delegate (int index, int count)
|
||||
{
|
||||
if (OnLoadingAsset != null)
|
||||
{
|
||||
OnLoadingAsset(index, count);
|
||||
}
|
||||
};
|
||||
|
||||
m_ResourceCollection.OnLoadCompleted += delegate ()
|
||||
{
|
||||
if (OnLoadCompleted != null)
|
||||
{
|
||||
OnLoadCompleted();
|
||||
}
|
||||
};
|
||||
|
||||
m_SourceAssetSearchPaths = new List<string>();
|
||||
m_SourceAssetSearchRelativePaths = new List<string>();
|
||||
m_SourceAssets = new Dictionary<string, SourceAsset>(StringComparer.Ordinal);
|
||||
m_SourceAssetRoot = null;
|
||||
m_SourceAssetRootPath = null;
|
||||
m_SourceAssetUnionTypeFilter = null;
|
||||
m_SourceAssetUnionLabelFilter = null;
|
||||
m_SourceAssetExceptTypeFilter = null;
|
||||
m_SourceAssetExceptLabelFilter = null;
|
||||
m_AssetSorter = AssetSorterType.Path;
|
||||
|
||||
SourceAssetRootPath = DefaultSourceAssetRootPath;
|
||||
}
|
||||
|
||||
public int ResourceCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_ResourceCollection.ResourceCount;
|
||||
}
|
||||
}
|
||||
|
||||
public int AssetCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_ResourceCollection.AssetCount;
|
||||
}
|
||||
}
|
||||
|
||||
public SourceFolder SourceAssetRoot
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SourceAssetRoot;
|
||||
}
|
||||
}
|
||||
|
||||
public string SourceAssetRootPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SourceAssetRootPath;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (m_SourceAssetRootPath == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_SourceAssetRootPath = value.Replace('\\', '/');
|
||||
m_SourceAssetRoot = new SourceFolder(m_SourceAssetRootPath, null);
|
||||
RefreshSourceAssetSearchPaths();
|
||||
}
|
||||
}
|
||||
|
||||
public string SourceAssetUnionTypeFilter
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SourceAssetUnionTypeFilter;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (m_SourceAssetUnionTypeFilter == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_SourceAssetUnionTypeFilter = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string SourceAssetUnionLabelFilter
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SourceAssetUnionLabelFilter;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (m_SourceAssetUnionLabelFilter == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_SourceAssetUnionLabelFilter = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string SourceAssetExceptTypeFilter
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SourceAssetExceptTypeFilter;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (m_SourceAssetExceptTypeFilter == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_SourceAssetExceptTypeFilter = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string SourceAssetExceptLabelFilter
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SourceAssetExceptLabelFilter;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (m_SourceAssetExceptLabelFilter == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_SourceAssetExceptLabelFilter = value;
|
||||
}
|
||||
}
|
||||
|
||||
public AssetSorterType AssetSorter
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_AssetSorter;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (m_AssetSorter == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_AssetSorter = value;
|
||||
}
|
||||
}
|
||||
|
||||
public event GameFrameworkAction<int, int> OnLoadingResource = null;
|
||||
|
||||
public event GameFrameworkAction<int, int> OnLoadingAsset = null;
|
||||
|
||||
public event GameFrameworkAction OnLoadCompleted = null;
|
||||
|
||||
public event GameFrameworkAction<SourceAsset[]> OnAssetAssigned = null;
|
||||
|
||||
public event GameFrameworkAction<SourceAsset[]> OnAssetUnassigned = null;
|
||||
|
||||
public bool Load()
|
||||
{
|
||||
if (!File.Exists(m_ConfigurationPath))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
XmlDocument xmlDocument = new XmlDocument();
|
||||
xmlDocument.Load(m_ConfigurationPath);
|
||||
XmlNode xmlRoot = xmlDocument.SelectSingleNode("UnityGameFramework");
|
||||
XmlNode xmlEditor = xmlRoot.SelectSingleNode("ResourceEditor");
|
||||
XmlNode xmlSettings = xmlEditor.SelectSingleNode("Settings");
|
||||
|
||||
XmlNodeList xmlNodeList = null;
|
||||
XmlNode xmlNode = null;
|
||||
|
||||
xmlNodeList = xmlSettings.ChildNodes;
|
||||
for (int i = 0; i < xmlNodeList.Count; i++)
|
||||
{
|
||||
xmlNode = xmlNodeList.Item(i);
|
||||
switch (xmlNode.Name)
|
||||
{
|
||||
case "SourceAssetRootPath":
|
||||
SourceAssetRootPath = xmlNode.InnerText;
|
||||
break;
|
||||
|
||||
case "SourceAssetSearchPaths":
|
||||
m_SourceAssetSearchRelativePaths.Clear();
|
||||
XmlNodeList xmlNodeListInner = xmlNode.ChildNodes;
|
||||
XmlNode xmlNodeInner = null;
|
||||
for (int j = 0; j < xmlNodeListInner.Count; j++)
|
||||
{
|
||||
xmlNodeInner = xmlNodeListInner.Item(j);
|
||||
if (xmlNodeInner.Name != "SourceAssetSearchPath")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
m_SourceAssetSearchRelativePaths.Add(xmlNodeInner.Attributes.GetNamedItem("RelativePath").Value);
|
||||
}
|
||||
break;
|
||||
|
||||
case "SourceAssetUnionTypeFilter":
|
||||
SourceAssetUnionTypeFilter = xmlNode.InnerText;
|
||||
break;
|
||||
|
||||
case "SourceAssetUnionLabelFilter":
|
||||
SourceAssetUnionLabelFilter = xmlNode.InnerText;
|
||||
break;
|
||||
|
||||
case "SourceAssetExceptTypeFilter":
|
||||
SourceAssetExceptTypeFilter = xmlNode.InnerText;
|
||||
break;
|
||||
|
||||
case "SourceAssetExceptLabelFilter":
|
||||
SourceAssetExceptLabelFilter = xmlNode.InnerText;
|
||||
break;
|
||||
|
||||
case "AssetSorter":
|
||||
AssetSorter = (AssetSorterType)Enum.Parse(typeof(AssetSorterType), xmlNode.InnerText);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
RefreshSourceAssetSearchPaths();
|
||||
}
|
||||
catch
|
||||
{
|
||||
File.Delete(m_ConfigurationPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
ScanSourceAssets();
|
||||
|
||||
m_ResourceCollection.Load();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Save()
|
||||
{
|
||||
try
|
||||
{
|
||||
XmlDocument xmlDocument = new XmlDocument();
|
||||
xmlDocument.AppendChild(xmlDocument.CreateXmlDeclaration("1.0", "UTF-8", null));
|
||||
|
||||
XmlElement xmlRoot = xmlDocument.CreateElement("UnityGameFramework");
|
||||
xmlDocument.AppendChild(xmlRoot);
|
||||
|
||||
XmlElement xmlEditor = xmlDocument.CreateElement("ResourceEditor");
|
||||
xmlRoot.AppendChild(xmlEditor);
|
||||
|
||||
XmlElement xmlSettings = xmlDocument.CreateElement("Settings");
|
||||
xmlEditor.AppendChild(xmlSettings);
|
||||
|
||||
XmlElement xmlElement = null;
|
||||
XmlAttribute xmlAttribute = null;
|
||||
|
||||
xmlElement = xmlDocument.CreateElement("SourceAssetRootPath");
|
||||
xmlElement.InnerText = SourceAssetRootPath.ToString();
|
||||
xmlSettings.AppendChild(xmlElement);
|
||||
|
||||
xmlElement = xmlDocument.CreateElement("SourceAssetSearchPaths");
|
||||
xmlSettings.AppendChild(xmlElement);
|
||||
|
||||
foreach (string sourceAssetSearchRelativePath in m_SourceAssetSearchRelativePaths)
|
||||
{
|
||||
XmlElement xmlElementInner = xmlDocument.CreateElement("SourceAssetSearchPath");
|
||||
xmlAttribute = xmlDocument.CreateAttribute("RelativePath");
|
||||
xmlAttribute.Value = sourceAssetSearchRelativePath;
|
||||
xmlElementInner.Attributes.SetNamedItem(xmlAttribute);
|
||||
xmlElement.AppendChild(xmlElementInner);
|
||||
}
|
||||
|
||||
xmlElement = xmlDocument.CreateElement("SourceAssetUnionTypeFilter");
|
||||
xmlElement.InnerText = SourceAssetUnionTypeFilter ?? string.Empty;
|
||||
xmlSettings.AppendChild(xmlElement);
|
||||
xmlElement = xmlDocument.CreateElement("SourceAssetUnionLabelFilter");
|
||||
xmlElement.InnerText = SourceAssetUnionLabelFilter ?? string.Empty;
|
||||
xmlSettings.AppendChild(xmlElement);
|
||||
xmlElement = xmlDocument.CreateElement("SourceAssetExceptTypeFilter");
|
||||
xmlElement.InnerText = SourceAssetExceptTypeFilter ?? string.Empty;
|
||||
xmlSettings.AppendChild(xmlElement);
|
||||
xmlElement = xmlDocument.CreateElement("SourceAssetExceptLabelFilter");
|
||||
xmlElement.InnerText = SourceAssetExceptLabelFilter ?? string.Empty;
|
||||
xmlSettings.AppendChild(xmlElement);
|
||||
xmlElement = xmlDocument.CreateElement("AssetSorter");
|
||||
xmlElement.InnerText = AssetSorter.ToString();
|
||||
xmlSettings.AppendChild(xmlElement);
|
||||
|
||||
string configurationDirectoryName = Path.GetDirectoryName(m_ConfigurationPath);
|
||||
if (!Directory.Exists(configurationDirectoryName))
|
||||
{
|
||||
Directory.CreateDirectory(configurationDirectoryName);
|
||||
}
|
||||
|
||||
xmlDocument.Save(m_ConfigurationPath);
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (File.Exists(m_ConfigurationPath))
|
||||
{
|
||||
File.Delete(m_ConfigurationPath);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return m_ResourceCollection.Save();
|
||||
}
|
||||
|
||||
public Resource[] GetResources()
|
||||
{
|
||||
return m_ResourceCollection.GetResources();
|
||||
}
|
||||
|
||||
public Resource GetResource(string name, string variant)
|
||||
{
|
||||
return m_ResourceCollection.GetResource(name, variant);
|
||||
}
|
||||
|
||||
public bool HasResource(string name, string variant)
|
||||
{
|
||||
return m_ResourceCollection.HasResource(name, variant);
|
||||
}
|
||||
|
||||
public bool AddResource(string name, string variant, string fileSystem, LoadType loadType, bool packed)
|
||||
{
|
||||
return m_ResourceCollection.AddResource(name, variant, fileSystem, loadType, packed);
|
||||
}
|
||||
|
||||
public bool RenameResource(string oldName, string oldVariant, string newName, string newVariant)
|
||||
{
|
||||
return m_ResourceCollection.RenameResource(oldName, oldVariant, newName, newVariant);
|
||||
}
|
||||
|
||||
public bool RemoveResource(string name, string variant)
|
||||
{
|
||||
Asset[] assetsToRemove = m_ResourceCollection.GetAssets(name, variant);
|
||||
if (m_ResourceCollection.RemoveResource(name, variant))
|
||||
{
|
||||
List<SourceAsset> unassignedSourceAssets = new List<SourceAsset>();
|
||||
foreach (Asset asset in assetsToRemove)
|
||||
{
|
||||
SourceAsset sourceAsset = GetSourceAsset(asset.Guid);
|
||||
if (sourceAsset != null)
|
||||
{
|
||||
unassignedSourceAssets.Add(sourceAsset);
|
||||
}
|
||||
}
|
||||
|
||||
if (OnAssetUnassigned != null)
|
||||
{
|
||||
OnAssetUnassigned(unassignedSourceAssets.ToArray());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool SetResourceLoadType(string name, string variant, LoadType loadType)
|
||||
{
|
||||
return m_ResourceCollection.SetResourceLoadType(name, variant, loadType);
|
||||
}
|
||||
|
||||
public bool SetResourcePacked(string name, string variant, bool packed)
|
||||
{
|
||||
return m_ResourceCollection.SetResourcePacked(name, variant, packed);
|
||||
}
|
||||
|
||||
public int RemoveUnusedResources()
|
||||
{
|
||||
List<Resource> resources = new List<Resource>(m_ResourceCollection.GetResources());
|
||||
List<Resource> removeResources = resources.FindAll(resource => GetAssets(resource.Name, resource.Variant).Length <= 0);
|
||||
foreach (Resource removeResource in removeResources)
|
||||
{
|
||||
m_ResourceCollection.RemoveResource(removeResource.Name, removeResource.Variant);
|
||||
}
|
||||
|
||||
return removeResources.Count;
|
||||
}
|
||||
|
||||
public Asset[] GetAssets(string name, string variant)
|
||||
{
|
||||
List<Asset> assets = new List<Asset>(m_ResourceCollection.GetAssets(name, variant));
|
||||
switch (AssetSorter)
|
||||
{
|
||||
case AssetSorterType.Path:
|
||||
assets.Sort(AssetPathComparer);
|
||||
break;
|
||||
|
||||
case AssetSorterType.Name:
|
||||
assets.Sort(AssetNameComparer);
|
||||
break;
|
||||
|
||||
case AssetSorterType.Guid:
|
||||
assets.Sort(AssetGuidComparer);
|
||||
break;
|
||||
}
|
||||
|
||||
return assets.ToArray();
|
||||
}
|
||||
|
||||
public Asset GetAsset(string guid)
|
||||
{
|
||||
return m_ResourceCollection.GetAsset(guid);
|
||||
}
|
||||
|
||||
public bool AssignAsset(string guid, string name, string variant)
|
||||
{
|
||||
if (m_ResourceCollection.AssignAsset(guid, name, variant))
|
||||
{
|
||||
if (OnAssetAssigned != null)
|
||||
{
|
||||
OnAssetAssigned(new SourceAsset[] { GetSourceAsset(guid) });
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool UnassignAsset(string guid)
|
||||
{
|
||||
if (m_ResourceCollection.UnassignAsset(guid))
|
||||
{
|
||||
SourceAsset sourceAsset = GetSourceAsset(guid);
|
||||
if (sourceAsset != null)
|
||||
{
|
||||
if (OnAssetUnassigned != null)
|
||||
{
|
||||
OnAssetUnassigned(new SourceAsset[] { sourceAsset });
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public int RemoveUnknownAssets()
|
||||
{
|
||||
List<Asset> assets = new List<Asset>(m_ResourceCollection.GetAssets());
|
||||
List<Asset> removeAssets = assets.FindAll(asset => GetSourceAsset(asset.Guid) == null);
|
||||
foreach (Asset asset in removeAssets)
|
||||
{
|
||||
m_ResourceCollection.UnassignAsset(asset.Guid);
|
||||
}
|
||||
|
||||
return removeAssets.Count;
|
||||
}
|
||||
|
||||
public SourceAsset[] GetSourceAssets()
|
||||
{
|
||||
int count = 0;
|
||||
SourceAsset[] sourceAssets = new SourceAsset[m_SourceAssets.Count];
|
||||
foreach (KeyValuePair<string, SourceAsset> sourceAsset in m_SourceAssets)
|
||||
{
|
||||
sourceAssets[count++] = sourceAsset.Value;
|
||||
}
|
||||
|
||||
return sourceAssets;
|
||||
}
|
||||
|
||||
public SourceAsset GetSourceAsset(string guid)
|
||||
{
|
||||
if (string.IsNullOrEmpty(guid))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
SourceAsset sourceAsset = null;
|
||||
if (m_SourceAssets.TryGetValue(guid, out sourceAsset))
|
||||
{
|
||||
return sourceAsset;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void ScanSourceAssets()
|
||||
{
|
||||
m_SourceAssets.Clear();
|
||||
m_SourceAssetRoot.Clear();
|
||||
|
||||
string[] sourceAssetSearchPaths = m_SourceAssetSearchPaths.ToArray();
|
||||
HashSet<string> tempGuids = new HashSet<string>();
|
||||
tempGuids.UnionWith(AssetDatabase.FindAssets(SourceAssetUnionTypeFilter, sourceAssetSearchPaths));
|
||||
tempGuids.UnionWith(AssetDatabase.FindAssets(SourceAssetUnionLabelFilter, sourceAssetSearchPaths));
|
||||
tempGuids.ExceptWith(AssetDatabase.FindAssets(SourceAssetExceptTypeFilter, sourceAssetSearchPaths));
|
||||
tempGuids.ExceptWith(AssetDatabase.FindAssets(SourceAssetExceptLabelFilter, sourceAssetSearchPaths));
|
||||
|
||||
string[] guids = new List<string>(tempGuids).ToArray();
|
||||
foreach (string guid in guids)
|
||||
{
|
||||
string fullPath = AssetDatabase.GUIDToAssetPath(guid);
|
||||
if (AssetDatabase.IsValidFolder(fullPath))
|
||||
{
|
||||
// Skip folder.
|
||||
continue;
|
||||
}
|
||||
|
||||
string assetPath = fullPath.Substring(SourceAssetRootPath.Length + 1);
|
||||
string[] splitedPath = assetPath.Split('/');
|
||||
SourceFolder folder = m_SourceAssetRoot;
|
||||
for (int i = 0; i < splitedPath.Length - 1; i++)
|
||||
{
|
||||
SourceFolder subFolder = folder.GetFolder(splitedPath[i]);
|
||||
folder = subFolder == null ? folder.AddFolder(splitedPath[i]) : subFolder;
|
||||
}
|
||||
|
||||
SourceAsset asset = folder.AddAsset(guid, fullPath, splitedPath[splitedPath.Length - 1]);
|
||||
m_SourceAssets.Add(asset.Guid, asset);
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshSourceAssetSearchPaths()
|
||||
{
|
||||
m_SourceAssetSearchPaths.Clear();
|
||||
|
||||
if (string.IsNullOrEmpty(m_SourceAssetRootPath))
|
||||
{
|
||||
SourceAssetRootPath = DefaultSourceAssetRootPath;
|
||||
}
|
||||
|
||||
if (m_SourceAssetSearchRelativePaths.Count > 0)
|
||||
{
|
||||
foreach (string sourceAssetSearchRelativePath in m_SourceAssetSearchRelativePaths)
|
||||
{
|
||||
m_SourceAssetSearchPaths.Add(Utility.Path.GetRegularPath(Path.Combine(m_SourceAssetRootPath, sourceAssetSearchRelativePath)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SourceAssetSearchPaths.Add(m_SourceAssetRootPath);
|
||||
}
|
||||
}
|
||||
|
||||
private int AssetPathComparer(Asset a, Asset b)
|
||||
{
|
||||
SourceAsset sourceAssetA = GetSourceAsset(a.Guid);
|
||||
SourceAsset sourceAssetB = GetSourceAsset(b.Guid);
|
||||
|
||||
if (sourceAssetA != null && sourceAssetB != null)
|
||||
{
|
||||
return sourceAssetA.Path.CompareTo(sourceAssetB.Path);
|
||||
}
|
||||
|
||||
if (sourceAssetA == null && sourceAssetB == null)
|
||||
{
|
||||
return a.Guid.CompareTo(b.Guid);
|
||||
}
|
||||
|
||||
if (sourceAssetA == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (sourceAssetB == null)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int AssetNameComparer(Asset a, Asset b)
|
||||
{
|
||||
SourceAsset sourceAssetA = GetSourceAsset(a.Guid);
|
||||
SourceAsset sourceAssetB = GetSourceAsset(b.Guid);
|
||||
|
||||
if (sourceAssetA != null && sourceAssetB != null)
|
||||
{
|
||||
return sourceAssetA.Name.CompareTo(sourceAssetB.Name);
|
||||
}
|
||||
|
||||
if (sourceAssetA == null && sourceAssetB == null)
|
||||
{
|
||||
return a.Guid.CompareTo(b.Guid);
|
||||
}
|
||||
|
||||
if (sourceAssetA == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (sourceAssetB == null)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int AssetGuidComparer(Asset a, Asset b)
|
||||
{
|
||||
SourceAsset sourceAssetA = GetSourceAsset(a.Guid);
|
||||
SourceAsset sourceAssetB = GetSourceAsset(b.Guid);
|
||||
|
||||
if (sourceAssetA != null && sourceAssetB != null || sourceAssetA == null && sourceAssetB == null)
|
||||
{
|
||||
return a.Guid.CompareTo(b.Guid);
|
||||
}
|
||||
|
||||
if (sourceAssetA == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (sourceAssetB == null)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c8c042eb5e752f49920cfc09aff81c6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,85 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Editor.ResourceTools
|
||||
{
|
||||
public sealed class SourceAsset
|
||||
{
|
||||
private Texture m_CachedIcon;
|
||||
|
||||
public SourceAsset(string guid, string path, string name, SourceFolder folder)
|
||||
{
|
||||
if (folder == null)
|
||||
{
|
||||
throw new GameFrameworkException("Source asset folder is invalid.");
|
||||
}
|
||||
|
||||
Guid = guid;
|
||||
Path = path;
|
||||
Name = name;
|
||||
Folder = folder;
|
||||
m_CachedIcon = null;
|
||||
}
|
||||
|
||||
public string Guid
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public string Path
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public SourceFolder Folder
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public string FromRootPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return Folder.Folder == null ? Name : Utility.Text.Format("{0}/{1}", Folder.FromRootPath, Name);
|
||||
}
|
||||
}
|
||||
|
||||
public int Depth
|
||||
{
|
||||
get
|
||||
{
|
||||
return Folder != null ? Folder.Depth + 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public Texture Icon
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CachedIcon == null)
|
||||
{
|
||||
m_CachedIcon = AssetDatabase.GetCachedIcon(Path);
|
||||
}
|
||||
|
||||
return m_CachedIcon;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ded5a7d9ccd4b2a409ec840ba3df0b18
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,172 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Editor.ResourceTools
|
||||
{
|
||||
public sealed class SourceFolder
|
||||
{
|
||||
private static Texture s_CachedIcon = null;
|
||||
|
||||
private readonly List<SourceFolder> m_Folders;
|
||||
private readonly List<SourceAsset> m_Assets;
|
||||
|
||||
public SourceFolder(string name, SourceFolder folder)
|
||||
{
|
||||
m_Folders = new List<SourceFolder>();
|
||||
m_Assets = new List<SourceAsset>();
|
||||
|
||||
Name = name;
|
||||
Folder = folder;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public SourceFolder Folder
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public string FromRootPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return Folder == null ? string.Empty : (Folder.Folder == null ? Name : Utility.Text.Format("{0}/{1}", Folder.FromRootPath, Name));
|
||||
}
|
||||
}
|
||||
|
||||
public int Depth
|
||||
{
|
||||
get
|
||||
{
|
||||
return Folder != null ? Folder.Depth + 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static Texture Icon
|
||||
{
|
||||
get
|
||||
{
|
||||
if (s_CachedIcon == null)
|
||||
{
|
||||
s_CachedIcon = AssetDatabase.GetCachedIcon("Assets");
|
||||
}
|
||||
|
||||
return s_CachedIcon;
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
m_Folders.Clear();
|
||||
m_Assets.Clear();
|
||||
}
|
||||
|
||||
public SourceFolder[] GetFolders()
|
||||
{
|
||||
return m_Folders.ToArray();
|
||||
}
|
||||
|
||||
public SourceFolder GetFolder(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new GameFrameworkException("Source folder name is invalid.");
|
||||
}
|
||||
|
||||
foreach (SourceFolder folder in m_Folders)
|
||||
{
|
||||
if (folder.Name == name)
|
||||
{
|
||||
return folder;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public SourceFolder AddFolder(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new GameFrameworkException("Source folder name is invalid.");
|
||||
}
|
||||
|
||||
SourceFolder folder = GetFolder(name);
|
||||
if (folder != null)
|
||||
{
|
||||
throw new GameFrameworkException("Source folder is already exist.");
|
||||
}
|
||||
|
||||
folder = new SourceFolder(name, this);
|
||||
m_Folders.Add(folder);
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
||||
public SourceAsset[] GetAssets()
|
||||
{
|
||||
return m_Assets.ToArray();
|
||||
}
|
||||
|
||||
public SourceAsset GetAsset(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new GameFrameworkException("Source asset name is invalid.");
|
||||
}
|
||||
|
||||
foreach (SourceAsset asset in m_Assets)
|
||||
{
|
||||
if (asset.Name == name)
|
||||
{
|
||||
return asset;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public SourceAsset AddAsset(string guid, string path, string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(guid))
|
||||
{
|
||||
throw new GameFrameworkException("Source asset guid is invalid.");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new GameFrameworkException("Source asset path is invalid.");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new GameFrameworkException("Source asset name is invalid.");
|
||||
}
|
||||
|
||||
SourceAsset asset = GetAsset(name);
|
||||
if (asset != null)
|
||||
{
|
||||
throw new GameFrameworkException(Utility.Text.Format("Source asset '{0}' is already exist.", name));
|
||||
}
|
||||
|
||||
asset = new SourceAsset(guid, path, name, this);
|
||||
m_Assets.Add(asset);
|
||||
|
||||
return asset;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bcb967b558b5d254fb96db1fc5ed808b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user