mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-26 18:26:23 +00:00
提交demo
This commit is contained in:
@@ -177,13 +177,13 @@ namespace AppGame.Sync
|
||||
|
||||
if (IsTileConnect(index))
|
||||
{
|
||||
Debug.Log($"[{index}] 连接 Socket");
|
||||
App.Client.AddClient(client);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Sockets.Remove(index);
|
||||
Debug.Log("获取连接失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -192,6 +192,7 @@ namespace AppGame.Sync
|
||||
{
|
||||
if (Sockets.TryGetValue(index,out var client))
|
||||
{
|
||||
Debug.Log($"[{index}] 卸载 Socket");
|
||||
App.Client.RemoveClient(client);
|
||||
}
|
||||
Sockets.Remove(index);
|
||||
|
@@ -128,11 +128,14 @@ namespace AppGame.Sync
|
||||
{
|
||||
|
||||
//插入未处理输入
|
||||
foreach (var input in Inputs)
|
||||
lock (Inputs)
|
||||
{
|
||||
GetSystem<DInputSystem>().Enqueue(input);
|
||||
foreach (var input in Inputs)
|
||||
{
|
||||
GetSystem<DInputSystem>().Enqueue(input);
|
||||
}
|
||||
Inputs.Clear();
|
||||
}
|
||||
Inputs.Clear();
|
||||
base.OnRunSimulate();
|
||||
|
||||
}
|
||||
@@ -202,13 +205,13 @@ namespace AppGame.Sync
|
||||
TileServerInfo info = message.data;
|
||||
if (info is not null)
|
||||
{
|
||||
Debug.Log($"[{index}] 连接 Socket");
|
||||
client.SetPoint($"{info.ip}:{info.port}");
|
||||
await client.OnInit();
|
||||
}
|
||||
else
|
||||
{
|
||||
Sockets.Remove(index);
|
||||
Debug.Log("获取连接失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -217,6 +220,7 @@ namespace AppGame.Sync
|
||||
{
|
||||
if (Sockets.TryGetValue(index,out var client))
|
||||
{
|
||||
Debug.Log($"[{index}] 卸载 Socket");
|
||||
client.OnClose();
|
||||
}
|
||||
Sockets.Remove(index);
|
||||
|
@@ -35,7 +35,7 @@ namespace AppGame.Systems
|
||||
|
||||
//监听服务端事件
|
||||
AddListener((int)NActionEnum.NSyncStateDataUpdate,OnNSyncStateDataUpdate);
|
||||
AddListener((int)NActionEnum.ClientConnect,OnClientConnect);
|
||||
AddListener((int)NActionEnum.LocalClientConnect,OnClientConnect);
|
||||
|
||||
//连接
|
||||
await base.OnInit();
|
||||
|
@@ -78,7 +78,6 @@ namespace Game.JNGState.Logic.Data
|
||||
if (bytes.Length == 0) return;
|
||||
var value = JsonConvert.DeserializeObject<EDNodeValue>(Encoding.UTF8.GetString(bytes));
|
||||
if (value.Position is not null) Value.Position = value.Position;
|
||||
|
||||
}
|
||||
}
|
||||
public class EDNodeDataSystem : DStateDataSystem<EDNodeData,EDNode>
|
||||
@@ -97,6 +96,11 @@ namespace Game.JNGState.Logic.Data
|
||||
var nodes = new Dictionary<long, EDNodeData>();
|
||||
NodeContext.GetEntities().ForEach(child =>
|
||||
{
|
||||
if (nodes.ContainsKey(child.Id))
|
||||
{
|
||||
Debug.Log($"[EDNodeDataSystem] 出错 发现重复Key");
|
||||
return;
|
||||
}
|
||||
nodes.Add(child.Id,new EDNodeData(child));
|
||||
});
|
||||
return nodes;
|
||||
|
@@ -21,5 +21,6 @@ namespace Game.JNGFrame.Logic.Entity.Components
|
||||
base.BindType(types);
|
||||
types.Add(Movement,typeof(EDMoveComponent));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -36,6 +36,7 @@ namespace Game.JNGFrame.View.Entity
|
||||
{
|
||||
view.transform.DOKill();
|
||||
view.transform.DOMove(data.Value.Position.ToVector3(), 0.5f);
|
||||
// view.transform.position = data.Value.Position.ToVector3();
|
||||
// view.transform.DOKill();
|
||||
// view.transform.DOMove(pos = pos + new Vector3(0,0,10f / 15), 0.07f);
|
||||
}
|
||||
|
@@ -46,7 +46,6 @@ namespace UI
|
||||
};
|
||||
if (App.Game.IsStartGame)
|
||||
{
|
||||
Debug.Log($"{vector.X} {vector.Y}");
|
||||
App.Game.GetInput<IDPlayer>().MoveVector = vector;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user