This repository was archived by the owner on Dec 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
src/UnityExtension/Assets/Editor/GitHub.Unity/UI Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ public abstract class Tree
20
20
[ SerializeField ] public Rect Margin = new Rect ( ) ;
21
21
[ SerializeField ] public Rect Padding = new Rect ( ) ;
22
22
23
+ [ SerializeField ] public string PathIgnoreRoot ;
23
24
[ SerializeField ] public string PathSeparator = "/" ;
24
25
[ SerializeField ] public GUIStyle FolderStyle ;
25
26
[ SerializeField ] public GUIStyle TreeNodeStyle ;
@@ -51,6 +52,7 @@ private set
51
52
52
53
public TreeNode ActiveNode { get { return activeNode ; } }
53
54
55
+
54
56
public void Load ( IEnumerable < ITreeData > data , string title )
55
57
{
56
58
var collapsedFoldersEnumerable = folders . Where ( pair => pair . Value . IsCollapsed ) . Select ( pair => pair . Key ) ;
@@ -74,7 +76,17 @@ public void Load(IEnumerable<ITreeData> data, string title)
74
76
75
77
foreach ( var d in data )
76
78
{
77
- var parts = d . Name . Split ( new [ ] { PathSeparator } , StringSplitOptions . None ) ;
79
+ var fullName = d . Name ;
80
+ if ( PathIgnoreRoot != null )
81
+ {
82
+ var indexOf = fullName . IndexOf ( PathIgnoreRoot ) ;
83
+ if ( indexOf != - 1 )
84
+ {
85
+ fullName = fullName . Substring ( indexOf + PathIgnoreRoot . Length ) ;
86
+ }
87
+ }
88
+
89
+ var parts = fullName . Split ( new [ ] { PathSeparator } , StringSplitOptions . None ) ;
78
90
for ( int i = 0 ; i < parts . Length ; i ++ )
79
91
{
80
92
var label = parts [ i ] ;
You can’t perform that action at this time.
0 commit comments