public static MWColor ApplyPatch(this MWColor _this, ColorPatch color)
        {
            if (color == null)
            {
                return(_this);
            }

            if (color.A != null)
            {
                _this.A = color.A.Value;
            }

            if (color.R != null)
            {
                _this.R = color.R.Value;
            }

            if (color.G != null)
            {
                _this.G = color.G.Value;
            }

            if (color.B != null)
            {
                _this.B = color.B.Value;
            }

            return(_this);
        }
Ejemplo n.º 2
0
 internal ColorPatch(MWColor color)
 {
     R = color.R;
     G = color.G;
     B = color.B;
     A = color.A;
 }
        public static ColorPatch GeneratePatch(MWColor _old, Color _new)
        {
            if (_old == null && _new != null)
            {
                return(new ColorPatch(_new));
            }
            else if (_new == null)
            {
                return(null);
            }

            var patch = new ColorPatch()
            {
                R = _old.R != _new.r ? (float?)_new.r : null,
                G = _old.G != _new.g ? (float?)_new.g : null,
                B = _old.B != _new.b ? (float?)_new.b : null,
                A = _old.A != _new.a ? (float?)_new.a : null
            };

            if (patch.IsPatched())
            {
                return(patch);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
 public static MWColor FromGodotColor(this MWColor _this, Color other)
 {
     _this.R = other.r;
     _this.G = other.g;
     _this.B = other.b;
     _this.A = other.a;
     return(_this);
 }
Ejemplo n.º 5
0
 public static MWColor SetValue(this MWColor _this, Color value)
 {
     _this.R = value.r;
     _this.G = value.g;
     _this.B = value.b;
     _this.A = value.a;
     return(_this);
 }
Ejemplo n.º 6
0
        public static Color GetPatchApplied(this Color _this, MWColor color)
        {
            _this.r = _this.r.GetPatchApplied(color.R);
            _this.g = _this.g.GetPatchApplied(color.G);
            _this.b = _this.b.GetPatchApplied(color.B);
            _this.a = _this.a.GetPatchApplied(color.A);

            return(_this);
        }
Ejemplo n.º 7
0
 public static Color ToColor(this MWColor _this)
 {
     return(new Color()
     {
         r = _this.R,
         g = _this.G,
         b = _this.B,
         a = _this.A
     });
 }
 public void ApplyPatch(TextPatch patch)
 {
     Enabled       = Enabled.ApplyPatch(patch.Enabled);
     Contents      = Contents.ApplyPatch(patch.Contents);
     PixelsPerLine = PixelsPerLine.ApplyPatch(patch.PixelsPerLine);
     Height        = Height.ApplyPatch(patch.Height);
     Anchor        = Anchor.ApplyPatch(patch.Anchor);
     Justify       = Justify.ApplyPatch(patch.Justify);
     Font          = Font.ApplyPatch(patch.Font);
     Color         = Color.ApplyPatch(patch.Color);
 }
    public TmpText(TmpTextFactory factory, TextMeshPro tmp)
    {
        _factory  = factory;
        _tmp      = tmp;
        _renderer = tmp.gameObject.GetComponent <Renderer>();

        // set extra settings
        _tmp.richText           = true;
        _tmp.enableWordWrapping = false;

        // set defaults
        Enabled       = true;
        Contents      = "";
        PixelsPerLine = 50;
        Height        = 1;
        Anchor        = TextAnchorLocation.TopLeft;
        Justify       = TextJustify.Left;
        Font          = FontFamily.SansSerif;
        Color         = new MWColor(1, 1, 1, 1);
    }
Ejemplo n.º 10
0
 public static Color ToColor(this MWColor _this)
 {
     return(new Color(_this.R, _this.G, _this.B, _this.A));
 }