mirror of
https://git.srhtnin.garden/sarah/srhtnin.github.io.git
synced 2026-10-13 18:38:11 +02:00
84 lines
1.4 KiB
JavaScript
84 lines
1.4 KiB
JavaScript
async function StartGuide() {
|
|
try {
|
|
await LoadGameContent();
|
|
RenderGuideRecipePlants();
|
|
} catch (Error) {
|
|
console.error(
|
|
"Couldn't load Guide plant images:",
|
|
Error
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
function RenderGuideRecipePlants() {
|
|
const Cells =
|
|
document.querySelectorAll(
|
|
".GuideRecipePlant[data-plant-key]"
|
|
);
|
|
|
|
|
|
for (
|
|
const Cell
|
|
of Cells
|
|
) {
|
|
const PlantKey =
|
|
Cell.dataset.plantKey;
|
|
|
|
const Plant =
|
|
Plants[PlantKey];
|
|
|
|
const MatureImage =
|
|
Plant === undefined
|
|
? null
|
|
: GetPlantMatureImageSource(
|
|
Plant
|
|
);
|
|
|
|
|
|
if (
|
|
Plant === undefined ||
|
|
MatureImage === null
|
|
) {
|
|
continue;
|
|
}
|
|
|
|
|
|
const Image =
|
|
document.createElement(
|
|
"img"
|
|
);
|
|
|
|
Image.className =
|
|
"PlantSprite GuideRecipeImage";
|
|
|
|
Image.src =
|
|
MatureImage;
|
|
|
|
Image.alt = "";
|
|
|
|
|
|
const Label =
|
|
Cell.querySelector(
|
|
".GuideRecipeLabel"
|
|
);
|
|
|
|
|
|
if (Label !== null) {
|
|
Label.textContent =
|
|
Plant.Name;
|
|
}
|
|
|
|
|
|
Cell.prepend(
|
|
Image
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
document.addEventListener(
|
|
"DOMContentLoaded",
|
|
StartGuide
|
|
);
|