mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 12:23:22 +08:00
Merge branch 'master' into skin-editor-nrt
This commit is contained in:
commit
98c9ba5b6f
@ -4,29 +4,38 @@
|
||||
#nullable disable
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public partial class TestSceneHitCircleKiai : TestSceneHitCircle
|
||||
public partial class TestSceneHitCircleKiai : TestSceneHitCircle, IBeatSyncProvider
|
||||
{
|
||||
private ControlPointInfo controlPoints { get; set; }
|
||||
|
||||
[SetUp]
|
||||
public void SetUp() => Schedule(() =>
|
||||
{
|
||||
var controlPointInfo = new ControlPointInfo();
|
||||
controlPoints = new ControlPointInfo();
|
||||
|
||||
controlPointInfo.Add(0, new TimingControlPoint { BeatLength = 500 });
|
||||
controlPointInfo.Add(0, new EffectControlPoint { KiaiMode = true });
|
||||
controlPoints.Add(0, new TimingControlPoint { BeatLength = 500 });
|
||||
controlPoints.Add(0, new EffectControlPoint { KiaiMode = true });
|
||||
|
||||
Beatmap.Value = CreateWorkingBeatmap(new Beatmap
|
||||
{
|
||||
ControlPointInfo = controlPointInfo
|
||||
ControlPointInfo = controlPoints
|
||||
});
|
||||
|
||||
// track needs to be playing for BeatSyncedContainer to work.
|
||||
Beatmap.Value.Track.Start();
|
||||
});
|
||||
|
||||
ChannelAmplitudes IHasAmplitudes.CurrentAmplitudes => new ChannelAmplitudes();
|
||||
ControlPointInfo IBeatSyncProvider.ControlPoints => controlPoints;
|
||||
IClock IBeatSyncProvider.Clock => Clock;
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
private readonly IBindable<Color4> accentColour = new Bindable<Color4>();
|
||||
private readonly IBindable<int> indexInCurrentCombo = new Bindable<int>();
|
||||
private readonly FlashPiece flash;
|
||||
private readonly Container kiaiContainer;
|
||||
|
||||
private Bindable<bool> configHitLighting = null!;
|
||||
|
||||
@ -82,6 +83,17 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
kiaiContainer = new CircularContainer
|
||||
{
|
||||
Masking = true,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = Size,
|
||||
Child = new KiaiFlash
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
}
|
||||
},
|
||||
number = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.Default.With(size: 52, weight: FontWeight.Bold),
|
||||
@ -119,6 +131,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
outerGradient.ClearTransforms(targetMember: nameof(Colour));
|
||||
outerGradient.Colour = ColourInfo.GradientVertical(colour.NewValue, colour.NewValue.Darken(0.1f));
|
||||
|
||||
kiaiContainer.Colour = colour.NewValue;
|
||||
outerFill.Colour = innerFill.Colour = colour.NewValue.Darken(4);
|
||||
innerGradient.Colour = ColourInfo.GradientVertical(colour.NewValue.Darken(0.5f), colour.NewValue.Darken(0.6f));
|
||||
flash.Colour = colour.NewValue;
|
||||
@ -180,6 +193,11 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
// gradient layers.
|
||||
border.ResizeTo(Size * shrink_size + new Vector2(border.BorderThickness), resize_duration, Easing.OutElasticHalf);
|
||||
|
||||
// Kiai flash should track the overall size but also be cleaned up quite fast, so we don't get additional
|
||||
// flashes after the hit animation is already in a mostly-completed state.
|
||||
kiaiContainer.ResizeTo(Size * shrink_size, resize_duration, Easing.OutElasticHalf);
|
||||
kiaiContainer.FadeOut(flash_in_duration, Easing.OutQuint);
|
||||
|
||||
// The outer gradient is resize with a slight delay from the border.
|
||||
// This is to give it a bomb-like effect, with the border "triggering" its animation when getting close.
|
||||
using (BeginDelayedSequence(flash_in_duration / 12))
|
||||
|
@ -268,7 +268,10 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
Stream storyboardFileStream = null;
|
||||
|
||||
if (BeatmapSetInfo?.Files.FirstOrDefault(f => f.Filename.EndsWith(".osb", StringComparison.OrdinalIgnoreCase))?.Filename is string storyboardFilename)
|
||||
string mainStoryboardFilename = getMainStoryboardFilename(BeatmapSetInfo.Metadata);
|
||||
|
||||
if (BeatmapSetInfo?.Files.FirstOrDefault(f => f.Filename.Equals(mainStoryboardFilename, StringComparison.OrdinalIgnoreCase))?.Filename is string
|
||||
storyboardFilename)
|
||||
{
|
||||
string storyboardFileStorePath = BeatmapSetInfo?.GetPathForFile(storyboardFilename);
|
||||
storyboardFileStream = GetStream(storyboardFileStorePath);
|
||||
@ -312,6 +315,33 @@ namespace osu.Game.Beatmaps
|
||||
}
|
||||
|
||||
public override Stream GetStream(string storagePath) => resources.Files.GetStream(storagePath);
|
||||
|
||||
private string getMainStoryboardFilename(IBeatmapMetadataInfo metadata)
|
||||
{
|
||||
// Matches stable implementation, because it's probably simpler than trying to do anything else.
|
||||
// This may need to be reconsidered after we begin storing storyboards in the new editor.
|
||||
return windowsFilenameStrip(
|
||||
(metadata.Artist.Length > 0 ? metadata.Artist + @" - " + metadata.Title : Path.GetFileNameWithoutExtension(metadata.AudioFile))
|
||||
+ (metadata.Author.Username.Length > 0 ? @" (" + metadata.Author.Username + @")" : string.Empty)
|
||||
+ @".osb");
|
||||
|
||||
string windowsFilenameStrip(string entry)
|
||||
{
|
||||
// Inlined from Path.GetInvalidFilenameChars() to ensure the windows characters are used (to match stable).
|
||||
char[] invalidCharacters =
|
||||
{
|
||||
'\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
|
||||
'\x08', '\x09', '\x0A', '\x0B', '\x0C', '\x0D', '\x0E', '\x0F', '\x10', '\x11', '\x12',
|
||||
'\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1A', '\x1B', '\x1C', '\x1D',
|
||||
'\x1E', '\x1F', '\x22', '\x3C', '\x3E', '\x7C', ':', '*', '?', '\\', '/'
|
||||
};
|
||||
|
||||
foreach (char c in invalidCharacters)
|
||||
entry = entry.Replace(c.ToString(), string.Empty);
|
||||
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user