public void LoadDungeonsRooms() { int objCount = 0, chestCount = 0, itemCount = 0, blockCount = 0, torchCount = 0, pitsCount = 0, spritesCount = 0, roomCount = 0; for (int i = 0; i < 296; i++) { try { all_rooms[i] = new RoomSave((short)i); objCount += all_rooms[i].tilesObjects.Count; chestCount += all_rooms[i].chest_list.Count; itemCount += all_rooms[i].pot_items.Count; blockCount += all_rooms[i].blocks.Count; torchCount += all_rooms[i].torches.Count; pitsCount += all_rooms[i].damagepit ? 1 : 0; spritesCount += all_rooms[i].sprites.Count; if (all_rooms[i].tilesObjects.Count != 0) { roomCount++; } } catch (Exception e) { //WriteLog("Error : " + e.Message.ToString(), Color.Red); return; } }/* * LoadedProjectStatistics.blocksRooms = blockCount; * LoadedProjectStatistics.chestsRooms = chestCount; * LoadedProjectStatistics.chestsRoomsLength = ((ROM.DATA[ConstantsReader.GetAddress("chests_length_pointer") + 1] << 8) + (ROM.DATA[ConstantsReader.GetAddress("chests_length_pointer")])) / 3; * LoadedProjectStatistics.blocksRoomsLength = ((short)((ROM.DATA[ConstantsReader.GetAddress("blocks_length") + 1] << 8) + ROM.DATA[ConstantsReader.GetAddress("blocks_length")])) / 4; * LoadedProjectStatistics.torchesRoomsLength = 86;//(ROM.DATA[ConstantsReader.GetAddress("torches_length_pointer + 1] << 8) + ROM.DATA[ConstantsReader.GetAddress("torches_length_pointer]; * LoadedProjectStatistics.entrancesRooms = 132; * LoadedProjectStatistics.itemsRooms = itemCount; * LoadedProjectStatistics.pitsRooms = pitsCount; * LoadedProjectStatistics.pitsRoomsLength = (ROM.DATA[ConstantsReader.GetAddress("pit_count")] / 2); * LoadedProjectStatistics.torchesRooms = torchCount; * LoadedProjectStatistics.usedRooms = roomCount; * LoadedProjectStatistics.spritesRooms = spritesCount; * LoadedProjectStatistics.objectsRooms = objCount; * WriteLog("All dungeon rooms data loaded properly : ", Color.Green);*/ }
public void writeRooms(string path) { if (!Directory.Exists(path + "Dungeons")) { Directory.CreateDirectory(path + "Dungeons"); } if (!Directory.Exists(path + "Dungeons//Rooms")) { Directory.CreateDirectory(path + "Dungeons//Rooms"); } for (int i = 0; i < 296; i++) { RoomSave rs = new RoomSave((short)i); File.WriteAllText(path + "Dungeons//Rooms//Room " + i.ToString("D3") + ".json", JsonConvert.SerializeObject(rs, Formatting.None, new JsonSerializerSettings() { ReferenceLoopHandling = ReferenceLoopHandling.Ignore })); } }