| | |
| | | |
| | | private ILRuntime.Runtime.Enviorment.AppDomain _appdomain; |
| | | |
| | | public ILRuntime.Runtime.Enviorment.AppDomain appDomain |
| | | public ILRuntime.Runtime.Enviorment.AppDomain appdomain |
| | | { |
| | | get |
| | | { |
| | |
| | | if (type != null) |
| | | { |
| | | var m = type.GetMethod("Initialize"); |
| | | m.Invoke(null, new object[] { appDomain }); |
| | | m.Invoke(null, new object[] { appdomain }); |
| | | } |
| | | #else |
| | | ILRuntime.Runtime.Generated.CLRBindings.Initialize(_appdomain); |
| | |
| | | //注册跨域继承适配器 |
| | | private void RegisterCrossBindingAdaptor() |
| | | { |
| | | appDomain.RegisterCrossBindingAdaptor(new CoroutineAdapter()); |
| | | appDomain.RegisterCrossBindingAdaptor(new DtcBasicAdapter()); |
| | | appDomain.RegisterCrossBindingAdaptor(new GameNetPackBasicAdapter()); |
| | | appdomain.RegisterCrossBindingAdaptor(new CoroutineAdapter()); |
| | | appdomain.RegisterCrossBindingAdaptor(new DtcBasicAdapter()); |
| | | appdomain.RegisterCrossBindingAdaptor(new GameNetPackBasicAdapter()); |
| | | } |
| | | |
| | | //注册值类型绑定 |
| | | private void RegisterValueTypeBinder() |
| | | { |
| | | appDomain.RegisterValueTypeBinder(typeof(Vector3), new Vector3Binder()); |
| | | appDomain.RegisterValueTypeBinder(typeof(Quaternion), new QuaternionBinder()); |
| | | appDomain.RegisterValueTypeBinder(typeof(Vector2), new Vector2Binder()); |
| | | appdomain.RegisterValueTypeBinder(typeof(Vector3), new Vector3Binder()); |
| | | appdomain.RegisterValueTypeBinder(typeof(Quaternion), new QuaternionBinder()); |
| | | appdomain.RegisterValueTypeBinder(typeof(Vector2), new Vector2Binder()); |
| | | } |
| | | |
| | | //注册委托 |
| | | private void RegisterDelegate() |
| | | { |
| | | //无返回值 |
| | | appDomain.DelegateManager.RegisterMethodDelegate<int>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<long>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<string>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<float>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<double>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<bool>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<byte[]>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<bool, bool>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<bool, string>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<int, string>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<int, float>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<string, int>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<int, bool, string>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<int, int>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<int, bool>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<bool, int>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<ulong>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<uint>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<Snxxz.UI.Operation>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<float, Vector2>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<int, Transform>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<Vector2>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<Vector3>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<Transform>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<GameObject>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<Component>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<E_AttackMode>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<PlayerDataType>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<PlayerDataType, int>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<List<Vector3>>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<ChatData>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<VoiceHttpRequest.VoiceDecodec>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<Snxxz.UI.ComposeMatCell, NeedMatType>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<ItemCompoundConfig, int>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<Snxxz.UI.ComposeMatCell, int, SelectItemType>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<GroupType, bool>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<PackType, int>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<PackType, string>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<PackType, int, int>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<SystemSwitch, bool>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<ChatBoolType, bool>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<E_NpcType, int, uint>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<TeamInviteType>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<Snxxz.UI.PlayerDetails.DetailType>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<FunctionUnlockType>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<TreasureCategory>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<Window>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<TimeMgr.SyntonyType>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<DateTime>(); |
| | | appDomain.DelegateManager.RegisterMethodDelegate<System.Object>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<int>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<long>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<string>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<float>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<double>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<bool>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<byte[]>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<bool, bool>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<bool, string>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<int, string>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<int, float>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<string, int>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<int, bool, string>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<int, int>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<int, bool>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<bool, int>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<ulong>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<uint>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<Snxxz.UI.Operation>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<float, Vector2>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<int, Transform>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<Vector2>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<Vector3>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<Transform>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<GameObject>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<Component>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<E_AttackMode>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<PlayerDataType>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<PlayerDataType, int>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<List<Vector3>>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<ChatData>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<VoiceHttpRequest.VoiceDecodec>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<Snxxz.UI.ComposeMatCell, NeedMatType>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<ItemCompoundConfig, int>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<Snxxz.UI.ComposeMatCell, int, SelectItemType>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<GroupType, bool>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<PackType, int>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<PackType, string>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<PackType, int, int>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<SystemSwitch, bool>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<ChatBoolType, bool>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<E_NpcType, int, uint>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<TeamInviteType>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<Snxxz.UI.PlayerDetails.DetailType>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<FunctionUnlockType>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<TreasureCategory>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<Window>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<TimeMgr.SyntonyType>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<DateTime>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<System.Object>(); |
| | | appdomain.DelegateManager.RegisterMethodDelegate<global::ScrollerDataType, global::CellView>(); |
| | | |
| | | //有返回值 |
| | | appDomain.DelegateManager.RegisterFunctionDelegate<int>(); |
| | | appDomain.DelegateManager.RegisterFunctionDelegate<bool>(); |
| | | appDomain.DelegateManager.RegisterFunctionDelegate<long>(); |
| | | appDomain.DelegateManager.RegisterFunctionDelegate<string>(); |
| | | appDomain.DelegateManager.RegisterFunctionDelegate<float>(); |
| | | appDomain.DelegateManager.RegisterFunctionDelegate<double>(); |
| | | appDomain.DelegateManager.RegisterFunctionDelegate<int, bool>(); |
| | | appDomain.DelegateManager.RegisterFunctionDelegate<System.Int32, System.Int32, System.Int32>(); |
| | | appdomain.DelegateManager.RegisterFunctionDelegate<int>(); |
| | | appdomain.DelegateManager.RegisterFunctionDelegate<bool>(); |
| | | appdomain.DelegateManager.RegisterFunctionDelegate<long>(); |
| | | appdomain.DelegateManager.RegisterFunctionDelegate<string>(); |
| | | appdomain.DelegateManager.RegisterFunctionDelegate<float>(); |
| | | appdomain.DelegateManager.RegisterFunctionDelegate<double>(); |
| | | appdomain.DelegateManager.RegisterFunctionDelegate<int, bool>(); |
| | | appdomain.DelegateManager.RegisterFunctionDelegate<System.Int32, System.Int32, System.Int32>(); |
| | | |
| | | appDomain.DelegateManager.RegisterDelegateConvertor<UnityEngine.Events.UnityAction>((action) => |
| | | //自定义委托转换 |
| | | appdomain.DelegateManager.RegisterDelegateConvertor<UnityEngine.Events.UnityAction>((action) => |
| | | { |
| | | return new UnityEngine.Events.UnityAction(() => |
| | | { |
| | | ((System.Action)action)(); |
| | | }); |
| | | }); |
| | | appDomain.DelegateManager.RegisterDelegateConvertor<System.Threading.WaitCallback>((act) => |
| | | appdomain.DelegateManager.RegisterDelegateConvertor<System.Threading.WaitCallback>((act) => |
| | | { |
| | | return new System.Threading.WaitCallback((state) => |
| | | { |
| | | ((Action<System.Object>)act)(state); |
| | | }); |
| | | }); |
| | | appDomain.DelegateManager.RegisterDelegateConvertor<System.Comparison<System.Int32>>((act) => |
| | | appdomain.DelegateManager.RegisterDelegateConvertor<System.Comparison<System.Int32>>((act) => |
| | | { |
| | | return new System.Comparison<System.Int32>((x, y) => |
| | | { |
| | | return ((Func<System.Int32, System.Int32, System.Int32>)act)(x, y); |
| | | }); |
| | | }); |
| | | appdomain.DelegateManager.RegisterDelegateConvertor<global::ScrollerController.OnRefreshCellDelegate>((act) => |
| | | { |
| | | return new global::ScrollerController.OnRefreshCellDelegate((type, cell) => |
| | | { |
| | | ((Action<global::ScrollerDataType, global::CellView>)act)(type, cell); |
| | | }); |
| | | }); |
| | | } |
| | |
| | | #if UNITY_EDITOR |
| | | _appdomain.DebugService.StartDebugService(56000); |
| | | #endif |
| | | launcherInstance = appDomain.Instantiate("LogicLauncher"); |
| | | launcherInstance = appdomain.Instantiate("LogicLauncher"); |
| | | var type = launcherInstance.Type; |
| | | update = type.GetMethod("Update"); |
| | | onDestroy = type.GetMethod("OnDestroy", 0); |
| | |
| | | private void Update() |
| | | { |
| | | if (update != null) |
| | | appDomain.Invoke(update, launcherInstance); |
| | | appdomain.Invoke(update, launcherInstance); |
| | | } |
| | | |
| | | protected override void OnDestroy() |
| | |
| | | base.OnDestroy(); |
| | | |
| | | if (onDestroy != null) |
| | | appDomain.Invoke(onDestroy, launcherInstance); |
| | | appdomain.Invoke(onDestroy, launcherInstance); |
| | | |
| | | #if UNITY_EDITOR |
| | | var type = Type.GetType("ILRuntime.Runtime.Generated.CLRBindings"); |
| | | if (type != null) |
| | | { |
| | | var m = type.GetMethod("Shutdown"); |
| | | m.Invoke(null, new object[] { appDomain }); |
| | | m.Invoke(null, new object[] { appdomain }); |
| | | } |
| | | #else |
| | | ILRuntime.Runtime.Generated.CLRBindings.Shutdown(appDomain); |