FEATURE: editing a room in the admin trigger a refresh system
This commit is contained in:
parent
8529037493
commit
88cc15cd02
12 changed files with 148 additions and 118 deletions
|
@ -13,21 +13,22 @@ export enum GameRoomPolicyTypes {
|
|||
|
||||
export class PusherRoom {
|
||||
private readonly positionNotifier: PositionDispatcher;
|
||||
public readonly anonymous: boolean;
|
||||
public readonly public: boolean;
|
||||
public tags: string[];
|
||||
public policyType: GameRoomPolicyTypes;
|
||||
public readonly roomSlug: string;
|
||||
public readonly worldSlug: string = '';
|
||||
public readonly organizationSlug: string = '';
|
||||
private versionNumber: number = 1;
|
||||
|
||||
constructor(public readonly roomId: string,
|
||||
private socketListener: ZoneEventListener)
|
||||
{
|
||||
this.anonymous = isRoomAnonymous(roomId);
|
||||
this.public = isRoomAnonymous(roomId);
|
||||
this.tags = [];
|
||||
this.policyType = GameRoomPolicyTypes.ANONYMUS_POLICY;
|
||||
|
||||
if (this.anonymous) {
|
||||
if (this.public) {
|
||||
this.roomSlug = extractRoomSlugPublicRoomId(this.roomId);
|
||||
} else {
|
||||
const {organizationSlug, worldSlug, roomSlug} = extractDataFromPrivateRoomId(this.roomId);
|
||||
|
@ -55,4 +56,13 @@ export class PusherRoom {
|
|||
public isEmpty(): boolean {
|
||||
return this.positionNotifier.isEmpty();
|
||||
}
|
||||
|
||||
public needsUpdate(versionNumber: number): boolean {
|
||||
if (this.versionNumber < versionNumber) {
|
||||
this.versionNumber = versionNumber;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue