mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-01-18 22:36:27 +01:00
Fix ad url
This commit is contained in:
parent
e36a906d89
commit
03fbeabbd5
@ -1,4 +1,4 @@
|
||||
import { DisplayObject, Point, Rectangle } from 'pixi.js';
|
||||
import { DisplayObject, Point, Rectangle, RenderTexture } from 'pixi.js';
|
||||
import { INitroManager } from '../../core/common/INitroManager';
|
||||
import { IRoomObject } from '../../room';
|
||||
import { IRoomManager } from '../../room/IRoomManager';
|
||||
@ -90,7 +90,8 @@ export interface IRoomEngine extends INitroManager
|
||||
processRoomObjectOperation(objectId: number, category: number, operation: string): boolean;
|
||||
processRoomObjectPlacement(placementSource: string, id: number, category: number, typeId: number, legacyString?: string, stuffData?: IObjectData, state?: number, frameNumber?: number, posture?: string): boolean;
|
||||
dispatchMouseEvent(canvasId: number, x: number, y: number, type: string, altKey: boolean, ctrlKey: boolean, shiftKey: boolean, buttonDown: boolean): void;
|
||||
createRoomScreenshot(roomId: number, canvasId?: number, bounds?: Rectangle, sendToServer?: boolean, asThumbnail?: boolean): HTMLImageElement;
|
||||
createTextureFromRoom(roomId: number, canvasId?: number, bounds?: Rectangle): RenderTexture;
|
||||
saveTextureAsScreenshot(texture: RenderTexture, saveAsThumbnail?: boolean): void
|
||||
modifyRoomObjectData(objectId: number, objectCategory: number, colorHex: string, text: string): boolean;
|
||||
deleteRoomObject(objectId: number, objectCategory: number): boolean;
|
||||
sessionDataManager: ISessionDataManager;
|
||||
|
@ -253,6 +253,15 @@ export class RoomContentLoader implements IFurnitureDataListener
|
||||
return name.substr(0, index);
|
||||
}
|
||||
|
||||
public getRoomObjectAdUrl(type: string): string
|
||||
{
|
||||
const value = this._objectTypeAdUrls.get(type);
|
||||
|
||||
if(!value) return '';
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public getPetColorResult(petIndex: number, paletteIndex: number): PetColorResult
|
||||
{
|
||||
const colorResults = this._petColors.get(petIndex);
|
||||
|
@ -1049,6 +1049,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FURNITURE_COLOR, this.getFurnitureFloorColorIndex(data.typeId));
|
||||
model.setValue(RoomObjectVariable.FURNITURE_TYPE_ID, data.typeId);
|
||||
model.setValue(RoomObjectVariable.FURNITURE_AD_URL, this.getRoomObjectAdUrl(data.type));
|
||||
model.setValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT, (data.realRoomObject ? 1 : 0));
|
||||
model.setValue(RoomObjectVariable.FURNITURE_EXPIRY_TIME, data.expiryTime);
|
||||
model.setValue(RoomObjectVariable.FURNITURE_EXPIRTY_TIMESTAMP, Nitro.instance.time);
|
||||
@ -1107,6 +1108,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FURNITURE_COLOR, this.getFurnitureWallColorIndex(data.typeId));
|
||||
model.setValue(RoomObjectVariable.FURNITURE_TYPE_ID, data.typeId);
|
||||
model.setValue(RoomObjectVariable.FURNITURE_AD_URL, this.getRoomObjectAdUrl(data.type));
|
||||
model.setValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT, (data.realRoomObject ? 1 : 0));
|
||||
model.setValue(RoomObjectVariable.OBJECT_ACCURATE_Z_VALUE, 1);
|
||||
model.setValue(RoomObjectVariable.FURNITURE_EXPIRY_TIME, data.expiryTime);
|
||||
@ -3448,7 +3450,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
|
||||
return null;
|
||||
}
|
||||
|
||||
public createRoomScreenshot(roomId: number, canvasId: number = -1, bounds: Rectangle = null, sendToServer: boolean = false, asThumbnail: boolean = false): HTMLImageElement
|
||||
public createTextureFromRoom(roomId: number, canvasId: number = -1, bounds: Rectangle = null): RenderTexture
|
||||
{
|
||||
let canvas: IRoomRenderingCanvas = null;
|
||||
|
||||
@ -3472,27 +3474,19 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
|
||||
texture = canvas.getDisplayAsTexture();
|
||||
}
|
||||
|
||||
if(sendToServer)
|
||||
{
|
||||
let composer: RenderRoomMessageComposer = null;
|
||||
return texture;
|
||||
}
|
||||
|
||||
if(asThumbnail) composer = new RenderRoomThumbnailMessageComposer();
|
||||
else composer = new RenderRoomMessageComposer();
|
||||
public saveTextureAsScreenshot(texture: RenderTexture, saveAsThumbnail: boolean = false): void
|
||||
{
|
||||
let composer: RenderRoomMessageComposer = null;
|
||||
|
||||
composer.assignBitmap(texture);
|
||||
if(saveAsThumbnail) composer = new RenderRoomThumbnailMessageComposer();
|
||||
else composer = new RenderRoomMessageComposer();
|
||||
|
||||
this._communication.connection.send(composer);
|
||||
}
|
||||
composer.assignBitmap(texture);
|
||||
|
||||
const base64 = TextureUtils.generateImageUrl(texture);
|
||||
const image = new Image();
|
||||
|
||||
image.src = base64;
|
||||
|
||||
/*const newWindow = window.open('');
|
||||
newWindow.document.write(image.outerHTML);*/
|
||||
|
||||
return image;
|
||||
this._communication.connection.send(composer);
|
||||
}
|
||||
|
||||
public objectsInitialized(k: string): void
|
||||
@ -3525,6 +3519,11 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
|
||||
return (object.model.getValue<string>(RoomObjectVariable.OBJECT_ROOM_ID));
|
||||
}
|
||||
|
||||
private getRoomObjectAdUrl(type: string): string
|
||||
{
|
||||
return this._roomContentLoader.getRoomObjectAdUrl(type);
|
||||
}
|
||||
|
||||
public getPetTypeId(figure: string): number
|
||||
{
|
||||
let type = -1;
|
||||
|
@ -26,6 +26,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization
|
||||
protected _alphaMultiplier: number;
|
||||
protected _alphaChanged: boolean;
|
||||
protected _clickUrl: string;
|
||||
protected _clickHandling: boolean;
|
||||
|
||||
protected _cacheDirection: number;
|
||||
protected _cacheScale: number;
|
||||
@ -60,6 +61,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization
|
||||
this._alphaMultiplier = 1;
|
||||
this._alphaChanged = false;
|
||||
this._clickUrl = null;
|
||||
this._clickHandling = false;
|
||||
|
||||
this._cacheDirection = -1;
|
||||
this._cacheScale = 0;
|
||||
@ -224,6 +226,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization
|
||||
|
||||
this._selectedColor = model.getValue<number>(RoomObjectVariable.FURNITURE_COLOR);
|
||||
this._clickUrl = model.getValue<string>(RoomObjectVariable.FURNITURE_AD_URL);
|
||||
this._clickHandling = ((this._clickUrl && (this._clickUrl !== '') && (this._clickUrl.indexOf('http') === 0)) || false);
|
||||
this._furnitureLift = (model.getValue<number>(RoomObjectVariable.FURNITURE_LIFT_AMOUNT) || 0);
|
||||
|
||||
let alphaMultiplier = model.getValue<number>(RoomObjectVariable.FURNITURE_ALPHA_MULTIPLIER);
|
||||
@ -318,9 +321,9 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization
|
||||
|
||||
sprite.relativeDepth = (relativeDepth * FurnitureVisualization.DEPTH_MULTIPLIER);
|
||||
sprite.name = assetName;
|
||||
sprite.libraryAssetName = this.getLibraryAssetNameForSprite(assetData, sprite);
|
||||
sprite.libraryAssetName = this.getLibraryAssetNameForSprite(assetData, sprite);
|
||||
sprite.posture = this.getPostureForAsset(scale, assetData.source);
|
||||
sprite.clickHandling = false;
|
||||
sprite.clickHandling = this._clickHandling;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -348,11 +351,15 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization
|
||||
if(!sprite) return;
|
||||
|
||||
sprite.texture = null;
|
||||
sprite.libraryAssetName = '';
|
||||
sprite.posture = '';
|
||||
sprite.tag = '';
|
||||
sprite.offsetX = 0;
|
||||
sprite.offsetY = 0;
|
||||
sprite.flipH = false;
|
||||
sprite.flipV = false;
|
||||
sprite.relativeDepth = 0;
|
||||
sprite.clickHandling = false;
|
||||
}
|
||||
|
||||
protected getSpriteAssetName(scale: number, layerId: number): string
|
||||
|
Loading…
Reference in New Issue
Block a user