2020-05-15 00:34:04 +02:00
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
using Microsoft.Xna.Framework;
|
|
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
|
|
using MLEM.Font;
|
2020-05-15 14:22:33 +02:00
|
|
|
using MLEM.Misc;
|
2020-05-15 00:34:04 +02:00
|
|
|
|
|
|
|
namespace MLEM.Formatting.Codes {
|
2020-05-15 14:22:33 +02:00
|
|
|
public class Code : GenericDataHolder {
|
2020-05-15 00:34:04 +02:00
|
|
|
|
2020-05-15 19:55:59 +02:00
|
|
|
public readonly Regex Regex;
|
2020-05-15 00:34:04 +02:00
|
|
|
public readonly Match Match;
|
|
|
|
public Token Token { get; internal set; }
|
|
|
|
|
2020-05-15 19:55:59 +02:00
|
|
|
protected Code(Match match, Regex regex) {
|
2020-05-15 00:34:04 +02:00
|
|
|
this.Match = match;
|
2020-05-15 19:55:59 +02:00
|
|
|
this.Regex = regex;
|
2020-05-15 00:34:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public virtual bool EndsHere(Code other) {
|
|
|
|
return other.GetType() == this.GetType();
|
|
|
|
}
|
|
|
|
|
2020-05-17 00:10:29 +02:00
|
|
|
public virtual Color? GetColor(Color defaultPick) {
|
2020-05-15 00:34:04 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2020-05-17 00:10:29 +02:00
|
|
|
public virtual GenericFont GetFont(GenericFont defaultPick) {
|
2020-05-15 00:34:04 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2020-05-15 14:22:33 +02:00
|
|
|
public virtual void Update(GameTime time) {
|
|
|
|
}
|
|
|
|
|
2020-05-15 19:55:59 +02:00
|
|
|
public virtual string GetReplacementString(GenericFont font) {
|
|
|
|
return string.Empty;
|
|
|
|
}
|
|
|
|
|
2020-05-15 14:22:33 +02:00
|
|
|
public virtual bool DrawCharacter(GameTime time, SpriteBatch batch, char c, string cString, int indexInToken, ref Vector2 pos, GenericFont font, ref Color color, ref float scale, float depth) {
|
2020-05-15 00:34:04 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-05-15 19:55:59 +02:00
|
|
|
public virtual void DrawSelf(GameTime time, SpriteBatch batch, Vector2 pos, GenericFont font, Color color, float scale, float depth) {
|
|
|
|
}
|
|
|
|
|
|
|
|
public delegate Code Constructor(TextFormatter formatter, Match match, Regex regex);
|
2020-05-15 00:34:04 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|