mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-22 23:50:52 +01:00
#28 - Game2GameDirectoryStatusMessageEvent added
This commit is contained in:
parent
12a8362872
commit
6c785320d3
File diff suppressed because one or more lines are too long
@ -35,6 +35,7 @@ export class IncomingHeader
|
||||
public static GAME_CENTER_ACHIEVEMENTS = 2265;
|
||||
public static GAME_CENTER_GAME_LIST = 222;
|
||||
public static GAME_CENTER_STATUS = 2893;
|
||||
public static GAME_CENTER_DIRECTORY_STATUS = 2246;
|
||||
public static GAMESTATUSMESSAGE = 3805;
|
||||
public static GAMEACHIEVEMENTS = 1689;
|
||||
public static GAMEINVITE = 904;
|
||||
|
@ -0,0 +1,16 @@
|
||||
import { IMessageEvent } from '../../../../../../api';
|
||||
import { MessageEvent } from '../../../../../../events';
|
||||
import { Game2GameDirectoryStatusMessageParser } from '../../../parser';
|
||||
|
||||
export class Game2GameDirectoryStatusMessageEvent extends MessageEvent implements IMessageEvent
|
||||
{
|
||||
constructor(callBack: Function)
|
||||
{
|
||||
super(callBack, Game2GameDirectoryStatusMessageParser);
|
||||
}
|
||||
|
||||
public getParser(): Game2GameDirectoryStatusMessageParser
|
||||
{
|
||||
return this.parser as Game2GameDirectoryStatusMessageParser;
|
||||
}
|
||||
}
|
@ -1 +1,2 @@
|
||||
export * from './Game2AccountGameStatusMessageEvent';
|
||||
export * from './Game2GameDirectoryStatusMessageEvent';
|
||||
|
@ -0,0 +1,61 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '../../../../../../api';
|
||||
|
||||
export class Game2GameDirectoryStatusMessageParser implements IMessageParser
|
||||
{
|
||||
public static readonly STATUS_OK: number = 0;
|
||||
public static readonly STATUS_FAILED_REASON_UNKNOWN: number = 1;
|
||||
public static readonly STATUS_FAILED_REASON_GAME_DIRECTORY_IS_NOT_AVAILABLE: number = 2;
|
||||
public static readonly STATUS_FAILED_REASON_HOTEL_IS_CLOSED: number = 3;
|
||||
|
||||
private _status: number;
|
||||
private _blockLength: number;
|
||||
private _gamesPlayed: number;
|
||||
private _freeGamesLeft: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._status = -1;
|
||||
this._blockLength = -1;
|
||||
this._gamesPlayed = -1;
|
||||
this._freeGamesLeft = -1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._status = wrapper.readInt();
|
||||
this._blockLength = wrapper.readInt();
|
||||
this._gamesPlayed = wrapper.readInt();
|
||||
this._freeGamesLeft = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get status(): number
|
||||
{
|
||||
return this._status;
|
||||
}
|
||||
|
||||
public get blockLength(): number
|
||||
{
|
||||
return this._blockLength;
|
||||
}
|
||||
|
||||
public get gamesPlayed(): number
|
||||
{
|
||||
return this._gamesPlayed;
|
||||
}
|
||||
|
||||
public get freeGamesLeft(): number
|
||||
{
|
||||
return this._freeGamesLeft;
|
||||
}
|
||||
|
||||
public get hasUnlimitedGames(): boolean
|
||||
{
|
||||
return this._freeGamesLeft == -1;
|
||||
}
|
||||
}
|
@ -1 +1,2 @@
|
||||
export * from './Game2AccountGameStatusMessageParser';
|
||||
export * from './Game2GameDirectoryStatusMessageParser';
|
||||
|
Loading…
Reference in New Issue
Block a user