Unity-DebugX/Runtime/Utils/DebugXTextSettings.cs

41 lines
1.2 KiB
C#
Raw Normal View History

2025-02-26 23:39:50 +08:00
using UnityEngine;
namespace DCFApixels
{
public struct DebugXTextSettings
{
public const TextAnchor DEFAULT_TEXT_ANCHOR = TextAnchor.MiddleLeft;
public const int DEFAULT_FONT_SIZE = 16;
public static readonly DebugXTextSettings Default = new DebugXTextSettings(DEFAULT_FONT_SIZE, DEFAULT_TEXT_ANCHOR, default);
public int FontSize;
public TextAnchor TextAnchor;
public Color BackgroundColor;
public bool IsHasBackground
{
get { return BackgroundColor.a > 0; }
}
public DebugXTextSettings(int fontSize, TextAnchor textAnchor, Color backgroundColor)
{
FontSize = fontSize;
TextAnchor = textAnchor;
BackgroundColor = backgroundColor;
}
public DebugXTextSettings SetSize(int fontSize)
{
FontSize = fontSize;
return this;
}
public DebugXTextSettings SetAnchor(TextAnchor textAnchor)
{
TextAnchor = textAnchor;
return this;
}
public DebugXTextSettings SetBackground(Color backgroundColor)
{
BackgroundColor = backgroundColor;
return this;
}
}
}