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,44 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class CameraPublishStatusMessageParser implements IMessageParser
{
private _ok: boolean = false;
private _secondsToWait: number = 0;
private _extraDataId: string;
public flush(): boolean
{
this._ok = false;
this._secondsToWait = 0;
this._extraDataId = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._ok = wrapper.readBoolean();
this._secondsToWait = wrapper.readInt();
if(this._ok && wrapper.bytesAvailable) this._extraDataId = wrapper.readString();
return true;
}
public get ok(): boolean
{
return this._ok;
}
public get secondsToWait(): number
{
return this._secondsToWait;
}
public get extraDataId(): string
{
return this._extraDataId;
}
}
@@ -0,0 +1,16 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class CameraPurchaseOKMessageParser implements IMessageParser
{
public flush(): boolean
{
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
return true;
}
}
@@ -0,0 +1,35 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class CameraSnapshotMessageParser implements IMessageParser
{
private _roomType: string;
private _roomId: number;
public flush(): boolean
{
this._roomType = null;
this._roomId = -1;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._roomType = wrapper.readString();
this._roomId = wrapper.readInt();
return true;
}
public get roomType(): string
{
return this._roomType;
}
public get roomId(): number
{
return this._roomId;
}
}
@@ -0,0 +1,27 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class CameraStorageUrlMessageParser implements IMessageParser
{
private _url: string;
public flush(): boolean
{
this._url = '';
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._url = wrapper.readString();
return true;
}
public get url(): string
{
return this._url;
}
}
@@ -0,0 +1,35 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class CompetitionStatusMessageParser implements IMessageParser
{
private _ok: boolean = false;
private _errorReason: string = null;
public flush(): boolean
{
this._ok = false;
this._errorReason = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._ok = wrapper.readBoolean();
this._errorReason = wrapper.readString();
return true;
}
public get ok(): boolean
{
return this._ok;
}
public get errorReason(): string
{
return this._errorReason;
}
}
@@ -0,0 +1,44 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class InitCameraMessageParser implements IMessageParser
{
private _creditPrice: number = 0;
private _ducketPrice: number = 0;
private _publishDucketPrice: number = 0;
public flush(): boolean
{
this._creditPrice = 0;
this._ducketPrice = 0;
this._publishDucketPrice = 0;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._creditPrice = wrapper.readInt();
this._ducketPrice = wrapper.readInt();
if(wrapper.bytesAvailable) this._publishDucketPrice = wrapper.readInt();
return true;
}
public get creditPrice(): number
{
return this._creditPrice;
}
public get ducketPrice(): number
{
return this._ducketPrice;
}
public get publishDucketPrice(): number
{
return this._publishDucketPrice;
}
}
@@ -0,0 +1,37 @@
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
export class ThumbnailStatusMessageParser implements IMessageParser
{
private _ok: boolean = true;
private _renderLimitHit: boolean = false;
public flush(): boolean
{
this._ok = true;
this._renderLimitHit = false;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
if(wrapper.bytesAvailable)
{
this._ok = wrapper.readBoolean();
this._renderLimitHit = wrapper.readBoolean();
}
return true;
}
public get ok(): boolean
{
return this._ok;
}
public get isRenderLimitHit(): boolean
{
return this._renderLimitHit;
}
}
@@ -0,0 +1,7 @@
export * from './CameraPublishStatusMessageParser';
export * from './CameraPurchaseOKMessageParser';
export * from './CameraSnapshotMessageParser';
export * from './CameraStorageUrlMessageParser';
export * from './CompetitionStatusMessageParser';
export * from './InitCameraMessageParser';
export * from './ThumbnailStatusMessageParser';