mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 14:52:57 +08:00
Merge branch 'master' into fix-beatmapoverlay-graphs
This commit is contained in:
commit
587edcb716
109
osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs
Normal file
109
osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Audio.Track;
|
||||||
|
using osu.Framework.MathUtils;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
|
{
|
||||||
|
public class TestSceneGameplayRewinding : PlayerTestScene
|
||||||
|
{
|
||||||
|
private RulesetExposingPlayer player => (RulesetExposingPlayer)Player;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private AudioManager audioManager { get; set; }
|
||||||
|
|
||||||
|
public TestSceneGameplayRewinding()
|
||||||
|
: base(new OsuRuleset())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private Track track;
|
||||||
|
|
||||||
|
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap)
|
||||||
|
{
|
||||||
|
var working = new ClockBackedTestWorkingBeatmap(beatmap, new FramedClock(new ManualClock { Rate = 1 }), audioManager);
|
||||||
|
track = working.Track;
|
||||||
|
return working;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestNoJudgementsOnRewind()
|
||||||
|
{
|
||||||
|
AddUntilStep("wait for track to start running", () => track.IsRunning);
|
||||||
|
addSeekStep(3000);
|
||||||
|
AddAssert("all judged", () => player.DrawableRuleset.Playfield.AllHitObjects.All(h => h.Judged));
|
||||||
|
AddStep("clear results", () => player.AppliedResults.Clear());
|
||||||
|
addSeekStep(0);
|
||||||
|
AddAssert("none judged", () => player.DrawableRuleset.Playfield.AllHitObjects.All(h => !h.Judged));
|
||||||
|
AddAssert("no results triggered", () => player.AppliedResults.Count == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addSeekStep(double time)
|
||||||
|
{
|
||||||
|
AddStep($"seek to {time}", () => track.Seek(time));
|
||||||
|
|
||||||
|
// Allow a few frames of lenience
|
||||||
|
AddUntilStep("wait for seek to finish", () => Precision.AlmostEquals(time, player.DrawableRuleset.FrameStableClock.CurrentTime, 100));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Player CreatePlayer(Ruleset ruleset)
|
||||||
|
{
|
||||||
|
Mods.Value = Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() }).ToArray();
|
||||||
|
return new RulesetExposingPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
|
||||||
|
{
|
||||||
|
var beatmap = new Beatmap
|
||||||
|
{
|
||||||
|
BeatmapInfo = { BaseDifficulty = { ApproachRate = 9 } },
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int i = 0; i < 15; i++)
|
||||||
|
{
|
||||||
|
beatmap.HitObjects.Add(new HitCircle
|
||||||
|
{
|
||||||
|
Position = new Vector2(256, 192),
|
||||||
|
StartTime = 1000 + 30 * i
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return beatmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class RulesetExposingPlayer : Player
|
||||||
|
{
|
||||||
|
public readonly List<JudgementResult> AppliedResults = new List<JudgementResult>();
|
||||||
|
|
||||||
|
public new GameplayClockContainer GameplayClockContainer => base.GameplayClockContainer;
|
||||||
|
|
||||||
|
public new DrawableRuleset DrawableRuleset => base.DrawableRuleset;
|
||||||
|
|
||||||
|
public RulesetExposingPlayer()
|
||||||
|
: base(false, false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
ScoreProcessor.NewJudgement += r => AppliedResults.Add(r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,9 +5,9 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Overlays.Profile.Sections;
|
using osu.Game.Overlays.Profile.Sections;
|
||||||
using osu.Game.Overlays.Profile.Sections.Historical;
|
using osu.Game.Overlays.Profile.Sections.Historical;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
@ -36,7 +36,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
Colour = OsuColour.Gray(0.2f)
|
Colour = OsuColour.Gray(0.2f)
|
||||||
});
|
});
|
||||||
|
|
||||||
Add(new ScrollContainer
|
Add(new OsuScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = section = new HistoricalSection(),
|
Child = section = new HistoricalSection(),
|
||||||
|
@ -9,6 +9,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays.Profile.Sections;
|
using osu.Game.Overlays.Profile.Sections;
|
||||||
@ -36,7 +37,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = OsuColour.Gray(0.2f)
|
Colour = OsuColour.Gray(0.2f)
|
||||||
},
|
},
|
||||||
new ScrollContainer
|
new OsuScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = new FillFlowContainer<DrawableRecentActivity>
|
Child = new FillFlowContainer<DrawableRecentActivity>
|
||||||
|
@ -8,6 +8,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Overlays.Profile.Sections;
|
using osu.Game.Overlays.Profile.Sections;
|
||||||
using osu.Game.Overlays.Profile.Sections.Ranks;
|
using osu.Game.Overlays.Profile.Sections.Ranks;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
@ -33,7 +34,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = OsuColour.Gray(0.2f)
|
Colour = OsuColour.Gray(0.2f)
|
||||||
},
|
},
|
||||||
new ScrollContainer
|
new OsuScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = ranks = new RanksSection(),
|
Child = ranks = new RanksSection(),
|
||||||
|
@ -18,6 +18,7 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Osu.Mods;
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
using osu.Game.Rulesets.Taiko;
|
using osu.Game.Rulesets.Taiko;
|
||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
@ -100,8 +101,11 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
}
|
}
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public virtual void SetUp() =>
|
public virtual void SetUp() => Schedule(() =>
|
||||||
Schedule(() => { manager?.Delete(manager.GetAllUsableBeatmapSets()); });
|
{
|
||||||
|
Ruleset.Value = new OsuRuleset().RulesetInfo;
|
||||||
|
manager?.Delete(manager.GetAllUsableBeatmapSets());
|
||||||
|
});
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestDummy()
|
public void TestDummy()
|
||||||
@ -185,7 +189,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddAssert("empty mods", () => !Mods.Value.Any());
|
AddAssert("empty mods", () => !Mods.Value.Any());
|
||||||
|
|
||||||
void onModChange(ValueChangedEvent<IReadOnlyList<Mod>> e) => modChangeIndex = actionIndex++;
|
void onModChange(ValueChangedEvent<IReadOnlyList<Mod>> e) => modChangeIndex = actionIndex++;
|
||||||
void onRulesetChange(ValueChangedEvent<RulesetInfo> e) => rulesetChangeIndex = actionIndex--;
|
void onRulesetChange(ValueChangedEvent<RulesetInfo> e) => rulesetChangeIndex = actionIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -26,8 +26,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
{
|
{
|
||||||
new NamedIconButton("No change", new IconButton()),
|
new NamedIconButton("No change", new IconButton()),
|
||||||
new NamedIconButton("Background colours", new ColouredIconButton()),
|
new NamedIconButton("Background colours", new ColouredIconButton()),
|
||||||
new NamedIconButton("Full-width", new IconButton { ButtonSize = new Vector2(200, 30) }),
|
new NamedIconButton("Full-width", new IconButton { Size = new Vector2(200, 30) }),
|
||||||
new NamedIconButton("Unchanging size", new IconButton(), false),
|
|
||||||
new NamedIconButton("Icon colours", new IconButton
|
new NamedIconButton("Icon colours", new IconButton
|
||||||
{
|
{
|
||||||
IconColour = Color4.Green,
|
IconColour = Color4.Green,
|
||||||
@ -48,7 +47,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
private class NamedIconButton : Container
|
private class NamedIconButton : Container
|
||||||
{
|
{
|
||||||
public NamedIconButton(string name, IconButton button, bool allowSizeChange = true)
|
public NamedIconButton(string name, IconButton button)
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
Width = 200;
|
Width = 200;
|
||||||
@ -101,13 +100,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (allowSizeChange)
|
|
||||||
iconContainer.AutoSizeAxes = Axes.Both;
|
iconContainer.AutoSizeAxes = Axes.Both;
|
||||||
else
|
|
||||||
{
|
|
||||||
iconContainer.RelativeSizeAxes = Axes.X;
|
|
||||||
iconContainer.Height = 30;
|
|
||||||
}
|
|
||||||
|
|
||||||
button.Anchor = Anchor.Centre;
|
button.Anchor = Anchor.Centre;
|
||||||
button.Origin = Anchor.Centre;
|
button.Origin = Anchor.Centre;
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
|
||||||
@ -23,9 +22,9 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
};
|
};
|
||||||
Add(mc);
|
Add(mc);
|
||||||
|
|
||||||
AddToggleStep(@"toggle visibility", state => mc.State.Value = state ? Visibility.Visible : Visibility.Hidden);
|
|
||||||
AddStep(@"show", () => mc.Show());
|
AddStep(@"show", () => mc.Show());
|
||||||
AddToggleStep(@"toggle beatmap lock", state => Beatmap.Disabled = state);
|
AddToggleStep(@"toggle beatmap lock", state => Beatmap.Disabled = state);
|
||||||
|
AddStep(@"show", () => mc.Hide());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ using osu.Framework.Graphics.Cursor;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -29,7 +30,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
Colour = Color4.Teal,
|
Colour = Color4.Teal,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
new ScrollContainer
|
new OsuScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = flow = new FillFlowContainer<Icon>
|
Child = flow = new FillFlowContainer<Icon>
|
||||||
|
@ -9,6 +9,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
@ -92,13 +93,13 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
public void TestUnloadAndReload()
|
public void TestUnloadAndReload()
|
||||||
{
|
{
|
||||||
var backgrounds = new List<TestUpdateableBeatmapBackgroundSprite>();
|
var backgrounds = new List<TestUpdateableBeatmapBackgroundSprite>();
|
||||||
ScrollContainer scrollContainer = null;
|
OsuScrollContainer scrollContainer = null;
|
||||||
|
|
||||||
AddStep("create backgrounds hierarchy", () =>
|
AddStep("create backgrounds hierarchy", () =>
|
||||||
{
|
{
|
||||||
FillFlowContainer backgroundFlow;
|
FillFlowContainer backgroundFlow;
|
||||||
|
|
||||||
Child = scrollContainer = new ScrollContainer
|
Child = scrollContainer = new OsuScrollContainer
|
||||||
{
|
{
|
||||||
Size = new Vector2(500),
|
Size = new Vector2(500),
|
||||||
Child = backgroundFlow = new FillFlowContainer
|
Child = backgroundFlow = new FillFlowContainer
|
||||||
|
@ -1,13 +1,18 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Containers
|
namespace osu.Game.Graphics.Containers
|
||||||
{
|
{
|
||||||
public class OsuScrollContainer : ScrollContainer
|
public class OsuScrollContainer : ScrollContainer<Drawable>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Allows controlling the scroll bar from any position in the container using the right mouse button.
|
/// Allows controlling the scroll bar from any position in the container using the right mouse button.
|
||||||
@ -28,6 +33,11 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
protected override bool IsDragging => base.IsDragging || mouseScrollBarDragging;
|
protected override bool IsDragging => base.IsDragging || mouseScrollBarDragging;
|
||||||
|
|
||||||
|
public OsuScrollContainer(Direction scrollDirection = Direction.Vertical)
|
||||||
|
: base(scrollDirection)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool OnMouseDown(MouseDownEvent e)
|
protected override bool OnMouseDown(MouseDownEvent e)
|
||||||
{
|
{
|
||||||
if (shouldPerformRightMouseScroll(e))
|
if (shouldPerformRightMouseScroll(e))
|
||||||
@ -71,5 +81,87 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
return base.OnDragEnd(e);
|
return base.OnDragEnd(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override ScrollbarContainer CreateScrollbar(Direction direction) => new OsuScrollbar(direction);
|
||||||
|
|
||||||
|
protected class OsuScrollbar : ScrollbarContainer
|
||||||
|
{
|
||||||
|
private const float dim_size = 10;
|
||||||
|
|
||||||
|
private Color4 hoverColour;
|
||||||
|
private Color4 defaultColour;
|
||||||
|
private Color4 highlightColour;
|
||||||
|
|
||||||
|
private readonly Box box;
|
||||||
|
|
||||||
|
public OsuScrollbar(Direction scrollDir)
|
||||||
|
: base(scrollDir)
|
||||||
|
{
|
||||||
|
Blending = BlendingMode.Additive;
|
||||||
|
|
||||||
|
CornerRadius = 5;
|
||||||
|
|
||||||
|
const float margin = 3;
|
||||||
|
|
||||||
|
Margin = new MarginPadding
|
||||||
|
{
|
||||||
|
Left = scrollDir == Direction.Vertical ? margin : 0,
|
||||||
|
Right = scrollDir == Direction.Vertical ? margin : 0,
|
||||||
|
Top = scrollDir == Direction.Horizontal ? margin : 0,
|
||||||
|
Bottom = scrollDir == Direction.Horizontal ? margin : 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
Masking = true;
|
||||||
|
Child = box = new Box { RelativeSizeAxes = Axes.Both };
|
||||||
|
|
||||||
|
ResizeTo(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
Colour = defaultColour = colours.Gray8;
|
||||||
|
hoverColour = colours.GrayF;
|
||||||
|
highlightColour = colours.Green;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ResizeTo(float val, int duration = 0, Easing easing = Easing.None)
|
||||||
|
{
|
||||||
|
Vector2 size = new Vector2(dim_size)
|
||||||
|
{
|
||||||
|
[(int)ScrollDirection] = val
|
||||||
|
};
|
||||||
|
this.ResizeTo(size, duration, easing);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnHover(HoverEvent e)
|
||||||
|
{
|
||||||
|
this.FadeColour(hoverColour, 100);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
|
{
|
||||||
|
this.FadeColour(defaultColour, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnMouseDown(MouseDownEvent e)
|
||||||
|
{
|
||||||
|
if (!base.OnMouseDown(e)) return false;
|
||||||
|
|
||||||
|
//note that we are changing the colour of the box here as to not interfere with the hover effect.
|
||||||
|
box.FadeColour(highlightColour, 100);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnMouseUp(MouseUpEvent e)
|
||||||
|
{
|
||||||
|
if (e.Button != MouseButton.Left) return false;
|
||||||
|
|
||||||
|
box.FadeColour(Color4.White, 100);
|
||||||
|
|
||||||
|
return base.OnMouseUp(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
where T : Drawable
|
where T : Drawable
|
||||||
{
|
{
|
||||||
private Drawable expandableHeader, fixedHeader, footer, headerBackground;
|
private Drawable expandableHeader, fixedHeader, footer, headerBackground;
|
||||||
private readonly ScrollContainer scrollContainer;
|
private readonly OsuScrollContainer scrollContainer;
|
||||||
private readonly Container headerBackgroundContainer;
|
private readonly Container headerBackgroundContainer;
|
||||||
private readonly FlowContainer<T> scrollContentContainer;
|
private readonly FlowContainer<T> scrollContentContainer;
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
public SectionsContainer()
|
public SectionsContainer()
|
||||||
{
|
{
|
||||||
AddInternal(scrollContainer = new ScrollContainer
|
AddInternal(scrollContainer = new OsuScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
|
@ -11,7 +11,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
public class IconButton : OsuAnimatedButton
|
public class IconButton : OsuAnimatedButton
|
||||||
{
|
{
|
||||||
public const float BUTTON_SIZE = 30;
|
public const float DEFAULT_BUTTON_SIZE = 30;
|
||||||
|
|
||||||
private Color4? iconColour;
|
private Color4? iconColour;
|
||||||
|
|
||||||
@ -57,26 +57,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
set => icon.Scale = value;
|
set => icon.Scale = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The size of the <see cref="IconButton"/> while it is not being pressed.
|
|
||||||
/// </summary>
|
|
||||||
public Vector2 ButtonSize
|
|
||||||
{
|
|
||||||
get => Content.Size;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
Content.RelativeSizeAxes = Axes.None;
|
|
||||||
Content.AutoSizeAxes = Axes.None;
|
|
||||||
Content.Size = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly SpriteIcon icon;
|
private readonly SpriteIcon icon;
|
||||||
|
|
||||||
public IconButton()
|
public IconButton()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
Size = new Vector2(DEFAULT_BUTTON_SIZE);
|
||||||
ButtonSize = new Vector2(BUTTON_SIZE);
|
|
||||||
|
|
||||||
Add(icon = new SpriteIcon
|
Add(icon = new SpriteIcon
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
{
|
{
|
||||||
private const double fade_duration = 300;
|
private const double fade_duration = 300;
|
||||||
|
|
||||||
private readonly ScrollContainer scrollContainer;
|
private readonly OsuScrollContainer scrollContainer;
|
||||||
private readonly Container placeholderContainer;
|
private readonly Container placeholderContainer;
|
||||||
|
|
||||||
private FillFlowContainer<LeaderboardScore> scrollFlow;
|
private FillFlowContainer<LeaderboardScore> scrollFlow;
|
||||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private RulesetStore rulesets;
|
private RulesetStore rulesets;
|
||||||
|
|
||||||
private readonly ScrollContainer scroll;
|
private readonly OsuScrollContainer scroll;
|
||||||
|
|
||||||
private readonly Bindable<BeatmapSetInfo> beatmapSet = new Bindable<BeatmapSetInfo>();
|
private readonly Bindable<BeatmapSetInfo> beatmapSet = new Bindable<BeatmapSetInfo>();
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ namespace osu.Game.Overlays
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = OsuColour.Gray(0.2f)
|
Colour = OsuColour.Gray(0.2f)
|
||||||
},
|
},
|
||||||
scroll = new ScrollContainer
|
scroll = new OsuScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
ScrollbarVisible = false,
|
ScrollbarVisible = false,
|
||||||
|
@ -51,7 +51,7 @@ namespace osu.Game.Overlays
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = colour.PurpleDarkAlternative,
|
Colour = colour.PurpleDarkAlternative,
|
||||||
},
|
},
|
||||||
new ScrollContainer
|
new OsuScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
ScrollbarVisible = false,
|
ScrollbarVisible = false,
|
||||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Chat
|
|||||||
{
|
{
|
||||||
public readonly Channel Channel;
|
public readonly Channel Channel;
|
||||||
protected readonly ChatLineContainer ChatLineFlow;
|
protected readonly ChatLineContainer ChatLineFlow;
|
||||||
private readonly ScrollContainer scroll;
|
private readonly OsuScrollContainer scroll;
|
||||||
|
|
||||||
public DrawableChannel(Channel channel)
|
public DrawableChannel(Channel channel)
|
||||||
{
|
{
|
||||||
|
@ -464,12 +464,26 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private class MusicIconButton : IconButton
|
private class MusicIconButton : IconButton
|
||||||
{
|
{
|
||||||
|
public MusicIconButton()
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
HoverColour = colours.YellowDark.Opacity(0.6f);
|
HoverColour = colours.YellowDark.Opacity(0.6f);
|
||||||
FlashColour = colours.Yellow;
|
FlashColour = colours.Yellow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
// works with AutoSizeAxes above to make buttons autosize with the scale animation.
|
||||||
|
Content.AutoSizeAxes = Axes.None;
|
||||||
|
Content.Size = new Vector2(DEFAULT_BUTTON_SIZE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Background : BufferedContainer
|
private class Background : BufferedContainer
|
||||||
|
@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Overlays.Toolbar;
|
using osu.Game.Overlays.Toolbar;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings
|
namespace osu.Game.Overlays.Settings
|
||||||
@ -76,7 +77,7 @@ namespace osu.Game.Overlays.Settings
|
|||||||
return base.OnMouseMove(e);
|
return base.OnMouseMove(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SidebarScrollContainer : ScrollContainer
|
private class SidebarScrollContainer : OsuScrollContainer
|
||||||
{
|
{
|
||||||
public SidebarScrollContainer()
|
public SidebarScrollContainer()
|
||||||
{
|
{
|
||||||
|
@ -167,6 +167,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
{
|
{
|
||||||
OnRevertResult?.Invoke(this, Result);
|
OnRevertResult?.Invoke(this, Result);
|
||||||
|
|
||||||
|
Result.TimeOffset = 0;
|
||||||
Result.Type = HitResult.None;
|
Result.Type = HitResult.None;
|
||||||
State.Value = ArmedState.Idle;
|
State.Value = ArmedState.Idle;
|
||||||
}
|
}
|
||||||
@ -243,6 +244,10 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
/// <returns>Whether a scoring result has occurred from this <see cref="DrawableHitObject"/> or any nested <see cref="DrawableHitObject"/>.</returns>
|
/// <returns>Whether a scoring result has occurred from this <see cref="DrawableHitObject"/> or any nested <see cref="DrawableHitObject"/>.</returns>
|
||||||
protected bool UpdateResult(bool userTriggered)
|
protected bool UpdateResult(bool userTriggered)
|
||||||
{
|
{
|
||||||
|
// It's possible for input to get into a bad state when rewinding gameplay, so results should not be processed
|
||||||
|
if (Time.Elapsed < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
judgementOccurred = false;
|
judgementOccurred = false;
|
||||||
|
|
||||||
if (AllJudged)
|
if (AllJudged)
|
||||||
|
@ -171,7 +171,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
// Small offset to look a bit better centered along with the divisor text
|
// Small offset to look a bit better centered along with the divisor text
|
||||||
Y = 1;
|
Y = 1;
|
||||||
|
|
||||||
ButtonSize = new Vector2(20);
|
Size = new Vector2(20);
|
||||||
IconScale = new Vector2(0.6f);
|
IconScale = new Vector2(0.6f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,14 +31,14 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
InternalChild = button = new TimelineIconButton { Action = () => Action?.Invoke() };
|
InternalChild = button = new TimelineIconButton { Action = () => Action?.Invoke() };
|
||||||
|
|
||||||
button.Enabled.BindTo(Enabled);
|
button.Enabled.BindTo(Enabled);
|
||||||
Width = button.ButtonSize.X;
|
Width = button.Width;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
button.ButtonSize = new Vector2(button.ButtonSize.X, DrawHeight);
|
button.Size = new Vector2(button.Width, DrawHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TimelineIconButton : IconButton
|
private class TimelineIconButton : IconButton
|
||||||
|
@ -7,11 +7,12 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Transforms;
|
using osu.Framework.Graphics.Transforms;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||||
{
|
{
|
||||||
public class ZoomableScrollContainer : ScrollContainer
|
public class ZoomableScrollContainer : OsuScrollContainer
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The time to zoom into/out of a point.
|
/// The time to zoom into/out of a point.
|
||||||
|
@ -12,6 +12,7 @@ using osu.Framework.Graphics.Cursor;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
@ -226,7 +227,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
{
|
{
|
||||||
Padding = new MarginPadding { Horizontal = 10 };
|
Padding = new MarginPadding { Horizontal = 10 };
|
||||||
|
|
||||||
InternalChild = new ScrollContainer
|
InternalChild = new OsuScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = fill = new FillFlowContainer
|
Child = fill = new FillFlowContainer
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Overlays.SearchableList;
|
using osu.Game.Overlays.SearchableList;
|
||||||
@ -43,7 +44,7 @@ namespace osu.Game.Screens.Multi.Lounge
|
|||||||
Width = 0.55f,
|
Width = 0.55f,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new ScrollContainer
|
new OsuScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
ScrollbarOverlapsContent = false,
|
ScrollbarOverlapsContent = false,
|
||||||
|
@ -10,6 +10,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
@ -91,7 +92,7 @@ namespace osu.Game.Screens.Multi.Match.Components
|
|||||||
{
|
{
|
||||||
new Drawable[]
|
new Drawable[]
|
||||||
{
|
{
|
||||||
new ScrollContainer
|
new OsuScrollContainer
|
||||||
{
|
{
|
||||||
Padding = new MarginPadding
|
Padding = new MarginPadding
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Overlays.SearchableList;
|
using osu.Game.Overlays.SearchableList;
|
||||||
using osu.Game.Screens.Multi.Components;
|
using osu.Game.Screens.Multi.Components;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
@ -25,7 +26,7 @@ namespace osu.Game.Screens.Multi.Match.Components
|
|||||||
Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING },
|
Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING },
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new ScrollContainer
|
new OsuScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Top = 10 },
|
Padding = new MarginPadding { Top = 10 },
|
||||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Screens.Select
|
|||||||
private readonly AdvancedStats advanced;
|
private readonly AdvancedStats advanced;
|
||||||
private readonly DetailBox ratingsContainer;
|
private readonly DetailBox ratingsContainer;
|
||||||
private readonly UserRatings ratings;
|
private readonly UserRatings ratings;
|
||||||
private readonly ScrollContainer metadataScroll;
|
private readonly OsuScrollContainer metadataScroll;
|
||||||
private readonly MetadataSection description, source, tags;
|
private readonly MetadataSection description, source, tags;
|
||||||
private readonly Container failRetryContainer;
|
private readonly Container failRetryContainer;
|
||||||
private readonly FailRetryGraph failRetryGraph;
|
private readonly FailRetryGraph failRetryGraph;
|
||||||
@ -111,7 +111,7 @@ namespace osu.Game.Screens.Select
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
metadataScroll = new ScrollContainer
|
metadataScroll = new OsuScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Width = 0.5f,
|
Width = 0.5f,
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.4" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.4" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.609.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.609.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.611.1" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.614.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.23.0" />
|
<PackageReference Include="SharpCompress" Version="0.23.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
@ -105,8 +105,8 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.609.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.609.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.611.1" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.614.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.611.1" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.614.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
Loading…
Reference in New Issue
Block a user