public RPCFunc(RPCDispatcher rpc, string name) { Assert.NotNull(rpc, "rpc"); Assert.NotNullOrEmpty(name, "name"); RPC = rpc; Name = name; }
Context(Peer peer) { Assert.NotNull(peer, "peer"); Client = peer as Client; Server = peer as Server; IsServer = peer is Server; IsClient = peer is Client; Peer = peer; Peer.ContextPlugin.Context = this; Scheduler = new Scheduler(this); NetworkQueue = new HashSet <Network.IConnection>(); SynchronizationQueue = new HashSet <Synchronizable>(); // Time = new TimeManager(peer); // Stats = new Stats(this); // Register packet handlers RegisterPacketHandler(new SynchronizableHandler(), HeaderBytes.Synchronizable); RegisterPacketHandler(RPC = new RPCDispatcher(this), HeaderBytes.RemoteProcedureCall); RegisterPacketHandler(StateStreamHandler = new StateStreamHandler(), HeaderBytes.ActorStateStream); // Register player events registerEventsForHandler <Actor>(ActorEventHandler = new EventHandlerActor(this)); registerEventsForHandler <Player>(PlayerEventHandler = new EventHandlerPlayer(this)); // Create spatial partitioner SpatialPartitioner = createSpatialPartitioner(); // Plugin callback Peer.ContextPlugin.ContextStarted(); // Init actor definitions ActorDefinition.Init(this); }