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

Merge branch 'master' into beatmap-conversion-rework

This commit is contained in:
Dean Herbert 2018-05-10 19:10:07 +08:00 committed by GitHub
commit 8a6ef0dabb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 69 additions and 101 deletions

View File

@ -11,7 +11,7 @@ install:
- cmd: git submodule update --init --recursive --depth=5
- cmd: choco install resharper-clt -y
- cmd: choco install nvika -y
- cmd: appveyor DownloadFile https://github.com/peppy/CodeFileSanity/releases/download/v0.2.4/CodeFileSanity.exe
- cmd: appveyor DownloadFile https://github.com/peppy/CodeFileSanity/releases/download/v0.2.5/CodeFileSanity.exe
before_build:
- cmd: CodeFileSanity.exe
- cmd: nuget restore -verbosity quiet

@ -1 +1 @@
Subproject commit 0773d895d9aa0729995cd4a23efc28238e35ceed
Subproject commit e793a084177f53920645c4f6f70cfef91e7fd19e

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Timing;
using osu.Game.Beatmaps.Timing;
using System.Collections.Generic;
using NUnit.Framework;
@ -16,8 +15,6 @@ namespace osu.Game.Tests.Visual
public TestCaseBreakOverlay()
{
Clock = new FramedClock();
Child = breakOverlay = new BreakOverlay(true);
AddStep("2s break", () => startBreak(2000));

View File

@ -12,45 +12,6 @@ using osu.Game.IO.Serialization.Converters;
namespace osu.Game.Beatmaps
{
public interface IBeatmap : IJsonSerializable
{
/// <summary>
/// This beatmap's info.
/// </summary>
BeatmapInfo BeatmapInfo { get; set; }
/// <summary>
/// This beatmap's metadata.
/// </summary>
BeatmapMetadata Metadata { get; }
/// <summary>
/// The control points in this beatmap.
/// </summary>
ControlPointInfo ControlPointInfo { get; }
/// <summary>
/// The breaks in this beatmap.
/// </summary>
List<BreakPeriod> Breaks { get; }
/// <summary>
/// Total amount of break time in the beatmap.
/// </summary>
double TotalBreakTime { get; }
/// <summary>
/// The hitobjects contained by this beatmap.
/// </summary>
IEnumerable<HitObject> HitObjects { get; }
/// <summary>
/// Creates a shallow-clone of this beatmap and returns it.
/// </summary>
/// <returns>The shallow-cloned beatmap.</returns>
IBeatmap Clone();
}
/// <summary>
/// A Beatmap containing converted HitObjects.
/// </summary>

View File

@ -0,0 +1,50 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Beatmaps.Timing;
using osu.Game.IO.Serialization;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Beatmaps
{
public interface IBeatmap : IJsonSerializable
{
/// <summary>
/// This beatmap's info.
/// </summary>
BeatmapInfo BeatmapInfo { get; set; }
/// <summary>
/// This beatmap's metadata.
/// </summary>
BeatmapMetadata Metadata { get; }
/// <summary>
/// The control points in this beatmap.
/// </summary>
ControlPointInfo ControlPointInfo { get; }
/// <summary>
/// The breaks in this beatmap.
/// </summary>
List<BreakPeriod> Breaks { get; }
/// <summary>
/// Total amount of break time in the beatmap.
/// </summary>
double TotalBreakTime { get; }
/// <summary>
/// The hitobjects contained by this beatmap.
/// </summary>
IEnumerable<HitObject> HitObjects { get; }
/// <summary>
/// Creates a shallow-clone of this beatmap and returns it.
/// </summary>
/// <returns>The shallow-cloned beatmap.</returns>
IBeatmap Clone();
}
}

View File

@ -12,10 +12,8 @@ using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Framework.MathUtils;
using osu.Framework.Threading;
using osu.Game.Configuration;
using osu.Game.Graphics;
@ -181,7 +179,7 @@ namespace osu.Game.Overlays
{
textbox.HoldFocus = false;
if (1f - ChatHeight.Value < channel_selection_min_height)
transformChatHeightTo(1f - channel_selection_min_height, 800, Easing.OutQuint);
this.TransformBindableTo(ChatHeight, 1f - channel_selection_min_height, 800, Easing.OutQuint);
}
else
textbox.HoldFocus = true;
@ -533,26 +531,5 @@ namespace osu.Game.Overlays
api.Queue(req);
}
private void transformChatHeightTo(double newChatHeight, double duration = 0, Easing easing = Easing.None)
{
this.TransformTo(this.PopulateTransform(new TransformChatHeight(), newChatHeight, duration, easing));
}
private class TransformChatHeight : Transform<double, ChatOverlay>
{
private double valueAt(double time)
{
if (time < StartTime) return StartValue;
if (time >= EndTime) return EndValue;
return Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
}
public override string TargetMember => "ChatHeight.Value";
protected override void Apply(ChatOverlay d, double time) => d.ChatHeight.Value = valueAt(time);
protected override void ReadIntoStartValue(ChatOverlay d) => StartValue = d.ChatHeight.Value;
}
}
}

View File

@ -1,8 +1,6 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
@ -12,6 +10,8 @@ using osu.Game.Graphics.Containers;
using osu.Game.Online.API.Requests;
using osu.Game.Overlays.SearchableList;
using osu.Game.Rulesets;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Overlays.Direct
{
@ -22,6 +22,7 @@ namespace osu.Game.Overlays.Direct
protected override Color4 BackgroundColour => OsuColour.FromHex(@"384552");
protected override DirectSortCriteria DefaultTab => DirectSortCriteria.Ranked;
protected override Drawable CreateSupplementaryControls()
{
modeButtons = new FillFlowContainer<RulesetToggleButton>
@ -38,7 +39,7 @@ namespace osu.Game.Overlays.Direct
{
DisplayStyleControl.Dropdown.AccentColour = colours.BlueDark;
Ruleset.BindTo(game?.Ruleset ?? new Bindable<RulesetInfo> { Value = rulesets.GetRuleset(0) });
Ruleset.Value = game?.Ruleset.Value ?? rulesets.GetRuleset(0);
foreach (var r in rulesets.AvailableRulesets)
{
modeButtons.Add(new RulesetToggleButton(Ruleset, r));
@ -49,14 +50,15 @@ namespace osu.Game.Overlays.Direct
{
private Drawable icon
{
get { return iconContainer.Icon; }
set { iconContainer.Icon = value; }
get => iconContainer.Icon;
set => iconContainer.Icon = value;
}
private RulesetInfo ruleset;
public RulesetInfo Ruleset
{
get { return ruleset; }
get => ruleset;
set
{
ruleset = value;
@ -73,6 +75,9 @@ namespace osu.Game.Overlays.Direct
iconContainer.FadeTo(Ruleset.ID == obj?.ID ? 1f : 0.5f, 100);
}
public override bool HandleKeyboardInput => !bindable.Disabled && base.HandleKeyboardInput;
public override bool HandleMouseInput => !bindable.Disabled && base.HandleMouseInput;
public RulesetToggleButton(Bindable<RulesetInfo> bindable, RulesetInfo ruleset)
{
this.bindable = bindable;

View File

@ -87,8 +87,8 @@ namespace osu.Game.Overlays.Toolbar
ruleset.Value = rulesets.AvailableRulesets.FirstOrDefault();
}
public override bool HandleKeyboardInput => !ruleset.Disabled;
public override bool HandleMouseInput => !ruleset.Disabled;
public override bool HandleKeyboardInput => !ruleset.Disabled && base.HandleKeyboardInput;
public override bool HandleMouseInput => !ruleset.Disabled && base.HandleMouseInput;
private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300);

View File

@ -4,9 +4,7 @@
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Input;
using osu.Framework.MathUtils;
using osu.Game.Rulesets.Objects.Drawables;
using OpenTK.Input;
@ -90,10 +88,10 @@ namespace osu.Game.Rulesets.UI.Scrolling
switch (args.Key)
{
case Key.Minus:
transformVisibleTimeRangeTo(VisibleTimeRange + time_span_step, 200, Easing.OutQuint);
this.TransformBindableTo(VisibleTimeRange, VisibleTimeRange + time_span_step, 200, Easing.OutQuint);
break;
case Key.Plus:
transformVisibleTimeRangeTo(VisibleTimeRange - time_span_step, 200, Easing.OutQuint);
this.TransformBindableTo(VisibleTimeRange, VisibleTimeRange - time_span_step, 200, Easing.OutQuint);
break;
}
}
@ -101,27 +99,6 @@ namespace osu.Game.Rulesets.UI.Scrolling
return false;
}
private void transformVisibleTimeRangeTo(double newTimeRange, double duration = 0, Easing easing = Easing.None)
{
this.TransformTo(this.PopulateTransform(new TransformVisibleTimeRange(), newTimeRange, duration, easing));
}
protected sealed override HitObjectContainer CreateHitObjectContainer() => new ScrollingHitObjectContainer(direction);
private class TransformVisibleTimeRange : Transform<double, ScrollingPlayfield>
{
private double valueAt(double time)
{
if (time < StartTime) return StartValue;
if (time >= EndTime) return EndValue;
return Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
}
public override string TargetMember => "VisibleTimeRange.Value";
protected override void Apply(ScrollingPlayfield d, double time) => d.VisibleTimeRange.Value = valueAt(time);
protected override void ReadIntoStartValue(ScrollingPlayfield d) => StartValue = d.VisibleTimeRange.Value;
}
}
}

View File

@ -27,6 +27,7 @@ namespace osu.Game.Screens.Edit
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");
public override bool ShowOverlaysOnEnter => false;
public override bool AllowBeatmapRulesetChange => false;
private Box bottomBackground;
private Container screenContainer;