Description:
Early version of serialization.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r84:d3b4d15b5d25 -

1 NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
@@ -9,6 +9,7
9 9 // public List<MapCell> Columns = new List<MapCell>();
10 10 //}
11 11
12 [Serializable]
12 13 public class CellMap
13 14 {
14 15 public List<List<Cell>> cells;
@@ -190,6 +191,7
190 191 DeadTree
191 192 }
192 193
194 [Serializable]
193 195 public class Cell
194 196 {
195 197 // public Boolean _hasTree = false;
@@ -145,7 +145,9
145 145
146 146 currentNode = DialogTrees.introTree;
147 147
148 }
148
149
150 }
149 151
150 152 protected override void Initialize()
151 153 {
@@ -418,6 +420,25
418 420
419 421 this.simulation.update(gameTime.ElapsedGameTime);
420 422
423 #if DEBUG
424
425 if (keyboardCur.IsKeyDown(Keys.S) && keyboardPrev.IsKeyUp(Keys.S))
426 {
427 System.Runtime.Serialization.IFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
428 Stream stream = new FileStream("MyFile.bin", FileMode.Create, FileAccess.Write, FileShare.None);
429 formatter.Serialize(stream, this.simulation);
430 stream.Close();
431 }
432
433 if (keyboardCur.IsKeyDown(Keys.L) && keyboardPrev.IsKeyUp(Keys.L))
434 {
435 System.Runtime.Serialization.IFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
436 Stream stream = new FileStream("MyFile.bin", FileMode.Open, FileAccess.Read);
437 this.simulation = (Simulation)formatter.Deserialize(stream);
438 }
439 #endif
440
441
421 442 if (this.showBudget)
422 443 {
423 444 this.showBudget = this.budgetWindow.update(mouseCur, this.simulation.latestBudget, this.simulation.previousBudget);
@@ -5,6 +5,7
5 5
6 6 namespace isometricparkfna
7 7 {
8 [Serializable]
8 9 public struct Budget
9 10 {
10 11 public DateTime DateTime;
@@ -31,6 +32,8
31 32
32 33 }
33 34
35
36 [Serializable]
34 37 public class Simulation
35 38 {
36 39 public const int START_YEAR = 2020;
@@ -137,6 +140,9
137 140 private float lastAdvance;
138 141 public bool paused;
139 142
143
144
145 [NonSerialized]
140 146 private Random random;
141 147
142 148 //forest policy params
You need to be logged in to leave comments. Login now