using System; using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; namespace Thousandto.Launcher.ExternalLibs { /// /// PrefabAsset运行时的处理 /// public class PrefabAssetRuntimeUtil { //对纹理设置通过文件路径 private static Func, bool> _setTextureWithPathHandler; //对材质的纹理进行复位的Handler private static Func _resetMaterialTextureHandler; //根据名字查找Shader private static Func _findShaderHandler; public static void SetHandler(Func, bool> setMatTexHandler, Func resetMatHandler, Func findShaderHandler) { _setTextureWithPathHandler = setMatTexHandler; _resetMaterialTextureHandler = resetMatHandler; _findShaderHandler = findShaderHandler; } public static bool ResetMateiralTexture(Material mat) { if (_resetMaterialTextureHandler != null) return _resetMaterialTextureHandler(mat); return false; } public static bool SetTexture(Material mat, string pName, string texPath, Action callBack) { if (_setTextureWithPathHandler != null) { return _setTextureWithPathHandler(mat, pName, texPath, callBack); } return false; } public static Shader FindShader(string name) { if (_findShaderHandler != null) { return _findShaderHandler(name); } return Shader.Find(name); } } }