mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
[+] TEngineServer
[+] TEngineServer
This commit is contained in:
90
DotNet/App/NLog.config
Normal file
90
DotNet/App/NLog.config
Normal file
@@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd">
|
||||
<targets async="true">
|
||||
<target name="ServerDebug" xsi:type="File"
|
||||
encoding="UTF-8"
|
||||
createDirs="true"
|
||||
autoFlush="false"
|
||||
keepFileOpen="true"
|
||||
concurrentWrites="true"
|
||||
openFileCacheTimeout="30"
|
||||
openFileFlushTimeout="60"
|
||||
fileName="${basedir}/../Logs/Server/Server${date:format=yyyyMMdd}/${logger}.${var:appId}.${date:format=yyyyMMddHH}.Debug.log"
|
||||
layout="${longdate} ${callsite:className=false:methodName=false:fileName=true:includeSourcePath=false:skipFrames=2} ${message}"/>
|
||||
</targets>
|
||||
<targets async="true">
|
||||
<target name="ServerInfo" xsi:type="File"
|
||||
encoding="UTF-8"
|
||||
createDirs="true"
|
||||
autoFlush="false"
|
||||
keepFileOpen="true"
|
||||
concurrentWrites="true"
|
||||
openFileCacheTimeout="30"
|
||||
openFileFlushTimeout="60"
|
||||
fileName="${basedir}/../Logs/Server/Server${date:format=yyyyMMdd}/${logger}.${var:appId}.${date:format=yyyyMMddHH}.Info.log"
|
||||
layout="${longdate} ${message}"/>
|
||||
</targets>
|
||||
<targets async="true">
|
||||
<target name="ServerWarn" xsi:type="File"
|
||||
encoding="UTF-8"
|
||||
createDirs="true"
|
||||
autoFlush="false"
|
||||
keepFileOpen="true"
|
||||
concurrentWrites="true"
|
||||
openFileCacheTimeout="30"
|
||||
openFileFlushTimeout="60"
|
||||
fileName="${basedir}/../Logs/Server/Server${date:format=yyyyMMdd}/${logger}.${var:appId}.${date:format=yyyyMMddHH}.Warn.log"
|
||||
layout="${longdate} ${message}"/>
|
||||
</targets>
|
||||
<targets async="true">
|
||||
<target name="ServerError" xsi:type="File"
|
||||
encoding="UTF-8"
|
||||
createDirs="true"
|
||||
autoFlush="false"
|
||||
keepFileOpen="true"
|
||||
concurrentWrites="true"
|
||||
openFileCacheTimeout="30"
|
||||
openFileFlushTimeout="60"
|
||||
fileName="${basedir}/../Logs/Server/Server${date:format=yyyyMMdd}/${logger}.${var:appId}.${date:format=yyyyMMddHH}.Error.log"
|
||||
layout="${longdate} ${message}"/>
|
||||
</targets>
|
||||
<targets async="true">
|
||||
<target name="ServerTrace" xsi:type="File"
|
||||
encoding="UTF-8"
|
||||
createDirs="true"
|
||||
autoFlush="false"
|
||||
keepFileOpen="true"
|
||||
concurrentWrites="true"
|
||||
openFileCacheTimeout="30"
|
||||
openFileFlushTimeout="60"
|
||||
fileName="${basedir}/../Logs/Server/Server${date:format=yyyyMMdd}/${logger}.${var:appId}.${date:format=yyyyMMddHH}.Trace.log"
|
||||
layout="${longdate} ${message}"/>
|
||||
</targets>
|
||||
<targets async="true">
|
||||
<target name="ConsoleColor" xsi:type="ColoredConsole"
|
||||
useDefaultRowHighlightingRules="false"
|
||||
layout="${longdate} ${message}">
|
||||
<highlight-row condition="level == LogLevel.Debug" foregroundColor="DarkGreen" />
|
||||
<highlight-row condition="level == LogLevel.Info" foregroundColor="Gray" />
|
||||
<highlight-row condition="level == LogLevel.Warn" foregroundColor="Yellow" />
|
||||
<highlight-row condition="level == LogLevel.Error" foregroundColor="DarkRed" />
|
||||
<highlight-row condition="level == LogLevel.Fatal" foregroundColor="Red" />
|
||||
</target>
|
||||
</targets>
|
||||
<rules>
|
||||
<!-- 控制台 调试或编辑器启动的时候会调用-->
|
||||
<logger ruleName="ConsoleTrace" name="Server" level="Trace" writeTo="ConsoleColor" />
|
||||
<logger ruleName="ConsoleDebug" name="Server" level="Debug" writeTo="ConsoleColor" />
|
||||
<logger ruleName="ConsoleInfo" name="Server" level="Info" writeTo="ConsoleColor" />
|
||||
<logger ruleName="ConsoleWarn" name="Server" level="Warn" writeTo="ConsoleColor" />
|
||||
<logger ruleName="ConsoleError" name="Server" level="Error" writeTo="ConsoleColor" />
|
||||
<!-- 服务端日志输出文件 发布到服务器后会调用-->
|
||||
<logger ruleName="ServerDebug" name="Server" level="Debug" writeTo="ServerDebug" />
|
||||
<logger ruleName="ServerTrace" name="Server" level="Trace" writeTo="ServerTrace" />
|
||||
<logger ruleName="ServerInfo" name="Server" level="Info" writeTo="ServerInfo" />
|
||||
<logger ruleName="ServerWarn" name="Server" level="Warn" writeTo="ServerWarn" />
|
||||
<logger ruleName="ServerError" name="Server" level="Error" writeTo="ServerError" />
|
||||
</rules>
|
||||
</nlog>
|
3483
DotNet/App/NLog.xsd
Normal file
3483
DotNet/App/NLog.xsd
Normal file
File diff suppressed because it is too large
Load Diff
32
DotNet/App/Program.cs
Normal file
32
DotNet/App/Program.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using TEngine;
|
||||
using TEngine.Core;
|
||||
using TEngine.Logic;
|
||||
|
||||
try
|
||||
{
|
||||
App.Init();
|
||||
|
||||
AssemblySystem.Init();
|
||||
|
||||
ConfigTableSystem.Bind();
|
||||
|
||||
App.Start().Coroutine();
|
||||
|
||||
Entry.Start().Coroutine();
|
||||
|
||||
while(true)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
ThreadSynchronizationContext.Main.Update();
|
||||
SingletonSystem.Update();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
62
DotNet/App/ProgramInfo.cs
Normal file
62
DotNet/App/ProgramInfo.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using TEngine;
|
||||
using TEngine.Core;
|
||||
using TEngine.Logic;
|
||||
|
||||
public class ProgramInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 启动说明。
|
||||
/// </summary>
|
||||
public void Temp()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 框架启动需要在命令行后面添加参数才会正常使用分别是:
|
||||
// 例如demo的服务器参数: --Mode Develop --AppType Game --AppId 100
|
||||
// Mode有两种:
|
||||
// Develop:开发模式 这个是所有在配置定义的服务器都会启动并且在同一个进程下、方便开发调试。
|
||||
// 当然如果游戏体量不大也可以用这个模式发布,后期改成Release模式也是没有问题的
|
||||
// Release:发布模式只会启动启动参数传递的Server、也就是只会启动一个Server
|
||||
// 您可以做一个Server专门用于管理启动所有Server的工具或脚本、一般都是运维同学来做
|
||||
// AppType有两种:
|
||||
// Game:游戏服务器
|
||||
// Export:导出配置表工具
|
||||
// 例如我要启动导表工具参数就应该是--AppType Export就可以了Mode和AppId都可以不用设置
|
||||
// AppId:告诉框架应该启动哪个服务器、对应ServerConfig.xls的Id 如果Mode使用的Develop的话、这个Id不生效
|
||||
// 初始化框架
|
||||
App.Init();
|
||||
|
||||
// 演示的框架创建了Model和Hotfix两个工程所以需要AssemblyManager.Load来加载这两个程序集
|
||||
// 这个看个人而定、你也可以不按照演示框架这样创建2个程序集、总之有几个程序集就AssemblyManager.Load一下加载到框架中
|
||||
// 因为App这个工程就不需要了、因为这里没有逻辑、具体看AssemblyLoadHelper的逻辑、自己写一下
|
||||
// 加载需要的程序集、这里因为每个人都框架规划都不一样、所以这块开放出自己定义
|
||||
AssemblySystem.Init();
|
||||
|
||||
// 绑定框架需要的配置文件
|
||||
// 框架启动服务器需要配置文件才可以启动、比如需要启动什么服务器、服务器的监听地址是什么等等、所以要提前绑定一下
|
||||
ConfigTableSystem.Bind();
|
||||
|
||||
// 启动框架
|
||||
// 启动框架会加载Demo下Config/Excel/Server里四个文件配置
|
||||
// 因为上面ConfigTableHelper.Bind已经绑定好了、所以框架可以直接读取这4个配置文件进行启动
|
||||
App.Start().Coroutine();
|
||||
|
||||
// 框架启动后需要执行的逻辑、现在是我是写的启动服务器的逻辑、同上这里也开放出来自定义
|
||||
// 但这里一定是异步的、不然框架部分功能可能不会正常、因为阻塞到这里、需要Update需要下面的才可以驱动
|
||||
// 这个入口代码可以不用调用、这里只是演示下如果调用应该怎么处理
|
||||
Entry.Start().Coroutine();
|
||||
|
||||
while (true)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
ThreadSynchronizationContext.Main.Update();
|
||||
SingletonSystem.Update();
|
||||
}
|
||||
}
|
||||
catch
|
||||
(Exception e)
|
||||
{
|
||||
Log.Error(e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
64
DotNet/App/TEngineSettings.json
Normal file
64
DotNet/App/TEngineSettings.json
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"Export": {
|
||||
"ProtoBufTemplatePath": {
|
||||
"Value": "../Config/Template/ProtoTemplate.txt",
|
||||
"Comment": "ProtoBuf生成代码模板的位置"
|
||||
},
|
||||
"ProtoBufDirectory": {
|
||||
"Value": "../Config/ProtoBuf/",
|
||||
"Comment": "ProtoBuf文件所在的位置文件夹位置"
|
||||
},
|
||||
"ProtoBufServerDirectory": {
|
||||
"Value": "../../Assets/GameScripts/DotNet/Logic/Generate~/NetworkProtocol/",
|
||||
"Comment": "ProtoBuf生成到服务端的文件夹位置"
|
||||
},
|
||||
"ProtoBufClientDirectory": {
|
||||
"Value": "../../Assets/GameScripts/HotFix/GameProto/GameProtocol/",
|
||||
"Comment": "ProtoBuf生成到客户端的文件夹位置"
|
||||
},
|
||||
"ExcelProgramPath": {
|
||||
"Value": "../Config/Excel/",
|
||||
"Comment": "Excel配置文件根目录"
|
||||
},
|
||||
"ExcelVersionFile": {
|
||||
"Value": ".../Config/Excel/Version.txt",
|
||||
"Comment": "Excel版本文件的位置"
|
||||
},
|
||||
"ExcelServerFileDirectory": {
|
||||
"Value": "../../Server/Hotfix/Generate/ConfigTable/Entity/",
|
||||
"Comment": "Excel生成服务器代码的文件夹位置"
|
||||
},
|
||||
"ExcelClientFileDirectory": {
|
||||
"Value": "../../Client/Unity/Assets/Scripts/Hotfix/Generate/ConfigTable/Entity/",
|
||||
"Comment": "Excel生成客户端代码文件夹位置"
|
||||
},
|
||||
"ExcelServerBinaryDirectory": {
|
||||
"Value": "../Config/Binary/",
|
||||
"Comment": "Excel生成服务器二进制数据文件夹位置"
|
||||
},
|
||||
"ExcelClientBinaryDirectory": {
|
||||
"Value": "../../Client/Unity/Assets/Bundles/Config/",
|
||||
"Comment": "Excel生成客户端二进制数据文件夹位置"
|
||||
},
|
||||
"ExcelServerJsonDirectory": {
|
||||
"Value": "../Config/Json/Server/",
|
||||
"Comment": "Excel生成服务器Json数据文件夹位置"
|
||||
},
|
||||
"ExcelClientJsonDirectory": {
|
||||
"Value": "../Config/Json/Client/",
|
||||
"Comment": "Excel生成客户端Json数据文件夹位置"
|
||||
},
|
||||
"ExcelTemplatePath": {
|
||||
"Value": "../Config/Template/ExcelTemplate.txt",
|
||||
"Comment": "Excel生成代码模板的位置"
|
||||
},
|
||||
"ServerCustomExportDirectory": {
|
||||
"Value": "../../Server/Hotfix/Generate/CustomExport/",
|
||||
"Comment": "服务器自定义导出代码文件夹位置"
|
||||
},
|
||||
"ClientCustomExportDirectory": {
|
||||
"Value": "../../Client/Unity/Assets/Scripts/Hotfix/Generate/CustomExport/",
|
||||
"Comment": "客户端自定义导出代码文件夹位置"
|
||||
}
|
||||
}
|
||||
}
|
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)}
|
@@ -1,43 +0,0 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNet.App", "App\DotNet.App.csproj", "{4948005C-3806-4C92-BA41-D27319A2B4B4}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNet.Loader", "Loader\DotNet.Loader.csproj", "{1D5E890A-C9D5-45DF-B098-73DBE39EB311}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNet.Core", "Core\DotNet.Core.csproj", "{E49D926E-53B5-4F16-BA8A-816694BD7C92}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNet.Hotfix", "Hotfix\DotNet.Hotfix.csproj", "{0EEA95E0-0040-4B3C-B7FD-0E4F38F90A07}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNet.Model", "Model\DotNet.Model.csproj", "{49855D78-0347-462B-AB98-90E4138C2AED}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNet.ThirdParty", "ThirdParty\DotNet.ThirdParty.csproj", "{19A11666-4891-4E73-B826-1B24D7A62080}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{4948005C-3806-4C92-BA41-D27319A2B4B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4948005C-3806-4C92-BA41-D27319A2B4B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4948005C-3806-4C92-BA41-D27319A2B4B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4948005C-3806-4C92-BA41-D27319A2B4B4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E49D926E-53B5-4F16-BA8A-816694BD7C92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E49D926E-53B5-4F16-BA8A-816694BD7C92}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E49D926E-53B5-4F16-BA8A-816694BD7C92}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E49D926E-53B5-4F16-BA8A-816694BD7C92}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0EEA95E0-0040-4B3C-B7FD-0E4F38F90A07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0EEA95E0-0040-4B3C-B7FD-0E4F38F90A07}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0EEA95E0-0040-4B3C-B7FD-0E4F38F90A07}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0EEA95E0-0040-4B3C-B7FD-0E4F38F90A07}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{49855D78-0347-462B-AB98-90E4138C2AED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{49855D78-0347-462B-AB98-90E4138C2AED}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{49855D78-0347-462B-AB98-90E4138C2AED}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{49855D78-0347-462B-AB98-90E4138C2AED}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{19A11666-4891-4E73-B826-1B24D7A62080}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{19A11666-4891-4E73-B826-1B24D7A62080}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{19A11666-4891-4E73-B826-1B24D7A62080}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{19A11666-4891-4E73-B826-1B24D7A62080}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1D5E890A-C9D5-45DF-B098-73DBE39EB311}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1D5E890A-C9D5-45DF-B098-73DBE39EB311}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
81
DotNet/ThirdParty/DotNet.ThirdParty.csproj
vendored
81
DotNet/ThirdParty/DotNet.ThirdParty.csproj
vendored
@@ -1,81 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>disable</Nullable>
|
||||
<LangVersion>11</LangVersion>
|
||||
<RootNamespace>ET</RootNamespace>
|
||||
<AssemblyName>ThirdParty</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DefineConstants>DOTNET;UNITY_DOTSPLAYER</DefineConstants>
|
||||
<OutputPath>..\..\Bin\</OutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Optimize>true</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DefineConstants>DOTNET;UNITY_DOTSPLAYER</DefineConstants>
|
||||
<OutputPath>..\..\Bin\</OutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
<Compile Include="..\..\Assets\GameScripts\ThirdParty\TrueSync\**\*.cs">
|
||||
<Link>TrueSync/%(RecursiveDir)%(FileName)%(Extension)</Link>
|
||||
</Compile>
|
||||
|
||||
<Compile Include="..\..\Assets\GameScripts\ThirdParty\ETTask\**\*.cs">
|
||||
<Link>ETTask/%(RecursiveDir)%(FileName)%(Extension)</Link>
|
||||
</Compile>
|
||||
|
||||
<Compile Include="..\..\Assets\GameScripts\ThirdParty\Kcp\**\*.cs">
|
||||
<Link>Kcp/%(RecursiveDir)%(FileName)%(Extension)</Link>
|
||||
</Compile>
|
||||
|
||||
<Compile Include="..\..\Assets\GameScripts\ThirdParty\Recast\Recast.cs">
|
||||
<Link>Recast\Recast.cs</Link>
|
||||
</Compile>
|
||||
|
||||
<Compile Include="..\..\Library\PackageCache\com.unity.mathematics*\Unity.Mathematics\**\*.cs">
|
||||
<Link>Unity.Mathematics/$([System.String]::new(%(RecursiveDir)).Substring($([System.String]::new(%(RecursiveDir)).Indexof("Unity.Mathematics"))).Replace("Unity.Mathematics", ""))/%(FileName)%(Extension)</Link>
|
||||
</Compile>
|
||||
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\..\Assets\Plugins\MacOS\x86_64\libRecastDll.dylib">
|
||||
<Link>runtimes\osx\native\libRecastDll.dylib</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\..\Assets\Plugins\x86_64\libRecastDll.so">
|
||||
<Link>runtimes\linux\native\libRecastDll.so</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\..\Assets\Plugins\x86_64\RecastDll.dll">
|
||||
<Link>runtimes\win\native\RecastDll.dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommandLineParser" Version="2.8.0" />
|
||||
<PackageReference Include="EPPlus" Version="5.8.8" />
|
||||
|
||||
<PackageReference Include="MemoryPack" Version="1.9.13" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="2.17.1" />
|
||||
<PackageReference Include="NLog" Version="4.7.15" />
|
||||
<PackageReference Include="SharpZipLib" Version="1.3.3" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.0.1" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
BIN
DotNet/ThirdParty/KCPLibrary/kcp.dll
vendored
Normal file
BIN
DotNet/ThirdParty/KCPLibrary/kcp.dll
vendored
Normal file
Binary file not shown.
BIN
DotNet/ThirdParty/KCPLibrary/kcp.dylib
vendored
Normal file
BIN
DotNet/ThirdParty/KCPLibrary/kcp.dylib
vendored
Normal file
Binary file not shown.
BIN
DotNet/ThirdParty/KCPLibrary/kcp.so
vendored
Normal file
BIN
DotNet/ThirdParty/KCPLibrary/kcp.so
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user