コード例 #1
0
 InStory(ZNormalForm from)
     : this()
 {
     // Convert back into an operational form
       player = from.Objects(this);
       relations = from.Relations();
 }
コード例 #2
0
ファイル: ZJSON.cs プロジェクト: randym32/InteractiveText-CS
 /// <summary>
 /// This creates a normal form of the world given by the root
 /// </summary>
 /// <param name="root">The object that refers to everything else</param>
 /// <returns>null on error, otherwise the normalize representation</returns>
 static ZNormalForm buildNormalForm(InStory story)
 {
     // first, create the instance to hold it all
       var thing = new ZNormalForm();
       // go thru and add stuff
       thing.addRelation("instance", (Dictionary<ZObject, ZObject>) story.relations[InStory._instance]);
       foreach (var item in story.relations)
       {
      if (item.Value is SparseGraph<ZObject>)
         thing.addRelation((string) item.Key.name, (SparseGraph<ZObject>) item.Value);
       }
       thing.add((ZObject)story.player);
       thing.rootObject = ((ZObject)story.player).name;
       return thing;
 }