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

Merge branch 'master' into beatmap-options

This commit is contained in:
Seth 2017-03-03 00:52:45 -04:00 committed by GitHub
commit 2e74b4be60
18 changed files with 78 additions and 62 deletions

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

View File

@ -74,7 +74,7 @@ namespace osu.Desktop.Deploy
refreshDirectory(StagingFolder);
//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;
while (Directory.GetFiles(ReleasesFolder, $"*{verBase}{increment}*").Any())
increment++;

View File

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

View File

@ -52,7 +52,6 @@ namespace osu.Game.Beatmaps.Drawables
},
artist = new OsuSpriteText
{
Margin = new MarginPadding { Top = -1 },
Font = @"Exo2.0-SemiBoldItalic",
Text = beatmap.BeatmapSetInfo.Metadata.Artist,
TextSize = 17,

View File

@ -14,6 +14,8 @@ namespace osu.Game.Graphics.UserInterface
{
protected override Drawable GetDrawableCharacter(char c) => new PasswordMaskChar(CalculatedTextSize);
public override bool AllowClipboardExport => false;
public class PasswordMaskChar : Container
{
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;
c2.Origin = c2.Anchor = (value & Anchor.x2) > 0 ? Anchor.TopRight : Anchor.TopLeft;
Margin = new MarginPadding
{
Right = (value & Anchor.x2) > 0 ? -SIZE_RETRACTED.X * shear * 0.5f : 0
};
X = (value & Anchor.x2) > 0 ? SIZE_RETRACTED.X * shear * 0.5f : 0;
c1.Depth = (value & Anchor.x2) > 0 ? 0 : 1;
c2.Depth = (value & Anchor.x2) > 0 ? 1 : 0;

View File

@ -55,7 +55,10 @@ namespace osu.Game.Overlays.Toolbar
},
modeSelector = new ToolbarModeSelector
{
OnPlayModeChange = OnPlayModeChange
OnPlayModeChange = (PlayMode mode) =>
{
OnPlayModeChange?.Invoke(mode);
}
}
}
},

View File

@ -1,15 +1,15 @@
// 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 osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
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
{

View File

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

View File

@ -1,13 +1,12 @@
// 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 osu.Framework.Allocation;
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 : DialogButton
{

View File

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

View File

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

View File

@ -2,19 +2,20 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
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.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Input;
using osu.Game.Graphics;
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
{

View File

@ -16,7 +16,6 @@ using osu.Framework.Screens;
using osu.Game.Modes.UI;
using osu.Game.Screens.Ranking;
using osu.Game.Configuration;
using osu.Game.Overlays.Pause;
using osu.Framework.Configuration;
using System;
using System.Linq;

View File

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

View File

@ -192,8 +192,10 @@ namespace osu.Game.Screens.Select
ScrollTo(selectedY, animated);
}
public void Sort(FilterControl.SortMode mode) {
switch (mode) {
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;
@ -206,15 +208,17 @@ namespace osu.Game.Screens.Select
case FilterControl.SortMode.Difficulty:
groups.Sort((x, y) =>
{
float xAverage=0, yAverage=0;
int counter=0;
foreach (BeatmapInfo set in x.BeatmapSet.Beatmaps) {
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) {
foreach (BeatmapInfo set in y.BeatmapSet.Beatmaps)
{
yAverage += set.StarDifficulty;
counter++;
}
@ -241,7 +245,7 @@ namespace osu.Game.Screens.Select
scrollableContent.Add(panel);
}
}
SelectGroup(groups.FirstOrDefault(), groups.First().BeatmapPanels.FirstOrDefault());
}
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)
{
if (!skipDifficulties)
if (!skipDifficulties && SelectedGroup != null)
{
int i = SelectedGroup.BeatmapPanels.IndexOf(SelectedPanel) + direction;

View File

@ -34,7 +34,7 @@ namespace osu.Game.Screens.Select
{
public class PlaySongSelect : OsuScreen
{
private Bindable<PlayMode> playMode;
private Bindable<PlayMode> playMode = new Bindable<PlayMode>();
private BeatmapDatabase database;
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
@ -77,7 +77,7 @@ namespace osu.Game.Screens.Select
[BackgroundDependencyLoader(permitNulls: true)]
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 filter_height = 100;
@ -113,7 +113,7 @@ namespace osu.Game.Screens.Select
{
RelativeSizeAxes = Axes.X,
Height = filter_height,
FilterChanged = filterChanged,
FilterChanged = () => filterChanged(),
Exit = Exit,
},
beatmapInfoWedge = new BeatmapInfoWedge
@ -162,11 +162,9 @@ namespace osu.Game.Screens.Select
footer.AddButton(@"random", colours.Green, carousel.SelectRandom);
footer.AddButton(@"options", colours.Blue, beatmapOptions.ToggleVisibility);
if (osuGame != null)
{
playMode = osuGame.PlayMode;
playMode.ValueChanged += playMode_ValueChanged;
}
if (osu != null)
playMode.BindTo(osu.PlayMode);
playMode.ValueChanged += playMode_ValueChanged;
if (database == null)
database = beatmaps;
@ -187,7 +185,7 @@ namespace osu.Game.Screens.Select
private ScheduledDelegate filterTask;
private void filterChanged()
private void filterChanged(bool debounce = true, bool eagerSelection = true)
{
filterTask?.Cancel();
filterTask = Scheduler.AddDelayed(() =>
@ -199,25 +197,42 @@ namespace osu.Game.Screens.Select
foreach (var beatmapGroup in carousel)
{
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.ArtistUnicode ?? "").IndexOf(search, StringComparison.InvariantCultureIgnoreCase) != -1
|| (set.Metadata.Title ?? "").IndexOf(search, StringComparison.InvariantCultureIgnoreCase) != -1
|| (set.Metadata.TitleUnicode ?? "").IndexOf(search, StringComparison.InvariantCultureIgnoreCase) != -1;
if (match)
{
beatmapGroup.State = BeatmapGroupState.Collapsed;
if (newSelection == null || beatmapGroup.BeatmapSet.OnlineBeatmapSetID == Beatmap.BeatmapSetInfo.OnlineBeatmapSetID)
{
if (newSelection != null)
newSelection.State = BeatmapGroupState.Collapsed;
newSelection = beatmapGroup;
}
else
beatmapGroup.State = BeatmapGroupState.Collapsed;
}
else
{
beatmapGroup.State = BeatmapGroupState.Hidden;
}
}
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));
@ -278,8 +293,6 @@ namespace osu.Game.Screens.Select
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
if (playMode != null)
playMode.ValueChanged -= playMode_ValueChanged;
database.BeatmapSetAdded -= onBeatmapSetAdded;
database.BeatmapSetRemoved -= onBeatmapSetRemoved;
@ -289,6 +302,7 @@ namespace osu.Game.Screens.Select
private void playMode_ValueChanged(object sender, EventArgs e)
{
filterChanged(false);
}
private void changeBackground(WorkingBeatmap beatmap)
@ -374,6 +388,8 @@ namespace osu.Game.Screens.Select
carousel.AddGroup(group);
filterChanged(false, false);
if (Beatmap == null || select)
carousel.SelectBeatmap(beatmapSet.Beatmaps.First());
else
@ -407,7 +423,6 @@ namespace osu.Game.Screens.Select
if (token.IsCancellationRequested) return;
addBeatmapSet(beatmapSet, game);
}
filterChanged();
}
private void promptDelete()

View File

@ -274,12 +274,12 @@
<Compile Include="Screens\Select\SearchTextBox.cs" />
<Compile Include="Screens\Select\FooterButton.cs" />
<Compile Include="Screens\Select\Footer.cs" />
<Compile Include="Overlays\Pause\PauseOverlay.cs" />
<Compile Include="Overlays\Pause\PauseProgressBar.cs" />
<Compile Include="Overlays\Pause\PauseProgressGraph.cs" />
<Compile Include="Overlays\Pause\ResumeButton.cs" />
<Compile Include="Overlays\Pause\RetryButton.cs" />
<Compile Include="Overlays\Pause\QuitButton.cs" />
<Compile Include="Screens\Play\PauseOverlay.cs" />
<Compile Include="Screens\Play\Pause\PauseProgressBar.cs" />
<Compile Include="Screens\Play\Pause\PauseProgressGraph.cs" />
<Compile Include="Screens\Play\Pause\ResumeButton.cs" />
<Compile Include="Screens\Play\Pause\RetryButton.cs" />
<Compile Include="Screens\Play\Pause\QuitButton.cs" />
<Compile Include="Overlays\Dialog\PopupDialog.cs" />
<Compile Include="Graphics\UserInterface\DialogButton.cs" />
<Compile Include="Overlays\Dialog\PopupDialogButton.cs" />
@ -313,10 +313,7 @@
<ItemGroup />
<ItemGroup />
<ItemGroup />
<ItemGroup>
<Folder Include="Overlays\Dialog\" />
<Folder Include="Screens\Select\Options\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 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.