沟通方案
原能力
为具体沟通情境拟定说法、顺序和可暂停的选择,保留当事人自己的表达。(细化版 p.2–3)
首选项目
Ink(MIT)。 Ink
匹配范围
用分支文本、choice 和状态变量承载备选沟通流程。
源码
Ink · public void ChooseChoiceIndex(
ink-engine-runtime/Story.cs · 1794–1807 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
public void ChooseChoiceIndex(int choiceIdx)
{
var choices = currentChoices;
Assert (choiceIdx >= 0 && choiceIdx < choices.Count, "choice out of range");
// Replace callstack with the one from the thread at the choosing point,
// so that we can jump into the right place in the flow.
// This is important in case the flow was forked by a new thread, which
// can create multiple leading edges for the story, each of
// which has its own context.
var choiceToChoose = choices [choiceIdx];
if(onMakeChoice != null) onMakeChoice(choiceToChoose);
state.callStack.currentThread = choiceToChoose.threadAtGeneration;
Ink · public string ToJson(
ink-engine-runtime/StoryState.cs · 37–50 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
public string ToJson() {
var writer = new SimpleJson.Writer();
WriteJson(writer);
return writer.ToString();
}
/// <summary>
/// Exports the current state to json format, in order to save the game.
/// For this overload you can pass in a custom stream, such as a FileStream.
/// </summary>
public void ToJson(Stream stream) {
var writer = new SimpleJson.Writer(stream);
WriteJson(writer);
}
实现与验收要点
方案内容、当事人调整、适用边界和风险提示。