AkiraPixelWind/Assets/Scripts/Editor/ResourceComponentInspector.cs
2022-12-29 18:20:40 +08:00

110 lines
5.0 KiB
C#

using Axibug.Editor;
using Axibug.Resources;
using Game;
using UnityEditor;
namespace Game.Editor
{
[CustomEditor(typeof(ResourcesComponent))]
public sealed class ResourceComponentInspector : GameInspector
{
private bool bAssets = true;
private bool bPrefabs = true;
private bool bAssetBundles = true;
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
serializedObject.Update();
ResourcesComponent t = (ResourcesComponent)target;
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
{
bAssets = EditorGUILayout.Foldout(bAssets, "Assets");
if (bAssets)
{
EditorGUI.indentLevel++;
//asset
EditorGUILayout.LabelField("Cache Assets");
EditorGUI.indentLevel++;
//缓存的asset
EditorGUILayout.LabelField("Count", AssetManager.getCacheAssetsCount.ToString());
EditorGUILayout.Popup("Names", 0, AssetManager.getCacheAssetsNames);
EditorGUI.indentLevel--;
EditorGUILayout.LabelField("Loading Assets");
EditorGUI.indentLevel++;
//正在加载的asset
EditorGUILayout.LabelField("Count", AssetManager.getLoadingAssetsCount.ToString());
EditorGUILayout.Popup("Names", 0, AssetManager.getLoadingAssetsNames);
EditorGUI.indentLevel--;
EditorGUILayout.LabelField("Unloads Assets");
EditorGUI.indentLevel++;
//卸载的asset
EditorGUILayout.LabelField("Count", AssetManager.getUnloadsAssetsCount.ToString());
EditorGUILayout.Popup("Names", 0, AssetManager.getUnloadsAssetsNames);
EditorGUI.indentLevel--;
EditorGUI.indentLevel--;
}
bPrefabs = EditorGUILayout.Foldout(bPrefabs, "Prefabs");
if (bPrefabs)
{
EditorGUI.indentLevel++;
EditorGUILayout.LabelField("Cache Prefabs");
EditorGUI.indentLevel++;
//缓存的Prefab
EditorGUILayout.LabelField("Count", PrefabManager.getCachePrefabsCount.ToString());
EditorGUILayout.Popup("Names", 0, PrefabManager.getCachePrefabsNames);
EditorGUI.indentLevel--;
EditorGUILayout.LabelField("Loading Prefabs");
EditorGUI.indentLevel++;
//正在加载的Prefab
EditorGUILayout.LabelField("Count", PrefabManager.getLoadingsPrefabsCount.ToString());
EditorGUILayout.Popup("Names", 0, PrefabManager.getLoadingsPrefabsNames);
EditorGUI.indentLevel--;
EditorGUILayout.LabelField("Instacnes Assets");
EditorGUI.indentLevel++;
//实例化的Prefab
EditorGUILayout.LabelField("Count", PrefabManager.getInstacnesPrefabsCount.ToString());
EditorGUILayout.Popup("Names", 0, PrefabManager.getInstacnesPrefabsNames);
EditorGUI.indentLevel--;
EditorGUI.indentLevel--;
}
bAssetBundles = EditorGUILayout.Foldout(bAssetBundles, "AssetBundles");
if (bAssetBundles)
{
EditorGUI.indentLevel++;
EditorGUILayout.LabelField("Cache AssetBundles");
EditorGUI.indentLevel++;
//缓存的AssetBundle
EditorGUILayout.LabelField("Count", AssetBundleManager.getCacheBundlesCount.ToString());
EditorGUILayout.Popup("Names", 0, AssetBundleManager.getCacheBundlesNames);
EditorGUI.indentLevel--;
EditorGUILayout.LabelField("Loading AssetBundles");
EditorGUI.indentLevel++;
//正在加载的AssetBundle
EditorGUILayout.LabelField("Count", AssetBundleManager.getLoadingBundlesCount.ToString());
EditorGUILayout.Popup("Names", 0, AssetBundleManager.getLoadingBundlesNames);
EditorGUI.indentLevel--;
EditorGUILayout.LabelField("Waits AssetBundles");
EditorGUI.indentLevel++;
//实例化的AssetBundle
EditorGUILayout.LabelField("Count", AssetBundleManager.getWaitsBundlesCount.ToString());
EditorGUILayout.Popup("Names", 0, AssetBundleManager.getWaitsBundlesNames);
EditorGUI.indentLevel--;
EditorGUI.indentLevel--;
}
}
}
protected override void OnCompileComplete()
{
base.OnCompileComplete();
}
}
}