You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-20 07:26:18 +00:00
40 lines
927 B
TypeScript
40 lines
927 B
TypeScript
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
|
|
|
export class QuestionFinishedParser implements IMessageParser
|
|
{
|
|
private _questionId: number;
|
|
private _answerCounts: Map<string, number>;
|
|
|
|
flush(): boolean
|
|
{
|
|
this._questionId = -1;
|
|
this._answerCounts = null;
|
|
return true;
|
|
}
|
|
|
|
parse(wrapper: IMessageDataWrapper): boolean
|
|
{
|
|
this._questionId = wrapper.readInt();
|
|
this._answerCounts = new Map();
|
|
const count = wrapper.readInt();
|
|
|
|
for(let i = 0; i < count; i++)
|
|
{
|
|
const key = wrapper.readString();
|
|
const value = wrapper.readInt();
|
|
this._answerCounts.set(key, value);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public get questionId(): number
|
|
{
|
|
return this._questionId;
|
|
}
|
|
|
|
public get answerCounts(): Map<string, number>
|
|
{
|
|
return this._answerCounts;
|
|
}
|
|
}
|