// TODO Maybe this is logic that can be moved to the Ramnet library? private void ReplicatePreExistingInstances() { var preExistingObjects = PreExistingObjects.FindAll(); foreach (var preExistingObject in preExistingObjects) { var gameObject = preExistingObject.Value; //Debug.Log("replicating existing instance " + gameObject + " under id " + preExistingObject.Key); _networkSystems.Replicator.AddPreExistingInstance(ConnectionId.Self, gameObject, preExistingObject.Key); } }
private void OnConnectionEstablished(ConnectionId hostConnectionId, IPEndPoint endPoint) { Debug.Log("Connection established to " + endPoint + " with " + hostConnectionId); var preExistingObjects = PreExistingObjects.FindAll(); var messageRouter = _networkSystems.DefaultMessageRouter; NetworkSystem.InstallBasicClientHandlers(messageRouter, _networkSystems, preExistingObjects); messageRouter.RegisterHandler <BasicMessage.Pong>(OnClockSync); _networkSystems.GroupRouter.SetDataHandler(ConnectionGroups.Default, messageRouter); _pingRoutine = _coroutineScheduler.Run(PingRepeatedly(hostConnectionId)); }