mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 13:32:54 +08:00
Merge branch 'master' into news
This commit is contained in:
commit
ab97645bc0
@ -51,7 +51,7 @@
|
||||
<Reference Include="Java.Interop" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.715.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.727.1" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.723.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -4,62 +4,109 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Pooling;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
public class TestSceneDrawableJudgement : OsuSkinnableTestScene
|
||||
{
|
||||
[Resolved]
|
||||
private OsuConfigManager config { get; set; }
|
||||
|
||||
private readonly List<DrawablePool<TestDrawableOsuJudgement>> pools;
|
||||
|
||||
public TestSceneDrawableJudgement()
|
||||
{
|
||||
var pools = new List<DrawablePool<DrawableOsuJudgement>>();
|
||||
pools = new List<DrawablePool<TestDrawableOsuJudgement>>();
|
||||
|
||||
foreach (HitResult result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Skip(1))
|
||||
showResult(result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHitLightingDisabled()
|
||||
{
|
||||
AddStep("hit lighting disabled", () => config.Set(OsuSetting.HitLighting, false));
|
||||
|
||||
showResult(HitResult.Great);
|
||||
|
||||
AddUntilStep("judgements shown", () => this.ChildrenOfType<TestDrawableOsuJudgement>().Any());
|
||||
AddAssert("judgement body immediately visible",
|
||||
() => this.ChildrenOfType<TestDrawableOsuJudgement>().All(judgement => judgement.JudgementBody.Alpha == 1));
|
||||
AddAssert("hit lighting hidden",
|
||||
() => this.ChildrenOfType<TestDrawableOsuJudgement>().All(judgement => judgement.Lighting.Alpha == 0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHitLightingEnabled()
|
||||
{
|
||||
AddStep("hit lighting enabled", () => config.Set(OsuSetting.HitLighting, true));
|
||||
|
||||
showResult(HitResult.Great);
|
||||
|
||||
AddUntilStep("judgements shown", () => this.ChildrenOfType<TestDrawableOsuJudgement>().Any());
|
||||
AddAssert("judgement body not immediately visible",
|
||||
() => this.ChildrenOfType<TestDrawableOsuJudgement>().All(judgement => judgement.JudgementBody.Alpha > 0 && judgement.JudgementBody.Alpha < 1));
|
||||
AddAssert("hit lighting shown",
|
||||
() => this.ChildrenOfType<TestDrawableOsuJudgement>().All(judgement => judgement.Lighting.Alpha > 0));
|
||||
}
|
||||
|
||||
private void showResult(HitResult result)
|
||||
{
|
||||
AddStep("Show " + result.GetDescription(), () =>
|
||||
{
|
||||
AddStep("Show " + result.GetDescription(), () =>
|
||||
int poolIndex = 0;
|
||||
|
||||
SetContents(() =>
|
||||
{
|
||||
int poolIndex = 0;
|
||||
DrawablePool<TestDrawableOsuJudgement> pool;
|
||||
|
||||
SetContents(() =>
|
||||
if (poolIndex >= pools.Count)
|
||||
pools.Add(pool = new DrawablePool<TestDrawableOsuJudgement>(1));
|
||||
else
|
||||
{
|
||||
DrawablePool<DrawableOsuJudgement> pool;
|
||||
pool = pools[poolIndex];
|
||||
|
||||
if (poolIndex >= pools.Count)
|
||||
pools.Add(pool = new DrawablePool<DrawableOsuJudgement>(1));
|
||||
else
|
||||
// We need to make sure neither the pool nor the judgement get disposed when new content is set, and they both share the same parent.
|
||||
((Container)pool.Parent).Clear(false);
|
||||
}
|
||||
|
||||
var container = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
pool = pools[poolIndex];
|
||||
|
||||
// We need to make sure neither the pool nor the judgement get disposed when new content is set, and they both share the same parent.
|
||||
((Container)pool.Parent).Clear(false);
|
||||
}
|
||||
|
||||
var container = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
pool,
|
||||
pool.Get(j => j.Apply(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null)).With(j =>
|
||||
{
|
||||
pool,
|
||||
pool.Get(j => j.Apply(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null)).With(j =>
|
||||
{
|
||||
j.Anchor = Anchor.Centre;
|
||||
j.Origin = Anchor.Centre;
|
||||
})
|
||||
}
|
||||
};
|
||||
j.Anchor = Anchor.Centre;
|
||||
j.Origin = Anchor.Centre;
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
poolIndex++;
|
||||
return container;
|
||||
});
|
||||
poolIndex++;
|
||||
return container;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private class TestDrawableOsuJudgement : DrawableOsuJudgement
|
||||
{
|
||||
public new SkinnableSprite Lighting => base.Lighting;
|
||||
public new Container JudgementBody => base.JudgementBody;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
// multipled by 2 to nullify the score multiplier. (autoplay mod selected)
|
||||
var totalScore = ((ScoreExposedPlayer)Player).ScoreProcessor.TotalScore.Value * 2;
|
||||
return totalScore == (int)(drawableSpinner.Disc.CumulativeRotation / 360) * 100;
|
||||
return totalScore == (int)(drawableSpinner.Disc.CumulativeRotation / 360) * SpinnerTick.SCORE_PER_TICK;
|
||||
});
|
||||
|
||||
addSeekStep(0);
|
||||
|
@ -16,9 +16,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
public class DrawableOsuJudgement : DrawableJudgement
|
||||
{
|
||||
private SkinnableSprite lighting;
|
||||
protected SkinnableSprite Lighting;
|
||||
|
||||
private Bindable<Color4> lightingColour;
|
||||
|
||||
[Resolved]
|
||||
private OsuConfigManager config { get; set; }
|
||||
|
||||
public DrawableOsuJudgement(JudgementResult result, DrawableHitObject judgedObject)
|
||||
: base(result, judgedObject)
|
||||
{
|
||||
@ -29,18 +33,16 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
private void load()
|
||||
{
|
||||
if (config.Get<bool>(OsuSetting.HitLighting))
|
||||
AddInternal(Lighting = new SkinnableSprite("lighting")
|
||||
{
|
||||
AddInternal(lighting = new SkinnableSprite("lighting")
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Blending = BlendingParameters.Additive,
|
||||
Depth = float.MaxValue
|
||||
});
|
||||
}
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Blending = BlendingParameters.Additive,
|
||||
Depth = float.MaxValue,
|
||||
Alpha = 0
|
||||
});
|
||||
}
|
||||
|
||||
public override void Apply(JudgementResult result, DrawableHitObject judgedObject)
|
||||
@ -60,33 +62,39 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
|
||||
lightingColour?.UnbindAll();
|
||||
|
||||
if (lighting != null)
|
||||
{
|
||||
lighting.ResetAnimation();
|
||||
Lighting.ResetAnimation();
|
||||
|
||||
if (JudgedObject != null)
|
||||
{
|
||||
lightingColour = JudgedObject.AccentColour.GetBoundCopy();
|
||||
lightingColour.BindValueChanged(colour => lighting.Colour = Result.Type == HitResult.Miss ? Color4.Transparent : colour.NewValue, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
lighting.Colour = Color4.White;
|
||||
}
|
||||
if (JudgedObject != null)
|
||||
{
|
||||
lightingColour = JudgedObject.AccentColour.GetBoundCopy();
|
||||
lightingColour.BindValueChanged(colour => Lighting.Colour = Result.Type == HitResult.Miss ? Color4.Transparent : colour.NewValue, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Lighting.Colour = Color4.White;
|
||||
}
|
||||
}
|
||||
|
||||
protected override double FadeOutDelay => lighting == null ? base.FadeOutDelay : 1400;
|
||||
private double fadeOutDelay;
|
||||
protected override double FadeOutDelay => fadeOutDelay;
|
||||
|
||||
protected override void ApplyHitAnimations()
|
||||
{
|
||||
if (lighting != null)
|
||||
bool hitLightingEnabled = config.Get<bool>(OsuSetting.HitLighting);
|
||||
|
||||
if (hitLightingEnabled)
|
||||
{
|
||||
JudgementBody.FadeIn().Delay(FadeInDuration).FadeOut(400);
|
||||
|
||||
lighting.ScaleTo(0.8f).ScaleTo(1.2f, 600, Easing.Out);
|
||||
lighting.FadeIn(200).Then().Delay(200).FadeOut(1000);
|
||||
Lighting.ScaleTo(0.8f).ScaleTo(1.2f, 600, Easing.Out);
|
||||
Lighting.FadeIn(200).Then().Delay(200).FadeOut(1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
JudgementBody.Alpha = 1;
|
||||
}
|
||||
|
||||
fadeOutDelay = hitLightingEnabled ? 1400 : base.FadeOutDelay;
|
||||
|
||||
JudgementText?.TransformSpacingTo(Vector2.Zero).Then().TransformSpacingTo(new Vector2(14, 0), 1800, Easing.OutQuint);
|
||||
base.ApplyHitAnimations();
|
||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
return;
|
||||
|
||||
displayedCount = count;
|
||||
bonusCounter.Text = $"{1000 * count}";
|
||||
bonusCounter.Text = $"{SpinnerBonusTick.SCORE_PER_TICK * count}";
|
||||
bonusCounter.FadeOutFromOne(1500);
|
||||
bonusCounter.ScaleTo(1.5f).Then().ScaleTo(1f, 1000, Easing.OutQuint);
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
{
|
||||
public class SpinnerBonusTick : SpinnerTick
|
||||
{
|
||||
public new const int SCORE_PER_TICK = 50;
|
||||
|
||||
public SpinnerBonusTick()
|
||||
{
|
||||
Samples.Add(new HitSampleInfo { Name = "spinnerbonus" });
|
||||
@ -18,7 +20,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
|
||||
public class OsuSpinnerBonusTickJudgement : OsuSpinnerTickJudgement
|
||||
{
|
||||
protected override int NumericResultFor(HitResult result) => 1100;
|
||||
protected override int NumericResultFor(HitResult result) => SCORE_PER_TICK;
|
||||
|
||||
protected override double HealthIncreaseFor(HitResult result) => base.HealthIncreaseFor(result) * 2;
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
{
|
||||
public class SpinnerTick : OsuHitObject
|
||||
{
|
||||
public const int SCORE_PER_TICK = 10;
|
||||
|
||||
public override Judgement CreateJudgement() => new OsuSpinnerTickJudgement();
|
||||
|
||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
||||
@ -17,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
{
|
||||
public override bool AffectsCombo => false;
|
||||
|
||||
protected override int NumericResultFor(HitResult result) => 100;
|
||||
protected override int NumericResultFor(HitResult result) => SCORE_PER_TICK;
|
||||
|
||||
protected override double HealthIncreaseFor(HitResult result) => result == MaxResult ? 0.6 * base.HealthIncreaseFor(result) : 0;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
||||
|
||||
case OsuSkinComponents.HitCircleText:
|
||||
var font = GetConfig<OsuSkinConfiguration, string>(OsuSkinConfiguration.HitCirclePrefix)?.Value ?? "default";
|
||||
var overlap = GetConfig<OsuSkinConfiguration, float>(OsuSkinConfiguration.HitCircleOverlap)?.Value ?? 0;
|
||||
var overlap = GetConfig<OsuSkinConfiguration, float>(OsuSkinConfiguration.HitCircleOverlap)?.Value ?? -2;
|
||||
|
||||
return !hasFont(font)
|
||||
? null
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 8.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
After Width: | Height: | Size: 9.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
@ -8,6 +8,7 @@ using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Animations;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
@ -36,6 +37,10 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
||||
private TaikoScoreProcessor scoreProcessor;
|
||||
|
||||
private IEnumerable<DrawableTaikoMascot> mascots => this.ChildrenOfType<DrawableTaikoMascot>();
|
||||
|
||||
private IEnumerable<DrawableTaikoMascot> animatedMascots =>
|
||||
mascots.Where(mascot => mascot.ChildrenOfType<TextureAnimation>().All(animation => animation.FrameCount > 0));
|
||||
|
||||
private IEnumerable<TaikoPlayfield> playfields => this.ChildrenOfType<TaikoPlayfield>();
|
||||
|
||||
[SetUp]
|
||||
@ -72,11 +77,11 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
||||
|
||||
AddStep("set clear state", () => mascots.ForEach(mascot => mascot.State.Value = TaikoMascotAnimationState.Clear));
|
||||
AddStep("miss", () => mascots.ForEach(mascot => mascot.LastResult.Value = new JudgementResult(new Hit(), new TaikoJudgement()) { Type = HitResult.Miss }));
|
||||
AddAssert("skins with animations remain in clear state", () => someMascotsIn(TaikoMascotAnimationState.Clear));
|
||||
AddAssert("skins with animations remain in clear state", () => animatedMascotsIn(TaikoMascotAnimationState.Clear));
|
||||
AddUntilStep("state reverts to fail", () => allMascotsIn(TaikoMascotAnimationState.Fail));
|
||||
|
||||
AddStep("set clear state again", () => mascots.ForEach(mascot => mascot.State.Value = TaikoMascotAnimationState.Clear));
|
||||
AddAssert("skins with animations change to clear", () => someMascotsIn(TaikoMascotAnimationState.Clear));
|
||||
AddAssert("skins with animations change to clear", () => animatedMascotsIn(TaikoMascotAnimationState.Clear));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -186,10 +191,18 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
||||
|
||||
private void assertStateAfterResult(JudgementResult judgementResult, TaikoMascotAnimationState expectedState)
|
||||
{
|
||||
AddStep($"{judgementResult.Type.ToString().ToLower()} result for {judgementResult.Judgement.GetType().Name.Humanize(LetterCasing.LowerCase)}",
|
||||
() => applyNewResult(judgementResult));
|
||||
TaikoMascotAnimationState[] mascotStates = null;
|
||||
|
||||
AddAssert($"state is {expectedState.ToString().ToLower()}", () => allMascotsIn(expectedState));
|
||||
AddStep($"{judgementResult.Type.ToString().ToLower()} result for {judgementResult.Judgement.GetType().Name.Humanize(LetterCasing.LowerCase)}",
|
||||
() =>
|
||||
{
|
||||
applyNewResult(judgementResult);
|
||||
// store the states as soon as possible, so that the delay between steps doesn't incorrectly fail the test
|
||||
// due to not checking if the state changed quickly enough.
|
||||
Schedule(() => mascotStates = animatedMascots.Select(mascot => mascot.State.Value).ToArray());
|
||||
});
|
||||
|
||||
AddAssert($"state is {expectedState.ToString().ToLower()}", () => mascotStates.All(state => state == expectedState));
|
||||
}
|
||||
|
||||
private void applyNewResult(JudgementResult judgementResult)
|
||||
@ -211,6 +224,6 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
||||
}
|
||||
|
||||
private bool allMascotsIn(TaikoMascotAnimationState state) => mascots.All(d => d.State.Value == state);
|
||||
private bool someMascotsIn(TaikoMascotAnimationState state) => mascots.Any(d => d.State.Value == state);
|
||||
private bool animatedMascotsIn(TaikoMascotAnimationState state) => animatedMascots.Any(d => d.State.Value == state);
|
||||
}
|
||||
}
|
||||
|
64
osu.Game.Rulesets.Taiko/Audio/DrumSampleContainer.cs
Normal file
64
osu.Game.Rulesets.Taiko/Audio/DrumSampleContainer.cs
Normal file
@ -0,0 +1,64 @@
|
||||
// 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.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Audio
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores samples for the input drum.
|
||||
/// The lifetime of the samples is adjusted so that they are only alive during the appropriate sample control point.
|
||||
/// </summary>
|
||||
public class DrumSampleContainer : LifetimeManagementContainer
|
||||
{
|
||||
private readonly ControlPointInfo controlPoints;
|
||||
private readonly Dictionary<double, DrumSample> mappings = new Dictionary<double, DrumSample>();
|
||||
|
||||
public DrumSampleContainer(ControlPointInfo controlPoints)
|
||||
{
|
||||
this.controlPoints = controlPoints;
|
||||
|
||||
IReadOnlyList<SampleControlPoint> samplePoints = controlPoints.SamplePoints.Count == 0 ? new[] { controlPoints.SamplePointAt(double.MinValue) } : controlPoints.SamplePoints;
|
||||
|
||||
for (int i = 0; i < samplePoints.Count; i++)
|
||||
{
|
||||
var samplePoint = samplePoints[i];
|
||||
|
||||
var centre = samplePoint.GetSampleInfo();
|
||||
var rim = samplePoint.GetSampleInfo(HitSampleInfo.HIT_CLAP);
|
||||
|
||||
var lifetimeStart = i > 0 ? samplePoint.Time : double.MinValue;
|
||||
var lifetimeEnd = i + 1 < samplePoints.Count ? samplePoints[i + 1].Time : double.MaxValue;
|
||||
|
||||
mappings[samplePoint.Time] = new DrumSample
|
||||
{
|
||||
Centre = addSound(centre, lifetimeStart, lifetimeEnd),
|
||||
Rim = addSound(rim, lifetimeStart, lifetimeEnd)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private SkinnableSound addSound(HitSampleInfo hitSampleInfo, double lifetimeStart, double lifetimeEnd)
|
||||
{
|
||||
var drawable = new SkinnableSound(hitSampleInfo)
|
||||
{
|
||||
LifetimeStart = lifetimeStart,
|
||||
LifetimeEnd = lifetimeEnd
|
||||
};
|
||||
AddInternal(drawable);
|
||||
return drawable;
|
||||
}
|
||||
|
||||
public DrumSample SampleAt(double time) => mappings[controlPoints.SamplePointAt(time).Time];
|
||||
|
||||
public class DrumSample
|
||||
{
|
||||
public SkinnableSound Centre;
|
||||
public SkinnableSound Rim;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
// 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.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Audio
|
||||
{
|
||||
public class DrumSampleMapping
|
||||
{
|
||||
private readonly ControlPointInfo controlPoints;
|
||||
private readonly Dictionary<double, DrumSample> mappings = new Dictionary<double, DrumSample>();
|
||||
|
||||
public readonly List<SkinnableSound> Sounds = new List<SkinnableSound>();
|
||||
|
||||
public DrumSampleMapping(ControlPointInfo controlPoints)
|
||||
{
|
||||
this.controlPoints = controlPoints;
|
||||
|
||||
IEnumerable<SampleControlPoint> samplePoints = controlPoints.SamplePoints.Count == 0 ? new[] { controlPoints.SamplePointAt(double.MinValue) } : controlPoints.SamplePoints;
|
||||
|
||||
foreach (var s in samplePoints)
|
||||
{
|
||||
var centre = s.GetSampleInfo();
|
||||
var rim = s.GetSampleInfo(HitSampleInfo.HIT_CLAP);
|
||||
|
||||
mappings[s.Time] = new DrumSample
|
||||
{
|
||||
Centre = addSound(centre),
|
||||
Rim = addSound(rim)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private SkinnableSound addSound(HitSampleInfo hitSampleInfo)
|
||||
{
|
||||
var drawable = new SkinnableSound(hitSampleInfo);
|
||||
Sounds.Add(drawable);
|
||||
return drawable;
|
||||
}
|
||||
|
||||
public DrumSample SampleAt(double time) => mappings[controlPoints.SamplePointAt(time).Time];
|
||||
|
||||
public class DrumSample
|
||||
{
|
||||
public SkinnableSound Centre;
|
||||
public SkinnableSound Rim;
|
||||
}
|
||||
}
|
||||
}
|
@ -111,7 +111,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
||||
public readonly Sprite Centre;
|
||||
|
||||
[Resolved]
|
||||
private DrumSampleMapping sampleMappings { get; set; }
|
||||
private DrumSampleContainer sampleContainer { get; set; }
|
||||
|
||||
public LegacyHalfDrum(bool flipped)
|
||||
{
|
||||
@ -143,7 +143,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
||||
public bool OnPressed(TaikoAction action)
|
||||
{
|
||||
Drawable target = null;
|
||||
var drumSample = sampleMappings.SampleAt(Time.Current);
|
||||
var drumSample = sampleContainer.SampleAt(Time.Current);
|
||||
|
||||
if (action == CentreAction)
|
||||
{
|
||||
|
@ -91,10 +91,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
||||
return null;
|
||||
|
||||
case TaikoSkinComponents.Mascot:
|
||||
if (GetTexture("pippidonclear0") != null)
|
||||
return new DrawableTaikoMascot();
|
||||
|
||||
return null;
|
||||
return new DrawableTaikoMascot();
|
||||
}
|
||||
|
||||
return Source.GetDrawableComponent(component);
|
||||
|
@ -25,11 +25,11 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
private const float middle_split = 0.025f;
|
||||
|
||||
[Cached]
|
||||
private DrumSampleMapping sampleMapping;
|
||||
private DrumSampleContainer sampleContainer;
|
||||
|
||||
public InputDrum(ControlPointInfo controlPoints)
|
||||
{
|
||||
sampleMapping = new DrumSampleMapping(controlPoints);
|
||||
sampleContainer = new DrumSampleContainer(controlPoints);
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
@ -37,39 +37,41 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Child = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.InputDrum), _ => new Container
|
||||
Children = new Drawable[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
FillMode = FillMode.Fit,
|
||||
Scale = new Vector2(0.9f),
|
||||
Children = new Drawable[]
|
||||
new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.InputDrum), _ => new Container
|
||||
{
|
||||
new TaikoHalfDrum(false)
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
FillMode = FillMode.Fit,
|
||||
Scale = new Vector2(0.9f),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Name = "Left Half",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreRight,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
RelativePositionAxes = Axes.X,
|
||||
X = -middle_split / 2,
|
||||
RimAction = TaikoAction.LeftRim,
|
||||
CentreAction = TaikoAction.LeftCentre
|
||||
},
|
||||
new TaikoHalfDrum(true)
|
||||
{
|
||||
Name = "Right Half",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreLeft,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
RelativePositionAxes = Axes.X,
|
||||
X = middle_split / 2,
|
||||
RimAction = TaikoAction.RightRim,
|
||||
CentreAction = TaikoAction.RightCentre
|
||||
new TaikoHalfDrum(false)
|
||||
{
|
||||
Name = "Left Half",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreRight,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
RelativePositionAxes = Axes.X,
|
||||
X = -middle_split / 2,
|
||||
RimAction = TaikoAction.LeftRim,
|
||||
CentreAction = TaikoAction.LeftCentre
|
||||
},
|
||||
new TaikoHalfDrum(true)
|
||||
{
|
||||
Name = "Right Half",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreLeft,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
RelativePositionAxes = Axes.X,
|
||||
X = middle_split / 2,
|
||||
RimAction = TaikoAction.RightRim,
|
||||
CentreAction = TaikoAction.RightCentre
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
AddRangeInternal(sampleMapping.Sounds);
|
||||
}),
|
||||
sampleContainer
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -93,7 +95,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
private readonly Sprite centreHit;
|
||||
|
||||
[Resolved]
|
||||
private DrumSampleMapping sampleMappings { get; set; }
|
||||
private DrumSampleContainer sampleContainer { get; set; }
|
||||
|
||||
public TaikoHalfDrum(bool flipped)
|
||||
{
|
||||
@ -154,7 +156,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
Drawable target = null;
|
||||
Drawable back = null;
|
||||
|
||||
var drumSample = sampleMappings.SampleAt(Time.Current);
|
||||
var drumSample = sampleContainer.SampleAt(Time.Current);
|
||||
|
||||
if (action == CentreAction)
|
||||
{
|
||||
|
@ -128,6 +128,13 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
}
|
||||
|
||||
private static Texture getAnimationFrame(ISkin skin, TaikoMascotAnimationState state, int frameIndex)
|
||||
=> skin.GetTexture($"pippidon{state.ToString().ToLower()}{frameIndex}");
|
||||
{
|
||||
var texture = skin.GetTexture($"pippidon{state.ToString().ToLower()}{frameIndex}");
|
||||
|
||||
if (frameIndex == 0 && texture == null)
|
||||
texture = skin.GetTexture($"pippidon{state.ToString().ToLower()}");
|
||||
|
||||
return texture;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
@ -221,6 +222,31 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
confirmExited();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPauseSoundLoop()
|
||||
{
|
||||
AddStep("seek before gameplay", () => Player.GameplayClockContainer.Seek(-5000));
|
||||
|
||||
SkinnableSound getLoop() => Player.ChildrenOfType<PauseOverlay>().FirstOrDefault()?.ChildrenOfType<SkinnableSound>().FirstOrDefault();
|
||||
|
||||
pauseAndConfirm();
|
||||
AddAssert("loop is playing", () => getLoop().IsPlaying);
|
||||
|
||||
resumeAndConfirm();
|
||||
AddUntilStep("loop is stopped", () => !getLoop().IsPlaying);
|
||||
|
||||
AddUntilStep("pause again", () =>
|
||||
{
|
||||
Player.Pause();
|
||||
return !Player.GameplayClockContainer.GameplayClock.IsRunning;
|
||||
});
|
||||
|
||||
AddAssert("loop is playing", () => getLoop().IsPlaying);
|
||||
|
||||
resumeAndConfirm();
|
||||
AddUntilStep("loop is stopped", () => !getLoop().IsPlaying);
|
||||
}
|
||||
|
||||
private void pauseAndConfirm()
|
||||
{
|
||||
pause();
|
||||
|
@ -11,14 +11,14 @@ using osu.Game.Graphics.Sprites;
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestSceneHueAnimation : OsuTestScene
|
||||
public class TestSceneLogoAnimation : OsuTestScene
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(LargeTextureStore textures)
|
||||
{
|
||||
HueAnimation anim2;
|
||||
LogoAnimation anim2;
|
||||
|
||||
Add(anim2 = new HueAnimation
|
||||
Add(anim2 = new LogoAnimation
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
FillMode = FillMode.Fit,
|
||||
@ -26,9 +26,9 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
Colour = Colour4.White,
|
||||
});
|
||||
|
||||
HueAnimation anim;
|
||||
LogoAnimation anim;
|
||||
|
||||
Add(anim = new HueAnimation
|
||||
Add(anim = new LogoAnimation
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
FillMode = FillMode.Fit,
|
@ -11,13 +11,13 @@ using osu.Framework.Graphics.Textures;
|
||||
|
||||
namespace osu.Game.Graphics.Sprites
|
||||
{
|
||||
public class HueAnimation : Sprite
|
||||
public class LogoAnimation : Sprite
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ShaderManager shaders, TextureStore textures)
|
||||
{
|
||||
TextureShader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"HueAnimation");
|
||||
RoundedTextureShader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"HueAnimation"); // Masking isn't supported for now
|
||||
TextureShader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"LogoAnimation");
|
||||
RoundedTextureShader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"LogoAnimation"); // Masking isn't supported for now
|
||||
}
|
||||
|
||||
private float animationProgress;
|
||||
@ -36,15 +36,15 @@ namespace osu.Game.Graphics.Sprites
|
||||
|
||||
public override bool IsPresent => true;
|
||||
|
||||
protected override DrawNode CreateDrawNode() => new HueAnimationDrawNode(this);
|
||||
protected override DrawNode CreateDrawNode() => new LogoAnimationDrawNode(this);
|
||||
|
||||
private class HueAnimationDrawNode : SpriteDrawNode
|
||||
private class LogoAnimationDrawNode : SpriteDrawNode
|
||||
{
|
||||
private HueAnimation source => (HueAnimation)Source;
|
||||
private LogoAnimation source => (LogoAnimation)Source;
|
||||
|
||||
private float progress;
|
||||
|
||||
public HueAnimationDrawNode(HueAnimation source)
|
||||
public LogoAnimationDrawNode(LogoAnimation source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
@ -130,7 +130,11 @@ namespace osu.Game.Rulesets.Judgements
|
||||
if (type == currentDrawableType)
|
||||
return;
|
||||
|
||||
InternalChild = JudgementBody = new Container
|
||||
// sub-classes might have added their own children that would be removed here if .InternalChild was used.
|
||||
if (JudgementBody != null)
|
||||
RemoveInternal(JudgementBody);
|
||||
|
||||
AddInternal(JudgementBody = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -142,7 +146,7 @@ namespace osu.Game.Rulesets.Judgements
|
||||
Colour = colours.ForHitResult(type),
|
||||
Scale = new Vector2(0.85f, 1),
|
||||
}, confineMode: ConfineMode.NoScaling)
|
||||
};
|
||||
});
|
||||
|
||||
currentDrawableType = type;
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private class LazerLogo : CompositeDrawable
|
||||
{
|
||||
private HueAnimation highlight, background;
|
||||
private LogoAnimation highlight, background;
|
||||
|
||||
public float Progress
|
||||
{
|
||||
@ -282,13 +282,13 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
highlight = new HueAnimation
|
||||
highlight = new LogoAnimation
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Texture = textures.Get(@"Intro/Triangles/logo-highlight"),
|
||||
Colour = Color4.White,
|
||||
},
|
||||
background = new HueAnimation
|
||||
background = new LogoAnimation
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Texture = textures.Get(@"Intro/Triangles/logo-background"),
|
||||
|
@ -24,7 +24,8 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
public abstract class GameplayMenuOverlay : OverlayContainer, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
private const int transition_duration = 200;
|
||||
protected const int TRANSITION_DURATION = 200;
|
||||
|
||||
private const int button_height = 70;
|
||||
private const float background_alpha = 0.75f;
|
||||
|
||||
@ -156,8 +157,8 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
}
|
||||
|
||||
protected override void PopIn() => this.FadeIn(transition_duration, Easing.In);
|
||||
protected override void PopOut() => this.FadeOut(transition_duration, Easing.In);
|
||||
protected override void PopIn() => this.FadeIn(TRANSITION_DURATION, Easing.In);
|
||||
protected override void PopOut() => this.FadeOut(TRANSITION_DURATION, Easing.In);
|
||||
|
||||
// Don't let mouse down events through the overlay or people can click circles while paused.
|
||||
protected override bool OnMouseDown(MouseDownEvent e) => true;
|
||||
|
@ -4,7 +4,10 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
@ -13,17 +16,46 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
public Action OnResume;
|
||||
|
||||
public override bool IsPresent => base.IsPresent || pauseLoop.IsPlaying;
|
||||
|
||||
public override string Header => "paused";
|
||||
public override string Description => "you're not going to do what i think you're going to do, are ya?";
|
||||
|
||||
private SkinnableSound pauseLoop;
|
||||
|
||||
protected override Action BackAction => () => InternalButtons.Children.First().Click();
|
||||
|
||||
private const float minimum_volume = 0.0001f;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
AddButton("Continue", colours.Green, () => OnResume?.Invoke());
|
||||
AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke());
|
||||
AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke());
|
||||
|
||||
AddInternal(pauseLoop = new SkinnableSound(new SampleInfo("pause-loop"))
|
||||
{
|
||||
Looping = true,
|
||||
});
|
||||
|
||||
// SkinnableSound only plays a sound if its aggregate volume is > 0, so the volume must be turned up before playing it
|
||||
pauseLoop.VolumeTo(minimum_volume);
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
base.PopIn();
|
||||
|
||||
pauseLoop.VolumeTo(1.0f, TRANSITION_DURATION, Easing.InQuint);
|
||||
pauseLoop.Play();
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
|
||||
pauseLoop.VolumeTo(minimum_volume, TRANSITION_DURATION, Easing.OutQuad).Finally(_ => pauseLoop.Stop());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,9 @@ namespace osu.Game.Skinning
|
||||
[Resolved]
|
||||
private ISampleStore samples { get; set; }
|
||||
|
||||
public override bool RemoveWhenNotAlive => false;
|
||||
public override bool RemoveCompletedTransforms => false;
|
||||
|
||||
public SkinnableSound(ISampleInfo hitSamples)
|
||||
: this(new[] { hitSamples })
|
||||
{
|
||||
@ -45,6 +48,10 @@ namespace osu.Game.Skinning
|
||||
|
||||
public BindableNumber<double> Tempo => samplesContainer.Tempo;
|
||||
|
||||
public override bool IsPresent => Scheduler.HasPendingTasks || IsPlaying;
|
||||
|
||||
public bool IsPlaying => samplesContainer.Any(s => s.Playing);
|
||||
|
||||
/// <summary>
|
||||
/// Smoothly adjusts <see cref="Volume"/> over time.
|
||||
/// </summary>
|
||||
@ -94,8 +101,6 @@ namespace osu.Game.Skinning
|
||||
|
||||
public void Stop() => samplesContainer.ForEach(c => c.Stop());
|
||||
|
||||
public override bool IsPresent => Scheduler.HasPendingTasks;
|
||||
|
||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||
{
|
||||
bool wasPlaying = samplesContainer.Any(s => s.Playing);
|
||||
|
@ -305,8 +305,10 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
double refTime = referenceClock.CurrentTime;
|
||||
|
||||
if (lastReferenceTime.HasValue)
|
||||
accumulated += (refTime - lastReferenceTime.Value) * Rate;
|
||||
double? lastRefTime = lastReferenceTime;
|
||||
|
||||
if (lastRefTime != null)
|
||||
accumulated += (refTime - lastRefTime.Value) * Rate;
|
||||
|
||||
lastReferenceTime = refTime;
|
||||
}
|
||||
|
@ -25,9 +25,9 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2020.723.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.715.0" />
|
||||
<PackageReference Include="Sentry" Version="2.1.4" />
|
||||
<PackageReference Include="SharpCompress" Version="0.25.1" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.727.1" />
|
||||
<PackageReference Include="Sentry" Version="2.1.5" />
|
||||
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
|
||||
</ItemGroup>
|
||||
|
@ -71,7 +71,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.723.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.715.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.727.1" />
|
||||
</ItemGroup>
|
||||
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
|
||||
<ItemGroup Label="Transitive Dependencies">
|
||||
@ -81,7 +81,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2020.723.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.25.1" />
|
||||
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
|
||||
|
Loading…
Reference in New Issue
Block a user