mirror of
https://github.com/osukey/osukey.git
synced 2025-05-04 21:27:22 +09:00
Merge branch 'master' into realtime-multiplayer-2
This commit is contained in:
commit
c07b2d89e6
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
@ -18,11 +19,8 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
public override void SetUpSteps()
|
public override void SetUpSteps()
|
||||||
{
|
{
|
||||||
base.SetUpSteps();
|
base.SetUpSteps();
|
||||||
AddAssert("has correct samples", () =>
|
|
||||||
{
|
|
||||||
var names = Player.DrawableRuleset.Playfield.AllHitObjects.OfType<DrawableHit>().Select(h => string.Join(',', h.GetSamples().Select(s => s.Name)));
|
|
||||||
|
|
||||||
var expected = new[]
|
var expectedSampleNames = new[]
|
||||||
{
|
{
|
||||||
string.Empty,
|
string.Empty,
|
||||||
string.Empty,
|
string.Empty,
|
||||||
@ -33,9 +31,21 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
HitSampleInfo.HIT_WHISTLE,
|
HitSampleInfo.HIT_WHISTLE,
|
||||||
HitSampleInfo.HIT_WHISTLE,
|
HitSampleInfo.HIT_WHISTLE,
|
||||||
};
|
};
|
||||||
|
var actualSampleNames = new List<string>();
|
||||||
|
|
||||||
return names.SequenceEqual(expected);
|
// due to pooling we can't access all samples right away due to object re-use,
|
||||||
|
// so we need to collect as we go.
|
||||||
|
AddStep("collect sample names", () => Player.DrawableRuleset.Playfield.NewResult += (dho, _) =>
|
||||||
|
{
|
||||||
|
if (!(dho is DrawableHit h))
|
||||||
|
return;
|
||||||
|
|
||||||
|
actualSampleNames.Add(string.Join(',', h.GetSamples().Select(s => s.Name)));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AddUntilStep("all samples collected", () => actualSampleNames.Count == expectedSampleNames.Length);
|
||||||
|
|
||||||
|
AddAssert("samples are correct", () => actualSampleNames.SequenceEqual(expectedSampleNames));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TaikoBeatmapConversionTest().GetBeatmap("sample-to-type-conversions");
|
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TaikoBeatmapConversionTest().GetBeatmap("sample-to-type-conversions");
|
||||||
|
@ -95,7 +95,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
protected override void ClearNestedHitObjects()
|
protected override void ClearNestedHitObjects()
|
||||||
{
|
{
|
||||||
base.ClearNestedHitObjects();
|
base.ClearNestedHitObjects();
|
||||||
tickContainer.Clear();
|
tickContainer.Clear(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override DrawableHitObject CreateNestedHitObject(HitObject hitObject)
|
protected override DrawableHitObject CreateNestedHitObject(HitObject hitObject)
|
||||||
@ -174,7 +174,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
(MainPiece.Drawable as IHasAccentColour)?.FadeAccent(newColour, fadeDuration);
|
(MainPiece.Drawable as IHasAccentColour)?.FadeAccent(newColour, fadeDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class StrongNestedHit : DrawableStrongNestedHit
|
public class StrongNestedHit : DrawableStrongNestedHit
|
||||||
{
|
{
|
||||||
public new DrawableDrumRoll ParentHitObject => (DrawableDrumRoll)base.ParentHitObject;
|
public new DrawableDrumRoll ParentHitObject => (DrawableDrumRoll)base.ParentHitObject;
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
|
|
||||||
protected override DrawableStrongNestedHit CreateStrongNestedHit(DrumRollTick.StrongNestedHit hitObject) => new StrongNestedHit(hitObject);
|
protected override DrawableStrongNestedHit CreateStrongNestedHit(DrumRollTick.StrongNestedHit hitObject) => new StrongNestedHit(hitObject);
|
||||||
|
|
||||||
private class StrongNestedHit : DrawableStrongNestedHit
|
public class StrongNestedHit : DrawableStrongNestedHit
|
||||||
{
|
{
|
||||||
public new DrawableDrumRollTick ParentHitObject => (DrawableDrumRollTick)base.ParentHitObject;
|
public new DrawableDrumRollTick ParentHitObject => (DrawableDrumRollTick)base.ParentHitObject;
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
|
|
||||||
protected override DrawableStrongNestedHit CreateStrongNestedHit(Hit.StrongNestedHit hitObject) => new StrongNestedHit(hitObject);
|
protected override DrawableStrongNestedHit CreateStrongNestedHit(Hit.StrongNestedHit hitObject) => new StrongNestedHit(hitObject);
|
||||||
|
|
||||||
private class StrongNestedHit : DrawableStrongNestedHit
|
public class StrongNestedHit : DrawableStrongNestedHit
|
||||||
{
|
{
|
||||||
public new DrawableHit ParentHitObject => (DrawableHit)base.ParentHitObject;
|
public new DrawableHit ParentHitObject => (DrawableHit)base.ParentHitObject;
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
protected override void ClearNestedHitObjects()
|
protected override void ClearNestedHitObjects()
|
||||||
{
|
{
|
||||||
base.ClearNestedHitObjects();
|
base.ClearNestedHitObjects();
|
||||||
ticks.Clear();
|
ticks.Clear(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override DrawableHitObject CreateNestedHitObject(HitObject hitObject)
|
protected override DrawableHitObject CreateNestedHitObject(HitObject hitObject)
|
||||||
|
@ -96,7 +96,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
protected override void ClearNestedHitObjects()
|
protected override void ClearNestedHitObjects()
|
||||||
{
|
{
|
||||||
base.ClearNestedHitObjects();
|
base.ClearNestedHitObjects();
|
||||||
strongHitContainer.Clear();
|
strongHitContainer.Clear(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override DrawableHitObject CreateNestedHitObject(HitObject hitObject)
|
protected override DrawableHitObject CreateNestedHitObject(HitObject hitObject)
|
||||||
|
@ -7,7 +7,6 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Taiko.Objects;
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Rulesets.Taiko.Replays;
|
using osu.Game.Rulesets.Taiko.Replays;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
@ -64,22 +63,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
|
|
||||||
protected override Playfield CreatePlayfield() => new TaikoPlayfield(Beatmap.ControlPointInfo);
|
protected override Playfield CreatePlayfield() => new TaikoPlayfield(Beatmap.ControlPointInfo);
|
||||||
|
|
||||||
public override DrawableHitObject<TaikoHitObject> CreateDrawableRepresentation(TaikoHitObject h)
|
public override DrawableHitObject<TaikoHitObject> CreateDrawableRepresentation(TaikoHitObject h) => null;
|
||||||
{
|
|
||||||
switch (h)
|
|
||||||
{
|
|
||||||
case Hit hit:
|
|
||||||
return new DrawableHit(hit);
|
|
||||||
|
|
||||||
case DrumRoll drumRoll:
|
|
||||||
return new DrawableDrumRoll(drumRoll);
|
|
||||||
|
|
||||||
case Swell swell:
|
|
||||||
return new DrawableSwell(swell);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override ReplayInputHandler CreateReplayInputHandler(Replay replay) => new TaikoFramedReplayInputHandler(replay);
|
protected override ReplayInputHandler CreateReplayInputHandler(Replay replay) => new TaikoFramedReplayInputHandler(replay);
|
||||||
|
|
||||||
|
@ -147,6 +147,32 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
},
|
},
|
||||||
drumRollHitContainer.CreateProxy(),
|
drumRollHitContainer.CreateProxy(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
RegisterPool<Hit, DrawableHit>(50);
|
||||||
|
RegisterPool<Hit.StrongNestedHit, DrawableHit.StrongNestedHit>(50);
|
||||||
|
|
||||||
|
RegisterPool<DrumRoll, DrawableDrumRoll>(5);
|
||||||
|
RegisterPool<DrumRoll.StrongNestedHit, DrawableDrumRoll.StrongNestedHit>(5);
|
||||||
|
|
||||||
|
RegisterPool<DrumRollTick, DrawableDrumRollTick>(100);
|
||||||
|
RegisterPool<DrumRollTick.StrongNestedHit, DrawableDrumRollTick.StrongNestedHit>(100);
|
||||||
|
|
||||||
|
RegisterPool<Swell, DrawableSwell>(5);
|
||||||
|
RegisterPool<SwellTick, DrawableSwellTick>(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
NewResult += OnNewResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnNewDrawableHitObject(DrawableHitObject drawableHitObject)
|
||||||
|
{
|
||||||
|
base.OnNewDrawableHitObject(drawableHitObject);
|
||||||
|
|
||||||
|
var taikoObject = (DrawableTaikoHitObject)drawableHitObject;
|
||||||
|
topLevelHitContainer.Add(taikoObject.CreateProxiedContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
@ -207,9 +233,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
barLinePlayfield.Add(barLine);
|
barLinePlayfield.Add(barLine);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DrawableTaikoHitObject taikoObject:
|
case DrawableTaikoHitObject _:
|
||||||
h.OnNewResult += OnNewResult;
|
|
||||||
topLevelHitContainer.Add(taikoObject.CreateProxiedContent());
|
|
||||||
base.Add(h);
|
base.Add(h);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -226,8 +250,6 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
return barLinePlayfield.Remove(barLine);
|
return barLinePlayfield.Remove(barLine);
|
||||||
|
|
||||||
case DrawableTaikoHitObject _:
|
case DrawableTaikoHitObject _:
|
||||||
h.OnNewResult -= OnNewResult;
|
|
||||||
// todo: consider tidying of proxied content if required.
|
|
||||||
return base.Remove(h);
|
return base.Remove(h);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -77,15 +77,8 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
public readonly BindableList<User> RecentParticipants = new BindableList<User>();
|
public readonly BindableList<User> RecentParticipants = new BindableList<User>();
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
public readonly Bindable<int> ParticipantCount = new Bindable<int>();
|
|
||||||
|
|
||||||
// todo: TEMPORARY
|
|
||||||
[JsonProperty("participant_count")]
|
[JsonProperty("participant_count")]
|
||||||
private int? participantCount
|
public readonly Bindable<int> ParticipantCount = new Bindable<int>();
|
||||||
{
|
|
||||||
get => ParticipantCount.Value;
|
|
||||||
set => ParticipantCount.Value = value ?? 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonProperty("duration")]
|
[JsonProperty("duration")]
|
||||||
private int? duration
|
private int? duration
|
||||||
@ -149,7 +142,7 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
ParticipantCount.Value = other.ParticipantCount.Value;
|
ParticipantCount.Value = other.ParticipantCount.Value;
|
||||||
EndDate.Value = other.EndDate.Value;
|
EndDate.Value = other.EndDate.Value;
|
||||||
|
|
||||||
if (DateTimeOffset.Now >= EndDate.Value)
|
if (EndDate.Value != null && DateTimeOffset.Now >= EndDate.Value)
|
||||||
Status.Value = new RoomStatusEnded();
|
Status.Value = new RoomStatusEnded();
|
||||||
|
|
||||||
if (!Playlist.SequenceEqual(other.Playlist))
|
if (!Playlist.SequenceEqual(other.Playlist))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user