Skip to content

Commit

Permalink
Minor code commenting and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnoyingRain5 committed Dec 1, 2023
1 parent db2091f commit 7d5aa7e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
1 change: 0 additions & 1 deletion CrankItUp.Game/src/CrankItUpGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ private void load(Storage store)
try
{
var sr = new StreamReader(store.GetStream("settings.json"));
// Read the stream as a string, and write the string to the console.
var settings = JObject.Parse(sr.ReadToEnd());
Settings.inputmode = (Settings.InputMode)settings.GetValue<int>("inputMode");
}
Expand Down
4 changes: 1 addition & 3 deletions CrankItUp.Game/src/Screens/CreditsScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
using osu.Framework.Graphics.Sprites;
using osu.Framework.Screens;
using osuTK;
using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input.Events;
using osu.Framework.Graphics.Containers;
Expand All @@ -16,7 +14,7 @@ public partial class CreditsScreen : Screen
CIUButton backButton;

[BackgroundDependencyLoader]
private void load(AudioManager audio, TextureStore textures)
private void load(TextureStore textures)
{
backButton = new CIUButton(textures)
{
Expand Down
4 changes: 4 additions & 0 deletions CrankItUp.Game/src/Screens/DifficultySelect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ private void load(AudioManager audio, TextureStore textures, Storage storage)
continue;
}
}

int dataVersion;
try
{
Expand Down Expand Up @@ -132,6 +133,8 @@ private void load(AudioManager audio, TextureStore textures, Storage storage)
}
);
}

// Create a grid of buttons, same as TrackSelect.cs
position.Y += 50;
if (position.Y == 600)
{
Expand All @@ -157,6 +160,7 @@ private void load(AudioManager audio, TextureStore textures, Storage storage)
// make an empty spritetext, as there is nothing to say
invalidDifficultyText = new SpriteText { };
}

InternalChildren = new Drawable[]
{
new DrawSizePreservingFillContainer
Expand Down
9 changes: 8 additions & 1 deletion CrankItUp.Game/src/Screens/TrackSelect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ private void load(TextureStore textures, Storage storage)
Origin = Anchor.BottomRight,
Position = new Vector2(0, 100)
};
var maps = storage.GetDirectories("maps");

Vector2 position = new Vector2(0, 0);
var maps = storage.GetDirectories("maps");
foreach (string mapPath in maps)
{
var map = mapPath[5..];
Expand All @@ -50,8 +51,11 @@ private void load(TextureStore textures, Storage storage)
}
catch
{
// if we can't get a metadata.json, or it's invalid, we can skip it
// logging the specific issue in the file is done by the TrackMetadata class
continue;
}

trackContainer.Add(
new CIUButton(textures)
{
Expand All @@ -62,6 +66,8 @@ private void load(TextureStore textures, Storage storage)
Action = () => pushDifficultySelect(map, mapPath, storage),
}
);

// change the position, relative to it's current position, preventing overlap
position.Y += 50;
if (position.Y == 600)
{
Expand Down Expand Up @@ -94,6 +100,7 @@ private void pushMenu()

public void pushDifficultySelect(string map, string mapPath, Storage storage)
{
// we get the metadata again here, as the metadata gathered in load() is overwriten each loop
var mapStorage = storage.GetStorageForDirectory(mapPath);
trackmeta = new TrackMetadata(mapStorage.GetStream("metadata.json"));
this.Push(new DifficultySelect(map, trackmeta));
Expand Down

0 comments on commit 7d5aa7e

Please sign in to comment.