[+] TEngineServer

[+] TEngineServer
This commit is contained in:
ALEXTANG
2023-07-13 17:17:26 +08:00
parent a69f53592e
commit 0c8f3a5f92
790 changed files with 52737 additions and 2533 deletions

View File

@@ -0,0 +1,2 @@
' 127.0.0.1 127.0.0.1" 127.0.0.1(<28><>

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,2 @@
E 测试服mongodb://root:root@127.0.0.1" tengine_main*MongoDB0

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1 @@
{"MachineConfig":1688402650290,"SceneConfig":1688638278438,"WorldConfig":1688296851256,"ServerConfig":1688401154525}

View File

@@ -0,0 +1,12 @@
{
"List": [
{
"Id": 16383,
"SceneType": "ClientNetwork",
"Name": "ClientNetwork",
"NetworkProtocol": "KCP",
"RemoteAddress": "192.168.31.37:20000",
"Platform": "Unity"
},
]
}

View File

@@ -0,0 +1,11 @@
{
"List": [
{
"Id": 1,
"OuterIP": "127.0.0.1",
"OuterBindIP": "127.0.0.1",
"InnerBindIP": "127.0.0.1",
"ManagementPort": 20000
}
]
}

View File

@@ -0,0 +1,44 @@
{
"List": [
{
"Id": 1,
"EntityId": 17246978048,
"RouteId": 1024,
"WorldId": 0,
"SceneType": "Gate",
"Name": "Gate",
"NetworkProtocol": "KCP",
"OuterPort": 20000
},
{
"Id": 2,
"EntityId": 34493956096,
"RouteId": 2048,
"WorldId": 0,
"SceneType": "Addressable",
"Name": "Addressable1",
"NetworkProtocol": null,
"OuterPort": 0
},
{
"Id": 4,
"EntityId": 68920803328,
"RouteId": 3072,
"WorldId": 0,
"SceneType": "Map",
"Name": "Map1",
"NetworkProtocol": null,
"OuterPort": 0
},
{
"Id": 5,
"EntityId": 86167781376,
"RouteId": 4096,
"WorldId": 0,
"SceneType": "Chat",
"Name": "Chat",
"NetworkProtocol": null,
"OuterPort": 0
}
]
}

View File

@@ -0,0 +1,28 @@
{
"List": [
{
"Id": 1024,
"MachineId": 1,
"InnerPort": 11001,
"ReleaseMode": false
},
{
"Id": 2048,
"MachineId": 1,
"InnerPort": 11002,
"ReleaseMode": false
},
{
"Id": 3072,
"MachineId": 1,
"InnerPort": 11003,
"ReleaseMode": false
},
{
"Id": 4096,
"MachineId": 1,
"InnerPort": 11004,
"ReleaseMode": false
}
]
}

View File

@@ -0,0 +1,12 @@
{
"List": [
{
"Id": 1,
"WorldName": "测试服",
"DbConnection": "mongodb://root:root@127.0.0.1",
"DbName": "tengine_main",
"DbType": "MongoDB",
"IsGameWorld": true
}
]
}

View File

@@ -0,0 +1,2 @@
syntax = "proto3";
package Sining.Message;

View File

@@ -0,0 +1,12 @@
syntax = "proto3";
package Sining.Message;
/// Gate跟Map服务器进行通讯、注册Address协议
message I_G2M_LoginAddressRequest // IRouteRequest,I_M2G_LoginAddressResponse
{
long AddressId = 1; // 用来关联Address的Id,一般是账号Id或UnitId这些不会变动的
long GateRouteId = 2; // Gate的RouteIdId用于Map发送给客户端时需要
}
message I_M2G_LoginAddressResponse // IRouteResponse
{
}

View File

@@ -0,0 +1,69 @@
syntax = "proto3";
package TEngine.Network.Message;
/// 发送一个消息到Gate服务器
message H_C2G_Message // IMessage
{
string Message = 1; // 消息信息
}
/// 发送一个RPC消息到Gate服务器
message H_C2G_MessageRequest // IRequest,H_G2C_MessageResponse
{
string Message = 1; // 消息信息
}
message H_G2C_MessageResponse // IResponse
{
string Message = 1; // 服务器返回给客户端的消息信息
}
/// 发送一个消息通知服务器给客户端推送一个消息
message H_C2G_PushMessageToClient // IMessage
{
string Message = 1; // 消息信息
}
/// 客户端接收服务器推送的一条消息
message H_G2C_ReceiveMessageToServer // IMessage
{
string Message = 1; // 消息信息
}
/// 注册Address消息
message H_C2G_LoginAddressRequest // IRequest,H_G2C_LoginAddressResponse
{
string Message = 1; // 消息信息
}
message H_G2C_LoginAddressResponse // IResponse
{
}
/// 发送一个Address消息给Map
message H_C2M_Message // IAddressableRouteMessage
{
string Message = 1; // 消息信息
}
/// 发送一个AddressRPC消息给Map
message H_C2M_MessageRequest // IAddressableRouteRequest,H_M2C_MessageResponse
{
string Message = 1; // 消息信息
}
message H_M2C_MessageResponse // IAddressableRouteResponse
{
string Message = 1; // 返回的消息信息
}
/// 发送一个消息通知服务器给客户端推送一个Address消息
message H_C2M_PushAddressMessageToClient // IAddressableRouteMessage
{
string Message = 1; // 消息信息
}
/// 客户端接收服务器推送的一条Address消息
message H_M2C_ReceiveAddressMessageToServer // IAddressableRouteMessage
{
string Message = 1; // 消息信息
}
/// 客户端发送消息请求登录服务器
message H_C2G_LoginRequest // IRequest,H_G2C_LoginResponse
{
string UserName = 1;
string Password = 2;
}
message H_G2C_LoginResponse // IResponse
{
string Text = 1;
}

View File

@@ -0,0 +1,2 @@
// Route协议定义(需要定义1000以上、因为1000以内的框架预留)
ChatRoute = 1001 // 聊天服协议

View File

@@ -0,0 +1,78 @@
using System;
using ProtoBuf;
using TEngine.Core;
using System.Linq;
using System.Collections.Generic;
// ReSharper disable CollectionNeverUpdated.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
#pragma warning disable CS0169
#pragma warning disable CS8618
#pragma warning disable CS8625
#pragma warning disable CS8603
namespace (namespace)
{
[ProtoContract]
public sealed partial class (ConfigName)Data : AProto, IConfigTable, IDisposable
{
[ProtoMember(1)]
public List<(ConfigName)> List { get; set; } = new List<(ConfigName)>();
[ProtoIgnore]
private readonly Dictionary<uint, (ConfigName)> _configs = new Dictionary<uint, (ConfigName)>();
private static (ConfigName)Data _instance;
public static (ConfigName)Data Instance
{
get { return _instance ??= ConfigTableManage.Load<(ConfigName)Data>(); }
private set => _instance = value;
}
public (ConfigName) Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"(ConfigName) not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out (ConfigName) config)
{
config = null;
if (!_configs.ContainsKey(id))
{
return false;
}
config = _configs[id];
return true;
}
public override void AfterDeserialization()
{
for (var i = 0; i < List.Count; i++)
{
(ConfigName) config = List[i];
_configs.Add(config.Id, config);
config.AfterDeserialization();
}
base.AfterDeserialization();
}
public void Dispose()
{
Instance = null;
}
}
[ProtoContract]
public sealed partial class (ConfigName) : AProto
{(Fields)
}
}

View File

@@ -0,0 +1,20 @@
#if SERVER
using ProtoBuf;
using Unity.Mathematics;
using System.Collections.Generic;
using TEngine.Core.Network;
#pragma warning disable CS8618
namespace TEngine
{
#else
using ProtoBuf;
using Unity.Mathematics;
using System.Collections.Generic;
using TEngine.Core.Network;
#pragma warning disable CS8618
namespace TEngine
{
#endif
(Content)}