This commit is contained in:
DrabWeb 2017-07-11 02:00:36 -03:00
commit 202e3ca530
159 changed files with 909 additions and 750 deletions

@ -1 +1 @@
Subproject commit 97ff3376d1bdac3703d442e62f5ee6a36eb3b73f Subproject commit 768a775b688d7a008d8933275b48ed0d2d491f12

@ -1 +1 @@
Subproject commit 10fda22522ffadbdbc43fa0f3683a065e536f7d1 Subproject commit 76656c51f281e7934159e9ed4414378fef24d130

View File

@ -0,0 +1,206 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Testing;
using osu.Framework.Graphics;
using osu.Framework.Timing;
using osu.Game.Overlays;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Containers;
using osu.Framework.Audio.Track;
using osu.Game.Beatmaps.ControlPoints;
using osu.Framework.Graphics.Shapes;
using OpenTK.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Framework.Lists;
using System;
using osu.Framework.Extensions.Color4Extensions;
namespace osu.Desktop.VisualTests.Tests
{
internal class TestCaseBeatSyncedContainer : TestCase
{
public override string Description => @"Tests beat synced containers.";
private readonly MusicController mc;
public TestCaseBeatSyncedContainer()
{
Clock = new FramedClock();
Clock.ProcessFrame();
Add(new BeatContainer
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
});
Add(mc = new MusicController
{
Origin = Anchor.TopRight,
Anchor = Anchor.TopRight,
});
}
protected override void LoadComplete()
{
base.LoadComplete();
mc.ToggleVisibility();
}
private class BeatContainer : BeatSyncedContainer
{
private const int flash_layer_heigth = 150;
private readonly InfoString timingPointCount;
private readonly InfoString currentTimingPoint;
private readonly InfoString beatCount;
private readonly InfoString currentBeat;
private readonly InfoString beatsPerMinute;
private readonly InfoString adjustedBeatLength;
private readonly InfoString timeUntilNextBeat;
private readonly InfoString timeSinceLastBeat;
private readonly Box flashLayer;
public BeatContainer()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Children = new Drawable[]
{
new Container
{
Name = @"Info Layer",
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
AutoSizeAxes = Axes.Both,
Margin = new MarginPadding { Bottom = flash_layer_heigth },
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black.Opacity(150),
},
new FillFlowContainer
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
timingPointCount = new InfoString(@"Timing points amount"),
currentTimingPoint = new InfoString(@"Current timing point"),
beatCount = new InfoString(@"Beats amount (in the current timing point)"),
currentBeat = new InfoString(@"Current beat"),
beatsPerMinute = new InfoString(@"BPM"),
adjustedBeatLength = new InfoString(@"Adjusted beat length"),
timeUntilNextBeat = new InfoString(@"Time until next beat"),
timeSinceLastBeat = new InfoString(@"Time since last beat"),
}
}
}
},
new Container
{
Name = @"Color indicator",
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.X,
Height = flash_layer_heigth,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
},
flashLayer = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.White,
Alpha = 0,
}
}
}
};
Beatmap.ValueChanged += delegate
{
timingPointCount.Value = 0;
currentTimingPoint.Value = 0;
beatCount.Value = 0;
currentBeat.Value = 0;
beatsPerMinute.Value = 0;
adjustedBeatLength.Value = 0;
timeUntilNextBeat.Value = 0;
timeSinceLastBeat.Value = 0;
};
}
private SortedList<TimingControlPoint> timingPoints => Beatmap.Value.Beatmap.ControlPointInfo.TimingPoints;
private TimingControlPoint getNextTimingPoint(TimingControlPoint current)
{
if (timingPoints[timingPoints.Count - 1] == current)
return current;
return timingPoints[timingPoints.IndexOf(current) + 1];
}
private int calculateBeatCount(TimingControlPoint current)
{
if (timingPoints[timingPoints.Count - 1] == current)
return (int)Math.Ceiling((Beatmap.Value.Track.Length - current.Time) / current.BeatLength);
return (int)Math.Ceiling((getNextTimingPoint(current).Time - current.Time) / current.BeatLength);
}
protected override void Update()
{
base.Update();
timeUntilNextBeat.Value = TimeUntilNextBeat;
timeSinceLastBeat.Value = TimeSinceLastBeat;
}
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
{
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
timingPointCount.Value = timingPoints.Count;
currentTimingPoint.Value = timingPoints.IndexOf(timingPoint);
beatCount.Value = calculateBeatCount(timingPoint);
currentBeat.Value = beatIndex;
beatsPerMinute.Value = 60000 / timingPoint.BeatLength;
adjustedBeatLength.Value = timingPoint.BeatLength;
flashLayer.ClearTransforms();
flashLayer.FadeTo(1);
flashLayer.FadeTo(0, timingPoint.BeatLength);
}
}
private class InfoString : FillFlowContainer
{
private const int text_size = 20;
private const int margin = 7;
private readonly OsuSpriteText valueText;
public double Value
{
set { valueText.Text = $"{value:G}"; }
}
public InfoString(string header)
{
AutoSizeAxes = Axes.Both;
Direction = FillDirection.Horizontal;
Add(new OsuSpriteText { Text = header + @": ", TextSize = text_size });
Add(valueText = new OsuSpriteText() { TextSize = text_size });
Margin = new MarginPadding(margin);
}
}
}
}

View File

@ -12,10 +12,8 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"Beatmap details in song select"; public override string Description => @"Beatmap details in song select";
public override void Reset() public TestCaseBeatmapDetailArea()
{ {
base.Reset();
Add(new BeatmapDetailArea Add(new BeatmapDetailArea
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,

View File

@ -13,12 +13,10 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => "BeatmapDetails tab of BeatmapDetailArea"; public override string Description => "BeatmapDetails tab of BeatmapDetailArea";
private BeatmapDetails details; private readonly BeatmapDetails details;
public override void Reset() public TestCaseBeatmapDetails()
{ {
base.Reset();
Add(details = new BeatmapDetails Add(details = new BeatmapDetails
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,

View File

@ -13,10 +13,8 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"Beatmap options in song select"; public override string Description => @"Beatmap options in song select";
public override void Reset() public TestCaseBeatmapOptionsOverlay()
{ {
base.Reset();
var overlay = new BeatmapOptionsOverlay(); var overlay = new BeatmapOptionsOverlay();
overlay.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, Color4.Purple, null, Key.Number1); overlay.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, Color4.Purple, null, Key.Number1);

View File

@ -11,10 +11,8 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"breadcrumb > control"; public override string Description => @"breadcrumb > control";
public override void Reset() public TestCaseBreadcrumbs()
{ {
base.Reset();
BreadcrumbControl<BreadcrumbTab> c; BreadcrumbControl<BreadcrumbTab> c;
Add(c = new BreadcrumbControl<BreadcrumbTab> Add(c = new BreadcrumbControl<BreadcrumbTab>
{ {

View File

@ -11,10 +11,8 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"Testing chat api and overlay"; public override string Description => @"Testing chat api and overlay";
public override void Reset() public TestCaseChatDisplay()
{ {
base.Reset();
Add(new ChatOverlay Add(new ChatOverlay
{ {
State = Visibility.Visible State = Visibility.Visible

View File

@ -7,7 +7,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -21,12 +20,10 @@ namespace osu.Desktop.VisualTests.Tests
private const int start_time = 0; private const int start_time = 0;
private const int duration = 1000; private const int duration = 1000;
private MyContextMenuContainer container; private readonly Container container;
public override void Reset() public TestCaseContextMenu()
{ {
base.Reset();
Add(container = new MyContextMenuContainer Add(container = new MyContextMenuContainer
{ {
Size = new Vector2(200), Size = new Vector2(200),
@ -56,43 +53,26 @@ namespace osu.Desktop.VisualTests.Tests
} }
} }
}); });
}
container.Transforms.Add(new TransformPosition protected override void LoadComplete()
{
base.LoadComplete();
using (container.BeginLoopedSequence())
{ {
StartValue = Vector2.Zero, container.MoveTo(new Vector2(0, 100), duration);
EndValue = new Vector2(0, 100), using (container.BeginDelayedSequence(duration))
StartTime = start_time, {
EndTime = start_time + duration, container.MoveTo(new Vector2(100, 100), duration);
LoopCount = -1, using (container.BeginDelayedSequence(duration))
LoopDelay = duration * 3 {
}); container.MoveTo(new Vector2(100, 0), duration);
container.Transforms.Add(new TransformPosition using (container.BeginDelayedSequence(duration))
{ container.MoveTo(Vector2.Zero, duration);
StartValue = new Vector2(0, 100), }
EndValue = new Vector2(100, 100), }
StartTime = start_time + duration, }
EndTime = start_time + duration * 2,
LoopCount = -1,
LoopDelay = duration * 3
});
container.Transforms.Add(new TransformPosition
{
StartValue = new Vector2(100, 100),
EndValue = new Vector2(100, 0),
StartTime = start_time + duration * 2,
EndTime = start_time + duration * 3,
LoopCount = -1,
LoopDelay = duration * 3
});
container.Transforms.Add(new TransformPosition
{
StartValue = new Vector2(100, 0),
EndValue = Vector2.Zero,
StartTime = start_time + duration * 3,
EndTime = start_time + duration * 4,
LoopCount = -1,
LoopDelay = duration * 3
});
} }
private class MyContextMenuContainer : Container, IHasContextMenu private class MyContextMenuContainer : Container, IHasContextMenu

View File

@ -12,11 +12,9 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"Display dialogs"; public override string Description => @"Display dialogs";
private DialogOverlay overlay; public TestCaseDialogOverlay()
public override void Reset()
{ {
base.Reset(); DialogOverlay overlay;
Add(overlay = new DialogOverlay()); Add(overlay = new DialogOverlay());

View File

@ -16,9 +16,9 @@ namespace osu.Desktop.VisualTests.Tests
private DirectOverlay direct; private DirectOverlay direct;
private RulesetDatabase rulesets; private RulesetDatabase rulesets;
public override void Reset() protected override void LoadComplete()
{ {
base.Reset(); base.LoadComplete();
Add(direct = new DirectOverlay()); Add(direct = new DirectOverlay());
newBeatmaps(); newBeatmaps();

View File

@ -15,9 +15,9 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"Select your favourite room"; public override string Description => @"Select your favourite room";
public override void Reset() protected override void LoadComplete()
{ {
base.Reset(); base.LoadComplete();
DrawableRoom first; DrawableRoom first;
DrawableRoom second; DrawableRoom second;

View File

@ -12,10 +12,8 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => "Tournament drawings"; public override string Description => "Tournament drawings";
public override void Reset() public TestCaseDrawings()
{ {
base.Reset();
Add(new Drawings Add(new Drawings
{ {
TeamList = new TestTeamList(), TeamList = new TestTeamList(),

View File

@ -34,9 +34,9 @@ namespace osu.Desktop.VisualTests.Tests
this.rulesets = rulesets; this.rulesets = rulesets;
} }
public override void Reset() protected override void LoadComplete()
{ {
base.Reset(); base.LoadComplete();
List<HitObject> objects = new List<HitObject>(); List<HitObject> objects = new List<HitObject>();

View File

@ -13,11 +13,9 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => "graph"; public override string Description => "graph";
private BarGraph graph; public TestCaseGraph()
public override void Reset()
{ {
base.Reset(); BarGraph graph;
Children = new[] Children = new[]
{ {

View File

@ -29,15 +29,58 @@ namespace osu.Desktop.VisualTests.Tests
var rateAdjustClock = new StopwatchClock(true); var rateAdjustClock = new StopwatchClock(true);
framedClock = new FramedClock(rateAdjustClock); framedClock = new FramedClock(rateAdjustClock);
playbackSpeed.ValueChanged += delegate { rateAdjustClock.Rate = playbackSpeed.Value; }; playbackSpeed.ValueChanged += delegate { rateAdjustClock.Rate = playbackSpeed.Value; };
playbackSpeed.TriggerChange();
AddStep(@"circles", () => loadHitobjects(HitObjectType.Circle));
AddStep(@"slider", () => loadHitobjects(HitObjectType.Slider));
AddStep(@"spinner", () => loadHitobjects(HitObjectType.Spinner));
AddToggleStep(@"auto", state => { auto = state; loadHitobjects(mode); });
BasicSliderBar<double> sliderBar;
Add(new Container
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
new SpriteText { Text = "Playback Speed" },
sliderBar = new BasicSliderBar<double>
{
Width = 150,
Height = 10,
SelectionColor = Color4.Orange,
}
}
});
sliderBar.Current.BindTo(playbackSpeed);
framedClock.ProcessFrame();
var clockAdjustContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Clock = framedClock,
Children = new[]
{
playfieldContainer = new Container { RelativeSizeAxes = Axes.Both },
approachContainer = new Container { RelativeSizeAxes = Axes.Both }
}
};
Add(clockAdjustContainer);
} }
private HitObjectType mode = HitObjectType.Slider; private HitObjectType mode = HitObjectType.Slider;
private readonly BindableNumber<double> playbackSpeed = new BindableDouble(0.5) { MinValue = 0, MaxValue = 1 }; private readonly BindableNumber<double> playbackSpeed = new BindableDouble(0.5) { MinValue = 0, MaxValue = 1 };
private Container playfieldContainer; private readonly Container playfieldContainer;
private Container approachContainer; private readonly Container approachContainer;
private void load(HitObjectType mode) private void loadHitobjects(HitObjectType mode)
{ {
this.mode = mode; this.mode = mode;
@ -83,54 +126,6 @@ namespace osu.Desktop.VisualTests.Tests
} }
} }
public override void Reset()
{
base.Reset();
playbackSpeed.TriggerChange();
AddStep(@"circles", () => load(HitObjectType.Circle));
AddStep(@"slider", () => load(HitObjectType.Slider));
AddStep(@"spinner", () => load(HitObjectType.Spinner));
AddToggleStep(@"auto", state => { auto = state; load(mode); });
BasicSliderBar<double> sliderBar;
Add(new Container
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
new SpriteText { Text = "Playback Speed" },
sliderBar = new BasicSliderBar<double>
{
Width = 150,
Height = 10,
SelectionColor = Color4.Orange,
}
}
});
sliderBar.Current.BindTo(playbackSpeed);
framedClock.ProcessFrame();
var clockAdjustContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Clock = framedClock,
Children = new[]
{
playfieldContainer = new Container { RelativeSizeAxes = Axes.Both },
approachContainer = new Container { RelativeSizeAxes = Axes.Both }
}
};
Add(clockAdjustContainer);
}
private int depth; private int depth;
private void add(DrawableOsuHitObject h) private void add(DrawableOsuHitObject h)

View File

@ -20,10 +20,8 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"Tests key counter"; public override string Description => @"Tests key counter";
public override void Reset() public TestCaseKeyCounter()
{ {
base.Reset();
KeyCounterCollection kc = new KeyCounterCollection KeyCounterCollection kc = new KeyCounterCollection
{ {
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -16,7 +16,7 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"From song select"; public override string Description => @"From song select";
private Leaderboard leaderboard; private readonly Leaderboard leaderboard;
private void newScores() private void newScores()
{ {
@ -207,10 +207,8 @@ namespace osu.Desktop.VisualTests.Tests
leaderboard.Scores = scores; leaderboard.Scores = scores;
} }
public override void Reset() public TestCaseLeaderboard()
{ {
base.Reset();
Add(leaderboard = new Leaderboard Add(leaderboard = new Leaderboard
{ {
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -13,10 +13,8 @@ namespace osu.Desktop.VisualTests.Tests
{ {
internal class TestCaseManiaHitObjects : TestCase internal class TestCaseManiaHitObjects : TestCase
{ {
public override void Reset() public TestCaseManiaHitObjects()
{ {
base.Reset();
Add(new FillFlowContainer Add(new FillFlowContainer
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,

View File

@ -25,10 +25,8 @@ namespace osu.Desktop.VisualTests.Tests
protected override double TimePerAction => 200; protected override double TimePerAction => 200;
public override void Reset() public TestCaseManiaPlayfield()
{ {
base.Reset();
Action<int, SpecialColumnPosition> createPlayfield = (cols, pos) => Action<int, SpecialColumnPosition> createPlayfield = (cols, pos) =>
{ {
Clear(); Clear();

View File

@ -13,10 +13,8 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"Main menu button system"; public override string Description => @"Main menu button system";
public override void Reset() public TestCaseMenuButtonSystem()
{ {
base.Reset();
Add(new Box Add(new Box
{ {
ColourInfo = ColourInfo.GradientVertical(Color4.Gray, Color4.WhiteSmoke), ColourInfo = ColourInfo.GradientVertical(Color4.Gray, Color4.WhiteSmoke),

View File

@ -12,15 +12,12 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"Tests pause and fail overlays"; public override string Description => @"Tests pause and fail overlays";
private PauseContainer.PauseOverlay pauseOverlay; public TestCaseMenuOverlays()
private FailOverlay failOverlay;
private int retryCount;
public override void Reset()
{ {
base.Reset(); FailOverlay failOverlay;
PauseContainer.PauseOverlay pauseOverlay;
retryCount = 0; var retryCount = 0;
Add(pauseOverlay = new PauseContainer.PauseOverlay Add(pauseOverlay = new PauseContainer.PauseOverlay
{ {
@ -34,14 +31,16 @@ namespace osu.Desktop.VisualTests.Tests
OnQuit = () => Logger.Log(@"Quit"), OnQuit = () => Logger.Log(@"Quit"),
}); });
AddStep(@"Pause", delegate { AddStep(@"Pause", delegate
{
if (failOverlay.State == Visibility.Visible) if (failOverlay.State == Visibility.Visible)
{ {
failOverlay.Hide(); failOverlay.Hide();
} }
pauseOverlay.Show(); pauseOverlay.Show();
}); });
AddStep("Fail", delegate { AddStep("Fail", delegate
{
if (pauseOverlay.State == Visibility.Visible) if (pauseOverlay.State == Visibility.Visible)
{ {
pauseOverlay.Hide(); pauseOverlay.Hide();

View File

@ -27,9 +27,9 @@ namespace osu.Desktop.VisualTests.Tests
this.rulesets = rulesets; this.rulesets = rulesets;
} }
public override void Reset() protected override void LoadComplete()
{ {
base.Reset(); base.LoadComplete();
Add(modSelect = new ModSelectOverlay Add(modSelect = new ModSelectOverlay
{ {

View File

@ -13,18 +13,11 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"Tests music controller ui."; public override string Description => @"Tests music controller ui.";
private MusicController mc;
public TestCaseMusicController() public TestCaseMusicController()
{ {
Clock = new FramedClock(); Clock = new FramedClock();
}
public override void Reset() var mc = new MusicController
{
base.Reset();
Clock.ProcessFrame();
mc = new MusicController
{ {
Origin = Anchor.Centre, Origin = Anchor.Centre,
Anchor = Anchor.Centre Anchor = Anchor.Centre

View File

@ -16,12 +16,10 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"I handle notifications"; public override string Description => @"I handle notifications";
private NotificationManager manager; private readonly NotificationManager manager;
public override void Reset() public TestCaseNotificationManager()
{ {
base.Reset();
progressingNotifications.Clear(); progressingNotifications.Clear();
Content.Add(manager = new NotificationManager Content.Add(manager = new NotificationManager

View File

@ -15,9 +15,9 @@ namespace osu.Desktop.VisualTests.Tests
public override string Description => @"Make it easier to see setting changes"; public override string Description => @"Make it easier to see setting changes";
public override void Reset() protected override void LoadComplete()
{ {
base.Reset(); base.LoadComplete();
Add(new OnScreenDisplay()); Add(new OnScreenDisplay());

View File

@ -13,20 +13,19 @@ namespace osu.Desktop.VisualTests.Tests
{ {
internal class TestCasePlaySongSelect : TestCase internal class TestCasePlaySongSelect : TestCase
{ {
private BeatmapDatabase db; private readonly BeatmapDatabase db;
private TestStorage storage;
private PlaySongSelect songSelect;
public override string Description => @"with fake data"; public override string Description => @"with fake data";
private RulesetDatabase rulesets; private readonly RulesetDatabase rulesets;
public override void Reset() public TestCasePlaySongSelect()
{ {
base.Reset(); PlaySongSelect songSelect;
if (db == null) if (db == null)
{ {
storage = new TestStorage(@"TestCasePlaySongSelect"); var storage = new TestStorage(@"TestCasePlaySongSelect");
var backingDatabase = storage.GetDatabase(@"client"); var backingDatabase = storage.GetDatabase(@"client");

View File

@ -2,7 +2,6 @@
// 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.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
@ -21,65 +20,54 @@ namespace osu.Desktop.VisualTests.Tests
internal class TestCasePlayer : TestCase internal class TestCasePlayer : TestCase
{ {
protected Player Player; protected Player Player;
private BeatmapDatabase db;
private RulesetDatabase rulesets; private RulesetDatabase rulesets;
public override string Description => @"Showing everything to play the game."; public override string Description => @"Showing everything to play the game.";
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(BeatmapDatabase db, RulesetDatabase rulesets) private void load(RulesetDatabase rulesets)
{ {
this.rulesets = rulesets; this.rulesets = rulesets;
this.db = db;
} }
public override void Reset() protected override void LoadComplete()
{ {
base.Reset(); base.LoadComplete();
WorkingBeatmap beatmap = null; var objects = new List<HitObject>();
var beatmapInfo = db.Query<BeatmapInfo>().FirstOrDefault(b => b.RulesetID == 0); int time = 1500;
if (beatmapInfo != null) for (int i = 0; i < 50; i++)
beatmap = db.GetWorkingBeatmap(beatmapInfo);
if (beatmap?.Track == null)
{ {
var objects = new List<HitObject>(); objects.Add(new HitCircle
int time = 1500;
for (int i = 0; i < 50; i++)
{ {
objects.Add(new HitCircle StartTime = time,
{ Position = new Vector2(i % 4 == 0 || i % 4 == 2 ? 0 : OsuPlayfield.BASE_SIZE.X,
StartTime = time, i % 4 < 2 ? 0 : OsuPlayfield.BASE_SIZE.Y),
Position = new Vector2(i % 4 == 0 || i % 4 == 2 ? 0 : OsuPlayfield.BASE_SIZE.X, NewCombo = i % 4 == 0
i % 4 < 2 ? 0 : OsuPlayfield.BASE_SIZE.Y), });
NewCombo = i % 4 == 0
});
time += 500; time += 500;
}
Beatmap b = new Beatmap
{
HitObjects = objects,
BeatmapInfo = new BeatmapInfo
{
Difficulty = new BeatmapDifficulty(),
Ruleset = rulesets.Query<RulesetInfo>().First(),
Metadata = new BeatmapMetadata
{
Artist = @"Unknown",
Title = @"Sample Beatmap",
Author = @"peppy",
}
}
};
beatmap = new TestWorkingBeatmap(b);
} }
Beatmap b = new Beatmap
{
HitObjects = objects,
BeatmapInfo = new BeatmapInfo
{
Difficulty = new BeatmapDifficulty(),
Ruleset = rulesets.Query<RulesetInfo>().First(),
Metadata = new BeatmapMetadata
{
Artist = @"Unknown",
Title = @"Sample Beatmap",
Author = @"peppy",
}
}
};
WorkingBeatmap beatmap = new TestWorkingBeatmap(b);
Add(new Box Add(new Box
{ {
RelativeSizeAxes = Framework.Graphics.Axes.Both, RelativeSizeAxes = Framework.Graphics.Axes.Both,

View File

@ -13,13 +13,11 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"Settings visible in replay/auto"; public override string Description => @"Settings visible in replay/auto";
private ExampleContainer container; public TestCaseReplaySettingsOverlay()
public override void Reset()
{ {
base.Reset(); ExampleContainer container;
Add(new ReplaySettingsOverlay() Add(new ReplaySettingsOverlay
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,

View File

@ -28,9 +28,9 @@ namespace osu.Desktop.VisualTests.Tests
private WorkingBeatmap beatmap; private WorkingBeatmap beatmap;
public override void Reset() protected override void LoadComplete()
{ {
base.Reset(); base.LoadComplete();
if (beatmap == null) if (beatmap == null)
{ {
@ -39,8 +39,6 @@ namespace osu.Desktop.VisualTests.Tests
beatmap = db.GetWorkingBeatmap(beatmapInfo); beatmap = db.GetWorkingBeatmap(beatmapInfo);
} }
base.Reset();
Add(new Results(new Score Add(new Results(new Score
{ {
TotalScore = 2845370, TotalScore = 2845370,

View File

@ -17,9 +17,9 @@ namespace osu.Desktop.VisualTests.Tests
private RulesetDatabase rulesets; private RulesetDatabase rulesets;
public override void Reset() protected override void LoadComplete()
{ {
base.Reset(); base.LoadComplete();
var room = new Room var room = new Room
{ {

View File

@ -15,10 +15,8 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"Tests multiple counters"; public override string Description => @"Tests multiple counters";
public override void Reset() public TestCaseScoreCounter()
{ {
base.Reset();
int numerator = 0, denominator = 0; int numerator = 0, denominator = 0;
ScoreCounter score = new ScoreCounter(7) ScoreCounter score = new ScoreCounter(7)

View File

@ -21,16 +21,15 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => "SpeedAdjustmentContainer/DrawableTimingSection"; public override string Description => "SpeedAdjustmentContainer/DrawableTimingSection";
private SpeedAdjustmentCollection adjustmentCollection; private readonly BindableDouble timeRangeBindable;
private readonly OsuSpriteText bottomLabel;
private readonly SpriteText topTime;
private readonly SpriteText bottomTime;
private BindableDouble timeRangeBindable; public TestCaseScrollingHitObjects()
private OsuSpriteText timeRangeText;
private OsuSpriteText bottomLabel;
private SpriteText topTime, bottomTime;
public override void Reset()
{ {
base.Reset(); OsuSpriteText timeRangeText;
SpeedAdjustmentCollection adjustmentCollection;
timeRangeBindable = new BindableDouble(2000) timeRangeBindable = new BindableDouble(2000)
{ {

View File

@ -10,13 +10,16 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"Tests the settings overlay"; public override string Description => @"Tests the settings overlay";
private SettingsOverlay settings; private readonly SettingsOverlay settings;
public override void Reset() public TestCaseSettings()
{ {
base.Reset();
Children = new[] { settings = new SettingsOverlay() }; Children = new[] { settings = new SettingsOverlay() };
}
protected override void LoadComplete()
{
base.LoadComplete();
settings.ToggleVisibility(); settings.ToggleVisibility();
} }
} }

View File

@ -10,9 +10,10 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"Skip skip skippediskip"; public override string Description => @"Skip skip skippediskip";
public override void Reset() protected override void LoadComplete()
{ {
base.Reset(); base.LoadComplete();
Add(new SkipButton(Clock.CurrentTime + 5000)); Add(new SkipButton(Clock.CurrentTime + 5000));
} }
} }

View File

@ -11,10 +11,8 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"social browser overlay"; public override string Description => @"social browser overlay";
public override void Reset() public TestCaseSocial()
{ {
base.Reset();
SocialOverlay s = new SocialOverlay SocialOverlay s = new SocialOverlay
{ {
Users = new[] Users = new[]

View File

@ -15,15 +15,13 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"With fake data"; public override string Description => @"With fake data";
private SongProgress progress; private readonly SongProgress progress;
private SongProgressGraph graph; private readonly SongProgressGraph graph;
private StopwatchClock clock; private readonly StopwatchClock clock;
public override void Reset() public TestCaseSongProgress()
{ {
base.Reset();
clock = new StopwatchClock(true); clock = new StopwatchClock(true);
Add(progress = new SongProgress Add(progress = new SongProgress

View File

@ -14,10 +14,8 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"Filter for song select"; public override string Description => @"Filter for song select";
public override void Reset() public TestCaseTabControl()
{ {
base.Reset();
OsuSpriteText text; OsuSpriteText text;
OsuTabControl<GroupMode> filter; OsuTabControl<GroupMode> filter;
Add(filter = new OsuTabControl<GroupMode> Add(filter = new OsuTabControl<GroupMode>

View File

@ -16,10 +16,8 @@ namespace osu.Desktop.VisualTests.Tests
private bool kiai; private bool kiai;
public override void Reset() public TestCaseTaikoHitObjects()
{ {
base.Reset();
AddToggleStep("Kiai", b => AddToggleStep("Kiai", b =>
{ {
kiai = !kiai; kiai = !kiai;

View File

@ -26,13 +26,11 @@ namespace osu.Desktop.VisualTests.Tests
protected override double TimePerAction => default_duration * 2; protected override double TimePerAction => default_duration * 2;
private readonly Random rng = new Random(1337); private readonly Random rng = new Random(1337);
private TaikoPlayfield playfield; private readonly TaikoPlayfield playfield;
private Container playfieldContainer; private readonly Container playfieldContainer;
public override void Reset() public TestCaseTaikoPlayfield()
{ {
base.Reset();
AddStep("Hit!", addHitJudgement); AddStep("Hit!", addHitJudgement);
AddStep("Miss :(", addMissJudgement); AddStep("Miss :(", addMissJudgement);
AddStep("DrumRoll", () => addDrumRoll(false)); AddStep("DrumRoll", () => addDrumRoll(false));

View File

@ -16,10 +16,8 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"Tests display of icons"; public override string Description => @"Tests display of icons";
public override void Reset() public TestCaseTextAwesome()
{ {
base.Reset();
FillFlowContainer flow; FillFlowContainer flow;
Add(flow = new FillFlowContainer Add(flow = new FillFlowContainer

View File

@ -10,10 +10,8 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"Mostly back button"; public override string Description => @"Mostly back button";
public override void Reset() public TestCaseTwoLayerButton()
{ {
base.Reset();
Add(new BackButton()); Add(new BackButton());
} }
} }

View File

@ -13,10 +13,8 @@ namespace osu.Desktop.VisualTests.Tests
{ {
public override string Description => @"Panels for displaying a user's status"; public override string Description => @"Panels for displaying a user's status";
public override void Reset() public TestCaseUserPanel()
{ {
base.Reset();
UserPanel flyte; UserPanel flyte;
UserPanel peppy; UserPanel peppy;
Add(new FillFlowContainer Add(new FillFlowContainer

View File

@ -187,6 +187,7 @@
<ItemGroup> <ItemGroup>
<Compile Include="AutomatedVisualTestGame.cs" /> <Compile Include="AutomatedVisualTestGame.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Tests\TestCaseBeatSyncedContainer.cs" />
<Compile Include="Tests\TestCaseChatDisplay.cs" /> <Compile Include="Tests\TestCaseChatDisplay.cs" />
<Compile Include="Tests\TestCaseBeatmapDetails.cs" /> <Compile Include="Tests\TestCaseBeatmapDetails.cs" />
<Compile Include="Tests\TestCaseContextMenu.cs" /> <Compile Include="Tests\TestCaseContextMenu.cs" />

View File

@ -11,6 +11,7 @@ using System.Reflection;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using osu.Framework.Graphics.Containers;
using osu.Game.Screens.Menu; using osu.Game.Screens.Menu;
namespace osu.Desktop namespace osu.Desktop
@ -22,18 +23,22 @@ namespace osu.Desktop
public OsuGameDesktop(string[] args = null) public OsuGameDesktop(string[] args = null)
: base(args) : base(args)
{ {
versionManager = new VersionManager { Depth = int.MinValue }; versionManager = new VersionManager
{
Depth = int.MinValue,
State = Visibility.Hidden
};
} }
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
LoadComponentAsync(versionManager); LoadComponentAsync(versionManager, Add);
ScreenChanged += s => ScreenChanged += s =>
{ {
if (!versionManager.IsAlive && s is Intro) if (!versionManager.IsPresent && s is Intro)
Add(versionManager); versionManager.State = Visibility.Visible;
}; };
} }

View File

@ -93,12 +93,6 @@ namespace osu.Desktop.Overlays
checkForUpdateAsync(); checkForUpdateAsync();
} }
protected override void LoadComplete()
{
base.LoadComplete();
State = Visibility.Visible;
}
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)
{ {
base.Dispose(isDisposing); base.Dispose(isDisposing);

View File

@ -5,18 +5,17 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Graphics.Transforms;
using OpenTK; using OpenTK;
namespace osu.Game.Rulesets.Catch.Objects.Drawable namespace osu.Game.Rulesets.Catch.Objects.Drawable
{ {
internal class DrawableFruit : Sprite internal class DrawableFruit : Sprite
{ {
private readonly CatchBaseHit h; //private readonly CatchBaseHit h;
public DrawableFruit(CatchBaseHit h) public DrawableFruit(CatchBaseHit h)
{ {
this.h = h; //this.h = h;
Origin = Anchor.Centre; Origin = Anchor.Centre;
Scale = new Vector2(0.1f); Scale = new Vector2(0.1f);
@ -29,10 +28,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
{ {
Texture = textures.Get(@"Menu/logo"); Texture = textures.Get(@"Menu/logo");
const double duration = 0; //Transforms.Add(new TransformPosition { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = new Vector2(h.Position, -0.1f), EndValue = new Vector2(h.Position, 0.9f) });
//Transforms.Add(new TransformAlpha { StartTime = h.StartTime + duration + 200, EndTime = h.StartTime + duration + 400, StartValue = 1, EndValue = 0 });
Transforms.Add(new TransformPosition { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = new Vector2(h.Position, -0.1f), EndValue = new Vector2(h.Position, 0.9f) });
Transforms.Add(new TransformAlpha { StartTime = h.StartTime + duration + 200, EndTime = h.StartTime + duration + 400, StartValue = 1, EndValue = 0 });
Expire(true); Expire(true);
} }
} }

View File

@ -235,7 +235,7 @@ namespace osu.Game.Rulesets.Mania.UI
private void transformVisibleTimeRangeTo(double newTimeRange, double duration = 0, EasingTypes easing = EasingTypes.None) private void transformVisibleTimeRangeTo(double newTimeRange, double duration = 0, EasingTypes easing = EasingTypes.None)
{ {
TransformTo(() => visibleTimeRange.Value, newTimeRange, duration, easing, new TransformTimeSpan()); TransformTo(newTimeRange, duration, easing, new TransformTimeSpan());
} }
protected override void Update() protected override void Update()
@ -247,7 +247,7 @@ namespace osu.Game.Rulesets.Mania.UI
private class TransformTimeSpan : Transform<double, Drawable> private class TransformTimeSpan : Transform<double, Drawable>
{ {
public override double CurrentValue public double CurrentValue
{ {
get get
{ {
@ -259,13 +259,8 @@ namespace osu.Game.Rulesets.Mania.UI
} }
} }
public override void Apply(Drawable d) public override void Apply(Drawable d) => ((ManiaPlayfield)d).visibleTimeRange.Value = (float)CurrentValue;
{ public override void ReadIntoStartValue(Drawable d) => StartValue = ((ManiaPlayfield)d).visibleTimeRange.Value;
base.Apply(d);
var p = (ManiaPlayfield)d;
p.visibleTimeRange.Value = (float)CurrentValue;
}
} }
} }
} }

View File

@ -89,11 +89,15 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{ {
base.UpdateInitialState(); base.UpdateInitialState();
//sane defaults // sane defaults
ring.Alpha = circle.Alpha = number.Alpha = glow.Alpha = 1; ring.Show();
ApproachCircle.Alpha = 0; circle.Show();
ApproachCircle.Scale = new Vector2(4); number.Show();
explode.Alpha = 0; glow.Show();
ApproachCircle.Hide();
ApproachCircle.ScaleTo(new Vector2(4));
explode.Hide();
} }
protected override void UpdatePreemptState() protected override void UpdatePreemptState()
@ -106,43 +110,45 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
protected override void UpdateCurrentState(ArmedState state) protected override void UpdateCurrentState(ArmedState state)
{ {
ApproachCircle.FadeOut(); double duration = ((HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime) - HitObject.StartTime;
double endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; using (glow.BeginDelayedSequence(duration))
double duration = endTime - HitObject.StartTime; glow.FadeOut(400);
glow.Delay(duration);
glow.FadeOut(400);
switch (state) switch (state)
{ {
case ArmedState.Idle: case ArmedState.Idle:
Delay(duration + TIME_PREEMPT); using (BeginDelayedSequence(duration + TIME_PREEMPT))
FadeOut(TIME_FADEOUT); FadeOut(TIME_FADEOUT);
Expire(true); Expire(true);
break; break;
case ArmedState.Miss: case ArmedState.Miss:
ApproachCircle.FadeOut(50);
FadeOut(TIME_FADEOUT / 5); FadeOut(TIME_FADEOUT / 5);
Expire(); Expire();
break; break;
case ArmedState.Hit: case ArmedState.Hit:
ApproachCircle.FadeOut(50);
const double flash_in = 40; const double flash_in = 40;
flash.FadeTo(0.8f, flash_in); flash.FadeTo(0.8f, flash_in);
flash.Delay(flash_in); using (flash.BeginDelayedSequence(flash_in))
flash.FadeOut(100); flash.FadeOut(100);
explode.FadeIn(flash_in); explode.FadeIn(flash_in);
Delay(flash_in, true); using (BeginDelayedSequence(flash_in, true))
{
//after the flash, we can hide some elements that were behind it
ring.FadeOut();
circle.FadeOut();
number.FadeOut();
//after the flash, we can hide some elements that were behind it FadeOut(800);
ring.FadeOut(); ScaleTo(Scale * 1.5f, 400, EasingTypes.OutQuad);
circle.FadeOut(); }
number.FadeOut();
FadeOut(800);
ScaleTo(Scale * 1.5f, 400, EasingTypes.OutQuad);
Expire(); Expire();
break; break;
} }

View File

@ -17,6 +17,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
: base(hitObject) : base(hitObject)
{ {
AccentColour = HitObject.ComboColour; AccentColour = HitObject.ComboColour;
Alpha = 0;
} }
protected override OsuJudgement CreateJudgement() => new OsuJudgement { MaxScore = OsuScoreResult.Hit300 }; protected override OsuJudgement CreateJudgement() => new OsuJudgement { MaxScore = OsuScoreResult.Hit300 };
@ -25,10 +26,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{ {
Flush(); Flush();
UpdateInitialState();
using (BeginAbsoluteSequence(HitObject.StartTime - TIME_PREEMPT, true)) using (BeginAbsoluteSequence(HitObject.StartTime - TIME_PREEMPT, true))
{ {
UpdateInitialState();
UpdatePreemptState(); UpdatePreemptState();
using (BeginDelayedSequence(TIME_PREEMPT + Judgement.TimeOffset, true)) using (BeginDelayedSequence(TIME_PREEMPT + Judgement.TimeOffset, true))
@ -36,8 +37,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
} }
} }
protected virtual void UpdateCurrentState(ArmedState state) protected virtual void UpdateInitialState()
{ {
Hide();
} }
protected virtual void UpdatePreemptState() protected virtual void UpdatePreemptState()
@ -45,9 +47,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
FadeIn(TIME_FADEIN); FadeIn(TIME_FADEIN);
} }
protected virtual void UpdateInitialState() protected virtual void UpdateCurrentState(ArmedState state)
{ {
Alpha = 0;
} }
} }

View File

@ -28,10 +28,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
public DrawableSlider(Slider s) : base(s) public DrawableSlider(Slider s) : base(s)
{ {
// Since the DrawableSlider itself is just a container without a size we need to
// pass all input through.
AlwaysReceiveInput = true;
SliderBouncer bouncer1; SliderBouncer bouncer1;
slider = s; slider = s;
@ -129,7 +125,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{ {
if (!userTriggered && Time.Current >= slider.EndTime) if (!userTriggered && Time.Current >= slider.EndTime)
{ {
var ticksCount = ticks.Children.Count() + 1; var ticksCount = ticks.Children.Count + 1;
var ticksHit = ticks.Children.Count(t => t.Judgement.Result == HitResult.Hit); var ticksHit = ticks.Children.Count(t => t.Judgement.Result == HitResult.Hit);
if (initialCircle.Judgement.Result == HitResult.Hit) if (initialCircle.Judgement.Result == HitResult.Hit)
ticksHit++; ticksHit++;

View File

@ -38,8 +38,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
public DrawableSpinner(Spinner s) : base(s) public DrawableSpinner(Spinner s) : base(s)
{ {
AlwaysReceiveInput = true;
Origin = Anchor.Centre; Origin = Anchor.Centre;
Position = s.Position; Position = s.Position;

View File

@ -118,7 +118,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
base.Update(); base.Update();
if (Time.Current < slider.EndTime) if (Time.Current < slider.EndTime)
Tracking = canCurrentlyTrack && lastState != null && Contains(lastState.Mouse.NativeState.Position) && lastState.Mouse.HasMainButtonPressed; Tracking = canCurrentlyTrack && lastState != null && ReceiveMouseInputAt(lastState.Mouse.NativeState.Position) && lastState.Mouse.HasMainButtonPressed;
} }
public void UpdateProgress(double progress, int repeat) public void UpdateProgress(double progress, int repeat)

View File

@ -37,8 +37,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
icon.RotateTo(360, 1000); using (icon.BeginLoopedSequence())
icon.Loop(); icon.RotateTo(360, 1000);
} }
public void UpdateProgress(double progress, int repeat) public void UpdateProgress(double progress, int repeat)

View File

@ -31,7 +31,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{ {
spinner = s; spinner = s;
AlwaysReceiveInput = true;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
Children = new Drawable[] Children = new Drawable[]
@ -40,6 +39,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
}; };
} }
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
private bool tracking; private bool tracking;
public bool Tracking public bool Tracking
{ {

View File

@ -111,7 +111,7 @@ namespace osu.Game.Tests.Beatmaps.IO
return osu; return osu;
} }
private void ensureLoaded(GameHost host, int timeout = 10000) private void ensureLoaded(GameHost host, int timeout = 60000)
{ {
IEnumerable<BeatmapSetInfo> resultSets = null; IEnumerable<BeatmapSetInfo> resultSets = null;

View File

@ -93,6 +93,7 @@ namespace osu.Game.Beatmaps.Drawables
{ {
new BeatmapBackgroundSprite(working) new BeatmapBackgroundSprite(working)
{ {
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
FillMode = FillMode.Fill, FillMode = FillMode.Fill,

View File

@ -26,6 +26,7 @@ namespace osu.Game.Graphics.Backgrounds
Add(Sprite = new Sprite Add(Sprite = new Sprite
{ {
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Colour = Color4.DarkGray, Colour = Color4.DarkGray,

View File

@ -23,6 +23,16 @@ namespace osu.Game.Graphics.Containers
/// </summary> /// </summary>
protected double EarlyActivationMilliseconds; protected double EarlyActivationMilliseconds;
/// <summary>
/// The time in milliseconds until the next beat.
/// </summary>
public double TimeUntilNextBeat { get; private set; }
/// <summary>
/// The time in milliseconds since the last beat
/// </summary>
public double TimeSinceLastBeat { get; private set; }
protected override void Update() protected override void Update()
{ {
if (Beatmap.Value?.Track == null) if (Beatmap.Value?.Track == null)
@ -42,12 +52,16 @@ namespace osu.Game.Graphics.Containers
if (currentTrackTime < timingPoint.Time) if (currentTrackTime < timingPoint.Time)
beatIndex--; beatIndex--;
TimeUntilNextBeat = (timingPoint.Time - currentTrackTime) % timingPoint.BeatLength;
if (TimeUntilNextBeat < 0)
TimeUntilNextBeat += timingPoint.BeatLength;
TimeSinceLastBeat = timingPoint.BeatLength - TimeUntilNextBeat;
if (timingPoint == lastTimingPoint && beatIndex == lastBeat) if (timingPoint == lastTimingPoint && beatIndex == lastBeat)
return; return;
double offsetFromBeat = (timingPoint.Time - currentTrackTime) % timingPoint.BeatLength; using (BeginDelayedSequence(-TimeSinceLastBeat, true))
using (BeginDelayedSequence(offsetFromBeat, true))
OnNewBeat(beatIndex, timingPoint, effectPoint, Beatmap.Value.Track.CurrentAmplitudes); OnNewBeat(beatIndex, timingPoint, effectPoint, Beatmap.Value.Track.CurrentAmplitudes);
lastBeat = beatIndex; lastBeat = beatIndex;

View File

@ -0,0 +1,35 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
namespace osu.Game.Graphics.Containers
{
public class OsuClickableContainer : ClickableContainer
{
protected SampleChannel SampleClick, SampleHover;
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
SampleHover = audio.Sample.Get(@"UI/generic-hover");
SampleClick = audio.Sample.Get(@"UI/generic-click");
}
protected override bool OnHover(InputState state)
{
SampleHover?.Play();
return base.OnHover(state);
}
protected override bool OnClick(InputState state)
{
SampleClick?.Play();
return base.OnClick(state);
}
}
}

View File

@ -0,0 +1,38 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Graphics.Containers
{
public class OsuFocusedOverlayContainer : FocusedOverlayContainer
{
private SampleChannel samplePopIn;
private SampleChannel samplePopOut;
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
samplePopIn = audio.Sample.Get(@"UI/melodic-5");
samplePopOut = audio.Sample.Get(@"UI/melodic-4");
StateChanged += OsuFocusedOverlayContainer_StateChanged;
}
private void OsuFocusedOverlayContainer_StateChanged(VisibilityContainer arg1, Visibility arg2)
{
switch (arg2)
{
case Visibility.Visible:
samplePopIn?.Play();
break;
case Visibility.Hidden:
samplePopOut?.Play();
break;
}
}
}
}

View File

@ -19,8 +19,6 @@ namespace osu.Game.Graphics.Containers
public ParallaxContainer() public ParallaxContainer()
{ {
AlwaysReceiveInput = true;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
AddInternal(content = new Container AddInternal(content = new Container
{ {

View File

@ -65,7 +65,6 @@ namespace osu.Game.Graphics.Cursor
// as we are currently very dependent on having a running clock, let's make our own clock for the time being. // as we are currently very dependent on having a running clock, let's make our own clock for the time being.
Clock = new FramedClock(); Clock = new FramedClock();
AlwaysReceiveInput = true;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
for (int i = 0; i < max_sprites; i++) for (int i = 0; i < max_sprites; i++)
@ -75,6 +74,8 @@ namespace osu.Game.Graphics.Cursor
} }
} }
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(ShaderManager shaders, TextureStore textures) private void load(ShaderManager shaders, TextureStore textures)
{ {

View File

@ -10,9 +10,5 @@ namespace osu.Game.Graphics.Cursor
public class OsuContextMenuContainer : ContextMenuContainer public class OsuContextMenuContainer : ContextMenuContainer
{ {
protected override ContextMenu<ContextMenuItem> CreateContextMenu() => new OsuContextMenu<ContextMenuItem>(); protected override ContextMenu<ContextMenuItem> CreateContextMenu() => new OsuContextMenu<ContextMenuItem>();
public OsuContextMenuContainer(CursorContainer cursor) : base(cursor)
{
}
} }
} }

View File

@ -15,7 +15,7 @@ namespace osu.Game.Graphics.Cursor
{ {
public class OsuTooltipContainer : TooltipContainer public class OsuTooltipContainer : TooltipContainer
{ {
protected override Tooltip CreateTooltip() => new OsuTooltip(); protected override ITooltip CreateTooltip() => new OsuTooltip();
public OsuTooltipContainer(CursorContainer cursor) : base(cursor) public OsuTooltipContainer(CursorContainer cursor) : base(cursor)
{ {

View File

@ -30,7 +30,7 @@ namespace osu.Game.Graphics
public static void FadeAccent<T>(this T accentedDrawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None) public static void FadeAccent<T>(this T accentedDrawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None)
where T : Transformable<Drawable>, IHasAccentColour where T : Transformable<Drawable>, IHasAccentColour
{ {
accentedDrawable.TransformTo(() => accentedDrawable.AccentColour, newColour, duration, easing, new TransformAccent()); accentedDrawable.TransformTo(newColour, duration, easing, new TransformAccent());
} }
} }
} }

View File

@ -12,7 +12,6 @@ namespace osu.Game.Graphics.Processing
{ {
public RatioAdjust() public RatioAdjust()
{ {
AlwaysReceiveInput = true;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
} }

View File

@ -13,7 +13,7 @@ namespace osu.Game.Graphics.Transforms
/// <summary> /// <summary>
/// Current value of the transformed colour in linear colour space. /// Current value of the transformed colour in linear colour space.
/// </summary> /// </summary>
public override Color4 CurrentValue public virtual Color4 CurrentValue
{ {
get get
{ {
@ -25,13 +25,7 @@ namespace osu.Game.Graphics.Transforms
} }
} }
public override void Apply(Drawable d) public override void Apply(Drawable d) => ((IHasAccentColour)d).AccentColour = CurrentValue;
{ public override void ReadIntoStartValue(Drawable d) => StartValue = ((IHasAccentColour)d).AccentColour;
base.Apply(d);
var accented = d as IHasAccentColour;
if (accented != null)
accented.AccentColour = CurrentValue;
}
} }
} }

View File

@ -2,7 +2,6 @@
// 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 osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Graphics; using osu.Framework.Graphics;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
@ -18,9 +17,8 @@ namespace osu.Game.Graphics.UserInterface
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio, OsuColour colours) private void load(OsuColour colours)
{ {
ActivationSound = audio.Sample.Get(@"Menu/menuback");
BackgroundColour = colours.Pink; BackgroundColour = colours.Pink;
HoverColour = colours.PinkDark; HoverColour = colours.PinkDark;
} }

View File

@ -29,7 +29,7 @@ namespace osu.Game.Graphics.UserInterface
base.Direction = (direction & BarDirection.Horizontal) > 0 ? FillDirection.Vertical : FillDirection.Horizontal; base.Direction = (direction & BarDirection.Horizontal) > 0 ? FillDirection.Vertical : FillDirection.Horizontal;
foreach (var bar in Children) foreach (var bar in Children)
{ {
bar.Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / Children.Count()) : new Vector2(1.0f / Children.Count(), 1); bar.Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / Children.Count) : new Vector2(1.0f / Children.Count, 1);
bar.Direction = direction; bar.Direction = direction;
} }
} }

View File

@ -38,7 +38,7 @@ namespace osu.Game.Graphics.UserInterface
public readonly TextAwesome Chevron; public readonly TextAwesome Chevron;
//don't allow clicking between transitions and don't make the chevron clickable //don't allow clicking between transitions and don't make the chevron clickable
protected override bool InternalContains(Vector2 screenSpacePos) => Alpha == 1f && Text.Contains(screenSpacePos); public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => Alpha == 1f && Text.ReceiveMouseInputAt(screenSpacePos);
public override bool HandleInput => State == Visibility.Visible; public override bool HandleInput => State == Visibility.Visible;
private Visibility state; private Visibility state;

View File

@ -8,14 +8,14 @@ using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Audio.Sample;
using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Game.Graphics.Containers;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
public class DialogButton : ClickableContainer public class DialogButton : OsuClickableContainer
{ {
private const float hover_width = 0.9f; private const float hover_width = 0.9f;
private const float hover_duration = 500; private const float hover_duration = 500;
@ -79,8 +79,6 @@ namespace osu.Game.Graphics.UserInterface
} }
} }
public SampleChannel SampleClick, SampleHover;
private readonly Container backgroundContainer; private readonly Container backgroundContainer;
private readonly Container colourContainer; private readonly Container colourContainer;
private readonly Container glowContainer; private readonly Container glowContainer;
@ -93,15 +91,13 @@ namespace osu.Game.Graphics.UserInterface
private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's when clicking private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's when clicking
protected override bool InternalContains(Vector2 screenSpacePos) => backgroundContainer.Contains(screenSpacePos); public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => backgroundContainer.ReceiveMouseInputAt(screenSpacePos);
protected override bool OnClick(Framework.Input.InputState state) protected override bool OnClick(Framework.Input.InputState state)
{ {
didClick = true; didClick = true;
colourContainer.ResizeTo(new Vector2(1.5f, 1f), click_duration, EasingTypes.In); colourContainer.ResizeTo(new Vector2(1.5f, 1f), click_duration, EasingTypes.In);
flash(); flash();
SampleClick?.Play();
Action?.Invoke();
Delay(click_duration); Delay(click_duration);
Schedule(delegate { Schedule(delegate {
@ -110,7 +106,7 @@ namespace osu.Game.Graphics.UserInterface
glowContainer.FadeOut(); glowContainer.FadeOut();
}); });
return true; return base.OnClick(state);
} }
protected override bool OnHover(Framework.Input.InputState state) protected override bool OnHover(Framework.Input.InputState state)
@ -119,7 +115,7 @@ namespace osu.Game.Graphics.UserInterface
colourContainer.ResizeTo(new Vector2(hover_width, 1f), hover_duration, EasingTypes.OutElastic); colourContainer.ResizeTo(new Vector2(hover_width, 1f), hover_duration, EasingTypes.OutElastic);
glowContainer.FadeIn(glow_fade_duration, EasingTypes.Out); glowContainer.FadeIn(glow_fade_duration, EasingTypes.Out);
SampleHover?.Play(); base.OnHover(state);
return true; return true;
} }

View File

@ -9,10 +9,11 @@ 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.Framework.Input; using osu.Framework.Input;
using osu.Game.Graphics.Containers;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
public class IconButton : ClickableContainer public class IconButton : OsuClickableContainer
{ {
private readonly TextAwesome icon; private readonly TextAwesome icon;
private readonly Box hover; private readonly Box hover;

View File

@ -34,9 +34,8 @@ namespace osu.Game.Graphics.UserInterface
{ {
base.LoadComplete(); base.LoadComplete();
spinner.RotateTo(360, 2000); using (spinner.BeginLoopedSequence())
using (spinner.BeginDelayedSequence(2000)) spinner.RotateTo(360, 2000);
spinner.Loop();
} }
private const float transition_duration = 500; private const float transition_duration = 500;

View File

@ -3,6 +3,8 @@
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
@ -18,6 +20,9 @@ namespace osu.Game.Graphics.UserInterface
{ {
private Box hover; private Box hover;
private SampleChannel sampleClick;
private SampleChannel sampleHover;
public OsuButton() public OsuButton()
{ {
Height = 40; Height = 40;
@ -34,7 +39,7 @@ namespace osu.Game.Graphics.UserInterface
public override bool HandleInput => Action != null; public override bool HandleInput => Action != null;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours, AudioManager audio)
{ {
if (Action == null) if (Action == null)
Colour = OsuColour.Gray(0.5f); Colour = OsuColour.Gray(0.5f);
@ -60,10 +65,20 @@ namespace osu.Game.Graphics.UserInterface
Alpha = 0, Alpha = 0,
}, },
}); });
sampleClick = audio.Sample.Get(@"UI/generic-click");
sampleHover = audio.Sample.Get(@"UI/generic-hover");
}
protected override bool OnClick(InputState state)
{
sampleClick?.Play();
return base.OnClick(state);
} }
protected override bool OnHover(InputState state) protected override bool OnHover(InputState state)
{ {
sampleHover?.Play();
hover.FadeIn(200); hover.FadeIn(200);
return base.OnHover(state); return base.OnHover(state);
} }

View File

@ -106,8 +106,8 @@ namespace osu.Game.Graphics.UserInterface
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio) private void load(AudioManager audio)
{ {
sampleChecked = audio.Sample.Get(@"Checkbox/check-on"); sampleChecked = audio.Sample.Get(@"UI/check-on");
sampleUnchecked = audio.Sample.Get(@"Checkbox/check-off"); sampleUnchecked = audio.Sample.Get(@"UI/check-off");
} }
} }
} }

View File

@ -65,8 +65,8 @@ namespace osu.Game.Graphics.UserInterface
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio) private void load(AudioManager audio)
{ {
sampleHover = audio.Sample.Get(@"Menu/menuclick"); sampleHover = audio.Sample.Get(@"UI/generic-hover");
sampleClick = audio.Sample.Get(@"Menu/menuback"); sampleClick = audio.Sample.Get(@"UI/generic-click");
BackgroundColour = Color4.Transparent; BackgroundColour = Color4.Transparent;
BackgroundColourHover = OsuColour.FromHex(@"172023"); BackgroundColourHover = OsuColour.FromHex(@"172023");

View File

@ -100,7 +100,7 @@ namespace osu.Game.Graphics.UserInterface
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio, OsuColour colours) private void load(AudioManager audio, OsuColour colours)
{ {
sample = audio.Sample.Get(@"Sliderbar/sliderbar"); sample = audio.Sample.Get(@"UI/sliderbar-notch");
AccentColour = colours.Pink; AccentColour = colours.Pink;
} }

View File

@ -23,8 +23,6 @@ namespace osu.Game.Graphics.UserInterface
protected override TabItem<T> CreateTabItem(T value) => new OsuTabItem(value); protected override TabItem<T> CreateTabItem(T value) => new OsuTabItem(value);
protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || Dropdown.Contains(screenSpacePos);
private bool isEnumType => typeof(T).IsEnum; private bool isEnumType => typeof(T).IsEnum;
public OsuTabControl() public OsuTabControl()

View File

@ -47,7 +47,7 @@ namespace osu.Game.Graphics.UserInterface
protected class TransformAccuracy : Transform<double, Drawable> protected class TransformAccuracy : Transform<double, Drawable>
{ {
public override double CurrentValue public virtual double CurrentValue
{ {
get get
{ {
@ -59,11 +59,8 @@ namespace osu.Game.Graphics.UserInterface
} }
} }
public override void Apply(Drawable d) public override void Apply(Drawable d) => ((PercentageCounter)d).DisplayedCount = CurrentValue;
{ public override void ReadIntoStartValue(Drawable d) => StartValue = ((PercentageCounter)d).DisplayedCount;
base.Apply(d);
((PercentageCounter)d).DisplayedCount = CurrentValue;
}
} }
} }
} }

View File

@ -210,7 +210,6 @@ namespace osu.Game.Graphics.UserInterface
transform.StartTime = TransformStartTime; transform.StartTime = TransformStartTime;
transform.EndTime = TransformStartTime + rollingTotalDuration; transform.EndTime = TransformStartTime + rollingTotalDuration;
transform.StartValue = currentValue;
transform.EndValue = newValue; transform.EndValue = newValue;
transform.Easing = RollingEasing; transform.Easing = RollingEasing;

View File

@ -58,7 +58,7 @@ namespace osu.Game.Graphics.UserInterface
protected class TransformScore : Transform<double, Drawable> protected class TransformScore : Transform<double, Drawable>
{ {
public override double CurrentValue public virtual double CurrentValue
{ {
get get
{ {
@ -70,11 +70,8 @@ namespace osu.Game.Graphics.UserInterface
} }
} }
public override void Apply(Drawable d) public override void Apply(Drawable d) => ((ScoreCounter)d).DisplayedCount = CurrentValue;
{ public override void ReadIntoStartValue(Drawable d) => StartValue = ((ScoreCounter)d).DisplayedCount;
base.Apply(d);
((ScoreCounter)d).DisplayedCount = CurrentValue;
}
} }
} }
} }

View File

@ -39,7 +39,7 @@ namespace osu.Game.Graphics.UserInterface
private class TransformCounterCount : Transform<int, Drawable> private class TransformCounterCount : Transform<int, Drawable>
{ {
public override int CurrentValue public int CurrentValue
{ {
get get
{ {
@ -51,11 +51,8 @@ namespace osu.Game.Graphics.UserInterface
} }
} }
public override void Apply(Drawable d) public override void Apply(Drawable d) => ((SimpleComboCounter)d).DisplayedCount = CurrentValue;
{ public override void ReadIntoStartValue(Drawable d) => StartValue = ((SimpleComboCounter)d).DisplayedCount;
base.Apply(d);
((SimpleComboCounter)d).DisplayedCount = CurrentValue;
}
} }
} }
} }

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 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 osu.Framework.Audio.Sample;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
@ -18,7 +17,7 @@ using osu.Framework.Graphics.Shapes;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
public class TwoLayerButton : ClickableContainer public class TwoLayerButton : OsuClickableContainer
{ {
private readonly BouncingIcon bouncingIcon; private readonly BouncingIcon bouncingIcon;
@ -32,7 +31,6 @@ namespace osu.Game.Graphics.UserInterface
public static readonly Vector2 SIZE_EXTENDED = new Vector2(140, 50); public static readonly Vector2 SIZE_EXTENDED = new Vector2(140, 50);
public static readonly Vector2 SIZE_RETRACTED = new Vector2(100, 50); public static readonly Vector2 SIZE_RETRACTED = new Vector2(100, 50);
public SampleChannel ActivationSound;
private readonly SpriteText text; private readonly SpriteText text;
public Color4 HoverColour; public Color4 HoverColour;
@ -171,7 +169,7 @@ namespace osu.Game.Graphics.UserInterface
} }
} }
protected override bool InternalContains(Vector2 screenSpacePos) => IconLayer.Contains(screenSpacePos) || TextLayer.Contains(screenSpacePos); public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => IconLayer.ReceiveMouseInputAt(screenSpacePos) || TextLayer.ReceiveMouseInputAt(screenSpacePos);
protected override bool OnHover(InputState state) protected override bool OnHover(InputState state)
{ {
@ -210,8 +208,6 @@ namespace osu.Game.Graphics.UserInterface
flash.FadeOut(500, EasingTypes.OutQuint); flash.FadeOut(500, EasingTypes.OutQuint);
flash.Expire(); flash.Expire();
ActivationSound.Play();
return base.OnClick(state); return base.OnClick(state);
} }

View File

@ -37,9 +37,9 @@ namespace osu.Game
public APIAccess API; public APIAccess API;
protected override Container<Drawable> Content => ratioContainer; private Container content;
private RatioAdjust ratioContainer; protected override Container<Drawable> Content => content;
protected MenuCursor Cursor; protected MenuCursor Cursor;
@ -146,22 +146,19 @@ namespace osu.Game
{ {
base.LoadComplete(); base.LoadComplete();
base.Content.Add(ratioContainer = new RatioAdjust base.Content.Add(new RatioAdjust
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new Container Cursor = new MenuCursor(),
new OsuTooltipContainer(Cursor)
{ {
AlwaysReceiveInput = true,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Depth = float.MinValue, Child = content = new OsuContextMenuContainer
Children = new Drawable[]
{ {
Cursor = new MenuCursor(), RelativeSizeAxes = Axes.Both,
new OsuContextMenuContainer(Cursor) { Depth = -2 }, },
new OsuTooltipContainer(Cursor) { Depth = -1 }, }
}
},
} }
}); });

View File

@ -12,10 +12,11 @@ using osu.Framework.Input;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Online.Chat; using osu.Game.Online.Chat;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays.Chat namespace osu.Game.Overlays.Chat
{ {
public class ChannelListItem : ClickableContainer, IFilterable public class ChannelListItem : OsuClickableContainer, IFilterable
{ {
private const float width_padding = 5; private const float width_padding = 5;
private const float channel_width = 150; private const float channel_width = 150;

View File

@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Chat
public IEnumerable<Channel> Channels public IEnumerable<Channel> Channels
{ {
set { ChannelFlow.Children = value.Select(c => new ChannelListItem(c)); } set { ChannelFlow.ChildrenEnumerable = value.Select(c => new ChannelListItem(c)); }
} }
public ChannelSection() public ChannelSection()

View File

@ -16,10 +16,11 @@ using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Chat; using osu.Game.Online.Chat;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays.Chat namespace osu.Game.Overlays.Chat
{ {
public class ChannelSelectionOverlay : FocusedOverlayContainer public class ChannelSelectionOverlay : OsuFocusedOverlayContainer
{ {
public static readonly float WIDTH_PADDING = 170; public static readonly float WIDTH_PADDING = 170;
@ -38,7 +39,7 @@ namespace osu.Game.Overlays.Chat
{ {
set set
{ {
sectionsFlow.Children = value; sectionsFlow.ChildrenEnumerable = value;
foreach (ChannelSection s in sectionsFlow.Children) foreach (ChannelSection s in sectionsFlow.Children)
{ {

View File

@ -22,10 +22,11 @@ using osu.Framework.Input;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Overlays.Chat; using osu.Game.Overlays.Chat;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public class ChatOverlay : FocusedOverlayContainer, IOnlineComponent public class ChatOverlay : OsuFocusedOverlayContainer, IOnlineComponent
{ {
private const float textbox_height = 60; private const float textbox_height = 60;
private const float channel_selection_min_height = 0.3f; private const float channel_selection_min_height = 0.3f;
@ -59,7 +60,7 @@ namespace osu.Game.Overlays
private readonly Container channelSelectionContainer; private readonly Container channelSelectionContainer;
private readonly ChannelSelectionOverlay channelSelection; private readonly ChannelSelectionOverlay channelSelection;
protected override bool InternalContains(Vector2 screenSpacePos) => chatContainer.Contains(screenSpacePos) || channelSelection.State == Visibility.Visible && channelSelection.Contains(screenSpacePos); public override bool Contains(Vector2 screenSpacePos) => chatContainer.ReceiveMouseInputAt(screenSpacePos) || channelSelection.State == Visibility.Visible && channelSelection.ReceiveMouseInputAt(screenSpacePos);
public ChatOverlay() public ChatOverlay()
{ {
@ -193,7 +194,7 @@ namespace osu.Game.Overlays
protected override bool OnDragStart(InputState state) protected override bool OnDragStart(InputState state)
{ {
if (!channelTabs.Hovering) if (!channelTabs.IsHovered)
return base.OnDragStart(state); return base.OnDragStart(state);
startDragChatHeight = chatHeight.Value; startDragChatHeight = chatHeight.Value;

View File

@ -15,10 +15,11 @@ using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using OpenTK.Input; using OpenTK.Input;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays.Dialog namespace osu.Game.Overlays.Dialog
{ {
public class PopupDialog : FocusedOverlayContainer public class PopupDialog : OsuFocusedOverlayContainer
{ {
public static readonly float ENTER_DURATION = 500; public static readonly float ENTER_DURATION = 500;
public static readonly float EXIT_DURATION = 200; public static readonly float EXIT_DURATION = 200;
@ -56,7 +57,7 @@ namespace osu.Game.Overlays.Dialog
get { return buttonsContainer.Children; } get { return buttonsContainer.Children; }
set set
{ {
buttonsContainer.Children = value; buttonsContainer.ChildrenEnumerable = value;
foreach (PopupDialogButton b in value) foreach (PopupDialogButton b in value)
{ {
var action = b.Action; var action = b.Action;

View File

@ -2,7 +2,6 @@
// 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 osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Game.Graphics; using osu.Game.Graphics;
namespace osu.Game.Overlays.Dialog namespace osu.Game.Overlays.Dialog
@ -10,11 +9,9 @@ namespace osu.Game.Overlays.Dialog
public class PopupDialogCancelButton : PopupDialogButton public class PopupDialogCancelButton : PopupDialogButton
{ {
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours, AudioManager audio) private void load(OsuColour colours)
{ {
ButtonColour = colours.Blue; ButtonColour = colours.Blue;
SampleHover = audio.Sample.Get(@"Menu/menuclick");
SampleClick = audio.Sample.Get(@"Menu/menuback");
} }
} }
} }

View File

@ -2,7 +2,6 @@
// 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 osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Game.Graphics; using osu.Game.Graphics;
namespace osu.Game.Overlays.Dialog namespace osu.Game.Overlays.Dialog
@ -10,11 +9,9 @@ namespace osu.Game.Overlays.Dialog
public class PopupDialogOkButton : PopupDialogButton public class PopupDialogOkButton : PopupDialogButton
{ {
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours, AudioManager audio) private void load(OsuColour colours)
{ {
ButtonColour = colours.Pink; ButtonColour = colours.Pink;
SampleHover = audio.Sample.Get(@"Menu/menuclick");
SampleClick = audio.Sample.Get(@"Menu/menu-play-click");
} }
} }
} }

View File

@ -7,10 +7,11 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Overlays.Dialog; using osu.Game.Overlays.Dialog;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public class DialogOverlay : FocusedOverlayContainer public class DialogOverlay : OsuFocusedOverlayContainer
{ {
private readonly Container dialogContainer; private readonly Container dialogContainer;
private PopupDialog currentDialog; private PopupDialog currentDialog;

View File

@ -16,6 +16,7 @@ using osu.Framework.Graphics.Textures;
using System.Linq; using System.Linq;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays.Direct namespace osu.Game.Overlays.Direct
{ {
@ -151,7 +152,7 @@ namespace osu.Game.Overlays.Direct
}; };
} }
private class DownloadButton : ClickableContainer private class DownloadButton : OsuClickableContainer
{ {
private readonly TextAwesome icon; private readonly TextAwesome icon;

View File

@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Direct
SetInfo = setInfo; SetInfo = setInfo;
} }
protected IEnumerable<DifficultyIcon> GetDifficultyIcons() protected List<DifficultyIcon> GetDifficultyIcons()
{ {
var icons = new List<DifficultyIcon>(); var icons = new List<DifficultyIcon>();
@ -38,6 +38,7 @@ namespace osu.Game.Overlays.Direct
{ {
return new AsyncLoadWrapper(new BeatmapBackgroundSprite(new OnlineWorkingBeatmap(SetInfo.Beatmaps.FirstOrDefault(), textures, null)) return new AsyncLoadWrapper(new BeatmapBackgroundSprite(new OnlineWorkingBeatmap(SetInfo.Beatmaps.FirstOrDefault(), textures, null))
{ {
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fill, FillMode = FillMode.Fill,
OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out),
}) { RelativeSizeAxes = Axes.Both }; }) { RelativeSizeAxes = Axes.Both };

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Overlays.SearchableList; using osu.Game.Overlays.SearchableList;
namespace osu.Game.Overlays.Direct namespace osu.Game.Overlays.Direct
@ -42,7 +43,7 @@ namespace osu.Game.Overlays.Direct
} }
} }
private class RulesetToggleButton : ClickableContainer private class RulesetToggleButton : OsuClickableContainer
{ {
private readonly TextAwesome icon; private readonly TextAwesome icon;

View File

@ -129,7 +129,7 @@ namespace osu.Game.Overlays
private void recreatePanels(PanelDisplayStyle displayStyle) private void recreatePanels(PanelDisplayStyle displayStyle)
{ {
if (BeatmapSets == null) return; if (BeatmapSets == null) return;
panels.Children = BeatmapSets.Select(b => displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)new DirectGridPanel(b) { Width = 400 } : new DirectListPanel(b)); panels.ChildrenEnumerable = BeatmapSets.Select(b => displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)new DirectGridPanel(b) { Width = 400 } : new DirectListPanel(b));
} }
public class ResultCounts public class ResultCounts

View File

@ -75,7 +75,7 @@ namespace osu.Game.Overlays
private void updatePosition(float position, bool easing = true) private void updatePosition(float position, bool easing = true)
{ {
position = MathHelper.Clamp(position, 0, 1); position = MathHelper.Clamp(position, 0, 1);
Fill.TransformTo(() => Fill.Width, position, easing ? 200 : 0, EasingTypes.OutQuint, new TransformSeek()); Fill.TransformTo(position, easing ? 200 : 0, EasingTypes.OutQuint, new TransformSeek());
} }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
@ -100,11 +100,8 @@ namespace osu.Game.Overlays
private class TransformSeek : TransformFloat<Drawable> private class TransformSeek : TransformFloat<Drawable>
{ {
public override void Apply(Drawable d) public override void Apply(Drawable d) => d.Width = CurrentValue;
{ public override void ReadIntoStartValue(Drawable d) => StartValue = d.Width;
base.Apply(d);
d.Width = CurrentValue;
}
} }
} }
} }

View File

@ -8,10 +8,11 @@ using osu.Game.Graphics;
using osu.Game.Overlays.Settings.Sections.General; using osu.Game.Overlays.Settings.Sections.General;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
internal class LoginOverlay : FocusedOverlayContainer internal class LoginOverlay : OsuFocusedOverlayContainer
{ {
private LoginSettings settingsSection; private LoginSettings settingsSection;

View File

@ -151,8 +151,8 @@ namespace osu.Game.Overlays.Mods
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio) private void load(AudioManager audio)
{ {
sampleOn = audio.Sample.Get(@"Checkbox/check-on"); sampleOn = audio.Sample.Get(@"UI/check-on");
sampleOff = audio.Sample.Get(@"Checkbox/check-off"); sampleOff = audio.Sample.Get(@"UI/check-off");
} }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
@ -171,7 +171,7 @@ namespace osu.Game.Overlays.Mods
public void SelectNext() public void SelectNext()
{ {
(++SelectedIndex == -1 ? sampleOff : sampleOn).Play(); (++SelectedIndex == Mods.Length ? sampleOff : sampleOn).Play();
Action?.Invoke(SelectedMod); Action?.Invoke(SelectedMod);
} }

Some files were not shown because too many files have changed in this diff Show More