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 | this.game = game; |
|
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 | public override void Update(double dt) |
|
30 | public override void Update(double dt) |
|
58 | { |
|
31 | { |
|
59 |
|
32 | ||
@@ -100,7 +73,7 | |||||
|
100 | foreach (ref readonly var fontMessage in ReadMessages<SetFontMessage>()) |
|
73 | foreach (ref readonly var fontMessage in ReadMessages<SetFontMessage>()) |
|
101 | { |
|
74 | { |
|
102 | game.setFont(fontMessage.fontName, fontMessage.fontSize); |
|
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 |
@@ -349,7 +349,7 | |||||
|
349 |
|
349 | ||
|
350 |
|
350 | ||
|
351 | try { |
|
351 | try { |
|
352 |
var options = |
|
352 | var options = Options.readOptions(); |
|
353 |
|
353 | ||
|
354 | this.imGuiWindowBridgeEngine.fontMessages.Add(new SetFontMessage{ |
|
354 | this.imGuiWindowBridgeEngine.fontMessages.Add(new SetFontMessage{ |
|
355 | fontSize = options.fontSize, |
|
355 | fontSize = options.fontSize, |
You need to be logged in to leave comments.
Login now