11.2.17 - Le cache-oeil d'Akarlikarlikar #695
@ -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)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user