mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 12:45:09 +08:00
Merge remote-tracking branch 'upstream/master' into letterboxing
This commit is contained in:
commit
74539b5e5c
@ -2,7 +2,6 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework;
|
||||
@ -77,10 +76,10 @@ namespace osu.Desktop.Updater
|
||||
switch (RuntimeInfo.OS)
|
||||
{
|
||||
case RuntimeInfo.Platform.Windows:
|
||||
bestAsset = release.Assets?.FirstOrDefault(f => f.Name.EndsWith(".exe"));
|
||||
bestAsset = release.Assets?.Find(f => f.Name.EndsWith(".exe"));
|
||||
break;
|
||||
case RuntimeInfo.Platform.MacOsx:
|
||||
bestAsset = release.Assets?.FirstOrDefault(f => f.Name.EndsWith(".app.zip"));
|
||||
bestAsset = release.Assets?.Find(f => f.Name.EndsWith(".app.zip"));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -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 osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
@ -23,60 +24,70 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
|
||||
|
||||
var osuBeatmap = (Beatmap<OsuHitObject>)Beatmap;
|
||||
|
||||
// Reset stacking
|
||||
foreach (var h in osuBeatmap.HitObjects)
|
||||
h.StackHeight = 0;
|
||||
if (osuBeatmap.HitObjects.Count > 0)
|
||||
{
|
||||
// Reset stacking
|
||||
foreach (var h in osuBeatmap.HitObjects)
|
||||
h.StackHeight = 0;
|
||||
|
||||
if (Beatmap.BeatmapInfo.BeatmapVersion >= 6)
|
||||
applyStacking(osuBeatmap);
|
||||
else
|
||||
applyStackingOld(osuBeatmap);
|
||||
if (Beatmap.BeatmapInfo.BeatmapVersion >= 6)
|
||||
applyStacking(osuBeatmap, 0, osuBeatmap.HitObjects.Count - 1);
|
||||
else
|
||||
applyStackingOld(osuBeatmap);
|
||||
}
|
||||
}
|
||||
|
||||
private void applyStacking(Beatmap<OsuHitObject> beatmap)
|
||||
private void applyStacking(Beatmap<OsuHitObject> beatmap, int startIndex, int endIndex)
|
||||
{
|
||||
// Extend the end index to include objects they are stacked on
|
||||
int extendedEndIndex = beatmap.HitObjects.Count - 1;
|
||||
for (int i = beatmap.HitObjects.Count - 1; i >= 0; i--)
|
||||
if (startIndex > endIndex) throw new ArgumentOutOfRangeException(nameof(startIndex), $"{nameof(startIndex)} cannot be greater than {nameof(endIndex)}.");
|
||||
if (startIndex < 0) throw new ArgumentOutOfRangeException(nameof(startIndex), $"{nameof(startIndex)} cannot be less than 0.");
|
||||
if (endIndex < 0) throw new ArgumentOutOfRangeException(nameof(endIndex), $"{nameof(endIndex)} cannot be less than 0.");
|
||||
|
||||
int extendedEndIndex = endIndex;
|
||||
if (endIndex < beatmap.HitObjects.Count - 1)
|
||||
{
|
||||
int stackBaseIndex = i;
|
||||
for (int n = stackBaseIndex + 1; n < beatmap.HitObjects.Count; n++)
|
||||
// Extend the end index to include objects they are stacked on
|
||||
for (int i = endIndex; i >= startIndex; i--)
|
||||
{
|
||||
OsuHitObject stackBaseObject = beatmap.HitObjects[stackBaseIndex];
|
||||
if (stackBaseObject is Spinner) break;
|
||||
|
||||
OsuHitObject objectN = beatmap.HitObjects[n];
|
||||
if (objectN is Spinner)
|
||||
continue;
|
||||
|
||||
double endTime = (stackBaseObject as IHasEndTime)?.EndTime ?? stackBaseObject.StartTime;
|
||||
double stackThreshold = objectN.TimePreempt * beatmap.BeatmapInfo.StackLeniency;
|
||||
|
||||
if (objectN.StartTime - endTime > stackThreshold)
|
||||
//We are no longer within stacking range of the next object.
|
||||
break;
|
||||
|
||||
if (Vector2Extensions.Distance(stackBaseObject.Position, objectN.Position) < stack_distance ||
|
||||
stackBaseObject is Slider && Vector2Extensions.Distance(stackBaseObject.EndPosition, objectN.Position) < stack_distance)
|
||||
int stackBaseIndex = i;
|
||||
for (int n = stackBaseIndex + 1; n < beatmap.HitObjects.Count; n++)
|
||||
{
|
||||
stackBaseIndex = n;
|
||||
OsuHitObject stackBaseObject = beatmap.HitObjects[stackBaseIndex];
|
||||
if (stackBaseObject is Spinner) break;
|
||||
|
||||
// HitObjects after the specified update range haven't been reset yet
|
||||
objectN.StackHeight = 0;
|
||||
OsuHitObject objectN = beatmap.HitObjects[n];
|
||||
if (objectN is Spinner)
|
||||
continue;
|
||||
|
||||
double endTime = (stackBaseObject as IHasEndTime)?.EndTime ?? stackBaseObject.StartTime;
|
||||
double stackThreshold = objectN.TimePreempt * beatmap.BeatmapInfo.StackLeniency;
|
||||
|
||||
if (objectN.StartTime - endTime > stackThreshold)
|
||||
//We are no longer within stacking range of the next object.
|
||||
break;
|
||||
|
||||
if (Vector2Extensions.Distance(stackBaseObject.Position, objectN.Position) < stack_distance
|
||||
|| stackBaseObject is Slider && Vector2Extensions.Distance(stackBaseObject.EndPosition, objectN.Position) < stack_distance)
|
||||
{
|
||||
stackBaseIndex = n;
|
||||
|
||||
// HitObjects after the specified update range haven't been reset yet
|
||||
objectN.StackHeight = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (stackBaseIndex > extendedEndIndex)
|
||||
{
|
||||
extendedEndIndex = stackBaseIndex;
|
||||
if (extendedEndIndex == beatmap.HitObjects.Count - 1)
|
||||
break;
|
||||
if (stackBaseIndex > extendedEndIndex)
|
||||
{
|
||||
extendedEndIndex = stackBaseIndex;
|
||||
if (extendedEndIndex == beatmap.HitObjects.Count - 1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Reverse pass for stack calculation.
|
||||
int extendedStartIndex = 0;
|
||||
for (int i = extendedEndIndex; i > 0; i--)
|
||||
int extendedStartIndex = startIndex;
|
||||
for (int i = extendedEndIndex; i > startIndex; i--)
|
||||
{
|
||||
int n = i;
|
||||
/* We should check every note which has not yet got a stack.
|
||||
@ -155,7 +166,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
|
||||
/* We have hit the first slider in a possible stack.
|
||||
* From this point on, we ALWAYS stack positive regardless.
|
||||
*/
|
||||
while (--n >= 0)
|
||||
while (--n >= startIndex)
|
||||
{
|
||||
OsuHitObject objectN = beatmap.HitObjects[n];
|
||||
if (objectN is Spinner) continue;
|
||||
|
@ -215,7 +215,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
var distanceProgress = d / length;
|
||||
var timeProgress = reversed ? 1 - distanceProgress : distanceProgress;
|
||||
|
||||
var firstSample = Samples.FirstOrDefault(s => s.Name == SampleInfo.HIT_NORMAL)
|
||||
var firstSample = Samples.Find(s => s.Name == SampleInfo.HIT_NORMAL)
|
||||
?? Samples.FirstOrDefault(); // TODO: remove this when guaranteed sort is present for samples (https://github.com/ppy/osu/issues/1933)
|
||||
var sampleList = new List<SampleInfo>();
|
||||
|
||||
|
@ -135,7 +135,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
{
|
||||
if (userTriggered)
|
||||
{
|
||||
var nextTick = ticks.FirstOrDefault(j => !j.IsHit);
|
||||
var nextTick = ticks.Find(j => !j.IsHit);
|
||||
|
||||
nextTick?.TriggerResult(HitResult.Great);
|
||||
|
||||
|
@ -148,7 +148,7 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
private bool selectedBeatmapVisible()
|
||||
{
|
||||
var currentlySelected = carousel.Items.FirstOrDefault(s => s.Item is CarouselBeatmap && s.Item.State == CarouselItemState.Selected);
|
||||
var currentlySelected = carousel.Items.Find(s => s.Item is CarouselBeatmap && s.Item.State == CarouselItemState.Selected);
|
||||
if (currentlySelected == null)
|
||||
return true;
|
||||
return currentlySelected.Item.Visible;
|
||||
|
@ -49,7 +49,6 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
manager.UnreadCount.ValueChanged += count => { displayedCount.Text = $"displayed count: {count}"; };
|
||||
|
||||
|
||||
setState(Visibility.Visible);
|
||||
AddStep(@"simple #1", sendHelloNotification);
|
||||
AddStep(@"simple #2", sendAmazingNotification);
|
||||
@ -75,7 +74,6 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
checkProgressingCount(0);
|
||||
|
||||
|
||||
setState(Visibility.Visible);
|
||||
|
||||
//AddStep(@"barrage", () => sendBarrage());
|
||||
@ -111,7 +109,7 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
if (progressingNotifications.Count(n => n.State == ProgressNotificationState.Active) < 3)
|
||||
{
|
||||
var p = progressingNotifications.FirstOrDefault(n => n.State == ProgressNotificationState.Queued);
|
||||
var p = progressingNotifications.Find(n => n.State == ProgressNotificationState.Queued);
|
||||
if (p != null)
|
||||
p.State = ProgressNotificationState.Active;
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Play;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
@ -23,7 +22,7 @@ namespace osu.Game.Tests.Visual
|
||||
// Reset the mods
|
||||
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Where(m => !(m is ModAutoplay));
|
||||
|
||||
return new ReplayPlayer(new Score { Replay = dummyRulesetContainer.Replay });
|
||||
return new ReplayPlayer(dummyRulesetContainer.ReplayScore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public string Hash { get; set; }
|
||||
|
||||
public string StoryboardFile => Files?.FirstOrDefault(f => f.Filename.EndsWith(".osb"))?.Filename;
|
||||
public string StoryboardFile => Files?.Find(f => f.Filename.EndsWith(".osb"))?.Filename;
|
||||
|
||||
public List<BeatmapSetFileInfo> Files { get; set; }
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Game.Rulesets;
|
||||
|
||||
@ -43,7 +42,7 @@ namespace osu.Game.Configuration
|
||||
{
|
||||
base.AddBindable(lookup, bindable);
|
||||
|
||||
var setting = databasedSettings.FirstOrDefault(s => (int)s.Key == (int)(object)lookup);
|
||||
var setting = databasedSettings.Find(s => (int)s.Key == (int)(object)lookup);
|
||||
if (setting != null)
|
||||
{
|
||||
bindable.Parse(setting.Value);
|
||||
|
@ -224,7 +224,7 @@ namespace osu.Game
|
||||
var databasedSet = BeatmapManager.QueryBeatmapSet(s => s.OnlineBeatmapSetID == beatmap.OnlineBeatmapSetID);
|
||||
|
||||
// Use first beatmap available for current ruleset, else switch ruleset.
|
||||
var first = databasedSet.Beatmaps.FirstOrDefault(b => b.Ruleset == ruleset.Value) ?? databasedSet.Beatmaps.First();
|
||||
var first = databasedSet.Beatmaps.Find(b => b.Ruleset == ruleset.Value) ?? databasedSet.Beatmaps.First();
|
||||
|
||||
ruleset.Value = first.Ruleset;
|
||||
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(first);
|
||||
|
@ -1,20 +0,0 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Settings
|
||||
{
|
||||
public class SettingsLabel : SettingsItem<string>
|
||||
{
|
||||
protected override Drawable CreateControl() => null;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colour)
|
||||
{
|
||||
Colour = colour.Gray6;
|
||||
}
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
|
||||
public override bool HasImplementation => GetType().GenericTypeArguments.Length == 0;
|
||||
|
||||
public virtual void ApplyToRulesetContainer(RulesetContainer<T> rulesetContainer) => rulesetContainer.SetReplay(CreateReplayScore(rulesetContainer.Beatmap)?.Replay);
|
||||
public virtual void ApplyToRulesetContainer(RulesetContainer<T> rulesetContainer) => rulesetContainer.SetReplayScore(CreateReplayScore(rulesetContainer.Beatmap));
|
||||
}
|
||||
|
||||
public abstract class ModAutoplay : Mod, IApplicableFailOverride
|
||||
|
@ -22,6 +22,7 @@ using osu.Game.Overlays;
|
||||
using osu.Game.Replays;
|
||||
using osu.Game.Rulesets.Configuration;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
@ -130,7 +131,7 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
protected virtual ReplayInputHandler CreateReplayInputHandler(Replay replay) => null;
|
||||
|
||||
public Replay Replay { get; private set; }
|
||||
public Score ReplayScore { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the game is paused. Used to block user input.
|
||||
@ -140,14 +141,14 @@ namespace osu.Game.Rulesets.UI
|
||||
/// <summary>
|
||||
/// Sets a replay to be used, overriding local input.
|
||||
/// </summary>
|
||||
/// <param name="replay">The replay, null for local input.</param>
|
||||
public virtual void SetReplay(Replay replay)
|
||||
/// <param name="replayScore">The replay, null for local input.</param>
|
||||
public virtual void SetReplayScore(Score replayScore)
|
||||
{
|
||||
if (ReplayInputManager == null)
|
||||
throw new InvalidOperationException($"A {nameof(KeyBindingInputManager)} which supports replay loading is not available");
|
||||
|
||||
Replay = replay;
|
||||
ReplayInputManager.ReplayInputHandler = replay != null ? CreateReplayInputHandler(replay) : null;
|
||||
ReplayScore = replayScore;
|
||||
ReplayInputManager.ReplayInputHandler = replayScore != null ? CreateReplayInputHandler(replayScore.Replay) : null;
|
||||
|
||||
HasReplayLoaded.Value = ReplayInputManager.ReplayInputHandler != null;
|
||||
}
|
||||
@ -302,9 +303,9 @@ namespace osu.Game.Rulesets.UI
|
||||
mod.ReadFromConfig(config);
|
||||
}
|
||||
|
||||
public override void SetReplay(Replay replay)
|
||||
public override void SetReplayScore(Score replayScore)
|
||||
{
|
||||
base.SetReplay(replay);
|
||||
base.SetReplayScore(replayScore);
|
||||
|
||||
if (ReplayInputManager?.ReplayInputHandler != null)
|
||||
ReplayInputManager.ReplayInputHandler.GamefieldToScreenSpace = Playfield.GamefieldToScreenSpace;
|
||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Scoring
|
||||
[Column(TypeName="DECIMAL(1,4)")]
|
||||
public double Accuracy { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[JsonProperty(@"pp")]
|
||||
public double? PP { get; set; }
|
||||
|
||||
[JsonProperty("max_combo")]
|
||||
|
@ -57,7 +57,7 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
// Depending on beatSnapLength, we may snap to a beat that is beyond timingPoint's end time, but we want to instead snap to
|
||||
// the next timing point's start time
|
||||
var nextTimingPoint = ControlPointInfo.TimingPoints.FirstOrDefault(t => t.Time > timingPoint.Time);
|
||||
var nextTimingPoint = ControlPointInfo.TimingPoints.Find(t => t.Time > timingPoint.Time);
|
||||
if (position > nextTimingPoint?.Time)
|
||||
position = nextTimingPoint.Time;
|
||||
|
||||
@ -123,7 +123,7 @@ namespace osu.Game.Screens.Edit
|
||||
if (seekTime < timingPoint.Time && timingPoint != ControlPointInfo.TimingPoints.First())
|
||||
seekTime = timingPoint.Time;
|
||||
|
||||
var nextTimingPoint = ControlPointInfo.TimingPoints.FirstOrDefault(t => t.Time > timingPoint.Time);
|
||||
var nextTimingPoint = ControlPointInfo.TimingPoints.Find(t => t.Time > timingPoint.Time);
|
||||
if (seekTime > nextTimingPoint?.Time)
|
||||
seekTime = nextTimingPoint.Time;
|
||||
|
||||
|
@ -292,7 +292,7 @@ namespace osu.Game.Screens.Play
|
||||
if (!IsCurrentScreen) return;
|
||||
|
||||
var score = CreateScore();
|
||||
if (RulesetContainer.Replay == null)
|
||||
if (RulesetContainer.ReplayScore == null)
|
||||
scoreManager.Import(score, true);
|
||||
|
||||
Push(CreateResults(score));
|
||||
@ -304,7 +304,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected virtual ScoreInfo CreateScore()
|
||||
{
|
||||
var score = new ScoreInfo
|
||||
var score = RulesetContainer.ReplayScore?.ScoreInfo ?? new ScoreInfo
|
||||
{
|
||||
Beatmap = Beatmap.Value.BeatmapInfo,
|
||||
Ruleset = ruleset,
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Screens.Play
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
RulesetContainer.SetReplay(score.Replay);
|
||||
RulesetContainer.SetReplayScore(score);
|
||||
}
|
||||
|
||||
protected override ScoreInfo CreateScore() => score.ScoreInfo;
|
||||
|
@ -327,7 +327,7 @@ namespace osu.Game.Screens.Tournament
|
||||
continue;
|
||||
|
||||
// ReSharper disable once AccessToModifiedClosure
|
||||
DrawingsTeam teamToAdd = allTeams.FirstOrDefault(t => t.FullName == line);
|
||||
DrawingsTeam teamToAdd = allTeams.Find(t => t.FullName == line);
|
||||
|
||||
if (teamToAdd == null)
|
||||
continue;
|
||||
|
@ -102,7 +102,7 @@ namespace osu.Game.Skinning
|
||||
|
||||
string lastPiece = filename.Split('/').Last();
|
||||
|
||||
var file = source.Files.FirstOrDefault(f =>
|
||||
var file = source.Files.Find(f =>
|
||||
string.Equals(hasExtension ? f.Filename : Path.ChangeExtension(f.Filename, null), lastPiece, StringComparison.InvariantCultureIgnoreCase));
|
||||
return file?.FileInfo.StoragePath;
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Animations;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
|
||||
namespace osu.Game.Storyboards.Drawables
|
||||
@ -71,7 +70,7 @@ namespace osu.Game.Storyboards.Drawables
|
||||
{
|
||||
var framePath = basePath.Replace(".", frame + ".");
|
||||
|
||||
var path = beatmap.Value.BeatmapSetInfo.Files.FirstOrDefault(f => f.Filename.ToLowerInvariant() == framePath)?.FileInfo.StoragePath;
|
||||
var path = beatmap.Value.BeatmapSetInfo.Files.Find(f => f.Filename.ToLowerInvariant() == framePath)?.FileInfo.StoragePath;
|
||||
if (path == null)
|
||||
continue;
|
||||
|
||||
|
@ -6,7 +6,6 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
|
||||
namespace osu.Game.Storyboards.Drawables
|
||||
@ -66,7 +65,7 @@ namespace osu.Game.Storyboards.Drawables
|
||||
private void load(IBindableBeatmap beatmap, TextureStore textureStore)
|
||||
{
|
||||
var spritePath = Sprite.Path.ToLowerInvariant();
|
||||
var path = beatmap.Value.BeatmapSetInfo.Files.FirstOrDefault(f => f.Filename.ToLowerInvariant() == spritePath)?.FileInfo.StoragePath;
|
||||
var path = beatmap.Value.BeatmapSetInfo.Files.Find(f => f.Filename.ToLowerInvariant() == spritePath)?.FileInfo.StoragePath;
|
||||
if (path == null)
|
||||
return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user