From b125584d05edb73651a15e8ceae813bc2450cf95 Mon Sep 17 00:00:00 2001 From: Ding Yuntian <1491671119@qq.com> Date: Tue, 13 Aug 2024 02:43:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Resources/Yarn/OptionTest/OptionTest1.yarn | 1 + Assets/Scripts/Dialog System/YarnOption.cs | 3 +++ Assets/Scripts/Test/OptionTest.cs | 15 +++++++++++++++ 3 files changed, 19 insertions(+) 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