mirror of
https://github.com/ppy/osu
synced 2025-01-03 12:52:10 +00:00
Merge branch 'master' into vote-pill-fix
This commit is contained in:
commit
683916967c
@ -62,6 +62,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<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>
|
||||
</Project>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<Import Project="..\osu.TestProject.props" />
|
||||
<ItemGroup Label="Package References">
|
||||
<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="NUnit3TestAdapter" Version="3.15.1" />
|
||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||
|
@ -2,7 +2,7 @@
|
||||
<Import Project="..\osu.TestProject.props" />
|
||||
<ItemGroup Label="Package References">
|
||||
<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="NUnit3TestAdapter" Version="3.15.1" />
|
||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||
|
@ -2,7 +2,7 @@
|
||||
<Import Project="..\osu.TestProject.props" />
|
||||
<ItemGroup Label="Package References">
|
||||
<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="NUnit3TestAdapter" Version="3.15.1" />
|
||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||
|
@ -10,6 +10,7 @@ using osu.Framework.Graphics.Lines;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
@ -29,6 +30,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
private readonly Container marker;
|
||||
private readonly Drawable markerRing;
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private IDistanceSnapProvider snapProvider { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
@ -146,12 +150,16 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
|
||||
if (Index == 0)
|
||||
{
|
||||
// Special handling for the head - only the position of the slider changes
|
||||
slider.Position += e.Delta;
|
||||
// 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
|
||||
(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
|
||||
for (int i = 1; i < newControlPoints.Length; i++)
|
||||
newControlPoints[i] -= e.Delta;
|
||||
newControlPoints[i] -= movementDelta;
|
||||
}
|
||||
else
|
||||
newControlPoints[Index] += e.Delta;
|
||||
|
@ -2,7 +2,7 @@
|
||||
<Import Project="..\osu.TestProject.props" />
|
||||
<ItemGroup Label="Package References">
|
||||
<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="NUnit3TestAdapter" Version="3.15.1" />
|
||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||
|
@ -3,7 +3,7 @@
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="Appveyor.TestLogger" 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="NUnit3TestAdapter" Version="3.15.1" />
|
||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||
|
@ -5,7 +5,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<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="NUnit3TestAdapter" Version="3.15.1" />
|
||||
</ItemGroup>
|
||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Video;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Tournament.Components
|
||||
@ -15,6 +16,8 @@ namespace osu.Game.Tournament.Components
|
||||
{
|
||||
private readonly VideoSprite video;
|
||||
|
||||
private readonly ManualClock manualClock;
|
||||
|
||||
public TourneyVideo(Stream stream)
|
||||
{
|
||||
if (stream == null)
|
||||
@ -30,6 +33,7 @@ namespace osu.Game.Tournament.Components
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
FillMode = FillMode.Fit,
|
||||
Clock = new FramedClock(manualClock = new ManualClock())
|
||||
};
|
||||
}
|
||||
|
||||
@ -41,5 +45,17 @@ namespace osu.Game.Tournament.Components
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Tournament.Components;
|
||||
using osu.Game.Tournament.Models;
|
||||
using osu.Game.Tournament.Screens.Drawings.Components;
|
||||
@ -24,7 +23,7 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Tournament.Screens.Drawings
|
||||
{
|
||||
public class DrawingsScreen : CompositeDrawable
|
||||
public class DrawingsScreen : TournamentScreen
|
||||
{
|
||||
private const string results_filename = "drawings_results.txt";
|
||||
|
||||
@ -128,21 +127,21 @@ namespace osu.Game.Tournament.Screens.Drawings
|
||||
// Control panel container
|
||||
new ControlPanel
|
||||
{
|
||||
new OsuButton
|
||||
new TourneyButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
|
||||
Text = "Begin random",
|
||||
Action = teamsContainer.StartScrolling,
|
||||
},
|
||||
new OsuButton
|
||||
new TourneyButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
|
||||
Text = "Stop random",
|
||||
Action = teamsContainer.StopScrolling,
|
||||
},
|
||||
new OsuButton
|
||||
new TourneyButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
|
||||
@ -150,7 +149,7 @@ namespace osu.Game.Tournament.Screens.Drawings
|
||||
Action = reloadTeams
|
||||
},
|
||||
new ControlPanel.Spacer(),
|
||||
new OsuButton
|
||||
new TourneyButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
|
||||
|
@ -11,7 +11,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Overlays.Settings;
|
||||
@ -32,7 +31,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
ControlPanel.Add(new OsuButton
|
||||
ControlPanel.Add(new TourneyButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Add all countries",
|
||||
|
@ -9,7 +9,6 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osu.Game.Tournament.Components;
|
||||
using osuTK;
|
||||
@ -56,7 +55,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuButton
|
||||
new TourneyButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Add new",
|
||||
|
@ -103,13 +103,13 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
warmupButton = new OsuButton
|
||||
warmupButton = new TourneyButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Toggle warmup",
|
||||
Action = () => warmup.Toggle()
|
||||
},
|
||||
new OsuButton
|
||||
new TourneyButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Toggle chat",
|
||||
|
@ -60,32 +60,32 @@ namespace osu.Game.Tournament.Screens.MapPool
|
||||
{
|
||||
Text = "Current Mode"
|
||||
},
|
||||
buttonRedBan = new OsuButton
|
||||
buttonRedBan = new TourneyButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Red Ban",
|
||||
Action = () => setMode(TeamColour.Red, ChoiceType.Ban)
|
||||
},
|
||||
buttonBlueBan = new OsuButton
|
||||
buttonBlueBan = new TourneyButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Blue Ban",
|
||||
Action = () => setMode(TeamColour.Blue, ChoiceType.Ban)
|
||||
},
|
||||
buttonRedPick = new OsuButton
|
||||
buttonRedPick = new TourneyButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Red Pick",
|
||||
Action = () => setMode(TeamColour.Red, ChoiceType.Pick)
|
||||
},
|
||||
buttonBluePick = new OsuButton
|
||||
buttonBluePick = new TourneyButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Blue Pick",
|
||||
Action = () => setMode(TeamColour.Blue, ChoiceType.Pick)
|
||||
},
|
||||
new ControlPanel.Spacer(),
|
||||
new OsuButton
|
||||
new TourneyButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Reset",
|
||||
|
@ -10,6 +10,8 @@ namespace osu.Game.Tournament.Screens
|
||||
{
|
||||
public abstract class TournamentScreen : CompositeDrawable
|
||||
{
|
||||
public const double FADE_DELAY = 200;
|
||||
|
||||
[Resolved]
|
||||
protected LadderInfo LadderInfo { get; private set; }
|
||||
|
||||
@ -18,14 +20,8 @@ namespace osu.Game.Tournament.Screens
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
public override void Hide()
|
||||
{
|
||||
this.FadeOut(200);
|
||||
}
|
||||
public override void Hide() => this.FadeOut(FADE_DELAY);
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
this.FadeIn(200);
|
||||
}
|
||||
public override void Show() => this.FadeIn(FADE_DELAY);
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ using osu.Framework.IO.Stores;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Tournament.IPC;
|
||||
using osu.Game.Tournament.Models;
|
||||
@ -76,7 +75,7 @@ namespace osu.Game.Tournament
|
||||
|
||||
AddRange(new[]
|
||||
{
|
||||
new OsuButton
|
||||
new TourneyButton
|
||||
{
|
||||
Text = "Save Changes",
|
||||
Width = 140,
|
||||
|
@ -8,7 +8,8 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
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.Models;
|
||||
using osu.Game.Tournament.Screens;
|
||||
@ -36,6 +37,7 @@ namespace osu.Game.Tournament
|
||||
private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay();
|
||||
|
||||
private Container chatContainer;
|
||||
private FillFlowContainer buttons;
|
||||
|
||||
public TournamentSceneManager()
|
||||
{
|
||||
@ -101,68 +103,136 @@ namespace osu.Game.Tournament
|
||||
Colour = Color4.Black,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new FillFlowContainer
|
||||
buttons = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(2),
|
||||
Padding = new MarginPadding(2),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Setup", Action = () => SetScreen(typeof(SetupScreen)) },
|
||||
new Container { RelativeSizeAxes = Axes.X, Height = 50 },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Team Editor", Action = () => SetScreen(typeof(TeamEditorScreen)) },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Rounds Editor", Action = () => SetScreen(typeof(RoundEditorScreen)) },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket Editor", Action = () => SetScreen(typeof(LadderEditorScreen)) },
|
||||
new Container { RelativeSizeAxes = Axes.X, Height = 50 },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => SetScreen(typeof(DrawingsScreen)) },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => SetScreen(typeof(ShowcaseScreen)) },
|
||||
new Container { RelativeSizeAxes = Axes.X, Height = 50 },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Schedule", Action = () => SetScreen(typeof(ScheduleScreen)) },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket", Action = () => SetScreen(typeof(LadderScreen)) },
|
||||
new Container { RelativeSizeAxes = Axes.X, Height = 50 },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "TeamIntro", Action = () => SetScreen(typeof(TeamIntroScreen)) },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "MapPool", Action = () => SetScreen(typeof(MapPoolScreen)) },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Gameplay", Action = () => SetScreen(typeof(GameplayScreen)) },
|
||||
new Container { RelativeSizeAxes = Axes.X, Height = 50 },
|
||||
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Win", Action = () => SetScreen(typeof(TeamWinScreen)) },
|
||||
new ScreenButton(typeof(SetupScreen)) { Text = "Setup", RequestSelection = SetScreen },
|
||||
new Separator(),
|
||||
new ScreenButton(typeof(TeamEditorScreen)) { Text = "Team Editor", RequestSelection = SetScreen },
|
||||
new ScreenButton(typeof(RoundEditorScreen)) { Text = "Rounds Editor", RequestSelection = SetScreen },
|
||||
new ScreenButton(typeof(LadderEditorScreen)) { Text = "Bracket Editor", RequestSelection = SetScreen },
|
||||
new Separator(),
|
||||
new ScreenButton(typeof(ScheduleScreen)) { Text = "Schedule", RequestSelection = SetScreen },
|
||||
new ScreenButton(typeof(LadderScreen)) { Text = "Bracket", RequestSelection = SetScreen },
|
||||
new Separator(),
|
||||
new ScreenButton(typeof(TeamIntroScreen)) { Text = "TeamIntro", RequestSelection = SetScreen },
|
||||
new Separator(),
|
||||
new ScreenButton(typeof(MapPoolScreen)) { Text = "MapPool", RequestSelection = SetScreen },
|
||||
new ScreenButton(typeof(GameplayScreen)) { Text = "Gameplay", RequestSelection = SetScreen },
|
||||
new Separator(),
|
||||
new ScreenButton(typeof(TeamWinScreen)) { Text = "Win", RequestSelection = SetScreen },
|
||||
new Separator(),
|
||||
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));
|
||||
}
|
||||
|
||||
private float depth;
|
||||
|
||||
private Drawable currentScreen;
|
||||
private ScheduledDelegate scheduledHide;
|
||||
|
||||
public void SetScreen(Type screenType)
|
||||
{
|
||||
var screen = screens.FirstOrDefault(s => s.GetType() == screenType);
|
||||
if (screen == null) return;
|
||||
var target = screens.FirstOrDefault(s => s.GetType() == screenType);
|
||||
|
||||
foreach (var s in screens.Children)
|
||||
if (target == null || currentScreen == target) return;
|
||||
|
||||
if (scheduledHide?.Completed == false)
|
||||
{
|
||||
if (s == screen)
|
||||
{
|
||||
s.Show();
|
||||
if (s is IProvideVideo)
|
||||
video.FadeOut(200);
|
||||
else
|
||||
video.Show();
|
||||
}
|
||||
else
|
||||
s.Hide();
|
||||
scheduledHide.RunTask();
|
||||
scheduledHide.Cancel(); // see https://github.com/ppy/osu-framework/issues/2967
|
||||
scheduledHide = null;
|
||||
}
|
||||
|
||||
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 MapPoolScreen _:
|
||||
chatContainer.FadeIn(100);
|
||||
chatContainer.FadeIn(TournamentScreen.FADE_DELAY);
|
||||
break;
|
||||
|
||||
default:
|
||||
chatContainer.FadeOut(100);
|
||||
chatContainer.FadeOut(TournamentScreen.FADE_DELAY);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
15
osu.Game.Tournament/TourneyButton.cs
Normal file
15
osu.Game.Tournament/TourneyButton.cs
Normal 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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
protected Box Background;
|
||||
protected SpriteText SpriteText;
|
||||
|
||||
public OsuButton()
|
||||
public OsuButton(HoverSampleSet? hoverSounds = HoverSampleSet.Loud)
|
||||
{
|
||||
Height = 40;
|
||||
|
||||
@ -78,10 +78,12 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Depth = float.MinValue
|
||||
},
|
||||
SpriteText = CreateText(),
|
||||
new HoverClickSounds(HoverSampleSet.Loud),
|
||||
}
|
||||
});
|
||||
|
||||
if (hoverSounds.HasValue)
|
||||
AddInternal(new HoverClickSounds(hoverSounds.Value));
|
||||
|
||||
Enabled.BindValueChanged(enabledChanged, true);
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,9 @@ namespace osu.Game.Rulesets.Edit
|
||||
[Resolved]
|
||||
protected IFrameBasedClock EditorClock { get; private set; }
|
||||
|
||||
[Resolved]
|
||||
private IAdjustableClock adjustableClock { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private BindableBeatDivisor beatDivisor { get; set; }
|
||||
|
||||
@ -256,6 +259,9 @@ namespace osu.Game.Rulesets.Edit
|
||||
public void EndPlacement(HitObject hitObject)
|
||||
{
|
||||
EditorBeatmap.Add(hitObject);
|
||||
|
||||
adjustableClock.Seek(hitObject.StartTime);
|
||||
|
||||
showGridFor(Enumerable.Empty<HitObject>());
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,10 @@ namespace osu.Game.Screens.Edit
|
||||
set
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
@ -218,12 +218,17 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
}
|
||||
|
||||
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.Flash();
|
||||
};
|
||||
}, true);
|
||||
}
|
||||
|
||||
protected override void UpdateValue(float value)
|
||||
|
@ -36,6 +36,8 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");
|
||||
|
||||
public override float BackgroundParallaxAmount => 0.1f;
|
||||
|
||||
public override bool AllowBackButton => false;
|
||||
|
||||
public override bool HideOverlaysOnEnter => true;
|
||||
@ -64,7 +66,10 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
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();
|
||||
clock = new EditorClock(Beatmap.Value, beatDivisor) { IsCoupled = false };
|
||||
clock.ChangeSource(sourceClock);
|
||||
@ -241,7 +246,8 @@ namespace osu.Game.Screens.Edit
|
||||
base.OnEntering(last);
|
||||
|
||||
Background.FadeColour(Color4.DarkGray, 500);
|
||||
resetTrack();
|
||||
|
||||
resetTrack(true);
|
||||
}
|
||||
|
||||
public override bool OnExiting(IScreen next)
|
||||
@ -252,10 +258,24 @@ namespace osu.Game.Screens.Edit
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
|
||||
private void resetTrack()
|
||||
private void resetTrack(bool seekToStart = false)
|
||||
{
|
||||
Beatmap.Value.Track?.ResetSpeedAdjustments();
|
||||
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());
|
||||
|
@ -26,7 +26,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||
<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="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
@ -118,8 +118,8 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1010.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.1106.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.1106.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.1108.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.1108.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
Loading…
Reference in New Issue
Block a user