Get the PlayerSheet working and actually saving data, using the data models instead of the template.json
This commit is contained in:
parent
6e3510ddd4
commit
58facf1490
11 changed files with 339 additions and 234 deletions
|
|
@ -1,26 +0,0 @@
|
|||
/**
|
||||
* Extend the basic ActorSheet with some very simple modifications
|
||||
* @extends {ActorSheet}
|
||||
*/
|
||||
export class CharacterSheet extends ActorSheet {
|
||||
static get defaultOptions() {
|
||||
let opts = mergeObject(
|
||||
super.defaultOptions,
|
||||
{
|
||||
template: "systems/dotdungeon/templates/actors/char-sheet-mvp/sheet.hbs"
|
||||
}
|
||||
);
|
||||
opts.classes.push("dotdungeon");
|
||||
return opts;
|
||||
};
|
||||
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
if (!this.isEditable) return;
|
||||
console.debug(`.dungeon | Adding event listeners for Actor${this.id}`)
|
||||
|
||||
// Modal openings
|
||||
html.find(`button.stat-prompt`).on("click", () => {});
|
||||
}
|
||||
}
|
||||
36
module/sheets/PlayerSheet.mjs
Normal file
36
module/sheets/PlayerSheet.mjs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
export class PlayerSheet extends ActorSheet {
|
||||
static get defaultOptions() {
|
||||
let opts = mergeObject(
|
||||
super.defaultOptions,
|
||||
{
|
||||
template: "systems/dotdungeon/templates/actors/char-sheet-mvp/sheet.hbs"
|
||||
}
|
||||
);
|
||||
opts.classes.push("dotdungeon");
|
||||
return opts;
|
||||
};
|
||||
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
if (!this.isEditable) return;
|
||||
console.debug(`.dungeon | Adding event listeners for Actor: ${this.id}`);
|
||||
|
||||
// Modal openings
|
||||
// html.find(`button.stat-prompt`).on("click", () => {});
|
||||
};
|
||||
|
||||
getData() {
|
||||
const ctx = super.getData();
|
||||
const actor = this.actor.toObject(false);
|
||||
|
||||
ctx.system = actor.system;
|
||||
ctx.flags = actor.flags;
|
||||
|
||||
console.group(`PlayerSheet.getData`);
|
||||
console.log(`ctx`, ctx);
|
||||
console.log(`actor`, actor);
|
||||
console.groupEnd();
|
||||
return ctx;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue