Skip to content

Commit

Permalink
Merge pull request #483 from LumpBloom7/Ex-modifier
Browse files Browse the repository at this point in the history
Implement EX notes
  • Loading branch information
LumpBloom7 authored Sep 3, 2023
2 parents a81db96 + c9098d5 commit daa2f80
Show file tree
Hide file tree
Showing 20 changed files with 229 additions and 68 deletions.
3 changes: 2 additions & 1 deletion osu.Game.Rulesets.Sentakki/Mods/SentakkiModAutoplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public override ModReplayData CreateReplayData(IBeatmap beatmap, IReadOnlyList<M
typeof(ModPerfect),
typeof(ModNoFail),
typeof(SentakkiModAutoTouch),
typeof(SentakkiModChallenge)
typeof(SentakkiModChallenge),
typeof(SentakkiModRelax)
};

public void ApplyToDrawableHitObject(DrawableHitObject drawableHitObject)
Expand Down
30 changes: 30 additions & 0 deletions osu.Game.Rulesets.Sentakki/Mods/SentakkiModRelax.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Sentakki.Objects;

namespace osu.Game.Rulesets.Sentakki.Mods
{
public class SentakkiModRelax : Mod, IApplicableAfterBeatmapConversion
{
public override Type[] IncompatibleMods => new[]
{
typeof(ModAutoplay),
};

public override string Name => "Relax";

public override string Acronym => "RX";

public override LocalisableString Description => "All notes are EX notes, you've got nothing to prove!";

public override double ScoreMultiplier => 0.3;

public void ApplyToBeatmap(IBeatmap beatmap)
{
foreach (SentakkiHitObject ho in beatmap.HitObjects)
ho.Ex = true;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
}

var result = HitObject.HitWindows.ResultFor(timeOffset);

if (result == HitResult.None)
return;

if (HitObject.Ex && result.IsHit())
result = Result.Judgement.MaxResult;

ApplyResult(result);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,13 @@ protected override void LoadAsyncComplete()
AnimationDuration.BindValueChanged(_ => queueTransformReset(), true);
}

public Bindable<bool> ExBindable = new Bindable<bool>();

protected override void OnApply()
{
base.OnApply();
AccentColour.BindTo(HitObject.ColourBindable);
ExBindable.BindTo(HitObject.ExBindable);
}

protected void ApplyResult(HitResult result)
Expand All @@ -64,6 +67,7 @@ protected override void OnFree()
{
base.OnFree();
AccentColour.UnbindFrom(HitObject.ColourBindable);
ExBindable.UnbindFrom(HitObject.ExBindable);
}

protected override void Update()
Expand Down
4 changes: 4 additions & 0 deletions osu.Game.Rulesets.Sentakki/Objects/Drawables/DrawableTap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,13 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
}

var result = HitObject.HitWindows.ResultFor(timeOffset);

if (result == HitResult.None)
return;

if (HitObject.Ex && result.IsHit())
result = Result.Judgement.MaxResult;

ApplyResult(result);
}

Expand Down
7 changes: 5 additions & 2 deletions osu.Game.Rulesets.Sentakki/Objects/Drawables/DrawableTouch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private void load(SentakkiRulesetConfigManager? sentakkiConfigs)
{
sentakkiConfigs?.BindWith(SentakkiRulesetSettings.TouchAnimationDuration, AnimationDuration);

Size = new Vector2(105);
Size = new Vector2(100);
Origin = Anchor.Centre;
Anchor = Anchor.Centre;
AddRangeInternal(new Drawable[]
Expand Down Expand Up @@ -113,9 +113,12 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
return;

// Hit before the early Great window
if (timeOffset < 0 && result is not HitResult.Great)
if (timeOffset < 0 && result != Result.Judgement.MaxResult)
return;

if (ExBindable.Value && result.IsHit())
result = Result.Judgement.MaxResult;

ApplyResult(result);
}

Expand Down
53 changes: 44 additions & 9 deletions osu.Game.Rulesets.Sentakki/Objects/Drawables/Pieces/ShadowPiece.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,66 @@
using osu.Framework.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Game.Rulesets.Objects.Drawables;
using osuTK.Graphics;

namespace osu.Game.Rulesets.Sentakki.Objects.Drawables.Pieces
{
public partial class ShadowPiece : Container
{
private CircularContainer glowContainer;

private Bindable<bool> ExBindable = new Bindable<bool>(true);
private Bindable<Color4> AccentColour = new Bindable<Color4>();

private static readonly EdgeEffectParameters shadow_parameters = new EdgeEffectParameters
{
Type = EdgeEffectType.Shadow,
Radius = 15,
Colour = Color4.Black,
Hollow = true
};

public ShadowPiece()
{
RelativeSizeAxes = Axes.Both;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Padding = new MarginPadding(1);

Child = new CircularContainer
Child = glowContainer = new CircularContainer
{
Alpha = .5f,
Masking = true,
RelativeSizeAxes = Axes.Both,
EdgeEffect = new EdgeEffectParameters
{
Hollow = true,
Type = EdgeEffectType.Shadow,
Radius = 15,
Colour = Color4.Black,
}
EdgeEffect = shadow_parameters
};
}

[BackgroundDependencyLoader]
private void load(DrawableHitObject hitObject)
{
// Bind exnote
ExBindable.BindTo(((DrawableSentakkiHitObject)hitObject).ExBindable);
AccentColour.BindTo(hitObject.AccentColour);

AccentColour.BindValueChanged(_ => updateGlow());
ExBindable.BindValueChanged(_ => updateGlow(), true);
}

private void updateGlow()
{
if (!ExBindable.Value)
{
glowContainer.EdgeEffect = shadow_parameters;
return;
}

glowContainer.EdgeEffect = shadow_parameters with
{
Colour = AccentColour.Value
};
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,51 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Rulesets.Objects.Drawables;
using osuTK.Graphics;

namespace osu.Game.Rulesets.Sentakki.Objects.Drawables.Pieces.Slides
{
public partial class StarPiece : CompositeDrawable
{
private Sprite glowTexture = null!;

private Bindable<bool> ExBindable = new Bindable<bool>();

public StarPiece()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
}

[BackgroundDependencyLoader]
private void load(TextureStore textures)
private void load(TextureStore textures, DrawableHitObject? hitObject)
{
AddInternal(new Sprite
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Texture = textures.Get("star"),
AddRangeInternal(new Drawable[]{
glowTexture = new Sprite
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Texture = textures.Get("starGlow"),
Colour = Color4.Black
},
new Sprite
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Texture = textures.Get("star"),
}
});

if (hitObject is null)
return;

// Bind exnote
ExBindable.BindTo(((DrawableSentakkiHitObject)hitObject).ExBindable);
ExBindable.BindValueChanged(v => glowTexture.Colour = v.NewValue ? Color4.White : Color4.Black, true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,27 @@ public TouchBody()

InternalChildren = new Drawable[]
{
PieceContainer = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
createTouchShapeWith<TouchGlowPiece>(), // Meant for the drop shadow/glow
createTouchShapeWith<TouchPiece>(),
new DotPiece()
}
},
BorderContainer = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(105),
Size = new Vector2(100),
CornerRadius = 25f,
CornerExponent = 2.5f,
Masking = true,
BorderThickness = 15,
BorderThickness = 10,
BorderColour = Color4.White,
Alpha = 0,
Child = new Box
Expand All @@ -41,39 +53,6 @@ public TouchBody()
RelativeSizeAxes = Axes.Both
}
},
PieceContainer = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
new TouchPiece
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
new TouchPiece
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.TopCentre,
Rotation = 180
},
new TouchPiece
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.TopCentre,
Rotation = 270
},
new TouchPiece
{
Anchor = Anchor.CentreRight,
Origin = Anchor.TopCentre,
Rotation = 90
},
new DotPiece()
}
}
};
}

Expand All @@ -83,10 +62,37 @@ public TouchBody()
private void load(DrawableHitObject drawableObject)
{
accentColour.BindTo(drawableObject.AccentColour);
accentColour.BindValueChanged(colour =>
{
PieceContainer.Colour = colour.NewValue;
}, true);
accentColour.BindValueChanged(colour => PieceContainer.Colour = colour.NewValue, true);
}

// Creates the touch shape using the provided drawable as each of the 4 quarters
private Drawable createTouchShapeWith<T>() where T : Drawable, new()
=> new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]{
new T
{
Anchor = Anchor.TopCentre,
},
new T
{
Anchor = Anchor.BottomCentre,
Rotation = 180
},
new T
{
Anchor = Anchor.CentreLeft,
Rotation = 270
},
new T
{
Anchor = Anchor.CentreRight,
Rotation = 90
},
}
};
}
}
Loading

0 comments on commit daa2f80

Please sign in to comment.