mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Merge remote-tracking branch 'upstream/master' into open-downloaded-beatmas
This commit is contained in:
@ -39,6 +39,11 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
|
|
||||||
private int downCount;
|
private int downCount;
|
||||||
|
|
||||||
|
private const float pressed_scale = 1.2f;
|
||||||
|
private const float released_scale = 1f;
|
||||||
|
|
||||||
|
private float targetScale => downCount > 0 ? pressed_scale : released_scale;
|
||||||
|
|
||||||
public bool OnPressed(OsuAction action)
|
public bool OnPressed(OsuAction action)
|
||||||
{
|
{
|
||||||
switch (action)
|
switch (action)
|
||||||
@ -46,7 +51,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
case OsuAction.LeftButton:
|
case OsuAction.LeftButton:
|
||||||
case OsuAction.RightButton:
|
case OsuAction.RightButton:
|
||||||
downCount++;
|
downCount++;
|
||||||
ActiveCursor.ScaleTo(1).ScaleTo(1.2f, 100, Easing.OutQuad);
|
ActiveCursor.ScaleTo(released_scale).ScaleTo(targetScale, 100, Easing.OutQuad);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +65,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
case OsuAction.LeftButton:
|
case OsuAction.LeftButton:
|
||||||
case OsuAction.RightButton:
|
case OsuAction.RightButton:
|
||||||
if (--downCount == 0)
|
if (--downCount == 0)
|
||||||
ActiveCursor.ScaleTo(1, 200, Easing.OutQuad);
|
ActiveCursor.ScaleTo(targetScale, 200, Easing.OutQuad);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,13 +77,13 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
{
|
{
|
||||||
fadeContainer.FadeTo(1, 300, Easing.OutQuint);
|
fadeContainer.FadeTo(1, 300, Easing.OutQuint);
|
||||||
ActiveCursor.ScaleTo(1, 400, Easing.OutQuint);
|
ActiveCursor.ScaleTo(targetScale, 400, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopOut()
|
protected override void PopOut()
|
||||||
{
|
{
|
||||||
fadeContainer.FadeTo(0.05f, 450, Easing.OutQuint);
|
fadeContainer.FadeTo(0.05f, 450, Easing.OutQuint);
|
||||||
ActiveCursor.ScaleTo(0.8f, 450, Easing.OutQuint);
|
ActiveCursor.ScaleTo(targetScale * 0.8f, 450, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OsuCursor : Container
|
public class OsuCursor : Container
|
||||||
|
@ -18,7 +18,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
IsCounting = true,
|
|
||||||
Children = new KeyCounter[]
|
Children = new KeyCounter[]
|
||||||
{
|
{
|
||||||
new KeyCounterKeyboard(Key.Z),
|
new KeyCounterKeyboard(Key.Z),
|
||||||
|
@ -16,7 +16,6 @@ using osu.Game.Rulesets;
|
|||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
using osu.Game.Screens.Select.Carousel;
|
using osu.Game.Screens.Select.Carousel;
|
||||||
using osu.Game.Screens.Select.Filter;
|
using osu.Game.Screens.Select.Filter;
|
||||||
using osu.Game.Tests.Platform;
|
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
{
|
{
|
||||||
@ -28,6 +27,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
private RulesetStore rulesets;
|
private RulesetStore rulesets;
|
||||||
|
|
||||||
private WorkingBeatmap defaultBeatmap;
|
private WorkingBeatmap defaultBeatmap;
|
||||||
|
private DatabaseContextFactory factory;
|
||||||
|
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
@ -59,10 +59,11 @@ namespace osu.Game.Tests.Visual
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
var storage = new TestStorage(@"TestCasePlaySongSelect");
|
factory = new DatabaseContextFactory(LocalStorage);
|
||||||
|
factory.ResetDatabase();
|
||||||
|
|
||||||
// this is by no means clean. should be replacing inside of OsuGameBase somehow.
|
using (var usage = factory.Get())
|
||||||
DatabaseContextFactory factory = new DatabaseContextFactory(storage);
|
usage.Migrate();
|
||||||
|
|
||||||
factory.ResetDatabase();
|
factory.ResetDatabase();
|
||||||
|
|
||||||
@ -70,7 +71,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
usage.Migrate();
|
usage.Migrate();
|
||||||
|
|
||||||
Dependencies.Cache(rulesets = new RulesetStore(factory));
|
Dependencies.Cache(rulesets = new RulesetStore(factory));
|
||||||
Dependencies.Cache(manager = new BeatmapManager(storage, factory, rulesets, null, null)
|
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, factory, rulesets, null, null)
|
||||||
{
|
{
|
||||||
DefaultBeatmap = defaultBeatmap = Beatmap.Default
|
DefaultBeatmap = defaultBeatmap = Beatmap.Default
|
||||||
});
|
});
|
||||||
|
@ -123,7 +123,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
private void validateOnlineIds(List<BeatmapInfo> beatmaps)
|
private void validateOnlineIds(List<BeatmapInfo> beatmaps)
|
||||||
{
|
{
|
||||||
var beatmapIds = beatmaps.Where(b => b.OnlineBeatmapID.HasValue).Select(b => b.OnlineBeatmapID);
|
var beatmapIds = beatmaps.Where(b => b.OnlineBeatmapID.HasValue).Select(b => b.OnlineBeatmapID).ToList();
|
||||||
|
|
||||||
// ensure all IDs are unique in this set and none match existing IDs in the local beatmap store.
|
// ensure all IDs are unique in this set and none match existing IDs in the local beatmap store.
|
||||||
if (beatmapIds.GroupBy(b => b).Any(g => g.Count() > 1) || QueryBeatmaps(b => beatmapIds.Contains(b.OnlineBeatmapID)).Any())
|
if (beatmapIds.GroupBy(b => b).Any(g => g.Count() > 1) || QueryBeatmaps(b => beatmapIds.Contains(b.OnlineBeatmapID)).Any())
|
||||||
|
@ -30,6 +30,8 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
{
|
{
|
||||||
string[] split = text.Split(',');
|
string[] split = text.Split(',');
|
||||||
|
|
||||||
|
Vector2 pos = new Vector2((int)Convert.ToSingle(split[0], CultureInfo.InvariantCulture), (int)Convert.ToSingle(split[1], CultureInfo.InvariantCulture));
|
||||||
|
|
||||||
ConvertHitObjectType type = (ConvertHitObjectType)int.Parse(split[3]) & ~ConvertHitObjectType.ColourHax;
|
ConvertHitObjectType type = (ConvertHitObjectType)int.Parse(split[3]) & ~ConvertHitObjectType.ColourHax;
|
||||||
bool combo = type.HasFlag(ConvertHitObjectType.NewCombo);
|
bool combo = type.HasFlag(ConvertHitObjectType.NewCombo);
|
||||||
type &= ~ConvertHitObjectType.NewCombo;
|
type &= ~ConvertHitObjectType.NewCombo;
|
||||||
@ -41,15 +43,13 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
|
|
||||||
if (type.HasFlag(ConvertHitObjectType.Circle))
|
if (type.HasFlag(ConvertHitObjectType.Circle))
|
||||||
{
|
{
|
||||||
result = CreateHit(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo);
|
result = CreateHit(pos, combo);
|
||||||
|
|
||||||
if (split.Length > 5)
|
if (split.Length > 5)
|
||||||
readCustomSampleBanks(split[5], bankInfo);
|
readCustomSampleBanks(split[5], bankInfo);
|
||||||
}
|
}
|
||||||
else if (type.HasFlag(ConvertHitObjectType.Slider))
|
else if (type.HasFlag(ConvertHitObjectType.Slider))
|
||||||
{
|
{
|
||||||
var pos = new Vector2(int.Parse(split[0]), int.Parse(split[1]));
|
|
||||||
|
|
||||||
CurveType curveType = CurveType.Catmull;
|
CurveType curveType = CurveType.Catmull;
|
||||||
double length = 0;
|
double length = 0;
|
||||||
var points = new List<Vector2> { Vector2.Zero };
|
var points = new List<Vector2> { Vector2.Zero };
|
||||||
@ -170,7 +170,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo);
|
readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = CreateHold(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo, endTime + offset);
|
result = CreateHold(pos, combo, endTime + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
|
@ -89,6 +89,14 @@ namespace osu.Game.Rulesets.UI
|
|||||||
Ruleset = ruleset;
|
Ruleset = ruleset;
|
||||||
playfield = new Lazy<Playfield>(CreatePlayfield);
|
playfield = new Lazy<Playfield>(CreatePlayfield);
|
||||||
|
|
||||||
|
IsPaused.ValueChanged += paused =>
|
||||||
|
{
|
||||||
|
if (HasReplayLoaded)
|
||||||
|
return;
|
||||||
|
|
||||||
|
KeyBindingInputManager.UseParentInput = !paused;
|
||||||
|
};
|
||||||
|
|
||||||
Cursor = CreateCursor();
|
Cursor = CreateCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,6 +128,11 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
public Replay Replay { get; private set; }
|
public Replay Replay { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the game is paused. Used to block user input.
|
||||||
|
/// </summary>
|
||||||
|
public readonly BindableBool IsPaused = new BindableBool();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets a replay to be used, overriding local input.
|
/// Sets a replay to be used, overriding local input.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -195,7 +195,6 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
protected virtual KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection
|
protected virtual KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection
|
||||||
{
|
{
|
||||||
IsCounting = true,
|
|
||||||
FadeTime = 50,
|
FadeTime = 50,
|
||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.BottomRight,
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Screens.Play
|
|||||||
private Container textLayer;
|
private Container textLayer;
|
||||||
private SpriteText countSpriteText;
|
private SpriteText countSpriteText;
|
||||||
|
|
||||||
public bool IsCounting { get; set; }
|
public bool IsCounting { get; set; } = true;
|
||||||
private int countPresses;
|
private int countPresses;
|
||||||
public int CountPresses
|
public int CountPresses
|
||||||
{
|
{
|
||||||
|
@ -53,8 +53,7 @@ namespace osu.Game.Screens.Play
|
|||||||
configVisibility.BindValueChanged(_ => updateVisibility(), true);
|
configVisibility.BindValueChanged(_ => updateVisibility(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//further: change default values here and in KeyCounter if needed, instead of passing them in every constructor
|
private bool isCounting = true;
|
||||||
private bool isCounting;
|
|
||||||
public bool IsCounting
|
public bool IsCounting
|
||||||
{
|
{
|
||||||
get { return isCounting; }
|
get { return isCounting; }
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
@ -18,7 +19,7 @@ namespace osu.Game.Screens.Play
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class PauseContainer : Container
|
public class PauseContainer : Container
|
||||||
{
|
{
|
||||||
public bool IsPaused { get; private set; }
|
public readonly BindableBool IsPaused = new BindableBool();
|
||||||
|
|
||||||
public Func<bool> CheckCanPause;
|
public Func<bool> CheckCanPause;
|
||||||
|
|
||||||
@ -39,9 +40,6 @@ namespace osu.Game.Screens.Play
|
|||||||
public Action OnRetry;
|
public Action OnRetry;
|
||||||
public Action OnQuit;
|
public Action OnQuit;
|
||||||
|
|
||||||
public Action OnResume;
|
|
||||||
public Action OnPause;
|
|
||||||
|
|
||||||
private readonly FramedClock framedClock;
|
private readonly FramedClock framedClock;
|
||||||
private readonly DecoupleableInterpolatingFramedClock decoupledClock;
|
private readonly DecoupleableInterpolatingFramedClock decoupledClock;
|
||||||
|
|
||||||
@ -84,9 +82,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
// stop the seekable clock (stops the audio eventually)
|
// stop the seekable clock (stops the audio eventually)
|
||||||
decoupledClock.Stop();
|
decoupledClock.Stop();
|
||||||
IsPaused = true;
|
IsPaused.Value = true;
|
||||||
|
|
||||||
OnPause?.Invoke();
|
|
||||||
pauseOverlay.Show();
|
pauseOverlay.Show();
|
||||||
|
|
||||||
lastPauseActionTime = Time.Current;
|
lastPauseActionTime = Time.Current;
|
||||||
@ -96,7 +93,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
if (!IsPaused) return;
|
if (!IsPaused) return;
|
||||||
|
|
||||||
IsPaused = false;
|
IsPaused.Value = false;
|
||||||
IsResuming = false;
|
IsResuming = false;
|
||||||
lastPauseActionTime = Time.Current;
|
lastPauseActionTime = Time.Current;
|
||||||
|
|
||||||
@ -105,7 +102,6 @@ namespace osu.Game.Screens.Play
|
|||||||
decoupledClock.Seek(decoupledClock.CurrentTime);
|
decoupledClock.Seek(decoupledClock.CurrentTime);
|
||||||
decoupledClock.Start();
|
decoupledClock.Start();
|
||||||
|
|
||||||
OnResume?.Invoke();
|
|
||||||
pauseOverlay.Hide();
|
pauseOverlay.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,15 +162,10 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
pauseContainer = new PauseContainer(offsetClock, adjustableClock)
|
pauseContainer = new PauseContainer(offsetClock, adjustableClock)
|
||||||
{
|
{
|
||||||
|
Retries = RestartCount,
|
||||||
OnRetry = Restart,
|
OnRetry = Restart,
|
||||||
OnQuit = Exit,
|
OnQuit = Exit,
|
||||||
CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded,
|
CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded,
|
||||||
OnPause = () =>
|
|
||||||
{
|
|
||||||
pauseContainer.Retries = RestartCount;
|
|
||||||
hudOverlay.KeyCounter.IsCounting = !pauseContainer.IsPaused;
|
|
||||||
},
|
|
||||||
OnResume = () => hudOverlay.KeyCounter.IsCounting = true,
|
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
storyboardContainer = new Container
|
storyboardContainer = new Container
|
||||||
@ -227,6 +222,8 @@ namespace osu.Game.Screens.Play
|
|||||||
hudOverlay.HoldToQuit.Action = Exit;
|
hudOverlay.HoldToQuit.Action = Exit;
|
||||||
hudOverlay.KeyCounter.Visible.BindTo(RulesetContainer.HasReplayLoaded);
|
hudOverlay.KeyCounter.Visible.BindTo(RulesetContainer.HasReplayLoaded);
|
||||||
|
|
||||||
|
RulesetContainer.IsPaused.BindTo(pauseContainer.IsPaused);
|
||||||
|
|
||||||
if (ShowStoryboard)
|
if (ShowStoryboard)
|
||||||
initializeStoryboard(false);
|
initializeStoryboard(false);
|
||||||
|
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
|
|
||||||
using osu.Framework.Platform;
|
|
||||||
|
|
||||||
namespace osu.Game.Tests.Platform
|
|
||||||
{
|
|
||||||
public class TestStorage : DesktopStorage
|
|
||||||
{
|
|
||||||
public TestStorage(string baseName)
|
|
||||||
: base(baseName, null)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string GetDatabaseConnectionString(string name) => "Data Source=" + GetUsablePathFor($"{(object)name}.db", true);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +1,12 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 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.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
@ -20,6 +22,9 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
protected DependencyContainer Dependencies { get; private set; }
|
protected DependencyContainer Dependencies { get; private set; }
|
||||||
|
|
||||||
|
private readonly Lazy<Storage> localStorage;
|
||||||
|
protected Storage LocalStorage => localStorage.Value;
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
{
|
{
|
||||||
Dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
Dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
@ -33,6 +38,11 @@ namespace osu.Game.Tests.Visual
|
|||||||
return Dependencies;
|
return Dependencies;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected OsuTestCase()
|
||||||
|
{
|
||||||
|
localStorage = new Lazy<Storage>(() => new DesktopStorage($"{GetType().Name}-{Guid.NewGuid()}", null));
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audioManager, RulesetStore rulesets)
|
private void load(AudioManager audioManager, RulesetStore rulesets)
|
||||||
{
|
{
|
||||||
@ -50,6 +60,9 @@ namespace osu.Game.Tests.Visual
|
|||||||
beatmap.Disabled = true;
|
beatmap.Disabled = true;
|
||||||
beatmap.Value.Track.Stop();
|
beatmap.Value.Track.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (localStorage.IsValueCreated)
|
||||||
|
localStorage.Value.DeleteDirectory(".");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override ITestCaseTestRunner CreateRunner() => new OsuTestCaseTestRunner();
|
protected override ITestCaseTestRunner CreateRunner() => new OsuTestCaseTestRunner();
|
||||||
|
Reference in New Issue
Block a user