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
Move to Renderer V2
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { IPollChoice } from '@nitrots/api';
|
||||
|
||||
export class PollChoice implements IPollChoice
|
||||
{
|
||||
private _value: string;
|
||||
private _choiceText: string;
|
||||
private _choiceType: number;
|
||||
|
||||
constructor(value: string, choiceText: string, choiceType: number)
|
||||
{
|
||||
this._value = value;
|
||||
this._choiceText = choiceText;
|
||||
this._choiceType = choiceType;
|
||||
}
|
||||
|
||||
public get value(): string
|
||||
{
|
||||
return this._value;
|
||||
}
|
||||
|
||||
public set value(value: string)
|
||||
{
|
||||
this._value = value;
|
||||
}
|
||||
|
||||
public get choiceText(): string
|
||||
{
|
||||
return this._choiceText;
|
||||
}
|
||||
|
||||
public set choiceText(choiceText: string)
|
||||
{
|
||||
this._choiceText = choiceText;
|
||||
}
|
||||
|
||||
public get choiceType(): number
|
||||
{
|
||||
return this._choiceType;
|
||||
}
|
||||
|
||||
public set choiceType(choiceType: number)
|
||||
{
|
||||
this._choiceType = choiceType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { PollChoice } from './PollChoice';
|
||||
import { PollQuestion } from './PollQuestion';
|
||||
|
||||
export class PollContentsParser implements IMessageParser
|
||||
{
|
||||
private _id = -1;
|
||||
private _startMessage = '';
|
||||
private _endMessage = '';
|
||||
private _numQuestions = 0;
|
||||
private _questionArray: PollQuestion[] = [];
|
||||
private _npsPoll = false;
|
||||
|
||||
flush(): boolean
|
||||
{
|
||||
this._id = -1;
|
||||
this._startMessage = '';
|
||||
this._endMessage = '';
|
||||
this._numQuestions = 0;
|
||||
this._questionArray = [];
|
||||
return true;
|
||||
}
|
||||
|
||||
parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._id = wrapper.readInt();
|
||||
this._startMessage = wrapper.readString();
|
||||
this._endMessage = wrapper.readString();
|
||||
this._numQuestions = wrapper.readInt();
|
||||
|
||||
for(let i = 0; i < this._numQuestions; i++)
|
||||
{
|
||||
const question = this.parsePollQuestion(wrapper);
|
||||
const childrenCount = wrapper.readInt();
|
||||
|
||||
for(let j = 0; j < childrenCount; j++)
|
||||
{
|
||||
question.children.push(this.parsePollQuestion(wrapper));
|
||||
}
|
||||
|
||||
this._questionArray.push(question);
|
||||
}
|
||||
|
||||
this._npsPoll = wrapper.readBoolean();
|
||||
return true;
|
||||
}
|
||||
|
||||
private parsePollQuestion(k: IMessageDataWrapper): PollQuestion
|
||||
{
|
||||
const pollQuestion = new PollQuestion();
|
||||
pollQuestion.questionId = k.readInt();
|
||||
pollQuestion.sortOrder = k.readInt();
|
||||
pollQuestion.questionType = k.readInt();
|
||||
pollQuestion.questionText = k.readString();
|
||||
pollQuestion.questionCategory = k.readInt();
|
||||
pollQuestion.questionAnswerType = k.readInt();
|
||||
pollQuestion.questionAnswerCount = k.readInt();
|
||||
if(((pollQuestion.questionType == 1) || (pollQuestion.questionType == 2)))
|
||||
{
|
||||
for(let i = 0; i < pollQuestion.questionAnswerCount; i++)
|
||||
{
|
||||
pollQuestion.questionChoices.push(new PollChoice(k.readString(), k.readString(), k.readInt()));
|
||||
}
|
||||
}
|
||||
return pollQuestion;
|
||||
}
|
||||
|
||||
public get id(): number
|
||||
{
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public get startMessage(): string
|
||||
{
|
||||
return this._startMessage;
|
||||
}
|
||||
|
||||
public get endMessage(): string
|
||||
{
|
||||
return this._endMessage;
|
||||
}
|
||||
|
||||
public get numQuestions(): number
|
||||
{
|
||||
return this._numQuestions;
|
||||
}
|
||||
|
||||
public get questionArray(): PollQuestion[]
|
||||
{
|
||||
return this._questionArray;
|
||||
}
|
||||
|
||||
public get npsPoll(): boolean
|
||||
{
|
||||
return this._npsPoll;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class PollErrorParser implements IMessageParser
|
||||
{
|
||||
flush(): boolean
|
||||
{
|
||||
throw true;
|
||||
}
|
||||
|
||||
parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class PollOfferParser implements IMessageParser
|
||||
{
|
||||
private _id = -1;
|
||||
private _type = '';
|
||||
private _headline = '';
|
||||
private _summary = '';
|
||||
|
||||
flush(): boolean
|
||||
{
|
||||
this._id = -1;
|
||||
this._type = '';
|
||||
this._summary = '';
|
||||
return true;
|
||||
}
|
||||
|
||||
parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._id = wrapper.readInt();
|
||||
this._type = wrapper.readString();
|
||||
this._headline = wrapper.readString();
|
||||
this._summary = wrapper.readString();
|
||||
return true;
|
||||
}
|
||||
|
||||
public get id(): number
|
||||
{
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public get type(): string
|
||||
{
|
||||
return this._type;
|
||||
}
|
||||
|
||||
public get headline(): string
|
||||
{
|
||||
return this._headline;
|
||||
}
|
||||
|
||||
public get summary(): string
|
||||
{
|
||||
return this._summary;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
import { IPollQuestion } from '@nitrots/api';
|
||||
import { PollChoice } from './PollChoice';
|
||||
|
||||
export class PollQuestion implements IPollQuestion
|
||||
{
|
||||
private _questionId: number;
|
||||
private _questionType: number;
|
||||
private _sortOrder: number;
|
||||
private _questionCategory: number;
|
||||
private _questionText: string;
|
||||
private _questionAnswerType: number;
|
||||
private _questionAnswerCount: number;
|
||||
private _children: PollQuestion[];
|
||||
private _questionChoices: PollChoice[];
|
||||
|
||||
constructor()
|
||||
{
|
||||
this._children = [];
|
||||
this._questionChoices = [];
|
||||
}
|
||||
|
||||
public get questionId(): number
|
||||
{
|
||||
return this._questionId;
|
||||
}
|
||||
|
||||
public set questionId(questionId: number)
|
||||
{
|
||||
this._questionId = questionId;
|
||||
}
|
||||
|
||||
public get questionType(): number
|
||||
{
|
||||
return this._questionType;
|
||||
}
|
||||
|
||||
public set questionType(questionType: number)
|
||||
{
|
||||
this._questionType = questionType;
|
||||
}
|
||||
|
||||
public get sortOrder(): number
|
||||
{
|
||||
return this._sortOrder;
|
||||
}
|
||||
|
||||
public set sortOrder(sortOrder: number)
|
||||
{
|
||||
this._sortOrder = sortOrder;
|
||||
}
|
||||
|
||||
public get questionText(): string
|
||||
{
|
||||
return this._questionText;
|
||||
}
|
||||
|
||||
public set questionText(questionText: string)
|
||||
{
|
||||
this._questionText = questionText;
|
||||
}
|
||||
|
||||
public get questionCategory(): number
|
||||
{
|
||||
return this._questionCategory;
|
||||
}
|
||||
|
||||
public set questionCategory(questionCategory: number)
|
||||
{
|
||||
this._questionCategory = questionCategory;
|
||||
}
|
||||
|
||||
public get questionAnswerType(): number
|
||||
{
|
||||
return this._questionAnswerType;
|
||||
}
|
||||
|
||||
public set questionAnswerType(answerType: number)
|
||||
{
|
||||
this._questionAnswerType = answerType;
|
||||
}
|
||||
|
||||
public get questionAnswerCount(): number
|
||||
{
|
||||
return this._questionAnswerCount;
|
||||
}
|
||||
|
||||
public set questionAnswerCount(k: number)
|
||||
{
|
||||
this._questionAnswerCount = k;
|
||||
}
|
||||
|
||||
public get children(): PollQuestion[]
|
||||
{
|
||||
return this._children;
|
||||
}
|
||||
|
||||
public set children(children: PollQuestion[])
|
||||
{
|
||||
this._children = children;
|
||||
}
|
||||
|
||||
public get questionChoices(): PollChoice[]
|
||||
{
|
||||
return this._questionChoices;
|
||||
}
|
||||
|
||||
public set questionChoices(k: PollChoice[])
|
||||
{
|
||||
this._questionChoices = k;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class QuestionAnsweredParser implements IMessageParser
|
||||
{
|
||||
private _userId: number;
|
||||
private _value: string;
|
||||
private _answerCounts: Map<string, number>;
|
||||
|
||||
flush(): boolean
|
||||
{
|
||||
this._userId = -1;
|
||||
this._value = '';
|
||||
this._answerCounts = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._userId = wrapper.readInt();
|
||||
this._value = wrapper.readString();
|
||||
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 userId(): number
|
||||
{
|
||||
return this._userId;
|
||||
}
|
||||
|
||||
public get value(): string
|
||||
{
|
||||
return this._value;
|
||||
}
|
||||
|
||||
public get answerCounts(): Map<string, number>
|
||||
{
|
||||
return this._answerCounts;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
import { IMessageDataWrapper, IMessageParser, IQuestion } from '@nitrots/api';
|
||||
|
||||
export class QuestionParser implements IMessageParser
|
||||
{
|
||||
private _pollType: string = null;
|
||||
private _pollId = -1;
|
||||
private _questionId = -1;
|
||||
private _duration = -1;
|
||||
private _question: IQuestion = null;
|
||||
|
||||
flush(): boolean
|
||||
{
|
||||
this._pollType = null;
|
||||
this._pollId = -1;
|
||||
this._questionId = -1;
|
||||
this._duration = -1;
|
||||
this._question = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._pollType = wrapper.readString();
|
||||
this._pollId = wrapper.readInt();
|
||||
this._questionId = wrapper.readInt();
|
||||
this._duration = wrapper.readInt();
|
||||
|
||||
const questionId = wrapper.readInt();
|
||||
const questionNumber = wrapper.readInt();
|
||||
const questionType = wrapper.readInt();
|
||||
const questionContent = wrapper.readString();
|
||||
|
||||
this._question = { id: questionId, number: questionNumber, type: questionType, content: questionContent };
|
||||
|
||||
if(((this._question.type == 1) || (this._question.type == 2)))
|
||||
{
|
||||
this._question.selection_min = wrapper.readInt();
|
||||
const count = wrapper.readInt();
|
||||
this._question.selections = [];
|
||||
this._question.selection_values = [];
|
||||
this._question.selection_count = count;
|
||||
this._question.selection_max = count;
|
||||
|
||||
for(let i = 0; i < count; i++)
|
||||
{
|
||||
this._question.selection_values.push(wrapper.readString());
|
||||
this._question.selections.push(wrapper.readString());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public get pollType(): string
|
||||
{
|
||||
return this._pollType;
|
||||
}
|
||||
|
||||
public get pollId(): number
|
||||
{
|
||||
return this._pollId;
|
||||
}
|
||||
|
||||
public get questionId(): number
|
||||
{
|
||||
return this._questionId;
|
||||
}
|
||||
|
||||
public get duration(): number
|
||||
{
|
||||
return this._duration;
|
||||
}
|
||||
|
||||
public get question(): IQuestion
|
||||
{
|
||||
return this._question;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class RoomPollDataParser implements IMessageParser
|
||||
{
|
||||
private _question: string;
|
||||
private _choices: string[];
|
||||
|
||||
flush(): boolean
|
||||
{
|
||||
this._question = null;
|
||||
this._choices = [];
|
||||
return true;
|
||||
}
|
||||
|
||||
parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._question = wrapper.readString();
|
||||
this._choices = [];
|
||||
|
||||
const totalChoices = wrapper.readInt();
|
||||
let total = 0;
|
||||
|
||||
while(total < totalChoices)
|
||||
{
|
||||
this._choices.push(wrapper.readString());
|
||||
total++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get question(): string
|
||||
{
|
||||
return this._question;
|
||||
}
|
||||
|
||||
public get choices(): string[]
|
||||
{
|
||||
return this._choices.slice();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class RoomPollResultParser implements IMessageParser
|
||||
{
|
||||
private _question: string;
|
||||
private _choices: string[];
|
||||
private _SafeStr_7651: any[];
|
||||
private _SafeStr_7654: number;
|
||||
|
||||
flush(): boolean
|
||||
{
|
||||
this._question = null;
|
||||
this._choices = [];
|
||||
this._SafeStr_7651 = [];
|
||||
this._SafeStr_7654 = -1;
|
||||
return true;
|
||||
}
|
||||
|
||||
parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._question = wrapper.readString();
|
||||
|
||||
this._choices = [];
|
||||
this._SafeStr_7651 = [];
|
||||
|
||||
let totalChoices = wrapper.readInt();
|
||||
|
||||
while(totalChoices > 0)
|
||||
{
|
||||
this._choices.push(wrapper.readString());
|
||||
this._SafeStr_7651.push(wrapper.readInt());
|
||||
|
||||
totalChoices--;
|
||||
}
|
||||
this._SafeStr_7654 = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get question(): string
|
||||
{
|
||||
return this._question;
|
||||
}
|
||||
|
||||
public get choices(): string[]
|
||||
{
|
||||
return this._choices;
|
||||
}
|
||||
|
||||
public get SafeStr_7651(): any[]
|
||||
{
|
||||
return this._SafeStr_7651;
|
||||
}
|
||||
|
||||
public get SafeStr_7654(): number
|
||||
{
|
||||
return this._SafeStr_7654;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
export * from './PollChoice';
|
||||
export * from './PollContentsParser';
|
||||
export * from './PollErrorParser';
|
||||
export * from './PollOfferParser';
|
||||
export * from './PollQuestion';
|
||||
export * from './QuestionAnsweredParser';
|
||||
export * from './QuestionFinishedParser';
|
||||
export * from './QuestionParser';
|
||||
export * from './RoomPollResultParser';
|
||||
export * from './RoomPollDataParser';
|
||||
Reference in New Issue
Block a user