예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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();
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
        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);
        }
예제 #6
0
        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;
        }