Skip to content

Commit d8382c9

Browse files
More migration docs.
1 parent c02add2 commit d8382c9

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/09-migration/09-02-0.5.0-to-0.6.0.md

+24
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,27 @@ video.play(videoPath);
3030
// You can also run video.load() in advance before playing the video.
3131
if (video.load(videoPath)) video.play();
3232
```
33+
34+
# Options Menu Changes
35+
36+
The options menu received a minor refactor internally. The `pages` list was moved to its own class, which changes the code needed to access the "Preferences" menu (mainly done to add custom preferences).
37+
38+
We would like to standardize the process of adding custom user preferences to mods in the future eventually, but in the meantime you can make the necessary tweaks:
39+
40+
```haxe
41+
// BEFORE: Retrieve the value from the page Map.
42+
if (Std.isOfType(currentState, OptionsState)) {
43+
var preferencesPage = currentState.pages.get("preferences");
44+
45+
// Create a new option.
46+
prefs.createPrefItemCheckbox(...);
47+
}
48+
49+
// AFTER: Retrieve the value from the page Map, which is now inside a Codex.
50+
if (Std.isOfType(currentState, OptionsState)) {
51+
var preferencesPage = currentState.optionsCodex.pages.get("preferences");
52+
53+
// Create a new option.
54+
prefs.createPrefItemCheckbox(...);
55+
}
56+
```

0 commit comments

Comments
 (0)