mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
合理化程序集,服务器Logic无需共享的代码存放解决方案目录,无需走Unity目录
合理化程序集,服务器Logic无需共享的代码存放解决方案目录,无需走Unity目录
This commit is contained in:
@@ -1,11 +1,3 @@
|
||||
{
|
||||
"List": [
|
||||
{
|
||||
"Id": 1,
|
||||
"OuterIP": "127.0.0.1",
|
||||
"OuterBindIP": "127.0.0.1",
|
||||
"InnerBindIP": "127.0.0.1",
|
||||
"ManagementPort": 20000
|
||||
}
|
||||
]
|
||||
}
|
||||
{"List":[
|
||||
{"Id":1,"OuterIP":"0.0.0.0","OuterBindIP":"0.0.0.0","InnerBindIP":"0.0.0.0","ManagementPort":20000}
|
||||
]}
|
||||
|
@@ -1,44 +1,10 @@
|
||||
{
|
||||
"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
|
||||
}
|
||||
]
|
||||
}
|
||||
{"List":[
|
||||
{"Id":1,"EntityId":17246978048,"RouteId":1024,"WorldId":1,"SceneType":"Gate","Name":"Gate","NetworkProtocol":"KCP","OuterPort":20000},
|
||||
{"Id":2,"EntityId":34493956096,"RouteId":2048,"WorldId":1,"SceneType":"Addressable","Name":"Addressable1","NetworkProtocol":null,"OuterPort":0},
|
||||
{"Id":4,"EntityId":68920803328,"RouteId":3072,"WorldId":1,"SceneType":"Map","Name":"Map1","NetworkProtocol":null,"OuterPort":0},
|
||||
{"Id":5,"EntityId":86167781376,"RouteId":4096,"WorldId":1,"SceneType":"Chat","Name":"Chat","NetworkProtocol":null,"OuterPort":0},
|
||||
{"Id":6,"EntityId":103146389504,"RouteId":1025,"WorldId":1,"SceneType":"Gate","Name":"Gate","NetworkProtocol":"KCP","OuterPort":20000},
|
||||
{"Id":7,"EntityId":120393367552,"RouteId":2049,"WorldId":1,"SceneType":"Addressable","Name":"Addressable1","NetworkProtocol":null,"OuterPort":0},
|
||||
{"Id":8,"EntityId":137640345600,"RouteId":3073,"WorldId":1,"SceneType":"Map","Name":"Map1","NetworkProtocol":null,"OuterPort":0},
|
||||
{"Id":9,"EntityId":154887323648,"RouteId":4097,"WorldId":1,"SceneType":"Chat","Name":"Chat","NetworkProtocol":null,"OuterPort":0}
|
||||
]}
|
||||
|
@@ -1,28 +1,6 @@
|
||||
{
|
||||
"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
|
||||
}
|
||||
]
|
||||
}
|
||||
{"List":[
|
||||
{"Id":1025,"MachineId":1,"InnerPort":11001,"ReleaseMode":false},
|
||||
{"Id":2049,"MachineId":1,"InnerPort":11002,"ReleaseMode":false},
|
||||
{"Id":3073,"MachineId":1,"InnerPort":11003,"ReleaseMode":false},
|
||||
{"Id":4097,"MachineId":1,"InnerPort":11004,"ReleaseMode":false}
|
||||
]}
|
||||
|
@@ -1,12 +1,3 @@
|
||||
{
|
||||
"List": [
|
||||
{
|
||||
"Id": 1,
|
||||
"WorldName": "测试服",
|
||||
"DbConnection": "mongodb://root:root@127.0.0.1",
|
||||
"DbName": "tengine_main",
|
||||
"DbType": "MongoDB",
|
||||
"IsGameWorld": true
|
||||
}
|
||||
]
|
||||
}
|
||||
{"List":[
|
||||
{"Id":1,"WorldName":"测试服","DbConnection":"mongodb://1.12.241.46:27017/","DbName":"tengine_test","DbType":"MongoDB","IsGameWorld":true}
|
||||
]}
|
||||
|
88
DotNet/Config/Server/Entity/MachineConfig.cs
Normal file
88
DotNet/Config/Server/Entity/MachineConfig.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
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 TEngine
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class MachineConfigData : AProto, IConfigTable, IDisposable
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public List<MachineConfig> List { get; set; } = new List<MachineConfig>();
|
||||
[ProtoIgnore]
|
||||
private readonly Dictionary<uint, MachineConfig> _configs = new Dictionary<uint, MachineConfig>();
|
||||
private static MachineConfigData _instance;
|
||||
|
||||
public static MachineConfigData Instance
|
||||
{
|
||||
get { return _instance ??= ConfigTableManage.Load<MachineConfigData>(); }
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public MachineConfig Get(uint id, bool check = true)
|
||||
{
|
||||
if (_configs.ContainsKey(id))
|
||||
{
|
||||
return _configs[id];
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
throw new Exception($"MachineConfig not find {id} Id");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool TryGet(uint id, out MachineConfig 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++)
|
||||
{
|
||||
MachineConfig config = List[i];
|
||||
_configs.Add(config.Id, config);
|
||||
config.AfterDeserialization();
|
||||
}
|
||||
|
||||
base.AfterDeserialization();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed partial class MachineConfig : AProto
|
||||
{
|
||||
[ProtoMember(1, IsRequired = true)]
|
||||
public uint Id { get; set; } // Id
|
||||
[ProtoMember(2, IsRequired = true)]
|
||||
public string OuterIP { get; set; } // 外网IP
|
||||
[ProtoMember(3, IsRequired = true)]
|
||||
public string OuterBindIP { get; set; } // 外网绑定IP
|
||||
[ProtoMember(4, IsRequired = true)]
|
||||
public string InnerBindIP { get; set; } // 内网绑定IP
|
||||
[ProtoMember(5, IsRequired = true)]
|
||||
public int ManagementPort { get; set; } // 管理端口
|
||||
}
|
||||
}
|
94
DotNet/Config/Server/Entity/SceneConfig.cs
Normal file
94
DotNet/Config/Server/Entity/SceneConfig.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
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 TEngine
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class SceneConfigData : AProto, IConfigTable, IDisposable
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public List<SceneConfig> List { get; set; } = new List<SceneConfig>();
|
||||
[ProtoIgnore]
|
||||
private readonly Dictionary<uint, SceneConfig> _configs = new Dictionary<uint, SceneConfig>();
|
||||
private static SceneConfigData _instance;
|
||||
|
||||
public static SceneConfigData Instance
|
||||
{
|
||||
get { return _instance ??= ConfigTableManage.Load<SceneConfigData>(); }
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public SceneConfig Get(uint id, bool check = true)
|
||||
{
|
||||
if (_configs.ContainsKey(id))
|
||||
{
|
||||
return _configs[id];
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
throw new Exception($"SceneConfig not find {id} Id");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool TryGet(uint id, out SceneConfig 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++)
|
||||
{
|
||||
SceneConfig config = List[i];
|
||||
_configs.Add(config.Id, config);
|
||||
config.AfterDeserialization();
|
||||
}
|
||||
|
||||
base.AfterDeserialization();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed partial class SceneConfig : AProto
|
||||
{
|
||||
[ProtoMember(1, IsRequired = true)]
|
||||
public uint Id { get; set; } // ID
|
||||
[ProtoMember(2, IsRequired = true)]
|
||||
public long EntityId { get; set; } // 实体Id
|
||||
[ProtoMember(3, IsRequired = true)]
|
||||
public uint RouteId { get; set; } // 路由Id
|
||||
[ProtoMember(4, IsRequired = true)]
|
||||
public uint WorldId { get; set; } // 世界Id
|
||||
[ProtoMember(5, IsRequired = true)]
|
||||
public string SceneType { get; set; } // Scene类型
|
||||
[ProtoMember(6, IsRequired = true)]
|
||||
public string Name { get; set; } // 名称
|
||||
[ProtoMember(7, IsRequired = true)]
|
||||
public string NetworkProtocol { get; set; } // 协议类型
|
||||
[ProtoMember(8, IsRequired = true)]
|
||||
public int OuterPort { get; set; } // 外网端口
|
||||
}
|
||||
}
|
86
DotNet/Config/Server/Entity/ServerConfig.cs
Normal file
86
DotNet/Config/Server/Entity/ServerConfig.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
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 TEngine
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class ServerConfigData : AProto, IConfigTable, IDisposable
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public List<ServerConfig> List { get; set; } = new List<ServerConfig>();
|
||||
[ProtoIgnore]
|
||||
private readonly Dictionary<uint, ServerConfig> _configs = new Dictionary<uint, ServerConfig>();
|
||||
private static ServerConfigData _instance;
|
||||
|
||||
public static ServerConfigData Instance
|
||||
{
|
||||
get { return _instance ??= ConfigTableManage.Load<ServerConfigData>(); }
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public ServerConfig Get(uint id, bool check = true)
|
||||
{
|
||||
if (_configs.ContainsKey(id))
|
||||
{
|
||||
return _configs[id];
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
throw new Exception($"ServerConfig not find {id} Id");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool TryGet(uint id, out ServerConfig 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++)
|
||||
{
|
||||
ServerConfig config = List[i];
|
||||
_configs.Add(config.Id, config);
|
||||
config.AfterDeserialization();
|
||||
}
|
||||
|
||||
base.AfterDeserialization();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed partial class ServerConfig : AProto
|
||||
{
|
||||
[ProtoMember(1, IsRequired = true)]
|
||||
public uint Id { get; set; } // 路由Id
|
||||
[ProtoMember(2, IsRequired = true)]
|
||||
public uint MachineId { get; set; } // 机器ID
|
||||
[ProtoMember(3, IsRequired = true)]
|
||||
public int InnerPort { get; set; } // 内网端口
|
||||
[ProtoMember(4, IsRequired = true)]
|
||||
public bool ReleaseMode { get; set; } // Release下运行
|
||||
}
|
||||
}
|
90
DotNet/Config/Server/Entity/WorldConfig.cs
Normal file
90
DotNet/Config/Server/Entity/WorldConfig.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
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 TEngine
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class WorldConfigData : AProto, IConfigTable, IDisposable
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public List<WorldConfig> List { get; set; } = new List<WorldConfig>();
|
||||
[ProtoIgnore]
|
||||
private readonly Dictionary<uint, WorldConfig> _configs = new Dictionary<uint, WorldConfig>();
|
||||
private static WorldConfigData _instance;
|
||||
|
||||
public static WorldConfigData Instance
|
||||
{
|
||||
get { return _instance ??= ConfigTableManage.Load<WorldConfigData>(); }
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public WorldConfig Get(uint id, bool check = true)
|
||||
{
|
||||
if (_configs.ContainsKey(id))
|
||||
{
|
||||
return _configs[id];
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
throw new Exception($"WorldConfig not find {id} Id");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool TryGet(uint id, out WorldConfig 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++)
|
||||
{
|
||||
WorldConfig config = List[i];
|
||||
_configs.Add(config.Id, config);
|
||||
config.AfterDeserialization();
|
||||
}
|
||||
|
||||
base.AfterDeserialization();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed partial class WorldConfig : AProto
|
||||
{
|
||||
[ProtoMember(1, IsRequired = true)]
|
||||
public uint Id { get; set; } // Id
|
||||
[ProtoMember(2, IsRequired = true)]
|
||||
public string WorldName { get; set; } // 名称
|
||||
[ProtoMember(3, IsRequired = true)]
|
||||
public string DbConnection { get; set; } // 连接字符串
|
||||
[ProtoMember(4, IsRequired = true)]
|
||||
public string DbName { get; set; } // 数据库名称
|
||||
[ProtoMember(5, IsRequired = true)]
|
||||
public string DbType { get; set; } // 数据库类型
|
||||
[ProtoMember(6, IsRequired = true)]
|
||||
public bool IsGameWorld { get; set; } // 是否游戏服
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user