コード例 #1
0
 public void LoadLayers(WzImage mapImage, Board mapBoard)
 {
     for (int layer = 0; layer <= 7; layer++)
     {
         WzSubProperty   layerProp = (WzSubProperty)mapImage[layer.ToString()];
         WzImageProperty tSprop    = layerProp["info"]["tS"];
         string          tS        = null;
         if (tSprop != null)
         {
             tS = InfoTool.GetString(tSprop);
         }
         foreach (WzImageProperty obj in layerProp["obj"].WzProperties)
         {
             int                        x           = InfoTool.GetInt(obj["x"]);
             int                        y           = InfoTool.GetInt(obj["y"]);
             int                        z           = InfoTool.GetInt(obj["z"]);
             int                        zM          = InfoTool.GetInt(obj["zM"]);
             string                     oS          = InfoTool.GetString(obj["oS"]);
             string                     l0          = InfoTool.GetString(obj["l0"]);
             string                     l1          = InfoTool.GetString(obj["l1"]);
             string                     l2          = InfoTool.GetString(obj["l2"]);
             string                     name        = InfoTool.GetOptionalString(obj["name"]);
             MapleBool                  r           = InfoTool.GetOptionalBool(obj["r"]);
             MapleBool                  hide        = InfoTool.GetOptionalBool(obj["hide"]);
             MapleBool                  reactor     = InfoTool.GetOptionalBool(obj["reactor"]);
             MapleBool                  flow        = InfoTool.GetOptionalBool(obj["flow"]);
             int?                       rx          = InfoTool.GetOptionalTranslatedInt(obj["rx"]);
             int?                       ry          = InfoTool.GetOptionalTranslatedInt(obj["ry"]);
             int?                       cx          = InfoTool.GetOptionalTranslatedInt(obj["cx"]);
             int?                       cy          = InfoTool.GetOptionalTranslatedInt(obj["cy"]);
             string                     tags        = InfoTool.GetOptionalString(obj["tags"]);
             WzImageProperty            questParent = obj["quest"];
             List <ObjectInstanceQuest> questInfo   = null;
             if (questParent != null)
             {
                 questInfo = new List <ObjectInstanceQuest>();
                 foreach (WzIntProperty info in questParent.WzProperties)
                 {
                     questInfo.Add(new ObjectInstanceQuest(int.Parse(info.Name), (QuestState)info.Value));
                 }
             }
             bool       flip    = InfoTool.GetBool(obj["f"]);
             ObjectInfo objInfo = ObjectInfo.Get(oS, l0, l1, l2);
             if (objInfo == null)
             {
                 continue;
             }
             Layer l = mapBoard.Layers[layer];
             mapBoard.BoardItems.TileObjs.Add((LayeredItem)objInfo.CreateInstance(l, mapBoard, x, y, z, zM, r, hide, reactor, flow, rx, ry, cx, cy, name, tags, questInfo, flip, false));
             l.zMList.Add(zM);
         }
         WzImageProperty tileParent = layerProp["tile"];
         foreach (WzImageProperty tile in tileParent.WzProperties)
         {
             int      x        = InfoTool.GetInt(tile["x"]);
             int      y        = InfoTool.GetInt(tile["y"]);
             int      zM       = InfoTool.GetInt(tile["zM"]);
             string   u        = InfoTool.GetString(tile["u"]);
             int      no       = InfoTool.GetInt(tile["no"]);
             Layer    l        = mapBoard.Layers[layer];
             TileInfo tileInfo = TileInfo.Get(tS, u, no.ToString());
             mapBoard.BoardItems.TileObjs.Add((LayeredItem)tileInfo.CreateInstance(l, mapBoard, x, y, int.Parse(tile.Name), zM, false, false));
             l.zMList.Add(zM);
         }
     }
 }
コード例 #2
0
ファイル: MapLoader.cs プロジェクト: xnum/hasuite
 private static void LoadLayers(WzImage mapImage, Board mapBoard)
 {
     for (int layer = 0; layer <= 7; layer++)
     {
         WzSubProperty    layerProp = (WzSubProperty)mapImage[layer.ToString()];
         IWzImageProperty tSprop    = layerProp["info"]["tS"];
         string           tS        = null;
         if (tSprop != null)
         {
             tS = InfoTool.GetString(tSprop);
         }
         foreach (IWzImageProperty obj in layerProp["obj"].WzProperties)
         {
             int x = InfoTool.GetInt(obj["x"]);
             int y = InfoTool.GetInt(obj["y"]);
             int z = InfoTool.GetInt(obj["z"]);
             //int zM = InfoTool.GetInt(obj["zM"]);
             string                     oS          = InfoTool.GetString(obj["oS"]);
             string                     l0          = InfoTool.GetString(obj["l0"]);
             string                     l1          = InfoTool.GetString(obj["l1"]);
             string                     l2          = InfoTool.GetString(obj["l2"]);
             string                     name        = InfoTool.GetOptionalString(obj["name"]);
             MapleBool                  r           = InfoTool.GetOptionalBool(obj["r"]);
             MapleBool                  hide        = InfoTool.GetOptionalBool(obj["hide"]);
             MapleBool                  reactor     = InfoTool.GetOptionalBool(obj["reactor"]);
             MapleBool                  flow        = InfoTool.GetOptionalBool(obj["flow"]);
             int?                       rx          = InfoTool.GetOptionalTranslatedInt(obj["rx"]);
             int?                       ry          = InfoTool.GetOptionalTranslatedInt(obj["ry"]);
             int?                       cx          = InfoTool.GetOptionalTranslatedInt(obj["cx"]);
             int?                       cy          = InfoTool.GetOptionalTranslatedInt(obj["cy"]);
             string                     tags        = InfoTool.GetOptionalString(obj["tags"]);
             IWzImageProperty           questParent = obj["quest"];
             List <ObjectInstanceQuest> questInfo   = null;
             if (questParent != null)
             {
                 foreach (WzCompressedIntProperty info in questParent.WzProperties)
                 {
                     questInfo.Add(new ObjectInstanceQuest(int.Parse(info.Name), (QuestState)info.Value));
                 }
             }
             bool             flip        = InfoTool.GetBool(obj["f"]);
             IWzImageProperty objInfoProp = Program.InfoManager.ObjectSets[oS][l0][l1][l2];
             if (objInfoProp.HCTag == null)
             {
                 objInfoProp.HCTag = ObjectInfo.Load((WzSubProperty)objInfoProp, oS, l0, l1, l2);
             }
             ObjectInfo objInfo = (ObjectInfo)objInfoProp.HCTag;
             mapBoard.BoardItems.TileObjs.Add((LayeredItem)objInfo.CreateInstance(mapBoard.Layers[layer], mapBoard, x, y, z, r, hide, reactor, flow, rx, ry, cx, cy, name, tags, questInfo, flip, false, false));
         }
         IWzImageProperty tileParent = layerProp["tile"];
         for (int i = 0; i < tileParent.WzProperties.Count; i++)
         //foreach (IWzImageProperty tile in layerProp["tile"].WzProperties)
         {
             IWzImageProperty tile = tileParent.WzProperties[i];
             int x = InfoTool.GetInt(tile["x"]);
             int y = InfoTool.GetInt(tile["y"]);
             //int zM = InfoTool.GetInt(tile["zM"]);
             string           u            = InfoTool.GetString(tile["u"]);
             int              no           = InfoTool.GetInt(tile["no"]);
             IWzImageProperty tileInfoProp = Program.InfoManager.TileSets[tS][u][no.ToString()];
             if (tileInfoProp.HCTag == null)
             {
                 tileInfoProp.HCTag = TileInfo.Load((WzCanvasProperty)tileInfoProp, tS, u, no.ToString());
             }
             TileInfo tileInfo = (TileInfo)tileInfoProp.HCTag;
             mapBoard.BoardItems.TileObjs.Add((LayeredItem)tileInfo.CreateInstance(mapBoard.Layers[layer], mapBoard, x, y, i /*zM*/, false, false, false));
         }
     }
 }