mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 23:12:55 +08:00
commit
96f814db6c
@ -8,9 +8,8 @@ using osu.Game.Modes.Taiko.Objects;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Beatmaps.Legacy;
|
|
||||||
using osu.Game.Beatmaps.Timing;
|
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
using osu.Game.IO.Serialization;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Taiko.Beatmaps
|
namespace osu.Game.Modes.Taiko.Beatmaps
|
||||||
@ -41,9 +40,12 @@ namespace osu.Game.Modes.Taiko.Beatmaps
|
|||||||
|
|
||||||
public Beatmap<TaikoHitObject> Convert(Beatmap original)
|
public Beatmap<TaikoHitObject> Convert(Beatmap original)
|
||||||
{
|
{
|
||||||
|
BeatmapInfo info = original.BeatmapInfo.DeepClone<BeatmapInfo>();
|
||||||
|
info.Difficulty.SliderMultiplier *= legacy_velocity_multiplier;
|
||||||
|
|
||||||
return new Beatmap<TaikoHitObject>(original)
|
return new Beatmap<TaikoHitObject>(original)
|
||||||
{
|
{
|
||||||
TimingInfo = original is LegacyBeatmap ? new LegacyTimingInfo(original.TimingInfo) : original.TimingInfo,
|
BeatmapInfo = info,
|
||||||
HitObjects = original.HitObjects.SelectMany(h => convertHitObject(h, original)).ToList()
|
HitObjects = original.HitObjects.SelectMany(h => convertHitObject(h, original)).ToList()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -75,7 +77,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps
|
|||||||
double distance = distanceData.Distance * repeats * legacy_velocity_multiplier;
|
double distance = distanceData.Distance * repeats * legacy_velocity_multiplier;
|
||||||
|
|
||||||
// The velocity of the taiko hit object - calculated as the velocity of a drum roll
|
// 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;
|
double taikoVelocity = taiko_base_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier * legacy_velocity_multiplier / speedAdjustedBeatLength;
|
||||||
// The duration of the taiko hit object
|
// The duration of the taiko hit object
|
||||||
double taikoDuration = distance / taikoVelocity;
|
double taikoDuration = distance / taikoVelocity;
|
||||||
|
|
||||||
@ -85,7 +87,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps
|
|||||||
speedAdjustedBeatLength /= speedAdjustment;
|
speedAdjustedBeatLength /= speedAdjustment;
|
||||||
|
|
||||||
// The velocity of the osu! hit object - calculated as the velocity of a slider
|
// 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;
|
double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier * legacy_velocity_multiplier / speedAdjustedBeatLength;
|
||||||
// The duration of the osu! hit object
|
// The duration of the osu! hit object
|
||||||
double osuDuration = distance / osuVelocity;
|
double osuDuration = distance / osuVelocity;
|
||||||
|
|
||||||
@ -155,21 +157,5 @@ namespace osu.Game.Modes.Taiko.Beatmaps
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class LegacyTimingInfo : TimingInfo
|
|
||||||
{
|
|
||||||
public LegacyTimingInfo(TimingInfo original)
|
|
||||||
{
|
|
||||||
if (original is LegacyTimingInfo)
|
|
||||||
ControlPoints.AddRange(original.ControlPoints);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ControlPoints.AddRange(original.ControlPoints.Select(c => c.Clone()));
|
|
||||||
|
|
||||||
foreach (var c in ControlPoints)
|
|
||||||
c.SpeedMultiplier *= legacy_velocity_multiplier;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@ namespace osu.Game.Modes.Taiko.Judgements
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public override string MaxResultString => string.Empty;
|
public override string MaxResultString => string.Empty;
|
||||||
|
|
||||||
|
public override bool AffectsCombo => false;
|
||||||
|
|
||||||
protected override int NumericResultForScore(TaikoHitResult result)
|
protected override int NumericResultForScore(TaikoHitResult result)
|
||||||
{
|
{
|
||||||
switch (result)
|
switch (result)
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using osu.Game.Modes.Judgements;
|
using osu.Game.Modes.Judgements;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Taiko.Judgements
|
namespace osu.Game.Modes.Taiko.Judgements
|
||||||
{
|
{
|
||||||
@ -21,12 +22,12 @@ namespace osu.Game.Modes.Taiko.Judgements
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The result value for the combo portion of the score.
|
/// The result value for the combo portion of the score.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int ResultValueForScore => NumericResultForScore(TaikoResult);
|
public int ResultValueForScore => Result == HitResult.Miss ? 0 : NumericResultForScore(TaikoResult);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The result value for the accuracy portion of the score.
|
/// The result value for the accuracy portion of the score.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int ResultValueForAccuracy => NumericResultForAccuracy(TaikoResult);
|
public int ResultValueForAccuracy => Result == HitResult.Miss ? 0 : NumericResultForAccuracy(TaikoResult);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The maximum result value for the combo portion of the score.
|
/// The maximum result value for the combo portion of the score.
|
||||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Modes.Taiko.Objects
|
|||||||
{
|
{
|
||||||
base.ApplyDefaults(timing, difficulty);
|
base.ApplyDefaults(timing, difficulty);
|
||||||
|
|
||||||
ScrollTime = scroll_time * (timing.BeatLengthAt(StartTime) / 1000) / (difficulty.SliderMultiplier * timing.SpeedMultiplierAt(StartTime));
|
ScrollTime = scroll_time * (timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / 1000) / difficulty.SliderMultiplier;
|
||||||
|
|
||||||
ControlPoint overridePoint;
|
ControlPoint overridePoint;
|
||||||
Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode;
|
Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode;
|
||||||
|
@ -187,10 +187,6 @@ namespace osu.Game.Modes.Taiko.Scoring
|
|||||||
if (!isTick)
|
if (!isTick)
|
||||||
totalHits++;
|
totalHits++;
|
||||||
|
|
||||||
// Apply combo changes, must be done before the hit score is added
|
|
||||||
if (!isTick && judgement.Result == HitResult.Hit)
|
|
||||||
Combo.Value++;
|
|
||||||
|
|
||||||
// Apply score changes
|
// Apply score changes
|
||||||
addHitScore(judgement);
|
addHitScore(judgement);
|
||||||
|
|
||||||
@ -261,7 +257,7 @@ namespace osu.Game.Modes.Taiko.Scoring
|
|||||||
foreach (var j in Judgements)
|
foreach (var j in Judgements)
|
||||||
{
|
{
|
||||||
scoreForAccuracy += j.ResultValueForAccuracy;
|
scoreForAccuracy += j.ResultValueForAccuracy;
|
||||||
maxScoreForAccuracy = j.MaxResultValueForAccuracy;
|
maxScoreForAccuracy += j.MaxResultValueForAccuracy;
|
||||||
}
|
}
|
||||||
|
|
||||||
Accuracy.Value = (double)scoreForAccuracy / maxScoreForAccuracy;
|
Accuracy.Value = (double)scoreForAccuracy / maxScoreForAccuracy;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using osu.Game.IO.Serialization;
|
||||||
using osu.Game.Modes;
|
using osu.Game.Modes;
|
||||||
using SQLite.Net.Attributes;
|
using SQLite.Net.Attributes;
|
||||||
using SQLiteNetExtensions.Attributes;
|
using SQLiteNetExtensions.Attributes;
|
||||||
@ -9,7 +11,7 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace osu.Game.Database
|
namespace osu.Game.Database
|
||||||
{
|
{
|
||||||
public class BeatmapInfo : IEquatable<BeatmapInfo>
|
public class BeatmapInfo : IEquatable<BeatmapInfo>, IJsonSerializable
|
||||||
{
|
{
|
||||||
[PrimaryKey, AutoIncrement]
|
[PrimaryKey, AutoIncrement]
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
@ -55,17 +57,13 @@ namespace osu.Game.Database
|
|||||||
// Editor
|
// Editor
|
||||||
// This bookmarks stuff is necessary because DB doesn't know how to store int[]
|
// This bookmarks stuff is necessary because DB doesn't know how to store int[]
|
||||||
public string StoredBookmarks { get; internal set; }
|
public string StoredBookmarks { get; internal set; }
|
||||||
|
|
||||||
[Ignore]
|
[Ignore]
|
||||||
|
[JsonIgnore]
|
||||||
public int[] Bookmarks
|
public int[] Bookmarks
|
||||||
{
|
{
|
||||||
get
|
get { return StoredBookmarks.Split(',').Select(int.Parse).ToArray(); }
|
||||||
{
|
set { StoredBookmarks = string.Join(",", value); }
|
||||||
return StoredBookmarks.Split(',').Select(int.Parse).ToArray();
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
StoredBookmarks = string.Join(",", value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double DistanceSpacing { get; set; }
|
public double DistanceSpacing { get; set; }
|
||||||
|
29
osu.Game/IO/Serialization/IJsonSerializable.cs
Normal file
29
osu.Game/IO/Serialization/IJsonSerializable.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace osu.Game.IO.Serialization
|
||||||
|
{
|
||||||
|
public interface IJsonSerializable
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class JsonSerializableExtensions
|
||||||
|
{
|
||||||
|
public static string Serialize(this IJsonSerializable obj)
|
||||||
|
{
|
||||||
|
return JsonConvert.SerializeObject(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static T Deserialize<T>(string objString)
|
||||||
|
{
|
||||||
|
return JsonConvert.DeserializeObject<T>(objString);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static T DeepClone<T>(this IJsonSerializable obj)
|
||||||
|
{
|
||||||
|
return Deserialize<T>(Serialize(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -17,10 +17,7 @@ namespace osu.Game.Modes.Judgements
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public double TimeOffset;
|
public double TimeOffset;
|
||||||
|
|
||||||
/// <summary>
|
public virtual bool AffectsCombo => true;
|
||||||
/// The combo after this judgement was processed.
|
|
||||||
/// </summary>
|
|
||||||
public int ComboAtHit;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The string representation for the result achieved.
|
/// The string representation for the result achieved.
|
||||||
|
@ -8,6 +8,7 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Modes.Judgements;
|
using osu.Game.Modes.Judgements;
|
||||||
using osu.Game.Modes.Objects;
|
using osu.Game.Modes.Objects;
|
||||||
using osu.Game.Modes.UI;
|
using osu.Game.Modes.UI;
|
||||||
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Scoring
|
namespace osu.Game.Modes.Scoring
|
||||||
{
|
{
|
||||||
@ -145,10 +146,21 @@ namespace osu.Game.Modes.Scoring
|
|||||||
|
|
||||||
if (!exists)
|
if (!exists)
|
||||||
{
|
{
|
||||||
|
if (judgement.AffectsCombo)
|
||||||
|
{
|
||||||
|
switch (judgement.Result)
|
||||||
|
{
|
||||||
|
case HitResult.Miss:
|
||||||
|
Combo.Value = 0;
|
||||||
|
break;
|
||||||
|
case HitResult.Hit:
|
||||||
|
Combo.Value++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Judgements.Add(judgement);
|
Judgements.Add(judgement);
|
||||||
OnNewJudgement(judgement);
|
OnNewJudgement(judgement);
|
||||||
|
|
||||||
judgement.ComboAtHit = Combo.Value;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
OnJudgementChanged(judgement);
|
OnJudgementChanged(judgement);
|
||||||
|
@ -98,6 +98,7 @@
|
|||||||
<Compile Include="IO\Legacy\ILegacySerializable.cs" />
|
<Compile Include="IO\Legacy\ILegacySerializable.cs" />
|
||||||
<Compile Include="IO\Legacy\SerializationReader.cs" />
|
<Compile Include="IO\Legacy\SerializationReader.cs" />
|
||||||
<Compile Include="IO\Legacy\SerializationWriter.cs" />
|
<Compile Include="IO\Legacy\SerializationWriter.cs" />
|
||||||
|
<Compile Include="IO\Serialization\IJsonSerializable.cs" />
|
||||||
<Compile Include="IPC\ScoreIPCChannel.cs" />
|
<Compile Include="IPC\ScoreIPCChannel.cs" />
|
||||||
<Compile Include="Modes\Replays\Replay.cs" />
|
<Compile Include="Modes\Replays\Replay.cs" />
|
||||||
<Compile Include="Modes\Judgements\DrawableJudgement.cs" />
|
<Compile Include="Modes\Judgements\DrawableJudgement.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user