public bool Pack(MahuaPluginPackContext context) { var projectDirectory = context.ProjectDirectory; var targetPaths = new TargetPaths(Path.Combine(projectDirectory, "bin", "Amanda"), context.NewbePluginName); //清理并创建目标文件夹 targetPaths.CleanAndCreateNew(); //复制bin DirectoryHelper.DirectoryCopy( Path.Combine(projectDirectory, "bin", context.Configuration), targetPaths.PluginDir, true); DirectoryHelper.DeleteOtherPlatformFile(targetPaths.PluginDir, MahuaPlatform.Amanda); var npkPath = GetNpkPath(context.PackageDirectory, PkgName); _log.Debug($"将使用{npkPath}中的插件平台包。"); //复制内容到平台插件目录 var apiExporterDll = new FileInfo(Path.Combine(npkPath.ForPlugin, $"{PkgName}.dll")); apiExporterDll.CopyTo(Path.Combine(targetPaths.PlatformPluginsDir, $"{context.NewbePluginName}.plugin.dll")); //复制forPlugin文件夹内容 DirectoryHelper.DirectoryCopy( npkPath.ForPlugin, targetPaths.PluginDir, false); //复制forMain文件夹内容 DirectoryHelper.DirectoryCopy( npkPath.ForMain, targetPaths.Target, false); return(true); }
public void Apply(GameObject gameObject) { try { TargetPaths.SelectMany(targetPath => gameObject.transform.Find(targetPath).GetComponentInChildren <Renderer>().materials) .Where(material => MaterialTargets.Contains(material.name.Replace(INSTANCE_POSTFIX, ""))) .ForEach(ApplyShaderAndMaterialProperties); } catch (Exception) { Log.Error($"[ApplyMaterial] Did not find a material called {MaterialTargets} on {gameObject.name}/[{string.Join("; ", TargetPaths)}]"); } }