Exemplo n.º 1
0
        public override void deserialize(VRage.ByteStream stream)
        {
            base.deserialize(stream);

            Settings = new ConquestSettings.SETTINGS();

            // Control Points
            ushort cpCount = stream.getUShort();
            Settings.ControlPoints = new List<Records.ControlPoint>();
            for (ushort i = 0; i < cpCount; ++i) {
                Settings.ControlPoints.Add(
                    Records.ControlPoint.deserialize(stream)
                );
            }

            // CP Period
            Settings.CPPeriod = (int)stream.getLong();

            // Cleanup Period
            Settings.CleanupPeriod = (int)stream.getLong();

            // Block Types
            ushort blockTypesLength = stream.getUShort();
            Settings.BlockTypes = new Records.BlockType[blockTypesLength];
            for (ushort i = 0; i < blockTypesLength; ++i) {
                Settings.BlockTypes[i] = Records.BlockType.deserialize(stream);
            }

            // Hull Rules
            ushort hullRulesLength = stream.getUShort();
            Settings.HullRules = new Records.HullRuleSet[hullRulesLength];
            for (ushort i = 0; i < hullRulesLength; ++i) {
                Settings.HullRules[i] = Records.HullRuleSet.deserialize(stream);
            }
        }
Exemplo n.º 2
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);
            }
        }