示例#1
0
 public MapTextBuilder(SpriteFont font, Color textColor, Color shadowColor, bool haveShadow, MapItemAlignment alignment)
 {
     this.font        = font;
     this.textColor   = textColor;
     this.shadowColor = shadowColor;
     this.haveShadow  = haveShadow;
     this.alignment   = alignment;
 }
示例#2
0
        public MapTextBuilder Text(string text, Color?textColor = null, Color?shadowColor = null, SpriteFont font = null, bool?haveShadow = null, MapItemAlignment?alignment = null)
        {
            // Store old values
            var oldTxtColor    = this.textColor;
            var oldShadowColor = this.shadowColor;
            var oldFont        = this.font;
            var oldHaveShadow  = this.haveShadow;
            var oldAlignment   = this.alignment;

            // Set temporary values
            if (textColor.HasValue)
            {
                this.textColor = textColor.Value;
            }
            if (shadowColor.HasValue)
            {
                this.shadowColor = shadowColor.Value;
            }
            if (font != null)
            {
                this.font = font;
            }
            if (haveShadow.HasValue)
            {
                this.haveShadow = haveShadow.Value;
            }
            if (alignment.HasValue)
            {
                this.alignment = alignment.Value;
            }

            // Add the text
            this.Text(text);

            // Restore old values
            this.textColor   = oldTxtColor;
            this.shadowColor = oldShadowColor;
            this.font        = oldFont;
            this.haveShadow  = oldHaveShadow;
            this.alignment   = oldAlignment;

            return(this);
        }
示例#3
0
 public MapTextBuilder(LoadedFont font, Color textColor, Color shadowColor, bool haveShadow, MapItemAlignment alignment)
     : this(API.Content.Fonts.GetFont(font), textColor, shadowColor, haveShadow, alignment)
 {
 }