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]
|
[Serializable]
|
||||||
[MetaColor(255 / 3, 255, 0)]
|
[MetaColor(255 / 3, 255, 0)]
|
||||||
[MetaDescription(EcsConsts.AUTHOR, "Component-reference to Unity object for EcsPool")]
|
|
||||||
[MetaGroup(UnityComponentConsts.UNITY_COMPONENT_NAME)]
|
[MetaGroup(UnityComponentConsts.UNITY_COMPONENT_NAME)]
|
||||||
|
[MetaDescription(EcsConsts.AUTHOR, "Component-reference to Unity object for EcsPool")]
|
||||||
public struct UnityComponent<T> : IEcsComponent, IEnumerable<T>//IntelliSense hack
|
public struct UnityComponent<T> : IEcsComponent, IEnumerable<T>//IntelliSense hack
|
||||||
where T : Component
|
where T : Component
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,9 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
[AddComponentMenu(EcsConsts.FRAMEWORK_NAME + "/" + nameof(AutoEntityCreator), 30)]
|
[AddComponentMenu(EcsConsts.FRAMEWORK_NAME + "/" + nameof(AutoEntityCreator), 30)]
|
||||||
|
[MetaColor(MetaColor.Cyan)]
|
||||||
|
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, EcsUnityConsts.UNITY_GROUP)]
|
||||||
|
[MetaDescription(EcsConsts.AUTHOR, "...")]
|
||||||
public class AutoEntityCreator : MonoBehaviour
|
public class AutoEntityCreator : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
|
@ -56,6 +56,9 @@ namespace DCFApixels.DragonECS
|
|||||||
[SelectionBase]
|
[SelectionBase]
|
||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
[AddComponentMenu(EcsConsts.FRAMEWORK_NAME + "/" + nameof(EcsEntityConnect), 30)]
|
[AddComponentMenu(EcsConsts.FRAMEWORK_NAME + "/" + nameof(EcsEntityConnect), 30)]
|
||||||
|
[MetaColor(MetaColor.Cyan)]
|
||||||
|
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, EcsUnityConsts.UNITY_GROUP)]
|
||||||
|
[MetaDescription(EcsConsts.AUTHOR, "...")]
|
||||||
public class EcsEntityConnect : MonoBehaviour
|
public class EcsEntityConnect : MonoBehaviour
|
||||||
{
|
{
|
||||||
private entlong _entity;
|
private entlong _entity;
|
||||||
|
@ -7,6 +7,8 @@ using UnityEditor;
|
|||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
[MetaColor(MetaColor.Cyan)]
|
[MetaColor(MetaColor.Cyan)]
|
||||||
|
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, EcsUnityConsts.UNITY_GROUP)]
|
||||||
|
[MetaDescription(EcsConsts.AUTHOR, "...")]
|
||||||
public readonly struct GameObjectConnect : IEcsComponent, IEcsComponentLifecycle<GameObjectConnect>
|
public readonly struct GameObjectConnect : IEcsComponent, IEcsComponentLifecycle<GameObjectConnect>
|
||||||
{
|
{
|
||||||
public readonly EcsEntityConnect Connect;
|
public readonly EcsEntityConnect Connect;
|
||||||
|
@ -12,6 +12,7 @@ namespace DCFApixels.DragonECS.Unity.Docs
|
|||||||
[NonSerialized] private bool _isInitSourceType = false;
|
[NonSerialized] private bool _isInitSourceType = false;
|
||||||
|
|
||||||
[DataMember, SerializeField] internal string _assemblyQualifiedName = string.Empty;
|
[DataMember, SerializeField] internal string _assemblyQualifiedName = string.Empty;
|
||||||
|
[DataMember, SerializeField] internal EcsMemberType _memberType = EcsMemberType.Undefined;
|
||||||
|
|
||||||
[DataMember, SerializeField] internal string _name = string.Empty;
|
[DataMember, SerializeField] internal string _name = string.Empty;
|
||||||
[DataMember, SerializeField] internal bool _isCustomName = false;
|
[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 _group = string.Empty;
|
||||||
[DataMember, SerializeField] internal string[] _tags = Array.Empty<string>();
|
[DataMember, SerializeField] internal string[] _tags = Array.Empty<string>();
|
||||||
|
|
||||||
|
|
||||||
public string AssemblyQualifiedName
|
public string AssemblyQualifiedName
|
||||||
{
|
{
|
||||||
get { return _assemblyQualifiedName; }
|
get { return _assemblyQualifiedName; }
|
||||||
}
|
}
|
||||||
|
public EcsMemberType EcsMemberType
|
||||||
|
{
|
||||||
|
get { return _memberType; }
|
||||||
|
}
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get { return _name; }
|
get { return _name; }
|
||||||
@ -53,7 +59,7 @@ namespace DCFApixels.DragonECS.Unity.Docs
|
|||||||
}
|
}
|
||||||
public string Group
|
public string Group
|
||||||
{
|
{
|
||||||
get { return _description; }
|
get { return _group; }
|
||||||
}
|
}
|
||||||
public ReadOnlySpan<string> Tags
|
public ReadOnlySpan<string> Tags
|
||||||
{
|
{
|
||||||
@ -64,13 +70,23 @@ namespace DCFApixels.DragonECS.Unity.Docs
|
|||||||
{
|
{
|
||||||
_sourceType = meta.Type;
|
_sourceType = meta.Type;
|
||||||
_assemblyQualifiedName = meta.Type.AssemblyQualifiedName;
|
_assemblyQualifiedName = meta.Type.AssemblyQualifiedName;
|
||||||
|
_memberType = meta.EcsMemberType;
|
||||||
|
|
||||||
_name = meta.Name;
|
_name = meta.Name;
|
||||||
_isCustomName = meta.IsCustomName;
|
_isCustomName = meta.IsCustomName;
|
||||||
_color = meta.Color;
|
_color = meta.Color;
|
||||||
_isCustomColor = meta.IsCustomColor;
|
_isCustomColor = meta.IsCustomColor;
|
||||||
_autor = meta.Description.Author;
|
_autor = meta.Description.Author;
|
||||||
|
|
||||||
|
|
||||||
|
if (meta.Description.IsHasAutor)
|
||||||
|
{
|
||||||
|
_description = $"{meta.Description.Text}\r\n - {meta.Description.Author}";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
_description = meta.Description.Text;
|
_description = meta.Description.Text;
|
||||||
|
}
|
||||||
|
|
||||||
_group = meta.Group.Name;
|
_group = meta.Group.Name;
|
||||||
_tags = new string[meta.Tags.Count];
|
_tags = new string[meta.Tags.Count];
|
||||||
|
@ -67,7 +67,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
|||||||
|
|
||||||
_infos = groups.ToArray();
|
_infos = groups.ToArray();
|
||||||
|
|
||||||
//_isInitInfos = true;
|
_isInitInfos = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddInfo(List<MetaGroupInfo> infos, string path, int startIndex, int length)
|
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));
|
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();
|
var selectedGroupInfo = DrawGroups();
|
||||||
GUILayout.EndScrollView();
|
GUILayout.EndScrollView();
|
||||||
|
|
||||||
DrawDragger();
|
DrawDragger();
|
||||||
|
|
||||||
|
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing * -2f);
|
||||||
|
|
||||||
|
|
||||||
DataScrolPosition = GUILayout.BeginScrollView(DataScrolPosition, UnityEditorUtility.GetStyle(Color.black, 0.2f), GUILayout.ExpandWidth(true));
|
DataScrolPosition = GUILayout.BeginScrollView(DataScrolPosition, UnityEditorUtility.GetStyle(Color.black, 0.2f), GUILayout.ExpandWidth(true));
|
||||||
DrawSelectedGroupMeta(selectedGroupInfo);
|
DrawSelectedGroupMeta(selectedGroupInfo);
|
||||||
GUILayout.EndScrollView();
|
GUILayout.EndScrollView();
|
||||||
@ -99,16 +102,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
|||||||
GUILayout.TextArea(meta.Name, EditorStyles.boldLabel);
|
GUILayout.TextArea(meta.Name, EditorStyles.boldLabel);
|
||||||
|
|
||||||
Rect lastRect = GUILayoutUtility.GetLastRect();
|
Rect lastRect = GUILayoutUtility.GetLastRect();
|
||||||
if (string.IsNullOrEmpty(meta.Description))
|
if (string.IsNullOrEmpty(meta.Description) == false)
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
{
|
||||||
Rect lineRect = lastRect;
|
Rect lineRect = lastRect;
|
||||||
lineRect.yMin = lineRect.yMax;
|
lineRect.yMin = lineRect.yMax;
|
||||||
@ -121,6 +115,24 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
|||||||
GUILayout.TextArea(meta.Description, EditorStyles.wordWrappedLabel);
|
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.Space(1f);
|
||||||
GUILayout.EndVertical();
|
GUILayout.EndVertical();
|
||||||
}
|
}
|
||||||
@ -215,31 +227,36 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
|||||||
{
|
{
|
||||||
const float DRAG_RESIZE_WIDTH = 4f;
|
const float DRAG_RESIZE_WIDTH = 4f;
|
||||||
|
|
||||||
Rect rect;
|
Rect rect = GUILayoutUtility.GetLastRect();
|
||||||
float m = DRAG_RESIZE_WIDTH;
|
float m = DRAG_RESIZE_WIDTH;
|
||||||
if (_dragState != DragState.None)
|
if (_dragState != DragState.None)
|
||||||
{
|
{
|
||||||
m *= 200f;
|
m *= 2f;
|
||||||
}
|
}
|
||||||
rect = GUILayoutUtility.GetLastRect();
|
|
||||||
rect.xMin = rect.xMax;
|
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;
|
Event current = Event.current;
|
||||||
switch (current.type)
|
switch (current.type)
|
||||||
{
|
{
|
||||||
case EventType.MouseDown:
|
case EventType.MouseDown:
|
||||||
|
|
||||||
if (EcsGUI.HitTest(rect))
|
if (EcsGUI.HitTest(rect))
|
||||||
{
|
{
|
||||||
_buttonsWidthDragStartPos = current.mousePosition;
|
_buttonsWidthDragStartPos = current.mousePosition;
|
||||||
_buttonsWidthDragStartValue = _buttonsWidth;
|
_buttonsWidthDragStartValue = _buttonsWidth;
|
||||||
_dragState = DragState.Init;
|
_dragState = DragState.Init;
|
||||||
|
current.Use();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EventType.MouseUp:
|
case EventType.MouseUp:
|
||||||
|
if(_dragState != DragState.None)
|
||||||
|
{
|
||||||
_dragState = DragState.None;
|
_dragState = DragState.None;
|
||||||
current.Use();
|
current.Use();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case EventType.MouseDrag:
|
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]
|
[DisallowMultipleComponent]
|
||||||
[AddComponentMenu(EcsConsts.FRAMEWORK_NAME + "/" + nameof(MonoEntityTemplate), 30)]
|
[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
|
public class MonoEntityTemplate : MonoEntityTemplateBase, ITemplateInternal
|
||||||
{
|
{
|
||||||
[SerializeReference]
|
[SerializeReference]
|
||||||
|
@ -9,6 +9,9 @@ namespace DCFApixels.DragonECS
|
|||||||
public abstract void Apply(short worldID, int entityID);
|
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)]
|
[CreateAssetMenu(fileName = nameof(ScriptableEntityTemplate), menuName = EcsConsts.FRAMEWORK_NAME + "/" + nameof(ScriptableEntityTemplate), order = 1)]
|
||||||
public class ScriptableEntityTemplate : ScriptableEntityTemplateBase, ITemplateInternal
|
public class ScriptableEntityTemplate : ScriptableEntityTemplateBase, ITemplateInternal
|
||||||
{
|
{
|
||||||
|
@ -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 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(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 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 Enable => new EditorGUI.DisabledScope(false);
|
||||||
public static EditorGUI.DisabledScope Disable => new EditorGUI.DisabledScope(true);
|
public static EditorGUI.DisabledScope Disable => new EditorGUI.DisabledScope(true);
|
||||||
public static EditorGUI.DisabledScope SetEnable(bool value) => new EditorGUI.DisabledScope(!value);
|
public static EditorGUI.DisabledScope SetEnable(bool value) => new EditorGUI.DisabledScope(!value);
|
||||||
|
Loading…
Reference in New Issue
Block a user