From d0ebbad0fab3da4833bc9e295270fce20dbb684c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 4 Apr 2017 09:47:52 +0900 Subject: [PATCH 1/7] Fix avatar display. --- osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index adcf8fd042..2bac387c5c 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -157,6 +157,7 @@ namespace osu.Game.Screens.Select.Leaderboards }) { TimeBeforeLoad = 500, + RelativeSizeAxes = Axes.None, Size = new Vector2(HEIGHT - edge_margin * 2, HEIGHT - edge_margin * 2), }, new Container From 8fcb1690cf2d5abd271daa16feaa2a85f67442e0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 4 Apr 2017 10:33:48 +0900 Subject: [PATCH 2/7] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 1c08c1fec4..e9b388934e 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 1c08c1fec496e9d64ba8f30ff0464cd5cdf567b6 +Subproject commit e9b388934ed77cbc1af3cdfd213eb754f71554ae From b0ebacb06d67edfb1b6dfeaccecf4adbea480a49 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Apr 2017 18:33:14 +0900 Subject: [PATCH 3/7] Fix some unused variables in test cases. --- .../Tests/TestCaseChatDisplay.cs | 3 --- .../Tests/TestCasePlaySongSelect.cs | 14 +++++++------- osu.Desktop.VisualTests/Tests/TestCaseReplay.cs | 9 --------- .../Tests/TestCaseScoreCounter.cs | 2 -- 4 files changed, 7 insertions(+), 21 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs b/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs index 2cb63ba7a0..2663c952cf 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs @@ -3,15 +3,12 @@ using osu.Framework.Testing; using osu.Framework.Graphics.Containers; -using osu.Framework.Threading; using osu.Game.Overlays; namespace osu.Desktop.VisualTests.Tests { internal class TestCaseChatDisplay : TestCase { - private ScheduledDelegate messageRequest; - public override string Description => @"Testing chat api and overlay"; public override void Reset() diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index aedab7e895..1a43425dda 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -14,7 +14,7 @@ namespace osu.Desktop.VisualTests.Tests { internal class TestCasePlaySongSelect : TestCase { - private BeatmapDatabase db, oldDb; + private BeatmapDatabase db; private TestStorage storage; private PlaySongSelect songSelect; @@ -44,13 +44,13 @@ namespace osu.Desktop.VisualTests.Tests AddStep(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; }); } - protected override void Dispose(bool isDisposing) - { - if (oldDb != null) - db = null; + //protected override void Dispose(bool isDisposing) + //{ + // if (oldDb != null) + // db = null; - base.Dispose(isDisposing); - } + // base.Dispose(isDisposing); + //} private BeatmapSetInfo createTestBeatmapSet(int i) { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs b/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs index c36fc0a47d..ffdca25bb3 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs @@ -1,24 +1,15 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Input.Handlers; using osu.Game.Beatmaps; using osu.Game.Modes.Mods; using osu.Game.Modes.Osu.Mods; using osu.Game.Screens.Play; -using System; -using System.IO; namespace osu.Desktop.VisualTests.Tests { internal class TestCaseReplay : TestCasePlayer { - private WorkingBeatmap beatmap; - - private InputHandler replay; - - private Func getReplayStream; - public override string Description => @"Testing replay playback."; protected override Player CreatePlayer(WorkingBeatmap beatmap) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs index 55fc969217..f3cca16678 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs @@ -22,8 +22,6 @@ namespace osu.Desktop.VisualTests.Tests int numerator = 0, denominator = 0; - bool maniaHold = false; - ScoreCounter score = new ScoreCounter(7) { Origin = Anchor.TopRight, From f6303d55ec04e89d4635667a4304e8f19933a21d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Apr 2017 18:35:33 +0900 Subject: [PATCH 4/7] Upodate some tab usages. --- .../Tests/TestCaseTabControl.cs | 4 +- .../Graphics/UserInterface/OsuTabControl.cs | 49 ++++++++----------- .../Select/BeatmapDetailAreaTabControl.cs | 4 +- 3 files changed, 24 insertions(+), 33 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs index 23e7f8a74d..780ff7b833 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs @@ -36,9 +36,9 @@ namespace osu.Desktop.VisualTests.Tests filter.PinItem(GroupMode.All); filter.PinItem(GroupMode.RecentlyPlayed); - filter.ItemChanged += (sender, mode) => + filter.SelectedItem.ValueChanged += (sender, args) => { - text.Text = "Currently Selected: " + mode.ToString(); + text.Text = "Currently Selected: " + filter.SelectedItem.ToString(); }; } } diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 6d17d79ca1..242a9a8f6a 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -21,7 +21,7 @@ namespace osu.Game.Graphics.UserInterface { protected override Dropdown CreateDropdown() => new OsuTabDropdown(); - protected override TabItem CreateTabItem(T value) => new OsuTabItem { Value = value }; + protected override TabItem CreateTabItem(T value) => new OsuTabItem(value); protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || Dropdown.Contains(screenSpacePos); @@ -75,16 +75,6 @@ namespace osu.Game.Graphics.UserInterface } } - public new T Value - { - get { return base.Value; } - set - { - base.Value = value; - text.Text = (value as Enum)?.GetDescription(); - } - } - public override bool Active { get { return base.Active; } @@ -134,30 +124,31 @@ namespace osu.Game.Graphics.UserInterface AccentColour = colours.Blue; } - public OsuTabItem() + public OsuTabItem(T value) : base(value) { AutoSizeAxes = Axes.X; RelativeSizeAxes = Axes.Y; Children = new Drawable[] { - text = new OsuSpriteText - { - Margin = new MarginPadding { Top = 5, Bottom = 5 }, - Origin = Anchor.BottomLeft, - Anchor = Anchor.BottomLeft, - TextSize = 14, - Font = @"Exo2.0-Bold", // Font should only turn bold when active? - }, - box = new Box - { - RelativeSizeAxes = Axes.X, - Height = 1, - Alpha = 0, - Colour = Color4.White, - Origin = Anchor.BottomLeft, - Anchor = Anchor.BottomLeft, - } + text = new OsuSpriteText + { + Margin = new MarginPadding { Top = 5, Bottom = 5 }, + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, + Text = (value as Enum)?.GetDescription(), + TextSize = 14, + Font = @"Exo2.0-Bold", // Font should only turn bold when active? + }, + box = new Box + { + RelativeSizeAxes = Axes.X, + Height = 1, + Alpha = 0, + Colour = Color4.White, + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, + } }; } } diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index 088346d91f..c9ea9e884e 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -61,10 +61,10 @@ namespace osu.Game.Screens.Select }, }; - tabs.ItemChanged += (sender, e) => invokeOnFilter(); + tabs.SelectedItem.ValueChanged += (sender, e) => invokeOnFilter(); modsCheckbox.Action += (sender, e) => invokeOnFilter(); - tabs.SelectedItem = BeatmapDetailTab.Global; + tabs.SelectedItem.Value = BeatmapDetailTab.Global; } } From 7c74951454498206d559f9906d402d951a8760e7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Apr 2017 19:34:00 +0900 Subject: [PATCH 5/7] Update bindables. # Conflicts: # osu.Desktop.VisualTests/Tests/TestCaseResults.cs # osu.Game/Screens/Ranking/ResultModeButton.cs # osu.Game/Screens/Ranking/Results.cs --- osu-resources | 2 +- .../Tests/TestCaseHitObjects.cs | 2 +- .../Tests/TestCaseKeyCounter.cs | 2 +- .../Tests/TestCaseTabControl.cs | 4 +-- .../Beatmaps/Drawables/BeatmapSetHeader.cs | 26 +++++--------- osu.Game/Configuration/OsuConfigManager.cs | 4 --- osu.Game/Graphics/Cursor/GameplayCursor.cs | 8 +---- osu.Game/Graphics/Cursor/MenuCursor.cs | 7 +--- .../Graphics/UserInterface/OsuCheckbox.cs | 5 ++- .../Graphics/UserInterface/RollingCounter.cs | 11 +++--- .../UserInterface/Volume/VolumeControl.cs | 3 +- osu.Game/Modes/UI/ComboCounter.cs | 7 +--- osu.Game/Modes/UI/HealthDisplay.cs | 2 +- osu.Game/Modes/UI/HudOverlay.cs | 17 ++++----- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 6 ++-- osu.Game/Overlays/MusicController.cs | 35 ++++++------------- osu.Game/Overlays/Options/OptionSlider.cs | 4 +-- osu.Game/Overlays/Options/OptionTextBox.cs | 6 +--- .../Sections/Graphics/LayoutOptions.cs | 5 ++- osu.Game/Screens/OsuGameScreen.cs | 8 +---- osu.Game/Screens/Play/Player.cs | 10 ++---- .../Select/BeatmapDetailAreaTabControl.cs | 2 +- osu.Game/Screens/Select/FilterControl.cs | 6 ++-- osu.Game/Screens/Select/SongSelect.cs | 5 +-- 24 files changed, 57 insertions(+), 130 deletions(-) diff --git a/osu-resources b/osu-resources index 12bbab717d..0d6dc29473 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 12bbab717d372dadbd3220d38da862276ac97e98 +Subproject commit 0d6dc294738d433999c6c68ff61169d3a8e6ce5f diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index cb7a3e3f84..99da7d1c73 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -112,7 +112,7 @@ namespace osu.Desktop.VisualTests.Tests Width = 150, Height = 10, SelectionColor = Color4.Orange, - Bindable = playbackSpeed + Value = playbackSpeed } } }); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index 3dba201f5d..7e7782662b 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -57,7 +57,7 @@ namespace osu.Desktop.VisualTests.Tests Width = 150, Height = 10, SelectionColor = Color4.Orange, - Bindable = bindable + Value = bindable } } }); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs index 780ff7b833..2d3969b822 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs @@ -36,9 +36,9 @@ namespace osu.Desktop.VisualTests.Tests filter.PinItem(GroupMode.All); filter.PinItem(GroupMode.RecentlyPlayed); - filter.SelectedItem.ValueChanged += (sender, args) => + filter.SelectedItem.ValueChanged += newFilter => { - text.Text = "Currently Selected: " + filter.SelectedItem.ToString(); + text.Text = "Currently Selected: " + newFilter.ToString(); }; } } diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index 89399a56ff..534578337f 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -22,8 +22,9 @@ namespace osu.Game.Beatmaps.Drawables public Action GainedSelection; private readonly SpriteText title; private readonly SpriteText artist; - private OsuConfigManager config; + private Bindable preferUnicode; + private readonly WorkingBeatmap beatmap; private readonly FillFlowContainer difficultyIcons; @@ -83,24 +84,13 @@ namespace osu.Game.Beatmaps.Drawables [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - this.config = config; - preferUnicode = config.GetBindable(OsuConfig.ShowUnicode); - preferUnicode.ValueChanged += preferUnicode_changed; - preferUnicode_changed(preferUnicode, null); - } - - private void preferUnicode_changed(object sender, EventArgs e) - { - title.Text = config.GetUnicodeString(beatmap.BeatmapSetInfo.Metadata.Title, beatmap.BeatmapSetInfo.Metadata.TitleUnicode); - artist.Text = config.GetUnicodeString(beatmap.BeatmapSetInfo.Metadata.Artist, beatmap.BeatmapSetInfo.Metadata.ArtistUnicode); - } - - protected override void Dispose(bool isDisposing) - { - if (preferUnicode != null) - preferUnicode.ValueChanged -= preferUnicode_changed; - base.Dispose(isDisposing); + preferUnicode.ValueChanged += unicode => + { + title.Text = unicode ? beatmap.BeatmapSetInfo.Metadata.TitleUnicode : beatmap.BeatmapSetInfo.Metadata.Title; + artist.Text = unicode ? beatmap.BeatmapSetInfo.Metadata.ArtistUnicode : beatmap.BeatmapSetInfo.Metadata.Artist; + }; + preferUnicode.TriggerChange(); } private class PanelBackground : BufferedContainer diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 6190678e1e..a4a960a7bc 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -187,10 +187,6 @@ namespace osu.Game.Configuration #pragma warning restore CS0612 // Type or member is obsolete } - //todo: make a UnicodeString class/struct rather than requiring this helper method. - public string GetUnicodeString(string nonunicode, string unicode) - => Get(OsuConfig.ShowUnicode) ? unicode ?? nonunicode : nonunicode ?? unicode; - public OsuConfigManager(Storage storage) : base(storage) { } diff --git a/osu.Game/Graphics/Cursor/GameplayCursor.cs b/osu.Game/Graphics/Cursor/GameplayCursor.cs index 3f94bbaddc..3f699219a4 100644 --- a/osu.Game/Graphics/Cursor/GameplayCursor.cs +++ b/osu.Game/Graphics/Cursor/GameplayCursor.cs @@ -12,7 +12,6 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Game.Configuration; -using System; namespace osu.Game.Graphics.Cursor { @@ -116,14 +115,9 @@ namespace osu.Game.Graphics.Cursor }; cursorScale = config.GetBindable(OsuConfig.GameplayCursorSize); - cursorScale.ValueChanged += scaleChanged; + cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)cursorScale); cursorScale.TriggerChange(); } - - private void scaleChanged(object sender, EventArgs e) - { - cursorContainer.Scale = new Vector2((float)cursorScale); - } } } } diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 67b17fae5c..0fb7f59212 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -131,14 +131,9 @@ namespace osu.Game.Graphics.Cursor }; cursorScale = config.GetBindable(OsuConfig.MenuCursorSize); - cursorScale.ValueChanged += scaleChanged; + cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)newScale); cursorScale.TriggerChange(); } - - private void scaleChanged(object sender, EventArgs e) - { - cursorContainer.Scale = new Vector2((float)cursorScale); - } } } } diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index fc44d80ea6..6a5151b90c 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -86,9 +85,9 @@ namespace osu.Game.Graphics.UserInterface }; } - private void bindableValueChanged(object sender, EventArgs e) + private void bindableValueChanged(bool isChecked) { - State = bindable.Value ? CheckboxState.Checked : CheckboxState.Unchecked; + State = isChecked ? CheckboxState.Checked : CheckboxState.Unchecked; } protected override void Dispose(bool isDisposing) diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index a4f6092d66..12eeb771dd 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -98,13 +98,10 @@ namespace osu.Game.Graphics.UserInterface DisplayedCount = Current; - Current.ValueChanged += currentChanged; - } - - private void currentChanged(object sender, EventArgs e) - { - if (IsLoaded) - TransformCount(displayedCount, Current); + Current.ValueChanged += newValue => + { + if (IsLoaded) TransformCount(displayedCount, newValue); + }; } protected override void LoadComplete() diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs index 374385e351..4933c170e8 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; @@ -19,7 +18,7 @@ namespace osu.Game.Graphics.UserInterface.Volume protected override bool HideOnEscape => false; - private void volumeChanged(object sender, EventArgs e) + private void volumeChanged(double newVolume) { Show(); schedulePopOut(); diff --git a/osu.Game/Modes/UI/ComboCounter.cs b/osu.Game/Modes/UI/ComboCounter.cs index 3629634889..8c0327fa04 100644 --- a/osu.Game/Modes/UI/ComboCounter.cs +++ b/osu.Game/Modes/UI/ComboCounter.cs @@ -66,12 +66,7 @@ namespace osu.Game.Modes.UI TextSize = 80; - Current.ValueChanged += comboChanged; - } - - private void comboChanged(object sender, System.EventArgs e) - { - updateCount(Current.Value == 0); + Current.ValueChanged += newValue => updateCount(newValue == 0); } protected override void LoadComplete() diff --git a/osu.Game/Modes/UI/HealthDisplay.cs b/osu.Game/Modes/UI/HealthDisplay.cs index 3471f4bc3f..4c8d7e4ab8 100644 --- a/osu.Game/Modes/UI/HealthDisplay.cs +++ b/osu.Game/Modes/UI/HealthDisplay.cs @@ -16,7 +16,7 @@ namespace osu.Game.Modes.UI protected HealthDisplay() { - Current.ValueChanged += (s, e) => SetHealth((float)Current); + Current.ValueChanged += newValue => SetHealth((float)newValue); } protected abstract void SetHealth(float value); diff --git a/osu.Game/Modes/UI/HudOverlay.cs b/osu.Game/Modes/UI/HudOverlay.cs index a6c54e7f3a..945f4a2fa8 100644 --- a/osu.Game/Modes/UI/HudOverlay.cs +++ b/osu.Game/Modes/UI/HudOverlay.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Containers; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Play; -using System; using osu.Game.Modes.Scoring; namespace osu.Game.Modes.UI @@ -47,18 +46,16 @@ namespace osu.Game.Modes.UI private void load(OsuConfigManager config) { showKeyCounter = config.GetBindable(OsuConfig.KeyOverlay); - showKeyCounter.ValueChanged += visibilityChanged; + showKeyCounter.ValueChanged += visibility => + { + if (visibility) + KeyCounter.Show(); + else + KeyCounter.Hide(); + }; showKeyCounter.TriggerChange(); } - private void visibilityChanged(object sender, EventArgs e) - { - if (showKeyCounter) - KeyCounter.Show(); - else - KeyCounter.Hide(); - } - public void BindProcessor(ScoreProcessor processor) { //bind processor bindables to combocounter, score display etc. diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 0272438927..2b9f8e86a9 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -39,9 +39,9 @@ namespace osu.Game.Overlays.Mods public readonly Bindable PlayMode = new Bindable(); - private void modeChanged(object sender, EventArgs eventArgs) + private void modeChanged(PlayMode newMode) { - var ruleset = Ruleset.GetRuleset(PlayMode); + var ruleset = Ruleset.GetRuleset(newMode); foreach (ModSection section in modSectionsContainer.Children) section.Buttons = ruleset.GetModsFor(section.ModType).Select(m => new ModButton(m)).ToArray(); refreshSelectedMods(); @@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Mods if (osu != null) PlayMode.BindTo(osu.PlayMode); PlayMode.ValueChanged += modeChanged; - modeChanged(null, null); + PlayMode.TriggerChange(); } protected override void PopOut() diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index aa0ea1ae9b..9f3eeb47a0 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -78,8 +78,6 @@ namespace osu.Game.Overlays [BackgroundDependencyLoader] private void load(OsuGameBase game, OsuConfigManager config, BeatmapDatabase beatmaps, OsuColour colours) { - unicodeString = config.GetUnicodeString; - Children = new Drawable[] { dragContainer = new Container @@ -210,7 +208,7 @@ namespace osu.Game.Overlays this.beatmaps = beatmaps; trackManager = game.Audio.Track; preferUnicode = config.GetBindable(OsuConfig.ShowUnicode); - preferUnicode.ValueChanged += preferUnicode_changed; + preferUnicode.ValueChanged += unicode => updateDisplay(current, TransformDirection.None); beatmapSource = game.Beatmap ?? new Bindable(); playList = beatmaps.GetAllWithChildren(); @@ -222,7 +220,8 @@ namespace osu.Game.Overlays protected override void LoadComplete() { beatmapSource.ValueChanged += workingChanged; - workingChanged(); + beatmapSource.TriggerChange(); + base.LoadComplete(); } @@ -247,17 +246,12 @@ namespace osu.Game.Overlays playButton.Icon = FontAwesome.fa_play_circle_o; } - private void preferUnicode_changed(object sender, EventArgs e) + private void workingChanged(WorkingBeatmap beatmap) { - updateDisplay(current, TransformDirection.None); - } - - private void workingChanged(object sender = null, EventArgs e = null) - { - progress.IsEnabled = beatmapSource.Value != null; - if (beatmapSource.Value == current) return; - bool audioEquals = current?.BeatmapInfo?.AudioEquals(beatmapSource?.Value?.BeatmapInfo) ?? false; - current = beatmapSource.Value; + progress.IsEnabled = beatmap != null; + if (beatmap == current) return; + bool audioEquals = current?.BeatmapInfo?.AudioEquals(beatmap?.BeatmapInfo) ?? false; + current = beatmap; updateDisplay(current, audioEquals ? TransformDirection.None : TransformDirection.Next); appendToHistory(current?.BeatmapInfo); } @@ -342,8 +336,8 @@ namespace osu.Game.Overlays else { BeatmapMetadata metadata = beatmap.Beatmap.BeatmapInfo.Metadata; - title.Text = unicodeString(metadata.Title, metadata.TitleUnicode); - artist.Text = unicodeString(metadata.Artist, metadata.ArtistUnicode); + title.Text = preferUnicode ? metadata.TitleUnicode : metadata.Title; + artist.Text = preferUnicode ? metadata.ArtistUnicode : metadata.Artist; } }); @@ -374,21 +368,12 @@ namespace osu.Game.Overlays }; } - private Func unicodeString; - private void seek(float position) { current?.Track?.Seek(current.Track.Length * position); current?.Track?.Start(); } - protected override void Dispose(bool isDisposing) - { - if (preferUnicode != null) - preferUnicode.ValueChanged -= preferUnicode_changed; - base.Dispose(isDisposing); - } - private const float transition_length = 800; protected override void PopIn() diff --git a/osu.Game/Overlays/Options/OptionSlider.cs b/osu.Game/Overlays/Options/OptionSlider.cs index 772d2c37e6..8fa9bf063d 100644 --- a/osu.Game/Overlays/Options/OptionSlider.cs +++ b/osu.Game/Overlays/Options/OptionSlider.cs @@ -29,10 +29,10 @@ namespace osu.Game.Overlays.Options public BindableNumber Bindable { - get { return slider.Bindable; } + get { return slider.Value; } set { - slider.Bindable = value; + slider.Value = value; if (value?.Disabled ?? true) Alpha = 0.3f; } diff --git a/osu.Game/Overlays/Options/OptionTextBox.cs b/osu.Game/Overlays/Options/OptionTextBox.cs index 47c81e6a7e..722f24d50d 100644 --- a/osu.Game/Overlays/Options/OptionTextBox.cs +++ b/osu.Game/Overlays/Options/OptionTextBox.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Configuration; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; @@ -41,10 +40,7 @@ namespace osu.Game.Overlays.Options bindable.Value = Text; } - private void bindableValueChanged(object sender, EventArgs e) - { - Text = bindable.Value; - } + private void bindableValueChanged(string newValue) => Text = newValue; protected override void Dispose(bool isDisposing) { diff --git a/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs index 8c4930d99d..b04f853ec4 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs @@ -5,7 +5,6 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; -using System; namespace osu.Game.Overlays.Options.Sections.Graphics { @@ -52,9 +51,9 @@ namespace osu.Game.Overlays.Options.Sections.Graphics letterboxing.TriggerChange(); } - private void visibilityChanged(object sender, EventArgs e) + private void visibilityChanged(bool newVisibility) { - if (letterboxing) + if (newVisibility) { letterboxPositionX.Show(); letterboxPositionY.Show(); diff --git a/osu.Game/Screens/OsuGameScreen.cs b/osu.Game/Screens/OsuGameScreen.cs index a5c6cec09e..3e832b36fa 100644 --- a/osu.Game/Screens/OsuGameScreen.cs +++ b/osu.Game/Screens/OsuGameScreen.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Screens; @@ -40,11 +39,6 @@ namespace osu.Game.Screens } } - private void beatmap_ValueChanged(object sender, EventArgs e) - { - OnBeatmapChanged(beatmap.Value); - } - [BackgroundDependencyLoader(permitNulls: true)] private void load(OsuGameBase game) { @@ -57,7 +51,7 @@ namespace osu.Game.Screens beatmap.Value = localMap; } - beatmap.ValueChanged += beatmap_ValueChanged; + beatmap.ValueChanged += OnBeatmapChanged; } protected virtual void OnBeatmapChanged(WorkingBeatmap beatmap) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index c678e9bf37..b263b5507c 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -275,7 +275,8 @@ namespace osu.Game.Screens.Play Background?.FadeTo((100f - dimLevel) / 100, 1500, EasingTypes.OutQuint); Content.Alpha = 0; - dimLevel.ValueChanged += dimChanged; + + dimLevel.ValueChanged += newDim => Background?.FadeTo((100f - newDim) / 100, 800); Content.ScaleTo(0.7f); @@ -318,18 +319,11 @@ namespace osu.Game.Screens.Play { FadeOut(250); Content.ScaleTo(0.7f, 750, EasingTypes.InQuint); - - dimLevel.ValueChanged -= dimChanged; Background?.FadeTo(1f, 200); return base.OnExiting(next); } } - private void dimChanged(object sender, EventArgs e) - { - Background?.FadeTo((100f - dimLevel) / 100, 800); - } - private Bindable mouseWheelDisabled; protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !IsPaused; diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index c9ea9e884e..c52d0397ed 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -61,7 +61,7 @@ namespace osu.Game.Screens.Select }, }; - tabs.SelectedItem.ValueChanged += (sender, e) => invokeOnFilter(); + tabs.SelectedItem.ValueChanged += item => invokeOnFilter(); modsCheckbox.Action += (sender, e) => invokeOnFilter(); tabs.SelectedItem.Value = BeatmapDetailTab.Global; diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 5445847da5..26daddc3a9 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -151,8 +151,8 @@ namespace osu.Game.Screens.Select groupTabs.PinItem(GroupMode.All); groupTabs.PinItem(GroupMode.RecentlyPlayed); - groupTabs.ItemChanged += (sender, value) => Group = value; - sortTabs.ItemChanged += (sender, value) => Sort = value; + groupTabs.SelectedItem.ValueChanged += val => Group = val; + sortTabs.SelectedItem.ValueChanged += val => Sort = val; } public void Deactivate() @@ -175,7 +175,7 @@ namespace osu.Game.Screens.Select if (osu != null) playMode.BindTo(osu.PlayMode); - playMode.ValueChanged += (s, e) => FilterChanged?.Invoke(CreateCriteria()); + playMode.ValueChanged += val => FilterChanged?.Invoke(CreateCriteria()); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 656adf0d62..44204f5beb 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Linq; using System.Threading; using OpenTK; @@ -170,7 +169,7 @@ namespace osu.Game.Screens.Select if (osu != null) playMode.BindTo(osu.PlayMode); - playMode.ValueChanged += playMode_ValueChanged; + playMode.ValueChanged += val => Beatmap.PreferredPlayMode = val; if (database == null) database = beatmaps; @@ -276,8 +275,6 @@ namespace osu.Game.Screens.Select initialAddSetsTask.Cancel(); } - private void playMode_ValueChanged(object sender, EventArgs e) => Beatmap.PreferredPlayMode = playMode; - private void changeBackground(WorkingBeatmap beatmap) { var backgroundModeBeatmap = Background as BackgroundScreenBeatmap; From c6216dbde12a8a212bae9ae2c36d5e372ce63de2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Apr 2017 15:22:54 +0900 Subject: [PATCH 6/7] Remove outdated todo. --- osu.Game/Modes/UI/HudOverlay.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Modes/UI/HudOverlay.cs b/osu.Game/Modes/UI/HudOverlay.cs index 945f4a2fa8..45dce8b332 100644 --- a/osu.Game/Modes/UI/HudOverlay.cs +++ b/osu.Game/Modes/UI/HudOverlay.cs @@ -58,8 +58,6 @@ namespace osu.Game.Modes.UI public void BindProcessor(ScoreProcessor processor) { - //bind processor bindables to combocounter, score display etc. - //TODO: these should be bindable binds, not events! ScoreCounter?.Current.BindTo(processor.TotalScore); AccuracyCounter?.Current.BindTo(processor.Accuracy); ComboCounter?.Current.BindTo(processor.Combo); From 1233fb5b82755271b3c248641ae760c66249d420 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Apr 2017 14:41:46 +0900 Subject: [PATCH 7/7] Split noto out into individual ranges. --- osu.Game/OsuGameBase.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index f454956de7..f95e8c3ac6 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -92,7 +92,10 @@ namespace osu.Game Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Medium")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-MediumItalic")); - Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto")); + Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-Basic")); + Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-Hangul")); + Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-CJK-Basic")); + Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-CJK-Compatibility")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Regular")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-RegularItalic"));