Merge branch 'fix_slider_velocities' into taiko_barlines

This commit is contained in:
smoogipooo 2017-04-03 14:47:40 +09:00
commit 759869f551
22 changed files with 172 additions and 227 deletions

@ -1 +1 @@
Subproject commit bf6a3dc40176ee4f921012808070e014fc4a5779
Subproject commit 1c08c1fec496e9d64ba8f30ff0464cd5cdf567b6

View File

@ -14,7 +14,7 @@ namespace osu.Desktop.VisualTests
{
base.LoadComplete();
new BackgroundScreenDefault { Depth = 10 }.LoadAsync(this, AddInternal);
LoadComponentAsync(new BackgroundScreenDefault { Depth = 10 }, AddInternal);
// Have to construct this here, rather than in the constructor, because
// we depend on some dependencies to be loaded within OsuGameBase.load().

View File

@ -29,7 +29,7 @@ namespace osu.Desktop
{
base.LoadComplete();
versionManager.LoadAsync(this);
LoadComponentAsync(versionManager);
ScreenChanged += s =>
{
if (!versionManager.IsAlive && s is Intro)

View File

@ -14,6 +14,11 @@ namespace osu.Game.Modes.Osu.Objects
{
public class Slider : OsuHitObject, IHasCurve
{
/// <summary>
/// Scoring distance with a speed-adjusted beat length of 1 second.
/// </summary>
private const float base_scoring_distance = 100;
public IHasCurve CurveObject { get; set; }
public SliderCurve Curve => CurveObject.Curve;
@ -51,13 +56,10 @@ namespace osu.Game.Modes.Osu.Objects
{
base.ApplyDefaults(timing, difficulty);
ControlPoint overridePoint;
ControlPoint timingPoint = timing.TimingPointAt(StartTime, out overridePoint);
var velocityAdjustment = overridePoint?.VelocityAdjustment ?? 1;
var baseVelocity = 100 * difficulty.SliderMultiplier / velocityAdjustment;
double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier / timing.SpeedMultiplierAt(StartTime);
Velocity = baseVelocity / timingPoint.BeatLength;
TickDistance = baseVelocity / difficulty.SliderTickRate;
Velocity = scoringDistance / timing.BeatLengthAt(StartTime);
TickDistance = scoringDistance / difficulty.SliderTickRate;
}
public IEnumerable<SliderTick> Ticks

View File

@ -13,6 +13,11 @@ namespace osu.Game.Modes.Taiko.Objects
{
public class DrumRoll : TaikoHitObject, IHasDistance
{
/// <summary>
/// Drum roll distance that results in a duration of 1 speed-adjusted beat length.
/// </summary>
private const float base_distance = 100;
public double EndTime => StartTime + Distance / Velocity;
public double Duration => EndTime - StartTime;
@ -59,7 +64,7 @@ namespace osu.Game.Modes.Taiko.Objects
{
base.ApplyDefaults(timing, difficulty);
Velocity = timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier / 1000;
Velocity = base_distance * difficulty.SliderMultiplier * difficulty.SliderTickRate * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime);
TickTimeDistance = timing.BeatLengthAt(StartTime);
//TODO: move this to legacy conversion code to allow for direct division without special case.

View File

@ -14,6 +14,11 @@ namespace osu.Game.Modes.Taiko.Objects
/// </summary>
public const float CIRCLE_RADIUS = 42f;
/// <summary>
/// Time (in milliseconds) to scroll in the hit object with a speed-adjusted beat length of 1 second.
/// </summary>
private const double base_scroll_time = 6000;
/// <summary>
/// The time to scroll in the HitObject.
/// </summary>
@ -34,7 +39,7 @@ namespace osu.Game.Modes.Taiko.Objects
{
base.ApplyDefaults(timing, difficulty);
PreEmpt = 600 / (timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier) * 1000;
PreEmpt = base_scroll_time / difficulty.SliderMultiplier * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / 1000;
ControlPoint overridePoint;
Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode;

View File

@ -33,19 +33,15 @@ namespace osu.Game.Beatmaps.Drawables
Children = new Drawable[]
{
new DelayedLoadContainer
{
RelativeSizeAxes = Axes.Both,
TimeBeforeLoad = 300,
FinishedLoading = d => d.FadeInFromZero(400, EasingTypes.Out),
Children = new[]
new DelayedLoadWrapper(
new PanelBackground(beatmap)
{
new PanelBackground(beatmap)
{
RelativeSizeAxes = Axes.Both,
Depth = 1,
}
RelativeSizeAxes = Axes.Both,
OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out),
}
)
{
TimeBeforeLoad = 300,
},
new FillFlowContainer
{

View File

@ -20,11 +20,11 @@ namespace osu.Game.Beatmaps.Timing
}
/// <summary>
/// Finds the BPM multiplier at a time.
/// Finds the speed multiplier at a time.
/// </summary>
/// <param name="time">The time to find the BPM multiplier at.</param>
/// <returns>The BPM multiplier.</returns>
public double BPMMultiplierAt(double time)
/// <param name="time">The time to find the speed multiplier at.</param>
/// <returns>The speed multiplier.</returns>
public double SpeedMultiplierAt(double time)
{
ControlPoint overridePoint;
ControlPoint timingPoint = TimingPointAt(time, out overridePoint);
@ -33,10 +33,10 @@ namespace osu.Game.Beatmaps.Timing
}
/// <summary>
/// Finds the beat length at a time.
/// Finds the beat length at a time. This is expressed in milliseconds.
/// </summary>
/// <param name="time">The time to find the beat length at.</param>
/// <returns>The beat length in milliseconds.</returns>
/// <returns>The beat length.</returns>
public double BeatLengthAt(double time)
{
ControlPoint overridePoint;
@ -45,32 +45,6 @@ namespace osu.Game.Beatmaps.Timing
return timingPoint.BeatLength;
}
/// <summary>
/// Finds the beat velocity at a time.
/// </summary>
/// <param name="time">The time to find the velocity at.</param>
/// <returns>The velocity.</returns>
public double BeatVelocityAt(double time)
{
ControlPoint overridePoint;
ControlPoint timingPoint = TimingPointAt(time, out overridePoint);
return overridePoint?.VelocityAdjustment ?? timingPoint?.VelocityAdjustment ?? 1;
}
/// <summary>
/// Finds the beat length at a time.
/// </summary>
/// <param name="time">The time to find the beat length at.</param>
/// <returns>The beat length in positional length units.</returns>
public double BeatDistanceAt(double time)
{
ControlPoint overridePoint;
ControlPoint timingPoint = TimingPointAt(time, out overridePoint);
return (timingPoint?.BeatLength ?? 1) * (overridePoint?.VelocityAdjustment ?? timingPoint?.VelocityAdjustment ?? 1);
}
/// <summary>
/// Finds the timing point at a time.
/// </summary>
@ -102,21 +76,5 @@ namespace osu.Game.Beatmaps.Timing
return timingPoint ?? ControlPoint.Default;
}
/// <summary>
/// Finds the slider velocity at a time.
/// </summary>
/// <param name="time">The time to find the slider velocity at.</param>
/// <returns>The slider velocity in milliseconds.</returns>
public double SliderVelocityAt(double time)
{
const double base_scoring_distance = 100;
double beatDistance = BeatDistanceAt(time);
if (beatDistance > 0)
return base_scoring_distance / beatDistance * 1000;
return base_scoring_distance;
}
}
}

View File

@ -150,7 +150,7 @@ namespace osu.Game
}
});
(screenStack = new Loader()).LoadAsync(this, d =>
LoadComponentAsync(screenStack = new Loader(), d =>
{
screenStack.ModePushed += screenAdded;
screenStack.Exited += screenRemoved;
@ -158,27 +158,27 @@ namespace osu.Game
});
//overlay elements
(chat = new ChatOverlay { Depth = 0 }).LoadAsync(this, overlayContent.Add);
(options = new OptionsOverlay { Depth = -1 }).LoadAsync(this, overlayContent.Add);
(musicController = new MusicController
LoadComponentAsync(chat = new ChatOverlay { Depth = 0 }, overlayContent.Add);
LoadComponentAsync(options = new OptionsOverlay { Depth = -1 }, overlayContent.Add);
LoadComponentAsync(musicController = new MusicController
{
Depth = -2,
Position = new Vector2(0, Toolbar.HEIGHT),
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
}).LoadAsync(this, overlayContent.Add);
}, overlayContent.Add);
(notificationManager = new NotificationManager
LoadComponentAsync(notificationManager = new NotificationManager
{
Depth = -2,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
}).LoadAsync(this, overlayContent.Add);
}, overlayContent.Add);
(dialogOverlay = new DialogOverlay
LoadComponentAsync(dialogOverlay = new DialogOverlay
{
Depth = -4,
}).LoadAsync(this, overlayContent.Add);
}, overlayContent.Add);
Logger.NewEntry += entry =>
{
@ -195,12 +195,12 @@ namespace osu.Game
Dependencies.Cache(notificationManager);
Dependencies.Cache(dialogOverlay);
(Toolbar = new Toolbar
LoadComponentAsync(Toolbar = new Toolbar
{
Depth = -3,
OnHome = delegate { intro?.ChildScreen?.MakeCurrent(); },
OnPlayModeChange = m => PlayMode.Value = m,
}).LoadAsync(this, t =>
}, t =>
{
PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); };
PlayMode.TriggerChange();

View File

@ -347,12 +347,9 @@ namespace osu.Game.Overlays
}
});
dragContainer.Add(new AsyncLoadContainer
dragContainer.Add(new AsyncLoadWrapper(new MusicControllerBackground(beatmap)
{
RelativeSizeAxes = Axes.Both,
Depth = float.MaxValue,
Children = new[] { new MusicControllerBackground(beatmap) },
FinishedLoading = d =>
OnLoadComplete = d =>
{
switch (direction)
{
@ -370,6 +367,9 @@ namespace osu.Game.Overlays
currentBackground.Expire();
currentBackground = d;
}
})
{
Depth = float.MaxValue,
});
};
}

View File

@ -3,7 +3,6 @@
using System;
using System.Threading;
using osu.Framework.Allocation;
using osu.Framework.Screens;
using osu.Framework.Graphics;
using osu.Framework.Input;
@ -27,21 +26,13 @@ namespace osu.Game.Screens
return false;
}
private Framework.Game game;
[BackgroundDependencyLoader]
private void load(Framework.Game game)
{
this.game = game;
}
public override bool Push(Screen screen)
{
// When trying to push a non-loaded GameMode, load it asynchronously and re-invoke Push
// once it's done.
if (screen.LoadState == LoadState.NotLoaded)
{
screen.LoadAsync(game, d => Push((BackgroundScreen)d));
LoadComponentAsync(screen, d => Push((BackgroundScreen)d));
return true;
}

View File

@ -32,7 +32,7 @@ namespace osu.Game.Screens.Backgrounds
{
var newBackground = beatmap == null ? new Background(@"Backgrounds/bg1") : new BeatmapBackground(beatmap);
newBackground.LoadAsync(Game, delegate
LoadComponentAsync(newBackground, delegate
{
float newDepth = 0;
if (background != null)

View File

@ -20,9 +20,9 @@ namespace osu.Game.Screens
private void load(OsuGame game)
{
if (game.IsDeployedBuild)
new Disclaimer().LoadAsync(game, d => Push((Screen)d));
LoadComponentAsync(new Disclaimer(), d => Push((Screen)d));
else
new Intro().LoadAsync(game, d => Push((Screen)d));
LoadComponentAsync(new Intro(), d => Push((Screen)d));
}
}
}

View File

@ -88,9 +88,9 @@ namespace osu.Game.Screens.Menu
}
[BackgroundDependencyLoader]
private void load(OsuGame game, OsuColour colours)
private void load(OsuColour colours)
{
(intro = new Intro()).LoadAsync(game);
LoadComponentAsync(intro = new Intro());
iconColour = colours.Yellow;
}

View File

@ -76,7 +76,7 @@ namespace osu.Game.Screens.Menu
{
bgm.Start();
(mainMenu = new MainMenu()).LoadAsync(Game);
LoadComponentAsync(mainMenu = new MainMenu());
Scheduler.AddDelayed(delegate
{

View File

@ -57,7 +57,7 @@ namespace osu.Game.Screens.Menu
[BackgroundDependencyLoader]
private void load(OsuGame game)
{
background.LoadAsync(game);
LoadComponentAsync(background);
buttons.OnSettings = game.ToggleOptions;
@ -67,10 +67,7 @@ namespace osu.Game.Screens.Menu
private void preloadSongSelect()
{
if (songSelect == null)
{
songSelect = new PlaySongSelect();
songSelect.LoadAsync(Game);
}
LoadComponentAsync(songSelect = new PlaySongSelect());
}
private Screen consumeSongSelect()

View File

@ -225,7 +225,7 @@ namespace osu.Game.Screens.Play
var newPlayer = new Player();
newPlayer.LoadAsync(Game, delegate
LoadComponentAsync(newPlayer, delegate
{
newPlayer.RestartCount = RestartCount + 1;
ValidForResume = false;

View File

@ -50,7 +50,7 @@ namespace osu.Game.Screens.Play
Origin = Anchor.Centre,
});
player.LoadAsync(Game);
LoadComponentAsync(player);
}
protected override void OnEntering(Screen last)

View File

@ -103,111 +103,109 @@ namespace osu.Game.Screens.Select
labels.AddRange(Ruleset.GetRuleset(beatmap.BeatmapInfo.Mode).GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s)));
}
Add(beatmapInfoContainer = new AsyncLoadContainer
{
FinishedLoading = d =>
{
FadeIn(250);
AlwaysPresent = true;
lastContainer?.FadeOut(250);
lastContainer?.Expire();
},
Depth = newDepth,
RelativeSizeAxes = Axes.Both,
Children = new[]
Add(beatmapInfoContainer = new AsyncLoadWrapper(
new BufferedContainer
{
new BufferedContainer
OnLoadComplete = d =>
{
PixelSnapping = true,
CacheDrawnFrameBuffer = true,
Shear = -Shear,
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
FadeIn(250);
lastContainer?.FadeOut(250);
lastContainer?.Expire();
},
PixelSnapping = true,
CacheDrawnFrameBuffer = true,
Shear = -Shear,
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
// We will create the white-to-black gradient by modulating transparency and having
// a black backdrop. This results in an sRGB-space gradient and not linear space,
// transitioning from white to black more perceptually uniformly.
new Box
{
// We will create the white-to-black gradient by modulating transparency and having
// a black backdrop. This results in an sRGB-space gradient and not linear space,
// transitioning from white to black more perceptually uniformly.
new Box
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
},
// We use a container, such that we can set the colour gradient to go across the
// vertices of the masked container instead of the vertices of the (larger) sprite.
new Container
{
RelativeSizeAxes = Axes.Both,
ColourInfo = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0.3f)),
Children = new[]
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
},
// We use a container, such that we can set the colour gradient to go across the
// vertices of the masked container instead of the vertices of the (larger) sprite.
new Container
{
RelativeSizeAxes = Axes.Both,
ColourInfo = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0.3f)),
Children = new[]
// Zoomed-in and cropped beatmap background
new BeatmapBackgroundSprite(beatmap)
{
// Zoomed-in and cropped beatmap background
new BeatmapBackgroundSprite(beatmap)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill,
},
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill,
},
},
// Text for beatmap info
new FillFlowContainer
},
// Text for beatmap info
new FillFlowContainer
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Direction = FillDirection.Vertical,
Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 },
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Direction = FillDirection.Vertical,
Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 },
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
new OsuSpriteText
{
new OsuSpriteText
Font = @"Exo2.0-MediumItalic",
Text = metadata.Artist + " -- " + metadata.Title,
TextSize = 28,
Shadow = true,
},
new OsuSpriteText
{
Font = @"Exo2.0-MediumItalic",
Text = beatmapInfo.Version,
TextSize = 17,
Shadow = true,
},
new FillFlowContainer
{
Margin = new MarginPadding { Top = 10 },
Direction = FillDirection.Horizontal,
AutoSizeAxes = Axes.Both,
Children = new[]
{
Font = @"Exo2.0-MediumItalic",
Text = metadata.Artist + " -- " + metadata.Title,
TextSize = 28,
Shadow = true,
},
new OsuSpriteText
{
Font = @"Exo2.0-MediumItalic",
Text = beatmapInfo.Version,
TextSize = 17,
Shadow = true,
},
new FillFlowContainer
{
Margin = new MarginPadding { Top = 10 },
Direction = FillDirection.Horizontal,
AutoSizeAxes = Axes.Both,
Children = new[]
new OsuSpriteText
{
new OsuSpriteText
{
Font = @"Exo2.0-Medium",
Text = "mapped by ",
TextSize = 15,
Shadow = true,
},
new OsuSpriteText
{
Font = @"Exo2.0-Bold",
Text = metadata.Author,
TextSize = 15,
Shadow = true,
},
}
},
new FillFlowContainer
{
Margin = new MarginPadding { Top = 20 },
Spacing = new Vector2(40, 0),
AutoSizeAxes = Axes.Both,
Children = labels
},
}
},
}
Font = @"Exo2.0-Medium",
Text = "mapped by ",
TextSize = 15,
Shadow = true,
},
new OsuSpriteText
{
Font = @"Exo2.0-Bold",
Text = metadata.Author,
TextSize = 15,
Shadow = true,
},
}
},
new FillFlowContainer
{
Margin = new MarginPadding { Top = 20 },
Spacing = new Vector2(40, 0),
AutoSizeAxes = Axes.Both,
Children = labels
},
}
},
}
}
})
{
Depth = newDepth,
});
}

View File

@ -141,26 +141,23 @@ namespace osu.Game.Screens.Select.Leaderboards
Padding = new MarginPadding(edge_margin),
Children = new Drawable[]
{
avatar = new DelayedLoadContainer
avatar = new DelayedLoadWrapper(
new Avatar(Score.User ?? new User { Id = Score.UserID })
{
RelativeSizeAxes = Axes.Both,
CornerRadius = corner_radius,
Masking = true,
OnLoadComplete = d => d.FadeInFromZero(200),
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Radius = 1,
Colour = Color4.Black.Opacity(0.2f),
},
})
{
TimeBeforeLoad = 500,
FinishedLoading = d => d.FadeInFromZero(200),
Size = new Vector2(HEIGHT - edge_margin * 2, HEIGHT - edge_margin * 2),
Children = new Drawable[]
{
new Avatar(Score.User ?? new User { Id = Score.UserID })
{
RelativeSizeAxes = Axes.Both,
CornerRadius = corner_radius,
Masking = true,
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Radius = 1,
Colour = Color4.Black.Opacity(0.2f),
},
},
}
},
new Container
{

View File

@ -81,10 +81,10 @@ namespace osu.Game.Screens.Select
{
if (player != null) return;
(player = new PlayerLoader(new Player
LoadComponentAsync(player = new PlayerLoader(new Player
{
Beatmap = Beatmap, //eagerly set this so it's present before push.
})).LoadAsync(Game, l => Push(player));
}), l => Push(player));
}
}
}

View File

@ -40,15 +40,11 @@ namespace osu.Game.Users
{
displayedAvatar?.FadeOut(300);
displayedAvatar?.Expire();
Add(displayedAvatar = new AsyncLoadContainer
Add(displayedAvatar = new AsyncLoadWrapper(new Avatar(user)
{
RelativeSizeAxes = Axes.Both,
FinishedLoading = d => d.FadeInFromZero(200),
Children = new[]
{
new Avatar(user) { RelativeSizeAxes = Axes.Both }
}
});
OnLoadComplete = d => d.FadeInFromZero(200),
}));
}
}
}