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


C# RelayTwo.LoadAll方法代码示例

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


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

示例1: InstantiateDialoguesFromDatabase

        public void InstantiateDialoguesFromDatabase()
        {
            {
                RelayTwo relay = new RelayTwo();
                relay.CreateTable(DialogueNode.TABLE_NAME);
                DialogueRunner runner = new DialogueRunner(relay, Language.SWEDISH);

                TimedDialogueNode d1 = runner.Create<TimedDialogueNode>("c", Language.SWEDISH, "d1") as TimedDialogueNode;
                d1.speaker = "A";

                TimedDialogueNode d2 = runner.Create<TimedDialogueNode>("c", Language.SWEDISH, "d2");
                d2.speaker = "B";

                relay.SaveAll("conversation.xml");
            }

            {
                RelayTwo relay = new RelayTwo();
                relay.LoadAll("conversation.xml");
                DialogueRunner runner = new DialogueRunner(relay, Language.SWEDISH);

                TimedDialogueNode d1 = runner.GetDialogueNode("c", "d1") as TimedDialogueNode;
                TimedDialogueNode d2 = runner.GetDialogueNode("c", "d2") as TimedDialogueNode;

                Assert.AreEqual("A", d1.speaker);
                Assert.AreEqual("B", d2.speaker);
            }
        }
开发者ID:substans,项目名称:Grimm,代码行数:28,代码来源:DialogueRunnerTest.cs

示例2: SetupTingsThenSaveAndLoadFromDisk

        public void SetupTingsThenSaveAndLoadFromDisk()
        {
            {
                TingRunner tingRunner = CreateTingRunnerWithSomeRoom();

                Animal bo = tingRunner.CreateTing<Animal>("Bo", new WorldCoordinate("SomeRoom", IntPoint.Zero));
                bo.species = "cow";
                bo.age = 10;
                Animal howly = tingRunner.CreateTing<Animal>("Howly", new WorldCoordinate("SomeRoom", IntPoint.Zero));
                howly.species = "owl";

                Assert.AreEqual("cow", bo.species);
                Assert.AreEqual(10, bo.age);
                Assert.AreEqual("owl", howly.species);
                Assert.AreEqual(0, howly.age); // <- default value

                howly.age = 35;

                relay.SaveAll("farm.json");
            }

            {
                relay = new RelayTwo();
                relay.LoadAll("farm.json");
                TingRunner tingRunner = new TingRunner(relay, new RoomRunner(relay));

                Animal bo = tingRunner.GetTing("Bo") as Animal;
                Animal howly = tingRunner.GetTing("Howly") as Animal;

                Assert.AreEqual("cow", bo.species);
                Assert.AreEqual(10, bo.age);
                Assert.AreEqual("owl", howly.species);
                Assert.AreEqual(35, howly.age);
            }
        }
开发者ID:substans,项目名称:TingTing,代码行数:35,代码来源:TingRunnerTest.cs


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