当前位置: 首页>>代码示例>>C#>>正文


C# Dialog.AddNext方法代码示例

本文整理汇总了C#中Dialog.AddNext方法的典型用法代码示例。如果您正苦于以下问题:C# Dialog.AddNext方法的具体用法?C# Dialog.AddNext怎么用?C# Dialog.AddNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dialog的用法示例。


在下文中一共展示了Dialog.AddNext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Conversation1

        public static IConversation Conversation1()
        {
            //Create dialogs
            IDialog dialog1 = new Dialog("Hello. What is your name");
            IDialog dialog2 = new Dialog("Hello. My name is \"EndlessDialogs\"");
            IDialog dialog3 = new Dialog("What are you you?");
            IDialog dialog4 = new Dialog("I am a software library that help developers to make conversation system.");
            IDialog dialog5 = new Dialog("Got you.");

            //Create dialog connections. In this case it is linear conversation
            dialog1.AddNext(new[] { dialog2 });
            dialog2.AddNext(new[] { dialog3 });
            dialog3.AddNext(new[] { dialog4 });
            dialog4.AddNext(new[] { dialog5 });

            //Create a conversation
            IConversation conversation1 = new Conversation();
            conversation1.SetName("Conversation 1");
            conversation1.SetDescription("Demo: Scene1 - Conversation1 ('DemoSceneCreator.cs' - 'CreateScene1()')");
            conversation1.SetStartDialog(new[] { dialog1 });

            return conversation1;
        }
开发者ID:AntonyBaasan,项目名称:endlessdialogs,代码行数:23,代码来源:DemoSceneCreator.cs

示例2: Conversation2Branched

        public static IConversation Conversation2Branched()
        {
            //Create dialogs
            IDialog dialog1 = new Dialog("Hello. What is your name?");
            IDialog dialogAnwer1 = new Dialog("My name is Player1");
            IDialog dialogAnwer2 = new Dialog("My name is Player2");
            IDialog dialogAnwer3 = new Dialog("My name is Player3");

            IDialog dialog2 = new Dialog("Nice to meet you Player1");
            IDialog dialog3 = new Dialog("Nice to meet you Player2");
            IDialog dialog4 = new Dialog("Nice to meet you Player3");

            IDialog dialog5 = new Dialog("Bye!.");
            IDialog dialog6 = new Dialog("Fare well ???.");

            //Create dialog connections. In this case it is linear conversation
            dialog1.AddNext(new[] { dialogAnwer1, dialogAnwer2, dialogAnwer3 });

            dialogAnwer1.AddNext(new[] { dialog2 });
            dialogAnwer2.AddNext(new[] { dialog3 });
            dialogAnwer3.AddNext(new[] { dialog4 });

            dialog2.AddNext(new[] { dialog5 });
            dialog3.AddNext(new[] { dialog5 });
            dialog4.AddNext(new[] { dialog5 });

            dialog5.AddNext(new[] { dialog6 });

            //Create a conversation
            IConversation conversation1 = new Conversation();
            conversation1.SetName("Conversation 2 (Branched)");
            conversation1.SetDescription("Demo: Scene1 - Conversation2 ('DemoSceneCreator.cs' - 'CreateScene2()')");
            conversation1.SetStartDialog(new[] { dialog1 });

            return conversation1;
        }
开发者ID:AntonyBaasan,项目名称:endlessdialogs,代码行数:36,代码来源:DemoSceneCreator.cs

示例3: If_Waiting_For_Answer_And_Answered_Correctly_GetNext_Should_Work_Correctly

        public void If_Waiting_For_Answer_And_Answered_Correctly_GetNext_Should_Work_Correctly()
        {
            Dialog d1 = new Dialog("d1");
            Dialog d2 = new Dialog("d2");
            Dialog d3 = new Dialog("d3");
            Dialog d4 = new Dialog("d4");
            Dialog d5 = new Dialog("d5");

            d1.AddNext(d3);
            d2.AddNext(d3);
            d3.AddNext(new[] { d4, d5 });

            conversation.SetStartDialog(new[] { d1, d2 }.ToList());

            conversation.Answer(d1);
            IEnumerable<IDialog> nextDialogs = conversation.CurrentDialogs();
            Assert.AreEqual(d3, nextDialogs.First());

            conversation.Next();
            //Assert.AreEqual(dialog3, nextDialogs.First());
            Assert.AreEqual(d4, conversation.CurrentDialogs().First());
        }
开发者ID:AntonyBaasan,项目名称:endlessdialogs,代码行数:22,代码来源:ConversationBranchingTests.cs


注:本文中的Dialog.AddNext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。