public void Load(GridPool Grid, string loadpath) { List <BuildPartsPool>[] baseParts = Singleton <CraftCommandListBaseObject> .Instance.BaseParts; FileStream fileStream = new FileStream(loadpath, FileMode.Open, FileAccess.Read); Encoding utF8 = Encoding.UTF8; BinaryReader br = new BinaryReader((Stream)fileStream, utF8); if (br != null) { PngFile.SkipPng(br); int num1 = (int)br.ReadChar(); char ch = br.ReadChar(); if (!ch.Equals('P')) { fileStream.Seek(-2L, SeekOrigin.Current); } this.data.MaxFloorNum = br.ReadInt32(); this.data.nPutPartsNum = br.ReadInt32(); Vector3 vector3; while (!ch.Equals('P')) { vector3.x = (__Null)br.ReadDouble(); vector3.y = (__Null)br.ReadDouble(); vector3.z = (__Null)br.ReadDouble(); this.data.GridPos.Add(vector3); int num2 = (int)br.ReadChar(); ch = br.ReadChar(); if (!ch.Equals('P')) { fileStream.Seek(-2L, SeekOrigin.Current); } } int num3 = (int)br.ReadChar(); ch = br.ReadChar(); if (!ch.Equals('U')) { fileStream.Seek(-2L, SeekOrigin.Current); } while (!ch.Equals('U')) { this.data.GridUseState.Add(br.ReadBoolean()); int num2 = (int)br.ReadChar(); ch = br.ReadChar(); if (!ch.Equals('U')) { fileStream.Seek(-2L, SeekOrigin.Current); } } int num4 = (int)br.ReadChar(); ch = br.ReadChar(); if (!ch.Equals('F')) { fileStream.Seek(-2L, SeekOrigin.Current); } while (!ch.Equals('F')) { this.data.nFloorPartsHeight.Add(br.ReadInt32()); int num2 = (int)br.ReadChar(); ch = br.ReadChar(); if (!ch.Equals('F')) { fileStream.Seek(-2L, SeekOrigin.Current); } } int num5 = (int)br.ReadChar(); ch = br.ReadChar(); if (!ch.Equals('S')) { fileStream.Seek(-2L, SeekOrigin.Current); } int index1 = 0; int index2 = 0; int num6 = 0; this.data.SmallGridState.Add(new List <List <int> >()); this.data.SmallGridOnParts.Add(new List <List <int[]> >()); this.data.SmallGridOnStackWall.Add(new List <List <int[]> >()); this.data.SmallGridCanRoofState.Add(new List <List <int> >()); this.data.SmallGridInRoomState.Add(new List <List <bool> >()); this.data.SmallGridState[index1].Add(new List <int>()); this.data.SmallGridOnParts[index1].Add(new List <int[]>()); this.data.SmallGridOnStackWall[index1].Add(new List <int[]>()); this.data.SmallGridCanRoofState[index1].Add(new List <int>()); this.data.SmallGridInRoomState[index1].Add(new List <bool>()); while (!ch.Equals('S')) { this.data.SmallGridState[index1][index2].Add(br.ReadInt32()); int[] numArray1 = new int[7]; for (int index3 = 0; index3 < numArray1.Length; ++index3) { numArray1[index3] = br.ReadInt32(); } this.data.SmallGridOnParts[index1][index2].Add(numArray1); int[] numArray2 = new int[9]; for (int index3 = 0; index3 < numArray2.Length; ++index3) { numArray2[index3] = br.ReadInt32(); } this.data.SmallGridOnStackWall[index1][index2].Add(numArray2); this.data.SmallGridCanRoofState[index1][index2].Add(br.ReadInt32()); this.data.SmallGridInRoomState[index1][index2].Add(br.ReadBoolean()); int num2 = (int)br.ReadChar(); ch = br.ReadChar(); if (!ch.Equals('S')) { fileStream.Seek(-2L, SeekOrigin.Current); } ++num6; if (num6 == 4) { num6 = 0; ++index2; if (index2 != this.data.MaxFloorNum) { this.data.SmallGridState[index1].Add(new List <int>()); this.data.SmallGridOnParts[index1].Add(new List <int[]>()); this.data.SmallGridOnStackWall[index1].Add(new List <int[]>()); this.data.SmallGridCanRoofState[index1].Add(new List <int>()); this.data.SmallGridInRoomState[index1].Add(new List <bool>()); } if (index2 == this.data.MaxFloorNum) { index2 = 0; ++index1; this.data.SmallGridState.Add(new List <List <int> >()); this.data.SmallGridOnParts.Add(new List <List <int[]> >()); this.data.SmallGridOnStackWall.Add(new List <List <int[]> >()); this.data.SmallGridCanRoofState.Add(new List <List <int> >()); this.data.SmallGridInRoomState.Add(new List <List <bool> >()); this.data.SmallGridState[index1].Add(new List <int>()); this.data.SmallGridOnParts[index1].Add(new List <int[]>()); this.data.SmallGridOnStackWall[index1].Add(new List <int[]>()); this.data.SmallGridCanRoofState[index1].Add(new List <int>()); this.data.SmallGridInRoomState[index1].Add(new List <bool>()); } } } int num7 = (int)br.ReadChar(); ch = br.ReadChar(); if (!ch.Equals('B')) { fileStream.Seek(-2L, SeekOrigin.Current); } List <int> intList1 = new List <int>(); List <int> intList2 = new List <int>(); while (!ch.Equals('B')) { this.data.BuildPartsGridKind.Add(br.ReadInt32()); this.data.BuildPartsKind.Add(br.ReadInt32()); this.data.BuildPartsFloor.Add(br.ReadInt32()); vector3.x = (__Null)br.ReadDouble(); vector3.y = (__Null)br.ReadDouble(); vector3.z = (__Null)br.ReadDouble(); this.data.BuildPartsPos.Add(vector3); Quaternion quaternion; quaternion.x = (__Null)br.ReadDouble(); quaternion.y = (__Null)br.ReadDouble(); quaternion.z = (__Null)br.ReadDouble(); quaternion.w = (__Null)br.ReadDouble(); this.data.BuildPartsRot.Add(quaternion); this.data.BuildPartsPutGridInfosNum.Add(br.ReadInt32()); intList1.Clear(); intList2.Clear(); for (int index3 = 0; index3 < this.data.BuildPartsPutGridInfosNum[this.data.BuildPartsPutGridInfosNum.Count - 1]; ++index3) { intList1.Add(br.ReadInt32()); intList2.Add(br.ReadInt32()); } this.data.BuildPartsPutGridInfos.Add(intList1); this.data.BuildPartsPutSmallGridInfos.Add(intList2); int num2 = (int)br.ReadChar(); ch = br.ReadChar(); if (!ch.Equals('B')) { fileStream.Seek(-2L, SeekOrigin.Current); } } int num8 = (int)br.ReadChar(); ch = br.ReadChar(); if (!ch.Equals('A')) { fileStream.Seek(-2L, SeekOrigin.Current); } bool[] flagArray = new bool[this.data.GridPos.Count]; while (!ch.Equals('A')) { for (int index3 = 0; index3 < flagArray.Length; ++index3) { flagArray[index3] = br.ReadBoolean(); } this.data.tmpGridActiveList.Add(flagArray); this.data.tmpGridActiveListUpdate.Add(br.ReadBoolean()); this.data.MaxPutHeight.Add(br.ReadInt32()); int num2 = (int)br.ReadChar(); ch = br.ReadChar(); if (!ch.Equals('A')) { fileStream.Seek(-2L, SeekOrigin.Current); } } br.Close(); } if (this.data.SmallGridState[this.data.SmallGridState.Count - 1][this.data.SmallGridState[this.data.SmallGridState.Count - 1].Count - 1].Count == 0) { this.data.SmallGridState.RemoveAt(this.data.SmallGridState.Count - 1); this.data.SmallGridOnParts.RemoveAt(this.data.SmallGridOnParts.Count - 1); this.data.SmallGridOnStackWall.RemoveAt(this.data.SmallGridOnStackWall.Count - 1); this.data.SmallGridCanRoofState.RemoveAt(this.data.SmallGridCanRoofState.Count - 1); this.data.SmallGridInRoomState.RemoveAt(this.data.SmallGridInRoomState.Count - 1); } Singleton <CraftCommandListBaseObject> .Instance.nMaxFloorCnt = this.data.MaxFloorNum; Singleton <CraftCommandListBaseObject> .Instance.nPutPartsNum = this.data.nPutPartsNum; List <GameObject> list1 = Grid.GetList(); List <GridInfo> Grid1 = new List <GridInfo>(); using (List <GameObject> .Enumerator enumerator = list1.GetEnumerator()) { while (enumerator.MoveNext()) { GameObject current = enumerator.Current; Grid1.Add((GridInfo)current.GetComponent <GridInfo>()); } } int num = this.data.GridPos.Count - list1.Count; if (num > 0) { for (int index = 0; index < num; ++index) { Grid.Get(); } } for (int index1 = 0; index1 < list1.Count; ++index1) { list1[index1].SetActive(true); list1[index1].get_transform().set_localPosition(this.data.GridPos[index1]); Grid1[index1].DelFloor(0); for (int floorNum = Grid1[index1].GetFloorNum(); floorNum < this.data.MaxFloorNum; ++floorNum) { Grid1[index1].AddFloor(); } for (int index2 = 0; index2 < this.data.MaxFloorNum; ++index2) { Grid1[index1].SetUseState(index2, this.data.GridUseState[index2 + Grid1[index1].GetFloorNum() * index1]); Grid1[index1].nFloorPartsHeight[index2] = this.data.nFloorPartsHeight[index2]; for (int index3 = 0; index3 < 4; ++index3) { for (int index4 = 0; index4 < 7; ++index4) { Grid1[index1].ChangeSmallGrid(index3, this.data.SmallGridState[index1][index2][index3], this.data.SmallGridOnParts[index1][index2][index3][index4], index2, false); } for (int index4 = 0; index4 < 5; ++index4) { Grid1[index1].ChangeSmallGrid(index3, this.data.SmallGridState[index1][index2][index3], this.data.SmallGridOnStackWall[index1][index2][index3][index4], index2, false); } if (index2 == 0) { Grid1[index1].ChangeSmallGridColor(index2, index3); } Grid1[index1].SetCanRoofSmallGrid(index3, index2, this.data.SmallGridCanRoofState[index1][index2][index3]); Grid1[index1].SetInRoomSmallGrid(index3, this.data.SmallGridInRoomState[index1][index2][index3], index2); } } } for (int floorcnt = 0; floorcnt < this.data.MaxFloorNum; ++floorcnt) { GridInfo.ChangeGridInfo(Grid1, floorcnt); } List <GameObject> gameObjectList = new List <GameObject>(); for (int index1 = 0; index1 < baseParts.Length; ++index1) { for (int index2 = 0; index2 < baseParts[index1].Count; ++index2) { List <GameObject> list2 = baseParts[index1][index2].GetList(); for (int index3 = 0; index3 < list2.Count; ++index3) { if (list2[index3].get_activeSelf()) { list2[index3].SetActive(false); } if (((BuildPartsInfo)list2[index3].GetComponent <BuildPartsInfo>()).nPutFloor != -1) { ((BuildPartsInfo)list2[index3].GetComponent <BuildPartsInfo>()).nPutFloor = -1; } } baseParts[index1][index2].ReserveListDel(0, 1); } } for (int index1 = 0; index1 < this.data.BuildPartsPos.Count; ++index1) { if (gameObjectList != baseParts[this.data.BuildPartsGridKind[index1]][this.data.BuildPartsKind[index1]].GetList()) { gameObjectList = baseParts[this.data.BuildPartsGridKind[index1]][this.data.BuildPartsKind[index1]].GetList(); } int ID = -1; baseParts[this.data.BuildPartsGridKind[index1]][this.data.BuildPartsKind[index1]].Get(ref ID); BuildPartsInfo component = (BuildPartsInfo)gameObjectList[ID].GetComponent <BuildPartsInfo>(); gameObjectList[ID].SetActive(true); gameObjectList[ID].get_transform().set_localPosition(this.data.BuildPartsPos[index1]); gameObjectList[ID].get_transform().set_localRotation(this.data.BuildPartsRot[index1]); component.nPutFloor = this.data.BuildPartsFloor[index1]; component.putGridInfos.Clear(); component.putSmallGridInfos.Clear(); for (int index2 = 0; index2 < this.data.BuildPartsPutGridInfos.Count; ++index2) { component.putGridInfos.Add(Singleton <CraftCommandListBaseObject> .Instance.BaseGridInfo[this.data.BuildPartsPutGridInfos[index1][index2]]); component.putSmallGridInfos.Add(this.data.BuildPartsPutSmallGridInfos[index1][index2]); } } Singleton <CraftCommandListBaseObject> .Instance.tmpGridActiveList = this.data.tmpGridActiveList; Singleton <CraftCommandListBaseObject> .Instance.tmpGridActiveListUpdate = this.data.tmpGridActiveListUpdate; Singleton <CraftCommandListBaseObject> .Instance.MaxPutHeight = this.data.MaxPutHeight; this.data.MaxFloorNum = 0; this.data.nPutPartsNum = 0; this.data.GridPos.Clear(); this.data.GridUseState.Clear(); this.data.nFloorPartsHeight.Clear(); this.data.SmallGridState.Clear(); this.data.SmallGridOnParts.Clear(); this.data.SmallGridOnStackWall.Clear(); this.data.SmallGridCanRoofState.Clear(); this.data.SmallGridInRoomState.Clear(); this.data.BuildPartsGridKind.Clear(); this.data.BuildPartsKind.Clear(); this.data.BuildPartsFloor.Clear(); this.data.BuildPartsPos.Clear(); this.data.BuildPartsRot.Clear(); this.data.BuildPartsPutGridInfos.Clear(); this.data.BuildPartsPutSmallGridInfos.Clear(); this.data.BuildPartsPutGridInfosNum.Clear(); this.data.tmpGridActiveList.Clear(); this.data.tmpGridActiveListUpdate.Clear(); this.data.MaxPutHeight.Clear(); }