public static DisposableGroup RegisterFixedUpdate(this DisposableGroup dg, Action fixedupdateAction, int order = 0) => dg.Register( TimeMachine.RegisterFixedUpdate(fixedupdateAction, order));
public static void GenCodeByAssemblies() { var config = XConfig.GetConfig <TinaX.XILRuntime.Internal.XILRTConfig>(XILConst.ConfigPath_Resources); if (config == null) { Debug.LogError($"[{XILConst.ServiceName}] Generate CLRBinding code failed: config file not found."); return; } string output_path = config.EditorCLRBindingCodeOutputPath; if (!output_path.StartsWith("Assets/")) { Debug.LogError($"[{XILConst.ServiceName}]Generate failed: Output folder path is invalid :" + output_path); return; } ILAppDomain domain = new ILAppDomain(); DisposableGroup disGroup = new DisposableGroup(); foreach (var path in config.EditorLoadAssemblyPaths) { if (!path.AssemblyPath.IsNullOrEmpty()) { var fs = new FileStream(path.AssemblyPath, FileMode.Open, FileAccess.Read); disGroup.Register(fs); domain.LoadAssembly(fs); } } List <Type> gen_valueTypes = new List <Type>(s_InternalValueTypes); List <Type> gen_delegates = new List <Type>(s_InternalDelegateTypes); Type t_define = typeof(ICLRGenerateDefine); var types = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(a => a.GetTypes().Where(t => t.GetInterfaces().Contains(t_define))) .ToArray(); if (types.Length > 0) { foreach (var type in types) { ICLRGenerateDefine define_obj = (ICLRGenerateDefine)Activator.CreateInstance(type); define_obj.GenerateByAssemblies_InitILRuntime(domain); var _valueTypes = define_obj.GetValueTypeBinders(); if (_valueTypes != null && _valueTypes.Count > 0) { foreach (var __valueType in _valueTypes) { if (!gen_valueTypes.Contains(__valueType)) { gen_valueTypes.Add(__valueType); } } } var _delegates = define_obj.GetDelegateTypes(); if (_delegates != null && _delegates.Count > 0) { foreach (var __delegate in _delegates) { if (!gen_delegates.Contains(__delegate)) { gen_delegates.Add(__delegate); } } } } } Internal_HandleBeforeGenCodeByAssemblies(domain); BindingCodeGenerator.GenerateBindingCode(domain, output_path, gen_valueTypes, gen_delegates); disGroup.Dispose(); Debug.Log($"<color=#{TinaX.Internal.XEditorColorDefine.Color_Safe_16}>Generate code finish.</color>"); AssetDatabase.Refresh(); }
public static DisposableGroup RegisterLateUpdate(this DisposableGroup dg, Action lateupdateAction, int order = 0) => dg.Register( TimeMachine.RegisterLateUpdate(lateupdateAction, order));
public static DisposableGroup RegisterEvent(this DisposableGroup dg, string EventName, Action <object> Handler, string EventGroup = XEvent.DefaultGroup) => dg.Register(XEvent.Register(EventName, Handler, EventGroup));