1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-06-01 04:43:37 +02:00
MLEM/MLEM/Formatting/Obsolete/FormattingCode.cs
2020-05-15 00:34:04 +02:00

65 lines
1.5 KiB
C#

using System;
using Microsoft.Xna.Framework;
using MLEM.Animations;
using MLEM.Extensions;
using MLEM.Font;
using MLEM.Textures;
namespace MLEM.Formatting {
[Obsolete("Use the new text formatting system in MLEM.Formatting instead")]
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(GenericFont font) {
return this.CodeType == Type.Icon ? font.GetWidthString(font.LineHeight) : string.Empty;
}
public enum Type {
Color,
Style,
Icon,
Animation
}
}
public enum TextStyle {
Regular,
Bold,
Italic,
Shadow
}
}