public static void LoadSettingFile() { // 加载配置文件 Setting = AssetDatabase.LoadAssetAtPath <ImportSetting>(EditorDefine.ImporterSettingFilePath); if (Setting == null) { Debug.LogWarning($"Create new ImportSetting.asset : {EditorDefine.ImporterSettingFilePath}"); Setting = ScriptableObject.CreateInstance <ImportSetting>(); EditorTools.CreateFileDirectory(EditorDefine.ImporterSettingFilePath); AssetDatabase.CreateAsset(Setting, EditorDefine.ImporterSettingFilePath); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } else { Debug.Log("Load ImportSetting.asset ok"); } // Clear CacheTypes.Clear(); CacheProcessor.Clear(); // 获取所有资源处理器类型 List <Type> result = UtilAssembly.GetAssignableTypes(typeof(IAssetProcessor)); for (int i = 0; i < result.Count; i++) { Type type = result[i]; if (CacheTypes.ContainsKey(type.Name) == false) { CacheTypes.Add(type.Name, type); } } }
public bool VerificaAtualizacoes(IView view, ModelDTO model) { bool atualizado = false; using (var util = new UtilAssembly()) { var versaoAtual = util.AssemblyVersion; atualizado = (model.HashValidacao.Equals(versaoAtual)); if (!atualizado) { Atualizar(view, model); } } return(atualizado); }
/// <summary> /// 初始化控制台 /// </summary> public static void Init() { // 加载背景纹理 _bgTexture = Resources.Load <Texture>("buildinBackground"); if (_bgTexture == null) { UnityEngine.Debug.LogWarning("Not found buildinBackground texture."); } // 获取所有调试类 List <Type> allTypes = UtilAssembly.GetAssignableAttributeTypes(typeof(IDebug), typeof(DebugAttribute)); for (int i = 0; i < allTypes.Count; i++) { DebugAttribute attribute = (DebugAttribute)Attribute.GetCustomAttribute(allTypes[i], typeof(DebugAttribute)); NodeWrapper wrapper = new NodeWrapper() { ClassType = allTypes[i], Title = attribute.Title, Priority = attribute.Order, }; _wrappers.Add(wrapper); } // 根据优先级排序 _wrappers.Sort(); // 创建实例类 for (int i = 0; i < _wrappers.Count; i++) { NodeWrapper wrapper = _wrappers[i]; wrapper.Instance = (IDebug)Activator.CreateInstance(wrapper.ClassType); wrapper.Instance.OnInit(); } // 标题列表 List <string> titles = new List <string>(); for (int i = 0; i < _wrappers.Count; i++) { titles.Add(_wrappers[i].Title); } _toolbarTitles = titles.ToArray(); }
static ConfigHandler() { List <Type> result = UtilAssembly.GetAssignableAttributeTypes(typeof(AssetConfig), typeof(ConfigAttribute)); for (int i = 0; i < result.Count; i++) { Type type = result[i]; // 判断是否重复 ConfigAttribute attribute = (ConfigAttribute)Attribute.GetCustomAttribute(type, typeof(ConfigAttribute)); if (_cfgTypes.ContainsKey(attribute.CfgType)) { throw new Exception($"Config {type} has same value : {attribute.CfgType}"); } // 添加到集合 _cfgTypes.Add(attribute.CfgType, type); } }