Пример #1
0
        public void PrepareRaceTextures([NotNull] RaceTexturesContext texturesContext)
        {
            var d = ReadCmTexturesJson();

            if (d != null)
            {
                try {
                    RunCmTexturesJson(d, texturesContext);
                } catch (Exception e) {
                    NonfatalError.NotifyBackground("Can’t prepare car textures", e);
                }
            }

            var s = ReadCmTexturesScript(out var data);

            if (s != null)
            {
                try {
                    RunCmTexturesScript(s, data, texturesContext,
                                        (textureName, textureData) => SaveExtraCmTexture(textureName, () => textureData));
                } catch (Exception e) {
                    NonfatalError.NotifyBackground("Can’t run car textures script", e);
                }
            }
        }
            public CmTexturesScriptTexture(Table v, [CanBeNull] ExtraDataProvider data, [NotNull] RaceTexturesContext texturesContext,
                                           [NotNull] Action <string, byte[]> saveCallback)
            {
                _data            = data;
                _texturesContext = texturesContext;
                _saveCallback    = saveCallback;
                _scale           = v[@"scale"].As(1d);

                ActionExtension.InvokeInMainThread(() => {
                    _canvas = new Cell {
                        Width      = v[@"width"].As(256d),
                        Height     = v[@"height"].As(256d),
                        Background = new SolidColorBrush(GetColor(v, "background", Colors.Transparent))
                    };
                });
            }
Пример #3
0
 private void RunCmTexturesJson([NotNull] JObject jObject, [NotNull] RaceTexturesContext texturesContext)
 {
     PrepareTrackOutlineTexture(jObject, texturesContext.Track);
 }