editing custom roles

This commit is contained in:
AlecM33
2022-01-11 19:57:13 -05:00
parent 3b14ae3978
commit c0c4ccdd74
14 changed files with 172 additions and 58 deletions

View File

@@ -6,6 +6,8 @@ export class DeckStateManager {
constructor() {
this.deck = null;
this.customRoleOptions = [];
this.createMode = false;
this.currentlyEditingRoleName = null;
}
addToDeck(role) {
@@ -22,6 +24,13 @@ export class DeckStateManager {
localStorage.setItem("play-werewolf-custom-roles", JSON.stringify(this.customRoleOptions.concat(this.deck.filter(card => card.custom === true))));
}
updateCustomRoleOption(option, name, description, team) {
option.role = name;
option.description = description;
option.team = team;
localStorage.setItem("play-werewolf-custom-roles", JSON.stringify(this.customRoleOptions.concat(this.deck.filter(card => card.custom === true))));
}
removeFromCustomRoleOptions(name) {
let option = this.customRoleOptions.find((option) => option.role === name);
if (option) {