private static List <ItemLocation <T> > CreateList <T>(int id, SceneHeader header, int scene, int room, CreateListThings <T> del) { List <ItemLocation <T> > result = new List <ItemLocation <T> >(); List <List <T> > test = del(id); for (int i = 0; i < test.Count; i++) { SceneRoomSetup srs = new SceneRoomSetup(scene, room, i); foreach (var item in test[i]) { result.Add(new ItemLocation <T>(item, srs)); } } return(result); }
private static List <ItemLocation <T> > CreateCollectionById <T>(Rom rom, int id, CreateListThings <T> CreateThings) { Scene scene; List <FileAddress> roomAddresses; Room room; List <ItemLocation <T> > result = new List <ItemLocation <T> >(); for (int sceneId = 0; sceneId < rom.Scenes; sceneId++) { //load scene var sceneFile = rom.Files.GetSceneFile(sceneId); scene = InitializeScene(sceneFile, sceneId); if (scene == null) { continue; } //scene level actors //set room negative to denote scene level actors result.AddRange(CreateList <T>(id, scene.Header, sceneId, -1, CreateThings)); //load room list roomAddresses = scene.Header.GetRoomAddresses(); for (int roomId = 0; roomId < roomAddresses.Count; roomId++) { try { room = InitializeRoom(rom.Files.GetFile(roomAddresses[roomId])); result.AddRange(CreateList <T>(id, scene.Header, sceneId, roomId, CreateThings)); } catch { } } } return(result); }