mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 12:32:56 +08:00
Made blinds open during breaks and start
This commit is contained in:
parent
633e8fafee
commit
c9ea5ce817
@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
if (mod is ModHardRock)
|
if (mod is ModHardRock)
|
||||||
hasHardrock = true;
|
hasHardrock = true;
|
||||||
}
|
}
|
||||||
rulesetContainer.Overlays.Add(flashlight = new DrawableOsuBlinds(restrictTo: rulesetContainer.Playfield, hasEasy: hasEasy, hasHardrock: hasHardrock));
|
rulesetContainer.Overlays.Add(flashlight = new DrawableOsuBlinds(rulesetContainer.Playfield, hasEasy, hasHardrock, rulesetContainer.Beatmap));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
|
public override void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
|
||||||
|
@ -11,6 +11,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
||||||
using System;
|
using System;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||||
{
|
{
|
||||||
@ -22,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Black background boxes behind blind panel textures.
|
/// Black background boxes behind blind panel textures.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Box box1, box2;
|
private Box blackBoxLeft, blackBoxRight;
|
||||||
private Sprite panelLeft, panelRight;
|
private Sprite panelLeft, panelRight;
|
||||||
private Sprite bgPanelLeft, bgPanelRight;
|
private Sprite bgPanelLeft, bgPanelRight;
|
||||||
|
|
||||||
@ -30,12 +31,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
private Drawable randomNpc;
|
private Drawable randomNpc;
|
||||||
private const float npc_movement_start = 1.5f;
|
private const float npc_movement_start = 1.5f;
|
||||||
private float npcPosition = npc_movement_start;
|
private float npcPosition = npc_movement_start;
|
||||||
private bool animatingNpc;
|
private bool animatingBlinds;
|
||||||
|
private Beatmap<OsuHitObject> beatmap;
|
||||||
private Random random;
|
private Random random;
|
||||||
|
|
||||||
private ISkinSource skin;
|
private ISkinSource skin;
|
||||||
|
|
||||||
private float targetClamp = 1;
|
private float targetClamp = 1;
|
||||||
|
private float targetBreakMultiplier = 0;
|
||||||
private float target = 1;
|
private float target = 1;
|
||||||
private readonly float easing = 1;
|
private readonly float easing = 1;
|
||||||
|
|
||||||
@ -60,14 +63,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private const float leniency = 0.1f;
|
private const float leniency = 0.1f;
|
||||||
|
|
||||||
/// <summary>
|
public DrawableOsuBlinds(Container restrictTo, bool hasEasy, bool hasHardrock, Beatmap<OsuHitObject> beatmap)
|
||||||
/// Multiplier for adding a gap when the Easy mod is also currently applied.
|
|
||||||
/// </summary>
|
|
||||||
private const float easy_position_multiplier = 0.95f;
|
|
||||||
|
|
||||||
public DrawableOsuBlinds(Container restrictTo, bool hasEasy, bool hasHardrock)
|
|
||||||
{
|
{
|
||||||
this.restrictTo = restrictTo;
|
this.restrictTo = restrictTo;
|
||||||
|
this.beatmap = beatmap;
|
||||||
|
|
||||||
modEasy = hasEasy;
|
modEasy = hasEasy;
|
||||||
modHardrock = hasHardrock;
|
modHardrock = hasHardrock;
|
||||||
@ -80,7 +79,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
Width = 1;
|
Width = 1;
|
||||||
Height = 1;
|
Height = 1;
|
||||||
|
|
||||||
Add(box1 = new Box
|
Add(blackBoxLeft = new Box
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopLeft,
|
Anchor = Anchor.TopLeft,
|
||||||
Origin = Anchor.TopLeft,
|
Origin = Anchor.TopLeft,
|
||||||
@ -90,7 +89,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
Height = 1,
|
Height = 1,
|
||||||
Depth = black_depth
|
Depth = black_depth
|
||||||
});
|
});
|
||||||
Add(box2 = new Box
|
Add(blackBoxRight = new Box
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
@ -161,28 +160,22 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
private float applyGap(float value)
|
private float applyGap(float value)
|
||||||
{
|
{
|
||||||
float ret;
|
const float easy_multiplier = 0.95f;
|
||||||
|
const float hardrock_multiplier = 1.1f;
|
||||||
|
|
||||||
|
float multiplier = 1;
|
||||||
if (modEasy)
|
if (modEasy)
|
||||||
{
|
{
|
||||||
const float multiplier = 0.95f;
|
multiplier = easy_multiplier;
|
||||||
ret = value * multiplier;
|
// TODO: include OD/CS
|
||||||
}
|
}
|
||||||
else if (modHardrock)
|
else if (modHardrock)
|
||||||
{
|
{
|
||||||
const float multiplier = 1.1f;
|
multiplier = hardrock_multiplier;
|
||||||
ret = value * multiplier;
|
// TODO: include OD/CS
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ret = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret > targetClamp)
|
return OpenTK.MathHelper.Clamp(value * multiplier, 0, targetClamp) * targetBreakMultiplier;
|
||||||
return targetClamp;
|
|
||||||
else if (ret < 0)
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static float applyAdjustmentCurve(float value)
|
private static float applyAdjustmentCurve(float value)
|
||||||
@ -201,8 +194,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
float width = (end - start) * 0.5f * applyAdjustmentCurve(applyGap(easing));
|
float width = (end - start) * 0.5f * applyAdjustmentCurve(applyGap(easing));
|
||||||
// different values in case the playfield ever moves from center to somewhere else.
|
// different values in case the playfield ever moves from center to somewhere else.
|
||||||
box1.Width = start + width;
|
blackBoxLeft.Width = start + width;
|
||||||
box2.Width = DrawWidth - end + width;
|
blackBoxRight.Width = DrawWidth - end + width;
|
||||||
|
|
||||||
panelLeft.X = start + width;
|
panelLeft.X = start + width;
|
||||||
panelRight.X = end - width;
|
panelRight.X = end - width;
|
||||||
@ -215,9 +208,45 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
bgRandomNpc.X = adjustedNpcPosition;
|
bgRandomNpc.X = adjustedNpcPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
const float break_open_early = 500;
|
||||||
|
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
var firstObj = beatmap.HitObjects[0];
|
||||||
|
var startDelay = firstObj.StartTime - firstObj.TimePreempt - firstObj.TimeFadeIn;
|
||||||
|
|
||||||
|
using (BeginAbsoluteSequence(startDelay, true))
|
||||||
|
LeaveBreak();
|
||||||
|
|
||||||
|
foreach (var breakInfo in beatmap.Breaks)
|
||||||
|
{
|
||||||
|
if (breakInfo.HasEffect)
|
||||||
|
{
|
||||||
|
using (BeginAbsoluteSequence(breakInfo.StartTime - break_open_early, true))
|
||||||
|
{
|
||||||
|
EnterBreak();
|
||||||
|
using (BeginDelayedSequence(breakInfo.Duration + break_open_early, true))
|
||||||
|
LeaveBreak();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EnterBreak()
|
||||||
|
{
|
||||||
|
this.TransformTo(nameof(targetBreakMultiplier), 0f, 1000, Easing.OutSine);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LeaveBreak()
|
||||||
|
{
|
||||||
|
this.TransformTo(nameof(targetBreakMultiplier), 1f, 2500, Easing.OutBounce);
|
||||||
|
}
|
||||||
|
|
||||||
public void TriggerNpc()
|
public void TriggerNpc()
|
||||||
{
|
{
|
||||||
if (animatingNpc)
|
if (animatingBlinds)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool left = (random.Next() & 1) != 0;
|
bool left = (random.Next() & 1) != 0;
|
||||||
@ -257,9 +286,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
ChangeChildDepth(panelRight, fg_panel_depth);
|
ChangeChildDepth(panelRight, fg_panel_depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
animatingNpc = true;
|
animatingBlinds = true;
|
||||||
npcPosition = start;
|
npcPosition = start;
|
||||||
this.TransformTo(nameof(npcPosition), end, 3000, Easing.OutSine).Finally(_ => animatingNpc = false);
|
this.TransformTo(nameof(npcPosition), end, 3000, Easing.OutSine).Finally(_ => animatingBlinds = false);
|
||||||
|
|
||||||
targetClamp = 1;
|
targetClamp = 1;
|
||||||
this.Delay(600).TransformTo(nameof(targetClamp), 0.6f, 300).Delay(500).TransformTo(nameof(targetClamp), 1f, 300);
|
this.Delay(600).TransformTo(nameof(targetClamp), 0.6f, 300).Delay(500).TransformTo(nameof(targetClamp), 1f, 300);
|
||||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
Height = Parent?.DrawHeight ?? 0;
|
Height = Parent?.DrawHeight ?? 0;
|
||||||
if (Height == 0 || Texture is null)
|
if (Height == 0 || Texture == null)
|
||||||
Width = 0;
|
Width = 0;
|
||||||
else
|
else
|
||||||
Width = Texture.Width / (float)Texture.Height * Height;
|
Width = Texture.Width / (float)Texture.Height * Height;
|
||||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
public override string Name => "Blinds";
|
public override string Name => "Blinds";
|
||||||
public override string ShortenedName => "BL";
|
public override string ShortenedName => "BL";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_flashlight;
|
public override FontAwesome Icon => FontAwesome.fa_adjust;
|
||||||
public override ModType Type => ModType.DifficultyIncrease;
|
public override ModType Type => ModType.DifficultyIncrease;
|
||||||
public override string Description => "Play with blinds on your screen.";
|
public override string Description => "Play with blinds on your screen.";
|
||||||
public override bool Ranked => false;
|
public override bool Ranked => false;
|
||||||
|
Loading…
Reference in New Issue
Block a user