update meta

This commit is contained in:
Mikhail 2024-06-13 18:04:47 +08:00
parent 9e848b790f
commit 7e15f7bd23
34 changed files with 1107 additions and 165 deletions

View File

@ -1,4 +1,5 @@
using System;
using DCFApixels.DragonECS.Unity;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
@ -14,9 +15,9 @@ namespace DCFApixels.DragonECS
public static readonly MetaGroup JointGroup = new MetaGroup($"{UNITY_COMPONENT_NAME}/Joint/");
}
[Serializable]
[MetaColor(255 / 3, 255, 0)]
[MetaGroup(UnityComponentConsts.UNITY_COMPONENT_NAME)]
[MetaDescription(EcsConsts.AUTHOR, "Component-reference to Unity object for EcsPool")]
[MetaColor(MetaColor.Cyan)]
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.COMPONENTS_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "Component-reference to Unity object for EcsPool.")]
public struct UnityComponent<T> : IEcsComponent, IEnumerable<T>//IntelliSense hack
where T : Component
{

View File

@ -1,22 +1,29 @@
using DCFApixels.DragonECS.RunnersCore;
using DCFApixels.DragonECS.Unity;
using DCFApixels.DragonECS.Unity.Internal;
namespace DCFApixels.DragonECS
{
[MetaName(nameof(DrawGizmos))]
[MetaColor(MetaColor.Orange)]
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "The process to run when EcsPipeline.DrawGizmos() is called.")]
public interface IEcsGizmosProcess : IEcsProcess
{
public void DrawGizmos();
}
[MetaName(nameof(LateRun))]
[MetaColor(MetaColor.Orange)]
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "The process to run when EcsPipeline.LateRun() is called.")]
public interface IEcsLateRunProcess : IEcsProcess
{
public void LateRun();
}
[MetaName(nameof(FixedRun))]
[MetaColor(MetaColor.Orange)]
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "The process to run when EcsPipeline.FixedRun() is called.")]
public interface IEcsFixedRunProcess : IEcsProcess
{
public void FixedRun();
@ -40,8 +47,10 @@ namespace DCFApixels.DragonECS
}
namespace DCFApixels.DragonECS.Unity.Internal
{
[MetaColor(MetaColor.Orange)]
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaTags(MetaTags.HIDDEN)]
public class EcsLateGizmosRunner : EcsRunner<IEcsGizmosProcess>, IEcsGizmosProcess
{
#if DEBUG && !DISABLE_DEBUG
@ -74,7 +83,10 @@ namespace DCFApixels.DragonECS.Unity.Internal
#endif
}
[MetaColor(MetaColor.Orange)]
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaTags(MetaTags.HIDDEN)]
public class EcsLateRunRunner : EcsRunner<IEcsLateRunProcess>, IEcsLateRunProcess
{
#if DEBUG && !DISABLE_DEBUG
@ -106,7 +118,11 @@ namespace DCFApixels.DragonECS.Unity.Internal
}
#endif
}
[MetaColor(MetaColor.Orange)]
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaTags(MetaTags.HIDDEN)]
public class EcsFixedRunRunner : EcsRunner<IEcsFixedRunProcess>, IEcsFixedRunProcess
{
#if DEBUG && !DISABLE_DEBUG

View File

@ -1,3 +1,4 @@
using DCFApixels.DragonECS.Unity;
using UnityEngine;
namespace DCFApixels.DragonECS
@ -5,8 +6,8 @@ namespace DCFApixels.DragonECS
[DisallowMultipleComponent]
[AddComponentMenu(EcsConsts.FRAMEWORK_NAME + "/" + nameof(AutoEntityCreator), 30)]
[MetaColor(MetaColor.Cyan)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, EcsUnityConsts.UNITY_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsUnityConsts.ENTITY_BUILDING_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, nameof(MonoBehaviour) + ". Automatically creates an entity in the selected world and connects it to EcsEntityConnect.")]
public class AutoEntityCreator : MonoBehaviour
{
[SerializeField]

View File

@ -5,6 +5,7 @@ using UnityEngine;
#region UNITY_EDITOR
using UnityEditor;
using DCFApixels.DragonECS.Unity.Internal;
using DCFApixels.DragonECS.Unity;
#endregion
namespace DCFApixels.DragonECS
@ -57,8 +58,8 @@ namespace DCFApixels.DragonECS
[DisallowMultipleComponent]
[AddComponentMenu(EcsConsts.FRAMEWORK_NAME + "/" + nameof(EcsEntityConnect), 30)]
[MetaColor(MetaColor.Cyan)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, EcsUnityConsts.UNITY_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsUnityConsts.ENTITY_BUILDING_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, nameof(MonoBehaviour) + ". Responsible for connecting the entity and GameObject using the EcsEntityConnect.ConnectWith method.")]
public class EcsEntityConnect : MonoBehaviour
{
private entlong _entity;

View File

@ -1,5 +1,6 @@
using System.Runtime.CompilerServices;
using UnityEngine;
using DCFApixels.DragonECS.Unity;
#if UNITY_EDITOR
using UnityEditor;
#endif
@ -7,8 +8,8 @@ using UnityEditor;
namespace DCFApixels.DragonECS
{
[MetaColor(MetaColor.Cyan)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, EcsUnityConsts.UNITY_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.COMPONENTS_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "This component is automatically added if an entity is connected to one of the EcsEntityConnect. It also contains a reference to the connected EcsEntityConnect.")]
public readonly struct GameObjectConnect : IEcsComponent, IEcsComponentLifecycle<GameObjectConnect>
{
public readonly EcsEntityConnect Connect;

8
src/Consts.cs Normal file
View File

@ -0,0 +1,8 @@
namespace DCFApixels.DragonECS.Unity
{
public class EcsUnityConsts
{
public const string PACK_GROUP = "_" + EcsConsts.FRAMEWORK_NAME + "/Unity";
public const string ENTITY_BUILDING_GROUP = "Entity Building";
}
}

View File

@ -41,6 +41,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
}
private void OnGUI()
{
var prefs = SettingsPrefs.instance;
float labelWidth = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = 0f;
@ -55,38 +56,35 @@ namespace DCFApixels.DragonECS.Unity.Editors
rect.xMin += 9f;
GUI.Label(rect, "Settings", EditorStyles.whiteLargeLabel);
EditorGUI.BeginChangeCheck();
Settings settings = new Settings();
//using (prefs.DisableAutoSave())
{
GUILayout.BeginHorizontal();
settings.IsShowHidden = EditorGUILayout.Toggle(SettingsPrefs.instance.IsShowHidden, GUILayout.Width(checkBoxWidth));
prefs.IsShowHidden = EditorGUILayout.Toggle(prefs.IsShowHidden, GUILayout.Width(checkBoxWidth));
GUILayout.Label(UnityEditorUtility.TransformFieldName(nameof(SettingsPrefs.IsShowHidden)), GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
settings.IsShowInterfaces = EditorGUILayout.Toggle(SettingsPrefs.instance.IsShowInterfaces, GUILayout.Width(checkBoxWidth));
prefs.IsShowInterfaces = EditorGUILayout.Toggle(prefs.IsShowInterfaces, GUILayout.Width(checkBoxWidth));
GUILayout.Label(UnityEditorUtility.TransformFieldName(nameof(SettingsPrefs.IsShowInterfaces)), GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
settings.IsShowRuntimeComponents = EditorGUILayout.Toggle(SettingsPrefs.instance.IsShowRuntimeComponents, GUILayout.Width(checkBoxWidth));
prefs.IsShowRuntimeComponents = EditorGUILayout.Toggle(prefs.IsShowRuntimeComponents, GUILayout.Width(checkBoxWidth));
GUILayout.Label(UnityEditorUtility.TransformFieldName(nameof(SettingsPrefs.IsShowRuntimeComponents)), GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();
settings.AutoColorMode = (ComponentColorMode)EditorGUILayout.EnumPopup(UnityEditorUtility.TransformFieldName(nameof(SettingsPrefs.ComponentColorMode)), SettingsPrefs.instance.ComponentColorMode);
GUILayout.BeginHorizontal();
prefs.IsUseCustomNames = EditorGUILayout.Toggle(prefs.IsUseCustomNames, GUILayout.Width(checkBoxWidth));
GUILayout.Label(UnityEditorUtility.TransformFieldName(nameof(SettingsPrefs.IsUseCustomNames)), GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();
if (EditorGUI.EndChangeCheck())
{
SettingsPrefs.instance.IsShowHidden = settings.IsShowHidden;
SettingsPrefs.instance.IsShowInterfaces = settings.IsShowInterfaces;
SettingsPrefs.instance.IsShowRuntimeComponents = settings.IsShowRuntimeComponents;
SettingsPrefs.instance.ComponentColorMode = settings.AutoColorMode;
prefs.ComponentColorMode = (ComponentColorMode)EditorGUILayout.EnumPopup(UnityEditorUtility.TransformFieldName(nameof(SettingsPrefs.ComponentColorMode)), prefs.ComponentColorMode);
}
GUILayout.EndVertical();
GUILayout.Space(20f);
using (new EcsGUI.ColorScope(Color.white * 0.5f))
using (EcsGUI.SetColor(Color.white * 0.5f))
GUILayout.BeginVertical(EditorStyles.helpBox);
//using (new EcsGUI.ColorScope(Color.white * 1.2f))
GUILayout.Label("", EditorStyles.toolbar, GUILayout.ExpandWidth(true), GUILayout.Height(22f));
@ -141,13 +139,6 @@ namespace DCFApixels.DragonECS.Unity.Editors
}
public static implicit operator DefineSymbolsInfo(string a) => new DefineSymbolsInfo(a, false);
}
private struct Settings
{
public bool IsShowHidden;
public bool IsShowInterfaces;
public bool IsShowRuntimeComponents;
public ComponentColorMode AutoColorMode;
}
}
}
#endif

View File

@ -13,15 +13,32 @@ namespace DCFApixels.DragonECS.Unity.Editors
[FilePath(EcsConsts.AUTHOR + "/" + EcsConsts.FRAMEWORK_NAME + "/" + nameof(SettingsPrefs) + ".prefs", FilePathAttribute.Location.ProjectFolder)]
internal class SettingsPrefs : ScriptableSingleton<SettingsPrefs>
{
[SerializeField]
private bool _isUseCustomNames = true;
public bool IsUseCustomNames
{
get => _isUseCustomNames;
set
{
if (_isUseCustomNames != value)
{
_isUseCustomNames = value;
AutoSave();
}
}
}
[SerializeField]
private bool _isShowInterfaces = false;
public bool IsShowInterfaces
{
get => _isShowInterfaces;
set
{
if (_isShowInterfaces != value)
{
_isShowInterfaces = value;
Save(false);
AutoSave();
}
}
}
[SerializeField]
@ -30,9 +47,12 @@ namespace DCFApixels.DragonECS.Unity.Editors
{
get => _isShowHidden;
set
{
if (_isShowHidden != value)
{
_isShowHidden = value;
Save(false);
AutoSave();
}
}
}
[SerializeField]
@ -41,24 +61,27 @@ namespace DCFApixels.DragonECS.Unity.Editors
{
get => _isShowRuntimeComponents;
set
{
if (_isShowRuntimeComponents != value)
{
_isShowRuntimeComponents = value;
Save(false);
}
}
[SerializeField]
private bool _poolsToggle = false;
public bool PoolsToggle
{
get => _poolsToggle;
set
{
_poolsToggle = value;
Save(false);
AutoSave();
}
}
}
//[SerializeField]
//private bool _poolsToggle = false;
//public bool PoolsToggle
//{
// get => _poolsToggle;
// set
// {
// _isChanged = _poolsToggle != value;
// _poolsToggle = value;
// AutoSave();
// }
//}
[SerializeField]
private ComponentColorMode _componentColorMode = ComponentColorMode.Auto;
@ -66,11 +89,20 @@ namespace DCFApixels.DragonECS.Unity.Editors
{
get => _componentColorMode;
set
{
if (_componentColorMode != value)
{
_componentColorMode = value;
Save(false);
AutoSave();
}
}
}
private void AutoSave()
{
Save(true);
Debug.Log("AutoSave");
}
}
}
#endif

View File

@ -2,8 +2,10 @@
namespace DCFApixels.DragonECS.Unity.Internal
{
[MetaTags(MetaTags.HIDDEN)]
[MetaColor(MetaColor.Gray)]
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.DEBUG_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaTags(MetaTags.HIDDEN)]
internal class EntityMonitor : MonoBehaviour
{
private entlong _entity;

View File

@ -3,8 +3,10 @@ using UnityEngine;
namespace DCFApixels.DragonECS.Unity.Internal
{
[MetaTags(MetaTags.HIDDEN)]
[MetaColor(MetaColor.Gray)]
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.DEBUG_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaTags(MetaTags.HIDDEN)]
internal class PipelineMonitor : MonoBehaviour
{
private EcsPipeline _pipeline;
@ -18,8 +20,10 @@ namespace DCFApixels.DragonECS.Unity.Internal
}
}
[MetaTags(MetaTags.HIDDEN)]
[MetaColor(MetaColor.Gray)]
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.DEBUG_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaTags(MetaTags.HIDDEN)]
internal class PipelineMonitorSystem : IEcsInit, IEcsPipelineMember, IEcsDestroy
{
private PipelineMonitor _monitor;

View File

@ -2,8 +2,10 @@
namespace DCFApixels.DragonECS.Unity.Editors
{
[MetaTags(MetaTags.HIDDEN)]
[MetaColor(MetaColor.Gray)]
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.DEBUG_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaTags(MetaTags.HIDDEN)]
internal class PipelineProcessMonitor : MonoBehaviour
{
private EcsPipeline _pipeline;

View File

@ -4,8 +4,10 @@ using UnityEngine;
namespace DCFApixels.DragonECS.Unity.Internal
{
[MetaTags(MetaTags.HIDDEN)]
[MetaColor(MetaColor.Gray)]
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.DEBUG_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaTags(MetaTags.HIDDEN)]
internal class WorldMonitor : MonoBehaviour
{
private EcsWorld _world;
@ -19,8 +21,10 @@ namespace DCFApixels.DragonECS.Unity.Internal
}
}
[MetaTags(MetaTags.HIDDEN)]
[MetaColor(MetaColor.Gray)]
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.DEBUG_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaTags(MetaTags.HIDDEN)]
internal class WorldMonitorSystem : IEcsInit, IEcsWorldEventListener, IEcsEntityEventListener
{
private EcsWorld _world;

View File

@ -11,7 +11,7 @@ namespace DCFApixels.DragonECS.Unity.Docs
public class DragonDocs
{
[DataMember, SerializeField]
private readonly DragonDocsMeta[] _metas;
private DragonDocsMeta[] _metas;
public ReadOnlySpan<DragonDocsMeta> Metas
{
@ -42,7 +42,7 @@ namespace DCFApixels.DragonECS.Unity.Docs
{
foreach (var type in assembly.GetTypes())
{
if (memberType.IsAssignableFrom(type) || Attribute.GetCustomAttributes(type, metaAttributeType, false).Length > 1)
if ((type.IsInterface == false && type.IsAbstract == false && memberType.IsAssignableFrom(type)) || Attribute.GetCustomAttributes(type, metaAttributeType, false).Length > 1)
{
result.Add(type);
}

View File

@ -12,10 +12,11 @@ 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 EcsMemberType _memberType = EcsMemberType.Undefined;
[DataMember, SerializeField] internal string _name = string.Empty;
[DataMember, SerializeField] internal bool _isCustomName = false;
[DataMember, SerializeField] internal string _typeName = string.Empty;
[DataMember, SerializeField] internal MetaColor _color = MetaColor.BlackColor;
[DataMember, SerializeField] internal bool _isCustomColor = false;
[DataMember, SerializeField] internal string _autor = string.Empty;
@ -24,15 +25,17 @@ namespace DCFApixels.DragonECS.Unity.Docs
[DataMember, SerializeField] internal string _group = string.Empty;
[DataMember, SerializeField] internal string[] _tags = Array.Empty<string>();
[DataMember, SerializeField] internal bool _isHidden = false;
public string AssemblyQualifiedName
{
get { return _assemblyQualifiedName; }
}
public EcsMemberType EcsMemberType
{
get { return _memberType; }
}
//public EcsMemberType EcsMemberType
//{
// get { return _memberType; }
//}
public string Name
{
get { return _name; }
@ -41,6 +44,10 @@ namespace DCFApixels.DragonECS.Unity.Docs
{
get { return _isCustomName; }
}
public string TypeName
{
get { return _typeName; }
}
public MetaColor Color
{
get { return _color; }
@ -65,15 +72,20 @@ namespace DCFApixels.DragonECS.Unity.Docs
{
get { return _tags; }
}
public bool IsHidden
{
get { return _isHidden; }
}
public DragonDocsMeta(TypeMeta meta)
{
_sourceType = meta.Type;
_assemblyQualifiedName = meta.Type.AssemblyQualifiedName;
_memberType = meta.EcsMemberType;
//_memberType = meta.EcsMemberType;
_name = meta.Name;
_isCustomName = meta.IsCustomName;
_typeName = meta.TypeName;
_color = meta.Color;
_isCustomColor = meta.IsCustomColor;
_autor = meta.Description.Author;
@ -94,6 +106,8 @@ namespace DCFApixels.DragonECS.Unity.Docs
{
_tags[i] = meta.Tags[i];
}
_isHidden = meta.IsHidden;
}
public bool TryGetSourceType(out Type type)
@ -111,11 +125,8 @@ namespace DCFApixels.DragonECS.Unity.Docs
int IComparable<DragonDocsMeta>.CompareTo(DragonDocsMeta other)
{
// int c = string.Compare(_group, other._group);
// //return c == 0 ? c : string.Compare(_name, other._name);
// return c;
int c = string.Compare(_name, other._name);
return c == 0 ? c : string.Compare(_group, other._group);
int c = string.Compare(_group, other._group);
return c == 0 ? string.Compare(_name, other._name) : c;
}
}
}

View File

@ -9,19 +9,19 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
[FilePath(EcsConsts.AUTHOR + "/" + EcsConsts.FRAMEWORK_NAME + "/" + nameof(DragonDocsPrefs) + ".prefs", FilePathAttribute.Location.ProjectFolder)]
internal class DragonDocsPrefs : ScriptableSingleton<DragonDocsPrefs>
{
[SerializeField] private DragonDocs _docs;
[SerializeField] private bool[] _isExpands;
[SerializeField] private DragonDocs m_docs;
[SerializeField] private bool[] m_isExpands;
[NonSerialized] private bool _isInitInfos = false;
[NonSerialized] private MetaGroupInfo[] _infos = null;
public DragonDocs Docs
{
get { return _docs; }
get { return m_docs; }
}
public Span<bool> IsExpands
{
get { return new Span<bool>(_isExpands, 0, _docs.Metas.Length); }
get { return new Span<bool>(m_isExpands, 0, m_docs.Metas.Length); }
}
public ReadOnlySpan<MetaGroupInfo> Infos
{
@ -36,7 +36,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
{
if (_isInitInfos) { return; }
ReadOnlySpan<DragonDocsMeta> metas;
if (_docs == null || (metas = _docs.Metas).IsEmpty)
if (m_docs == null || (metas = m_docs.Metas).IsEmpty)
{
_infos = Array.Empty<MetaGroupInfo>();
_isInitInfos = true;
@ -53,7 +53,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
{
if (string.IsNullOrEmpty(groupPath))
{
groups.Add(new MetaGroupInfo("<ROOT>", "<ROOT>", startIndex, i - startIndex, 0));
groups.Add(new MetaGroupInfo("", "<OTHER>", startIndex, i - startIndex, 0));
}
else
{
@ -73,12 +73,12 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
private void AddInfo(List<MetaGroupInfo> infos, string path, int startIndex, int length)
{
MetaGroupInfo lastInfo = infos[infos.Count - 1];
if (lastInfo.Depth == 0) { lastInfo = new MetaGroupInfo("", "", 0, 0, 0); }
int depth = 1;
//if (lastInfo.Depth == 0) { lastInfo = new MetaGroupInfo("", "", 0, 0, 0); }
int depth = 0;
int lastSeparatorIndex = 0;
int i = 0;
int nameLength = 0;
if(lastInfo.Path.Length <= path.Length)
//if(lastInfo.Path.Length <= path.Length)
{
for (int j = 0, jMax = lastInfo.Path.Length; j < jMax; j++)
{
@ -123,11 +123,11 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
public void Save(DragonDocs docs)
{
_docs = docs;
if(_isExpands == null || _isExpands.Length != docs.Metas.Length)
m_docs = docs;
if(m_isExpands == null || m_isExpands.Length != docs.Metas.Length)
{
Array.Resize(ref _isExpands, docs.Metas.Length);
_isExpands[0] = true;
Array.Resize(ref m_isExpands, docs.Metas.Length);
m_isExpands[0] = true;
}
_isInitInfos = false;
_infos = null;

View File

@ -1,6 +1,7 @@
#if UNITY_EDITOR
using DCFApixels.DragonECS.Unity.Editors;
using DCFApixels.DragonECS.Unity.Internal;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
@ -13,6 +14,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
{
var wnd = GetWindow<DragonDocsWindow>();
wnd.titleContent = new GUIContent($"{EcsConsts.FRAMEWORK_NAME} Documentation");
wnd.minSize = new Vector2(100f, 120f);
wnd.Show();
}
@ -38,22 +40,51 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
get { return SettingsPrefs.instance.IsShowHidden; }
set { SettingsPrefs.instance.IsShowHidden = value; }
}
private static bool IsUseCustomNames
{
get { return SettingsPrefs.instance.IsUseCustomNames; }
set { SettingsPrefs.instance.IsUseCustomNames = value; }
}
private bool _searchingSampleChanged = false;
private string _searchingSampleEnter = string.Empty;
private string _searchingSample = string.Empty;
private bool[] _searchingHideMetaMap = System.Array.Empty<bool>();
private bool[] _searchingHideGroupMap = System.Array.Empty<bool>();
private void OnGUI()
{
Event current = Event.current;
DragonDocs docs = DragonDocsPrefs.instance.Docs;
var metas = docs.Metas;
if (docs == null || docs.Metas.IsEmpty)
{
docs = DragonDocs.Generate();
DragonDocsPrefs.instance.Save(docs);
}
var infos = DragonDocsPrefs.instance.Infos;
if (_searchingHideMetaMap.Length < metas.Length)
{
System.Array.Resize(ref _searchingHideMetaMap, metas.Length);
}
if (_searchingHideGroupMap.Length < infos.Length)
{
System.Array.Resize(ref _searchingHideGroupMap, DragonDocsPrefs.instance.Infos.Length);
}
if(_selectedIndex < 0 || _selectedIndex >= infos.Length)
{
_selectedIndex = 0;
}
DrawToolbar();
GUILayout.BeginHorizontal(GUILayout.ExpandHeight(true));
ButtonsScrolPosition = GUILayout.BeginScrollView(ButtonsScrolPosition, UnityEditorUtility.GetStyle(Color.black, 0.1f), GUILayout.Width(_buttonsWidth));
ButtonsScrolPosition = GUILayout.BeginScrollView(ButtonsScrolPosition, UnityEditorUtility.GetStyle(Color.black, 0f), GUILayout.Width(_buttonsWidth));
var selectedGroupInfo = DrawGroups();
GUILayout.EndScrollView();
@ -66,25 +97,146 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
DrawSelectedGroupMeta(selectedGroupInfo);
GUILayout.EndScrollView();
//GUILayout.Space(EditorGUIUtility.standardVerticalSpacing * -2f);
GUILayout.EndHorizontal();
Rect r = GUILayoutUtility.GetLastRect();
float h = r.height;
r.height = EditorGUIUtility.standardVerticalSpacing;
//EditorGUI.DrawRect(r, new Color(0, 0, 0, 0.3f));
r.y += h;
EditorGUI.DrawRect(r, new Color(0, 0, 0, 0.3f));
GUI.enabled = true;
IsShowHidden = EditorGUILayout.Toggle("Show Hidden", IsShowHidden);
if (GUILayout.Button("Update"))
GUILayout.Label(infos[_selectedIndex].Path);
}
private void DrawToolbar()
{
docs = DragonDocs.Generate();
using (EcsGUI.SetColor(GUI.color * 0.8f))
GUILayout.BeginHorizontal(EditorStyles.toolbar);
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing * 2f);
if (GUILayout.Button("Update", EditorStyles.toolbarButton, GUILayout.Width(80f)))
{
DragonDocs docs = DragonDocs.Generate();
DragonDocsPrefs.instance.Save(docs);
}
if (EcsGUI.Layout.IconButton(IsShowHidden ? Icons.Instance.VisibilityIconOn : Icons.Instance.VisibilityIconOff, 0f, IsShowHidden ? "Show Hidden" : "Don't Show Hidden", EditorStyles.toolbarButton, GUILayout.Width(EditorGUIUtility.singleLineHeight * 1.6f)))
{
IsShowHidden = !IsShowHidden;
}
if (EcsGUI.Layout.IconButton(IsUseCustomNames ? Icons.Instance.LabelIconMeta : Icons.Instance.LabelIconType, 1f, IsUseCustomNames ? "Use Meta Name" : "Use Type Name", EditorStyles.toolbarButton, GUILayout.Width(EditorGUIUtility.singleLineHeight * 1.6f)))
{
IsUseCustomNames = !IsUseCustomNames;
}
GUILayout.Label("");
EditorGUI.BeginChangeCheck();
_searchingSampleEnter = EditorGUILayout.TextField(_searchingSampleEnter, EditorStyles.toolbarTextField, GUILayout.ExpandHeight(true), GUILayout.MaxWidth(200f));
if (EditorGUI.EndChangeCheck())
{
_searchingSampleChanged = true;
}
if ((_searchingSampleChanged && Event.current.keyCode == KeyCode.Return) ||
EcsGUI.Layout.IconButton(Icons.Instance.SearchIcon, 3f, null, EditorStyles.toolbarButton, GUILayout.ExpandHeight(true), GUILayout.Width(EditorGUIUtility.singleLineHeight * 1.6f)))
{
Searh();
}
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing * 2f);
GUILayout.EndHorizontal();
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing * -2f);
}
private void Searh()
{
_searchingSample = _searchingSampleEnter;
_searchingSampleChanged = false;
DragonDocs docs = DragonDocsPrefs.instance.Docs;
var metas = docs.Metas;
if (_searchingSample.Length <= 0)
{
var infos = DragonDocsPrefs.instance.Infos;
var isExpands = DragonDocsPrefs.instance.IsExpands;
for (int i = 0; i < _searchingHideMetaMap.Length; i++)
{
_searchingHideMetaMap[i] = false;
}
for (int i = 0; i < _searchingHideGroupMap.Length; i++)
{
_searchingHideGroupMap[i] = false;
}
{
int i = _selectedIndex;
var info = infos[i];
int depth = info.Depth;
while (depth > 0)
{
i--;
info = infos[i];
if (info.Depth >= depth)
{
continue;
}
depth = info.Depth;
isExpands[i] = true;
}
}
}
else
{
var infos = DragonDocsPrefs.instance.Infos;
for (int i = 0; i < infos.Length; i++)
{
var info = infos[i];
int visibleCount = 0;
bool isUseCustomNames = IsUseCustomNames;
for (int j = info.StartIndex, jMax = j + info.Length; j < jMax; j++)
{
var b = (isUseCustomNames ? metas[j].Name : metas[j].TypeName).Contains(_searchingSample, System.StringComparison.InvariantCultureIgnoreCase);
_searchingHideMetaMap[j] = !b;
if (b)
{
visibleCount++;
}
}
_searchingHideGroupMap[i] = visibleCount == 0;
}
}
}
private void DrawSelectedGroupMeta(MetaGroupInfo info)
{
bool hide = IsShowHidden == false;
var metas = Prefs.Docs.Metas;
for (int i = 0, j = info.StartIndex; i < info.Length; i++, j++)
int iMax = info.Length;
for (int i = 0, j = info.StartIndex; i < iMax; j++)
{
if (_searchingHideMetaMap[j] || (metas[j]._isHidden && hide))
{
iMax--;
}
else
{
DrawMeta(metas[j], i, 12);
i++;
}
}
if (iMax <= 0)
{
GUILayout.Label(info.Length <= 0 ? "empty group" : "there are hidden items", EditorStyles.centeredGreyMiniLabel, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
}
}
@ -96,10 +248,19 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
Color alphaPanelColor = panelColor;
alphaPanelColor.a = EscEditorConsts.COMPONENT_DRAWER_ALPHA;
GUILayout.BeginVertical(UnityEditorUtility.GetStyle(alphaPanelColor));
GUILayout.Space(1f);
GUILayout.TextArea(meta.Name, EditorStyles.boldLabel);
GUILayout.BeginHorizontal();
GUILayout.TextArea(IsUseCustomNames ? meta.Name : meta.TypeName, EditorStyles.boldLabel, GUILayout.ExpandWidth(false));
if (meta.IsCustomName)
{
using (EcsGUI.SetAlpha(0.64f)) using (EcsGUI.SetAlignment(GUI.skin.label, TextAnchor.MiddleRight))
{
GUILayout.TextArea(IsUseCustomNames ? meta.TypeName : meta.Name, GUI.skin.label);
}
}
GUILayout.EndHorizontal();
Rect lastRect = GUILayoutUtility.GetLastRect();
if (string.IsNullOrEmpty(meta.Description) == false)
@ -139,22 +300,28 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
}
private MetaGroupInfo DrawGroups()
{
using (EcsGUI.SetIndentLevel(0))
{
Event current = Event.current;
MetaGroupInfo result = new MetaGroupInfo("NO_NAME", "NO_NAME", 0, 0, 0);
var infos = Prefs.Infos;
var IsExpands = Prefs.IsExpands;
var isExpands = Prefs.IsExpands;
using (EcsGUI.SetIndentLevel(0))
{
int clippingDepth = int.MaxValue;
for (int i = 0; i < infos.Length; i++)
{
if (_searchingHideGroupMap[i]) { continue; }
var groupInfo = infos[i];
if (groupInfo.Depth > clippingDepth)
if (i == _selectedIndex)
{
result = groupInfo;
}
if (_searchingSample.Length == 0 && groupInfo.Depth > clippingDepth)
{
continue;
}
@ -163,47 +330,58 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
clippingDepth = int.MaxValue;
}
if(_searchingSample.Length == 0)
{
EditorGUI.indentLevel = groupInfo.Depth;
}
GUIContent label = UnityEditorUtility.GetLabel(groupInfo.Name);
GUIContent label = UnityEditorUtility.GetLabel(_searchingSample.Length == 0 ? groupInfo.Name : groupInfo.Path);
Rect r = GUILayoutUtility.GetRect(label, EditorStyles.foldout);
if (i == _selectedIndex)
{
EditorGUI.DrawRect(r, new Color(0.12f, 0.5f, 1f, 0.40f));
result = groupInfo;
}
bool isClick;
using (EcsGUI.SetColor(0, 0, 0, 0))
using (EcsGUI.Disable)
{
isClick = GUI.Button(r, "");
}
using (EcsGUI.SetColor(0, 0, 0, 0)) using (EcsGUI.Disable) { GUI.Button(r, ""); }
bool isClick = false;
if (EcsGUI.HitTest(r))
{
EditorGUI.DrawRect(r, new Color(1f, 1f, 1f, 0.12f));
if (current.type == EventType.MouseDown)
if (current.type == EventType.MouseUp)
{
_selectedIndex = i;
isClick = true;
//_selectedIndex = i;
//current.Use();
}
}
if (i + 1 == infos.Length || infos[i + 1].Depth <= groupInfo.Depth)
if (_searchingSample.Length != 0 || (i + 1 == infos.Length || infos[i + 1].Depth <= groupInfo.Depth))
{
using (EcsGUI.SetBackgroundColor(0, 0, 0, 0))
{
EditorGUI.Foldout(r, false, label, EditorStyles.foldout);
}
}
else
{
IsExpands[i] = EditorGUI.Foldout(r, IsExpands[i], label, EditorStyles.foldout);
if (i == 0)
EditorGUI.BeginChangeCheck();
isExpands[i] = EditorGUI.Foldout(r, isExpands[i], label, EditorStyles.foldout);
if (EditorGUI.EndChangeCheck())
{
IsExpands[i] = true;
isClick = false;
}
}
if (IsExpands[i] == false)
if (isClick)
{
_selectedIndex = i;
current.Use();
}
if (isExpands[i] == false)
{
clippingDepth = groupInfo.Depth;
}
@ -218,9 +396,8 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
EditorGUI.DrawRect(r, new Color(0.2f, 0.6f, 1f));
}
}
return result;
}
return result;
}
private void DrawDragger()
@ -237,7 +414,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
rect.x -= m / 2f;
rect.width = m;
EditorGUI.DrawRect(rect.AddPadding(1f, 0), new Color(0,0,0,0.5f));
EditorGUI.DrawRect(rect.AddPadding(1f, 0), new Color(0, 0, 0, 0.3f));
Event current = Event.current;
switch (current.type)

View File

@ -1,7 +0,0 @@
namespace DCFApixels.DragonECS
{
public class EcsUnityConsts
{
public const string UNITY_GROUP = "Unity";
}
}

View File

@ -1,4 +1,5 @@
using DCFApixels.DragonECS.Unity.Internal;
using DCFApixels.DragonECS.Unity;
using DCFApixels.DragonECS.Unity.Internal;
using System;
using UnityEngine;
@ -12,8 +13,8 @@ namespace DCFApixels.DragonECS
[DisallowMultipleComponent]
[AddComponentMenu(EcsConsts.FRAMEWORK_NAME + "/" + nameof(MonoEntityTemplate), 30)]
[MetaColor(MetaColor.Cyan)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, EcsUnityConsts.UNITY_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsUnityConsts.ENTITY_BUILDING_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, nameof(MonoBehaviour) + " implementation of an entity template. Templates are a set of components that are applied to entities.")]
public class MonoEntityTemplate : MonoEntityTemplateBase, ITemplateInternal
{
[SerializeReference]

View File

@ -1,4 +1,5 @@
using DCFApixels.DragonECS.Unity.Internal;
using DCFApixels.DragonECS.Unity;
using DCFApixels.DragonECS.Unity.Internal;
using System;
using UnityEngine;
@ -10,8 +11,8 @@ namespace DCFApixels.DragonECS
}
[MetaColor(MetaColor.Cyan)]
[MetaGroup(EcsConsts.FRAMEWORK_GROUP, EcsUnityConsts.UNITY_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "...")]
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsUnityConsts.ENTITY_BUILDING_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, nameof(ScriptableObject) + " implementation of an entity template. Templates are a set of components that are applied to entities.")]
[CreateAssetMenu(fileName = nameof(ScriptableEntityTemplate), menuName = EcsConsts.FRAMEWORK_NAME + "/" + nameof(ScriptableEntityTemplate), order = 1)]
public class ScriptableEntityTemplate : ScriptableEntityTemplateBase, ITemplateInternal
{

View File

@ -4,7 +4,7 @@ namespace DCFApixels.DragonECS.Unity.Internal
{
internal class Icons : Config<Icons>
{
//Thank f*cking balls, everything inside #if UNITY_EDITOR is not serialized in the release build
//Everything inside #if UNITY_EDITOR is not serialized in the release build
#if UNITY_EDITOR
[SerializeField]
private Texture _helpIcon;
@ -18,12 +18,28 @@ namespace DCFApixels.DragonECS.Unity.Internal
private Texture _auotsetIcon;
[SerializeField]
private Texture _auotsetCascadeIcon;
[SerializeField]
private Texture _searchIcon;
[SerializeField]
private Texture _visibilityIconOn;
[SerializeField]
private Texture _visibilityIconOff;
[SerializeField]
private Texture _labelIconType;
[SerializeField]
private Texture _labelIconMeta;
internal Texture HelpIcon { get { return _helpIcon; } }
internal Texture CloseIcon { get { return _closeIcon; } }
internal Texture CloseIconOn { get { return _closeIconOn; } }
internal Texture UnlinkIcon { get { return _unlinkIcon; } }
internal Texture AuotsetIcon { get { return _auotsetIcon; } }
internal Texture AutosetCascadeIcon { get { return _auotsetCascadeIcon; } }
internal Texture SearchIcon { get { return _searchIcon; } }
internal Texture VisibilityIconOn { get { return _visibilityIconOn; } }
internal Texture VisibilityIconOff { get { return _visibilityIconOff; } }
internal Texture LabelIconType { get { return _labelIconType; } }
internal Texture LabelIconMeta { get { return _labelIconMeta; } }
#endif
}
}

View File

@ -10,6 +10,11 @@ MonoImporter:
- _unlinkIcon: {fileID: 2800000, guid: 5baead89a941e034e9f44d63617d3246, type: 3}
- _auotsetIcon: {fileID: 2800000, guid: d01e651682f48b548b597714f47e14b9, type: 3}
- _auotsetCascadeIcon: {fileID: 2800000, guid: 8f9fb2a8877577940971d81a98aeaaaa, type: 3}
- _searchIcon: {fileID: 2800000, guid: 239e73d04c7ba4649bc4cc10e70e62e5, type: 3}
- _visibilityIconOn: {fileID: 2800000, guid: 9ce9d719a106be04fa4cf0c369c61e1c, type: 3}
- _visibilityIconOff: {fileID: 2800000, guid: 1f25a5ca611092642a8ee4e08fafcd43, type: 3}
- _labelIconType: {fileID: 2800000, guid: 5476d6e1435981e4cbc915a080f93ee6, type: 3}
- _labelIconMeta: {fileID: 2800000, guid: ebb82b09315bde749a10dfa45e64067c, type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:

BIN
src/Icons/LabelIconMeta.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -0,0 +1,122 @@
fileFormatVersion: 2
guid: ebb82b09315bde749a10dfa45e64067c
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
src/Icons/LabelIconType.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,122 @@
fileFormatVersion: 2
guid: 5476d6e1435981e4cbc915a080f93ee6
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
src/Icons/SearchIcon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -0,0 +1,122 @@
fileFormatVersion: 2
guid: 239e73d04c7ba4649bc4cc10e70e62e5
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,122 @@
fileFormatVersion: 2
guid: 1f25a5ca611092642a8ee4e08fafcd43
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,122 @@
fileFormatVersion: 2
guid: 9ce9d719a106be04fa4cf0c369c61e1c
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -80,6 +80,24 @@ namespace DCFApixels.DragonECS.Unity.Editors
EditorGUI.indentLevel = _value;
}
}
public struct AlignmentScope : IDisposable
{
private readonly GUIStyle _target;
private readonly TextAnchor _value;
public AlignmentScope(GUIStyle target, TextAnchor value)
{
_target = target;
_value = _target.alignment;
_target.alignment = value;
}
public void Dispose()
{
_target.alignment = _value;
}
}
#endregion
public static AlignmentScope SetAlignment(GUIStyle target, TextAnchor value) => new AlignmentScope(target, value);
public static IndentLevelScope SetIndentLevel(int level) => new IndentLevelScope(level);
public static ContentColorScope SetContentColor(Color value) => new ContentColorScope(value);
public static ContentColorScope SetContentColor(float r, float g, float b, float a = 1f) => new ContentColorScope(r, g, b, a);
@ -91,7 +109,8 @@ namespace DCFApixels.DragonECS.Unity.Editors
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);
#endregion
private static readonly BindingFlags fieldFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
@ -161,6 +180,14 @@ namespace DCFApixels.DragonECS.Unity.Editors
#region small elems
public static void DrawIcon(Rect position, Texture icon, float iconPadding, string description)
{
if(position.width != position.height)
{
Vector2 center = position.center;
float size = Mathf.Min(position.width, position.height);
position.height = size;
position.width = size;
position.center = center;
}
using (SetColor(GUI.enabled ? GUI.color : GUI.color * new Color(1f, 1f, 1f, 0.4f)))
{
GUI.Label(position, UnityEditorUtility.GetLabel(string.Empty, description));
@ -389,8 +416,41 @@ namespace DCFApixels.DragonECS.Unity.Editors
EditorGUI.EndProperty();
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public static class Layout
{
public static bool IconButton(Texture icon, params GUILayoutOption[] options)
{
bool result = GUILayout.Button(UnityEditorUtility.GetLabel(string.Empty), options);
DrawIcon(GUILayoutUtility.GetLastRect(), icon, 0, null);
return result;
}
public static bool IconButton(Texture icon, float iconPadding = 0, string description = null)
{
bool result = GUILayout.Button(UnityEditorUtility.GetLabel(string.Empty));
DrawIcon(GUILayoutUtility.GetLastRect(), icon, iconPadding, description);
return result;
}
public static bool IconButton(Texture icon, float iconPadding = 0, string description = null, GUIStyle style = null, params GUILayoutOption[] options)
{
bool result;
if(style == null)
{
result = GUILayout.Button(UnityEditorUtility.GetLabel(string.Empty), options);
}
else
{
result = GUILayout.Button(UnityEditorUtility.GetLabel(string.Empty), style, options);
}
DrawIcon(GUILayoutUtility.GetLastRect(), icon, iconPadding, description);
return result;
}
public static void DrawEmptyComponentProperty(SerializedProperty property, string name, bool isDisplayEmpty)
{
EcsGUI.DrawEmptyComponentProperty(GUILayoutUtility.GetRect(UnityEditorUtility.GetLabel(name), EditorStyles.label), property, name, isDisplayEmpty);

View File

@ -18,3 +18,8 @@ MonoBehaviour:
_unlinkIcon: {fileID: 2800000, guid: 5baead89a941e034e9f44d63617d3246, type: 3}
_auotsetIcon: {fileID: 2800000, guid: d01e651682f48b548b597714f47e14b9, type: 3}
_auotsetCascadeIcon: {fileID: 2800000, guid: 8f9fb2a8877577940971d81a98aeaaaa, type: 3}
_searchIcon: {fileID: 2800000, guid: 239e73d04c7ba4649bc4cc10e70e62e5, type: 3}
_visibilityIconOn: {fileID: 2800000, guid: 9ce9d719a106be04fa4cf0c369c61e1c, type: 3}
_visibilityIconOff: {fileID: 2800000, guid: 1f25a5ca611092642a8ee4e08fafcd43, type: 3}
_labelIconType: {fileID: 2800000, guid: 5476d6e1435981e4cbc915a080f93ee6, type: 3}
_labelIconMeta: {fileID: 2800000, guid: ebb82b09315bde749a10dfa45e64067c, type: 3}