protected virtual void SerializeClass(IDataStruct value) { if (value is IVersionedData versionedData) { _writer.WriteByte(versionedData.Version); } value.Serialize(this); }
public static Blueprint FromTable(IDataStruct blueprintTable) { var data = blueprintTable.Get("data"); string name = data.GetValue("name") as string; IDataStruct blocks = blueprintTable.Get("blocks"); int cost = 0; Console.WriteLine("Parsing blueprint for ship: " + name); foreach (IDataStruct block in blocks) { int id = int.Parse(block.GetValue(0).ToString()); cost += BlockData.GetBlockCost(id); } Console.WriteLine($"Succesfully parsed ship {name} with a cost of {cost}"); return(new Blueprint(name, cost, blueprintTable.Serialize())); }