private void video_NewFrame(object sender, NewFrameEventArgs e) { RemoteClient.SendMessage(new global::DataObject { CommandName = "Update", CommandType = "Webcam", CommandData = Utility.Optimize(e.Frame, depth) }); }
private void Send(DeviceNotifyEventArgs device) { List <string> data = new List <string>(); data.Add(device.Device.Name); data.Add(device.DeviceType.ToString()); data.Add(device.EventType.ToString()); data.Add(device.Port.Name); data.Add(device.Volume.Letter); RemoteClient.SendMessage(new global::DataObject { CommandType = "Device", CommandName = "notify", CommandData = data }); }
private static void Login(IMultiPlayerServer server, RemoteClient client) { var username = client.Username ?? "<NO_USERNAME>"; if (string.IsNullOrWhiteSpace(username)) { username = "******"; } client.LoggedIn = true; client.Entity = new PlayerEntity(username); client.World = server.Worlds[0]; client.ChunkRadius = 2; server.Trace.TraceData(TraceEventType.Start, 0, $"{username} is logging in with reported position {client.Entity?.Position.ToString()}"); if (!client.Load()) { client.Entity.Position = client.World.SpawnPoint.AsVector3(); } // Make sure player doesn't spawn in the ground while (ClientCollidesWithGround(client, server, client)) { server.Trace.TraceData(TraceEventType.Warning, 0, "spawn point is in the ground"); client.Entity.Position += Directions.Up; } var entityManager = server.GetEntityManagerForWorld(client.World); entityManager.SpawnEntity(client.Entity); var position = client.Entity.Position; server.Trace.TraceData(TraceEventType.Start, 0, "updating initial chunks"); client.UpdateChunks(true); server.Trace.TraceData(TraceEventType.Start, 0, "done"); // Send setup packets server.Trace.TraceData(TraceEventType.Start, 0, "sending setup packets"); client.QueuePacket(new LoginResponsePacket(client.Entity.EntityId, 0, Dimension.Overworld)); client.QueuePacket(new WindowItemsPacket(0, client.Inventory.GetSlots())); client.QueuePacket(new UpdateHealthPacket(((PlayerEntity)client.Entity).Health)); client.QueuePacket(new SpawnPositionPacket((int)position.X, (int)position.Y, (int)position.Z)); client.QueuePacket(new SetPlayerPositionPacket(position.X, position.Y + 1, position.Y + client.Entity.Size.Height + 1, position.Z, client.Entity.Yaw, client.Entity.Pitch, true)); client.QueuePacket(new TimeUpdatePacket(client.World.Time)); // Start housekeeping for this client server.Trace.TraceData(TraceEventType.Start, 0, "starting housekeeping"); entityManager.SendEntitiesToClient(client); server.Scheduler.ScheduleEvent(Constants.Events.RemoteKeepAlive, client, TimeSpan.FromSeconds(10), client.SendKeepAlive); server.Scheduler.ScheduleEvent(Constants.Events.RemoteChunks, client, TimeSpan.FromSeconds(1), client.ExpandChunkRadius); if (!string.IsNullOrEmpty(server.ServerConfiguration.MOTD)) { client.SendMessage(server.ServerConfiguration.MOTD); } if (!server.ServerConfiguration.Singleplayer) { server.SendMessage(ChatColor.Yellow + "{0} joined the server.", client.Username); } }