mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 20:05:29 +08:00
Merge pull request #593 from peppy/general-fixes
Fix crash on changing play mode too early.
This commit is contained in:
commit
7c57ae3ae1
@ -1 +1 @@
|
||||
Subproject commit e9b388934ed77cbc1af3cdfd213eb754f71554ae
|
||||
Subproject commit cd715ac535ace224188ac56f88a08c4c2908f51b
|
@ -21,6 +21,8 @@ namespace osu.Game.Modes.Osu.UI
|
||||
private readonly Container judgementLayer;
|
||||
private readonly ConnectionRenderer<OsuHitObject> connectionLayer;
|
||||
|
||||
public override bool ProvidingUserCursor => true;
|
||||
|
||||
public override Vector2 Size
|
||||
{
|
||||
get
|
||||
|
@ -60,8 +60,8 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
for (int i = 0; i < aimTriangleCount; i++)
|
||||
addTriangle(true);
|
||||
|
||||
addTriangles(true);
|
||||
}
|
||||
|
||||
private int aimTriangleCount => (int)(DrawWidth * DrawHeight * 0.002f / (triangleScale * triangleScale) * SpawnRatio);
|
||||
@ -83,8 +83,8 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
t.Expire();
|
||||
}
|
||||
|
||||
while (CreateNewTriangles && Children.Count() < aimTriangleCount)
|
||||
addTriangle(false);
|
||||
if (CreateNewTriangles)
|
||||
addTriangles(false);
|
||||
}
|
||||
|
||||
protected virtual Triangle CreateTriangle()
|
||||
@ -113,12 +113,16 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
|
||||
protected virtual Color4 GetTriangleShade() => Interpolation.ValueAt(RNG.NextSingle(), ColourDark, ColourLight, 0, 1);
|
||||
|
||||
private void addTriangle(bool randomY)
|
||||
private void addTriangles(bool randomY)
|
||||
{
|
||||
var sprite = CreateTriangle();
|
||||
float triangleHeight = sprite.DrawHeight / DrawHeight;
|
||||
sprite.Position = new Vector2(RNG.NextSingle(), randomY ? RNG.NextSingle() * (1 + triangleHeight) - triangleHeight : 1);
|
||||
Add(sprite);
|
||||
int addCount = aimTriangleCount - Children.Count();
|
||||
for (int i = 0; i < addCount; i++)
|
||||
{
|
||||
var sprite = CreateTriangle();
|
||||
float triangleHeight = sprite.DrawHeight / DrawHeight;
|
||||
sprite.Position = new Vector2(RNG.NextSingle(), randomY ? RNG.NextSingle() * (1 + triangleHeight) - triangleHeight : 1);
|
||||
Add(sprite);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,16 @@ namespace osu.Game.Modes.UI
|
||||
/// </summary>
|
||||
protected readonly KeyConversionInputManager KeyConversionInputManager;
|
||||
|
||||
/// <summary>
|
||||
/// Whether we are currently providing the local user a gameplay cursor.
|
||||
/// </summary>
|
||||
public virtual bool ProvidingUserCursor => false;
|
||||
|
||||
/// <summary>
|
||||
/// Whether we have a replay loaded currently.
|
||||
/// </summary>
|
||||
public bool HasReplayLoaded => InputManager.ReplayInputHandler != null;
|
||||
|
||||
/// <summary>
|
||||
/// Whether all the HitObjects have been judged.
|
||||
/// </summary>
|
||||
@ -157,6 +167,8 @@ namespace osu.Game.Modes.UI
|
||||
{
|
||||
public event Action<TJudgement> OnJudgement;
|
||||
|
||||
public sealed override bool ProvidingUserCursor => !HasReplayLoaded && Playfield.ProvidingUserCursor;
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
protected override bool AllObjectsJudged => Playfield.HitObjects.Children.All(h => h.Judgement.Result != HitResult.None);
|
||||
|
||||
|
@ -22,6 +22,11 @@ namespace osu.Game.Modes.UI
|
||||
|
||||
internal Container<Drawable> ScaledContent;
|
||||
|
||||
/// <summary>
|
||||
/// Whether we are currently providing the local user a gameplay cursor.
|
||||
/// </summary>
|
||||
public virtual bool ProvidingUserCursor => false;
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
private readonly Container<Drawable> content;
|
||||
|
||||
|
@ -314,7 +314,7 @@ namespace osu.Game
|
||||
if (intro?.ChildScreen != null)
|
||||
intro.ChildScreen.Padding = new MarginPadding { Top = Toolbar.Position.Y + Toolbar.DrawHeight };
|
||||
|
||||
Cursor.State = currentScreen == null || currentScreen.HasLocalCursorDisplayed ? Visibility.Hidden : Visibility.Visible;
|
||||
Cursor.State = currentScreen?.HasLocalCursorDisplayed == false ? Visibility.Visible : Visibility.Hidden;
|
||||
}
|
||||
|
||||
private void screenAdded(Screen newScreen)
|
||||
|
@ -155,7 +155,7 @@ namespace osu.Game.Overlays.Notifications
|
||||
|
||||
public void MarkAllRead()
|
||||
{
|
||||
notifications.Children.ForEach(n => n.Read = true);
|
||||
notifications?.Children.ForEach(n => n.Read = true);
|
||||
}
|
||||
}
|
||||
}
|
@ -31,9 +31,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
internal override bool ShowOverlays => false;
|
||||
|
||||
internal override bool HasLocalCursorDisplayed => !hasReplayLoaded && !IsPaused;
|
||||
|
||||
private bool hasReplayLoaded => HitRenderer.InputManager.ReplayInputHandler != null;
|
||||
internal override bool HasLocalCursorDisplayed => !IsPaused && HitRenderer.ProvidingUserCursor;
|
||||
|
||||
public BeatmapInfo BeatmapInfo;
|
||||
|
||||
@ -305,7 +303,7 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
if (pauseOverlay == null) return false;
|
||||
|
||||
if (hasReplayLoaded)
|
||||
if (HitRenderer.HasReplayLoaded)
|
||||
return false;
|
||||
|
||||
if (pauseOverlay.State != Visibility.Visible && !canPause) return true;
|
||||
|
@ -179,11 +179,11 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
public void Filter(FilterCriteria newCriteria = null, bool debounce = true)
|
||||
{
|
||||
if (!IsLoaded) return;
|
||||
|
||||
if (newCriteria != null)
|
||||
criteria = newCriteria;
|
||||
|
||||
if (!IsLoaded) return;
|
||||
|
||||
Action perform = delegate
|
||||
{
|
||||
filterTask = null;
|
||||
|
@ -173,9 +173,9 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
sortTabs.AccentColour = colours.GreenLight;
|
||||
|
||||
if (osu != null)
|
||||
playMode.BindTo(osu.PlayMode);
|
||||
if (osu != null) playMode.BindTo(osu.PlayMode);
|
||||
playMode.ValueChanged += val => FilterChanged?.Invoke(CreateCriteria());
|
||||
playMode.TriggerChange();
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
|
||||
|
@ -167,13 +167,12 @@ namespace osu.Game.Screens.Select
|
||||
BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, promptDelete, Key.Number4, float.MaxValue);
|
||||
}
|
||||
|
||||
if (osu != null)
|
||||
playMode.BindTo(osu.PlayMode);
|
||||
playMode.ValueChanged += val => Beatmap.PreferredPlayMode = val;
|
||||
|
||||
if (database == null)
|
||||
database = beatmaps;
|
||||
|
||||
playMode.ValueChanged += val => { if (Beatmap != null) Beatmap.PreferredPlayMode = val; };
|
||||
if (osu != null) playMode.BindTo(osu.PlayMode);
|
||||
|
||||
database.BeatmapSetAdded += onBeatmapSetAdded;
|
||||
database.BeatmapSetRemoved += onBeatmapSetRemoved;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user