Guidebook links (#17162)

* Guidebook links

* warning!
This commit is contained in:
Nemanja
2023-06-07 03:51:11 -04:00
committed by GitHub
parent f7418588ec
commit ba9a369d0e
3 changed files with 118 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using Content.Client.Resources;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
@@ -196,13 +197,38 @@ public sealed partial class FancyTree : Control
if (depth == 0)
return;
depth--;
foreach (var child in item.Body.Children)
{
RecursiveSetExpanded((TreeItem) child, value, depth);
}
}
public bool TryGetIndexFromMetadata(object metadata, [NotNullWhen(true)] out int? index)
{
index = null;
foreach (var item in Items)
{
if (item.Metadata?.Equals(metadata) ?? false)
{
index = item.Index;
break;
}
}
return index != null;
}
public void ExpandParentEntries(int index)
{
Control? current = Items[index];
while (current != null)
{
if (current is TreeItem item)
item.SetExpanded(true);
current = current.Parent;
}
}
public void Clear()
{
foreach (var item in Items)