1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 19:23:20 +08:00

Merge branch 'master' into mod-overlay

This commit is contained in:
Seth 2017-03-03 01:11:15 -04:00 committed by GitHub
commit 1891bdf51e
16 changed files with 72 additions and 59 deletions

@ -1 +1 @@
Subproject commit 5dbb4a5134dacb2e98ab8f2af219039a72bd32e6 Subproject commit 798409058a421307b5a92aeea4cd60a065f5a0d4

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

@ -52,7 +52,6 @@ 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,

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

@ -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

@ -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,13 +1,12 @@
// 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 osu.Game.Graphics.UserInterface;
using OpenTK.Graphics;
namespace osu.Game.Overlays.Pause namespace osu.Game.Screens.Play.Pause
{ {
public class QuitButton : DialogButton public class QuitButton : DialogButton
{ {

View File

@ -6,7 +6,7 @@ using osu.Framework.Audio;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Pause namespace osu.Game.Screens.Play.Pause
{ {
public class ResumeButton : DialogButton public class ResumeButton : DialogButton
{ {

View File

@ -6,7 +6,7 @@ using osu.Framework.Audio;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Pause namespace osu.Game.Screens.Play.Pause
{ {
public class RetryButton : DialogButton public class RetryButton : DialogButton
{ {

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
{ {

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;

View File

@ -8,7 +8,7 @@ using osu.Game.Database;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Overlays.Dialog; using osu.Game.Overlays.Dialog;
namespace osu.Game namespace osu.Game.Screens.Select
{ {
public class BeatmapDeleteDialog : PopupDialog public class BeatmapDeleteDialog : PopupDialog
{ {

View File

@ -192,8 +192,10 @@ namespace osu.Game.Screens.Select
ScrollTo(selectedY, animated); ScrollTo(selectedY, animated);
} }
public void Sort(FilterControl.SortMode mode) { public void Sort(FilterControl.SortMode mode)
switch (mode) { {
switch (mode)
{
case FilterControl.SortMode.Artist: case FilterControl.SortMode.Artist:
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Artist, y.BeatmapSet.Metadata.Artist)); groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Artist, y.BeatmapSet.Metadata.Artist));
break; break;
@ -206,15 +208,17 @@ namespace osu.Game.Screens.Select
case FilterControl.SortMode.Difficulty: case FilterControl.SortMode.Difficulty:
groups.Sort((x, y) => groups.Sort((x, y) =>
{ {
float xAverage=0, yAverage=0; float xAverage = 0, yAverage = 0;
int counter=0; int counter = 0;
foreach (BeatmapInfo set in x.BeatmapSet.Beatmaps) { foreach (BeatmapInfo set in x.BeatmapSet.Beatmaps)
{
xAverage += set.StarDifficulty; xAverage += set.StarDifficulty;
counter++; counter++;
} }
xAverage /= counter; xAverage /= counter;
counter = 0; counter = 0;
foreach (BeatmapInfo set in y.BeatmapSet.Beatmaps) { foreach (BeatmapInfo set in y.BeatmapSet.Beatmaps)
{
yAverage += set.StarDifficulty; yAverage += set.StarDifficulty;
counter++; counter++;
} }
@ -241,7 +245,7 @@ namespace osu.Game.Screens.Select
scrollableContent.Add(panel); scrollableContent.Add(panel);
} }
} }
SelectGroup(groups.FirstOrDefault(), groups.First().BeatmapPanels.FirstOrDefault());
} }
private static float offsetX(float dist, float halfHeight) private static float offsetX(float dist, float halfHeight)
@ -344,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

@ -34,7 +34,7 @@ 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);
@ -78,7 +78,7 @@ namespace osu.Game.Screens.Select
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, 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;
@ -114,7 +114,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
@ -159,11 +159,9 @@ namespace osu.Game.Screens.Select
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;
@ -184,7 +182,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(() =>
@ -196,25 +194,42 @@ namespace osu.Game.Screens.Select
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));
@ -275,8 +290,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;
@ -286,6 +299,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)
@ -371,6 +385,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
@ -404,7 +420,6 @@ namespace osu.Game.Screens.Select
if (token.IsCancellationRequested) return; if (token.IsCancellationRequested) return;
addBeatmapSet(beatmapSet, game); addBeatmapSet(beatmapSet, game);
} }
filterChanged();
} }
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)

View File

@ -273,12 +273,12 @@
<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\PauseOverlay.cs" /> <Compile Include="Screens\Play\PauseOverlay.cs" />
<Compile Include="Overlays\Pause\PauseProgressBar.cs" /> <Compile Include="Screens\Play\Pause\PauseProgressBar.cs" />
<Compile Include="Overlays\Pause\PauseProgressGraph.cs" /> <Compile Include="Screens\Play\Pause\PauseProgressGraph.cs" />
<Compile Include="Overlays\Pause\ResumeButton.cs" /> <Compile Include="Screens\Play\Pause\ResumeButton.cs" />
<Compile Include="Overlays\Pause\RetryButton.cs" /> <Compile Include="Screens\Play\Pause\RetryButton.cs" />
<Compile Include="Overlays\Pause\QuitButton.cs" /> <Compile Include="Screens\Play\Pause\QuitButton.cs" />
<Compile Include="Overlays\Mods\ModSelectOverlay.cs" /> <Compile Include="Overlays\Mods\ModSelectOverlay.cs" />
<Compile Include="Modes\Mod.cs" /> <Compile Include="Modes\Mod.cs" />
<Compile Include="Overlays\Mods\ModButton.cs" /> <Compile Include="Overlays\Mods\ModButton.cs" />
@ -316,9 +316,6 @@
<ItemGroup /> <ItemGroup />
<ItemGroup /> <ItemGroup />
<ItemGroup /> <ItemGroup />
<ItemGroup>
<Folder Include="Overlays\Dialog\" />
</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.