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:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user