Beispiel #1
0
 public void Clear()
 {
     GameManager.Ins.MapEntities.Clear();
     if (this.WadFiles != null)
     {
         WadReader[] wadFiles = this.WadFiles;
         for (int i = 0; i < wadFiles.Length; i++)
         {
             WadReader wadReader = wadFiles[i];
             if (wadReader.BR != null)
             {
                 wadReader.BR.BaseStream.Dispose();
             }
         }
     }
     this.WadFiles = null;
     this.Header = default(BSPLoader.dheader_t);
     this.entitiesLump = null;
     this.texturesLump = null;
     this.vertexesLump.Clear();
     this.texinfoLump = null;
     this.facesLump.Clear();
     this.lightingLump = null;
     this.edgesLump.Clear();
     this.surfedgesLump = null;
     this.modelsLump.Clear();
     this.mipStructOffsets = null;
     UnityEngine.Object.Destroy(this.mapObject);
     this.Models.Clear();
     this.entities.Clear();
     this.Textures.Clear();
     this.tempLog = null;
     Resources.UnloadUnusedAssets();
 }
Beispiel #2
0
 public void Load()
 {
     this.Clear();
     if (!File.Exists(string.Concat(new string[]
     {
         GameManager.Ins.patch,
         GameManager.Ins.mod,
         "maps/",
         GameManager.Ins.mapName,
         ".bsp"
     })))
     {
         Debug.Log(string.Concat(new string[]
         {
             GameManager.Ins.patch,
             GameManager.Ins.mod,
             "maps/",
             GameManager.Ins.mapName,
             ".bsp"
         }));
         this.tempLog += "<color=#FF0000>Map file not found</color> \n";
         return;
     }
     this.BR = new BinaryReader(File.Open(string.Concat(new string[]
     {
         GameManager.Ins.patch,
         GameManager.Ins.mod,
         "maps/",
         GameManager.Ins.mapName,
         ".bsp"
     }), FileMode.Open));
     this.Header = this.ReadHeader();
     if (this.Header.version != 30)
     {
         this.tempLog += "<color=#FF0000>Invalid BSP version</color> \n";
         return;
     }
     this.tempLog += "====Start read file====\n";
     this.ReadEntities();
     this.ParseEntities(this.entitiesLump);
     this.ReadTextures();
     this.ReadVertexes();
     this.ReadTexinfo();
     this.ReadFaces();
     this.ReadLighting();
     this.ReadEdges();
     this.ReadSurfedges();
     this.ReadModels();
     for (int i = 0; i < this.entities.Count; i++)
     {
         this.LoadEntity(i);
     }
     this.tempLog += "======Finish======\n";
     Debug.Log(this.tempLog);
     this.BR.BaseStream.Dispose();
 }