mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-26 18:26:23 +00:00
添加线程逻辑执行
This commit is contained in:
@@ -33,11 +33,6 @@ public class DApplication : MonoBehaviour
|
||||
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
App.Game.Update();
|
||||
}
|
||||
|
||||
public void OnClickPlayerCreate()
|
||||
{
|
||||
var input = App.Game.GetInput<IDWorld>();
|
||||
|
@@ -26,6 +26,13 @@ namespace AppGame.Systems
|
||||
|
||||
}
|
||||
|
||||
public override void OnClose()
|
||||
{
|
||||
base.OnClose();
|
||||
client?.Dispose();
|
||||
server?.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 运行同步类
|
||||
/// </summary>
|
||||
@@ -33,24 +40,17 @@ namespace AppGame.Systems
|
||||
{
|
||||
client = new T();
|
||||
client.Initialize();
|
||||
client.TStartExecute();
|
||||
return client as T;
|
||||
}
|
||||
public T StartServer<T>() where T : JNSStateServerService,new()
|
||||
{
|
||||
server = new T();
|
||||
server.Initialize();
|
||||
server.TStartExecute();
|
||||
return server as T;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新周期
|
||||
/// </summary>
|
||||
public void Update()
|
||||
{
|
||||
client?.Execute();
|
||||
server?.Execute();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取第一个客户端的输入类
|
||||
/// </summary>
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using Game.JNGFrame.View.Entity;
|
||||
using JNGame.Sync.System;
|
||||
using JNGame.Sync.View;
|
||||
using JNGame.Util;
|
||||
|
||||
namespace Game.JNGFrame.View
|
||||
{
|
||||
@@ -23,7 +24,8 @@ namespace Game.JNGFrame.View
|
||||
base.OnSyncUpdate(dt);
|
||||
foreach (var view in views)
|
||||
{
|
||||
view.Execute();
|
||||
//视图逻辑交给主线程运行
|
||||
UnityMainThreadDispatcher.Instance.Enqueue(view.Execute);
|
||||
}
|
||||
}
|
||||
// public override void Execute()
|
||||
|
Reference in New Issue
Block a user