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