public void ProcessCitizen(uint citizenId, CitizenHandler handler) { ProcessCitizen( citizenId, ref Singleton <CitizenManager> .instance.m_citizens.m_buffer[citizenId], handler); }
/// <summary> /// Main loop, runs the WebSocket connection. /// </summary> protected void RunSocket() { //We don't really need to store the handlers; //just create them and let them call our EnqueueMessage method. //XXX automatically find these like WebServer does. Log($"Creating socket handlers (thread: {Thread.CurrentThread.Name})"); BudgetHandler budgetHandler = new BudgetHandler(this); BuildingHandler buildingHandler = new BuildingHandler(this); CameraHandler cameraHandler = new CameraHandler(this); ChirperHandler chirperHandler = new ChirperHandler(this); CitizenHandler citizenHandler = new CitizenHandler(this); CityInfoHandler cityInfoHandler = new CityInfoHandler(this); DebugHandler debugHandler = new DebugHandler(this); DistrictHandler districtHandler = new DistrictHandler(this); FlagsHandler flagsHandler = new FlagsHandler(this); InstancesHandler instancesHandler = new InstancesHandler(this); LimitsHandler limitsHandler = new LimitsHandler(this); NotificationHandler notificationHandler = new NotificationHandler(this); ReflectionHandler reflectionHandler = new ReflectionHandler(this); TerrainHandler terrainHandler = new TerrainHandler(this); TransportHandler transportHandler = new TransportHandler(this); VehicleHandler vehicleHandler = new VehicleHandler(this); Log("Waiting for messages"); try { while (true) { if (stream.DataAvailable) { HandleNextMessage(); } String msg = GetNextOutgoingMessage(); if (msg != null) { byte[] buf = Encoding.UTF8.GetBytes(msg); SendFrame(buf); } Thread.Sleep(100); } } catch (ObjectDisposedException) { //we're done, stream is closed Log("Connection closed"); } catch (OperationCanceledException) { Log("Connection closed"); } }
public void ProcessCitizen(uint citizenId, ref Citizen citizen, CitizenHandler handler) { handler(citizenId, ref citizen); }