1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 06:42:56 +08:00

Merge branch 'master' into tournament_drawings

This commit is contained in:
Dan Balasescu 2017-03-03 13:06:18 +09:00 committed by GitHub
commit 09a2d39e3e
79 changed files with 934 additions and 240 deletions

@ -1 +1 @@
Subproject commit 4c0762eec20d2a3063df908a49432326570bea9f Subproject commit 798409058a421307b5a92aeea4cd60a065f5a0d4

View File

@ -74,7 +74,7 @@ namespace osu.Desktop.Deploy
refreshDirectory(StagingFolder); refreshDirectory(StagingFolder);
//increment build number until we have a unique one. //increment build number until we have a unique one.
string verBase = DateTime.Now.ToString("yyyy.Md."); string verBase = DateTime.Now.ToString("yyyy.Mdd.");
int increment = 0; int increment = 0;
while (Directory.GetFiles(ReleasesFolder, $"*{verBase}{increment}*").Any()) while (Directory.GetFiles(ReleasesFolder, $"*{verBase}{increment}*").Any())
increment++; increment++;

View File

@ -0,0 +1,80 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Screens.Testing;
using osu.Game.Graphics;
using osu.Game.Overlays;
using osu.Game.Overlays.Dialog;
namespace osu.Desktop.VisualTests.Tests
{
class TestCaseDialogOverlay : TestCase
{
public override string Name => @"Dialog Overlay";
public override string Description => @"Display dialogs";
DialogOverlay overlay;
public override void Reset()
{
base.Reset();
Add(overlay = new DialogOverlay());
AddButton("dialog #1", () => overlay.Push(new PopupDialog
{
Icon = FontAwesome.fa_trash_o,
HeaderText = @"Confirm deletion of",
BodyText = @"Ayase Rie - Yuima-ru*World TVver.",
Buttons = new PopupDialogButton[]
{
new PopupDialogOkButton
{
Text = @"I never want to see this again.",
Action = () => System.Console.WriteLine(@"OK"),
},
new PopupDialogCancelButton
{
Text = @"Firetruck, I still want quick ranks!",
Action = () => System.Console.WriteLine(@"Cancel"),
},
},
}));
AddButton("dialog #2", () => overlay.Push(new PopupDialog
{
Icon = FontAwesome.fa_gear,
HeaderText = @"What do you want to do with",
BodyText = "Camellia as \"Bang Riot\" - Blastix Riotz",
Buttons = new PopupDialogButton[]
{
new PopupDialogOkButton
{
Text = @"Manage collections",
},
new PopupDialogOkButton
{
Text = @"Delete...",
},
new PopupDialogOkButton
{
Text = @"Remove from unplayed",
},
new PopupDialogOkButton
{
Text = @"Clear local scores",
},
new PopupDialogOkButton
{
Text = @"Edit",
},
new PopupDialogCancelButton
{
Text = @"Cancel",
},
},
}));
}
}
}

View File

@ -95,7 +95,7 @@ namespace osu.Desktop.VisualTests.Tests
AddButton(@"slider", () => load(HitObjectType.Slider)); AddButton(@"slider", () => load(HitObjectType.Slider));
AddButton(@"spinner", () => load(HitObjectType.Spinner)); AddButton(@"spinner", () => load(HitObjectType.Spinner));
AddToggle(@"auto", () => { auto = !auto; load(mode); }); AddToggle(@"auto", (state) => { auto = state; load(mode); });
ButtonsContainer.Add(new SpriteText { Text = "Playback Speed" }); ButtonsContainer.Add(new SpriteText { Text = "Playback Speed" });
ButtonsContainer.Add(new BasicSliderBar<double> ButtonsContainer.Add(new BasicSliderBar<double>

View File

@ -5,6 +5,7 @@ using osu.Framework.Screens.Testing;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Timing; using osu.Framework.Timing;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Framework.Graphics.Containers;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
@ -30,7 +31,7 @@ namespace osu.Desktop.VisualTests.Tests
Anchor = Anchor.Centre Anchor = Anchor.Centre
}; };
Add(mc); Add(mc);
AddToggle(@"Show", mc.ToggleVisibility); AddToggle(@"Show", (state) => mc.State = state ? Visibility.Visible : Visibility.Hidden);
} }
} }
} }

View File

@ -8,6 +8,7 @@ using osu.Framework.MathUtils;
using osu.Game.Overlays; using osu.Game.Overlays;
using System.Linq; using System.Linq;
using osu.Game.Overlays.Notifications; using osu.Game.Overlays.Notifications;
using osu.Framework.Graphics.Containers;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
@ -30,7 +31,7 @@ namespace osu.Desktop.VisualTests.Tests
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
}); });
AddToggle(@"show", manager.ToggleVisibility); AddToggle(@"show", (state) => manager.State = state ? Visibility.Visible : Visibility.Hidden);
AddButton(@"simple #1", sendNotification1); AddButton(@"simple #1", sendNotification1);
AddButton(@"simple #2", sendNotification2); AddButton(@"simple #2", sendNotification2);

View File

@ -2,8 +2,8 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game.Overlays.Pause;
using osu.Framework.Screens.Testing; using osu.Framework.Screens.Testing;
using osu.Game.Screens.Play;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {

View File

@ -1,9 +1,11 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic; using System.Collections.Generic;
using osu.Desktop.VisualTests.Platform; using osu.Desktop.VisualTests.Platform;
using osu.Framework.Screens.Testing; using osu.Framework.Screens.Testing;
using osu.Framework.MathUtils;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.Modes; using osu.Game.Modes;
using osu.Game.Screens.Select; using osu.Game.Screens.Select;
@ -14,6 +16,7 @@ namespace osu.Desktop.VisualTests.Tests
{ {
private BeatmapDatabase db, oldDb; private BeatmapDatabase db, oldDb;
private TestStorage storage; private TestStorage storage;
private PlaySongSelect songSelect;
public override string Name => @"Song Select"; public override string Name => @"Song Select";
public override string Description => @"with fake data"; public override string Description => @"with fake data";
@ -35,7 +38,13 @@ namespace osu.Desktop.VisualTests.Tests
db.Import(sets); db.Import(sets);
} }
Add(new PlaySongSelect());
Add(songSelect = new PlaySongSelect());
AddButton(@"Sort by Artist", delegate { songSelect.Filter.Sort = FilterControl.SortMode.Artist; });
AddButton(@"Sort by Title", delegate { songSelect.Filter.Sort = FilterControl.SortMode.Title; });
AddButton(@"Sort by Author", delegate { songSelect.Filter.Sort = FilterControl.SortMode.Author; });
AddButton(@"Sort by Difficulty", delegate { songSelect.Filter.Sort = FilterControl.SortMode.Difficulty; });
} }
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)
@ -59,9 +68,10 @@ namespace osu.Desktop.VisualTests.Tests
Metadata = new BeatmapMetadata Metadata = new BeatmapMetadata
{ {
OnlineBeatmapSetID = 1234 + i, OnlineBeatmapSetID = 1234 + i,
Artist = "MONACA", // Create random metadata, then we can check if sorting works based on these
Title = "Black Song", Artist = "MONACA " + RNG.Next(0, 9),
Author = "Some Guy", Title = "Black Song " + RNG.Next(0, 9),
Author = "Some Guy " + RNG.Next(0, 9),
}, },
Beatmaps = new List<BeatmapInfo>(new[] Beatmaps = new List<BeatmapInfo>(new[]
{ {

View File

@ -22,9 +22,9 @@ namespace osu.Desktop.VisualTests.Tests
{ {
base.Reset(); base.Reset();
FlowContainer flow; FillFlowContainer flow;
Add(flow = new FlowContainer() Add(flow = new FillFlowContainer()
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.5f), Size = new Vector2(0.5f),

View File

@ -195,6 +195,7 @@
<Compile Include="Platform\TestStorage.cs" /> <Compile Include="Platform\TestStorage.cs" />
<Compile Include="Tests\TestCaseOptions.cs" /> <Compile Include="Tests\TestCaseOptions.cs" />
<Compile Include="Tests\TestCasePauseOverlay.cs" /> <Compile Include="Tests\TestCasePauseOverlay.cs" />
<Compile Include="Tests\TestCaseDialogOverlay.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup />
<ItemGroup /> <ItemGroup />

View File

@ -57,19 +57,19 @@ namespace osu.Desktop.Overlays
Children = new Drawable[] Children = new Drawable[]
{ {
new FlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FlowDirections.Vertical, Direction = FillDirection.Down,
Children = new Drawable[] Children = new Drawable[]
{ {
new FlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FlowDirections.Horizontal, Direction = FillDirection.Right,
Spacing = new Vector2(5),
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Spacing = new Vector2(5),
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText new OsuSpriteText
@ -95,6 +95,8 @@ namespace osu.Desktop.Overlays
}, },
new Sprite new Sprite
{ {
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Texture = textures.Get(@"Menu/dev-build-footer"), Texture = textures.Get(@"Menu/dev-build-footer"),
}, },
} }

View File

@ -13,7 +13,7 @@ using OpenTK.Graphics;
namespace osu.Game.Modes.Osu.Objects.Drawables namespace osu.Game.Modes.Osu.Objects.Drawables
{ {
public class HitExplosion : FlowContainer public class HitExplosion : FillFlowContainer
{ {
private readonly OsuJudgementInfo judgement; private readonly OsuJudgementInfo judgement;
private SpriteText line1; private SpriteText line1;
@ -25,7 +25,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Origin = Anchor.Centre; Origin = Anchor.Centre;
Direction = FlowDirections.Vertical; Direction = FillDirection.Down;
Spacing = new Vector2(0, 2); Spacing = new Vector2(0, 2);
Position = (h?.StackedEndPosition ?? Vector2.Zero) + judgement.PositionOffset; Position = (h?.StackedEndPosition ?? Vector2.Zero) + judgement.PositionOffset;

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Modes.Osu.Objects namespace osu.Game.Modes.Osu.Objects
{ {
public class HitCircle : OsuHitObject public class HitCircle : OsuHitObject

View File

@ -1,4 +1,7 @@
namespace osu.Game.Modes.Osu.Objects // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Modes.Osu.Objects
{ {
public class SliderTick : OsuHitObject public class SliderTick : OsuHitObject
{ {

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Modes.Osu.Objects namespace osu.Game.Modes.Osu.Objects
{ {
public class Spinner : OsuHitObject public class Spinner : OsuHitObject

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Modes.Osu namespace osu.Game.Modes.Osu
{ {
class OsuScore : Score class OsuScore : Score

View File

@ -64,7 +64,7 @@ namespace osu.Game.Beatmaps.Drawables
BeatmapSet = beatmapSet; BeatmapSet = beatmapSet;
WorkingBeatmap beatmap = database.GetWorkingBeatmap(BeatmapSet.Beatmaps.FirstOrDefault()); WorkingBeatmap beatmap = database.GetWorkingBeatmap(BeatmapSet.Beatmaps.FirstOrDefault());
foreach (var b in BeatmapSet.Beatmaps) foreach (var b in BeatmapSet.Beatmaps)
b.StarDifficulty = (float)(database.GetWorkingBeatmap(b).Beatmap?.CalculateStarDifficulty() ?? 0); b.StarDifficulty = (float)(database.GetWorkingBeatmap(b).Beatmap?.CalculateStarDifficulty() ?? -1f);
Header = new BeatmapSetHeader(beatmap) Header = new BeatmapSetHeader(beatmap)
{ {

View File

@ -83,10 +83,10 @@ namespace osu.Game.Beatmaps.Drawables
ColourLight = OsuColour.FromHex(@"3a7285"), ColourLight = OsuColour.FromHex(@"3a7285"),
ColourDark = OsuColour.FromHex(@"123744") ColourDark = OsuColour.FromHex(@"123744")
}, },
new FlowContainer new FillFlowContainer
{ {
Padding = new MarginPadding(5), Padding = new MarginPadding(5),
Direction = FlowDirections.Horizontal, Direction = FillDirection.Right,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
@ -98,18 +98,18 @@ namespace osu.Game.Beatmaps.Drawables
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
}, },
new FlowContainer new FillFlowContainer
{ {
Padding = new MarginPadding { Left = 5 }, Padding = new MarginPadding { Left = 5 },
Direction = FlowDirections.Vertical, Direction = FillDirection.Down,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
new FlowContainer new FillFlowContainer
{ {
Direction = FlowDirections.Horizontal, Direction = FillDirection.Right,
AutoSizeAxes = Axes.Both,
Spacing = new Vector2(4, 0), Spacing = new Vector2(4, 0),
AutoSizeAxes = Axes.Both,
Children = new[] Children = new[]
{ {
new OsuSpriteText new OsuSpriteText

View File

@ -24,7 +24,7 @@ namespace osu.Game.Beatmaps.Drawables
private OsuConfigManager config; private OsuConfigManager config;
private Bindable<bool> preferUnicode; private Bindable<bool> preferUnicode;
private WorkingBeatmap beatmap; private WorkingBeatmap beatmap;
private FlowContainer difficultyIcons; private FillFlowContainer difficultyIcons;
public BeatmapSetHeader(WorkingBeatmap beatmap) public BeatmapSetHeader(WorkingBeatmap beatmap)
{ {
@ -36,9 +36,9 @@ namespace osu.Game.Beatmaps.Drawables
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
new FlowContainer new FillFlowContainer
{ {
Direction = FlowDirections.Vertical, Direction = FillDirection.Down,
Padding = new MarginPadding { Top = 5, Left = 18, Right = 10, Bottom = 10 }, Padding = new MarginPadding { Top = 5, Left = 18, Right = 10, Bottom = 10 },
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = new[] Children = new[]
@ -52,13 +52,12 @@ namespace osu.Game.Beatmaps.Drawables
}, },
artist = new OsuSpriteText artist = new OsuSpriteText
{ {
Margin = new MarginPadding { Top = -1 },
Font = @"Exo2.0-SemiBoldItalic", Font = @"Exo2.0-SemiBoldItalic",
Text = beatmap.BeatmapSetInfo.Metadata.Artist, Text = beatmap.BeatmapSetInfo.Metadata.Artist,
TextSize = 17, TextSize = 17,
Shadow = true, Shadow = true,
}, },
difficultyIcons = new FlowContainer difficultyIcons = new FillFlowContainer
{ {
Margin = new MarginPadding { Top = 5 }, Margin = new MarginPadding { Top = 5 },
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
@ -109,10 +108,10 @@ namespace osu.Game.Beatmaps.Drawables
Children = new[] Children = new[]
{ {
new FlowContainer new FillFlowContainer
{ {
Depth = -1, Depth = -1,
Direction = FlowDirections.Horizontal, Direction = FillDirection.Right,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
// This makes the gradient not be perfectly horizontal, but diagonal at a ~40° angle // This makes the gradient not be perfectly horizontal, but diagonal at a ~40° angle
Shear = new Vector2(0.8f, 0), Shear = new Vector2(0.8f, 0),

View File

@ -33,6 +33,8 @@ namespace osu.Game.Configuration
Set(OsuConfig.SnakingOutSliders, false); Set(OsuConfig.SnakingOutSliders, false);
Set(OsuConfig.MenuParallax, true); Set(OsuConfig.MenuParallax, true);
Set(OsuConfig.KeyOverlay, false);
//todo: implement all settings below this line (remove the Disabled set when doing so). //todo: implement all settings below this line (remove the Disabled set when doing so).
Set(OsuConfig.MouseSpeed, 1.0).Disabled = true; Set(OsuConfig.MouseSpeed, 1.0).Disabled = true;
@ -80,7 +82,6 @@ namespace osu.Game.Configuration
Set(OsuConfig.IgnoreBeatmapSamples, false).Disabled = true; Set(OsuConfig.IgnoreBeatmapSamples, false).Disabled = true;
Set(OsuConfig.IgnoreBeatmapSkins, false).Disabled = true; Set(OsuConfig.IgnoreBeatmapSkins, false).Disabled = true;
Set(OsuConfig.IgnoreList, string.Empty).Disabled = true; Set(OsuConfig.IgnoreList, string.Empty).Disabled = true;
Set(OsuConfig.KeyOverlay, false).Disabled = true;
Set(OsuConfig.Language, @"unknown").Disabled = true; Set(OsuConfig.Language, @"unknown").Disabled = true;
Set(OsuConfig.AllowNowPlayingHighlights, false).Disabled = true; Set(OsuConfig.AllowNowPlayingHighlights, false).Disabled = true;
Set(OsuConfig.LastVersion, string.Empty).Disabled = true; Set(OsuConfig.LastVersion, string.Empty).Disabled = true;

View File

@ -88,7 +88,7 @@ namespace osu.Game.Database
return ID == other?.ID; return ID == other?.ID;
} }
public bool AudioEquals(BeatmapInfo other) => other != null && public bool AudioEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null &&
BeatmapSet.Path == other.BeatmapSet.Path && BeatmapSet.Path == other.BeatmapSet.Path &&
(Metadata ?? BeatmapSet.Metadata).AudioFile == (other.Metadata ?? other.BeatmapSet.Metadata).AudioFile; (Metadata ?? BeatmapSet.Metadata).AudioFile == (other.Metadata ?? other.BeatmapSet.Metadata).AudioFile;
} }

View File

@ -13,17 +13,15 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Pause namespace osu.Game.Graphics.UserInterface
{ {
public class PauseButton : ClickableContainer public class DialogButton : ClickableContainer
{ {
private const float hover_width = 0.9f; private const float hover_width = 0.9f;
private const float hover_duration = 500; private const float hover_duration = 500;
private const float glow_fade_duration = 250; private const float glow_fade_duration = 250;
private const float click_duration = 200; private const float click_duration = 200;
private Color4 backgroundColour = OsuColour.Gray(34);
private Color4 buttonColour; private Color4 buttonColour;
public Color4 ButtonColour public Color4 ButtonColour
{ {
@ -35,8 +33,21 @@ namespace osu.Game.Overlays.Pause
{ {
buttonColour = value; buttonColour = value;
updateGlow(); updateGlow();
if (colourContainer == null) return; colourContainer.Colour = value;
colourContainer.Colour = ButtonColour; }
}
private Color4 backgroundColour = OsuColour.Gray(34);
public Color4 BackgroundColour
{
get
{
return backgroundColour;
}
set
{
backgroundColour = value;
background.Colour = value;
} }
} }
@ -50,16 +61,30 @@ namespace osu.Game.Overlays.Pause
set set
{ {
text = value; text = value;
if (spriteText == null) return;
spriteText.Text = Text; spriteText.Text = Text;
} }
} }
private float textSize = 28;
internal float TextSize
{
get
{
return textSize;
}
set
{
textSize = value;
spriteText.TextSize = value;
}
}
public SampleChannel SampleClick, SampleHover; public SampleChannel SampleClick, SampleHover;
private Container backgroundContainer, colourContainer, glowContainer; private Container backgroundContainer, colourContainer, glowContainer;
private Box leftGlow, centerGlow, rightGlow; private Box leftGlow, centerGlow, rightGlow, background;
private SpriteText spriteText; private SpriteText spriteText;
private Vector2 hoverSpacing => new Vector2(3f, 0f);
private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's when clicking private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's when clicking
@ -85,8 +110,9 @@ namespace osu.Game.Overlays.Pause
protected override bool OnHover(Framework.Input.InputState state) protected override bool OnHover(Framework.Input.InputState state)
{ {
spriteText.TransformSpacingTo(hoverSpacing, hover_duration, EasingTypes.OutElastic);
colourContainer.ResizeTo(new Vector2(hover_width, 1f), hover_duration, EasingTypes.OutElastic); colourContainer.ResizeTo(new Vector2(hover_width, 1f), hover_duration, EasingTypes.OutElastic);
spriteText.TransformSpacingTo(new Vector2(3f, 0f), hover_duration, EasingTypes.OutElastic);
glowContainer.FadeIn(glow_fade_duration, EasingTypes.Out); glowContainer.FadeIn(glow_fade_duration, EasingTypes.Out);
SampleHover?.Play(); SampleHover?.Play();
return true; return true;
@ -127,8 +153,10 @@ namespace osu.Game.Overlays.Pause
rightGlow.ColourInfo = ColourInfo.GradientHorizontal(ButtonColour, new Color4(ButtonColour.R, ButtonColour.G, ButtonColour.B, 0f)); rightGlow.ColourInfo = ColourInfo.GradientHorizontal(ButtonColour, new Color4(ButtonColour.R, ButtonColour.G, ButtonColour.B, 0f));
} }
public PauseButton() public DialogButton()
{ {
RelativeSizeAxes = Axes.X;
Children = new Drawable[] Children = new Drawable[]
{ {
backgroundContainer = new Container backgroundContainer = new Container
@ -137,12 +165,12 @@ namespace osu.Game.Overlays.Pause
Width = 1f, Width = 1f,
Children = new Drawable[] Children = new Drawable[]
{ {
new Box background = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = backgroundColour Colour = backgroundColour,
} },
} },
}, },
glowContainer = new Container glowContainer = new Container
{ {
@ -156,23 +184,23 @@ namespace osu.Game.Overlays.Pause
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopLeft, Origin = Anchor.TopLeft,
Anchor = Anchor.TopLeft, Anchor = Anchor.TopLeft,
Width = 0.125f Width = 0.125f,
}, },
centerGlow = new Box centerGlow = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Width = 0.75f Width = 0.75f,
}, },
rightGlow = new Box rightGlow = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Width = 0.125f Width = 0.125f,
} },
} },
}, },
new Container new Container
{ {
@ -194,7 +222,7 @@ namespace osu.Game.Overlays.Pause
{ {
Type = EdgeEffectType.Shadow, Type = EdgeEffectType.Shadow,
Colour = Color4.Black.Opacity(0.2f), Colour = Color4.Black.Opacity(0.2f),
Radius = 5 Radius = 5,
}, },
Colour = ButtonColour, Colour = ButtonColour,
Shear = new Vector2(0.2f, 0), Shear = new Vector2(0.2f, 0),
@ -203,7 +231,7 @@ namespace osu.Game.Overlays.Pause
new Box new Box
{ {
EdgeSmoothness = new Vector2(2, 0), EdgeSmoothness = new Vector2(2, 0),
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both,
}, },
new Container new Container
{ {
@ -217,13 +245,13 @@ namespace osu.Game.Overlays.Pause
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
TriangleScale = 4, TriangleScale = 4,
ColourDark = OsuColour.Gray(0.88f), ColourDark = OsuColour.Gray(0.88f),
Shear = new Vector2(-0.2f, 0) Shear = new Vector2(-0.2f, 0),
} },
} },
}, },
} },
} },
} },
}, },
spriteText = new OsuSpriteText spriteText = new OsuSpriteText
{ {
@ -234,8 +262,8 @@ namespace osu.Game.Overlays.Pause
Font = "Exo2.0-Bold", Font = "Exo2.0-Bold",
Shadow = true, Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.1f), ShadowColour = new Color4(0, 0, 0, 0.1f),
Colour = Color4.White Colour = Color4.White,
} },
}; };
updateGlow(); updateGlow();

View File

@ -1,4 +1,7 @@
using OpenTK.Graphics; // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
using OpenTK.Input; using OpenTK.Input;
using osu.Framework.Input; using osu.Framework.Input;
using System; using System;

View File

@ -19,9 +19,9 @@ namespace osu.Game.Graphics.UserInterface
Children = new[] Children = new[]
{ {
new FlowContainer new FillFlowContainer
{ {
Direction = FlowDirections.Horizontal, Direction = FillDirection.Right,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Children = new Drawable[] Children = new Drawable[]

View File

@ -14,6 +14,8 @@ namespace osu.Game.Graphics.UserInterface
{ {
protected override Drawable GetDrawableCharacter(char c) => new PasswordMaskChar(CalculatedTextSize); protected override Drawable GetDrawableCharacter(char c) => new PasswordMaskChar(CalculatedTextSize);
public override bool AllowClipboardExport => false;
public class PasswordMaskChar : Container public class PasswordMaskChar : Container
{ {
private CircularContainer circle; private CircularContainer circle;

View File

@ -68,10 +68,10 @@ namespace osu.Game.Graphics.UserInterface
Children = new Drawable[] Children = new Drawable[]
{ {
stars = new FlowContainer<Star> stars = new FillFlowContainer<Star>
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FlowDirections.Horizontal, Direction = FillDirection.Right,
Spacing = new Vector2(star_spacing), Spacing = new Vector2(star_spacing),
} }
}; };

View File

@ -57,10 +57,7 @@ namespace osu.Game.Graphics.UserInterface
c1.Origin = c1.Anchor = (value & Anchor.x2) > 0 ? Anchor.TopLeft : Anchor.TopRight; c1.Origin = c1.Anchor = (value & Anchor.x2) > 0 ? Anchor.TopLeft : Anchor.TopRight;
c2.Origin = c2.Anchor = (value & Anchor.x2) > 0 ? Anchor.TopRight : Anchor.TopLeft; c2.Origin = c2.Anchor = (value & Anchor.x2) > 0 ? Anchor.TopRight : Anchor.TopLeft;
Margin = new MarginPadding X = (value & Anchor.x2) > 0 ? SIZE_RETRACTED.X * shear * 0.5f : 0;
{
Right = (value & Anchor.x2) > 0 ? -SIZE_RETRACTED.X * shear * 0.5f : 0
};
c1.Depth = (value & Anchor.x2) > 0 ? 0 : 1; c1.Depth = (value & Anchor.x2) > 0 ? 0 : 1;
c2.Depth = (value & Anchor.x2) > 0 ? 1 : 0; c2.Depth = (value & Anchor.x2) > 0 ? 1 : 0;

View File

@ -33,7 +33,7 @@ namespace osu.Game.Graphics.UserInterface.Volume
Children = new Drawable[] Children = new Drawable[]
{ {
new FlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Modes.Objects namespace osu.Game.Modes.Objects
{ {
public abstract class HitObjectParser public abstract class HitObjectParser

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Modes.Objects namespace osu.Game.Modes.Objects
{ {
/// <summary> /// <summary>

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Modes namespace osu.Game.Modes
{ {
public class Score public class Score

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System; using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;

View File

@ -9,6 +9,9 @@ using osu.Game.Modes.Objects;
using OpenTK; using OpenTK;
using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osu.Framework.Allocation;
using osu.Game.Configuration;
using osu.Framework.Configuration;
namespace osu.Game.Modes.UI namespace osu.Game.Modes.UI
{ {
@ -21,6 +24,8 @@ namespace osu.Game.Modes.UI
public HealthDisplay HealthDisplay; public HealthDisplay HealthDisplay;
public Score Score { get; set; } public Score Score { get; set; }
private Bindable<bool> showKeyCounter;
protected abstract KeyCounterCollection CreateKeyCounter(); protected abstract KeyCounterCollection CreateKeyCounter();
protected abstract ComboCounter CreateComboCounter(); protected abstract ComboCounter CreateComboCounter();
protected abstract PercentageCounter CreateAccuracyCounter(); protected abstract PercentageCounter CreateAccuracyCounter();
@ -58,6 +63,22 @@ namespace osu.Game.Modes.UI
}; };
} }
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
showKeyCounter = config.GetBindable<bool>(OsuConfig.KeyOverlay);
showKeyCounter.ValueChanged += visibilityChanged;
showKeyCounter.TriggerChange();
}
private void visibilityChanged(object sender, EventArgs e)
{
if (showKeyCounter)
KeyCounter.Show();
else
KeyCounter.Hide();
}
public void BindProcessor(ScoreProcessor processor) public void BindProcessor(ScoreProcessor processor)
{ {
//bind processor bindables to combocounter, score display etc. //bind processor bindables to combocounter, score display etc.

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Online.API namespace osu.Game.Online.API
{ {
public interface IOnlineComponent public interface IOnlineComponent

View File

@ -15,7 +15,7 @@ namespace osu.Game.Online.Chat.Drawables
public class DrawableChannel : Container public class DrawableChannel : Container
{ {
private readonly Channel channel; private readonly Channel channel;
private FlowContainer flow; private FillFlowContainer flow;
private ScrollContainer scroll; private ScrollContainer scroll;
public DrawableChannel(Channel channel) public DrawableChannel(Channel channel)
@ -39,9 +39,9 @@ namespace osu.Game.Online.Chat.Drawables
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
flow = new FlowContainer flow = new FillFlowContainer
{ {
Direction = FlowDirections.Vertical, Direction = FillDirection.Down,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Left = 20, Right = 20 } Padding = new MarginPadding { Left = 20, Right = 20 }

View File

@ -42,6 +42,8 @@ namespace osu.Game
private NotificationManager notificationManager; private NotificationManager notificationManager;
private DialogOverlay dialogOverlay;
private Intro intro private Intro intro
{ {
get get
@ -142,6 +144,11 @@ namespace osu.Game
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
}).LoadAsync(this, overlayContent.Add); }).LoadAsync(this, overlayContent.Add);
(dialogOverlay = new DialogOverlay
{
Depth = -4,
}).LoadAsync(this, overlayContent.Add);
Logger.NewEntry += entry => Logger.NewEntry += entry =>
{ {
if (entry.Level < LogLevel.Important) return; if (entry.Level < LogLevel.Important) return;
@ -155,6 +162,7 @@ namespace osu.Game
Dependencies.Cache(options); Dependencies.Cache(options);
Dependencies.Cache(musicController); Dependencies.Cache(musicController);
Dependencies.Cache(notificationManager); Dependencies.Cache(notificationManager);
Dependencies.Cache(dialogOverlay);
(Toolbar = new Toolbar (Toolbar = new Toolbar
{ {

View File

@ -0,0 +1,245 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Input;
using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Input;
namespace osu.Game.Overlays.Dialog
{
public class PopupDialog : FocusedOverlayContainer
{
public static readonly float ENTER_DURATION = 500;
public static readonly float EXIT_DURATION = 200;
private readonly Vector2 ringSize = new Vector2(100f);
private readonly Vector2 ringMinifiedSize = new Vector2(20f);
private readonly Vector2 buttonsEnterSpacing = new Vector2(0f, 50f);
private Container content, ring;
private FillFlowContainer<PopupDialogButton> buttonsContainer;
private TextAwesome iconText;
private SpriteText header, body;
public FontAwesome Icon
{
get { return iconText.Icon; }
set { iconText.Icon = value; }
}
public string HeaderText
{
get { return header.Text; }
set { header.Text = value; }
}
public string BodyText
{
get { return body.Text; }
set { body.Text = value; }
}
public IEnumerable<PopupDialogButton> Buttons
{
get { return buttonsContainer.Children; }
set
{
buttonsContainer.Children = value;
foreach (PopupDialogButton b in value)
{
var action = b.Action;
b.Action = () =>
{
Hide();
action?.Invoke();
};
}
}
}
private void pressButtonAtIndex(int index)
{
if (index < Buttons.Count())
Buttons.Skip(index).First().TriggerClick();
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{
if (args.Repeat) return false;
if (args.Key == Key.Enter)
{
Buttons.OfType<PopupDialogOkButton>().FirstOrDefault()?.TriggerClick();
return true;
}
// press button at number if 1-9 on number row or keypad are pressed
var k = args.Key;
if (k >= Key.Number1 && k <= Key.Number9)
{
pressButtonAtIndex(k - Key.Number1);
return true;
}
if (k >= Key.Keypad1 && k <= Key.Keypad9)
{
pressButtonAtIndex(k - Key.Keypad1);
return true;
}
return base.OnKeyDown(state, args);
}
protected override void PopIn()
{
base.PopIn();
// Reset various animations but only if the dialog animation fully completed
if (content.Alpha == 0)
{
buttonsContainer.TransformSpacingTo(buttonsEnterSpacing);
buttonsContainer.MoveToY(buttonsEnterSpacing.Y);
ring.ResizeTo(ringMinifiedSize);
}
content.FadeIn(ENTER_DURATION, EasingTypes.OutQuint);
ring.ResizeTo(ringSize, ENTER_DURATION, EasingTypes.OutQuint);
buttonsContainer.TransformSpacingTo(Vector2.Zero, ENTER_DURATION, EasingTypes.OutQuint);
buttonsContainer.MoveToY(0, ENTER_DURATION, EasingTypes.OutQuint);
}
protected override void PopOut()
{
base.PopOut();
content.FadeOut(EXIT_DURATION, EasingTypes.InSine);
}
public PopupDialog()
{
RelativeSizeAxes = Axes.Both;
Children = new Drawable[]
{
content = new Container
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Width = 0.4f,
Alpha = 0f,
Children = new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
Masking = true,
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Colour = Color4.Black.Opacity(0.5f),
Radius = 8,
},
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.FromHex(@"221a21"),
},
new Triangles
{
RelativeSizeAxes = Axes.Both,
ColourLight = OsuColour.FromHex(@"271e26"),
ColourDark = OsuColour.FromHex(@"1e171e"),
TriangleScale = 4,
},
},
},
new FillFlowContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Position = new Vector2(0f, -50f),
Direction = FillDirection.Down,
Spacing = new Vector2(0f, 10f),
Children = new Drawable[]
{
new Container
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Size = ringSize,
Margin = new MarginPadding
{
Bottom = 30,
},
Children = new Drawable[]
{
ring = new CircularContainer
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
BorderColour = Color4.White,
BorderThickness = 5f,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black.Opacity(0),
},
iconText = new TextAwesome
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Icon = FontAwesome.fa_close,
TextSize = 50,
},
},
},
},
},
header = new SpriteText
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Text = @"Header",
TextSize = 25,
Shadow = true,
},
body = new SpriteText
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Text = @"Body",
TextSize = 18,
Shadow = true,
},
},
},
buttonsContainer = new FillFlowContainer<PopupDialogButton>
{
Anchor = Anchor.Centre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Down,
},
},
},
};
}
}
}

View File

@ -0,0 +1,20 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Dialog
{
public class PopupDialogButton : DialogButton
{
public PopupDialogButton()
{
Height = 50;
BackgroundColour = OsuColour.FromHex(@"150e14");
TextSize = 18;
}
}
}

View File

@ -0,0 +1,20 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Game.Graphics;
namespace osu.Game.Overlays.Dialog
{
public class PopupDialogCancelButton : PopupDialogButton
{
[BackgroundDependencyLoader]
private void load(OsuColour colours, AudioManager audio)
{
ButtonColour = colours.Blue;
SampleHover = audio.Sample.Get(@"Menu/menuclick");
SampleClick = audio.Sample.Get(@"Menu/menuback");
}
}
}

View File

@ -0,0 +1,20 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Game.Graphics;
namespace osu.Game.Overlays.Dialog
{
public class PopupDialogOkButton : PopupDialogButton
{
[BackgroundDependencyLoader]
private void load(OsuColour colours, AudioManager audio)
{
ButtonColour = colours.Pink;
SampleHover = audio.Sample.Get(@"Menu/menuclick");
SampleClick = audio.Sample.Get(@"Menu/menu-play-click");
}
}
}

View File

@ -0,0 +1,82 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transforms;
using osu.Game.Graphics;
using osu.Game.Overlays.Dialog;
using OpenTK.Graphics;
namespace osu.Game.Overlays
{
public class DialogOverlay : FocusedOverlayContainer
{
private Container dialogContainer;
private PopupDialog currentDialog;
public void Push(PopupDialog dialog)
{
if (dialog == currentDialog) return;
currentDialog?.Hide();
currentDialog = dialog;
dialogContainer.Add(currentDialog);
currentDialog.Show();
currentDialog.StateChanged += onDialogOnStateChanged;
State = Visibility.Visible;
}
private void onDialogOnStateChanged(OverlayContainer dialog, Visibility v)
{
if (v != Visibility.Hidden) return;
//handle the dialog being dismissed.
dialog.Delay(PopupDialog.EXIT_DURATION);
dialog.Expire();
if (dialog == currentDialog)
State = Visibility.Hidden;
}
protected override void PopIn()
{
base.PopIn();
FadeIn(PopupDialog.ENTER_DURATION, EasingTypes.OutQuint);
}
protected override void PopOut()
{
base.PopOut();
FadeOut(PopupDialog.EXIT_DURATION, EasingTypes.InSine);
}
public DialogOverlay()
{
RelativeSizeAxes = Axes.Both;
Children = new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black.Opacity(0.5f),
},
},
},
dialogContainer = new Container
{
RelativeSizeAxes = Axes.Both,
},
};
}
}
}

View File

@ -44,9 +44,9 @@ namespace osu.Game.Overlays
Margin = new MarginPadding { Top = Toolbar.Toolbar.HEIGHT }, Margin = new MarginPadding { Top = Toolbar.Toolbar.HEIGHT },
Children = new[] Children = new[]
{ {
sections = new FlowContainer<NotificationSection> sections = new FillFlowContainer<NotificationSection>
{ {
Direction = FlowDirections.Vertical, Direction = FillDirection.Down,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Children = new [] Children = new []

View File

@ -16,7 +16,7 @@ using OpenTK;
namespace osu.Game.Overlays.Notifications namespace osu.Game.Overlays.Notifications
{ {
public class NotificationSection : FlowContainer public class NotificationSection : FillFlowContainer
{ {
private OsuSpriteText titleText; private OsuSpriteText titleText;
private OsuSpriteText countText; private OsuSpriteText countText;
@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Notifications
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Direction = FlowDirections.Vertical; Direction = FillDirection.Down;
Padding = new MarginPadding Padding = new MarginPadding
{ {
@ -85,7 +85,7 @@ namespace osu.Game.Overlays.Notifications
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Action = clearAll Action = clearAll
}, },
new FlowContainer new FillFlowContainer
{ {
Margin = new MarginPadding Margin = new MarginPadding
{ {
@ -110,7 +110,7 @@ namespace osu.Game.Overlays.Notifications
}, },
}, },
}, },
notifications = new FlowContainer<Notification> notifications = new FillFlowContainer<Notification>
{ {
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,

View File

@ -14,7 +14,7 @@ using System.Collections.Generic;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options
{ {
public class OptionDropDown<T> : FlowContainer public class OptionDropDown<T> : FillFlowContainer
{ {
private DropDownMenu<T> dropdown; private DropDownMenu<T> dropdown;
private SpriteText text; private SpriteText text;
@ -89,7 +89,7 @@ namespace osu.Game.Overlays.Options
{ {
Items = new KeyValuePair<string, T>[0]; Items = new KeyValuePair<string, T>[0];
Direction = FlowDirections.Vertical; Direction = FillDirection.Down;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Children = new Drawable[] Children = new Drawable[]

View File

@ -12,7 +12,7 @@ using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options
{ {
public class OptionSlider<T> : FlowContainer where T : struct public class OptionSlider<T> : FillFlowContainer where T : struct
{ {
private SliderBar<T> slider; private SliderBar<T> slider;
private SpriteText text; private SpriteText text;
@ -40,7 +40,6 @@ namespace osu.Game.Overlays.Options
public OptionSlider() public OptionSlider()
{ {
Direction = FlowDirections.Vertical;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Padding = new MarginPadding { Right = 5 }; Padding = new MarginPadding { Right = 5 };

View File

@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Options
{ {
public abstract class OptionsSection : Container public abstract class OptionsSection : Container
{ {
protected FlowContainer FlowContent; protected FillFlowContainer FlowContent;
protected override Container<Drawable> Content => FlowContent; protected override Container<Drawable> Content => FlowContent;
public abstract FontAwesome Icon { get; } public abstract FontAwesome Icon { get; }
@ -58,10 +58,10 @@ namespace osu.Game.Overlays.Options
TextSize = header_size, TextSize = header_size,
Text = Header, Text = Header,
}, },
FlowContent = new FlowContainer FlowContent = new FillFlowContainer
{ {
Margin = new MarginPadding { Top = header_size + header_margin }, Margin = new MarginPadding { Top = header_size + header_margin },
Direction = FlowDirections.Vertical, Direction = FillDirection.Down,
Spacing = new Vector2(0, 30), Spacing = new Vector2(0, 30),
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,

View File

@ -9,7 +9,7 @@ using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options
{ {
public abstract class OptionsSubsection : FlowContainer public abstract class OptionsSubsection : FillFlowContainer
{ {
private Container<Drawable> content; private Container<Drawable> content;
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Options
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Direction = FlowDirections.Vertical; Direction = FillDirection.Down;
AddInternal(new Drawable[] AddInternal(new Drawable[]
{ {
new OsuSpriteText new OsuSpriteText
@ -29,12 +29,12 @@ namespace osu.Game.Overlays.Options
Margin = new MarginPadding { Bottom = 10 }, Margin = new MarginPadding { Bottom = 10 },
Font = @"Exo2.0-Black", Font = @"Exo2.0-Black",
}, },
content = new FlowContainer content = new FillFlowContainer
{ {
Direction = FlowDirections.Vertical, Direction = FillDirection.Down,
Spacing = new Vector2(0, 5),
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Spacing = new Vector2(0, 5),
}, },
}); });
} }

View File

@ -7,6 +7,7 @@ using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using OpenTK; using OpenTK;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Overlays.Options.Sections namespace osu.Game.Overlays.Options.Sections
{ {

View File

@ -84,7 +84,7 @@ namespace osu.Game.Overlays.Options.Sections.General
} }
} }
class LoginForm : FlowContainer class LoginForm : FillFlowContainer
{ {
private TextBox username; private TextBox username;
private TextBox password; private TextBox password;
@ -100,10 +100,10 @@ namespace osu.Game.Overlays.Options.Sections.General
private void load(APIAccess api, OsuConfigManager config) private void load(APIAccess api, OsuConfigManager config)
{ {
this.api = api; this.api = api;
Direction = FlowDirections.Vertical; Direction = FillDirection.Down;
Spacing = new Vector2(0, 5);
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Spacing = new Vector2(0, 5);
Children = new Drawable[] Children = new Drawable[]
{ {
username = new OsuTextBox username = new OsuTextBox

View File

@ -5,6 +5,7 @@ using osu.Framework.Graphics;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using OpenTK; using OpenTK;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Overlays.Options.Sections namespace osu.Game.Overlays.Options.Sections
{ {

View File

@ -8,6 +8,7 @@ using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using OpenTK; using OpenTK;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Overlays.Options.Sections namespace osu.Game.Overlays.Options.Sections
{ {

View File

@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Options
{ {
public class Sidebar : Container public class Sidebar : Container
{ {
private FlowContainer content; private FillFlowContainer content;
internal const float DEFAULT_WIDTH = ToolbarButton.WIDTH; internal const float DEFAULT_WIDTH = ToolbarButton.WIDTH;
internal const int EXPANDED_WIDTH = 200; internal const int EXPANDED_WIDTH = 200;
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
@ -34,13 +34,13 @@ namespace osu.Game.Overlays.Options
{ {
Children = new [] Children = new []
{ {
content = new FlowContainer content = new FillFlowContainer
{ {
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Direction = FlowDirections.Vertical Direction = FillDirection.Down,
} }
} }
}, },

View File

@ -73,11 +73,11 @@ namespace osu.Game.Overlays
Margin = new MarginPadding { Left = SIDEBAR_WIDTH }, Margin = new MarginPadding { Left = SIDEBAR_WIDTH },
Children = new[] Children = new[]
{ {
new FlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Direction = FlowDirections.Vertical, Direction = FillDirection.Down,
Children = new Drawable[] Children = new Drawable[]
{ {
@ -94,11 +94,11 @@ namespace osu.Game.Overlays
TextSize = 18, TextSize = 18,
Margin = new MarginPadding { Left = CONTENT_MARGINS, Bottom = 30 }, Margin = new MarginPadding { Left = CONTENT_MARGINS, Bottom = 30 },
}, },
new FlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Direction = FlowDirections.Vertical, Direction = FillDirection.Down,
Children = sections, Children = sections,
} }
} }

View File

@ -41,9 +41,9 @@ namespace osu.Game.Overlays.Toolbar
Children = new Drawable[] Children = new Drawable[]
{ {
new ToolbarBackground(), new ToolbarBackground(),
new FlowContainer new FillFlowContainer
{ {
Direction = FlowDirections.Horizontal, Direction = FillDirection.Right,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
Children = new Drawable[] Children = new Drawable[]
@ -55,7 +55,10 @@ namespace osu.Game.Overlays.Toolbar
}, },
modeSelector = new ToolbarModeSelector modeSelector = new ToolbarModeSelector
{ {
OnPlayModeChange = OnPlayModeChange OnPlayModeChange = (PlayMode mode) =>
{
OnPlayModeChange?.Invoke(mode);
}
} }
} }
}, },
@ -63,7 +66,7 @@ namespace osu.Game.Overlays.Toolbar
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Direction = FlowDirections.Horizontal, Direction = FillDirection.Right,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
Children = new Drawable[] Children = new Drawable[]
@ -141,7 +144,7 @@ namespace osu.Game.Overlays.Toolbar
FadeOut(transition_time); FadeOut(transition_time);
} }
class PassThroughFlowContainer : FlowContainer class PassThroughFlowContainer : FillFlowContainer
{ {
//needed to get input to the login overlay. //needed to get input to the login overlay.
public override bool Contains(Vector2 screenSpacePos) => true; public override bool Contains(Vector2 screenSpacePos) => true;

View File

@ -62,10 +62,10 @@ namespace osu.Game.Overlays.Toolbar
protected TextAwesome DrawableIcon; protected TextAwesome DrawableIcon;
protected SpriteText DrawableText; protected SpriteText DrawableText;
protected Box HoverBackground; protected Box HoverBackground;
private FlowContainer tooltipContainer; private FillFlowContainer tooltipContainer;
private SpriteText tooltip1; private SpriteText tooltip1;
private SpriteText tooltip2; private SpriteText tooltip2;
protected FlowContainer Flow; protected FillFlowContainer Flow;
private SampleChannel sampleClick; private SampleChannel sampleClick;
public ToolbarButton() public ToolbarButton()
@ -82,21 +82,21 @@ namespace osu.Game.Overlays.Toolbar
BlendingMode = BlendingMode.Additive, BlendingMode = BlendingMode.Additive,
Alpha = 0, Alpha = 0,
}, },
Flow = new FlowContainer Flow = new FillFlowContainer
{ {
Direction = FlowDirections.Horizontal, Direction = FillDirection.Right,
Spacing = new Vector2(5),
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Padding = new MarginPadding { Left = Toolbar.HEIGHT / 2, Right = Toolbar.HEIGHT / 2 }, Padding = new MarginPadding { Left = Toolbar.HEIGHT / 2, Right = Toolbar.HEIGHT / 2 },
Spacing = new Vector2(5),
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
Children = new Drawable[] Children = new Drawable[]
{ {
DrawableIcon = new TextAwesome DrawableIcon = new TextAwesome
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft, Origin = Anchor.Centre,
}, },
DrawableText = new OsuSpriteText DrawableText = new OsuSpriteText
{ {
@ -105,9 +105,9 @@ namespace osu.Game.Overlays.Toolbar
}, },
}, },
}, },
tooltipContainer = new FlowContainer tooltipContainer = new FillFlowContainer
{ {
Direction = FlowDirections.Vertical, Direction = FillDirection.Down,
RelativeSizeAxes = Axes.Both, //stops us being considered in parent's autosize RelativeSizeAxes = Axes.Both, //stops us being considered in parent's autosize
Anchor = (TooltipAnchor & Anchor.x0) > 0 ? Anchor.BottomLeft : Anchor.BottomRight, Anchor = (TooltipAnchor & Anchor.x0) > 0 ? Anchor.BottomLeft : Anchor.BottomRight,
Origin = TooltipAnchor, Origin = TooltipAnchor,

View File

@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Toolbar
{ {
const float padding = 10; const float padding = 10;
private FlowContainer modeButtons; private FillFlowContainer modeButtons;
private Drawable modeButtonLine; private Drawable modeButtonLine;
private ToolbarModeButton activeButton; private ToolbarModeButton activeButton;
@ -32,11 +32,11 @@ namespace osu.Game.Overlays.Toolbar
Children = new Drawable[] Children = new Drawable[]
{ {
new OpaqueBackground(), new OpaqueBackground(),
modeButtons = new FlowContainer modeButtons = new FillFlowContainer
{ {
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
Direction = FlowDirections.Horizontal, Direction = FillDirection.Right,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Padding = new MarginPadding { Left = padding, Right = padding }, Padding = new MarginPadding { Left = padding, Right = padding },

View File

@ -25,7 +25,7 @@ namespace osu.Game.Screens
protected virtual IEnumerable<Type> PossibleChildren => null; protected virtual IEnumerable<Type> PossibleChildren => null;
private FlowContainer childModeButtons; private FillFlowContainer childModeButtons;
private Container textContainer; private Container textContainer;
private Box box; private Box box;
@ -124,9 +124,9 @@ namespace osu.Game.Screens
Exit(); Exit();
} }
}, },
childModeButtons = new FlowContainer childModeButtons = new FillFlowContainer
{ {
Direction = FlowDirections.Vertical, Direction = FillDirection.Down,
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,

View File

@ -114,7 +114,7 @@ namespace osu.Game.Screens.Menu
new OsuSpriteText new OsuSpriteText
{ {
Shadow = true, Shadow = true,
Direction = FlowDirections.Horizontal, AllowMultiline = false,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
TextSize = 16, TextSize = 16,

View File

@ -78,16 +78,16 @@ namespace osu.Game.Screens.Menu
}, },
buttonFlow = new FlowContainerWithOrigin buttonFlow = new FlowContainerWithOrigin
{ {
Direction = FlowDirections.Horizontal, Direction = FillDirection.Right,
Spacing = new Vector2(-WEDGE_WIDTH, 0),
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Spacing = new Vector2(-WEDGE_WIDTH, 0),
Children = new[] Children = new[]
{ {
settingsButton = new Button(@"settings", @"options", FontAwesome.fa_gear, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -WEDGE_WIDTH, Key.O), settingsButton = new Button(@"settings", @"options", FontAwesome.fa_gear, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -WEDGE_WIDTH, Key.O),
backButton = new Button(@"back", @"back", FontAwesome.fa_osu_left_o, new Color4(51, 58, 94, 255), onBack, -WEDGE_WIDTH), backButton = new Button(@"back", @"back", FontAwesome.fa_osu_left_o, new Color4(51, 58, 94, 255), onBack, -WEDGE_WIDTH),
iconFacade = new Container //need a container to make the osu! icon flow properly. iconFacade = new Container //need a container to make the osu! icon flow properly.
{ {
Size = new Vector2(0, BUTTON_AREA_HEIGHT) Size = new Vector2(0, BUTTON_AREA_HEIGHT)
} }
}, },

View File

@ -27,12 +27,12 @@ namespace osu.Game.Screens.Menu
Children = new Drawable[] Children = new Drawable[]
{ {
new FlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Direction = FlowDirections.Vertical, Direction = FillDirection.Down,
Spacing = new Vector2(0, 2), Spacing = new Vector2(0, 2),
Children = new Drawable[] Children = new Drawable[]
{ {

View File

@ -12,7 +12,7 @@ namespace osu.Game.Screens.Menu
/// <summary> /// <summary>
/// A flow container with an origin based on one of its contained drawables. /// A flow container with an origin based on one of its contained drawables.
/// </summary> /// </summary>
public class FlowContainerWithOrigin : FlowContainer public class FlowContainerWithOrigin : FillFlowContainer
{ {
/// <summary> /// <summary>
/// A target drawable which this flowcontainer should be centered around. /// A target drawable which this flowcontainer should be centered around.
@ -22,7 +22,7 @@ namespace osu.Game.Screens.Menu
protected override IComparer<Drawable> DepthComparer => new ReverseCreationOrderDepthComparer(); protected override IComparer<Drawable> DepthComparer => new ReverseCreationOrderDepthComparer();
protected override IEnumerable<Drawable> SortedChildren => base.SortedChildren.Reverse(); protected override IEnumerable<Drawable> FlowingChildren => base.FlowingChildren.Reverse();
public override Anchor Origin => Anchor.Custom; public override Anchor Origin => Anchor.Custom;

View File

@ -8,11 +8,11 @@ using OpenTK.Graphics;
namespace osu.Game.Screens.Play namespace osu.Game.Screens.Play
{ {
public class KeyCounterCollection : FlowContainer<KeyCounter> public class KeyCounterCollection : FillFlowContainer<KeyCounter>
{ {
public KeyCounterCollection() public KeyCounterCollection()
{ {
Direction = FlowDirections.Horizontal; Direction = FillDirection.Right;
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
} }

View File

@ -1,15 +1,15 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
using OpenTK.Graphics;
namespace osu.Game.Overlays.Pause namespace osu.Game.Screens.Play.Pause
{ {
public class PauseProgressBar : Container public class PauseProgressBar : Container
{ {

View File

@ -3,7 +3,7 @@
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
namespace osu.Game.Overlays.Pause namespace osu.Game.Screens.Play.Pause
{ {
public class PauseProgressGraph : Container public class PauseProgressGraph : Container
{ {

View File

@ -1,14 +1,14 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Game.Graphics; using osu.Game.Graphics.UserInterface;
using OpenTK.Graphics;
namespace osu.Game.Overlays.Pause namespace osu.Game.Screens.Play.Pause
{ {
public class QuitButton : PauseButton public class QuitButton : DialogButton
{ {
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio) private void load(AudioManager audio)

View File

@ -4,10 +4,11 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Pause namespace osu.Game.Screens.Play.Pause
{ {
public class ResumeButton : PauseButton public class ResumeButton : DialogButton
{ {
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio, OsuColour colours) private void load(AudioManager audio, OsuColour colours)

View File

@ -4,10 +4,11 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Pause namespace osu.Game.Screens.Play.Pause
{ {
public class RetryButton : PauseButton public class RetryButton : DialogButton
{ {
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio, OsuColour colours) private void load(AudioManager audio, OsuColour colours)

View File

@ -2,19 +2,20 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System; using System;
using OpenTK;
using OpenTK.Input;
using OpenTK.Graphics;
using osu.Game.Graphics;
using osu.Framework.Input;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.Transforms;
using osu.Framework.Input;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Play.Pause;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Input;
namespace osu.Game.Overlays.Pause namespace osu.Game.Screens.Play
{ {
public class PauseOverlay : OverlayContainer public class PauseOverlay : OverlayContainer
{ {
@ -66,7 +67,7 @@ namespace osu.Game.Overlays.Pause
} }
} }
private FlowContainer retryCounterContainer; private FillFlowContainer retryCounterContainer;
public override bool Contains(Vector2 screenSpacePos) => true; public override bool Contains(Vector2 screenSpacePos) => true;
public override bool HandleInput => State == Visibility.Visible; public override bool HandleInput => State == Visibility.Visible;
@ -100,21 +101,21 @@ namespace osu.Game.Overlays.Pause
Colour = Color4.Black, Colour = Color4.Black,
Alpha = background_alpha, Alpha = background_alpha,
}, },
new FlowContainer new FillFlowContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FlowDirections.Vertical, Direction = FillDirection.Down,
Spacing = new Vector2(0f, 50f), Spacing = new Vector2(0, 50),
Origin = Anchor.Centre, Origin = Anchor.Centre,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Children = new Drawable[] Children = new Drawable[]
{ {
new FlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FlowDirections.Vertical, Direction = FillDirection.Down,
Spacing = new Vector2(0f, 20f), Spacing = new Vector2(0, 20),
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Children = new Drawable[] Children = new Drawable[]
@ -141,7 +142,7 @@ namespace osu.Game.Overlays.Pause
} }
} }
}, },
new FlowContainer new FillFlowContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
@ -156,7 +157,6 @@ namespace osu.Game.Overlays.Pause
{ {
new ResumeButton new ResumeButton
{ {
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Height = button_height, Height = button_height,
@ -164,7 +164,6 @@ namespace osu.Game.Overlays.Pause
}, },
new RetryButton new RetryButton
{ {
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Height = button_height, Height = button_height,
@ -176,7 +175,6 @@ namespace osu.Game.Overlays.Pause
}, },
new QuitButton new QuitButton
{ {
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Height = button_height, Height = button_height,
@ -188,7 +186,7 @@ namespace osu.Game.Overlays.Pause
} }
} }
}, },
retryCounterContainer = new FlowContainer retryCounterContainer = new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,

View File

@ -16,7 +16,6 @@ using osu.Framework.Screens;
using osu.Game.Modes.UI; using osu.Game.Modes.UI;
using osu.Game.Screens.Ranking; using osu.Game.Screens.Ranking;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Overlays.Pause;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using System; using System;
using System.Linq; using System.Linq;
@ -152,7 +151,6 @@ namespace osu.Game.Screens.Play
playerInputManager = new PlayerInputManager(game.Host) playerInputManager = new PlayerInputManager(game.Host)
{ {
Clock = new InterpolatingFramedClock(sourceClock), Clock = new InterpolatingFramedClock(sourceClock),
PassThrough = false,
Children = new Drawable[] Children = new Drawable[]
{ {
hitRenderer, hitRenderer,
@ -196,7 +194,6 @@ namespace osu.Game.Screens.Play
if (canPause || force) if (canPause || force)
{ {
lastPauseActionTime = Time.Current; lastPauseActionTime = Time.Current;
playerInputManager.PassThrough = true;
scoreOverlay.KeyCounter.IsCounting = false; scoreOverlay.KeyCounter.IsCounting = false;
pauseOverlay.Retries = RestartCount; pauseOverlay.Retries = RestartCount;
pauseOverlay.Show(); pauseOverlay.Show();
@ -212,7 +209,6 @@ namespace osu.Game.Screens.Play
public void Resume() public void Resume()
{ {
lastPauseActionTime = Time.Current; lastPauseActionTime = Time.Current;
playerInputManager.PassThrough = false;
scoreOverlay.KeyCounter.IsCounting = true; scoreOverlay.KeyCounter.IsCounting = true;
pauseOverlay.Hide(); pauseOverlay.Hide();
sourceClock.Start(); sourceClock.Start();

View File

@ -131,12 +131,12 @@ namespace osu.Game.Screens.Play
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Children = new Drawable[] Children = new Drawable[]
{ {
new FlowContainer() new FillFlowContainer()
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Direction = FlowDirections.Vertical, Direction = FillDirection.Down,
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText new OsuSpriteText

View File

@ -65,10 +65,10 @@ namespace osu.Game.Screens.Ranking
Children = new Drawable[] Children = new Drawable[]
{ {
new FlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FlowDirections.Vertical, Direction = FillDirection.Down,
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText new OsuSpriteText

View File

@ -0,0 +1,46 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Allocation;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Graphics;
using osu.Game.Overlays.Dialog;
namespace osu.Game.Screens.Select
{
public class BeatmapDeleteDialog : PopupDialog
{
private BeatmapDatabase database;
[BackgroundDependencyLoader]
private void load(BeatmapDatabase beatmapDatabase)
{
database = beatmapDatabase;
}
public BeatmapDeleteDialog(WorkingBeatmap beatmap)
{
Icon = FontAwesome.fa_trash_o;
HeaderText = @"Confirm deletion of";
BodyText = $@"{beatmap?.Beatmap?.Metadata?.Artist} - {beatmap?.Beatmap?.Metadata?.Title}";
Buttons = new PopupDialogButton[]
{
new PopupDialogOkButton
{
Text = @"Yes. Totally. Delete it.",
Action = () =>
{
beatmap.Dispose();
database.Delete(beatmap.BeatmapSetInfo);
},
},
new PopupDialogCancelButton
{
Text = @"Firetruck, I didn't mean to!",
},
};
}
}
}

View File

@ -121,11 +121,11 @@ namespace osu.Game.Screens.Select
}, },
}, },
// Text for beatmap info // Text for beatmap info
new FlowContainer new FillFlowContainer
{ {
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Direction = FlowDirections.Vertical, Direction = FillDirection.Down,
Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 }, Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 },
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
@ -144,10 +144,10 @@ namespace osu.Game.Screens.Select
TextSize = 17, TextSize = 17,
Shadow = true, Shadow = true,
}, },
new FlowContainer new FillFlowContainer
{ {
Margin = new MarginPadding { Top = 10 }, Margin = new MarginPadding { Top = 10 },
Direction = FlowDirections.Horizontal, Direction = FillDirection.Right,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = new [] Children = new []
{ {
@ -167,10 +167,10 @@ namespace osu.Game.Screens.Select
}, },
} }
}, },
new FlowContainer new FillFlowContainer
{ {
Margin = new MarginPadding { Top = 20 }, Margin = new MarginPadding { Top = 20 },
Spacing = new Vector2(40,0), Spacing = new Vector2(40, 0),
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = labels Children = labels
}, },

View File

@ -183,6 +183,7 @@ namespace osu.Game.Screens.Select
if (SelectedGroup != null && SelectedGroup != group && SelectedGroup.State != BeatmapGroupState.Hidden) if (SelectedGroup != null && SelectedGroup != group && SelectedGroup.State != BeatmapGroupState.Hidden)
SelectedGroup.State = BeatmapGroupState.Collapsed; SelectedGroup.State = BeatmapGroupState.Collapsed;
group.State = BeatmapGroupState.Expanded;
SelectedGroup = group; SelectedGroup = group;
panel.State = PanelSelectedState.Selected; panel.State = PanelSelectedState.Selected;
SelectedPanel = panel; SelectedPanel = panel;
@ -191,6 +192,62 @@ namespace osu.Game.Screens.Select
ScrollTo(selectedY, animated); ScrollTo(selectedY, animated);
} }
public void Sort(FilterControl.SortMode mode)
{
switch (mode)
{
case FilterControl.SortMode.Artist:
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Artist, y.BeatmapSet.Metadata.Artist));
break;
case FilterControl.SortMode.Title:
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Title, y.BeatmapSet.Metadata.Title));
break;
case FilterControl.SortMode.Author:
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Author, y.BeatmapSet.Metadata.Author));
break;
case FilterControl.SortMode.Difficulty:
groups.Sort((x, y) =>
{
float xAverage = 0, yAverage = 0;
int counter = 0;
foreach (BeatmapInfo set in x.BeatmapSet.Beatmaps)
{
xAverage += set.StarDifficulty;
counter++;
}
xAverage /= counter;
counter = 0;
foreach (BeatmapInfo set in y.BeatmapSet.Beatmaps)
{
yAverage += set.StarDifficulty;
counter++;
}
yAverage /= counter;
if (xAverage > yAverage)
return 1;
else
return -1;
});
break;
default:
throw new NotImplementedException();
}
scrollableContent.Clear(false);
lifetime.Clear();
foreach (BeatmapGroup group in groups)
{
group.Header.Depth = -scrollableContent.Children.Count();
scrollableContent.Add(group.Header);
foreach (BeatmapPanel panel in group.BeatmapPanels)
{
panel.Depth = -scrollableContent.Children.Count();
scrollableContent.Add(panel);
}
}
}
private static float offsetX(float dist, float halfHeight) private static float offsetX(float dist, float halfHeight)
{ {
// The radius of the circle the carousel moves on. // The radius of the circle the carousel moves on.
@ -291,7 +348,7 @@ namespace osu.Game.Screens.Select
public void SelectNext(int direction = 1, bool skipDifficulties = true) public void SelectNext(int direction = 1, bool skipDifficulties = true)
{ {
if (!skipDifficulties) if (!skipDifficulties && SelectedGroup != null)
{ {
int i = SelectedGroup.BeatmapPanels.IndexOf(SelectedPanel) + direction; int i = SelectedGroup.BeatmapPanels.IndexOf(SelectedPanel) + direction;

View File

@ -21,7 +21,18 @@ namespace osu.Game.Screens.Select
public Action FilterChanged; public Action FilterChanged;
public string Search => searchTextBox.Text; public string Search => searchTextBox.Text;
public SortMode Sort { get; private set; } = SortMode.Title; private SortMode sort = SortMode.Title;
public SortMode Sort {
get { return sort; }
set {
if (sort != value)
{
sort = value;
FilterChanged?.Invoke();
}
}
}
public Action Exit; public Action Exit;
private SearchTextBox searchTextBox; private SearchTextBox searchTextBox;
@ -36,7 +47,7 @@ namespace osu.Game.Screens.Select
Alpha = 0.8f, Alpha = 0.8f,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
new FlowContainer new FillFlowContainer
{ {
Padding = new MarginPadding(20), Padding = new MarginPadding(20),
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
@ -44,7 +55,7 @@ namespace osu.Game.Screens.Select
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Width = 0.4f, // TODO: InnerWidth property or something Width = 0.4f, // TODO: InnerWidth property or something
Direction = FlowDirections.Vertical, Direction = FillDirection.Down,
Children = new Drawable[] Children = new Drawable[]
{ {
searchTextBox = new SearchTextBox { searchTextBox = new SearchTextBox {
@ -174,10 +185,10 @@ namespace osu.Game.Screens.Select
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
}, },
new FlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FlowDirections.Horizontal, Direction = FillDirection.Right,
Spacing = new Vector2(10, 0), Spacing = new Vector2(10, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
@ -206,10 +217,10 @@ namespace osu.Game.Screens.Select
} }
} }
}, },
new FlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FlowDirections.Horizontal, Direction = FillDirection.Right,
Spacing = new Vector2(10, 0), Spacing = new Vector2(10, 0),
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
@ -251,9 +262,9 @@ namespace osu.Game.Screens.Select
public enum SortMode public enum SortMode
{ {
Arist, Artist,
BPM, BPM,
Creator, Author,
DateAdded, DateAdded,
Difficulty, Difficulty,
Length, Length,
@ -264,9 +275,9 @@ namespace osu.Game.Screens.Select
public enum GroupMode public enum GroupMode
{ {
NoGrouping, NoGrouping,
Arist, Artist,
BPM, BPM,
Creator, Author,
DateAdded, DateAdded,
Difficulty, Difficulty,
Length, Length,

View File

@ -30,7 +30,7 @@ namespace osu.Game.Screens.Select
public Action OnBack; public Action OnBack;
public Action OnStart; public Action OnStart;
private FlowContainer buttons; private FillFlowContainer buttons;
public OsuLogo StartButton; public OsuLogo StartButton;
@ -91,21 +91,20 @@ namespace osu.Game.Screens.Select
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Action = () => OnBack?.Invoke(), Action = () => OnBack?.Invoke(),
}, },
new FlowContainer new FillFlowContainer
{ {
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Position = new Vector2(BackButton.SIZE_EXTENDED.X + padding, 0), Position = new Vector2(BackButton.SIZE_EXTENDED.X + padding, 0),
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
Direction = FlowDirections.Horizontal, Direction = FillDirection.Right,
Spacing = new Vector2(padding, 0), Spacing = new Vector2(padding, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
buttons = new FillFlowContainer
buttons = new FlowContainer
{ {
Direction = FlowDirections.Horizontal, Direction = FillDirection.Right,
Spacing = new Vector2(0.2f, 0), Spacing = new Vector2(0.2f, 0),
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
} }

View File

@ -27,17 +27,19 @@ using osu.Framework.Input;
using OpenTK.Input; using OpenTK.Input;
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Threading; using osu.Framework.Threading;
using osu.Game.Overlays;
namespace osu.Game.Screens.Select namespace osu.Game.Screens.Select
{ {
public class PlaySongSelect : OsuScreen public class PlaySongSelect : OsuScreen
{ {
private Bindable<PlayMode> playMode; private Bindable<PlayMode> playMode = new Bindable<PlayMode>();
private BeatmapDatabase database; private BeatmapDatabase database;
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
private CarouselContainer carousel; private CarouselContainer carousel;
private TrackManager trackManager; private TrackManager trackManager;
private DialogOverlay dialogOverlay;
private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 225); private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 225);
private BeatmapInfoWedge beatmapInfoWedge; private BeatmapInfoWedge beatmapInfoWedge;
@ -54,11 +56,26 @@ namespace osu.Game.Screens.Select
OsuScreen player; OsuScreen player;
FilterControl filter; private FilterControl filter;
public FilterControl Filter
{
get
{
return filter;
}
private set
{
if (filter != value)
{
filter = value;
filterChanged();
}
}
}
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
private void load(BeatmapDatabase beatmaps, AudioManager audio, Framework.Game game, private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, Framework.Game game,
OsuGame osuGame, OsuColour colours) OsuGame osu, OsuColour colours)
{ {
const float carousel_width = 640; const float carousel_width = 640;
const float filter_height = 100; const float filter_height = 100;
@ -94,7 +111,7 @@ namespace osu.Game.Screens.Select
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = filter_height, Height = filter_height,
FilterChanged = filterChanged, FilterChanged = () => filterChanged(),
Exit = Exit, Exit = Exit,
}, },
beatmapInfoWedge = new BeatmapInfoWedge beatmapInfoWedge = new BeatmapInfoWedge
@ -122,18 +139,16 @@ namespace osu.Game.Screens.Select
PreferredPlayMode = playMode.Value PreferredPlayMode = playMode.Value
})).LoadAsync(Game, l => Push(player)); })).LoadAsync(Game, l => Push(player));
} }
} },
}; };
footer.AddButton(@"mods", colours.Yellow, null); footer.AddButton(@"mods", colours.Yellow, null);
footer.AddButton(@"random", colours.Green, carousel.SelectRandom); footer.AddButton(@"random", colours.Green, carousel.SelectRandom);
footer.AddButton(@"options", colours.Blue, null); footer.AddButton(@"options", colours.Blue, null);
if (osuGame != null) if (osu != null)
{ playMode.BindTo(osu.PlayMode);
playMode = osuGame.PlayMode; playMode.ValueChanged += playMode_ValueChanged;
playMode.ValueChanged += playMode_ValueChanged;
}
if (database == null) if (database == null)
database = beatmaps; database = beatmaps;
@ -142,6 +157,7 @@ namespace osu.Game.Screens.Select
database.BeatmapSetRemoved += onBeatmapSetRemoved; database.BeatmapSetRemoved += onBeatmapSetRemoved;
trackManager = audio.Track; trackManager = audio.Track;
dialogOverlay = dialog;
sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty"); sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty");
sampleChangeBeatmap = audio.Sample.Get(@"SongSelect/select-expand"); sampleChangeBeatmap = audio.Sample.Get(@"SongSelect/select-expand");
@ -153,7 +169,7 @@ namespace osu.Game.Screens.Select
private ScheduledDelegate filterTask; private ScheduledDelegate filterTask;
private void filterChanged() private void filterChanged(bool debounce = true, bool eagerSelection = true)
{ {
filterTask?.Cancel(); filterTask?.Cancel();
filterTask = Scheduler.AddDelayed(() => filterTask = Scheduler.AddDelayed(() =>
@ -161,28 +177,46 @@ namespace osu.Game.Screens.Select
filterTask = null; filterTask = null;
var search = filter.Search; var search = filter.Search;
BeatmapGroup newSelection = null; BeatmapGroup newSelection = null;
carousel.Sort(filter.Sort);
foreach (var beatmapGroup in carousel) foreach (var beatmapGroup in carousel)
{ {
var set = beatmapGroup.BeatmapSet; var set = beatmapGroup.BeatmapSet;
bool match = string.IsNullOrEmpty(search)
bool hasCurrentMode = set.Beatmaps.Any(bm => bm.Mode == playMode);
bool match = hasCurrentMode;
match &= string.IsNullOrEmpty(search)
|| (set.Metadata.Artist ?? "").IndexOf(search, StringComparison.InvariantCultureIgnoreCase) != -1 || (set.Metadata.Artist ?? "").IndexOf(search, StringComparison.InvariantCultureIgnoreCase) != -1
|| (set.Metadata.ArtistUnicode ?? "").IndexOf(search, StringComparison.InvariantCultureIgnoreCase) != -1 || (set.Metadata.ArtistUnicode ?? "").IndexOf(search, StringComparison.InvariantCultureIgnoreCase) != -1
|| (set.Metadata.Title ?? "").IndexOf(search, StringComparison.InvariantCultureIgnoreCase) != -1 || (set.Metadata.Title ?? "").IndexOf(search, StringComparison.InvariantCultureIgnoreCase) != -1
|| (set.Metadata.TitleUnicode ?? "").IndexOf(search, StringComparison.InvariantCultureIgnoreCase) != -1; || (set.Metadata.TitleUnicode ?? "").IndexOf(search, StringComparison.InvariantCultureIgnoreCase) != -1;
if (match) if (match)
{ {
beatmapGroup.State = BeatmapGroupState.Collapsed;
if (newSelection == null || beatmapGroup.BeatmapSet.OnlineBeatmapSetID == Beatmap.BeatmapSetInfo.OnlineBeatmapSetID) if (newSelection == null || beatmapGroup.BeatmapSet.OnlineBeatmapSetID == Beatmap.BeatmapSetInfo.OnlineBeatmapSetID)
{
if (newSelection != null)
newSelection.State = BeatmapGroupState.Collapsed;
newSelection = beatmapGroup; newSelection = beatmapGroup;
}
else
beatmapGroup.State = BeatmapGroupState.Collapsed;
} }
else else
{ {
beatmapGroup.State = BeatmapGroupState.Hidden; beatmapGroup.State = BeatmapGroupState.Hidden;
} }
} }
if (newSelection != null) if (newSelection != null)
carousel.SelectBeatmap(newSelection.BeatmapSet.Beatmaps[0], false); {
}, 250); if (newSelection.BeatmapPanels.Any(b => b.Beatmap.ID == Beatmap.BeatmapInfo.ID))
carousel.SelectBeatmap(Beatmap.BeatmapInfo, false);
else if (eagerSelection)
carousel.SelectBeatmap(newSelection.BeatmapSet.Beatmaps[0], false);
}
}, debounce ? 250 : 0);
} }
private void onBeatmapSetAdded(BeatmapSetInfo s) => Schedule(() => addBeatmapSet(s, Game, true)); private void onBeatmapSetAdded(BeatmapSetInfo s) => Schedule(() => addBeatmapSet(s, Game, true));
@ -243,8 +277,6 @@ namespace osu.Game.Screens.Select
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)
{ {
base.Dispose(isDisposing); base.Dispose(isDisposing);
if (playMode != null)
playMode.ValueChanged -= playMode_ValueChanged;
database.BeatmapSetAdded -= onBeatmapSetAdded; database.BeatmapSetAdded -= onBeatmapSetAdded;
database.BeatmapSetRemoved -= onBeatmapSetRemoved; database.BeatmapSetRemoved -= onBeatmapSetRemoved;
@ -254,6 +286,7 @@ namespace osu.Game.Screens.Select
private void playMode_ValueChanged(object sender, EventArgs e) private void playMode_ValueChanged(object sender, EventArgs e)
{ {
filterChanged(false);
} }
private void changeBackground(WorkingBeatmap beatmap) private void changeBackground(WorkingBeatmap beatmap)
@ -339,6 +372,8 @@ namespace osu.Game.Screens.Select
carousel.AddGroup(group); carousel.AddGroup(group);
filterChanged(false, false);
if (Beatmap == null || select) if (Beatmap == null || select)
carousel.SelectBeatmap(beatmapSet.Beatmaps.First()); carousel.SelectBeatmap(beatmapSet.Beatmaps.First());
else else
@ -382,12 +417,14 @@ namespace osu.Game.Screens.Select
footer.StartButton.TriggerClick(); footer.StartButton.TriggerClick();
return true; return true;
case Key.Delete: case Key.Delete:
if (Beatmap != null) if (state.Keyboard.ShiftPressed)
{ {
Beatmap.Dispose(); if (Beatmap != null)
database.Delete(Beatmap.BeatmapSetInfo); dialogOverlay?.Push(new BeatmapDeleteDialog(Beatmap));
return true;
} }
return true; break;
} }
return base.OnKeyDown(state, args); return base.OnKeyDown(state, args);

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Users namespace osu.Game.Users
{ {
public class User public class User

View File

@ -281,13 +281,19 @@
<Compile Include="Screens\Select\SearchTextBox.cs" /> <Compile Include="Screens\Select\SearchTextBox.cs" />
<Compile Include="Screens\Select\FooterButton.cs" /> <Compile Include="Screens\Select\FooterButton.cs" />
<Compile Include="Screens\Select\Footer.cs" /> <Compile Include="Screens\Select\Footer.cs" />
<Compile Include="Overlays\Pause\PauseButton.cs" /> <Compile Include="Screens\Play\PauseOverlay.cs" />
<Compile Include="Overlays\Pause\PauseOverlay.cs" /> <Compile Include="Screens\Play\Pause\PauseProgressBar.cs" />
<Compile Include="Overlays\Pause\PauseProgressBar.cs" /> <Compile Include="Screens\Play\Pause\PauseProgressGraph.cs" />
<Compile Include="Overlays\Pause\PauseProgressGraph.cs" /> <Compile Include="Screens\Play\Pause\ResumeButton.cs" />
<Compile Include="Overlays\Pause\ResumeButton.cs" /> <Compile Include="Screens\Play\Pause\RetryButton.cs" />
<Compile Include="Overlays\Pause\RetryButton.cs" /> <Compile Include="Screens\Play\Pause\QuitButton.cs" />
<Compile Include="Overlays\Pause\QuitButton.cs" /> <Compile Include="Overlays\Dialog\PopupDialog.cs" />
<Compile Include="Graphics\UserInterface\DialogButton.cs" />
<Compile Include="Overlays\Dialog\PopupDialogButton.cs" />
<Compile Include="Overlays\Dialog\PopupDialogOKButton.cs" />
<Compile Include="Overlays\Dialog\PopupDialogCancelButton.cs" />
<Compile Include="Screens\Select\BeatmapDeleteDialog.cs" />
<Compile Include="Overlays\DialogOverlay.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj"> <ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">
@ -308,6 +314,7 @@
<ItemGroup /> <ItemGroup />
<ItemGroup /> <ItemGroup />
<ItemGroup /> <ItemGroup />
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.