Add amplitude adjust

This commit is contained in:
Dean Herbert 2017-05-24 01:45:01 +09:00
parent f57b234cc3
commit 7e827c4f11

View File

@ -31,6 +31,7 @@ namespace osu.Game.Screens.Menu
private readonly CircularContainer logoContainer;
private readonly Container logoBounceContainer;
private readonly Container logoBeatContainer;
private readonly Container logoAmplitudeContainer;
private readonly Container logoHoverContainer;
private SampleChannel sampleClick;
@ -112,6 +113,11 @@ namespace osu.Game.Screens.Menu
}
}
},
logoAmplitudeContainer = new Container
{
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
logoBeatContainer = new Container
{
AutoSizeAxes = Axes.Both,
@ -201,47 +207,63 @@ namespace osu.Game.Screens.Menu
}
}
}
}
}
};
}
[BackgroundDependencyLoader]
private void load(TextureStore textures, AudioManager audio)
private void load(TextureStore textures, AudioManager audio, OsuGameBase game)
{
sampleClick = audio.Sample.Get(@"Menu/menuhit");
logo.Texture = textures.Get(@"Menu/logo");
ripple.Texture = textures.Get(@"Menu/logo");
}
private int lastBeatIndex;
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
{
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
lastBeatIndex = beatIndex;
var beatLength = timingPoint.BeatLength;
float amplitudeAdjust = Math.Min(1, 0.4f + amplitudes.Maximum);
if (beatIndex < 0) return;
logoBeatContainer.ScaleTo(0.98f, beat_in_time, EasingTypes.Out);
logoBeatContainer.ScaleTo(1 - 0.02f * amplitudeAdjust, beat_in_time, EasingTypes.Out);
using (logoBeatContainer.BeginDelayedSequence(beat_in_time))
logoBeatContainer.ScaleTo(1, beatLength * 2, EasingTypes.OutQuint);
ripple.ClearTransforms();
ripple.ScaleTo(Vector2.One);
ripple.Alpha = 0.15f;
ripple.ScaleTo(logoAmplitudeContainer.Scale);
ripple.Alpha = 0.15f * amplitudeAdjust;
ripple.ScaleTo(ripple.Scale * 1.04f, beatLength, EasingTypes.OutQuint);
ripple.FadeOut(beatLength);
ripple.ScaleTo(logoAmplitudeContainer.Scale * (1 + 0.04f * amplitudeAdjust), beatLength, EasingTypes.OutQuint);
ripple.FadeOut(beatLength, EasingTypes.OutQuint);
if (effectPoint.KiaiMode && flashLayer.Alpha < 0.4f)
{
flashLayer.ClearTransforms();
flashLayer.FadeTo(0.14f, beat_in_time, EasingTypes.Out);
flashLayer.FadeTo(0.2f * amplitudeAdjust, beat_in_time, EasingTypes.Out);
using (flashLayer.BeginDelayedSequence(beat_in_time))
flashLayer.FadeOut(beatLength);
}
}
protected override void Update()
{
base.Update();
var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value.Track.CurrentAmplitudes.Maximum : 0;
logoAmplitudeContainer.ScaleTo(1 - maxAmplitude * 0.04f, 50, EasingTypes.OutQuint);
}
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{
if (!Interactive) return false;