diff --git a/src/core/utils/proxy/NitroSprite.ts b/src/core/utils/proxy/NitroSprite.ts index 9d33af5a..8268d1c0 100644 --- a/src/core/utils/proxy/NitroSprite.ts +++ b/src/core/utils/proxy/NitroSprite.ts @@ -2,5 +2,4 @@ import { Sprite as SpriteBase } from '@pixi/sprite'; export class NitroSprite extends SpriteBase { - public name: string; } diff --git a/src/nitro/Plugins.ts b/src/nitro/Plugins.ts index ef2a7efd..a630cc61 100644 --- a/src/nitro/Plugins.ts +++ b/src/nitro/Plugins.ts @@ -5,6 +5,7 @@ import { BatchRenderer, Renderer } from '@pixi/core'; import { Extract } from '@pixi/extract'; import { InteractionManager } from '@pixi/interaction'; import { AppLoaderPlugin, Loader } from '@pixi/loaders'; +import '@pixi/mixin-get-child-by-name'; import { ParticleRenderer } from '@pixi/particle-container'; import { Prepare } from '@pixi/prepare'; import { TilingSpriteRenderer } from '@pixi/sprite-tiling'; diff --git a/src/nitro/communication/messages/outgoing/camera/RenderRoomMessageComposer.ts b/src/nitro/communication/messages/outgoing/camera/RenderRoomMessageComposer.ts index ae130f61..14bbc2aa 100644 --- a/src/nitro/communication/messages/outgoing/camera/RenderRoomMessageComposer.ts +++ b/src/nitro/communication/messages/outgoing/camera/RenderRoomMessageComposer.ts @@ -32,4 +32,12 @@ export class RenderRoomMessageComposer implements IMessageComposer c.charCodeAt(0)); + + this._data.push(binaryData.byteLength, binaryData.buffer); + } } diff --git a/src/nitro/room/IRoomEngine.ts b/src/nitro/room/IRoomEngine.ts index 35d8946f..c0e6ab99 100644 --- a/src/nitro/room/IRoomEngine.ts +++ b/src/nitro/room/IRoomEngine.ts @@ -93,7 +93,8 @@ export interface IRoomEngine extends INitroManager 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; createTextureFromRoom(roomId: number, canvasId?: number, bounds?: Rectangle): RenderTexture; - saveTextureAsScreenshot(texture: RenderTexture, saveAsThumbnail?: boolean): void + saveTextureAsScreenshot(texture: RenderTexture, saveAsThumbnail?: boolean): void; + saveBase64AsScreenshot(base64: string, saveAsThumbnail?: boolean): void; modifyRoomObjectData(objectId: number, objectCategory: number, colorHex: string, text: string): boolean; deleteRoomObject(objectId: number, objectCategory: number): boolean; sessionDataManager: ISessionDataManager; diff --git a/src/nitro/room/RoomEngine.ts b/src/nitro/room/RoomEngine.ts index 9d9425aa..f56b1111 100644 --- a/src/nitro/room/RoomEngine.ts +++ b/src/nitro/room/RoomEngine.ts @@ -3316,21 +3316,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato if(!displayObject) return null; - let index = (displayObject.children.length - 1); - - while(index >= 0) - { - const child = (displayObject.getChildAt(index) as NitroSprite); - - if(child) - { - if(child.name === RoomEngine.OVERLAY) return child; - } - - index--; - } - - return null; + return ((displayObject.getChildByName(RoomEngine.OVERLAY) as NitroSprite) || null); } private removeOverlayIconSprite(k: NitroSprite, _arg_2: string): boolean @@ -3502,6 +3488,18 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato this._communication.connection.send(composer); } + public saveBase64AsScreenshot(base64: string, saveAsThumbnail: boolean = false): void + { + let composer: RenderRoomMessageComposer = null; + + if(saveAsThumbnail) composer = new RenderRoomThumbnailMessageComposer(); + else composer = new RenderRoomMessageComposer(); + + composer.assignBase64(base64); + + this._communication.connection.send(composer); + } + public objectsInitialized(k: string): void { const roomId = this.getRoomIdFromString(k);