2020-11-29 18:21:34 +01:00
|
|
|
/* -------------------------------------------- */
|
|
|
|
export class RdDTMRRencontreDialog extends Dialog {
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
2021-01-29 15:13:59 +01:00
|
|
|
constructor(html, tmrApp, rencontre) {
|
2020-11-29 18:21:34 +01:00
|
|
|
const dialogConf = {
|
|
|
|
title: "Rencontre en TMR!",
|
2021-01-29 15:13:59 +01:00
|
|
|
content: "Vous recontrez un " + rencontre.name + " de force " + rencontre.force + "<br>",
|
2020-11-29 18:21:34 +01:00
|
|
|
buttons: {
|
|
|
|
derober: { icon: '<i class="fas fa-check"></i>', label: "Se dérober", callback: () => { this.toClose = true; this.tmrApp.derober() } },
|
2021-01-29 15:13:59 +01:00
|
|
|
refouler: { icon: '<i class="fas fa-check"></i>', label: "Refouler", callback: () => { this.toClose = true; this.tmrApp.refouler() } },
|
|
|
|
maitiser: { icon: '<i class="fas fa-check"></i>', label: "Maîtriser", callback: () => { this.toClose = true; this.tmrApp.maitriser() } }
|
2020-11-29 18:21:34 +01:00
|
|
|
},
|
|
|
|
default: "derober"
|
|
|
|
}
|
2021-01-29 15:13:59 +01:00
|
|
|
if (rencontre.ignorer) {
|
|
|
|
dialogConf.buttons.ignorer = { icon: '<i class="fas fa-check"></i>', label: "Ignorer", callback: () => { this.toClose = true; this.tmrApp.ignorerRencontre() }};
|
|
|
|
}
|
2020-11-29 18:21:34 +01:00
|
|
|
|
|
|
|
const dialogOptions = {
|
|
|
|
classes: ["tmrrencdialog"],
|
|
|
|
width: 320, height: 240,
|
|
|
|
'z-index': 20
|
|
|
|
}
|
|
|
|
super(dialogConf, dialogOptions);
|
|
|
|
|
|
|
|
this.toClose = false;
|
2021-01-29 15:13:59 +01:00
|
|
|
this.rencontreData = duplicate(rencontre);
|
2020-11-29 18:21:34 +01:00
|
|
|
this.tmrApp = tmrApp;
|
|
|
|
this.tmrApp.minimize();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
close() {
|
|
|
|
if ( this.toClose ) {
|
|
|
|
this.tmrApp.maximize();
|
|
|
|
return super.close();
|
|
|
|
}
|
|
|
|
ui.notifications.info("Vous devez résoudre la rencontre.");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|