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.Runtime.Serialization;
using UnityEngine;
@ -10,9 +9,9 @@ namespace DCFApixels.DragonECS.Unity.Docs
[DataContract]
public class DragonDocs
{
[DataMember, SerializeField]
[DataMember, SerializeField]
private DragonDocsMeta[] _metas;
public 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
{
get
get
{
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)
{
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);
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);
}
if(_selectedIndex < 0 || _selectedIndex >= infos.Length)
if (_selectedIndex < 0 || _selectedIndex >= infos.Length)
{
_selectedIndex = 0;
}
@ -153,7 +153,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
private void Searh()
{
_searchingSample = _searchingSampleEnter;
_searchingSample = _searchingSampleEnter;
_searchingSampleChanged = false;
DragonDocs docs = DragonDocsPrefs.instance.Docs;
var metas = docs.Metas;
@ -332,7 +332,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
clippingDepth = int.MaxValue;
}
if(_searchingSample.Length == 0)
if (_searchingSample.Length == 0)
{
EditorGUI.indentLevel = groupInfo.Depth;
}

View File

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

View File

@ -55,7 +55,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
var splitedGroup = group.Splited;
Item parent = root;
if(splitedGroup.Count > 0)
if (splitedGroup.Count > 0)
{
int i = 1;
foreach (var subgroup in splitedGroup)
@ -105,7 +105,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
public Key(MetaGroup group, int length)
{
Group = group;
Length = length;
Length = length;
}
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)
{
bool result;
if(style == null)
if (style == null)
{
result = GUILayout.Button(UnityEditorUtility.GetLabel(string.Empty), options);
}
@ -615,7 +615,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
object data = pool.GetRaw(entityID);
Color panelColor = SelectPanelColor(meta, index, total).Desaturate(EscEditorConsts.COMPONENT_DRAWER_DESATURATE);
Type componentType = pool.ComponentType;
ExpandMatrix expandMatrix = ExpandMatrix.Take(componentType);

View File

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