using file-scoped namespaces
This commit is contained in:
@@ -2,62 +2,61 @@
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UIFixes
|
||||
namespace UIFixes;
|
||||
|
||||
public class MultiSelectDebug : MonoBehaviour
|
||||
{
|
||||
public class MultiSelectDebug : MonoBehaviour
|
||||
private GUIStyle guiStyle;
|
||||
private Rect guiRect = new(20, 70, 0, 0);
|
||||
|
||||
GUIContent guiContent;
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
private GUIStyle guiStyle;
|
||||
private Rect guiRect = new(20, 70, 0, 0);
|
||||
|
||||
GUIContent guiContent;
|
||||
|
||||
public void OnGUI()
|
||||
if (!MultiSelect.Enabled || !Settings.ShowMultiSelectDebug.Value)
|
||||
{
|
||||
if (!MultiSelect.Enabled || !Settings.ShowMultiSelectDebug.Value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
guiStyle ??= new GUIStyle(GUI.skin.box)
|
||||
{
|
||||
alignment = TextAnchor.MiddleLeft,
|
||||
fontSize = 14,
|
||||
margin = new RectOffset(3, 3, 3, 3),
|
||||
richText = true
|
||||
};
|
||||
|
||||
guiContent ??= new GUIContent();
|
||||
|
||||
StringBuilder builder = new();
|
||||
|
||||
builder.Append("<b>MultiSelect</b>\n");
|
||||
builder.AppendFormat("Active: <color={0}>{1}</color>\n", MultiSelect.Active ? "green" : "red", MultiSelect.Active);
|
||||
builder.AppendFormat("Items: <color=yellow>{0}</color>\n", MultiSelect.Count);
|
||||
|
||||
foreach (DragItemContext itemContext in MultiSelect.SortedItemContexts())
|
||||
{
|
||||
LocationInGrid location = itemContext.ItemAddress is GridItemAddress gridAddress ? MultiGrid.GetGridLocation(gridAddress) : null;
|
||||
builder.AppendFormat("x{0} {1} {2} {3}\n",
|
||||
itemContext.Item.StackObjectsCount,
|
||||
itemContext.ItemAddress.Container.ID,
|
||||
location != null ? $"({location.x}, {location.y})" : "(slot)",
|
||||
itemContext.Item.Name.Localized());
|
||||
}
|
||||
|
||||
if (MultiSelect.SecondaryContexts.Any())
|
||||
{
|
||||
builder.AppendFormat("Secondary Items: <color=yellow>{0}</color>\n", MultiSelect.SecondaryCount);
|
||||
foreach (DragItemContext itemContext in MultiSelect.SecondaryContexts)
|
||||
{
|
||||
builder.AppendFormat("x{0} {1}\n", itemContext.Item.StackObjectsCount, itemContext.Item.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
guiContent.text = builder.ToString();
|
||||
|
||||
guiRect.size = guiStyle.CalcSize(guiContent);
|
||||
|
||||
GUI.Box(guiRect, guiContent, guiStyle);
|
||||
return;
|
||||
}
|
||||
|
||||
guiStyle ??= new GUIStyle(GUI.skin.box)
|
||||
{
|
||||
alignment = TextAnchor.MiddleLeft,
|
||||
fontSize = 14,
|
||||
margin = new RectOffset(3, 3, 3, 3),
|
||||
richText = true
|
||||
};
|
||||
|
||||
guiContent ??= new GUIContent();
|
||||
|
||||
StringBuilder builder = new();
|
||||
|
||||
builder.Append("<b>MultiSelect</b>\n");
|
||||
builder.AppendFormat("Active: <color={0}>{1}</color>\n", MultiSelect.Active ? "green" : "red", MultiSelect.Active);
|
||||
builder.AppendFormat("Items: <color=yellow>{0}</color>\n", MultiSelect.Count);
|
||||
|
||||
foreach (DragItemContext itemContext in MultiSelect.SortedItemContexts())
|
||||
{
|
||||
LocationInGrid location = itemContext.ItemAddress is GridItemAddress gridAddress ? MultiGrid.GetGridLocation(gridAddress) : null;
|
||||
builder.AppendFormat("x{0} {1} {2} {3}\n",
|
||||
itemContext.Item.StackObjectsCount,
|
||||
itemContext.ItemAddress.Container.ID,
|
||||
location != null ? $"({location.x}, {location.y})" : "(slot)",
|
||||
itemContext.Item.Name.Localized());
|
||||
}
|
||||
|
||||
if (MultiSelect.SecondaryContexts.Any())
|
||||
{
|
||||
builder.AppendFormat("Secondary Items: <color=yellow>{0}</color>\n", MultiSelect.SecondaryCount);
|
||||
foreach (DragItemContext itemContext in MultiSelect.SecondaryContexts)
|
||||
{
|
||||
builder.AppendFormat("x{0} {1}\n", itemContext.Item.StackObjectsCount, itemContext.Item.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
guiContent.text = builder.ToString();
|
||||
|
||||
guiRect.size = guiStyle.CalcSize(guiContent);
|
||||
|
||||
GUI.Box(guiRect, guiContent, guiStyle);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user