决定抄一遍源码,学习一下框架的搭建流程和里面的一些东西。
步骤:先抄服务端,即server.app。里面用到了Server.Model,Server.Hotfix,Server.ThirdParty。搭建的过程中会有各种依赖引用,以及第三方的东西。会依次记录。
然后抄一下客户端的内容。目标是抛开复杂的工具,先用简化版的跑起来。
Client-Server
创建空解决方案

Server
创建Server.App,及其他三个库。将目录,文件,抄的一模一样,然后引用到解决方案中。
下载NLog选择同款版本。

里面用到了Server.Model模块,开始抄这部分。
Server.Model

依赖项中的包下下来。然后代码需要先搞定Server.ThirdParty。
Server.ThirdParty

引入了外部的源码和库。
目前遇到了问题,我不知道如何引入外部文件夹;好在可以看csproj文件了解它的引用关系:

工具不会用,在这手撸配置,抄。

然后照着这个把其他的静态库引用引一下。
三个Libs目录下的,看上去是寻路用的插件。两个Unity目录下的,mac和win下的kcp插件。
引用结束,抄这部分开始。

这部分大概是unity引擎自带的基础计算源码,不用抄。直接复制有时间再看。

报错如此。配置项里面,几个选项都选一下,照着勾选。然后会发现.csproj文件变得只有一点点区别,一个langversion8什么的。然后不管它,直接把原工程的这个配置文件复制过来,就没有区别了。编译。

Server.Model
继续Server.Model

除了上面的基本属性,引用,及输出文件夹为最外层的Bin文件夹,其他的代码引用全在Unity里面写的。

是时候去抄unity中的代码了。
Unity

作为一名程序的直觉,Model和ModelView是我下手的重点对象。它应该是解耦的。
网友评论