11.2.17 - Le cache-oeil d'Akarlikarlikar #695

Merged
uberwald merged 10 commits from VincentVk/foundryvtt-reve-de-dragon:v11 into v11 2024-03-10 08:57:29 +01:00
2 changed files with 7 additions and 8 deletions
Showing only changes of commit 84ea3a6ea9 - Show all commits

View File

@ -44,16 +44,15 @@ export class RdDTMRDialog extends Dialog {
type: Number,
range: TMR_DISPLAY_SIZE.range
})
await PixiTMR.init()
}
static async create(actor, tmrData) {
await PixiTMR.init()
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.html', tmrData);
if (tmrData.mode != 'visu' && !game.user.isGM) {
ChatMessage.create({ content: actor.name + " est monté dans les TMR en mode : " + tmrData.mode, whisper: ChatMessage.getWhisperRecipients("GM") });
}
return new RdDTMRDialog(html, actor, tmrData);
return new RdDTMRDialog(html, actor, tmrData)
}
/* -------------------------------------------- */

View File

@ -1,4 +1,3 @@
import { SYSTEM_RDD } from "../constants.js";
import { Misc } from "../misc.js";
import { TMRConstants, tmrTokenZIndex } from "../tmr-constants.js";
import { TMRUtility } from "../tmr-utility.js";
@ -14,12 +13,12 @@ export class PixiTMR {
static register(name, img) {
PixiTMR.textures[name] = img;
}
static async init() {
await Promise.all(
Object.values(PixiTMR.textures)
.filter(img => img != undefined)
.map(async img => PIXI.Sprite.from(await PIXI.Assets.load(img)))
)
.filter(img => img != undefined && !PIXI.utils.TextureCache[img])
.map(async img => PIXI.Sprite.from(await PIXI.Assets.load(img))))
}
constructor(tmrDialog, displaySize) {
@ -106,8 +105,9 @@ export class PixiTMR {
sprite(code, options = {}) {
let img = PixiTMR.getImgFromCode(code)
const texture = PIXI.utils.TextureCache[img]
let texture = PIXI.utils.TextureCache[img]
if (!texture) {
// TODO: charger la texture
console.error("Texture manquante", code, PIXI.utils.TextureCache)
return;
}