Finishing the Sync sheet and some other stuffs
This commit is contained in:
parent
a28718b115
commit
554fae5a93
26 changed files with 494 additions and 105 deletions
|
|
@ -1,7 +1,8 @@
|
|||
export class GenericSheet extends ActorSheet {
|
||||
#propogatedSettings = [
|
||||
`devMode`,
|
||||
`showAvatarOnSheet`
|
||||
`showAvatarOnSheet`,
|
||||
`playersCanChangeGroup`,
|
||||
];
|
||||
|
||||
getData() {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,35 @@ export class PlayerSheet extends GenericSheet {
|
|||
if (!this.isEditable) return;
|
||||
console.debug(`.dungeon | Adding event listeners for Actor: ${this.id}`);
|
||||
|
||||
// html.find(`input.sync__input`).on("blur", ($e) => {});
|
||||
// html.find(`input.sync__input`).on("blur", ($e) => {
|
||||
// console.debug(`.dungeon | input.sync__input blur event`);
|
||||
|
||||
// let value = parseInt($e.target.value);
|
||||
// if (!value) {
|
||||
// ui.notifications.error(
|
||||
// `dotdungeon.notification.error.invalid-integer`,
|
||||
// { localize: true }
|
||||
// );
|
||||
// return;
|
||||
// };
|
||||
// let delta = value - this.#syncValue();
|
||||
// this.actor.system.syncDelta += delta;
|
||||
// for (const actor of game.actors) {
|
||||
// if (actor._sheet)
|
||||
// }
|
||||
// game.socket.emit(`system.dotdungeon`, {
|
||||
// type: "reload",
|
||||
|
||||
// })
|
||||
// });
|
||||
};
|
||||
|
||||
#syncValue() {
|
||||
let delta = 0;
|
||||
for (const actor of game.actors) {
|
||||
delta += actor.system.syncDelta ?? 0;
|
||||
};
|
||||
return 100 + delta;
|
||||
};
|
||||
|
||||
getData() {
|
||||
|
|
@ -30,7 +58,8 @@ export class PlayerSheet extends GenericSheet {
|
|||
ctx.flags = actor.flags;
|
||||
|
||||
ctx.computed = {
|
||||
syncTotal: 0
|
||||
syncTotal: this.#syncValue(),
|
||||
canChangeGroup: ctx.settings.playersCanChangeGroup,
|
||||
};
|
||||
|
||||
console.groupCollapsed(`PlayerSheet.getData`);
|
||||
|
|
|
|||
32
module/sheets/SyncVariations/AbstractSyncSheet.mjs
Normal file
32
module/sheets/SyncVariations/AbstractSyncSheet.mjs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { GenericSheet } from "../GenericSheet.mjs";
|
||||
|
||||
export class AbstractSyncSheet extends GenericSheet {
|
||||
static get defaultOptions() {
|
||||
let opts = mergeObject(
|
||||
super.defaultOptions,
|
||||
{
|
||||
width: 200,
|
||||
height: 200,
|
||||
}
|
||||
);
|
||||
opts.classes.push(
|
||||
`dotdungeon`,
|
||||
`dotdungeon--sync-sheet`
|
||||
);
|
||||
return opts;
|
||||
};
|
||||
|
||||
getData() {
|
||||
const ctx = super.getData();
|
||||
const actor = this.actor.toObject(false);
|
||||
|
||||
ctx.system = actor.system;
|
||||
ctx.flags = actor.flags;
|
||||
|
||||
console.groupCollapsed(`SyncSheet.getData`);
|
||||
console.log(`ctx`, ctx);
|
||||
console.log(`actor`, actor);
|
||||
console.groupEnd();
|
||||
return ctx;
|
||||
};
|
||||
};
|
||||
7
module/sheets/SyncVariations/BasicSyncSheet.mjs
Normal file
7
module/sheets/SyncVariations/BasicSyncSheet.mjs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import { AbstractSyncSheet } from "./AbstractSyncSheet.mjs";
|
||||
|
||||
export class BasicSyncSheet extends AbstractSyncSheet {
|
||||
get template() {
|
||||
return `systems/dotdungeon/templates/actors/sync/basic.hbs`;
|
||||
};
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue