mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-18 01:54:35 +08:00
update docs
This commit is contained in:
parent
94dff93393
commit
9e848b790f
@ -15,8 +15,8 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
[Serializable]
|
||||
[MetaColor(255 / 3, 255, 0)]
|
||||
[MetaDescription(EcsConsts.AUTHOR, "Component-reference to Unity object for EcsPool")]
|
||||
[MetaGroup(UnityComponentConsts.UNITY_COMPONENT_NAME)]
|
||||
[MetaDescription(EcsConsts.AUTHOR, "Component-reference to Unity object for EcsPool")]
|
||||
public struct UnityComponent<T> : IEcsComponent, IEnumerable<T>//IntelliSense hack
|
||||
where T : Component
|
||||
{
|
||||
|
@ -4,6 +4,9 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
[AddComponentMenu(EcsConsts.FRAMEWORK_NAME + "/" + nameof(AutoEntityCreator), 30)]
|
||||
[MetaColor(MetaColor.Cyan)]
|
||||
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, EcsUnityConsts.UNITY_GROUP)]
|
||||
[MetaDescription(EcsConsts.AUTHOR, "...")]
|
||||
public class AutoEntityCreator : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
|
@ -56,6 +56,9 @@ namespace DCFApixels.DragonECS
|
||||
[SelectionBase]
|
||||
[DisallowMultipleComponent]
|
||||
[AddComponentMenu(EcsConsts.FRAMEWORK_NAME + "/" + nameof(EcsEntityConnect), 30)]
|
||||
[MetaColor(MetaColor.Cyan)]
|
||||
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, EcsUnityConsts.UNITY_GROUP)]
|
||||
[MetaDescription(EcsConsts.AUTHOR, "...")]
|
||||
public class EcsEntityConnect : MonoBehaviour
|
||||
{
|
||||
private entlong _entity;
|
||||
|
@ -7,6 +7,8 @@ using UnityEditor;
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
[MetaColor(MetaColor.Cyan)]
|
||||
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, EcsUnityConsts.UNITY_GROUP)]
|
||||
[MetaDescription(EcsConsts.AUTHOR, "...")]
|
||||
public readonly struct GameObjectConnect : IEcsComponent, IEcsComponentLifecycle<GameObjectConnect>
|
||||
{
|
||||
public readonly EcsEntityConnect Connect;
|
||||
|
@ -12,6 +12,7 @@ namespace DCFApixels.DragonECS.Unity.Docs
|
||||
[NonSerialized] private bool _isInitSourceType = false;
|
||||
|
||||
[DataMember, SerializeField] internal string _assemblyQualifiedName = string.Empty;
|
||||
[DataMember, SerializeField] internal EcsMemberType _memberType = EcsMemberType.Undefined;
|
||||
|
||||
[DataMember, SerializeField] internal string _name = string.Empty;
|
||||
[DataMember, SerializeField] internal bool _isCustomName = false;
|
||||
@ -23,10 +24,15 @@ namespace DCFApixels.DragonECS.Unity.Docs
|
||||
[DataMember, SerializeField] internal string _group = string.Empty;
|
||||
[DataMember, SerializeField] internal string[] _tags = Array.Empty<string>();
|
||||
|
||||
|
||||
public string AssemblyQualifiedName
|
||||
{
|
||||
get { return _assemblyQualifiedName; }
|
||||
}
|
||||
public EcsMemberType EcsMemberType
|
||||
{
|
||||
get { return _memberType; }
|
||||
}
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
@ -53,7 +59,7 @@ namespace DCFApixels.DragonECS.Unity.Docs
|
||||
}
|
||||
public string Group
|
||||
{
|
||||
get { return _description; }
|
||||
get { return _group; }
|
||||
}
|
||||
public ReadOnlySpan<string> Tags
|
||||
{
|
||||
@ -64,13 +70,23 @@ namespace DCFApixels.DragonECS.Unity.Docs
|
||||
{
|
||||
_sourceType = meta.Type;
|
||||
_assemblyQualifiedName = meta.Type.AssemblyQualifiedName;
|
||||
_memberType = meta.EcsMemberType;
|
||||
|
||||
_name = meta.Name;
|
||||
_isCustomName = meta.IsCustomName;
|
||||
_color = meta.Color;
|
||||
_isCustomColor = meta.IsCustomColor;
|
||||
_autor = meta.Description.Author;
|
||||
_description = meta.Description.Text;
|
||||
|
||||
|
||||
if (meta.Description.IsHasAutor)
|
||||
{
|
||||
_description = $"{meta.Description.Text}\r\n - {meta.Description.Author}";
|
||||
}
|
||||
else
|
||||
{
|
||||
_description = meta.Description.Text;
|
||||
}
|
||||
|
||||
_group = meta.Group.Name;
|
||||
_tags = new string[meta.Tags.Count];
|
||||
|
@ -67,7 +67,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
||||
|
||||
_infos = groups.ToArray();
|
||||
|
||||
//_isInitInfos = true;
|
||||
_isInitInfos = true;
|
||||
}
|
||||
|
||||
private void AddInfo(List<MetaGroupInfo> infos, string path, int startIndex, int length)
|
||||
|
@ -53,12 +53,15 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
||||
GUILayout.BeginHorizontal(GUILayout.ExpandHeight(true));
|
||||
|
||||
|
||||
ButtonsScrolPosition = GUILayout.BeginScrollView(ButtonsScrolPosition, EditorStyles.helpBox, GUILayout.Width(_buttonsWidth));
|
||||
ButtonsScrolPosition = GUILayout.BeginScrollView(ButtonsScrolPosition, UnityEditorUtility.GetStyle(Color.black, 0.1f), GUILayout.Width(_buttonsWidth));
|
||||
var selectedGroupInfo = DrawGroups();
|
||||
GUILayout.EndScrollView();
|
||||
|
||||
DrawDragger();
|
||||
|
||||
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing * -2f);
|
||||
|
||||
|
||||
DataScrolPosition = GUILayout.BeginScrollView(DataScrolPosition, UnityEditorUtility.GetStyle(Color.black, 0.2f), GUILayout.ExpandWidth(true));
|
||||
DrawSelectedGroupMeta(selectedGroupInfo);
|
||||
GUILayout.EndScrollView();
|
||||
@ -99,16 +102,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
||||
GUILayout.TextArea(meta.Name, EditorStyles.boldLabel);
|
||||
|
||||
Rect lastRect = GUILayoutUtility.GetLastRect();
|
||||
if (string.IsNullOrEmpty(meta.Description))
|
||||
{
|
||||
using (EcsGUI.SetContentColor(1f, 1f, 1f, 0.4f))
|
||||
{
|
||||
Rect pos = lastRect;
|
||||
pos.xMin = Mathf.Max(EditorGUIUtility.labelWidth, pos.xMax - 42f);
|
||||
GUI.Label(pos, "empty");
|
||||
}
|
||||
}
|
||||
else
|
||||
if (string.IsNullOrEmpty(meta.Description) == false)
|
||||
{
|
||||
Rect lineRect = lastRect;
|
||||
lineRect.yMin = lineRect.yMax;
|
||||
@ -120,7 +114,25 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
||||
|
||||
GUILayout.TextArea(meta.Description, EditorStyles.wordWrappedLabel);
|
||||
}
|
||||
|
||||
|
||||
if (meta._tags.Length > 0)
|
||||
{
|
||||
Rect lineRect = GUILayoutUtility.GetLastRect();
|
||||
lineRect.yMin = lineRect.yMax;
|
||||
lineRect.yMax += 1f;
|
||||
lineRect.y += 5f;
|
||||
EditorGUI.DrawRect(lineRect, new Color(1, 1, 1, 0.12f));
|
||||
|
||||
GUILayout.Space(3f);
|
||||
|
||||
var tagsstring = string.Join(',', meta._tags);
|
||||
using (EcsGUI.SetAlpha(0.5f))
|
||||
{
|
||||
GUILayout.TextArea(tagsstring, EditorStyles.wordWrappedMiniLabel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GUILayout.Space(1f);
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
@ -215,31 +227,36 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
||||
{
|
||||
const float DRAG_RESIZE_WIDTH = 4f;
|
||||
|
||||
Rect rect;
|
||||
Rect rect = GUILayoutUtility.GetLastRect();
|
||||
float m = DRAG_RESIZE_WIDTH;
|
||||
if (_dragState != DragState.None)
|
||||
{
|
||||
m *= 200f;
|
||||
m *= 2f;
|
||||
}
|
||||
rect = GUILayoutUtility.GetLastRect();
|
||||
rect.xMin = rect.xMax;
|
||||
rect.xMax = rect.xMax + m;
|
||||
rect.x -= m / 2f;
|
||||
rect.width = m;
|
||||
|
||||
EditorGUI.DrawRect(rect.AddPadding(1f, 0), new Color(0,0,0,0.5f));
|
||||
|
||||
Event current = Event.current;
|
||||
switch (current.type)
|
||||
{
|
||||
case EventType.MouseDown:
|
||||
|
||||
if (EcsGUI.HitTest(rect))
|
||||
{
|
||||
_buttonsWidthDragStartPos = current.mousePosition;
|
||||
_buttonsWidthDragStartValue = _buttonsWidth;
|
||||
_dragState = DragState.Init;
|
||||
current.Use();
|
||||
}
|
||||
break;
|
||||
case EventType.MouseUp:
|
||||
_dragState = DragState.None;
|
||||
current.Use();
|
||||
if(_dragState != DragState.None)
|
||||
{
|
||||
_dragState = DragState.None;
|
||||
current.Use();
|
||||
}
|
||||
break;
|
||||
case EventType.MouseDrag:
|
||||
{
|
||||
|
7
src/EcsUnityConsts.cs
Normal file
7
src/EcsUnityConsts.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
public class EcsUnityConsts
|
||||
{
|
||||
public const string UNITY_GROUP = "Unity";
|
||||
}
|
||||
}
|
11
src/EcsUnityConsts.cs.meta
Normal file
11
src/EcsUnityConsts.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 218c18557ccdad24c9c5e155c3dd6008
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -11,6 +11,9 @@ namespace DCFApixels.DragonECS
|
||||
|
||||
[DisallowMultipleComponent]
|
||||
[AddComponentMenu(EcsConsts.FRAMEWORK_NAME + "/" + nameof(MonoEntityTemplate), 30)]
|
||||
[MetaColor(MetaColor.Cyan)]
|
||||
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, EcsUnityConsts.UNITY_GROUP)]
|
||||
[MetaDescription(EcsConsts.AUTHOR, "...")]
|
||||
public class MonoEntityTemplate : MonoEntityTemplateBase, ITemplateInternal
|
||||
{
|
||||
[SerializeReference]
|
||||
|
@ -9,6 +9,9 @@ namespace DCFApixels.DragonECS
|
||||
public abstract void Apply(short worldID, int entityID);
|
||||
}
|
||||
|
||||
[MetaColor(MetaColor.Cyan)]
|
||||
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, EcsUnityConsts.UNITY_GROUP)]
|
||||
[MetaDescription(EcsConsts.AUTHOR, "...")]
|
||||
[CreateAssetMenu(fileName = nameof(ScriptableEntityTemplate), menuName = EcsConsts.FRAMEWORK_NAME + "/" + nameof(ScriptableEntityTemplate), order = 1)]
|
||||
public class ScriptableEntityTemplate : ScriptableEntityTemplateBase, ITemplateInternal
|
||||
{
|
||||
|
@ -67,7 +67,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
GUI.backgroundColor = _value;
|
||||
}
|
||||
}
|
||||
public struct IndentLevelScope : IDisposable
|
||||
public struct IndentLevelScope : IDisposable
|
||||
{
|
||||
private readonly int _value;
|
||||
public IndentLevelScope(int value)
|
||||
@ -87,6 +87,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
public static BackgroundColorScope SetBackgroundColor(float r, float g, float b, float a = 1f) => new BackgroundColorScope(r, g, b, a);
|
||||
public static ColorScope SetColor(Color value) => new ColorScope(value);
|
||||
public static ColorScope SetColor(float r, float g, float b, float a = 1f) => new ColorScope(r, g, b, a);
|
||||
public static ColorScope SetAlpha(float a) => new ColorScope(GUI.color * new Color(1, 1, 1, a));
|
||||
public static EditorGUI.DisabledScope Enable => new EditorGUI.DisabledScope(false);
|
||||
public static EditorGUI.DisabledScope Disable => new EditorGUI.DisabledScope(true);
|
||||
public static EditorGUI.DisabledScope SetEnable(bool value) => new EditorGUI.DisabledScope(!value);
|
||||
|
Loading…
Reference in New Issue
Block a user