Skip to content

Commit

Permalink
Persistence: Display Mode & Hidden Actors
Browse files Browse the repository at this point in the history
  • Loading branch information
mclemente committed Dec 21, 2022
1 parent 78c949a commit 4186fca
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
8 changes: 6 additions & 2 deletions module/logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class PartyOverviewApp extends Application {
constructor(options) {
super(options);

this.hiddenActors = [];
this.hiddenActors = game.settings.get("party-overview", "hiddenActors");
this.state = {};
this.displayMode = DISPLAY_MODE.SHOW_PC_ONLY;
this.displayMode = game.settings.get("party-overview", "displayMode");
this.activeTab = "general";
this.rendering = false;
}
Expand Down Expand Up @@ -117,22 +117,26 @@ class PartyOverviewApp extends Application {
$(".btn-toggle-visibility").on("click", (event) => {
const actorId = event.currentTarget.dataset.actor;
this.hiddenActors = this.hiddenActors.includes(actorId) ? this.hiddenActors.filter((id) => id !== actorId) : [...this.hiddenActors, actorId];
game.settings.set("party-overview", "hiddenActors", this.hiddenActors);
this.render(false);
});
$(".btn-toggle-visibility").on("contextmenu", (event) => {
const actorId = event.currentTarget.dataset.actor;
this.hiddenActors = this.hiddenActors.includes(actorId) ? this.hiddenActors.filter((id) => id !== actorId) : [...this.hiddenActors, actorId];
game.settings.set("party-overview", "hiddenActors", this.hiddenActors);
this.render(false);
});

$(".btn-filter").on("click", (event) => {
this.displayMode += 1;
if (this.displayMode > Object.keys(DISPLAY_MODE).length - 1) this.displayMode = 0;
game.settings.set("party-overview", "displayMode", this.displayMode);
this.render(false);
});
$(".btn-filter").on("contextmenu", (event) => {
this.displayMode -= 1;
if (this.displayMode < 0) this.displayMode = Object.keys(DISPLAY_MODE).length - 1;
game.settings.set("party-overview", "displayMode", this.displayMode);
this.render(false);
});

Expand Down
12 changes: 12 additions & 0 deletions module/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ export function registerSettings() {
default: getDefaultSystemProvider(),
onChange: updateSystemProvider,
});
game.settings.register("party-overview", "displayMode", {
scope: "world",
config: false,
type: Number,
default: 4,
});
game.settings.register("party-overview", "hiddenActors", {
scope: "world",
config: false,
type: Array,
default: [],
});
}

export function registerApiSettings() {
Expand Down

0 comments on commit 4186fca

Please sign in to comment.