egametang启动配置

egametang的启动配置文件可以在Unity的Tools->命令行配置中修改保存然后启动
如果需要添加自定义的启动配置项目,只需要修改客户端的

ServerCommandLineEditor.cs
if (GUILayout.Button("添加一行配置"))
{
StartConfig newStartConfig = new StartConfig();
newStartConfig.AppType = this.AppType;
if (this.AppType.Is(AppType.Gate | AppType.Realm | AppType.Manager))
{
newStartConfig.AddComponent<OuterConfig>();
}
if (this.AppType.Is(AppType.Gate | AppType.Realm | AppType.Manager | AppType.Http | AppType.DB | AppType.Map | AppType.Location))
{
newStartConfig.AddComponent<InnerConfig>();
}
if (this.AppType.Is(AppType.Benchmark))
{
newStartConfig.AddComponent<ClientConfig>();
}
if (this.AppType.Is(AppType.Http))
{
newStartConfig.AddComponent<HttpConfig>();
}
if (this.AppType.Is(AppType.DB))
{
newStartConfig.AddComponent<DBConfig>();
}
this.startConfigs.Add(newStartConfig);
}
这段代码里可以修改AppType对应的startconfig包含的AConfigComponent子类
InnerConfig innerConfig = startConfig.GetComponent<InnerConfig>();
if (innerConfig != null)
{
GUILayout.Label($"InnerHost:");
innerConfig.Host = EditorGUILayout.TextField(innerConfig.Host);
GUILayout.Label($"InnerPort:");
innerConfig.Port = EditorGUILayout.IntField(innerConfig.Port);
} OuterConfig outerConfig = startConfig.GetComponent<OuterConfig>();
if (outerConfig != null)
{
GUILayout.Label($"OuterHost:");
outerConfig.Host = EditorGUILayout.TextField(outerConfig.Host);
GUILayout.Label($"OuterHost2:");
outerConfig.Host2 = EditorGUILayout.TextField(outerConfig.Host2);
GUILayout.Label($"OuterPort:");
outerConfig.Port = EditorGUILayout.IntField(outerConfig.Port);
} ClientConfig clientConfig = startConfig.GetComponent<ClientConfig>();
if (clientConfig != null)
{
GUILayout.Label($"Host:");
clientConfig.Host = EditorGUILayout.TextField(clientConfig.Host);
GUILayout.Label($"Port:");
clientConfig.Port = EditorGUILayout.IntField(clientConfig.Port);
} HttpConfig httpConfig = startConfig.GetComponent<HttpConfig>();
if (httpConfig != null)
{
GUILayout.Label($"AppId:");
httpConfig.AppId = EditorGUILayout.IntField(httpConfig.AppId);
GUILayout.Label($"AppKey:");
httpConfig.AppKey = EditorGUILayout.TextField(httpConfig.AppKey);
GUILayout.Label($"Url:");
httpConfig.Url = EditorGUILayout.TextField(httpConfig.Url);
GUILayout.Label($"ManagerSystemUrl:");
httpConfig.ManagerSystemUrl = EditorGUILayout.TextField(httpConfig.ManagerSystemUrl);
} DBConfig dbConfig = startConfig.GetComponent<DBConfig>();
if (dbConfig != null)
{
GUILayout.Label($"Connection:");
dbConfig.ConnectionString = EditorGUILayout.TextField(dbConfig.ConnectionString); GUILayout.Label($"DBName:");
dbConfig.DBName = EditorGUILayout.TextField(dbConfig.DBName);
}
修改这段代码即可给新增或者修改的AConfigComponent子类字段赋值
注意如果派生新的AConfigComponent 子类,需要再AConfigComponent上使用BsonKnownTypes标记记录上去
using MongoDB.Bson.Serialization.Attributes; namespace Model
{
/// <summary>
/// 每个Config的基类
/// </summary>
[BsonKnownTypes(typeof(ClientConfig))]
[BsonKnownTypes(typeof(InnerConfig))]
[BsonKnownTypes(typeof(OuterConfig))]
[BsonKnownTypes(typeof(HttpConfig))]
[BsonKnownTypes(typeof(DBConfig))]
[BsonKnownTypes(typeof(RunServerConfig))]
public abstract class AConfigComponent: ComponentDB
{
}
}
点击保存后,StartConfig是个Entity,Entity的Componet容器被标记了BsonElement,所以它包含的配置组件及其内容都会序列化成json保存在配置文件夹中。从项目根目录\Config\StartConfig中即可查看这些序列化出来的json配置文件,这些配置文件还包含了_t之类的bson特有字段,和通常的newtonsoft.json序列化出来的还是有点不同。
服务端进程启动时这些序列化好的配置文件会在Program.Main函数中的OptionComponent和StartConfigComponent被反序列化 服务端需要修改StartConfigComponent加入相关代码:


改完上面2处就可以在代码中引用了。
egametang启动配置的更多相关文章
- ABP(现代ASP.NET样板开发框架)系列之5、ABP启动配置
点这里进入ABP系列文章总目录 基于DDD的现代ASP.NET开发框架--ABP系列之5.ABP启动配置 ABP是“ASP.NET Boilerplate Project (ASP.NET样板项目)” ...
- ABP框架 - 启动配置
文档目录 本节内容: 配置ABP 替换内置服务 配置模块 为一个模块创建配置 ABP在启动时,提供基础框架和模型来配置和模块化. 置ABP 在预初始化事件中进行配置,示例: kid1412注:XmlL ...
- ABP理论学习之启动配置
返回总目录 本篇目录 配置ABP 配置模块 为模块创建配置 为了在应用启动时配置ABP和模块,ABP提供了一个基础设施. 配置ABP 配置ABP是在模块的PreInitialize事件中完成的.下面的 ...
- 【推荐】CentOS安装Tomcat-7.0.57+启动配置+安全配置+性能配置
注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. #准备工作# 在安装Tomcat之前,请确保已经安装了JDK-1.7环境,具体见<CentOS安装JDK-1.7>. ...
- 基于DDD的.NET开发框架 - ABP启动配置
返回ABP系列 ABP是“ASP.NET Boilerplate Project (ASP.NET样板项目)”的简称. ASP.NET Boilerplate是一个用最佳实践和流行技术开发现代WEB应 ...
- 适合最新版docker自定义启动配置
docker不断发布新版本,以前默认的在 /etc/default/docker里修改,但是新版已经不推荐了 注意: 一些文章推荐在 /lib/systemd/system/docker.servic ...
- MongoDB启动配置等
目录: 一.mongoDB 启动配置 二.导出,导入,运行时备份 三.Fsync锁,数据修复 四.用户管理,安全认证 一.启动项 mongod --help C:\Windows\system32&g ...
- 14.6.1 InnoDB Startup Configuration 启动配置
14.6.1 InnoDB Startup Configuration 启动配置 首先描述关于InnoDB 配置设计数据库文件,日志文件,page size 和内存buffer 的配置. 推荐你定义数 ...
- ABP启动配置
ABP启动配置 返回ABP系列 ABP是“ASP.NET Boilerplate Project (ASP.NET样板项目)”的简称. ASP.NET Boilerplate是一个用最佳实践和流行 ...
随机推荐
- LNMP状态管理命令
https://lnmp.org/faq/lnmp-status-manager.html LNMP状态管理命令: LNMP 1.2+状态管理: lnmp {start|stop|reload|res ...
- 《并行程序设计导论》——MPI(Microsoft MPI)(1):Hello
=================================版权声明================================= 版权声明:原创文章 禁止转载 请通过右侧公告中的“联系邮 ...
- Linuxc - 执行c程序
1.新建工作空间 root@jiqing-virtual-machine:~/cspace/les1# pwd /root/cspace/les1 2.新建c程序 root@jiqing-virtua ...
- Git初入
Git记录 使用git 也有一段时间了, git的入门级了解也就不再多说, 但平常使用中, 仍然会遇到很多问题, 在此记录一二. 在查资料的过程中, 发现了两个比较好的资料: 特别是第二个, 相当详细 ...
- jdk源码->集合->HashSet
类的属性 public class HashSet<E> extends AbstractSet<E> implements Set<E>, Cloneable, ...
- word中批量转换字母数字为Times New Roman
通常撰写论文时,英文与中文的格式会区分开,但是一个个修改会比较费时,可以通过替换功能实现.此处以word2003为例. 1.选择 编辑→替换 界面.在“查找内容”文本框中输入"[0-9a-z ...
- Request和Response
1 简介 web服务器收到客户端的http请求,会针对每一个请求,分别创建一个用于代表请求的request对象和代表响应的response对象. request和response对象既然代表请求和响应 ...
- HTML学习——表单标签
1.type: 当 type="radio" 时,控件为单选框 当 type="checkbox" 时,控件为复选框 2.value:提交数据到服务器的值(后台 ...
- Mysql高可用架构(主从同步)
做高可用的优势 1.成本低 2.解决单点故障 3.不容易遇到性能瓶颈 一 .Mysql主从同步架构搭建案例 优点如下:·在业务繁忙阶段,在从服务器上可以执行查询工作(即我们常说的读写分离),降低主服务 ...
- 关于fprint()和fwrite()
int num = 12345; 将12345作为二进制数存储到num中 1. fprintf(fp,"%d",num); //把字符'1','2','3','4','5'的二进制 ...