mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 02:42:54 +08:00
Add "Argon" background wedges
This commit is contained in:
parent
56eeb117ce
commit
50af1574cf
27
osu.Game/Screens/Play/HUD/ArgonComboWedge.cs
Normal file
27
osu.Game/Screens/Play/HUD/ArgonComboWedge.cs
Normal file
@ -0,0 +1,27 @@
|
||||
// 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.Containers;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public partial class ArgonComboWedge : CompositeDrawable, ISerialisableDrawable
|
||||
{
|
||||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
InternalChild = new ArgonWedgePiece
|
||||
{
|
||||
WedgeWidth = { Value = 186 },
|
||||
WedgeHeight = { Value = 33 },
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
29
osu.Game/Screens/Play/HUD/ArgonRightWedge.cs
Normal file
29
osu.Game/Screens/Play/HUD/ArgonRightWedge.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.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public partial class ArgonRightWedge : CompositeDrawable, ISerialisableDrawable
|
||||
{
|
||||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
InternalChild = new ArgonWedgePiece
|
||||
{
|
||||
WedgeWidth = { Value = 274 },
|
||||
WedgeHeight = { Value = 40 },
|
||||
InvertShear = { Value = true },
|
||||
EndOpacity = 0.5f,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
83
osu.Game/Screens/Play/HUD/ArgonScoreWedge.cs
Normal file
83
osu.Game/Screens/Play/HUD/ArgonScoreWedge.cs
Normal file
@ -0,0 +1,83 @@
|
||||
// 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.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Lines;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public partial class ArgonScoreWedge : CompositeDrawable, ISerialisableDrawable
|
||||
{
|
||||
private SliderPath barPath = null!;
|
||||
|
||||
private const float main_path_radius = 1f;
|
||||
|
||||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
const float bar_length = 430 - main_path_radius * 2;
|
||||
const float bar_top = 0;
|
||||
const float bar_bottom = 80;
|
||||
const float curve_start = bar_length - 105;
|
||||
const float curve_end = bar_length - 35;
|
||||
|
||||
const float curve_smoothness = 10;
|
||||
|
||||
Vector2 diagonalDir = (new Vector2(curve_end, bar_top) - new Vector2(curve_start, bar_bottom)).Normalized();
|
||||
|
||||
barPath = new SliderPath(new[]
|
||||
{
|
||||
new PathControlPoint(new Vector2(0, bar_bottom), PathType.Linear),
|
||||
new PathControlPoint(new Vector2(curve_start - curve_smoothness, bar_bottom), PathType.Bezier),
|
||||
new PathControlPoint(new Vector2(curve_start, bar_bottom)),
|
||||
new PathControlPoint(new Vector2(curve_start, bar_bottom) + diagonalDir * curve_smoothness, PathType.Linear),
|
||||
new PathControlPoint(new Vector2(curve_end, bar_top) - diagonalDir * curve_smoothness, PathType.Bezier),
|
||||
new PathControlPoint(new Vector2(curve_end, bar_top)),
|
||||
new PathControlPoint(new Vector2(curve_end + curve_smoothness, bar_top), PathType.Linear),
|
||||
new PathControlPoint(new Vector2(bar_length, bar_top)),
|
||||
});
|
||||
|
||||
var vertices = new List<Vector2>();
|
||||
barPath.GetPathToProgress(vertices, 0, 1);
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
new ArgonWedgePiece
|
||||
{
|
||||
WedgeWidth = { Value = 380 },
|
||||
WedgeHeight = { Value = 72 },
|
||||
},
|
||||
new ArgonWedgePiece
|
||||
{
|
||||
WedgeWidth = { Value = 380 },
|
||||
WedgeHeight = { Value = 72 },
|
||||
Position = new Vector2(4, 5)
|
||||
},
|
||||
new SmoothPath
|
||||
{
|
||||
Colour = Color4.White,
|
||||
PathRadius = 1f,
|
||||
Vertices = vertices,
|
||||
},
|
||||
new Circle
|
||||
{
|
||||
Y = bar_bottom - 1.5f + main_path_radius,
|
||||
Size = new Vector2(300f, 3f),
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
69
osu.Game/Screens/Play/HUD/ArgonWedgePiece.cs
Normal file
69
osu.Game/Screens/Play/HUD/ArgonWedgePiece.cs
Normal file
@ -0,0 +1,69 @@
|
||||
// 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.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public partial class ArgonWedgePiece : CompositeDrawable, ISerialisableDrawable
|
||||
{
|
||||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
public float EndOpacity { get; init; } = 0.25f;
|
||||
|
||||
[SettingSource("Wedge width")]
|
||||
public BindableFloat WedgeWidth { get; } = new BindableFloat(400f)
|
||||
{
|
||||
MinValue = 0f,
|
||||
MaxValue = 500f,
|
||||
Precision = 1f,
|
||||
};
|
||||
|
||||
[SettingSource("Wedge height")]
|
||||
public BindableFloat WedgeHeight { get; } = new BindableFloat(100f)
|
||||
{
|
||||
MinValue = 0f,
|
||||
MaxValue = 500f,
|
||||
Precision = 1f,
|
||||
};
|
||||
|
||||
[SettingSource("Inverted shear")]
|
||||
public BindableBool InvertShear { get; } = new BindableBool();
|
||||
|
||||
public ArgonWedgePiece()
|
||||
{
|
||||
CornerRadius = 10f;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Masking = true;
|
||||
Shear = new Vector2(0.8f, 0f);
|
||||
|
||||
InternalChild = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = ColourInfo.GradientVertical(Color4Extensions.FromHex("#66CCFF").Opacity(0.0f), Color4Extensions.FromHex("#66CCFF").Opacity(EndOpacity)),
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
WedgeWidth.BindValueChanged(v => Width = v.NewValue, true);
|
||||
WedgeHeight.BindValueChanged(v => Height = v.NewValue, true);
|
||||
InvertShear.BindValueChanged(v => Shear = new Vector2(0.8f, 0f) * (v.NewValue ? -1 : 1), true);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user