1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 22:06:08 +08:00

Merge branch 'master' into songselect-preview-fix

This commit is contained in:
Dean Herbert 2017-07-18 13:05:03 +09:00 committed by GitHub
commit b5035ec245
292 changed files with 5534 additions and 1550 deletions

10
.vscode/tasks.json vendored
View File

@ -9,15 +9,9 @@
"showOutput": "silent", "showOutput": "silent",
"args": [ "args": [
"/property:GenerateFullPaths=true", "/property:GenerateFullPaths=true",
"/property:DebugType=portable" "/property:DebugType=portable",
"/m" //parallel compiling support.
], ],
"windows": {
"args": [
"/property:GenerateFullPaths=true",
"/property:DebugType=portable",
"/m" //parallel compiling support. doesn't work well with mono atm
]
},
"tasks": [ "tasks": [
{ {
"taskName": "Build (Debug)", "taskName": "Build (Debug)",

@ -1 +1 @@
Subproject commit 3dd751659b5f8e3267146db1557ec43d77456b8e Subproject commit 991177da4fbed2dd8260c215f2d341ebc858b03e

@ -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

@ -6,8 +6,7 @@ using OpenTK.Graphics;
using osu.Framework.Graphics; 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.Sprites; 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();
@ -48,6 +48,17 @@ namespace osu.Desktop.VisualTests.Tests
Author = @"RLC", Author = @"RLC",
Source = @"", Source = @"",
}, },
OnlineInfo = new BeatmapSetOnlineInfo
{
Covers = new BeatmapSetOnlineCovers
{
Card = @"https://assets.ppy.sh/beatmaps/578332/covers/card.jpg?1494591390",
Cover = @"https://assets.ppy.sh/beatmaps/578332/covers/cover.jpg?1494591390",
},
Preview = @"https://b.ppy.sh/preview/578332.mp3",
PlayCount = 97,
FavouriteCount = 72,
},
Beatmaps = new List<BeatmapInfo> Beatmaps = new List<BeatmapInfo>
{ {
new BeatmapInfo new BeatmapInfo
@ -55,13 +66,6 @@ namespace osu.Desktop.VisualTests.Tests
Ruleset = ruleset, Ruleset = ruleset,
StarDifficulty = 5.35f, StarDifficulty = 5.35f,
Metadata = new BeatmapMetadata(), Metadata = new BeatmapMetadata(),
OnlineInfo = new BeatmapOnlineInfo
{
Covers = new[] { @"https://assets.ppy.sh//beatmaps/578332/covers/cover.jpg?1494591390" },
Preview = @"https://b.ppy.sh/preview/578332.mp3",
PlayCount = 97,
FavouriteCount = 72,
},
}, },
}, },
}, },
@ -74,6 +78,17 @@ namespace osu.Desktop.VisualTests.Tests
Author = @"Sotarks", Author = @"Sotarks",
Source = @"ぎんぎつね", Source = @"ぎんぎつね",
}, },
OnlineInfo = new BeatmapSetOnlineInfo
{
Covers = new BeatmapSetOnlineCovers
{
Card = @"https://assets.ppy.sh/beatmaps/599627/covers/card.jpg?1494539318",
Cover = @"https://assets.ppy.sh/beatmaps/599627/covers/cover.jpg?1494539318",
},
Preview = @"https//b.ppy.sh/preview/599627.mp3",
PlayCount = 3082,
FavouriteCount = 14,
},
Beatmaps = new List<BeatmapInfo> Beatmaps = new List<BeatmapInfo>
{ {
new BeatmapInfo new BeatmapInfo
@ -81,13 +96,6 @@ namespace osu.Desktop.VisualTests.Tests
Ruleset = ruleset, Ruleset = ruleset,
StarDifficulty = 5.81f, StarDifficulty = 5.81f,
Metadata = new BeatmapMetadata(), Metadata = new BeatmapMetadata(),
OnlineInfo = new BeatmapOnlineInfo
{
Covers = new[] { @"https://assets.ppy.sh//beatmaps/599627/covers/cover.jpg?1494539318" },
Preview = @"https//b.ppy.sh/preview/599627.mp3",
PlayCount = 3082,
FavouriteCount = 14,
},
}, },
}, },
}, },
@ -100,6 +108,17 @@ namespace osu.Desktop.VisualTests.Tests
Author = @"Cerulean Veyron", Author = @"Cerulean Veyron",
Source = @"", Source = @"",
}, },
OnlineInfo = new BeatmapSetOnlineInfo
{
Covers = new BeatmapSetOnlineCovers
{
Card = @"https://assets.ppy.sh/beatmaps/513268/covers/card.jpg?1494502863",
Cover = @"https://assets.ppy.sh/beatmaps/513268/covers/cover.jpg?1494502863",
},
Preview = @"https//b.ppy.sh/preview/513268.mp3",
PlayCount = 2762,
FavouriteCount = 15,
},
Beatmaps = new List<BeatmapInfo> Beatmaps = new List<BeatmapInfo>
{ {
new BeatmapInfo new BeatmapInfo
@ -107,13 +126,6 @@ namespace osu.Desktop.VisualTests.Tests
Ruleset = ruleset, Ruleset = ruleset,
StarDifficulty = 0.9f, StarDifficulty = 0.9f,
Metadata = new BeatmapMetadata(), Metadata = new BeatmapMetadata(),
OnlineInfo = new BeatmapOnlineInfo
{
Covers = new[] { @"https://assets.ppy.sh//beatmaps/513268/covers/cover.jpg?1494502863" },
Preview = @"https//b.ppy.sh/preview/513268.mp3",
PlayCount = 2762,
FavouriteCount = 15,
},
}, },
new BeatmapInfo new BeatmapInfo
{ {
@ -141,6 +153,17 @@ namespace osu.Desktop.VisualTests.Tests
Author = @"[Kamiya]", Author = @"[Kamiya]",
Source = @"小林さんちのメイドラゴン", Source = @"小林さんちのメイドラゴン",
}, },
OnlineInfo = new BeatmapSetOnlineInfo
{
Covers = new BeatmapSetOnlineCovers
{
Card = @"https://assets.ppy.sh/beatmaps/586841/covers/card.jpg?1494052741",
Cover = @"https://assets.ppy.sh/beatmaps/586841/covers/cover.jpg?1494052741",
},
Preview = @"https//b.ppy.sh/preview/586841.mp3",
PlayCount = 62317,
FavouriteCount = 161,
},
Beatmaps = new List<BeatmapInfo> Beatmaps = new List<BeatmapInfo>
{ {
new BeatmapInfo new BeatmapInfo
@ -148,13 +171,6 @@ namespace osu.Desktop.VisualTests.Tests
Ruleset = ruleset, Ruleset = ruleset,
StarDifficulty = 1.26f, StarDifficulty = 1.26f,
Metadata = new BeatmapMetadata(), Metadata = new BeatmapMetadata(),
OnlineInfo = new BeatmapOnlineInfo
{
Covers = new[] { @"https://assets.ppy.sh//beatmaps/586841/covers/cover.jpg?1494052741" },
Preview = @"https//b.ppy.sh/preview/586841.mp3",
PlayCount = 62317,
FavouriteCount = 161,
},
}, },
new BeatmapInfo new BeatmapInfo
{ {

View File

@ -8,6 +8,7 @@ using osu.Game.Screens.Multiplayer;
using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer;
using osu.Game.Users; using osu.Game.Users;
using osu.Game.Database; using osu.Game.Database;
using osu.Framework.Allocation;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
@ -15,60 +16,117 @@ 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() private RulesetDatabase rulesets;
protected override void LoadComplete()
{ {
base.Reset(); base.LoadComplete();
DrawableRoom first; DrawableRoom first;
DrawableRoom second;
Add(new FillFlowContainer Add(new FillFlowContainer
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Width = 500f, Width = 580f,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
first = new DrawableRoom(new Room()), first = new DrawableRoom(new Room
second = new DrawableRoom(new Room()), {
Name = { Value = @"Great Room Right Here" },
Host = { Value = new User { Username = @"Naeferith", Id = 9492835, Country = new Country { FlagName = @"FR" } } },
Status = { Value = new RoomStatusOpen() },
Type = { Value = new GameTypeTeamVersus() },
Beatmap =
{
Value = new BeatmapInfo
{
StarDifficulty = 4.65,
Ruleset = rulesets.GetRuleset(3),
Metadata = new BeatmapMetadata
{
Title = @"Critical Crystal",
Artist = @"Seiryu",
},
BeatmapSet = new BeatmapSetInfo
{
OnlineInfo = new BeatmapSetOnlineInfo
{
Covers = new BeatmapSetOnlineCovers
{
Cover = @"https://assets.ppy.sh//beatmaps/376340/covers/cover.jpg?1456478455",
},
},
},
},
},
Participants =
{
Value = new[]
{
new User { GlobalRank = 1355 },
new User { GlobalRank = 8756 },
},
},
}),
new DrawableRoom(new Room
{
Name = { Value = @"Relax It's The Weekend" },
Host = { Value = new User { Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" } } },
Status = { Value = new RoomStatusPlaying() },
Type = { Value = new GameTypeTagTeam() },
Beatmap =
{
Value = new BeatmapInfo
{
StarDifficulty = 1.96,
Ruleset = rulesets.GetRuleset(0),
Metadata = new BeatmapMetadata
{
Title = @"Serendipity",
Artist = @"ZAQ",
},
BeatmapSet = new BeatmapSetInfo
{
OnlineInfo = new BeatmapSetOnlineInfo
{
Covers = new BeatmapSetOnlineCovers
{
Cover = @"https://assets.ppy.sh//beatmaps/526839/covers/cover.jpg?1493815706",
},
},
},
},
},
Participants =
{
Value = new[]
{
new User { GlobalRank = 578975 },
new User { GlobalRank = 24554 },
},
},
}),
} }
}); });
first.Room.Name.Value = @"Great Room Right Here"; AddStep(@"change title", () => first.Room.Name.Value = @"I Changed Name");
first.Room.Host.Value = new User { Username = @"Naeferith", Id = 9492835, Country = new Country { FlagName = @"FR" } }; AddStep(@"change host", () => first.Room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } });
first.Room.Status.Value = new RoomStatusOpen(); AddStep(@"change status", () => first.Room.Status.Value = new RoomStatusPlaying());
first.Room.Beatmap.Value = new BeatmapMetadata { Title = @"Seiryu", Artist = @"Critical Crystal" }; AddStep(@"change type", () => first.Room.Type.Value = new GameTypeVersus());
AddStep(@"change beatmap", () => first.Room.Beatmap.Value = null);
second.Room.Name.Value = @"Relax It's The Weekend"; AddStep(@"change participants", () => first.Room.Participants.Value = new[]
second.Room.Host.Value = new User { Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" } };
second.Room.Status.Value = new RoomStatusPlaying();
second.Room.Beatmap.Value = new BeatmapMetadata { Title = @"ZAQ", Artist = @"Serendipity" };
AddStep(@"change state", () =>
{ {
first.Room.Status.Value = new RoomStatusPlaying(); new User { GlobalRank = 1254 },
new User { GlobalRank = 123189 },
}); });
}
AddStep(@"change name", () => [BackgroundDependencyLoader]
{ private void load(RulesetDatabase rulesets)
first.Room.Name.Value = @"I Changed Name"; {
}); this.rulesets = rulesets;
AddStep(@"change host", () =>
{
first.Room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } };
});
AddStep(@"change beatmap", () =>
{
first.Room.Beatmap.Value = null;
});
AddStep(@"change state", () =>
{
first.Room.Status.Value = new RoomStatusOpen();
});
} }
} }
} }

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>();
@ -76,7 +76,7 @@ namespace osu.Desktop.VisualTests.Tests
ControlPointInfo = controlPointInfo ControlPointInfo = controlPointInfo
}); });
Add(new Drawable[] AddRange(new Drawable[]
{ {
new Container new Container
{ {

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

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
@ -19,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

@ -0,0 +1,27 @@
// 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.Game.Overlays;
using osu.Game.Users;
namespace osu.Desktop.VisualTests.Tests
{
internal class TestCaseMedalOverlay : TestCase
{
public override string Description => @"medal get!";
public TestCaseMedalOverlay()
{
AddStep(@"display", () =>
{
LoadComponentAsync(new MedalOverlay(new Medal
{
Name = @"Animations",
InternalName = @"all-intro-doubletime",
Description = @"More complex than you think.",
}), Add);
});
}
}
}

View File

@ -3,9 +3,9 @@
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Sprites;
using osu.Game.Screens.Menu; using osu.Game.Screens.Menu;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
@ -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,12 +2,10 @@
// 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;
using OpenTK; using OpenTK;
using osu.Framework.Graphics.Sprites;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
@ -15,71 +13,61 @@ using osu.Game.Screens.Play;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Desktop.VisualTests.Beatmaps; using osu.Desktop.VisualTests.Beatmaps;
using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.Osu.UI;
using osu.Framework.Graphics.Shapes;
namespace osu.Desktop.VisualTests.Tests 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,
@ -48,7 +46,7 @@ namespace osu.Desktop.VisualTests.Tests
MaxCombo = 123, MaxCombo = 123,
Rank = ScoreRank.A, Rank = ScoreRank.A,
Date = DateTimeOffset.Now, Date = DateTimeOffset.Now,
Statistics = new Dictionary<string, dynamic>() Statistics = new Dictionary<string, dynamic>
{ {
{ "300", 50 }, { "300", 50 },
{ "100", 20 }, { "100", 20 },

View File

@ -0,0 +1,143 @@
// 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.Game.Screens.Multiplayer;
using osu.Game.Database;
using osu.Game.Online.Multiplayer;
using osu.Game.Users;
using osu.Framework.Allocation;
namespace osu.Desktop.VisualTests.Tests
{
internal class TestCaseRoomInspector : TestCase
{
public override string Description => @"from the multiplayer lobby";
private RulesetDatabase rulesets;
protected override void LoadComplete()
{
base.LoadComplete();
var room = new Room
{
Name = { Value = @"My Awesome Room" },
Host = { Value = new User { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" } } },
Status = { Value = new RoomStatusOpen() },
Type = { Value = new GameTypeTeamVersus() },
Beatmap =
{
Value = new BeatmapInfo
{
StarDifficulty = 3.7,
Ruleset = rulesets.GetRuleset(3),
Metadata = new BeatmapMetadata
{
Title = @"Platina",
Artist = @"Maaya Sakamoto",
Author = @"uwutm8",
},
BeatmapSet = new BeatmapSetInfo
{
OnlineInfo = new BeatmapSetOnlineInfo
{
Covers = new BeatmapSetOnlineCovers
{
Cover = @"https://assets.ppy.sh/beatmaps/560573/covers/cover.jpg?1492722343",
},
},
},
}
},
MaxParticipants = { Value = 200 },
Participants =
{
Value = new[]
{
new User { Username = @"flyte", Id = 3103765, GlobalRank = 1425 },
new User { Username = @"Cookiezi", Id = 124493, GlobalRank = 5466 },
new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 2873 },
new User { Username = @"Rafis", Id = 2558286, GlobalRank = 4687 },
new User { Username = @"hvick225", Id = 50265, GlobalRank = 3258 },
new User { Username = @"peppy", Id = 2, GlobalRank = 6251 }
}
}
};
RoomInspector inspector;
Add(inspector = new RoomInspector
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Room = room,
});
AddStep(@"change title", () => room.Name.Value = @"A Better Room Than The Above");
AddStep(@"change host", () => room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } });
AddStep(@"change status", () => room.Status.Value = new RoomStatusPlaying());
AddStep(@"change type", () => room.Type.Value = new GameTypeTag());
AddStep(@"change beatmap", () => room.Beatmap.Value = null);
AddStep(@"change max participants", () => room.MaxParticipants.Value = null);
AddStep(@"change participants", () => room.Participants.Value = new[]
{
new User { Username = @"filsdelama", Id = 2831793, GlobalRank = 8542 },
new User { Username = @"_index", Id = 652457, GlobalRank = 15024 }
});
AddStep(@"change room", () =>
{
var newRoom = new Room
{
Name = { Value = @"My New, Better Than Ever Room" },
Host = { Value = new User { Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" } } },
Status = { Value = new RoomStatusOpen() },
Type = { Value = new GameTypeTagTeam() },
Beatmap =
{
Value = new BeatmapInfo
{
StarDifficulty = 7.07,
Ruleset = rulesets.GetRuleset(0),
Metadata = new BeatmapMetadata
{
Title = @"FREEDOM DIVE",
Artist = @"xi",
Author = @"Nakagawa-Kanon",
},
BeatmapSet = new BeatmapSetInfo
{
OnlineInfo = new BeatmapSetOnlineInfo
{
Covers = new BeatmapSetOnlineCovers
{
Cover = @"https://assets.ppy.sh/beatmaps/39804/covers/cover.jpg?1456506845",
},
},
},
},
},
MaxParticipants = { Value = 10 },
Participants =
{
Value = new[]
{
new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 4 },
new User { Username = @"HappyStick", Id = 256802, GlobalRank = 752 },
new User { Username = @"-Konpaku-", Id = 2258797, GlobalRank = 571 }
}
}
};
inspector.Room = newRoom;
});
}
[BackgroundDependencyLoader]
private void load(RulesetDatabase rulesets)
{
this.rulesets = rulesets;
}
}
}

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)
@ -52,7 +50,7 @@ namespace osu.Desktop.VisualTests.Tests
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Position = new Vector2(20, -160), Position = new Vector2(20, -160),
Count = 5, CountStars = 5,
}; };
Add(stars); Add(stars);
@ -61,7 +59,7 @@ namespace osu.Desktop.VisualTests.Tests
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Position = new Vector2(20, -190), Position = new Vector2(20, -190),
Text = stars.Count.ToString("0.00"), Text = stars.CountStars.ToString("0.00"),
}; };
Add(starsLabel); Add(starsLabel);
@ -71,8 +69,8 @@ namespace osu.Desktop.VisualTests.Tests
comboCounter.Current.Value = 0; comboCounter.Current.Value = 0;
numerator = denominator = 0; numerator = denominator = 0;
accuracyCounter.SetFraction(0, 0); accuracyCounter.SetFraction(0, 0);
stars.Count = 0; stars.CountStars = 0;
starsLabel.Text = stars.Count.ToString("0.00"); starsLabel.Text = stars.CountStars.ToString("0.00");
}); });
AddStep(@"Hit! :D", delegate AddStep(@"Hit! :D", delegate
@ -93,8 +91,8 @@ namespace osu.Desktop.VisualTests.Tests
AddStep(@"Alter stars", delegate AddStep(@"Alter stars", delegate
{ {
stars.Count = RNG.NextSingle() * (stars.StarCount + 1); stars.CountStars = RNG.NextSingle() * (stars.StarCount + 1);
starsLabel.Text = stars.Count.ToString("0.00"); starsLabel.Text = stars.CountStars.ToString("0.00");
}); });
AddStep(@"Stop counters", delegate AddStep(@"Stop counters", delegate

View File

@ -6,6 +6,7 @@ using OpenTK.Graphics;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Testing; using osu.Framework.Testing;
@ -20,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)
{ {
@ -55,7 +55,7 @@ namespace osu.Desktop.VisualTests.Tests
timeRangeBindable.ValueChanged += v => timeRangeText.Text = $"Visible Range: {v:#,#.#}"; timeRangeBindable.ValueChanged += v => timeRangeText.Text = $"Visible Range: {v:#,#.#}";
timeRangeBindable.ValueChanged += v => bottomLabel.Text = $"t minus {v:#,#}"; timeRangeBindable.ValueChanged += v => bottomLabel.Text = $"t minus {v:#,#}";
Add(new Drawable[] AddRange(new Drawable[]
{ {
new Container new Container
{ {
@ -125,6 +125,8 @@ namespace osu.Desktop.VisualTests.Tests
private class TestSpeedAdjustmentContainer : SpeedAdjustmentContainer private class TestSpeedAdjustmentContainer : SpeedAdjustmentContainer
{ {
public override bool RemoveWhenNotAlive => false;
public TestSpeedAdjustmentContainer(MultiplierControlPoint controlPoint) public TestSpeedAdjustmentContainer(MultiplierControlPoint controlPoint)
: base(controlPoint) : base(controlPoint)
{ {
@ -150,11 +152,13 @@ namespace osu.Desktop.VisualTests.Tests
} }
} }
private class TestDrawableHitObject : DrawableHitObject private class TestDrawableHitObject : DrawableHitObject, IScrollingHitObject
{ {
private readonly Box background; private readonly Box background;
private const float height = 14; private const float height = 14;
public BindableDouble LifetimeOffset { get; } = new BindableDouble();
public TestDrawableHitObject(HitObject hitObject) public TestDrawableHitObject(HitObject hitObject)
: base(hitObject) : base(hitObject)
{ {
@ -195,25 +199,11 @@ namespace osu.Desktop.VisualTests.Tests
FadeInFromZero(250, EasingTypes.OutQuint); FadeInFromZero(250, EasingTypes.OutQuint);
} }
private bool hasExpired;
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
if (Time.Current >= HitObject.StartTime) if (Time.Current >= HitObject.StartTime)
{
background.Colour = Color4.Red; background.Colour = Color4.Red;
if (!hasExpired)
{
using (BeginDelayedSequence(200))
{
FadeOut(200);
Expire();
}
hasExpired = true;
}
}
} }
} }
} }

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

@ -0,0 +1,64 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Linq;
using osu.Framework.Testing;
using osu.Game.Overlays;
using osu.Game.Users;
namespace osu.Desktop.VisualTests.Tests
{
internal class TestCaseUserProfile : TestCase
{
public override string Description => "Tests user's profile page.";
public TestCaseUserProfile()
{
var profile = new UserProfileOverlay();
Add(profile);
AddStep("Show offline dummy", () => profile.ShowUser(new User
{
Username = @"Somebody",
Id = 1,
Country = new Country { FullName = @"Alien" },
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg",
JoinDate = DateTimeOffset.Now.AddDays(-1),
LastVisit = DateTimeOffset.Now,
Age = 1,
ProfileOrder = new[] { "me" },
CountryRank = 1,
Statistics = new UserStatistics
{
Rank = 2148,
PP = 4567.89m
},
AllRankHistories = new User.RankHistories
{
Osu = new User.RankHistory
{
Mode = @"osu",
Data = Enumerable.Range(2345,45).Concat(Enumerable.Range(2109,40)).ToArray()
}
}
}, false));
AddStep("Show ppy", () => profile.ShowUser(new User
{
Username = @"peppy",
Id = 2,
Country = new Country { FullName = @"Australia", FlagName = @"AU" },
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg"
}));
AddStep("Show flyte", () => profile.ShowUser(new User
{
Username = @"flyte",
Id = 3103765,
Country = new Country { FullName = @"Japan", FlagName = @"JP" },
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg"
}));
AddStep("Hide", profile.Hide);
AddStep("Show without reload", profile.Show);
}
}
}

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" />
@ -215,6 +216,7 @@
<Compile Include="Tests\TestCaseTextAwesome.cs" /> <Compile Include="Tests\TestCaseTextAwesome.cs" />
<Compile Include="Tests\TestCasePlaySongSelect.cs" /> <Compile Include="Tests\TestCasePlaySongSelect.cs" />
<Compile Include="Tests\TestCaseTwoLayerButton.cs" /> <Compile Include="Tests\TestCaseTwoLayerButton.cs" />
<Compile Include="Tests\TestCaseUserProfile.cs" />
<Compile Include="VisualTestGame.cs" /> <Compile Include="VisualTestGame.cs" />
<Compile Include="Platform\TestStorage.cs" /> <Compile Include="Platform\TestStorage.cs" />
<Compile Include="Tests\TestCaseSettings.cs" /> <Compile Include="Tests\TestCaseSettings.cs" />
@ -230,6 +232,8 @@
<Compile Include="Tests\TestCaseDirect.cs" /> <Compile Include="Tests\TestCaseDirect.cs" />
<Compile Include="Tests\TestCaseSocial.cs" /> <Compile Include="Tests\TestCaseSocial.cs" />
<Compile Include="Tests\TestCaseBreadcrumbs.cs" /> <Compile Include="Tests\TestCaseBreadcrumbs.cs" />
<Compile Include="Tests\TestCaseMedalOverlay.cs" />
<Compile Include="Tests\TestCaseRoomInspector.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup />
<ItemGroup /> <ItemGroup />

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;
}; };
} }
@ -45,7 +50,7 @@ namespace osu.Desktop
{ {
desktopWindow.CursorState |= CursorState.Hidden; desktopWindow.CursorState |= CursorState.Hidden;
desktopWindow.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location); desktopWindow.Icon = new Icon(Assembly.GetExecutingAssembly().GetManifestResourceStream(GetType(), "lazer.ico"));
desktopWindow.Title = Name; desktopWindow.Title = Name;
desktopWindow.DragEnter += dragEnter; desktopWindow.DragEnter += dragEnter;

View File

@ -10,6 +10,7 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Overlays.Notifications; using osu.Game.Overlays.Notifications;
using Squirrel; using Squirrel;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -92,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);
@ -191,7 +186,7 @@ namespace osu.Desktop.Overlays
{ {
private OsuGame game; private OsuGame game;
protected override Notification CreateCompletionNotification() => new ProgressCompletionNotification() protected override Notification CreateCompletionNotification() => new ProgressCompletionNotification
{ {
Text = @"Update ready to install. Click to restart!", Text = @"Update ready to install. Click to restart!",
Activated = () => Activated = () =>
@ -207,7 +202,7 @@ namespace osu.Desktop.Overlays
{ {
this.game = game; this.game = game;
IconContent.Add(new Drawable[] IconContent.AddRange(new Drawable[]
{ {
new Box new Box
{ {

View File

@ -232,7 +232,7 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="lazer.ico" /> <EmbeddedResource Include="lazer.ico" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.

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

@ -2,7 +2,7 @@
// 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.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using OpenTK; using OpenTK;

View File

@ -3,7 +3,7 @@
using OpenTK; using OpenTK;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Objects.Drawables namespace osu.Game.Rulesets.Mania.Objects.Drawables

View File

@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
Height = (float)HitObject.Duration; Height = (float)HitObject.Duration;
Add(new Drawable[] AddRange(new Drawable[]
{ {
// For now the body piece covers the entire height of the container // For now the body piece covers the entire height of the container
// whereas possibly in the future we don't want to extend under the head/tail. // whereas possibly in the future we don't want to extend under the head/tail.

View File

@ -7,9 +7,9 @@ using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
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.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Mania.Judgements;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Mania.Objects.Drawables namespace osu.Game.Rulesets.Mania.Objects.Drawables
{ {

View File

@ -6,12 +6,11 @@ using OpenTK.Input;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Mania.Judgements;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Objects.Drawables namespace osu.Game.Rulesets.Mania.Objects.Drawables
{ {
public abstract class DrawableManiaHitObject<TObject> : DrawableHitObject<ManiaHitObject, ManiaJudgement> public abstract class DrawableManiaHitObject<TObject> : DrawableScrollingHitObject<ManiaHitObject, ManiaJudgement>
where TObject : ManiaHitObject where TObject : ManiaHitObject
{ {
/// <summary> /// <summary>
@ -33,13 +32,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
Y = (float)HitObject.StartTime; Y = (float)HitObject.StartTime;
} }
protected override void LoadComplete()
{
base.LoadComplete();
LifetimeStart = HitObject.StartTime - ManiaPlayfield.TIME_SPAN_MAX;
}
public override Color4 AccentColour public override Color4 AccentColour
{ {
get { return base.AccentColour; } get { return base.AccentColour; }

View File

@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
public DrawableNote(Note hitObject, Bindable<Key> key = null) public DrawableNote(Note hitObject, Bindable<Key> key = null)
: base(hitObject, key) : base(hitObject, key)
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.X;
Height = 100; Height = 100;
Add(headPiece = new NotePiece Add(headPiece = new NotePiece

View File

@ -4,7 +4,7 @@
using OpenTK.Graphics; using OpenTK.Graphics;
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.Shapes;
using osu.Game.Graphics; using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces

View File

@ -5,7 +5,7 @@ using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
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.Shapes;
using osu.Game.Graphics; using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces

View File

@ -7,7 +7,7 @@ using OpenTK.Input;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
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.Shapes;
using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Colour;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Game.Graphics; using osu.Game.Graphics;

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.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using OpenTK; using OpenTK;
@ -22,6 +21,7 @@ using osu.Framework.MathUtils;
using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Timing; using osu.Game.Rulesets.Timing;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Mania.UI namespace osu.Game.Rulesets.Mania.UI
{ {
@ -30,8 +30,8 @@ namespace osu.Game.Rulesets.Mania.UI
public const float HIT_TARGET_POSITION = 50; public const float HIT_TARGET_POSITION = 50;
private const double time_span_default = 1500; private const double time_span_default = 1500;
public const double TIME_SPAN_MIN = 50; private const double time_span_min = 50;
public const double TIME_SPAN_MAX = 10000; private const double time_span_max = 10000;
private const double time_span_step = 50; private const double time_span_step = 50;
/// <summary> /// <summary>
@ -60,8 +60,8 @@ namespace osu.Game.Rulesets.Mania.UI
private readonly BindableDouble visibleTimeRange = new BindableDouble(time_span_default) private readonly BindableDouble visibleTimeRange = new BindableDouble(time_span_default)
{ {
MinValue = TIME_SPAN_MIN, MinValue = time_span_min,
MaxValue = TIME_SPAN_MAX MaxValue = time_span_max
}; };
private readonly SpeedAdjustmentCollection barLineContainer; private readonly SpeedAdjustmentCollection barLineContainer;
@ -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()
@ -245,9 +245,9 @@ namespace osu.Game.Rulesets.Mania.UI
barLineContainer.Width = columns.Width; barLineContainer.Width = columns.Width;
} }
private class TransformTimeSpan : Transform<double> 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

@ -6,7 +6,7 @@ using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
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.Shapes;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
{ {

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

@ -3,11 +3,11 @@
using System; using System;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Osu.Judgements;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Osu.Objects.Drawables namespace osu.Game.Rulesets.Osu.Objects.Drawables
{ {

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

@ -3,8 +3,8 @@
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using OpenTK; using OpenTK;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{ {

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{ {

View File

@ -3,9 +3,9 @@
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{ {

View File

@ -3,7 +3,7 @@
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.Shapes;
using osu.Framework.Input; using osu.Framework.Input;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -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

@ -4,7 +4,7 @@
using OpenTK.Graphics; using OpenTK.Graphics;
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.Shapes;
using osu.Game.Graphics; using osu.Game.Graphics;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces

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

@ -5,9 +5,9 @@ using System;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{ {

View File

@ -15,6 +15,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Game.Rulesets.Osu.Scoring; using osu.Game.Rulesets.Osu.Scoring;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Overlays.Settings;
namespace osu.Game.Rulesets.Osu namespace osu.Game.Rulesets.Osu
{ {
@ -119,6 +120,8 @@ namespace osu.Game.Rulesets.Osu
public override ScoreProcessor CreateScoreProcessor() => new OsuScoreProcessor(); public override ScoreProcessor CreateScoreProcessor() => new OsuScoreProcessor();
public override SettingsSubsection CreateSettings() => new OsuSettings();
public override int LegacyID => 0; public override int LegacyID => 0;
} }
} }

View File

@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Osu.UI
Anchor = Anchor.Centre; Anchor = Anchor.Centre;
Origin = Anchor.Centre; Origin = Anchor.Centre;
Add(new Drawable[] AddRange(new Drawable[]
{ {
connectionLayer = new FollowPointRenderer connectionLayer = new FollowPointRenderer
{ {

View File

@ -0,0 +1,33 @@
// 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.Graphics;
using osu.Game.Configuration;
using osu.Game.Overlays.Settings;
namespace osu.Game.Rulesets.Osu.UI
{
public class OsuSettings : SettingsSubsection
{
protected override string Header => "osu!";
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new Drawable[]
{
new SettingsCheckbox
{
LabelText = "Snaking in sliders",
Bindable = config.GetBindable<bool>(OsuSetting.SnakingInSliders)
},
new SettingsCheckbox
{
LabelText = "Snaking out sliders",
Bindable = config.GetBindable<bool>(OsuSetting.SnakingOutSliders)
},
};
}
}
}

View File

@ -78,6 +78,7 @@
<Compile Include="OsuDifficulty\Skills\Speed.cs" /> <Compile Include="OsuDifficulty\Skills\Speed.cs" />
<Compile Include="OsuDifficulty\Utils\History.cs" /> <Compile Include="OsuDifficulty\Utils\History.cs" />
<Compile Include="OsuKeyConversionInputManager.cs" /> <Compile Include="OsuKeyConversionInputManager.cs" />
<Compile Include="UI\OsuSettings.cs" />
<Compile Include="Scoring\OsuScoreProcessor.cs" /> <Compile Include="Scoring\OsuScoreProcessor.cs" />
<Compile Include="UI\OsuHitRenderer.cs" /> <Compile Include="UI\OsuHitRenderer.cs" />
<Compile Include="UI\OsuPlayfield.cs" /> <Compile Include="UI\OsuPlayfield.cs" />

View File

@ -3,7 +3,7 @@
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.Shapes;
using OpenTK; using OpenTK;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables namespace osu.Game.Rulesets.Taiko.Objects.Drawables

View File

@ -3,8 +3,8 @@
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using OpenTK; using OpenTK;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{ {

View File

@ -7,7 +7,6 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
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.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Judgements; using osu.Game.Rulesets.Taiko.Judgements;
@ -15,6 +14,7 @@ using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using OpenTK.Input; using OpenTK.Input;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{ {

View File

@ -3,8 +3,8 @@
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using OpenTK; using OpenTK;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
{ {

View File

@ -4,7 +4,7 @@
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
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.Shapes;
using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Backgrounds;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
{ {
EarlyActivationMilliseconds = pre_beat_transition_time; EarlyActivationMilliseconds = pre_beat_transition_time;
AddInternal(new Drawable[] AddRangeInternal(new Drawable[]
{ {
background = new CircularContainer background = new CircularContainer
{ {

View File

@ -3,9 +3,9 @@
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
{ {

View File

@ -3,9 +3,9 @@
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
{ {

View File

@ -6,7 +6,7 @@ using OpenTK.Graphics;
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.Framework.Graphics.Sprites; using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.Taiko.Judgements; using osu.Game.Rulesets.Taiko.Judgements;
using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Objects;

View File

@ -5,7 +5,7 @@ using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
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.Shapes;
using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Objects;
namespace osu.Game.Rulesets.Taiko.UI namespace osu.Game.Rulesets.Taiko.UI

View File

@ -5,7 +5,7 @@ using OpenTK;
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.Framework.Graphics.Sprites; using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.Taiko.Judgements; using osu.Game.Rulesets.Taiko.Judgements;
using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Objects;

View File

@ -3,7 +3,7 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using OpenTK; using OpenTK;
@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Taiko.UI
public TaikoPlayfield() public TaikoPlayfield()
{ {
AddInternal(new Drawable[] AddRangeInternal(new Drawable[]
{ {
new ScaleFixContainer new ScaleFixContainer
{ {

View File

@ -75,18 +75,16 @@ namespace osu.Game.Tests.Beatmaps.IO
var temp = prepareTempCopy(osz_path); var temp = prepareTempCopy(osz_path);
Assert.IsTrue(File.Exists(temp)); Assert.IsTrue(File.Exists(temp), "Temporary file copy never substantiated");
using (File.OpenRead(temp)) using (File.OpenRead(temp))
host.Dependencies.Get<BeatmapDatabase>().Import(temp); host.Dependencies.Get<BeatmapDatabase>().Import(temp);
ensureLoaded(host); ensureLoaded(host);
Assert.IsTrue(File.Exists(temp));
File.Delete(temp); File.Delete(temp);
Assert.IsFalse(File.Exists(temp)); Assert.IsFalse(File.Exists(temp), "We likely held a read lock on the file when we shouldn't");
} }
} }
@ -111,7 +109,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

@ -91,7 +91,7 @@ namespace osu.Game.Beatmaps.ControlPoints
if (time < list[0].Time) if (time < list[0].Time)
return prePoint ?? new T(); return prePoint ?? new T();
int index = list.BinarySearch(new T() { Time = time }); int index = list.BinarySearch(new T { Time = time });
// Check if we've found an exact match (t == time) // Check if we've found an exact match (t == time)
if (index >= 0) if (index >= 0)

View File

@ -14,6 +14,7 @@ using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Beatmaps.Drawables namespace osu.Game.Beatmaps.Drawables
{ {
@ -139,7 +140,7 @@ namespace osu.Game.Beatmaps.Drawables
}, },
starCounter = new StarCounter starCounter = new StarCounter
{ {
Count = (float)beatmap.StarDifficulty, CountStars = (float)beatmap.StarDifficulty,
Scale = new Vector2(0.8f), Scale = new Vector2(0.8f),
} }
} }

View File

@ -0,0 +1,28 @@
// 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.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Database;
namespace osu.Game.Beatmaps.Drawables
{
public class BeatmapSetCover : Sprite
{
private readonly BeatmapSetInfo set;
public BeatmapSetCover(BeatmapSetInfo set)
{
this.set = set;
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
string resource = set.OnlineInfo.Covers.Cover;
if (resource != null)
Texture = textures.Get(resource);
}
}
}

View File

@ -12,6 +12,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Beatmaps.Drawables namespace osu.Game.Beatmaps.Drawables
{ {
@ -92,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

@ -2,6 +2,7 @@
// 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.Linq; using System.Linq;
using Newtonsoft.Json;
using SQLite.Net.Attributes; using SQLite.Net.Attributes;
namespace osu.Game.Database namespace osu.Game.Database
@ -17,8 +18,13 @@ namespace osu.Game.Database
public string TitleUnicode { get; set; } public string TitleUnicode { get; set; }
public string Artist { get; set; } public string Artist { get; set; }
public string ArtistUnicode { get; set; } public string ArtistUnicode { get; set; }
[JsonProperty(@"creator")]
public string Author { get; set; } public string Author { get; set; }
public string Source { get; set; } public string Source { get; set; }
[JsonProperty(@"tags")]
public string Tags { get; set; } public string Tags { get; set; }
public int PreviewTime { get; set; } public int PreviewTime { get; set; }
public string AudioFile { get; set; } public string AudioFile { get; set; }

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 Newtonsoft.Json; using Newtonsoft.Json;
using System.Collections.Generic;
namespace osu.Game.Database namespace osu.Game.Database
{ {
@ -11,28 +10,16 @@ namespace osu.Game.Database
/// </summary> /// </summary>
public class BeatmapOnlineInfo public class BeatmapOnlineInfo
{ {
/// <summary>
/// The different sizes of cover art for this beatmap: cover, cover@2x, card, card@2x, list, list@2x.
/// </summary>
[JsonProperty(@"covers")]
public IEnumerable<string> Covers { get; set; }
/// <summary>
/// A small sample clip of this beatmap's song.
/// </summary>
[JsonProperty(@"previewUrl")]
public string Preview { get; set; }
/// <summary> /// <summary>
/// The amount of plays this beatmap has. /// The amount of plays this beatmap has.
/// </summary> /// </summary>
[JsonProperty(@"play_count")] [JsonProperty(@"playcount")]
public int PlayCount { get; set; } public int PlayCount { get; set; }
/// <summary> /// <summary>
/// The amount of people who have favourited this map. /// The amount of passes this beatmap has.
/// </summary> /// </summary>
[JsonProperty(@"favourite_count")] [JsonProperty(@"passcount")]
public int FavouriteCount { get; set; } public int PassCount { get; set; }
} }
} }

View File

@ -24,6 +24,9 @@ namespace osu.Game.Database
[OneToMany(CascadeOperations = CascadeOperation.All)] [OneToMany(CascadeOperations = CascadeOperation.All)]
public List<BeatmapInfo> Beatmaps { get; set; } public List<BeatmapInfo> Beatmaps { get; set; }
[Ignore]
public BeatmapSetOnlineInfo OnlineInfo { get; set; }
public double MaxStarDifficulty => Beatmaps.Max(b => b.StarDifficulty); public double MaxStarDifficulty => Beatmaps.Max(b => b.StarDifficulty);
[Indexed] [Indexed]

View File

@ -0,0 +1,55 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using Newtonsoft.Json;
namespace osu.Game.Database
{
/// <summary>
/// Beatmap set info retrieved for previewing locally without having the set downloaded.
/// </summary>
public class BeatmapSetOnlineInfo
{
/// <summary>
/// The different sizes of cover art for this beatmap set.
/// </summary>
[JsonProperty(@"covers")]
public BeatmapSetOnlineCovers Covers { get; set; }
/// <summary>
/// A small sample clip of this beatmap set's song.
/// </summary>
[JsonProperty(@"previewUrl")]
public string Preview { get; set; }
/// <summary>
/// The amount of plays this beatmap set has.
/// </summary>
[JsonProperty(@"play_count")]
public int PlayCount { get; set; }
/// <summary>
/// The amount of people who have favourited this beatmap set.
/// </summary>
[JsonProperty(@"favourite_count")]
public int FavouriteCount { get; set; }
}
public class BeatmapSetOnlineCovers
{
public string CoverLowRes { get; set; }
[JsonProperty(@"cover@2x")]
public string Cover { get; set; }
public string CardLowRes { get; set; }
[JsonProperty(@"card@2x")]
public string Card { get; set; }
public string ListLowRes { get; set; }
[JsonProperty(@"list@2x")]
public string List { get; set; }
}
}

View File

@ -69,7 +69,7 @@ namespace osu.Game.Database
var trackData = getReader()?.GetStream(Metadata.AudioFile); var trackData = getReader()?.GetStream(Metadata.AudioFile);
return trackData == null ? null : new TrackBass(trackData); return trackData == null ? null : new TrackBass(trackData);
} }
catch { return null; } catch { return new TrackVirtual(); }
} }
} }
} }

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