Пример #1
0
 public void Load(string ifoName, string mapFolder, ZSC dec, ZSC build, Vector2 mapPosition)
 {
     this.ifo           = new IFO();
     this.ifo           = ContentManager.Instance().GetIFO(ifoName, mapFolder);
     this.decorationZSC = dec;
     this.buildingZSC   = build;
     for (int i = 0; i < this.ifo.listDecorationBlock.Count; i++)
     {
         for (int j = 0; j < this.ifo.listDecorationBlock[i].listDecoration.Count; j++)
         {
             int    objectID = this.ifo.listDecorationBlock[i].listDecoration[j].objectID;
             Entity entity   = new Entity();
             for (int k = 0; k < dec.listObject[objectID].list_mesh.Count; k++)
             {
                 ZMS zMS = new ZMS(this.graphics);
                 zMS.Load(ContentManager.GetRootPath() + dec.listMesh[(int)dec.listObject[objectID].list_mesh[k].mesh_id].path, ClientType.IROSE);
                 zMS.LoadTexture(ContentManager.GetRootPath(), this.graphics, dec.listMateriel[(int)dec.listObject[objectID].list_mesh[k].material_id]);
                 zMS.ApplyZSCData(dec.listObject[objectID], k);
                 entity.AddPart(zMS);
             }
             Vector3 position = default(Vector3);
             position.X = this.ifo.listDecorationBlock[i].listDecoration[j].position.X / 100f + 5200f;
             position.Y = this.ifo.listDecorationBlock[i].listDecoration[j].position.Y / 100f + 5200f;
             position.Z = this.ifo.listDecorationBlock[i].listDecoration[j].position.Z / 100f;
             Matrix matrix = Matrix.Identity;
             matrix *= Matrix.CreateScale(this.ifo.listDecorationBlock[i].listDecoration[j].scale);
             matrix *= Matrix.CreateFromQuaternion(new Quaternion(this.ifo.listDecorationBlock[i].listDecoration[j].rotation.W, this.ifo.listDecorationBlock[i].listDecoration[j].rotation.X, this.ifo.listDecorationBlock[i].listDecoration[j].rotation.Y, this.ifo.listDecorationBlock[i].listDecoration[j].rotation.Z));
             matrix *= Matrix.CreateTranslation(position);
             entity.ApplyTransformation(matrix);
             this.listEntity.Add(entity);
         }
     }
     for (int j = 0; j < this.ifo.listBuildingBlock[0].listBuilding.Count; j++)
     {
         int    objectID = this.ifo.listBuildingBlock[0].listBuilding[j].objectID;
         Entity entity   = new Entity();
         for (int k = 0; k < build.listObject[objectID].list_mesh.Count; k++)
         {
             ZMS zMS = new ZMS(this.graphics);
             zMS.Load(ContentManager.GetRootPath() + build.listMesh[(int)build.listObject[objectID].list_mesh[k].mesh_id].path, ClientType.IROSE);
             zMS.LoadTexture(ContentManager.GetRootPath(), this.graphics, build.listMateriel[(int)build.listObject[objectID].list_mesh[k].material_id]);
             zMS.ApplyZSCData(build.listObject[objectID], k);
             entity.AddPart(zMS);
         }
         Vector3 position = default(Vector3);
         position.X = this.ifo.listBuildingBlock[0].listBuilding[j].position.X / 100f + 5200f;
         position.Y = this.ifo.listBuildingBlock[0].listBuilding[j].position.Y / 100f + 5200f;
         position.Z = this.ifo.listBuildingBlock[0].listBuilding[j].position.Z / 100f;
         Matrix matrix = Matrix.Identity;
         matrix *= Matrix.CreateScale(this.ifo.listBuildingBlock[0].listBuilding[j].scale);
         matrix *= Matrix.CreateFromQuaternion(new Quaternion(this.ifo.listBuildingBlock[0].listBuilding[j].rotation.W, this.ifo.listBuildingBlock[0].listBuilding[j].rotation.X, this.ifo.listBuildingBlock[0].listBuilding[j].rotation.Y, this.ifo.listBuildingBlock[0].listBuilding[j].rotation.Z));
         matrix *= Matrix.CreateTranslation(position);
         entity.ApplyTransformation(matrix);
         this.listEntity.Add(entity);
     }
 }
Пример #2
0
        public void Load(int mapIndex)
        {
            ContentManager.Instance().ClearMapData();
            STB    sTB        = ContentManager.Instance().GetSTB("3DDATA\\STB\\LIST_ZONE.STB");
            string cellValue  = sTB.GetCellValue <string>(mapIndex, 2);
            string cellValue2 = sTB.GetCellValue <string>(mapIndex, 13);
            string cellValue3 = sTB.GetCellValue <string>(mapIndex, 12);

            this.mapFolder = Directory.GetParent(ContentManager.GetRootPath() + cellValue).FullName + "\\";
            this.minSizeX  = sTB.GetCellValue <int>(mapIndex, 10);
            this.minSizeY  = sTB.GetCellValue <int>(mapIndex, 11);
            this.maxSizeY  = this.minSizeY;
            this.maxSizeX  = this.minSizeX;
            while (File.Exists(string.Concat(new object[]
            {
                this.mapFolder,
                this.maxSizeX,
                "_",
                this.minSizeY,
                ".HIM"
            })))
            {
                this.maxSizeX++;
            }
            this.maxSizeX--;
            while (File.Exists(string.Concat(new object[]
            {
                this.mapFolder,
                this.minSizeX,
                "_",
                this.maxSizeY,
                ".HIM"
            })))
            {
                this.maxSizeY++;
            }
            this.maxSizeY--;
            this.terrain = new Terrain(this.graphics);
            this.terrain.Load(cellValue, cellValue2, cellValue3, this.mapFolder, this.minSizeX, this.minSizeY, this.maxSizeX, this.maxSizeY);
        }