#52 : Debut gestion astrologie
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
/* -------------------------------------------- */
|
||||
import { RdDCalendrierEditeur } from "./rdd-calendrier-editeur.js";
|
||||
import { RdDAstrologieEditeur } from "./rdd-astrologie-editeur.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const heuresList = [ "vaisseau", "sirene", "faucon", "couronne", "dragon", "epees", "lyre", "serpent", "poissonacrobate", "araignee", "roseau", "chateaudormant" ];
|
||||
@ -69,6 +70,13 @@ export class RdDCalendrier extends Application {
|
||||
return options;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getDateFromIndex( index ) {
|
||||
let month = Math.ceil(index / 28);
|
||||
let day = index - (month*28);
|
||||
return day+"/"+heuresList[month];
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getCurrentDayIndex( ) {
|
||||
return (this.calendrier.moisRdD * 28) + this.calendrier.jour;
|
||||
@ -241,7 +249,7 @@ export class RdDCalendrier extends Application {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async showCalendarEditor() {
|
||||
async showCalendarEditor() {
|
||||
let calendrierData = duplicate( this.fillCalendrierData( ) );
|
||||
if ( this.editeur == undefined ) {
|
||||
calendrierData.jourMoisOptions = Array(28).fill().map((item, index) => 1 + index);
|
||||
@ -254,6 +262,22 @@ export class RdDCalendrier extends Application {
|
||||
this.editeur.render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async showAstrologieEditor() {
|
||||
let calendrierData = duplicate( this.fillCalendrierData( ) );
|
||||
calendrierData.astrologieData = duplicate( this.listeNombreAstral );
|
||||
for (let index in calendrierData.astrologieData ) {
|
||||
let astralData = calendrierData.astrologieData[index];
|
||||
astralData.humanDate = this.getDateFromIndex( index );
|
||||
}
|
||||
if ( this.astrologieEditeur == undefined ) {
|
||||
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/calendar-astrologie-template.html', calendrierData );
|
||||
this.astrologieEditeur = new RdDAstrologieEditeur(html, this, calendrierData )
|
||||
}
|
||||
this.astrologieEditeur.updateData( calendrierData );
|
||||
this.astrologieEditeur.render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
activateListeners(html) {
|
||||
@ -305,6 +329,10 @@ export class RdDCalendrier extends Application {
|
||||
ev.preventDefault();
|
||||
this.showCalendarEditor();
|
||||
});
|
||||
html.find('#astrologie-btn-edit').click(ev => {
|
||||
ev.preventDefault();
|
||||
this.showAstrologieEditor();
|
||||
});
|
||||
|
||||
html.find('#calendar--move-handle').mousedown(ev => {
|
||||
ev.preventDefault();
|
||||
|
Reference in New Issue
Block a user