예제 #1
0
 public ColoredItem(Dictionary <string, TintedEntry> replacements, CarPaintColors colors) : base(false)
 {
     Replacements            = replacements;
     Colors                  = colors;
     Colors.PropertyChanged += OnColorsChanged;
     AffectedTextures.AddRange(Replacements.Keys);
 }
예제 #2
0
 public CarPaintPattern(string name, [NotNull] PaintShopSource source, [CanBeNull] PaintShopSource overlay, CarPaintColors colors)
 {
     DisplayName             = name;
     Source                  = source;
     Overlay                 = overlay;
     Colors                  = colors;
     colors.PropertyChanged += OnColorsChanged;
 }
예제 #3
0
            protected void DeserializeColors([NotNull] CarPaintColors target, JObject data, string key)
            {
                var colors = (data?[key] as JArray)?.ToObject <string[]>();

                if (colors != null)
                {
                    for (var i = 0; i < colors.Length && i < target.Colors.Length; i++)
                    {
                        target.Colors[i].Value = colors[i].ToColor() ?? Colors.White;
                    }
                }
            }
예제 #4
0
 public TintedWindows(Dictionary <string, TintedEntry> replacements, CarPaintColors colors, double defaultAlpha = 0.23, bool fixedColor = false)
     : base(replacements, colors)
 {
     DefaultAlpha = defaultAlpha;
     FixedColor   = fixedColor;
 }
예제 #5
0
 public TintedWindows([Localizable(false)] string diffuseTexture, CarPaintColors colors, double defaultAlpha = 0.23, bool fixedColor = false)
     : base(diffuseTexture, colors)
 {
     DefaultAlpha = defaultAlpha;
     FixedColor   = fixedColor;
 }
예제 #6
0
 public ColoredItem([Localizable(false)] string diffuseTexture, CarPaintColors colors)
     : this(new Dictionary <string, TintedEntry> {
     [diffuseTexture] = new TintedEntry(PaintShopSource.White, null, null)
 }, colors)
 {
 }
예제 #7
0
 protected JArray SerializeColors([CanBeNull] CarPaintColors target)
 {
     return(target == null ? null : JArray.FromObject(target.ActualColors.Select(x => x.ToHexString())));
 }