v10/v11 compat

This commit is contained in:
2023-05-25 20:40:59 +02:00
parent e2a9f55740
commit 75a0f7c322
195 changed files with 497 additions and 6 deletions

View File

@ -102,6 +102,7 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */
createPixiSprites() {
console.log("Create sprite")
EffetsDraconiques.carteTmr.createSprite(this.pixiTMR);
this.updateTokens();
this.forceDemiRevePositionView();

View File

@ -3,6 +3,7 @@ import { Draconique } from "./draconique.js";
export class CarteTmr extends Draconique {
constructor() {
console.log("Sprite create 1!!!!")
super();
}
@ -15,6 +16,7 @@ export class CarteTmr extends Draconique {
img() { return 'systems/foundryvtt-reve-de-dragon/styles/img/ui/tmp_main_r1.webp' }
createSprite(pixiTMR) {
console.log("Sprite create!!!!")
return pixiTMR.carteTmr(this.code());
}
}

View File

@ -20,18 +20,24 @@ export class PixiTMR {
this.callbacksOnAnimate = [];
}
load( onLoad = (loader, resources) => {} ) {
let loader = this.pixiApp.loader;
async load( onLoad = (loader, resources) => {} ) {
// WIP è- Deprecated since v7 : let loader = new PIXI.Loader();
for (const [name, img] of Object.entries(PixiTMR.textures)) {
loader = loader.add(name, img);
const texture = await PIXI.Assets.load(img);
let image = PIXI.Sprite.from(texture);
}
loader.onError.add((error, reason) => { console.log("ERROR", error, reason) });
loader.load( (loader, resources) => {
console.log(">>>>>>>>>>>>>< ALL TEXTURE LOADED")
//onLoad(loader, resources); ??
for (let onAnimate of this.callbacksOnAnimate) { //??
onAnimate();
}
//loader.onError.add((error, reason) => { console.log("ERROR", error, reason) });
/*loader.load( (loader, resources) => {
onLoad(loader, resources);
for (let onAnimate of this.callbacksOnAnimate) {
onAnimate();
}
});
});*/
}
static register(name, img) {
@ -44,7 +50,9 @@ export class PixiTMR {
}
carteTmr(code) {
console.log(code)
const carteTmr = new PIXI.Sprite(PIXI.utils.TextureCache[code]);
console.log(code, carteTmr)
// Setup the position of the TMR
carteTmr.x = 0;
carteTmr.y = 0;