mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 23:12:56 +08:00
Merge branch 'master' into song-select-track-selected-better-2
This commit is contained in:
commit
b0637cebd1
@ -52,6 +52,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1030.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.1120.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.1127.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -1,9 +1,10 @@
|
||||
// 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;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Rulesets.Catch.Objects;
|
||||
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
||||
using osuTK;
|
||||
@ -17,34 +18,49 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
foreach (FruitVisualRepresentation rep in Enum.GetValues(typeof(FruitVisualRepresentation)))
|
||||
AddStep($"show {rep}", () => SetContents(() => createDrawableFruit(rep)));
|
||||
AddStep("show pear", () => SetContents(() => createDrawableFruit(0)));
|
||||
AddStep("show grape", () => SetContents(() => createDrawableFruit(1)));
|
||||
AddStep("show pineapple / apple", () => SetContents(() => createDrawableFruit(2)));
|
||||
AddStep("show raspberry / orange", () => SetContents(() => createDrawableFruit(3)));
|
||||
|
||||
AddStep("show banana", () => SetContents(createDrawableBanana));
|
||||
|
||||
AddStep("show droplet", () => SetContents(() => createDrawableDroplet()));
|
||||
AddStep("show tiny droplet", () => SetContents(createDrawableTinyDroplet));
|
||||
|
||||
foreach (FruitVisualRepresentation rep in Enum.GetValues(typeof(FruitVisualRepresentation)))
|
||||
AddStep($"show hyperdash {rep}", () => SetContents(() => createDrawableFruit(rep, true)));
|
||||
AddStep("show hyperdash pear", () => SetContents(() => createDrawableFruit(0, true)));
|
||||
AddStep("show hyperdash grape", () => SetContents(() => createDrawableFruit(1, true)));
|
||||
AddStep("show hyperdash pineapple / apple", () => SetContents(() => createDrawableFruit(2, true)));
|
||||
AddStep("show hyperdash raspberry / orange", () => SetContents(() => createDrawableFruit(3, true)));
|
||||
|
||||
AddStep("show hyperdash droplet", () => SetContents(() => createDrawableDroplet(true)));
|
||||
}
|
||||
|
||||
private Drawable createDrawableFruit(FruitVisualRepresentation rep, bool hyperdash = false) =>
|
||||
setProperties(new DrawableFruit(new TestCatchFruit(rep)), hyperdash);
|
||||
private Drawable createDrawableFruit(int indexInBeatmap, bool hyperdash = false) =>
|
||||
SetProperties(new DrawableFruit(new Fruit
|
||||
{
|
||||
IndexInBeatmap = indexInBeatmap,
|
||||
HyperDashBindable = { Value = hyperdash }
|
||||
}));
|
||||
|
||||
private Drawable createDrawableDroplet(bool hyperdash = false) => setProperties(new DrawableDroplet(new Droplet()), hyperdash);
|
||||
private Drawable createDrawableBanana() =>
|
||||
SetProperties(new DrawableBanana(new Banana()));
|
||||
|
||||
private Drawable createDrawableTinyDroplet() => setProperties(new DrawableTinyDroplet(new TinyDroplet()));
|
||||
private Drawable createDrawableDroplet(bool hyperdash = false) =>
|
||||
SetProperties(new DrawableDroplet(new Droplet
|
||||
{
|
||||
HyperDashBindable = { Value = hyperdash }
|
||||
}));
|
||||
|
||||
private DrawableCatchHitObject setProperties(DrawableCatchHitObject d, bool hyperdash = false)
|
||||
private Drawable createDrawableTinyDroplet() => SetProperties(new DrawableTinyDroplet(new TinyDroplet()));
|
||||
|
||||
protected virtual DrawableCatchHitObject SetProperties(DrawableCatchHitObject d)
|
||||
{
|
||||
var hitObject = d.HitObject;
|
||||
hitObject.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 0 });
|
||||
hitObject.StartTime = 1000000000000;
|
||||
hitObject.Scale = 1.5f;
|
||||
|
||||
if (hyperdash)
|
||||
((PalpableCatchHitObject)hitObject).HyperDashTarget = new Banana();
|
||||
|
||||
d.Anchor = Anchor.Centre;
|
||||
d.RelativePositionAxes = Axes.None;
|
||||
d.Position = Vector2.Zero;
|
||||
@ -55,15 +71,5 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
};
|
||||
return d;
|
||||
}
|
||||
|
||||
public class TestCatchFruit : Fruit
|
||||
{
|
||||
public TestCatchFruit(FruitVisualRepresentation rep)
|
||||
{
|
||||
VisualRepresentation = rep;
|
||||
}
|
||||
|
||||
public override FruitVisualRepresentation VisualRepresentation { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
32
osu.Game.Rulesets.Catch.Tests/TestSceneFruitVisualChange.cs
Normal file
32
osu.Game.Rulesets.Catch.Tests/TestSceneFruitVisualChange.cs
Normal file
@ -0,0 +1,32 @@
|
||||
// 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 osu.Framework.Bindables;
|
||||
using osu.Game.Rulesets.Catch.Objects;
|
||||
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Tests
|
||||
{
|
||||
public class TestSceneFruitVisualChange : TestSceneFruitObjects
|
||||
{
|
||||
private readonly Bindable<int> indexInBeatmap = new Bindable<int>();
|
||||
private readonly Bindable<bool> hyperDash = new Bindable<bool>();
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
AddStep("fruit changes visual and hyper", () => SetContents(() => SetProperties(new DrawableFruit(new Fruit
|
||||
{
|
||||
IndexInBeatmapBindable = { BindTarget = indexInBeatmap },
|
||||
HyperDashBindable = { BindTarget = hyperDash },
|
||||
}))));
|
||||
|
||||
AddStep("droplet changes hyper", () => SetContents(() => SetProperties(new DrawableDroplet(new Droplet
|
||||
{
|
||||
HyperDashBindable = { BindTarget = hyperDash },
|
||||
}))));
|
||||
|
||||
Scheduler.AddDelayed(() => indexInBeatmap.Value++, 250, true);
|
||||
Scheduler.AddDelayed(() => hyperDash.Value = !hyperDash.Value, 1000, true);
|
||||
}
|
||||
}
|
||||
}
|
@ -2,21 +2,22 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Rulesets.Catch.Judgements;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Objects
|
||||
{
|
||||
public class Banana : Fruit
|
||||
public class Banana : Fruit, IHasComboInformation
|
||||
{
|
||||
/// <summary>
|
||||
/// Index of banana in current shower.
|
||||
/// </summary>
|
||||
public int BananaIndex;
|
||||
|
||||
public override FruitVisualRepresentation VisualRepresentation => FruitVisualRepresentation.Banana;
|
||||
|
||||
public override Judgement CreateJudgement() => new CatchBananaJudgement();
|
||||
|
||||
private static readonly List<HitSampleInfo> samples = new List<HitSampleInfo> { new BananaHitSampleInfo() };
|
||||
@ -26,6 +27,29 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
Samples = samples;
|
||||
}
|
||||
|
||||
private Color4? colour;
|
||||
|
||||
Color4 IHasComboInformation.GetComboColour(IReadOnlyList<Color4> comboColours)
|
||||
{
|
||||
// override any external colour changes with banananana
|
||||
return colour ??= getBananaColour();
|
||||
}
|
||||
|
||||
private Color4 getBananaColour()
|
||||
{
|
||||
switch (RNG.Next(0, 3))
|
||||
{
|
||||
default:
|
||||
return new Color4(255, 240, 0, 255);
|
||||
|
||||
case 1:
|
||||
return new Color4(255, 192, 0, 255);
|
||||
|
||||
case 2:
|
||||
return new Color4(214, 221, 28, 255);
|
||||
}
|
||||
}
|
||||
|
||||
private class BananaHitSampleInfo : HitSampleInfo
|
||||
{
|
||||
private static string[] lookupNames { get; } = { "metronomelow", "catch-banana" };
|
||||
|
@ -9,8 +9,6 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
{
|
||||
public class BananaShower : CatchHitObject, IHasDuration
|
||||
{
|
||||
public override FruitVisualRepresentation VisualRepresentation => FruitVisualRepresentation.Banana;
|
||||
|
||||
public override bool LastInCombo => true;
|
||||
|
||||
public override Judgement CreateJudgement() => new IgnoreJudgement();
|
||||
|
@ -16,27 +16,47 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
{
|
||||
public const float OBJECT_RADIUS = 64;
|
||||
|
||||
private float x;
|
||||
// This value is after XOffset applied.
|
||||
public readonly Bindable<float> XBindable = new Bindable<float>();
|
||||
|
||||
// This value is before XOffset applied.
|
||||
private float originalX;
|
||||
|
||||
/// <summary>
|
||||
/// The horizontal position of the fruit between 0 and <see cref="CatchPlayfield.WIDTH"/>.
|
||||
/// </summary>
|
||||
public float X
|
||||
{
|
||||
get => x + XOffset;
|
||||
set => x = value;
|
||||
// TODO: I don't like this asymmetry.
|
||||
get => XBindable.Value;
|
||||
// originalX is set by `XBindable.BindValueChanged`
|
||||
set => XBindable.Value = value + xOffset;
|
||||
}
|
||||
|
||||
private float xOffset;
|
||||
|
||||
/// <summary>
|
||||
/// A random offset applied to <see cref="X"/>, set by the <see cref="CatchBeatmapProcessor"/>.
|
||||
/// </summary>
|
||||
internal float XOffset { get; set; }
|
||||
internal float XOffset
|
||||
{
|
||||
get => xOffset;
|
||||
set
|
||||
{
|
||||
xOffset = value;
|
||||
XBindable.Value = originalX + xOffset;
|
||||
}
|
||||
}
|
||||
|
||||
public double TimePreempt = 1000;
|
||||
|
||||
public int IndexInBeatmap { get; set; }
|
||||
public readonly Bindable<int> IndexInBeatmapBindable = new Bindable<int>();
|
||||
|
||||
public virtual FruitVisualRepresentation VisualRepresentation => (FruitVisualRepresentation)(IndexInBeatmap % 4);
|
||||
public int IndexInBeatmap
|
||||
{
|
||||
get => IndexInBeatmapBindable.Value;
|
||||
set => IndexInBeatmapBindable.Value = value;
|
||||
}
|
||||
|
||||
public virtual bool NewCombo { get; set; }
|
||||
|
||||
@ -69,7 +89,13 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
set => LastInComboBindable.Value = value;
|
||||
}
|
||||
|
||||
public float Scale { get; set; } = 1;
|
||||
public readonly Bindable<float> ScaleBindable = new Bindable<float>(1);
|
||||
|
||||
public float Scale
|
||||
{
|
||||
get => ScaleBindable.Value;
|
||||
set => ScaleBindable.Value = value;
|
||||
}
|
||||
|
||||
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
||||
{
|
||||
@ -81,14 +107,10 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
}
|
||||
|
||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
||||
}
|
||||
|
||||
public enum FruitVisualRepresentation
|
||||
{
|
||||
Pear,
|
||||
Grape,
|
||||
Pineapple,
|
||||
Raspberry,
|
||||
Banana // banananananannaanana
|
||||
protected CatchHitObject()
|
||||
{
|
||||
XBindable.BindValueChanged(x => originalX = x.NewValue - xOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,28 +1,20 @@
|
||||
// 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;
|
||||
using osu.Framework.Utils;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
{
|
||||
public class DrawableBanana : DrawableFruit
|
||||
{
|
||||
protected override FruitVisualRepresentation GetVisualRepresentation(int indexInBeatmap) => FruitVisualRepresentation.Banana;
|
||||
|
||||
public DrawableBanana(Banana h)
|
||||
: base(h)
|
||||
{
|
||||
}
|
||||
|
||||
private Color4? colour;
|
||||
|
||||
protected override Color4 GetComboColour(IReadOnlyList<Color4> comboColours)
|
||||
{
|
||||
// override any external colour changes with banananana
|
||||
return colour ??= getBananaColour();
|
||||
}
|
||||
|
||||
protected override void UpdateInitialTransforms()
|
||||
{
|
||||
base.UpdateInitialTransforms();
|
||||
@ -46,20 +38,5 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
if (Samples != null)
|
||||
Samples.Frequency.Value = 0.77f + ((Banana)HitObject).BananaIndex * 0.006f;
|
||||
}
|
||||
|
||||
private Color4 getBananaColour()
|
||||
{
|
||||
switch (RNG.Next(0, 3))
|
||||
{
|
||||
default:
|
||||
return new Color4(255, 240, 0, 255);
|
||||
|
||||
case 1:
|
||||
return new Color4(255, 192, 0, 255);
|
||||
|
||||
case 2:
|
||||
return new Color4(214, 221, 28, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,8 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Catch.UI;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
@ -10,19 +12,34 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
{
|
||||
public abstract class DrawableCatchHitObject : DrawableHitObject<CatchHitObject>
|
||||
{
|
||||
public readonly Bindable<float> XBindable = new Bindable<float>();
|
||||
|
||||
protected override double InitialLifetimeOffset => HitObject.TimePreempt;
|
||||
|
||||
public float DisplayRadius => DrawSize.X / 2 * Scale.X * HitObject.Scale;
|
||||
|
||||
protected override float SamplePlaybackPosition => HitObject.X / CatchPlayfield.WIDTH;
|
||||
|
||||
protected DrawableCatchHitObject(CatchHitObject hitObject)
|
||||
protected DrawableCatchHitObject([CanBeNull] CatchHitObject hitObject)
|
||||
: base(hitObject)
|
||||
{
|
||||
X = hitObject.X;
|
||||
Anchor = Anchor.BottomLeft;
|
||||
}
|
||||
|
||||
protected override void OnApply()
|
||||
{
|
||||
base.OnApply();
|
||||
|
||||
XBindable.BindTo(HitObject.XBindable);
|
||||
}
|
||||
|
||||
protected override void OnFree()
|
||||
{
|
||||
base.OnFree();
|
||||
|
||||
XBindable.UnbindFrom(HitObject.XBindable);
|
||||
}
|
||||
|
||||
public Func<CatchHitObject, bool> CheckPosition;
|
||||
|
||||
public bool IsOnPlate;
|
||||
|
@ -21,7 +21,17 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
ScaleContainer.Child = new SkinnableDrawable(new CatchSkinComponent(CatchSkinComponents.Droplet), _ => new DropletPiece());
|
||||
HyperDash.BindValueChanged(_ => updatePiece(), true);
|
||||
}
|
||||
|
||||
private void updatePiece()
|
||||
{
|
||||
ScaleContainer.Child = new SkinnableDrawable(
|
||||
new CatchSkinComponent(CatchSkinComponents.Droplet),
|
||||
_ => new DropletPiece
|
||||
{
|
||||
HyperDash = { BindTarget = HyperDash }
|
||||
});
|
||||
}
|
||||
|
||||
protected override void UpdateInitialTransforms()
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Rulesets.Catch.Objects.Drawables.Pieces;
|
||||
using osu.Game.Skinning;
|
||||
@ -11,6 +12,10 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
{
|
||||
public class DrawableFruit : DrawablePalpableCatchHitObject
|
||||
{
|
||||
public readonly Bindable<FruitVisualRepresentation> VisualRepresentation = new Bindable<FruitVisualRepresentation>();
|
||||
|
||||
protected virtual FruitVisualRepresentation GetVisualRepresentation(int indexInBeatmap) => (FruitVisualRepresentation)(indexInBeatmap % 4);
|
||||
|
||||
public DrawableFruit(CatchHitObject h)
|
||||
: base(h)
|
||||
{
|
||||
@ -19,10 +24,26 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
ScaleContainer.Child = new SkinnableDrawable(
|
||||
new CatchSkinComponent(getComponent(HitObject.VisualRepresentation)), _ => new FruitPiece());
|
||||
|
||||
ScaleContainer.Rotation = (float)(RNG.NextDouble() - 0.5f) * 40;
|
||||
|
||||
IndexInBeatmap.BindValueChanged(change =>
|
||||
{
|
||||
VisualRepresentation.Value = GetVisualRepresentation(change.NewValue);
|
||||
}, true);
|
||||
|
||||
VisualRepresentation.BindValueChanged(_ => updatePiece());
|
||||
HyperDash.BindValueChanged(_ => updatePiece(), true);
|
||||
}
|
||||
|
||||
private void updatePiece()
|
||||
{
|
||||
ScaleContainer.Child = new SkinnableDrawable(
|
||||
new CatchSkinComponent(getComponent(VisualRepresentation.Value)),
|
||||
_ => new FruitPiece
|
||||
{
|
||||
VisualRepresentation = { BindTarget = VisualRepresentation },
|
||||
HyperDash = { BindTarget = HyperDash },
|
||||
});
|
||||
}
|
||||
|
||||
private CatchSkinComponents getComponent(FruitVisualRepresentation hitObjectVisualRepresentation)
|
||||
@ -49,4 +70,13 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum FruitVisualRepresentation
|
||||
{
|
||||
Pear,
|
||||
Grape,
|
||||
Pineapple,
|
||||
Raspberry,
|
||||
Banana // banananananannaanana
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
// 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 JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
{
|
||||
@ -14,6 +14,17 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
{
|
||||
public new PalpableCatchHitObject HitObject => (PalpableCatchHitObject)base.HitObject;
|
||||
|
||||
public readonly Bindable<bool> HyperDash = new Bindable<bool>();
|
||||
|
||||
public readonly Bindable<float> ScaleBindable = new Bindable<float>(1);
|
||||
|
||||
public readonly Bindable<int> IndexInBeatmap = new Bindable<int>();
|
||||
|
||||
/// <summary>
|
||||
/// The multiplicative factor applied to <see cref="ScaleContainer"/> scale relative to <see cref="HitObject"/> scale.
|
||||
/// </summary>
|
||||
protected virtual float ScaleFactor => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this hit object should stay on the catcher plate when the object is caught by the catcher.
|
||||
/// </summary>
|
||||
@ -21,7 +32,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
|
||||
protected readonly Container ScaleContainer;
|
||||
|
||||
protected DrawablePalpableCatchHitObject(CatchHitObject h)
|
||||
protected DrawablePalpableCatchHitObject([CanBeNull] CatchHitObject h)
|
||||
: base(h)
|
||||
{
|
||||
Origin = Anchor.Centre;
|
||||
@ -38,10 +49,35 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
ScaleContainer.Scale = new Vector2(HitObject.Scale);
|
||||
XBindable.BindValueChanged(x =>
|
||||
{
|
||||
if (!IsOnPlate) X = x.NewValue;
|
||||
}, true);
|
||||
|
||||
ScaleBindable.BindValueChanged(scale =>
|
||||
{
|
||||
ScaleContainer.Scale = new Vector2(scale.NewValue * ScaleFactor);
|
||||
}, true);
|
||||
|
||||
IndexInBeatmap.BindValueChanged(_ => UpdateComboColour());
|
||||
}
|
||||
|
||||
protected override Color4 GetComboColour(IReadOnlyList<Color4> comboColours) =>
|
||||
comboColours[(HitObject.IndexInBeatmap + 1) % comboColours.Count];
|
||||
protected override void OnApply()
|
||||
{
|
||||
base.OnApply();
|
||||
|
||||
HyperDash.BindTo(HitObject.HyperDashBindable);
|
||||
ScaleBindable.BindTo(HitObject.ScaleBindable);
|
||||
IndexInBeatmap.BindTo(HitObject.IndexInBeatmapBindable);
|
||||
}
|
||||
|
||||
protected override void OnFree()
|
||||
{
|
||||
HyperDash.UnbindFrom(HitObject.HyperDashBindable);
|
||||
ScaleBindable.UnbindFrom(HitObject.ScaleBindable);
|
||||
IndexInBeatmap.UnbindFrom(HitObject.IndexInBeatmapBindable);
|
||||
|
||||
base.OnFree();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,15 @@
|
||||
// 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 osu.Framework.Allocation;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
{
|
||||
public class DrawableTinyDroplet : DrawableDroplet
|
||||
{
|
||||
protected override float ScaleFactor => base.ScaleFactor / 2;
|
||||
|
||||
public DrawableTinyDroplet(TinyDroplet h)
|
||||
: base(h)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
ScaleContainer.Scale /= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
@ -11,6 +12,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces
|
||||
{
|
||||
public class DropletPiece : CompositeDrawable
|
||||
{
|
||||
public readonly Bindable<bool> HyperDash = new Bindable<bool>();
|
||||
|
||||
public DropletPiece()
|
||||
{
|
||||
Size = new Vector2(CatchHitObject.OBJECT_RADIUS / 2);
|
||||
@ -19,15 +22,13 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(DrawableHitObject drawableObject)
|
||||
{
|
||||
var drawableCatchObject = (DrawablePalpableCatchHitObject)drawableObject;
|
||||
|
||||
InternalChild = new Pulp
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
AccentColour = { BindTarget = drawableObject.AccentColour }
|
||||
};
|
||||
|
||||
if (drawableCatchObject.HitObject.HyperDash)
|
||||
if (HyperDash.Value)
|
||||
{
|
||||
AddInternal(new HyperDropletBorderPiece());
|
||||
}
|
||||
|
@ -2,7 +2,9 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
@ -16,36 +18,39 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces
|
||||
/// </summary>
|
||||
public const float RADIUS_ADJUST = 1.1f;
|
||||
|
||||
private BorderPiece border;
|
||||
private PalpableCatchHitObject hitObject;
|
||||
public readonly Bindable<FruitVisualRepresentation> VisualRepresentation = new Bindable<FruitVisualRepresentation>();
|
||||
public readonly Bindable<bool> HyperDash = new Bindable<bool>();
|
||||
|
||||
[CanBeNull]
|
||||
private DrawableCatchHitObject drawableHitObject;
|
||||
|
||||
[CanBeNull]
|
||||
private BorderPiece borderPiece;
|
||||
|
||||
public FruitPiece()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(DrawableHitObject drawableObject)
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load([CanBeNull] DrawableHitObject drawable)
|
||||
{
|
||||
var drawableCatchObject = (DrawablePalpableCatchHitObject)drawableObject;
|
||||
hitObject = drawableCatchObject.HitObject;
|
||||
drawableHitObject = (DrawableCatchHitObject)drawable;
|
||||
|
||||
AddRangeInternal(new[]
|
||||
{
|
||||
getFruitFor(hitObject.VisualRepresentation),
|
||||
border = new BorderPiece(),
|
||||
});
|
||||
AddInternal(getFruitFor(VisualRepresentation.Value));
|
||||
|
||||
if (hitObject.HyperDash)
|
||||
{
|
||||
// if it is not part of a DHO, the border is always invisible.
|
||||
if (drawableHitObject != null)
|
||||
AddInternal(borderPiece = new BorderPiece());
|
||||
|
||||
if (HyperDash.Value)
|
||||
AddInternal(new HyperBorderPiece());
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
border.Alpha = (float)Math.Clamp((hitObject.StartTime - Time.Current) / 500, 0, 1);
|
||||
if (borderPiece != null && drawableHitObject?.HitObject != null)
|
||||
borderPiece.Alpha = (float)Math.Clamp((drawableHitObject.HitObject.StartTime - Time.Current) / 500, 0, 1);
|
||||
}
|
||||
|
||||
private Drawable getFruitFor(FruitVisualRepresentation representation)
|
||||
|
@ -1,13 +1,18 @@
|
||||
// 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.Bindables;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a single object that can be caught by the catcher.
|
||||
/// This includes normal fruits, droplets, and bananas but excludes objects that act only as a container of nested hit objects.
|
||||
/// </summary>
|
||||
public abstract class PalpableCatchHitObject : CatchHitObject
|
||||
public abstract class PalpableCatchHitObject : CatchHitObject, IHasComboInformation
|
||||
{
|
||||
/// <summary>
|
||||
/// Difference between the distance to the next object
|
||||
@ -16,14 +21,28 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
/// </summary>
|
||||
public float DistanceToHyperDash { get; set; }
|
||||
|
||||
public readonly Bindable<bool> HyperDashBindable = new Bindable<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Whether this fruit can initiate a hyperdash.
|
||||
/// </summary>
|
||||
public bool HyperDash => HyperDashTarget != null;
|
||||
public bool HyperDash => HyperDashBindable.Value;
|
||||
|
||||
private CatchHitObject hyperDashTarget;
|
||||
|
||||
/// <summary>
|
||||
/// The target fruit if we are to initiate a hyperdash.
|
||||
/// </summary>
|
||||
public CatchHitObject HyperDashTarget;
|
||||
public CatchHitObject HyperDashTarget
|
||||
{
|
||||
get => hyperDashTarget;
|
||||
set
|
||||
{
|
||||
hyperDashTarget = value;
|
||||
HyperDashBindable.Value = value != null;
|
||||
}
|
||||
}
|
||||
|
||||
Color4 IHasComboInformation.GetComboColour(IReadOnlyList<Color4> comboColours) => comboColours[(IndexInBeatmap + 1) % comboColours.Count];
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,13 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
HitObjectContainer,
|
||||
CatcherArea,
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
// these subscriptions need to be done post constructor to ensure externally bound components have a chance to populate required fields (ScoreProcessor / ComboAtJudgement in this case).
|
||||
NewResult += onNewResult;
|
||||
RevertResult += onRevertResult;
|
||||
}
|
||||
|
@ -53,9 +53,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
});
|
||||
}
|
||||
|
||||
protected override void OnApply(HitObject hitObject)
|
||||
protected override void OnApply()
|
||||
{
|
||||
base.OnApply(hitObject);
|
||||
base.OnApply();
|
||||
|
||||
IndexInCurrentComboBindable.BindTo(HitObject.IndexInCurrentComboBindable);
|
||||
PositionBindable.BindTo(HitObject.PositionBindable);
|
||||
@ -70,9 +70,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
LifetimeEnd = HitObject.GetEndTime() + HitObject.HitWindows.WindowFor(HitResult.Miss) + 1000;
|
||||
}
|
||||
|
||||
protected override void OnFree(HitObject hitObject)
|
||||
protected override void OnFree()
|
||||
{
|
||||
base.OnFree(hitObject);
|
||||
base.OnFree();
|
||||
|
||||
IndexInCurrentComboBindable.UnbindFrom(HitObject.IndexInCurrentComboBindable);
|
||||
PositionBindable.UnbindFrom(HitObject.PositionBindable);
|
||||
|
@ -86,18 +86,18 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
Tracking.BindValueChanged(updateSlidingSample);
|
||||
}
|
||||
|
||||
protected override void OnApply(HitObject hitObject)
|
||||
protected override void OnApply()
|
||||
{
|
||||
base.OnApply(hitObject);
|
||||
base.OnApply();
|
||||
|
||||
// Ensure that the version will change after the upcoming BindTo().
|
||||
pathVersion.Value = int.MaxValue;
|
||||
PathVersion.BindTo(HitObject.Path.Version);
|
||||
}
|
||||
|
||||
protected override void OnFree(HitObject hitObject)
|
||||
protected override void OnFree()
|
||||
{
|
||||
base.OnFree(hitObject);
|
||||
base.OnFree();
|
||||
|
||||
PathVersion.UnbindFrom(HitObject.Path.Version);
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
|
||||
@ -36,9 +35,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
pathVersion.BindValueChanged(_ => updatePosition());
|
||||
}
|
||||
|
||||
protected override void OnFree(HitObject hitObject)
|
||||
protected override void OnFree()
|
||||
{
|
||||
base.OnFree(hitObject);
|
||||
base.OnFree();
|
||||
|
||||
pathVersion.UnbindFrom(drawableSlider.PathVersion);
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
};
|
||||
}
|
||||
|
||||
private readonly IBindable<ArmedState> state = new Bindable<ArmedState>();
|
||||
private readonly IBindable<Color4> accentColour = new Bindable<Color4>();
|
||||
private readonly IBindable<int> indexInCurrentCombo = new Bindable<int>();
|
||||
|
||||
@ -50,7 +49,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
var drawableOsuObject = (DrawableOsuHitObject)drawableObject;
|
||||
|
||||
state.BindTo(drawableObject.State);
|
||||
accentColour.BindTo(drawableObject.AccentColour);
|
||||
indexInCurrentCombo.BindTo(drawableOsuObject.IndexInCurrentComboBindable);
|
||||
}
|
||||
@ -59,7 +57,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
state.BindValueChanged(updateState, true);
|
||||
accentColour.BindValueChanged(colour =>
|
||||
{
|
||||
explode.Colour = colour.NewValue;
|
||||
@ -68,15 +65,18 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
}, true);
|
||||
|
||||
indexInCurrentCombo.BindValueChanged(index => number.Text = (index.NewValue + 1).ToString(), true);
|
||||
|
||||
drawableObject.ApplyCustomUpdateState += updateState;
|
||||
updateState(drawableObject, drawableObject.State.Value);
|
||||
}
|
||||
|
||||
private void updateState(ValueChangedEvent<ArmedState> state)
|
||||
private void updateState(DrawableHitObject drawableObject, ArmedState state)
|
||||
{
|
||||
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime, true))
|
||||
{
|
||||
glow.FadeOut(400);
|
||||
|
||||
switch (state.NewValue)
|
||||
switch (state)
|
||||
{
|
||||
case ArmedState.Hit:
|
||||
const double flash_in = 40;
|
||||
|
@ -248,7 +248,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
}
|
||||
|
||||
private void trackingChanged(ValueChangedEvent<bool> tracking) =>
|
||||
box.FadeTo(tracking.NewValue ? 0.6f : 0.05f, 200, Easing.OutQuint);
|
||||
box.FadeTo(tracking.NewValue ? 0.3f : 0.05f, 200, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
||||
|
||||
private SkinnableSpriteText hitCircleText;
|
||||
|
||||
private readonly IBindable<ArmedState> state = new Bindable<ArmedState>();
|
||||
private readonly Bindable<Color4> accentColour = new Bindable<Color4>();
|
||||
private readonly IBindable<int> indexInCurrentCombo = new Bindable<int>();
|
||||
|
||||
@ -113,7 +112,6 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
||||
if (overlayAboveNumber)
|
||||
AddInternal(hitCircleOverlay.CreateProxy());
|
||||
|
||||
state.BindTo(drawableObject.State);
|
||||
accentColour.BindTo(drawableObject.AccentColour);
|
||||
indexInCurrentCombo.BindTo(drawableOsuObject.IndexInCurrentComboBindable);
|
||||
|
||||
@ -137,19 +135,21 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
state.BindValueChanged(updateState, true);
|
||||
accentColour.BindValueChanged(colour => hitCircleSprite.Colour = LegacyColourCompatibility.DisallowZeroAlpha(colour.NewValue), true);
|
||||
if (hasNumber)
|
||||
indexInCurrentCombo.BindValueChanged(index => hitCircleText.Text = (index.NewValue + 1).ToString(), true);
|
||||
|
||||
drawableObject.ApplyCustomUpdateState += updateState;
|
||||
updateState(drawableObject, drawableObject.State.Value);
|
||||
}
|
||||
|
||||
private void updateState(ValueChangedEvent<ArmedState> state)
|
||||
private void updateState(DrawableHitObject drawableObject, ArmedState state)
|
||||
{
|
||||
const double legacy_fade_duration = 240;
|
||||
|
||||
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime, true))
|
||||
{
|
||||
switch (state.NewValue)
|
||||
switch (state)
|
||||
{
|
||||
case ArmedState.Hit:
|
||||
circleSprites.FadeOut(legacy_fade_duration, Easing.Out);
|
||||
|
@ -1,6 +1,7 @@
|
||||
// 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;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
@ -37,7 +38,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
private SkinnableDrawable mascot;
|
||||
|
||||
private ProxyContainer topLevelHitContainer;
|
||||
private ProxyContainer barlineContainer;
|
||||
private ScrollingHitObjectContainer barlineContainer;
|
||||
private Container rightArea;
|
||||
private Container leftArea;
|
||||
|
||||
@ -83,10 +84,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
barlineContainer = new ProxyContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
barlineContainer = new ScrollingHitObjectContainer(),
|
||||
new Container
|
||||
{
|
||||
Name = "Hit objects",
|
||||
@ -159,18 +157,37 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
|
||||
public override void Add(DrawableHitObject h)
|
||||
{
|
||||
h.OnNewResult += OnNewResult;
|
||||
base.Add(h);
|
||||
|
||||
switch (h)
|
||||
{
|
||||
case DrawableBarLine barline:
|
||||
barlineContainer.Add(barline.CreateProxy());
|
||||
barlineContainer.Add(barline);
|
||||
break;
|
||||
|
||||
case DrawableTaikoHitObject taikoObject:
|
||||
h.OnNewResult += OnNewResult;
|
||||
topLevelHitContainer.Add(taikoObject.CreateProxiedContent());
|
||||
base.Add(h);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new ArgumentException($"Unsupported {nameof(DrawableHitObject)} type");
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Remove(DrawableHitObject h)
|
||||
{
|
||||
switch (h)
|
||||
{
|
||||
case DrawableBarLine barline:
|
||||
return barlineContainer.Remove(barline);
|
||||
|
||||
case DrawableTaikoHitObject _:
|
||||
h.OnNewResult -= OnNewResult;
|
||||
// todo: consider tidying of proxied content if required.
|
||||
return base.Remove(h);
|
||||
|
||||
default:
|
||||
throw new ArgumentException($"Unsupported {nameof(DrawableHitObject)} type");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Screens.Edit;
|
||||
@ -44,6 +43,36 @@ namespace osu.Game.Tests.Editing
|
||||
Assert.That(stateChangedFired, Is.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestApplyThenUndoThenApplySameChange()
|
||||
{
|
||||
var (handler, beatmap) = createChangeHandler();
|
||||
|
||||
Assert.That(handler.CanUndo.Value, Is.False);
|
||||
Assert.That(handler.CanRedo.Value, Is.False);
|
||||
|
||||
string originalHash = handler.CurrentStateHash;
|
||||
|
||||
addArbitraryChange(beatmap);
|
||||
handler.SaveState();
|
||||
|
||||
Assert.That(handler.CanUndo.Value, Is.True);
|
||||
Assert.That(handler.CanRedo.Value, Is.False);
|
||||
Assert.That(stateChangedFired, Is.EqualTo(1));
|
||||
|
||||
string hash = handler.CurrentStateHash;
|
||||
|
||||
// undo a change without saving
|
||||
handler.RestoreState(-1);
|
||||
|
||||
Assert.That(originalHash, Is.EqualTo(handler.CurrentStateHash));
|
||||
Assert.That(stateChangedFired, Is.EqualTo(2));
|
||||
|
||||
addArbitraryChange(beatmap);
|
||||
handler.SaveState();
|
||||
Assert.That(hash, Is.EqualTo(handler.CurrentStateHash));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSaveSameStateDoesNotSave()
|
||||
{
|
||||
@ -139,7 +168,7 @@ namespace osu.Game.Tests.Editing
|
||||
|
||||
private void addArbitraryChange(EditorBeatmap beatmap)
|
||||
{
|
||||
beatmap.Add(new HitCircle { StartTime = RNG.Next(0, 100000) });
|
||||
beatmap.Add(new HitCircle { StartTime = 2760 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -261,9 +261,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
});
|
||||
}
|
||||
|
||||
protected override void OnApply(HitObject hitObject)
|
||||
protected override void OnApply()
|
||||
{
|
||||
base.OnApply(hitObject);
|
||||
base.OnApply();
|
||||
Position = new Vector2(RNG.Next(-200, 200), RNG.Next(-200, 200));
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -14,44 +13,41 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
[TestFixture]
|
||||
public class TestSceneStarCounter : OsuTestScene
|
||||
{
|
||||
private readonly StarCounter starCounter;
|
||||
private readonly OsuSpriteText starsLabel;
|
||||
|
||||
public TestSceneStarCounter()
|
||||
{
|
||||
StarCounter stars = new StarCounter
|
||||
starCounter = new StarCounter
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Current = 5,
|
||||
};
|
||||
|
||||
Add(stars);
|
||||
Add(starCounter);
|
||||
|
||||
SpriteText starsLabel = new OsuSpriteText
|
||||
starsLabel = new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Scale = new Vector2(2),
|
||||
Y = 50,
|
||||
Text = stars.Current.ToString("0.00"),
|
||||
};
|
||||
|
||||
Add(starsLabel);
|
||||
|
||||
AddRepeatStep(@"random value", delegate
|
||||
{
|
||||
stars.Current = RNG.NextSingle() * (stars.StarCount + 1);
|
||||
starsLabel.Text = stars.Current.ToString("0.00");
|
||||
}, 10);
|
||||
setStars(5);
|
||||
|
||||
AddStep(@"Stop animation", delegate
|
||||
{
|
||||
stars.StopAnimation();
|
||||
});
|
||||
AddRepeatStep("random value", () => setStars(RNG.NextSingle() * (starCounter.StarCount + 1)), 10);
|
||||
AddSliderStep("exact value", 0f, 10f, 5f, setStars);
|
||||
AddStep("stop animation", () => starCounter.StopAnimation());
|
||||
AddStep("reset", () => setStars(0));
|
||||
}
|
||||
|
||||
AddStep(@"Reset", delegate
|
||||
{
|
||||
stars.Current = 0;
|
||||
starsLabel.Text = stars.Current.ToString("0.00");
|
||||
});
|
||||
private void setStars(float stars)
|
||||
{
|
||||
starCounter.Current = stars;
|
||||
starsLabel.Text = starCounter.Current.ToString("0.00");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public override void DisplayAt(float scale)
|
||||
{
|
||||
scale = Math.Clamp(scale, min_star_scale, 1);
|
||||
scale = (float)Interpolation.Lerp(min_star_scale, 1, Math.Clamp(scale, 0, 1));
|
||||
|
||||
this.FadeTo(scale, fading_duration);
|
||||
Icon.ScaleTo(scale, scaling_duration, scaling_easing);
|
||||
|
@ -69,6 +69,7 @@ namespace osu.Game.Input.Bindings
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.Plus }, GlobalAction.IncreaseScrollSpeed),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.Minus }, GlobalAction.DecreaseScrollSpeed),
|
||||
new KeyBinding(InputKey.MouseMiddle, GlobalAction.PauseGameplay),
|
||||
new KeyBinding(InputKey.Space, GlobalAction.TogglePauseReplay),
|
||||
new KeyBinding(InputKey.Control, GlobalAction.HoldForHUD),
|
||||
};
|
||||
|
||||
@ -163,10 +164,10 @@ namespace osu.Game.Input.Bindings
|
||||
[Description("Toggle now playing overlay")]
|
||||
ToggleNowPlaying,
|
||||
|
||||
[Description("Previous Selection")]
|
||||
[Description("Previous selection")]
|
||||
SelectPrevious,
|
||||
|
||||
[Description("Next Selection")]
|
||||
[Description("Next selection")]
|
||||
SelectNext,
|
||||
|
||||
[Description("Home")]
|
||||
@ -175,26 +176,29 @@ namespace osu.Game.Input.Bindings
|
||||
[Description("Toggle notifications")]
|
||||
ToggleNotifications,
|
||||
|
||||
[Description("Pause")]
|
||||
[Description("Pause gameplay")]
|
||||
PauseGameplay,
|
||||
|
||||
// Editor
|
||||
[Description("Setup Mode")]
|
||||
[Description("Setup mode")]
|
||||
EditorSetupMode,
|
||||
|
||||
[Description("Compose Mode")]
|
||||
[Description("Compose mode")]
|
||||
EditorComposeMode,
|
||||
|
||||
[Description("Design Mode")]
|
||||
[Description("Design mode")]
|
||||
EditorDesignMode,
|
||||
|
||||
[Description("Timing Mode")]
|
||||
[Description("Timing mode")]
|
||||
EditorTimingMode,
|
||||
|
||||
[Description("Hold for HUD")]
|
||||
HoldForHUD,
|
||||
|
||||
[Description("Random Skin")]
|
||||
[Description("Random skin")]
|
||||
RandomSkin,
|
||||
|
||||
[Description("Pause / resume replay")]
|
||||
TogglePauseReplay,
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
new AudioDevicesSettings(),
|
||||
new VolumeSettings(),
|
||||
new OffsetSettings(),
|
||||
new MainMenuSettings()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new GeneralSettings(),
|
||||
new SongSelectSettings(),
|
||||
new ModsSettings(),
|
||||
};
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
new RendererSettings(),
|
||||
new LayoutSettings(),
|
||||
new DetailSettings(),
|
||||
new UserInterfaceSettings(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
15
osu.Game/Overlays/Settings/Sections/SizeSlider.cs
Normal file
15
osu.Game/Overlays/Settings/Sections/SizeSlider.cs
Normal file
@ -0,0 +1,15 @@
|
||||
// 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 osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Settings.Sections
|
||||
{
|
||||
/// <summary>
|
||||
/// A slider intended to show a "size" multiplier number, where 1x is 1.0.
|
||||
/// </summary>
|
||||
internal class SizeSlider : OsuSliderBar<float>
|
||||
{
|
||||
public override string TooltipText => Current.Value.ToString(@"0.##x");
|
||||
}
|
||||
}
|
@ -54,12 +54,6 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
skinDropdown = new SkinSettingsDropdown(),
|
||||
new ExportSkinButton(),
|
||||
new SettingsSlider<float, SizeSlider>
|
||||
{
|
||||
LabelText = "Menu cursor size",
|
||||
Current = config.GetBindable<float>(OsuSetting.MenuCursorSize),
|
||||
KeyboardStep = 0.01f
|
||||
},
|
||||
new SettingsSlider<float, SizeSlider>
|
||||
{
|
||||
LabelText = "Gameplay cursor size",
|
||||
Current = config.GetBindable<float>(OsuSetting.GameplayCursorSize),
|
||||
@ -136,11 +130,6 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
Schedule(() => skinDropdown.Items = skinDropdown.Items.Where(i => i.ID != item.ID).ToArray());
|
||||
}
|
||||
|
||||
private class SizeSlider : OsuSliderBar<float>
|
||||
{
|
||||
public override string TooltipText => Current.Value.ToString(@"0.##x");
|
||||
}
|
||||
|
||||
private class SkinSettingsDropdown : SettingsDropdown<SkinInfo>
|
||||
{
|
||||
protected override OsuDropdown<SkinInfo> CreateDropdown() => new SkinDropdownControl();
|
||||
|
@ -6,11 +6,11 @@ using osu.Framework.Graphics;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
namespace osu.Game.Overlays.Settings.Sections.UserInterface
|
||||
{
|
||||
public class UserInterfaceSettings : SettingsSubsection
|
||||
public class GeneralSettings : SettingsSubsection
|
||||
{
|
||||
protected override string Header => "User Interface";
|
||||
protected override string Header => "General";
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
@ -22,6 +22,12 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
LabelText = "Rotate cursor when dragging",
|
||||
Current = config.GetBindable<bool>(OsuSetting.CursorRotation)
|
||||
},
|
||||
new SettingsSlider<float, SizeSlider>
|
||||
{
|
||||
LabelText = "Menu cursor size",
|
||||
Current = config.GetBindable<float>(OsuSetting.MenuCursorSize),
|
||||
KeyboardStep = 0.01f
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Parallax",
|
@ -7,7 +7,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Configuration;
|
||||
|
||||
namespace osu.Game.Overlays.Settings.Sections.Audio
|
||||
namespace osu.Game.Overlays.Settings.Sections.UserInterface
|
||||
{
|
||||
public class MainMenuSettings : SettingsSubsection
|
||||
{
|
@ -8,7 +8,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
namespace osu.Game.Overlays.Settings.Sections.UserInterface
|
||||
{
|
||||
public class SongSelectSettings : SettingsSubsection
|
||||
{
|
29
osu.Game/Overlays/Settings/Sections/UserInterfaceSection.cs
Normal file
29
osu.Game/Overlays/Settings/Sections/UserInterfaceSection.cs
Normal file
@ -0,0 +1,29 @@
|
||||
// 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 osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Overlays.Settings.Sections.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Settings.Sections
|
||||
{
|
||||
public class UserInterfaceSection : SettingsSection
|
||||
{
|
||||
public override string Header => "User Interface";
|
||||
|
||||
public override Drawable CreateIcon() => new SpriteIcon
|
||||
{
|
||||
Icon = FontAwesome.Solid.LayerGroup
|
||||
};
|
||||
|
||||
public UserInterfaceSection()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new GeneralSettings(),
|
||||
new MainMenuSettings(),
|
||||
new SongSelectSettings()
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -23,10 +23,11 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
new GeneralSection(),
|
||||
new GraphicsSection(),
|
||||
new GameplaySection(),
|
||||
new AudioSection(),
|
||||
new SkinSection(),
|
||||
new InputSection(createSubPanel(new KeyBindingPanel())),
|
||||
new UserInterfaceSection(),
|
||||
new GameplaySection(),
|
||||
new SkinSection(),
|
||||
new OnlineSection(),
|
||||
new MaintenanceSection(),
|
||||
new DebugSection(),
|
||||
|
@ -32,9 +32,6 @@ namespace osu.Game.Rulesets.Judgements
|
||||
|
||||
private readonly Container aboveHitObjectsContent;
|
||||
|
||||
[Resolved]
|
||||
private ISkinSource skinSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Duration of initial fade in.
|
||||
/// </summary>
|
||||
@ -78,29 +75,6 @@ namespace osu.Game.Rulesets.Judgements
|
||||
|
||||
public Drawable GetProxyAboveHitObjectsContent() => aboveHitObjectsContent.CreateProxy();
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
skinSource.SourceChanged += onSkinChanged;
|
||||
}
|
||||
|
||||
private void onSkinChanged()
|
||||
{
|
||||
// on a skin change, the child component will update but not get correctly triggered to play its animation.
|
||||
// we need to trigger a reinitialisation to make things right.
|
||||
currentDrawableType = null;
|
||||
|
||||
PrepareForUse();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (skinSource != null)
|
||||
skinSource.SourceChanged -= onSkinChanged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply top-level animations to the current judgement when successfully hit.
|
||||
/// If displaying components which require lifetime extensions, manually adjusting <see cref="Drawable.LifetimeEnd"/> is required.
|
||||
@ -142,13 +116,14 @@ namespace osu.Game.Rulesets.Judgements
|
||||
|
||||
Debug.Assert(Result != null);
|
||||
|
||||
prepareDrawables();
|
||||
|
||||
runAnimation();
|
||||
}
|
||||
|
||||
private void runAnimation()
|
||||
{
|
||||
// is a no-op if the drawables are already in a correct state.
|
||||
prepareDrawables();
|
||||
|
||||
// undo any transforms applies in ApplyMissAnimations/ApplyHitAnimations to get a sane initial state.
|
||||
ApplyTransformsAt(double.MinValue, true);
|
||||
ClearTransforms(true);
|
||||
@ -203,7 +178,6 @@ namespace osu.Game.Rulesets.Judgements
|
||||
if (JudgementBody != null)
|
||||
RemoveInternal(JudgementBody);
|
||||
|
||||
aboveHitObjectsContent.Clear();
|
||||
AddInternal(JudgementBody = new SkinnableDrawable(new GameplaySkinComponent<HitResult>(type), _ =>
|
||||
CreateDefaultJudgement(type), confineMode: ConfineMode.NoScaling)
|
||||
{
|
||||
@ -211,14 +185,29 @@ namespace osu.Game.Rulesets.Judgements
|
||||
Origin = Anchor.Centre,
|
||||
});
|
||||
|
||||
if (JudgementBody.Drawable is IAnimatableJudgement animatable)
|
||||
JudgementBody.OnSkinChanged += () =>
|
||||
{
|
||||
var proxiedContent = animatable.GetAboveHitObjectsProxiedContent();
|
||||
if (proxiedContent != null)
|
||||
aboveHitObjectsContent.Add(proxiedContent);
|
||||
}
|
||||
// on a skin change, the child component will update but not get correctly triggered to play its animation (or proxy the newly created content).
|
||||
// we need to trigger a reinitialisation to make things right.
|
||||
proxyContent();
|
||||
runAnimation();
|
||||
};
|
||||
|
||||
proxyContent();
|
||||
|
||||
currentDrawableType = type;
|
||||
|
||||
void proxyContent()
|
||||
{
|
||||
aboveHitObjectsContent.Clear();
|
||||
|
||||
if (JudgementBody.Drawable is IAnimatableJudgement animatable)
|
||||
{
|
||||
var proxiedContent = animatable.GetAboveHitObjectsProxiedContent();
|
||||
if (proxiedContent != null)
|
||||
aboveHitObjectsContent.Add(proxiedContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual Drawable CreateDefaultJudgement(HitResult result) => new DefaultJudgementPiece(result);
|
||||
|
@ -128,6 +128,12 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
|
||||
private readonly Bindable<ArmedState> state = new Bindable<ArmedState>();
|
||||
|
||||
/// <summary>
|
||||
/// The state of this <see cref="DrawableHitObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For pooled hitobjects, <see cref="ApplyCustomUpdateState"/> is recommended to be used instead for better editor/rewinding support.
|
||||
/// </remarks>
|
||||
public IBindable<ArmedState> State => state;
|
||||
|
||||
/// <summary>
|
||||
@ -184,7 +190,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
comboIndexBindable.BindValueChanged(_ => updateComboColour(), true);
|
||||
comboIndexBindable.BindValueChanged(_ => UpdateComboColour(), true);
|
||||
|
||||
updateState(ArmedState.Idle, true);
|
||||
}
|
||||
@ -254,12 +260,19 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
|
||||
HitObject.DefaultsApplied += onDefaultsApplied;
|
||||
|
||||
OnApply(hitObject);
|
||||
OnApply();
|
||||
HitObjectApplied?.Invoke(this);
|
||||
|
||||
// If not loaded, the state update happens in LoadComplete(). Otherwise, the update is scheduled to allow for lifetime updates.
|
||||
// If not loaded, the state update happens in LoadComplete().
|
||||
if (IsLoaded)
|
||||
Schedule(() => updateState(ArmedState.Idle, true));
|
||||
{
|
||||
if (Result.IsHit)
|
||||
updateState(ArmedState.Hit, true);
|
||||
else if (Result.HasResult)
|
||||
updateState(ArmedState.Miss, true);
|
||||
else
|
||||
updateState(ArmedState.Idle, true);
|
||||
}
|
||||
|
||||
hasHitObjectApplied = true;
|
||||
}
|
||||
@ -299,7 +312,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
|
||||
HitObject.DefaultsApplied -= onDefaultsApplied;
|
||||
|
||||
OnFree(HitObject);
|
||||
OnFree();
|
||||
|
||||
HitObject = null;
|
||||
Result = null;
|
||||
@ -324,16 +337,14 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
/// <summary>
|
||||
/// Invoked for this <see cref="DrawableHitObject"/> to take on any values from a newly-applied <see cref="HitObject"/>.
|
||||
/// </summary>
|
||||
/// <param name="hitObject">The <see cref="HitObject"/> being applied.</param>
|
||||
protected virtual void OnApply(HitObject hitObject)
|
||||
protected virtual void OnApply()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked for this <see cref="DrawableHitObject"/> to revert any values previously taken on from the currently-applied <see cref="HitObject"/>.
|
||||
/// </summary>
|
||||
/// <param name="hitObject">The currently-applied <see cref="HitObject"/>.</param>
|
||||
protected virtual void OnFree(HitObject hitObject)
|
||||
protected virtual void OnFree()
|
||||
{
|
||||
}
|
||||
|
||||
@ -519,7 +530,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
{
|
||||
base.SkinChanged(skin, allowFallback);
|
||||
|
||||
updateComboColour();
|
||||
UpdateComboColour();
|
||||
|
||||
ApplySkin(skin, allowFallback);
|
||||
|
||||
@ -527,13 +538,12 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
updateState(State.Value, true);
|
||||
}
|
||||
|
||||
private void updateComboColour()
|
||||
protected void UpdateComboColour()
|
||||
{
|
||||
if (!(HitObject is IHasComboInformation)) return;
|
||||
if (!(HitObject is IHasComboInformation combo)) return;
|
||||
|
||||
var comboColours = CurrentSkin.GetConfig<GlobalSkinColours, IReadOnlyList<Color4>>(GlobalSkinColours.ComboColours)?.Value;
|
||||
|
||||
AccentColour.Value = GetComboColour(comboColours);
|
||||
var comboColours = CurrentSkin.GetConfig<GlobalSkinColours, IReadOnlyList<Color4>>(GlobalSkinColours.ComboColours)?.Value ?? Array.Empty<Color4>();
|
||||
AccentColour.Value = combo.GetComboColour(comboColours);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -544,6 +554,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
/// This will only be called if the <see cref="HitObject"/> implements <see cref="IHasComboInformation"/>.
|
||||
/// </remarks>
|
||||
/// <param name="comboColours">A list of combo colours provided by the beatmap or skin. Can be null if not available.</param>
|
||||
[Obsolete("Unused. Implement IHasComboInformation and IHasComboInformation.GetComboColour() on the HitObject model instead.")] // Can be removed 20210527
|
||||
protected virtual Color4 GetComboColour(IReadOnlyList<Color4> comboColours)
|
||||
{
|
||||
if (!(HitObject is IHasComboInformation combo))
|
||||
|
@ -1,7 +1,10 @@
|
||||
// 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 JetBrains.Annotations;
|
||||
using osu.Framework.Bindables;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Objects.Types
|
||||
{
|
||||
@ -35,5 +38,13 @@ namespace osu.Game.Rulesets.Objects.Types
|
||||
/// Whether this is the last object in the current combo.
|
||||
/// </summary>
|
||||
bool LastInCombo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the colour of the combo described by this <see cref="IHasComboInformation"/> object from a set of possible combo colours.
|
||||
/// Defaults to using <see cref="ComboIndex"/> to decide the colour.
|
||||
/// </summary>
|
||||
/// <param name="comboColours">A list of possible combo colours provided by the beatmap or skin.</param>
|
||||
/// <returns>The colour of the combo described by this <see cref="IHasComboInformation"/> object.</returns>
|
||||
Color4 GetComboColour([NotNull] IReadOnlyList<Color4> comboColours) => comboColours.Count > 0 ? comboColours[ComboIndex % comboColours.Count] : Color4.White;
|
||||
}
|
||||
}
|
||||
|
@ -496,10 +496,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
double offset = result.Time.Value - movementBlueprints.First().HitObject.StartTime;
|
||||
|
||||
foreach (HitObject obj in Beatmap.SelectedHitObjects)
|
||||
{
|
||||
obj.StartTime += offset;
|
||||
Beatmap.Update(obj);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -19,8 +18,8 @@ using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -28,32 +27,26 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
{
|
||||
public class TimelineHitObjectBlueprint : SelectionBlueprint
|
||||
{
|
||||
private readonly Circle circle;
|
||||
private const float thickness = 5;
|
||||
private const float shadow_radius = 5;
|
||||
private const float circle_size = 24;
|
||||
|
||||
public Action<DragEvent> OnDragHandled;
|
||||
|
||||
[UsedImplicitly]
|
||||
private readonly Bindable<double> startTime;
|
||||
|
||||
public Action<DragEvent> OnDragHandled;
|
||||
private Bindable<int> indexInCurrentComboBindable;
|
||||
private Bindable<int> comboIndexBindable;
|
||||
|
||||
private readonly Circle circle;
|
||||
private readonly DragBar dragBar;
|
||||
|
||||
private readonly List<Container> shadowComponents = new List<Container>();
|
||||
|
||||
private DrawableHitObject drawableHitObject;
|
||||
|
||||
private Bindable<Color4> comboColour;
|
||||
|
||||
private readonly Container mainComponents;
|
||||
|
||||
private readonly OsuSpriteText comboIndexText;
|
||||
|
||||
private Bindable<int> comboIndex;
|
||||
|
||||
private const float thickness = 5;
|
||||
|
||||
private const float shadow_radius = 5;
|
||||
|
||||
private const float circle_size = 24;
|
||||
[Resolved]
|
||||
private ISkinSource skin { get; set; }
|
||||
|
||||
public TimelineHitObjectBlueprint(HitObject hitObject)
|
||||
: base(hitObject)
|
||||
@ -152,46 +145,42 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
updateShadows();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(HitObjectComposer composer)
|
||||
{
|
||||
if (composer != null)
|
||||
{
|
||||
// best effort to get the drawable representation for grabbing colour and what not.
|
||||
drawableHitObject = composer.HitObjects.FirstOrDefault(d => d.HitObject == HitObject);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
if (HitObject is IHasComboInformation comboInfo)
|
||||
{
|
||||
comboIndex = comboInfo.IndexInCurrentComboBindable.GetBoundCopy();
|
||||
comboIndex.BindValueChanged(combo =>
|
||||
{
|
||||
comboIndexText.Text = (combo.NewValue + 1).ToString();
|
||||
}, true);
|
||||
indexInCurrentComboBindable = comboInfo.IndexInCurrentComboBindable.GetBoundCopy();
|
||||
indexInCurrentComboBindable.BindValueChanged(_ => updateComboIndex(), true);
|
||||
|
||||
comboIndexBindable = comboInfo.ComboIndexBindable.GetBoundCopy();
|
||||
comboIndexBindable.BindValueChanged(_ => updateComboColour(), true);
|
||||
|
||||
skin.SourceChanged += updateComboColour;
|
||||
}
|
||||
}
|
||||
|
||||
if (drawableHitObject != null)
|
||||
{
|
||||
comboColour = drawableHitObject.AccentColour.GetBoundCopy();
|
||||
comboColour.BindValueChanged(colour =>
|
||||
{
|
||||
if (HitObject is IHasDuration)
|
||||
mainComponents.Colour = ColourInfo.GradientHorizontal(drawableHitObject.AccentColour.Value, Color4.White);
|
||||
else
|
||||
mainComponents.Colour = drawableHitObject.AccentColour.Value;
|
||||
private void updateComboIndex() => comboIndexText.Text = (indexInCurrentComboBindable.Value + 1).ToString();
|
||||
|
||||
var col = mainComponents.Colour.TopLeft.Linear;
|
||||
float brightness = col.R + col.G + col.B;
|
||||
private void updateComboColour()
|
||||
{
|
||||
if (!(HitObject is IHasComboInformation combo))
|
||||
return;
|
||||
|
||||
// decide the combo index colour based on brightness?
|
||||
comboIndexText.Colour = brightness > 0.5f ? Color4.Black : Color4.White;
|
||||
}, true);
|
||||
}
|
||||
var comboColours = skin.GetConfig<GlobalSkinColours, IReadOnlyList<Color4>>(GlobalSkinColours.ComboColours)?.Value ?? Array.Empty<Color4>();
|
||||
var comboColour = combo.GetComboColour(comboColours);
|
||||
|
||||
if (HitObject is IHasDuration)
|
||||
mainComponents.Colour = ColourInfo.GradientHorizontal(comboColour, Color4.White);
|
||||
else
|
||||
mainComponents.Colour = comboColour;
|
||||
|
||||
var col = mainComponents.Colour.TopLeft.Linear;
|
||||
float brightness = col.R + col.G + col.B;
|
||||
|
||||
// decide the combo index colour based on brightness?
|
||||
comboIndexText.Colour = brightness > 0.5f ? Color4.Black : Color4.White;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
|
@ -1,6 +1,7 @@
|
||||
// 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.Diagnostics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
@ -43,6 +44,21 @@ namespace osu.Game.Screens.Edit.Compose
|
||||
if (ruleset == null || composer == null)
|
||||
return new ScreenWhiteBox.UnderConstructionMessage(ruleset == null ? "This beatmap" : $"{ruleset.Description}'s composer");
|
||||
|
||||
return wrapSkinnableContent(composer);
|
||||
}
|
||||
|
||||
protected override Drawable CreateTimelineContent()
|
||||
{
|
||||
if (ruleset == null || composer == null)
|
||||
return base.CreateTimelineContent();
|
||||
|
||||
return wrapSkinnableContent(new TimelineBlueprintContainer(composer));
|
||||
}
|
||||
|
||||
private Drawable wrapSkinnableContent(Drawable content)
|
||||
{
|
||||
Debug.Assert(ruleset != null);
|
||||
|
||||
var beatmapSkinProvider = new BeatmapSkinProvidingContainer(Beatmap.Value.Skin);
|
||||
|
||||
// the beatmapSkinProvider is used as the fallback source here to allow the ruleset-specific skin implementation
|
||||
@ -51,9 +67,7 @@ namespace osu.Game.Screens.Edit.Compose
|
||||
|
||||
// load the skinning hierarchy first.
|
||||
// this is intentionally done in two stages to ensure things are in a loaded state before exposing the ruleset to skin sources.
|
||||
return beatmapSkinProvider.WithChild(rulesetSkinProvider.WithChild(composer));
|
||||
return beatmapSkinProvider.WithChild(rulesetSkinProvider.WithChild(content));
|
||||
}
|
||||
|
||||
protected override Drawable CreateTimelineContent() => composer == null ? base.CreateTimelineContent() : new TimelineBlueprintContainer(composer);
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ namespace osu.Game.Screens.Edit
|
||||
var newState = stream.ToArray();
|
||||
|
||||
// if the previous state is binary equal we don't need to push a new one, unless this is the initial state.
|
||||
if (savedStates.Count > 0 && newState.SequenceEqual(savedStates.Last())) return;
|
||||
if (savedStates.Count > 0 && newState.SequenceEqual(savedStates[currentState])) return;
|
||||
|
||||
if (currentState < savedStates.Count - 1)
|
||||
savedStates.RemoveRange(currentState + 1, savedStates.Count - currentState - 1);
|
||||
|
@ -339,7 +339,11 @@ namespace osu.Game.Screens.Play
|
||||
AlwaysVisible = { BindTarget = DrawableRuleset.HasReplayLoaded },
|
||||
IsCounting = false
|
||||
},
|
||||
RequestSeek = GameplayClockContainer.Seek,
|
||||
RequestSeek = time =>
|
||||
{
|
||||
GameplayClockContainer.Seek(time);
|
||||
GameplayClockContainer.Start();
|
||||
},
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
},
|
||||
|
@ -1,12 +1,14 @@
|
||||
// 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 osu.Framework.Input.Bindings;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Ranking;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class ReplayPlayer : Player
|
||||
public class ReplayPlayer : Player, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
protected readonly Score Score;
|
||||
|
||||
@ -35,5 +37,24 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
return Score.ScoreInfo;
|
||||
}
|
||||
|
||||
public bool OnPressed(GlobalAction action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.TogglePauseReplay:
|
||||
if (GameplayClockContainer.IsPaused.Value)
|
||||
GameplayClockContainer.Start();
|
||||
else
|
||||
GameplayClockContainer.Stop();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void OnReleased(GlobalAction action)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -133,6 +133,9 @@ namespace osu.Game.Screens.Play
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.SkipCutscene:
|
||||
if (!button.Enabled.Value)
|
||||
return false;
|
||||
|
||||
button.Click();
|
||||
return true;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||
<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.1120.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2020.1127.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1030.0" />
|
||||
<PackageReference Include="Sentry" Version="2.1.6" />
|
||||
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
||||
|
@ -70,7 +70,7 @@
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.1120.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.1127.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1030.0" />
|
||||
</ItemGroup>
|
||||
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
|
||||
@ -88,7 +88,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||
<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.1120.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2020.1127.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
Loading…
Reference in New Issue
Block a user