Command Option 增强及示例
This commit is contained in:
@@ -10,6 +10,8 @@ namespace AibisDream
|
||||
{
|
||||
private DialogueRunner dialogueRunner;
|
||||
|
||||
private VariableStorageBehaviour _variableStorage;
|
||||
|
||||
private Dictionary<string, Action<YarnOption[]>> commandMap = new();
|
||||
|
||||
public bool quickRunMode;
|
||||
@@ -17,8 +19,33 @@ namespace AibisDream
|
||||
private void Start()
|
||||
{
|
||||
dialogueRunner = GetComponentInChildren<DialogueRunner>();
|
||||
_variableStorage = GetComponentInChildren<InMemoryVariableStorage>();
|
||||
}
|
||||
|
||||
#region 变量操作
|
||||
|
||||
public bool TryGetVariable<T>(string variableName, out T result)
|
||||
{
|
||||
return _variableStorage.TryGetValue(variableName, out result);
|
||||
}
|
||||
|
||||
public void SetVariable(string variableName, string value)
|
||||
{
|
||||
_variableStorage.SetValue(variableName, value);
|
||||
}
|
||||
|
||||
public void SetVariable(string variableName, bool value)
|
||||
{
|
||||
_variableStorage.SetValue(variableName, value);
|
||||
}
|
||||
|
||||
public void SetVariable(string variableName, float value)
|
||||
{
|
||||
_variableStorage.SetValue(variableName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 开启对话
|
||||
/// </summary>
|
||||
@@ -158,7 +185,6 @@ namespace AibisDream
|
||||
[YarnCommand("fade_in")]
|
||||
public static IEnumerator FadeIn(float duration = 1)
|
||||
{
|
||||
Debug.Log("fade_in");
|
||||
return MainUIController.Instance.FadeInSync(duration);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user