12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- //------------------------------------------------------------
- // Game Framework
- // Copyright © 2013-2021 loyalsoft. All rights reserved.
- // Homepage: http://www.game7000.com/
- // Feedback: http://www.game7000.com/
- //------------------------------------------------------------
- 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;
- }
- }
- }
- }
|