using System.Collections; using System.Collections.Generic; using UnityEngine; using Yarn.Markup; namespace AibisDream { public static class YarnUtil { private const string COMMAND_ATTR = "command"; private const string COMMAND_PROP = "name"; public static bool HasCommandAttr(this MarkupParseResult text) { return text.TryGetAttributeWithName(COMMAND_ATTR, out var attribute); } public static bool TryGetCommandAttr(this MarkupParseResult text, out string commandName) { bool res = text.TryGetAttributeWithName(COMMAND_ATTR, out var attribute); commandName = res ? attribute.Properties[COMMAND_PROP].StringValue : null; return res; } } }