mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 03:02:54 +08:00
Merge master with conflicts resolved
This commit is contained in:
commit
e1856503c2
@ -1,23 +1,27 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Pooling;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Mania.Judgements;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Tests.Skinning
|
namespace osu.Game.Rulesets.Mania.Tests.Skinning
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneHitExplosion : ManiaSkinnableTestScene
|
public class TestSceneHitExplosion : ManiaSkinnableTestScene
|
||||||
{
|
{
|
||||||
|
private readonly List<DrawablePool<PoolableHitExplosion>> hitExplosionPools = new List<DrawablePool<PoolableHitExplosion>>();
|
||||||
|
|
||||||
public TestSceneHitExplosion()
|
public TestSceneHitExplosion()
|
||||||
{
|
{
|
||||||
int runcount = 0;
|
int runcount = 0;
|
||||||
@ -29,28 +33,40 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
|
|||||||
if (runcount % 15 > 12)
|
if (runcount % 15 > 12)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CreatedDrawables.OfType<Container>().ForEach(c =>
|
int poolIndex = 0;
|
||||||
|
|
||||||
|
foreach (var c in CreatedDrawables.OfType<Container>())
|
||||||
{
|
{
|
||||||
c.Add(new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.HitExplosion, 0),
|
c.Add(hitExplosionPools[poolIndex].Get(e =>
|
||||||
_ => new DefaultHitExplosion((runcount / 15) % 2 == 0 ? new Color4(94, 0, 57, 255) : new Color4(6, 84, 0, 255), runcount % 6 != 0)
|
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
e.Apply(new JudgementResult(new HitObject(), runcount % 6 == 0 ? new HoldNoteTickJudgement() : new ManiaJudgement()));
|
||||||
Origin = Anchor.Centre,
|
|
||||||
|
e.Anchor = Anchor.Centre;
|
||||||
|
e.Origin = Anchor.Centre;
|
||||||
}));
|
}));
|
||||||
});
|
|
||||||
|
poolIndex++;
|
||||||
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
SetContents(() => new ColumnTestContainer(0, ManiaAction.Key1)
|
SetContents(() =>
|
||||||
|
{
|
||||||
|
var pool = new DrawablePool<PoolableHitExplosion>(5);
|
||||||
|
hitExplosionPools.Add(pool);
|
||||||
|
|
||||||
|
return new ColumnTestContainer(0, ManiaAction.Key1)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
RelativePositionAxes = Axes.Y,
|
RelativePositionAxes = Axes.Y,
|
||||||
Y = -0.25f,
|
Y = -0.25f,
|
||||||
Size = new Vector2(Column.COLUMN_WIDTH, DefaultNotePiece.NOTE_HEIGHT),
|
Size = new Vector2(Column.COLUMN_WIDTH, DefaultNotePiece.NOTE_HEIGHT),
|
||||||
|
Child = pool
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Mania.Judgements
|
|||||||
return 300;
|
return 300;
|
||||||
|
|
||||||
case HitResult.Perfect:
|
case HitResult.Perfect:
|
||||||
return 320;
|
return 350;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,9 @@ namespace osu.Game.Rulesets.Mania.Scoring
|
|||||||
{
|
{
|
||||||
internal class ManiaScoreProcessor : ScoreProcessor
|
internal class ManiaScoreProcessor : ScoreProcessor
|
||||||
{
|
{
|
||||||
protected override double DefaultAccuracyPortion => 0.8;
|
protected override double DefaultAccuracyPortion => 0.95;
|
||||||
|
|
||||||
protected override double DefaultComboPortion => 0.2;
|
protected override double DefaultComboPortion => 0.05;
|
||||||
|
|
||||||
public override HitWindows CreateHitWindows() => new ManiaHitWindows();
|
public override HitWindows CreateHitWindows() => new ManiaHitWindows();
|
||||||
}
|
}
|
||||||
|
@ -6,13 +6,15 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Animations;
|
using osu.Framework.Graphics.Animations;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Skinning
|
namespace osu.Game.Rulesets.Mania.Skinning
|
||||||
{
|
{
|
||||||
public class LegacyHitExplosion : LegacyManiaColumnElement
|
public class LegacyHitExplosion : LegacyManiaColumnElement, IHitExplosion
|
||||||
{
|
{
|
||||||
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
||||||
|
|
||||||
@ -62,9 +64,9 @@ namespace osu.Game.Rulesets.Mania.Skinning
|
|||||||
explosion.Anchor = direction.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
|
explosion.Anchor = direction.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
public void Animate(JudgementResult result)
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
(explosion as IFramedAnimation)?.GotoFrame(0);
|
||||||
|
|
||||||
explosion?.FadeInFromZero(80)
|
explosion?.FadeInFromZero(80)
|
||||||
.Then().FadeOut(120);
|
.Then().FadeOut(120);
|
||||||
|
@ -9,9 +9,9 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics.Pooling;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
|
||||||
using osu.Game.Rulesets.Mania.UI.Components;
|
using osu.Game.Rulesets.Mania.UI.Components;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
@ -34,8 +34,8 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
public readonly Bindable<ManiaAction> Action = new Bindable<ManiaAction>();
|
public readonly Bindable<ManiaAction> Action = new Bindable<ManiaAction>();
|
||||||
|
|
||||||
public readonly ColumnHitObjectArea HitObjectArea;
|
public readonly ColumnHitObjectArea HitObjectArea;
|
||||||
|
|
||||||
internal readonly Container TopLevelContainer;
|
internal readonly Container TopLevelContainer;
|
||||||
|
private readonly DrawablePool<PoolableHitExplosion> hitExplosionPool;
|
||||||
|
|
||||||
public Container UnderlayElements => HitObjectArea.UnderlayElements;
|
public Container UnderlayElements => HitObjectArea.UnderlayElements;
|
||||||
|
|
||||||
@ -53,6 +53,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
InternalChildren = new[]
|
InternalChildren = new[]
|
||||||
{
|
{
|
||||||
|
hitExplosionPool = new DrawablePool<PoolableHitExplosion>(5),
|
||||||
// For input purposes, the background is added at the highest depth, but is then proxied back below all other elements
|
// For input purposes, the background is added at the highest depth, but is then proxied back below all other elements
|
||||||
background.CreateProxy(),
|
background.CreateProxy(),
|
||||||
HitObjectArea = new ColumnHitObjectArea(Index, HitObjectContainer) { RelativeSizeAxes = Axes.Both },
|
HitObjectArea = new ColumnHitObjectArea(Index, HitObjectContainer) { RelativeSizeAxes = Axes.Both },
|
||||||
@ -108,15 +109,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
if (!result.IsHit || !judgedObject.DisplayResult || !DisplayJudgements.Value)
|
if (!result.IsHit || !judgedObject.DisplayResult || !DisplayJudgements.Value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var explosion = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.HitExplosion, Index), _ =>
|
HitObjectArea.Explosions.Add(hitExplosionPool.Get(e => e.Apply(result)));
|
||||||
new DefaultHitExplosion(judgedObject.AccentColour.Value, judgedObject is DrawableHoldNoteTick))
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both
|
|
||||||
};
|
|
||||||
|
|
||||||
HitObjectArea.Explosions.Add(explosion);
|
|
||||||
|
|
||||||
explosion.Delay(200).Expire(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnPressed(ManiaAction action)
|
public bool OnPressed(ManiaAction action)
|
||||||
|
@ -8,6 +8,8 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Effects;
|
using osu.Framework.Graphics.Effects;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Mania.Judgements;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -15,35 +17,36 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.UI
|
namespace osu.Game.Rulesets.Mania.UI
|
||||||
{
|
{
|
||||||
public class DefaultHitExplosion : CompositeDrawable
|
public class DefaultHitExplosion : CompositeDrawable, IHitExplosion
|
||||||
{
|
{
|
||||||
|
private const float default_large_faint_size = 0.8f;
|
||||||
|
|
||||||
public override bool RemoveWhenNotAlive => true;
|
public override bool RemoveWhenNotAlive => true;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private Column column { get; set; }
|
||||||
|
|
||||||
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
||||||
|
|
||||||
private readonly CircularContainer largeFaint;
|
private CircularContainer largeFaint;
|
||||||
private readonly CircularContainer mainGlow1;
|
private CircularContainer mainGlow1;
|
||||||
|
|
||||||
public DefaultHitExplosion(Color4 objectColour, bool isSmall = false)
|
public DefaultHitExplosion()
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = DefaultNotePiece.NOTE_HEIGHT;
|
Height = DefaultNotePiece.NOTE_HEIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
// scale roughly in-line with visual appearance of notes
|
[BackgroundDependencyLoader]
|
||||||
Scale = new Vector2(1f, 0.6f);
|
private void load(IScrollingInfo scrollingInfo)
|
||||||
|
{
|
||||||
if (isSmall)
|
|
||||||
Scale *= 0.5f;
|
|
||||||
|
|
||||||
const float angle_variangle = 15; // should be less than 45
|
const float angle_variangle = 15; // should be less than 45
|
||||||
|
|
||||||
const float roundness = 80;
|
const float roundness = 80;
|
||||||
|
|
||||||
const float initial_height = 10;
|
const float initial_height = 10;
|
||||||
|
|
||||||
var colour = Interpolation.ValueAt(0.4f, objectColour, Color4.White, 0, 1);
|
var colour = Interpolation.ValueAt(0.4f, column.AccentColour, Color4.White, 0, 1);
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -54,12 +57,12 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
// we want our size to be very small so the glow dominates it.
|
// we want our size to be very small so the glow dominates it.
|
||||||
Size = new Vector2(0.8f),
|
Size = new Vector2(default_large_faint_size),
|
||||||
Blending = BlendingParameters.Additive,
|
Blending = BlendingParameters.Additive,
|
||||||
EdgeEffect = new EdgeEffectParameters
|
EdgeEffect = new EdgeEffectParameters
|
||||||
{
|
{
|
||||||
Type = EdgeEffectType.Glow,
|
Type = EdgeEffectType.Glow,
|
||||||
Colour = Interpolation.ValueAt(0.1f, objectColour, Color4.White, 0, 1).Opacity(0.3f),
|
Colour = Interpolation.ValueAt(0.1f, column.AccentColour, Color4.White, 0, 1).Opacity(0.3f),
|
||||||
Roundness = 160,
|
Roundness = 160,
|
||||||
Radius = 200,
|
Radius = 200,
|
||||||
},
|
},
|
||||||
@ -74,7 +77,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
EdgeEffect = new EdgeEffectParameters
|
EdgeEffect = new EdgeEffectParameters
|
||||||
{
|
{
|
||||||
Type = EdgeEffectType.Glow,
|
Type = EdgeEffectType.Glow,
|
||||||
Colour = Interpolation.ValueAt(0.6f, objectColour, Color4.White, 0, 1),
|
Colour = Interpolation.ValueAt(0.6f, column.AccentColour, Color4.White, 0, 1),
|
||||||
Roundness = 20,
|
Roundness = 20,
|
||||||
Radius = 50,
|
Radius = 50,
|
||||||
},
|
},
|
||||||
@ -114,30 +117,11 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(IScrollingInfo scrollingInfo)
|
|
||||||
{
|
|
||||||
direction.BindTo(scrollingInfo.Direction);
|
direction.BindTo(scrollingInfo.Direction);
|
||||||
direction.BindValueChanged(onDirectionChanged, true);
|
direction.BindValueChanged(onDirectionChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
const double duration = 200;
|
|
||||||
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
largeFaint
|
|
||||||
.ResizeTo(largeFaint.Size * new Vector2(5, 1), duration, Easing.OutQuint)
|
|
||||||
.FadeOut(duration * 2);
|
|
||||||
|
|
||||||
mainGlow1.ScaleTo(1.4f, duration, Easing.OutQuint);
|
|
||||||
|
|
||||||
this.FadeOut(duration, Easing.Out);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onDirectionChanged(ValueChangedEvent<ScrollingDirection> direction)
|
private void onDirectionChanged(ValueChangedEvent<ScrollingDirection> direction)
|
||||||
{
|
{
|
||||||
if (direction.NewValue == ScrollingDirection.Up)
|
if (direction.NewValue == ScrollingDirection.Up)
|
||||||
@ -151,5 +135,29 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
Y = -DefaultNotePiece.NOTE_HEIGHT / 2;
|
Y = -DefaultNotePiece.NOTE_HEIGHT / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Animate(JudgementResult result)
|
||||||
|
{
|
||||||
|
// scale roughly in-line with visual appearance of notes
|
||||||
|
Vector2 scale = new Vector2(1, 0.6f);
|
||||||
|
|
||||||
|
if (result.Judgement is HoldNoteTickJudgement)
|
||||||
|
scale *= 0.5f;
|
||||||
|
|
||||||
|
this.ScaleTo(scale);
|
||||||
|
|
||||||
|
largeFaint
|
||||||
|
.ResizeTo(default_large_faint_size)
|
||||||
|
.Then()
|
||||||
|
.ResizeTo(default_large_faint_size * new Vector2(5, 1), PoolableHitExplosion.DURATION, Easing.OutQuint)
|
||||||
|
.FadeOut(PoolableHitExplosion.DURATION * 2);
|
||||||
|
|
||||||
|
mainGlow1
|
||||||
|
.ScaleTo(1)
|
||||||
|
.Then()
|
||||||
|
.ScaleTo(1.4f, PoolableHitExplosion.DURATION, Easing.OutQuint);
|
||||||
|
|
||||||
|
this.FadeOutFromOne(PoolableHitExplosion.DURATION, Easing.Out);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,10 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DrawableManiaJudgement()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
|
19
osu.Game.Rulesets.Mania/UI/IHitExplosion.cs
Normal file
19
osu.Game.Rulesets.Mania/UI/IHitExplosion.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// 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.Rulesets.Judgements;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Common interface for all hit explosion bodies.
|
||||||
|
/// </summary>
|
||||||
|
public interface IHitExplosion
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Begins animating this <see cref="IHitExplosion"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="result">The type of <see cref="JudgementResult"/> that caused this explosion.</param>
|
||||||
|
void Animate(JudgementResult result);
|
||||||
|
}
|
||||||
|
}
|
51
osu.Game.Rulesets.Mania/UI/PoolableHitExplosion.cs
Normal file
51
osu.Game.Rulesets.Mania/UI/PoolableHitExplosion.cs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
// 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;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Pooling;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.UI
|
||||||
|
{
|
||||||
|
public class PoolableHitExplosion : PoolableDrawable
|
||||||
|
{
|
||||||
|
public const double DURATION = 200;
|
||||||
|
|
||||||
|
public JudgementResult Result { get; private set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private Column column { get; set; }
|
||||||
|
|
||||||
|
private SkinnableDrawable skinnableExplosion;
|
||||||
|
|
||||||
|
public PoolableHitExplosion()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
InternalChild = skinnableExplosion = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.HitExplosion, column.Index), _ => new DefaultHitExplosion())
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Apply(JudgementResult result)
|
||||||
|
{
|
||||||
|
Result = result;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void PrepareForUse()
|
||||||
|
{
|
||||||
|
base.PrepareForUse();
|
||||||
|
|
||||||
|
(skinnableExplosion?.Drawable as IHitExplosion)?.Animate(Result);
|
||||||
|
|
||||||
|
this.Delay(DURATION).Then().Expire();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Pooling;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
@ -33,8 +34,8 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
public IReadOnlyList<Column> Columns => columnFlow.Children;
|
public IReadOnlyList<Column> Columns => columnFlow.Children;
|
||||||
private readonly FillFlowContainer<Column> columnFlow;
|
private readonly FillFlowContainer<Column> columnFlow;
|
||||||
|
|
||||||
public Container<DrawableManiaJudgement> Judgements => judgements;
|
|
||||||
private readonly JudgementContainer<DrawableManiaJudgement> judgements;
|
private readonly JudgementContainer<DrawableManiaJudgement> judgements;
|
||||||
|
private readonly DrawablePool<DrawableManiaJudgement> judgementPool;
|
||||||
|
|
||||||
private readonly Drawable barLineContainer;
|
private readonly Drawable barLineContainer;
|
||||||
private readonly Container topLevelContainer;
|
private readonly Container topLevelContainer;
|
||||||
@ -63,6 +64,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
|
judgementPool = new DrawablePool<DrawableManiaJudgement>(2),
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
@ -208,12 +210,14 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
if (!judgedObject.DisplayResult || !DisplayJudgements.Value)
|
if (!judgedObject.DisplayResult || !DisplayJudgements.Value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
judgements.Clear();
|
judgements.Clear(false);
|
||||||
judgements.Add(new DrawableManiaJudgement(result, judgedObject)
|
judgements.Add(judgementPool.Get(j =>
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
j.Apply(result, judgedObject);
|
||||||
Origin = Anchor.Centre,
|
|
||||||
});
|
j.Anchor = Anchor.Centre;
|
||||||
|
j.Origin = Anchor.Centre;
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
|
@ -11,6 +11,7 @@ using osu.Game.Rulesets.Mods;
|
|||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Replays;
|
using osu.Game.Rulesets.Osu.Replays;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
@ -30,6 +31,8 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
|
|
||||||
private OsuInputManager inputManager;
|
private OsuInputManager inputManager;
|
||||||
|
|
||||||
|
private GameplayClock gameplayClock;
|
||||||
|
|
||||||
private List<OsuReplayFrame> replayFrames;
|
private List<OsuReplayFrame> replayFrames;
|
||||||
|
|
||||||
private int currentFrame;
|
private int currentFrame;
|
||||||
@ -38,7 +41,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
{
|
{
|
||||||
if (currentFrame == replayFrames.Count - 1) return;
|
if (currentFrame == replayFrames.Count - 1) return;
|
||||||
|
|
||||||
double time = playfield.Time.Current;
|
double time = gameplayClock.CurrentTime;
|
||||||
|
|
||||||
// Very naive implementation of autopilot based on proximity to replay frames.
|
// Very naive implementation of autopilot based on proximity to replay frames.
|
||||||
// TODO: this needs to be based on user interactions to better match stable (pausing until judgement is registered).
|
// TODO: this needs to be based on user interactions to better match stable (pausing until judgement is registered).
|
||||||
@ -53,6 +56,8 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
|
|
||||||
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
|
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
|
||||||
{
|
{
|
||||||
|
gameplayClock = drawableRuleset.FrameStableClock;
|
||||||
|
|
||||||
// Grab the input manager to disable the user's cursor, and for future use
|
// Grab the input manager to disable the user's cursor, and for future use
|
||||||
inputManager = (OsuInputManager)drawableRuleset.KeyBindingInputManager;
|
inputManager = (OsuInputManager)drawableRuleset.KeyBindingInputManager;
|
||||||
inputManager.AllowUserCursorMovement = false;
|
inputManager.AllowUserCursorMovement = false;
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
@ -15,6 +17,14 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
|
|
||||||
public override string Description => "Hit them at the right size!";
|
public override string Description => "Hit them at the right size!";
|
||||||
|
|
||||||
protected override float StartScale => 2f;
|
[SettingSource("Starting Size", "The initial size multiplier applied to all objects.")]
|
||||||
|
public override BindableNumber<float> StartScale { get; } = new BindableFloat
|
||||||
|
{
|
||||||
|
MinValue = 1f,
|
||||||
|
MaxValue = 25f,
|
||||||
|
Default = 2f,
|
||||||
|
Value = 2f,
|
||||||
|
Precision = 0.1f,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
@ -15,6 +17,14 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
|
|
||||||
public override string Description => "Hit them at the right size!";
|
public override string Description => "Hit them at the right size!";
|
||||||
|
|
||||||
protected override float StartScale => 0.5f;
|
[SettingSource("Starting Size", "The initial size multiplier applied to all objects.")]
|
||||||
|
public override BindableNumber<float> StartScale { get; } = new BindableFloat
|
||||||
|
{
|
||||||
|
MinValue = 0f,
|
||||||
|
MaxValue = 0.99f,
|
||||||
|
Default = 0.5f,
|
||||||
|
Value = 0.5f,
|
||||||
|
Precision = 0.01f,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
|
|
||||||
public override double ScoreMultiplier => 1;
|
public override double ScoreMultiplier => 1;
|
||||||
|
|
||||||
protected virtual float StartScale => 1;
|
public abstract BindableNumber<float> StartScale { get; }
|
||||||
|
|
||||||
protected virtual float EndScale => 1;
|
protected virtual float EndScale => 1;
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
case DrawableHitCircle _:
|
case DrawableHitCircle _:
|
||||||
{
|
{
|
||||||
using (drawable.BeginAbsoluteSequence(h.StartTime - h.TimePreempt))
|
using (drawable.BeginAbsoluteSequence(h.StartTime - h.TimePreempt))
|
||||||
drawable.ScaleTo(StartScale).Then().ScaleTo(EndScale, h.TimePreempt, Easing.OutSine);
|
drawable.ScaleTo(StartScale.Value).Then().ScaleTo(EndScale, h.TimePreempt, Easing.OutSine);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
105
osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs
Normal file
105
osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableSound.cs
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
// 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.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Audio;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game.Audio;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
|
{
|
||||||
|
public class TestSceneSkinnableSound : OsuTestScene
|
||||||
|
{
|
||||||
|
[Cached]
|
||||||
|
private GameplayClock gameplayClock = new GameplayClock(new FramedClock());
|
||||||
|
|
||||||
|
private SkinnableSound skinnableSound;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp() => Schedule(() =>
|
||||||
|
{
|
||||||
|
gameplayClock.IsPaused.Value = false;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Clock = gameplayClock,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Child = skinnableSound = new SkinnableSound(new SampleInfo("normal-sliderslide"))
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestStoppedSoundDoesntResumeAfterPause()
|
||||||
|
{
|
||||||
|
DrawableSample sample = null;
|
||||||
|
AddStep("start sample with looping", () =>
|
||||||
|
{
|
||||||
|
sample = skinnableSound.ChildrenOfType<DrawableSample>().First();
|
||||||
|
|
||||||
|
skinnableSound.Looping = true;
|
||||||
|
skinnableSound.Play();
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("wait for sample to start playing", () => sample.Playing);
|
||||||
|
|
||||||
|
AddStep("stop sample", () => skinnableSound.Stop());
|
||||||
|
|
||||||
|
AddUntilStep("wait for sample to stop playing", () => !sample.Playing);
|
||||||
|
|
||||||
|
AddStep("pause gameplay clock", () => gameplayClock.IsPaused.Value = true);
|
||||||
|
AddStep("resume gameplay clock", () => gameplayClock.IsPaused.Value = false);
|
||||||
|
|
||||||
|
AddWaitStep("wait a bit", 5);
|
||||||
|
AddAssert("sample not playing", () => !sample.Playing);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestLoopingSoundResumesAfterPause()
|
||||||
|
{
|
||||||
|
DrawableSample sample = null;
|
||||||
|
AddStep("start sample with looping", () =>
|
||||||
|
{
|
||||||
|
skinnableSound.Looping = true;
|
||||||
|
skinnableSound.Play();
|
||||||
|
sample = skinnableSound.ChildrenOfType<DrawableSample>().First();
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("wait for sample to start playing", () => sample.Playing);
|
||||||
|
|
||||||
|
AddStep("pause gameplay clock", () => gameplayClock.IsPaused.Value = true);
|
||||||
|
AddUntilStep("wait for sample to stop playing", () => !sample.Playing);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestNonLoopingStopsWithPause()
|
||||||
|
{
|
||||||
|
DrawableSample sample = null;
|
||||||
|
AddStep("start sample", () =>
|
||||||
|
{
|
||||||
|
skinnableSound.Play();
|
||||||
|
sample = skinnableSound.ChildrenOfType<DrawableSample>().First();
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("sample playing", () => sample.Playing);
|
||||||
|
|
||||||
|
AddStep("pause gameplay clock", () => gameplayClock.IsPaused.Value = true);
|
||||||
|
AddUntilStep("wait for sample to stop playing", () => !sample.Playing);
|
||||||
|
|
||||||
|
AddStep("resume gameplay clock", () => gameplayClock.IsPaused.Value = false);
|
||||||
|
|
||||||
|
AddAssert("sample not playing", () => !sample.Playing);
|
||||||
|
AddAssert("sample not playing", () => !sample.Playing);
|
||||||
|
AddAssert("sample not playing", () => !sample.Playing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,7 +11,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
public class TestSceneShowMoreButton : OsuTestScene
|
public class TestSceneShowMoreButton : OsuTestScene
|
||||||
{
|
{
|
||||||
[Cached]
|
[Cached]
|
||||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Red);
|
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
|
||||||
|
|
||||||
public TestSceneShowMoreButton()
|
public TestSceneShowMoreButton()
|
||||||
{
|
{
|
||||||
|
@ -109,25 +109,58 @@ namespace osu.Game.Beatmaps
|
|||||||
}
|
}
|
||||||
|
|
||||||
private CancellationTokenSource trackedUpdateCancellationSource;
|
private CancellationTokenSource trackedUpdateCancellationSource;
|
||||||
|
private readonly List<CancellationTokenSource> linkedCancellationSources = new List<CancellationTokenSource>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates all tracked <see cref="BindableStarDifficulty"/> using the current ruleset and mods.
|
/// Updates all tracked <see cref="BindableStarDifficulty"/> using the current ruleset and mods.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void updateTrackedBindables()
|
private void updateTrackedBindables()
|
||||||
{
|
{
|
||||||
trackedUpdateCancellationSource?.Cancel();
|
cancelTrackedBindableUpdate();
|
||||||
trackedUpdateCancellationSource = new CancellationTokenSource();
|
trackedUpdateCancellationSource = new CancellationTokenSource();
|
||||||
|
|
||||||
foreach (var b in trackedBindables)
|
foreach (var b in trackedBindables)
|
||||||
{
|
{
|
||||||
if (trackedUpdateCancellationSource.IsCancellationRequested)
|
var linkedSource = CancellationTokenSource.CreateLinkedTokenSource(trackedUpdateCancellationSource.Token, b.CancellationToken);
|
||||||
break;
|
linkedCancellationSources.Add(linkedSource);
|
||||||
|
|
||||||
using (var linkedSource = CancellationTokenSource.CreateLinkedTokenSource(trackedUpdateCancellationSource.Token, b.CancellationToken))
|
|
||||||
updateBindable(b, currentRuleset.Value, currentMods.Value, linkedSource.Token);
|
updateBindable(b, currentRuleset.Value, currentMods.Value, linkedSource.Token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cancels the existing update of all tracked <see cref="BindableStarDifficulty"/> via <see cref="updateTrackedBindables"/>.
|
||||||
|
/// </summary>
|
||||||
|
private void cancelTrackedBindableUpdate()
|
||||||
|
{
|
||||||
|
trackedUpdateCancellationSource?.Cancel();
|
||||||
|
trackedUpdateCancellationSource = null;
|
||||||
|
|
||||||
|
if (linkedCancellationSources != null)
|
||||||
|
{
|
||||||
|
foreach (var c in linkedCancellationSources)
|
||||||
|
c.Dispose();
|
||||||
|
|
||||||
|
linkedCancellationSources.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new <see cref="BindableStarDifficulty"/> and triggers an initial value update.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="beatmapInfo">The <see cref="BeatmapInfo"/> that star difficulty should correspond to.</param>
|
||||||
|
/// <param name="initialRulesetInfo">The initial <see cref="RulesetInfo"/> to get the difficulty with.</param>
|
||||||
|
/// <param name="initialMods">The initial <see cref="Mod"/>s to get the difficulty with.</param>
|
||||||
|
/// <param name="cancellationToken">An optional <see cref="CancellationToken"/> which stops updating the star difficulty for the given <see cref="BeatmapInfo"/>.</param>
|
||||||
|
/// <returns>The <see cref="BindableStarDifficulty"/>.</returns>
|
||||||
|
private BindableStarDifficulty createBindable([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo initialRulesetInfo, [CanBeNull] IEnumerable<Mod> initialMods,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var bindable = new BindableStarDifficulty(beatmapInfo, cancellationToken);
|
||||||
|
updateBindable(bindable, initialRulesetInfo, initialMods, cancellationToken);
|
||||||
|
return bindable;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the value of a <see cref="BindableStarDifficulty"/> with a given ruleset + mods.
|
/// Updates the value of a <see cref="BindableStarDifficulty"/> with a given ruleset + mods.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -148,22 +181,6 @@ namespace osu.Game.Beatmaps
|
|||||||
}, cancellationToken);
|
}, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a new <see cref="BindableStarDifficulty"/> and triggers an initial value update.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="beatmapInfo">The <see cref="BeatmapInfo"/> that star difficulty should correspond to.</param>
|
|
||||||
/// <param name="initialRulesetInfo">The initial <see cref="RulesetInfo"/> to get the difficulty with.</param>
|
|
||||||
/// <param name="initialMods">The initial <see cref="Mod"/>s to get the difficulty with.</param>
|
|
||||||
/// <param name="cancellationToken">An optional <see cref="CancellationToken"/> which stops updating the star difficulty for the given <see cref="BeatmapInfo"/>.</param>
|
|
||||||
/// <returns>The <see cref="BindableStarDifficulty"/>.</returns>
|
|
||||||
private BindableStarDifficulty createBindable([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo initialRulesetInfo, [CanBeNull] IEnumerable<Mod> initialMods,
|
|
||||||
CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var bindable = new BindableStarDifficulty(beatmapInfo, cancellationToken);
|
|
||||||
updateBindable(bindable, initialRulesetInfo, initialMods, cancellationToken);
|
|
||||||
return bindable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Computes the difficulty defined by a <see cref="DifficultyCacheLookup"/> key, and stores it to the timed cache.
|
/// Computes the difficulty defined by a <see cref="DifficultyCacheLookup"/> key, and stores it to the timed cache.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -220,6 +237,14 @@ namespace osu.Game.Beatmaps
|
|||||||
return difficultyCache.TryGetValue(key, out existingDifficulty);
|
return difficultyCache.TryGetValue(key, out existingDifficulty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
|
cancelTrackedBindableUpdate();
|
||||||
|
updateScheduler?.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
private readonly struct DifficultyCacheLookup : IEquatable<DifficultyCacheLookup>
|
private readonly struct DifficultyCacheLookup : IEquatable<DifficultyCacheLookup>
|
||||||
{
|
{
|
||||||
public readonly int BeatmapId;
|
public readonly int BeatmapId;
|
||||||
|
@ -6,6 +6,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -25,6 +26,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
|
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
|
||||||
|
|
||||||
|
private ChevronIcon leftIcon;
|
||||||
|
private ChevronIcon rightIcon;
|
||||||
private SpriteText text;
|
private SpriteText text;
|
||||||
private Box background;
|
private Box background;
|
||||||
private FillFlowContainer textContainer;
|
private FillFlowContainer textContainer;
|
||||||
@ -58,15 +61,19 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Spacing = new Vector2(7),
|
Spacing = new Vector2(10),
|
||||||
Margin = new MarginPadding
|
Margin = new MarginPadding
|
||||||
{
|
{
|
||||||
Horizontal = 20,
|
Horizontal = 20,
|
||||||
Vertical = 5,
|
Vertical = 5
|
||||||
},
|
},
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new ChevronIcon(),
|
leftIcon = new ChevronIcon
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
},
|
||||||
text = new OsuSpriteText
|
text = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
@ -74,7 +81,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
|
Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
|
||||||
Text = "show more".ToUpper(),
|
Text = "show more".ToUpper(),
|
||||||
},
|
},
|
||||||
new ChevronIcon()
|
rightIcon = new ChevronIcon
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -84,21 +95,40 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
protected override void OnLoadFinished() => textContainer.FadeIn(duration, Easing.OutQuint);
|
protected override void OnLoadFinished() => textContainer.FadeIn(duration, Easing.OutQuint);
|
||||||
|
|
||||||
private class ChevronIcon : SpriteIcon
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
|
base.OnHover(e);
|
||||||
|
leftIcon.SetHoveredState(true);
|
||||||
|
rightIcon.SetHoveredState(true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
|
{
|
||||||
|
base.OnHoverLost(e);
|
||||||
|
leftIcon.SetHoveredState(false);
|
||||||
|
rightIcon.SetHoveredState(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ChevronIcon : SpriteIcon
|
||||||
|
{
|
||||||
|
[Resolved]
|
||||||
|
private OverlayColourProvider colourProvider { get; set; }
|
||||||
|
|
||||||
public ChevronIcon()
|
public ChevronIcon()
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre;
|
Size = new Vector2(7.5f);
|
||||||
Origin = Anchor.Centre;
|
|
||||||
Size = new Vector2(8);
|
|
||||||
Icon = FontAwesome.Solid.ChevronDown;
|
Icon = FontAwesome.Solid.ChevronDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OverlayColourProvider colourProvider)
|
private void load()
|
||||||
{
|
{
|
||||||
Colour = colourProvider.Foreground1;
|
Colour = colourProvider.Foreground1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetHoveredState(bool hovered) =>
|
||||||
|
this.FadeColour(hovered ? colourProvider.Light1 : colourProvider.Foreground1, 200, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
48
osu.Game/Overlays/Comments/Buttons/ChevronButton.cs
Normal file
48
osu.Game/Overlays/Comments/Buttons/ChevronButton.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
// 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.Game.Graphics.Containers;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osuTK;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Comments.Buttons
|
||||||
|
{
|
||||||
|
public class ChevronButton : OsuHoverContainer
|
||||||
|
{
|
||||||
|
public readonly BindableBool Expanded = new BindableBool(true);
|
||||||
|
|
||||||
|
private readonly SpriteIcon icon;
|
||||||
|
|
||||||
|
public ChevronButton()
|
||||||
|
{
|
||||||
|
Size = new Vector2(40, 22);
|
||||||
|
Child = icon = new SpriteIcon
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Size = new Vector2(12),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OverlayColourProvider colourProvider)
|
||||||
|
{
|
||||||
|
IdleColour = HoverColour = colourProvider.Foreground1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
Action = Expanded.Toggle;
|
||||||
|
Expanded.BindValueChanged(onExpandedChanged, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onExpandedChanged(ValueChangedEvent<bool> expanded)
|
||||||
|
{
|
||||||
|
icon.Icon = expanded.NewValue ? FontAwesome.Solid.ChevronUp : FontAwesome.Solid.ChevronDown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,12 +5,12 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using static osu.Game.Graphics.UserInterface.ShowMoreButton;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Comments.Buttons
|
namespace osu.Game.Overlays.Comments.Buttons
|
||||||
{
|
{
|
||||||
@ -25,17 +25,13 @@ namespace osu.Game.Overlays.Comments.Buttons
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private OverlayColourProvider colourProvider { get; set; }
|
private OverlayColourProvider colourProvider { get; set; }
|
||||||
|
|
||||||
private readonly SpriteIcon icon;
|
private readonly ChevronIcon icon;
|
||||||
private readonly Box background;
|
private readonly Box background;
|
||||||
private readonly OsuSpriteText text;
|
private readonly OsuSpriteText text;
|
||||||
|
|
||||||
protected CommentRepliesButton()
|
protected CommentRepliesButton()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
Margin = new MarginPadding
|
|
||||||
{
|
|
||||||
Vertical = 2
|
|
||||||
};
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new CircularContainer
|
new CircularContainer
|
||||||
@ -72,12 +68,10 @@ namespace osu.Game.Overlays.Comments.Buttons
|
|||||||
AlwaysPresent = true,
|
AlwaysPresent = true,
|
||||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold)
|
Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold)
|
||||||
},
|
},
|
||||||
icon = new SpriteIcon
|
icon = new ChevronIcon
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft
|
||||||
Size = new Vector2(7.5f),
|
|
||||||
Icon = FontAwesome.Solid.ChevronDown
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -92,7 +86,6 @@ namespace osu.Game.Overlays.Comments.Buttons
|
|||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
background.Colour = colourProvider.Background2;
|
background.Colour = colourProvider.Background2;
|
||||||
icon.Colour = colourProvider.Foreground1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void SetIconDirection(bool upwards) => icon.ScaleTo(new Vector2(1, upwards ? -1 : 1));
|
protected void SetIconDirection(bool upwards) => icon.ScaleTo(new Vector2(1, upwards ? -1 : 1));
|
||||||
@ -103,7 +96,7 @@ namespace osu.Game.Overlays.Comments.Buttons
|
|||||||
{
|
{
|
||||||
base.OnHover(e);
|
base.OnHover(e);
|
||||||
background.FadeColour(colourProvider.Background1, 200, Easing.OutQuint);
|
background.FadeColour(colourProvider.Background1, 200, Easing.OutQuint);
|
||||||
icon.FadeColour(colourProvider.Light1, 200, Easing.OutQuint);
|
icon.SetHoveredState(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +104,7 @@ namespace osu.Game.Overlays.Comments.Buttons
|
|||||||
{
|
{
|
||||||
base.OnHoverLost(e);
|
base.OnHoverLost(e);
|
||||||
background.FadeColour(colourProvider.Background2, 200, Easing.OutQuint);
|
background.FadeColour(colourProvider.Background2, 200, Easing.OutQuint);
|
||||||
icon.FadeColour(colourProvider.Foreground1, 200, Easing.OutQuint);
|
icon.SetHoveredState(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,38 +8,42 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Comments
|
namespace osu.Game.Overlays.Comments.Buttons
|
||||||
{
|
{
|
||||||
public abstract class GetCommentRepliesButton : LoadingButton
|
public class ShowMoreRepliesButton : LoadingButton
|
||||||
{
|
{
|
||||||
private const int duration = 200;
|
|
||||||
|
|
||||||
protected override IEnumerable<Drawable> EffectTargets => new[] { text };
|
protected override IEnumerable<Drawable> EffectTargets => new[] { text };
|
||||||
|
|
||||||
private OsuSpriteText text;
|
private OsuSpriteText text;
|
||||||
|
|
||||||
protected GetCommentRepliesButton()
|
public ShowMoreRepliesButton()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
LoadingAnimationSize = new Vector2(8);
|
LoadingAnimationSize = new Vector2(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OverlayColourProvider colourProvider)
|
||||||
|
{
|
||||||
|
IdleColour = colourProvider.Light2;
|
||||||
|
HoverColour = colourProvider.Light1;
|
||||||
|
}
|
||||||
|
|
||||||
protected override Drawable CreateContent() => new Container
|
protected override Drawable CreateContent() => new Container
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Child = text = new OsuSpriteText
|
Child = text = new OsuSpriteText
|
||||||
{
|
{
|
||||||
AlwaysPresent = true,
|
AlwaysPresent = true,
|
||||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
|
||||||
Text = GetText()
|
Text = "show more"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
protected abstract string GetText();
|
protected override void OnLoadStarted() => text.FadeOut(200, Easing.OutQuint);
|
||||||
|
|
||||||
protected override void OnLoadStarted() => text.FadeOut(duration, Easing.OutQuint);
|
protected override void OnLoadFinished() => text.FadeIn(200, Easing.OutQuint);
|
||||||
|
|
||||||
protected override void OnLoadFinished() => text.FadeIn(duration, Easing.OutQuint);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -78,21 +78,22 @@ namespace osu.Game.Overlays.Comments
|
|||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = colourProvider.Background4
|
|
||||||
},
|
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
|
Margin = new MarginPadding { Bottom = 20 },
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
deletedCommentsCounter = new DeletedCommentsCounter
|
deletedCommentsCounter = new DeletedCommentsCounter
|
||||||
{
|
{
|
||||||
ShowDeleted = { BindTarget = ShowDeleted }
|
ShowDeleted = { BindTarget = ShowDeleted },
|
||||||
|
Margin = new MarginPadding
|
||||||
|
{
|
||||||
|
Horizontal = 70,
|
||||||
|
Vertical = 10
|
||||||
|
}
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
@ -102,7 +103,10 @@ namespace osu.Game.Overlays.Comments
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Margin = new MarginPadding(5),
|
Margin = new MarginPadding
|
||||||
|
{
|
||||||
|
Vertical = 10
|
||||||
|
},
|
||||||
Action = getComments,
|
Action = getComments,
|
||||||
IsLoading = true,
|
IsLoading = true,
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,6 @@ namespace osu.Game.Overlays.Comments
|
|||||||
public DeletedCommentsCounter()
|
public DeletedCommentsCounter()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
Margin = new MarginPadding { Vertical = 10, Left = 80 };
|
|
||||||
|
|
||||||
InternalChild = new FillFlowContainer
|
InternalChild = new FillFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
|
@ -28,7 +28,6 @@ namespace osu.Game.Overlays.Comments
|
|||||||
public class DrawableComment : CompositeDrawable
|
public class DrawableComment : CompositeDrawable
|
||||||
{
|
{
|
||||||
private const int avatar_size = 40;
|
private const int avatar_size = 40;
|
||||||
private const int margin = 10;
|
|
||||||
|
|
||||||
public Action<DrawableComment, int> RepliesRequested;
|
public Action<DrawableComment, int> RepliesRequested;
|
||||||
|
|
||||||
@ -47,7 +46,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
private FillFlowContainer childCommentsVisibilityContainer;
|
private FillFlowContainer childCommentsVisibilityContainer;
|
||||||
private FillFlowContainer childCommentsContainer;
|
private FillFlowContainer childCommentsContainer;
|
||||||
private LoadRepliesButton loadRepliesButton;
|
private LoadRepliesButton loadRepliesButton;
|
||||||
private ShowMoreButton showMoreButton;
|
private ShowMoreRepliesButton showMoreButton;
|
||||||
private ShowRepliesButton showRepliesButton;
|
private ShowRepliesButton showRepliesButton;
|
||||||
private ChevronButton chevronButton;
|
private ChevronButton chevronButton;
|
||||||
private DeletedCommentsCounter deletedCommentsCounter;
|
private DeletedCommentsCounter deletedCommentsCounter;
|
||||||
@ -58,7 +57,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load(OverlayColourProvider colourProvider)
|
||||||
{
|
{
|
||||||
LinkFlowContainer username;
|
LinkFlowContainer username;
|
||||||
FillFlowContainer info;
|
FillFlowContainer info;
|
||||||
@ -70,25 +69,25 @@ namespace osu.Game.Overlays.Comments
|
|||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new FillFlowContainer
|
new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Padding = getPadding(Comment.IsTopLevel),
|
||||||
|
Child = new FillFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
content = new GridContainer
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Padding = new MarginPadding(margin) { Left = margin + 5, Top = Comment.IsTopLevel ? 10 : 0 },
|
|
||||||
Child = content = new GridContainer
|
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
ColumnDimensions = new[]
|
ColumnDimensions = new[]
|
||||||
{
|
{
|
||||||
new Dimension(GridSizeMode.AutoSize),
|
new Dimension(GridSizeMode.Absolute, size: avatar_size + 10),
|
||||||
new Dimension(),
|
new Dimension(),
|
||||||
},
|
},
|
||||||
RowDimensions = new[]
|
RowDimensions = new[]
|
||||||
@ -98,77 +97,67 @@ namespace osu.Game.Overlays.Comments
|
|||||||
Content = new[]
|
Content = new[]
|
||||||
{
|
{
|
||||||
new Drawable[]
|
new Drawable[]
|
||||||
{
|
|
||||||
new FillFlowContainer
|
|
||||||
{
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Margin = new MarginPadding { Horizontal = margin },
|
|
||||||
Direction = FillDirection.Horizontal,
|
|
||||||
Spacing = new Vector2(5, 0),
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Size = new Vector2(avatar_size),
|
||||||
Origin = Anchor.Centre,
|
Children = new Drawable[]
|
||||||
Width = 40,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Child = votePill = new VotePill(Comment)
|
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreRight,
|
|
||||||
Origin = Anchor.CentreRight,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new UpdateableAvatar(Comment.User)
|
new UpdateableAvatar(Comment.User)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Size = new Vector2(avatar_size),
|
Size = new Vector2(avatar_size),
|
||||||
Masking = true,
|
Masking = true,
|
||||||
CornerRadius = avatar_size / 2f,
|
CornerRadius = avatar_size / 2f,
|
||||||
CornerExponent = 2,
|
CornerExponent = 2,
|
||||||
},
|
},
|
||||||
|
votePill = new VotePill(Comment)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
Margin = new MarginPadding
|
||||||
|
{
|
||||||
|
Right = 5
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Spacing = new Vector2(0, 3),
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(0, 4),
|
||||||
|
Margin = new MarginPadding
|
||||||
|
{
|
||||||
|
Vertical = 2
|
||||||
|
},
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Spacing = new Vector2(7, 0),
|
Spacing = new Vector2(10, 0),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true))
|
username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold))
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both
|
||||||
},
|
},
|
||||||
new ParentUsername(Comment),
|
new ParentUsername(Comment),
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Alpha = Comment.IsDeleted ? 1 : 0,
|
Alpha = Comment.IsDeleted ? 1 : 0,
|
||||||
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
|
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold),
|
||||||
Text = @"deleted",
|
Text = "deleted"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
message = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14))
|
message = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14))
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y
|
||||||
Padding = new MarginPadding { Right = 40 }
|
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
|
||||||
{
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
info = new FillFlowContainer
|
info = new FillFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
@ -176,16 +165,17 @@ namespace osu.Game.Overlays.Comments
|
|||||||
Spacing = new Vector2(10, 0),
|
Spacing = new Vector2(10, 0),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuSpriteText
|
new DrawableDate(Comment.CreatedAt, 12, false)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Colour = colourProvider.Foreground1
|
||||||
Origin = Anchor.CentreLeft,
|
}
|
||||||
Font = OsuFont.GetFont(size: 12),
|
|
||||||
Colour = OsuColour.Gray(0.7f),
|
|
||||||
Text = HumanizerUtils.Humanize(Comment.CreatedAt)
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
showRepliesButton = new ShowRepliesButton(Comment.RepliesCount)
|
showRepliesButton = new ShowRepliesButton(Comment.RepliesCount)
|
||||||
{
|
{
|
||||||
Expanded = { BindTarget = childrenExpanded }
|
Expanded = { BindTarget = childrenExpanded }
|
||||||
@ -200,42 +190,52 @@ namespace osu.Game.Overlays.Comments
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
childCommentsVisibilityContainer = new FillFlowContainer
|
childCommentsVisibilityContainer = new FillFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
|
Padding = new MarginPadding { Left = 20 },
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
childCommentsContainer = new FillFlowContainer
|
childCommentsContainer = new FillFlowContainer
|
||||||
{
|
{
|
||||||
Padding = new MarginPadding { Left = 20 },
|
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Direction = FillDirection.Vertical
|
Direction = FillDirection.Vertical
|
||||||
},
|
},
|
||||||
deletedCommentsCounter = new DeletedCommentsCounter
|
deletedCommentsCounter = new DeletedCommentsCounter
|
||||||
{
|
{
|
||||||
ShowDeleted = { BindTarget = ShowDeleted }
|
ShowDeleted = { BindTarget = ShowDeleted },
|
||||||
|
Margin = new MarginPadding
|
||||||
|
{
|
||||||
|
Top = 10
|
||||||
|
}
|
||||||
},
|
},
|
||||||
showMoreButton = new ShowMoreButton
|
showMoreButton = new ShowMoreRepliesButton
|
||||||
{
|
{
|
||||||
Action = () => RepliesRequested(this, ++currentPage)
|
Action = () => RepliesRequested(this, ++currentPage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
chevronButton = new ChevronButton
|
new Container
|
||||||
{
|
{
|
||||||
|
Size = new Vector2(70, 40),
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
Margin = new MarginPadding { Right = 30, Top = margin },
|
Margin = new MarginPadding { Horizontal = 5 },
|
||||||
|
Child = chevronButton = new ChevronButton
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
Expanded = { BindTarget = childrenExpanded },
|
Expanded = { BindTarget = childrenExpanded },
|
||||||
Alpha = 0
|
Alpha = 0
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Comment.UserId.HasValue)
|
if (Comment.UserId.HasValue)
|
||||||
@ -247,10 +247,9 @@ namespace osu.Game.Overlays.Comments
|
|||||||
{
|
{
|
||||||
info.Add(new OsuSpriteText
|
info.Add(new OsuSpriteText
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular),
|
||||||
Origin = Anchor.CentreLeft,
|
Text = $@"edited {HumanizerUtils.Humanize(Comment.EditedAt.Value)} by {Comment.EditedUser.Username}",
|
||||||
Font = OsuFont.GetFont(size: 12),
|
Colour = colourProvider.Foreground1
|
||||||
Text = $@"edited {HumanizerUtils.Humanize(Comment.EditedAt.Value)} by {Comment.EditedUser.Username}"
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,35 +356,21 @@ namespace osu.Game.Overlays.Comments
|
|||||||
showMoreButton.IsLoading = loadRepliesButton.IsLoading = false;
|
showMoreButton.IsLoading = loadRepliesButton.IsLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ChevronButton : ShowChildrenButton
|
private MarginPadding getPadding(bool isTopLevel)
|
||||||
{
|
{
|
||||||
private readonly SpriteIcon icon;
|
if (isTopLevel)
|
||||||
|
|
||||||
public ChevronButton()
|
|
||||||
{
|
{
|
||||||
Child = icon = new SpriteIcon
|
return new MarginPadding
|
||||||
{
|
{
|
||||||
Size = new Vector2(12),
|
Horizontal = 70,
|
||||||
|
Vertical = 15
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnExpandedChanged(ValueChangedEvent<bool> expanded)
|
return new MarginPadding
|
||||||
{
|
{
|
||||||
icon.Icon = expanded.NewValue ? FontAwesome.Solid.ChevronUp : FontAwesome.Solid.ChevronDown;
|
Top = 10
|
||||||
}
|
};
|
||||||
}
|
|
||||||
|
|
||||||
private class ShowMoreButton : GetCommentRepliesButton
|
|
||||||
{
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OverlayColourProvider colourProvider)
|
|
||||||
{
|
|
||||||
Margin = new MarginPadding { Vertical = 10, Left = 80 };
|
|
||||||
IdleColour = colourProvider.Light2;
|
|
||||||
HoverColour = colourProvider.Light1;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string GetText() => @"Show More";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ParentUsername : FillFlowContainer, IHasTooltip
|
private class ParentUsername : FillFlowContainer, IHasTooltip
|
||||||
|
@ -1,33 +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 osu.Framework.Graphics;
|
|
||||||
using osu.Game.Graphics.Containers;
|
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osuTK.Graphics;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Comments
|
|
||||||
{
|
|
||||||
public abstract class ShowChildrenButton : OsuHoverContainer
|
|
||||||
{
|
|
||||||
public readonly BindableBool Expanded = new BindableBool(true);
|
|
||||||
|
|
||||||
protected ShowChildrenButton()
|
|
||||||
{
|
|
||||||
AutoSizeAxes = Axes.Both;
|
|
||||||
IdleColour = OsuColour.Gray(0.7f);
|
|
||||||
HoverColour = Color4.White;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
Action = Expanded.Toggle;
|
|
||||||
|
|
||||||
Expanded.BindValueChanged(OnExpandedChanged, true);
|
|
||||||
base.LoadComplete();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void OnExpandedChanged(ValueChangedEvent<bool> expanded);
|
|
||||||
}
|
|
||||||
}
|
|
@ -330,7 +330,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
if (Beatmap.Value.Track.IsRunning)
|
if (Beatmap.Value.Track.IsRunning)
|
||||||
{
|
{
|
||||||
var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value.Track.CurrentAmplitudes.Maximum : 0;
|
var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value.Track.CurrentAmplitudes.Maximum : 0;
|
||||||
logoAmplitudeContainer.ScaleTo(1 - Math.Max(0, maxAmplitude - scale_adjust_cutoff) * 0.04f, 75, Easing.OutQuint);
|
logoAmplitudeContainer.Scale = new Vector2((float)Interpolation.Damp(logoAmplitudeContainer.Scale.X, 1 - Math.Max(0, maxAmplitude - scale_adjust_cutoff) * 0.04f, 0.9f, Time.Elapsed));
|
||||||
|
|
||||||
if (maxAmplitude > velocity_adjust_cutoff)
|
if (maxAmplitude > velocity_adjust_cutoff)
|
||||||
triangles.Velocity = 1 + Math.Max(0, maxAmplitude - velocity_adjust_cutoff) * 50;
|
triangles.Velocity = 1 + Math.Max(0, maxAmplitude - velocity_adjust_cutoff) * 50;
|
||||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
|
|
||||||
private const float max_alpha = 0.4f;
|
private const float max_alpha = 0.4f;
|
||||||
private const int fade_time = 400;
|
private const int fade_time = 400;
|
||||||
private const float gradient_size = 0.3f;
|
private const float gradient_size = 0.2f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The threshold under which the current player life should be considered low and the layer should start fading in.
|
/// The threshold under which the current player life should be considered low and the layer should start fading in.
|
||||||
@ -56,16 +56,16 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0)),
|
Colour = ColourInfo.GradientHorizontal(Color4.White, Color4.White.Opacity(0)),
|
||||||
Height = gradient_size,
|
Width = gradient_size,
|
||||||
},
|
},
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Height = gradient_size,
|
Width = gradient_size,
|
||||||
Colour = ColourInfo.GradientVertical(Color4.White.Opacity(0), Color4.White),
|
Colour = ColourInfo.GradientHorizontal(Color4.White.Opacity(0), Color4.White),
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.TopRight,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -12,6 +12,7 @@ using osu.Framework.Graphics.Audio;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Transforms;
|
using osu.Framework.Graphics.Transforms;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
namespace osu.Game.Skinning
|
namespace osu.Game.Skinning
|
||||||
{
|
{
|
||||||
@ -22,9 +23,13 @@ namespace osu.Game.Skinning
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private ISampleStore samples { get; set; }
|
private ISampleStore samples { get; set; }
|
||||||
|
|
||||||
|
private bool requestedPlaying;
|
||||||
|
|
||||||
public override bool RemoveWhenNotAlive => false;
|
public override bool RemoveWhenNotAlive => false;
|
||||||
public override bool RemoveCompletedTransforms => false;
|
public override bool RemoveCompletedTransforms => false;
|
||||||
|
|
||||||
|
private readonly AudioContainer<DrawableSample> samplesContainer;
|
||||||
|
|
||||||
public SkinnableSound(ISampleInfo hitSamples)
|
public SkinnableSound(ISampleInfo hitSamples)
|
||||||
: this(new[] { hitSamples })
|
: this(new[] { hitSamples })
|
||||||
{
|
{
|
||||||
@ -36,9 +41,99 @@ namespace osu.Game.Skinning
|
|||||||
InternalChild = samplesContainer = new AudioContainer<DrawableSample>();
|
InternalChild = samplesContainer = new AudioContainer<DrawableSample>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Bindable<bool> gameplayClockPaused;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader(true)]
|
||||||
|
private void load(GameplayClock gameplayClock)
|
||||||
|
{
|
||||||
|
// if in a gameplay context, pause sample playback when gameplay is paused.
|
||||||
|
gameplayClockPaused = gameplayClock?.IsPaused.GetBoundCopy();
|
||||||
|
gameplayClockPaused?.BindValueChanged(paused =>
|
||||||
|
{
|
||||||
|
if (requestedPlaying)
|
||||||
|
{
|
||||||
|
if (paused.NewValue)
|
||||||
|
stop();
|
||||||
|
// it's not easy to know if a sample has finished playing (to end).
|
||||||
|
// to keep things simple only resume playing looping samples.
|
||||||
|
else if (Looping)
|
||||||
|
play();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private bool looping;
|
private bool looping;
|
||||||
|
|
||||||
private readonly AudioContainer<DrawableSample> samplesContainer;
|
public bool Looping
|
||||||
|
{
|
||||||
|
get => looping;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == looping) return;
|
||||||
|
|
||||||
|
looping = value;
|
||||||
|
|
||||||
|
samplesContainer.ForEach(c => c.Looping = looping);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Play()
|
||||||
|
{
|
||||||
|
requestedPlaying = true;
|
||||||
|
play();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void play()
|
||||||
|
{
|
||||||
|
samplesContainer.ForEach(c =>
|
||||||
|
{
|
||||||
|
if (c.AggregateVolume.Value > 0)
|
||||||
|
c.Play();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Stop()
|
||||||
|
{
|
||||||
|
requestedPlaying = false;
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stop()
|
||||||
|
{
|
||||||
|
samplesContainer.ForEach(c => c.Stop());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||||
|
{
|
||||||
|
var channels = hitSamples.Select(s =>
|
||||||
|
{
|
||||||
|
var ch = skin.GetSample(s);
|
||||||
|
|
||||||
|
if (ch == null && allowFallback)
|
||||||
|
{
|
||||||
|
foreach (var lookup in s.LookupNames)
|
||||||
|
{
|
||||||
|
if ((ch = samples.Get($"Gameplay/{lookup}")) != null)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ch != null)
|
||||||
|
{
|
||||||
|
ch.Looping = looping;
|
||||||
|
ch.Volume.Value = s.Volume / 100.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ch;
|
||||||
|
}).Where(c => c != null);
|
||||||
|
|
||||||
|
samplesContainer.ChildrenEnumerable = channels.Select(c => new DrawableSample(c));
|
||||||
|
|
||||||
|
if (requestedPlaying)
|
||||||
|
Play();
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Re-expose AudioContainer
|
||||||
|
|
||||||
public BindableNumber<double> Volume => samplesContainer.Volume;
|
public BindableNumber<double> Volume => samplesContainer.Volume;
|
||||||
|
|
||||||
@ -48,8 +143,6 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
public BindableNumber<double> Tempo => samplesContainer.Tempo;
|
public BindableNumber<double> Tempo => samplesContainer.Tempo;
|
||||||
|
|
||||||
public override bool IsPresent => Scheduler.HasPendingTasks || IsPlaying;
|
|
||||||
|
|
||||||
public bool IsPlaying => samplesContainer.Any(s => s.Playing);
|
public bool IsPlaying => samplesContainer.Any(s => s.Playing);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -80,57 +173,6 @@ namespace osu.Game.Skinning
|
|||||||
public TransformSequence<DrawableAudioWrapper> TempoTo(double newTempo, double duration = 0, Easing easing = Easing.None) =>
|
public TransformSequence<DrawableAudioWrapper> TempoTo(double newTempo, double duration = 0, Easing easing = Easing.None) =>
|
||||||
samplesContainer.TempoTo(newTempo, duration, easing);
|
samplesContainer.TempoTo(newTempo, duration, easing);
|
||||||
|
|
||||||
public bool Looping
|
#endregion
|
||||||
{
|
|
||||||
get => looping;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == looping) return;
|
|
||||||
|
|
||||||
looping = value;
|
|
||||||
|
|
||||||
samplesContainer.ForEach(c => c.Looping = looping);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Play() => samplesContainer.ForEach(c =>
|
|
||||||
{
|
|
||||||
if (c.AggregateVolume.Value > 0)
|
|
||||||
c.Play();
|
|
||||||
});
|
|
||||||
|
|
||||||
public void Stop() => samplesContainer.ForEach(c => c.Stop());
|
|
||||||
|
|
||||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
|
||||||
{
|
|
||||||
bool wasPlaying = samplesContainer.Any(s => s.Playing);
|
|
||||||
|
|
||||||
var channels = hitSamples.Select(s =>
|
|
||||||
{
|
|
||||||
var ch = skin.GetSample(s);
|
|
||||||
|
|
||||||
if (ch == null && allowFallback)
|
|
||||||
{
|
|
||||||
foreach (var lookup in s.LookupNames)
|
|
||||||
{
|
|
||||||
if ((ch = samples.Get($"Gameplay/{lookup}")) != null)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ch != null)
|
|
||||||
{
|
|
||||||
ch.Looping = looping;
|
|
||||||
ch.Volume.Value = s.Volume / 100.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ch;
|
|
||||||
}).Where(c => c != null);
|
|
||||||
|
|
||||||
samplesContainer.ChildrenEnumerable = channels.Select(c => new DrawableSample(c));
|
|
||||||
|
|
||||||
if (wasPlaying)
|
|
||||||
Play();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user