mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 19:27:26 +08:00
Merge branch 'master' of git://github.com/ppy/osu into details
This commit is contained in:
commit
f3946bebb4
@ -1 +1 @@
|
||||
Subproject commit bf6a3dc40176ee4f921012808070e014fc4a5779
|
||||
Subproject commit 1c08c1fec496e9d64ba8f30ff0464cd5cdf567b6
|
@ -1,12 +1,11 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Linq;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
@ -24,7 +23,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
AddToggleStep("Kiai", b =>
|
||||
{
|
||||
kiai = !kiai;
|
||||
Reset();
|
||||
updateKiaiState();
|
||||
});
|
||||
|
||||
Add(new CirclePiece
|
||||
@ -87,37 +86,27 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
}
|
||||
});
|
||||
|
||||
Add(new DrumRollCircle(new CirclePiece
|
||||
Add(new CirclePiece
|
||||
{
|
||||
KiaiMode = kiai
|
||||
})
|
||||
{
|
||||
Width = 250,
|
||||
Position = new Vector2(575, 100)
|
||||
Position = new Vector2(575, 100),
|
||||
Width = 0.25f,
|
||||
AccentColour = Color4.Orange,
|
||||
KiaiMode = kiai,
|
||||
});
|
||||
|
||||
Add(new DrumRollCircle(new StrongCirclePiece
|
||||
Add(new StrongCirclePiece
|
||||
{
|
||||
Position = new Vector2(575, 300),
|
||||
Width = 0.25f,
|
||||
AccentColour = Color4.Orange,
|
||||
KiaiMode = kiai
|
||||
})
|
||||
{
|
||||
Width = 250,
|
||||
Position = new Vector2(575, 300)
|
||||
});
|
||||
}
|
||||
|
||||
private class DrumRollCircle : BaseCircle
|
||||
private void updateKiaiState()
|
||||
{
|
||||
public DrumRollCircle(CirclePiece piece)
|
||||
: base(piece)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Piece.AccentColour = colours.YellowDark;
|
||||
}
|
||||
foreach (var c in Children.OfType<CirclePiece>())
|
||||
c.KiaiMode = kiai;
|
||||
}
|
||||
|
||||
private abstract class BaseCircle : Container
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
@ -26,6 +25,8 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
|
||||
AddStep("Hit!", addHitJudgement);
|
||||
AddStep("Miss :(", addMissJudgement);
|
||||
AddStep("DrumRoll", () => addDrumRoll(false));
|
||||
AddStep("Strong DrumRoll", () => addDrumRoll(true));
|
||||
AddStep("Swell", addSwell);
|
||||
AddStep("Centre", () => addCentreHit(false));
|
||||
AddStep("Strong Centre", () => addCentreHit(true));
|
||||
@ -36,7 +37,6 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Y = 200,
|
||||
Padding = new MarginPadding { Left = 200 },
|
||||
Children = new[]
|
||||
{
|
||||
playfield = new TaikoPlayfield()
|
||||
@ -82,6 +82,18 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
PreEmpt = 1000
|
||||
}));
|
||||
}
|
||||
|
||||
private void addDrumRoll(bool strong)
|
||||
{
|
||||
var d = new DrumRoll
|
||||
{
|
||||
StartTime = Time.Current + 1000,
|
||||
Distance = 20000,
|
||||
PreEmpt = 1000,
|
||||
};
|
||||
|
||||
playfield.Add(strong ? new DrawableStrongDrumRoll(d) : new DrawableDrumRoll(d));
|
||||
}
|
||||
|
||||
private void addCentreHit(bool strong)
|
||||
{
|
||||
|
@ -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().
|
||||
|
@ -3,10 +3,7 @@
|
||||
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.Beatmaps.IO;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
|
||||
namespace osu.Desktop.Beatmaps.IO
|
||||
{
|
||||
@ -18,20 +15,17 @@ namespace osu.Desktop.Beatmaps.IO
|
||||
public static void Register() => AddReader<LegacyFilesystemReader>((storage, path) => Directory.Exists(path));
|
||||
|
||||
private string basePath { get; }
|
||||
private Beatmap firstMap { get; }
|
||||
|
||||
public LegacyFilesystemReader(string path)
|
||||
{
|
||||
basePath = path;
|
||||
|
||||
BeatmapFilenames = Directory.GetFiles(basePath, @"*.osu").Select(Path.GetFileName).ToArray();
|
||||
|
||||
if (BeatmapFilenames.Length == 0)
|
||||
throw new FileNotFoundException(@"This directory contains no beatmaps");
|
||||
|
||||
StoryboardFilename = Directory.GetFiles(basePath, @"*.osb").Select(Path.GetFileName).FirstOrDefault();
|
||||
using (var stream = new StreamReader(GetStream(BeatmapFilenames[0])))
|
||||
{
|
||||
var decoder = BeatmapDecoder.GetDecoder(stream);
|
||||
firstMap = decoder.Decode(stream);
|
||||
}
|
||||
}
|
||||
|
||||
public override Stream GetStream(string name)
|
||||
@ -39,11 +33,6 @@ namespace osu.Desktop.Beatmaps.IO
|
||||
return File.OpenRead(Path.Combine(basePath, name));
|
||||
}
|
||||
|
||||
public override BeatmapMetadata ReadMetadata()
|
||||
{
|
||||
return firstMap.BeatmapInfo.Metadata;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
// no-op
|
||||
|
@ -29,7 +29,7 @@ namespace osu.Desktop
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
versionManager.LoadAsync(this);
|
||||
LoadComponentAsync(versionManager);
|
||||
ScreenChanged += s =>
|
||||
{
|
||||
if (!versionManager.IsAlive && s is Intro)
|
||||
|
@ -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
|
||||
|
@ -2,96 +2,160 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Legacy;
|
||||
using osu.Game.Beatmaps.Samples;
|
||||
using osu.Game.Modes.Objects;
|
||||
using osu.Game.Modes.Objects.Types;
|
||||
using osu.Game.Modes.Taiko.Objects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Database;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Beatmaps
|
||||
{
|
||||
internal class TaikoBeatmapConverter : IBeatmapConverter<TaikoHitObject>
|
||||
{
|
||||
private const float legacy_velocity_scale = 1.4f;
|
||||
private const float bash_convert_factor = 1.65f;
|
||||
/// <summary>
|
||||
/// osu! is generally slower than taiko, so a factor is added to increase
|
||||
/// speed. This must be used everywhere slider length or beat length is used.
|
||||
/// </summary>
|
||||
private const float legacy_velocity_multiplier = 1.4f;
|
||||
|
||||
/// <summary>
|
||||
/// Because swells are easier in taiko than spinners are in osu!,
|
||||
/// legacy taiko multiplies a factor when converting the number of required hits.
|
||||
/// </summary>
|
||||
private const float swell_hit_multiplier = 1.65f;
|
||||
|
||||
/// <summary>
|
||||
/// Base osu! slider scoring distance.
|
||||
/// </summary>
|
||||
private const float osu_base_scoring_distance = 100;
|
||||
|
||||
/// <summary>
|
||||
/// Drum roll distance that results in a duration of 1 speed-adjusted beat length.
|
||||
/// </summary>
|
||||
private const float taiko_base_distance = 100;
|
||||
|
||||
public Beatmap<TaikoHitObject> Convert(Beatmap original)
|
||||
{
|
||||
if (original is LegacyBeatmap)
|
||||
original.TimingInfo.ControlPoints.ForEach(c => c.VelocityAdjustment /= legacy_velocity_scale);
|
||||
|
||||
return new Beatmap<TaikoHitObject>(original)
|
||||
{
|
||||
HitObjects = convertHitObjects(original.HitObjects)
|
||||
HitObjects = original.HitObjects.SelectMany(h => convertHitObject(h, original)).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
private List<TaikoHitObject> convertHitObjects(List<HitObject> hitObjects)
|
||||
{
|
||||
return hitObjects.Select(convertHitObject).ToList();
|
||||
}
|
||||
|
||||
private TaikoHitObject convertHitObject(HitObject original)
|
||||
private IEnumerable<TaikoHitObject> convertHitObject(HitObject obj, Beatmap beatmap)
|
||||
{
|
||||
// Check if this HitObject is already a TaikoHitObject, and return it if so
|
||||
TaikoHitObject originalTaiko = original as TaikoHitObject;
|
||||
var originalTaiko = obj as TaikoHitObject;
|
||||
if (originalTaiko != null)
|
||||
return originalTaiko;
|
||||
yield return originalTaiko;
|
||||
|
||||
IHasDistance distanceData = original as IHasDistance;
|
||||
IHasRepeats repeatsData = original as IHasRepeats;
|
||||
IHasEndTime endTimeData = original as IHasEndTime;
|
||||
var distanceData = obj as IHasDistance;
|
||||
var repeatsData = obj as IHasRepeats;
|
||||
var endTimeData = obj as IHasEndTime;
|
||||
|
||||
// Old osu! used hit sounding to determine various hit type information
|
||||
SampleType sample = original.Sample?.Type ?? SampleType.None;
|
||||
SampleType sample = obj.Sample?.Type ?? SampleType.None;
|
||||
|
||||
bool strong = (sample & SampleType.Finish) > 0;
|
||||
|
||||
if (distanceData != null)
|
||||
{
|
||||
return new DrumRoll
|
||||
int repeats = repeatsData?.RepeatCount ?? 1;
|
||||
|
||||
double speedAdjustment = beatmap.TimingInfo.SpeedMultiplierAt(obj.StartTime);
|
||||
double speedAdjustedBeatLength = beatmap.TimingInfo.BeatLengthAt(obj.StartTime) * speedAdjustment;
|
||||
|
||||
// The true distance, accounting for any repeats. This ends up being the drum roll distance later
|
||||
double distance = distanceData.Distance * repeats * legacy_velocity_multiplier;
|
||||
|
||||
// The velocity of the taiko hit object - calculated as the velocity of a drum roll
|
||||
double taikoVelocity = taiko_base_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier / speedAdjustedBeatLength * legacy_velocity_multiplier;
|
||||
// The duration of the taiko hit object
|
||||
double taikoDuration = distance / taikoVelocity;
|
||||
|
||||
// For some reason, old osu! always uses speedAdjustment to determine the taiko velocity, but
|
||||
// only uses it to determine osu! velocity if beatmap version < 8. Let's account for that here.
|
||||
if (beatmap.BeatmapInfo.BeatmapVersion >= 8)
|
||||
speedAdjustedBeatLength /= speedAdjustment;
|
||||
|
||||
// The velocity of the osu! hit object - calculated as the velocity of a slider
|
||||
double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier / speedAdjustedBeatLength * legacy_velocity_multiplier;
|
||||
// The duration of the osu! hit object
|
||||
double osuDuration = distance / osuVelocity;
|
||||
|
||||
// If the drum roll is to be split into hit circles, assume the ticks are 1/8 spaced within the duration of one beat
|
||||
double tickSpacing = Math.Min(speedAdjustedBeatLength / beatmap.BeatmapInfo.Difficulty.SliderTickRate, taikoDuration / repeats) / 8;
|
||||
|
||||
if (tickSpacing > 0 && osuDuration < 2 * speedAdjustedBeatLength)
|
||||
{
|
||||
StartTime = original.StartTime,
|
||||
Sample = original.Sample,
|
||||
for (double j = obj.StartTime; j <= distanceData.EndTime + tickSpacing; j += tickSpacing)
|
||||
{
|
||||
// Todo: This should generate different type of hits (including strongs)
|
||||
// depending on hitobject sound additions (not implemented fully yet)
|
||||
yield return new CentreHit
|
||||
{
|
||||
StartTime = j,
|
||||
Sample = obj.Sample,
|
||||
IsStrong = strong,
|
||||
VelocityMultiplier = legacy_velocity_multiplier
|
||||
};
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
yield return new DrumRoll
|
||||
{
|
||||
StartTime = obj.StartTime,
|
||||
Sample = obj.Sample,
|
||||
IsStrong = strong,
|
||||
Distance = distance,
|
||||
TickRate = beatmap.BeatmapInfo.Difficulty.SliderTickRate == 3 ? 3 : 4,
|
||||
VelocityMultiplier = legacy_velocity_multiplier
|
||||
};
|
||||
}
|
||||
}
|
||||
else if (endTimeData != null)
|
||||
{
|
||||
double hitMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.Difficulty.OverallDifficulty, 3, 5, 7.5) * swell_hit_multiplier;
|
||||
|
||||
yield return new Swell
|
||||
{
|
||||
StartTime = obj.StartTime,
|
||||
Sample = obj.Sample,
|
||||
IsStrong = strong,
|
||||
|
||||
Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1)
|
||||
EndTime = endTimeData.EndTime,
|
||||
RequiredHits = (int)Math.Max(1, endTimeData.Duration / 1000 * hitMultiplier),
|
||||
VelocityMultiplier = legacy_velocity_multiplier
|
||||
};
|
||||
}
|
||||
|
||||
if (endTimeData != null)
|
||||
else
|
||||
{
|
||||
// We compute the end time manually to add in the Bash convert factor
|
||||
return new Swell
|
||||
bool isCentre = (sample & ~(SampleType.Finish | SampleType.Normal)) == 0;
|
||||
|
||||
if (isCentre)
|
||||
{
|
||||
StartTime = original.StartTime,
|
||||
Sample = original.Sample,
|
||||
IsStrong = strong,
|
||||
|
||||
EndTime = original.StartTime + endTimeData.Duration * bash_convert_factor
|
||||
};
|
||||
}
|
||||
|
||||
bool isCentre = (sample & ~(SampleType.Finish | SampleType.Normal)) == 0;
|
||||
|
||||
if (isCentre)
|
||||
{
|
||||
return new CentreHit
|
||||
yield return new CentreHit
|
||||
{
|
||||
StartTime = obj.StartTime,
|
||||
Sample = obj.Sample,
|
||||
IsStrong = strong,
|
||||
VelocityMultiplier = legacy_velocity_multiplier
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
StartTime = original.StartTime,
|
||||
Sample = original.Sample,
|
||||
IsStrong = strong
|
||||
};
|
||||
yield return new RimHit
|
||||
{
|
||||
StartTime = obj.StartTime,
|
||||
Sample = obj.Sample,
|
||||
IsStrong = strong,
|
||||
VelocityMultiplier = legacy_velocity_multiplier
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return new RimHit
|
||||
{
|
||||
StartTime = original.StartTime,
|
||||
Sample = original.Sample,
|
||||
IsStrong = strong,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ namespace osu.Game.Modes.Taiko.Judgements
|
||||
public override string MaxResultString => MAX_HIT_RESULT.GetDescription();
|
||||
|
||||
/// <summary>
|
||||
/// Whether this Judgement has a secondary hit in the case of finishers.
|
||||
/// Whether this Judgement has a secondary hit in the case of strong hits.
|
||||
/// </summary>
|
||||
public virtual bool SecondHit { get; set; }
|
||||
|
||||
|
@ -12,24 +12,20 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
protected override Key[] HitKeys { get; } = { Key.F, Key.J };
|
||||
|
||||
private readonly CirclePiece circlePiece;
|
||||
|
||||
public DrawableCentreHit(Hit hit)
|
||||
: base(hit)
|
||||
{
|
||||
Add(circlePiece = new CirclePiece
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
new CentreHitSymbolPiece()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
circlePiece.AccentColour = colours.PinkDarker;
|
||||
Circle.AccentColour = colours.PinkDarker;
|
||||
}
|
||||
|
||||
protected override CirclePiece CreateCirclePiece() => new CirclePiece
|
||||
{
|
||||
Children = new[] { new CentreHitSymbolPiece() }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,38 +1,91 @@
|
||||
// Copyright (c) 2007-2017 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.Graphics;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
public class DrawableDrumRoll : DrawableTaikoHitObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Number of rolling hits required to reach the dark/final accent colour.
|
||||
/// </summary>
|
||||
private const int rolling_hits_for_dark_accent = 5;
|
||||
|
||||
private readonly DrumRoll drumRoll;
|
||||
|
||||
private readonly CirclePiece circle;
|
||||
|
||||
private Color4 accentDarkColour;
|
||||
|
||||
/// <summary>
|
||||
/// Rolling number of tick hits. This increases for hits and decreases for misses.
|
||||
/// </summary>
|
||||
private int rollingHits;
|
||||
|
||||
public DrawableDrumRoll(DrumRoll drumRoll)
|
||||
: base(drumRoll)
|
||||
{
|
||||
this.drumRoll = drumRoll;
|
||||
|
||||
int tickIndex = 0;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Width = (float)(drumRoll.Duration / drumRoll.PreEmpt);
|
||||
|
||||
Add(circle = CreateCirclePiece());
|
||||
circle.KiaiMode = HitObject.Kiai;
|
||||
|
||||
foreach (var tick in drumRoll.Ticks)
|
||||
{
|
||||
var newTick = new DrawableDrumRollTick(tick)
|
||||
{
|
||||
Depth = tickIndex,
|
||||
X = (float)((tick.StartTime - HitObject.StartTime) / drumRoll.Duration)
|
||||
};
|
||||
|
||||
AddNested(newTick);
|
||||
newTick.OnJudgement += onTickJudgement;
|
||||
|
||||
tickIndex++;
|
||||
AddNested(newTick);
|
||||
Add(newTick);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
circle.AccentColour = AccentColour = colours.YellowDark;
|
||||
accentDarkColour = colours.YellowDarker;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
// This is naive, however it's based on the reasoning that the hit target
|
||||
// is further than mid point of the play field, so the time taken to scroll in should always
|
||||
// be greater than the time taken to scroll out to the left of the screen.
|
||||
// Thus, using PreEmpt here is enough for the drum roll to completely scroll out.
|
||||
LifetimeEnd = drumRoll.EndTime + drumRoll.PreEmpt;
|
||||
}
|
||||
|
||||
private void onTickJudgement(DrawableHitObject<TaikoHitObject, TaikoJudgement> obj)
|
||||
{
|
||||
if (obj.Judgement.Result == HitResult.Hit)
|
||||
rollingHits++;
|
||||
else
|
||||
rollingHits--;
|
||||
|
||||
rollingHits = MathHelper.Clamp(rollingHits, 0, rolling_hits_for_dark_accent);
|
||||
|
||||
Color4 newAccent = Interpolation.ValueAt((float)rollingHits / rolling_hits_for_dark_accent, AccentColour, accentDarkColour, 0, 1);
|
||||
circle.FadeAccent(newAccent, 100);
|
||||
}
|
||||
|
||||
protected override void CheckJudgement(bool userTriggered)
|
||||
@ -53,5 +106,11 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
else
|
||||
Judgement.Result = HitResult.Miss;
|
||||
}
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual CirclePiece CreateCirclePiece() => new CirclePiece();
|
||||
}
|
||||
}
|
||||
|
@ -5,20 +5,66 @@ using OpenTK.Input;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using System;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
public class DrawableDrumRollTick : DrawableTaikoHitObject
|
||||
{
|
||||
/// <summary>
|
||||
/// The size of a tick.
|
||||
/// </summary>
|
||||
private const float tick_size = TaikoHitObject.CIRCLE_RADIUS / 2;
|
||||
|
||||
/// <summary>
|
||||
/// Any tick that is not the first for a drumroll is not filled, but is instead displayed
|
||||
/// as a hollow circle. This is what controls the border width of that circle.
|
||||
/// </summary>
|
||||
private const float tick_border_width = tick_size / 4;
|
||||
|
||||
private readonly DrumRollTick tick;
|
||||
|
||||
private readonly CircularContainer bodyContainer;
|
||||
|
||||
public DrawableDrumRollTick(DrumRollTick tick)
|
||||
: base(tick)
|
||||
{
|
||||
this.tick = tick;
|
||||
|
||||
Anchor = Anchor.CentreLeft;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
RelativePositionAxes = Axes.X;
|
||||
Size = new Vector2(tick_size);
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
bodyContainer = new CircularContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
BorderThickness = tick_border_width,
|
||||
BorderColour = Color4.White,
|
||||
Children = new[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = tick.FirstTick ? 1 : 0,
|
||||
AlwaysPresent = true
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override TaikoJudgement CreateJudgement() => new TaikoDrumRollTickJudgement();
|
||||
protected override TaikoJudgement CreateJudgement() => new TaikoDrumRollTickJudgement { SecondHit = tick.IsStrong };
|
||||
|
||||
protected override void CheckJudgement(bool userTriggered)
|
||||
{
|
||||
@ -38,11 +84,17 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case ArmedState.Hit:
|
||||
bodyContainer.ScaleTo(0, 100, EasingTypes.OutQuint);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void UpdateScrollPosition(double time)
|
||||
{
|
||||
// Drum roll ticks shouldn't move
|
||||
// Ticks don't move
|
||||
}
|
||||
|
||||
protected override bool HandleKeyPress(Key key)
|
||||
|
@ -6,6 +6,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
@ -20,15 +21,17 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
|
||||
protected override Container<Framework.Graphics.Drawable> Content => bodyContainer;
|
||||
|
||||
protected readonly CirclePiece Circle;
|
||||
|
||||
private readonly Hit hit;
|
||||
|
||||
private readonly Container bodyContainer;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the last key pressed is a valid hit key.
|
||||
/// </summary>
|
||||
private bool validKeyPressed;
|
||||
|
||||
private readonly Container bodyContainer;
|
||||
|
||||
protected DrawableHit(Hit hit)
|
||||
: base(hit)
|
||||
{
|
||||
@ -38,7 +41,13 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Children = new[]
|
||||
{
|
||||
Circle = CreateCirclePiece()
|
||||
}
|
||||
});
|
||||
|
||||
Circle.KiaiMode = HitObject.Kiai;
|
||||
}
|
||||
|
||||
protected override void CheckJudgement(bool userTriggered)
|
||||
@ -100,5 +109,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
|
||||
Expire();
|
||||
}
|
||||
|
||||
protected abstract CirclePiece CreateCirclePiece();
|
||||
}
|
||||
}
|
||||
|
@ -12,24 +12,20 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
protected override Key[] HitKeys { get; } = { Key.D, Key.K };
|
||||
|
||||
private readonly CirclePiece circlePiece;
|
||||
|
||||
public DrawableRimHit(Hit hit)
|
||||
: base(hit)
|
||||
{
|
||||
Add(circlePiece = new CirclePiece
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
new RimHitSymbolPiece()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
circlePiece.AccentColour = colours.BlueDarker;
|
||||
Circle.AccentColour = colours.BlueDarker;
|
||||
}
|
||||
|
||||
protected override CirclePiece CreateCirclePiece() => new CirclePiece
|
||||
{
|
||||
Children = new[] { new RimHitSymbolPiece() }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -12,24 +12,20 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
protected override Key[] HitKeys { get; } = { Key.F, Key.J };
|
||||
|
||||
private readonly CirclePiece circlePiece;
|
||||
|
||||
public DrawableStrongCentreHit(Hit hit)
|
||||
: base(hit)
|
||||
{
|
||||
Add(circlePiece = new StrongCirclePiece
|
||||
{
|
||||
Children = new []
|
||||
{
|
||||
new CentreHitSymbolPiece()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
circlePiece.AccentColour = colours.PinkDarker;
|
||||
Circle.AccentColour = colours.PinkDarker;
|
||||
}
|
||||
|
||||
protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece
|
||||
{
|
||||
Children = new[] { new CentreHitSymbolPiece() }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
public class DrawableStrongDrumRoll : DrawableDrumRoll
|
||||
{
|
||||
public DrawableStrongDrumRoll(DrumRoll drumRoll)
|
||||
: base(drumRoll)
|
||||
{
|
||||
}
|
||||
|
||||
protected override TaikoJudgement CreateJudgement() => new TaikoJudgement { SecondHit = true };
|
||||
|
||||
protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece();
|
||||
}
|
||||
}
|
@ -12,24 +12,20 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
protected override Key[] HitKeys { get; } = { Key.D, Key.K };
|
||||
|
||||
private readonly CirclePiece circlePiece;
|
||||
|
||||
public DrawableStrongRimHit(Hit hit)
|
||||
: base(hit)
|
||||
{
|
||||
Add(circlePiece = new StrongCirclePiece
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
new RimHitSymbolPiece()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
circlePiece.AccentColour = colours.BlueDarker;
|
||||
Circle.AccentColour = colours.BlueDarker;
|
||||
}
|
||||
|
||||
protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece
|
||||
{
|
||||
Children = new[] { new RimHitSymbolPiece() }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -128,6 +128,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
circlePiece.KiaiMode = HitObject.Kiai;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
: base(hitObject)
|
||||
{
|
||||
Anchor = Anchor.CentreLeft;
|
||||
Origin = Anchor.Centre;
|
||||
Origin = Anchor.CentreLeft;
|
||||
|
||||
RelativePositionAxes = Axes.X;
|
||||
}
|
||||
|
@ -36,10 +36,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
|
||||
{
|
||||
accentColour = value;
|
||||
|
||||
innerBackground.Colour = AccentColour;
|
||||
|
||||
triangles.ColourLight = AccentColour;
|
||||
triangles.ColourDark = AccentColour.Darken(0.1f);
|
||||
background.Colour = AccentColour;
|
||||
|
||||
resetEdgeEffects();
|
||||
}
|
||||
@ -69,10 +66,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
|
||||
protected override Container<Framework.Graphics.Drawable> Content => SymbolContainer;
|
||||
protected readonly Container SymbolContainer;
|
||||
|
||||
private readonly Container background;
|
||||
private readonly Container innerLayer;
|
||||
private readonly Container innerCircleContainer;
|
||||
private readonly Box innerBackground;
|
||||
private readonly Triangles triangles;
|
||||
|
||||
public CirclePiece()
|
||||
{
|
||||
@ -88,26 +83,28 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Children = new Framework.Graphics.Drawable[]
|
||||
{
|
||||
innerCircleContainer = new CircularContainer
|
||||
background = new CircularContainer
|
||||
{
|
||||
Name = "Inner Circle",
|
||||
Name = "Background",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
Children = new Framework.Graphics.Drawable[]
|
||||
{
|
||||
innerBackground = new Box
|
||||
new Box
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
triangles = new Triangles
|
||||
new Triangles
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ColourLight = Color4.White,
|
||||
ColourDark = Color4.White.Darken(0.1f)
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -150,7 +147,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
|
||||
|
||||
private void resetEdgeEffects()
|
||||
{
|
||||
innerCircleContainer.EdgeEffect = new EdgeEffect
|
||||
background.EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Glow,
|
||||
Colour = AccentColour,
|
||||
|
@ -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;
|
||||
@ -25,13 +30,12 @@ namespace osu.Game.Modes.Taiko.Objects
|
||||
/// <summary>
|
||||
/// Velocity of the drum roll in positional length units per millisecond.
|
||||
/// </summary>
|
||||
public double Velocity { get; protected set; }
|
||||
public double Velocity { get; protected set; } = 5;
|
||||
|
||||
/// <summary>
|
||||
/// The distance between ticks of this drumroll.
|
||||
/// <para>Half of this value is the hit window of the ticks.</para>
|
||||
/// Numer of ticks per beat length.
|
||||
/// </summary>
|
||||
public double TickTimeDistance { get; protected set; }
|
||||
public int TickRate = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Number of drum roll ticks required for a "Good" hit.
|
||||
@ -55,18 +59,20 @@ namespace osu.Game.Modes.Taiko.Objects
|
||||
|
||||
private List<DrumRollTick> ticks;
|
||||
|
||||
/// <summary>
|
||||
/// The length (in milliseconds) between ticks of this drumroll.
|
||||
/// <para>Half of this value is the hit window of the ticks.</para>
|
||||
/// </summary>
|
||||
private double tickSpacing = 100;
|
||||
|
||||
public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty)
|
||||
{
|
||||
base.ApplyDefaults(timing, difficulty);
|
||||
|
||||
Velocity = timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier / 1000;
|
||||
TickTimeDistance = timing.BeatLengthAt(StartTime);
|
||||
double speedAdjutedBeatLength = timing.SpeedMultiplierAt(StartTime) * timing.BeatLengthAt(StartTime);
|
||||
|
||||
//TODO: move this to legacy conversion code to allow for direct division without special case.
|
||||
if (difficulty.SliderTickRate == 3)
|
||||
TickTimeDistance /= 3;
|
||||
else
|
||||
TickTimeDistance /= 4;
|
||||
Velocity = base_distance * difficulty.SliderMultiplier / speedAdjutedBeatLength * VelocityMultiplier;
|
||||
tickSpacing = timing.BeatLengthAt(StartTime) / TickRate;
|
||||
|
||||
RequiredGoodHits = TotalTicks * Math.Min(0.15, 0.05 + 0.10 / 6 * difficulty.OverallDifficulty);
|
||||
RequiredGreatHits = TotalTicks * Math.Min(0.30, 0.10 + 0.20 / 6 * difficulty.OverallDifficulty);
|
||||
@ -76,18 +82,19 @@ namespace osu.Game.Modes.Taiko.Objects
|
||||
{
|
||||
var ret = new List<DrumRollTick>();
|
||||
|
||||
if (TickTimeDistance == 0)
|
||||
if (tickSpacing == 0)
|
||||
return ret;
|
||||
|
||||
bool first = true;
|
||||
for (double t = StartTime; t < EndTime + (int)TickTimeDistance; t += TickTimeDistance)
|
||||
for (double t = StartTime; t < EndTime + (int)tickSpacing; t += tickSpacing)
|
||||
{
|
||||
ret.Add(new DrumRollTick
|
||||
{
|
||||
FirstTick = first,
|
||||
PreEmpt = PreEmpt,
|
||||
TickTimeDistance = TickTimeDistance,
|
||||
TickSpacing = tickSpacing,
|
||||
StartTime = t,
|
||||
IsStrong = IsStrong,
|
||||
Sample = new HitSampleInfo
|
||||
{
|
||||
Type = SampleType.None,
|
||||
|
@ -11,14 +11,14 @@ namespace osu.Game.Modes.Taiko.Objects
|
||||
public bool FirstTick;
|
||||
|
||||
/// <summary>
|
||||
/// The distance between this tick and the next in milliseconds.
|
||||
/// The length (in milliseconds) between this tick and the next.
|
||||
/// <para>Half of this value is the hit window of the tick.</para>
|
||||
/// </summary>
|
||||
public double TickTimeDistance;
|
||||
public double TickSpacing;
|
||||
|
||||
/// <summary>
|
||||
/// The time allowed to hit this tick.
|
||||
/// </summary>
|
||||
public double HitWindow => TickTimeDistance / 2;
|
||||
public double HitWindow => TickSpacing / 2;
|
||||
}
|
||||
}
|
@ -1,9 +1,6 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Game.Beatmaps.Timing;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Modes.Objects.Types;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects
|
||||
@ -17,14 +14,6 @@ namespace osu.Game.Modes.Taiko.Objects
|
||||
/// <summary>
|
||||
/// The number of hits required to complete the swell successfully.
|
||||
/// </summary>
|
||||
public int RequiredHits { get; protected set; } = 10;
|
||||
|
||||
public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty)
|
||||
{
|
||||
base.ApplyDefaults(timing, difficulty);
|
||||
|
||||
double spinnerRotationRatio = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5);
|
||||
RequiredHits = (int)Math.Max(1, Duration / 1000f * spinnerRotationRatio);
|
||||
}
|
||||
public int RequiredHits = 10;
|
||||
}
|
||||
}
|
@ -14,6 +14,16 @@ 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 velocity multiplier applied to this hit object.
|
||||
/// </summary>
|
||||
public float VelocityMultiplier = 1;
|
||||
|
||||
/// <summary>
|
||||
/// The time to scroll in the HitObject.
|
||||
/// </summary>
|
||||
@ -34,7 +44,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) / VelocityMultiplier / 1000;
|
||||
|
||||
ControlPoint overridePoint;
|
||||
Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode;
|
||||
|
@ -72,14 +72,9 @@ namespace osu.Game.Modes.Taiko.Replays
|
||||
}
|
||||
else if (drumRoll != null)
|
||||
{
|
||||
double delay = drumRoll.TickTimeDistance;
|
||||
|
||||
double time = drumRoll.StartTime;
|
||||
|
||||
for (int j = 0; j < drumRoll.TotalTicks; j++)
|
||||
foreach (var tick in drumRoll.Ticks)
|
||||
{
|
||||
Frames.Add(new ReplayFrame((int)time, 0, 0, hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2));
|
||||
time += delay;
|
||||
Frames.Add(new ReplayFrame(tick.StartTime, 0, 0, hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2));
|
||||
hitButton = !hitButton;
|
||||
}
|
||||
}
|
||||
|
@ -18,12 +18,21 @@ namespace osu.Game.Modes.Taiko.UI
|
||||
/// </summary>
|
||||
internal class HitExplosion : CircularContainer
|
||||
{
|
||||
private readonly TaikoJudgement judgement;
|
||||
/// <summary>
|
||||
/// The size multiplier of a hit explosion if a hit object has been hit with the second key.
|
||||
/// </summary>
|
||||
private const float secondhit_size_multiplier = 1.5f;
|
||||
|
||||
/// <summary>
|
||||
/// The judgement this hit explosion visualises.
|
||||
/// </summary>
|
||||
public readonly TaikoJudgement Judgement;
|
||||
|
||||
private readonly Box innerFill;
|
||||
|
||||
public HitExplosion(TaikoJudgement judgement)
|
||||
{
|
||||
this.judgement = judgement;
|
||||
Judgement = judgement;
|
||||
|
||||
Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2);
|
||||
|
||||
@ -50,10 +59,7 @@ namespace osu.Game.Modes.Taiko.UI
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
if (judgement.SecondHit)
|
||||
Size *= 1.5f;
|
||||
|
||||
switch (judgement.TaikoResult)
|
||||
switch (Judgement.TaikoResult)
|
||||
{
|
||||
case TaikoHitResult.Good:
|
||||
innerFill.Colour = colours.Green;
|
||||
@ -73,5 +79,13 @@ namespace osu.Game.Modes.Taiko.UI
|
||||
|
||||
Expire();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Transforms this hit explosion to visualise a secondary hit.
|
||||
/// </summary>
|
||||
public void VisualiseSecondHit()
|
||||
{
|
||||
ResizeTo(Size * secondhit_size_multiplier, 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,9 +21,9 @@ namespace osu.Game.Modes.Taiko.UI
|
||||
private const float normal_diameter = TaikoHitObject.CIRCLE_RADIUS * 2;
|
||||
|
||||
/// <summary>
|
||||
/// Diameter of finisher hit object circles.
|
||||
/// Diameter of strong hit object circles.
|
||||
/// </summary>
|
||||
private const float finisher_diameter = normal_diameter * 1.5f;
|
||||
private const float strong_hit_diameter = normal_diameter * 1.5f;
|
||||
|
||||
/// <summary>
|
||||
/// The 1px inner border of the taiko playfield.
|
||||
@ -47,15 +47,15 @@ namespace osu.Game.Modes.Taiko.UI
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Y = border_offset,
|
||||
Size = new Vector2(border_thickness, (TaikoPlayfield.PLAYFIELD_HEIGHT - finisher_diameter) / 2f - border_offset),
|
||||
Size = new Vector2(border_thickness, (TaikoPlayfield.PLAYFIELD_HEIGHT - strong_hit_diameter) / 2f - border_offset),
|
||||
Alpha = 0.1f
|
||||
},
|
||||
new CircularContainer
|
||||
{
|
||||
Name = "Finisher Ring",
|
||||
Name = "Strong Hit Ring",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(finisher_diameter),
|
||||
Size = new Vector2(strong_hit_diameter),
|
||||
Masking = true,
|
||||
BorderColour = Color4.White,
|
||||
BorderThickness = border_thickness,
|
||||
@ -72,7 +72,7 @@ namespace osu.Game.Modes.Taiko.UI
|
||||
},
|
||||
new CircularContainer
|
||||
{
|
||||
Name = "Normal Ring",
|
||||
Name = "Normal Hit Ring",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(normal_diameter),
|
||||
@ -96,7 +96,7 @@ namespace osu.Game.Modes.Taiko.UI
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Y = -border_offset,
|
||||
Size = new Vector2(border_thickness, (TaikoPlayfield.PLAYFIELD_HEIGHT - finisher_diameter) / 2f - border_offset),
|
||||
Size = new Vector2(border_thickness, (TaikoPlayfield.PLAYFIELD_HEIGHT - strong_hit_diameter) / 2f - border_offset),
|
||||
Alpha = 0.1f
|
||||
},
|
||||
};
|
||||
|
@ -2,15 +2,17 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Modes.Replays;
|
||||
using osu.Game.Modes.Scoring;
|
||||
using osu.Game.Modes.Taiko.Beatmaps;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using osu.Game.Modes.Taiko.Objects;
|
||||
using osu.Game.Modes.Taiko.Replays;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawable;
|
||||
using osu.Game.Modes.Taiko.Scoring;
|
||||
using osu.Game.Modes.UI;
|
||||
using osu.Game.Modes.Replays;
|
||||
using osu.Game.Modes.Taiko.Replays;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.UI
|
||||
{
|
||||
@ -27,9 +29,44 @@ namespace osu.Game.Modes.Taiko.UI
|
||||
|
||||
protected override IBeatmapProcessor<TaikoHitObject> CreateBeatmapProcessor() => new TaikoBeatmapProcessor();
|
||||
|
||||
protected override Playfield<TaikoHitObject, TaikoJudgement> CreatePlayfield() => new TaikoPlayfield();
|
||||
protected override Playfield<TaikoHitObject, TaikoJudgement> CreatePlayfield() => new TaikoPlayfield
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft
|
||||
};
|
||||
|
||||
protected override DrawableHitObject<TaikoHitObject, TaikoJudgement> GetVisualRepresentation(TaikoHitObject h) => null;
|
||||
protected override DrawableHitObject<TaikoHitObject, TaikoJudgement> GetVisualRepresentation(TaikoHitObject h)
|
||||
{
|
||||
var centreHit = h as CentreHit;
|
||||
if (centreHit != null)
|
||||
{
|
||||
if (h.IsStrong)
|
||||
return new DrawableStrongCentreHit(centreHit);
|
||||
return new DrawableCentreHit(centreHit);
|
||||
}
|
||||
|
||||
var rimHit = h as RimHit;
|
||||
if (rimHit != null)
|
||||
{
|
||||
if (h.IsStrong)
|
||||
return new DrawableStrongRimHit(rimHit);
|
||||
return new DrawableRimHit(rimHit);
|
||||
}
|
||||
|
||||
var drumRoll = h as DrumRoll;
|
||||
if (drumRoll != null)
|
||||
{
|
||||
if (h.IsStrong)
|
||||
return new DrawableStrongDrumRoll(drumRoll);
|
||||
return new DrawableDrumRoll(drumRoll);
|
||||
}
|
||||
|
||||
var swell = h as Swell;
|
||||
if (swell != null)
|
||||
return new DrawableSwell(swell);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected override FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => new TaikoFramedReplayInputHandler(replay);
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawable;
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.UI
|
||||
{
|
||||
@ -22,7 +23,7 @@ namespace osu.Game.Modes.Taiko.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// The play field height. This is relative to the size of hit objects
|
||||
/// such that the playfield is just a bit larger than finishers.
|
||||
/// such that the playfield is just a bit larger than strong hits.
|
||||
/// </summary>
|
||||
public const float PLAYFIELD_HEIGHT = TaikoHitObject.CIRCLE_RADIUS * 2 * 2;
|
||||
|
||||
@ -176,9 +177,7 @@ namespace osu.Game.Modes.Taiko.UI
|
||||
public override void OnJudgement(DrawableHitObject<TaikoHitObject, TaikoJudgement> judgedObject)
|
||||
{
|
||||
bool wasHit = judgedObject.Judgement.Result == HitResult.Hit;
|
||||
|
||||
if (wasHit)
|
||||
hitExplosionContainer.Add(new HitExplosion(judgedObject.Judgement));
|
||||
bool secondHit = judgedObject.Judgement.SecondHit;
|
||||
|
||||
judgementContainer.Add(new DrawableTaikoJudgement(judgedObject.Judgement)
|
||||
{
|
||||
@ -187,6 +186,22 @@ namespace osu.Game.Modes.Taiko.UI
|
||||
RelativePositionAxes = Axes.X,
|
||||
X = wasHit ? judgedObject.Position.X : 0,
|
||||
});
|
||||
|
||||
if (!wasHit)
|
||||
return;
|
||||
|
||||
if (!secondHit)
|
||||
{
|
||||
if (judgedObject.X >= -0.05f && !(judgedObject is DrawableSwell))
|
||||
{
|
||||
// If we're far enough away from the left stage, we should bring outselves in front of it
|
||||
topLevelHitContainer.Add(judgedObject.CreateProxy());
|
||||
}
|
||||
|
||||
hitExplosionContainer.Add(new HitExplosion(judgedObject.Judgement));
|
||||
}
|
||||
else
|
||||
hitExplosionContainer.Children.FirstOrDefault(e => e.Judgement == judgedObject.Judgement)?.VisualiseSecondHit();
|
||||
}
|
||||
}
|
||||
}
|
@ -58,6 +58,7 @@
|
||||
<Compile Include="Objects\Drawable\DrawableStrongRimHit.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableCentreHit.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableHit.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableStrongDrumRoll.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableStrongCentreHit.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableStrongHit.cs" />
|
||||
<Compile Include="Objects\Drawable\Pieces\CentreHitSymbolPiece.cs" />
|
||||
|
@ -7,6 +7,8 @@ using osu.Game.Beatmaps.IO;
|
||||
using osu.Game.Modes;
|
||||
using osu.Game.Modes.Osu;
|
||||
using osu.Game.Tests.Resources;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.Database;
|
||||
|
||||
namespace osu.Game.Tests.Beatmaps.IO
|
||||
{
|
||||
@ -53,7 +55,11 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
using (var osz = Resource.OpenResource("Beatmaps.241526 Soleily - Renatus.osz"))
|
||||
{
|
||||
var reader = new OszArchiveReader(osz);
|
||||
var meta = reader.ReadMetadata();
|
||||
|
||||
BeatmapMetadata meta;
|
||||
using (var stream = new StreamReader(reader.GetStream("Soleily - Renatus (Deif) [Platter].osu")))
|
||||
meta = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata;
|
||||
|
||||
Assert.AreEqual(241526, meta.OnlineBeatmapSetID);
|
||||
Assert.AreEqual("Soleily", meta.Artist);
|
||||
Assert.AreEqual("Soleily", meta.ArtistUnicode);
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -13,13 +13,13 @@ namespace osu.Game.Beatmaps.Formats
|
||||
{
|
||||
private static Dictionary<string, Type> decoders { get; } = new Dictionary<string, Type>();
|
||||
|
||||
public static BeatmapDecoder GetDecoder(TextReader stream)
|
||||
public static BeatmapDecoder GetDecoder(StreamReader stream)
|
||||
{
|
||||
var line = stream.ReadLine()?.Trim();
|
||||
string line = stream.ReadLine()?.Trim();
|
||||
|
||||
if (line == null || !decoders.ContainsKey(line))
|
||||
throw new IOException(@"Unknown file format");
|
||||
return (BeatmapDecoder)Activator.CreateInstance(decoders[line]);
|
||||
return (BeatmapDecoder)Activator.CreateInstance(decoders[line], line);
|
||||
}
|
||||
|
||||
protected static void AddDecoder<T>(string magic) where T : BeatmapDecoder
|
||||
@ -27,17 +27,17 @@ namespace osu.Game.Beatmaps.Formats
|
||||
decoders[magic] = typeof(T);
|
||||
}
|
||||
|
||||
public virtual Beatmap Decode(TextReader stream)
|
||||
public virtual Beatmap Decode(StreamReader stream)
|
||||
{
|
||||
return ParseFile(stream);
|
||||
}
|
||||
|
||||
public virtual void Decode(TextReader stream, Beatmap beatmap)
|
||||
public virtual void Decode(StreamReader stream, Beatmap beatmap)
|
||||
{
|
||||
ParseFile(stream, beatmap);
|
||||
}
|
||||
|
||||
protected virtual Beatmap ParseFile(TextReader stream)
|
||||
protected virtual Beatmap ParseFile(StreamReader stream)
|
||||
{
|
||||
var beatmap = new Beatmap
|
||||
{
|
||||
@ -48,9 +48,11 @@ namespace osu.Game.Beatmaps.Formats
|
||||
Difficulty = new BeatmapDifficulty(),
|
||||
},
|
||||
};
|
||||
|
||||
ParseFile(stream, beatmap);
|
||||
return beatmap;
|
||||
}
|
||||
protected abstract void ParseFile(TextReader stream, Beatmap beatmap);
|
||||
|
||||
protected abstract void ParseFile(StreamReader stream, Beatmap beatmap);
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +0,0 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace osu.Game.Beatmaps.Formats
|
||||
{
|
||||
public class ConstructableBeatmapDecoder : BeatmapDecoder
|
||||
{
|
||||
protected override void ParseFile(TextReader stream, Beatmap beatmap)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -31,6 +31,17 @@ namespace osu.Game.Beatmaps.Formats
|
||||
// TODO: Not sure how far back to go, or differences between versions
|
||||
}
|
||||
|
||||
private readonly int beatmapVersion;
|
||||
|
||||
public OsuLegacyDecoder()
|
||||
{
|
||||
}
|
||||
|
||||
public OsuLegacyDecoder(string header)
|
||||
{
|
||||
beatmapVersion = int.Parse(header.Substring(17));
|
||||
}
|
||||
|
||||
private enum Section
|
||||
{
|
||||
None,
|
||||
@ -246,32 +257,36 @@ namespace osu.Game.Beatmaps.Formats
|
||||
}
|
||||
}
|
||||
|
||||
protected override Beatmap ParseFile(TextReader stream)
|
||||
protected override Beatmap ParseFile(StreamReader stream)
|
||||
{
|
||||
return new LegacyBeatmap(base.ParseFile(stream));
|
||||
}
|
||||
|
||||
public override Beatmap Decode(TextReader stream)
|
||||
public override Beatmap Decode(StreamReader stream)
|
||||
{
|
||||
return new LegacyBeatmap(base.Decode(stream));
|
||||
}
|
||||
|
||||
protected override void ParseFile(TextReader stream, Beatmap beatmap)
|
||||
protected override void ParseFile(StreamReader stream, Beatmap beatmap)
|
||||
{
|
||||
beatmap.BeatmapInfo.BeatmapVersion = beatmapVersion;
|
||||
|
||||
HitObjectParser parser = null;
|
||||
|
||||
Section section = Section.None;
|
||||
bool hasCustomColours = false;
|
||||
|
||||
var section = Section.None;
|
||||
while (true)
|
||||
string line;
|
||||
while ((line = stream.ReadLine()) != null)
|
||||
{
|
||||
var line = stream.ReadLine();
|
||||
if (line == null)
|
||||
break;
|
||||
if (string.IsNullOrEmpty(line))
|
||||
continue;
|
||||
|
||||
if (line.StartsWith(@"osu file format v"))
|
||||
{
|
||||
beatmap.BeatmapInfo.BeatmapVersion = int.Parse(line.Substring(17));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line.StartsWith(@"[") && line.EndsWith(@"]"))
|
||||
{
|
||||
|
@ -6,7 +6,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using osu.Framework.IO.Stores;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Database;
|
||||
|
||||
namespace osu.Game.Beatmaps.IO
|
||||
{
|
||||
@ -35,11 +34,6 @@ namespace osu.Game.Beatmaps.IO
|
||||
readers.Add(new Reader { Test = test, Type = typeof(T) });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the beatmap metadata from this archive.
|
||||
/// </summary>
|
||||
public abstract BeatmapMetadata ReadMetadata();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of beatmap file names.
|
||||
/// </summary>
|
||||
|
@ -5,7 +5,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using Ionic.Zip;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.Database;
|
||||
|
||||
namespace osu.Game.Beatmaps.IO
|
||||
{
|
||||
@ -23,23 +22,18 @@ namespace osu.Game.Beatmaps.IO
|
||||
|
||||
private readonly Stream archiveStream;
|
||||
private readonly ZipFile archive;
|
||||
private readonly Beatmap firstMap;
|
||||
|
||||
public OszArchiveReader(Stream archiveStream)
|
||||
{
|
||||
this.archiveStream = archiveStream;
|
||||
archive = ZipFile.Read(archiveStream);
|
||||
BeatmapFilenames = archive.Entries.Where(e => e.FileName.EndsWith(@".osu"))
|
||||
.Select(e => e.FileName).ToArray();
|
||||
|
||||
BeatmapFilenames = archive.Entries.Where(e => e.FileName.EndsWith(@".osu")).Select(e => e.FileName).ToArray();
|
||||
|
||||
if (BeatmapFilenames.Length == 0)
|
||||
throw new FileNotFoundException(@"This directory contains no beatmaps");
|
||||
StoryboardFilename = archive.Entries.Where(e => e.FileName.EndsWith(@".osb"))
|
||||
.Select(e => e.FileName).FirstOrDefault();
|
||||
using (var stream = new StreamReader(GetStream(BeatmapFilenames[0])))
|
||||
{
|
||||
var decoder = BeatmapDecoder.GetDecoder(stream);
|
||||
firstMap = decoder.Decode(stream);
|
||||
}
|
||||
|
||||
StoryboardFilename = archive.Entries.Where(e => e.FileName.EndsWith(@".osb")).Select(e => e.FileName).FirstOrDefault();
|
||||
}
|
||||
|
||||
public override Stream GetStream(string name)
|
||||
@ -50,11 +44,6 @@ namespace osu.Game.Beatmaps.IO
|
||||
return entry.OpenReader();
|
||||
}
|
||||
|
||||
public override BeatmapMetadata ReadMetadata()
|
||||
{
|
||||
return firstMap.BeatmapInfo.Metadata;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
archive.Dispose();
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -175,7 +175,10 @@ namespace osu.Game.Database
|
||||
BeatmapMetadata metadata;
|
||||
|
||||
using (var reader = ArchiveReader.GetReader(storage, path))
|
||||
metadata = reader.ReadMetadata();
|
||||
{
|
||||
using (var stream = new StreamReader(reader.GetStream(reader.BeatmapFilenames[0])))
|
||||
metadata = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata;
|
||||
}
|
||||
|
||||
if (File.Exists(path)) // Not always the case, i.e. for LegacyFilesystemReader
|
||||
{
|
||||
|
@ -15,6 +15,8 @@ namespace osu.Game.Database
|
||||
[PrimaryKey, AutoIncrement]
|
||||
public int ID { get; set; }
|
||||
|
||||
public int BeatmapVersion;
|
||||
|
||||
public int? OnlineBeatmapID { get; set; }
|
||||
|
||||
public int? OnlineBeatmapSetID { get; set; }
|
||||
|
@ -34,12 +34,14 @@ namespace osu.Game.Database
|
||||
using (var stream = new StreamReader(reader.GetStream(BeatmapInfo.Path)))
|
||||
{
|
||||
decoder = BeatmapDecoder.GetDecoder(stream);
|
||||
beatmap = decoder?.Decode(stream);
|
||||
beatmap = decoder.Decode(stream);
|
||||
}
|
||||
|
||||
if (WithStoryboard && beatmap != null && BeatmapSetInfo.StoryboardFile != null)
|
||||
using (var stream = new StreamReader(reader.GetStream(BeatmapSetInfo.StoryboardFile)))
|
||||
decoder.Decode(stream, beatmap);
|
||||
if (beatmap == null || !WithStoryboard || BeatmapSetInfo.StoryboardFile == null)
|
||||
return beatmap;
|
||||
|
||||
using (var stream = new StreamReader(reader.GetStream(BeatmapSetInfo.StoryboardFile)))
|
||||
decoder.Decode(stream, beatmap);
|
||||
}
|
||||
|
||||
return beatmap;
|
||||
|
@ -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();
|
||||
|
@ -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,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
bgm.Start();
|
||||
|
||||
(mainMenu = new MainMenu()).LoadAsync(Game);
|
||||
LoadComponentAsync(mainMenu = new MainMenu());
|
||||
|
||||
Scheduler.AddDelayed(delegate
|
||||
{
|
||||
|
@ -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()
|
||||
|
@ -64,7 +64,7 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
var beatmap = Beatmap.Beatmap;
|
||||
|
||||
if (beatmap.BeatmapInfo?.Mode > PlayMode.Osu)
|
||||
if (beatmap.BeatmapInfo?.Mode > PlayMode.Taiko)
|
||||
{
|
||||
//we only support osu! mode for now because the hitobject parsing is crappy and needs a refactor.
|
||||
Exit();
|
||||
@ -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;
|
||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Screens.Play
|
||||
Origin = Anchor.Centre,
|
||||
});
|
||||
|
||||
player.LoadAsync(Game);
|
||||
LoadComponentAsync(player);
|
||||
}
|
||||
|
||||
protected override void OnEntering(Screen last)
|
||||
|
@ -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,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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),
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
@ -142,7 +142,6 @@
|
||||
<Compile Include="Overlays\LoginOverlay.cs" />
|
||||
<Compile Include="Overlays\MusicController.cs" />
|
||||
<Compile Include="Beatmaps\Beatmap.cs" />
|
||||
<Compile Include="Beatmaps\Formats\ConstructableBeatmapDecoder.cs" />
|
||||
<Compile Include="Beatmaps\WorkingBeatmap.cs" />
|
||||
<Compile Include="Beatmaps\Drawables\BeatmapSetHeader.cs" />
|
||||
<Compile Include="Beatmaps\Drawables\DifficultyIcon.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user