diff --git a/Assets/DLL/TEngineHotUpdate.dll b/Assets/DLL/TEngineHotUpdate.dll index 0237998e..484ec707 100644 Binary files a/Assets/DLL/TEngineHotUpdate.dll and b/Assets/DLL/TEngineHotUpdate.dll differ diff --git a/Assets/TEngine/Runtime/HotUpdate/Runtime/LoadDll.cs b/Assets/TEngine/Runtime/HotUpdate/Runtime/LoadDll.cs index 5a1513e2..b2a88c7e 100644 --- a/Assets/TEngine/Runtime/HotUpdate/Runtime/LoadDll.cs +++ b/Assets/TEngine/Runtime/HotUpdate/Runtime/LoadDll.cs @@ -9,7 +9,7 @@ using UnityEngine; public class LoadDll : MonoBehaviour { private System.Reflection.Assembly gameLogic; - private MethodInfo updateMethod; + private Action updateAction; void Start() { @@ -39,12 +39,9 @@ public class LoadDll : MonoBehaviour AddMyComponent("TEngineCore.TEngineDemo", this.gameObject); - //Type appType = gameLogic.GetType("TEngineCore.TEngine"); - //MethodInfo mainMethod = appType.GetMethod("InitLibImp"); - //mainMethod?.Invoke(null, null); - - //updateMethod = appType.GetMethod("Update"); - //var updateDel = System.Delegate.CreateDelegate(typeof(Action), null, updateMethod); + Type appType = gameLogic.GetType("TEngineCore.TEngineDemo"); + var method = appType.GetMethod("GetUpdateDelegate"); + updateAction = (Action)method.Invoke(null, null); } void AddMyComponent(string className, GameObject obj) @@ -56,10 +53,9 @@ public class LoadDll : MonoBehaviour void Update() { - //if (gameLogic == null) - //{ - // return; - //} - //updateMethod?.Invoke(Time.deltaTime,null); + if(updateAction != null) + { + updateAction(Time.deltaTime); + } } } \ No newline at end of file diff --git a/TEngineHotUpdate/src/TEngineDemo.cs b/TEngineHotUpdate/src/TEngineDemo.cs index fab35b11..81653871 100644 --- a/TEngineHotUpdate/src/TEngineDemo.cs +++ b/TEngineHotUpdate/src/TEngineDemo.cs @@ -1,4 +1,5 @@ -using TEngineCore.Net; +using System; +using TEngineCore.Net; namespace TEngineCore { @@ -19,5 +20,15 @@ namespace TEngineCore GameClient.Instance.Connect("127.0.0.1", 54809, true); } + + public static Action GetUpdateDelegate() + { + return Update; + } + + public static void Update(float deltaTime) + { + UnityEngine.Debug.Log("HuaTuo热更域Update"); + } } } \ No newline at end of file