From 4ea7f31e5b197997a676854aac9cc3fa5d5746ce Mon Sep 17 00:00:00 2001 From: Black Ram <67595890+BlackRam-oss@users.noreply.github.com> Date: Sat, 10 Aug 2024 23:40:44 +0200 Subject: [PATCH] glueEnabled --- src/classes/LabelJson.ts | 10 ++++++++-- src/functions/DialogueUtility.ts | 10 ++++++++++ src/managers/StorageManager.ts | 5 +++++ src/types/StepLabelJsonType.ts | 5 +++++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/classes/LabelJson.ts b/src/classes/LabelJson.ts index 1f93d2ba..e50fe10a 100644 --- a/src/classes/LabelJson.ts +++ b/src/classes/LabelJson.ts @@ -1,6 +1,6 @@ -import { clearChoiceMenuOptions, clearDialogue, setChoiceMenuOptions, setDialogue } from "../functions" +import { clearChoiceMenuOptions, clearDialogue, setChoiceMenuOptions, setDialogue, setFlag } from "../functions" import { LabelProps } from "../interface" -import { GameStepManager } from "../managers" +import { GameStepManager, GameStorageManager } from "../managers" import { StepLabelJsonType } from "../types" import { LabelIdType } from "../types/LabelIdType" import { StepLabelType } from "../types/StepLabelType" @@ -48,6 +48,12 @@ export default class LabelJson extends LabelAbstract() + if (glueDialogue) { + dialogue.text = `${glueDialogue.text}${dialogue.text}` + dialogue = glueDialogue + } + setFlag(GameStorageManager.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY, false) + } + GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY, dialogue as DialogueData) GameStorageManager.setVariable(GameStorageManager.keysSystem.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY, GameStepManager.lastStepIndex) } diff --git a/src/managers/StorageManager.ts b/src/managers/StorageManager.ts index 182cd75a..cfe8ffaa 100644 --- a/src/managers/StorageManager.ts +++ b/src/managers/StorageManager.ts @@ -31,6 +31,11 @@ export default class GameStorageManager { * The key of the flags memory */ FLAGS_CATEGORY_KEY: "___flags___", + /** + * This variable is used to add the next dialog text into the current dialog memory. + * This value was added to introduce Ink Glue functionality https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#glue + */ + ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY: "___glue___", } } /** diff --git a/src/types/StepLabelJsonType.ts b/src/types/StepLabelJsonType.ts index bfc88382..55191960 100644 --- a/src/types/StepLabelJsonType.ts +++ b/src/types/StepLabelJsonType.ts @@ -39,6 +39,11 @@ type StepLabelJsonType = { */ text: string, } | string + /** + * This variable is used to add the next dialog text into the current dialog memory. + * This value was added to introduce Ink Glue functionality https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#glue + */ + glueEnabled?: boolean /** * Variable used to open a label. */