diff --git a/Samples/Space/Dialogue/Sally.yarn b/Samples/Space/Dialogue/Sally.yarn index d19ffcc..ab8f7df 100644 --- a/Samples/Space/Dialogue/Sally.yarn +++ b/Samples/Space/Dialogue/Sally.yarn @@ -5,8 +5,10 @@ position: 524,111 --- <> Player: Hey, Sally. #line:794945 - Sally: Uah! #line:2dc39b - Sally: You snuck up on me. #line:34de2f + // these HTML-style tags will only work with the ConvertHTMLToBBCode setting + // enabled on the provided example LineView + Sally: Uah! #line:2dc39b + Sally: You snuck up on me! #line:34de2f Sally: Don't do that. #line:dcc2bc <> Player: Hey. #line:a8e70c diff --git a/Samples/Space/Dialogue/SpaceYarnProject.tres b/Samples/Space/Dialogue/SpaceYarnProject.tres index a49831f..6cfba24 100644 --- a/Samples/Space/Dialogue/SpaceYarnProject.tres +++ b/Samples/Space/Dialogue/SpaceYarnProject.tres @@ -7,7 +7,7 @@ resource_name = "Default (en)" script = ExtResource("2") LocaleCode = "en" -_stringTableJSON = "{\"line:03f451b\":{\"Language\":\"en\",\"ID\":\"line:03f451b\",\"Text\":\"Welcome to the {0} Sample! Try talking to Sally and the Ship.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Intro.yarn\",\"Node\":\"SpaceIntro\",\"LineNumber\":\"6\",\"Lock\":\"43e3ae38\",\"Comment\":\"\"},\"line:07ee50d\":{\"Language\":\"en\",\"ID\":\"line:07ee50d\",\"Text\":\"A VISUAL NOVEL EXAMPLE\",\"Original\":null,\"File\":\"res://Samples/VisualNovel/Dialogue/VNExampleDialogue.yarn\",\"Node\":\"Start\",\"LineNumber\":\"14\",\"Lock\":\"243448f9\",\"Comment\":\"\"},\"line:03a9f6d\":{\"Language\":\"en\",\"ID\":\"line:03a9f6d\",\"Text\":\"Eve: Finally, a quiet day at the office. Maybe I\\u0027ll be able to get some work done.\",\"Original\":null,\"File\":\"res://Samples/VisualNovel/Dialogue/VNExampleDialogue.yarn\",\"Node\":\"Start\",\"LineNumber\":\"19\",\"Lock\":\"498c5529\",\"Comment\":\"\"},\"line:07f4eac\":{\"Language\":\"en\",\"ID\":\"line:07f4eac\",\"Text\":\"Adam: Hey Eve! I have a question!\",\"Original\":null,\"File\":\"res://Samples/VisualNovel/Dialogue/VNExampleDialogue.yarn\",\"Node\":\"Start\",\"LineNumber\":\"28\",\"Lock\":\"459fb170\",\"Comment\":\"\"},\"line:794945\":{\"Language\":\"en\",\"ID\":\"line:794945\",\"Text\":\"Player: Hey, Sally.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally\",\"LineNumber\":\"7\",\"Lock\":\"2bc75173\",\"Comment\":\"\"},\"line:0721506\":{\"Language\":\"en\",\"ID\":\"line:0721506\",\"Text\":\"Eve: Oh no...\",\"Original\":null,\"File\":\"res://Samples/VisualNovel/Dialogue/VNExampleDialogue.yarn\",\"Node\":\"Start\",\"LineNumber\":\"29\",\"Lock\":\"62b75da4\",\"Comment\":\"\"},\"line:2dc39b\":{\"Language\":\"en\",\"ID\":\"line:2dc39b\",\"Text\":\"Sally: Uah!\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally\",\"LineNumber\":\"8\",\"Lock\":\"b85fb55f\",\"Comment\":\"\"},\"line:0b52843\":{\"Language\":\"en\",\"ID\":\"line:0b52843\",\"Text\":\"Eve gets upset with Adam\",\"Original\":null,\"File\":\"res://Samples/VisualNovel/Dialogue/VNExampleDialogue.yarn\",\"Node\":\"Start\",\"LineNumber\":\"35\",\"Lock\":\"8ace03d4\",\"Comment\":\"\"},\"line:34de2f\":{\"Language\":\"en\",\"ID\":\"line:34de2f\",\"Text\":\"Sally: You snuck up on me.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally\",\"LineNumber\":\"9\",\"Lock\":\"35e4db4c\",\"Comment\":\"\"},\"line:09f21f4\":{\"Language\":\"en\",\"ID\":\"line:09f21f4\",\"Text\":\"Eve: WHAT DO YOU WANT???\",\"Original\":null,\"File\":\"res://Samples/VisualNovel/Dialogue/VNExampleDialogue.yarn\",\"Node\":\"Start\",\"LineNumber\":\"37\",\"Lock\":\"0e3efc57\",\"Comment\":\"\"},\"line:dcc2bc\":{\"Language\":\"en\",\"ID\":\"line:dcc2bc\",\"Text\":\"Sally: Don\\u0027t do that.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally\",\"LineNumber\":\"10\",\"Lock\":\"ac04c57a\",\"Comment\":\"\"},\"line:0b7be61\":{\"Language\":\"en\",\"ID\":\"line:0b7be61\",\"Text\":\"Adam: I just wanted to see if you liked using YarnSpinner.\",\"Original\":null,\"File\":\"res://Samples/VisualNovel/Dialogue/VNExampleDialogue.yarn\",\"Node\":\"Start\",\"LineNumber\":\"38\",\"Lock\":\"fba93c4b\",\"Comment\":\"\"},\"line:a8e70c\":{\"Language\":\"en\",\"ID\":\"line:a8e70c\",\"Text\":\"Player: Hey.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally\",\"LineNumber\":\"12\",\"Lock\":\"52e9bd6e\",\"Comment\":\"\"},\"line:01942dd\":{\"Language\":\"en\",\"ID\":\"line:01942dd\",\"Text\":\"Eve: ... It\\u0027s fine. Thanks. Now leave me alone.\",\"Original\":null,\"File\":\"res://Samples/VisualNovel/Dialogue/VNExampleDialogue.yarn\",\"Node\":\"Start\",\"LineNumber\":\"39\",\"Lock\":\"d9e33ebb\",\"Comment\":\"\"},\"line:0af7f86\":{\"Language\":\"en\",\"ID\":\"line:0af7f86\",\"Text\":\"Sally: Hi.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally\",\"LineNumber\":\"13\",\"Lock\":\"41aa2f03\",\"Comment\":\"\"},\"line:0c481f8\":{\"Language\":\"en\",\"ID\":\"line:0c481f8\",\"Text\":\"Adam asks Eve a question\",\"Original\":null,\"File\":\"res://Samples/VisualNovel/Dialogue/VNExampleDialogue.yarn\",\"Node\":\"Start\",\"LineNumber\":\"40\",\"Lock\":\"8dc9fa94\",\"Comment\":\"\"},\"line:5d7a7c\":{\"Language\":\"en\",\"ID\":\"line:5d7a7c\",\"Text\":\"Anything exciting happen on your watch?\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally\",\"LineNumber\":\"16\",\"Lock\":\"5a28d06b\",\"Comment\":\"\"},\"line:05eb26a\":{\"Language\":\"en\",\"ID\":\"line:05eb26a\",\"Text\":\"Adam: Do you think YarnSpinner is easy to use?\",\"Original\":null,\"File\":\"res://Samples/VisualNovel/Dialogue/VNExampleDialogue.yarn\",\"Node\":\"Start\",\"LineNumber\":\"41\",\"Lock\":\"bb786882\",\"Comment\":\"\"},\"line:0a7e39\":{\"Language\":\"en\",\"ID\":\"line:0a7e39\",\"Text\":\"Sorry about the console.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally\",\"LineNumber\":\"18\",\"Lock\":\"6c4c5826\",\"Comment\":\"\"},\"line:0e8ce79\":{\"Language\":\"en\",\"ID\":\"line:0e8ce79\",\"Text\":\"Eve: Not when you\\u0027re bothering me.\",\"Original\":null,\"File\":\"res://Samples/VisualNovel/Dialogue/VNExampleDialogue.yarn\",\"Node\":\"Start\",\"LineNumber\":\"42\",\"Lock\":\"37abe891\",\"Comment\":\"\"},\"line:0facf7\":{\"Language\":\"en\",\"ID\":\"line:0facf7\",\"Text\":\"See you later.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally\",\"LineNumber\":\"20\",\"Lock\":\"e241648d\",\"Comment\":\"\"},\"line:0cb4316\":{\"Language\":\"en\",\"ID\":\"line:0cb4316\",\"Text\":\"Adam: Oh, I didn\\u0027t realize you were busy. Sorry.\",\"Original\":null,\"File\":\"res://Samples/VisualNovel/Dialogue/VNExampleDialogue.yarn\",\"Node\":\"Start\",\"LineNumber\":\"43\",\"Lock\":\"0ed8f46b\",\"Comment\":\"\"},\"line:8c3f98\":{\"Language\":\"en\",\"ID\":\"line:8c3f98\",\"Text\":\"Sally: Not really.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally_Watch\",\"LineNumber\":\"29\",\"Lock\":\"c6bcc3d6\",\"Comment\":\"\"},\"line:0794753\":{\"Language\":\"en\",\"ID\":\"line:0794753\",\"Text\":\"Eve: Ok, now to finally write that visual novel.\",\"Original\":null,\"File\":\"res://Samples/VisualNovel/Dialogue/VNExampleDialogue.yarn\",\"Node\":\"Start\",\"LineNumber\":\"50\",\"Lock\":\"3a4e6cf6\",\"Comment\":\"\"},\"line:24c418\":{\"Language\":\"en\",\"ID\":\"line:24c418\",\"Text\":\"Sally: Same old nebula, doing the same old thing.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally_Watch\",\"LineNumber\":\"30\",\"Lock\":\"d3a88d93\",\"Comment\":\"\"},\"line:0c39b43\":{\"Language\":\"en\",\"ID\":\"line:0c39b43\",\"Text\":\"Eve: I can finally write my epic romance about -\",\"Original\":null,\"File\":\"res://Samples/VisualNovel/Dialogue/VNExampleDialogue.yarn\",\"Node\":\"Start\",\"LineNumber\":\"53\",\"Lock\":\"75318ced\",\"Comment\":\"\"},\"line:df4eaf\":{\"Language\":\"en\",\"ID\":\"line:df4eaf\",\"Text\":\"Sally: Oh, Ship wanted to see you. Go say hi to it.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally_Watch\",\"LineNumber\":\"31\",\"Lock\":\"5f2cc23a\",\"Comment\":\"\"},\"line:04432b5\":{\"Language\":\"en\",\"ID\":\"line:04432b5\",\"Text\":\"Eve: Wait... where\\u0027s my laptop? It\\u0027s not here.\",\"Original\":null,\"File\":\"res://Samples/VisualNovel/Dialogue/VNExampleDialogue.yarn\",\"Node\":\"Start\",\"LineNumber\":\"58\",\"Lock\":\"3a394f4f\",\"Comment\":\"\"},\"line:1fea6c\":{\"Language\":\"en\",\"ID\":\"line:1fea6c\",\"Text\":\"Player: Already done!\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally_Watch\",\"LineNumber\":\"34\",\"Lock\":\"599299b9\",\"Comment\":\"\"},\"line:0a21105\":{\"Language\":\"en\",\"ID\":\"line:0a21105\",\"Text\":\"Eve: Adam! Have you seen my laptop???\",\"Original\":null,\"File\":\"res://Samples/VisualNovel/Dialogue/VNExampleDialogue.yarn\",\"Node\":\"Start\",\"LineNumber\":\"60\",\"Lock\":\"8b7f1f59\",\"Comment\":\"\"},\"line:5df323\":{\"Language\":\"en\",\"ID\":\"line:5df323\",\"Text\":\"Sally: Go say hi again.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally_Watch\",\"LineNumber\":\"35\",\"Lock\":\"fed05ceb\",\"Comment\":\"\"},\"line:062467b\":{\"Language\":\"en\",\"ID\":\"line:062467b\",\"Text\":\"Eve: ADDDDAAAMMMMMMM!!!\",\"Original\":null,\"File\":\"res://Samples/VisualNovel/Dialogue/VNExampleDialogue.yarn\",\"Node\":\"Start\",\"LineNumber\":\"65\",\"Lock\":\"3c0876b7\",\"Comment\":\"\"},\"line:60c282\":{\"Language\":\"en\",\"ID\":\"line:60c282\",\"Text\":\"Sally: Bye.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally_Exit\",\"LineNumber\":\"44\",\"Lock\":\"29ecd7c6\",\"Comment\":\"\"},\"line:0d7e78e\":{\"Language\":\"en\",\"ID\":\"line:0d7e78e\",\"Text\":\"THE END.\",\"Original\":null,\"File\":\"res://Samples/VisualNovel/Dialogue/VNExampleDialogue.yarn\",\"Node\":\"Start\",\"LineNumber\":\"69\",\"Lock\":\"f953533f\",\"Comment\":\"\"},\"line:d7df49\":{\"Language\":\"en\",\"ID\":\"line:d7df49\",\"Text\":\"Sally: Yeah. Don\\u0027t do it again.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally_Sorry\",\"LineNumber\":\"52\",\"Lock\":\"0ce38920\",\"Comment\":\"\"},\"line:5837f2\":{\"Language\":\"en\",\"ID\":\"line:5837f2\",\"Text\":\"Ship: Hey, friend.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"7\",\"Lock\":\"b709c42e\",\"Comment\":\"Line metadata: firstline\"},\"line:ship09\":{\"Language\":\"en\",\"ID\":\"line:ship09\",\"Text\":\"Player: Hi, Ship.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"8\",\"Lock\":\"0f857079\",\"Comment\":\"\"},\"line:ship10\":{\"Language\":\"en\",\"ID\":\"line:ship10\",\"Text\":\"Player: How\\u0027s space?\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"9\",\"Lock\":\"a741d6b2\",\"Comment\":\"\"},\"line:ship11\":{\"Language\":\"en\",\"ID\":\"line:ship11\",\"Text\":\"Ship: Oh, man.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"10\",\"Lock\":\"778a5a83\",\"Comment\":\"\"},\"line:ship12\":{\"Language\":\"en\",\"ID\":\"line:ship12\",\"Text\":\"Ship: It\\u0027s HUGE!\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"12\",\"Lock\":\"88f3fb99\",\"Comment\":\"\"},\"line:ship13\":{\"Language\":\"en\",\"ID\":\"line:ship13\",\"Text\":\"Ship: Hey!!\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"16\",\"Lock\":\"5a889e0a\",\"Comment\":\"\"},\"line:ship01\":{\"Language\":\"en\",\"ID\":\"line:ship01\",\"Text\":\"Player: Sally said you wanted to see me?\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"21\",\"Lock\":\"be6b00c6\",\"Comment\":\"\"},\"line:ship03\":{\"Language\":\"en\",\"ID\":\"line:ship03\",\"Text\":\"Ship: She totally did!!\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"23\",\"Lock\":\"171196c4\",\"Comment\":\"\"},\"line:ship04\":{\"Language\":\"en\",\"ID\":\"line:ship04\",\"Text\":\"Ship: She wanted me to tell you...\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"25\",\"Lock\":\"e1980146\",\"Comment\":\"\"},\"line:ship05\":{\"Language\":\"en\",\"ID\":\"line:ship05\",\"Text\":\"Ship: If you ever go off-watch without resetting the console again...\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"26\",\"Lock\":\"b6808e22\",\"Comment\":\"\"},\"line:ship06\":{\"Language\":\"en\",\"ID\":\"line:ship06\",\"Text\":\"Ship: She\\u0027ll flay you alive!\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"28\",\"Lock\":\"c1c63254\",\"Comment\":\"\"},\"line:ship07\":{\"Language\":\"en\",\"ID\":\"line:ship07\",\"Text\":\"Player: Uh.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"31\",\"Lock\":\"727bb97b\",\"Comment\":\"\"}}" +_stringTableJSON = "{\"line:03f451b\":{\"Language\":\"en\",\"ID\":\"line:03f451b\",\"Text\":\"Welcome to the {0} Sample! Try talking to Sally and the Ship.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Intro.yarn\",\"Node\":\"SpaceIntro\",\"LineNumber\":\"6\",\"Lock\":\"43e3ae38\",\"Comment\":\"\"},\"line:794945\":{\"Language\":\"en\",\"ID\":\"line:794945\",\"Text\":\"Player: Hey, Sally.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally\",\"LineNumber\":\"7\",\"Lock\":\"2bc75173\",\"Comment\":\"\"},\"line:2dc39b\":{\"Language\":\"en\",\"ID\":\"line:2dc39b\",\"Text\":\"Sally: \\u003Cwave freq=20 amp=14\\u003EUah!\\u003C/wave\\u003E\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally\",\"LineNumber\":\"10\",\"Lock\":\"cb48fbdb\",\"Comment\":\"\"},\"line:34de2f\":{\"Language\":\"en\",\"ID\":\"line:34de2f\",\"Text\":\"Sally: \\u003Cshake rate=20.0 level=5 connected=1\\u003EYou snuck up on me!\\u003C/shake\\u003E\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally\",\"LineNumber\":\"11\",\"Lock\":\"ea5f1db2\",\"Comment\":\"\"},\"line:dcc2bc\":{\"Language\":\"en\",\"ID\":\"line:dcc2bc\",\"Text\":\"Sally: Don\\u0027t do that.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally\",\"LineNumber\":\"12\",\"Lock\":\"ac04c57a\",\"Comment\":\"\"},\"line:a8e70c\":{\"Language\":\"en\",\"ID\":\"line:a8e70c\",\"Text\":\"Player: Hey.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally\",\"LineNumber\":\"14\",\"Lock\":\"52e9bd6e\",\"Comment\":\"\"},\"line:0af7f86\":{\"Language\":\"en\",\"ID\":\"line:0af7f86\",\"Text\":\"Sally: Hi.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally\",\"LineNumber\":\"15\",\"Lock\":\"41aa2f03\",\"Comment\":\"\"},\"line:5d7a7c\":{\"Language\":\"en\",\"ID\":\"line:5d7a7c\",\"Text\":\"Anything exciting happen on your watch?\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally\",\"LineNumber\":\"18\",\"Lock\":\"5a28d06b\",\"Comment\":\"\"},\"line:0a7e39\":{\"Language\":\"en\",\"ID\":\"line:0a7e39\",\"Text\":\"Sorry about the console.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally\",\"LineNumber\":\"20\",\"Lock\":\"6c4c5826\",\"Comment\":\"\"},\"line:0facf7\":{\"Language\":\"en\",\"ID\":\"line:0facf7\",\"Text\":\"See you later.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally\",\"LineNumber\":\"22\",\"Lock\":\"e241648d\",\"Comment\":\"\"},\"line:8c3f98\":{\"Language\":\"en\",\"ID\":\"line:8c3f98\",\"Text\":\"Sally: Not really.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally_Watch\",\"LineNumber\":\"31\",\"Lock\":\"c6bcc3d6\",\"Comment\":\"\"},\"line:24c418\":{\"Language\":\"en\",\"ID\":\"line:24c418\",\"Text\":\"Sally: Same old nebula, doing the same old thing.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally_Watch\",\"LineNumber\":\"32\",\"Lock\":\"d3a88d93\",\"Comment\":\"\"},\"line:df4eaf\":{\"Language\":\"en\",\"ID\":\"line:df4eaf\",\"Text\":\"Sally: Oh, Ship wanted to see you. Go say hi to it.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally_Watch\",\"LineNumber\":\"33\",\"Lock\":\"5f2cc23a\",\"Comment\":\"\"},\"line:1fea6c\":{\"Language\":\"en\",\"ID\":\"line:1fea6c\",\"Text\":\"Player: Already done!\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally_Watch\",\"LineNumber\":\"36\",\"Lock\":\"599299b9\",\"Comment\":\"\"},\"line:5df323\":{\"Language\":\"en\",\"ID\":\"line:5df323\",\"Text\":\"Sally: Go say hi again.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally_Watch\",\"LineNumber\":\"37\",\"Lock\":\"fed05ceb\",\"Comment\":\"\"},\"line:60c282\":{\"Language\":\"en\",\"ID\":\"line:60c282\",\"Text\":\"Sally: Bye.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally_Exit\",\"LineNumber\":\"46\",\"Lock\":\"29ecd7c6\",\"Comment\":\"\"},\"line:d7df49\":{\"Language\":\"en\",\"ID\":\"line:d7df49\",\"Text\":\"Sally: Yeah. Don\\u0027t do it again.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Sally.yarn\",\"Node\":\"Sally_Sorry\",\"LineNumber\":\"54\",\"Lock\":\"0ce38920\",\"Comment\":\"\"},\"line:5837f2\":{\"Language\":\"en\",\"ID\":\"line:5837f2\",\"Text\":\"Ship: Hey, friend.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"7\",\"Lock\":\"b709c42e\",\"Comment\":\"Line metadata: firstline\"},\"line:ship09\":{\"Language\":\"en\",\"ID\":\"line:ship09\",\"Text\":\"Player: Hi, Ship.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"8\",\"Lock\":\"0f857079\",\"Comment\":\"\"},\"line:ship10\":{\"Language\":\"en\",\"ID\":\"line:ship10\",\"Text\":\"Player: How\\u0027s space?\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"9\",\"Lock\":\"a741d6b2\",\"Comment\":\"\"},\"line:ship11\":{\"Language\":\"en\",\"ID\":\"line:ship11\",\"Text\":\"Ship: Oh, man.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"10\",\"Lock\":\"778a5a83\",\"Comment\":\"\"},\"line:ship12\":{\"Language\":\"en\",\"ID\":\"line:ship12\",\"Text\":\"Ship: It\\u0027s HUGE!\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"12\",\"Lock\":\"88f3fb99\",\"Comment\":\"\"},\"line:ship13\":{\"Language\":\"en\",\"ID\":\"line:ship13\",\"Text\":\"Ship: Hey!!\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"16\",\"Lock\":\"5a889e0a\",\"Comment\":\"\"},\"line:ship01\":{\"Language\":\"en\",\"ID\":\"line:ship01\",\"Text\":\"Player: Sally said you wanted to see me?\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"21\",\"Lock\":\"be6b00c6\",\"Comment\":\"\"},\"line:ship03\":{\"Language\":\"en\",\"ID\":\"line:ship03\",\"Text\":\"Ship: She totally did!!\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"23\",\"Lock\":\"171196c4\",\"Comment\":\"\"},\"line:ship04\":{\"Language\":\"en\",\"ID\":\"line:ship04\",\"Text\":\"Ship: She wanted me to tell you...\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"25\",\"Lock\":\"e1980146\",\"Comment\":\"\"},\"line:ship05\":{\"Language\":\"en\",\"ID\":\"line:ship05\",\"Text\":\"Ship: If you ever go off-watch without resetting the console again...\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"26\",\"Lock\":\"b6808e22\",\"Comment\":\"\"},\"line:ship06\":{\"Language\":\"en\",\"ID\":\"line:ship06\",\"Text\":\"Ship: She\\u0027ll flay you alive!\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"28\",\"Lock\":\"c1c63254\",\"Comment\":\"\"},\"line:ship07\":{\"Language\":\"en\",\"ID\":\"line:ship07\",\"Text\":\"Player: Uh.\",\"Original\":null,\"File\":\"res://Samples/Space/Dialogue/Ship.yarn\",\"Node\":\"Ship\",\"LineNumber\":\"31\",\"Lock\":\"727bb97b\",\"Comment\":\"\"}}" stringsFile = "" [resource] diff --git a/Samples/Space/SpaceSample.tscn b/Samples/Space/SpaceSample.tscn index a112ceb..5a0ff41 100644 --- a/Samples/Space/SpaceSample.tscn +++ b/Samples/Space/SpaceSample.tscn @@ -146,6 +146,9 @@ yarnProject = ExtResource("1") startNode = "SpaceIntro" startAutomatically = true +[node name="LineView" parent="YarnSpinnerCanvasLayer" index="2"] +ConvertHTMLToBBCode = true + [node name="LineText" parent="YarnSpinnerCanvasLayer/LineView/ViewControl" index="0"] theme_override_font_sizes/normal_font_size = 34 diff --git a/addons/YarnSpinner-Godot/Runtime/Views/LineView.cs b/addons/YarnSpinner-Godot/Runtime/Views/LineView.cs index a1c7fdb..3269184 100644 --- a/addons/YarnSpinner-Godot/Runtime/Views/LineView.cs +++ b/addons/YarnSpinner-Godot/Runtime/Views/LineView.cs @@ -1,4 +1,5 @@ using System; +using System.Text.RegularExpressions; using System.Threading.Tasks; using Godot; @@ -84,7 +85,7 @@ public void Interrupt() public static async Task FadeAlpha(Control control, float from, float to, float fadeTime, TaskInterruptToken stopToken = null) { - var mainTree = (SceneTree) Engine.GetMainLoop(); + var mainTree = (SceneTree)Engine.GetMainLoop(); stopToken?.Start(); @@ -104,7 +105,7 @@ public static async Task FadeAlpha(Control control, float from, float to, float var fraction = timeElapsed / fadeTime; timeElapsed += mainTree.Root.GetProcessDeltaTime(); - float a = Mathf.Lerp(from, to, (float) fraction); + float a = Mathf.Lerp(from, to, (float)fraction); color.A = a; control.Modulate = color; await DefaultActions.Wait(mainTree.Root.GetProcessDeltaTime()); @@ -139,7 +140,7 @@ public static async Task FadeAlpha(Control control, float from, float to, float public static async Task Typewriter(RichTextLabel text, float lettersPerSecond, Action onCharacterTyped, TaskInterruptToken stopToken = null) { - var mainTree = (SceneTree) Engine.GetMainLoop(); + var mainTree = (SceneTree)Engine.GetMainLoop(); stopToken?.Start(); // Start with everything invisible @@ -251,6 +252,19 @@ public partial class LineView : Node, DialogueViewBase /// /// [Export] public NodePath viewControlPath; + /// + /// If enabled, matched pairs of the characters '<' and `>` will be replaced by + /// [ and ] respectively, so that you can write, for example, + /// writing my text in your yarn script would be converted to + /// [b]my text[/b] at runtime to take advantage of the RichTextLabel's + /// BBCode feature. Turning this feature on, would prevent you from using the characters + /// '<' or '>' in your dialogue. + /// If you need a more advanced or nuanced way to use + /// BBCode in your yarn scripts, it's recommended to implement your own custom + /// dialogue view. + /// https://docs.godotengine.org/en/stable/tutorials/ui/bbcode_in_richtextlabel.html + /// + [Export] public bool ConvertHTMLToBBCode; public Control viewControl; @@ -446,7 +460,7 @@ public override void _Ready() if (continueButton == null && !string.IsNullOrEmpty(continueButtonPath.ToString())) { - continueButton = (Control) GetNode(continueButtonPath); + continueButton = (Control)GetNode(continueButtonPath); } continueButton?.Connect("pressed", new Callable(this, nameof(OnContinueClicked))); @@ -457,6 +471,17 @@ public override void _Ready() SetViewAlpha(0); SetCanvasInteractable(false); + if (ConvertHTMLToBBCode) + { + if (characterNameText != null) + { + characterNameText.BbcodeEnabled = true; + } + if (lineText != null) + { + lineText.BbcodeEnabled = true; + } + } } private void SetViewAlpha(float alpha) @@ -502,7 +527,7 @@ public void InterruptLine(LocalizedLine dialogueLine, Action onInterruptLineFini { currentLine = dialogueLine; - if (currentStopToken is {CanInterrupt: true}) + if (currentStopToken is { CanInterrupt: true }) { currentStopToken.Interrupt(); } @@ -608,23 +633,8 @@ async Task PresentLine() // If we have a character name text view, show the character // name in it, and show the rest of the text in our main // text view. - if (characterNameText.BbcodeEnabled) - { - characterNameText.Text = dialogueLine.CharacterName; - } - else - { - characterNameText.Text = dialogueLine.CharacterName; - } - - if (lineText.BbcodeEnabled) - { - lineText.Text = dialogueLine.TextWithoutCharacterName.Text; - } - else - { - lineText.Text = dialogueLine.TextWithoutCharacterName.Text; - } + characterNameText.Text = dialogueLine.CharacterName; + lineText.Text = dialogueLine.TextWithoutCharacterName.Text; } else { @@ -642,6 +652,15 @@ async Task PresentLine() } } + if (ConvertHTMLToBBCode) + { + const string htmlTagPattern= @"<(.*?)>"; + if (characterNameText != null) + { + characterNameText.Text = Regex.Replace(characterNameText.Text , htmlTagPattern, "[$1]"); + } + lineText.Text = Regex.Replace(lineText.Text, htmlTagPattern, "[$1]"); + } if (useTypewriterEffect) { // If we're using the typewriter effect, hide all of the @@ -652,9 +671,10 @@ async Task PresentLine() else { // Show all characters - lineText.VisibleRatio = 100; + lineText.VisibleRatio = 1; } + // If we're using the fade effect, start it, and wait for it to // finish. if (useFadeEffect) @@ -791,8 +811,8 @@ public void OnContinueClicked() // example, if a DialogueAdvanceInput had signalled us.) UserRequestedViewAdvancement(); } - - + + /// public void DialogueComplete() { diff --git a/docs/Usage.md b/docs/Usage.md index d737852..c1b1be7 100644 --- a/docs/Usage.md +++ b/docs/Usage.md @@ -30,9 +30,33 @@ You can integrate the story in your .yarn scripts with your C# code in several w This repository also comes with a few default [dialogue views](https://docs.yarnspinner.dev/using-yarnspinner-with-unity/components/dialogue-view). These will do the basics for you of displaying lines and options in Godot UI components. -The [samples](./Samples) in this repository give an example of how to set up a scene in Godot with the necessary views. You can try out the DefaultDialogueSystem.tscn sample file in the Scenes/ directory as a base of your own view. In the likely event you want to change the look and feel of this provided UI, you may be able to accomplish this just by theming and rearranging the components. For more customization, consider basing your view on the provided samples. You might want to include custom text animations, font changes, etc., in your custom view. See [Creating Custom Dialogue Views](https://docs.yarnspinner.dev/using-yarnspinner-with-unity/components/dialogue-view/custom-dialogue-views). Rather than subclassing DialogueViewBase as in Unity, however, you implement the DialogueViewBase interface and can subclass any type which derives from Godot's Node class. +The [samples](./Samples) in this repository give an example of how to set up a scene in Godot with the necessary views. -Keep in mind you can also write smaller, single-purpose views, such as a dialogue view that reads each line of dialogue, checks for a `#portrait:` metadata tag on the line, and if it is present, and sets the appropriate dialogue portrait texture. +You can try out the DefaultDialogueSystem.tscn sample file in the Scenes/ directory as a base of your own view. +In the likely event you want to change the look and feel of this provided UI, you may be able to accomplish this just by +theming and rearranging the components. +For more customization, consider creating your own view based on the provided samples. You might want to include custom text +animations, font changes, etc., in your custom view. See [Creating Custom Dialogue Views](https://docs.yarnspinner.dev/using-yarnspinner-with-unity/components/dialogue-view/custom-dialogue-views). +Rather than subclassing DialogueViewBase as in Unity, however, you implement the DialogueViewBase interface and can subclass any type which derives from Godot's Node class. + + +If you would like to use [BBCode](https://docs.godotengine.org/en/stable/tutorials/ui/bbcode_in_richtextlabel.html) in your yarn scripts to style and animate your text, you have a few options. +You can't use BBCode directly in .yarn scripts, as YarnSpinner uses the `[]` characters for its own [Markup](https://yarnspinner.dev/docs/writing/markup/) feature. +One option is to use the Markup feature in your .yarn scripts, and write a custom view that fills in BBCode tags based on your markup. + +The example LineView in the plugin provides the `ConvertHTMLToBBCode` setting, +a simple way to use HTML style tags and convert them to BBCode at runtime, but this may not suit every use case. +It will attempt to convert paired instances of `<`and `>` to `[` and `]`. For example `Hello!` would be converted +to the BBCode `[wave amp=5]Hello![/wave]` + +Here's an example of this feature in action, using some built-in BBCode effects. + + +https://github.com/YarnSpinnerTool/YarnSpinner-Godot/assets/9920963/5e372fcf-07c3-4764-90d1-43d789a1c6b6 + + +Keep in mind you can also write smaller, single-purpose views, such as a dialogue view that reads each line of dialogue, +checks for a `#portrait:` metadata tag on the line, and if it is present, and displays the appropriate dialogue portrait texture. # Localization