diff --git a/prefabs/map_info_container.tscn b/prefabs/map_info_container.tscn index bbd365d..a8d4b3c 100644 --- a/prefabs/map_info_container.tscn +++ b/prefabs/map_info_container.tscn @@ -21,6 +21,7 @@ [ext_resource type="Texture2D" uid="uid://csk7favaty7k2" path="res://user/skins/default/ui/buttons/speed_plus_plus.png" id="14_hri10"] [ext_resource type="Texture2D" uid="uid://ddhu70ryjua54" path="res://user/skins/default/ui/buttons/speed_middle.png" id="18_1m5pv"] [ext_resource type="Texture2D" uid="uid://4o5eelsayk4d" path="res://user/skins/default/ui/buttons/play.png" id="20_ir45w"] +[ext_resource type="Texture2D" path="res://user/skins/default/modifiers/hardrock_v2.png" id="21_hardrock"] [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_svokg"] @@ -615,6 +616,17 @@ layout_mode = 2 icon = ExtResource("9_abwk8") Modifier = "Ghost" +[node name="Hard" type="AspectRatioContainer" parent="Actions/ScrollContainer/Holder/Modifiers/ScrollContainer/HBoxContainer" unique_id=1417833015] +layout_mode = 2 +size_flags_horizontal = 0 + +[node name="ModifierButton" parent="Actions/ScrollContainer/Holder/Modifiers/ScrollContainer/HBoxContainer/Hard" unique_id=1417833016 instance=ExtResource("7_dccrs")] +custom_minimum_size = Vector2(58, 54) +layout_mode = 2 +icon = ExtResource("21_hardrock") +Modifier = "HardRock" +Description = "Hard Mode: Reducing note size and hit window" + [node name="Speed" type="Panel" parent="Actions/ScrollContainer/Holder" unique_id=1748400541] custom_minimum_size = Vector2(0, 32) layout_mode = 1 diff --git a/prefabs/score_panel.tscn b/prefabs/score_panel.tscn index a0adbc2..020bcbc 100644 --- a/prefabs/score_panel.tscn +++ b/prefabs/score_panel.tscn @@ -98,6 +98,21 @@ label_settings = SubResource("LabelSettings_i1p2f") horizontal_alignment = 2 vertical_alignment = 1 +[node name="Rank" type="Label" parent="." unique_id=1111993920] +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.6 +anchor_top = 0.4 +anchor_right = 1.0 +anchor_bottom = 0.4 +offset_left = 4.0 +offset_top = 4.0 +offset_right = -110.0 +text = "SS" +label_settings = SubResource("LabelSettings_exmec") +horizontal_alignment = 2 +vertical_alignment = 1 + [node name="Accuracy" type="Label" parent="." unique_id=696162467] layout_mode = 1 anchors_preset = -1 diff --git a/scenes/game.tscn b/scenes/game.tscn index 6558496..d193460 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -752,6 +752,19 @@ grow_horizontal = 2 grow_vertical = 2 texture = ExtResource("12_whe6p") +[node name="Rank" type="Label" parent="PanelRight/PanelRightViewport"] +anchors_preset = -1 +anchor_left = 0.5 +anchor_top = 0.15 +anchor_right = 0.5 +anchor_bottom = 0.15 +grow_horizontal = 2 +grow_vertical = 2 +theme = ExtResource("4_rvp5o") +text = "SS" +label_settings = SubResource("LabelSettings_usmyc") +horizontal_alignment = 1 + [node name="Accuracy" type="Label" parent="PanelRight/PanelRightViewport" unique_id=1669266042] anchors_preset = -1 anchor_left = 0.5 diff --git a/scenes/results.tscn b/scenes/results.tscn index 10955bc..2d16afe 100644 --- a/scenes/results.tscn +++ b/scenes/results.tscn @@ -90,6 +90,11 @@ font_size = 32 shader = ExtResource("5_eo0oh") shader_parameter/brightness = 1.25 +[sub_resource type="LabelSettings" id="LabelSettings_huge_rank"] +font = ExtResource("2_f4qdi") +font_size = 550 +font_color = Color(1, 1, 1, 0.5) + [node name="SceneResults" type="Node" unique_id=11944572] script = ExtResource("1_llpx6") @@ -230,6 +235,20 @@ offset_top = 300.0 offset_right = -32.0 offset_bottom = 302.0 +[node name="Rank" type="Label" parent="Holder"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = 32.0 +grow_horizontal = 2 +grow_vertical = 2 +text = "SS" +label_settings = SubResource("LabelSettings_huge_rank") +horizontal_alignment = 0 +vertical_alignment = 1 +text_overrun_behavior = 3 + [node name="Accuracy" type="Label" parent="Holder" unique_id=678663131] layout_mode = 1 anchors_preset = -1 diff --git a/scripts/SceneManager.cs b/scripts/SceneManager.cs index 5404a0b..d97f775 100644 --- a/scripts/SceneManager.cs +++ b/scripts/SceneManager.cs @@ -3,133 +3,133 @@ public partial class SceneManager : Node { - private static SubViewportContainer backgroundContainer; + private static SubViewportContainer backgroundContainer; - private static SubViewport backgroundViewport; + private static SubViewport backgroundViewport; - private static string activeScenePath; + private static string activeScenePath; - public static SceneManager Instance { get; private set; } + public static SceneManager Instance { get; private set; } - public static Window Root; + public static Window Root; - public static Dictionary Scenes = []; + public static Dictionary Scenes = []; - public static BaseScene Scene; + public static BaseScene Scene; - public static BaseSpace Space; + public static BaseSpace Space; - public static Panel VolumePanel; + public static Panel VolumePanel; - public override void _EnterTree() - { - Instance = this; - Root = GetTree().Root; - VolumePanel = GetNode("Volume"); - } + public override void _EnterTree() + { + Instance = this; + Root = GetTree().Root; + VolumePanel = GetNode("Volume"); + } - public override void _Ready() - { - backgroundContainer = GetNode("Background"); - backgroundViewport = backgroundContainer.GetNode("SubViewport"); + public override void _Ready() + { + backgroundContainer = GetNode("Background"); + backgroundViewport = backgroundContainer.GetNode("SubViewport"); - Load("res://scenes/loading.tscn"); - } + Load("res://scenes/loading.tscn"); + } - public static void ReloadCurrentScene() - { - Load(activeScenePath, true); - } + public static void ReloadCurrentScene() + { + Load(activeScenePath, true); + } - public static void Load(string path, bool skipTransition = false) - { - bool isSceneLoaded = Scenes.TryGetValue(path, out BaseScene loadedScene); - BaseScene newScene = isSceneLoaded ? loadedScene : (BaseScene)ResourceLoader.Load(path).Instantiate(); + public static void Load(string path, bool skipTransition = false) + { + bool isSceneLoaded = Scenes.TryGetValue(path, out BaseScene loadedScene); + BaseScene newScene = isSceneLoaded ? loadedScene : (BaseScene)ResourceLoader.Load(path).Instantiate(); - // temp solution until these scenes are non-static - if (!isSceneLoaded && newScene.Name != "SceneGame" && newScene.Name != "SceneResults") - { - Scenes[path] = newScene; - } + // temp solution until these scenes are non-static + if (!isSceneLoaded && newScene.Name != "SceneGame" && newScene.Name != "SceneResults") + { + Scenes[path] = newScene; + } - Tween outTween = Instance.CreateTween().SetTrans(Tween.TransitionType.Quad); + Tween outTween = Instance.CreateTween().SetTrans(Tween.TransitionType.Quad); - if (Scene != null) - { - outTween.TweenProperty(Scene.Transition, "self_modulate", Color.FromHtml("ffffffff"), skipTransition ? 0 : 0.25); - } + if (Scene != null) + { + outTween.TweenProperty(Scene.Transition, "self_modulate", Color.FromHtml("ffffffff"), skipTransition ? 0 : 0.25); + } - outTween.TweenCallback(Callable.From(() => - { - removeScene(Scene); + outTween.TweenCallback(Callable.From(() => + { + removeScene(Scene); - activeScenePath = path; - Scene = newScene; + activeScenePath = path; + Scene = newScene; - addScene(newScene); + addScene(newScene); - newScene.Transition.SelfModulate = Color.FromHtml("ffffffff"); - Instance.CreateTween().SetTrans(Tween.TransitionType.Quad).TweenProperty(newScene.Transition, "self_modulate", Color.FromHtml("ffffff00"), skipTransition ? 0 : 0.25); - })); - } + newScene.Transition.SelfModulate = Color.FromHtml("ffffffff"); + Instance.CreateTween().SetTrans(Tween.TransitionType.Quad).TweenProperty(newScene.Transition, "self_modulate", Color.FromHtml("ffffff00"), skipTransition ? 0 : 0.25); + })); + } - private static void addScene(BaseScene scene, bool updateSpace = true) - { - if (scene == null || scene.GetParent() == Instance) { return; } + private static void addScene(BaseScene scene, bool updateSpace = true) + { + if (scene == null || scene.GetParent() == Instance) { return; } - if (updateSpace) - { - addSpace(scene.GetSpace(), scene.AddSpaceAsChild); - } + if (updateSpace) + { + addSpace(scene.GetSpace(), scene.AddSpaceAsChild); + } - Instance.AddChild(scene); - scene.Load(); - } + Instance.AddChild(scene); + scene.Load(); + } - private static void removeScene(BaseScene scene, bool updateSpace = true) - { - if (scene == null || scene.GetParent() != Instance) { return; } + private static void removeScene(BaseScene scene, bool updateSpace = true) + { + if (scene == null || scene.GetParent() != Instance) { return; } - scene.Unload(); - Instance.RemoveChild(scene); + scene.Unload(); + Instance.RemoveChild(scene); - // also temp - if (scene.Name == "SceneGame" || scene.Name == "SceneResults") - { - scene.QueueFree(); - } + // also temp + if (scene.Name == "SceneGame" || scene.Name == "SceneResults") + { + scene.QueueFree(); + } - if (updateSpace) - { - removeSpace(); - } - } + if (updateSpace) + { + removeSpace(); + } + } - private static void addSpace(BaseSpace space, bool addToScene = false) - { - if (space == null || space.GetParent() == backgroundViewport) { return; } + private static void addSpace(BaseSpace space, bool addToScene = false) + { + if (space == null || space.GetParent() == backgroundViewport) { return; } - if (addToScene) - { - Scene.AddChild(space); - Scene.MoveChild(space, 0); - } - else - { - backgroundViewport.AddChild(space); - } - - backgroundContainer.Visible = !addToScene; - - Space = space; - } - - private static void removeSpace() - { - if (Space == null) { return; } - - Space.GetParent().RemoveChild(Space); - - Space = null; - } + if (addToScene) + { + Scene.AddChild(space); + Scene.MoveChild(space, 0); + } + else + { + backgroundViewport.AddChild(space); + } + + backgroundContainer.Visible = !addToScene; + + Space = space; + } + + private static void removeSpace() + { + if (Space == null) { return; } + + Space.GetParent().RemoveChild(Space); + + Space = null; + } } diff --git a/scripts/SettingsManager.cs b/scripts/SettingsManager.cs index 9caf7fc..3615c79 100644 --- a/scripts/SettingsManager.cs +++ b/scripts/SettingsManager.cs @@ -10,152 +10,152 @@ [GlobalClass] public partial class SettingsManager : Node { - public static bool Shown = false; + public static bool Shown = false; - public static bool HideNotifications = false; + public static bool HideNotifications = false; - public static ColorRect Menu; + public static ColorRect Menu; - public static SettingsManager Instance { get; private set; } + public static SettingsManager Instance { get; private set; } - public SettingsProfile Settings = new SettingsProfile(); + public SettingsProfile Settings = new SettingsProfile(); - [Signal] - public delegate void MenuToggledEventHandler(bool shown); + [Signal] + public delegate void MenuToggledEventHandler(bool shown); - [Signal] - public delegate void SavedEventHandler(); + [Signal] + public delegate void SavedEventHandler(); - [Signal] - public delegate void LoadedEventHandler(); + [Signal] + public delegate void LoadedEventHandler(); - public override void _Ready() - { - Instance = this; + public override void _Ready() + { + Instance = this; - Menu = SceneManager.Instance.GetNode("Settings"); + Menu = SceneManager.Instance.GetNode("Settings"); - HideMenu(); - } + HideMenu(); + } - public static void ShowMenu(bool show = true) - { - Shown = show; + public static void ShowMenu(bool show = true) + { + Shown = show; - Instance.EmitSignal(SignalName.MenuToggled, Shown); - } + Instance.EmitSignal(SignalName.MenuToggled, Shown); + } - public static void HideMenu() - { - ShowMenu(false); - } + public static void HideMenu() + { + ShowMenu(false); + } - public static void Save(string profile = null) - { - profile ??= GetCurrentProfile(); + public static void Save(string profile = null) + { + profile ??= GetCurrentProfile(); - string data = SettingsProfileConverter.Serialize(Instance.Settings); + string data = SettingsProfileConverter.Serialize(Instance.Settings); - File.WriteAllText($"{Constants.USER_FOLDER}/profiles/{profile}.json", data); + File.WriteAllText($"{Constants.USER_FOLDER}/profiles/{profile}.json", data); - Logger.Log($"Saved settings {profile}"); + Logger.Log($"Saved settings {profile}"); - Instance.EmitSignal(SignalName.Saved); + Instance.EmitSignal(SignalName.Saved); - SkinManager.Save(); - } + SkinManager.Save(); + } - public static void Load(string profile = null) - { - profile ??= GetCurrentProfile(); + public static void Load(string profile = null) + { + profile ??= GetCurrentProfile(); - try - { - SettingsProfileConverter.Deserialize($"{Constants.USER_FOLDER}/profiles/{profile}.json", Instance.Settings); + try + { + SettingsProfileConverter.Deserialize($"{Constants.USER_FOLDER}/profiles/{profile}.json", Instance.Settings); - ToastNotification.Notify($"Loaded profile [{profile}]"); - } - catch (Exception exception) - { - ToastNotification.Notify("Settings file corrupted", 2); - Logger.Error(exception); - } + ToastNotification.Notify($"Loaded profile [{profile}]"); + } + catch (Exception exception) + { + ToastNotification.Notify("Settings file corrupted", 2); + Logger.Error(exception); + } - if (!Directory.Exists($"{Constants.USER_FOLDER}/skins/{Instance.Settings.Skin.Value}")) - { - Instance.Settings.Skin.Value = new("default"); - ToastNotification.Notify($"Could not find skin {Instance.Settings.Skin.Value}", 1); - } + if (!Directory.Exists($"{Constants.USER_FOLDER}/skins/{Instance.Settings.Skin.Value}")) + { + Instance.Settings.Skin.Value = new("default"); + ToastNotification.Notify($"Could not find skin {Instance.Settings.Skin.Value}", 1); + } - static void addUserContentToSettingsList(SettingsItem settingsItem, IEnumerable options) - { - foreach (string option in options) - { - string name = option.GetFile().GetBaseName(); + static void addUserContentToSettingsList(SettingsItem settingsItem, IEnumerable options) + { + foreach (string option in options) + { + string name = option.GetFile().GetBaseName(); - if (settingsItem.List.Values.IndexOf(name) == -1) - { - settingsItem.List.Values.Add(name); - } - } - } + if (settingsItem.List.Values.IndexOf(name) == -1) + { + settingsItem.List.Values.Add(name); + } + } + } - addUserContentToSettingsList(Instance.Settings.Skin, Directory.GetDirectories($"{Constants.USER_FOLDER}/skins")); - addUserContentToSettingsList(Instance.Settings.NoteColors, Directory.GetFiles($"{Constants.USER_FOLDER}/colorsets")); + addUserContentToSettingsList(Instance.Settings.Skin, Directory.GetDirectories($"{Constants.USER_FOLDER}/skins")); + addUserContentToSettingsList(Instance.Settings.NoteColors, Directory.GetFiles($"{Constants.USER_FOLDER}/colorsets")); - Logger.Log($"Loaded settings {profile}"); + Logger.Log($"Loaded settings {profile}"); - Instance.EmitSignal(SignalName.Loaded); + Instance.EmitSignal(SignalName.Loaded); - SkinManager.Load(); - } + SkinManager.Load(); + } - public static void Reload() - { - Save(); - Load(); - } + public static void Reload() + { + Save(); + Load(); + } - public static void SetCurrentProfile(string profile = null) - { - profile ??= GetCurrentProfile(); + public static void SetCurrentProfile(string profile = null) + { + profile ??= GetCurrentProfile(); - File.WriteAllText($"{Constants.USER_FOLDER}/current_profile.txt", profile); - } + File.WriteAllText($"{Constants.USER_FOLDER}/current_profile.txt", profile); + } - public static string GetCurrentProfile() - { - string file = $"{Constants.USER_FOLDER}/current_profile.txt"; + public static string GetCurrentProfile() + { + string file = $"{Constants.USER_FOLDER}/current_profile.txt"; - if (File.Exists(file)) - { - return File.ReadAllText(file); - } + if (File.Exists(file)) + { + return File.ReadAllText(file); + } - return "default"; - } + return "default"; + } - // the HideNotifications bool exists to prevent a lot of toasts that inform the user of changing the skin to "default", - // this bool is only used inside of SkinManager - line 164. - public static void ResetToDefaults() - { - HideNotifications = true; + // the HideNotifications bool exists to prevent a lot of toasts that inform the user of changing the skin to "default", + // this bool is only used inside of SkinManager - line 164. + public static void ResetToDefaults() + { + HideNotifications = true; - SettingsProfile defaults = new SettingsProfile(); + SettingsProfile defaults = new SettingsProfile(); - foreach (var property in typeof(SettingsProfile).GetProperties()) - { - if (!typeof(ISettingsItem).IsAssignableFrom(property.PropertyType)) continue; + foreach (var property in typeof(SettingsProfile).GetProperties()) + { + if (!typeof(ISettingsItem).IsAssignableFrom(property.PropertyType)) continue; - ISettingsItem current = (ISettingsItem)property.GetValue(Instance.Settings); - ISettingsItem defs = (ISettingsItem)property.GetValue(defaults); + ISettingsItem current = (ISettingsItem)property.GetValue(Instance.Settings); + ISettingsItem defs = (ISettingsItem)property.GetValue(defaults); - current.SetVariant(defs.GetVariant()); - } + current.SetVariant(defs.GetVariant()); + } - Save(); - HideNotifications = false; + Save(); + HideNotifications = false; - ToastNotification.Notify("Settings reset to default successfully!"); - } + ToastNotification.Notify("Settings reset to default successfully!"); + } } diff --git a/scripts/SoundManager.cs b/scripts/SoundManager.cs index 7bf7cbb..e70aae4 100644 --- a/scripts/SoundManager.cs +++ b/scripts/SoundManager.cs @@ -6,235 +6,235 @@ public partial class SoundManager : Node, ISkinnable { - public static SoundManager Instance; - - public static AudioStreamPlayer HitSound; - public static AudioStreamPlayer MissSound; - public static AudioStreamPlayer FailSound; - public static AudioStreamPlayer Song; - - public Action JukeboxPlayed; - - public event Action JukeboxEmpty; - - public static int[] JukeboxQueue = []; - public static int JukeboxIndex = 0; - public static bool JukeboxPaused = false; - public static ulong LastRewind = 0; - public static Map Map; - - private static bool volumePopupShown = false; - private static ulong lastVolumeChange = 0; - - public override void _Ready() - { - Instance = this; - - HitSound = new(); - MissSound = new(); - FailSound = new(); - Song = new(); - - HitSound.MaxPolyphony = 16; - - AddChild(HitSound); - AddChild(MissSound); - AddChild(FailSound); - AddChild(Song); - - SkinManager.Instance.Loaded += UpdateSkin; - - UpdateSkin(SkinManager.Instance.Skin); - - Song.Finished += () => - { - switch (SceneManager.Scene.Name) - { - case "SceneMenu": - if (SettingsManager.Instance.Settings.AutoplayJukebox) - { - JukeboxIndex++; - PlayJukebox(JukeboxIndex); - } - break; - case "SceneResults": - PlayJukebox(JukeboxIndex); // play skinnable results song here in the future - break; - default: - break; - } - }; - - SettingsManager.Instance.Loaded += UpdateVolume; - Lobby.Instance.SpeedChanged += (speed) => { SoundManager.Song.PitchScale = (float)speed; }; - MapManager.Selected.ValueChanged += (_, selected) => - { - var map = selected.Value; - - if (Map == null || Map.Name != map.Name) - { - PlayJukebox(map); - } - }; - - MapManager.MapDeleted += (map) => - { - UpdateJukeboxQueue(); - - if (Map != map) - { - return; - } - - if (JukeboxQueue.Length == 0) - { - Song.Stop(); - Map = null; - JukeboxEmpty?.Invoke(); - } - else - { - PlayJukebox(new Random().Next(0, JukeboxQueue.Length)); - } - }; - - UpdateVolume(); - - static void start() - { - UpdateJukeboxQueue(); - - if (SettingsManager.Instance.Settings.AutoplayJukebox) - { - PlayJukebox(new Random().Next(0, JukeboxQueue.Length)); - } - } - - if (MapManager.Initialized) - { - start(); - return; - } - - MapManager.MapsInitialized += _ => start(); - } - - public override void _Process(double delta) - { - if (volumePopupShown && Time.GetTicksMsec() - lastVolumeChange >= 1000) - { - volumePopupShown = false; - - Tween tween = SceneManager.VolumePanel.CreateTween().SetTrans(Tween.TransitionType.Quad).SetParallel(); - tween.TweenProperty(SceneManager.VolumePanel, "modulate", Color.FromHtml("ffffff00"), 0.25); - tween.TweenProperty(SceneManager.VolumePanel.GetNode