提交demo

This commit is contained in:
PC-20230316NUNE\Administrator 2024-08-21 16:18:52 +08:00
parent 17cb342387
commit 5858bd2407
23 changed files with 4418 additions and 9411 deletions

View File

@ -6,8 +6,10 @@
NActionDemo = 2, //Demo 消息
NActionDemo2 = 3, //Demo 消息
ClientConnect = 11, //客户端连接
ClientDisconnect = 12, //客户端断开
LocalClientConnect = 11, //客户端连接 (用于客户端通知)
LocalClientDisconnect = 12, //客户端断开 (用于客户端通知)
ServerClientConnect = 13, //服务器客户端连接 (用于服务端通知)
ServerClientDisconnect = 14, //服务器客户端断开 (用于服务端通知)
NSyncFrameStart = 100, //帧同步开始
NSyncFrameEnd = 101, //帧同步结束

View File

@ -29,6 +29,9 @@ namespace Plugins.JNGame.Network
public async Task StartConnect()
{
var url = $"{await this.GetUrl()}";
this._socket = new WebSocket(new Uri(url));

View File

@ -63,7 +63,7 @@ namespace JNGame.Network
private Task OnConnected(ITcpClient client, ConnectedEventArgs e)
{
Debug.Log($"[JNTCPClient] 服务器连接成功");
Dispatch(new JNetParam(_id++,(int)NActionEnum.ClientConnect));
Dispatch(new JNetParam(_id++,(int)NActionEnum.LocalClientConnect));
return Task.CompletedTask;
}
@ -77,7 +77,7 @@ namespace JNGame.Network
private Task OnDisconnected(ITcpClientBase client, DisconnectEventArgs e)
{
Debug.Log($"[JNTCPClient] 服务器断开");
Dispatch(new JNetParam(_id++,(int)NActionEnum.ClientDisconnect));
Dispatch(new JNetParam(_id++,(int)NActionEnum.LocalClientDisconnect));
return Task.CompletedTask;
}

View File

@ -62,7 +62,7 @@ namespace JNGame.Network
private Task OnConnected(SocketClient client, ConnectedEventArgs e)
{
Debug.Log($"[JNTCPServer] 有客户端连接成功");
Dispatch((int)NActionEnum.ClientConnect,new JNServerParam()
Dispatch((int)NActionEnum.LocalClientConnect,new JNServerParam()
{
Client = client.Id
});
@ -79,7 +79,7 @@ namespace JNGame.Network
private Task OnDisconnected(SocketClient client, DisconnectEventArgs e)
{
Debug.Log($"[JNTCPServer] 有客户端断开连接");
Dispatch((int)NActionEnum.ClientDisconnect,new JNServerParam()
Dispatch((int)NActionEnum.LocalClientDisconnect,new JNServerParam()
{
Client = client.Id
});

View File

@ -22,30 +22,34 @@ public static partial class JNSyncMessageReflection {
static JNSyncMessageReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"ChNKTlN5bmNNZXNzYWdlLnByb3RvIksKDEpORnJhbWVJbnB1dBILCgNuSWQY",
"ASABKAUSEgoFaW5wdXQYAiABKAxIAIgBARIQCghjbGllbnRJZBgDIAEoBUII",
"CgZfaW5wdXQiLgoNSk5GcmFtZUlucHV0cxIdCgZpbnB1dHMYASADKAsyDS5K",
"TkZyYW1lSW5wdXQiPQoLSk5GcmFtZUluZm8SDQoFaW5kZXgYASABKAUSHwoI",
"bWVzc2FnZXMYAiADKAsyDS5KTkZyYW1lSW5wdXQiLAoMSk5GcmFtZUluZm9z",
"EhwKBmZyYW1lcxgBIAMoCzIMLkpORnJhbWVJbmZvIisKB0pOSW5wdXQSFAoH",
"bWVzc2FnZRgBIAEoCUgAiAEBQgoKCF9tZXNzYWdlIikKC0pOU3RhdGVEYXRh",
"EhEKBGRhdGEYAiABKAxIAIgBAUIHCgVfZGF0YSKPAQoOSk5TdGF0ZUFsbERh",
"dGESDQoFTmV0SUQYASABKAUSLwoIbWVzc2FnZXMYAiADKAsyHS5KTlN0YXRl",
"QWxsRGF0YS5NZXNzYWdlc0VudHJ5Gj0KDU1lc3NhZ2VzRW50cnkSCwoDa2V5",
"GAEgASgDEhsKBXZhbHVlGAIgASgLMgwuSk5TdGF0ZURhdGE6AjgBIpEBCg9K",
"TlN0YXRlSXRlbURhdGESDQoFTmV0SUQYASABKAUSMAoIbWVzc2FnZXMYAiAD",
"KAsyHi5KTlN0YXRlSXRlbURhdGEuTWVzc2FnZXNFbnRyeRo9Cg1NZXNzYWdl",
"c0VudHJ5EgsKA2tleRgBIAEoAxIbCgV2YWx1ZRgCIAEoCzIMLkpOU3RhdGVE",
"YXRhOgI4ASJBChFKTlN0YXRlVGlsZUlucHV0cxILCgN0SWQYASABKAUSHwoH",
"bWVzc2FnZRgCIAEoCzIOLkpORnJhbWVJbnB1dHMiQgoTSk5TdGF0ZVRpbGVJ",
"dGVtRGF0YRILCgN0SWQYASABKAUSHgoEZGF0YRgCIAEoCzIQLkpOU3RhdGVJ",
"dGVtRGF0YSJAChJKTlN0YXRlVGlsZUFsbERhdGESCwoDdElkGAEgASgFEh0K",
"BGRhdGEYAiABKAsyDy5KTlN0YXRlQWxsRGF0YSI5Cg9KTkFkZFRpbGVTZXJ2",
"ZXISDAoEdGlsZRgBIAEoBRIKCgJpcBgCIAEoCRIMCgRwb3J0GAMgASgFQhYK",
"FGNuLmppc29sLm5nYW1lLnByb3RvYgZwcm90bzM="));
"ChNKTlN5bmNNZXNzYWdlLnByb3RvIiMKD0pOQ2xpZW50Q29ubmVjdBIQCghj",
"bGllbnRJZBgBIAEoCSImChJKTkNsaWVudERpc2Nvbm5lY3QSEAoIY2xpZW50",
"SWQYASABKAkiSwoMSk5GcmFtZUlucHV0EgsKA25JZBgBIAEoBRISCgVpbnB1",
"dBgCIAEoDEgAiAEBEhAKCGNsaWVudElkGAMgASgFQggKBl9pbnB1dCIuCg1K",
"TkZyYW1lSW5wdXRzEh0KBmlucHV0cxgBIAMoCzINLkpORnJhbWVJbnB1dCI9",
"CgtKTkZyYW1lSW5mbxINCgVpbmRleBgBIAEoBRIfCghtZXNzYWdlcxgCIAMo",
"CzINLkpORnJhbWVJbnB1dCIsCgxKTkZyYW1lSW5mb3MSHAoGZnJhbWVzGAEg",
"AygLMgwuSk5GcmFtZUluZm8iKwoHSk5JbnB1dBIUCgdtZXNzYWdlGAEgASgJ",
"SACIAQFCCgoIX21lc3NhZ2UiKQoLSk5TdGF0ZURhdGESEQoEZGF0YRgCIAEo",
"DEgAiAEBQgcKBV9kYXRhIo8BCg5KTlN0YXRlQWxsRGF0YRINCgVOZXRJRBgB",
"IAEoBRIvCghtZXNzYWdlcxgCIAMoCzIdLkpOU3RhdGVBbGxEYXRhLk1lc3Nh",
"Z2VzRW50cnkaPQoNTWVzc2FnZXNFbnRyeRILCgNrZXkYASABKAMSGwoFdmFs",
"dWUYAiABKAsyDC5KTlN0YXRlRGF0YToCOAEikQEKD0pOU3RhdGVJdGVtRGF0",
"YRINCgVOZXRJRBgBIAEoBRIwCghtZXNzYWdlcxgCIAMoCzIeLkpOU3RhdGVJ",
"dGVtRGF0YS5NZXNzYWdlc0VudHJ5Gj0KDU1lc3NhZ2VzRW50cnkSCwoDa2V5",
"GAEgASgDEhsKBXZhbHVlGAIgASgLMgwuSk5TdGF0ZURhdGE6AjgBIkEKEUpO",
"U3RhdGVUaWxlSW5wdXRzEgsKA3RJZBgBIAEoBRIfCgdtZXNzYWdlGAIgASgL",
"Mg4uSk5GcmFtZUlucHV0cyJCChNKTlN0YXRlVGlsZUl0ZW1EYXRhEgsKA3RJ",
"ZBgBIAEoBRIeCgRkYXRhGAIgASgLMhAuSk5TdGF0ZUl0ZW1EYXRhIkAKEkpO",
"U3RhdGVUaWxlQWxsRGF0YRILCgN0SWQYASABKAUSHQoEZGF0YRgCIAEoCzIP",
"LkpOU3RhdGVBbGxEYXRhIjkKD0pOQWRkVGlsZVNlcnZlchIMCgR0aWxlGAEg",
"ASgFEgoKAmlwGAIgASgJEgwKBHBvcnQYAyABKAVCFgoUY24uamlzb2wubmdh",
"bWUucHJvdG9iBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::JNClientConnect), global::JNClientConnect.Parser, new[]{ "ClientId" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::JNClientDisconnect), global::JNClientDisconnect.Parser, new[]{ "ClientId" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::JNFrameInput), global::JNFrameInput.Parser, new[]{ "NId", "Input", "ClientId" }, new[]{ "Input" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::JNFrameInputs), global::JNFrameInputs.Parser, new[]{ "Inputs" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::JNFrameInfo), global::JNFrameInfo.Parser, new[]{ "Index", "Messages" }, null, null, null, null),
@ -64,6 +68,397 @@ public static partial class JNSyncMessageReflection {
}
#region Messages
/// <summary>
/// ---------------------- 状态 --------------------------
///连接客户端
/// </summary>
public sealed partial class JNClientConnect : pb::IMessage<JNClientConnect>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<JNClientConnect> _parser = new pb::MessageParser<JNClientConnect>(() => new JNClientConnect());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<JNClientConnect> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public JNClientConnect() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public JNClientConnect(JNClientConnect other) : this() {
clientId_ = other.clientId_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public JNClientConnect Clone() {
return new JNClientConnect(this);
}
/// <summary>Field number for the "clientId" field.</summary>
public const int ClientIdFieldNumber = 1;
private string clientId_ = "";
/// <summary>
///客户端Id
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string ClientId {
get { return clientId_; }
set {
clientId_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as JNClientConnect);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(JNClientConnect other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (ClientId != other.ClientId) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (ClientId.Length != 0) hash ^= ClientId.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (ClientId.Length != 0) {
output.WriteRawTag(10);
output.WriteString(ClientId);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (ClientId.Length != 0) {
output.WriteRawTag(10);
output.WriteString(ClientId);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (ClientId.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(ClientId);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(JNClientConnect other) {
if (other == null) {
return;
}
if (other.ClientId.Length != 0) {
ClientId = other.ClientId;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
ClientId = input.ReadString();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
ClientId = input.ReadString();
break;
}
}
}
}
#endif
}
/// <summary>
///断开客户端
/// </summary>
public sealed partial class JNClientDisconnect : pb::IMessage<JNClientDisconnect>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<JNClientDisconnect> _parser = new pb::MessageParser<JNClientDisconnect>(() => new JNClientDisconnect());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<JNClientDisconnect> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[1]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public JNClientDisconnect() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public JNClientDisconnect(JNClientDisconnect other) : this() {
clientId_ = other.clientId_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public JNClientDisconnect Clone() {
return new JNClientDisconnect(this);
}
/// <summary>Field number for the "clientId" field.</summary>
public const int ClientIdFieldNumber = 1;
private string clientId_ = "";
/// <summary>
///客户端Id
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string ClientId {
get { return clientId_; }
set {
clientId_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as JNClientDisconnect);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(JNClientDisconnect other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (ClientId != other.ClientId) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (ClientId.Length != 0) hash ^= ClientId.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (ClientId.Length != 0) {
output.WriteRawTag(10);
output.WriteString(ClientId);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (ClientId.Length != 0) {
output.WriteRawTag(10);
output.WriteString(ClientId);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (ClientId.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(ClientId);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(JNClientDisconnect other) {
if (other == null) {
return;
}
if (other.ClientId.Length != 0) {
ClientId = other.ClientId;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
ClientId = input.ReadString();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
ClientId = input.ReadString();
break;
}
}
}
}
#endif
}
/// <summary>
/// ---------------------- 帧同步 --------------------------
///帧同步输入
@ -82,7 +477,7 @@ public sealed partial class JNFrameInput : pb::IMessage<JNFrameInput>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[0]; }
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[2]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -369,7 +764,7 @@ public sealed partial class JNFrameInputs : pb::IMessage<JNFrameInputs>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[1]; }
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[3]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -553,7 +948,7 @@ public sealed partial class JNFrameInfo : pb::IMessage<JNFrameInfo>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[2]; }
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[4]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -777,7 +1172,7 @@ public sealed partial class JNFrameInfos : pb::IMessage<JNFrameInfos>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[3]; }
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[5]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -961,7 +1356,7 @@ public sealed partial class JNInput : pb::IMessage<JNInput>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[4]; }
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[6]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1166,7 +1561,7 @@ public sealed partial class JNStateData : pb::IMessage<JNStateData>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[5]; }
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[7]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1373,7 +1768,7 @@ public sealed partial class JNStateAllData : pb::IMessage<JNStateAllData>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[6]; }
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[8]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1597,7 +1992,7 @@ public sealed partial class JNStateItemData : pb::IMessage<JNStateItemData>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[7]; }
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[9]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1822,7 +2217,7 @@ public sealed partial class JNStateTileInputs : pb::IMessage<JNStateTileInputs>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[8]; }
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[10]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -2066,7 +2461,7 @@ public sealed partial class JNStateTileItemData : pb::IMessage<JNStateTileItemDa
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[9]; }
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[11]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -2307,7 +2702,7 @@ public sealed partial class JNStateTileAllData : pb::IMessage<JNStateTileAllData
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[10]; }
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[12]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -2548,7 +2943,7 @@ public sealed partial class JNAddTileServer : pb::IMessage<JNAddTileServer>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[11]; }
get { return global::JNSyncMessageReflection.Descriptor.MessageTypes[13]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]

View File

@ -2,6 +2,17 @@ syntax = "proto3";
option java_package = "cn.jisol.ngame.proto";
// ---------------------- --------------------------
//
message JNClientConnect{
string clientId = 1; //Id
}
//
message JNClientDisconnect{
string clientId = 1; //Id
}
// ---------------------- --------------------------
//
message JNFrameInput{

View File

@ -46,10 +46,14 @@ namespace JNGame.Sync.System.Data
{
//如果有则删除
if (lIsTileData.Remove(child.Id,out var data))
{
//同步不属于自己的实体
if (!child.IsHost)
{
//并且同步属性到实体中
child.TileSyncData(data);
}
}
});
//将数据同步到实体中

View File

@ -42,7 +42,6 @@ namespace Plugins.JNGame.Util
{
var request = UnityWebRequest.Get($"{this._config.BaseURL}/{url}");
var text = (await request.SendWebRequest()).downloadHandler.text;
Debug.Log(text);
return JsonConvert.DeserializeObject<NewsContext<T>>(text);
}

View File

@ -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);

View File

@ -128,11 +128,14 @@ namespace AppGame.Sync
{
//插入未处理输入
lock (Inputs)
{
foreach (var input in Inputs)
{
GetSystem<DInputSystem>().Enqueue(input);
}
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);

View File

@ -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();

View File

@ -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;

View File

@ -21,5 +21,6 @@ namespace Game.JNGFrame.Logic.Entity.Components
base.BindType(types);
types.Add(Movement,typeof(EDMoveComponent));
}
}
}

View File

@ -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);
}

View File

@ -46,7 +46,6 @@ namespace UI
};
if (App.Game.IsStartGame)
{
Debug.Log($"{vector.X} {vector.Y}");
App.Game.GetInput<IDPlayer>().MoveVector = vector;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
Base path: 'D:/Unity/2021.3.35f1/Editor/Data', plugins path 'D:/Unity/2021.3.35f1/Editor/Data/PlaybackEngines'
Cmd: initializeCompiler

View File

@ -119,7 +119,7 @@ MonoBehaviour:
m_MinSize: {x: 400, y: 200}
m_MaxSize: {x: 32384, y: 16192}
vertical: 0
controlID: 17
controlID: 73
--- !u!114 &6
MonoBehaviour:
m_ObjectHideFlags: 52
@ -144,7 +144,7 @@ MonoBehaviour:
m_MinSize: {x: 300, y: 200}
m_MaxSize: {x: 24288, y: 16192}
vertical: 1
controlID: 18
controlID: 74
--- !u!114 &7
MonoBehaviour:
m_ObjectHideFlags: 52
@ -170,7 +170,7 @@ MonoBehaviour:
m_MinSize: {x: 300, y: 100}
m_MaxSize: {x: 24288, y: 8096}
vertical: 0
controlID: 96
controlID: 75
--- !u!114 &8
MonoBehaviour:
m_ObjectHideFlags: 52
@ -214,7 +214,7 @@ MonoBehaviour:
serializedVersion: 2
x: 264
y: 0
width: 709
width: 710
height: 384
m_MinSize: {x: 202, y: 221}
m_MaxSize: {x: 4002, y: 4021}
@ -239,9 +239,9 @@ MonoBehaviour:
m_Children: []
m_Position:
serializedVersion: 2
x: 973
x: 974
y: 0
width: 495
width: 494
height: 384
m_MinSize: {x: 102, y: 121}
m_MaxSize: {x: 4002, y: 4021}
@ -324,9 +324,9 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 973
x: 974
y: 73
width: 493
width: 492
height: 363
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
@ -341,7 +341,7 @@ MonoBehaviour:
m_ShowGizmos: 0
m_TargetDisplay: 0
m_ClearColor: {r: 0, g: 0, b: 0, a: 0}
m_TargetSize: {x: 493, y: 342}
m_TargetSize: {x: 492, y: 342}
m_TextureFilterMode: 0
m_TextureHideFlags: 61
m_RenderIMGUI: 1
@ -356,8 +356,8 @@ MonoBehaviour:
m_VRangeLocked: 0
hZoomLockedByDefault: 0
vZoomLockedByDefault: 0
m_HBaseRangeMin: -246.5
m_HBaseRangeMax: 246.5
m_HBaseRangeMin: -246
m_HBaseRangeMax: 246
m_VBaseRangeMin: -171
m_VBaseRangeMax: 171
m_HAllowExceedBaseRangeMin: 1
@ -368,7 +368,7 @@ MonoBehaviour:
m_HSlider: 0
m_VSlider: 0
m_IgnoreScrollWheelUntilClicked: 0
m_EnableMouseInput: 1
m_EnableMouseInput: 0
m_EnableSliderZoomHorizontal: 0
m_EnableSliderZoomVertical: 0
m_UniformScale: 1
@ -377,23 +377,23 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 21
width: 493
width: 492
height: 342
m_Scale: {x: 1, y: 1}
m_Translation: {x: 246.5, y: 171}
m_Translation: {x: 246, y: 171}
m_MarginLeft: 0
m_MarginRight: 0
m_MarginTop: 0
m_MarginBottom: 0
m_LastShownAreaInsideMargins:
serializedVersion: 2
x: -246.5
x: -246
y: -171
width: 493
width: 492
height: 342
m_MinimalGUI: 1
m_defaultScale: 1
m_LastWindowPixelSize: {x: 493, y: 363}
m_LastWindowPixelSize: {x: 492, y: 363}
m_ClearInEditMode: 1
m_NoCameraWarning: 1
m_LowResolutionForAspectRatios: 01000000000000000000
@ -448,8 +448,8 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: -32000
y: -31586
x: 0
y: 457
width: 1467
height: 534
m_ViewDataDictionary: {fileID: 0}
@ -489,9 +489,9 @@ MonoBehaviour:
m_SceneHierarchy:
m_TreeViewState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_SelectedIDs: 00930000
m_LastClickedID: 0
m_ExpandedIDs: ee51ffff3054ffff8654ffff4257ffff4657ffffe058ffffd65affff8668ffffdc68ffff986bffff9c6bffffe06effff366ffffff271fffff671ffff0c7bffff627bffff1e7effff227efffff085ffff4686ffff0289ffff0689ffffac8dffff028effffbe90ffffc290ffff5e96ffffb496ffff7099ffff7499ffffb69dffff0c9effffc8a0ffffcca0ffffaea5ffff04a6ffffc0a8ffffc4a8ffffecb2ffff42b3ffff02b6ffff0ab6ffffd2bcffff76bdfffff4d8ffff16fbfffff4ffffff88b20000a6b30000
m_ExpandedIDs: 7adeffff9ee1ffffb8e3ffff0ee4ffffcae6ffffcee6ffff12eaffffb8ecffff0eedffffcaefffffceefffffc8f1ffff46f6ffff9cf6ffff58f9ffff5cf9ffff16fbfffff092000000930000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -537,7 +537,7 @@ MonoBehaviour:
serializedVersion: 2
x: 264
y: 73
width: 707
width: 708
height: 363
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
@ -829,9 +829,9 @@ MonoBehaviour:
m_PlayAudio: 0
m_AudioPlay: 0
m_Position:
m_Target: {x: 115.69666, y: 156.10828, z: -93.89607}
m_Target: {x: 207.45923, y: 142.01059, z: -10.114366}
speed: 2
m_Value: {x: 115.69666, y: 156.10828, z: -93.89607}
m_Value: {x: 207.45923, y: 142.01059, z: -10.114366}
m_RenderMode: 0
m_CameraMode:
drawMode: 0
@ -878,9 +878,9 @@ MonoBehaviour:
m_GridAxis: 1
m_gridOpacity: 0.5
m_Rotation:
m_Target: {x: -0.35689405, y: -0.06941557, z: 0.026610041, w: -0.93119174}
m_Target: {x: -0.54965925, y: 0.14655384, z: -0.09864675, w: -0.8165088}
speed: 2
m_Value: {x: -0.3568505, y: -0.07081164, z: 0.027145106, w: -0.93107814}
m_Value: {x: -0.5496534, y: 0.1465523, z: -0.09864571, w: -0.8165002}
m_Size:
m_Target: 3.155869
speed: 2
@ -992,9 +992,9 @@ MonoBehaviour:
m_IsLocked: 0
m_FolderTreeState:
scrollPos: {x: 0, y: 199}
m_SelectedIDs: fe730000
m_LastClickedID: 29694
m_ExpandedIDs: 00000000827300008473000086730000887300008a7300008c7300008e73000090730000927300009473000096730000d673000000ca9a3bffffff7f
m_SelectedIDs: d28c0000
m_LastClickedID: 36050
m_ExpandedIDs: 00000000c2730000c4730000c6730000c8730000ca730000cc730000ce730000d0730000d2730000d4730000d673000000ca9a3bffffff7f
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -1022,7 +1022,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 00000000827300008473000086730000887300008a7300008c7300008e73000090730000927300009473000096730000
m_ExpandedIDs: 00000000c2730000c4730000c6730000c8730000ca730000cc730000ce730000d0730000d2730000d4730000d6730000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -1047,9 +1047,9 @@ MonoBehaviour:
m_Icon: {fileID: 0}
m_ResourceFile:
m_ListAreaState:
m_SelectedInstanceIDs: 48780000
m_LastClickedInstanceID: 30792
m_HadKeyboardFocusLastEvent: 1
m_SelectedInstanceIDs:
m_LastClickedInstanceID: 0
m_HadKeyboardFocusLastEvent: 0
m_ExpandedInstanceIDs: c623000000000000
m_RenameOverlay:
m_UserAcceptedRename: 0

View File

@ -50,8 +50,8 @@ public class WebSocket {
@OnClose
public void onClose(Session session){
NClient client = CLIENTS.get(session.getId());
JNetwork.onDisconnect(client,client,CLIENTS);
CLIENTS.remove(session.getId());
JNetwork.onDisconnect(client,client,CLIENTS);
if(CLIENTS.size() == 0){
SystemAction.NSyncFrameEnd();
}

@ -1 +1 @@
Subproject commit ea4abb5d6b04999aabb97c97c398e040339cb352
Subproject commit 4252d755a7ddf5ff613d7383600dee71b4cd7ac6