Fix: TMR qui ne s'affichent pas
Après un certain temps (changements de scènes?), les TMR ne s'affichaient plus correctement. Tentative de forcer le chargement des textures manquantes lors de l'ouverture de la fenêtre de TMR.
This commit is contained in:
parent
7ada5577aa
commit
84ea3a6ea9
@ -44,16 +44,15 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
type: Number,
|
type: Number,
|
||||||
range: TMR_DISPLAY_SIZE.range
|
range: TMR_DISPLAY_SIZE.range
|
||||||
})
|
})
|
||||||
await PixiTMR.init()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static async create(actor, tmrData) {
|
static async create(actor, tmrData) {
|
||||||
|
await PixiTMR.init()
|
||||||
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.html', tmrData);
|
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.html', tmrData);
|
||||||
|
|
||||||
if (tmrData.mode != 'visu' && !game.user.isGM) {
|
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") });
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { SYSTEM_RDD } from "../constants.js";
|
|
||||||
import { Misc } from "../misc.js";
|
import { Misc } from "../misc.js";
|
||||||
import { TMRConstants, tmrTokenZIndex } from "../tmr-constants.js";
|
import { TMRConstants, tmrTokenZIndex } from "../tmr-constants.js";
|
||||||
import { TMRUtility } from "../tmr-utility.js";
|
import { TMRUtility } from "../tmr-utility.js";
|
||||||
@ -14,12 +13,12 @@ export class PixiTMR {
|
|||||||
static register(name, img) {
|
static register(name, img) {
|
||||||
PixiTMR.textures[name] = img;
|
PixiTMR.textures[name] = img;
|
||||||
}
|
}
|
||||||
|
|
||||||
static async init() {
|
static async init() {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
Object.values(PixiTMR.textures)
|
Object.values(PixiTMR.textures)
|
||||||
.filter(img => img != undefined)
|
.filter(img => img != undefined && !PIXI.utils.TextureCache[img])
|
||||||
.map(async img => PIXI.Sprite.from(await PIXI.Assets.load(img)))
|
.map(async img => PIXI.Sprite.from(await PIXI.Assets.load(img))))
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(tmrDialog, displaySize) {
|
constructor(tmrDialog, displaySize) {
|
||||||
@ -106,8 +105,9 @@ export class PixiTMR {
|
|||||||
|
|
||||||
sprite(code, options = {}) {
|
sprite(code, options = {}) {
|
||||||
let img = PixiTMR.getImgFromCode(code)
|
let img = PixiTMR.getImgFromCode(code)
|
||||||
const texture = PIXI.utils.TextureCache[img]
|
let texture = PIXI.utils.TextureCache[img]
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
|
// TODO: charger la texture
|
||||||
console.error("Texture manquante", code, PIXI.utils.TextureCache)
|
console.error("Texture manquante", code, PIXI.utils.TextureCache)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user