Description:
Refactor slightly.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -27,33 +27,6 | |||
|
27 | 27 | this.game = game; |
|
28 | 28 | } |
|
29 | 29 | |
|
30 | public void writeOptions(string fontName, int fontSize) | |
|
31 | { | |
|
32 | ||
|
33 | var options = new Options(fontName, fontSize); | |
|
34 | ||
|
35 | string json = JsonConvert.SerializeObject(options, | |
|
36 | Formatting.Indented); | |
|
37 | ||
|
38 | File.WriteAllText(@"options.json", json); | |
|
39 | Logging.Success("Writing options to file."); | |
|
40 | ||
|
41 | } | |
|
42 | ||
|
43 | public Options readOptions() | |
|
44 | { | |
|
45 | var json = File.ReadAllText(@"options.json"); | |
|
46 | Logging.Spy(new {json=json}); | |
|
47 | ||
|
48 | Options options = JsonConvert.DeserializeObject<Options>(json); | |
|
49 | ||
|
50 | Logging.Spy(new {name=options.fontName, | |
|
51 | size=options.fontSize}); | |
|
52 | Logging.Success("Read options."); | |
|
53 | ||
|
54 | return options; | |
|
55 | } | |
|
56 | ||
|
57 | 30 | public override void Update(double dt) |
|
58 | 31 | { |
|
59 | 32 | |
@@ -100,7 +73,7 | |||
|
100 | 73 | foreach (ref readonly var fontMessage in ReadMessages<SetFontMessage>()) |
|
101 | 74 | { |
|
102 | 75 | game.setFont(fontMessage.fontName, fontMessage.fontSize); |
|
103 | writeOptions(fontMessage.fontName, fontMessage.fontSize); | |
|
76 | Options.writeOptions(fontMessage.fontName, fontMessage.fontSize); | |
|
104 | 77 | |
|
105 | 78 | } |
|
106 | 79 |
You need to be logged in to leave comments.
Login now