mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Merge branch 'master' into master
This commit is contained in:
@ -11,6 +11,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
public static class SliderEventGenerator
|
||||
{
|
||||
[Obsolete("Use the overload with cancellation support instead.")] // can be removed 20201115
|
||||
// ReSharper disable once RedundantOverload.Global
|
||||
public static IEnumerable<SliderEventDescriptor> Generate(double startTime, double spanDuration, double velocity, double tickDistance, double totalDistance, int spanCount,
|
||||
double? legacyLastTickOffset)
|
||||
{
|
||||
|
@ -22,6 +22,7 @@ using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Skinning;
|
||||
using osu.Game.Users;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace osu.Game.Rulesets
|
||||
{
|
||||
@ -100,7 +101,8 @@ namespace osu.Game.Rulesets
|
||||
return value;
|
||||
}
|
||||
|
||||
public ModAutoplay GetAutoplayMod() => GetAllMods().OfType<ModAutoplay>().First();
|
||||
[CanBeNull]
|
||||
public ModAutoplay GetAutoplayMod() => GetAllMods().OfType<ModAutoplay>().FirstOrDefault();
|
||||
|
||||
public virtual ISkin CreateLegacySkinProvider(ISkinSource source, IBeatmap beatmap) => null;
|
||||
|
||||
|
@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Rulesets;
|
||||
@ -24,6 +25,9 @@ namespace osu.Game.Screens.Ranking
|
||||
|
||||
protected override APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback)
|
||||
{
|
||||
if (Score.Beatmap.OnlineBeatmapID == null || Score.Beatmap.Status <= BeatmapSetOnlineStatus.Pending)
|
||||
return null;
|
||||
|
||||
var req = new GetScoresRequest(Score.Beatmap, Score.Ruleset);
|
||||
req.Success += r => scoresCallback?.Invoke(r.Scores.Where(s => s.OnlineScoreID != Score.OnlineScoreID).Select(s => s.CreateScoreInfo(rulesets)));
|
||||
return req;
|
||||
|
@ -7,6 +7,8 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Ranking;
|
||||
@ -20,6 +22,9 @@ namespace osu.Game.Screens.Select
|
||||
private bool removeAutoModOnResume;
|
||||
private OsuScreen player;
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private NotificationOverlay notifications { get; set; }
|
||||
|
||||
public override bool AllowExternalScreenChange => true;
|
||||
|
||||
protected override UserActivity InitialActivity => new UserActivity.ChoosingBeatmap();
|
||||
@ -49,8 +54,11 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
if (removeAutoModOnResume)
|
||||
{
|
||||
var autoType = Ruleset.Value.CreateInstance().GetAutoplayMod().GetType();
|
||||
ModSelect.DeselectTypes(new[] { autoType }, true);
|
||||
var autoType = Ruleset.Value.CreateInstance().GetAutoplayMod()?.GetType();
|
||||
|
||||
if (autoType != null)
|
||||
ModSelect.DeselectTypes(new[] { autoType }, true);
|
||||
|
||||
removeAutoModOnResume = false;
|
||||
}
|
||||
}
|
||||
@ -78,10 +86,19 @@ namespace osu.Game.Screens.Select
|
||||
if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true)
|
||||
{
|
||||
var auto = Ruleset.Value.CreateInstance().GetAutoplayMod();
|
||||
var autoType = auto.GetType();
|
||||
var autoType = auto?.GetType();
|
||||
|
||||
var mods = Mods.Value;
|
||||
|
||||
if (autoType == null)
|
||||
{
|
||||
notifications?.Post(new SimpleNotification
|
||||
{
|
||||
Text = "The current ruleset doesn't have an autoplay mod avalaible!"
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mods.All(m => m.GetType() != autoType))
|
||||
{
|
||||
Mods.Value = mods.Append(auto).ToArray();
|
||||
|
Reference in New Issue
Block a user