1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-06-28 07:19:09 +02:00
MLEM/MLEM/Formatting/FormattingCode.cs
2020-02-03 04:37:14 +01:00

62 lines
1.4 KiB
C#

using Microsoft.Xna.Framework;
using MLEM.Animations;
using MLEM.Font;
using MLEM.Textures;
namespace MLEM.Formatting {
public class FormattingCode {
public readonly Type CodeType;
public readonly Color Color;
public readonly TextStyle Style;
public readonly SpriteAnimation Icon;
public readonly TextAnimation.DrawCharacter Animation;
public FormattingCode(Color color) {
this.Color = color;
this.CodeType = Type.Color;
}
public FormattingCode(TextStyle style) {
this.Style = style;
this.CodeType = Type.Style;
}
public FormattingCode(TextureRegion icon) :
this(new SpriteAnimation(0, icon)) {
}
public FormattingCode(SpriteAnimation icon) {
this.Icon = icon;
this.CodeType = Type.Icon;
}
public FormattingCode(TextAnimation.DrawCharacter animation) {
this.Animation = animation;
this.CodeType = Type.Animation;
}
public virtual string GetReplacementString(IGenericFont font) {
return this.CodeType == Type.Icon ? TextFormatting.GetOneEmString(font) : string.Empty;
}
public enum Type {
Color,
Style,
Icon,
Animation
}
}
public enum TextStyle {
Regular,
Bold,
Italic,
Shadow
}
}