/// <summary> /// Read file. /// </summary> /// <returns>True if succeeded, otherwise false.</returns> private bool Read() { try { for (int i = 0; i < elvPakFile.PakInnerFileCount; i++) { var elvdata = elvPakFile.GetFileInner(i); for (int x = 0; x < (VerticesBlockSide * VerticesBlockSide); x++) { // var tile = elvdata.Read<MCTile>(); var tile = new MCTile(); tile.Elevation = elvdata[(x * 8) + 0]; tile.Mask = elvdata[(x * 8) + 1]; tile.Byte2 = elvdata[(x * 8) + 2]; tile.Byte3 = elvdata[(x * 8) + 3]; tile.Terrain = BitConverter.ToUInt16(elvdata, (x * 8) + 4); tile.OverlayTile = BitConverter.ToInt16(elvdata, (x * 8) + 6); Vertice[(i * VerticesBlockSide * VerticesBlockSide) + x] = tile; } //if (!ReadMapBlock(elvdata)) // return false; } } catch (Exception e) { MechCommanderUnity.LogMessage(e.Message + " " + e.InnerException); return(false); } return(true); }
/// <summary> /// Read file. /// </summary> /// <returns>True if succeeded, otherwise false.</returns> private bool Read() { try { for (int i = 0; i < objPakFile.PakInnerFileCount; i++) { var objdata = objPakFile.GetFileInner(i); if (objdata == null || objdata.Length == 0) { continue; } for (int x = 0; x < (objdata.Length / 11); x++) { var obj = objdata.Skip((x * 11)).ToArray().Read <MCObj>(); Objs.Add(obj); } } } catch (Exception e) { MechCommanderUnity.LogMessage(e.Message); return(false); } return(true); }