mirror of
https://github.com/ppy/osu
synced 2025-01-03 21:02:22 +00:00
Merge remote-tracking branch 'refs/remotes/ppy/master' into spotlights_api
This commit is contained in:
commit
e531570352
@ -135,7 +135,7 @@ csharp_preferred_modifier_order = public,private,protected,internal,new,abstract
|
||||
csharp_style_expression_bodied_accessors = true:warning
|
||||
csharp_style_expression_bodied_constructors = false:none
|
||||
csharp_style_expression_bodied_indexers = true:warning
|
||||
csharp_style_expression_bodied_methods = true:silent
|
||||
csharp_style_expression_bodied_methods = false:silent
|
||||
csharp_style_expression_bodied_operators = true:warning
|
||||
csharp_style_expression_bodied_properties = true:warning
|
||||
csharp_style_expression_bodied_local_functions = true:silent
|
||||
|
20
.idea/.idea.osu.Desktop/.idea/runConfigurations/osu_SDL.xml
generated
Normal file
20
.idea/.idea.osu.Desktop/.idea/runConfigurations/osu_SDL.xml
generated
Normal file
@ -0,0 +1,20 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="osu! SDL" type="DotNetProject" factoryName=".NET Project" folderName="osu!">
|
||||
<option name="EXE_PATH" value="$PROJECT_DIR$/osu.Desktop/bin/Debug/netcoreapp3.1/osu!.dll" />
|
||||
<option name="PROGRAM_PARAMETERS" value="--sdl" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/osu.Desktop" />
|
||||
<option name="PASS_PARENT_ENVS" value="1" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="PROJECT_PATH" value="$PROJECT_DIR$/osu.Desktop/osu.Desktop.csproj" />
|
||||
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
|
||||
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
|
||||
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
|
||||
<option name="PROJECT_KIND" value="DotNetCore" />
|
||||
<option name="PROJECT_TFM" value=".NETCoreApp,Version=v3.0" />
|
||||
<method v="2">
|
||||
<option name="Build" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
@ -40,7 +40,7 @@
|
||||
<RepositoryUrl>https://github.com/ppy/osu</RepositoryUrl>
|
||||
<PackageReleaseNotes>Automated release.</PackageReleaseNotes>
|
||||
<Company>ppy Pty Ltd</Company>
|
||||
<Copyright>Copyright (c) 2019 ppy Pty Ltd</Copyright>
|
||||
<Copyright>Copyright (c) 2020 ppy Pty Ltd</Copyright>
|
||||
<PackageTags>osu game</PackageTags>
|
||||
</PropertyGroup>
|
||||
</Project>
|
74
Gemfile.lock
74
Gemfile.lock
@ -1,7 +1,7 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
CFPropertyList (3.0.1)
|
||||
CFPropertyList (3.0.2)
|
||||
addressable (2.7.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
atomos (0.1.3)
|
||||
@ -18,8 +18,8 @@ GEM
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
dotenv (2.7.5)
|
||||
emoji_regex (1.0.1)
|
||||
excon (0.67.0)
|
||||
faraday (0.15.4)
|
||||
excon (0.71.1)
|
||||
faraday (0.17.3)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
faraday-cookie_jar (0.0.6)
|
||||
faraday (>= 0.7.4)
|
||||
@ -27,7 +27,7 @@ GEM
|
||||
faraday_middleware (0.13.1)
|
||||
faraday (>= 0.7.4, < 1.0)
|
||||
fastimage (2.1.7)
|
||||
fastlane (2.133.0)
|
||||
fastlane (2.140.0)
|
||||
CFPropertyList (>= 2.3, < 4.0.0)
|
||||
addressable (>= 2.3, < 3.0.0)
|
||||
babosa (>= 1.0.2, < 2.0.0)
|
||||
@ -36,13 +36,13 @@ GEM
|
||||
commander-fastlane (>= 4.4.6, < 5.0.0)
|
||||
dotenv (>= 2.1.1, < 3.0.0)
|
||||
emoji_regex (>= 0.1, < 2.0)
|
||||
excon (>= 0.45.0, < 1.0.0)
|
||||
faraday (< 0.16.0)
|
||||
excon (>= 0.71.0, < 1.0.0)
|
||||
faraday (~> 0.17)
|
||||
faraday-cookie_jar (~> 0.0.6)
|
||||
faraday_middleware (< 0.16.0)
|
||||
faraday_middleware (~> 0.13.1)
|
||||
fastimage (>= 2.1.0, < 3.0.0)
|
||||
gh_inspector (>= 1.1.2, < 2.0.0)
|
||||
google-api-client (>= 0.21.2, < 0.24.0)
|
||||
google-api-client (>= 0.29.2, < 0.37.0)
|
||||
google-cloud-storage (>= 1.15.0, < 2.0.0)
|
||||
highline (>= 1.7.2, < 2.0.0)
|
||||
json (< 3.0.0)
|
||||
@ -61,56 +61,58 @@ GEM
|
||||
tty-screen (>= 0.6.3, < 1.0.0)
|
||||
tty-spinner (>= 0.8.0, < 1.0.0)
|
||||
word_wrap (~> 1.0.0)
|
||||
xcodeproj (>= 1.8.1, < 2.0.0)
|
||||
xcodeproj (>= 1.13.0, < 2.0.0)
|
||||
xcpretty (~> 0.3.0)
|
||||
xcpretty-travis-formatter (>= 0.0.3)
|
||||
fastlane-plugin-clean_testflight_testers (0.3.0)
|
||||
fastlane-plugin-souyuz (0.8.1)
|
||||
souyuz (>= 0.8.1)
|
||||
fastlane-plugin-souyuz (0.9.1)
|
||||
souyuz (= 0.9.1)
|
||||
fastlane-plugin-xamarin (0.6.3)
|
||||
gh_inspector (1.1.3)
|
||||
google-api-client (0.23.9)
|
||||
google-api-client (0.36.4)
|
||||
addressable (~> 2.5, >= 2.5.1)
|
||||
googleauth (>= 0.5, < 0.7.0)
|
||||
googleauth (~> 0.9)
|
||||
httpclient (>= 2.8.1, < 3.0)
|
||||
mime-types (~> 3.0)
|
||||
mini_mime (~> 1.0)
|
||||
representable (~> 3.0)
|
||||
retriable (>= 2.0, < 4.0)
|
||||
signet (~> 0.9)
|
||||
google-cloud-core (1.3.1)
|
||||
signet (~> 0.12)
|
||||
google-cloud-core (1.5.0)
|
||||
google-cloud-env (~> 1.0)
|
||||
google-cloud-env (1.2.1)
|
||||
google-cloud-errors (~> 1.0)
|
||||
google-cloud-env (1.3.0)
|
||||
faraday (~> 0.11)
|
||||
google-cloud-storage (1.16.0)
|
||||
google-cloud-errors (1.0.0)
|
||||
google-cloud-storage (1.25.1)
|
||||
addressable (~> 2.5)
|
||||
digest-crc (~> 0.4)
|
||||
google-api-client (~> 0.23)
|
||||
google-api-client (~> 0.33)
|
||||
google-cloud-core (~> 1.2)
|
||||
googleauth (>= 0.6.2, < 0.10.0)
|
||||
googleauth (0.6.7)
|
||||
googleauth (~> 0.9)
|
||||
mini_mime (~> 1.0)
|
||||
googleauth (0.10.0)
|
||||
faraday (~> 0.12)
|
||||
jwt (>= 1.4, < 3.0)
|
||||
memoist (~> 0.16)
|
||||
multi_json (~> 1.11)
|
||||
os (>= 0.9, < 2.0)
|
||||
signet (~> 0.7)
|
||||
signet (~> 0.12)
|
||||
highline (1.7.10)
|
||||
http-cookie (1.0.3)
|
||||
domain_name (~> 0.5)
|
||||
httpclient (2.8.3)
|
||||
json (2.2.0)
|
||||
json (2.3.0)
|
||||
jwt (2.1.0)
|
||||
memoist (0.16.0)
|
||||
mime-types (3.3)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2019.1009)
|
||||
mini_magick (4.9.5)
|
||||
memoist (0.16.2)
|
||||
mini_magick (4.10.1)
|
||||
mini_mime (1.0.2)
|
||||
mini_portile2 (2.4.0)
|
||||
multi_json (1.13.1)
|
||||
multi_json (1.14.1)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.0.0)
|
||||
nanaimo (0.2.6)
|
||||
naturally (2.2.0)
|
||||
nokogiri (1.10.4)
|
||||
nokogiri (1.10.7)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
os (1.0.1)
|
||||
plist (3.5.0)
|
||||
@ -128,12 +130,12 @@ GEM
|
||||
faraday (~> 0.9)
|
||||
jwt (>= 1.5, < 3.0)
|
||||
multi_json (~> 1.10)
|
||||
simctl (1.6.6)
|
||||
simctl (1.6.7)
|
||||
CFPropertyList
|
||||
naturally
|
||||
slack-notifier (2.3.2)
|
||||
souyuz (0.8.1)
|
||||
fastlane (>= 2.29.0)
|
||||
souyuz (0.9.1)
|
||||
fastlane (>= 1.103.0)
|
||||
highline (~> 1.7)
|
||||
nokogiri (~> 1.7)
|
||||
terminal-notifier (2.0.0)
|
||||
@ -141,15 +143,15 @@ GEM
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
tty-cursor (0.7.0)
|
||||
tty-screen (0.7.0)
|
||||
tty-spinner (0.9.1)
|
||||
tty-spinner (0.9.2)
|
||||
tty-cursor (~> 0.7)
|
||||
uber (0.1.0)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf_ext (0.0.7.6)
|
||||
unicode-display_width (1.6.0)
|
||||
unicode-display_width (1.6.1)
|
||||
word_wrap (1.0.0)
|
||||
xcodeproj (1.12.0)
|
||||
xcodeproj (1.14.0)
|
||||
CFPropertyList (>= 2.3.3, < 4.0)
|
||||
atomos (~> 0.1.3)
|
||||
claide (>= 1.0.2, < 2.0)
|
||||
|
2
LICENCE
2
LICENCE
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2019 ppy Pty Ltd <contact@ppy.sh>.
|
||||
Copyright (c) 2020 ppy Pty Ltd <contact@ppy.sh>.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -111,7 +111,6 @@ platform :ios do
|
||||
|
||||
souyuz(
|
||||
platform: "ios",
|
||||
build_target: "osu_iOS",
|
||||
plist_path: "../osu.iOS/Info.plist"
|
||||
)
|
||||
end
|
||||
|
@ -54,6 +54,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1230.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.111.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.131.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -22,8 +22,9 @@ namespace osu.Desktop
|
||||
{
|
||||
// Back up the cwd before DesktopGameHost changes it
|
||||
var cwd = Environment.CurrentDirectory;
|
||||
bool useSdl = args.Contains("--sdl");
|
||||
|
||||
using (DesktopGameHost host = Host.GetSuitableHost(@"osu", true))
|
||||
using (DesktopGameHost host = Host.GetSuitableHost(@"osu", true, useSdl: useSdl))
|
||||
{
|
||||
host.ExceptionThrown += handleException;
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.6" />
|
||||
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
|
||||
<PackageReference Include="DiscordRichPresence" Version="1.0.121" />
|
||||
<PackageReference Include="DiscordRichPresence" Version="1.0.147" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Resources">
|
||||
<EmbeddedResource Include="lazer.ico" />
|
||||
|
@ -12,7 +12,7 @@
|
||||
<description>click the circles. to the beat.</description>
|
||||
<summary>click the circles.</summary>
|
||||
<releaseNotes>testing</releaseNotes>
|
||||
<copyright>Copyright (c) 2019 ppy Pty Ltd</copyright>
|
||||
<copyright>Copyright (c) 2020 ppy Pty Ltd</copyright>
|
||||
<language>en-AU</language>
|
||||
</metadata>
|
||||
<files>
|
||||
|
@ -36,7 +36,10 @@ namespace osu.Game.Rulesets.Catch.Mods
|
||||
|
||||
//disable keyboard controls
|
||||
public bool OnPressed(CatchAction action) => true;
|
||||
public bool OnReleased(CatchAction action) => true;
|
||||
|
||||
public void OnReleased(CatchAction action)
|
||||
{
|
||||
}
|
||||
|
||||
protected override bool OnMouseMove(MouseMoveEvent e)
|
||||
{
|
||||
|
@ -20,7 +20,9 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
|
||||
internal readonly CatcherArea CatcherArea;
|
||||
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => base.ReceivePositionalInputAt(screenSpacePos) || CatcherArea.ReceivePositionalInputAt(screenSpacePos);
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) =>
|
||||
// only check the X position; handle all vertical space.
|
||||
base.ReceivePositionalInputAt(new Vector2(screenSpacePos.X, ScreenSpaceDrawQuad.Centre.Y));
|
||||
|
||||
public CatchPlayfield(BeatmapDifficulty difficulty, Func<CatchHitObject, DrawableHitObject<CatchHitObject>> createDrawableRepresentation)
|
||||
{
|
||||
|
@ -103,7 +103,9 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
MovableCatcher.X = state.CatcherX.Value;
|
||||
}
|
||||
|
||||
public bool OnReleased(CatchAction action) => false;
|
||||
public void OnReleased(CatchAction action)
|
||||
{
|
||||
}
|
||||
|
||||
public bool AttemptCatch(CatchHitObject obj) => MovableCatcher.AttemptCatch(obj);
|
||||
|
||||
@ -341,24 +343,22 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool OnReleased(CatchAction action)
|
||||
public void OnReleased(CatchAction action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case CatchAction.MoveLeft:
|
||||
currentDirection++;
|
||||
return true;
|
||||
break;
|
||||
|
||||
case CatchAction.MoveRight:
|
||||
currentDirection--;
|
||||
return true;
|
||||
break;
|
||||
|
||||
case CatchAction.Dash:
|
||||
Dashing = false;
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -54,10 +54,10 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnMouseUp(MouseUpEvent e)
|
||||
protected override void OnMouseUp(MouseUpEvent e)
|
||||
{
|
||||
EndPlacement();
|
||||
return base.OnMouseUp(e);
|
||||
base.OnMouseUp(e);
|
||||
}
|
||||
|
||||
public override void UpdatePosition(Vector2 screenSpacePosition)
|
||||
|
@ -13,7 +13,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
||||
{
|
||||
public class ManiaSelectionBlueprint : SelectionBlueprint
|
||||
public class ManiaSelectionBlueprint : OverlaySelectionBlueprint
|
||||
{
|
||||
public Vector2 ScreenSpaceDragPosition { get; private set; }
|
||||
public Vector2 DragPosition { get; private set; }
|
||||
@ -55,14 +55,12 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
||||
return base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
protected override bool OnDrag(DragEvent e)
|
||||
protected override void OnDrag(DragEvent e)
|
||||
{
|
||||
var result = base.OnDrag(e);
|
||||
base.OnDrag(e);
|
||||
|
||||
ScreenSpaceDragPosition = e.ScreenSpaceMousePosition;
|
||||
DragPosition = DrawableObject.ToLocalSpace(e.ScreenSpaceMousePosition);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
|
34
osu.Game.Rulesets.Mania/Edit/ManiaBlueprintContainer.cs
Normal file
34
osu.Game.Rulesets.Mania/Edit/ManiaBlueprintContainer.cs
Normal file
@ -0,0 +1,34 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Screens.Edit.Compose.Components;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Edit
|
||||
{
|
||||
public class ManiaBlueprintContainer : ComposeBlueprintContainer
|
||||
{
|
||||
public ManiaBlueprintContainer(IEnumerable<DrawableHitObject> drawableHitObjects)
|
||||
: base(drawableHitObjects)
|
||||
{
|
||||
}
|
||||
|
||||
public override OverlaySelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject)
|
||||
{
|
||||
switch (hitObject)
|
||||
{
|
||||
case DrawableNote note:
|
||||
return new NoteSelectionBlueprint(note);
|
||||
|
||||
case DrawableHoldNote holdNote:
|
||||
return new HoldNoteSelectionBlueprint(holdNote);
|
||||
}
|
||||
|
||||
return base.CreateBlueprintFor(hitObject);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,11 +5,8 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Edit.Tools;
|
||||
using osu.Game.Rulesets.Mania.Objects;
|
||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.UI;
|
||||
@ -52,26 +49,12 @@ namespace osu.Game.Rulesets.Mania.Edit
|
||||
return drawableRuleset;
|
||||
}
|
||||
|
||||
protected override ComposeBlueprintContainer CreateBlueprintContainer() => new ManiaBlueprintContainer(drawableRuleset.Playfield.AllHitObjects);
|
||||
|
||||
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new HitObjectCompositionTool[]
|
||||
{
|
||||
new NoteCompositionTool(),
|
||||
new HoldNoteCompositionTool()
|
||||
};
|
||||
|
||||
public override SelectionHandler CreateSelectionHandler() => new ManiaSelectionHandler();
|
||||
|
||||
public override SelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject)
|
||||
{
|
||||
switch (hitObject)
|
||||
{
|
||||
case DrawableNote note:
|
||||
return new NoteSelectionBlueprint(note);
|
||||
|
||||
case DrawableHoldNote holdNote:
|
||||
return new HoldNoteSelectionBlueprint(holdNote);
|
||||
}
|
||||
|
||||
return base.CreateBlueprintFor(hitObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
||||
using osu.Game.Rulesets.Mania.Objects;
|
||||
using osu.Game.Rulesets.UI;
|
||||
@ -70,10 +71,12 @@ namespace osu.Game.Rulesets.Mania.Edit
|
||||
// When scrolling downwards the anchor position is at the bottom of the screen, however the movement event assumes the anchor is at the top of the screen.
|
||||
// This causes the delta to assume a positive hitobject position, and which can be corrected for by subtracting the parent height.
|
||||
if (scrollingInfo.Direction.Value == ScrollingDirection.Down)
|
||||
delta -= moveEvent.Blueprint.DrawableObject.Parent.DrawHeight;
|
||||
delta -= moveEvent.Blueprint.Parent.DrawHeight; // todo: probably wrong
|
||||
|
||||
foreach (var b in SelectedBlueprints)
|
||||
foreach (var selectionBlueprint in SelectedBlueprints)
|
||||
{
|
||||
var b = (OverlaySelectionBlueprint)selectionBlueprint;
|
||||
|
||||
var hitObject = b.DrawableObject;
|
||||
var objectParent = (HitObjectContainer)hitObject.Parent;
|
||||
|
||||
|
@ -7,7 +7,7 @@ using osu.Game.Rulesets.Objects.Drawables;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Edit.Masks
|
||||
{
|
||||
public abstract class ManiaSelectionBlueprint : SelectionBlueprint
|
||||
public abstract class ManiaSelectionBlueprint : OverlaySelectionBlueprint
|
||||
{
|
||||
protected ManiaSelectionBlueprint(DrawableHitObject drawableObject)
|
||||
: base(drawableObject)
|
||||
|
@ -237,19 +237,19 @@ namespace osu.Game.Rulesets.Mania
|
||||
{
|
||||
LeftKeys = new[]
|
||||
{
|
||||
InputKey.Number1,
|
||||
InputKey.Number2,
|
||||
InputKey.Number3,
|
||||
InputKey.Number4,
|
||||
InputKey.Q,
|
||||
InputKey.W,
|
||||
InputKey.E,
|
||||
InputKey.R,
|
||||
},
|
||||
RightKeys = new[]
|
||||
{
|
||||
InputKey.Z,
|
||||
InputKey.X,
|
||||
InputKey.C,
|
||||
InputKey.V
|
||||
InputKey.V,
|
||||
InputKey.B
|
||||
},
|
||||
SpecialKey = InputKey.Tilde,
|
||||
SpecialKey = InputKey.S,
|
||||
SpecialAction = ManiaAction.Special1,
|
||||
NormalActionStart = ManiaAction.Key1
|
||||
}.GenerateKeyBindingsFor(keys, out var nextNormal);
|
||||
@ -265,12 +265,12 @@ namespace osu.Game.Rulesets.Mania
|
||||
},
|
||||
RightKeys = new[]
|
||||
{
|
||||
InputKey.O,
|
||||
InputKey.P,
|
||||
InputKey.BracketLeft,
|
||||
InputKey.BracketRight
|
||||
InputKey.K,
|
||||
InputKey.L,
|
||||
InputKey.Semicolon,
|
||||
InputKey.Quote
|
||||
},
|
||||
SpecialKey = InputKey.BackSlash,
|
||||
SpecialKey = InputKey.I,
|
||||
SpecialAction = ManiaAction.Special2,
|
||||
NormalActionStart = nextNormal
|
||||
}.GenerateKeyBindingsFor(keys, out _);
|
||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
{
|
||||
public override string Name => "Fade In";
|
||||
public override string Acronym => "FI";
|
||||
public override IconUsage Icon => OsuIcon.ModHidden;
|
||||
public override IconUsage? Icon => OsuIcon.ModHidden;
|
||||
public override ModType Type => ModType.DifficultyIncrease;
|
||||
public override string Description => @"Keys appear out of nowhere!";
|
||||
public override double ScoreMultiplier => 1;
|
||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
public override string Name => "Random";
|
||||
public override string Acronym => "RD";
|
||||
public override ModType Type => ModType.Conversion;
|
||||
public override IconUsage Icon => OsuIcon.Dice;
|
||||
public override IconUsage? Icon => OsuIcon.Dice;
|
||||
public override string Description => @"Shuffle around the keys!";
|
||||
public override double ScoreMultiplier => 1;
|
||||
|
||||
|
@ -171,17 +171,17 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
bodyPiece.Hitting = true;
|
||||
}
|
||||
|
||||
public bool OnReleased(ManiaAction action)
|
||||
public void OnReleased(ManiaAction action)
|
||||
{
|
||||
if (AllJudged)
|
||||
return false;
|
||||
return;
|
||||
|
||||
if (action != Action.Value)
|
||||
return false;
|
||||
return;
|
||||
|
||||
// Make sure a hold was started
|
||||
if (HoldStartTime == null)
|
||||
return false;
|
||||
return;
|
||||
|
||||
Tail.UpdateResult();
|
||||
endHold();
|
||||
@ -189,8 +189,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
// If the key has been released too early, the user should not receive full score for the release
|
||||
if (!Tail.IsHit)
|
||||
HasBroken = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void endHold()
|
||||
|
@ -17,6 +17,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
|
||||
public override bool OnPressed(ManiaAction action) => false; // Handled by the hold note
|
||||
|
||||
public override bool OnReleased(ManiaAction action) => false; // Handled by the hold note
|
||||
public override void OnReleased(ManiaAction action)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
|
||||
public override bool OnPressed(ManiaAction action) => false; // Handled by the hold note
|
||||
|
||||
public override bool OnReleased(ManiaAction action) => false; // Handled by the hold note
|
||||
public override void OnReleased(ManiaAction action)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,6 +77,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
return UpdateResult(true);
|
||||
}
|
||||
|
||||
public virtual bool OnReleased(ManiaAction action) => false;
|
||||
public virtual void OnReleased(ManiaAction action)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -191,7 +191,9 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool OnReleased(ManiaAction action) => false;
|
||||
public void OnReleased(ManiaAction action)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos)
|
||||
// This probably shouldn't exist as is, but the columns in the stage are separated by a 1px border
|
||||
|
@ -98,11 +98,10 @@ namespace osu.Game.Rulesets.Mania.UI.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool OnReleased(ManiaAction action)
|
||||
public void OnReleased(ManiaAction action)
|
||||
{
|
||||
if (action == this.action.Value)
|
||||
backgroundOverlay.FadeTo(0, 250, Easing.OutQuint);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -115,11 +115,10 @@ namespace osu.Game.Rulesets.Mania.UI.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool OnReleased(ManiaAction action)
|
||||
public void OnReleased(ManiaAction action)
|
||||
{
|
||||
if (action == this.action.Value)
|
||||
keyIcon.ScaleTo(1f, 125, Easing.OutQuint);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,12 +7,10 @@ using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.IO.Stores;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Screens;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Skinning;
|
||||
using osu.Game.Tests.Visual;
|
||||
@ -21,7 +19,7 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
public class TestSceneLegacyBeatmapSkin : OsuTestScene
|
||||
public class TestSceneLegacyBeatmapSkin : ScreenTestScene
|
||||
{
|
||||
[Resolved]
|
||||
private AudioManager audio { get; set; }
|
||||
@ -65,7 +63,8 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
ExposedPlayer player;
|
||||
|
||||
Beatmap.Value = new CustomSkinWorkingBeatmap(audio, beatmapHasColours);
|
||||
Child = new OsuScreenStack(player = new ExposedPlayer(userHasCustomColours)) { RelativeSizeAxes = Axes.Both };
|
||||
|
||||
LoadScreen(player = new ExposedPlayer(userHasCustomColours));
|
||||
|
||||
return player;
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
private const double time_during_slide_2 = 3000;
|
||||
private const double time_during_slide_3 = 3500;
|
||||
private const double time_during_slide_4 = 3800;
|
||||
private const double time_slider_end = 4000;
|
||||
|
||||
private List<JudgementResult> judgementResults;
|
||||
private bool allJudgedFired;
|
||||
@ -284,6 +285,48 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
AddAssert("Tracking acquired", assertMidSliderJudgements);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scenario:
|
||||
/// - Press a key on the slider head
|
||||
/// - While holding the key, move cursor close to the edge of tracking area
|
||||
/// - Keep the cursor on the edge of tracking area until the slider ends
|
||||
/// Expected Result:
|
||||
/// A passing test case will have the slider track the cursor throughout the whole test.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestTrackingAreaEdge()
|
||||
{
|
||||
performTest(new List<ReplayFrame>
|
||||
{
|
||||
new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start },
|
||||
new OsuReplayFrame { Position = new Vector2(0, OsuHitObject.OBJECT_RADIUS * 1.19f), Actions = { OsuAction.LeftButton }, Time = time_slider_start + 250 },
|
||||
new OsuReplayFrame { Position = new Vector2(slider_path_length, OsuHitObject.OBJECT_RADIUS * 1.199f), Actions = { OsuAction.LeftButton }, Time = time_slider_end },
|
||||
});
|
||||
|
||||
AddAssert("Tracking kept", assertGreatJudge);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scenario:
|
||||
/// - Press a key on the slider head
|
||||
/// - While holding the key, move cursor just outside the tracking area
|
||||
/// - Keep the cursor just outside the tracking area until the slider ends
|
||||
/// Expected Result:
|
||||
/// A passing test case will have the slider drop the tracking on frame 2.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestTrackingAreaOutsideEdge()
|
||||
{
|
||||
performTest(new List<ReplayFrame>
|
||||
{
|
||||
new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start },
|
||||
new OsuReplayFrame { Position = new Vector2(0, OsuHitObject.OBJECT_RADIUS * 1.21f), Actions = { OsuAction.LeftButton }, Time = time_slider_start + 250 },
|
||||
new OsuReplayFrame { Position = new Vector2(slider_path_length, OsuHitObject.OBJECT_RADIUS * 1.201f), Actions = { OsuAction.LeftButton }, Time = time_slider_end },
|
||||
});
|
||||
|
||||
AddAssert("Tracking dropped", assertMidSliderJudgementFail);
|
||||
}
|
||||
|
||||
private bool assertGreatJudge() => judgementResults.Last().Type == HitResult.Great;
|
||||
|
||||
private bool assertHeadMissTailTracked() => judgementResults[^2].Type == HitResult.Great && judgementResults.First().Type == HitResult.Miss;
|
||||
@ -294,6 +337,8 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
|
||||
private ScoreAccessibleReplayPlayer currentPlayer;
|
||||
|
||||
private const float slider_path_length = 25;
|
||||
|
||||
private void performTest(List<ReplayFrame> frames)
|
||||
{
|
||||
AddStep("load player", () =>
|
||||
@ -309,8 +354,8 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
Path = new SliderPath(PathType.PerfectCurve, new[]
|
||||
{
|
||||
Vector2.Zero,
|
||||
new Vector2(25, 0),
|
||||
}, 25),
|
||||
new Vector2(slider_path_length, 0),
|
||||
}, slider_path_length),
|
||||
}
|
||||
},
|
||||
BeatmapInfo =
|
||||
|
@ -4,7 +4,7 @@
|
||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.16.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Project">
|
||||
|
@ -7,10 +7,10 @@ using osu.Game.Rulesets.Osu.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Edit.Blueprints
|
||||
{
|
||||
public abstract class OsuSelectionBlueprint<T> : SelectionBlueprint
|
||||
public abstract class OsuSelectionBlueprint<T> : OverlaySelectionBlueprint
|
||||
where T : OsuHitObject
|
||||
{
|
||||
protected T HitObject => (T)DrawableObject.HitObject;
|
||||
protected new T HitObject => (T)DrawableObject.HitObject;
|
||||
|
||||
protected OsuSelectionBlueprint(DrawableHitObject drawableObject)
|
||||
: base(drawableObject)
|
||||
|
@ -135,13 +135,11 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override bool OnMouseUp(MouseUpEvent e) => RequestSelection != null;
|
||||
|
||||
protected override bool OnClick(ClickEvent e) => RequestSelection != null;
|
||||
|
||||
protected override bool OnDragStart(DragStartEvent e) => e.Button == MouseButton.Left;
|
||||
|
||||
protected override bool OnDrag(DragEvent e)
|
||||
protected override void OnDrag(DragEvent e)
|
||||
{
|
||||
if (ControlPoint == slider.Path.ControlPoints[0])
|
||||
{
|
||||
@ -158,12 +156,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
}
|
||||
else
|
||||
ControlPoint.Position.Value += e.Delta;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnDragEnd(DragEndEvent e) => true;
|
||||
|
||||
/// <summary>
|
||||
/// Updates the state of the circular control point marker.
|
||||
/// </summary>
|
||||
|
@ -108,7 +108,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool OnReleased(PlatformAction action) => action.ActionMethod == PlatformActionMethod.Delete;
|
||||
public void OnReleased(PlatformAction action)
|
||||
{
|
||||
}
|
||||
|
||||
private void selectPiece(PathControlPointPiece piece, MouseButtonEvent e)
|
||||
{
|
||||
|
@ -17,6 +17,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
: base(slider)
|
||||
{
|
||||
this.position = position;
|
||||
|
||||
InternalChild = CirclePiece = new HitCirclePiece();
|
||||
|
||||
Select();
|
||||
|
@ -106,11 +106,11 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnMouseUp(MouseUpEvent e)
|
||||
protected override void OnMouseUp(MouseUpEvent e)
|
||||
{
|
||||
if (state == PlacementState.Body && e.Button == MouseButton.Right)
|
||||
endCurve();
|
||||
return base.OnMouseUp(e);
|
||||
base.OnMouseUp(e);
|
||||
}
|
||||
|
||||
protected override bool OnDoubleClick(DoubleClickEvent e)
|
||||
|
@ -90,19 +90,16 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
|
||||
protected override bool OnDragStart(DragStartEvent e) => placementControlPointIndex != null;
|
||||
|
||||
protected override bool OnDrag(DragEvent e)
|
||||
protected override void OnDrag(DragEvent e)
|
||||
{
|
||||
Debug.Assert(placementControlPointIndex != null);
|
||||
|
||||
HitObject.Path.ControlPoints[placementControlPointIndex.Value].Position.Value = e.MousePosition - HitObject.Position;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnDragEnd(DragEndEvent e)
|
||||
protected override void OnDragEnd(DragEndEvent e)
|
||||
{
|
||||
placementControlPointIndex = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
private BindableList<PathControlPoint> controlPoints => HitObject.Path.ControlPoints;
|
||||
@ -173,7 +170,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
new OsuMenuItem("Add control point", MenuItemType.Standard, () => addControlPoint(rightClickPosition)),
|
||||
};
|
||||
|
||||
public override Vector2 SelectionPoint => HeadBlueprint.SelectionPoint;
|
||||
public override Vector2 SelectionPoint => ((DrawableSlider)DrawableObject).HeadCircle.ScreenSpaceDrawQuad.Centre;
|
||||
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => BodyPiece.ReceivePositionalInputAt(screenSpacePos);
|
||||
|
||||
|
41
osu.Game.Rulesets.Osu/Edit/OsuBlueprintContainer.cs
Normal file
41
osu.Game.Rulesets.Osu/Edit/OsuBlueprintContainer.cs
Normal file
@ -0,0 +1,41 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
|
||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders;
|
||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
using osu.Game.Screens.Edit.Compose.Components;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Edit
|
||||
{
|
||||
public class OsuBlueprintContainer : ComposeBlueprintContainer
|
||||
{
|
||||
public OsuBlueprintContainer(IEnumerable<DrawableHitObject> drawableHitObjects)
|
||||
: base(drawableHitObjects)
|
||||
{
|
||||
}
|
||||
|
||||
protected override SelectionHandler CreateSelectionHandler() => new OsuSelectionHandler();
|
||||
|
||||
public override OverlaySelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject)
|
||||
{
|
||||
switch (hitObject)
|
||||
{
|
||||
case DrawableHitCircle circle:
|
||||
return new HitCircleSelectionBlueprint(circle);
|
||||
|
||||
case DrawableSlider slider:
|
||||
return new SliderSelectionBlueprint(slider);
|
||||
|
||||
case DrawableSpinner spinner:
|
||||
return new SpinnerSelectionBlueprint(spinner);
|
||||
}
|
||||
|
||||
return base.CreateBlueprintFor(hitObject);
|
||||
}
|
||||
}
|
||||
}
|
@ -9,12 +9,7 @@ using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Edit.Tools;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
|
||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders;
|
||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Edit.Compose.Components;
|
||||
|
||||
@ -37,24 +32,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
new SpinnerCompositionTool()
|
||||
};
|
||||
|
||||
public override SelectionHandler CreateSelectionHandler() => new OsuSelectionHandler();
|
||||
|
||||
public override SelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject)
|
||||
{
|
||||
switch (hitObject)
|
||||
{
|
||||
case DrawableHitCircle circle:
|
||||
return new HitCircleSelectionBlueprint(circle);
|
||||
|
||||
case DrawableSlider slider:
|
||||
return new SliderSelectionBlueprint(slider);
|
||||
|
||||
case DrawableSpinner spinner:
|
||||
return new SpinnerSelectionBlueprint(spinner);
|
||||
}
|
||||
|
||||
return base.CreateBlueprintFor(hitObject);
|
||||
}
|
||||
protected override ComposeBlueprintContainer CreateBlueprintContainer() => new OsuBlueprintContainer(HitObjects);
|
||||
|
||||
protected override DistanceSnapGrid CreateDistanceSnapGrid(IEnumerable<HitObject> selectedHitObjects)
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
{
|
||||
public override string Name => "Autopilot";
|
||||
public override string Acronym => "AP";
|
||||
public override IconUsage Icon => OsuIcon.ModAutopilot;
|
||||
public override IconUsage? Icon => OsuIcon.ModAutopilot;
|
||||
public override ModType Type => ModType.Automation;
|
||||
public override string Description => @"Automatic cursor movement - just follow the rhythm.";
|
||||
public override double ScoreMultiplier => 1;
|
||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
public override string Description => "Play with blinds on your screen.";
|
||||
public override string Acronym => "BL";
|
||||
|
||||
public override IconUsage Icon => FontAwesome.Solid.Adjust;
|
||||
public override IconUsage? Icon => FontAwesome.Solid.Adjust;
|
||||
public override ModType Type => ModType.DifficultyIncrease;
|
||||
|
||||
public override bool Ranked => false;
|
||||
|
@ -11,7 +11,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
public override string Acronym => "DF";
|
||||
|
||||
public override IconUsage Icon => FontAwesome.Solid.CompressArrowsAlt;
|
||||
public override IconUsage? Icon => FontAwesome.Solid.CompressArrowsAlt;
|
||||
|
||||
public override string Description => "Hit them at the right size!";
|
||||
|
||||
|
@ -11,7 +11,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
public override string Acronym => "GR";
|
||||
|
||||
public override IconUsage Icon => FontAwesome.Solid.ArrowsAltV;
|
||||
public override IconUsage? Icon => FontAwesome.Solid.ArrowsAltV;
|
||||
|
||||
public override string Description => "Hit them at the right size!";
|
||||
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
{
|
||||
public override string Name => "Spin In";
|
||||
public override string Acronym => "SI";
|
||||
public override IconUsage Icon => FontAwesome.Solid.Undo;
|
||||
public override IconUsage? Icon => FontAwesome.Solid.Undo;
|
||||
public override ModType Type => ModType.Fun;
|
||||
public override string Description => "Circles spin in. No approach circles.";
|
||||
public override double ScoreMultiplier => 1;
|
||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
{
|
||||
public override string Name => "Spun Out";
|
||||
public override string Acronym => "SO";
|
||||
public override IconUsage Icon => OsuIcon.ModSpunout;
|
||||
public override IconUsage? Icon => OsuIcon.ModSpunout;
|
||||
public override ModType Type => ModType.DifficultyReduction;
|
||||
public override string Description => @"Spinners will be automatically completed.";
|
||||
public override double ScoreMultiplier => 0.9;
|
||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
public override string Name => "Target";
|
||||
public override string Acronym => "TP";
|
||||
public override ModType Type => ModType.Conversion;
|
||||
public override IconUsage Icon => OsuIcon.ModTarget;
|
||||
public override IconUsage? Icon => OsuIcon.ModTarget;
|
||||
public override string Description => @"Practice keeping up with the beat of the song.";
|
||||
public override double ScoreMultiplier => 1;
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ using System.Linq;
|
||||
using osu.Framework.Bindables;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
@ -19,7 +18,6 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
{
|
||||
public override string Name => "Traceable";
|
||||
public override string Acronym => "TC";
|
||||
public override IconUsage Icon => FontAwesome.Brands.SnapchatGhost;
|
||||
public override ModType Type => ModType.Fun;
|
||||
public override string Description => "Put your faith in the approach circles...";
|
||||
public override double ScoreMultiplier => 1;
|
||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
{
|
||||
public override string Name => "Transform";
|
||||
public override string Acronym => "TR";
|
||||
public override IconUsage Icon => FontAwesome.Solid.ArrowsAlt;
|
||||
public override IconUsage? Icon => FontAwesome.Solid.ArrowsAlt;
|
||||
public override ModType Type => ModType.Fun;
|
||||
public override string Description => "Everything rotates. EVERYTHING.";
|
||||
public override double ScoreMultiplier => 1;
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
{
|
||||
public override string Name => "Wiggle";
|
||||
public override string Acronym => "WG";
|
||||
public override IconUsage Icon => FontAwesome.Solid.Certificate;
|
||||
public override IconUsage? Icon => FontAwesome.Solid.Certificate;
|
||||
public override ModType Type => ModType.Fun;
|
||||
public override string Description => "They just won't stay still...";
|
||||
public override double ScoreMultiplier => 1;
|
||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
||||
/// <summary>
|
||||
/// The start time of <see cref="Start"/>.
|
||||
/// </summary>
|
||||
public readonly Bindable<double> StartTime = new Bindable<double>();
|
||||
public readonly Bindable<double> StartTime = new BindableDouble();
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="DrawableOsuHitObject"/> which <see cref="FollowPoint"/>s will exit from.
|
||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
|
||||
private readonly IBindable<Vector2> positionBindable = new Bindable<Vector2>();
|
||||
private readonly IBindable<int> stackHeightBindable = new Bindable<int>();
|
||||
private readonly IBindable<float> scaleBindable = new Bindable<float>();
|
||||
private readonly IBindable<float> scaleBindable = new BindableFloat();
|
||||
|
||||
public OsuAction? HitAction => HitArea.HitAction;
|
||||
|
||||
@ -205,7 +205,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool OnReleased(OsuAction action) => false;
|
||||
public void OnReleased(OsuAction action)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,13 +6,11 @@ using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osuTK;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
@ -23,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
|
||||
private double animDuration;
|
||||
|
||||
private readonly SkinnableDrawable scaleContainer;
|
||||
private readonly Drawable scaleContainer;
|
||||
|
||||
public DrawableRepeatPoint(RepeatPoint repeatPoint, DrawableSlider drawableSlider)
|
||||
: base(repeatPoint)
|
||||
@ -36,19 +34,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
Blending = BlendingParameters.Additive;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
InternalChild = scaleContainer = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.ReverseArrow), _ => new SpriteIcon
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Icon = FontAwesome.Solid.ChevronRight,
|
||||
Size = new Vector2(0.35f)
|
||||
}, confineMode: ConfineMode.NoScaling)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
};
|
||||
InternalChild = scaleContainer = new ReverseArrowPiece();
|
||||
}
|
||||
|
||||
private readonly IBindable<float> scaleBindable = new Bindable<float>();
|
||||
private readonly IBindable<float> scaleBindable = new BindableFloat();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
@ -65,11 +54,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
|
||||
protected override void UpdateInitialTransforms()
|
||||
{
|
||||
animDuration = Math.Min(150, repeatPoint.SpanDuration / 2);
|
||||
animDuration = Math.Min(300, repeatPoint.SpanDuration);
|
||||
|
||||
this.Animate(
|
||||
d => d.FadeIn(animDuration),
|
||||
d => d.ScaleTo(0.5f).ScaleTo(1f, animDuration * 4, Easing.OutElasticHalf)
|
||||
d => d.ScaleTo(0.5f).ScaleTo(1f, animDuration * 2, Easing.OutElasticHalf)
|
||||
);
|
||||
}
|
||||
|
||||
@ -88,7 +77,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
break;
|
||||
|
||||
case ArmedState.Hit:
|
||||
this.FadeOut(animDuration, Easing.OutQuint)
|
||||
this.FadeOut(animDuration, Easing.Out)
|
||||
.ScaleTo(Scale * 1.5f, animDuration, Easing.Out);
|
||||
break;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
|
||||
private readonly IBindable<Vector2> positionBindable = new Bindable<Vector2>();
|
||||
private readonly IBindable<int> stackHeightBindable = new Bindable<int>();
|
||||
private readonly IBindable<float> scaleBindable = new Bindable<float>();
|
||||
private readonly IBindable<float> scaleBindable = new BindableFloat();
|
||||
|
||||
public DrawableSlider(Slider s)
|
||||
: base(s)
|
||||
|
@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
};
|
||||
}
|
||||
|
||||
private readonly IBindable<float> scaleBindable = new Bindable<float>();
|
||||
private readonly IBindable<float> scaleBindable = new BindableFloat();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
|
@ -0,0 +1,43 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Graphics;
|
||||
using osuTK;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
public class ReverseArrowPiece : BeatSyncedContainer
|
||||
{
|
||||
public ReverseArrowPiece()
|
||||
{
|
||||
Divisor = 2;
|
||||
MinimumBeatLength = 200;
|
||||
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
Blending = BlendingParameters.Additive;
|
||||
|
||||
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||
|
||||
Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.ReverseArrow), _ => new SpriteIcon
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Icon = FontAwesome.Solid.ChevronRight,
|
||||
Size = new Vector2(0.35f)
|
||||
})
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
};
|
||||
}
|
||||
|
||||
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) =>
|
||||
Child.ScaleTo(1.3f).ScaleTo(1f, timingPoint.BeatLength, Easing.Out);
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
public Func<OsuAction?> GetInitialHitAction;
|
||||
|
||||
private readonly Slider slider;
|
||||
public readonly Drawable FollowCircle;
|
||||
private readonly Drawable followCircle;
|
||||
private readonly DrawableSlider drawableSlider;
|
||||
|
||||
public SliderBall(Slider slider, DrawableSlider drawableSlider = null)
|
||||
@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
FollowCircle = new FollowCircleContainer
|
||||
followCircle = new FollowCircleContainer
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
@ -95,8 +95,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
|
||||
tracking = value;
|
||||
|
||||
FollowCircle.ScaleTo(tracking ? 2f : 1, 300, Easing.OutQuint);
|
||||
FollowCircle.FadeTo(tracking ? 1f : 0, 300, Easing.OutQuint);
|
||||
followCircle.ScaleTo(tracking ? 2.4f : 1f, 300, Easing.OutQuint);
|
||||
followCircle.FadeTo(tracking ? 1f : 0, 300, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
// in valid time range
|
||||
Time.Current >= slider.StartTime && Time.Current < slider.EndTime &&
|
||||
// in valid position range
|
||||
lastScreenSpaceMousePosition.HasValue && FollowCircle.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) &&
|
||||
lastScreenSpaceMousePosition.HasValue && followCircle.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) &&
|
||||
// valid action
|
||||
(actions?.Any(isValidTrackingAction) ?? false);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
|
||||
public double Radius => OBJECT_RADIUS * Scale;
|
||||
|
||||
public readonly Bindable<float> ScaleBindable = new Bindable<float>(1);
|
||||
public readonly Bindable<float> ScaleBindable = new BindableFloat(1);
|
||||
|
||||
public float Scale
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
autoCursorScale = config.GetBindable<bool>(OsuSetting.AutoCursorSize);
|
||||
autoCursorScale.ValueChanged += _ => calculateScale();
|
||||
|
||||
CursorScale = new Bindable<float>();
|
||||
CursorScale = new BindableFloat();
|
||||
CursorScale.ValueChanged += e => ActiveCursor.Scale = cursorTrail.Scale = new Vector2(e.NewValue);
|
||||
|
||||
calculateScale();
|
||||
@ -107,7 +107,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool OnReleased(OsuAction action)
|
||||
public void OnReleased(OsuAction action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
@ -120,8 +120,6 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
updateExpandedState();
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool HandlePositionalInput => true; // OverlayContainer will set this false when we go hidden, but we always want to receive input.
|
||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
{
|
||||
Add(localCursorContainer = new OsuCursorContainer());
|
||||
|
||||
localCursorScale = new Bindable<float>();
|
||||
localCursorScale = new BindableFloat();
|
||||
localCursorScale.BindTo(localCursorContainer.CursorScale);
|
||||
localCursorScale.BindValueChanged(scale => cursorScaleContainer.Scale = new Vector2(scale.NewValue), true);
|
||||
}
|
||||
@ -107,7 +107,9 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool OnReleased(OsuAction action) => false;
|
||||
public void OnReleased(OsuAction action)
|
||||
{
|
||||
}
|
||||
|
||||
public void Appear() => Schedule(() =>
|
||||
{
|
||||
|
@ -77,11 +77,12 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
return result;
|
||||
}
|
||||
|
||||
public override bool OnReleased(TaikoAction action)
|
||||
public override void OnReleased(TaikoAction action)
|
||||
{
|
||||
if (action == HitAction)
|
||||
HitAction = null;
|
||||
return base.OnReleased(action);
|
||||
|
||||
base.OnReleased(action);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
|
@ -77,7 +77,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
public Drawable CreateProxiedContent() => proxiedContent.CreateProxy();
|
||||
|
||||
public abstract bool OnPressed(TaikoAction action);
|
||||
public virtual bool OnReleased(TaikoAction action) => false;
|
||||
|
||||
public virtual void OnReleased(TaikoAction action)
|
||||
{
|
||||
}
|
||||
|
||||
public override double LifetimeStart
|
||||
{
|
||||
|
@ -187,7 +187,9 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool OnReleased(TaikoAction action) => false;
|
||||
public void OnReleased(TaikoAction action)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
@ -13,7 +14,9 @@ using osu.Game.IPC;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.IO;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Tests.Resources;
|
||||
using SharpCompress.Archives;
|
||||
using SharpCompress.Archives.Zip;
|
||||
@ -552,6 +555,83 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TestUpdateBeatmapInfo()
|
||||
{
|
||||
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestUpdateBeatmapInfo)))
|
||||
{
|
||||
try
|
||||
{
|
||||
var osu = loadOsu(host);
|
||||
var manager = osu.Dependencies.Get<BeatmapManager>();
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
await osu.Dependencies.Get<BeatmapManager>().Import(temp);
|
||||
|
||||
// Update via the beatmap, not the beatmap info, to ensure correct linking
|
||||
BeatmapSetInfo setToUpdate = manager.GetAllUsableBeatmapSets()[0];
|
||||
Beatmap beatmapToUpdate = (Beatmap)manager.GetWorkingBeatmap(setToUpdate.Beatmaps.First(b => b.RulesetID == 0)).Beatmap;
|
||||
beatmapToUpdate.BeatmapInfo.Version = "updated";
|
||||
|
||||
manager.Update(setToUpdate);
|
||||
|
||||
BeatmapInfo updatedInfo = manager.QueryBeatmap(b => b.ID == beatmapToUpdate.BeatmapInfo.ID);
|
||||
Assert.That(updatedInfo.Version, Is.EqualTo("updated"));
|
||||
}
|
||||
finally
|
||||
{
|
||||
host.Exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TestUpdateBeatmapFile()
|
||||
{
|
||||
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestUpdateBeatmapFile)))
|
||||
{
|
||||
try
|
||||
{
|
||||
var osu = loadOsu(host);
|
||||
var manager = osu.Dependencies.Get<BeatmapManager>();
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
await osu.Dependencies.Get<BeatmapManager>().Import(temp);
|
||||
|
||||
BeatmapSetInfo setToUpdate = manager.GetAllUsableBeatmapSets()[0];
|
||||
Beatmap beatmapToUpdate = (Beatmap)manager.GetWorkingBeatmap(setToUpdate.Beatmaps.First(b => b.RulesetID == 0)).Beatmap;
|
||||
BeatmapSetFileInfo fileToUpdate = setToUpdate.Files.First(f => beatmapToUpdate.BeatmapInfo.Path.Contains(f.Filename));
|
||||
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
using (var writer = new StreamWriter(stream, Encoding.UTF8, 1024, true))
|
||||
{
|
||||
beatmapToUpdate.HitObjects.Clear();
|
||||
beatmapToUpdate.HitObjects.Add(new HitCircle { StartTime = 5000 });
|
||||
|
||||
new LegacyBeatmapEncoder(beatmapToUpdate).Encode(writer);
|
||||
}
|
||||
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
manager.UpdateFile(setToUpdate, fileToUpdate, stream);
|
||||
}
|
||||
|
||||
// Check that the old file reference has been removed
|
||||
Assert.That(manager.QueryBeatmapSet(s => s.ID == setToUpdate.ID).Files.All(f => f.ID != fileToUpdate.ID));
|
||||
|
||||
// Check that the new file is referenced correctly by attempting a retrieval
|
||||
Beatmap updatedBeatmap = (Beatmap)manager.GetWorkingBeatmap(manager.QueryBeatmap(b => b.ID == beatmapToUpdate.BeatmapInfo.ID)).Beatmap;
|
||||
Assert.That(updatedBeatmap.HitObjects.Count, Is.EqualTo(1));
|
||||
Assert.That(updatedBeatmap.HitObjects[0].StartTime, Is.EqualTo(5000));
|
||||
}
|
||||
finally
|
||||
{
|
||||
host.Exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<BeatmapSetInfo> LoadOszIntoOsu(OsuGameBase osu, string path = null, bool virtualTrack = false)
|
||||
{
|
||||
var temp = path ?? TestResources.GetTestBeatmapForImport(virtualTrack);
|
||||
|
@ -5,6 +5,7 @@ using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||
using osu.Game.Rulesets.Osu.Edit;
|
||||
@ -19,7 +20,13 @@ namespace osu.Game.Tests.Editor
|
||||
private TestHitObjectComposer composer;
|
||||
|
||||
[Cached(typeof(EditorBeatmap))]
|
||||
private readonly EditorBeatmap editorBeatmap = new EditorBeatmap(new OsuBeatmap());
|
||||
[Cached(typeof(IBeatSnapProvider))]
|
||||
private readonly EditorBeatmap editorBeatmap;
|
||||
|
||||
public TestSceneHitObjectComposerDistanceSnapping()
|
||||
{
|
||||
editorBeatmap = new EditorBeatmap(new OsuBeatmap(), BeatDivisor);
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void Setup() => Schedule(() =>
|
||||
@ -111,17 +118,19 @@ namespace osu.Game.Tests.Editor
|
||||
[Test]
|
||||
public void TestGetSnappedDurationFromDistance()
|
||||
{
|
||||
assertSnappedDuration(50, 0);
|
||||
assertSnappedDuration(0, 0);
|
||||
assertSnappedDuration(50, 1000);
|
||||
assertSnappedDuration(100, 1000);
|
||||
assertSnappedDuration(150, 1000);
|
||||
assertSnappedDuration(150, 2000);
|
||||
assertSnappedDuration(200, 2000);
|
||||
assertSnappedDuration(250, 2000);
|
||||
assertSnappedDuration(250, 3000);
|
||||
|
||||
AddStep("set slider multiplier = 2", () => composer.EditorBeatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier = 2);
|
||||
|
||||
assertSnappedDuration(0, 0);
|
||||
assertSnappedDuration(50, 0);
|
||||
assertSnappedDuration(100, 0);
|
||||
assertSnappedDuration(150, 0);
|
||||
assertSnappedDuration(100, 1000);
|
||||
assertSnappedDuration(150, 1000);
|
||||
assertSnappedDuration(200, 1000);
|
||||
assertSnappedDuration(250, 1000);
|
||||
|
||||
@ -132,8 +141,8 @@ namespace osu.Game.Tests.Editor
|
||||
});
|
||||
|
||||
assertSnappedDuration(50, 0);
|
||||
assertSnappedDuration(100, 0);
|
||||
assertSnappedDuration(150, 0);
|
||||
assertSnappedDuration(100, 500);
|
||||
assertSnappedDuration(150, 500);
|
||||
assertSnappedDuration(200, 500);
|
||||
assertSnappedDuration(250, 500);
|
||||
assertSnappedDuration(400, 1000);
|
||||
@ -142,17 +151,17 @@ namespace osu.Game.Tests.Editor
|
||||
[Test]
|
||||
public void GetSnappedDistanceFromDistance()
|
||||
{
|
||||
assertSnappedDistance(50, 0);
|
||||
assertSnappedDistance(50, 100);
|
||||
assertSnappedDistance(100, 100);
|
||||
assertSnappedDistance(150, 100);
|
||||
assertSnappedDistance(150, 200);
|
||||
assertSnappedDistance(200, 200);
|
||||
assertSnappedDistance(250, 200);
|
||||
assertSnappedDistance(250, 300);
|
||||
|
||||
AddStep("set slider multiplier = 2", () => composer.EditorBeatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier = 2);
|
||||
|
||||
assertSnappedDistance(50, 0);
|
||||
assertSnappedDistance(100, 0);
|
||||
assertSnappedDistance(150, 0);
|
||||
assertSnappedDistance(100, 200);
|
||||
assertSnappedDistance(150, 200);
|
||||
assertSnappedDistance(200, 200);
|
||||
assertSnappedDistance(250, 200);
|
||||
|
||||
@ -163,8 +172,8 @@ namespace osu.Game.Tests.Editor
|
||||
});
|
||||
|
||||
assertSnappedDistance(50, 0);
|
||||
assertSnappedDistance(100, 0);
|
||||
assertSnappedDistance(150, 0);
|
||||
assertSnappedDistance(100, 200);
|
||||
assertSnappedDistance(150, 200);
|
||||
assertSnappedDistance(200, 200);
|
||||
assertSnappedDistance(250, 200);
|
||||
assertSnappedDistance(400, 400);
|
||||
|
82
osu.Game.Tests/Online/TestAPIModSerialization.cs
Normal file
82
osu.Game.Tests/Online/TestAPIModSerialization.cs
Normal file
@ -0,0 +1,82 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.UI;
|
||||
|
||||
namespace osu.Game.Tests.Online
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestAPIModSerialization
|
||||
{
|
||||
[Test]
|
||||
public void TestAcronymIsPreserved()
|
||||
{
|
||||
var apiMod = new APIMod(new TestMod());
|
||||
|
||||
var deserialized = JsonConvert.DeserializeObject<APIMod>(JsonConvert.SerializeObject(apiMod));
|
||||
|
||||
Assert.That(deserialized.Acronym, Is.EqualTo(apiMod.Acronym));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRawSettingIsPreserved()
|
||||
{
|
||||
var apiMod = new APIMod(new TestMod { TestSetting = { Value = 2 } });
|
||||
|
||||
var deserialized = JsonConvert.DeserializeObject<APIMod>(JsonConvert.SerializeObject(apiMod));
|
||||
|
||||
Assert.That(deserialized.Settings, Contains.Key("test_setting").With.ContainValue(2.0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestConvertedModHasCorrectSetting()
|
||||
{
|
||||
var apiMod = new APIMod(new TestMod { TestSetting = { Value = 2 } });
|
||||
|
||||
var deserialized = JsonConvert.DeserializeObject<APIMod>(JsonConvert.SerializeObject(apiMod));
|
||||
var converted = (TestMod)deserialized.ToMod(new TestRuleset());
|
||||
|
||||
Assert.That(converted.TestSetting.Value, Is.EqualTo(2));
|
||||
}
|
||||
|
||||
private class TestRuleset : Ruleset
|
||||
{
|
||||
public override IEnumerable<Mod> GetModsFor(ModType type) => new[] { new TestMod() };
|
||||
|
||||
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => throw new System.NotImplementedException();
|
||||
|
||||
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => throw new System.NotImplementedException();
|
||||
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => throw new System.NotImplementedException();
|
||||
|
||||
public override string Description { get; } = string.Empty;
|
||||
public override string ShortName { get; } = string.Empty;
|
||||
}
|
||||
|
||||
private class TestMod : Mod
|
||||
{
|
||||
public override string Name => "Test Mod";
|
||||
public override string Acronym => "TM";
|
||||
public override double ScoreMultiplier => 1;
|
||||
|
||||
[SettingSource("Test")]
|
||||
public BindableNumber<double> TestSetting { get; } = new BindableDouble
|
||||
{
|
||||
MinValue = 0,
|
||||
MaxValue = 10,
|
||||
Default = 5,
|
||||
Precision = 0.01,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -68,10 +68,10 @@ namespace osu.Game.Tests.Visual.Background
|
||||
[SetUp]
|
||||
public virtual void SetUp() => Schedule(() =>
|
||||
{
|
||||
Child = new OsuScreenStack(songSelect = new DummySongSelect())
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
};
|
||||
var stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both };
|
||||
Child = stack;
|
||||
|
||||
stack.Push(songSelect = new DummySongSelect());
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
@ -277,7 +277,7 @@ namespace osu.Game.Tests.Visual.Background
|
||||
|
||||
private void setupUserSettings()
|
||||
{
|
||||
AddUntilStep("Song select has selection", () => songSelect.Carousel.SelectedBeatmap != null);
|
||||
AddUntilStep("Song select has selection", () => songSelect.Carousel?.SelectedBeatmap != null);
|
||||
AddStep("Set default user settings", () =>
|
||||
{
|
||||
SelectedMods.Value = SelectedMods.Value.Concat(new[] { new OsuModNoFail() }).ToArray();
|
||||
@ -302,8 +302,8 @@ namespace osu.Game.Tests.Visual.Background
|
||||
}
|
||||
|
||||
public readonly Bindable<bool> DimEnabled = new Bindable<bool>();
|
||||
public readonly Bindable<double> DimLevel = new Bindable<double>();
|
||||
public readonly Bindable<double> BlurLevel = new Bindable<double>();
|
||||
public readonly Bindable<double> DimLevel = new BindableDouble();
|
||||
public readonly Bindable<double> BlurLevel = new BindableDouble();
|
||||
|
||||
public new BeatmapCarousel Carousel => base.Carousel;
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||
using osu.Game.Screens.Edit;
|
||||
@ -14,6 +15,7 @@ namespace osu.Game.Tests.Visual.Editor
|
||||
public class TestSceneComposeScreen : EditorClockTestScene
|
||||
{
|
||||
[Cached(typeof(EditorBeatmap))]
|
||||
[Cached(typeof(IBeatSnapProvider))]
|
||||
private readonly EditorBeatmap editorBeatmap =
|
||||
new EditorBeatmap(new OsuBeatmap
|
||||
{
|
||||
|
@ -85,64 +85,64 @@ namespace osu.Game.Tests.Visual.Editor
|
||||
{
|
||||
}
|
||||
|
||||
protected override void CreateContent(Vector2 startPosition)
|
||||
protected override void CreateContent()
|
||||
{
|
||||
AddInternal(new Circle
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(5),
|
||||
Position = startPosition
|
||||
Position = StartPosition
|
||||
});
|
||||
|
||||
int beatIndex = 0;
|
||||
int indexFromPlacement = 0;
|
||||
|
||||
for (float s = startPosition.X + DistanceSpacing; s <= DrawWidth && beatIndex < MaxIntervals; s += DistanceSpacing, beatIndex++)
|
||||
for (float s = StartPosition.X + DistanceSpacing; s <= DrawWidth && indexFromPlacement < MaxIntervals; s += DistanceSpacing, indexFromPlacement++)
|
||||
{
|
||||
AddInternal(new Circle
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(5, 10),
|
||||
Position = new Vector2(s, startPosition.Y),
|
||||
Colour = GetColourForBeatIndex(beatIndex)
|
||||
Position = new Vector2(s, StartPosition.Y),
|
||||
Colour = GetColourForIndexFromPlacement(indexFromPlacement)
|
||||
});
|
||||
}
|
||||
|
||||
beatIndex = 0;
|
||||
indexFromPlacement = 0;
|
||||
|
||||
for (float s = startPosition.X - DistanceSpacing; s >= 0 && beatIndex < MaxIntervals; s -= DistanceSpacing, beatIndex++)
|
||||
for (float s = StartPosition.X - DistanceSpacing; s >= 0 && indexFromPlacement < MaxIntervals; s -= DistanceSpacing, indexFromPlacement++)
|
||||
{
|
||||
AddInternal(new Circle
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(5, 10),
|
||||
Position = new Vector2(s, startPosition.Y),
|
||||
Colour = GetColourForBeatIndex(beatIndex)
|
||||
Position = new Vector2(s, StartPosition.Y),
|
||||
Colour = GetColourForIndexFromPlacement(indexFromPlacement)
|
||||
});
|
||||
}
|
||||
|
||||
beatIndex = 0;
|
||||
indexFromPlacement = 0;
|
||||
|
||||
for (float s = startPosition.Y + DistanceSpacing; s <= DrawHeight && beatIndex < MaxIntervals; s += DistanceSpacing, beatIndex++)
|
||||
for (float s = StartPosition.Y + DistanceSpacing; s <= DrawHeight && indexFromPlacement < MaxIntervals; s += DistanceSpacing, indexFromPlacement++)
|
||||
{
|
||||
AddInternal(new Circle
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(10, 5),
|
||||
Position = new Vector2(startPosition.X, s),
|
||||
Colour = GetColourForBeatIndex(beatIndex)
|
||||
Position = new Vector2(StartPosition.X, s),
|
||||
Colour = GetColourForIndexFromPlacement(indexFromPlacement)
|
||||
});
|
||||
}
|
||||
|
||||
beatIndex = 0;
|
||||
indexFromPlacement = 0;
|
||||
|
||||
for (float s = startPosition.Y - DistanceSpacing; s >= 0 && beatIndex < MaxIntervals; s -= DistanceSpacing, beatIndex++)
|
||||
for (float s = StartPosition.Y - DistanceSpacing; s >= 0 && indexFromPlacement < MaxIntervals; s -= DistanceSpacing, indexFromPlacement++)
|
||||
{
|
||||
AddInternal(new Circle
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(10, 5),
|
||||
Position = new Vector2(startPosition.X, s),
|
||||
Colour = GetColourForBeatIndex(beatIndex)
|
||||
Position = new Vector2(StartPosition.X, s),
|
||||
Colour = GetColourForIndexFromPlacement(indexFromPlacement)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ namespace osu.Game.Tests.Visual.Editor
|
||||
Dependencies.CacheAs<IAdjustableClock>(clock);
|
||||
Dependencies.CacheAs<IFrameBasedClock>(clock);
|
||||
Dependencies.CacheAs(editorBeatmap);
|
||||
Dependencies.CacheAs<IBeatSnapProvider>(editorBeatmap);
|
||||
|
||||
Child = new OsuHitObjectComposer(new OsuRuleset());
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Editor
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestSceneTimelineBlueprintContainer : TimelineTestScene
|
||||
{
|
||||
public override Drawable CreateTestComponent() => new TimelineBlueprintContainer();
|
||||
}
|
||||
}
|
32
osu.Game.Tests/Visual/Editor/TestSceneTimelineTickDisplay.cs
Normal file
32
osu.Game.Tests/Visual/Editor/TestSceneTimelineTickDisplay.cs
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Screens.Edit.Compose.Components;
|
||||
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Editor
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestSceneTimelineTickDisplay : TimelineTestScene
|
||||
{
|
||||
public override Drawable CreateTestComponent() => new TimelineTickDisplay();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
BeatDivisor.Value = 4;
|
||||
|
||||
Add(new BeatDivisorControl(BeatDivisor)
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Margin = new MarginPadding(30),
|
||||
Size = new Vector2(90)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Bindables;
|
||||
@ -13,6 +12,7 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
||||
@ -21,26 +21,29 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Editor
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestSceneEditorComposeTimeline : EditorClockTestScene
|
||||
public abstract class TimelineTestScene : EditorClockTestScene
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(TimelineArea),
|
||||
typeof(TimelineHitObjectDisplay),
|
||||
typeof(Timeline),
|
||||
typeof(TimelineButton),
|
||||
typeof(CentreMarker)
|
||||
};
|
||||
|
||||
protected TimelineArea TimelineArea { get; private set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
Beatmap.Value = new WaveformTestBeatmap(audio);
|
||||
|
||||
var editorBeatmap = new EditorBeatmap((Beatmap<HitObject>)Beatmap.Value.Beatmap);
|
||||
var editorBeatmap = new EditorBeatmap((Beatmap<HitObject>)Beatmap.Value.Beatmap, BeatDivisor);
|
||||
|
||||
Children = new Drawable[]
|
||||
Dependencies.Cache(editorBeatmap);
|
||||
Dependencies.CacheAs<IBeatSnapProvider>(editorBeatmap);
|
||||
|
||||
AddRange(new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
{
|
||||
@ -53,17 +56,19 @@ namespace osu.Game.Tests.Visual.Editor
|
||||
new AudioVisualiser(),
|
||||
}
|
||||
},
|
||||
new TimelineArea
|
||||
TimelineArea = new TimelineArea
|
||||
{
|
||||
Child = new TimelineHitObjectDisplay(editorBeatmap),
|
||||
Child = CreateTestComponent(),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Size = new Vector2(0.8f, 100)
|
||||
Size = new Vector2(0.8f, 100),
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
public abstract Drawable CreateTestComponent();
|
||||
|
||||
private class AudioVisualiser : CompositeDrawable
|
||||
{
|
||||
private readonly Drawable marker;
|
@ -2,49 +2,66 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Catch;
|
||||
using osu.Game.Rulesets.Mania;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Taiko;
|
||||
using osu.Game.Screens.Play;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
/// <summary>
|
||||
/// A base class which runs <see cref="Player"/> test for all available rulesets.
|
||||
/// Steps to be run for each ruleset should be added via <see cref="AddCheckSteps"/>.
|
||||
/// </summary>
|
||||
public abstract class AllPlayersTestScene : RateAdjustedBeatmapTestScene
|
||||
public abstract class TestSceneAllRulesetPlayers : RateAdjustedBeatmapTestScene
|
||||
{
|
||||
protected Player Player;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RulesetStore rulesets)
|
||||
{
|
||||
foreach (var r in rulesets.AvailableRulesets)
|
||||
{
|
||||
Player p = null;
|
||||
AddStep(r.Name, () => p = loadPlayerFor(r));
|
||||
AddUntilStep("player loaded", () =>
|
||||
{
|
||||
if (p?.IsLoaded == true)
|
||||
{
|
||||
p = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
AddCheckSteps();
|
||||
}
|
||||
|
||||
OsuConfigManager manager;
|
||||
Dependencies.Cache(manager = new OsuConfigManager(LocalStorage));
|
||||
manager.GetBindable<double>(OsuSetting.DimLevel).Value = 1.0;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOsu() => runForRuleset(new OsuRuleset().RulesetInfo);
|
||||
|
||||
[Test]
|
||||
public void TestTaiko() => runForRuleset(new TaikoRuleset().RulesetInfo);
|
||||
|
||||
[Test]
|
||||
public void TestCatch() => runForRuleset(new CatchRuleset().RulesetInfo);
|
||||
|
||||
[Test]
|
||||
public void TestMania() => runForRuleset(new ManiaRuleset().RulesetInfo);
|
||||
|
||||
private void runForRuleset(RulesetInfo ruleset)
|
||||
{
|
||||
Player p = null;
|
||||
AddStep($"load {ruleset.Name} player", () => p = loadPlayerFor(ruleset));
|
||||
AddUntilStep("player loaded", () =>
|
||||
{
|
||||
if (p?.IsLoaded == true)
|
||||
{
|
||||
p = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
AddCheckSteps();
|
||||
}
|
||||
|
||||
protected abstract void AddCheckSteps();
|
||||
|
||||
private Player loadPlayerFor(RulesetInfo rulesetInfo)
|
@ -12,7 +12,7 @@ using osu.Game.Storyboards;
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
[Description("Player instantiated with an autoplay mod.")]
|
||||
public class TestSceneAutoplay : AllPlayersTestScene
|
||||
public class TestSceneAutoplay : TestSceneAllRulesetPlayers
|
||||
{
|
||||
private ClockBackedTestWorkingBeatmap.TrackVirtualManual track;
|
||||
|
||||
|
@ -10,7 +10,7 @@ using osu.Game.Screens.Play;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
public class TestSceneFailAnimation : AllPlayersTestScene
|
||||
public class TestSceneFailAnimation : TestSceneAllRulesetPlayers
|
||||
{
|
||||
protected override Player CreatePlayer(Ruleset ruleset)
|
||||
{
|
||||
@ -20,7 +20,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(AllPlayersTestScene),
|
||||
typeof(TestSceneAllRulesetPlayers),
|
||||
typeof(TestPlayer),
|
||||
typeof(Player),
|
||||
};
|
||||
|
@ -10,7 +10,7 @@ using osu.Game.Screens.Play;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
public class TestSceneFailJudgement : AllPlayersTestScene
|
||||
public class TestSceneFailJudgement : TestSceneAllRulesetPlayers
|
||||
{
|
||||
protected override Player CreatePlayer(Ruleset ruleset)
|
||||
{
|
||||
|
@ -19,18 +19,22 @@ using osu.Game.Screens.Play.HUD.HitErrorMeters;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
public class TestSceneBarHitErrorMeter : OsuTestScene
|
||||
public class TestSceneHitErrorMeter : OsuTestScene
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(HitErrorMeter),
|
||||
typeof(BarHitErrorMeter),
|
||||
typeof(ColourHitErrorMeter)
|
||||
};
|
||||
|
||||
private HitErrorMeter meter;
|
||||
private HitErrorMeter meter2;
|
||||
private BarHitErrorMeter barMeter;
|
||||
private BarHitErrorMeter barMeter2;
|
||||
private ColourHitErrorMeter colourMeter;
|
||||
private ColourHitErrorMeter colourMeter2;
|
||||
private HitWindows hitWindows;
|
||||
|
||||
public TestSceneBarHitErrorMeter()
|
||||
public TestSceneHitErrorMeter()
|
||||
{
|
||||
recreateDisplay(new OsuHitWindows(), 5);
|
||||
|
||||
@ -91,17 +95,31 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
}
|
||||
});
|
||||
|
||||
Add(meter = new BarHitErrorMeter(hitWindows, true)
|
||||
Add(barMeter = new BarHitErrorMeter(hitWindows, true)
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
});
|
||||
|
||||
Add(meter2 = new BarHitErrorMeter(hitWindows, false)
|
||||
Add(barMeter2 = new BarHitErrorMeter(hitWindows, false)
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
});
|
||||
|
||||
Add(colourMeter = new ColourHitErrorMeter(hitWindows)
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
Margin = new MarginPadding { Right = 50 }
|
||||
});
|
||||
|
||||
Add(colourMeter2 = new ColourHitErrorMeter(hitWindows)
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Margin = new MarginPadding { Left = 50 }
|
||||
});
|
||||
}
|
||||
|
||||
private void newJudgement(double offset = 0)
|
||||
@ -112,8 +130,10 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
Type = HitResult.Perfect,
|
||||
};
|
||||
|
||||
meter.OnNewJudgement(judgement);
|
||||
meter2.OnNewJudgement(judgement);
|
||||
barMeter.OnNewJudgement(judgement);
|
||||
barMeter2.OnNewJudgement(judgement);
|
||||
colourMeter.OnNewJudgement(judgement);
|
||||
colourMeter2.OnNewJudgement(judgement);
|
||||
}
|
||||
}
|
||||
}
|
@ -36,6 +36,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
AddStep("resume player", () => Player.GameplayClockContainer.Start());
|
||||
confirmClockRunning(true);
|
||||
}
|
||||
|
@ -207,9 +207,11 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
OsuScreenStack stack;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
new OsuScreenStack(screen)
|
||||
stack = new OsuScreenStack
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
@ -224,6 +226,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
Origin = Anchor.TopLeft,
|
||||
}
|
||||
};
|
||||
|
||||
stack.Push(screen);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ using osu.Game.Storyboards;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
public class TestScenePlayerReferenceLeaking : AllPlayersTestScene
|
||||
public class TestScenePlayerReferenceLeaking : TestSceneAllRulesetPlayers
|
||||
{
|
||||
private readonly WeakList<WorkingBeatmap> workingWeakReferences = new WeakList<WorkingBeatmap>();
|
||||
|
||||
|
@ -13,7 +13,7 @@ using osu.Game.Screens.Play;
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
[Description("Player instantiated with a replay.")]
|
||||
public class TestSceneReplay : AllPlayersTestScene
|
||||
public class TestSceneReplay : TestSceneAllRulesetPlayers
|
||||
{
|
||||
protected override Player CreatePlayer(Ruleset ruleset)
|
||||
{
|
||||
|
@ -75,10 +75,16 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
public void ResultsWithoutPlayer()
|
||||
{
|
||||
TestSoloResults screen = null;
|
||||
OsuScreenStack stack;
|
||||
|
||||
AddStep("load results", () => Child = new OsuScreenStack(screen = createResultsScreen())
|
||||
AddStep("load results", () =>
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
Child = stack = new OsuScreenStack
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
};
|
||||
|
||||
stack.Push(screen = createResultsScreen());
|
||||
});
|
||||
AddUntilStep("wait for loaded", () => screen.IsLoaded);
|
||||
AddAssert("retry overlay not present", () => screen.RetryOverlay == null);
|
||||
@ -102,11 +108,14 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
public TestResultsContainer(IScreen screen)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
OsuScreenStack stack;
|
||||
|
||||
InternalChild = new OsuScreenStack(screen)
|
||||
InternalChild = stack = new OsuScreenStack
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
};
|
||||
|
||||
stack.Push(screen);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,17 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Screens.Play;
|
||||
|
||||
@ -15,63 +20,125 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
[TestFixture]
|
||||
public class TestSceneSongProgress : OsuTestScene
|
||||
{
|
||||
private readonly SongProgress progress;
|
||||
private readonly TestSongProgressGraph graph;
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(SongProgressBar),
|
||||
};
|
||||
|
||||
private SongProgress progress;
|
||||
private TestSongProgressGraph graph;
|
||||
private readonly Container progressContainer;
|
||||
|
||||
private readonly StopwatchClock clock;
|
||||
private readonly FramedClock framedClock;
|
||||
|
||||
[Cached]
|
||||
private readonly GameplayClock gameplayClock;
|
||||
|
||||
private readonly FramedClock framedClock;
|
||||
|
||||
public TestSceneSongProgress()
|
||||
{
|
||||
clock = new StopwatchClock(true);
|
||||
|
||||
clock = new StopwatchClock();
|
||||
gameplayClock = new GameplayClock(framedClock = new FramedClock(clock));
|
||||
|
||||
Add(progress = new SongProgress
|
||||
Add(progressContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Height = 100,
|
||||
Y = -100,
|
||||
Child = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.Gray(1),
|
||||
}
|
||||
});
|
||||
|
||||
Add(graph = new TestSongProgressGraph
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 200,
|
||||
Anchor = Anchor.TopLeft,
|
||||
Origin = Anchor.TopLeft,
|
||||
});
|
||||
|
||||
AddWaitStep("wait some", 5);
|
||||
AddAssert("ensure not created", () => graph.CreationCount == 0);
|
||||
|
||||
AddStep("display values", displayNewValues);
|
||||
AddWaitStep("wait some", 5);
|
||||
AddUntilStep("wait for creation count", () => graph.CreationCount == 1);
|
||||
|
||||
AddStep("Toggle Bar", () => progress.AllowSeeking = !progress.AllowSeeking);
|
||||
AddWaitStep("wait some", 5);
|
||||
AddUntilStep("wait for creation count", () => graph.CreationCount == 1);
|
||||
|
||||
AddStep("Toggle Bar", () => progress.AllowSeeking = !progress.AllowSeeking);
|
||||
AddWaitStep("wait some", 5);
|
||||
AddUntilStep("wait for creation count", () => graph.CreationCount == 1);
|
||||
AddRepeatStep("New Values", displayNewValues, 5);
|
||||
|
||||
AddWaitStep("wait some", 5);
|
||||
AddAssert("ensure debounced", () => graph.CreationCount == 2);
|
||||
}
|
||||
|
||||
private void displayNewValues()
|
||||
[SetUpSteps]
|
||||
public void SetupSteps()
|
||||
{
|
||||
List<HitObject> objects = new List<HitObject>();
|
||||
AddStep("add new song progress", () =>
|
||||
{
|
||||
if (progress != null)
|
||||
{
|
||||
progress.Expire();
|
||||
progress = null;
|
||||
}
|
||||
|
||||
progressContainer.Add(progress = new SongProgress
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
});
|
||||
});
|
||||
|
||||
AddStep("add new big graph", () =>
|
||||
{
|
||||
if (graph != null)
|
||||
{
|
||||
graph.Expire();
|
||||
graph = null;
|
||||
}
|
||||
|
||||
Add(graph = new TestSongProgressGraph
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 200,
|
||||
Anchor = Anchor.TopLeft,
|
||||
Origin = Anchor.TopLeft,
|
||||
});
|
||||
});
|
||||
|
||||
AddStep("reset clock", clock.Reset);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGraphRecreation()
|
||||
{
|
||||
AddAssert("ensure not created", () => graph.CreationCount == 0);
|
||||
AddStep("display values", displayRandomValues);
|
||||
AddUntilStep("wait for creation count", () => graph.CreationCount == 1);
|
||||
AddRepeatStep("new values", displayRandomValues, 5);
|
||||
AddWaitStep("wait some", 5);
|
||||
AddAssert("ensure recreation debounced", () => graph.CreationCount == 2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDisplay()
|
||||
{
|
||||
AddStep("display max values", displayMaxValues);
|
||||
AddUntilStep("wait for graph", () => graph.CreationCount == 1);
|
||||
AddStep("start", clock.Start);
|
||||
AddStep("allow seeking", () => progress.AllowSeeking.Value = true);
|
||||
AddStep("hide graph", () => progress.ShowGraph.Value = false);
|
||||
AddStep("disallow seeking", () => progress.AllowSeeking.Value = false);
|
||||
AddStep("allow seeking", () => progress.AllowSeeking.Value = true);
|
||||
AddStep("show graph", () => progress.ShowGraph.Value = true);
|
||||
AddStep("stop", clock.Stop);
|
||||
}
|
||||
|
||||
private void displayRandomValues()
|
||||
{
|
||||
var objects = new List<HitObject>();
|
||||
for (double i = 0; i < 5000; i += RNG.NextDouble() * 10 + i / 1000)
|
||||
objects.Add(new HitObject { StartTime = i });
|
||||
|
||||
replaceObjects(objects);
|
||||
}
|
||||
|
||||
private void displayMaxValues()
|
||||
{
|
||||
var objects = new List<HitObject>();
|
||||
for (double i = 0; i < 5000; i++)
|
||||
objects.Add(new HitObject { StartTime = i });
|
||||
|
||||
replaceObjects(objects);
|
||||
}
|
||||
|
||||
private void replaceObjects(List<HitObject> objects)
|
||||
{
|
||||
progress.Objects = objects;
|
||||
graph.Objects = objects;
|
||||
|
||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
|
||||
protected IntroTestScene()
|
||||
{
|
||||
Drawable introStack = null;
|
||||
OsuScreenStack introStack = null;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -57,10 +57,12 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
|
||||
introStack?.Expire();
|
||||
|
||||
Add(introStack = new OsuScreenStack(CreateScreen())
|
||||
Add(introStack = new OsuScreenStack
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
});
|
||||
|
||||
introStack.Push(CreateScreen());
|
||||
});
|
||||
}
|
||||
|
||||
|
36
osu.Game.Tests/Visual/Menus/TestSceneSongTicker.cs
Normal file
36
osu.Game.Tests/Visual/Menus/TestSceneSongTicker.cs
Normal file
@ -0,0 +1,36 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Screens.Menu;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Menus
|
||||
{
|
||||
public class TestSceneSongTicker : OsuTestScene
|
||||
{
|
||||
[Cached]
|
||||
private MusicController musicController = new MusicController();
|
||||
|
||||
public TestSceneSongTicker()
|
||||
{
|
||||
AddRange(new Drawable[]
|
||||
{
|
||||
musicController,
|
||||
new SongTicker
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
new NowPlayingOverlay
|
||||
{
|
||||
Origin = Anchor.TopRight,
|
||||
Anchor = Anchor.TopRight,
|
||||
State = { Value = Visibility.Visible }
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -16,7 +16,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
OsuScreenStack screenStack = new OsuScreenStack(new TestMultiplayerSubScreen(index)) { RelativeSizeAxes = Axes.Both };
|
||||
OsuScreenStack screenStack = new OsuScreenStack { RelativeSizeAxes = Axes.Both };
|
||||
|
||||
screenStack.Push(new TestMultiplayerSubScreen(index));
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
133
osu.Game.Tests/Visual/Navigation/OsuGameTestScene.cs
Normal file
133
osu.Game.Tests/Visual/Navigation/OsuGameTestScene.cs
Normal file
@ -0,0 +1,133 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Screens;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osuTK.Graphics;
|
||||
using IntroSequence = osu.Game.Configuration.IntroSequence;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Navigation
|
||||
{
|
||||
/// <summary>
|
||||
/// A scene which tests full game flow.
|
||||
/// </summary>
|
||||
public abstract class OsuGameTestScene : ManualInputManagerTestScene
|
||||
{
|
||||
private GameHost host;
|
||||
|
||||
protected TestOsuGame Game;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host)
|
||||
{
|
||||
this.host = host;
|
||||
|
||||
Child = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
};
|
||||
}
|
||||
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
{
|
||||
AddStep("Create new game instance", () =>
|
||||
{
|
||||
if (Game != null)
|
||||
{
|
||||
Remove(Game);
|
||||
Game.Dispose();
|
||||
}
|
||||
|
||||
RecycleLocalStorage();
|
||||
|
||||
// see MouseSettings
|
||||
var frameworkConfig = host.Dependencies.Get<FrameworkConfigManager>();
|
||||
frameworkConfig.GetBindable<double>(FrameworkSetting.CursorSensitivity).Disabled = false;
|
||||
|
||||
Game = new TestOsuGame(LocalStorage, API);
|
||||
Game.SetHost(host);
|
||||
|
||||
// todo: this can be removed once we can run audio tracks without a device present
|
||||
// see https://github.com/ppy/osu/issues/1302
|
||||
Game.LocalConfig.Set(OsuSetting.IntroSequence, IntroSequence.Circles);
|
||||
|
||||
Add(Game);
|
||||
});
|
||||
|
||||
AddUntilStep("Wait for load", () => Game.IsLoaded);
|
||||
AddUntilStep("Wait for intro", () => Game.ScreenStack.CurrentScreen is IntroScreen);
|
||||
|
||||
ConfirmAtMainMenu();
|
||||
}
|
||||
|
||||
protected void PushAndConfirm(Func<Screen> newScreen)
|
||||
{
|
||||
Screen screen = null;
|
||||
AddStep("Push new screen", () => Game.ScreenStack.Push(screen = newScreen()));
|
||||
AddUntilStep("Wait for new screen", () => Game.ScreenStack.CurrentScreen == screen && screen.IsLoaded);
|
||||
}
|
||||
|
||||
protected void ConfirmAtMainMenu() => AddUntilStep("Wait for main menu", () => Game.ScreenStack.CurrentScreen is MainMenu menu && menu.IsLoaded);
|
||||
|
||||
public class TestOsuGame : OsuGame
|
||||
{
|
||||
public new ScreenStack ScreenStack => base.ScreenStack;
|
||||
|
||||
public new BackButton BackButton => base.BackButton;
|
||||
|
||||
public new BeatmapManager BeatmapManager => base.BeatmapManager;
|
||||
|
||||
public new SettingsPanel Settings => base.Settings;
|
||||
|
||||
public new OsuConfigManager LocalConfig => base.LocalConfig;
|
||||
|
||||
public new Bindable<WorkingBeatmap> Beatmap => base.Beatmap;
|
||||
|
||||
public new Bindable<RulesetInfo> Ruleset => base.Ruleset;
|
||||
|
||||
protected override Loader CreateLoader() => new TestLoader();
|
||||
|
||||
public new void PerformFromScreen(Action<IScreen> action, IEnumerable<Type> validScreens = null) => base.PerformFromScreen(action, validScreens);
|
||||
|
||||
public TestOsuGame(Storage storage, IAPIProvider api)
|
||||
{
|
||||
Storage = storage;
|
||||
API = api;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
API.Login("Rhythm Champion", "osu!");
|
||||
}
|
||||
}
|
||||
|
||||
public class TestLoader : Loader
|
||||
{
|
||||
protected override ShaderPrecompiler CreateShaderPrecompiler() => new TestShaderPrecompiler();
|
||||
|
||||
private class TestShaderPrecompiler : ShaderPrecompiler
|
||||
{
|
||||
protected override bool AllLoaded => true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Select;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Navigation
|
||||
{
|
||||
public class TestScenePerformFromScreen : OsuGameTestScene
|
||||
{
|
||||
[Test]
|
||||
public void TestPerformAtMenu()
|
||||
{
|
||||
AddAssert("could perform immediately", () =>
|
||||
{
|
||||
bool actionPerformed = false;
|
||||
Game.PerformFromScreen(_ => actionPerformed = true);
|
||||
return actionPerformed;
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPerformAtSongSelect()
|
||||
{
|
||||
PushAndConfirm(() => new PlaySongSelect());
|
||||
|
||||
AddAssert("could perform immediately", () =>
|
||||
{
|
||||
bool actionPerformed = false;
|
||||
Game.PerformFromScreen(_ => actionPerformed = true, new[] { typeof(PlaySongSelect) });
|
||||
return actionPerformed;
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPerformAtMenuFromSongSelect()
|
||||
{
|
||||
PushAndConfirm(() => new PlaySongSelect());
|
||||
|
||||
bool actionPerformed = false;
|
||||
AddStep("try to perform", () => Game.PerformFromScreen(_ => actionPerformed = true));
|
||||
AddUntilStep("returned to menu", () => Game.ScreenStack.CurrentScreen is MainMenu);
|
||||
AddAssert("did perform", () => actionPerformed);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPerformAtSongSelectFromPlayerLoader()
|
||||
{
|
||||
PushAndConfirm(() => new PlaySongSelect());
|
||||
PushAndConfirm(() => new PlayerLoader(() => new Player()));
|
||||
|
||||
bool actionPerformed = false;
|
||||
AddStep("try to perform", () => Game.PerformFromScreen(_ => actionPerformed = true, new[] { typeof(PlaySongSelect) }));
|
||||
AddUntilStep("returned to song select", () => Game.ScreenStack.CurrentScreen is PlaySongSelect);
|
||||
AddAssert("did perform", () => actionPerformed);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPerformAtMenuFromPlayerLoader()
|
||||
{
|
||||
PushAndConfirm(() => new PlaySongSelect());
|
||||
PushAndConfirm(() => new PlayerLoader(() => new Player()));
|
||||
|
||||
bool actionPerformed = false;
|
||||
AddStep("try to perform", () => Game.PerformFromScreen(_ => actionPerformed = true));
|
||||
AddUntilStep("returned to song select", () => Game.ScreenStack.CurrentScreen is MainMenu);
|
||||
AddAssert("did perform", () => actionPerformed);
|
||||
}
|
||||
}
|
||||
}
|
110
osu.Game.Tests/Visual/Navigation/TestScenePresentBeatmap.cs
Normal file
110
osu.Game.Tests/Visual/Navigation/TestScenePresentBeatmap.cs
Normal file
@ -0,0 +1,110 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mania;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Screens.Menu;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Navigation
|
||||
{
|
||||
public class TestScenePresentBeatmap : OsuGameTestScene
|
||||
{
|
||||
[Test]
|
||||
public void TestFromMainMenu()
|
||||
{
|
||||
var firstImport = importBeatmap(1);
|
||||
presentAndConfirm(firstImport);
|
||||
|
||||
AddStep("return to menu", () => Game.ScreenStack.CurrentScreen.Exit());
|
||||
AddUntilStep("wait for menu", () => Game.ScreenStack.CurrentScreen is MainMenu);
|
||||
|
||||
var secondimport = importBeatmap(2);
|
||||
presentAndConfirm(secondimport);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFromMainMenuDifferentRuleset()
|
||||
{
|
||||
var firstImport = importBeatmap(1);
|
||||
presentAndConfirm(firstImport);
|
||||
|
||||
AddStep("return to menu", () => Game.ScreenStack.CurrentScreen.Exit());
|
||||
AddUntilStep("wait for menu", () => Game.ScreenStack.CurrentScreen is MainMenu);
|
||||
|
||||
var secondimport = importBeatmap(2, new ManiaRuleset().RulesetInfo);
|
||||
presentAndConfirm(secondimport);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFromSongSelect()
|
||||
{
|
||||
var firstImport = importBeatmap(1);
|
||||
presentAndConfirm(firstImport);
|
||||
|
||||
var secondimport = importBeatmap(2);
|
||||
presentAndConfirm(secondimport);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFromSongSelectDifferentRuleset()
|
||||
{
|
||||
var firstImport = importBeatmap(1);
|
||||
presentAndConfirm(firstImport);
|
||||
|
||||
var secondimport = importBeatmap(2, new ManiaRuleset().RulesetInfo);
|
||||
presentAndConfirm(secondimport);
|
||||
}
|
||||
|
||||
private Func<BeatmapSetInfo> importBeatmap(int i, RulesetInfo ruleset = null)
|
||||
{
|
||||
BeatmapSetInfo imported = null;
|
||||
AddStep($"import beatmap {i}", () =>
|
||||
{
|
||||
var difficulty = new BeatmapDifficulty();
|
||||
var metadata = new BeatmapMetadata
|
||||
{
|
||||
Artist = "SomeArtist",
|
||||
AuthorString = "SomeAuthor",
|
||||
Title = $"import {i}"
|
||||
};
|
||||
|
||||
imported = Game.BeatmapManager.Import(new BeatmapSetInfo
|
||||
{
|
||||
Hash = Guid.NewGuid().ToString(),
|
||||
OnlineBeatmapSetID = i,
|
||||
Metadata = metadata,
|
||||
Beatmaps = new List<BeatmapInfo>
|
||||
{
|
||||
new BeatmapInfo
|
||||
{
|
||||
OnlineBeatmapID = i * 1024,
|
||||
Metadata = metadata,
|
||||
BaseDifficulty = difficulty,
|
||||
Ruleset = ruleset ?? new OsuRuleset().RulesetInfo
|
||||
},
|
||||
}
|
||||
}).Result;
|
||||
});
|
||||
|
||||
AddAssert($"import {i} succeeded", () => imported != null);
|
||||
|
||||
return () => imported;
|
||||
}
|
||||
|
||||
private void presentAndConfirm(Func<BeatmapSetInfo> getImport)
|
||||
{
|
||||
AddStep("present beatmap", () => Game.PresentBeatmap(getImport()));
|
||||
|
||||
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is Screens.Select.SongSelect);
|
||||
AddUntilStep("correct beatmap displayed", () => Game.Beatmap.Value.BeatmapSetInfo.ID == getImport().ID);
|
||||
AddAssert("correct ruleset selected", () => Game.Ruleset.Value.ID == getImport().Beatmaps.First().Ruleset.ID);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,90 +1,36 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Mods;
|
||||
using osu.Game.Screens;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Select;
|
||||
using osu.Game.Tests.Beatmaps.IO;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osuTK.Input;
|
||||
using IntroSequence = osu.Game.Configuration.IntroSequence;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Menus
|
||||
namespace osu.Game.Tests.Visual.Navigation
|
||||
{
|
||||
public class TestSceneScreenNavigation : ManualInputManagerTestScene
|
||||
public class TestSceneScreenNavigation : OsuGameTestScene
|
||||
{
|
||||
private const float click_padding = 25;
|
||||
|
||||
private GameHost host;
|
||||
private TestOsuGame game;
|
||||
private Vector2 backButtonPosition => Game.ToScreenSpace(new Vector2(click_padding, Game.LayoutRectangle.Bottom - click_padding));
|
||||
|
||||
private Vector2 backButtonPosition => game.ToScreenSpace(new Vector2(click_padding, game.LayoutRectangle.Bottom - click_padding));
|
||||
|
||||
private Vector2 optionsButtonPosition => game.ToScreenSpace(new Vector2(click_padding, click_padding));
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host)
|
||||
{
|
||||
this.host = host;
|
||||
|
||||
Child = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
};
|
||||
}
|
||||
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
{
|
||||
AddStep("Create new game instance", () =>
|
||||
{
|
||||
if (game != null)
|
||||
{
|
||||
Remove(game);
|
||||
game.Dispose();
|
||||
}
|
||||
|
||||
game = new TestOsuGame(LocalStorage, API);
|
||||
game.SetHost(host);
|
||||
|
||||
// todo: this can be removed once we can run audio trakcs without a device present
|
||||
// see https://github.com/ppy/osu/issues/1302
|
||||
game.LocalConfig.Set(OsuSetting.IntroSequence, IntroSequence.Circles);
|
||||
|
||||
Add(game);
|
||||
});
|
||||
AddUntilStep("Wait for load", () => game.IsLoaded);
|
||||
AddUntilStep("Wait for intro", () => game.ScreenStack.CurrentScreen is IntroScreen);
|
||||
confirmAtMainMenu();
|
||||
}
|
||||
private Vector2 optionsButtonPosition => Game.ToScreenSpace(new Vector2(click_padding, click_padding));
|
||||
|
||||
[Test]
|
||||
public void TestExitSongSelectWithEscape()
|
||||
{
|
||||
TestSongSelect songSelect = null;
|
||||
|
||||
pushAndConfirm(() => songSelect = new TestSongSelect());
|
||||
PushAndConfirm(() => songSelect = new TestSongSelect());
|
||||
AddStep("Show mods overlay", () => songSelect.ModSelectOverlay.Show());
|
||||
AddAssert("Overlay was shown", () => songSelect.ModSelectOverlay.State.Value == Visibility.Visible);
|
||||
pushEscape();
|
||||
@ -98,21 +44,21 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
{
|
||||
Player player = null;
|
||||
|
||||
WorkingBeatmap beatmap() => game.Beatmap.Value;
|
||||
WorkingBeatmap beatmap() => Game.Beatmap.Value;
|
||||
Track track() => beatmap().Track;
|
||||
|
||||
pushAndConfirm(() => new TestSongSelect());
|
||||
PushAndConfirm(() => new TestSongSelect());
|
||||
|
||||
AddStep("import beatmap", () => ImportBeatmapTest.LoadOszIntoOsu(game, virtualTrack: true).Wait());
|
||||
AddStep("import beatmap", () => ImportBeatmapTest.LoadOszIntoOsu(Game, virtualTrack: true).Wait());
|
||||
|
||||
AddUntilStep("wait for selected", () => !game.Beatmap.IsDefault);
|
||||
AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
|
||||
|
||||
if (withUserPause)
|
||||
AddStep("pause", () => game.Dependencies.Get<MusicController>().Stop());
|
||||
AddStep("pause", () => Game.Dependencies.Get<MusicController>().Stop());
|
||||
|
||||
AddStep("press enter", () => pressAndRelease(Key.Enter));
|
||||
|
||||
AddUntilStep("wait for player", () => (player = game.ScreenStack.CurrentScreen as Player) != null);
|
||||
AddUntilStep("wait for player", () => (player = Game.ScreenStack.CurrentScreen as Player) != null);
|
||||
AddUntilStep("wait for fail", () => player.HasFailed);
|
||||
|
||||
AddUntilStep("wait for track stop", () => !track().IsRunning);
|
||||
@ -129,13 +75,13 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
{
|
||||
TestSongSelect songSelect = null;
|
||||
|
||||
pushAndConfirm(() => songSelect = new TestSongSelect());
|
||||
PushAndConfirm(() => songSelect = new TestSongSelect());
|
||||
AddStep("Show mods overlay", () => songSelect.ModSelectOverlay.Show());
|
||||
AddAssert("Overlay was shown", () => songSelect.ModSelectOverlay.State.Value == Visibility.Visible);
|
||||
AddStep("Move mouse to backButton", () => InputManager.MoveMouseTo(backButtonPosition));
|
||||
|
||||
// BackButton handles hover using its child button, so this checks whether or not any of BackButton's children are hovered.
|
||||
AddUntilStep("Back button is hovered", () => InputManager.HoveredDrawables.Any(d => d.Parent == game.BackButton));
|
||||
AddUntilStep("Back button is hovered", () => InputManager.HoveredDrawables.Any(d => d.Parent == Game.BackButton));
|
||||
|
||||
AddStep("Click back button", () => InputManager.Click(MouseButton.Left));
|
||||
AddUntilStep("Overlay was hidden", () => songSelect.ModSelectOverlay.State.Value == Visibility.Hidden);
|
||||
@ -145,34 +91,27 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
[Test]
|
||||
public void TestExitMultiWithEscape()
|
||||
{
|
||||
pushAndConfirm(() => new Screens.Multi.Multiplayer());
|
||||
PushAndConfirm(() => new Screens.Multi.Multiplayer());
|
||||
exitViaEscapeAndConfirm();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestExitMultiWithBackButton()
|
||||
{
|
||||
pushAndConfirm(() => new Screens.Multi.Multiplayer());
|
||||
PushAndConfirm(() => new Screens.Multi.Multiplayer());
|
||||
exitViaBackButtonAndConfirm();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOpenOptionsAndExitWithEscape()
|
||||
{
|
||||
AddUntilStep("Wait for options to load", () => game.Settings.IsLoaded);
|
||||
AddUntilStep("Wait for options to load", () => Game.Settings.IsLoaded);
|
||||
AddStep("Enter menu", () => pressAndRelease(Key.Enter));
|
||||
AddStep("Move mouse to options overlay", () => InputManager.MoveMouseTo(optionsButtonPosition));
|
||||
AddStep("Click options overlay", () => InputManager.Click(MouseButton.Left));
|
||||
AddAssert("Options overlay was opened", () => game.Settings.State.Value == Visibility.Visible);
|
||||
AddAssert("Options overlay was opened", () => Game.Settings.State.Value == Visibility.Visible);
|
||||
AddStep("Hide options overlay using escape", () => pressAndRelease(Key.Escape));
|
||||
AddAssert("Options overlay was closed", () => game.Settings.State.Value == Visibility.Hidden);
|
||||
}
|
||||
|
||||
private void pushAndConfirm(Func<Screen> newScreen)
|
||||
{
|
||||
Screen screen = null;
|
||||
AddStep("Push new screen", () => game.ScreenStack.Push(screen = newScreen()));
|
||||
AddUntilStep("Wait for new screen", () => game.ScreenStack.CurrentScreen == screen && screen.IsLoaded);
|
||||
AddAssert("Options overlay was closed", () => Game.Settings.State.Value == Visibility.Hidden);
|
||||
}
|
||||
|
||||
private void pushEscape() =>
|
||||
@ -181,64 +120,25 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
private void exitViaEscapeAndConfirm()
|
||||
{
|
||||
pushEscape();
|
||||
confirmAtMainMenu();
|
||||
ConfirmAtMainMenu();
|
||||
}
|
||||
|
||||
private void exitViaBackButtonAndConfirm()
|
||||
{
|
||||
AddStep("Move mouse to backButton", () => InputManager.MoveMouseTo(backButtonPosition));
|
||||
AddStep("Click back button", () => InputManager.Click(MouseButton.Left));
|
||||
confirmAtMainMenu();
|
||||
ConfirmAtMainMenu();
|
||||
}
|
||||
|
||||
private void confirmAtMainMenu() => AddUntilStep("Wait for main menu", () => game.ScreenStack.CurrentScreen is MainMenu menu && menu.IsLoaded);
|
||||
|
||||
private void pressAndRelease(Key key)
|
||||
{
|
||||
InputManager.PressKey(key);
|
||||
InputManager.ReleaseKey(key);
|
||||
}
|
||||
|
||||
private class TestOsuGame : OsuGame
|
||||
{
|
||||
public new ScreenStack ScreenStack => base.ScreenStack;
|
||||
|
||||
public new BackButton BackButton => base.BackButton;
|
||||
|
||||
public new SettingsPanel Settings => base.Settings;
|
||||
|
||||
public new OsuConfigManager LocalConfig => base.LocalConfig;
|
||||
|
||||
public new Bindable<WorkingBeatmap> Beatmap => base.Beatmap;
|
||||
|
||||
protected override Loader CreateLoader() => new TestLoader();
|
||||
|
||||
public TestOsuGame(Storage storage, IAPIProvider api)
|
||||
{
|
||||
Storage = storage;
|
||||
API = api;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
API.Login("Rhythm Champion", "osu!");
|
||||
}
|
||||
}
|
||||
|
||||
private class TestSongSelect : PlaySongSelect
|
||||
{
|
||||
public ModSelectOverlay ModSelectOverlay => ModSelect;
|
||||
}
|
||||
|
||||
private class TestLoader : Loader
|
||||
{
|
||||
protected override ShaderPrecompiler CreateShaderPrecompiler() => new TestShaderPrecompiler();
|
||||
|
||||
private class TestShaderPrecompiler : ShaderPrecompiler
|
||||
{
|
||||
protected override bool AllLoaded => true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
[TestFixture]
|
||||
public class TestSceneChangelogOverlay : OsuTestScene
|
||||
{
|
||||
private ChangelogOverlay changelog;
|
||||
private TestChangelogOverlay changelog;
|
||||
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
@ -29,23 +29,40 @@ namespace osu.Game.Tests.Visual.Online
|
||||
|
||||
protected override bool UseOnlineAPI => true;
|
||||
|
||||
protected override void LoadComplete()
|
||||
[SetUp]
|
||||
public void SetUp() => Schedule(() =>
|
||||
{
|
||||
base.LoadComplete();
|
||||
Child = changelog = new TestChangelogOverlay();
|
||||
});
|
||||
|
||||
Add(changelog = new ChangelogOverlay());
|
||||
AddStep(@"Show", changelog.Show);
|
||||
AddStep(@"Hide", changelog.Hide);
|
||||
[Test]
|
||||
public void ShowWithNoFetch()
|
||||
{
|
||||
AddStep(@"Show", () => changelog.Show());
|
||||
AddUntilStep(@"wait for streams", () => changelog.Streams?.Count > 0);
|
||||
AddAssert(@"listing displayed", () => changelog.Current.Value == null);
|
||||
AddAssert(@"no stream selected", () => changelog.Header.Streams.Current.Value == null);
|
||||
}
|
||||
|
||||
AddWaitStep("wait for hide", 3);
|
||||
[Test]
|
||||
public void ShowWithListing()
|
||||
{
|
||||
AddStep(@"Show with listing", () => changelog.ShowListing());
|
||||
AddUntilStep(@"wait for streams", () => changelog.Streams?.Count > 0);
|
||||
AddAssert(@"listing displayed", () => changelog.Current.Value == null);
|
||||
AddAssert(@"no stream selected", () => changelog.Header.Streams.Current.Value == null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ShowWithBuild()
|
||||
{
|
||||
AddStep(@"Show with Lazer 2018.712.0", () =>
|
||||
{
|
||||
changelog.ShowBuild(new APIChangelogBuild
|
||||
{
|
||||
Version = "2018.712.0",
|
||||
DisplayVersion = "2018.712.0",
|
||||
UpdateStream = new APIUpdateStream { Name = OsuGameBase.CLIENT_STREAM_NAME },
|
||||
UpdateStream = new APIUpdateStream { Id = 7, Name = OsuGameBase.CLIENT_STREAM_NAME },
|
||||
ChangelogEntries = new List<APIChangelogEntry>
|
||||
{
|
||||
new APIChangelogEntry
|
||||
@ -56,19 +73,16 @@ namespace osu.Game.Tests.Visual.Online
|
||||
}
|
||||
}
|
||||
});
|
||||
changelog.Show();
|
||||
});
|
||||
|
||||
AddWaitStep("wait for show", 3);
|
||||
AddStep(@"Hide", changelog.Hide);
|
||||
AddWaitStep("wait for hide", 3);
|
||||
|
||||
AddStep(@"Show with listing", () =>
|
||||
{
|
||||
changelog.ShowListing();
|
||||
changelog.Show();
|
||||
});
|
||||
AddUntilStep(@"wait for streams", () => changelog.Streams?.Count > 0);
|
||||
AddAssert(@"correct build displayed", () => changelog.Current.Value.Version == "2018.712.0");
|
||||
AddAssert(@"correct stream selected", () => changelog.Header.Streams.Current.Value.Id == 7);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHTMLUnescaping()
|
||||
{
|
||||
AddStep(@"Ensure HTML string unescaping", () =>
|
||||
{
|
||||
changelog.ShowBuild(new APIChangelogBuild
|
||||
@ -97,5 +111,12 @@ namespace osu.Game.Tests.Visual.Online
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private class TestChangelogOverlay : ChangelogOverlay
|
||||
{
|
||||
public new List<APIUpdateStream> Streams => base.Streams;
|
||||
|
||||
public new ChangelogHeader Header => base.Header;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@ -25,7 +26,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
typeof(ChannelTabControl),
|
||||
};
|
||||
|
||||
private readonly ChannelTabControl channelTabControl;
|
||||
private readonly TestTabControl channelTabControl;
|
||||
|
||||
public TestSceneChannelTabControl()
|
||||
{
|
||||
@ -37,7 +38,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
Anchor = Anchor.Centre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
channelTabControl = new ChannelTabControl
|
||||
channelTabControl = new TestTabControl
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.Centre,
|
||||
@ -73,32 +74,40 @@ namespace osu.Game.Tests.Visual.Online
|
||||
channelTabControl.Current.ValueChanged += channel => currentText.Text = "Currently selected channel: " + channel.NewValue;
|
||||
|
||||
AddStep("Add random private channel", addRandomPrivateChannel);
|
||||
AddAssert("There is only one channels", () => channelTabControl.Items.Count() == 2);
|
||||
AddAssert("There is only one channels", () => channelTabControl.Items.Count == 2);
|
||||
AddRepeatStep("Add 3 random private channels", addRandomPrivateChannel, 3);
|
||||
AddAssert("There are four channels", () => channelTabControl.Items.Count() == 5);
|
||||
AddAssert("There are four channels", () => channelTabControl.Items.Count == 5);
|
||||
AddStep("Add random public channel", () => addChannel(RNG.Next().ToString()));
|
||||
|
||||
AddRepeatStep("Select a random channel", () => channelTabControl.Current.Value = channelTabControl.Items.ElementAt(RNG.Next(channelTabControl.Items.Count() - 1)), 20);
|
||||
AddRepeatStep("Select a random channel", () =>
|
||||
{
|
||||
List<Channel> validChannels = channelTabControl.Items.Where(c => !(c is ChannelSelectorTabItem.ChannelSelectorTabChannel)).ToList();
|
||||
channelTabControl.SelectChannel(validChannels[RNG.Next(0, validChannels.Count)]);
|
||||
}, 20);
|
||||
|
||||
Channel channelBefore = channelTabControl.Items.First();
|
||||
AddStep("set first channel", () => channelTabControl.Current.Value = channelBefore);
|
||||
Channel channelBefore = null;
|
||||
AddStep("set first channel", () => channelTabControl.SelectChannel(channelBefore = channelTabControl.Items.First(c => !(c is ChannelSelectorTabItem.ChannelSelectorTabChannel))));
|
||||
|
||||
AddStep("select selector tab", () => channelTabControl.Current.Value = channelTabControl.Items.Last());
|
||||
AddStep("select selector tab", () => channelTabControl.SelectChannel(channelTabControl.Items.Single(c => c is ChannelSelectorTabItem.ChannelSelectorTabChannel)));
|
||||
AddAssert("selector tab is active", () => channelTabControl.ChannelSelectorActive.Value);
|
||||
|
||||
AddAssert("check channel unchanged", () => channelBefore == channelTabControl.Current.Value);
|
||||
|
||||
AddStep("set second channel", () => channelTabControl.Current.Value = channelTabControl.Items.Skip(1).First());
|
||||
AddStep("set second channel", () => channelTabControl.SelectChannel(channelTabControl.Items.GetNext(channelBefore)));
|
||||
AddAssert("selector tab is inactive", () => !channelTabControl.ChannelSelectorActive.Value);
|
||||
|
||||
AddUntilStep("remove all channels", () =>
|
||||
{
|
||||
var first = channelTabControl.Items.First();
|
||||
if (first is ChannelSelectorTabItem.ChannelSelectorTabChannel)
|
||||
return true;
|
||||
foreach (var item in channelTabControl.Items.ToList())
|
||||
{
|
||||
if (item is ChannelSelectorTabItem.ChannelSelectorTabChannel)
|
||||
continue;
|
||||
|
||||
channelTabControl.RemoveChannel(first);
|
||||
return false;
|
||||
channelTabControl.RemoveChannel(item);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
AddAssert("selector tab is active", () => channelTabControl.ChannelSelectorActive.Value);
|
||||
@ -117,5 +126,10 @@ namespace osu.Game.Tests.Visual.Online
|
||||
Type = ChannelType.Public,
|
||||
Name = name
|
||||
});
|
||||
|
||||
private class TestTabControl : ChannelTabControl
|
||||
{
|
||||
public void SelectChannel(Channel channel) => base.SelectTab(TabMap[channel]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,12 +3,15 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Chat;
|
||||
@ -35,8 +38,21 @@ namespace osu.Game.Tests.Visual.Online
|
||||
private TestChatOverlay chatOverlay;
|
||||
private ChannelManager channelManager;
|
||||
|
||||
private readonly Channel channel1 = new Channel(new User()) { Name = "test really long username" };
|
||||
private readonly Channel channel2 = new Channel(new User()) { Name = "test2" };
|
||||
private readonly List<Channel> channels;
|
||||
|
||||
private Channel channel1 => channels[0];
|
||||
private Channel channel2 => channels[1];
|
||||
|
||||
public TestSceneChatOverlay()
|
||||
{
|
||||
channels = Enumerable.Range(1, 10)
|
||||
.Select(index => new Channel(new User())
|
||||
{
|
||||
Name = $"Channel no. {index}",
|
||||
Topic = index == 3 ? null : $"We talk about the number {index} here"
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
@ -45,7 +61,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
ChannelManagerContainer container;
|
||||
|
||||
Child = container = new ChannelManagerContainer(new List<Channel> { channel1, channel2 })
|
||||
Child = container = new ChannelManagerContainer(channels)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
};
|
||||
@ -96,6 +112,47 @@ namespace osu.Game.Tests.Visual.Online
|
||||
AddAssert("Selector is visible", () => chatOverlay.SelectionOverlayState == Visibility.Visible);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSearchInSelector()
|
||||
{
|
||||
AddStep("search for 'no. 2'", () => chatOverlay.ChildrenOfType<SearchTextBox>().First().Text = "no. 2");
|
||||
AddUntilStep("only channel 2 visible", () =>
|
||||
{
|
||||
var listItems = chatOverlay.ChildrenOfType<ChannelListItem>().Where(c => c.IsPresent);
|
||||
return listItems.Count() == 1 && listItems.Single().Channel == channel2;
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestChannelShortcutKeys()
|
||||
{
|
||||
AddStep("join 10 channels", () => channels.ForEach(channel => channelManager.JoinChannel(channel)));
|
||||
AddStep("close channel selector", () =>
|
||||
{
|
||||
InputManager.PressKey(Key.Escape);
|
||||
InputManager.ReleaseKey(Key.Escape);
|
||||
});
|
||||
AddUntilStep("wait for close", () => chatOverlay.SelectionOverlayState == Visibility.Hidden);
|
||||
|
||||
for (int zeroBasedIndex = 0; zeroBasedIndex < 10; ++zeroBasedIndex)
|
||||
{
|
||||
var oneBasedIndex = zeroBasedIndex + 1;
|
||||
var targetNumberKey = oneBasedIndex % 10;
|
||||
var targetChannel = channels[zeroBasedIndex];
|
||||
AddStep($"press Alt+{targetNumberKey}", () => pressChannelHotkey(targetNumberKey));
|
||||
AddAssert($"channel #{oneBasedIndex} is selected", () => channelManager.CurrentChannel.Value == targetChannel);
|
||||
}
|
||||
}
|
||||
|
||||
private void pressChannelHotkey(int number)
|
||||
{
|
||||
var channelKey = Key.Number0 + number;
|
||||
InputManager.PressKey(Key.AltLeft);
|
||||
InputManager.PressKey(channelKey);
|
||||
InputManager.ReleaseKey(Key.AltLeft);
|
||||
InputManager.ReleaseKey(channelKey);
|
||||
}
|
||||
|
||||
private void clickDrawable(Drawable d)
|
||||
{
|
||||
InputManager.MoveMouseTo(d);
|
||||
|
@ -8,6 +8,8 @@ using osu.Game.Online.API.Requests;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Overlays.Comments;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Framework.Allocation;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
@ -22,37 +24,35 @@ namespace osu.Game.Tests.Visual.Online
|
||||
typeof(HeaderButton),
|
||||
typeof(SortTabControl),
|
||||
typeof(ShowChildrenButton),
|
||||
typeof(DeletedChildrenPlaceholder),
|
||||
typeof(VotePill)
|
||||
typeof(DeletedCommentsCounter),
|
||||
typeof(VotePill),
|
||||
typeof(CommentsPage),
|
||||
};
|
||||
|
||||
protected override bool UseOnlineAPI => true;
|
||||
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
|
||||
|
||||
public TestSceneCommentsContainer()
|
||||
{
|
||||
BasicScrollContainer scrollFlow;
|
||||
BasicScrollContainer scroll;
|
||||
CommentsContainer comments;
|
||||
|
||||
Add(scrollFlow = new BasicScrollContainer
|
||||
Add(scroll = new BasicScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = comments = new CommentsContainer()
|
||||
});
|
||||
|
||||
AddStep("Big Black comments", () =>
|
||||
AddStep("Big Black comments", () => comments.ShowComments(CommentableType.Beatmapset, 41823));
|
||||
AddStep("Airman comments", () => comments.ShowComments(CommentableType.Beatmapset, 24313));
|
||||
AddStep("Lazer build comments", () => comments.ShowComments(CommentableType.Build, 4772));
|
||||
AddStep("News comments", () => comments.ShowComments(CommentableType.NewsPost, 715));
|
||||
AddStep("Idle state", () =>
|
||||
{
|
||||
scrollFlow.Clear();
|
||||
scrollFlow.Add(new CommentsContainer(CommentableType.Beatmapset, 41823));
|
||||
});
|
||||
|
||||
AddStep("Airman comments", () =>
|
||||
{
|
||||
scrollFlow.Clear();
|
||||
scrollFlow.Add(new CommentsContainer(CommentableType.Beatmapset, 24313));
|
||||
});
|
||||
|
||||
AddStep("lazer build comments", () =>
|
||||
{
|
||||
scrollFlow.Clear();
|
||||
scrollFlow.Add(new CommentsContainer(CommentableType.Build, 4772));
|
||||
scroll.Clear();
|
||||
scroll.Add(comments = new CommentsContainer());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Comments;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
@ -19,6 +21,9 @@ namespace osu.Game.Tests.Visual.Online
|
||||
typeof(SortTabControl),
|
||||
};
|
||||
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
||||
|
||||
private readonly Bindable<CommentsSortCriteria> sort = new Bindable<CommentsSortCriteria>();
|
||||
private readonly BindableBool showDeleted = new BindableBool();
|
||||
|
||||
|
162
osu.Game.Tests/Visual/Online/TestSceneCommentsPage.cs
Normal file
162
osu.Game.Tests/Visual/Online/TestSceneCommentsPage.cs
Normal file
@ -0,0 +1,162 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Overlays.Comments;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Users;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
public class TestSceneCommentsPage : OsuTestScene
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(DrawableComment),
|
||||
typeof(CommentsPage),
|
||||
};
|
||||
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
|
||||
|
||||
private readonly BindableBool showDeleted = new BindableBool();
|
||||
private readonly Container content;
|
||||
|
||||
public TestSceneCommentsPage()
|
||||
{
|
||||
Add(new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0, 10),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Width = 200,
|
||||
Child = new OsuCheckbox
|
||||
{
|
||||
Current = showDeleted,
|
||||
LabelText = @"Show Deleted"
|
||||
}
|
||||
},
|
||||
content = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
AddStep("load comments", () => createPage(comment_bundle));
|
||||
AddStep("load empty comments", () => createPage(empty_comment_bundle));
|
||||
}
|
||||
|
||||
private void createPage(CommentBundle commentBundle)
|
||||
{
|
||||
content.Clear();
|
||||
content.Add(new CommentsPage(commentBundle)
|
||||
{
|
||||
ShowDeleted = { BindTarget = showDeleted }
|
||||
});
|
||||
}
|
||||
|
||||
private static readonly CommentBundle empty_comment_bundle = new CommentBundle
|
||||
{
|
||||
Comments = new List<Comment>(),
|
||||
Total = 0,
|
||||
};
|
||||
|
||||
private static readonly CommentBundle comment_bundle = new CommentBundle
|
||||
{
|
||||
Comments = new List<Comment>
|
||||
{
|
||||
new Comment
|
||||
{
|
||||
Id = 1,
|
||||
Message = "Simple test comment",
|
||||
LegacyName = "TestUser1",
|
||||
CreatedAt = DateTimeOffset.Now,
|
||||
VotesCount = 5
|
||||
},
|
||||
new Comment
|
||||
{
|
||||
Id = 2,
|
||||
Message = "This comment has been deleted :( but visible for admins",
|
||||
LegacyName = "TestUser2",
|
||||
CreatedAt = DateTimeOffset.Now,
|
||||
DeletedAt = DateTimeOffset.Now,
|
||||
VotesCount = 5
|
||||
},
|
||||
new Comment
|
||||
{
|
||||
Id = 3,
|
||||
Message = "This comment is a top level",
|
||||
LegacyName = "TestUser3",
|
||||
CreatedAt = DateTimeOffset.Now,
|
||||
RepliesCount = 2,
|
||||
},
|
||||
new Comment
|
||||
{
|
||||
Id = 4,
|
||||
ParentId = 3,
|
||||
Message = "And this is a reply",
|
||||
RepliesCount = 1,
|
||||
LegacyName = "TestUser1",
|
||||
CreatedAt = DateTimeOffset.Now,
|
||||
},
|
||||
new Comment
|
||||
{
|
||||
Id = 15,
|
||||
ParentId = 4,
|
||||
Message = "Reply to reply",
|
||||
LegacyName = "TestUser1",
|
||||
CreatedAt = DateTimeOffset.Now,
|
||||
},
|
||||
new Comment
|
||||
{
|
||||
Id = 6,
|
||||
ParentId = 3,
|
||||
LegacyName = "TestUser11515",
|
||||
CreatedAt = DateTimeOffset.Now,
|
||||
DeletedAt = DateTimeOffset.Now,
|
||||
},
|
||||
new Comment
|
||||
{
|
||||
Id = 5,
|
||||
Message = "This comment is voted and edited",
|
||||
LegacyName = "BigBrainUser",
|
||||
CreatedAt = DateTimeOffset.Now,
|
||||
EditedAt = DateTimeOffset.Now,
|
||||
VotesCount = 1000,
|
||||
EditedById = 1,
|
||||
}
|
||||
},
|
||||
IncludedComments = new List<Comment>(),
|
||||
UserVotes = new List<long>
|
||||
{
|
||||
5
|
||||
},
|
||||
Users = new List<User>
|
||||
{
|
||||
new User
|
||||
{
|
||||
Id = 1,
|
||||
Username = "Good_Admin"
|
||||
}
|
||||
},
|
||||
TopLevelCount = 4,
|
||||
Total = 7
|
||||
};
|
||||
}
|
||||
}
|
@ -41,6 +41,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
private class TestFullscreenOverlay : FullscreenOverlay
|
||||
{
|
||||
public TestFullscreenOverlay()
|
||||
: base(OverlayColourScheme.Pink)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -4,10 +4,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Profile.Sections;
|
||||
using osu.Game.Overlays.Profile.Sections.Historical;
|
||||
using osu.Game.Users;
|
||||
@ -24,9 +26,11 @@ namespace osu.Game.Tests.Visual.Online
|
||||
typeof(HistoricalSection),
|
||||
typeof(PaginatedMostPlayedBeatmapContainer),
|
||||
typeof(DrawableMostPlayedBeatmap),
|
||||
typeof(DrawableProfileRow)
|
||||
};
|
||||
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Pink);
|
||||
|
||||
public TestSceneHistoricalSection()
|
||||
{
|
||||
HistoricalSection section;
|
||||
|
@ -11,6 +11,8 @@ using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Taiko;
|
||||
using osu.Game.Users;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Framework.Allocation;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
@ -22,10 +24,13 @@ namespace osu.Game.Tests.Visual.Online
|
||||
typeof(ProfileRulesetTabItem),
|
||||
};
|
||||
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
|
||||
|
||||
public TestSceneProfileRulesetSelector()
|
||||
{
|
||||
ProfileRulesetSelector selector;
|
||||
Bindable<User> user = new Bindable<User>();
|
||||
var user = new Bindable<User>();
|
||||
|
||||
Child = selector = new ProfileRulesetSelector
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user