/// <summary> /// Used to load our data from buffer. /// </summary> /// <param name="Buffer"></param> public CivilianMilitia(ArcenDeserializationBuffer Buffer) { this.Version = Buffer.ReadInt32(ReadStyle.NonNeg); this.Centerpiece = Buffer.ReadInt32(ReadStyle.Signed); this.Status = (CivilianMilitiaStatus)Buffer.ReadByte(ReadStyleByte.Normal); if (this.Version < 2) { this.PlanetFocus = (short)Buffer.ReadInt32(ReadStyle.Signed); } else { this.PlanetFocus = Buffer.ReadInt16(ReadStyle.Signed); } this.EntityFocus = Buffer.ReadInt32(ReadStyle.Signed); int count = Buffer.ReadInt32(ReadStyle.NonNeg); for (int x = 0; x < count; x++) { this.ShipTypeData.Add(x, Buffer.ReadString()); this.Ships[x] = new List <int>(); int subCount = Buffer.ReadInt32(ReadStyle.NonNeg); for (int y = 0; y < subCount; y++) { this.Ships[x].Add(Buffer.ReadInt32(ReadStyle.NonNeg)); } this.ShipCapacity[x] = Buffer.ReadInt32(ReadStyle.NonNeg); } if (this.ShipTypeData.Count < (int)CivilianResource.Length) { for (int x = count; x < (int)CivilianResource.Length; x++) { this.ShipTypeData.Add(x, "none"); this.Ships.Add(x, new List <int>()); this.ShipCapacity.Add(x, 0); } } this.CostMultiplier = Buffer.ReadInt32(ReadStyle.NonNeg); this.CapMultiplier = Buffer.ReadInt32(ReadStyle.NonNeg); }
/// <summary> /// Used to load data. Make sure the loading order is the same as the saving order. /// </summary> public CivilianPlanet(ArcenDeserializationBuffer Buffer) { this.Version = Buffer.ReadInt32(ReadStyle.NonNeg); this.Resource = (CivilianResource)Buffer.ReadByte(ReadStyleByte.Normal); }