Example #1
0
        public static void CheckForPatch()
        {
            var assetProvider = new AssetProvider();
            var patchType     = typeof(IPatchModule);
            var patches       = System.AppDomain.CurrentDomain.GetAssemblies()
                                .SelectMany(s => s.GetTypes())
                                .Where(p => patchType.IsAssignableFrom(p) && p.IsClass && !p.IsAbstract)
                                .Select(p => System.Activator.CreateInstance(p, assetProvider) as IPatchModule)
                                .OrderBy(p => p.toTargetVersion);

            var patchesToApply = patches.Where(p => p.IsPatchNeeded());
            var patchesCount   = patchesToApply.Count();

            if (patchesCount > 0)
            {
                var doPatch = EditorUtility.DisplayDialog("Kamakura Shaders Patch is available", "Please make a backup of your project before applying this patch", "Apply Patch", "Cancel");
                if (doPatch)
                {
                    foreach (var patch in patchesToApply)
                    {
                        patch.DoPatch();
                    }
                }
            }
            else
            {
                EditorUtility.DisplayDialog("Info", "No patch needed", "Close");
            }
        }
Example #2
0
 public BasePatchModule(AssetProvider assetProvider)
 {
     this.assetProvider = assetProvider;
 }
Example #3
0
 public PatchModule01(AssetProvider assetProvider) : base(assetProvider)
 {
     _fromTargetVersion = VersionDescriptor.ConvertToSingleInt(0, 0, 0);
     _toTargetVersion   = VersionDescriptor.ConvertToSingleInt(1, 0, 7);
 }