mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 13:22:55 +08:00
Merge branch 'master' into multiplayer-base-screen
This commit is contained in:
commit
7c9d3c9742
13
osu.Game.Rulesets.Mania/Judgements/HoldNoteJudgement.cs
Normal file
13
osu.Game.Rulesets.Mania/Judgements/HoldNoteJudgement.cs
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Judgements
|
||||
{
|
||||
public class HoldNoteJudgement : ManiaJudgement
|
||||
{
|
||||
public override bool AffectsCombo => false;
|
||||
protected override int NumericResultFor(HitResult result) => 0;
|
||||
}
|
||||
}
|
@ -99,6 +99,19 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case ArmedState.Hit:
|
||||
// Good enough for now, we just want them to have a lifetime end
|
||||
this.Delay(2000).Expire();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
|
||||
{
|
||||
if (tail.AllJudged)
|
||||
AddJudgement(new HoldNoteJudgement { Result = HitResult.Perfect });
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
|
@ -11,7 +11,7 @@ using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Scoring
|
||||
namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
{
|
||||
public class OsuPerformanceCalculator : PerformanceCalculator
|
||||
{
|
@ -12,7 +12,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.Osu.Scoring;
|
||||
using osu.Game.Rulesets.Osu.Edit;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Osu.Replays;
|
||||
|
@ -8,7 +8,6 @@ using osu.Game.Rulesets.Taiko.Objects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.IO.Serialization;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
|
||||
@ -51,8 +50,9 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
|
||||
protected override Beatmap<TaikoHitObject> ConvertBeatmap(IBeatmap original)
|
||||
{
|
||||
// Rewrite the beatmap info to add the slider velocity multiplier
|
||||
BeatmapInfo info = original.BeatmapInfo.DeepClone();
|
||||
info.BaseDifficulty.SliderMultiplier *= legacy_velocity_multiplier;
|
||||
original.BeatmapInfo = original.BeatmapInfo.Clone();
|
||||
original.BeatmapInfo.BaseDifficulty = original.BeatmapInfo.BaseDifficulty.Clone();
|
||||
original.BeatmapInfo.BaseDifficulty.SliderMultiplier *= legacy_velocity_multiplier;
|
||||
|
||||
Beatmap<TaikoHitObject> converted = base.ConvertBeatmap(original);
|
||||
|
||||
|
@ -6,7 +6,6 @@ using osu.Game.Rulesets.Objects;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.IO.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.IO.Serialization.Converters;
|
||||
|
||||
@ -55,17 +54,11 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
IBeatmap IBeatmap.Clone() => Clone();
|
||||
|
||||
public Beatmap<T> Clone()
|
||||
{
|
||||
var newInstance = (Beatmap<T>)MemberwiseClone();
|
||||
newInstance.BeatmapInfo = BeatmapInfo.DeepClone();
|
||||
|
||||
return newInstance;
|
||||
}
|
||||
public Beatmap<T> Clone() => (Beatmap<T>)MemberwiseClone();
|
||||
}
|
||||
|
||||
public class Beatmap : Beatmap<HitObject>
|
||||
{
|
||||
public Beatmap Clone() => (Beatmap)base.Clone();
|
||||
public new Beatmap Clone() => (Beatmap)base.Clone();
|
||||
}
|
||||
}
|
||||
|
@ -53,8 +53,6 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
var beatmap = CreateBeatmap();
|
||||
|
||||
// todo: this *must* share logic (or directly use) Beatmap<T>'s constructor.
|
||||
// right now this isn't easily possible due to generic entanglement.
|
||||
beatmap.BeatmapInfo = original.BeatmapInfo;
|
||||
beatmap.ControlPointInfo = original.ControlPointInfo;
|
||||
beatmap.HitObjects = original.HitObjects.SelectMany(h => convert(h, original)).ToList();
|
||||
|
@ -32,6 +32,11 @@ namespace osu.Game.Beatmaps
|
||||
public double SliderMultiplier { get; set; } = 1;
|
||||
public double SliderTickRate { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Returns a shallow-clone of this <see cref="BeatmapDifficulty"/>.
|
||||
/// </summary>
|
||||
public BeatmapDifficulty Clone() => (BeatmapDifficulty)MemberwiseClone();
|
||||
|
||||
/// <summary>
|
||||
/// Maps a difficulty value [0, 10] to a two-piece linear range of values.
|
||||
/// </summary>
|
||||
|
@ -143,5 +143,10 @@ namespace osu.Game.Beatmaps
|
||||
public bool BackgroundEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null &&
|
||||
BeatmapSet.Hash == other.BeatmapSet.Hash &&
|
||||
(Metadata ?? BeatmapSet.Metadata).BackgroundFile == (other.Metadata ?? other.BeatmapSet.Metadata).BackgroundFile;
|
||||
|
||||
/// <summary>
|
||||
/// Returns a shallow-clone of this <see cref="BeatmapInfo"/>.
|
||||
/// </summary>
|
||||
public BeatmapInfo Clone() => (BeatmapInfo)MemberwiseClone();
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,6 @@ namespace osu.Game.IO.Serialization
|
||||
|
||||
public static void DeserializeInto<T>(this string objString, T target) => JsonConvert.PopulateObject(objString, target, CreateGlobalSettings());
|
||||
|
||||
public static T DeepClone<T>(this T obj) where T : IJsonSerializable => Deserialize<T>(Serialize(obj));
|
||||
|
||||
/// <summary>
|
||||
/// Creates the default <see cref="JsonSerializerSettings"/> that should be used for all <see cref="IJsonSerializable"/>s.
|
||||
/// </summary>
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
@ -56,10 +57,10 @@ namespace osu.Game.Rulesets.Objects
|
||||
/// </summary>
|
||||
public HitWindows HitWindows { get; set; }
|
||||
|
||||
private readonly SortedList<HitObject> nestedHitObjects = new SortedList<HitObject>((h1, h2) => h1.StartTime.CompareTo(h2.StartTime));
|
||||
private readonly Lazy<SortedList<HitObject>> nestedHitObjects = new Lazy<SortedList<HitObject>>(() => new SortedList<HitObject>((h1, h2) => h1.StartTime.CompareTo(h2.StartTime)));
|
||||
|
||||
[JsonIgnore]
|
||||
public IReadOnlyList<HitObject> NestedHitObjects => nestedHitObjects;
|
||||
public IReadOnlyList<HitObject> NestedHitObjects => nestedHitObjects.Value;
|
||||
|
||||
/// <summary>
|
||||
/// Applies default values to this HitObject.
|
||||
@ -70,13 +71,19 @@ namespace osu.Game.Rulesets.Objects
|
||||
{
|
||||
ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
||||
|
||||
nestedHitObjects.Clear();
|
||||
if (nestedHitObjects.IsValueCreated)
|
||||
nestedHitObjects.Value.Clear();
|
||||
|
||||
CreateNestedHitObjects();
|
||||
nestedHitObjects.ForEach(h =>
|
||||
|
||||
if (nestedHitObjects.IsValueCreated)
|
||||
{
|
||||
h.HitWindows = HitWindows;
|
||||
h.ApplyDefaults(controlPointInfo, difficulty);
|
||||
});
|
||||
nestedHitObjects.Value.ForEach(h =>
|
||||
{
|
||||
h.HitWindows = HitWindows;
|
||||
h.ApplyDefaults(controlPointInfo, difficulty);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
||||
@ -96,7 +103,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
{
|
||||
}
|
||||
|
||||
protected void AddNested(HitObject hitObject) => nestedHitObjects.Add(hitObject);
|
||||
protected void AddNested(HitObject hitObject) => nestedHitObjects.Value.Add(hitObject);
|
||||
|
||||
/// <summary>
|
||||
/// Creates the <see cref="HitWindows"/> for this <see cref="HitObject"/>.
|
||||
|
@ -8,7 +8,6 @@ using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Lists;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.IO.Serialization;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Rulesets.Timing;
|
||||
@ -104,7 +103,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
if (index < 0)
|
||||
return new MultiplierControlPoint(time);
|
||||
|
||||
return new MultiplierControlPoint(time, DefaultControlPoints[index].DeepClone());
|
||||
return new MultiplierControlPoint(time, DefaultControlPoints[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user