public static BaseResponse messageFromBytes(byte[] buffer) { VRage.ByteStream stream = new VRage.ByteStream(buffer, buffer.Length); TYPE t = (TYPE)stream.getUShort(); stream.Seek(0, SeekOrigin.Begin); BaseResponse msg = null; switch (t) { case TYPE.NOTIFICATION: msg = new NotificationResponse(); break; case TYPE.DIALOG: msg = new DialogResponse(); break; case TYPE.SETTINGS: msg = new SettingsResponse(); break; case TYPE.FLEET: msg = new FleetResponse(); break; } if (msg != null) { msg.deserialize(stream); } return(msg); }
private void processSettingsRequest(SettingsRequest req) { log("", "processSettingsRequest"); SettingsResponse resp = new SettingsResponse() { Settings = ConquestSettings.getInstance().Settings, Destination = new List <long>() { req.ReturnAddress }, DestType = BaseResponse.DEST_TYPE.PLAYER }; send(resp); }
private void processSettingsResponse(SettingsResponse resp) { log("Loading settings from server", "processSettingsResponse"); m_ServerSettings = resp.Settings; log("Adding CP GPS", "processSettingsResponse"); foreach (Records.ControlPoint cp in ServerSettings.ControlPoints) { m_ServerCPGPS.Add(MyAPIGateway.Session.GPS.Create( cp.Name, "GardenConquest Control Point", new VRageMath.Vector3D(cp.Position.X, cp.Position.Y, cp.Position.Z), true, true )); } addCPGPS(); }
private void processSettingsResponse(SettingsResponse resp) { log("Loading settings from server", "processSettingsResponse"); m_ServerSettings = resp.Settings; log("Adding CP GPS", "processSettingsResponse"); foreach (Records.ControlPoint cp in ServerSettings.ControlPoints) { IMyGps gps = MyAPIGateway.Session.GPS.Create( cp.Name, "GardenConquest Control Point", new VRageMath.Vector3D(cp.Position.X, cp.Position.Y, cp.Position.Z), true, true); MyAPIGateway.Session.GPS.AddLocalGps(gps); } }
private void processSettingsRequest(SettingsRequest req) { log("", "processSettingsRequest"); SettingsResponse resp = new SettingsResponse() { Settings = ConquestSettings.getInstance().Settings, Destination = new List<long>() { req.ReturnAddress }, DestType = BaseResponse.DEST_TYPE.PLAYER }; send(resp); }
public static BaseResponse messageFromBytes(byte[] buffer) { VRage.ByteStream stream = new VRage.ByteStream(buffer, buffer.Length); TYPE t = (TYPE)stream.getUShort(); stream.Seek(0, SeekOrigin.Begin); BaseResponse msg = null; switch (t) { case TYPE.NOTIFICATION: msg = new NotificationResponse(); break; case TYPE.DIALOG: msg = new DialogResponse(); break; case TYPE.SETTINGS: msg = new SettingsResponse(); break; case TYPE.FLEET: msg = new FleetResponse(); break; } if (msg != null) msg.deserialize(stream); return msg; }