增加A2WToolBox工具集,增加Launch场景核LaunchPanel
This commit is contained in:
16
Assets/A2WToolBox/Editor/A2W.Editor.asmdef
Normal file
16
Assets/A2WToolBox/Editor/A2W.Editor.asmdef
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "A2W.Editor.Hierponent",
|
||||
"rootNamespace": "",
|
||||
"references": [],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
7
Assets/A2WToolBox/Editor/A2W.Editor.asmdef.meta
Normal file
7
Assets/A2WToolBox/Editor/A2W.Editor.asmdef.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eaf4bf9926fd9bd43b90025b52883a3a
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/A2WToolBox/Editor/Hierponent.meta
Normal file
8
Assets/A2WToolBox/Editor/Hierponent.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 660f79e5d9bf60b4a9723a5ea37d75ae
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
133
Assets/A2WToolBox/Editor/Hierponent/Hierponent.cs
Normal file
133
Assets/A2WToolBox/Editor/Hierponent/Hierponent.cs
Normal file
@@ -0,0 +1,133 @@
|
||||
#if UNITY_EDITOR
|
||||
|
||||
namespace Hierponent
|
||||
{
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class Hierponent
|
||||
{
|
||||
#region --- VAR ---
|
||||
|
||||
private const int MAX_ICON_NUM = 4;
|
||||
|
||||
private static List<System.Type> HideTypes =
|
||||
new List<System.Type>() { typeof(Transform), typeof(ParticleSystemRenderer), typeof(CanvasRenderer), };
|
||||
private static Transform OffsetObject = null;
|
||||
private static int Offset = 0;
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- MSG ---
|
||||
|
||||
[InitializeOnLoadMethod]
|
||||
public static void Init()
|
||||
{
|
||||
EditorApplication.hierarchyWindowItemOnGUI += HieGUI;
|
||||
}
|
||||
|
||||
public static void HieGUI(int instanceID, Rect rect)
|
||||
{
|
||||
// Check
|
||||
Object tempObj = EditorUtility.InstanceIDToObject(instanceID);
|
||||
if (!tempObj)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// fix rect
|
||||
rect.width += rect.x;
|
||||
rect.x = 0;
|
||||
|
||||
// Logic
|
||||
GameObject obj = tempObj as GameObject;
|
||||
List<Component> coms = new List<Component>(obj.GetComponents<Component>());
|
||||
for (int i = 0; i < coms.Count; i++)
|
||||
{
|
||||
if (!coms[i])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (TypeCheck(coms[i].GetType()))
|
||||
{
|
||||
coms.RemoveAt(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
int iconSize = 16;
|
||||
int y = 1;
|
||||
int offset = obj.transform == OffsetObject ? Offset : 0;
|
||||
|
||||
// Main
|
||||
for (int i = 0; i + offset < coms.Count && i < MAX_ICON_NUM; i++)
|
||||
{
|
||||
Component com = coms[i + offset];
|
||||
|
||||
// Logic
|
||||
Texture2D texture = AssetPreview.GetMiniThumbnail(com);
|
||||
|
||||
if (texture)
|
||||
{
|
||||
GUI.DrawTexture(new Rect(rect.width - (iconSize + 1) * (i + 1), rect.y + y, iconSize, iconSize), texture);
|
||||
}
|
||||
}
|
||||
|
||||
// More Button
|
||||
if (coms.Count == MAX_ICON_NUM + 1)
|
||||
{
|
||||
Texture2D texture = AssetPreview.GetMiniThumbnail(coms[coms.Count - 1]);
|
||||
if (texture)
|
||||
{
|
||||
GUI.DrawTexture(new Rect(rect.width - (iconSize + 1) * (coms.Count - 1 + 1), rect.y + y, iconSize, iconSize),
|
||||
texture);
|
||||
}
|
||||
}
|
||||
else if (coms.Count > MAX_ICON_NUM)
|
||||
{
|
||||
GUIStyle style = new GUIStyle(GUI.skin.label);
|
||||
style.fontSize = 9;
|
||||
style.alignment = TextAnchor.MiddleCenter;
|
||||
|
||||
if (GUI.Button(new Rect(rect.width - (iconSize + 2) * (MAX_ICON_NUM + 1), rect.y + y, 22, iconSize), "•••",
|
||||
style))
|
||||
{
|
||||
if (OffsetObject != obj.transform)
|
||||
{
|
||||
OffsetObject = obj.transform;
|
||||
Offset = 0;
|
||||
}
|
||||
|
||||
Offset += MAX_ICON_NUM;
|
||||
if (Offset >= coms.Count)
|
||||
{
|
||||
Offset = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- LGC ---
|
||||
|
||||
private static bool TypeCheck(System.Type type)
|
||||
{
|
||||
for (int i = 0; i < HideTypes.Count; i++)
|
||||
{
|
||||
if (type == HideTypes[i] || type.IsSubclassOf(HideTypes[i]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
11
Assets/A2WToolBox/Editor/Hierponent/Hierponent.cs.meta
Normal file
11
Assets/A2WToolBox/Editor/Hierponent/Hierponent.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9483cc826c5e8fd42a14f05294ea4495
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user