1
0
mirror of https://github.com/ppy/osu synced 2025-03-21 18:38:25 +00:00

Merge branch 'master' into diffcalc-fixes

This commit is contained in:
Dean Herbert 2018-05-12 21:01:58 +09:00 committed by GitHub
commit 36af7feab3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 11 deletions
osu-framework
osu.Game.Tests/Visual
osu.Game/Overlays/Mods

@ -1 +1 @@
Subproject commit 8c4f23269447d9ce21a5dbd3a0fd4f6caae9ab38 Subproject commit f8079973011b54e84e5c0e677fe2b56e55947666

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.ComponentModel; using System.ComponentModel;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -17,6 +18,7 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Mania;
using osu.Game.Rulesets.Mania.Mods; using osu.Game.Rulesets.Mania.Mods;
using osu.Game.Rulesets.UI;
using OpenTK.Graphics; using OpenTK.Graphics;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
@ -24,6 +26,19 @@ namespace osu.Game.Tests.Visual
[Description("mod select and icon display")] [Description("mod select and icon display")]
public class TestCaseMods : OsuTestCase public class TestCaseMods : OsuTestCase
{ {
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(ModSelectOverlay),
typeof(ModDisplay),
typeof(ModSection),
typeof(ModIcon),
typeof(ModButton),
typeof(ModButtonEmpty),
typeof(DifficultyReductionSection),
typeof(DifficultyIncreaseSection),
typeof(SpecialSection),
};
private const string unranked_suffix = " (Unranked)"; private const string unranked_suffix = " (Unranked)";
private RulesetStore rulesets; private RulesetStore rulesets;
@ -66,7 +81,8 @@ namespace osu.Game.Tests.Visual
Ruleset ruleset = rulesetInfo.CreateInstance(); Ruleset ruleset = rulesetInfo.CreateInstance();
AddStep($"switch to {ruleset.Description}", () => modSelect.Ruleset.Value = rulesetInfo); AddStep($"switch to {ruleset.Description}", () => modSelect.Ruleset.Value = rulesetInfo);
switch (ruleset) { switch (ruleset)
{
case OsuRuleset or: case OsuRuleset or:
testOsuMods(or); testOsuMods(or);
break; break;

View File

@ -116,6 +116,7 @@ namespace osu.Game.Overlays.Mods
} }
private Mod mod; private Mod mod;
private readonly Container scaleContainer;
public Mod Mod public Mod Mod
{ {
@ -149,14 +150,26 @@ namespace osu.Game.Overlays.Mods
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{ {
switch (args.Button) scaleContainer.ScaleTo(0.9f, 800, Easing.Out);
return base.OnMouseDown(state, args);
}
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
{
scaleContainer.ScaleTo(1, 500, Easing.OutElastic);
// only trigger the event if we are inside the area of the button
if (Contains(ToScreenSpace(state.Mouse.Position - Position)))
{ {
case MouseButton.Left: switch (args.Button)
SelectNext(1); {
break; case MouseButton.Left:
case MouseButton.Right: SelectNext(1);
SelectNext(-1); break;
break; case MouseButton.Right:
SelectNext(-1);
break;
}
} }
return true; return true;
@ -176,7 +189,8 @@ namespace osu.Game.Overlays.Mods
start = Mods.Length - 1; start = Mods.Length - 1;
for (int i = start; i < Mods.Length && i >= 0; i += direction) for (int i = start; i < Mods.Length && i >= 0; i += direction)
if (SelectAt(i)) return; if (SelectAt(i))
return;
Deselect(); Deselect();
} }
@ -242,8 +256,14 @@ namespace osu.Game.Overlays.Mods
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Children = new Drawable[] Children = new Drawable[]
{ {
iconsContainer = new Container<ModIcon> scaleContainer = new Container
{ {
Child = iconsContainer = new Container<ModIcon>
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
},
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,