first commit

This commit is contained in:
2025-07-06 00:23:46 +02:00
commit 38f50c8819
1788 changed files with 112878 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
using System;
using UnityEngine;
using UnityEngine.UI;
namespace NitroxClient.Debuggers.Drawer.UnityUI;
public class LayoutElementDrawer : IDrawer<LayoutElement>
{
private const float LABEL_WIDTH = 100;
public void Draw(LayoutElement layoutElement)
{
using (new GUILayout.HorizontalScope())
{
GUILayout.Label("Ignore Layout", NitroxGUILayout.DrawerLabel, GUILayout.Width(LABEL_WIDTH));
NitroxGUILayout.Separator();
layoutElement.ignoreLayout = NitroxGUILayout.BoolField(layoutElement.ignoreLayout);
}
GUILayout.Space(8f);
layoutElement.minWidth = DrawToggleableFloat("Min Width", layoutElement.minWidth);
layoutElement.minHeight = DrawToggleableFloat("Min Height", layoutElement.minHeight);
layoutElement.preferredWidth = DrawToggleableFloat("Preferred Width", layoutElement.preferredWidth);
layoutElement.preferredHeight = DrawToggleableFloat("Preferred Height", layoutElement.preferredHeight);
layoutElement.flexibleWidth = DrawToggleableFloat("Flexible Width", layoutElement.flexibleWidth);
layoutElement.flexibleHeight = DrawToggleableFloat("Flexible Height", layoutElement.flexibleHeight);
using (new GUILayout.HorizontalScope())
{
GUILayout.Label("Layout Priority", NitroxGUILayout.DrawerLabel, GUILayout.Width(LABEL_WIDTH));
NitroxGUILayout.Separator();
layoutElement.layoutPriority = NitroxGUILayout.IntField(layoutElement.layoutPriority);
}
}
private static float DrawToggleableFloat(string name, float value)
{
using (new GUILayout.HorizontalScope())
{
GUILayout.Label(name, NitroxGUILayout.DrawerLabel, GUILayout.Width(LABEL_WIDTH));
NitroxGUILayout.Separator();
bool active = value >= 0;
if (GUILayout.Button(active ? "X" : " ", GUILayout.Width(25)))
{
value = active ? -1 : 0;
}
return Math.Max(-1, NitroxGUILayout.FloatField(value));
}
}
}