From e94425f311d2c3f844bf37c90d038513a192563c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 12 Jun 2017 16:40:53 +0900 Subject: [PATCH 01/10] Improve the loading animation and use it in multiple places - Supersedes https://github.com/ppy/osu/pull/926. - [ ] Depends on https://github.com/ppy/osu-framework/pull/817. --- osu-framework | 2 +- .../UserInterface/LoadingAnimation.cs | 41 +++++++++++++++++-- osu.Game/Overlays/ChatOverlay.cs | 29 ++++++------- osu.Game/Overlays/DialogOverlay.cs | 2 +- osu.Game/Overlays/SocialOverlay.cs | 13 +++++- .../Toolbar/ToolbarOverlayToggleButton.cs | 2 +- osu.Game/Screens/Select/BeatmapDetails.cs | 12 ++++-- .../Select/Leaderboards/Leaderboard.cs | 13 +++++- 8 files changed, 86 insertions(+), 28 deletions(-) diff --git a/osu-framework b/osu-framework index 83ee0bf599..fafadf5e8e 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 83ee0bf59995a4399dd7c2ee676cdac6ac1669f8 +Subproject commit fafadf5e8e204c971c56b3141ce0e1388cfce62d diff --git a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs index 61ec859b44..27a888f0b5 100644 --- a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs +++ b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs @@ -1,15 +1,48 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using OpenTK; namespace osu.Game.Graphics.UserInterface { - public class LoadingAnimation : SpriteText + public class LoadingAnimation : VisibilityContainer { + private readonly TextAwesome spinner; + public LoadingAnimation() { - Text = "Loading"; + Size = new Vector2(20); + + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + + Children = new Drawable[] + { + spinner = new TextAwesome + { + TextSize = 20, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Icon = FontAwesome.fa_spinner + } + }; } + + protected override void LoadComplete() + { + base.LoadComplete(); + + spinner.RotateTo(360, 2000); + using (spinner.BeginDelayedSequence(2000)) + spinner.Loop(); + } + + private const float transition_duration = 500; + + protected override void PopIn() => FadeIn(transition_duration * 5, EasingTypes.OutQuint); + + protected override void PopOut() => FadeOut(transition_duration, EasingTypes.OutQuint); } -} \ No newline at end of file +} diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 08b40b6079..4f51575da3 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -12,7 +12,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Threading; -using osu.Game.Graphics.Sprites; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.Chat; @@ -33,7 +32,9 @@ namespace osu.Game.Overlays private ScheduledDelegate messageRequest; - private readonly Container currentChannelContainer; + private readonly Container currentChannelContainer; + + private readonly LoadingAnimation loading; private readonly FocusedTextBox inputTextBox; @@ -104,7 +105,7 @@ namespace osu.Game.Overlays { RelativeSizeAxes = Axes.Both, }, - currentChannelContainer = new Container + currentChannelContainer = new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding @@ -138,7 +139,8 @@ namespace osu.Game.Overlays HoldFocus = true, } } - } + }, + loading = new LoadingAnimation(), } }, new Container @@ -274,14 +276,7 @@ namespace osu.Game.Overlays private void initializeChannels() { - SpriteText loading; - Add(loading = new OsuSpriteText - { - Text = @"initialising chat...", - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - TextSize = 40, - }); + loading.Show(); messageRequest?.Cancel(); @@ -290,9 +285,6 @@ namespace osu.Game.Overlays { Scheduler.Add(delegate { - loading.FadeOut(100); - loading.Expire(); - addChannel(channels.Find(c => c.Name == @"#lazer")); addChannel(channels.Find(c => c.Name == @"#osu")); addChannel(channels.Find(c => c.Name == @"#lobby")); @@ -336,13 +328,17 @@ namespace osu.Game.Overlays if (loaded == null) { currentChannelContainer.FadeOut(500, EasingTypes.OutQuint); + loading.Show(); loaded = new DrawableChannel(currentChannel); loadedChannels.Add(loaded); LoadComponentAsync(loaded, l => { + if (currentChannel.Messages.Any()) + loading.Hide(); + currentChannelContainer.Clear(false); - currentChannelContainer.Add(l); + currentChannelContainer.Add(loaded); currentChannelContainer.FadeIn(500, EasingTypes.OutQuint); }); } @@ -386,6 +382,7 @@ namespace osu.Game.Overlays req.Success += delegate (List messages) { + loading.Hide(); channel.AddNewMessages(messages.ToArray()); Debug.Write("success!"); }; diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index 9454272728..461eb2595a 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -29,7 +29,7 @@ namespace osu.Game.Overlays State = Visibility.Visible; } - private void onDialogOnStateChanged(OverlayContainer dialog, Visibility v) + private void onDialogOnStateChanged(VisibilityContainer dialog, Visibility v) { if (v != Visibility.Hidden) return; diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 97c27a9ea9..c6ce20f5cf 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -9,6 +9,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Overlays.SearchableList; @@ -29,6 +30,8 @@ namespace osu.Game.Overlays protected override SearchableListFilterControl CreateFilterControl() => new FilterControl(); private IEnumerable users; + private readonly LoadingAnimation loading; + public IEnumerable Users { get { return users; } @@ -68,6 +71,8 @@ namespace osu.Game.Overlays Spacing = new Vector2(10f), }, }; + + Add(loading = new LoadingAnimation()); } [BackgroundDependencyLoader] @@ -83,8 +88,14 @@ namespace osu.Game.Overlays // no this is not the correct data source, but it's something. var request = new GetUsersRequest(); - request.Success += res => Users = res.Select(e => e.User); + request.Success += res => + { + Users = res.Select(e => e.User); + loading.Hide(); + }; + api.Queue(request); + loading.Show(); } public void APIStateChanged(APIAccess api, APIState state) diff --git a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs index fa668bad60..976164a53e 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs @@ -45,7 +45,7 @@ namespace osu.Game.Overlays.Toolbar stateContainer.StateChanged -= stateChanged; } - private void stateChanged(OverlayContainer c, Visibility state) + private void stateChanged(VisibilityContainer c, Visibility state) { switch (state) { diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 2aec489508..aefb9901b6 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -80,8 +80,8 @@ namespace osu.Game.Screens.Select lookup.Success += res => { if (beatmap != requestedBeatmap) - //the beatmap has been changed since we started the lookup. - return; + //the beatmap has been changed since we started the lookup. + return; requestedBeatmap.Metrics = res; Schedule(() => updateMetrics(res)); @@ -89,6 +89,7 @@ namespace osu.Game.Screens.Select lookup.Failure += e => updateMetrics(null); api.Queue(lookup); + loading.Show(); } updateMetrics(requestedBeatmap.Metrics, false); @@ -104,6 +105,9 @@ namespace osu.Game.Screens.Select var hasRatings = metrics?.Ratings.Any() ?? false; var hasRetriesFails = (metrics?.Retries.Any() ?? false) && metrics.Fails.Any(); + if (failOnMissing) + loading.Hide(); + if (hasRatings) { var ratings = metrics.Ratings.ToList(); @@ -320,11 +324,13 @@ namespace osu.Game.Screens.Select } }, }, - } + }, + loading = new LoadingAnimation() }; } private APIAccess api; + private readonly LoadingAnimation loading; [BackgroundDependencyLoader] private void load(OsuColour colour, APIAccess api) diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 7d97581a29..510ba68f2c 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -12,6 +12,7 @@ using System; using osu.Framework.Allocation; using osu.Framework.Threading; using osu.Game.Database; +using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Scoring; using osu.Game.Online.API; using osu.Game.Online.API.Requests; @@ -25,6 +26,8 @@ namespace osu.Game.Screens.Select.Leaderboards public Action ScoreSelected; + private LoadingAnimation loading; + private IEnumerable scores; public IEnumerable Scores { @@ -86,6 +89,7 @@ namespace osu.Game.Screens.Select.Leaderboards }, }, }, + loading = new LoadingAnimation() }; } @@ -117,6 +121,7 @@ namespace osu.Game.Screens.Select.Leaderboards } private GetScoresRequest getScoresRequest; + private void updateScores() { if (!IsLoaded) return; @@ -126,8 +131,14 @@ namespace osu.Game.Screens.Select.Leaderboards if (api == null || Beatmap == null) return; + loading.Show(); + getScoresRequest = new GetScoresRequest(Beatmap); - getScoresRequest.Success += r => Scores = r.Scores; + getScoresRequest.Success += r => + { + Scores = r.Scores; + loading.Hide(); + }; api.Queue(getScoresRequest); } From 6c71e8447ca94caeb1ab514c782affcd89853917 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 12 Jun 2017 12:55:58 +0300 Subject: [PATCH 02/10] update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 83ee0bf599..ea2797c611 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 83ee0bf59995a4399dd7c2ee676cdac6ac1669f8 +Subproject commit ea2797c611a494369e1d3292c55f51b19bc5eeb2 From 171125803812bc31af05b8e6bb4a9eb162a1c619 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 12 Jun 2017 12:56:07 +0300 Subject: [PATCH 03/10] Context Menu --- .../Tests/TestCaseContextMenu.cs | 126 ++++++++++++++++++ .../osu.Desktop.VisualTests.csproj | 1 + .../Cursor/OsuContextMenuContainer.cs | 18 +++ osu.Game/Graphics/OsuColour.cs | 2 + .../Graphics/UserInterface/ContextMenuType.cs | 12 ++ .../Graphics/UserInterface/OsuContextMenu.cs | 45 +++++++ .../UserInterface/OsuContextMenuItem.cs | 114 ++++++++++++++++ osu.Game/OsuGameBase.cs | 1 + osu.Game/osu.Game.csproj | 10 +- 9 files changed, 326 insertions(+), 3 deletions(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs create mode 100644 osu.Game/Graphics/Cursor/OsuContextMenuContainer.cs create mode 100644 osu.Game/Graphics/UserInterface/ContextMenuType.cs create mode 100644 osu.Game/Graphics/UserInterface/OsuContextMenu.cs create mode 100644 osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs new file mode 100644 index 0000000000..ac7fe4b403 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs @@ -0,0 +1,126 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transforms; +using osu.Framework.Graphics.UserInterface; +using osu.Framework.Testing; +using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseContextMenu : TestCase + { + public override string Description => @"Menu visible on right click"; + + private const int start_time = 0; + private const int duration = 1000; + + private MyContextMenuContainer container; + + public override void Reset() + { + base.Reset(); + + Add(container = new MyContextMenuContainer + { + Size = new Vector2(200), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + new Framework.Graphics.Sprites.Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Green, + } + } + }); + + Add(new AnotherContextMenuContainer + { + Size = new Vector2(200), + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Red, + } + } + }); + + container.Transforms.Add(new TransformPosition + { + StartValue = Vector2.Zero, + EndValue = new Vector2(0, 100), + StartTime = start_time, + EndTime = start_time + duration, + LoopCount = -1, + LoopDelay = duration * 3 + }); + container.Transforms.Add(new TransformPosition + { + StartValue = new Vector2(0, 100), + EndValue = new Vector2(100, 100), + StartTime = start_time + duration, + EndTime = start_time + duration * 2, + LoopCount = -1, + LoopDelay = duration * 3 + }); + container.Transforms.Add(new TransformPosition + { + StartValue = new Vector2(100, 100), + EndValue = new Vector2(100, 0), + StartTime = start_time + duration * 2, + EndTime = start_time + duration * 3, + LoopCount = -1, + LoopDelay = duration * 3 + }); + container.Transforms.Add(new TransformPosition + { + StartValue = new Vector2(100, 0), + EndValue = Vector2.Zero, + StartTime = start_time + duration * 3, + EndTime = start_time + duration * 4, + LoopCount = -1, + LoopDelay = duration * 3 + }); + } + + private class MyContextMenuContainer : Container, IHasContextMenu + { + public ContextMenuItem[] ContextMenuItems => new[] + { + new OsuContextMenuItem(@"Some option"), + new OsuContextMenuItem(@"Highlighted option", ContextMenuType.Highlighted), + new OsuContextMenuItem(@"Another option"), + new OsuContextMenuItem(@"Choose me please"), + new OsuContextMenuItem(@"And me too"), + new OsuContextMenuItem(@"Trying to fill"), + new OsuContextMenuItem(@"Destructive option", ContextMenuType.Destructive), + }; + } + + private class AnotherContextMenuContainer : Container, IHasContextMenu + { + public ContextMenuItem[] ContextMenuItems => new[] + { + new OsuContextMenuItem(@"Simple option"), + new OsuContextMenuItem(@"Simple very very long option"), + new OsuContextMenuItem(@"Change width", ContextMenuType.Highlighted) { Action = () => ResizeWidthTo(Width * 2, 100, EasingTypes.OutQuint) }, + new OsuContextMenuItem(@"Change height", ContextMenuType.Highlighted) { Action = () => ResizeHeightTo(Height * 2, 100, EasingTypes.OutQuint) }, + new OsuContextMenuItem(@"Change width back", ContextMenuType.Destructive) { Action = () => ResizeWidthTo(Width / 2, 100, EasingTypes.OutQuint) }, + new OsuContextMenuItem(@"Change height back", ContextMenuType.Destructive) { Action = () => ResizeHeightTo(Height / 2, 100, EasingTypes.OutQuint) }, + }; + } + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index d1d0cc1c1a..c32d38482a 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -187,6 +187,7 @@ + diff --git a/osu.Game/Graphics/Cursor/OsuContextMenuContainer.cs b/osu.Game/Graphics/Cursor/OsuContextMenuContainer.cs new file mode 100644 index 0000000000..2cc6c3a46a --- /dev/null +++ b/osu.Game/Graphics/Cursor/OsuContextMenuContainer.cs @@ -0,0 +1,18 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics.Cursor; +using osu.Framework.Graphics.UserInterface; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Graphics.Cursor +{ + public class OsuContextMenuContainer : ContextMenuContainer + { + protected override ContextMenu CreateContextMenu() => new OsuContextMenu(); + + public OsuContextMenuContainer(CursorContainer cursor) : base(cursor) + { + } + } +} \ No newline at end of file diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index 3d83668d07..d2f4d4768c 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -87,5 +87,7 @@ namespace osu.Game.Graphics public readonly Color4 RedDarker = FromHex(@"870000"); public readonly Color4 ChatBlue = FromHex(@"17292e"); + + public readonly Color4 ContextMenuGray = FromHex(@"223034"); } } diff --git a/osu.Game/Graphics/UserInterface/ContextMenuType.cs b/osu.Game/Graphics/UserInterface/ContextMenuType.cs new file mode 100644 index 0000000000..11086f13b8 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/ContextMenuType.cs @@ -0,0 +1,12 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Graphics +{ + public enum ContextMenuType + { + Standard, + Highlighted, + Destructive, + } +} \ No newline at end of file diff --git a/osu.Game/Graphics/UserInterface/OsuContextMenu.cs b/osu.Game/Graphics/UserInterface/OsuContextMenu.cs new file mode 100644 index 0000000000..684bc840ec --- /dev/null +++ b/osu.Game/Graphics/UserInterface/OsuContextMenu.cs @@ -0,0 +1,45 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.UserInterface; + +namespace osu.Game.Graphics.UserInterface +{ + public class OsuContextMenu : ContextMenu + where TItem : ContextMenuItem + { + protected override Menu CreateMenu() => new CustomMenu(); + + public class CustomMenu : Menu + { + private const int fade_duration = 250; + + public CustomMenu() + { + CornerRadius = 5; + ItemsContainer.Padding = new MarginPadding { Vertical = OsuContextMenuItem.MARGIN_VERTICAL }; + Masking = true; + EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(0.25f), + Radius = 4, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Background.Colour = colours.ContextMenuGray; + } + + protected override void AnimateOpen() => FadeIn(fade_duration, EasingTypes.OutQuint); + protected override void AnimateClose() => FadeOut(fade_duration, EasingTypes.OutQuint); + } + } +} \ No newline at end of file diff --git a/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs b/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs new file mode 100644 index 0000000000..a9b4975552 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs @@ -0,0 +1,114 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Graphics.UserInterface +{ + public class OsuContextMenuItem : ContextMenuItem + { + private const int transition_length = 200; + private const int margin_horizontal = 17; + public const int MARGIN_VERTICAL = 4; + private const int text_size = 17; + + private OsuSpriteText text; + private OsuSpriteText textBold; + + private SampleChannel sampleClick; + private SampleChannel sampleHover; + + private ContextMenuType type; + + protected override Container CreateTextContainer(string title) => new Container + { + AutoSizeAxes = Axes.Both, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Children = new Drawable[] + { + text = new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = text_size, + Text = title, + Margin = new MarginPadding { Horizontal = margin_horizontal, Vertical = MARGIN_VERTICAL }, + }, + textBold = new OsuSpriteText + { + AlwaysPresent = true, + Alpha = 0, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = text_size, + Text = title, + Font = @"Exo2.0-Bold", + Margin = new MarginPadding { Horizontal = margin_horizontal, Vertical = MARGIN_VERTICAL }, + } + } + }; + + public OsuContextMenuItem(string title, ContextMenuType type = ContextMenuType.Standard) : base(title) + { + this.type = type; + } + + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + sampleHover = audio.Sample.Get(@"Menu/menuclick"); + sampleClick = audio.Sample.Get(@"Menu/menuback"); + + BackgroundColour = Color4.Transparent; + BackgroundColourHover = OsuColour.FromHex(@"172023"); + + updateTextColour(); + } + + private void updateTextColour() + { + switch (type) + { + case ContextMenuType.Standard: + textBold.Colour = text.Colour = Color4.White; + break; + case ContextMenuType.Destructive: + textBold.Colour = text.Colour = Color4.Red; + break; + case ContextMenuType.Highlighted: + textBold.Colour = text.Colour = OsuColour.FromHex(@"ffcc22"); + break; + } + } + + protected override bool OnHover(InputState state) + { + sampleHover.Play(); + textBold.FadeIn(transition_length, EasingTypes.OutQuint); + text.FadeOut(transition_length, EasingTypes.OutQuint); + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + textBold.FadeOut(transition_length, EasingTypes.OutQuint); + text.FadeIn(transition_length, EasingTypes.OutQuint); + base.OnHoverLost(state); + } + + protected override bool OnClick(InputState state) + { + sampleClick.Play(); + return base.OnClick(state); + } + } +} \ No newline at end of file diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index b228b6485a..306cdaddf0 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -158,6 +158,7 @@ namespace osu.Game Children = new Drawable[] { Cursor = new MenuCursor(), + new OsuContextMenuContainer(Cursor) { Depth = -2 }, new OsuTooltipContainer(Cursor) { Depth = -1 }, } }, diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index a299ea3cb2..fd7bbe058f 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -43,8 +43,8 @@ $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll - $(SolutionDir)\packages\sharpcompress.0.15.2\lib\net45\SharpCompress.dll - $(SolutionDir)\packages\SharpCompress.0.15.2\lib\net45\SharpCompress.dll + $(SolutionDir)\packages\sharpcompress.0.15.2\lib\net45\SharpCompress.dll + $(SolutionDir)\packages\SharpCompress.0.15.2\lib\net45\SharpCompress.dll $(SolutionDir)\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll @@ -75,8 +75,12 @@ + + + + @@ -505,4 +509,4 @@ --> - + \ No newline at end of file From 41eb084191c855cb24fdbda197f11b8ab67210e3 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 12 Jun 2017 13:37:13 +0300 Subject: [PATCH 04/10] CI fixes --- osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs | 6 +++--- osu.Game/Graphics/{UserInterface => }/ContextMenuType.cs | 0 osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs | 2 +- osu.Game/osu.Game.csproj | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) rename osu.Game/Graphics/{UserInterface => }/ContextMenuType.cs (100%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs index ac7fe4b403..48bfbe3cf4 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs @@ -35,7 +35,7 @@ namespace osu.Desktop.VisualTests.Tests Origin = Anchor.Centre, Children = new Drawable[] { - new Framework.Graphics.Sprites.Box + new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Green, @@ -98,7 +98,7 @@ namespace osu.Desktop.VisualTests.Tests private class MyContextMenuContainer : Container, IHasContextMenu { - public ContextMenuItem[] ContextMenuItems => new[] + public ContextMenuItem[] ContextMenuItems => new ContextMenuItem[] { new OsuContextMenuItem(@"Some option"), new OsuContextMenuItem(@"Highlighted option", ContextMenuType.Highlighted), @@ -112,7 +112,7 @@ namespace osu.Desktop.VisualTests.Tests private class AnotherContextMenuContainer : Container, IHasContextMenu { - public ContextMenuItem[] ContextMenuItems => new[] + public ContextMenuItem[] ContextMenuItems => new ContextMenuItem[] { new OsuContextMenuItem(@"Simple option"), new OsuContextMenuItem(@"Simple very very long option"), diff --git a/osu.Game/Graphics/UserInterface/ContextMenuType.cs b/osu.Game/Graphics/ContextMenuType.cs similarity index 100% rename from osu.Game/Graphics/UserInterface/ContextMenuType.cs rename to osu.Game/Graphics/ContextMenuType.cs diff --git a/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs b/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs index a9b4975552..f5786598bf 100644 --- a/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs @@ -26,7 +26,7 @@ namespace osu.Game.Graphics.UserInterface private SampleChannel sampleClick; private SampleChannel sampleHover; - private ContextMenuType type; + private readonly ContextMenuType type; protected override Container CreateTextContainer(string title) => new Container { diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index fd7bbe058f..8ffbf75139 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -76,7 +76,7 @@ - + From 9f8c66b8c6c8facb815ad9871c196e95b51f1862 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 12 Jun 2017 13:39:45 +0300 Subject: [PATCH 05/10] Forgot to add dropdown-like animation --- osu.Game/Graphics/UserInterface/OsuContextMenu.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game/Graphics/UserInterface/OsuContextMenu.cs b/osu.Game/Graphics/UserInterface/OsuContextMenu.cs index 684bc840ec..3aba4afd0a 100644 --- a/osu.Game/Graphics/UserInterface/OsuContextMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuContextMenu.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; @@ -40,6 +41,12 @@ namespace osu.Game.Graphics.UserInterface protected override void AnimateOpen() => FadeIn(fade_duration, EasingTypes.OutQuint); protected override void AnimateClose() => FadeOut(fade_duration, EasingTypes.OutQuint); + + protected override void UpdateContentHeight() + { + var actualHeight = (RelativeSizeAxes & Axes.Y) > 0 ? 1 : ContentHeight; + ResizeTo(new Vector2(1, State == MenuState.Opened ? actualHeight : 0), 300, EasingTypes.OutQuint); + } } } } \ No newline at end of file From 41d4aee4f5f5e7b820322cda8af3b938cd398da9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 13 Jun 2017 11:50:46 +0900 Subject: [PATCH 06/10] Update nuget packages - [ ] Depends on framework partner in crime https://github.com/ppy/osu-framework/pull/820 --- osu.Desktop.Deploy/App.config | 4 ++++ osu.Desktop.Deploy/osu.Desktop.Deploy.csproj | 14 +++++++------- osu.Desktop.Deploy/packages.config | 5 +++-- osu.Desktop.Tests/app.config | 11 +++++++++++ osu.Desktop.Tests/osu.Desktop.Tests.csproj | 6 ++++-- osu.Desktop.Tests/packages.config | 2 +- .../osu.Desktop.VisualTests.csproj | 10 ++++++---- osu.Desktop.VisualTests/packages.config | 4 ++-- osu.Desktop/osu.Desktop.csproj | 15 ++++++++++----- osu.Desktop/packages.config | 5 +++-- .../osu.Game.Rulesets.Catch.csproj | 5 +++-- osu.Game.Rulesets.Catch/packages.config | 2 +- .../osu.Game.Rulesets.Mania.csproj | 5 +++-- osu.Game.Rulesets.Mania/packages.config | 2 +- .../osu.Game.Rulesets.Osu.csproj | 5 +++-- osu.Game.Rulesets.Osu/packages.config | 2 +- .../osu.Game.Rulesets.Taiko.csproj | 5 +++-- osu.Game.Rulesets.Taiko/packages.config | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 10 ++++++---- osu.Game.Tests/packages.config | 4 ++-- osu.Game/osu.Game.csproj | 11 ++++++----- osu.Game/packages.config | 4 ++-- 22 files changed, 83 insertions(+), 50 deletions(-) create mode 100644 osu.Desktop.Tests/app.config diff --git a/osu.Desktop.Deploy/App.config b/osu.Desktop.Deploy/App.config index 45685a74a8..6711f9c54e 100644 --- a/osu.Desktop.Deploy/App.config +++ b/osu.Desktop.Deploy/App.config @@ -31,6 +31,10 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste + + + + \ No newline at end of file diff --git a/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj b/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj index 1f9726b573..c6474eae5a 100644 --- a/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj +++ b/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj @@ -49,10 +49,6 @@ $(SolutionDir)\packages\DeltaCompressionDotNet.1.1.0\lib\net20\DeltaCompressionDotNet.PatchApi.dll True - - $(SolutionDir)\packages\squirrel.windows.1.5.2\lib\Net45\ICSharpCode.SharpZipLib.dll - True - $(SolutionDir)\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.dll True @@ -73,15 +69,19 @@ $(SolutionDir)\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll - $(SolutionDir)\packages\squirrel.windows.1.5.2\lib\Net45\NuGet.Squirrel.dll + $(SolutionDir)\packages\squirrel.windows.1.7.5\lib\Net45\NuGet.Squirrel.dll + True + + + $(SolutionDir)\packages\SharpCompress.0.17.1\lib\net45\SharpCompress.dll True $(SolutionDir)\packages\Splat.2.0.0\lib\Net45\Splat.dll True - - $(SolutionDir)\packages\squirrel.windows.1.5.2\lib\Net45\Squirrel.dll + + $(SolutionDir)\packages\squirrel.windows.1.7.5\lib\Net45\Squirrel.dll True diff --git a/osu.Desktop.Deploy/packages.config b/osu.Desktop.Deploy/packages.config index 4878297be9..3c5ca9f9a3 100644 --- a/osu.Desktop.Deploy/packages.config +++ b/osu.Desktop.Deploy/packages.config @@ -7,7 +7,8 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste - + + - + \ No newline at end of file diff --git a/osu.Desktop.Tests/app.config b/osu.Desktop.Tests/app.config new file mode 100644 index 0000000000..faeaf001de --- /dev/null +++ b/osu.Desktop.Tests/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/osu.Desktop.Tests/osu.Desktop.Tests.csproj b/osu.Desktop.Tests/osu.Desktop.Tests.csproj index f0620c98ef..f940e4be9e 100644 --- a/osu.Desktop.Tests/osu.Desktop.Tests.csproj +++ b/osu.Desktop.Tests/osu.Desktop.Tests.csproj @@ -37,8 +37,9 @@ $(SolutionDir)\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll - - $(SolutionDir)\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll + + $(SolutionDir)\packages\NUnit.3.7.1\lib\net45\nunit.framework.dll + True False @@ -100,6 +101,7 @@ osu.licenseheader + diff --git a/osu.Desktop.Tests/packages.config b/osu.Desktop.Tests/packages.config index ad51a60195..7bd35a3abe 100644 --- a/osu.Desktop.Tests/packages.config +++ b/osu.Desktop.Tests/packages.config @@ -5,7 +5,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste --> - + diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index d1d0cc1c1a..e8debc50da 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -87,11 +87,13 @@ $(SolutionDir)\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll - - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll + + $(SolutionDir)\packages\ppy.OpenTK.3.0\lib\net45\OpenTK.dll + True - - $(SolutionDir)\packages\SharpCompress.0.15.2\lib\net45\SharpCompress.dll + + $(SolutionDir)\packages\SharpCompress.0.17.1\lib\net45\SharpCompress.dll + True False diff --git a/osu.Desktop.VisualTests/packages.config b/osu.Desktop.VisualTests/packages.config index cad2ffff0d..2fb1023253 100644 --- a/osu.Desktop.VisualTests/packages.config +++ b/osu.Desktop.VisualTests/packages.config @@ -5,8 +5,8 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste --> - - + + diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 4f66dfd3eb..5ac888b515 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -121,18 +121,23 @@ - $(SolutionDir)\packages\squirrel.windows.1.5.2\lib\Net45\NuGet.Squirrel.dll + $(SolutionDir)\packages\squirrel.windows.1.7.5\lib\Net45\NuGet.Squirrel.dll True - - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll + + $(SolutionDir)\packages\ppy.OpenTK.3.0\lib\net45\OpenTK.dll + True + + + $(SolutionDir)\packages\SharpCompress.0.17.1\lib\net45\SharpCompress.dll + True $(SolutionDir)\packages\Splat.2.0.0\lib\Net45\Splat.dll True - - $(SolutionDir)\packages\squirrel.windows.1.5.2\lib\Net45\Squirrel.dll + + $(SolutionDir)\packages\squirrel.windows.1.7.5\lib\Net45\Squirrel.dll True diff --git a/osu.Desktop/packages.config b/osu.Desktop/packages.config index 60e8182c82..3ad2106d2b 100644 --- a/osu.Desktop/packages.config +++ b/osu.Desktop/packages.config @@ -7,7 +7,8 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste - + + - + \ No newline at end of file diff --git a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj index 281d2b5a79..83996df41a 100644 --- a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj +++ b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj @@ -33,8 +33,9 @@ false - - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll + + $(SolutionDir)\packages\ppy.OpenTK.3.0\lib\net45\OpenTK.dll + True diff --git a/osu.Game.Rulesets.Catch/packages.config b/osu.Game.Rulesets.Catch/packages.config index 634d0b51f6..fa6edb9c8f 100644 --- a/osu.Game.Rulesets.Catch/packages.config +++ b/osu.Game.Rulesets.Catch/packages.config @@ -5,5 +5,5 @@ Copyright (c) 2007-2017 ppy Pty Ltd . Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE --> - + \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index 3d5614bd90..154e3d9b3e 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -33,8 +33,9 @@ false - - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll + + $(SolutionDir)\packages\ppy.OpenTK.3.0\lib\net45\OpenTK.dll + True diff --git a/osu.Game.Rulesets.Mania/packages.config b/osu.Game.Rulesets.Mania/packages.config index 634d0b51f6..fa6edb9c8f 100644 --- a/osu.Game.Rulesets.Mania/packages.config +++ b/osu.Game.Rulesets.Mania/packages.config @@ -5,5 +5,5 @@ Copyright (c) 2007-2017 ppy Pty Ltd . Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE --> - + \ No newline at end of file diff --git a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj index 7219cf8769..f6f565c502 100644 --- a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj +++ b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj @@ -34,8 +34,9 @@ false - - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll + + $(SolutionDir)\packages\ppy.OpenTK.3.0\lib\net45\OpenTK.dll + True diff --git a/osu.Game.Rulesets.Osu/packages.config b/osu.Game.Rulesets.Osu/packages.config index 634d0b51f6..fa6edb9c8f 100644 --- a/osu.Game.Rulesets.Osu/packages.config +++ b/osu.Game.Rulesets.Osu/packages.config @@ -5,5 +5,5 @@ Copyright (c) 2007-2017 ppy Pty Ltd . Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE --> - + \ No newline at end of file diff --git a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj index 8d6fcb503c..f719f2002b 100644 --- a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj +++ b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj @@ -33,8 +33,9 @@ false - - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll + + $(SolutionDir)\packages\ppy.OpenTK.3.0\lib\net45\OpenTK.dll + True diff --git a/osu.Game.Rulesets.Taiko/packages.config b/osu.Game.Rulesets.Taiko/packages.config index dc059c684b..8add43d5d5 100644 --- a/osu.Game.Rulesets.Taiko/packages.config +++ b/osu.Game.Rulesets.Taiko/packages.config @@ -4,5 +4,5 @@ Copyright (c) 2007-2017 ppy Pty Ltd . Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE --> - + \ No newline at end of file diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index b8fcb80aaf..8ec68b41be 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -30,11 +30,13 @@ false - - $(SolutionDir)\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll + + $(SolutionDir)\packages\NUnit.3.7.1\lib\net45\nunit.framework.dll + True - - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll + + $(SolutionDir)\packages\ppy.OpenTK.3.0\lib\net45\OpenTK.dll + True diff --git a/osu.Game.Tests/packages.config b/osu.Game.Tests/packages.config index 9972fb41a1..9ad76308d7 100644 --- a/osu.Game.Tests/packages.config +++ b/osu.Game.Tests/packages.config @@ -4,8 +4,8 @@ Copyright (c) 2007-2017 ppy Pty Ltd . Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE --> - - + + \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index a299ea3cb2..62c3f53221 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -39,12 +39,13 @@ $(SolutionDir)\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll - - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll + + $(SolutionDir)\packages\ppy.OpenTK.3.0\lib\net45\OpenTK.dll + True - - $(SolutionDir)\packages\sharpcompress.0.15.2\lib\net45\SharpCompress.dll - $(SolutionDir)\packages\SharpCompress.0.15.2\lib\net45\SharpCompress.dll + + $(SolutionDir)\packages\SharpCompress.0.17.1\lib\net45\SharpCompress.dll + True $(SolutionDir)\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll diff --git a/osu.Game/packages.config b/osu.Game/packages.config index d51b0033ed..434f9328ea 100644 --- a/osu.Game/packages.config +++ b/osu.Game/packages.config @@ -6,8 +6,8 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste - - + + From cec9053f0bfc0d32e5600fe1bab6d592323f3a03 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 13 Jun 2017 14:01:56 +0900 Subject: [PATCH 07/10] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 83ee0bf599..b04ebcf58a 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 83ee0bf59995a4399dd7c2ee676cdac6ac1669f8 +Subproject commit b04ebcf58a21ef17374383500f449fade3511c85 From 679786c76f1778ee5951058e1c61aa7b21703040 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 13 Jun 2017 15:20:21 +0900 Subject: [PATCH 08/10] Move MenuItemType to correct namespace --- .../Tests/TestCaseContextMenu.cs | 13 ++++++------- .../MenuItemType.cs} | 4 ++-- .../Graphics/UserInterface/OsuContextMenuItem.cs | 10 +++++----- osu.Game/osu.Game.csproj | 2 +- 4 files changed, 14 insertions(+), 15 deletions(-) rename osu.Game/Graphics/{ContextMenuType.cs => UserInterface/MenuItemType.cs} (73%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs index 48bfbe3cf4..00d4d33c86 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs @@ -10,7 +10,6 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.UserInterface; using osu.Framework.Testing; -using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; namespace osu.Desktop.VisualTests.Tests @@ -101,12 +100,12 @@ namespace osu.Desktop.VisualTests.Tests public ContextMenuItem[] ContextMenuItems => new ContextMenuItem[] { new OsuContextMenuItem(@"Some option"), - new OsuContextMenuItem(@"Highlighted option", ContextMenuType.Highlighted), + new OsuContextMenuItem(@"Highlighted option", MenuItemType.Highlighted), new OsuContextMenuItem(@"Another option"), new OsuContextMenuItem(@"Choose me please"), new OsuContextMenuItem(@"And me too"), new OsuContextMenuItem(@"Trying to fill"), - new OsuContextMenuItem(@"Destructive option", ContextMenuType.Destructive), + new OsuContextMenuItem(@"Destructive option", MenuItemType.Destructive), }; } @@ -116,10 +115,10 @@ namespace osu.Desktop.VisualTests.Tests { new OsuContextMenuItem(@"Simple option"), new OsuContextMenuItem(@"Simple very very long option"), - new OsuContextMenuItem(@"Change width", ContextMenuType.Highlighted) { Action = () => ResizeWidthTo(Width * 2, 100, EasingTypes.OutQuint) }, - new OsuContextMenuItem(@"Change height", ContextMenuType.Highlighted) { Action = () => ResizeHeightTo(Height * 2, 100, EasingTypes.OutQuint) }, - new OsuContextMenuItem(@"Change width back", ContextMenuType.Destructive) { Action = () => ResizeWidthTo(Width / 2, 100, EasingTypes.OutQuint) }, - new OsuContextMenuItem(@"Change height back", ContextMenuType.Destructive) { Action = () => ResizeHeightTo(Height / 2, 100, EasingTypes.OutQuint) }, + new OsuContextMenuItem(@"Change width", MenuItemType.Highlighted) { Action = () => ResizeWidthTo(Width * 2, 100, EasingTypes.OutQuint) }, + new OsuContextMenuItem(@"Change height", MenuItemType.Highlighted) { Action = () => ResizeHeightTo(Height * 2, 100, EasingTypes.OutQuint) }, + new OsuContextMenuItem(@"Change width back", MenuItemType.Destructive) { Action = () => ResizeWidthTo(Width / 2, 100, EasingTypes.OutQuint) }, + new OsuContextMenuItem(@"Change height back", MenuItemType.Destructive) { Action = () => ResizeHeightTo(Height / 2, 100, EasingTypes.OutQuint) }, }; } } diff --git a/osu.Game/Graphics/ContextMenuType.cs b/osu.Game/Graphics/UserInterface/MenuItemType.cs similarity index 73% rename from osu.Game/Graphics/ContextMenuType.cs rename to osu.Game/Graphics/UserInterface/MenuItemType.cs index 11086f13b8..bd89dbfced 100644 --- a/osu.Game/Graphics/ContextMenuType.cs +++ b/osu.Game/Graphics/UserInterface/MenuItemType.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Graphics +namespace osu.Game.Graphics.UserInterface { - public enum ContextMenuType + public enum MenuItemType { Standard, Highlighted, diff --git a/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs b/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs index f5786598bf..1081962ed7 100644 --- a/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs @@ -26,7 +26,7 @@ namespace osu.Game.Graphics.UserInterface private SampleChannel sampleClick; private SampleChannel sampleHover; - private readonly ContextMenuType type; + private readonly MenuItemType type; protected override Container CreateTextContainer(string title) => new Container { @@ -57,7 +57,7 @@ namespace osu.Game.Graphics.UserInterface } }; - public OsuContextMenuItem(string title, ContextMenuType type = ContextMenuType.Standard) : base(title) + public OsuContextMenuItem(string title, MenuItemType type = MenuItemType.Standard) : base(title) { this.type = type; } @@ -78,13 +78,13 @@ namespace osu.Game.Graphics.UserInterface { switch (type) { - case ContextMenuType.Standard: + case MenuItemType.Standard: textBold.Colour = text.Colour = Color4.White; break; - case ContextMenuType.Destructive: + case MenuItemType.Destructive: textBold.Colour = text.Colour = Color4.Red; break; - case ContextMenuType.Highlighted: + case MenuItemType.Highlighted: textBold.Colour = text.Colour = OsuColour.FromHex(@"ffcc22"); break; } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 8ffbf75139..68e84a1846 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -76,9 +76,9 @@ - + From 700d6f9d3874829596b31545016fa9f0b673fbd5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 13 Jun 2017 15:27:47 +0900 Subject: [PATCH 09/10] Adjust appearance slightly --- osu.Game/Graphics/UserInterface/OsuContextMenu.cs | 2 +- osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuContextMenu.cs b/osu.Game/Graphics/UserInterface/OsuContextMenu.cs index 3aba4afd0a..e17ce2a5b2 100644 --- a/osu.Game/Graphics/UserInterface/OsuContextMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuContextMenu.cs @@ -28,7 +28,7 @@ namespace osu.Game.Graphics.UserInterface EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, - Colour = Color4.Black.Opacity(0.25f), + Colour = Color4.Black.Opacity(0.1f), Radius = 4, }; } diff --git a/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs b/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs index 1081962ed7..769df18566 100644 --- a/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/OsuContextMenuItem.cs @@ -15,7 +15,7 @@ namespace osu.Game.Graphics.UserInterface { public class OsuContextMenuItem : ContextMenuItem { - private const int transition_length = 200; + private const int transition_length = 80; private const int margin_horizontal = 17; public const int MARGIN_VERTICAL = 4; private const int text_size = 17; From 3ca80eb149065a9a44f97cb6132fd030677eb71b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 13 Jun 2017 15:54:26 +0900 Subject: [PATCH 10/10] Add readonly --- osu.Game/Screens/Select/Leaderboards/Leaderboard.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 510ba68f2c..e560cfe413 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -26,7 +26,7 @@ namespace osu.Game.Screens.Select.Leaderboards public Action ScoreSelected; - private LoadingAnimation loading; + private readonly LoadingAnimation loading; private IEnumerable scores; public IEnumerable Scores