diff --git a/README.md b/README.md index b5092c79b..ec73f7a53 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -![Hero Image](https://coppolaemilio.com/images/dialogic/dialogic-hero-1.3.png?v1) -![image](https://user-images.githubusercontent.com/2206700/133774754-8ab47c3a-ae94-414d-b5c7-84ea878cd55b.png) +![github-cover](https://user-images.githubusercontent.com/2206700/136808110-7caa2d2c-44c0-4d8e-a272-fd01b990c6ba.png) Create dialogs, characters and scenes to display conversations in your Godot games. @@ -12,27 +11,26 @@ Create dialogs, characters and scenes to display conversations in your Godot gam - -# Version 1.3 - BETA ![Godot v3.3](https://img.shields.io/badge/godot-v3.3-%23478cbf) +# Version 1.4 - Work in progress 🛠️ ![Godot v3.4](https://img.shields.io/badge/godot-v3.3-%23478cbf) ## Getting started -This video will teach you everything you need to know to get started with Dialogic: [https://www.youtube.com/watch?v=sYjgDIgD7AY](https://www.youtube.com/watch?v=sYjgDIgD7AY) +You can read a step by step guide on how to use [Dialogic here](https://github.com/coppolaemilio/dialogic/blob/main/addons/dialogic/Documentation/Content/Tutorials/BeginnersGuideStepByStep.md) + +## 📚 Documentation +You can check the documentation from inside the plugin or [here](https://github.com/coppolaemilio/dialogic/blob/main/addons/dialogic/Documentation/Content/Welcome.md) ## Installation To install a Dialogic, download it as a ZIP archive. All releases are listed here: [releases](https://github.com/coppolaemilio/dialogic/releases). Then extract the ZIP archive and move the `addons/` folder it contains into your project folder. Then, enable the plugin in project settings. -If you want to know more about installing plugins you can read the [official documentation page](https://docs.godotengine.org/en/stable/tutorials/plugins/editor/installing_plugins.html). +If you want to know more about installing plugins you can read the [Godot docs page](https://docs.godotengine.org/en/stable/tutorials/plugins/editor/installing_plugins.html). You can also install Dialogic using the **AssetLib** tab in the editor, but the version here will not be the latest one available since it takes some time for it to be approved. ## ⚠ IMPORTANT If you encounter any issue when exporting your game, try having at least 1 theme in your project. -## 📚 Documentation -You can check the documentation from inside the plugin or [here](https://github.com/coppolaemilio/dialogic/blob/main/addons/dialogic/Documentation/Content/Welcome.md) - --- ## 📃 Credits diff --git a/addons/dialogic/Documentation/Content/Changelog.md b/addons/dialogic/Documentation/Content/Changelog.md index 762c0f6aa..ad51b3a3d 100644 --- a/addons/dialogic/Documentation/Content/Changelog.md +++ b/addons/dialogic/Documentation/Content/Changelog.md @@ -1,6 +1,10 @@ # Changelog -## v1.3 - (WIP) +## v1.4 +- Wait seconds event can now be set to be skipped with the user's action [[SimonLammer](https://github.com/SimonLammer)] +- Added: `Autofocus choices` in the settings [[Jowan-Spooner](https://github.com/Jowan-Spooner)] + +## v1.3 - Save me some time #### General Editor Stuff - **Builtin documentation** [[Jowan-Spooner](https://github.com/Jowan-Spooner)] - Added a button to open the documentation from the nav bar diff --git a/addons/dialogic/Documentation/Content/Events/Custom Events/CreateCustomEvents.md b/addons/dialogic/Documentation/Content/Events/Custom Events/CreateCustomEvents.md index 57b1c5928..5fc194b1b 100644 --- a/addons/dialogic/Documentation/Content/Events/Custom Events/CreateCustomEvents.md +++ b/addons/dialogic/Documentation/Content/Events/Custom Events/CreateCustomEvents.md @@ -27,81 +27,76 @@ All of the files that are used for creating a custom Event Block and Handling Sc # Making your first custom event in 6 steps Let's now create a simple event that will print some text to the Output panel in Godot. -### You can avoid the manual copy-pasting part. Go to Dialogic's settings and use the Custom events section [new] button to create and rename an event for you. Make sure to read the guide so you know what is happening in the process. -## 1. Create the folder -First you should create a new folder in `res://dialogic/custom-events` and give it a name that is descriptive and unique. +## Create the event +Go to the `settings page` and in the `custom events section` hit the `New` button. +Fill in a name for your event, a folder name and an id. For the id's I recommend using your name or a string unique to you followed by a number. +**The id has to be different for every event!!!** +This is why I recommend the unique string, because it will enable you to share the event with others without breaking their games. +![Creating](./Images/CreationProcess.PNG) -For this print event let's call it `print-event`. +When you are ready, hit `Create`. You will see the folder appear in the `FileSystem` under `res://dialogic/custom-events/`. +If you go to the `timeline editor` now, you should already be able to see your event in the event list. -## 2. The folders content -Now you should go to `res://addons/dialogic/Example Assets/CustomEvents` and copy all the files from there and paste them into your new folder (In this case: `res://dialogic/custom-events/print-event`) +### What happened +This little menu already created a number of things for you: +- The `EventBlock` (EventBlock.tscn) +- An example `EventPart` (EventPart_Example.gd/.tscn) +- The `event handling script` (event_+EVENTID+.gd) +- A `stylebox` for your event (Stylebox.tres) -## 3. The EventBlock (EventBlock.tscn) -This is a scene that inherits `res://addongs/dialogic/Editor/Events/Templates/EventTemplate.tscn`. -When you open the scene you can see that all except the root node are grayed out. -**IMPORTANT!!! This file needs to be named `EventBlock.tscn`!!! DO NOT RENAME** +## What next +The automatic process already setup a lot. But it didn't know the purpose of our event. +So we will have to add that. -### Setting the EventBlock values -Now select the the root node of that scene. In the inspector you will see a couple of variables to set. +### | Adding the data +First we want to open the `EventBlock.tscn` scene. (Do not rename this scene!) -#### EventName and icon -For now let's set the `Event Name`. I will set mine to `Print Event`. +Select its root node and look at it's exported variables in the inspector. -#### The Event Data -Next you also need to think about the data that your event should save/handle. +We will need to add all the data, that our event can have to the `event_data`. +You can see, that it alread contains your event id. This needs to be there, do not delete it! -As said before it has to contain an `event_id`. These ids mostly consist of your "name" and a number. My event_id will be `rabloe_000`. -*We decided to move away from the actual names so that renaming wouldn't cause lots of rework.* -*Make sure your "name" is as unique as possible, so you can share custom events with others without trouble.* +I want to be able to set a text that will be printed, when my event is activated, so I'll add an information slot for that: +![EventData](./Images/EventBlock_EventData.PNG) -For the rest of the data I just want to store a string to print. Create the default data as a dictionary in the `event_data` in the inspector. +### | Icon and Stylebox +You can also change your events icon in the inspector. Just drag an image into the `Event Icon`. -#### Style and Icon -Now there is also already a stylebox. You can edit it (mainly the background color) to give it a unique style. -You can also select an icon for your event. The default Dialogic icon size and format is: 22x22 `svg`. You can find the icons used for the built-in events here: `res://addons/dialogic/Images/Event Icons/Main Icons` +Below that, you can open the Stylebox and change its background color, to give your event a unique look. - -## 4. The Event Blocks Content (EventParts) +### | The Event Blocks Content (EventParts) Right now your event block will be empty so let's change that (if you want to). The content of an EventBlock is separated as `EventParts`. This allows for some reuse. There are two places EventParts can be in an EventBlock: The Header (always visible) and the Body (can be hidden). -*EventParts can also contain other EventParts, but it wont be necessary for most custom events.* -*An EventBlock does not have to have a body nor a header EventPart.* +*An EventBlock does not have to have a body nor a header EventPart. For example the End Branch event has none.* There is already a simple example `EventPart` (Script and Scene) included. You can change it as much as you want. -### Loading the data -In `load_data()` you will need to set the values of your control nodes. +#### | Loading the data +In `load_data()` you will need to set the values of your control nodes. This function is called when the event is added to the timeline editor. -### Saving changes to the data +#### | Saving changes to the data When the values get changed (listen to it via signals) set the according value in the `event_data` dictionary and call `data_changed()`. This is pretty much all you need to know. *If you want to find more examples you can go to `res://addons/dialogic/Editor/Events/Parts/` and look at the EventParts that shape Dialogic's default blocks.* -### Using the EventPart +### | Using the EventPart Once you finished everything in your EventPart(s) you need to go into the `EventBlock` scene and set the `header`/`body` variable in the inspector to the new scene(s). -Here is how the EventBlock's settings look for me now: -![EventPartAdded](./Images/EventBlockSettingsFilled.PNG) - -## 5. The event handler script (event_yourname_000.gd) +### | The event handler script (event_yourname_000.gd) Once you have your `EventBlock` finished, you need to add the event handling logic. -### The correct name -Dialogic will search your handler script following the format `event_` + your event id. -So in our case, since the `event_id` is `rabloe_000` the handler scripts needs to be called **exactly** `event_rabloe_000.gd` - -### The handle_event() function +#### | The handle_event() function If you open the script you will see, that there is only one function by default, the `handle_event()` function. It comes with two usefull pieces of information: the `event_data` and a reference to the `dialog_node`. @@ -112,21 +107,16 @@ there. But of course you can do a lot more. Some more stuff is already explained in the script: -#### Continue +##### Continue Use `dialog_node.load_next_event()` to continue with the next event. -#### Waiting +##### Waiting If you don't want the player to interrupt your event, set `dialog_node.waiting` to `true` while your event is handled. Don't forget to set it back to `false`. -## 6. Using your event -You are as good as done. Just enable custom events in dialogics settings menu. -Then go into a timeline. Scroll down to the custom events section. There it should be, otherwise you should hit the refresh button. - -*Go ahead and try it out!* - - +## And done! +Great, you've created your first custom event for dialogic. *Make sure to check Emilio's Discord server just in case someone has already created the custom event that you need. They are super easy to [import](./ImportCustomEvents.md)!* \ No newline at end of file diff --git a/addons/dialogic/Documentation/Content/Events/Custom Events/Images/CreationProcess.PNG b/addons/dialogic/Documentation/Content/Events/Custom Events/Images/CreationProcess.PNG new file mode 100644 index 000000000..1bd21d093 Binary files /dev/null and b/addons/dialogic/Documentation/Content/Events/Custom Events/Images/CreationProcess.PNG differ diff --git a/addons/dialogic/Documentation/Content/Events/Custom Events/Images/EventBlockSettings.PNG b/addons/dialogic/Documentation/Content/Events/Custom Events/Images/EventBlockSettings.PNG deleted file mode 100644 index e61c5ea53..000000000 Binary files a/addons/dialogic/Documentation/Content/Events/Custom Events/Images/EventBlockSettings.PNG and /dev/null differ diff --git a/addons/dialogic/Documentation/Content/Events/Custom Events/Images/EventBlockSettingsFilled.PNG b/addons/dialogic/Documentation/Content/Events/Custom Events/Images/EventBlockSettingsFilled.PNG deleted file mode 100644 index 1473d275e..000000000 Binary files a/addons/dialogic/Documentation/Content/Events/Custom Events/Images/EventBlockSettingsFilled.PNG and /dev/null differ diff --git a/addons/dialogic/Documentation/Content/Events/Custom Events/Images/EventBlock_EventData.PNG b/addons/dialogic/Documentation/Content/Events/Custom Events/Images/EventBlock_EventData.PNG new file mode 100644 index 000000000..839fe7529 Binary files /dev/null and b/addons/dialogic/Documentation/Content/Events/Custom Events/Images/EventBlock_EventData.PNG differ diff --git a/addons/dialogic/Documentation/Content/Events/Custom Events/Images/EventPartAdded.PNG b/addons/dialogic/Documentation/Content/Events/Custom Events/Images/EventPartAdded.PNG deleted file mode 100644 index 43f0a49a8..000000000 Binary files a/addons/dialogic/Documentation/Content/Events/Custom Events/Images/EventPartAdded.PNG and /dev/null differ diff --git a/addons/dialogic/Documentation/Content/Events/Custom Events/Images/InheritedScene.PNG b/addons/dialogic/Documentation/Content/Events/Custom Events/Images/InheritedScene.PNG deleted file mode 100644 index e6ef3c19e..000000000 Binary files a/addons/dialogic/Documentation/Content/Events/Custom Events/Images/InheritedScene.PNG and /dev/null differ diff --git a/addons/dialogic/Documentation/Content/Reference/001.md b/addons/dialogic/Documentation/Content/Reference/001.md index b669dbd9b..2ffe6f15a 100644 --- a/addons/dialogic/Documentation/Content/Reference/001.md +++ b/addons/dialogic/Documentation/Content/Reference/001.md @@ -4,7 +4,7 @@ ### Methods: #### start() -`start(timeline: String, reset_saves: bool=true, dialog_scene_path: String="res://addons/dialogic/Nodes/DialogNode.tscn", debug_mode: bool=false, use_canvas_instead=true)` +`start(timeline: String, default_timeline: String, dialog_scene_path: String="res://addons/dialogic/Nodes/DialogNode.tscn", debug_mode: bool=false, use_canvas_instead=true)` Starts the dialog for the given timeline and returns a Dialog node. You must then add it manually to the scene to display the dialog. @@ -17,7 +17,7 @@ you can drag and drop the scene located at /addons/dialogic/Dialog.tscn and set the current timeline via the inspector. @param timeline The timeline to load. You can provide the timeline name or the filename. -@param reset_saves True to reset dialogic saved data such as definitions. +@param default_timeline If timeline == '' and no valid data was found, this will be loaded. @param dialog_scene_path If you made a custom Dialog scene or moved it from its default path, you can specify its new path here. @param debug_mode Debug is disabled by default but can be enabled if needed. @param use_canvas_instead Create the Dialog inside a canvas layer to make it show up regardless of the camera 2D/3D situation. diff --git a/addons/dialogic/Documentation/Content/Reference/Theme.md b/addons/dialogic/Documentation/Content/Reference/Theme.md index 732f0fc81..fb427a240 100644 --- a/addons/dialogic/Documentation/Content/Reference/Theme.md +++ b/addons/dialogic/Documentation/Content/Reference/Theme.md @@ -9,46 +9,46 @@ The settings are sorted into different sections. Most of the settings are self-e ## Dialog Text Here you can set the look and behaviour of the text inside the dialog box. -#####Behaviour>Speed +##### Behaviour>Speed Using this setting you can change the speed at which the text is shown, where bigger values will result in a slower speed. Setting this to 0 will result in the text being shown instantly. -#####Behaviour>Single Portrait Mode +##### Behaviour>Single Portrait Mode If you enable this mode, there will always only be one portrait visible, the one of the character currently speaking. ## Dialog Box ### Visuals For the background of the box you will have to choose between a solid color or a texture. For the texture you can also change it's modulation. -#####Visuals>Full width +##### Visuals>Full width If you enable this setting the box will be stretched from left to right. -#####Visuals>Box padding +##### Visuals>Box padding The padding between the border of the box and the text inside the box. -#####Visuals>Bottom gap +##### Visuals>Bottom gap How far the box is from the bottom. ### Next indicator The next indicator is the little icon that appears once the text is completed. ### Behaviour -#####Behaviour>Action Key +##### Behaviour>Action Key If you do not want to use the same action as the default one (in the settings) for advancing the dialog, you can select a different one for the current theme. -#####Behaviour>Fade in time +##### Behaviour>Fade in time This sets how long the theme takes to fade in. Fading only happens on dialog load and is not triggered by the `Set Theme` event. ## Name Label The `Name label` is the section above the text box that displays the name of the currently speaking character. -#####Text>Use character Color +##### Text>Use character Color If you enable this, the name label will always use the color of the currently speaking character. The characters color can be edited in the [Character Editor](./Character.md). ### Box As for the text box, you can choose between a solid color or a texture. -#####Box>Box Padding +##### Box>Box Padding The padding between the texture border and the text. ### Placement @@ -58,16 +58,16 @@ Here you can set the alignment of the `Name label` as well as setting some addit #####Advanced>Use Custom Buttons If you enable this, you can select a scene that will be used as the buttons. Make sure the scene has a 'pressed', 'focus_entered' and 'mouse_entered' signal. -#####Advanced>Use Native Buttons +##### Advanced>Use Native Buttons ToDo: Find out if this works in any way. ## Glossary Here you can define how the box looks, that appears when you hover a glossary entry. -#####Visuals>Word color +##### Visuals>Word color This is the color, that glossary entries have in the text. -#####Behaviour>Show +##### Behaviour>Show If this is disabled, the glossary info box won't be shown and glossary entries won't be colored. ## Audio @@ -76,18 +76,18 @@ This sections allows you to set audio that plays at different moments. Each of t You can decide to select a single audio file or a folder where one file will be picked. You can set a range for the `volume` (a random one in that range will be picked each time). Likewise you can set a range for the `pitch`. `Allow interrupt` decides whether the sound can be interrupted by a new sound of that type. -#####Typing Sound Effects +##### Typing Sound Effects This sound will be played for each appearing character. -#####Next Sound Effects>Waiting +##### Next Sound Effects>Waiting This is played once the text is completed. -#####Next Sound Effects>Passing +##### Next Sound Effects>Passing This is played when the player continues. -#####Choice Sound Effects>Hovered +##### Choice Sound Effects>Hovered When a choice button is hovered. -#####Choice Sound Effects>Selecting +##### Choice Sound Effects>Selecting When a choice is selected. diff --git a/addons/dialogic/Documentation/Content/Tutorials/BeginnersGuideStepByStep.md b/addons/dialogic/Documentation/Content/Tutorials/BeginnersGuideStepByStep.md index 6e5db93f6..434136db4 100644 --- a/addons/dialogic/Documentation/Content/Tutorials/BeginnersGuideStepByStep.md +++ b/addons/dialogic/Documentation/Content/Tutorials/BeginnersGuideStepByStep.md @@ -1,87 +1,97 @@ # Beginners Guide Let's begin creating your first dialog with Dialogic! + + ## 1. Meeting the Dialogic tab -All the things related to your dialogue will be done in the Dialogic tab. You can access it like the 2D and 3D tab on the very top of the editor. You can access all the things you create with Dialogic here. +All the things related to your dialogue will be done in the Dialogic tab. You can access it like the 2D and 3D tab on the very top of the editor. ![Dialogic Tab](https://github.com/Jowan-Spooner/dialogic/blob/plugin-docs/addons/dialogic/Documentation/Content/Tutorials/Images/Dialogic_Tab.PNG) -Let's have a look into the toolbar at the top. + +Let's have a look into the `toolbar` at the top. ![Toolbar](https://github.com/Jowan-Spooner/dialogic/blob/plugin-docs/addons/dialogic/Documentation/Content/Tutorials/Images/Toolbar.PNG) -Here you can create Dialogic's four **resources**: -### Timelines -that represent a list of events. Control characters, make them talk, change the background, ask questions, emit signals and more! -### Characters -that represent your characters. You can set a name, a description, a color, and set different images for expressions. +### | The resources +Here you can create Dialogic's five **resources**. You will hear more on each of them later. + +**Timelines** represent a list of events. Show characters, make them talk, change the background, ask questions, emit signals, and more! + +**Characters** can have name, a special color, and different images for expressions. -### Definitions -that can be used as variables (to branch your story or be used inside the texts) or as information for the player (a name and description are shown when the player hovers over the word). +**Value Definitions** that can be used as variables to branch your story or be used inside the texts. -### Themes -that specify how your dialogue is looking. There are many settings you can tweak to suit your need. +**Glossary Entries** that can contain information that is shown in a popup when the player hovers over the word. -You will hear more on each of them later. +**Themes** that specify how your dialogue is looking. There are many settings you can tweak to suit your need. -All your resources are shown in the big master tree on the left. You can select on which you want to work there. +### | The master tree +All your resources are shown in the big `master tree` on the left. You can select on which you want to work there, create sub folders and move the items by dragging them. + +*Let's continue! What is the most important thing for a dialogue? Someone to talk to. So we will create our first character.* + +-------------------- -Let's continue! What is the most important thing for a dialogue? Someone to talk to. So we will create our first character. ## 2. Creating your first character -Click the little character icon in the toolbar to create a new character. You will see the character editor now. +Click the little character icon in the toolbar to create a new character. You will see the `character editor` now. +### | Name +You can instantly type in the `name`, the character should have. Hit enter to set the name. ![Empty Character Editor](./Images/Empty_Character_Editor.PNG) -We will go over it step by step. -Go on and give your character a name and a color. You can ignore the rest of these settings for now. -![YFD Character NameColor](https://github.com/Jowan-Spooner/dialogic/blob/plugin-docs/addons/dialogic/Documentation/Content/Tutorials/Images/YFD_Character_NameColor.PNG) -Next let's add a default look for them. You can select a file by clicking the tree dots. +### | Color +Go ahead and also set a `color`, by clicking on the color block. + +### | A default portrait/expression +Next let's add a default `portrait` for them. You can select a file by clicking the tree dots. +If you do not have a image to use right now, you can use the example dwarf from the `Example Assets folder` inside the Dialogic folder (res://addons/dialogic/Example Assets/portraits). + + ![grafik](./Images/Character_Editor_With_Portrait.PNG) +This is all for now. You can create as many characters as your story needs. -If you do not have a image to use right now, you can use the default dwarf from the Example Assets folder inside the Dialogic folder. +*Now let's create our first dialogue!* -This is all for now. You can create a second character just like this. +-------------------- -When you are ready let's create our first ever dialogue! ## 3. Creating your first timeline Timelines specify what events happen in which order. Create a new timeline with the icon in the toolbar. -You can now see the timeline editor. You can find all possible events on the right. -![Empty Timeline](./Images/Empty_Timeline_Editor.PNG) - - -### | Give it a name -Let's first give our timeline a proper name. To do so double-click the resource on the right. Give it a name of your liking. -![Timeline Name](./Images/Timeline_Change_Name.PNG) +You can now see the `timeline editor`. -### | Now let's talk about the EVENTS! +### | Name +Go ahead and give it a `name`. You can do so right after creating or double-click the item in the tree. -You can click each of the buttons on the right to add the event to the timeline. Or you can drag and drop it to the position you want. +### | Adding your first event +You can find all possible `events` on the right. +![Empty Timeline](./Images/Empty_Timeline_Editor.PNG) -You can select events by left clicking them. When you click one of the event buttons on the right, new events will be added below the selected one. +Go ahead and add a `Text` event (the very first, grey button), by clicking it or dragging it into the timeline area. -You can select events and delete them with CRTL + DEL. +The `Text` event is what will make text appear on the dialog box. +You can select a character that will say the text. Go ahead and let your character say something! -In the timeline you can reorder the events by dragging and dropping them. You can also move the selected event up/down with ALT+UP/ALT+DOWN. +### | More events! +Now we also want our character to be visible in the scene. For that, we use the `Character Join` event (the second, green event). -### | Let's do it! -The events are sorted on the right so you can more easily find them. Let's look at the first three. We will use them to built our first timeline. +Select what character should appear and at which of the 5 available positions. -Click on the `Character Join` button and drag it onto the timeline. Drop it there (by releasing the mouse button). +Make sure the new event is above the Text event. If it's not, you can drag it up (alternatively you can select the event and use `ALT+UP`/`ALT+DOWN`). -All of the events have settings to customize them. For the `Character Join` event, we can set a character that should join, it's portrait (only if the character has more then one) and the position at which the character should be standing by selecting one of the five positions. +### | Create your dialog +Now go ahead and try out the other events. If you want to learn more about them, click the little help button on them! -When you have done that, add a `Text` event the same way. +FYI: new events get added below the currently selected one. -For this event we can specify which character talks, the portrait they have while saying it (if they have more then one) and what they say. On default, line-breaks split the message and empty lines are just ignored. +If you want to delete an event use `DEL` key. -Let your character say something! +After some time your dialogue might look something like this: +![TimelineExample](./Images/TimelineEditor_Example.PNG) -If you are ready, let the character leave with the `Character Leave` event. -You can find explanations for all events and their settings further down in the [refrence](Reference/Events). +*Now your dialog is ready to be played! But how? Let's find out!* -### | On we go -Now your dialog is ready to be played! But how? Let's find out! +-------------------- ## 4. Adding your first DialogNode to a scene @@ -91,68 +101,70 @@ There are two ways of doing this, using gdscript or the scene editor. ### | Instancing the scene using gdscript Using the `Dialogic` class you can add dialogs from code easily: -``` +` var new_dialog = Dialogic.start('Your Timeline Name Here') add_child(new_dialog) -``` +` + ### | Instancing the scene using the editor Using the editor, you can drag and drop the scene located at `/addons/dialogic/Dialog.tscn` and set the current timeline via the inspector. ### | Run, game, run! If you have done one of the previous steps, run your game (F5). I hope you will see your dialog appear. If not check if you missed something. You can also always ask for help on the discord. -Before you start to make your own dialog, let us introduce some more cool things! +*Before you start to make your own dialog, let us introduce some more cool things!* +-------------------- -## 5. Making your first definition -This is already pretty cool, but let's make things more complex. We mentioned them earlier but here they are: Definitions. +## 5. Making your first value and glossary entry +This is already pretty cool, but let's make things more complex. We mentioned them earlier but here they are: `values` and `glossary entries`. -### | Make one? -Create a new definition by clicking the X-icon in the toolbar. You will now see the definition editor. +### | Make a value +Create a new `value` by clicking the X-icon in the toolbar. You will now see the definition editor. -Here you can give your definition a name and a default value, but behold. Do you see that `Type` button? It's very important because it differentiates to types of definitions that are very different: +Here you can give your value a name and a default value. +Now you can use that value in your dialogues. You can: +- change it with the Set Value event +- use it to have conditions (Condition event) +- add conditions to choices +- display it in texts by writing [MyValue] -A `Variable` just has a name and a value. These definitions can be used to store information (that can be inserted into text events) and to use that information in condition events. +#### Example value +Here an example value ... +![ValueExample](./Images/Value_Example1.PNG) +... and how it might be used in a timeline. +![ValueExampleTimeline](./Images/Value_ExampleTimeline.PNG) -An `Extra Information` is used for extra information. WOW. Sorry. If the name of such a definition is inside a text, the player can hover over it and see a box with information appear. +### | Make a glossary entry +An `glossary entry` is used for extra information. If the name of this is used in a text or question event, the player can hover it and it will show a popup with the given information. You can also change the information during the game with the `Set Glossary` event. -### | Make one! -Let's first create a `variable`, so make sure that type is selected. We will call it weapon and give it a default value of "knife". -![Your first variable](./Images/Definition_Editor.PNG) +#### Example glossary entry +Here is an example glossary entry... +![GlossaryExample](./Images/Glossary_Example.PNG) +... and how it looks in the game. +![GlossaryExampleLook](./Images/Glossary_ExampleLook.PNG) -### | And... another one! -Now let's create another definition, this time of type `Extra Information`. Select the type. +*If you don't like the look of this box, don't worry. The next section is about customizing the look of your dialogue!* -I will call mine "Hogwarts" and use the same as the title. I will enter some usefull information and some lore to be displayed at the bottom. -![Extra Information](./Images/Definition_Extra_Informaton_Editor.PNG) +-------------------- -### | Now use them. Do it! -These definitions are nice and everything. But let's put them to actual use. -Go back into your timeline. Add a new `Text` event. -Now we want to mention the characters weapon. We will write the name of the definition in brackets: -![Use Variable](./Images/Definition_In_Use.PNG) - -Test the game. The definitions name is replaced by it's value. -Let's get even more crazy. Add a `Set Value` event and drag it above the `Text` event from earlier. In the event select the variable and set it's value to "sword". -![UseVariableComplex](./Images/Definition_In_Use_Complex.PNG) -Now play the game again. Can you spot the difference? - -### | What about the Extra information +## 6. Create your first dialog theme +Themes are used to change the look. By default you already have a theme. Let's start by clicking it. +You will now see the `theme editor`. -To use the extra information definitions you don't have to put them in brackets. Just use the word somewhere in your text. Let's try it out. Add a text event that contains the name of your extra information definition. -![Hogwarts](./Images/Definition_Extra_Information_In_Use.PNG) +It has a preview at the top, and all the settings - grouped into multiple tabs - at the bottom. +I won't explain all the settings here. You can open the `Theme Editor Reference` if you wonder about one of the settings. -Run the game and hover over the word. Cool, right? +The most important one is the Dialog Box's `Box Size`. If you are making a pixel-art game with a small resolution you will have to change it to be much smaller. Also change the font size to fit your games size. +-------------------- -## 6. Create your first dialog theme -This section is in the work... Please stay tuned! ## Behind the scenes If you wonder how all of this works, here is some (very) short explanation. All the resources are saved as `.json` or `.cfg` in a Dialogic folder in your games root directory `res://dialogic/`. -Boom. There you go :). I'm to lazy to explain more. +Boom. There you go :). I'm to lazy to explain more. \ No newline at end of file diff --git a/addons/dialogic/Documentation/Content/Tutorials/GettingStarted.md b/addons/dialogic/Documentation/Content/Tutorials/GettingStarted.md new file mode 100644 index 000000000..14516e8e8 --- /dev/null +++ b/addons/dialogic/Documentation/Content/Tutorials/GettingStarted.md @@ -0,0 +1,3 @@ +# Getting started + +The video is a bit outdated since it was made using the previous version, but the concepts are the same. You can watch the video [here](https://www.youtube.com/watch?v=sYjgDIgD7AY) or use the new and improved guide [here](./BeginnersGuideStepByStep) \ No newline at end of file diff --git a/addons/dialogic/Documentation/Content/Tutorials/GettingStarted.md.md b/addons/dialogic/Documentation/Content/Tutorials/GettingStarted.md.md deleted file mode 100644 index 3fccfb5a3..000000000 --- a/addons/dialogic/Documentation/Content/Tutorials/GettingStarted.md.md +++ /dev/null @@ -1,3 +0,0 @@ -# Getting started - -You can watch the video [here](https://www.youtube.com/watch?v=sYjgDIgD7AY) \ No newline at end of file diff --git a/addons/dialogic/Documentation/Content/Tutorials/Images/Character_Editor_With_Portrait.PNG b/addons/dialogic/Documentation/Content/Tutorials/Images/Character_Editor_With_Portrait.PNG index 0cd1e6659..7a6d0e55c 100644 Binary files a/addons/dialogic/Documentation/Content/Tutorials/Images/Character_Editor_With_Portrait.PNG and b/addons/dialogic/Documentation/Content/Tutorials/Images/Character_Editor_With_Portrait.PNG differ diff --git a/addons/dialogic/Documentation/Content/Tutorials/Images/Definition_Editor.PNG b/addons/dialogic/Documentation/Content/Tutorials/Images/Definition_Editor.PNG deleted file mode 100644 index 1939dd8ba..000000000 Binary files a/addons/dialogic/Documentation/Content/Tutorials/Images/Definition_Editor.PNG and /dev/null differ diff --git a/addons/dialogic/Documentation/Content/Tutorials/Images/Definition_Extra_Information_In_Use.PNG b/addons/dialogic/Documentation/Content/Tutorials/Images/Definition_Extra_Information_In_Use.PNG deleted file mode 100644 index da92babb1..000000000 Binary files a/addons/dialogic/Documentation/Content/Tutorials/Images/Definition_Extra_Information_In_Use.PNG and /dev/null differ diff --git a/addons/dialogic/Documentation/Content/Tutorials/Images/Definition_Extra_Informaton_Editor.PNG b/addons/dialogic/Documentation/Content/Tutorials/Images/Definition_Extra_Informaton_Editor.PNG deleted file mode 100644 index 9e2919f0b..000000000 Binary files a/addons/dialogic/Documentation/Content/Tutorials/Images/Definition_Extra_Informaton_Editor.PNG and /dev/null differ diff --git a/addons/dialogic/Documentation/Content/Tutorials/Images/Definition_In_Use.PNG b/addons/dialogic/Documentation/Content/Tutorials/Images/Definition_In_Use.PNG deleted file mode 100644 index 24ca5b4af..000000000 Binary files a/addons/dialogic/Documentation/Content/Tutorials/Images/Definition_In_Use.PNG and /dev/null differ diff --git a/addons/dialogic/Documentation/Content/Tutorials/Images/Definition_In_Use_Complex.PNG b/addons/dialogic/Documentation/Content/Tutorials/Images/Definition_In_Use_Complex.PNG deleted file mode 100644 index 06ee37544..000000000 Binary files a/addons/dialogic/Documentation/Content/Tutorials/Images/Definition_In_Use_Complex.PNG and /dev/null differ diff --git a/addons/dialogic/Documentation/Content/Tutorials/Images/Dialogic_Tab.PNG b/addons/dialogic/Documentation/Content/Tutorials/Images/Dialogic_Tab.PNG index dd651baea..16dc26bf2 100644 Binary files a/addons/dialogic/Documentation/Content/Tutorials/Images/Dialogic_Tab.PNG and b/addons/dialogic/Documentation/Content/Tutorials/Images/Dialogic_Tab.PNG differ diff --git a/addons/dialogic/Documentation/Content/Tutorials/Images/Empty_Character_Editor.PNG b/addons/dialogic/Documentation/Content/Tutorials/Images/Empty_Character_Editor.PNG index 29a751279..ee1e6e4c3 100644 Binary files a/addons/dialogic/Documentation/Content/Tutorials/Images/Empty_Character_Editor.PNG and b/addons/dialogic/Documentation/Content/Tutorials/Images/Empty_Character_Editor.PNG differ diff --git a/addons/dialogic/Documentation/Content/Tutorials/Images/Empty_Timeline_Editor.PNG b/addons/dialogic/Documentation/Content/Tutorials/Images/Empty_Timeline_Editor.PNG index 23f869bfe..aedb089ca 100644 Binary files a/addons/dialogic/Documentation/Content/Tutorials/Images/Empty_Timeline_Editor.PNG and b/addons/dialogic/Documentation/Content/Tutorials/Images/Empty_Timeline_Editor.PNG differ diff --git a/addons/dialogic/Documentation/Content/Tutorials/Images/ExportResources.PNG b/addons/dialogic/Documentation/Content/Tutorials/Images/ExportResources.PNG deleted file mode 100644 index cc022d017..000000000 Binary files a/addons/dialogic/Documentation/Content/Tutorials/Images/ExportResources.PNG and /dev/null differ diff --git a/addons/dialogic/Documentation/Content/Tutorials/Images/Glossary_Example.PNG b/addons/dialogic/Documentation/Content/Tutorials/Images/Glossary_Example.PNG new file mode 100644 index 000000000..c8469dcd5 Binary files /dev/null and b/addons/dialogic/Documentation/Content/Tutorials/Images/Glossary_Example.PNG differ diff --git a/addons/dialogic/Documentation/Content/Tutorials/Images/Glossary_ExampleLook.PNG b/addons/dialogic/Documentation/Content/Tutorials/Images/Glossary_ExampleLook.PNG new file mode 100644 index 000000000..56588fd75 Binary files /dev/null and b/addons/dialogic/Documentation/Content/Tutorials/Images/Glossary_ExampleLook.PNG differ diff --git a/addons/dialogic/Documentation/Content/Tutorials/Images/TimelineEditor_Example.PNG b/addons/dialogic/Documentation/Content/Tutorials/Images/TimelineEditor_Example.PNG new file mode 100644 index 000000000..6c7595d52 Binary files /dev/null and b/addons/dialogic/Documentation/Content/Tutorials/Images/TimelineEditor_Example.PNG differ diff --git a/addons/dialogic/Documentation/Content/Tutorials/Images/Timeline_Change_Name.PNG b/addons/dialogic/Documentation/Content/Tutorials/Images/Timeline_Change_Name.PNG deleted file mode 100644 index 085af2a33..000000000 Binary files a/addons/dialogic/Documentation/Content/Tutorials/Images/Timeline_Change_Name.PNG and /dev/null differ diff --git a/addons/dialogic/Documentation/Content/Tutorials/Images/Toolbar.PNG b/addons/dialogic/Documentation/Content/Tutorials/Images/Toolbar.PNG index fc03e295f..a2f9c83e1 100644 Binary files a/addons/dialogic/Documentation/Content/Tutorials/Images/Toolbar.PNG and b/addons/dialogic/Documentation/Content/Tutorials/Images/Toolbar.PNG differ diff --git a/addons/dialogic/Documentation/Content/Tutorials/Images/Value_Example1.PNG b/addons/dialogic/Documentation/Content/Tutorials/Images/Value_Example1.PNG new file mode 100644 index 000000000..2f8dfbdfe Binary files /dev/null and b/addons/dialogic/Documentation/Content/Tutorials/Images/Value_Example1.PNG differ diff --git a/addons/dialogic/Documentation/Content/Tutorials/Images/Value_ExampleTimeline.PNG b/addons/dialogic/Documentation/Content/Tutorials/Images/Value_ExampleTimeline.PNG new file mode 100644 index 000000000..7419f65b9 Binary files /dev/null and b/addons/dialogic/Documentation/Content/Tutorials/Images/Value_ExampleTimeline.PNG differ diff --git a/addons/dialogic/Documentation/Content/Tutorials/Images/YFD_Character_NameColor.PNG b/addons/dialogic/Documentation/Content/Tutorials/Images/YFD_Character_NameColor.PNG deleted file mode 100644 index 63a3deef6..000000000 Binary files a/addons/dialogic/Documentation/Content/Tutorials/Images/YFD_Character_NameColor.PNG and /dev/null differ diff --git a/addons/dialogic/Documentation/Content/Tutorials/Saving.md b/addons/dialogic/Documentation/Content/Tutorials/Saving.md index 63df312d8..ccd4c7b8e 100644 --- a/addons/dialogic/Documentation/Content/Tutorials/Saving.md +++ b/addons/dialogic/Documentation/Content/Tutorials/Saving.md @@ -1,138 +1,52 @@ -# Saving and Loading +# Saving and loading -Dialogic save system can be used in two ways: +Dialogic can handle saving and loading for you. -With **save slots** on timeline start and end. -Or the **manual** way. This lets you handle the import and export of data manually. +## Simple saving +By default Dialogic's autosave settings are turned on. They will save whenever you start a new timeline. +To trigger a save you can also use the `Save` event, or call `Dialogic.save()`. +## Simple loading +All the saving in the world will have little visible effect though, if you don't load your dialog. -## Examples +To do so, you can call `Dialogic.load()`. -### Very simple +Then you can use `Dialogic.start('')` to play from the last saved point. As a fallback (for the first game, or if the player finished the game last time), you can give a default timeline as the second argument: `Dialogic.start('', 'Chapter1')`. -` # when starting your game - Dialogic.load() +In case you want to restart, you can do `Dialogic.reset_saves()` before calling `Dialogic.start()`. - # when you want to start your dialog - var dialog = Dialogic.start('', 'my_first_timeline') - add_child(dialog) - # to save the dialog - Dialogic.save() - - # if you want to restart - Dialogic.reset_saves()` -### Save slots -` # when deciding on a save slot - Dialogic.load('my_slot') +## Implementing save slots +Many games allow you to have more then one save at the same time. - # when you want to start your dialog - var dialog = Dialogic.start('', 'my_first_timeline') - add_child(dialog) +To make this easily possible, you can do `Dialogic.save('slot_name')` and `Dialogic.load('slot_name')`. - # to save the dialog - Dialogic.save() # you can specify what slot, but you don't need to - - # if you want to clear that slot - Dialogic.reset_saves('my_slot') +There are some more functions for slots: - # if you want to remove that slot - Dialogic.erase_slot('my_slot') +- `Dialogic.get_slot_list()` returns a list of slots. +- `Dialogic.erase_slot('slot_name')` deletes the given slot. +- `Dialogic.get_current_slot()` returns the name of the last loaded slot. +- `Dialogic.reset_saves('slot_name')` will reset the given slot. - # to know what slots exist - Dialogic.get_slot_names() +For making menus with this the function `Dialogic.has_current_dialog_node()` is usefull, as it will tell you whether a dialog node is instanced right now. - # if you need to know if you can save - Dialogic.has_current_dialog_node() +For **visual novels** there is a [template with a full menu](https://github.com/Dialogic-Godot/visual-novel-template). You can look at the implementation there, if you are wondering how to do a menu. - # if you need to know, what slot is currently used - Dialogic.get_current_slot() -` -### Manual saving (export/import) +## Custom saving/loading (export+import) +Some games might not want to use dialogics built in saving system but still want to save and load dialogic data. -` - # when you loaded the data - Dialogic.import(data) +You can do this with the `Dialogic.export()` function, that will give you all the important information in a dictionary (that you can save or do whatever with). - # when you want to start your dialog - Dialogic.start('', 'my_first_timeline') +You can then us `Dialogic.import(data)` to import a dictionary. After you have done so, you can use `Dialogic.start('')` like before. - # when you want to save the data - var data = Dialogic.export() - # if you need to know if you can save - Dialogic.has_current_dialog_node() -` +## Saving custom information +Dialogic has a dictionary of custom information that you can use to store things unrelated to dialogic too. You could store your players location in there or whatever you want. -## Loading -To load the data you can use Dialogic.load() or Dialogic.import() +There are two functions for this: +- `Dialogic.get_saved_state_general_key('key')` +- `Dialogic.set_saved_state_general_key('key', value)` - -## Saving -By default Dialogic saves the current state and definitions each time a timeline starts or ends (you can disable this in the settings menu). -If you want to load from this default save, you can just use `Dialogic.start_from_save()`. Make sure to leave the first argument empty. -Here is a short example script: -` -func _ready(): - var dialog = Dialogic.start_from_save('', 'Introduction') - add_child(dialog) -` -If you want to start the game from the beginning, use `Dialogic.reset_saves()` before this. - - -## Save slots -Like the previous one, this approach handles saving for you. It also allows for **multiple save slots**. These will be saved in the user directory under `user://dialogic/SAVE_NAME/`. -These are the functions intended for you: -- `Dialogic.save_current_info(save_name) ` - -> saves all the data of the latest dialog node into the save "save_name" -- `Dialogic.get_save_names_array()` - -> returns a list of all save names (useful for menus) -- `Dialogic.erase_save(save_name) ` -- `Dialogic.has_current_dialog_node()` - -> useful if you need to know if you can save - -They should enable you to create a visual novel menu with all features you would normally expect. - -*[A full visual novel template using this method can be found here.](https://github.com/Dialogic-Godot/visual-novel-template)* - -## The manual way -If Dialogic is not the main part of your game, you probably have an own saving/loading system. -You can easily get the current data out of Dialogic and integrate it with your current code. - -There are three parts of the data: -- **current definitions**: values and glossary entries -- **dialog state**: The current timeline, event index, portraits, background, background music, etc... -- **game state**: By default the state only contains a timeline that has to be set manually. You can add other info to it too. This one is legacy and not perfect but necessary for people who created their projects before 1.3. - -You can get all this data with the `Dialogic.export()` function and load it back in with the `Dialogic.import()` function. - -When you have imported, you can use the `Dialogic.start_from_save()` function to load the last timeline. -Or you can use the `Dialogic.start(my_timeline, false)` to start a different timeline but with the imported definitions. - -Here is an example: -` -func my_saving_function(): - ... - var file = File.new() - file.open('user://my_save.txt', File.WRITE) - file.store_var(Dialogic.export()) - file.close() - ... - -func my_loading_function(): - ... - var file = File.new() - file.open('user://my_save.txt', File.READ) - Dialogic.import(file.get_var()) - file.close() - - var dialog = Dialogic.start_from_save() - add_child(dialog) -` - -### Notes for people from before 1.3 -The `DialogicSingleton` got removed because it proved to be an unstable mess. This, and the introduction of the new and improved built-in saving system, mean that you will need to change some smaller things in your existing code. - -The `Dialogic.start_from_save()` works a bit differently now. If you want to provide a default timeline, it's the second argument now. Also it wont use the `current_timeline` anymore. Instead it uses the `last_dialog_state` that is imported with `Dialogic.import()`. \ No newline at end of file +This dictionary is saved and loaded (or exported/imported) alongside the other information. \ No newline at end of file diff --git a/addons/dialogic/Documentation/Content/Tutorials/Updating.md b/addons/dialogic/Documentation/Content/Tutorials/Updating.md new file mode 100644 index 000000000..4cb9775c4 --- /dev/null +++ b/addons/dialogic/Documentation/Content/Tutorials/Updating.md @@ -0,0 +1,37 @@ +# Updating to 1.3 + +1.3 has brought some big changes, and a few changed the behavior in a way that might break some older code of yours. +This was mainly due to the removal of the DialogicSingleton as well of the implementation of a new saving system. + +Here is everything you need to do to successfully updated (as far as we know): + +## 1. Updating and removing the Dialogic Singleton +- Make a full project backup just in case you lose some data while upgrading +- Disable the current installed Dialogic plugin (Project Settings/Plugins) +- Remove the `/addons/dialogic` folder from your project +- Remove the DialogicSingleton (Project Settings/Autoloads) +- Paste the new Dialogic 1.3 into the addons folder +- Enable the new Dialogic from the plugin menu (Project Settings/Plugins) + +## 2. Remove the reset_saves argument in Dialogic.start() +The Dialogic.start() function no longer has a reset_saves argument, so you will have to get rid of that, wherever you used it. + +Instead you will have to use Dialogic.load() when your game starts and Dialogic.reset_saves() if you want to reset the definitions. Learn more about the new saving system [here](./Saving.md). + +## 3. Remove Dialogic.start_from_save() +This can now be done with by calling Dialogic.load() and then Dialogic.start(''). +You can add a default timeline (used if nothing could be loaded) as the second argument: + +` +Dialogic.load() +var dialog = Dialogic.start('', 'Chapter1') +` + +## 4. Check autosave setting +The autosave settings have been removed in favor of a single one. Check if you want it to be enabled, because it is on by default. + +## 5. Learn the new saving system +There are some more less straight-forward changes to the saving system (no set_timeline() anymore) so I suggest [learning how it should be done now](./Saving.md). Good luck! + +## 6. Redo the typing audio +If one of your themes used the typing audio effects, you will have to redo it with the new and improved system. diff --git a/addons/dialogic/Documentation/Content/Tutorials/VoiceLines.md b/addons/dialogic/Documentation/Content/Tutorials/VoiceLines.md index 0eca64059..82643def5 100644 --- a/addons/dialogic/Documentation/Content/Tutorials/VoiceLines.md +++ b/addons/dialogic/Documentation/Content/Tutorials/VoiceLines.md @@ -1,20 +1,20 @@ -# Voice Line Support - -You can add audio to your text events! Here's what you have to do: - -## 1. Settings -In dialogics `Settings` window enable audio for Text events. - -I recommend to also create a `new audio bus` for your voice lines. -If you do this right now and select it as the default bus (the next setting), you wont have to select it everytime. -Having a seperate bus allows you to control the volume and effects of the voice lines seperate from your other audio. - -## 2. Adding audio to your Text events -Now when you see a Text or Question event, you should find, that it has a new section called 'Audio Pickers'. -For each line (except if "New lines create extra messages" is off) you will find an Audio picker. -You can select the `audio file` you want to play while that line is shown. - -You can also change `volume`, `audiobus` and an `audio region` (the second to begin at and the one where to end). -Leave both audio-regions at 0 to play the whole file. - +# Voice Line Support + +You can add audio to your text events! Here's what you have to do: + +## 1. Settings +In dialogics `Settings` window enable audio for Text events. + +I recommend to also create a `new audio bus` for your voice lines. +If you do this right now and select it as the default bus (the next setting), you wont have to select it everytime. +Having a seperate bus allows you to control the volume and effects of the voice lines seperate from your other audio. + +## 2. Adding audio to your Text events +Now when you see a Text or Question event, you should find, that it has a new section called 'Audio Pickers'. +For each line (except if "New lines create extra messages" is off) you will find an Audio picker. +You can select the `audio file` you want to play while that line is shown. + +You can also change `volume`, `audiobus` and an `audio region` (the second to begin at and the one where to end). +Leave both audio-regions at 0 to play the whole file. + Great! That's all you need to know. \ No newline at end of file diff --git a/addons/dialogic/Documentation/Content/Welcome.md b/addons/dialogic/Documentation/Content/Welcome.md index a78ca684a..a60778eb8 100644 --- a/addons/dialogic/Documentation/Content/Welcome.md +++ b/addons/dialogic/Documentation/Content/Welcome.md @@ -39,10 +39,11 @@ This project is made possible by the support of our [Patreons](https://www.patre - [Theme Editor](./Reference/Theme.md) ## Tutorials +- [Beginners Guide](./Tutorials/BeginnersGuideStepByStep.md) - [Getting started (video)](https://www.youtube.com/watch?v=sYjgDIgD7AY) +- [Updating to 1.3](./Tutorials/Updating.md) - [Saving and Loading](./Tutorials/Saving.md) - [Creating Custom Events](./Events/Custom Events/CreateCustomEvents) -- [Beginners Guide](./Tutorials/BeginnersGuideStepByStep.md) - [Voice Line Support](./Tutorials/VoiceLines.md) diff --git a/addons/dialogic/Editor/Events/Parts/Numbers/EventPart_SecondsSelector.gd b/addons/dialogic/Editor/Events/Parts/Numbers/EventPart_SecondsSelector.gd deleted file mode 100644 index 7fc13c9a6..000000000 --- a/addons/dialogic/Editor/Events/Parts/Numbers/EventPart_SecondsSelector.gd +++ /dev/null @@ -1,30 +0,0 @@ -tool -extends "res://addons/dialogic/Editor/Events/Parts/EventPart.gd" - -# has an event_data variable that stores the current data!!! - -## node references -onready var seconds_input = $HBox/SecondsBox - -# used to connect the signals -func _ready(): - seconds_input.connect("value_changed", self, "_on_SecondsInput_value_changed") - pass - -# called by the event block -func load_data(data:Dictionary): - # First set the event_data - .load_data(data) - - # Now update the ui nodes to display the data. - seconds_input.value = event_data['wait_seconds'] - -# has to return the wanted preview, only useful for body parts -func get_preview(): - return '' - -func _on_SecondsInput_value_changed(value): - event_data['wait_seconds'] = value - - # informs the parent about the changes! - data_changed() diff --git a/addons/dialogic/Editor/Events/Parts/Numbers/SecondsSelector.tscn b/addons/dialogic/Editor/Events/Parts/Numbers/SecondsSelector.tscn deleted file mode 100644 index 19a17a0ed..000000000 --- a/addons/dialogic/Editor/Events/Parts/Numbers/SecondsSelector.tscn +++ /dev/null @@ -1,33 +0,0 @@ -[gd_scene load_steps=3 format=2] - -[ext_resource path="res://addons/dialogic/Editor/Events/Parts/SpinBoxPreventDnD.gd" type="Script" id=1] -[ext_resource path="res://addons/dialogic/Editor/Events/Parts/Numbers/EventPart_SecondsSelector.gd" type="Script" id=2] - -[node name="SecondsSelector" type="VBoxContainer"] -margin_right = 40.0 -margin_bottom = 40.0 -script = ExtResource( 2 ) -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="HBox" type="HBoxContainer" parent="."] -margin_right = 145.0 -margin_bottom = 24.0 - -[node name="SecondsBox" type="SpinBox" parent="HBox"] -margin_right = 74.0 -margin_bottom = 24.0 -min_value = 0.1 -step = 0.1 -value = 1.0 -allow_greater = true -align = 1 -script = ExtResource( 1 ) - -[node name="Title" type="Label" parent="HBox"] -margin_left = 78.0 -margin_top = 5.0 -margin_right = 139.0 -margin_bottom = 19.0 -text = " Seconds" diff --git a/addons/dialogic/Editor/Events/Parts/WaitSeconds/EventPart_WaitSeconds.gd b/addons/dialogic/Editor/Events/Parts/WaitSeconds/EventPart_WaitSeconds.gd new file mode 100644 index 000000000..a472b42cf --- /dev/null +++ b/addons/dialogic/Editor/Events/Parts/WaitSeconds/EventPart_WaitSeconds.gd @@ -0,0 +1,34 @@ +tool +extends "res://addons/dialogic/Editor/Events/Parts/EventPart.gd" + +# has an event_data variable that stores the current data!!! + +## node references +onready var seconds_selector = $HBoxContainer/SecondsBox +onready var skippable_selector = $HBoxContainer/SkippableCheckbox + +# used to connect the signals +func _ready(): + seconds_selector.connect("value_changed", self, "_on_SecondsSelector_value_changed") + skippable_selector.connect("toggled", self, "_on_SkippableSelector_toggled") + +# called by the event block +func load_data(data:Dictionary): + # First set the event_data + .load_data(data) + + # Now update the ui nodes to display the data. + seconds_selector.value = event_data['wait_seconds'] + skippable_selector.pressed = event_data.get('waiting_skippable', false) + +func _on_SecondsSelector_value_changed(value): + event_data['wait_seconds'] = value + data_changed() + +func _on_SkippableSelector_toggled(checkbox_value): + event_data['waiting_skippable'] = checkbox_value + data_changed() + +# has to return the wanted preview, only useful for body parts +func get_preview(): + return '' diff --git a/addons/dialogic/Editor/Events/Parts/WaitSeconds/WaitSeconds.tscn b/addons/dialogic/Editor/Events/Parts/WaitSeconds/WaitSeconds.tscn new file mode 100644 index 000000000..36e6a617f --- /dev/null +++ b/addons/dialogic/Editor/Events/Parts/WaitSeconds/WaitSeconds.tscn @@ -0,0 +1,40 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://addons/dialogic/Editor/Events/Parts/WaitSeconds/EventPart_WaitSeconds.gd" type="Script" id=1] +[ext_resource path="res://addons/dialogic/Editor/Events/Parts/SpinBoxPreventDnD.gd" type="Script" id=4] + +[node name="VBoxContainer" type="VBoxContainer"] +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +margin_right = 232.0 +margin_bottom = 24.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="SecondsBox" type="SpinBox" parent="HBoxContainer"] +margin_right = 74.0 +margin_bottom = 24.0 +min_value = 0.1 +step = 0.1 +value = 1.0 +allow_greater = true +align = 1 +script = ExtResource( 4 ) + +[node name="Title" type="Label" parent="HBoxContainer"] +margin_left = 78.0 +margin_top = 5.0 +margin_right = 131.0 +margin_bottom = 19.0 +text = "Seconds" + +[node name="SkippableCheckbox" type="CheckBox" parent="HBoxContainer"] +margin_left = 145.0 +margin_right = 224.0 +margin_bottom = 24.0 +text = "Skippable" diff --git a/addons/dialogic/Editor/Events/WaitSeconds.tscn b/addons/dialogic/Editor/Events/WaitSeconds.tscn index d11f809f2..a4ace7dde 100644 --- a/addons/dialogic/Editor/Events/WaitSeconds.tscn +++ b/addons/dialogic/Editor/Events/WaitSeconds.tscn @@ -1,55 +1,41 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/wait-seconds.svg" type="Texture" id=1] -[ext_resource path="res://addons/dialogic/Editor/Events/Parts/Numbers/SecondsSelector.tscn" type="PackedScene" id=3] +[ext_resource path="res://addons/dialogic/Editor/Events/Parts/WaitSeconds/WaitSeconds.tscn" type="PackedScene" id=2] [ext_resource path="res://addons/dialogic/Editor/Events/Templates/EventTemplate.tscn" type="PackedScene" id=4] [ext_resource path="res://addons/dialogic/Editor/Events/styles/WaitSeconds.tres" type="StyleBox" id=5] -[sub_resource type="Image" id=1] -data = { -"data": PoolByteArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ), -"format": "LumAlpha8", -"height": 16, -"mipmaps": false, -"width": 16 -} - -[sub_resource type="ImageTexture" id=2] -flags = 4 -flags = 4 -image = SubResource( 1 ) -size = Vector2( 16, 16 ) - [node name="WaitSeconds" instance=ExtResource( 4 )] +event_name = "Wait Seconds" event_data = { "event_id": "dialogic_023", "wait_seconds": 1.0 } -event_style = ExtResource( 5 ) event_icon = ExtResource( 1 ) -event_name = "Wait Seconds" -header_scene = ExtResource( 3 ) +event_style = ExtResource( 5 ) +header_scene = ExtResource( 2 ) [node name="PanelContainer" parent="." index="1"] custom_styles/panel = ExtResource( 5 ) -[node name="Warning" parent="PanelContainer/MarginContainer/VBoxContainer/Header" index="0"] -icon = SubResource( 2 ) +[node name="SelectedStyle" parent="PanelContainer" index="0"] +modulate = Color( 0, 0, 0, 1 ) -[node name="IconTexture" parent="PanelContainer/MarginContainer/VBoxContainer/Header" index="0"] +[node name="IconTexture" parent="PanelContainer/MarginContainer/VBoxContainer/Header" index="1"] margin_right = 32.0 texture = ExtResource( 1 ) -[node name="TitleLabel" parent="PanelContainer/MarginContainer/VBoxContainer/Header" index="0"] -margin_right = 91.0 +[node name="TitleLabel" parent="PanelContainer/MarginContainer/VBoxContainer/Header" index="2"] +margin_left = 42.0 +margin_right = 128.0 text = "Wait Seconds" [node name="Content" parent="PanelContainer/MarginContainer/VBoxContainer/Header" index="3"] -margin_left = 157.0 -margin_right = 306.0 +margin_left = 138.0 +margin_right = 386.0 [node name="Spacer" parent="PanelContainer/MarginContainer/VBoxContainer/Header" index="5"] -margin_left = 310.0 +margin_left = 396.0 [node name="OptionsControl" parent="PanelContainer/MarginContainer/VBoxContainer/Header" index="7"] items = [ "Move Up", null, 0, false, false, 0, 0, null, "", false, "Move Down", null, 0, false, false, 1, 0, null, "", false, "", null, 0, false, false, 2, 0, null, "", false, "Remove", null, 0, false, false, 3, 0, null, "", false ] diff --git a/addons/dialogic/Editor/MasterTree/MasterTree.gd b/addons/dialogic/Editor/MasterTree/MasterTree.gd index 22b942948..7d2e125b5 100644 --- a/addons/dialogic/Editor/MasterTree/MasterTree.gd +++ b/addons/dialogic/Editor/MasterTree/MasterTree.gd @@ -766,7 +766,6 @@ func _on_gui_input(event): func _start_rename(): - print('rename start') var item = get_selected() var metadata = item.get_metadata(0) if metadata.has("editable") and metadata["editable"]: diff --git a/addons/dialogic/Editor/TimelineEditor/TimelineEditor.tscn b/addons/dialogic/Editor/TimelineEditor/TimelineEditor.tscn index f8c4f605d..c0f2f6746 100644 --- a/addons/dialogic/Editor/TimelineEditor/TimelineEditor.tscn +++ b/addons/dialogic/Editor/TimelineEditor/TimelineEditor.tscn @@ -31,7 +31,7 @@ content_margin_left = 5.0 content_margin_right = 5.0 content_margin_top = 5.0 content_margin_bottom = 5.0 -bg_color = Color( 0.15, 0.1725, 0.2325, 1 ) +bg_color = Color( 0, 0, 0, 1 ) border_width_left = 1 border_width_top = 1 border_width_right = 1 @@ -254,7 +254,7 @@ margin_bottom = 20.0 hint_tooltip = "End Branch" icon = ExtResource( 9 ) event_id = "dialogic_013" -event_color = Color( 0.160784, 0.423529, 0.309804, 0.447059 ) +event_color = Color( 0.270588, 0.243137, 0.572549, 0.407843 ) event_icon = ExtResource( 9 ) [node name="SetValue" parent="ScrollContainer/EventContainer/Grid2" instance=ExtResource( 25 )] diff --git a/addons/dialogic/Nodes/DialogNode.gd b/addons/dialogic/Nodes/DialogNode.gd index de2ad901b..dccdeb00f 100644 --- a/addons/dialogic/Nodes/DialogNode.gd +++ b/addons/dialogic/Nodes/DialogNode.gd @@ -632,21 +632,28 @@ func _process(delta): # checks for the "input_next" action func _input(event: InputEvent) -> void: - if not Engine.is_editor_hint() and event.is_action_pressed(input_next) and not waiting: - if not $TextBubble.is_finished(): - # Skip to end if key is pressed during the text animation - $TextBubble.skip() - # Cut the voice - $FX/CharacterVoice.stop_voice() + if not Engine.is_editor_hint() and event.is_action_pressed(input_next): + if waiting: + if not current_event: + return + var timer = current_event.get('waiting_timer_skippable') + if timer: + timer.time_left = 0 else: - if waiting_for_answer == false and waiting_for_input == false and while_dialog_animation == false: - $FX/CharacterVoice.stop_voice() # stop the current voice as well - play_audio("passing") - _load_next_event() - if settings.has_section_key('dialog', 'propagate_input'): - var propagate_input: bool = settings.get_value('dialog', 'propagate_input') - if not propagate_input: - get_tree().set_input_as_handled() + if not $TextBubble.is_finished(): + # Skip to end if key is pressed during the text animation + $TextBubble.skip() + # Cut the voice + $FX/CharacterVoice.stop_voice() + else: + if waiting_for_answer == false and waiting_for_input == false and while_dialog_animation == false: + $FX/CharacterVoice.stop_voice() # stop the current voice as well + play_audio("passing") + _load_next_event() + if settings.has_section_key('dialog', 'propagate_input'): + var propagate_input: bool = settings.get_value('dialog', 'propagate_input') + if not propagate_input: + get_tree().set_input_as_handled() # when the text finished showing # plays audio, adds buttons, handles [nw] @@ -678,7 +685,7 @@ func _on_text_completed(): var wait_settings = result.get_string() waiting_time = float(wait_settings.split('=')[1]) - yield(get_tree().create_timer(waiting_time), "timeout") + $DialogicTimer.start(waiting_time); yield($DialogicTimer, "timeout") if dialog_index == current_index: _load_next_event() @@ -945,7 +952,11 @@ func event_handler(event: Dictionary): emit_signal("event_start", "wait", event) $TextBubble.visible = false waiting = true - yield(get_tree().create_timer(event['wait_seconds']), "timeout") + var timer = get_tree().create_timer(event['wait_seconds']) + if event.get('waiting_skippable', false): + event['waiting_timer_skippable'] = timer + yield(timer, "timeout") + event.erase('waiting_timer_skippable') waiting = false $TextBubble.visible = true emit_signal("event_end", "wait") diff --git a/addons/dialogic/Other/DialogicSharp.cs b/addons/dialogic/Other/DialogicSharp.cs index 9d8f3db34..6fcf4cadf 100644 --- a/addons/dialogic/Other/DialogicSharp.cs +++ b/addons/dialogic/Other/DialogicSharp.cs @@ -7,103 +7,121 @@ public static class DialogicSharp private static Script _dialogic = GD.Load