move depends-on from category to codelist
This commit is contained in:
parent
e5a6d2e0db
commit
dd215c75e7
4 changed files with 22 additions and 28 deletions
|
@ -751,6 +751,7 @@
|
|||
<code>
|
||||
<category>timer</category>
|
||||
<presets>standard,recommended,il</presets>
|
||||
<depends-on>loader</depends-on>
|
||||
<title lang="en-US">Shine Get Timer</title>
|
||||
<title lang="de-CH">Shine Get Timer</title>
|
||||
<title lang="fr-FR">Chronomètre Shine Get</title>
|
||||
|
|
|
@ -287,6 +287,7 @@ const parseXml = (xmlString, gameVersion = null) => {
|
|||
source: readCode(code, 'source', gameVersion),
|
||||
presets: readPresetList(code, gameVersion),
|
||||
category: readTextNode(code, 'category'),
|
||||
dependsOn: code.querySelector('depends-on')?.textContent ?? null,
|
||||
}))
|
||||
.filter((code) => code.source != null);
|
||||
};
|
||||
|
|
|
@ -87,8 +87,8 @@ export default {
|
|||
}
|
||||
|
||||
this.unselectStageLoader();
|
||||
this.onSelectionChanged(this.availableCodes.filter((c) => c.selected));
|
||||
this.refreshDisabledCodes();
|
||||
this.onSelectionChanged(this.availableCodes.filter((c) => c.selected));
|
||||
this.generation++;
|
||||
},
|
||||
getPresetPlaceholder() {
|
||||
|
@ -117,23 +117,21 @@ export default {
|
|||
const newState = !this.stageLoaderSelected;
|
||||
this.stageLoaderSelected = newState;
|
||||
this.onStageLoaderToggle(newState);
|
||||
this.onSelectionChanged(this.availableCodes.filter((c) => c.selected));
|
||||
this.refreshDisabledCodes();
|
||||
this.onSelectionChanged(this.availableCodes.filter((c) => c.selected));
|
||||
},
|
||||
refreshDisabledCodes() {
|
||||
for (const dependentCategory of codeCategories.filter((c) => c.dependsOn.length > 0)) {
|
||||
for (const dependency of dependentCategory.dependsOn) {
|
||||
const enableCodes =
|
||||
(dependency === 'loader' && this.stageLoaderSelected) ||
|
||||
this.availableCodes.find((c) => c.selected && c.category === dependency);
|
||||
|
||||
for (const code of this.availableCodes.filter(
|
||||
(c) => c.category === dependentCategory.identifier && c.disabled !== !enableCodes,
|
||||
)) {
|
||||
code.disabled = !enableCodes;
|
||||
if (code.disabled && code.selected) {
|
||||
this.toggle(code);
|
||||
}
|
||||
for (const code of this.availableCodes) {
|
||||
if (code.dependsOn) {
|
||||
if (code.dependsOn === 'loader' && this.stageLoaderSelected) {
|
||||
code.disabled = false;
|
||||
} else if (
|
||||
!this.availableCodes.some((c) => c.selected && c.category === code.dependsOn)
|
||||
) {
|
||||
code.disabled = true;
|
||||
code.selected = false;
|
||||
} else {
|
||||
code.disabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -153,8 +151,8 @@ export default {
|
|||
}
|
||||
|
||||
code.selected = code.disabled ? false : !code.selected;
|
||||
this.onSelectionChanged(this.availableCodes.filter((c) => c.selected));
|
||||
this.refreshDisabledCodes();
|
||||
this.onSelectionChanged(this.availableCodes.filter((c) => c.selected));
|
||||
},
|
||||
populate() {
|
||||
this.availableCodes = this.codes.map((c) => ({ ...c, selected: false }));
|
||||
|
|
|
@ -2,37 +2,31 @@
|
|||
{
|
||||
"identifier": "qol",
|
||||
"i18nKey": "generatorconfig.categories.qol",
|
||||
"exclusive": false,
|
||||
"dependsOn": []
|
||||
"exclusive": false
|
||||
},
|
||||
{
|
||||
"identifier": "loader",
|
||||
"i18nKey": "generatorconfig.categories.loader",
|
||||
"exclusive": true,
|
||||
"dependsOn": []
|
||||
"exclusive": true
|
||||
},
|
||||
{
|
||||
"identifier": "timer",
|
||||
"i18nKey": "generatorconfig.categories.timer",
|
||||
"exclusive": false,
|
||||
"dependsOn": ["loader"]
|
||||
"exclusive": false
|
||||
},
|
||||
{
|
||||
"identifier": "misc",
|
||||
"i18nKey": "generatorconfig.categories.misc",
|
||||
"exclusive": false,
|
||||
"dependsOn": []
|
||||
"exclusive": false
|
||||
},
|
||||
{
|
||||
"identifier": "memcardpatch",
|
||||
"i18nKey": "generatorconfig.categories.memcardpatch",
|
||||
"exclusive": true,
|
||||
"dependsOn": []
|
||||
"exclusive": true
|
||||
},
|
||||
{
|
||||
"identifier": "cosmetic",
|
||||
"i18nKey": "generatorconfig.categories.cosmetic",
|
||||
"exclusive": false,
|
||||
"dependsOn": []
|
||||
"exclusive": false
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue