mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-05 12:52:24 +08:00
WIP
* Using publicized mono assemblies * Remaking UI from scratch. Done the Scene Explorer so far.
This commit is contained in:
35
src/UI/Widgets/TransformTree/CachedTransform.cs
Normal file
35
src/UI/Widgets/TransformTree/CachedTransform.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityExplorer.UI.Widgets
|
||||
{
|
||||
public class CachedTransform
|
||||
{
|
||||
public Transform RefTransform { get; }
|
||||
public CachedTransform Parent { get; internal set; }
|
||||
|
||||
public string Name { get; internal set; }
|
||||
public int ChildCount { get; internal set; }
|
||||
public int Depth { get; internal set; }
|
||||
|
||||
public bool Expanded { get; set; }
|
||||
|
||||
public CachedTransform(Transform transform, CachedTransform parent = null)
|
||||
{
|
||||
RefTransform = transform;
|
||||
Expanded = false;
|
||||
Parent = parent;
|
||||
Update();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
Name = RefTransform.name;
|
||||
ChildCount = RefTransform.childCount;
|
||||
Depth = Parent?.Depth + 1 ?? 0;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user