mirror of
https://github.com/duckietm/Nitro-Cool-UI-Renderer.git
synced 2025-06-21 15:06:58 +00:00
📷 Fully working Photo now in rooms
This commit is contained in:
parent
ea4b7bfb97
commit
feda0b3e3a
@ -1,6 +1,6 @@
|
|||||||
import { IGraphicAsset } from '@nitrots/api';
|
import { IGraphicAsset } from '@nitrots/api';
|
||||||
import { GetRenderer, TextureUtils } from '@nitrots/utils';
|
import { GetRenderer, TextureUtils } from '@nitrots/utils';
|
||||||
import { Matrix, Sprite, Texture, RenderTexture } from 'pixi.js';
|
import { Matrix, Sprite, Texture, RenderTexture, Graphics } from 'pixi.js';
|
||||||
import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization';
|
import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization';
|
||||||
|
|
||||||
export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualization {
|
export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualization {
|
||||||
@ -11,7 +11,8 @@ export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualiza
|
|||||||
private _thumbnailDirection: number;
|
private _thumbnailDirection: number;
|
||||||
private _thumbnailChanged: boolean;
|
private _thumbnailChanged: boolean;
|
||||||
private _uniqueId: string;
|
private _uniqueId: string;
|
||||||
private _photoUrl: string; // Store the photo URL or ID
|
private _photoUrl: string;
|
||||||
|
protected _hasOutline: boolean;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@ -22,6 +23,7 @@ export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualiza
|
|||||||
this._thumbnailChanged = false;
|
this._thumbnailChanged = false;
|
||||||
this._uniqueId = `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
this._uniqueId = `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
||||||
this._photoUrl = null;
|
this._photoUrl = null;
|
||||||
|
this._hasOutline = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get hasThumbnailImage(): boolean {
|
public get hasThumbnailImage(): boolean {
|
||||||
@ -30,12 +32,13 @@ export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualiza
|
|||||||
|
|
||||||
public setThumbnailImages(k: Texture, url?: string): void {
|
public setThumbnailImages(k: Texture, url?: string): void {
|
||||||
this._thumbnailImageNormal = k;
|
this._thumbnailImageNormal = k;
|
||||||
this._photoUrl = url || null; // Store the URL or ID passed with the texture
|
this._photoUrl = url || null;
|
||||||
|
console.log("Set thumbnail - texture:", k, "url:", this._photoUrl);
|
||||||
this._thumbnailChanged = true;
|
this._thumbnailChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getPhotoUrl(): string {
|
public getPhotoUrl(): string {
|
||||||
return this._photoUrl; // Expose the URL for the click handler
|
return this._photoUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected updateModel(scale: number): boolean {
|
protected updateModel(scale: number): boolean {
|
||||||
@ -130,8 +133,14 @@ export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualiza
|
|||||||
|
|
||||||
const width = 64;
|
const width = 64;
|
||||||
const height = 64;
|
const height = 64;
|
||||||
|
|
||||||
|
const container = new Sprite();
|
||||||
|
|
||||||
|
sprite.position.set((width - sprite.width) / 2 + 2, (height - sprite.height) / 2 + 2);
|
||||||
|
container.addChild(sprite);
|
||||||
|
|
||||||
const renderTexture = RenderTexture.create({ width, height, resolution: 1 });
|
const renderTexture = RenderTexture.create({ width, height, resolution: 1 });
|
||||||
GetRenderer().render({ container: sprite, target: renderTexture });
|
GetRenderer().render({ container, target: renderTexture, clear: true });
|
||||||
|
|
||||||
return renderTexture;
|
return renderTexture;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user