mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 20:52:54 +08:00
Removed amplitude container
This commit is contained in:
parent
ad66587273
commit
2c23703ca6
@ -19,7 +19,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
public class TwoLayerButton : ClickableContainer
|
public class TwoLayerButton : ClickableContainer
|
||||||
{
|
{
|
||||||
private readonly IconBeatSyncedContainer iconBeatSyncedContainer;
|
private readonly BouncingIcon bouncingIcon;
|
||||||
|
|
||||||
public Box IconLayer;
|
public Box IconLayer;
|
||||||
public Box TextLayer;
|
public Box TextLayer;
|
||||||
@ -98,7 +98,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
iconBeatSyncedContainer = new IconBeatSyncedContainer
|
bouncingIcon = new BouncingIcon
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -148,7 +148,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
iconBeatSyncedContainer.Icon = value;
|
bouncingIcon.Icon = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,27 +200,19 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
return base.OnClick(state);
|
return base.OnClick(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class IconBeatSyncedContainer : BeatSyncedContainer
|
private class BouncingIcon : BeatSyncedContainer
|
||||||
{
|
{
|
||||||
private const double beat_in_time = 60;
|
private const double beat_in_time = 60;
|
||||||
|
|
||||||
private readonly TextAwesome icon;
|
private readonly TextAwesome icon;
|
||||||
private readonly Container amplitudeContainer;
|
|
||||||
|
|
||||||
public FontAwesome Icon { set { icon.Icon = value; } }
|
public FontAwesome Icon { set { icon.Icon = value; } }
|
||||||
|
|
||||||
public IconBeatSyncedContainer()
|
public BouncingIcon()
|
||||||
{
|
{
|
||||||
EarlyActivationMilliseconds = beat_in_time;
|
EarlyActivationMilliseconds = beat_in_time;
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
amplitudeContainer = new Container
|
|
||||||
{
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
icon = new TextAwesome
|
icon = new TextAwesome
|
||||||
@ -229,19 +221,13 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
TextSize = 25
|
TextSize = 25
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private int lastBeatIndex;
|
|
||||||
|
|
||||||
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
|
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
|
||||||
{
|
{
|
||||||
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
|
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
|
||||||
|
|
||||||
lastBeatIndex = beatIndex;
|
|
||||||
|
|
||||||
var beatLength = timingPoint.BeatLength;
|
var beatLength = timingPoint.BeatLength;
|
||||||
|
|
||||||
float amplitudeAdjust = Math.Min(1, 0.4f + amplitudes.Maximum);
|
float amplitudeAdjust = Math.Min(1, 0.4f + amplitudes.Maximum);
|
||||||
@ -252,16 +238,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
using (icon.BeginDelayedSequence(beat_in_time))
|
using (icon.BeginDelayedSequence(beat_in_time))
|
||||||
icon.ScaleTo(1, beatLength * 2, EasingTypes.OutQuint);
|
icon.ScaleTo(1, beatLength * 2, EasingTypes.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
|
||||||
base.Update();
|
|
||||||
|
|
||||||
const float scale_adjust_cutoff = 0.4f;
|
|
||||||
|
|
||||||
var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value?.Track?.CurrentAmplitudes.Maximum ?? 0 : 0;
|
|
||||||
amplitudeContainer.ScaleTo(1 - Math.Max(0, maxAmplitude - scale_adjust_cutoff) * 0.1f, 75, EasingTypes.OutQuint);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user