1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 20:47:25 +08:00

Merge remote-tracking branch 'origin/master' into mania-timing-sections

This commit is contained in:
smoogipooo 2017-05-11 21:48:20 +09:00
commit 9477024e7b
9 changed files with 67 additions and 67 deletions

View File

@ -54,33 +54,33 @@ namespace osu.Game.Rulesets.Taiko.UI
{
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
{
RelativeSizeAxes = Axes.X,
Height = DEFAULT_PLAYFIELD_HEIGHT,
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
{
Name = "Transparent playfield elements",

View File

@ -142,7 +142,7 @@ namespace osu.Game.Tests.Beatmaps.IO
Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout),
@"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(),
$@"Incorrect database beatmap count post-import ({resultBeatmaps.Count()} but should be {set.Beatmaps.Count}).");

View File

@ -267,6 +267,9 @@ namespace osu.Game.Database
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null, bool withStoryboard = false)
{
if (beatmapInfo.BeatmapSet == null)
beatmapInfo = GetChildren(beatmapInfo, true);
if (beatmapInfo.BeatmapSet == null)
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database.");

View File

@ -48,11 +48,9 @@ namespace osu.Game.Database
return Connection.Table<T>();
}
public T GetWithChildren<T>(object id, bool recursive = false) where T : class
{
return Connection.GetWithChildren<T>(id, recursive);
}
/// <summary>
/// This is expensive. Use with caution.
/// </summary>
public List<T> GetAllWithChildren<T>(Expression<Func<T, bool>> filter = null, bool recursive = true)
where T : class
{

View File

@ -72,21 +72,28 @@ namespace osu.Game.Online.API
}
}
private static readonly object access_token_retrieval_lock = new object();
/// <summary>
/// Should be run before any API request to make sure we have a valid key.
/// </summary>
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 not, let's try using our refresh token to request a new access token.
if (!string.IsNullOrEmpty(Token?.RefreshToken))
AuthenticateWithRefresh(Token.RefreshToken);
// we want to ensure only a single authentication update is happening at once.
lock (access_token_retrieval_lock)
{
// 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;

View File

@ -41,13 +41,13 @@ namespace osu.Game.Online.API
[JsonProperty(@"refresh_token")]
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)
{
try
{
string[] parts = value.Split('/');
string[] parts = value.Split('|');
return new OAuthToken
{
AccessToken = parts[0],

View File

@ -110,12 +110,18 @@ namespace osu.Game.Overlays
{
MoveToY(0, transition_length, EasingTypes.OutQuint);
FadeIn(transition_length, EasingTypes.OutQuint);
inputTextBox.HoldFocus = true;
base.PopIn();
}
protected override void PopOut()
{
MoveToY(DrawSize.Y, transition_length, EasingTypes.InSine);
FadeOut(transition_length, EasingTypes.InSine);
inputTextBox.HoldFocus = false;
base.PopOut();
}
[BackgroundDependencyLoader]

View File

@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
@ -16,20 +15,25 @@ using System.Linq;
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
{
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 bool Interactive = true;
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 void UpdateState(ArmedState state);
@ -62,14 +66,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
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()
{
base.LoadComplete();
@ -77,25 +73,11 @@ namespace osu.Game.Rulesets.Objects.Drawables
//force application of the state that was set before we loaded.
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>
/// Whether this hit object and all of its nested hit objects have been judged.
/// </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)
{
@ -177,6 +159,10 @@ namespace osu.Game.Rulesets.Objects.Drawables
channel.Volume.Value = sample.Volume;
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;

View File

@ -79,7 +79,7 @@ namespace osu.Game.Screens.Menu
if (count > 0)
{
var beatmap = query.ElementAt(RNG.Next(0, count - 1));
beatmaps.GetChildren(beatmap, true);
beatmaps.GetChildren(beatmap);
Beatmap = beatmaps.GetWorkingBeatmap(beatmap.Beatmaps[0]);
}
}