1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 21:47:25 +08:00

Merge branch 'master' into vote-pill-fix

This commit is contained in:
Dean Herbert 2019-11-09 12:15:48 +09:00 committed by GitHub
commit 683916967c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 224 additions and 85 deletions

View File

@ -62,6 +62,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1010.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2019.1010.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.1106.0" /> <PackageReference Include="ppy.osu.Framework.Android" Version="2019.1108.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -2,7 +2,7 @@
<Import Project="..\osu.TestProject.props" /> <Import Project="..\osu.TestProject.props" />
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" /> <PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="NUnit" Version="3.12.0" /> <PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" /> <PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" /> <PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />

View File

@ -2,7 +2,7 @@
<Import Project="..\osu.TestProject.props" /> <Import Project="..\osu.TestProject.props" />
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" /> <PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="NUnit" Version="3.12.0" /> <PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" /> <PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" /> <PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />

View File

@ -2,7 +2,7 @@
<Import Project="..\osu.TestProject.props" /> <Import Project="..\osu.TestProject.props" />
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" /> <PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="NUnit" Version="3.12.0" /> <PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" /> <PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" /> <PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Lines;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -29,6 +30,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
private readonly Container marker; private readonly Container marker;
private readonly Drawable markerRing; private readonly Drawable markerRing;
[Resolved(CanBeNull = true)]
private IDistanceSnapProvider snapProvider { get; set; }
[Resolved] [Resolved]
private OsuColour colours { get; set; } private OsuColour colours { get; set; }
@ -146,12 +150,16 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
if (Index == 0) if (Index == 0)
{ {
// Special handling for the head - only the position of the slider changes // Special handling for the head control point - the position of the slider changes which means the snapped position and time have to be taken into account
slider.Position += e.Delta; (Vector2 snappedPosition, double snappedTime) = snapProvider?.GetSnappedPosition(e.MousePosition, slider.StartTime) ?? (e.MousePosition, slider.StartTime);
Vector2 movementDelta = snappedPosition - slider.Position;
slider.Position += movementDelta;
slider.StartTime = snappedTime;
// Since control points are relative to the position of the slider, they all need to be offset backwards by the delta // Since control points are relative to the position of the slider, they all need to be offset backwards by the delta
for (int i = 1; i < newControlPoints.Length; i++) for (int i = 1; i < newControlPoints.Length; i++)
newControlPoints[i] -= e.Delta; newControlPoints[i] -= movementDelta;
} }
else else
newControlPoints[Index] += e.Delta; newControlPoints[Index] += e.Delta;

View File

@ -2,7 +2,7 @@
<Import Project="..\osu.TestProject.props" /> <Import Project="..\osu.TestProject.props" />
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" /> <PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="NUnit" Version="3.12.0" /> <PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" /> <PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" /> <PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />

View File

@ -3,7 +3,7 @@
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" /> <PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="DeepEqual" Version="2.0.0" /> <PackageReference Include="DeepEqual" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="NUnit" Version="3.12.0" /> <PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" /> <PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" /> <PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />

View File

@ -5,7 +5,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" /> <PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="NUnit" Version="3.12.0" /> <PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" /> <PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
</ItemGroup> </ItemGroup>

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Video; using osu.Framework.Graphics.Video;
using osu.Framework.Timing;
using osu.Game.Graphics; using osu.Game.Graphics;
namespace osu.Game.Tournament.Components namespace osu.Game.Tournament.Components
@ -15,6 +16,8 @@ namespace osu.Game.Tournament.Components
{ {
private readonly VideoSprite video; private readonly VideoSprite video;
private readonly ManualClock manualClock;
public TourneyVideo(Stream stream) public TourneyVideo(Stream stream)
{ {
if (stream == null) if (stream == null)
@ -30,6 +33,7 @@ namespace osu.Game.Tournament.Components
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit, FillMode = FillMode.Fit,
Clock = new FramedClock(manualClock = new ManualClock())
}; };
} }
@ -41,5 +45,17 @@ namespace osu.Game.Tournament.Components
video.Loop = value; video.Loop = value;
} }
} }
protected override void Update()
{
base.Update();
if (manualClock != null && Clock.ElapsedFrameTime < 100)
{
// we want to avoid seeking as much as possible, because we care about performance, not sync.
// to avoid seeking completely, we only increment out local clock when in an updating state.
manualClock.CurrentTime += Clock.ElapsedFrameTime;
}
}
} }
} }

View File

@ -15,7 +15,6 @@ using osu.Framework.Logging;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osu.Game.Tournament.Screens.Drawings.Components; using osu.Game.Tournament.Screens.Drawings.Components;
@ -24,7 +23,7 @@ using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.Drawings namespace osu.Game.Tournament.Screens.Drawings
{ {
public class DrawingsScreen : CompositeDrawable public class DrawingsScreen : TournamentScreen
{ {
private const string results_filename = "drawings_results.txt"; private const string results_filename = "drawings_results.txt";
@ -128,21 +127,21 @@ namespace osu.Game.Tournament.Screens.Drawings
// Control panel container // Control panel container
new ControlPanel new ControlPanel
{ {
new OsuButton new TourneyButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = "Begin random", Text = "Begin random",
Action = teamsContainer.StartScrolling, Action = teamsContainer.StartScrolling,
}, },
new OsuButton new TourneyButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = "Stop random", Text = "Stop random",
Action = teamsContainer.StopScrolling, Action = teamsContainer.StopScrolling,
}, },
new OsuButton new TourneyButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
@ -150,7 +149,7 @@ namespace osu.Game.Tournament.Screens.Drawings
Action = reloadTeams Action = reloadTeams
}, },
new ControlPanel.Spacer(), new ControlPanel.Spacer(),
new OsuButton new TourneyButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,

View File

@ -11,7 +11,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests;
using osu.Game.Overlays.Settings; using osu.Game.Overlays.Settings;
@ -32,7 +31,7 @@ namespace osu.Game.Tournament.Screens.Editors
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
ControlPanel.Add(new OsuButton ControlPanel.Add(new TourneyButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = "Add all countries", Text = "Add all countries",

View File

@ -9,7 +9,6 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Settings; using osu.Game.Overlays.Settings;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
using osuTK; using osuTK;
@ -56,7 +55,7 @@ namespace osu.Game.Tournament.Screens.Editors
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuButton new TourneyButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = "Add new", Text = "Add new",

View File

@ -103,13 +103,13 @@ namespace osu.Game.Tournament.Screens.Gameplay
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
warmupButton = new OsuButton warmupButton = new TourneyButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = "Toggle warmup", Text = "Toggle warmup",
Action = () => warmup.Toggle() Action = () => warmup.Toggle()
}, },
new OsuButton new TourneyButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = "Toggle chat", Text = "Toggle chat",

View File

@ -60,32 +60,32 @@ namespace osu.Game.Tournament.Screens.MapPool
{ {
Text = "Current Mode" Text = "Current Mode"
}, },
buttonRedBan = new OsuButton buttonRedBan = new TourneyButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = "Red Ban", Text = "Red Ban",
Action = () => setMode(TeamColour.Red, ChoiceType.Ban) Action = () => setMode(TeamColour.Red, ChoiceType.Ban)
}, },
buttonBlueBan = new OsuButton buttonBlueBan = new TourneyButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = "Blue Ban", Text = "Blue Ban",
Action = () => setMode(TeamColour.Blue, ChoiceType.Ban) Action = () => setMode(TeamColour.Blue, ChoiceType.Ban)
}, },
buttonRedPick = new OsuButton buttonRedPick = new TourneyButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = "Red Pick", Text = "Red Pick",
Action = () => setMode(TeamColour.Red, ChoiceType.Pick) Action = () => setMode(TeamColour.Red, ChoiceType.Pick)
}, },
buttonBluePick = new OsuButton buttonBluePick = new TourneyButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = "Blue Pick", Text = "Blue Pick",
Action = () => setMode(TeamColour.Blue, ChoiceType.Pick) Action = () => setMode(TeamColour.Blue, ChoiceType.Pick)
}, },
new ControlPanel.Spacer(), new ControlPanel.Spacer(),
new OsuButton new TourneyButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = "Reset", Text = "Reset",

View File

@ -10,6 +10,8 @@ namespace osu.Game.Tournament.Screens
{ {
public abstract class TournamentScreen : CompositeDrawable public abstract class TournamentScreen : CompositeDrawable
{ {
public const double FADE_DELAY = 200;
[Resolved] [Resolved]
protected LadderInfo LadderInfo { get; private set; } protected LadderInfo LadderInfo { get; private set; }
@ -18,14 +20,8 @@ namespace osu.Game.Tournament.Screens
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
} }
public override void Hide() public override void Hide() => this.FadeOut(FADE_DELAY);
{
this.FadeOut(200);
}
public override void Show() public override void Show() => this.FadeIn(FADE_DELAY);
{
this.FadeIn(200);
}
} }
} }

View File

@ -18,7 +18,6 @@ using osu.Framework.IO.Stores;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests;
using osu.Game.Tournament.IPC; using osu.Game.Tournament.IPC;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
@ -76,7 +75,7 @@ namespace osu.Game.Tournament
AddRange(new[] AddRange(new[]
{ {
new OsuButton new TourneyButton
{ {
Text = "Save Changes", Text = "Save Changes",
Width = 140, Width = 140,

View File

@ -8,7 +8,8 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Graphics.UserInterface; using osu.Framework.Threading;
using osu.Game.Graphics;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osu.Game.Tournament.Screens; using osu.Game.Tournament.Screens;
@ -36,6 +37,7 @@ namespace osu.Game.Tournament
private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay(); private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay();
private Container chatContainer; private Container chatContainer;
private FillFlowContainer buttons;
public TournamentSceneManager() public TournamentSceneManager()
{ {
@ -101,68 +103,136 @@ namespace osu.Game.Tournament
Colour = Color4.Black, Colour = Color4.Black,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
new FillFlowContainer buttons = new FillFlowContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Spacing = new Vector2(2),
Padding = new MarginPadding(2),
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Setup", Action = () => SetScreen(typeof(SetupScreen)) }, new ScreenButton(typeof(SetupScreen)) { Text = "Setup", RequestSelection = SetScreen },
new Container { RelativeSizeAxes = Axes.X, Height = 50 }, new Separator(),
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Team Editor", Action = () => SetScreen(typeof(TeamEditorScreen)) }, new ScreenButton(typeof(TeamEditorScreen)) { Text = "Team Editor", RequestSelection = SetScreen },
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Rounds Editor", Action = () => SetScreen(typeof(RoundEditorScreen)) }, new ScreenButton(typeof(RoundEditorScreen)) { Text = "Rounds Editor", RequestSelection = SetScreen },
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket Editor", Action = () => SetScreen(typeof(LadderEditorScreen)) }, new ScreenButton(typeof(LadderEditorScreen)) { Text = "Bracket Editor", RequestSelection = SetScreen },
new Container { RelativeSizeAxes = Axes.X, Height = 50 }, new Separator(),
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => SetScreen(typeof(DrawingsScreen)) }, new ScreenButton(typeof(ScheduleScreen)) { Text = "Schedule", RequestSelection = SetScreen },
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => SetScreen(typeof(ShowcaseScreen)) }, new ScreenButton(typeof(LadderScreen)) { Text = "Bracket", RequestSelection = SetScreen },
new Container { RelativeSizeAxes = Axes.X, Height = 50 }, new Separator(),
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Schedule", Action = () => SetScreen(typeof(ScheduleScreen)) }, new ScreenButton(typeof(TeamIntroScreen)) { Text = "TeamIntro", RequestSelection = SetScreen },
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket", Action = () => SetScreen(typeof(LadderScreen)) }, new Separator(),
new Container { RelativeSizeAxes = Axes.X, Height = 50 }, new ScreenButton(typeof(MapPoolScreen)) { Text = "MapPool", RequestSelection = SetScreen },
new OsuButton { RelativeSizeAxes = Axes.X, Text = "TeamIntro", Action = () => SetScreen(typeof(TeamIntroScreen)) }, new ScreenButton(typeof(GameplayScreen)) { Text = "Gameplay", RequestSelection = SetScreen },
new OsuButton { RelativeSizeAxes = Axes.X, Text = "MapPool", Action = () => SetScreen(typeof(MapPoolScreen)) }, new Separator(),
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Gameplay", Action = () => SetScreen(typeof(GameplayScreen)) }, new ScreenButton(typeof(TeamWinScreen)) { Text = "Win", RequestSelection = SetScreen },
new Container { RelativeSizeAxes = Axes.X, Height = 50 }, new Separator(),
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Win", Action = () => SetScreen(typeof(TeamWinScreen)) }, new ScreenButton(typeof(DrawingsScreen)) { Text = "Drawings", RequestSelection = SetScreen },
new ScreenButton(typeof(ShowcaseScreen)) { Text = "Showcase", RequestSelection = SetScreen },
} }
}, },
}, },
}, },
}; };
foreach (var drawable in screens)
drawable.Hide();
SetScreen(typeof(SetupScreen)); SetScreen(typeof(SetupScreen));
} }
private float depth;
private Drawable currentScreen;
private ScheduledDelegate scheduledHide;
public void SetScreen(Type screenType) public void SetScreen(Type screenType)
{ {
var screen = screens.FirstOrDefault(s => s.GetType() == screenType); var target = screens.FirstOrDefault(s => s.GetType() == screenType);
if (screen == null) return;
foreach (var s in screens.Children) if (target == null || currentScreen == target) return;
if (scheduledHide?.Completed == false)
{ {
if (s == screen) scheduledHide.RunTask();
{ scheduledHide.Cancel(); // see https://github.com/ppy/osu-framework/issues/2967
s.Show(); scheduledHide = null;
if (s is IProvideVideo)
video.FadeOut(200);
else
video.Show();
}
else
s.Hide();
} }
switch (screen) var lastScreen = currentScreen;
currentScreen = target;
if (currentScreen is IProvideVideo)
{
video.FadeOut(200);
// delay the hide to avoid a double-fade transition.
scheduledHide = Scheduler.AddDelayed(() => lastScreen?.Hide(), TournamentScreen.FADE_DELAY);
}
else
{
lastScreen?.Hide();
video.Show();
}
screens.ChangeChildDepth(currentScreen, depth--);
currentScreen.Show();
switch (currentScreen)
{ {
case GameplayScreen _: case GameplayScreen _:
case MapPoolScreen _: case MapPoolScreen _:
chatContainer.FadeIn(100); chatContainer.FadeIn(TournamentScreen.FADE_DELAY);
break; break;
default: default:
chatContainer.FadeOut(100); chatContainer.FadeOut(TournamentScreen.FADE_DELAY);
break; break;
} }
foreach (var s in buttons.OfType<ScreenButton>())
s.IsSelected = screenType == s.Type;
}
private class Separator : CompositeDrawable
{
public Separator()
{
RelativeSizeAxes = Axes.X;
Height = 20;
}
}
private class ScreenButton : TourneyButton
{
public readonly Type Type;
public ScreenButton(Type type)
{
Type = type;
BackgroundColour = OsuColour.Gray(0.2f);
Action = () => RequestSelection(type);
RelativeSizeAxes = Axes.X;
}
private bool isSelected;
public Action<Type> RequestSelection;
public bool IsSelected
{
get => isSelected;
set
{
if (value == isSelected)
return;
isSelected = value;
BackgroundColour = isSelected ? Color4.SkyBlue : OsuColour.Gray(0.2f);
SpriteText.Colour = isSelected ? Color4.Black : Color4.White;
}
}
} }
} }
} }

View File

@ -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 osu.Game.Graphics.UserInterface;
namespace osu.Game.Tournament
{
public class TourneyButton : OsuButton
{
public TourneyButton()
: base(null)
{
}
}
}

View File

@ -69,9 +69,11 @@ namespace osu.Game.Graphics.Containers
{ {
Vector2 offset = (input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.Position) - DrawSize / 2) * ParallaxAmount; Vector2 offset = (input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.Position) - DrawSize / 2) * ParallaxAmount;
double elapsed = MathHelper.Clamp(Clock.ElapsedFrameTime, 0, 1000); const float parallax_duration = 100;
content.Position = Interpolation.ValueAt(elapsed, content.Position, offset, 0, 1000, Easing.OutQuint); double elapsed = MathHelper.Clamp(Clock.ElapsedFrameTime, 0, parallax_duration);
content.Position = Interpolation.ValueAt(elapsed, content.Position, offset, 0, parallax_duration, Easing.OutQuint);
content.Scale = Interpolation.ValueAt(elapsed, content.Scale, new Vector2(1 + System.Math.Abs(ParallaxAmount)), 0, 1000, Easing.OutQuint); content.Scale = Interpolation.ValueAt(elapsed, content.Scale, new Vector2(1 + System.Math.Abs(ParallaxAmount)), 0, 1000, Easing.OutQuint);
} }

View File

@ -48,7 +48,7 @@ namespace osu.Game.Graphics.UserInterface
protected Box Background; protected Box Background;
protected SpriteText SpriteText; protected SpriteText SpriteText;
public OsuButton() public OsuButton(HoverSampleSet? hoverSounds = HoverSampleSet.Loud)
{ {
Height = 40; Height = 40;
@ -78,10 +78,12 @@ namespace osu.Game.Graphics.UserInterface
Depth = float.MinValue Depth = float.MinValue
}, },
SpriteText = CreateText(), SpriteText = CreateText(),
new HoverClickSounds(HoverSampleSet.Loud),
} }
}); });
if (hoverSounds.HasValue)
AddInternal(new HoverClickSounds(hoverSounds.Value));
Enabled.BindValueChanged(enabledChanged, true); Enabled.BindValueChanged(enabledChanged, true);
} }

View File

@ -40,6 +40,9 @@ namespace osu.Game.Rulesets.Edit
[Resolved] [Resolved]
protected IFrameBasedClock EditorClock { get; private set; } protected IFrameBasedClock EditorClock { get; private set; }
[Resolved]
private IAdjustableClock adjustableClock { get; set; }
[Resolved] [Resolved]
private BindableBeatDivisor beatDivisor { get; set; } private BindableBeatDivisor beatDivisor { get; set; }
@ -256,6 +259,9 @@ namespace osu.Game.Rulesets.Edit
public void EndPlacement(HitObject hitObject) public void EndPlacement(HitObject hitObject)
{ {
EditorBeatmap.Add(hitObject); EditorBeatmap.Add(hitObject);
adjustableClock.Seek(hitObject.StartTime);
showGridFor(Enumerable.Empty<HitObject>()); showGridFor(Enumerable.Empty<HitObject>());
} }

View File

@ -29,7 +29,10 @@ namespace osu.Game.Screens.Edit
set set
{ {
if (!VALID_DIVISORS.Contains(value)) if (!VALID_DIVISORS.Contains(value))
throw new ArgumentOutOfRangeException($"Provided divisor is not in {nameof(VALID_DIVISORS)}"); {
// If it doesn't match, value will be 0, but will be clamped to the valid range via DefaultMinValue
value = Array.FindLast(VALID_DIVISORS, d => d < value);
}
base.Value = value; base.Value = value;
} }

View File

@ -218,12 +218,17 @@ namespace osu.Game.Screens.Edit.Compose.Components
} }
AddInternal(marker = new Marker()); AddInternal(marker = new Marker());
}
CurrentNumber.ValueChanged += div => protected override void LoadComplete()
{
base.LoadComplete();
CurrentNumber.BindValueChanged(div =>
{ {
marker.MoveToX(getMappedPosition(div.NewValue), 100, Easing.OutQuint); marker.MoveToX(getMappedPosition(div.NewValue), 100, Easing.OutQuint);
marker.Flash(); marker.Flash();
}; }, true);
} }
protected override void UpdateValue(float value) protected override void UpdateValue(float value)

View File

@ -36,6 +36,8 @@ namespace osu.Game.Screens.Edit
{ {
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4"); protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");
public override float BackgroundParallaxAmount => 0.1f;
public override bool AllowBackButton => false; public override bool AllowBackButton => false;
public override bool HideOverlaysOnEnter => true; public override bool HideOverlaysOnEnter => true;
@ -64,7 +66,10 @@ namespace osu.Game.Screens.Edit
{ {
this.host = host; this.host = host;
// TODO: should probably be done at a DrawableRuleset level to share logic with Player. beatDivisor.Value = Beatmap.Value.BeatmapInfo.BeatDivisor;
beatDivisor.BindValueChanged(divisor => Beatmap.Value.BeatmapInfo.BeatDivisor = divisor.NewValue);
// Todo: should probably be done at a DrawableRuleset level to share logic with Player.
var sourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock(); var sourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock();
clock = new EditorClock(Beatmap.Value, beatDivisor) { IsCoupled = false }; clock = new EditorClock(Beatmap.Value, beatDivisor) { IsCoupled = false };
clock.ChangeSource(sourceClock); clock.ChangeSource(sourceClock);
@ -241,7 +246,8 @@ namespace osu.Game.Screens.Edit
base.OnEntering(last); base.OnEntering(last);
Background.FadeColour(Color4.DarkGray, 500); Background.FadeColour(Color4.DarkGray, 500);
resetTrack();
resetTrack(true);
} }
public override bool OnExiting(IScreen next) public override bool OnExiting(IScreen next)
@ -252,10 +258,24 @@ namespace osu.Game.Screens.Edit
return base.OnExiting(next); return base.OnExiting(next);
} }
private void resetTrack() private void resetTrack(bool seekToStart = false)
{ {
Beatmap.Value.Track?.ResetSpeedAdjustments(); Beatmap.Value.Track?.ResetSpeedAdjustments();
Beatmap.Value.Track?.Stop(); Beatmap.Value.Track?.Stop();
if (seekToStart)
{
double targetTime = 0;
if (Beatmap.Value.Beatmap.HitObjects.Count > 0)
{
// seek to one beat length before the first hitobject
targetTime = Beatmap.Value.Beatmap.HitObjects[0].StartTime;
targetTime -= Beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(targetTime).BeatLength;
}
clock.Seek(Math.Max(0, targetTime));
}
} }
private void exportBeatmap() => host.OpenFileExternally(Beatmap.Value.Save()); private void exportBeatmap() => host.OpenFileExternally(Beatmap.Value.Save());

View File

@ -26,7 +26,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1010.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2019.1010.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.1106.0" /> <PackageReference Include="ppy.osu.Framework" Version="2019.1108.0" />
<PackageReference Include="SharpCompress" Version="0.24.0" /> <PackageReference Include="SharpCompress" Version="0.24.0" />
<PackageReference Include="NUnit" Version="3.12.0" /> <PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" /> <PackageReference Include="SharpRaven" Version="2.4.0" />

View File

@ -118,8 +118,8 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1010.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2019.1010.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.1106.0" /> <PackageReference Include="ppy.osu.Framework" Version="2019.1108.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.1106.0" /> <PackageReference Include="ppy.osu.Framework.iOS" Version="2019.1108.0" />
<PackageReference Include="SharpCompress" Version="0.24.0" /> <PackageReference Include="SharpCompress" Version="0.24.0" />
<PackageReference Include="NUnit" Version="3.11.0" /> <PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" /> <PackageReference Include="SharpRaven" Version="2.4.0" />