mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 03:02:54 +08:00
Merge remote-tracking branch 'origin/master' into mania-timing-sections
This commit is contained in:
commit
9477024e7b
@ -54,33 +54,33 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
{
|
{
|
||||||
AddInternal(new Drawable[]
|
AddInternal(new Drawable[]
|
||||||
{
|
{
|
||||||
rightBackgroundContainer = new Container
|
|
||||||
{
|
|
||||||
Name = "Transparent playfield background",
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
BorderThickness = 2,
|
|
||||||
Masking = true,
|
|
||||||
EdgeEffect = new EdgeEffect
|
|
||||||
{
|
|
||||||
Type = EdgeEffectType.Shadow,
|
|
||||||
Colour = Color4.Black.Opacity(0.2f),
|
|
||||||
Radius = 5,
|
|
||||||
},
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
rightBackground = new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Alpha = 0.6f
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new ScaleFixContainer
|
new ScaleFixContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = DEFAULT_PLAYFIELD_HEIGHT,
|
Height = DEFAULT_PLAYFIELD_HEIGHT,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
|
rightBackgroundContainer = new Container
|
||||||
|
{
|
||||||
|
Name = "Transparent playfield background",
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
BorderThickness = 2,
|
||||||
|
Masking = true,
|
||||||
|
EdgeEffect = new EdgeEffect
|
||||||
|
{
|
||||||
|
Type = EdgeEffectType.Shadow,
|
||||||
|
Colour = Color4.Black.Opacity(0.2f),
|
||||||
|
Radius = 5,
|
||||||
|
},
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
rightBackground = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Alpha = 0.6f
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
Name = "Transparent playfield elements",
|
Name = "Transparent playfield elements",
|
||||||
|
@ -142,7 +142,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout),
|
Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout),
|
||||||
@"Beatmaps did not import to the database in allocated time");
|
@"Beatmaps did not import to the database in allocated time");
|
||||||
|
|
||||||
var set = host.Dependencies.Get<BeatmapDatabase>().GetChildren(resultSets.First(), true);
|
var set = host.Dependencies.Get<BeatmapDatabase>().GetChildren(resultSets.First());
|
||||||
|
|
||||||
Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count(),
|
Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count(),
|
||||||
$@"Incorrect database beatmap count post-import ({resultBeatmaps.Count()} but should be {set.Beatmaps.Count}).");
|
$@"Incorrect database beatmap count post-import ({resultBeatmaps.Count()} but should be {set.Beatmaps.Count}).");
|
||||||
|
@ -267,6 +267,9 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null, bool withStoryboard = false)
|
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null, bool withStoryboard = false)
|
||||||
{
|
{
|
||||||
|
if (beatmapInfo.BeatmapSet == null)
|
||||||
|
beatmapInfo = GetChildren(beatmapInfo, true);
|
||||||
|
|
||||||
if (beatmapInfo.BeatmapSet == null)
|
if (beatmapInfo.BeatmapSet == null)
|
||||||
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database.");
|
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database.");
|
||||||
|
|
||||||
|
@ -48,11 +48,9 @@ namespace osu.Game.Database
|
|||||||
return Connection.Table<T>();
|
return Connection.Table<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public T GetWithChildren<T>(object id, bool recursive = false) where T : class
|
/// <summary>
|
||||||
{
|
/// This is expensive. Use with caution.
|
||||||
return Connection.GetWithChildren<T>(id, recursive);
|
/// </summary>
|
||||||
}
|
|
||||||
|
|
||||||
public List<T> GetAllWithChildren<T>(Expression<Func<T, bool>> filter = null, bool recursive = true)
|
public List<T> GetAllWithChildren<T>(Expression<Func<T, bool>> filter = null, bool recursive = true)
|
||||||
where T : class
|
where T : class
|
||||||
{
|
{
|
||||||
|
@ -72,21 +72,28 @@ namespace osu.Game.Online.API
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static readonly object access_token_retrieval_lock = new object();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Should be run before any API request to make sure we have a valid key.
|
/// Should be run before any API request to make sure we have a valid key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool ensureAccessToken()
|
private bool ensureAccessToken()
|
||||||
{
|
{
|
||||||
//todo: we need to mutex this to ensure only one authentication request is running at a time.
|
// if we already have a valid access token, let's use it.
|
||||||
|
|
||||||
//If we already have a valid access token, let's use it.
|
|
||||||
if (accessTokenValid) return true;
|
if (accessTokenValid) return true;
|
||||||
|
|
||||||
//If not, let's try using our refresh token to request a new access token.
|
// we want to ensure only a single authentication update is happening at once.
|
||||||
if (!string.IsNullOrEmpty(Token?.RefreshToken))
|
lock (access_token_retrieval_lock)
|
||||||
AuthenticateWithRefresh(Token.RefreshToken);
|
{
|
||||||
|
// re-check if valid, in case another request completed and revalidated our access.
|
||||||
|
if (accessTokenValid) return true;
|
||||||
|
|
||||||
return accessTokenValid;
|
// if not, let's try using our refresh token to request a new access token.
|
||||||
|
if (!string.IsNullOrEmpty(Token?.RefreshToken))
|
||||||
|
AuthenticateWithRefresh(Token.RefreshToken);
|
||||||
|
|
||||||
|
return accessTokenValid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool accessTokenValid => Token?.IsValid ?? false;
|
private bool accessTokenValid => Token?.IsValid ?? false;
|
||||||
|
@ -41,13 +41,13 @@ namespace osu.Game.Online.API
|
|||||||
[JsonProperty(@"refresh_token")]
|
[JsonProperty(@"refresh_token")]
|
||||||
public string RefreshToken;
|
public string RefreshToken;
|
||||||
|
|
||||||
public override string ToString() => $@"{AccessToken}/{AccessTokenExpiry.ToString(NumberFormatInfo.InvariantInfo)}/{RefreshToken}";
|
public override string ToString() => $@"{AccessToken}|{AccessTokenExpiry.ToString(NumberFormatInfo.InvariantInfo)}|{RefreshToken}";
|
||||||
|
|
||||||
public static OAuthToken Parse(string value)
|
public static OAuthToken Parse(string value)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string[] parts = value.Split('/');
|
string[] parts = value.Split('|');
|
||||||
return new OAuthToken
|
return new OAuthToken
|
||||||
{
|
{
|
||||||
AccessToken = parts[0],
|
AccessToken = parts[0],
|
||||||
|
@ -110,12 +110,18 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
MoveToY(0, transition_length, EasingTypes.OutQuint);
|
MoveToY(0, transition_length, EasingTypes.OutQuint);
|
||||||
FadeIn(transition_length, EasingTypes.OutQuint);
|
FadeIn(transition_length, EasingTypes.OutQuint);
|
||||||
|
|
||||||
|
inputTextBox.HoldFocus = true;
|
||||||
|
base.PopIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopOut()
|
protected override void PopOut()
|
||||||
{
|
{
|
||||||
MoveToY(DrawSize.Y, transition_length, EasingTypes.InSine);
|
MoveToY(DrawSize.Y, transition_length, EasingTypes.InSine);
|
||||||
FadeOut(transition_length, EasingTypes.InSine);
|
FadeOut(transition_length, EasingTypes.InSine);
|
||||||
|
|
||||||
|
inputTextBox.HoldFocus = false;
|
||||||
|
base.PopOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
@ -16,20 +15,25 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Drawables
|
namespace osu.Game.Rulesets.Objects.Drawables
|
||||||
{
|
{
|
||||||
public abstract class DrawableHitObject<TJudgement> : Container, IStateful<ArmedState>
|
public abstract class DrawableHitObject<TObject, TJudgement> : Container
|
||||||
|
where TObject : HitObject
|
||||||
where TJudgement : Judgement
|
where TJudgement : Judgement
|
||||||
{
|
{
|
||||||
|
public event Action<DrawableHitObject<TObject, TJudgement>> OnJudgement;
|
||||||
|
|
||||||
|
public TObject HitObject;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The colour used for various elements of this DrawableHitObject.
|
||||||
|
/// </summary>
|
||||||
|
public virtual Color4 AccentColour { get; set; }
|
||||||
|
|
||||||
public override bool HandleInput => Interactive;
|
public override bool HandleInput => Interactive;
|
||||||
|
|
||||||
public bool Interactive = true;
|
public bool Interactive = true;
|
||||||
|
|
||||||
public TJudgement Judgement;
|
public TJudgement Judgement;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether this hit object has been judged.
|
|
||||||
/// </summary>
|
|
||||||
public virtual bool Judged => (Judgement?.Result ?? HitResult.None) != HitResult.None;
|
|
||||||
|
|
||||||
protected abstract TJudgement CreateJudgement();
|
protected abstract TJudgement CreateJudgement();
|
||||||
|
|
||||||
protected abstract void UpdateState(ArmedState state);
|
protected abstract void UpdateState(ArmedState state);
|
||||||
@ -62,14 +66,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
Samples.ForEach(s => s?.Play());
|
Samples.ForEach(s => s?.Play());
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
//we may be setting a custom judgement in test cases or what not.
|
|
||||||
if (Judgement == null)
|
|
||||||
Judgement = CreateJudgement();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
@ -77,25 +73,11 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
//force application of the state that was set before we loaded.
|
//force application of the state that was set before we loaded.
|
||||||
UpdateState(State);
|
UpdateState(State);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public abstract class DrawableHitObject<TObject, TJudgement> : DrawableHitObject<TJudgement>
|
|
||||||
where TObject : HitObject
|
|
||||||
where TJudgement : Judgement
|
|
||||||
{
|
|
||||||
public event Action<DrawableHitObject<TObject, TJudgement>> OnJudgement;
|
|
||||||
|
|
||||||
public TObject HitObject;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The colour used for various elements of this DrawableHitObject.
|
|
||||||
/// </summary>
|
|
||||||
public virtual Color4 AccentColour { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this hit object and all of its nested hit objects have been judged.
|
/// Whether this hit object and all of its nested hit objects have been judged.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed override bool Judged => base.Judged && (NestedHitObjects?.All(h => h.Judged) ?? true);
|
public bool Judged => (Judgement?.Result ?? HitResult.None) != HitResult.None && (NestedHitObjects?.All(h => h.Judged) ?? true);
|
||||||
|
|
||||||
protected DrawableHitObject(TObject hitObject)
|
protected DrawableHitObject(TObject hitObject)
|
||||||
{
|
{
|
||||||
@ -177,6 +159,10 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
channel.Volume.Value = sample.Volume;
|
channel.Volume.Value = sample.Volume;
|
||||||
Samples.Add(channel);
|
Samples.Add(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//we may be setting a custom judgement in test cases or what not.
|
||||||
|
if (Judgement == null)
|
||||||
|
Judgement = CreateJudgement();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<DrawableHitObject<TObject, TJudgement>> nestedHitObjects;
|
private List<DrawableHitObject<TObject, TJudgement>> nestedHitObjects;
|
||||||
|
@ -79,7 +79,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
var beatmap = query.ElementAt(RNG.Next(0, count - 1));
|
var beatmap = query.ElementAt(RNG.Next(0, count - 1));
|
||||||
beatmaps.GetChildren(beatmap, true);
|
beatmaps.GetChildren(beatmap);
|
||||||
Beatmap = beatmaps.GetWorkingBeatmap(beatmap.Beatmaps[0]);
|
Beatmap = beatmaps.GetWorkingBeatmap(beatmap.Beatmaps[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user