@@ -16,7 +16,6 @@ public enum EditorUIMode {
1616 }
1717
1818 public bool DisableLogo = false ;
19- public FontMeta AdofaiFont = new ( ) ;
2019 public string Lang = "en-US" ;
2120 public float FPSUpdateRate = 100 ;
2221 public float FrameTimeUpdateRate = 100 ;
@@ -29,25 +28,23 @@ public enum EditorUIMode {
2928 public bool AutoUpdateBeta = false ;
3029 public bool Tooltip = true ;
3130 public bool AutoPivot = true ;
32- public bool IncludeReferences = true ;
3331 public bool ShowTextNameAsDisplayText = false ;
3432 public EditorUIMode UiMode = EditorUIMode . Simple ;
33+ public bool IncludeReferences = true ;
3534
35+ public FontMeta AdofaiFont = new ( ) ;
3636 public bool ChangeFont = false ;
3737 public bool ShowTrueAutoJudgment = false ;
3838
3939 public bool IsFirstEg = true ;
4040 public JToken Serialize ( ) {
4141 var node = new JObject {
4242 [ nameof ( DisableLogo ) ] = DisableLogo ,
43- [ nameof ( ChangeFont ) ] = ChangeFont ,
44- [ nameof ( AdofaiFont ) ] = AdofaiFont ? . Serialize ( ) ,
4543 [ nameof ( Lang ) ] = Lang ,
4644 [ nameof ( FPSUpdateRate ) ] = FPSUpdateRate ,
4745 [ nameof ( FrameTimeUpdateRate ) ] = FrameTimeUpdateRate ,
4846 [ nameof ( SystemTagUpdateRate ) ] = SystemTagUpdateRate ,
4947 [ nameof ( LegacyTheme ) ] = LegacyTheme ,
50- [ nameof ( ShowTrueAutoJudgment ) ] = ShowTrueAutoJudgment ,
5148 [ nameof ( MovingManEditor ) ] = MovingManEditor ,
5249 [ nameof ( ColorRangeEditor ) ] = ColorRangeEditor ,
5350 [ nameof ( EasedValueEditor ) ] = EasedValueEditor ,
@@ -56,8 +53,13 @@ public JToken Serialize() {
5653 [ nameof ( Tooltip ) ] = Tooltip ,
5754 [ nameof ( AutoPivot ) ] = AutoPivot ,
5855 [ nameof ( ShowTextNameAsDisplayText ) ] = ShowTextNameAsDisplayText ,
59- [ nameof ( IncludeReferences ) ] = IncludeReferences ,
6056 [ nameof ( UiMode ) ] = UiMode . ToString ( ) ,
57+ [ nameof ( IncludeReferences ) ] = IncludeReferences ,
58+
59+ [ nameof ( AdofaiFont ) ] = AdofaiFont ? . Serialize ( ) ,
60+ [ nameof ( ChangeFont ) ] = ChangeFont ,
61+ [ nameof ( ShowTrueAutoJudgment ) ] = ShowTrueAutoJudgment ,
62+
6163 [ nameof ( IsFirstEg ) ] = IsFirstEg
6264 } ;
6365 return node ;
@@ -66,48 +68,52 @@ public void Deserialize(JToken node) {
6668 var defaultSettings = new Settings ( ) ;
6769
6870 DisableLogo = node [ nameof ( DisableLogo ) ] ? . Value < bool > ( ) ?? defaultSettings . DisableLogo ;
69- ChangeFont = node [ nameof ( ChangeFont ) ] ? . Value < bool > ( ) ?? defaultSettings . ChangeFont ;
70- AdofaiFont = node [ nameof ( AdofaiFont ) ] != null
71- ? ModelUtils . Unbox < FontMeta > ( node [ nameof ( AdofaiFont ) ] )
72- : defaultSettings . AdofaiFont ;
7371 Lang = node [ nameof ( Lang ) ] ? . Value < string > ( ) ?? defaultSettings . Lang ;
7472 FPSUpdateRate = node [ nameof ( FPSUpdateRate ) ] ? . Value < float > ( ) ?? defaultSettings . FPSUpdateRate ;
7573 FrameTimeUpdateRate = node [ nameof ( FrameTimeUpdateRate ) ] ? . Value < float > ( ) ?? defaultSettings . FrameTimeUpdateRate ;
7674 SystemTagUpdateRate = node [ nameof ( SystemTagUpdateRate ) ] ? . Value < int > ( ) ?? defaultSettings . SystemTagUpdateRate ;
7775 LegacyTheme = node [ nameof ( LegacyTheme ) ] ? . Value < bool > ( ) ?? defaultSettings . LegacyTheme ;
78- ShowTrueAutoJudgment = node [ nameof ( ShowTrueAutoJudgment ) ] ? . Value < bool > ( ) ?? defaultSettings . ShowTrueAutoJudgment ;
7976 MovingManEditor = node [ nameof ( MovingManEditor ) ] ? . Value < bool > ( ) ?? defaultSettings . MovingManEditor ;
8077 ColorRangeEditor = node [ nameof ( ColorRangeEditor ) ] ? . Value < bool > ( ) ?? defaultSettings . ColorRangeEditor ;
8178 EasedValueEditor = node [ nameof ( EasedValueEditor ) ] ? . Value < bool > ( ) ?? defaultSettings . EasedValueEditor ;
8279 AutoUpdate = node [ nameof ( AutoUpdate ) ] ? . Value < bool > ( ) ?? defaultSettings . AutoUpdate ;
8380 AutoUpdateBeta = node [ nameof ( AutoUpdateBeta ) ] ? . Value < bool > ( ) ?? defaultSettings . AutoUpdateBeta ;
8481 Tooltip = node [ nameof ( Tooltip ) ] ? . Value < bool > ( ) ?? defaultSettings . Tooltip ;
8582 AutoPivot = node [ nameof ( AutoPivot ) ] ? . Value < bool > ( ) ?? defaultSettings . AutoPivot ;
86- IncludeReferences = node [ nameof ( IncludeReferences ) ] ? . Value < bool > ( ) ?? defaultSettings . IncludeReferences ;
8783 ShowTextNameAsDisplayText = node [ nameof ( ShowTextNameAsDisplayText ) ] ? . Value < bool > ( ) ?? defaultSettings . ShowTextNameAsDisplayText ;
8884 UiMode = EnumHelper < EditorUIMode > . Parse ( node [ nameof ( UiMode ) ] ? . Value < string > ( ) ?? defaultSettings . UiMode . ToString ( ) ) ;
85+ IncludeReferences = node [ nameof ( IncludeReferences ) ] ? . Value < bool > ( ) ?? defaultSettings . IncludeReferences ;
86+
87+ ChangeFont = node [ nameof ( ChangeFont ) ] ? . Value < bool > ( ) ?? defaultSettings . ChangeFont ;
88+ AdofaiFont = node [ nameof ( AdofaiFont ) ] != null
89+ ? ModelUtils . Unbox < FontMeta > ( node [ nameof ( AdofaiFont ) ] )
90+ : defaultSettings . AdofaiFont ;
91+ ShowTrueAutoJudgment = node [ nameof ( ShowTrueAutoJudgment ) ] ? . Value < bool > ( ) ?? defaultSettings . ShowTrueAutoJudgment ;
8992
9093 IsFirstEg = node [ nameof ( IsFirstEg ) ] ? . Value < bool > ( ) ?? defaultSettings . IsFirstEg ;
9194 }
9295 public Settings Copy ( ) {
9396 var newSettings = new Settings {
9497 DisableLogo = DisableLogo ,
95- ChangeFont = ChangeFont ,
96- AdofaiFont = AdofaiFont . Copy ( ) ,
9798 Lang = Lang ,
9899 FPSUpdateRate = FPSUpdateRate ,
99100 FrameTimeUpdateRate = FrameTimeUpdateRate ,
100101 SystemTagUpdateRate = SystemTagUpdateRate ,
101102 LegacyTheme = LegacyTheme ,
102- ShowTrueAutoJudgment = ShowTrueAutoJudgment ,
103103 MovingManEditor = MovingManEditor ,
104104 ColorRangeEditor = ColorRangeEditor ,
105105 EasedValueEditor = EasedValueEditor ,
106106 AutoUpdate = AutoUpdate ,
107107 AutoUpdateBeta = AutoUpdateBeta ,
108108 AutoPivot = AutoPivot ,
109- IncludeReferences = IncludeReferences ,
110109 ShowTextNameAsDisplayText = ShowTextNameAsDisplayText ,
110+ UiMode = UiMode ,
111+ IncludeReferences = IncludeReferences ,
112+
113+ ChangeFont = ChangeFont ,
114+ AdofaiFont = AdofaiFont . Copy ( ) ,
115+ ShowTrueAutoJudgment = ShowTrueAutoJudgment ,
116+
111117 IsFirstEg = IsFirstEg
112118 } ;
113119 return newSettings ;
@@ -150,7 +156,7 @@ private bool MigratefromLegacyXmlSettings() {
150156
151157 DisableLogo = legacy . disableLogo ;
152158 ChangeFont = legacy . ChangeFont ;
153- AdofaiFont = legacy . AdoFont ;
159+ AdofaiFont = legacy . AdoFont ? . Copy ( ) ;
154160 Lang = legacy . Lang ;
155161 FPSUpdateRate = legacy . FPSUpdateRate ;
156162 FrameTimeUpdateRate = legacy . FrameTimeUpdateRate ;
@@ -176,7 +182,7 @@ private bool MigratefromLegacyXmlSettings() {
176182 return true ;
177183 }
178184
179- [ Serializable ]
185+ [ XmlRoot ( "Settings" ) ]
180186 public class LegacyXmlSettings {
181187 public bool disableLogo ;
182188 public bool ChangeFont ;
@@ -195,7 +201,7 @@ public class LegacyXmlSettings {
195201 public bool useTooltip ;
196202 public bool autoPivot ;
197203 public bool showTextNameAsDisplayText ;
198- public Settings . EditorUIMode uiMode ;
204+ public EditorUIMode uiMode ;
199205 public bool isFirstEg ;
200206 }
201207}
0 commit comments