foundryvtt-reve-de-dragon/module/rdd-astrologie-editeur.js

55 lines
1.5 KiB
JavaScript
Raw Normal View History

import { ThemeAstral } from "./sommeil/theme-astral.js";
2020-12-10 20:14:35 +01:00
/**
* Extend the base Dialog entity by defining a custom window to perform roll.
* @extends {Dialog}
*/
export class RdDAstrologieEditeur extends Dialog {
2020-12-10 20:14:35 +01:00
/* -------------------------------------------- */
constructor(html, calendrier, calendrierData) {
let dialogConf = {
title: "Editeur d'Astrologie",
content: html,
default: "fermer",
buttons: {
fermer: { label: "Fermer", callback: html => { } }
}
};
let dialogOptions = {
classes: ["rdd-roll-dialog"],
width: 600,
height: 'fit-content',
'max-height': 800,
'z-index': 99999
}
2020-12-10 20:14:35 +01:00
super(dialogConf, dialogOptions)
2020-12-10 20:14:35 +01:00
this.calendrier = calendrier;
this.updateData(calendrierData);
2020-12-10 20:14:35 +01:00
}
activateListeners(html) {
super.activateListeners(html);
this.html = html;
this.html.find('[name="theme-astral"]').click(event => ThemeAstral.create());
this.html.find('[name="reset-nombres-astraux"]').click(event => this.resetNombreAstraux());
}
/* -------------------------------------------- */
async resetNombreAstraux() {
2021-04-25 10:08:40 +02:00
game.system.rdd.calendrier.resetNombreAstral();
await game.system.rdd.calendrier.rebuildListeNombreAstral();
2021-04-25 10:08:40 +02:00
game.system.rdd.calendrier.showAstrologieEditor();
this.close()
2021-04-25 10:08:40 +02:00
}
2020-12-10 20:14:35 +01:00
/* -------------------------------------------- */
updateData(calendrierData) {
2020-12-10 20:14:35 +01:00
this.calendrierData = duplicate(calendrierData);
}
}