Description:
Early version of serialization.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
|
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -9,6 +9,7 | |||||
|
9 | // public List<MapCell> Columns = new List<MapCell>(); |
|
9 | // public List<MapCell> Columns = new List<MapCell>(); |
|
10 | //} |
|
10 | //} |
|
11 |
|
11 | ||
|
|
12 | [Serializable] | ||
|
12 | public class CellMap |
|
13 | public class CellMap |
|
13 | { |
|
14 | { |
|
14 | public List<List<Cell>> cells; |
|
15 | public List<List<Cell>> cells; |
@@ -190,6 +191,7 | |||||
|
190 | DeadTree |
|
191 | DeadTree |
|
191 | } |
|
192 | } |
|
192 |
|
193 | ||
|
|
194 | [Serializable] | ||
|
193 | public class Cell |
|
195 | public class Cell |
|
194 | { |
|
196 | { |
|
195 | // public Boolean _hasTree = false; |
|
197 | // public Boolean _hasTree = false; |
@@ -145,7 +145,9 | |||||
|
145 |
|
145 | ||
|
146 | currentNode = DialogTrees.introTree; |
|
146 | currentNode = DialogTrees.introTree; |
|
147 |
|
147 | ||
|
148 | } |
|
148 | |
|
|
149 | |||
|
|
150 | } | ||
|
149 |
|
151 | ||
|
150 | protected override void Initialize() |
|
152 | protected override void Initialize() |
|
151 | { |
|
153 | { |
@@ -418,6 +420,25 | |||||
|
418 |
|
420 | ||
|
419 | this.simulation.update(gameTime.ElapsedGameTime); |
|
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 | if (this.showBudget) |
|
442 | if (this.showBudget) |
|
422 | { |
|
443 | { |
|
423 | this.showBudget = this.budgetWindow.update(mouseCur, this.simulation.latestBudget, this.simulation.previousBudget); |
|
444 | this.showBudget = this.budgetWindow.update(mouseCur, this.simulation.latestBudget, this.simulation.previousBudget); |
@@ -5,6 +5,7 | |||||
|
5 |
|
5 | ||
|
6 | namespace isometricparkfna |
|
6 | namespace isometricparkfna |
|
7 | { |
|
7 | { |
|
|
8 | [Serializable] | ||
|
8 | public struct Budget |
|
9 | public struct Budget |
|
9 | { |
|
10 | { |
|
10 | public DateTime DateTime; |
|
11 | public DateTime DateTime; |
@@ -31,6 +32,8 | |||||
|
31 |
|
32 | ||
|
32 | } |
|
33 | } |
|
33 |
|
34 | ||
|
|
35 | |||
|
|
36 | [Serializable] | ||
|
34 | public class Simulation |
|
37 | public class Simulation |
|
35 | { |
|
38 | { |
|
36 | public const int START_YEAR = 2020; |
|
39 | public const int START_YEAR = 2020; |
@@ -137,6 +140,9 | |||||
|
137 | private float lastAdvance; |
|
140 | private float lastAdvance; |
|
138 | public bool paused; |
|
141 | public bool paused; |
|
139 |
|
142 | ||
|
|
143 | |||
|
|
144 | |||
|
|
145 | [NonSerialized] | ||
|
140 | private Random random; |
|
146 | private Random random; |
|
141 |
|
147 | ||
|
142 | //forest policy params |
|
148 | //forest policy params |
You need to be logged in to leave comments.
Login now