From d04ae8accea04146292406e46f5e78373cd2428d Mon Sep 17 00:00:00 2001 From: tanghai Date: Tue, 17 Oct 2017 15:22:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BF=90=E8=A1=8C=E6=8C=87?= =?UTF-8?q?=E5=8D=97=E5=87=BA=E9=94=99=E5=8E=9F=E5=9B=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\220\350\241\214\346\214\207\345\215\227.md" | 17 +++++++++++------ Server/Model/Base/Message/AActorMessage.cs | 4 ++++ .../Scripts/Entity/Message/OuterMessage.cs | 3 +++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git "a/Doc/\350\277\220\350\241\214\346\214\207\345\215\227.md" "b/Doc/\350\277\220\350\241\214\346\214\207\345\215\227.md" index dbc44570..603d41f3 100644 --- "a/Doc/\350\277\220\350\241\214\346\214\207\345\215\227.md" +++ "b/Doc/\350\277\220\350\241\214\346\214\207\345\215\227.md" @@ -2,17 +2,17 @@ .net 桌面开发 使用C++的桌面开发,VC++ 2017 v141工具集,对C++的xp支持 visual studio tools for unity .netcore2.0 -##### 2. unity一定要安装 unity 2017.1.0p5以上版本,其它版本不支持 +##### 2. unity一定要安装 unity 2017.1.0p5到2017.1.2,其它版本不支持 ##### 3. 启动unity2017, 菜单 File->open project->open 选中Egametang/Unity文件夹,点击选择文件夹按钮。 -##### 4.用vs2017打开Egametang/Unity/Unity.sln 编译 +##### 4.用vs2017打开Egametang/Unity/Unity.sln 编译(一定要编译,右键VS解决方案,全部编译) -##### 4.用vs2017打开Egametang/Server/Server.sln 编译 +##### 5.用vs2017打开Egametang/Server/Server.sln 编译(一定要编译,右键VS解决方案,全部编译) -##### 5.打开Unity->tools菜单->命令行配置,选择LocalAllServer.txt 这是启动单一App的方式,如果要启动一组多App服务器,在命令行工具中选择127.0.0.1.txt,点击启动即可,具体配置都可以自己用这个命令行配置工具修改 -##### 6.点击工具中的启动,这样就启动了服务端(也可以用VS启动,方便单步调试) -##### 7.运行Unity,输入帐号,点击登录这时日志 连接Gate成功,表示运行OK! +##### 6.打开Unity->tools菜单->命令行配置,选择LocalAllServer.txt 这是启动单一App的方式,如果要启动一组多App服务器,在命令行工具中选择127.0.0.1.txt,点击启动即可,具体配置都可以自己用这个命令行配置工具修改 +##### 7.点击工具中的启动,这样就启动了服务端(也可以用VS启动,方便单步调试) +##### 8.运行Unity,输入帐号,点击登录这时日志 连接Gate成功,表示运行OK! ## 测试帧同步 ##### 1. Unity->tools菜单->打包->PC打包, 打出一个PC包在Release目录下 @@ -20,3 +20,8 @@ visual studio tools for unity .netcore2.0 ##### 3. 运行PC包 登录 进入大厅   这时会出现两个小人(重叠在一起) ##### 4. 点击鼠标右键即可移动人物 +# 注意事项: +VS2017 15.4版本有bug,会提示Hotfix找不到Assembly-CSharp.dll,需要将Hotfix工程引用的Unity跟Unity.Plugin去掉,直接引用这两个工程生成的dll。 + +一般出错原因都是 1.没编译。2.中文目录。3.vs没有安装vs tools或者不是最新的vs tools。4.没安装.netcore2.0 + diff --git a/Server/Model/Base/Message/AActorMessage.cs b/Server/Model/Base/Message/AActorMessage.cs index 0b1dd9ea..65375965 100644 --- a/Server/Model/Base/Message/AActorMessage.cs +++ b/Server/Model/Base/Message/AActorMessage.cs @@ -1,4 +1,5 @@ using MongoDB.Bson.Serialization.Attributes; +using ProtoBuf; namespace Model { @@ -25,9 +26,12 @@ namespace Model /// /// 帧消息,继承这个类的消息会经过服务端转发 /// + [ProtoContract] + [ProtoInclude(30000, typeof(Frame_ClickMap))] [BsonKnownTypes(typeof(Frame_ClickMap))] public abstract class AFrameMessage : AActorMessage { + [ProtoMember(1)] public long Id; } } \ No newline at end of file diff --git a/Unity/Assets/Scripts/Entity/Message/OuterMessage.cs b/Unity/Assets/Scripts/Entity/Message/OuterMessage.cs index f4d81125..7393e0db 100644 --- a/Unity/Assets/Scripts/Entity/Message/OuterMessage.cs +++ b/Unity/Assets/Scripts/Entity/Message/OuterMessage.cs @@ -118,10 +118,13 @@ namespace Model } // ͻ˵ͼ + [ProtoContract] [Message(Opcode.Frame_ClickMap)] public class Frame_ClickMap: AFrameMessage { + [ProtoMember(1)] public int X; + [ProtoMember(2)] public int Z; } -- GitLab