Added a real app fo helper/info button (dialog before)

This commit is contained in:
Vlyan
2021-01-05 12:29:13 +01:00
parent 1a292feee2
commit 29b21b7d1c
6 changed files with 95 additions and 67 deletions

View File

@@ -40,14 +40,14 @@
"title": "Need help?", "title": "Need help?",
"content": "Follow the guide :", "content": "Follow the guide :",
"edge": "Go to the Edge-Studio website", "edge": "Go to the Edge-Studio website",
"drive": "Buy a PDF of the game...", "drivethrurpg": "Buy a PDF of the game...",
"discord": "FoundryVTT Official Discord", "discord": "FoundryVTT Official Discord",
"src": "systems/l5r5e/assets/l5r-logo.webp", "src": "systems/l5r5e/assets/l5r-logo.webp",
"alt": "Online Help", "alt": "Online Help",
"edge-info": "your browser will open the EDGE STUDIO website", "edge-info": "your browser will open the EDGE STUDIO website",
"edge-link": "https://edge-studio.net/", "edge-link": "https://edge-studio.net/",
"drive-info": "your browser will open the DriveThruRpg site of Edge Studio", "drivethrurpg-info": "your browser will open the DriveThruRpg site of Edge Studio",
"drive-link": "https://www.drivethrurpg.com/browse/pub/17946/EDGE-Studio", "drivethrurpg-link": "https://www.drivethrurpg.com/browse/pub/17946/EDGE-Studio",
"discord-info": "Your browser will open on the official Foundry discord", "discord-info": "Your browser will open on the official Foundry discord",
"discord-link": "https://discordapp.com/invite/DDBZUDf" "discord-link": "https://discordapp.com/invite/DDBZUDf"
}, },

View File

@@ -40,14 +40,14 @@
"títle": "¿Necesitas ayuda?", "títle": "¿Necesitas ayuda?",
"content": "Sigue la guía :", "content": "Sigue la guía :",
"edge": "Ir a la página web de Edge-Studio", "edge": "Ir a la página web de Edge-Studio",
"drive": "¿Comprar un PDF del juego?", "drivethrurpg": "¿Comprar un PDF del juego?",
"discord": "Discordia oficial de FoundryVTT", "discord": "Discordia oficial de FoundryVTT",
"src": "systems/l5r5e/assets/l5r-logo.webp", "src": "systems/l5r5e/assets/l5r-logo.webp",
"alt": "Ayuda en línea", "alt": "Ayuda en línea",
"edge-info": "tu navegador abrirá la página web de EDGE STUDIO", "edge-info": "Tu navegador abrirá la página web de EDGE STUDIO",
"edge-link": "https://edge-studio.net/", "edge-link": "https://edge-studio.net/",
"drive-info": "tu navegador abrirá el sitio DriveThruRpg de Edge Studio", "drivethrurpg-info": "tu navegador abrirá el sitio DriveThruRpg de Edge Studio",
"drive-link": "https://www.drivethrurpg.com/browse/pub/17946/EDGE-Studio", "drivethrurpg-link": "https://www.drivethrurpg.com/browse/pub/17946/EDGE-Studio",
"discord-info": "Su navegador se abrirá a la discordia oficial de la Fundición", "discord-info": "Su navegador se abrirá a la discordia oficial de la Fundición",
"discord-link": "https://discordapp.com/invite/DDBZUDf" "discord-link": "https://discordapp.com/invite/DDBZUDf"
}, },

View File

@@ -40,14 +40,14 @@
"title": "Besoin d'aide ?", "title": "Besoin d'aide ?",
"content": "Suivez le guide :", "content": "Suivez le guide :",
"edge": "Accéder au site de Edge Studio.", "edge": "Accéder au site de Edge Studio.",
"drive": "Acheter un PDF du jeu ?", "drivethrurpg": "Acheter un PDF du jeu ?",
"discord": "rejoignez le Discord Francophone", "discord": "Rejoignez le Discord Francophone",
"src": "systems/l5r5e/assets/l5r-logo.webp", "src": "systems/l5r5e/assets/l5r-logo.webp",
"alt": "Aide en Ligne", "alt": "Aide en Ligne",
"edge-info": "Votre navigateur va ouvrir le site de Edge Studio.", "edge-info": "Votre navigateur va ouvrir le site de Edge Studio.",
"edge-link": "https://edge-studio.net/", "edge-link": "https://edge-studio.net/",
"drive-info": "Votre navigateur va ouvrir le site DriveThruRpg de Edge Studio.", "drivethrurpg-info": "Votre navigateur va ouvrir le site DriveThruRpg de Edge Studio.",
"drive-link": "https://www.drivethrurpg.com/browse/pub/17946/EDGE-Studio", "drivethrurpg-link": "https://www.drivethrurpg.com/browse/pub/17946/EDGE-Studio",
"discord-info": "Votre navigateur va ouvrir le discord francophone de foundry.", "discord-info": "Votre navigateur va ouvrir le discord francophone de foundry.",
"discord-link": "https://discord.gg/pPSDNJk" "discord-link": "https://discord.gg/pPSDNJk"
}, },

View File

@@ -0,0 +1,66 @@
/**
* L5R Help dialog
* @extends {FormApplication}
*/
export class HelpDialog extends FormApplication {
/**
* Payload Object
*/
object = {};
/**
* Assign the default options
* @override
*/
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
id: "l5r5e-help-dialog",
classes: ["l5r5e", "help-dialog"],
template: CONFIG.l5r5e.paths.templates + "help/help-dialog.html",
title: game.i18n.localize("l5r5e.logo.title"),
width: 400,
height: 200,
closeOnSubmit: false,
submitOnClose: false,
submitOnChange: false,
});
}
/**
* Construct and return the data object used to render the HTML template for this form application.
* @param options
* @return {Object}
*/
getData(options = null) {
return {
...super.getData(options),
};
}
/**
* Listen to html elements
* @override
*/
activateListeners(html) {
super.activateListeners(html);
// Buttons
["edge", "drivethrurpg", "discord"].forEach((name) => {
html.find(`button[name='${name}']`).on("click", (event) => {
ui.notifications.info(game.i18n.localize(`l5r5e.logo.${name}-info`));
window.open(game.i18n.localize(`l5r5e.logo.${name}-link`), "_blank");
});
});
}
/**
* This method is called upon form submission after form data is validated
* @param event {Event} The initial triggering submission event
* @param formData {Object} The object of validated form data with which to update the object
* @returns {Promise} A Promise which resolves once the update operation has completed
* @override
*/
_updateObject(event, formData) {
// Nothing, but needed to be override
}
}

View File

@@ -3,6 +3,7 @@ import { L5R5E } from "./config.js";
import { HelpersL5r5e } from "./helpers.js"; import { HelpersL5r5e } from "./helpers.js";
import { RegisterSettings } from "./settings.js"; import { RegisterSettings } from "./settings.js";
import { PreloadTemplates } from "./preloadTemplates.js"; import { PreloadTemplates } from "./preloadTemplates.js";
import { HelpDialog } from "./help/help-dialog.js";
// Actors // Actors
import { ActorL5r5e } from "./actor.js"; import { ActorL5r5e } from "./actor.js";
import { CharacterSheetL5r5e } from "./actors/character-sheet.js"; import { CharacterSheetL5r5e } from "./actors/character-sheet.js";
@@ -63,6 +64,7 @@ Hooks.once("init", async function () {
HelpersL5r5e, HelpersL5r5e,
RollL5r5e, RollL5r5e,
DicePickerDialog, DicePickerDialog,
HelpDialog,
}; };
// Register custom system settings // Register custom system settings
@@ -182,16 +184,16 @@ Hooks.once("init", async function () {
// }); // });
/* ------------------------------------ */ /* ------------------------------------ */
/* Actor Dialog */ /* Do anything once the system is ready */
/* ------------------------------------ */
/* ------------------------------------ */
/* When ready */
/* ------------------------------------ */ /* ------------------------------------ */
Hooks.once("ready", function () { Hooks.once("ready", function () {
// Do anything once the system is ready
// Add title on button dice icon // Add title on button dice icon
$(".chat-control-icon")[0].title = game.i18n.localize("l5r5e.chatdices.dicepicker"); $(".chat-control-icon")[0].title = game.i18n.localize("l5r5e.chatdices.dicepicker");
// Open Help dialog on clic on logo
$("#logo")
.on("click", () => new game.l5r5e.HelpDialog().render(true))
.prop("title", game.i18n.localize("l5r5e.logo.alt"));
}); });
/* ------------------------------------ */ /* ------------------------------------ */
@@ -259,53 +261,3 @@ Hooks.once("diceSoNiceReady", (dice3d) => {
"d12" "d12"
); );
}); });
// Logo & Menu options
Hooks.once("ready", async function () {
// -- Function Open Edge-Studio Website
function openEdge() {
ui.notifications.info(game.i18n.localize("l5r5e.logo.edge-info"));
var windowObjectReference = window.open(game.i18n.localize("l5r5e.logo.edge-link"), "_blank");
}
// -- Open Function Edge's DriveThruRpg
function openDrive() {
ui.notifications.info(game.i18n.localize("l5r5e.logo.drive-info"));
var windowObjectReference = window.open(game.i18n.localize("l5r5e.logo.drive-link"), "_blank");
}
// -- Open Function Discord Link
function openDiscord() {
ui.notifications.info(game.i18n.localize("l5r5e.logo.discord-info"));
var windowObjectReference = window.open(game.i18n.localize("l5r5e.logo.discord-link"), "_blank");
}
//-- Logo Menu Link
let liensExt = new Dialog({
title: game.i18n.localize("l5r5e.logo.title"),
content: "<p>" + game.i18n.localize("l5r5e.logo.content") + "</p>",
buttons: {
one: {
icon: '<i class="fas fa-check"></i>',
label: game.i18n.localize("l5r5e.logo.edge"),
callback: () => openEdge(),
},
two: {
icon: '<i class="fas fa-check"></i>',
label: game.i18n.localize("l5r5e.logo.drive"),
callback: () => openDrive(),
},
three: {
icon: '<i class="fas fa-check"></i>',
label: game.i18n.localize("l5r5e.logo.discord"),
callback: () => openDiscord(),
},
},
});
//-- Logo
var logo = document.getElementById("logo");
//-- Open menu on Logo click
logo.setAttribute("title", game.i18n.localize("l5r5e.logo.alt"));
logo.addEventListener("click", function () {
liensExt.render(true);
});
});

View File

@@ -0,0 +1,10 @@
<form class="l5r5e help-dialog" autocomplete="off">
<p>{{localize 'l5r5e.logo.content'}}</p>
<button name="edge"><i class="fas fa-check"></i> {{localize 'l5r5e.logo.edge'}}</button>
<button name="drivethrurpg"><i class="fas fa-check"></i> {{localize 'l5r5e.logo.drivethrurpg'}}</button>
<button name="discord"><i class="fas fa-check"></i> {{localize 'l5r5e.logo.discord'}}</button>
</form>