File

src/app/models/scenario-phrase.ts

Constructor

constructor(texte: any, callback: any, phraseTTS: any, buttonTexte: string)

Methods

setRandomMode
setRandomMode()
Returns: void
speechOnly
speechOnly()
Returns: void
hideBubble
hideBubble()
Returns: void
keepBubbleOn
keepBubbleOn()
Returns: void
showButtons
showButtons()
Returns: void
disableSkipButton
disableSkipButton()
Returns: void
showAward
showAward(award: string)

shows award

Parameters :
  • award

    with stt

Returns: void

nothing

Properties

Public buttons
buttons: boolean
Public buttonText
buttonText: string
Public callback
callback: any
Public disableSkip
disableSkip: boolean
Default value: false
isFeedback
isFeedback: boolean
Default value: false
keepBubble
keepBubble: boolean
Public moon
moon: boolean
Default value: false
Public normalStar
normalStar: boolean
Default value: false
Public onlySpeech
onlySpeech: boolean
Default value: false
Public phrase
phrase: string[]
Public phraseTTS
phraseTTS: string[]
Public randomSpeechMode
randomSpeechMode: boolean
Default value: false
Public shootingStar
shootingStar: boolean
Default value: false
Public textBubble
textBubble: boolean
Default value: true
export class ScenarioPhrase {
	public phrase: Array<string>;
	public phraseTTS: Array<string>;
	public callback: any;
	public randomSpeechMode = false;
	public textBubble = true;
	public buttons: boolean;
	public buttonText: string;
	public disableSkip = false;
	public shootingStar = false;
	public normalStar = false;
	public moon = false;
	public onlySpeech = false;
	keepBubble: boolean;
	isFeedback: boolean = false;

	constructor(texte: any, callback = null, phraseTTS: any = null, buttonTexte: string = null) {
		if (Array.isArray(texte)) {
			this.phrase = texte;
		} else {
			this.phrase = [texte];
		}

		if (buttonTexte) {
			this.buttonText = buttonTexte;
		}

		if (phraseTTS) {
			if (Array.isArray(texte)) {
				this.phraseTTS = phraseTTS;
			} else {
				this.phraseTTS = [phraseTTS];
			}
		} else {
			this.phraseTTS = [];
			// remove space before ! and ? for intonations in sentence.
			this.phrase.forEach(element => {
				let elementTTS = element.replace(" ?", "?");
				elementTTS = elementTTS.replace(" !", "!");
				this.phraseTTS.push(elementTTS);
			});
		}

		if (callback) {
			this.callback = callback;
		} else {
			this.callback = () => {};
		}
	}

	setRandomMode() {
		this.randomSpeechMode = true;
		return this;
	}

	speechOnly() {
		this.onlySpeech = true;
		return this;
	}

	hideBubble() {
		this.textBubble = false;
		return this;
	}

	keepBubbleOn() {
		this.keepBubble = true;
		return this;
	}

	showButtons() {
		this.buttons = true;
		return this;
	}

	disableSkipButton() {
		this.disableSkip = true;
		return this;
	}

	/**
	 * shows award
	 * @param [award] with stt
	 * @returns nothing
	 */
	showAward(award: string) {
		if (award === "shooting") {
			this.shootingStar = true;
		} else if (award === "normal") {
			this.normalStar = true;
		} else if (award === "moon") {
			this.moon = true;
		}
		return this;
	}
}

results matching ""

    No results matching ""