//[RPC] void RPC_S2C_CreateNewServer(uLink.BitStream stream, uLink.NetworkP2PMessageInfo info) { try { string srvName = stream.Read <string>(); int srvMode = stream.Read <int>(); int srvPort = stream.Read <int>(); ConnectedServer cServer = connectedServers.Find(it => it.peer == info.sender); if (cServer == null) { ConnectedServer server = new ConnectedServer(srvName, srvMode, info.sender); connectedServers.Add(server); } LoadServer.AddServer(srvName, srvMode); if (null != OnServerRegisteredEvent) { OnServerRegisteredEvent(srvName, srvMode, srvPort); } } catch (Exception e) { if (LogFilter.logFatal) { Debug.LogErrorFormat("RPC_S2C_CreateNewServer error\r\n{0}\r\n{1}", e.Message, e.StackTrace); } } }
protected override bool OnRPC(string rpcName, BitStream stream, NetworkP2PMessageInfo info) { Profiler.BeginSample("RPC: " + rpcName); var rpc = _rpcInstances.Find(this, rpcReceiver, observed, listOfGameObjects, rpcName); var success = rpc.Execute(stream, info); Profiler.EndSample(); return(success); }