Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split score multiplier and unranked label colours #2314

Merged
merged 13 commits into from
May 31, 2018
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class ManiaModDualStages : Mod, IPlayfieldTypeMod, IApplicableToBeatmapCo
public override string Name => "Dual Stages";
public override string ShortenedName => "DS";
public override string Description => @"Double the stages, double the fun!";
public override double ScoreMultiplier => 0;
public override double ScoreMultiplier => 1;

public void ApplyToBeatmapConverter(BeatmapConverter<ManiaHitObject> beatmapConverter)
{
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class ManiaModRandom : Mod, IApplicableToRulesetContainer<ManiaHitObject>
public override string ShortenedName => "RD";
public override FontAwesome Icon => FontAwesome.fa_osu_dice;
public override string Description => @"Shuffle around the keys!";
public override double ScoreMultiplier => 0;
public override double ScoreMultiplier => 1;

public void ApplyToRulesetContainer(RulesetContainer<ManiaHitObject> rulesetContainer)
{
Expand Down
3 changes: 1 addition & 2 deletions osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public class OsuModAutopilot : Mod
public override string ShortenedName => "AP";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_autopilot;
public override string Description => @"Automatic cursor movement - just follow the rhythm.";
public override double ScoreMultiplier => 0;
public override bool Ranked => false;
public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => new[] { typeof(OsuModSpunOut), typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail), typeof(ModAutoplay) };
}
}
13 changes: 7 additions & 6 deletions osu.Game.Tests/Visual/TestCaseMods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual
[Description("mod select and icon display")]
public class TestCaseMods : OsuTestCase
{
private const string unranked_suffix = " (Unranked)";
private const string unranked_suffix = "(Unranked)";

private RulesetStore rulesets;
private ModDisplay modDisplay;
Expand Down Expand Up @@ -105,7 +105,7 @@ private void testOsuMods(OsuRuleset ruleset)

private void testManiaMods(ManiaRuleset ruleset)
{
testMultiplierTextUnranked(ruleset.GetModsFor(ModType.Special).First(m => m is ManiaModRandom));
testRankedText(ruleset.GetModsFor(ModType.Special).First(m => m is ManiaModRandom));
}

private void testSingleMod(Mod mod)
Expand Down Expand Up @@ -182,13 +182,13 @@ private void testMultiplierTextColour(Mod mod, Color4 colour)
checkLabelColor(Color4.White);
}

private void testMultiplierTextUnranked(Mod mod)
private void testRankedText(Mod mod)
{
AddAssert("check for ranked", () => !modSelect.MultiplierLabel.Text.EndsWith(unranked_suffix));
AddAssert("check for ranked", () => !modSelect.RankedLabel.Text.Equals(unranked_suffix));

This comment was marked as off-topic.

This comment was marked as off-topic.

selectNext(mod);
AddAssert("check for unranked", () => modSelect.MultiplierLabel.Text.EndsWith(unranked_suffix));
AddAssert("check for unranked", () => modSelect.RankedLabel.Text.Equals(unranked_suffix));
selectPrevious(mod);
AddAssert("check for ranked", () => !modSelect.MultiplierLabel.Text.EndsWith(unranked_suffix));
AddAssert("check for ranked", () => !modSelect.RankedLabel.Text.Equals(unranked_suffix));
}

private void selectNext(Mod mod) => AddStep($"left click {mod.Name}", () => modSelect.GetModButton(mod)?.SelectNext(1));
Expand Down Expand Up @@ -224,6 +224,7 @@ public ModButton GetModButton(Mod mod)
}

public new OsuSpriteText MultiplierLabel => base.MultiplierLabel;
public new OsuSpriteText RankedLabel => base.RankedLabel;
public new TriangleButton DeselectAllButton => base.DeselectAllButton;

public new Color4 LowMultiplierColour => base.LowMultiplierColour;
Expand Down
41 changes: 34 additions & 7 deletions osu.Game/Overlays/Mods/ModSelectOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ public class ModSelectOverlay : WaveOverlayContainer
{
private const float content_width = 0.8f;

protected Color4 LowMultiplierColour, HighMultiplierColour;
protected Color4 LowMultiplierColour, HighMultiplierColour, RankedColour;

protected readonly TriangleButton DeselectAllButton;
protected readonly OsuSpriteText ScoreLabel;
protected readonly OsuSpriteText MultiplierLabel;
protected readonly OsuSpriteText RankedLabel;
private readonly FillFlowContainer footerContainer;

protected override bool BlockPassThroughKeyboard => false;
Expand All @@ -57,6 +59,7 @@ private void load(OsuColour colours, OsuGame osu, RulesetStore rulesets, AudioMa

LowMultiplierColour = colours.Red;
HighMultiplierColour = colours.Green;
RankedColour = colours.Blue;

This comment was marked as off-topic.


if (osu != null)
Ruleset.BindTo(osu.Ruleset);
Expand Down Expand Up @@ -97,16 +100,29 @@ private void updateMods()
ranked &= mod.Ranked;
}

MultiplierLabel.Text = $"{multiplier:N2}x";
if (!ranked)
MultiplierLabel.Text += " (Unranked)";
ScoreLabel.Text = "Score Multiplier:";

This comment was marked as off-topic.

if (multiplier > 1.0)
ScoreLabel.FadeColour(HighMultiplierColour, 200);
else if (multiplier < 1.0)
ScoreLabel.FadeColour(LowMultiplierColour, 200);
else
ScoreLabel.FadeColour(Color4.White, 200);

MultiplierLabel.Text = $"{multiplier:N2}x";
if (multiplier > 1.0)
MultiplierLabel.FadeColour(HighMultiplierColour, 200);
else if (multiplier < 1.0)
MultiplierLabel.FadeColour(LowMultiplierColour, 200);
else
MultiplierLabel.FadeColour(Color4.White, 200);

RankedLabel.Text = "(Unranked)";

This comment was marked as off-topic.

RankedLabel.FadeColour(RankedColour, 200);
RankedLabel.FadeOut(200);
if (!ranked)

This comment was marked as off-topic.

{
RankedLabel.FadeIn(200);
}
}

protected override void PopOut()
Expand Down Expand Up @@ -351,14 +367,14 @@ public ModSelectOverlay()
Right = 20
}
},
new OsuSpriteText
ScoreLabel = new OsuSpriteText
{
Text = @"Score Multiplier: ",

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

TextSize = 30,
Shadow = true,
Margin = new MarginPadding
{
Top = 5
Top = 5,
Right = 10
}
},
MultiplierLabel = new OsuSpriteText
Expand All @@ -370,6 +386,17 @@ public ModSelectOverlay()
{
Top = 5
}
},
RankedLabel = new OsuSpriteText
{
Font = @"Exo2.0-Bold",
TextSize = 30,
Shadow = true,
Margin = new MarginPadding
{
Top = 5,
Left = 10
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Rulesets/Mods/ModAutoplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public abstract class ModAutoplay : Mod, IApplicableFailOverride
public override string ShortenedName => "AT";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_auto;
public override string Description => "Watch a perfect automated play through the song.";
public override double ScoreMultiplier => 0;
public override double ScoreMultiplier => 1;
public bool AllowFail => false;
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail) };
}
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Rulesets/Mods/ModRelax.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public abstract class ModRelax : Mod
public override string Name => "Relax";
public override string ShortenedName => "RX";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_relax;
public override double ScoreMultiplier => 0;
public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModNoFail), typeof(ModSuddenDeath) };
}
}