添加debug工具
This commit is contained in:
.gitignore
Assets
CSAssets
Editor
Plugins
IngameDebugConsole.meta
IngameDebugConsole
Android.meta
RuntimeInspector.metaAndroid
DebugLogLogcatListener.csDebugLogLogcatListener.cs.metaIngameDebugConsole.aarIngameDebugConsole.aar.meta
Editor.metaEditor
DebugLogManagerEditor.csDebugLogManagerEditor.cs.metaIngameDebugConsole.Editor.asmdefIngameDebugConsole.Editor.asmdef.meta
IngameDebugConsole.Runtime.asmdefIngameDebugConsole.Runtime.asmdef.metaIngameDebugConsole.prefabIngameDebugConsole.prefab.metaPrefabs.metaPrefabs
README.txtREADME.txt.metaScripts.metaScripts
CircularBuffer.csCircularBuffer.cs.metaCommands.meta
Sprites.metaCommands
PlayerPrefsCommands.csPlayerPrefsCommands.cs.metaSceneCommands.csSceneCommands.cs.metaTimeCommands.csTimeCommands.cs.meta
ConsoleMethodAttribute.csConsoleMethodAttribute.cs.metaDebugLogConsole.csDebugLogConsole.cs.metaDebugLogEntry.csDebugLogEntry.cs.metaDebugLogIndexList.csDebugLogIndexList.cs.metaDebugLogItem.csDebugLogItem.cs.metaDebugLogItemCopyWebGL.csDebugLogItemCopyWebGL.cs.metaDebugLogManager.csDebugLogManager.cs.metaDebugLogPopup.csDebugLogPopup.cs.metaDebugLogRecycledListView.csDebugLogRecycledListView.cs.metaDebugLogResizeListener.csDebugLogResizeListener.cs.metaDebugsOnScrollListener.csDebugsOnScrollListener.cs.metaEventSystemHandler.csEventSystemHandler.cs.metaSprites
IconClear.psdIconClear.psd.metaIconCollapse.psdIconCollapse.psd.metaIconError.psdIconError.psd.metaIconHide.psdIconHide.psd.metaIconInfo.psdIconInfo.psd.metaIconResizeAllDirections.psdIconResizeAllDirections.psd.metaIconResizeVertialOnly.psdIconResizeVertialOnly.psd.metaIconSnapToBottom.psdIconSnapToBottom.psd.metaIconSnapToBottomBg.psdIconSnapToBottomBg.psd.metaIconWarning.psdIconWarning.psd.metaIngameDebugConsoleSpriteAtlas.spriteatlasIngameDebugConsoleSpriteAtlas.spriteatlas.metaSearchIcon.psdSearchIcon.psd.metaSlicedBackground.psdSlicedBackground.psd.metaSlicedBackground2.psdSlicedBackground2.psd.metaSlicedBackground3.psdSlicedBackground3.psd.metaUnused.meta
WebGL.metaUnused
WebGL
iOS.metaiOS
RuntimeInspector
ExternalResources.meta
ExternalResources
ColorWheel.meta
InternalSettings.assetInternalSettings.asset.metaPrefabs.metaColorWheel
Prefabs
RuntimeHierarchy.meta
README.txtREADME.txt.metaResources.metaRuntimeHierarchy
RuntimeInspector.metaRuntimeInspector
Fields.meta
Fields
ArrayField.prefabArrayField.prefab.metaBoolField.prefabBoolField.prefab.metaBoundsField.prefabBoundsField.prefab.metaColorField.prefabColorField.prefab.metaEnumField.prefabEnumField.prefab.metaExposedMethodField.prefabExposedMethodField.prefab.metaGameObjectField.prefabGameObjectField.prefab.metaNumberField.prefabNumberField.prefab.metaNumberRangeField.prefabNumberRangeField.prefab.metaObjectField.prefabObjectField.prefab.metaObjectReferenceField.prefabObjectReferenceField.prefab.metaRectField.prefabRectField.prefab.metaStringField.prefabStringField.prefab.metaTextureReferenceField.prefabTextureReferenceField.prefab.metaTransformField.prefabTransformField.prefab.metaVector2Field.prefabVector2Field.prefab.metaVector3Field.prefabVector3Field.prefab.metaVector4Field.prefabVector4Field.prefab.meta
Helpers.metaHelpers
Resources
RuntimeInspector.meta
RuntimeHierarchy.prefabRuntimeHierarchy.prefab.metaRuntimeInspector.Runtime.asmdefRuntimeInspector.Runtime.asmdef.metaRuntimeInspector.prefabRuntimeInspector.prefab.metaScripts.metaRuntimeInspector
Scripts
RuntimeHierarchy.csRuntimeHierarchy.cs.metaRuntimeHierarchy.meta
Shaders.metaRuntimeHierarchy
Helpers.meta
RuntimeInspector.csRuntimeInspector.cs.metaRuntimeInspector.metaHelpers
HierarchyDragDropListener.csHierarchyDragDropListener.cs.metaPseudoSceneSourceTransform.csPseudoSceneSourceTransform.cs.meta
HierarchyData.csHierarchyData.cs.metaHierarchyDataRoot.csHierarchyDataRoot.cs.metaHierarchyDataRootPseudoScene.csHierarchyDataRootPseudoScene.cs.metaHierarchyDataRootScene.csHierarchyDataRootScene.cs.metaHierarchyDataRootSearch.csHierarchyDataRootSearch.cs.metaHierarchyDataTransform.csHierarchyDataTransform.cs.metaHierarchyField.csHierarchyField.cs.metaRuntimeInspector
Attributes.meta
Attributes
RuntimeInspectorButtonAttribute.csRuntimeInspectorButtonAttribute.cs.metaRuntimeInspectorCustomEditorAttribute.csRuntimeInspectorCustomEditorAttribute.cs.meta
Fields.metaFields
ArrayField.csArrayField.cs.metaBoolField.csBoolField.cs.metaBoundsField.csBoundsField.cs.metaColorField.csColorField.cs.metaEnumField.csEnumField.cs.metaExposedMethodField.csExposedMethodField.cs.metaGameObjectField.csGameObjectField.cs.metaInspectorField.csInspectorField.cs.metaNumberField.csNumberField.cs.metaNumberRangeField.csNumberRangeField.cs.metaObjectField.csObjectField.cs.metaObjectReferenceField.csObjectReferenceField.cs.metaRectField.csRectField.cs.metaStringField.csStringField.cs.metaTextureReferenceField.csTextureReferenceField.cs.metaTransformField.csTransformField.cs.metaVector2Field.csVector2Field.cs.metaVector3Field.csVector3Field.cs.metaVector4Field.csVector4Field.cs.meta
Helpers.metaHelpers
BoundInputField.csBoundInputField.cs.metaBoundSlider.csBoundSlider.cs.metaColorPicker.meta
Skin.metaColorPicker
DraggedReferenceItem.csDraggedReferenceItem.cs.metaDraggedReferenceSourceCamera.csDraggedReferenceSourceCamera.cs.metaDraggedReferenceSourceUI.csDraggedReferenceSourceUI.cs.metaExposedMethod.csExposedMethod.cs.metaExposedVariablesEnumerator.csExposedVariablesEnumerator.cs.metaNonDrawingGraphic.csNonDrawingGraphic.cs.metaNonDrawingMaskableGraphic.csNonDrawingMaskableGraphic.cs.metaNumberHandlers.csNumberHandlers.cs.metaObjectReferencePicker.metaObjectReferencePicker
ObjectReferencePicker.csObjectReferencePicker.cs.metaObjectReferencePickerItem.csObjectReferencePickerItem.cs.meta
PointerEventListener.csPointerEventListener.cs.metaPopupBase.csPopupBase.cs.metaRecycledListView.metaRecycledListView
IListViewAdapter.csIListViewAdapter.cs.metaRecycledListItem.csRecycledListItem.cs.metaRecycledListView.csRecycledListView.cs.meta
RuntimeInspectorSettings.csRuntimeInspectorSettings.cs.metaRuntimeInspectorUtils.csRuntimeInspectorUtils.cs.metaTooltip.csTooltip.cs.metaTooltipArea.csTooltipArea.cs.metaTooltipListener.csTooltipListener.cs.metaVariableSet.csVariableSet.cs.metaWindowDragHandler.csWindowDragHandler.cs.metaSkin
Shaders
ColorPickerAlphaMaterial.matColorPickerAlphaMaterial.mat.metaColorPickerAlphaShader.shaderColorPickerAlphaShader.shader.meta
Skins.metaSkins
Sprites.metaSprites
ButtonBg.psdButtonBg.psd.metaCheckmark.psdCheckmark.psd.metaColorFieldBg.psdColorFieldBg.psd.metaColorFieldTransparentBg.psdColorFieldTransparentBg.psd.metaDownArrow.psdDownArrow.psd.metaDragAndDropBg.psdDragAndDropBg.psd.metaExpandArrow.psdExpandArrow.psd.metaInputFieldBg.psdInputFieldBg.psd.metaInspectReferenceArrow.psdInspectReferenceArrow.psd.metaSearchIcon.psdSearchIcon.psd.metaSliderBg.psdSliderBg.psd.metaSliderThumb.psdSliderThumb.psd.metaWhite.pngWhite.png.meta
ThirdPartyNotices.txtThirdPartyNotices.txt.metaProject
GameRes
DummyMaterial
1005278527.mat.meta1027421493.mat.meta1029769654.mat.meta103973718.mat.meta1098675164.mat.meta1105669650.mat.meta1129907047.mat.meta1183509003.mat.meta1184956560.mat.meta1192151891.mat.meta1209964436.mat.meta1248213280.mat.meta1274362148.mat.meta1288468513.mat.meta1296894701.mat.meta130217613.mat.meta1381407051.mat.meta1423995325.mat.meta1456853423.mat.meta1459214389.mat.meta1500675633.mat.meta1503927734.mat.meta1511286178.mat.meta1519698979.mat.meta1521666193.mat.meta1556632090.mat.meta1568252347.mat.meta1580009455.mat.meta1659897039.mat.meta1670160698.mat.meta1692493091.mat.meta1704837334.mat.meta1717444261.mat.meta1739460917.mat.meta1767002623.mat.meta1772791499.mat.meta1841997986.mat.meta1846757793.mat.meta1847907842.mat.meta1849660902.mat.meta1892877949.mat.meta1899344832.mat.meta1942141328.mat.meta1998554402.mat.meta2030778644.mat.meta2038172114.mat.meta2056516474.mat.meta2086589292.mat.meta2126790404.mat.meta2150757578.mat.meta2164612953.mat.meta2173349684.mat.meta2179085644.mat.meta2224894161.mat.meta2231992728.mat.meta2236099016.mat.meta2270965971.mat.meta2308993049.mat.meta2329426606.mat.meta2330919951.mat.meta2341708282.mat.meta2365482467.mat.meta2374156310.mat.meta2412091565.mat.meta2422519158.mat.meta242956612.mat.meta2663927093.mat.meta2671497964.mat.meta2712042832.mat.meta2717376397.mat.meta2748594355.mat.meta2768759778.mat.meta2773309832.mat.meta279519651.mat.meta2798732219.mat.meta2818854931.mat.meta282571981.mat.meta2827258663.mat.meta2872434622.mat.meta291057203.mat.meta2951302974.mat.meta2955110083.mat.meta2984523060.mat.meta3010969751.mat.meta3021603982.mat.meta3069336989.mat.meta3075384026.mat.meta312143936.mat.meta3212549395.mat.meta3226047052.mat.meta3262379475.mat.meta3273471000.mat.meta3295735809.mat.meta3336766882.mat.meta333862325.mat.meta3341047381.mat.meta3353932625.mat.meta3363614085.mat.meta3437553339.mat.meta344691116.mat.meta3523271540.mat.meta3570599973.mat.meta3572509830.mat.meta3610657690.mat.meta3639508904.mat.meta3644564855.mat.meta368522329.mat.meta3705907492.mat.meta3749952433.mat.meta3755923179.mat.meta3896304250.mat.meta3942533584.mat.meta3962488102.mat.meta4014519825.mat.meta40224011.mat.meta4032495685.mat.meta4059208281.mat.meta4065270110.mat.meta4118968099.mat.meta4127354831.mat.meta4136476578.mat.meta4147561564.mat.meta4203081856.mat.meta420772151.mat.meta4227421557.mat.meta423142768.mat.meta4237594988.mat.meta4259853465.mat.meta4272373903.mat.meta445651814.mat.meta508718230.mat.meta508911977.mat.meta514692701.mat.meta528925730.mat.meta539264358.mat.meta591534960.mat.meta632347983.mat.meta675833814.mat.meta690632569.mat.meta712937773.mat.meta728259273.mat.meta756241716.mat.meta766900231.mat.meta779439783.mat.meta80054534.mat.meta811395433.mat.meta831380125.mat.meta855384395.mat.meta880088689.mat.meta895650739.mat.meta914047818.mat.meta920657540.mat.meta948720418.mat.meta977943163.mat.meta
Model
Materials
Script
Project3D
BundleData
Tables3D
Res_newMS
ChangJing
kuafu
Sence
Moxing
Boss
BOSS_tiemuzhen
zhanhun
Moster
MS_baiwuchang
MS_haidao
MS_heiyiren
MS_jianshi
MS_qixuezhu
NPC
Player
jianxiu
shizhuang
liushan
shizhuang
jiuzhoumiaoyi
liehuoxianfeng
molong
xiaochou
xiarilianren
xueguohuanjing
yezhanshizhuang
yundongshizhuang
Wing
Wing_huihuang
xiaowujian
Sence_beifen
zhucheng
Particles
Meshes
TeXiao
Fbxs
Effect
zhaohuanshi_FBX
T4M
Editor
MeshBillb
UnusedAssets
Res_newMS
ChangJing
Particles
Meshes
TeXiao
ExcelTexts
ProjectSettings
@ -0,0 +1,441 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RuntimeInspectorNamespace
|
||||
{
|
||||
public abstract class HierarchyData
|
||||
{
|
||||
private static readonly List<HierarchyDataTransform> transformDataPool = new List<HierarchyDataTransform>( 32 );
|
||||
private static readonly List<List<HierarchyDataTransform>> childrenListPool = new List<List<HierarchyDataTransform>>( 32 );
|
||||
|
||||
public abstract string Name { get; }
|
||||
public abstract bool IsActive { get; }
|
||||
public abstract int ChildCount { get; }
|
||||
public abstract Transform BoundTransform { get; }
|
||||
|
||||
protected List<HierarchyDataTransform> children;
|
||||
protected HierarchyData parent;
|
||||
public HierarchyDataRoot Root
|
||||
{
|
||||
get
|
||||
{
|
||||
HierarchyData _parent = this;
|
||||
while( _parent.parent != null )
|
||||
_parent = _parent.parent;
|
||||
|
||||
return (HierarchyDataRoot) _parent;
|
||||
}
|
||||
}
|
||||
|
||||
protected int m_index;
|
||||
public int Index { get { return m_index; } }
|
||||
public int AbsoluteIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
int result = m_index;
|
||||
HierarchyData _parent = parent;
|
||||
while( _parent != null )
|
||||
{
|
||||
result += _parent.m_index + 1;
|
||||
_parent = _parent.parent;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
protected int m_height = 1;
|
||||
public int Height { get { return m_height; } }
|
||||
|
||||
protected int m_depth;
|
||||
public int Depth { get { return m_depth; } }
|
||||
|
||||
public bool CanExpand { get { return ChildCount > 0; } }
|
||||
public bool IsExpanded
|
||||
{
|
||||
get { return children != null; }
|
||||
set
|
||||
{
|
||||
if( IsExpanded == value )
|
||||
return;
|
||||
|
||||
if( value )
|
||||
{
|
||||
if( ChildCount == 0 )
|
||||
return;
|
||||
|
||||
PopChildrenList();
|
||||
}
|
||||
else
|
||||
PoolChildrenList();
|
||||
|
||||
int prevHeight = m_height;
|
||||
Refresh();
|
||||
|
||||
int deltaHeight = m_height - prevHeight;
|
||||
if( deltaHeight != 0 )
|
||||
{
|
||||
if( parent != null )
|
||||
{
|
||||
HierarchyData child = this;
|
||||
HierarchyData _parent = parent;
|
||||
while( _parent != null )
|
||||
{
|
||||
List<HierarchyDataTransform> children = _parent.children;
|
||||
for( int i = children.IndexOf( (HierarchyDataTransform) child ) + 1, childCount = children.Count; i < childCount; i++ )
|
||||
children[i].m_index += deltaHeight;
|
||||
|
||||
_parent.m_height += deltaHeight;
|
||||
|
||||
child = _parent;
|
||||
_parent = _parent.parent;
|
||||
}
|
||||
}
|
||||
|
||||
HierarchyDataRoot root = Root;
|
||||
if( root != null )
|
||||
root.Hierarchy.SetListViewDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool Refresh()
|
||||
{
|
||||
if( m_depth < 0 ) // This object is hidden from Hierarchy
|
||||
return false;
|
||||
|
||||
m_height = 1;
|
||||
bool hasChanged = false;
|
||||
int childCount = ChildCount;
|
||||
|
||||
if( IsExpanded )
|
||||
{
|
||||
if( childCount != children.Count )
|
||||
hasChanged = true;
|
||||
|
||||
//if( childCount == 0 ) // Issue with IsExpanded's Refresh changing iteratedIndex
|
||||
// PoolChildrenList();
|
||||
//else
|
||||
{
|
||||
RuntimeHierarchy hierarchy = null; // Root's RuntimeHierarchy will be fetched only once when it is needed
|
||||
for( int i = 0; i < childCount; i++ )
|
||||
{
|
||||
Transform child = GetChild( i );
|
||||
if( children.Count <= i )
|
||||
{
|
||||
if( hierarchy == null )
|
||||
hierarchy = Root.Hierarchy;
|
||||
|
||||
GenerateChildItem( child, i, hierarchy );
|
||||
}
|
||||
else if( children[i].BoundTransform != child )
|
||||
{
|
||||
int childIndex;
|
||||
for( childIndex = 0; childIndex < children.Count; childIndex++ )
|
||||
{
|
||||
if( children[childIndex].BoundTransform == child )
|
||||
break;
|
||||
}
|
||||
|
||||
if( childIndex == children.Count )
|
||||
{
|
||||
if( hierarchy == null )
|
||||
hierarchy = Root.Hierarchy;
|
||||
|
||||
GenerateChildItem( child, i, hierarchy );
|
||||
}
|
||||
else
|
||||
{
|
||||
HierarchyDataTransform childItem = children[childIndex];
|
||||
children.RemoveAt( childIndex );
|
||||
children.Insert( i, childItem );
|
||||
}
|
||||
|
||||
hasChanged = true;
|
||||
}
|
||||
|
||||
hasChanged |= children[i].Refresh();
|
||||
children[i].m_index = m_height - 1;
|
||||
m_height += children[i].m_height;
|
||||
}
|
||||
|
||||
for( int i = children.Count - 1; i >= childCount; i-- )
|
||||
RemoveChildItem( i );
|
||||
}
|
||||
}
|
||||
|
||||
return hasChanged;
|
||||
}
|
||||
|
||||
public HierarchyData FindDataAtIndex( int index )
|
||||
{
|
||||
int upperBound = children.Count - 1;
|
||||
if( index <= upperBound && children[index].m_index == index )
|
||||
{
|
||||
int middle = index;
|
||||
while( middle < upperBound && index == children[middle + 1].m_index )
|
||||
middle++;
|
||||
|
||||
return children[middle];
|
||||
}
|
||||
|
||||
// Binary search
|
||||
int min = 0;
|
||||
int max = upperBound;
|
||||
while( min <= max )
|
||||
{
|
||||
int middle = ( min + max ) / 2;
|
||||
int childIndex = children[middle].m_index;
|
||||
if( index == childIndex )
|
||||
{
|
||||
// Items hidden from the Hierarchy have same indices with their adjacent items
|
||||
while( middle < upperBound && index == children[middle + 1].m_index )
|
||||
middle++;
|
||||
|
||||
return children[middle];
|
||||
}
|
||||
|
||||
if( index < childIndex )
|
||||
max = middle - 1;
|
||||
else
|
||||
min = middle + 1;
|
||||
}
|
||||
|
||||
if( max < 0 )
|
||||
max = 0;
|
||||
|
||||
while( max < upperBound && index >= children[max + 1].m_index )
|
||||
max++;
|
||||
|
||||
return children[max].FindDataAtIndex( index - 1 - children[max].m_index );
|
||||
}
|
||||
|
||||
public HierarchyDataTransform FindTransform( Transform target, Transform nextInPath = null )
|
||||
{
|
||||
if( m_depth < 0 ) // This object is hidden from Hierarchy
|
||||
return null;
|
||||
|
||||
bool isInitSearch = nextInPath == null;
|
||||
if( isInitSearch )
|
||||
{
|
||||
nextInPath = ( this is HierarchyDataRootSearch ) ? target : target.root;
|
||||
|
||||
// In the current implementation, FindTransform is only called from RuntimeHierarchy.Select which
|
||||
// automatically calls RefreshContent prior to FindTransform
|
||||
//( (HierarchyDataRoot) this ).RefreshContent();
|
||||
}
|
||||
|
||||
int childIndex = IndexOf( nextInPath );
|
||||
if( childIndex < 0 )
|
||||
{
|
||||
if( isInitSearch && this is HierarchyDataRootPseudoScene )
|
||||
{
|
||||
nextInPath = target;
|
||||
childIndex = IndexOf( nextInPath );
|
||||
while( childIndex < 0 && nextInPath != null )
|
||||
{
|
||||
nextInPath = nextInPath.parent;
|
||||
childIndex = IndexOf( nextInPath );
|
||||
}
|
||||
|
||||
if( childIndex < 0 )
|
||||
return null;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
if( !CanExpand )
|
||||
return null;
|
||||
|
||||
bool wasExpanded = IsExpanded;
|
||||
if( !wasExpanded )
|
||||
IsExpanded = true;
|
||||
|
||||
HierarchyDataTransform childItem = children[childIndex];
|
||||
if( childItem.BoundTransform == target )
|
||||
return childItem;
|
||||
|
||||
HierarchyDataTransform result = null;
|
||||
if( childItem.BoundTransform == nextInPath )
|
||||
{
|
||||
Transform next = target;
|
||||
Transform parent = next.parent;
|
||||
while( parent != null && parent != nextInPath )
|
||||
{
|
||||
next = parent;
|
||||
parent = next.parent;
|
||||
}
|
||||
|
||||
if( parent != null )
|
||||
result = childItem.FindTransform( target, next );
|
||||
}
|
||||
|
||||
if( result != null && result.m_depth < 0 )
|
||||
result = null;
|
||||
|
||||
if( result == null && !wasExpanded )
|
||||
IsExpanded = false;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual HierarchyDataTransform FindTransformInVisibleChildren( Transform target, int targetDepth = -1 )
|
||||
{
|
||||
for( int i = 0; i < children.Count; i++ )
|
||||
{
|
||||
HierarchyDataTransform child = children[i];
|
||||
if( child.m_depth < 0 )
|
||||
continue;
|
||||
|
||||
if( ReferenceEquals( child.BoundTransform, target ) )
|
||||
{
|
||||
if( targetDepth <= 0 || child.m_depth == targetDepth )
|
||||
return child;
|
||||
}
|
||||
else if( ( targetDepth <= 0 || child.m_depth < targetDepth ) && child.IsExpanded && child.BoundTransform && target.IsChildOf( child.BoundTransform ) )
|
||||
{
|
||||
child = child.FindTransformInVisibleChildren( target, targetDepth );
|
||||
if( child != null )
|
||||
return child;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract Transform GetChild( int index );
|
||||
|
||||
public int IndexOf( Transform transform )
|
||||
{
|
||||
for( int i = ChildCount - 1; i >= 0; i-- )
|
||||
{
|
||||
if( ReferenceEquals( GetChild( i ), transform ) )
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void GetSiblingIndexTraversalList( List<int> traversalList )
|
||||
{
|
||||
traversalList.Clear();
|
||||
|
||||
HierarchyData current = this;
|
||||
while( current.parent != null )
|
||||
{
|
||||
traversalList.Add( current.parent.children.IndexOf( (HierarchyDataTransform) current ) );
|
||||
current = current.parent;
|
||||
}
|
||||
}
|
||||
|
||||
public HierarchyData TraverseSiblingIndexList( List<int> traversalList )
|
||||
{
|
||||
HierarchyData current = this;
|
||||
for( int i = traversalList.Count - 1; i >= 0; i-- )
|
||||
{
|
||||
int siblingIndex = traversalList[i];
|
||||
if( current.children == null || siblingIndex >= current.children.Count )
|
||||
return null;
|
||||
|
||||
current = current.children[siblingIndex];
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
private void GenerateChildItem( Transform child, int index, RuntimeHierarchy hierarchy )
|
||||
{
|
||||
bool isChildVisible = !RuntimeInspectorUtils.IgnoredTransformsInHierarchy.Contains( child );
|
||||
if( isChildVisible && hierarchy.GameObjectFilter != null )
|
||||
isChildVisible = hierarchy.GameObjectFilter( child );
|
||||
|
||||
HierarchyDataTransform childData;
|
||||
int poolIndex = transformDataPool.Count - 1;
|
||||
if( poolIndex >= 0 )
|
||||
{
|
||||
childData = transformDataPool[poolIndex];
|
||||
transformDataPool.RemoveAt( poolIndex );
|
||||
}
|
||||
else
|
||||
childData = new HierarchyDataTransform();
|
||||
|
||||
childData.Initialize( child, this is HierarchyDataRootSearch );
|
||||
childData.parent = this;
|
||||
if( isChildVisible )
|
||||
{
|
||||
childData.m_depth = m_depth + 1;
|
||||
childData.m_height = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
childData.m_depth = -1;
|
||||
childData.m_height = 0;
|
||||
}
|
||||
|
||||
children.Insert( index, childData );
|
||||
}
|
||||
|
||||
private void RemoveChildItem( int index )
|
||||
{
|
||||
children[index].PoolData();
|
||||
transformDataPool.Add( children[index] );
|
||||
children.RemoveAt( index );
|
||||
}
|
||||
|
||||
protected void PoolChildrenList()
|
||||
{
|
||||
if( children != null )
|
||||
{
|
||||
for( int i = children.Count - 1; i >= 0; i-- )
|
||||
{
|
||||
children[i].PoolData();
|
||||
transformDataPool.Add( children[i] );
|
||||
}
|
||||
|
||||
children.Clear();
|
||||
childrenListPool.Add( children );
|
||||
children = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void PopChildrenList()
|
||||
{
|
||||
int desiredSize = ChildCount;
|
||||
int bestFittingListIndex = -1;
|
||||
int bestFittingListDeltaSize = int.MaxValue;
|
||||
for( int i = childrenListPool.Count - 1; i >= 0; i-- )
|
||||
{
|
||||
int deltaSize = childrenListPool[i].Capacity - desiredSize;
|
||||
if( deltaSize < 0 )
|
||||
deltaSize = -deltaSize;
|
||||
|
||||
if( deltaSize < bestFittingListDeltaSize )
|
||||
{
|
||||
bestFittingListDeltaSize = deltaSize;
|
||||
bestFittingListIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
if( bestFittingListIndex >= 0 )
|
||||
{
|
||||
children = childrenListPool[bestFittingListIndex];
|
||||
childrenListPool.RemoveAt( bestFittingListIndex );
|
||||
}
|
||||
else
|
||||
children = new List<HierarchyDataTransform>( ChildCount );
|
||||
}
|
||||
|
||||
public static void ClearPool()
|
||||
{
|
||||
childrenListPool.Clear();
|
||||
transformDataPool.Clear();
|
||||
|
||||
if( childrenListPool.Capacity > 128 )
|
||||
childrenListPool.Capacity = 128;
|
||||
if( transformDataPool.Capacity > 128 )
|
||||
transformDataPool.Capacity = 128;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user