11.2.17 - Le cache-oeil d'Akarlikarlikar #695
@ -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