simple refactoring

This commit is contained in:
Mikhail 2024-09-10 19:13:31 +08:00
parent b1ec482266
commit 9567613ed6
7 changed files with 15 additions and 16 deletions

View File

@ -1,5 +1,4 @@
using DCFApixels.DragonECS.PoolsCore; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using UnityEngine; using UnityEngine;
@ -10,9 +9,9 @@ namespace DCFApixels.DragonECS.Unity.Docs
[DataContract] [DataContract]
public class DragonDocs public class DragonDocs
{ {
[DataMember, SerializeField] [DataMember, SerializeField]
private DragonDocsMeta[] _metas; private DragonDocsMeta[] _metas;
public ReadOnlySpan<DragonDocsMeta> Metas public ReadOnlySpan<DragonDocsMeta> Metas
{ {
get { return new ReadOnlySpan<DragonDocsMeta>(_metas); } get { return new ReadOnlySpan<DragonDocsMeta>(_metas); }

View File

@ -25,10 +25,10 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
} }
public ReadOnlySpan<MetaGroupInfo> Infos public ReadOnlySpan<MetaGroupInfo> Infos
{ {
get get
{ {
InitInfos(); InitInfos();
return new ReadOnlySpan<MetaGroupInfo>(_infos); return new ReadOnlySpan<MetaGroupInfo>(_infos);
} }
} }
@ -124,7 +124,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
public void Save(DragonDocs docs) public void Save(DragonDocs docs)
{ {
m_docs = docs; m_docs = docs;
if(m_isExpands == null || m_isExpands.Length != docs.Metas.Length) if (m_isExpands == null || m_isExpands.Length != docs.Metas.Length)
{ {
Array.Resize(ref m_isExpands, docs.Metas.Length); Array.Resize(ref m_isExpands, docs.Metas.Length);
m_isExpands[0] = true; m_isExpands[0] = true;

View File

@ -72,7 +72,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
System.Array.Resize(ref _searchingHideGroupMap, DragonDocsPrefs.instance.Infos.Length); System.Array.Resize(ref _searchingHideGroupMap, DragonDocsPrefs.instance.Infos.Length);
} }
if(_selectedIndex < 0 || _selectedIndex >= infos.Length) if (_selectedIndex < 0 || _selectedIndex >= infos.Length)
{ {
_selectedIndex = 0; _selectedIndex = 0;
} }
@ -153,7 +153,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
private void Searh() private void Searh()
{ {
_searchingSample = _searchingSampleEnter; _searchingSample = _searchingSampleEnter;
_searchingSampleChanged = false; _searchingSampleChanged = false;
DragonDocs docs = DragonDocsPrefs.instance.Docs; DragonDocs docs = DragonDocsPrefs.instance.Docs;
var metas = docs.Metas; var metas = docs.Metas;
@ -332,7 +332,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
clippingDepth = int.MaxValue; clippingDepth = int.MaxValue;
} }
if(_searchingSample.Length == 0) if (_searchingSample.Length == 0)
{ {
EditorGUI.indentLevel = groupInfo.Depth; EditorGUI.indentLevel = groupInfo.Depth;
} }

View File

@ -93,7 +93,7 @@ namespace DCFApixels.DragonECS
int lastNewLayersCount = newLayers.Count; int lastNewLayersCount = newLayers.Count;
foreach (var pair in builtinLayerIndexes) foreach (var pair in builtinLayerIndexes)
{ {
if(pair.Value < 0) if (pair.Value < 0)
{ {
newLayers.Add(pair.Key); newLayers.Add(pair.Key);
} }

View File

@ -55,7 +55,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
var splitedGroup = group.Splited; var splitedGroup = group.Splited;
Item parent = root; Item parent = root;
if(splitedGroup.Count > 0) if (splitedGroup.Count > 0)
{ {
int i = 1; int i = 1;
foreach (var subgroup in splitedGroup) foreach (var subgroup in splitedGroup)
@ -105,7 +105,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
public Key(MetaGroup group, int length) public Key(MetaGroup group, int length)
{ {
Group = group; Group = group;
Length = length; Length = length;
} }
public bool Equals(Key other) public bool Equals(Key other)
{ {

View File

@ -496,7 +496,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
public static bool IconButton(Texture icon, float iconPadding = 0, string description = null, GUIStyle style = null, params GUILayoutOption[] options) public static bool IconButton(Texture icon, float iconPadding = 0, string description = null, GUIStyle style = null, params GUILayoutOption[] options)
{ {
bool result; bool result;
if(style == null) if (style == null)
{ {
result = GUILayout.Button(UnityEditorUtility.GetLabel(string.Empty), options); result = GUILayout.Button(UnityEditorUtility.GetLabel(string.Empty), options);
} }
@ -615,7 +615,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
object data = pool.GetRaw(entityID); object data = pool.GetRaw(entityID);
Color panelColor = SelectPanelColor(meta, index, total).Desaturate(EscEditorConsts.COMPONENT_DRAWER_DESATURATE); Color panelColor = SelectPanelColor(meta, index, total).Desaturate(EscEditorConsts.COMPONENT_DRAWER_DESATURATE);
Type componentType = pool.ComponentType; Type componentType = pool.ComponentType;
ExpandMatrix expandMatrix = ExpandMatrix.Take(componentType); ExpandMatrix expandMatrix = ExpandMatrix.Take(componentType);

View File

@ -122,7 +122,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
script = null; script = null;
string name = type.Name; string name = type.Name;
int indexOf = name.LastIndexOf('`'); int indexOf = name.LastIndexOf('`');
if(indexOf >= 0) if (indexOf >= 0)
{ {
name = name.Substring(0, indexOf); name = name.Substring(0, indexOf);
} }