public void ExposeData()
        {
            Scribe_Values.Look <int>(ref mapId, "mapid", -1);
            if (map != null)
            {
                numCells = map.cellIndices.NumGridCells;
            }

            Scribe_Values.Look <int>(ref numCells, "numCells", 0);
            if (Scribe.mode == LoadSaveMode.Saving)
            {
                MapExposeUtility.ExposeUshort(map, (IntVec3 c) => priorityGrid[map.cellIndices.CellToIndex(c)], delegate(IntVec3 c, ushort val)
                {
                    priorityGrid[map.cellIndices.CellToIndex(c)] = val;
                }, "priorityGrid");
            }
            else if (Scribe.mode == LoadSaveMode.LoadingVars)
            {
                priorityGrid = new ushort[numCells];
                DataExposeUtility.ByteArray(ref griddata, "priorityGrid");
                DataSerializeUtility.LoadUshort(griddata, numCells, delegate(int c, ushort val)
                {
                    priorityGrid[c] = val;
                });
                griddata = null;
            }
        }
 public void ExposeData()
 {
     Scribe_Defs.Look <HistoryAutoRecorderDef>(ref this.def, "def");
     byte[] array = null;
     if (Scribe.mode == LoadSaveMode.Saving)
     {
         array = new byte[this.records.Count * 4];
         for (int i = 0; i < this.records.Count; i++)
         {
             byte[] bytes = BitConverter.GetBytes(this.records[i]);
             for (int j = 0; j < 4; j++)
             {
                 array[i * 4 + j] = bytes[j];
             }
         }
     }
     DataExposeUtility.ByteArray(ref array, "records");
     if (Scribe.mode == LoadSaveMode.LoadingVars)
     {
         int num = array.Length / 4;
         this.records.Clear();
         for (int k = 0; k < num; k++)
         {
             float item = BitConverter.ToSingle(array, k * 4);
             this.records.Add(item);
         }
     }
 }
Exemple #3
0
        private static BinaryReader LoadBinary(string label)
        {
            byte[] arr = null;
            DataExposeUtility.ByteArray(ref arr, label);
            if (arr == null)
            {
                return(null);
            }

            return(new BinaryReader(new MemoryStream(arr)));
        }
 public static void ExposeUshort(Map map, Func <IntVec3, ushort> shortReader, Action <IntVec3, ushort> shortWriter, string label)
 {
     byte[] arr = null;
     if (Scribe.mode == LoadSaveMode.Saving)
     {
         arr = MapSerializeUtility.SerializeUshort(map, shortReader);
     }
     DataExposeUtility.ByteArray(ref arr, label);
     if (Scribe.mode == LoadSaveMode.LoadingVars)
     {
         MapSerializeUtility.LoadUshort(arr, map, shortWriter);
     }
 }
Exemple #5
0
 public void ExposeData()
 {
     Scribe_Defs.Look(ref def, "def");
     byte[] arr = null;
     if (Scribe.mode == LoadSaveMode.Saving)
     {
         arr = RecordsToBytes();
     }
     DataExposeUtility.ByteArray(ref arr, "records");
     if (Scribe.mode == LoadSaveMode.LoadingVars)
     {
         SetRecordsFromBytes(arr);
     }
 }
Exemple #6
0
 public void ExposeData()
 {
     Scribe_Defs.Look <HistoryAutoRecorderDef>(ref this.def, "def");
     byte[] recordsFromBytes = null;
     if (Scribe.mode == LoadSaveMode.Saving)
     {
         recordsFromBytes = this.RecordsToBytes();
     }
     DataExposeUtility.ByteArray(ref recordsFromBytes, "records");
     if (Scribe.mode == LoadSaveMode.LoadingVars)
     {
         this.SetRecordsFromBytes(recordsFromBytes);
     }
 }
Exemple #7
0
        public override void ExposeData()
        {
            byte[] arr = null;

            if (Scribe.mode == LoadSaveMode.Saving)
            {
                if (priorityGrid == null || priorityGrid.Length != map.cellIndices.NumGridCells)
                {
                    Log.Error("PriorityMapGrid : Invalid priorityGrid. fixing..");
                    InitGrid();
                }
                arr = DataSerializeUtility.SerializeInt(priorityGrid);
            }
            DataExposeUtility.ByteArray(ref arr, "priorityGrid");
            if (Scribe.mode == LoadSaveMode.LoadingVars)
            {
                priorityGrid = DataSerializeUtility.DeserializeInt(arr);
            }
        }
Exemple #8
0
 public void ExposeData()
 {
     if (Scribe.mode == LoadSaveMode.Saving)
     {
         this.TilesToRawData();
     }
     DataExposeUtility.ByteArray(ref this.tileBiome, "tileBiome");
     DataExposeUtility.ByteArray(ref this.tileElevation, "tileElevation");
     DataExposeUtility.ByteArray(ref this.tileHilliness, "tileHilliness");
     DataExposeUtility.ByteArray(ref this.tileTemperature, "tileTemperature");
     DataExposeUtility.ByteArray(ref this.tileRainfall, "tileRainfall");
     DataExposeUtility.ByteArray(ref this.tileSwampiness, "tileSwampiness");
     DataExposeUtility.ByteArray(ref this.tileFeature, "tileFeature");
     DataExposeUtility.ByteArray(ref this.tileRoadOrigins, "tileRoadOrigins");
     DataExposeUtility.ByteArray(ref this.tileRoadAdjacency, "tileRoadAdjacency");
     DataExposeUtility.ByteArray(ref this.tileRoadDef, "tileRoadDef");
     DataExposeUtility.ByteArray(ref this.tileRiverOrigins, "tileRiverOrigins");
     DataExposeUtility.ByteArray(ref this.tileRiverAdjacency, "tileRiverAdjacency");
     DataExposeUtility.ByteArray(ref this.tileRiverDef, "tileRiverDef");
     if (Scribe.mode == LoadSaveMode.LoadingVars)
     {
         this.RawDataToTiles();
     }
 }
        public override void ExposeData()
        {
            base.ExposeData();

            DataExposeUtility.BoolArray(ref knownCells, map.Size.x * map.Size.z, "revealedCells");
        }
Exemple #10
0
 private static void SaveBinary(BinaryWriter writer, string label)
 {
     byte[] arr = (writer.BaseStream as MemoryStream).ToArray();
     DataExposeUtility.ByteArray(ref arr, label);
 }
Exemple #11
0
 public override void ExposeData()
 {
     DataExposeUtility.ByteArray(ref this.grid, "grid");
 }