2020-11-29 18:21:34 +01:00
|
|
|
/* -------------------------------------------- */
|
|
|
|
export class RdDTMRRencontreDialog extends Dialog {
|
2021-02-05 01:38:40 +01:00
|
|
|
|
2020-11-29 18:21:34 +01:00
|
|
|
/* -------------------------------------------- */
|
2022-11-07 00:04:43 +01:00
|
|
|
constructor(tmrApp, rencontre, tmr) {
|
2020-11-29 18:21:34 +01:00
|
|
|
const dialogConf = {
|
|
|
|
title: "Rencontre en TMR!",
|
2022-11-07 00:04:43 +01:00
|
|
|
content: "Vous rencontrez un " + rencontre.name + " de force " + rencontre.system.force + "<br>",
|
2020-11-29 18:21:34 +01:00
|
|
|
buttons: {
|
2022-11-07 00:04:43 +01:00
|
|
|
derober: { icon: '<i class="fas fa-check"></i>', label: "Se dérober", callback: () => this.onButtonAction('derober') },
|
|
|
|
maitiser: { icon: '<i class="fas fa-check"></i>', label: "Maîtriser", callback: () => this.onButtonAction('maitriser') }
|
2020-11-29 18:21:34 +01:00
|
|
|
},
|
|
|
|
default: "derober"
|
2022-11-07 00:04:43 +01:00
|
|
|
}
|
|
|
|
if ((rencontre.system.refoulement ?? 0) == 0) {
|
|
|
|
dialogConf.buttons.ignorer = { icon: '<i class="fas fa-check"></i>', label: "Ignorer", callback: () => this.onButtonAction('ignorer') }
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
dialogConf.buttons.refouler = { icon: '<i class="fas fa-check"></i>', label: "Refouler", callback: () => this.onButtonAction('refouler') }
|
|
|
|
}
|
2021-02-05 01:38:40 +01:00
|
|
|
|
2020-11-29 18:21:34 +01:00
|
|
|
const dialogOptions = {
|
|
|
|
classes: ["tmrrencdialog"],
|
2022-11-16 02:46:26 +01:00
|
|
|
width: 320, height: 'fit-content',
|
2021-05-04 12:22:19 +02:00
|
|
|
'z-index': 50
|
2020-11-29 18:21:34 +01:00
|
|
|
}
|
|
|
|
super(dialogConf, dialogOptions);
|
|
|
|
|
|
|
|
this.toClose = false;
|
2022-11-07 00:04:43 +01:00
|
|
|
this.tmr = tmr;
|
2020-11-29 18:21:34 +01:00
|
|
|
this.tmrApp = tmrApp;
|
|
|
|
this.tmrApp.minimize();
|
|
|
|
}
|
2021-02-05 01:38:40 +01:00
|
|
|
|
|
|
|
async onButtonAction(action) {
|
|
|
|
this.toClose = true;
|
2022-11-07 00:04:43 +01:00
|
|
|
this.tmrApp.onActionRencontre(action, this.tmr)
|
2021-02-05 01:38:40 +01:00
|
|
|
}
|
2020-11-29 18:21:34 +01:00
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
close() {
|
2021-02-05 01:38:40 +01:00
|
|
|
if (this.toClose) {
|
2020-11-29 18:21:34 +01:00
|
|
|
this.tmrApp.maximize();
|
|
|
|
return super.close();
|
|
|
|
}
|
|
|
|
ui.notifications.info("Vous devez résoudre la rencontre.");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|