first commit
This commit is contained in:
55
NitroxClient/Debuggers/Drawer/UnityUI/AnimatorDrawer.cs
Normal file
55
NitroxClient/Debuggers/Drawer/UnityUI/AnimatorDrawer.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class AnimatorDrawer : IDrawer<Animator>
|
||||
{
|
||||
public void Draw(Animator target)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("updateMode", GUILayout.Width(200));
|
||||
target.updateMode = NitroxGUILayout.EnumPopup(target.updateMode, NitroxGUILayout.VALUE_WIDTH);
|
||||
}
|
||||
|
||||
GUILayout.Label($"Parameters [{target.parameterCount}]:");
|
||||
foreach (AnimatorControllerParameter parameter in target.parameters)
|
||||
{
|
||||
GUILayout.Space(8);
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label(parameter.name, GUILayout.Width(200));
|
||||
NitroxGUILayout.Separator();
|
||||
switch (parameter.type)
|
||||
{
|
||||
case AnimatorControllerParameterType.Float:
|
||||
float floatValue = NitroxGUILayout.FloatField(target.GetFloat(parameter.name));
|
||||
|
||||
target.SetFloat(parameter.name, GUILayout.Button("Reset") ? parameter.defaultFloat : floatValue);
|
||||
break;
|
||||
case AnimatorControllerParameterType.Int:
|
||||
int intValue = NitroxGUILayout.IntField(target.GetInteger(parameter.name));
|
||||
|
||||
target.SetInteger(parameter.name, GUILayout.Button("Reset") ? parameter.defaultInt : intValue);
|
||||
break;
|
||||
case AnimatorControllerParameterType.Bool:
|
||||
bool boolValue = NitroxGUILayout.BoolField(target.GetBool(parameter.name));
|
||||
|
||||
target.SetBool(parameter.name, GUILayout.Button("Reset") ? parameter.defaultBool : boolValue);
|
||||
break;
|
||||
case AnimatorControllerParameterType.Trigger:
|
||||
if (GUILayout.Button("Trigger"))
|
||||
{
|
||||
target.SetTrigger(parameter.name);
|
||||
}
|
||||
if (GUILayout.Button("Reset"))
|
||||
{
|
||||
target.ResetTrigger(parameter.name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class AspectRatioFitterDrawer : IDrawer<AspectRatioFitter>
|
||||
{
|
||||
public void Draw(AspectRatioFitter aspectRatioFitter)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Aspect Mode", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
aspectRatioFitter.aspectMode = NitroxGUILayout.EnumPopup(aspectRatioFitter.aspectMode);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Aspect Ratio", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
|
||||
if (aspectRatioFitter.aspectMode == AspectRatioFitter.AspectMode.None)
|
||||
{
|
||||
NitroxGUILayout.FloatField(aspectRatioFitter.aspectRatio);
|
||||
}
|
||||
else
|
||||
{
|
||||
aspectRatioFitter.aspectRatio = NitroxGUILayout.FloatField(aspectRatioFitter.aspectRatio);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
27
NitroxClient/Debuggers/Drawer/UnityUI/ButtonDrawer.cs
Normal file
27
NitroxClient/Debuggers/Drawer/UnityUI/ButtonDrawer.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using NitroxClient.Debuggers.Drawer.Unity;
|
||||
using NitroxModel.Helper;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class ButtonDrawer : IDrawer<Button>
|
||||
{
|
||||
private readonly SelectableDrawer selectableDrawer;
|
||||
private readonly UnityEventDrawer unityEventDrawer;
|
||||
|
||||
public ButtonDrawer(SelectableDrawer selectableDrawer, UnityEventDrawer unityEventDrawer)
|
||||
{
|
||||
Validate.NotNull(selectableDrawer);
|
||||
Validate.NotNull(unityEventDrawer);
|
||||
this.selectableDrawer = selectableDrawer;
|
||||
this.unityEventDrawer = unityEventDrawer;
|
||||
}
|
||||
|
||||
public void Draw(Button button)
|
||||
{
|
||||
selectableDrawer.Draw(button);
|
||||
GUILayout.Space(10);
|
||||
unityEventDrawer.Draw(button.onClick, new UnityEventDrawer.DrawOptions("OnClick()"));
|
||||
}
|
||||
}
|
111
NitroxClient/Debuggers/Drawer/UnityUI/CanvasDrawer.cs
Normal file
111
NitroxClient/Debuggers/Drawer/UnityUI/CanvasDrawer.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
using System;
|
||||
using NitroxModel.Helper;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class CanvasDrawer : IDrawer<Canvas>
|
||||
{
|
||||
private readonly SceneDebugger sceneDebugger;
|
||||
|
||||
public CanvasDrawer(SceneDebugger sceneDebugger)
|
||||
{
|
||||
Validate.NotNull(sceneDebugger);
|
||||
this.sceneDebugger = sceneDebugger;
|
||||
}
|
||||
|
||||
public void Draw(Canvas canvas)
|
||||
{
|
||||
RenderMode renderMode = canvas.renderMode;
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Raycast Target", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
renderMode = NitroxGUILayout.EnumPopup(renderMode);
|
||||
}
|
||||
|
||||
if (renderMode == RenderMode.WorldSpace)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Event Camera", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (GUILayout.Button("Jump to", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH)))
|
||||
{
|
||||
sceneDebugger.UpdateSelectedObject(canvas.worldCamera.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Sorting layer", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
canvas.sortingLayerID = NitroxGUILayout.IntField(canvas.sortingLayerID);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Order in Layer", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
canvas.sortingOrder = NitroxGUILayout.IntField(canvas.sortingOrder);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Additional Shader Channels", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
canvas.additionalShaderChannels = NitroxGUILayout.EnumPopup(canvas.additionalShaderChannels);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Pixel Perfect", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
canvas.pixelPerfect = NitroxGUILayout.BoolField(canvas.pixelPerfect);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Sort Order", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
canvas.sortingOrder = NitroxGUILayout.IntField(canvas.sortingOrder);
|
||||
}
|
||||
|
||||
if (renderMode == RenderMode.ScreenSpaceOverlay)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Target Display", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
int newTargetDisplay = NitroxGUILayout.IntField(canvas.targetDisplay);
|
||||
canvas.targetDisplay = Math.Max(0, Math.Min(8, newTargetDisplay));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Render Camera", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (GUILayout.Button("Jump to", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH)))
|
||||
{
|
||||
sceneDebugger.UpdateSelectedObject(canvas.worldCamera.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
if (canvas.worldCamera)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Plane Distance", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
canvas.planeDistance = NitroxGUILayout.FloatField(canvas.planeDistance);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
37
NitroxClient/Debuggers/Drawer/UnityUI/CanvasGroupDrawer.cs
Normal file
37
NitroxClient/Debuggers/Drawer/UnityUI/CanvasGroupDrawer.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class CanvasGroupDrawer : IDrawer<CanvasGroup>
|
||||
{
|
||||
public void Draw(CanvasGroup canvasGroup)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Alpha", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
canvasGroup.alpha = NitroxGUILayout.SliderField(canvasGroup.alpha, 0f, 1f);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Interactable", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
canvasGroup.interactable = NitroxGUILayout.BoolField(canvasGroup.interactable);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Blocks Raycasts", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
canvasGroup.blocksRaycasts = NitroxGUILayout.BoolField(canvasGroup.blocksRaycasts);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Ignore Parent Groups", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
canvasGroup.ignoreParentGroups = NitroxGUILayout.BoolField(canvasGroup.ignoreParentGroups);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class CanvasRendererDrawer : IDrawer<CanvasRenderer>
|
||||
{
|
||||
public void Draw(CanvasRenderer canvasRenderer)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Raycast Target", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
canvasRenderer.cullTransparentMesh = NitroxGUILayout.BoolField(canvasRenderer.cullTransparentMesh);
|
||||
}
|
||||
}
|
||||
}
|
105
NitroxClient/Debuggers/Drawer/UnityUI/CanvasScalerDrawer.cs
Normal file
105
NitroxClient/Debuggers/Drawer/UnityUI/CanvasScalerDrawer.cs
Normal file
@@ -0,0 +1,105 @@
|
||||
using NitroxClient.Debuggers.Drawer.Unity;
|
||||
using NitroxModel.Helper;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class CanvasScalerDrawer : IDrawer<CanvasScaler>
|
||||
{
|
||||
private readonly VectorDrawer vectorDrawer;
|
||||
|
||||
public CanvasScalerDrawer(VectorDrawer vectorDrawer)
|
||||
{
|
||||
Validate.NotNull(vectorDrawer);
|
||||
|
||||
this.vectorDrawer = vectorDrawer;
|
||||
}
|
||||
|
||||
public void Draw(CanvasScaler canvasScaler)
|
||||
{
|
||||
if (canvasScaler.GetComponent<Canvas>().renderMode == RenderMode.WorldSpace)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Dynamic Pixels Per Unit", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
canvasScaler.dynamicPixelsPerUnit = NitroxGUILayout.FloatField(canvasScaler.dynamicPixelsPerUnit);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("UI Scale Mode", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
canvasScaler.uiScaleMode = NitroxGUILayout.EnumPopup(canvasScaler.uiScaleMode);
|
||||
}
|
||||
|
||||
if (canvasScaler.uiScaleMode == CanvasScaler.ScaleMode.ConstantPixelSize)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Scale Factor", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
canvasScaler.scaleFactor = NitroxGUILayout.FloatField(canvasScaler.scaleFactor);
|
||||
}
|
||||
}
|
||||
else if (canvasScaler.uiScaleMode == CanvasScaler.ScaleMode.ScaleWithScreenSize)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Reference Resolution", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
canvasScaler.referenceResolution = vectorDrawer.Draw(canvasScaler.referenceResolution);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Screen Match Mode", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
canvasScaler.screenMatchMode = NitroxGUILayout.EnumPopup(canvasScaler.screenMatchMode);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Match", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
float newMatchValue = NitroxGUILayout.FloatField(canvasScaler.matchWidthOrHeight);
|
||||
canvasScaler.matchWidthOrHeight = UnityEngine.Mathf.Max(0, UnityEngine.Mathf.Min(newMatchValue, 1));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Physical Unit", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
canvasScaler.physicalUnit = NitroxGUILayout.EnumPopup(canvasScaler.physicalUnit);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Fallback Screen DPI", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
canvasScaler.matchWidthOrHeight = NitroxGUILayout.FloatField(canvasScaler.fallbackScreenDPI);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Default Sprite DPI", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
float newDefaultSpriteDPI = NitroxGUILayout.FloatField(canvasScaler.defaultSpriteDPI);
|
||||
canvasScaler.defaultSpriteDPI = UnityEngine.Mathf.Max(1, newDefaultSpriteDPI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Reference Pixels Per Unit", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
canvasScaler.referencePixelsPerUnit = NitroxGUILayout.FloatField(canvasScaler.referencePixelsPerUnit);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class ContentSizeFitterDrawer : IDrawer<ContentSizeFitter>
|
||||
{
|
||||
public void Draw(ContentSizeFitter contentSizeFitter)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Horizontal Fit", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
contentSizeFitter.horizontalFit = NitroxGUILayout.EnumPopup(contentSizeFitter.horizontalFit);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Vertical Fit", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
contentSizeFitter.verticalFit = NitroxGUILayout.EnumPopup(contentSizeFitter.verticalFit);
|
||||
}
|
||||
}
|
||||
}
|
111
NitroxClient/Debuggers/Drawer/UnityUI/DropdownDrawer.cs
Normal file
111
NitroxClient/Debuggers/Drawer/UnityUI/DropdownDrawer.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
using System;
|
||||
using NitroxModel.Core;
|
||||
using NitroxModel.Helper;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class DropdownDrawer : IDrawer<Dropdown>
|
||||
{
|
||||
private readonly SelectableDrawer selectableDrawer;
|
||||
private readonly SceneDebugger sceneDebugger;
|
||||
|
||||
public DropdownDrawer(SceneDebugger sceneDebugger, SelectableDrawer selectableDrawer)
|
||||
{
|
||||
Validate.NotNull(sceneDebugger);
|
||||
Validate.NotNull(selectableDrawer);
|
||||
|
||||
this.selectableDrawer = selectableDrawer;
|
||||
this.sceneDebugger = sceneDebugger;
|
||||
}
|
||||
|
||||
public void Draw(Dropdown dropdown)
|
||||
{
|
||||
selectableDrawer.Draw(dropdown);
|
||||
|
||||
GUILayout.Space(NitroxGUILayout.DEFAULT_SPACE);
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Template", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (GUILayout.Button("Jump to", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH)))
|
||||
{
|
||||
sceneDebugger.JumpToComponent(dropdown.template);
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Caption Text", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (GUILayout.Button("Jump to", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH)))
|
||||
{
|
||||
sceneDebugger.JumpToComponent(dropdown.captionText);
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Caption Image", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (GUILayout.Button("Jump to", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH)))
|
||||
{
|
||||
sceneDebugger.JumpToComponent(dropdown.captionImage);
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.Space(NitroxGUILayout.DEFAULT_SPACE);
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Item Text", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (GUILayout.Button("Jump to", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH)))
|
||||
{
|
||||
sceneDebugger.JumpToComponent(dropdown.itemText);
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Item Image", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (GUILayout.Button("Jump to", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH)))
|
||||
{
|
||||
sceneDebugger.JumpToComponent(dropdown.itemImage);
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.Space(NitroxGUILayout.DEFAULT_SPACE);
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Value", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
dropdown.value = NitroxGUILayout.IntField(dropdown.value);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Alpha Fade Speed", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
dropdown.alphaFadeSpeed = NitroxGUILayout.FloatField(dropdown.alphaFadeSpeed);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Options", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
GUILayout.Button("Unsupported", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("On Value Changed", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
GUILayout.Button("Unsupported", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
}
|
||||
}
|
||||
}
|
57
NitroxClient/Debuggers/Drawer/UnityUI/EventTriggerDrawer.cs
Normal file
57
NitroxClient/Debuggers/Drawer/UnityUI/EventTriggerDrawer.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using NitroxModel.Helper;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class EventTriggerDrawer : IDrawer<EventTrigger>
|
||||
{
|
||||
private readonly SceneDebugger sceneDebugger;
|
||||
|
||||
public EventTriggerDrawer(SceneDebugger sceneDebugger)
|
||||
{
|
||||
Validate.NotNull(sceneDebugger);
|
||||
|
||||
this.sceneDebugger = sceneDebugger;
|
||||
}
|
||||
|
||||
public void Draw(EventTrigger eventTrigger)
|
||||
{
|
||||
foreach (EventTrigger.Entry entry in eventTrigger.triggers.OrderBy(x => x.eventID))
|
||||
{
|
||||
using (new GUILayout.VerticalScope("box"))
|
||||
{
|
||||
GUILayout.Label($"EventTriggerType.{Enum.GetName(typeof(EventTriggerType), entry.eventID)}");
|
||||
|
||||
for (int i = 0; i < entry.callback.GetPersistentEventCount(); i++)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
object target = entry.callback.GetPersistentTarget(i);
|
||||
|
||||
switch (target)
|
||||
{
|
||||
case Component component:
|
||||
if (GUILayout.Button($"Jump to {component.name}", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH)))
|
||||
{
|
||||
sceneDebugger.JumpToComponent(component);
|
||||
}
|
||||
NitroxGUILayout.Separator();
|
||||
GUILayout.TextField($"{component.GetType().Name}.{entry.callback.GetPersistentMethodName(i)}()", GUILayout.ExpandWidth(true), GUILayout.MaxWidth(250));
|
||||
break;
|
||||
default:
|
||||
GUILayout.TextField($"[{target.GetType().Name}]: {target}", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
GUILayout.TextField($"{entry.callback.GetPersistentMethodName(i)}()", GUILayout.ExpandWidth(true), GUILayout.MaxWidth(250));
|
||||
break;
|
||||
}
|
||||
}
|
||||
NitroxGUILayout.Separator();
|
||||
}
|
||||
}
|
||||
NitroxGUILayout.Separator();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class GraphicRaycasterDrawer : IDrawer<GraphicRaycaster>
|
||||
{
|
||||
public void Draw(GraphicRaycaster graphicRaycaster)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Ignore Reversed Graphics", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
graphicRaycaster.ignoreReversedGraphics = NitroxGUILayout.BoolField(graphicRaycaster.ignoreReversedGraphics);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Blocking Objects", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
graphicRaycaster.blockingObjects = NitroxGUILayout.EnumPopup(graphicRaycaster.blockingObjects);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using NitroxClient.Debuggers.Drawer.Unity;
|
||||
using NitroxModel.Helper;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class GridLayoutGroupDrawer : IDrawer<GridLayoutGroup>
|
||||
{
|
||||
private readonly VectorDrawer vectorDrawer;
|
||||
private readonly RectDrawer rectDrawer;
|
||||
|
||||
public GridLayoutGroupDrawer(VectorDrawer vectorDrawer, RectDrawer rectDrawer)
|
||||
{
|
||||
Validate.NotNull(vectorDrawer);
|
||||
Validate.NotNull(rectDrawer);
|
||||
|
||||
this.vectorDrawer = vectorDrawer;
|
||||
this.rectDrawer = rectDrawer;
|
||||
}
|
||||
|
||||
public void Draw(GridLayoutGroup gridLayoutGroup)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Padding", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
gridLayoutGroup.padding = rectDrawer.Draw(gridLayoutGroup.padding);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Cell Size", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
gridLayoutGroup.cellSize = vectorDrawer.Draw(gridLayoutGroup.cellSize);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Spacing", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
gridLayoutGroup.spacing = vectorDrawer.Draw(gridLayoutGroup.spacing);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Start Corner", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
gridLayoutGroup.startCorner = NitroxGUILayout.EnumPopup(gridLayoutGroup.startCorner);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Start Axis", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
gridLayoutGroup.startAxis = NitroxGUILayout.EnumPopup(gridLayoutGroup.startAxis);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Child Alignment", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
gridLayoutGroup.childAlignment = NitroxGUILayout.EnumPopup(gridLayoutGroup.childAlignment);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Constraint", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
gridLayoutGroup.constraint = NitroxGUILayout.EnumPopup(gridLayoutGroup.constraint);
|
||||
}
|
||||
|
||||
if (gridLayoutGroup.constraint != GridLayoutGroup.Constraint.Flexible)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Constraint Count", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
gridLayoutGroup.constraintCount = Math.Max(1, NitroxGUILayout.IntField(gridLayoutGroup.constraintCount));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
100
NitroxClient/Debuggers/Drawer/UnityUI/ImageDrawer.cs
Normal file
100
NitroxClient/Debuggers/Drawer/UnityUI/ImageDrawer.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using NitroxClient.Debuggers.Drawer.Unity;
|
||||
using NitroxModel.Helper;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class ImageDrawer : IDrawer<Image>, IDrawer<RawImage>
|
||||
{
|
||||
private readonly ColorDrawer colorDrawer;
|
||||
private readonly MaterialDrawer materialDrawer;
|
||||
private readonly RectDrawer rectDrawer;
|
||||
|
||||
public ImageDrawer(ColorDrawer colorDrawer, MaterialDrawer materialDrawer, RectDrawer rectDrawer)
|
||||
{
|
||||
Validate.NotNull(colorDrawer);
|
||||
Validate.NotNull(materialDrawer);
|
||||
Validate.NotNull(rectDrawer);
|
||||
|
||||
this.colorDrawer = colorDrawer;
|
||||
this.materialDrawer = materialDrawer;
|
||||
this.rectDrawer = rectDrawer;
|
||||
}
|
||||
|
||||
public static void DrawTexture(Texture texture)
|
||||
{
|
||||
GUIStyle style = new("box") { fixedHeight = texture.height * (250f / texture.width), fixedWidth = 250 };
|
||||
GUILayout.Box(texture, style);
|
||||
}
|
||||
|
||||
public void Draw(Image image)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Image", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
DrawTexture(image.mainTexture);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Color", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
image.color = colorDrawer.Draw(image.color);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Material", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
image.material = materialDrawer.Draw(image.material);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Raycast Target", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
image.raycastTarget = NitroxGUILayout.BoolField(image.raycastTarget);
|
||||
}
|
||||
}
|
||||
|
||||
public void Draw(RawImage rawImage)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Image", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
DrawTexture(rawImage.mainTexture);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Color", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
rawImage.color = colorDrawer.Draw(rawImage.color);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Material", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
rawImage.material = materialDrawer.Draw(rawImage.material);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Raycast Target", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
rawImage.raycastTarget = NitroxGUILayout.BoolField(rawImage.raycastTarget);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("UV Rect", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
rawImage.uvRect = rectDrawer.Draw(rawImage.uvRect);
|
||||
}
|
||||
}
|
||||
}
|
151
NitroxClient/Debuggers/Drawer/UnityUI/InputFieldDrawer.cs
Normal file
151
NitroxClient/Debuggers/Drawer/UnityUI/InputFieldDrawer.cs
Normal file
@@ -0,0 +1,151 @@
|
||||
using NitroxClient.Debuggers.Drawer.Unity;
|
||||
using NitroxModel.Helper;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class InputFieldDrawer : IDrawer<InputField>
|
||||
{
|
||||
private readonly SceneDebugger sceneDebugger;
|
||||
private readonly SelectableDrawer selectableDrawer;
|
||||
private readonly ColorDrawer colorDrawer;
|
||||
|
||||
public InputFieldDrawer(SceneDebugger sceneDebugger, SelectableDrawer selectableDrawer, ColorDrawer colorDrawer)
|
||||
{
|
||||
Validate.NotNull(sceneDebugger);
|
||||
Validate.NotNull(selectableDrawer);
|
||||
Validate.NotNull(colorDrawer);
|
||||
|
||||
this.sceneDebugger = sceneDebugger;
|
||||
this.selectableDrawer = selectableDrawer;
|
||||
this.colorDrawer = colorDrawer;
|
||||
}
|
||||
|
||||
public void Draw(InputField inputField)
|
||||
{
|
||||
selectableDrawer.Draw(inputField);
|
||||
|
||||
GUILayout.Space(NitroxGUILayout.DEFAULT_SPACE);
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Text Component", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (GUILayout.Button("Jump to", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH)))
|
||||
{
|
||||
sceneDebugger.JumpToComponent(inputField.textComponent);
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Text", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
inputField.text = GUILayout.TextArea(inputField.text, GUILayout.MaxHeight(100));
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Character Limit", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
inputField.characterLimit = NitroxGUILayout.IntField(inputField.characterLimit);
|
||||
}
|
||||
|
||||
GUILayout.Space(NitroxGUILayout.DEFAULT_SPACE);
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Content Type", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
inputField.contentType = NitroxGUILayout.EnumPopup(inputField.contentType);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Line Type", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
inputField.lineType = NitroxGUILayout.EnumPopup(inputField.lineType);
|
||||
}
|
||||
|
||||
GUILayout.Space(NitroxGUILayout.DEFAULT_SPACE);
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Placeholder", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (GUILayout.Button("Jump to", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH)))
|
||||
{
|
||||
sceneDebugger.JumpToComponent(inputField.placeholder);
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Caret Blink Rate", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
inputField.caretBlinkRate = NitroxGUILayout.SliderField(inputField.caretBlinkRate, 0f, 4f);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Caret Width", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
inputField.caretWidth = NitroxGUILayout.SliderField(inputField.caretWidth, 1, 5);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Custom Caret Color", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
inputField.customCaretColor = NitroxGUILayout.BoolField(inputField.customCaretColor);
|
||||
}
|
||||
|
||||
if (inputField.customCaretColor)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Caret Color", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
inputField.caretColor = colorDrawer.Draw(inputField.caretColor);
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Selection Color", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
inputField.selectionColor = colorDrawer.Draw(inputField.selectionColor);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Hide Mobile Input", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
inputField.shouldHideMobileInput = NitroxGUILayout.BoolField(inputField.shouldHideMobileInput);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Read Only", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
inputField.readOnly = NitroxGUILayout.BoolField(inputField.readOnly);
|
||||
}
|
||||
|
||||
GUILayout.Space(NitroxGUILayout.DEFAULT_SPACE);
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("On Value Changed", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
GUILayout.Button("Unsupported", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("On End Edit", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
GUILayout.Button("Unsupported", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
}
|
||||
}
|
||||
}
|
55
NitroxClient/Debuggers/Drawer/UnityUI/LayoutElementDrawer.cs
Normal file
55
NitroxClient/Debuggers/Drawer/UnityUI/LayoutElementDrawer.cs
Normal 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));
|
||||
}
|
||||
}
|
||||
}
|
77
NitroxClient/Debuggers/Drawer/UnityUI/LayoutGroupDrawer.cs
Normal file
77
NitroxClient/Debuggers/Drawer/UnityUI/LayoutGroupDrawer.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using NitroxClient.Debuggers.Drawer.Unity;
|
||||
using NitroxModel.Helper;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class LayoutGroupDrawer : IDrawer<HorizontalLayoutGroup>, IDrawer<VerticalLayoutGroup>
|
||||
{
|
||||
private readonly RectDrawer rectDrawer;
|
||||
|
||||
public LayoutGroupDrawer(RectDrawer rectDrawer)
|
||||
{
|
||||
Validate.NotNull(rectDrawer);
|
||||
|
||||
this.rectDrawer = rectDrawer;
|
||||
}
|
||||
|
||||
public void Draw(HorizontalLayoutGroup target)
|
||||
{
|
||||
DrawLayoutGroup(target);
|
||||
}
|
||||
|
||||
public void Draw(VerticalLayoutGroup target)
|
||||
{
|
||||
DrawLayoutGroup(target);
|
||||
}
|
||||
|
||||
private void DrawLayoutGroup(HorizontalOrVerticalLayoutGroup layoutGroup)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Padding", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
rectDrawer.Draw(layoutGroup.padding);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Spacing", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
layoutGroup.spacing = NitroxGUILayout.FloatField(layoutGroup.spacing);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Child Alignment", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
layoutGroup.childAlignment = NitroxGUILayout.EnumPopup(layoutGroup.childAlignment);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Control Child Size", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
layoutGroup.childControlWidth = NitroxGUILayout.BoolField(layoutGroup.childControlWidth, "Width");
|
||||
layoutGroup.childControlHeight = NitroxGUILayout.BoolField(layoutGroup.childControlHeight, "Height");
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Use Child Scale", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
layoutGroup.childScaleWidth = NitroxGUILayout.BoolField(layoutGroup.childScaleWidth, "Width");
|
||||
layoutGroup.childScaleHeight = NitroxGUILayout.BoolField(layoutGroup.childScaleHeight, "Height");
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Child Force Expand", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
layoutGroup.childForceExpandWidth = NitroxGUILayout.BoolField(layoutGroup.childForceExpandWidth, "Width");
|
||||
layoutGroup.childForceExpandHeight = NitroxGUILayout.BoolField(layoutGroup.childForceExpandHeight, "Height");
|
||||
}
|
||||
}
|
||||
}
|
25
NitroxClient/Debuggers/Drawer/UnityUI/MaskDrawer.cs
Normal file
25
NitroxClient/Debuggers/Drawer/UnityUI/MaskDrawer.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class MaskDrawer : IDrawer<Mask>, IDrawer<RectMask2D>
|
||||
{
|
||||
public Type[] ApplicableTypes { get; } = { typeof(Mask), typeof(RectMask2D) };
|
||||
|
||||
public void Draw(Mask mask)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Show Mask Graphic", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
mask.showMaskGraphic = NitroxGUILayout.BoolField(mask.showMaskGraphic);
|
||||
}
|
||||
}
|
||||
|
||||
public void Draw(RectMask2D target)
|
||||
{
|
||||
// RectMask2D has no fields in the editor.
|
||||
}
|
||||
}
|
207
NitroxClient/Debuggers/Drawer/UnityUI/RectTransformDrawer.cs
Normal file
207
NitroxClient/Debuggers/Drawer/UnityUI/RectTransformDrawer.cs
Normal file
@@ -0,0 +1,207 @@
|
||||
using System;
|
||||
using NitroxClient.Debuggers.Drawer.Unity;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class RectTransformDrawer : IDrawer<RectTransform>
|
||||
{
|
||||
private readonly VectorDrawer vectorDrawer;
|
||||
private const float LABEL_WIDTH = 120;
|
||||
private const float VECTOR_MAX_WIDTH = 405;
|
||||
|
||||
public RectTransformDrawer(VectorDrawer vectorDrawer)
|
||||
{
|
||||
this.vectorDrawer = vectorDrawer;
|
||||
}
|
||||
|
||||
public void Draw(RectTransform rectTransform)
|
||||
{
|
||||
using (new GUILayout.VerticalScope())
|
||||
{
|
||||
//TODO: Implement position display like the Unity editor
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Anchored Position", NitroxGUILayout.DrawerLabel, GUILayout.Width(LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
rectTransform.anchoredPosition = vectorDrawer.Draw(rectTransform.anchoredPosition, new VectorDrawer.DrawOptions(VECTOR_MAX_WIDTH));
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Local Position", NitroxGUILayout.DrawerLabel, GUILayout.Width(LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
rectTransform.localPosition = vectorDrawer.Draw(rectTransform.localPosition, new VectorDrawer.DrawOptions(VECTOR_MAX_WIDTH));
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Local Rotation", NitroxGUILayout.DrawerLabel, GUILayout.Width(LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
rectTransform.localRotation = Quaternion.Euler(vectorDrawer.Draw(rectTransform.localRotation.eulerAngles, new VectorDrawer.DrawOptions(VECTOR_MAX_WIDTH)));
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Local Scale", NitroxGUILayout.DrawerLabel, GUILayout.Width(LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
rectTransform.localScale = vectorDrawer.Draw(rectTransform.localScale, new VectorDrawer.DrawOptions(VECTOR_MAX_WIDTH));
|
||||
}
|
||||
|
||||
GUILayout.Space(20);
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Size", NitroxGUILayout.DrawerLabel, GUILayout.Width(LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
rectTransform.sizeDelta = vectorDrawer.Draw(rectTransform.sizeDelta, new VectorDrawer.DrawOptions(VECTOR_MAX_WIDTH));
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Anchor", NitroxGUILayout.DrawerLabel, GUILayout.Width(LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
AnchorMode anchorMode = VectorToAnchorMode(rectTransform.anchorMin, rectTransform.anchorMax);
|
||||
|
||||
if (anchorMode == AnchorMode.NONE)
|
||||
{
|
||||
vectorDrawer.Draw(rectTransform.anchorMin, new VectorDrawer.DrawOptions(VECTOR_MAX_WIDTH * 0.5f));
|
||||
vectorDrawer.Draw(rectTransform.anchorMax, new VectorDrawer.DrawOptions(VECTOR_MAX_WIDTH * 0.5f));
|
||||
}
|
||||
else
|
||||
{
|
||||
anchorMode = NitroxGUILayout.EnumPopup(anchorMode, VECTOR_MAX_WIDTH);
|
||||
|
||||
// Vector2[] anchorVectors = AnchorModeToVector(anchorMode);
|
||||
// rectTransform.anchorMin = anchorVectors[0];
|
||||
// rectTransform.anchorMax = anchorVectors[1];
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Pivot", NitroxGUILayout.DrawerLabel, GUILayout.Width(LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
rectTransform.pivot = vectorDrawer.Draw(rectTransform.pivot, new VectorDrawer.DrawOptions(VECTOR_MAX_WIDTH));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum AnchorMode
|
||||
{
|
||||
TOP_LEFT,
|
||||
TOP_CENTER,
|
||||
TOP_RIGHT,
|
||||
TOP_STRETCH,
|
||||
MIDDLE_LEFT,
|
||||
MIDDLE_CENTER,
|
||||
MIDDLE_RIGHT,
|
||||
MIDDLE_STRETCH,
|
||||
BOTTOM_LEFT,
|
||||
BOTTOM_CENTER,
|
||||
BOTTOM_RIGHT,
|
||||
BOTTOM_STRETCH,
|
||||
STRETCH_LEFT,
|
||||
STRETCH_CENTER,
|
||||
STRETCH_RIGHT,
|
||||
STRETCH_STRETCH,
|
||||
NONE
|
||||
}
|
||||
|
||||
private const float FLOAT_TOLERANCE = 0.0001f;
|
||||
|
||||
#pragma warning disable IDE0011 // ReSharper disable EnforceIfStatementBraces
|
||||
private static AnchorMode VectorToAnchorMode(Vector2 min, Vector2 max)
|
||||
{
|
||||
bool minXNull = min.x == 0f;
|
||||
bool minXHalf = Math.Abs(min.x - 0.5f) < FLOAT_TOLERANCE;
|
||||
bool minXFull = Math.Abs(min.x - 1f) < FLOAT_TOLERANCE;
|
||||
|
||||
bool minYNull = min.y == 0f;
|
||||
bool minYHalf = Math.Abs(min.y - 0.5f) < FLOAT_TOLERANCE;
|
||||
bool minYFull = Math.Abs(min.y - 1f) < FLOAT_TOLERANCE;
|
||||
|
||||
bool maxXNull = max.x == 0f;
|
||||
bool maxXHalf = Math.Abs(max.x - 0.5f) < FLOAT_TOLERANCE;
|
||||
bool maxXFull = Math.Abs(max.x - 1f) < FLOAT_TOLERANCE;
|
||||
|
||||
bool maxYNull = max.y == 0f;
|
||||
bool maxYHalf = Math.Abs(max.y - 0.5f) < FLOAT_TOLERANCE;
|
||||
bool maxYFull = Math.Abs(max.y - 1f) < FLOAT_TOLERANCE;
|
||||
|
||||
if (minYFull && maxYFull)
|
||||
{
|
||||
if (minXNull && maxXNull)
|
||||
return AnchorMode.TOP_LEFT;
|
||||
if (minXHalf && maxXHalf)
|
||||
|
||||
return AnchorMode.TOP_CENTER;
|
||||
if (minXFull && maxXFull)
|
||||
return AnchorMode.TOP_RIGHT;
|
||||
if (minXNull && maxXFull)
|
||||
return AnchorMode.TOP_STRETCH;
|
||||
}
|
||||
|
||||
if (minYHalf && maxYHalf)
|
||||
{
|
||||
if (minXNull && maxXNull)
|
||||
return AnchorMode.MIDDLE_LEFT;
|
||||
if (minXHalf && maxXHalf)
|
||||
return AnchorMode.MIDDLE_CENTER;
|
||||
if (minXFull && maxXFull)
|
||||
return AnchorMode.MIDDLE_RIGHT;
|
||||
if (minXNull && maxXFull)
|
||||
return AnchorMode.MIDDLE_STRETCH;
|
||||
}
|
||||
|
||||
if (minYNull && maxYNull)
|
||||
{
|
||||
if (minXNull && maxXNull)
|
||||
return AnchorMode.BOTTOM_LEFT;
|
||||
if (minXHalf && maxXHalf)
|
||||
return AnchorMode.BOTTOM_CENTER;
|
||||
if (minXFull && maxXFull)
|
||||
return AnchorMode.BOTTOM_RIGHT;
|
||||
if (minXNull && maxXFull)
|
||||
return AnchorMode.BOTTOM_STRETCH;
|
||||
}
|
||||
|
||||
if (minYNull && maxYFull)
|
||||
{
|
||||
if (minXNull && maxXNull)
|
||||
return AnchorMode.STRETCH_LEFT;
|
||||
if (minXHalf && maxXHalf)
|
||||
return AnchorMode.STRETCH_CENTER;
|
||||
if (minXFull && maxXFull)
|
||||
return AnchorMode.STRETCH_RIGHT;
|
||||
if (minXNull && maxXFull)
|
||||
return AnchorMode.STRETCH_STRETCH;
|
||||
}
|
||||
|
||||
return AnchorMode.NONE;
|
||||
}
|
||||
#pragma warning restore IDE0011 // ReSharper restore EnforceIfStatementBraces
|
||||
|
||||
private static Vector2[] AnchorModeToVector(AnchorMode anchorMode) =>
|
||||
anchorMode switch
|
||||
{
|
||||
AnchorMode.TOP_LEFT => [new Vector2(0, 1), new Vector2(0, 1)],
|
||||
AnchorMode.TOP_CENTER => [new Vector2(0.5f, 1), new Vector2(0.5f, 1)],
|
||||
AnchorMode.TOP_RIGHT => [new Vector2(1, 1), new Vector2(1, 1)],
|
||||
AnchorMode.TOP_STRETCH => [new Vector2(0, 1), new Vector2(1, 1)],
|
||||
AnchorMode.MIDDLE_LEFT => [new Vector2(0, 0.5f), new Vector2(0, 0.5f)],
|
||||
AnchorMode.MIDDLE_CENTER => [new Vector2(0.5f, 1), new Vector2(0.5f, 0.5f)],
|
||||
AnchorMode.MIDDLE_RIGHT => [new Vector2(1, 0.5f), new Vector2(1, 0.5f)],
|
||||
AnchorMode.MIDDLE_STRETCH => [new Vector2(0, 0.5f), new Vector2(1, 0.5f)],
|
||||
AnchorMode.BOTTOM_LEFT => [new Vector2(0, 0), new Vector2(0, 0)],
|
||||
AnchorMode.BOTTOM_CENTER => [new Vector2(0.5f, 0), new Vector2(0.5f, 0)],
|
||||
AnchorMode.BOTTOM_RIGHT => [new Vector2(1, 0), new Vector2(1, 0)],
|
||||
AnchorMode.BOTTOM_STRETCH => [new Vector2(0, 0), new Vector2(1, 0)],
|
||||
AnchorMode.STRETCH_LEFT => [new Vector2(0, 0), new Vector2(0, 1)],
|
||||
AnchorMode.STRETCH_CENTER => [new Vector2(0.5f, 0), new Vector2(0.5f, 1)],
|
||||
AnchorMode.STRETCH_RIGHT => [new Vector2(1, 0), new Vector2(1, 1)],
|
||||
AnchorMode.STRETCH_STRETCH => [new Vector2(0, 0), new Vector2(1, 1)],
|
||||
AnchorMode.NONE => throw new ArgumentOutOfRangeException(),
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
}
|
121
NitroxClient/Debuggers/Drawer/UnityUI/ScrollRectDrawer.cs
Normal file
121
NitroxClient/Debuggers/Drawer/UnityUI/ScrollRectDrawer.cs
Normal file
@@ -0,0 +1,121 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class ScrollRectDrawer : IDrawer<ScrollRect>
|
||||
{
|
||||
private readonly SceneDebugger sceneDebugger;
|
||||
|
||||
public ScrollRectDrawer(SceneDebugger sceneDebugger)
|
||||
{
|
||||
this.sceneDebugger = sceneDebugger;
|
||||
}
|
||||
|
||||
public void Draw(ScrollRect scrollRect)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Content", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (GUILayout.Button("Jump to", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH)))
|
||||
{
|
||||
sceneDebugger.JumpToComponent(scrollRect.content);
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Horizontal", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
scrollRect.horizontal = NitroxGUILayout.BoolField(scrollRect.horizontal);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Vertical", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
scrollRect.vertical = NitroxGUILayout.BoolField(scrollRect.vertical);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("MovementType", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
scrollRect.movementType = NitroxGUILayout.EnumPopup(scrollRect.movementType);
|
||||
}
|
||||
|
||||
if (scrollRect.movementType == ScrollRect.MovementType.Elastic)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Elasticity", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
scrollRect.elasticity = NitroxGUILayout.FloatField(scrollRect.elasticity);
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Inertia", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
scrollRect.inertia = NitroxGUILayout.BoolField(scrollRect.inertia);
|
||||
}
|
||||
|
||||
if (scrollRect.inertia)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Deceleration Rate", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
scrollRect.decelerationRate = NitroxGUILayout.FloatField(scrollRect.decelerationRate);
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Scroll Sensitivity", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
scrollRect.scrollSensitivity = NitroxGUILayout.FloatField(scrollRect.scrollSensitivity);
|
||||
}
|
||||
|
||||
GUILayout.Space(8f);
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Viewport", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (GUILayout.Button("Jump to", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH)))
|
||||
{
|
||||
sceneDebugger.JumpToComponent(scrollRect.viewport);
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Horizontal Scrollbar", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (GUILayout.Button("Jump to", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH)))
|
||||
{
|
||||
sceneDebugger.JumpToComponent(scrollRect.horizontalScrollbar);
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Vertical Scrollbar", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (GUILayout.Button("Jump to", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH)))
|
||||
{
|
||||
sceneDebugger.JumpToComponent(scrollRect.verticalScrollbar);
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("On Value Changed", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
GUILayout.Button("Unsupported", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
}
|
||||
}
|
||||
}
|
68
NitroxClient/Debuggers/Drawer/UnityUI/ScrollbarDrawer.cs
Normal file
68
NitroxClient/Debuggers/Drawer/UnityUI/ScrollbarDrawer.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class ScrollbarDrawer : IDrawer<Scrollbar>
|
||||
{
|
||||
private readonly SceneDebugger sceneDebugger;
|
||||
private readonly SelectableDrawer selectableDrawer;
|
||||
|
||||
public ScrollbarDrawer(SceneDebugger sceneDebugger, SelectableDrawer selectableDrawer)
|
||||
{
|
||||
this.sceneDebugger = sceneDebugger;
|
||||
this.selectableDrawer = selectableDrawer;
|
||||
}
|
||||
|
||||
public void Draw(Scrollbar scrollbar)
|
||||
{
|
||||
selectableDrawer.Draw(scrollbar);
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Handle Rect", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (GUILayout.Button("Jump to", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH)))
|
||||
{
|
||||
sceneDebugger.JumpToComponent(scrollbar.handleRect);
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Direction", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
scrollbar.direction = NitroxGUILayout.EnumPopup(scrollbar.direction);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Value", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
scrollbar.value = NitroxGUILayout.SliderField(scrollbar.value, 0f, 1f);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Size", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
scrollbar.size = NitroxGUILayout.SliderField(scrollbar.size, 0f, 1f);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Number Of Steps", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
scrollbar.numberOfSteps = NitroxGUILayout.SliderField(scrollbar.numberOfSteps, 0, 11);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("On Value Changed", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
GUILayout.Button("Unsupported", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
}
|
||||
}
|
||||
}
|
241
NitroxClient/Debuggers/Drawer/UnityUI/SelectableDrawer.cs
Normal file
241
NitroxClient/Debuggers/Drawer/UnityUI/SelectableDrawer.cs
Normal file
@@ -0,0 +1,241 @@
|
||||
using NitroxClient.Debuggers.Drawer.Unity;
|
||||
using NitroxModel.Helper;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class SelectableDrawer : IDrawer<Selectable>
|
||||
{
|
||||
private readonly SceneDebugger sceneDebugger;
|
||||
private readonly ColorDrawer colorDrawer;
|
||||
|
||||
public SelectableDrawer(SceneDebugger sceneDebugger, ColorDrawer colorDrawer)
|
||||
{
|
||||
Validate.NotNull(sceneDebugger);
|
||||
Validate.NotNull(colorDrawer);
|
||||
|
||||
this.sceneDebugger = sceneDebugger;
|
||||
this.colorDrawer = colorDrawer;
|
||||
}
|
||||
|
||||
public void Draw(Selectable selectable)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Interactable", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
selectable.interactable = NitroxGUILayout.BoolField(selectable.interactable);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Transition", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
selectable.transition = NitroxGUILayout.EnumPopup(selectable.transition);
|
||||
}
|
||||
|
||||
switch (selectable.transition)
|
||||
{
|
||||
case Selectable.Transition.ColorTint:
|
||||
DrawTransitionColorTint(selectable);
|
||||
break;
|
||||
case Selectable.Transition.SpriteSwap:
|
||||
DrawTransitionSpriteSwap(selectable);
|
||||
break;
|
||||
case Selectable.Transition.Animation:
|
||||
DrawTransitionAnimation(selectable);
|
||||
break;
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Navigation", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
NitroxGUILayout.EnumPopup(selectable.navigation.mode);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawTransitionColorTint(Selectable selectable)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Target Graphic", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (GUILayout.Button("Jump to", GUILayout.Width(NitroxGUILayout.VALUE_WIDTH)))
|
||||
{
|
||||
sceneDebugger.UpdateSelectedObject(selectable.targetGraphic.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
Color normalColor, highlightedColor, pressedColor, selectedColor, disabledColor;
|
||||
float colorMultiplier, fadeDuration;
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Normal Color", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
normalColor = colorDrawer.Draw(selectable.colors.normalColor);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Highlighted Color", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
highlightedColor = colorDrawer.Draw(selectable.colors.highlightedColor);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Pressed Color", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
pressedColor = colorDrawer.Draw(selectable.colors.pressedColor);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Selected Color", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
selectedColor = colorDrawer.Draw(selectable.colors.selectedColor);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Disabled Color", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
disabledColor = colorDrawer.Draw(selectable.colors.disabledColor);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Color Multiplier", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
colorMultiplier = NitroxGUILayout.SliderField(selectable.colors.colorMultiplier, 1, 5);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Fader Duration", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
fadeDuration = NitroxGUILayout.SliderField(selectable.colors.fadeDuration, 1, 5);
|
||||
}
|
||||
|
||||
selectable.colors = new ColorBlock
|
||||
{
|
||||
normalColor = normalColor,
|
||||
highlightedColor = highlightedColor,
|
||||
pressedColor = pressedColor,
|
||||
selectedColor = selectedColor,
|
||||
disabledColor = disabledColor,
|
||||
colorMultiplier = colorMultiplier,
|
||||
fadeDuration = fadeDuration
|
||||
};
|
||||
}
|
||||
|
||||
private void DrawTransitionSpriteSwap(Selectable selectable)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Target Graphic", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (GUILayout.Button("Jump to", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH)))
|
||||
{
|
||||
sceneDebugger.UpdateSelectedObject(selectable.targetGraphic.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Highlighted Sprite", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (selectable.spriteState.highlightedSprite)
|
||||
{
|
||||
ImageDrawer.DrawTexture(selectable.spriteState.highlightedSprite.texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Box("Field is null", GUILayout.Width(NitroxGUILayout.VALUE_WIDTH));
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Pressed Sprite", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (selectable.spriteState.pressedSprite)
|
||||
{
|
||||
ImageDrawer.DrawTexture(selectable.spriteState.pressedSprite.texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Box("Field is null", GUILayout.Width(NitroxGUILayout.VALUE_WIDTH));
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Selected Sprite", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (selectable.spriteState.selectedSprite)
|
||||
{
|
||||
ImageDrawer.DrawTexture(selectable.spriteState.selectedSprite.texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Box("Field is null", GUILayout.Width(NitroxGUILayout.VALUE_WIDTH));
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Disabled Sprite", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (selectable.spriteState.disabledSprite)
|
||||
{
|
||||
ImageDrawer.DrawTexture(selectable.spriteState.disabledSprite.texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Box("Field is null", GUILayout.Width(NitroxGUILayout.VALUE_WIDTH));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void DrawTransitionAnimation(Selectable selectable)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Normal Trigger", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
selectable.animationTriggers.normalTrigger = GUILayout.TextField(selectable.animationTriggers.normalTrigger);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Highlighted Trigger", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
selectable.animationTriggers.highlightedTrigger = GUILayout.TextField(selectable.animationTriggers.highlightedTrigger);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Pressed Trigger", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
selectable.animationTriggers.pressedTrigger = GUILayout.TextField(selectable.animationTriggers.pressedTrigger);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Selected Trigger", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
selectable.animationTriggers.selectedTrigger = GUILayout.TextField(selectable.animationTriggers.selectedTrigger);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Disabled Trigger", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
selectable.animationTriggers.disabledTrigger = GUILayout.TextField(selectable.animationTriggers.disabledTrigger);
|
||||
}
|
||||
}
|
||||
}
|
100
NitroxClient/Debuggers/Drawer/UnityUI/SliderDrawer.cs
Normal file
100
NitroxClient/Debuggers/Drawer/UnityUI/SliderDrawer.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
using NitroxModel.Helper;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class SliderDrawer : IDrawer<Slider>
|
||||
{
|
||||
private readonly SceneDebugger sceneDebugger;
|
||||
private readonly SelectableDrawer selectableDrawer;
|
||||
|
||||
public SliderDrawer(SceneDebugger sceneDebugger, SelectableDrawer selectableDrawer)
|
||||
{
|
||||
Validate.NotNull(sceneDebugger);
|
||||
Validate.NotNull(selectableDrawer);
|
||||
|
||||
this.sceneDebugger = sceneDebugger;
|
||||
this.selectableDrawer = selectableDrawer;
|
||||
}
|
||||
|
||||
public void Draw(Slider slider)
|
||||
{
|
||||
selectableDrawer.Draw(slider);
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Fill Rect", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (GUILayout.Button("Jump to", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH)))
|
||||
{
|
||||
sceneDebugger.JumpToComponent(slider.fillRect);
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Handle Rect", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (GUILayout.Button("Jump to", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH)))
|
||||
{
|
||||
sceneDebugger.JumpToComponent(slider.handleRect);
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Direction", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
slider.direction = NitroxGUILayout.EnumPopup(slider.direction);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Min Value", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
slider.minValue = NitroxGUILayout.FloatField(slider.minValue);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Max Value", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
slider.maxValue = NitroxGUILayout.FloatField(slider.maxValue);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Whole Numbers", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
slider.wholeNumbers = NitroxGUILayout.BoolField(slider.wholeNumbers);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Value", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (slider.wholeNumbers)
|
||||
{
|
||||
slider.value = NitroxGUILayout.SliderField((int)slider.value, (int)slider.minValue, (int)slider.maxValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
slider.value = NitroxGUILayout.SliderField(slider.value, slider.minValue, slider.maxValue);
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("On Value Changed", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
GUILayout.Button("Unsupported", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
}
|
||||
}
|
||||
}
|
125
NitroxClient/Debuggers/Drawer/UnityUI/TextDrawer.cs
Normal file
125
NitroxClient/Debuggers/Drawer/UnityUI/TextDrawer.cs
Normal file
@@ -0,0 +1,125 @@
|
||||
using NitroxClient.Debuggers.Drawer.Unity;
|
||||
using NitroxModel.Helper;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class TextDrawer : IDrawer<Text>
|
||||
{
|
||||
private readonly ColorDrawer colorDrawer;
|
||||
private readonly MaterialDrawer materialDrawer;
|
||||
private const float LABEL_WIDTH = 150;
|
||||
private const float VALUE_WIDTH = 200;
|
||||
|
||||
public TextDrawer(ColorDrawer colorDrawer, MaterialDrawer materialDrawer)
|
||||
{
|
||||
Validate.NotNull(colorDrawer);
|
||||
Validate.NotNull(materialDrawer);
|
||||
|
||||
this.colorDrawer = colorDrawer;
|
||||
this.materialDrawer = materialDrawer;
|
||||
}
|
||||
|
||||
public void Draw(Text text)
|
||||
{
|
||||
GUILayout.Label("Text");
|
||||
text.text = GUILayout.TextArea(text.text, GUILayout.MaxHeight(100));
|
||||
|
||||
GUILayout.Space(25);
|
||||
GUILayout.Label("Character:", "bold");
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Font", GUILayout.Width(LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
GUILayout.TextField(text.font ? text.font.name : "NoFont", GUILayout.Width(VALUE_WIDTH));
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Font Style", GUILayout.Width(LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
GUILayout.TextField(text.fontStyle.ToString(), GUILayout.Width(VALUE_WIDTH));
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Font Size", GUILayout.Width(LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
text.fontSize = NitroxGUILayout.IntField(text.fontSize, VALUE_WIDTH);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Line Spacing", GUILayout.Width(LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
text.lineSpacing = NitroxGUILayout.FloatField(text.lineSpacing, VALUE_WIDTH);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Rich Text", GUILayout.Width(LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
text.supportRichText = NitroxGUILayout.BoolField(text.supportRichText, VALUE_WIDTH);
|
||||
}
|
||||
|
||||
GUILayout.Space(25);
|
||||
GUILayout.Label("Paragraph:", "bold");
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Alignment", GUILayout.Width(LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
text.alignment = NitroxGUILayout.EnumPopup(text.alignment, VALUE_WIDTH);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Align By Geometry", GUILayout.Width(LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
text.alignByGeometry = NitroxGUILayout.BoolField(text.alignByGeometry, VALUE_WIDTH);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Horizontal Overflow", GUILayout.Width(LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
text.horizontalOverflow = NitroxGUILayout.EnumPopup(text.horizontalOverflow, VALUE_WIDTH);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Vertical Overflow", GUILayout.Width(LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
text.verticalOverflow = NitroxGUILayout.EnumPopup(text.verticalOverflow, VALUE_WIDTH);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Best Fit", GUILayout.Width(LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
text.resizeTextForBestFit = NitroxGUILayout.BoolField(text.resizeTextForBestFit, VALUE_WIDTH);
|
||||
}
|
||||
|
||||
GUILayout.Space(25);
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Color", GUILayout.Width(LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
text.color = colorDrawer.Draw(text.color);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Material", GUILayout.Width(LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
text.material = materialDrawer.Draw(text.material);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Raycast Target", GUILayout.Width(LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
text.raycastTarget = NitroxGUILayout.BoolField(text.raycastTarget, VALUE_WIDTH);
|
||||
}
|
||||
}
|
||||
}
|
66
NitroxClient/Debuggers/Drawer/UnityUI/ToggleDrawer.cs
Normal file
66
NitroxClient/Debuggers/Drawer/UnityUI/ToggleDrawer.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using NitroxClient.Debuggers.Drawer.Unity;
|
||||
using NitroxModel.Helper;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class ToggleDrawer : IDrawer<Toggle>
|
||||
{
|
||||
private readonly SceneDebugger sceneDebugger;
|
||||
private readonly SelectableDrawer selectableDrawer;
|
||||
private readonly UnityEventDrawer unityEventDrawer;
|
||||
|
||||
public ToggleDrawer(SceneDebugger sceneDebugger, SelectableDrawer selectableDrawer, UnityEventDrawer unityEventDrawer)
|
||||
{
|
||||
Validate.NotNull(sceneDebugger);
|
||||
Validate.NotNull(selectableDrawer);
|
||||
Validate.NotNull(unityEventDrawer);
|
||||
|
||||
this.sceneDebugger = sceneDebugger;
|
||||
this.selectableDrawer = selectableDrawer;
|
||||
this.unityEventDrawer = unityEventDrawer;
|
||||
}
|
||||
|
||||
public void Draw(Toggle toggle)
|
||||
{
|
||||
selectableDrawer.Draw(toggle);
|
||||
GUILayout.Space(10);
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Is On", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
toggle.isOn = NitroxGUILayout.BoolField(toggle.isOn);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Toggle Transition", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
toggle.toggleTransition = NitroxGUILayout.EnumPopup(toggle.toggleTransition);
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Graphic", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (GUILayout.Button("Jump to", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH)))
|
||||
{
|
||||
sceneDebugger.UpdateSelectedObject(toggle.graphic.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Group", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
if (GUILayout.Button("Jump to", GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH)))
|
||||
{
|
||||
sceneDebugger.UpdateSelectedObject(toggle.group.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
unityEventDrawer.Draw(toggle.onValueChanged, new UnityEventDrawer.DrawOptions("OnClick()"));
|
||||
}
|
||||
}
|
17
NitroxClient/Debuggers/Drawer/UnityUI/ToggleGroupDrawer.cs
Normal file
17
NitroxClient/Debuggers/Drawer/UnityUI/ToggleGroupDrawer.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NitroxClient.Debuggers.Drawer.UnityUI;
|
||||
|
||||
public class ToggleGroupDrawer : IDrawer<ToggleGroup>
|
||||
{
|
||||
public void Draw(ToggleGroup toggleGroup)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("Allow Switch Off", NitroxGUILayout.DrawerLabel, GUILayout.Width(NitroxGUILayout.DEFAULT_LABEL_WIDTH));
|
||||
NitroxGUILayout.Separator();
|
||||
toggleGroup.allowSwitchOff = NitroxGUILayout.BoolField(toggleGroup.allowSwitchOff);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user