mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
27 lines
917 B
C#
27 lines
917 B
C#
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;
|
|
}
|
|
}
|
|
} |