先在phontoserver文件夹里的deploy创建一个文件夹MyGameServer,在它里面创建一个bin文件夹,把生成目录改一下
在创建一个类库,名字为MyGameServer
导入三个引用:ExitGamesLibs.dll Phonto.SocketServer.dll PhontoHostRuntimeInterfaces.dll
创建一个MyGameServer的类
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Photon.SocketServer; using ExitGames.Logging; using System.IO; using ExitGames.Logging.Log4Net; using log4net.Config; namespace MyGameServer { //所有的server端 主类都要继承自applicationbase class MyGameServer : ApplicationBase { private static readonly ILogger log = LogManager.GetCurrentClassLogger(); //log文件,用于日志输出 //当一个客户端请求链接的时候 //我们使用peerbase,表示和一个客户端的连接 protected override PeerBase CreatePeer(InitRequest initRequest) { log.Info("一个客户端链接过来了..."); return new ClientPeer(initRequest); } //初始化 protected override void Setup() { //日志的初始化 log4net.GlobalContext.Prop