# ET-MMO **Repository Path**: jiaosaisai/et-mmo ## Basic Information - **Project Name**: ET-MMO - **Description**: 用ET实现的简单MMO游戏 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2025-06-20 - **Last Updated**: 2025-12-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### 安装配置流程 #### 1.下载gitee文件,解压;或者在RIDER中使用终端执行命令git clone https://gitee.com/jiaosaisai/et-mmo.git 进行下载 #### 2.如果电脑没有安装net10,可以将DotNet下的程序降到net8,或者使用RIDER的git管理工具,回退更新(当前最后一个更新为升级net10) #### 3.修改et-mmo\Excel\StartConfig\Localhost\StartZoneConfig@s.xlsx中的MongoDB参数 #### 4.执行init.bat等待操作完成 #### 5.用unity2022系列打开客户端程序,不需要强求2022.3.62f1,按照程序操作应该没有报错信息 #### 6.服务端DOTNET的报错提示解决方法 ##### 启动CMD管理员模式,分别CD进入 ##### DotNet\App\ ##### DotNet\Core\ ##### DotNet\Hotfix\ ##### DotNet\Loader\ ##### DotNet\Model\ ##### DotNet\ThirdParty\ ##### 输入命令 运行包还原 ##### dotnet restore #### 此时服务器应该可以正常编译 #### 7.启动服务器,执行START.Bat出现报错的解决方法 ##### 启动CMD管理员模式,输入下列命令 ##### netsh http add urlacl url=http://*:30300/ user=Everyone ##### netsh http add urlacl url=http://*:8000/ user=Everyone ##### netsh http add urlacl url=http://*:18010/ user=Everyone ##### netsh http add urlacl url=http://*:20011/ user=Everyone ##### netsh http add urlacl url=http://*:20021/ user=Everyone ##### netsh http add urlacl url=http://*:20111/ user=Everyone ##### netsh http add urlacl url=http://*:20121/ user=Everyone #### 8.启动自己的MongoDB后,执行START.Bat,服务器启动成功 #### 9.客户端登陆报错,提示无法获取AppSetting的解决方法 ##### 项目中有AppSetting.json文件,将AppSetting.json复制到bin文件夹中,修改内容为 ##### { ##### "AccountHost": "http://127.0.0.1:18010", ##### "RouterHttpHost": "http://127.0.0.1:30300", ##### "HotUpdate" : false, ##### "HostServerHost" : "http://127.0.0.1:89", ##### "AppVersion" : "1.0.0", ##### "Debug" : true ##### } ##### 此时再重新执行START.Bat,重新登陆客户端 ### English: please use your browser to translate to english ### 1. 登录创建保存流程 ### 2. 缓存服 ### 3. 聊天服 ### 4. 道具和任务(服务端) ### 5. 账号服 #### 1. 存储服务器, 账号和角色数据 #### 2. 数据保存和代码重载 * 利用Http请求实现数据保存 ```csharp [HttpHandler(SceneType.Account, "/save")] public class HttpSaveDataRequestHandler: IHttpHandler { public async ETTask Handle(Scene scene, HttpListenerContext context) { var set = new HashSet() { "Cache", "Chat", "Map", "Rank" }; foreach (StartSceneConfig config in StartSceneConfigCategory.Instance.GetAll().Values) { if (set.Contains(config.Name)) { IResponse resp = null; try { resp = await scene.GetComponent().Call(config.ActorId, W2Other_SaveDataRequest.Create()); } catch (Exception) { HttpHelper.Response(context, $"保存数据错误: {resp.Error}, {config.Name} - {config.Id}"); return; } } } HttpHelper.Response(context, "Success"); await ETTask.CompletedTask; } } ``` #### 3. 数据查询 * 利用Http请求实现数据查询 ```csharp [HttpHandler(SceneType.Account, "/query_info")] public class HttpQueryInfoHandler: IHttpHandler { public async ETTask Handle(Scene scene, HttpListenerContext context) { string sceneName = context.Request.QueryString["scene"]; if (sceneName.IsNullOrEmpty()) { HttpHelper.Response(context, "scene type is null"); return; } string componentName = context.Request.QueryString["component"]; if (componentName.IsNullOrEmpty()) { HttpHelper.Response(context, "component name is null"); return; } var actorId = StartSceneConfigCategory.Instance.GetBySceneName(scene.Zone(), sceneName).ActorId; var rep = await scene.GetComponent().Call(actorId, new ConmponentQueryRequest() { ComponentName = componentName }); if (rep == null) { HttpHelper.Response(context, "component not found"); return; } byte[] data = (rep as ComponentQueryResponse).Entity; var entity = MongoHelper.Deserialize(data); string field = context.Request.QueryString["field"]; if (!field.IsNullOrEmpty()) { var f = entity.GetType().GetField(field, BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty | BindingFlags.NonPublic); if (f == null) { HttpHelper.Response(context, "field not found"); return; } HttpHelper.Response(context, f.GetValue(entity)); return; } HttpHelper.Response(context, entity); } } ``` **本项目中使用了如下插件(仅供学习交流使用,请务必支持正版!)** - **[Odin](https://odininspector.com/)** - **[Animancer](https://kybernetik.com.au/animancer/)** 交流群: 951617541 ## 友情链接 - [ET 框架](https://github.com/egametang/ET) 强大的基于C#的双端框架 - [xasset](https://github.com/xasset/xasset) 致力于为 Unity 项目提供了一套 精简稳健 的资源管理环境 - [ET UI框架](https://github.com/zzjfengqing/ET-EUI) 字母哥实现的UI框架,ET风格,各种事件分发