public static void LoadRoomsFromRoomDirectory() { string roomDirectory = RoomDirectory(); Directory.CreateDirectory(roomDirectory); foreach (string f in Directory.GetFiles(roomDirectory, "*", SearchOption.AllDirectories)) { if (f.EndsWith(".room", StringComparison.OrdinalIgnoreCase)) { string name = Path.GetFullPath(f).RemovePrefix(roomDirectory).RemoveSuffix(".room"); Tools.Log($"Found room: \"{name}\""); var roomData = BuildFromRoomFile(f); DungeonHandler.Register(roomData); rooms.Add(name, roomData); } else if (f.EndsWith(".zip", StringComparison.OrdinalIgnoreCase)) { Tools.Log($"Found zipped rooms: \"{f}\""); var roomsData = BuildFromZipFile(f); foreach (var roomData in roomsData) { string name = roomData.room.name; Tools.Log($"Found room: \"{name}\""); DungeonHandler.Register(roomData); rooms.Add(roomData.room.name, roomData); } } } }
public static void LoadRoomsFromRoomDirectory() { Directory.CreateDirectory(roomDirectory); foreach (string f in Directory.GetFiles(roomDirectory)) { if (!f.EndsWith(".room")) { continue; } string name = Path.GetFileName(f); Tools.Log($"Found room: \"{name}\""); var roomData = BuildFromFile(f); DungeonHandler.Register(roomData); rooms.Add(name, roomData); } }
// Token: 0x0600003A RID: 58 RVA: 0x00003A08 File Offset: 0x00001C08 public static void LoadRoomsFromRoomDirectory() { Directory.CreateDirectory(RoomFactory.roomDirectory); foreach (string text in Directory.GetFiles(RoomFactory.roomDirectory)) { bool flag = !text.EndsWith(".room"); if (!flag) { string fileName = Path.GetFileName(text); Tools.Log <string>("Found room: \"" + fileName + "\""); RoomFactory.RoomData roomData = RoomFactory.BuildFromFile(text); DungeonHandler.Register(roomData); RoomFactory.rooms.Add(fileName, roomData); } } }
public static void RegisterShrineRoom(GameObject shrine, PrototypeDungeonRoom protoroom, string ID, Vector2 offset) { protoroom.category = PrototypeDungeonRoom.RoomCategory.NORMAL; DungeonPrerequisite[] emptyReqs = new DungeonPrerequisite[0]; Vector2 position = new Vector2(protoroom.Width / 2 + offset.x, protoroom.Height / 2 + offset.y); protoroom.placedObjectPositions.Add(position); var placeableContents = ScriptableObject.CreateInstance <DungeonPlaceable>(); placeableContents.width = 2; placeableContents.height = 2; placeableContents.respectsEncounterableDifferentiator = true; placeableContents.variantTiers = new List <DungeonPlaceableVariant>() { new DungeonPlaceableVariant() { percentChance = 1, nonDatabasePlaceable = shrine, prerequisites = emptyReqs, materialRequirements = new DungeonPlaceableRoomMaterialRequirement[0] } }; protoroom.placedObjects.Add(new PrototypePlacedObjectData() { contentsBasePosition = position, fieldData = new List <PrototypePlacedObjectFieldData>(), instancePrerequisites = emptyReqs, linkedTriggerAreaIDs = new List <int>(), placeableContents = placeableContents }); var data = new RoomFactory.RoomData() { room = protoroom, isSpecialRoom = true, category = "SPECIAL", specialSubCategory = "UNSPECIFIED_SPECIAL" }; RoomFactory.rooms.Add(ID, data); DungeonHandler.Register(data); }
public static void LoadRoomsFromRoomDirectory() { string roomDirectory = Initialisation.ZipFilePath; string unzippedDirectory = Initialisation.FilePath; if (File.Exists(roomDirectory)) { using (ZipFile zip = ZipFile.Read(roomDirectory)) foreach (ZipEntry f in zip.Entries) { if (f.FileName.Contains("rooms") && !FailSafeCheck) { FailSafeCheck = true; //ItemAPI.Tools.PrintNoID("this is being read"); var roomData = BuildFromZipFile(roomDirectory); foreach (var roomsData in roomData) { string name = roomsData.room.name; //Debug.Log("Found room: "+name); DungeonHandler.Register(roomsData); rooms.Add(roomsData.room.name, roomsData); } } } } else { Directory.CreateDirectory(unzippedDirectory); foreach (string g in Directory.GetFiles(unzippedDirectory, "*", SearchOption.AllDirectories)) { if (g.EndsWith(".room", StringComparison.OrdinalIgnoreCase)) { string name = Path.GetFullPath(g).RemovePrefix(unzippedDirectory).RemoveSuffix(".room"); // Debug.Log("Found room: " + name); var roomData = BuildFromRoomFile(g); DungeonHandler.Register(roomData); rooms.Add(name, roomData); } } } }
// Token: 0x0600005A RID: 90 RVA: 0x000050E4 File Offset: 0x000032E4 public static void RegisterShrineRoom(GameObject shrine, PrototypeDungeonRoom protoroom, string ID, Vector2 offset) { protoroom.category = PrototypeDungeonRoom.RoomCategory.NORMAL; DungeonPrerequisite[] array = new DungeonPrerequisite[0]; Vector2 vector = new Vector2((float)(protoroom.Width / 2) + offset.x, (float)(protoroom.Height / 2) + offset.y); protoroom.placedObjectPositions.Add(vector); protoroom.placedObjects.Add(new PrototypePlacedObjectData { contentsBasePosition = vector, fieldData = new List <PrototypePlacedObjectFieldData>(), instancePrerequisites = array, linkedTriggerAreaIDs = new List <int>(), placeableContents = new DungeonPlaceable { width = 2, height = 2, respectsEncounterableDifferentiator = true, variantTiers = new List <DungeonPlaceableVariant> { new DungeonPlaceableVariant { percentChance = 1f, nonDatabasePlaceable = shrine, prerequisites = array, materialRequirements = new DungeonPlaceableRoomMaterialRequirement[0] } } } }); RoomFactory.RoomData roomData = new RoomFactory.RoomData { room = protoroom, isSpecialRoom = true, category = "SPECIAL", specialSubCatergory = "UNSPECIFIED_SPECIAL" }; RoomFactory.rooms.Add(ID, roomData); DungeonHandler.Register(roomData); }
// Token: 0x06000018 RID: 24 RVA: 0x0000399C File Offset: 0x00001B9C public static void RegisterShrineRoom(GameObject shrine, PrototypeDungeonRoom protoroom, string ID, Vector2 offset, float roomweight) { DungeonPrerequisite[] array = new DungeonPrerequisite[0]; Vector2 vector = new Vector2((float)(protoroom.Width / 2) + offset.x, (float)(protoroom.Height / 2) + offset.y); protoroom.placedObjectPositions.Add(vector); protoroom.placedObjects.Add(new PrototypePlacedObjectData { contentsBasePosition = vector, fieldData = new List <PrototypePlacedObjectFieldData>(), instancePrerequisites = array, linkedTriggerAreaIDs = new List <int>(), placeableContents = new DungeonPlaceable { width = 2, height = 2, respectsEncounterableDifferentiator = true, variantTiers = new List <DungeonPlaceableVariant> { new DungeonPlaceableVariant { percentChance = 1f, nonDatabasePlaceable = shrine, prerequisites = array, materialRequirements = new DungeonPlaceableRoomMaterialRequirement[0] } } } }); RoomFactory.RoomData roomData = new RoomFactory.RoomData { room = protoroom, category = protoroom.category.ToString(), weight = roomweight, }; //RoomFactory.RoomData roomData = RoomFactory.ExtractRoomDataFromResource(roomPath); RoomFactory.rooms.Add(ID, roomData); DungeonHandler.Register(roomData); }