diff --git a/Assets/Resources/Yarn/OptionTest/OptionTest1.yarn b/Assets/Resources/Yarn/OptionTest/OptionTest1.yarn index 6d69025f1..7bf3a089d 100644 --- a/Assets/Resources/Yarn/OptionTest/OptionTest1.yarn +++ b/Assets/Resources/Yarn/OptionTest/OptionTest1.yarn @@ -5,6 +5,7 @@ <> 我: 加载测试场景 #line:0a67910 我: 提供两个按钮进行点击 #line:0cb2011 +我: 代码部分在Asset->Scripts->Test->OptionTest #line:0344182 [command name=show_buttons /] #line:006eeaa -> 按钮1 #line:0db0f08 我: 按下了按钮1 #line:0d84460 diff --git a/Assets/Scripts/Dialog System/YarnOption.cs b/Assets/Scripts/Dialog System/YarnOption.cs index 37485fd89..56601a9c6 100644 --- a/Assets/Scripts/Dialog System/YarnOption.cs +++ b/Assets/Scripts/Dialog System/YarnOption.cs @@ -18,6 +18,9 @@ namespace AibisDream this.onOptionSelected = onOptionSelected; } + /// + /// ѡе + /// public string Text { get diff --git a/Assets/Scripts/Test/OptionTest.cs b/Assets/Scripts/Test/OptionTest.cs index f9eb82554..006a389e6 100644 --- a/Assets/Scripts/Test/OptionTest.cs +++ b/Assets/Scripts/Test/OptionTest.cs @@ -13,11 +13,20 @@ namespace AibisDream.Test void Start() { + // ʼʱעCommand + // һΪ[command name=xxx]IJ + // ڶעĺYarnߵѡʱ DialogController.Instance.RegisterOptionCommand("show_buttons", ShowButtons); + + // Ҫ panel = transform.GetChild(0).gameObject; prefab = Resources.Load("Perfabs/UI/Choice Button"); } + /// + /// ע + /// + /// ʱṩѡ public void ShowButtons(YarnOption[] options) { foreach (YarnOption option in options) @@ -25,8 +34,13 @@ namespace AibisDream.Test var instance = Instantiate(prefab); instance.transform.SetParent(panel.transform); instance.GetComponentInChildren().text = option.Text; + instance.GetComponent