diff --git a/Assets/Scripts/GameScene1/LevelRegistry.cs b/Assets/Scripts/GameScene1/LevelRegistry.cs index 46ba5d7..c2ab4f7 100644 --- a/Assets/Scripts/GameScene1/LevelRegistry.cs +++ b/Assets/Scripts/GameScene1/LevelRegistry.cs @@ -91,9 +91,10 @@ public static void InitializeLevelList() { levelMap[levelHeight - i - 1] = levelRow; } } - + var level = new Level(id, levelName, time, difficulty, boxCount, levelWidth, levelHeight, levelMap); Registry.Add(level); + fileReader.Close(); } Registry.Sort(); diff --git a/Assets/Scripts/GameScene3/LevelRegistry2.cs b/Assets/Scripts/GameScene3/LevelRegistry2.cs index d342294..0673697 100644 --- a/Assets/Scripts/GameScene3/LevelRegistry2.cs +++ b/Assets/Scripts/GameScene3/LevelRegistry2.cs @@ -43,13 +43,13 @@ public static void InitializeLevelList(TileBase boxOnBoxArea, TileBase boxArea, LevelRegistry2.wall = wall; LevelRegistry2.box = box; LevelRegistry2.empty = empty; - + var directory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Sokoban\levels"; if (!Directory.Exists(directory)) Directory.CreateDirectory(directory); var files = Directory.GetFiles(directory, "*.txt"); - + foreach (var file in files) { var fileReader = new StreamReader(file); var id = Convert.ToInt32(ProcessLine(fileReader.ReadLine())); @@ -104,6 +104,7 @@ public static void InitializeLevelList(TileBase boxOnBoxArea, TileBase boxArea, var level = new Level(id, levelName, 0, Level.Difficulty.None, boxCount, levelWidth, levelHeight, levelMap); Registry.Add(level); + fileReader.Close(); } Registry.Sort(); diff --git a/Assets/StreamingAssets/build_info b/Assets/StreamingAssets/build_info index 0071841..3435b8d 100644 --- a/Assets/StreamingAssets/build_info +++ b/Assets/StreamingAssets/build_info @@ -1 +1 @@ -Build from DESKTOP-7NTI7HV at 31.03.2021 10:47:34 \ No newline at end of file +Build from DESKTOP-7NTI7HV at 31.03.2021 23:00:39 \ No newline at end of file