剧情+对话完善

This commit is contained in:
SoulliesOfficial
2026-07-21 15:24:42 -04:00
parent 8f230831e9
commit 810d019619
161 changed files with 7271 additions and 1893 deletions

View File

@@ -1,76 +1,51 @@
using UnityEngine;
using Yarn.Unity;
using Ichni.Story;
using Yarn.Unity;
namespace Ichni.Story.YarnFunctions
{
/// <summary>
/// 提供可以直接在 Yarn 脚本中调用的全局变量读写指令
/// 完全兼容旧系统中的自定义函数(避免旧的 .yarn 报错),
/// 底层统一指向全新的 StoryVariables 枢纽。
/// ichni Official 的永久剧情变量 Yarn 接口
/// <para>所有变量都属于当前 StoryData 对应的章节存档。请不要在新台本中使用 Yarn 原生的
/// <c>&lt;&lt;declare&gt;&gt;</c>、<c>&lt;&lt;set&gt;&gt;</c> 或 <c>$variable</c>,它们会创建不受本章节回滚系统管理的临时变量。</para>
/// <para>推荐语法:<c>&lt;&lt;set_bool "c0_intro_read" true&gt;&gt;</c>、
/// <c>&lt;&lt;if get_int("c0_route") == 1&gt;&gt;</c>。</para>
/// </summary>
public static class VariableCommands
{
[YarnCommand("set_bool")]
public static void SetBool(string key, bool value)
{
StoryVariables.SetBool(key, value);
}
public static void SetBool(string key, bool value) => StoryProgress.SetBoolAndRefresh(key, value);
[YarnFunction("get_bool")]
public static bool GetBool(string key)
{
return StoryVariables.GetBool(key);
}
[YarnCommand("set_int")]
public static void SetInt(string key, int value)
{
StoryVariables.SetInt(key, value);
}
public static bool GetBool(string key) => StoryVariables.GetBool(key);
[YarnCommand("set_int")]
public static void SetInt(string key, int value) => StoryProgress.SetIntAndRefresh(key, value);
[YarnCommand("add_int")]
public static void AddInt(string key, int delta) => StoryProgress.AddIntAndRefresh(key, delta);
[YarnCommand("modify_int")]
public static void ModifyInt(string key, int modification)
{
int currentValue = StoryVariables.GetInt(key);
StoryVariables.SetInt(key, currentValue + modification);
}
[YarnFunction("get_int")]
public static int GetInt(string key)
{
return StoryVariables.GetInt(key);
}
public static int GetInt(string key) => StoryVariables.GetInt(key);
[YarnCommand("set_float")]
public static void SetFloat(string key, float value)
{
StoryVariables.SetFloat(key, value);
}
public static void SetFloat(string key, float value) => StoryProgress.SetFloatAndRefresh(key, value);
[YarnCommand("modify_float")]
public static void ModifyFloat(string key, float modification)
{
float currentValue = StoryVariables.GetFloat(key);
StoryVariables.SetFloat(key, currentValue + modification);
}
[YarnCommand("add_float")]
public static void AddFloat(string key, float delta) => StoryProgress.AddFloatAndRefresh(key, delta);
[YarnFunction("get_float")]
public static float GetFloat(string key)
{
return StoryVariables.GetFloat(key);
}
public static float GetFloat(string key) => StoryVariables.GetFloat(key);
[YarnCommand("set_string")]
public static void SetString(string key, string value)
{
StoryVariables.SetString(key, value);
}
public static void SetString(string key, string value) => StoryProgress.SetStringAndRefresh(key, value);
[YarnFunction("get_string")]
public static string GetString(string key)
{
return StoryVariables.GetString(key);
}
public static string GetString(string key) => StoryVariables.GetString(key);
[YarnCommand("remove_variable")]
public static void RemoveVariable(string key) => StoryProgress.RemoveVariableAndRefresh(key);
[YarnFunction("has_variable")]
public static bool HasVariable(string key) => StoryVariables.HasVariable(key);
}
}