本文整理汇总了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);
}
}
示例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);
}
}