@drincs/pixi-vn
Version:
Pixi'VN is a npm package that provides various features for creating visual novels.
51 lines (49 loc) • 1.33 kB
JavaScript
'use strict';
// src/classes/DialogueBaseModel.ts
var DialogueBaseModel = class {
/**
* @param text The text of the dialogue.
* @param character The id of the character that is speaking.
* @param oltherParams Other parameters that can be stored in the dialogue.
*/
constructor(text, character, oltherParams = {}) {
/**
* The text of the dialogue.
*/
this.text = "";
/**
* Other parameters that can be stored in the dialogue.
*/
this.oltherParams = {};
if (typeof text === "string") {
this.text = text;
if (typeof character === "string") {
this.character = character;
} else {
this.character = character == null ? void 0 : character.id;
}
this.oltherParams = oltherParams;
} else {
this.text = text.text;
if (text.character) {
this.character = text.character;
}
this.oltherParams = text.oltherParams || {};
}
}
/**
* Export the dialogue to a DialogueBaseData object.
*
* @returns The data of the dialogue.
*/
export() {
return {
text: this.text,
character: this.character,
oltherParams: this.oltherParams
};
}
};
module.exports = DialogueBaseModel;
//# sourceMappingURL=DialogueBaseModel.js.map
//# sourceMappingURL=DialogueBaseModel.js.map