Decal text input UI

This commit is contained in:
2020-07-19 21:12:48 -07:00
parent 1316dbb553
commit e87fc48edf
14 changed files with 348 additions and 102 deletions

View File

@ -0,0 +1,27 @@
using System;
using TMPro;
namespace ConformalDecals.Text {
public class DecalFont {
public readonly string title;
public readonly TMP_FontAsset fontAsset;
public readonly FontStyles fontStyle;
public DecalFont(string title, TMP_FontAsset fontAsset, FontStyles fontStyle) {
if (fontAsset == null) throw new ArgumentNullException(nameof(fontAsset));
this.title = title;
this.fontAsset = fontAsset;
this.fontStyle = fontStyle;
}
public void SetupSample(TMP_Text tmp) {
if (tmp == null) throw new ArgumentNullException(nameof(tmp));
if (fontAsset == null) throw new InvalidOperationException("DecalFont has not been initialized and Font is null.");
tmp.text = title;
tmp.font = fontAsset;
tmp.fontStyle = fontStyle;
}
}
}

View File

@ -0,0 +1,16 @@
using System;
using TMPro;
using UnityEngine;
namespace ConformalDecals.Text {
public struct DecalText {
public string text;
public DecalFont font;
public FontStyles style;
public bool vertical;
public Color color;
public Color outlineColor;
public float outlineWidth;
}
}

View File

@ -1,15 +0,0 @@
using TMPro;
using UnityEngine;
namespace ConformalDecals.Text {
public struct FormattedText {
public string text;
public TMP_FontAsset font;
public FontStyles style;
public bool vertical;
public Color32 color;
public Color32 outlineColor;
public float outlineWidth;
}
}