From 63e410458ec5e7cc2d676017002b7751864e1443 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Wed, 9 Dec 2020 00:01:02 +0100 Subject: [PATCH] #52 Gestion astrologie --- module/rdd-calendrier.js | 23 ++++++++++++++--------- styles/simple.css | 9 +++++++++ templates/calendar-template.html | 2 +- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/module/rdd-calendrier.js b/module/rdd-calendrier.js index 409634c4..c2fe6656 100644 --- a/module/rdd-calendrier.js +++ b/module/rdd-calendrier.js @@ -54,19 +54,12 @@ export class RdDCalendrier extends Application { // nombre astral if ( game.user.isGM) { this.listeNombreAstral = duplicate(game.settings.get("foundryvtt-reve-de-dragon", "liste-nombre-astral")); - if ( this.listeNombreAstral == undefined ) { - this.rebuildListeNombreAstral(); - } + this.rebuildListeNombreAstral(); // Ensure always up-to-date } console.log(this.calendrier, this.calendrierPos, this.listeNombreAstral); } - /* -------------------------------------------- */ - getCurrentDayIndex( ) { - return (this.calendrier.moisRdD * 28) + this.calendrier.jour; - } - /* -------------------------------------------- */ static get defaultOptions() { const options = super.defaultOptions; @@ -76,6 +69,11 @@ export class RdDCalendrier extends Application { return options; } + /* -------------------------------------------- */ + getCurrentDayIndex( ) { + return (this.calendrier.moisRdD * 28) + this.calendrier.jour; + } + /* -------------------------------------------- */ ajouterNombreAstral(index) { return { @@ -85,6 +83,12 @@ export class RdDCalendrier extends Application { } } + /* -------------------------------------------- */ + getCurrentNombreAstral() { + let index = this.getCurrentDayIndex(); + return this.listeNombreAstral[index].nombreAstral; + } + /* -------------------------------------------- */ rebuildListeNombreAstral() { // Auto-create if needed @@ -215,10 +219,11 @@ export class RdDCalendrier extends Application { updateDisplay() { let data = this.fillCalendrierData( ); // Rebuild data - document.getElementById("calendar--move-handle").innerHTML = `Jour ${data.jourMois} de ${data.nomMois} (${data.nomSaison})`; + document.getElementById("calendar--move-handle").innerHTML = `Jour ${data.jourMois} de ${data.nomMois} (${data.nomSaison})` + " - NA: "+this.getCurrentNombreAstral(); document.getElementById("calendar-heure-texte").innerHTML = ` - ${data.nomHeure}`; document.getElementById("calendar-time").innerHTML = `${data.heuresRelative}:${data.minutesRelative}`; document.getElementById("calendar-icone-heure").innerHTML = data.lettreFont; + } /* -------------------------------------------- */ diff --git a/styles/simple.css b/styles/simple.css index 6c083eee..41d119e7 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -1127,6 +1127,15 @@ ul, li { cursor: pointer; display: inline-flex; } +.calendar-nombre-astral{ +grid-column: 2; +grid-row: 2; +font-size: 1.10rem; +text-align: right; +margin: auto; +cursor: pointer; +display: inline-flex; +} .calendar-time-disp{ position: relative; bottom: 6px; diff --git a/templates/calendar-template.html b/templates/calendar-template.html index e4b8496e..269c5e06 100644 --- a/templates/calendar-template.html +++ b/templates/calendar-template.html @@ -18,7 +18,7 @@ {{/if}}

H {{nomHeure}}

-

{{heuresRelative}}:{{minutesRelative}}

+

{{heuresRelative}}:{{minutesRelative}} - N. Astral: 1

{{#if isGM}}