mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
HuaTuo最佳实践Update
HuaTuo最佳实践Update
This commit is contained in:
Binary file not shown.
@@ -9,7 +9,7 @@ using UnityEngine;
|
|||||||
public class LoadDll : MonoBehaviour
|
public class LoadDll : MonoBehaviour
|
||||||
{
|
{
|
||||||
private System.Reflection.Assembly gameLogic;
|
private System.Reflection.Assembly gameLogic;
|
||||||
private MethodInfo updateMethod;
|
private Action<float> updateAction;
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
@@ -39,12 +39,9 @@ public class LoadDll : MonoBehaviour
|
|||||||
|
|
||||||
AddMyComponent("TEngineCore.TEngineDemo", this.gameObject);
|
AddMyComponent("TEngineCore.TEngineDemo", this.gameObject);
|
||||||
|
|
||||||
//Type appType = gameLogic.GetType("TEngineCore.TEngine");
|
Type appType = gameLogic.GetType("TEngineCore.TEngineDemo");
|
||||||
//MethodInfo mainMethod = appType.GetMethod("InitLibImp");
|
var method = appType.GetMethod("GetUpdateDelegate");
|
||||||
//mainMethod?.Invoke(null, null);
|
updateAction = (Action<float>)method.Invoke(null, null);
|
||||||
|
|
||||||
//updateMethod = appType.GetMethod("Update");
|
|
||||||
//var updateDel = System.Delegate.CreateDelegate(typeof(Action<float>), null, updateMethod);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddMyComponent(string className, GameObject obj)
|
void AddMyComponent(string className, GameObject obj)
|
||||||
@@ -56,10 +53,9 @@ public class LoadDll : MonoBehaviour
|
|||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
//if (gameLogic == null)
|
if(updateAction != null)
|
||||||
//{
|
{
|
||||||
// return;
|
updateAction(Time.deltaTime);
|
||||||
//}
|
}
|
||||||
//updateMethod?.Invoke(Time.deltaTime,null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,4 +1,5 @@
|
|||||||
using TEngineCore.Net;
|
using System;
|
||||||
|
using TEngineCore.Net;
|
||||||
|
|
||||||
namespace TEngineCore
|
namespace TEngineCore
|
||||||
{
|
{
|
||||||
@@ -19,5 +20,15 @@ namespace TEngineCore
|
|||||||
|
|
||||||
GameClient.Instance.Connect("127.0.0.1", 54809, true);
|
GameClient.Instance.Connect("127.0.0.1", 54809, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Action<float> GetUpdateDelegate()
|
||||||
|
{
|
||||||
|
return Update;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Update(float deltaTime)
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.Log("HuaTuo热更域Update");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user