branches =
branch0:
name: "Start"
text: "This is a wall of text. #1 {Terra: Hello there! My name is Terra! What's yours?} You find your desperation outweighing Cora’s vague warning. You feel miserable, paranoid, and your skin grows more raw and drenched by the minute. This is the fourth wall of text. This is the fifth wall of text. {Terra: My you're cute!} This is the sixth wall of text."
options:
branch1: "Bad"
branch2: "Good"
branch1:
name: "Bad Intro"
text: "You're a bad person!"
options:
branch3: "To Gate"
branch2:
name: "Good Intro"
text: "You've done good things!"
options:
branch3: "To Gate"
所以我正在开发一款基于文本的游戏。主要的分支路径被分成对象,故事文本是一个叫做“文本”的属性;主要的游戏逻辑涉及读取“text:”属性中的巨大字符串并将其写入 HTML 文档。
为了便于阅读,有没有什么办法可以从单独的文件中读取我的文本,并以某种方式让内容显示为我的“文本:”属性的字符串?在这个项目上工作变得越来越混乱和困难,一个 7000 多个单词的故事把我的主要代码弄得乱七八糟。