mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Decal text input UI
This commit is contained in:
27
Source/ConformalDecals/Text/DecalFont.cs
Normal file
27
Source/ConformalDecals/Text/DecalFont.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
16
Source/ConformalDecals/Text/DecalText.cs
Normal file
16
Source/ConformalDecals/Text/DecalText.cs
Normal 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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user