mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Removed reset button from achievement state
Root is not accessible there
This commit is contained in:
parent
d95ecd7ee2
commit
09d84a714d
@ -20,53 +20,6 @@ export class AchievementsState extends TextualGameState {
|
|||||||
]);
|
]);
|
||||||
this.contentDiv = makeDiv(this.parent, null, ["content"]);
|
this.contentDiv = makeDiv(this.parent, null, ["content"]);
|
||||||
|
|
||||||
this.resetElement = {};
|
|
||||||
|
|
||||||
// Wrapper
|
|
||||||
this.resetElement.elem = makeDiv(this.contentDiv, null, ["achievement", "reset", "unlocked"]);
|
|
||||||
|
|
||||||
// Icon
|
|
||||||
this.resetElement.icon = makeDiv(this.resetElement.elem, null, ["icon"]);
|
|
||||||
this.resetElement.icon.setAttribute("data-icon", "achievements/reset.png");
|
|
||||||
|
|
||||||
// Info
|
|
||||||
this.resetElement.info = makeDiv(this.resetElement.elem, null, ["info"]);
|
|
||||||
|
|
||||||
// Title
|
|
||||||
this.resetElement.title = makeDiv(
|
|
||||||
this.resetElement.info,
|
|
||||||
null,
|
|
||||||
["title"],
|
|
||||||
T.achievements.reset.title
|
|
||||||
);
|
|
||||||
|
|
||||||
// Description
|
|
||||||
this.resetElement.description = makeDiv(
|
|
||||||
this.resetElement.info,
|
|
||||||
null,
|
|
||||||
["description"],
|
|
||||||
T.achievements.reset.description
|
|
||||||
);
|
|
||||||
|
|
||||||
// Reset button
|
|
||||||
this.resetElement.resetButton = document.createElement("button");
|
|
||||||
this.resetElement.resetButton.classList.add("reset", "styledButton");
|
|
||||||
this.resetElement.resetButton.innerText = T.ingame.achievements.buttonReset;
|
|
||||||
this.resetElement.elem.appendChild(this.resetElement.resetButton);
|
|
||||||
this.trackClicks(this.resetElement.resetButton, () => {
|
|
||||||
const signals = this.dialogs.showWarning(
|
|
||||||
T.dialogs.resetAchievements.title,
|
|
||||||
T.dialogs.resetAchievements.description,
|
|
||||||
["cancel:bad:escape", "ok:good:enter"]
|
|
||||||
);
|
|
||||||
signals.ok.add(() => {
|
|
||||||
for (const achievementKey in ACHIEVEMENTS) {
|
|
||||||
if (!this.app.achievementProvider.collection.map.has(achievementKey))
|
|
||||||
this.app.achievementProvider.collection.lock(ACHIEVEMENTS[achievementKey]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
this.achievementToElements = {};
|
this.achievementToElements = {};
|
||||||
|
|
||||||
// ACHIEVEMENTS
|
// ACHIEVEMENTS
|
||||||
@ -94,16 +47,6 @@ export class AchievementsState extends TextualGameState {
|
|||||||
T.achievements[achievementKey].description
|
T.achievements[achievementKey].description
|
||||||
);
|
);
|
||||||
|
|
||||||
// Reset button
|
|
||||||
handle.resetButton = document.createElement("button");
|
|
||||||
handle.resetButton.classList.add("reset", "styledButton");
|
|
||||||
handle.resetButton.innerText = T.ingame.achievements.buttonReset;
|
|
||||||
handle.elem.appendChild(handle.resetButton);
|
|
||||||
|
|
||||||
this.trackClicks(handle.resetButton, () => {
|
|
||||||
this.app.achievementProvider.collection.lock(ACHIEVEMENTS[achievementKey]);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Assign handle
|
// Assign handle
|
||||||
this.achievementToElements[achievementKey] = handle;
|
this.achievementToElements[achievementKey] = handle;
|
||||||
}
|
}
|
||||||
@ -161,11 +104,5 @@ export class AchievementsState extends TextualGameState {
|
|||||||
"<amountHidden>",
|
"<amountHidden>",
|
||||||
hidden + ""
|
hidden + ""
|
||||||
);
|
);
|
||||||
|
|
||||||
if (unlocked > 0) {
|
|
||||||
if (!this.resetElement.elem.classList.contains("unlocked"))
|
|
||||||
this.resetElement.elem.classList.add("unlocked");
|
|
||||||
} else if (this.resetElement.elem.classList.contains("unlocked"))
|
|
||||||
this.resetElement.elem.classList.remove("unlocked");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user