🆙 Removed the generic.asset.url
We have removed the generic.asset.url and all is now in the renderer, so easy to edit and no more wrongly loaded assets
@@ -106,6 +106,16 @@ export class AssetManager implements IAssetManager
|
||||
case 'room':
|
||||
await this.loadLocalRoom();
|
||||
return true;
|
||||
case 'place_holder':
|
||||
case 'place_holder_wall':
|
||||
case 'place_holder_pet':
|
||||
case 'tile_cursor':
|
||||
case 'selection_arrow':
|
||||
case 'avatar_additions':
|
||||
case 'floor_editor':
|
||||
case 'group_badge':
|
||||
await this.loadLocalAsset(key);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -207,6 +217,69 @@ export class AssetManager implements IAssetManager
|
||||
collection.define(roomData);
|
||||
}
|
||||
|
||||
private async loadLocalAsset(name: string): Promise<void>
|
||||
{
|
||||
let dataModule: any;
|
||||
|
||||
switch(name)
|
||||
{
|
||||
case 'place_holder':
|
||||
dataModule = await import('./assets/place_holder/place_holder.asset.json');
|
||||
break;
|
||||
case 'place_holder_wall':
|
||||
dataModule = await import('./assets/place_holder_wall/place_holder_wall.asset.json');
|
||||
break;
|
||||
case 'place_holder_pet':
|
||||
dataModule = await import('./assets/place_holder_pet/place_holder_pet.asset.json');
|
||||
break;
|
||||
case 'tile_cursor':
|
||||
dataModule = await import('./assets/tile_cursor/tile_cursor.asset.json');
|
||||
break;
|
||||
case 'selection_arrow':
|
||||
dataModule = await import('./assets/selection_arrow/selection_arrow.asset.json');
|
||||
break;
|
||||
case 'avatar_additions':
|
||||
dataModule = await import('./assets/avatar_additions/avatar_additions.asset.json');
|
||||
break;
|
||||
case 'floor_editor':
|
||||
dataModule = await import('./assets/floor_editor/floor_editor.asset.json');
|
||||
break;
|
||||
case 'group_badge':
|
||||
dataModule = await import('./assets/group_badge/group_badge.asset.json');
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
const data = (dataModule.default ?? dataModule) as IAssetData;
|
||||
const collection = this.createCollection(data, null) as GraphicAssetCollection;
|
||||
if(!collection) return;
|
||||
|
||||
const allImages = import.meta.glob('./assets/*/images/*.png', { eager: true });
|
||||
const prefix = `./assets/${name}/images/`;
|
||||
|
||||
for(const path in allImages)
|
||||
{
|
||||
if(!path.startsWith(prefix)) continue;
|
||||
|
||||
const mod = allImages[path];
|
||||
const imageUrl = (mod.default ?? mod) as string;
|
||||
|
||||
const file = path.split('/').pop()!;
|
||||
const rawName = file.replace(/\.png$/i, '');
|
||||
|
||||
const texture = await Assets.load<Texture>(imageUrl);
|
||||
if(!texture) continue;
|
||||
|
||||
this.setTexture(rawName, texture);
|
||||
|
||||
collection.textures.set(name + '_' + rawName, texture);
|
||||
collection.textures.set(rawName, texture);
|
||||
}
|
||||
|
||||
collection.define(data);
|
||||
}
|
||||
|
||||
private async processAsset(texture: Texture, data: IAssetData): Promise<IGraphicAssetCollection>
|
||||
{
|
||||
let spritesheet: Spritesheet<SpritesheetData> = null;
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"type": "avatar_additions",
|
||||
"name": "avatar_additions"
|
||||
}
|
||||
|
After Width: | Height: | Size: 667 B |
|
After Width: | Height: | Size: 831 B |
|
After Width: | Height: | Size: 761 B |
|
After Width: | Height: | Size: 721 B |
|
After Width: | Height: | Size: 764 B |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 200 B |
|
After Width: | Height: | Size: 540 B |
|
After Width: | Height: | Size: 1007 B |
|
After Width: | Height: | Size: 195 B |
|
After Width: | Height: | Size: 184 B |
|
After Width: | Height: | Size: 191 B |
|
After Width: | Height: | Size: 177 B |
|
After Width: | Height: | Size: 332 B |
|
After Width: | Height: | Size: 317 B |
|
After Width: | Height: | Size: 205 B |
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"type": "floor_editor",
|
||||
"name": "floor_editor"
|
||||
}
|
||||
|
After Width: | Height: | Size: 193 B |
|
After Width: | Height: | Size: 191 B |
|
After Width: | Height: | Size: 191 B |
|
After Width: | Height: | Size: 191 B |
|
After Width: | Height: | Size: 192 B |
|
After Width: | Height: | Size: 191 B |
|
After Width: | Height: | Size: 191 B |
|
After Width: | Height: | Size: 191 B |
|
After Width: | Height: | Size: 193 B |
|
After Width: | Height: | Size: 190 B |
|
After Width: | Height: | Size: 190 B |
|
After Width: | Height: | Size: 189 B |
|
After Width: | Height: | Size: 189 B |
|
After Width: | Height: | Size: 191 B |
|
After Width: | Height: | Size: 189 B |
|
After Width: | Height: | Size: 189 B |
|
After Width: | Height: | Size: 189 B |
|
After Width: | Height: | Size: 194 B |
|
After Width: | Height: | Size: 191 B |
|
After Width: | Height: | Size: 190 B |
|
After Width: | Height: | Size: 187 B |
|
After Width: | Height: | Size: 189 B |
|
After Width: | Height: | Size: 189 B |
|
After Width: | Height: | Size: 189 B |
|
After Width: | Height: | Size: 190 B |
|
After Width: | Height: | Size: 189 B |
|
After Width: | Height: | Size: 189 B |
|
After Width: | Height: | Size: 197 B |
|
After Width: | Height: | Size: 186 B |
|
After Width: | Height: | Size: 189 B |
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"type": "group_badge",
|
||||
"name": "group_badge"
|
||||
}
|
||||
|
After Width: | Height: | Size: 543 B |
|
After Width: | Height: | Size: 517 B |
|
After Width: | Height: | Size: 592 B |
|
After Width: | Height: | Size: 722 B |
|
After Width: | Height: | Size: 408 B |
|
After Width: | Height: | Size: 441 B |
|
After Width: | Height: | Size: 397 B |
|
After Width: | Height: | Size: 352 B |
|
After Width: | Height: | Size: 534 B |
|
After Width: | Height: | Size: 151 B |
|
After Width: | Height: | Size: 700 B |
|
After Width: | Height: | Size: 639 B |
|
After Width: | Height: | Size: 372 B |
|
After Width: | Height: | Size: 484 B |
|
After Width: | Height: | Size: 845 B |
|
After Width: | Height: | Size: 467 B |
|
After Width: | Height: | Size: 363 B |
|
After Width: | Height: | Size: 602 B |
|
After Width: | Height: | Size: 193 B |
|
After Width: | Height: | Size: 402 B |
|
After Width: | Height: | Size: 391 B |
|
After Width: | Height: | Size: 469 B |
|
After Width: | Height: | Size: 274 B |
|
After Width: | Height: | Size: 314 B |
|
After Width: | Height: | Size: 846 B |
|
After Width: | Height: | Size: 248 B |
|
After Width: | Height: | Size: 713 B |
|
After Width: | Height: | Size: 303 B |
|
After Width: | Height: | Size: 411 B |
|
After Width: | Height: | Size: 114 B |
|
After Width: | Height: | Size: 485 B |
|
After Width: | Height: | Size: 439 B |
|
After Width: | Height: | Size: 408 B |
|
After Width: | Height: | Size: 488 B |
|
After Width: | Height: | Size: 210 B |
|
After Width: | Height: | Size: 558 B |
|
After Width: | Height: | Size: 820 B |
|
After Width: | Height: | Size: 86 B |
|
After Width: | Height: | Size: 159 B |
|
After Width: | Height: | Size: 145 B |
|
After Width: | Height: | Size: 161 B |
|
After Width: | Height: | Size: 177 B |
|
After Width: | Height: | Size: 166 B |
|
After Width: | Height: | Size: 157 B |
|
After Width: | Height: | Size: 160 B |
|
After Width: | Height: | Size: 145 B |
|
After Width: | Height: | Size: 161 B |
|
After Width: | Height: | Size: 165 B |
|
After Width: | Height: | Size: 195 B |
|
After Width: | Height: | Size: 255 B |