1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-15 14:47:18 +08:00

Merge branch 'master' into fix-results-crash

This commit is contained in:
Dan Balasescu 2020-06-03 15:19:30 +09:00 committed by GitHub
commit 8131137fea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 5 deletions

View File

@ -237,6 +237,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
{ {
Position = new Vector2(part.Position.X - size.X / 2, part.Position.Y + size.Y / 2), Position = new Vector2(part.Position.X - size.X / 2, part.Position.Y + size.Y / 2),
TexturePosition = textureRect.BottomLeft, TexturePosition = textureRect.BottomLeft,
TextureRect = new Vector4(0, 0, 1, 1),
Colour = DrawColourInfo.Colour.BottomLeft.Linear, Colour = DrawColourInfo.Colour.BottomLeft.Linear,
Time = part.Time Time = part.Time
}); });
@ -245,6 +246,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
{ {
Position = new Vector2(part.Position.X + size.X / 2, part.Position.Y + size.Y / 2), Position = new Vector2(part.Position.X + size.X / 2, part.Position.Y + size.Y / 2),
TexturePosition = textureRect.BottomRight, TexturePosition = textureRect.BottomRight,
TextureRect = new Vector4(0, 0, 1, 1),
Colour = DrawColourInfo.Colour.BottomRight.Linear, Colour = DrawColourInfo.Colour.BottomRight.Linear,
Time = part.Time Time = part.Time
}); });
@ -253,6 +255,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
{ {
Position = new Vector2(part.Position.X + size.X / 2, part.Position.Y - size.Y / 2), Position = new Vector2(part.Position.X + size.X / 2, part.Position.Y - size.Y / 2),
TexturePosition = textureRect.TopRight, TexturePosition = textureRect.TopRight,
TextureRect = new Vector4(0, 0, 1, 1),
Colour = DrawColourInfo.Colour.TopRight.Linear, Colour = DrawColourInfo.Colour.TopRight.Linear,
Time = part.Time Time = part.Time
}); });
@ -261,6 +264,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
{ {
Position = new Vector2(part.Position.X - size.X / 2, part.Position.Y - size.Y / 2), Position = new Vector2(part.Position.X - size.X / 2, part.Position.Y - size.Y / 2),
TexturePosition = textureRect.TopLeft, TexturePosition = textureRect.TopLeft,
TextureRect = new Vector4(0, 0, 1, 1),
Colour = DrawColourInfo.Colour.TopLeft.Linear, Colour = DrawColourInfo.Colour.TopLeft.Linear,
Time = part.Time Time = part.Time
}); });
@ -290,6 +294,9 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
[VertexMember(2, VertexAttribPointerType.Float)] [VertexMember(2, VertexAttribPointerType.Float)]
public Vector2 TexturePosition; public Vector2 TexturePosition;
[VertexMember(4, VertexAttribPointerType.Float)]
public Vector4 TextureRect;
[VertexMember(1, VertexAttribPointerType.Float)] [VertexMember(1, VertexAttribPointerType.Float)]
public float Time; public float Time;

View File

@ -19,7 +19,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{ {
var beatmap = Beatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo, Array.Empty<Mod>()); var beatmap = Beatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo, Array.Empty<Mod>());
return new ScoreAccessibleReplayPlayer(ruleset.GetAutoplayMod().CreateReplayScore(beatmap)); return new ScoreAccessibleReplayPlayer(ruleset.GetAutoplayMod()?.CreateReplayScore(beatmap));
} }
protected override void AddCheckSteps() protected override void AddCheckSteps()

View File

@ -22,6 +22,7 @@ using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring; using osu.Game.Scoring;
using osu.Game.Skinning; using osu.Game.Skinning;
using osu.Game.Users; using osu.Game.Users;
using JetBrains.Annotations;
namespace osu.Game.Rulesets namespace osu.Game.Rulesets
{ {
@ -100,7 +101,8 @@ namespace osu.Game.Rulesets
return value; 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; public virtual ISkin CreateLegacySkinProvider(ISkinSource source, IBeatmap beatmap) => null;

View File

@ -7,6 +7,8 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
using osu.Game.Scoring; using osu.Game.Scoring;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osu.Game.Screens.Ranking; using osu.Game.Screens.Ranking;
@ -20,6 +22,9 @@ namespace osu.Game.Screens.Select
private bool removeAutoModOnResume; private bool removeAutoModOnResume;
private OsuScreen player; private OsuScreen player;
[Resolved(CanBeNull = true)]
private NotificationOverlay notifications { get; set; }
public override bool AllowExternalScreenChange => true; public override bool AllowExternalScreenChange => true;
protected override UserActivity InitialActivity => new UserActivity.ChoosingBeatmap(); protected override UserActivity InitialActivity => new UserActivity.ChoosingBeatmap();
@ -49,8 +54,11 @@ namespace osu.Game.Screens.Select
if (removeAutoModOnResume) if (removeAutoModOnResume)
{ {
var autoType = Ruleset.Value.CreateInstance().GetAutoplayMod().GetType(); var autoType = Ruleset.Value.CreateInstance().GetAutoplayMod()?.GetType();
ModSelect.DeselectTypes(new[] { autoType }, true);
if (autoType != null)
ModSelect.DeselectTypes(new[] { autoType }, true);
removeAutoModOnResume = false; removeAutoModOnResume = false;
} }
} }
@ -78,10 +86,19 @@ namespace osu.Game.Screens.Select
if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true) if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true)
{ {
var auto = Ruleset.Value.CreateInstance().GetAutoplayMod(); var auto = Ruleset.Value.CreateInstance().GetAutoplayMod();
var autoType = auto.GetType(); var autoType = auto?.GetType();
var mods = Mods.Value; 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)) if (mods.All(m => m.GetType() != autoType))
{ {
Mods.Value = mods.Append(auto).ToArray(); Mods.Value = mods.Append(auto).ToArray();