mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
[+] TEngineServer
[+] TEngineServer
This commit is contained in:
2
DotNet/Config/Binary/MachineConfigData.bytes
Normal file
2
DotNet/Config/Binary/MachineConfigData.bytes
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
' 127.0.0.1 127.0.0.1" 127.0.0.1(<28><>
|
BIN
DotNet/Config/Binary/SceneConfigData.bytes
Normal file
BIN
DotNet/Config/Binary/SceneConfigData.bytes
Normal file
Binary file not shown.
BIN
DotNet/Config/Binary/ServerConfigData.bytes
Normal file
BIN
DotNet/Config/Binary/ServerConfigData.bytes
Normal file
Binary file not shown.
2
DotNet/Config/Binary/WorldConfigData.bytes
Normal file
2
DotNet/Config/Binary/WorldConfigData.bytes
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
E 测试服mongodb://root:root@127.0.0.1"tengine_main*MongoDB0
|
BIN
DotNet/Config/Excel/Server/MachineConfig.xlsx
Normal file
BIN
DotNet/Config/Excel/Server/MachineConfig.xlsx
Normal file
Binary file not shown.
BIN
DotNet/Config/Excel/Server/SceneConfig.xlsx
Normal file
BIN
DotNet/Config/Excel/Server/SceneConfig.xlsx
Normal file
Binary file not shown.
BIN
DotNet/Config/Excel/Server/ServerConfig.xlsx
Normal file
BIN
DotNet/Config/Excel/Server/ServerConfig.xlsx
Normal file
Binary file not shown.
BIN
DotNet/Config/Excel/Server/WorldConfig.xlsx
Normal file
BIN
DotNet/Config/Excel/Server/WorldConfig.xlsx
Normal file
Binary file not shown.
1
DotNet/Config/Excel/Version.txt
Normal file
1
DotNet/Config/Excel/Version.txt
Normal file
@@ -0,0 +1 @@
|
||||
{"MachineConfig":1688402650290,"SceneConfig":1688638278438,"WorldConfig":1688296851256,"ServerConfig":1688401154525}
|
12
DotNet/Config/Json/Client/SceneConfigData.Json
Normal file
12
DotNet/Config/Json/Client/SceneConfigData.Json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"List": [
|
||||
{
|
||||
"Id": 16383,
|
||||
"SceneType": "ClientNetwork",
|
||||
"Name": "ClientNetwork",
|
||||
"NetworkProtocol": "KCP",
|
||||
"RemoteAddress": "192.168.31.37:20000",
|
||||
"Platform": "Unity"
|
||||
},
|
||||
]
|
||||
}
|
11
DotNet/Config/Json/Server/MachineConfigData.Json
Normal file
11
DotNet/Config/Json/Server/MachineConfigData.Json
Normal 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
|
||||
}
|
||||
]
|
||||
}
|
44
DotNet/Config/Json/Server/SceneConfigData.Json
Normal file
44
DotNet/Config/Json/Server/SceneConfigData.Json
Normal 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
|
||||
}
|
||||
]
|
||||
}
|
28
DotNet/Config/Json/Server/ServerConfigData.Json
Normal file
28
DotNet/Config/Json/Server/ServerConfigData.Json
Normal 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
|
||||
}
|
||||
]
|
||||
}
|
12
DotNet/Config/Json/Server/WorldConfigData.Json
Normal file
12
DotNet/Config/Json/Server/WorldConfigData.Json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"List": [
|
||||
{
|
||||
"Id": 1,
|
||||
"WorldName": "测试服",
|
||||
"DbConnection": "mongodb://root:root@127.0.0.1",
|
||||
"DbName": "tengine_main",
|
||||
"DbType": "MongoDB",
|
||||
"IsGameWorld": true
|
||||
}
|
||||
]
|
||||
}
|
2
DotNet/Config/ProtoBuf/InnerBsonMessage.proto
Normal file
2
DotNet/Config/ProtoBuf/InnerBsonMessage.proto
Normal file
@@ -0,0 +1,2 @@
|
||||
syntax = "proto3";
|
||||
package Sining.Message;
|
12
DotNet/Config/ProtoBuf/InnerMessage.proto
Normal file
12
DotNet/Config/ProtoBuf/InnerMessage.proto
Normal 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
|
||||
{
|
||||
|
||||
}
|
69
DotNet/Config/ProtoBuf/OuterMessage.proto
Normal file
69
DotNet/Config/ProtoBuf/OuterMessage.proto
Normal 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;
|
||||
}
|
2
DotNet/Config/ProtoBuf/RouteType.Config
Normal file
2
DotNet/Config/ProtoBuf/RouteType.Config
Normal file
@@ -0,0 +1,2 @@
|
||||
// Route协议定义(需要定义1000以上、因为1000以内的框架预留)
|
||||
ChatRoute = 1001 // 聊天服协议
|
78
DotNet/Config/Template/ExcelTemplate.txt
Normal file
78
DotNet/Config/Template/ExcelTemplate.txt
Normal 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)
|
||||
}
|
||||
}
|
20
DotNet/Config/Template/ProtoTemplate.txt
Normal file
20
DotNet/Config/Template/ProtoTemplate.txt
Normal 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)}
|
Reference in New Issue
Block a user