Move to Renderer V2

This commit is contained in:
duckietm
2024-04-03 09:27:56 +02:00
parent 110c3ad393
commit b3134ce50b
4080 changed files with 115593 additions and 66375 deletions
@@ -0,0 +1,60 @@
import { IRoomGeometry, RoomObjectVariable } from '@nitrots/api';
import { FurnitureVisualization } from './FurnitureVisualization';
export class FurnitureGiftWrappedVisualization extends FurnitureVisualization
{
private _packetType: number = 0;
private _ribbonType: number = 0;
public update(geometry: IRoomGeometry, time: number, update: boolean, skipUpdate: boolean): void
{
this.updatePresentWrap();
super.update(geometry, time, update, skipUpdate);
}
private updatePresentWrap(): void
{
if(!this.object) return;
const extras = this.object.model.getValue<string>(RoomObjectVariable.FURNITURE_EXTRAS);
const local3 = 1000;
const typeIndex = parseInt(extras);
this._packetType = Math.floor((typeIndex / local3));
this._ribbonType = (typeIndex % local3);
}
public getFrameNumber(scale: number, layerId: number): number
{
if(layerId <= 1) return this._packetType;
return this._ribbonType;
}
public getSpriteAssetName(scale: number, layerId: number): string
{
const size = this.getValidSize(scale);
let assetName = this._type;
let layerCode = '';
if(layerId < (this.spriteCount - 1))
{
layerCode = String.fromCharCode(('a'.charCodeAt(0) + layerId));
}
else
{
layerCode = 'sd';
}
const frameNumber = this.getFrameNumber(scale, layerId);
assetName = (assetName + ((((('_' + size) + '_') + layerCode) + '_') + this.direction));
assetName = (assetName + ('_' + frameNumber));
return assetName;
}
}