1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-28 09:37:23 +08:00

Merge branch 'master' into taiko-wtf

This commit is contained in:
Dan Balasescu 2017-04-06 12:30:44 +09:00 committed by GitHub
commit 326baae615
11 changed files with 44 additions and 24 deletions

@ -1 +1 @@
Subproject commit e9b388934ed77cbc1af3cdfd213eb754f71554ae Subproject commit cd715ac535ace224188ac56f88a08c4c2908f51b

View File

@ -21,6 +21,8 @@ namespace osu.Game.Modes.Osu.UI
private readonly Container judgementLayer; private readonly Container judgementLayer;
private readonly ConnectionRenderer<OsuHitObject> connectionLayer; private readonly ConnectionRenderer<OsuHitObject> connectionLayer;
public override bool ProvidingUserCursor => true;
public override Vector2 Size public override Vector2 Size
{ {
get get

View File

@ -60,8 +60,8 @@ namespace osu.Game.Graphics.Backgrounds
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.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); private int aimTriangleCount => (int)(DrawWidth * DrawHeight * 0.002f / (triangleScale * triangleScale) * SpawnRatio);
@ -83,8 +83,8 @@ namespace osu.Game.Graphics.Backgrounds
t.Expire(); t.Expire();
} }
while (CreateNewTriangles && Children.Count() < aimTriangleCount) if (CreateNewTriangles)
addTriangle(false); addTriangles(false);
} }
protected virtual Triangle CreateTriangle() 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); 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(); int addCount = aimTriangleCount - Children.Count();
float triangleHeight = sprite.DrawHeight / DrawHeight; for (int i = 0; i < addCount; i++)
sprite.Position = new Vector2(RNG.NextSingle(), randomY ? RNG.NextSingle() * (1 + triangleHeight) - triangleHeight : 1); {
Add(sprite); var sprite = CreateTriangle();
float triangleHeight = sprite.DrawHeight / DrawHeight;
sprite.Position = new Vector2(RNG.NextSingle(), randomY ? RNG.NextSingle() * (1 + triangleHeight) - triangleHeight : 1);
Add(sprite);
}
} }
} }
} }

View File

@ -42,6 +42,16 @@ namespace osu.Game.Modes.UI
/// </summary> /// </summary>
protected readonly KeyConversionInputManager KeyConversionInputManager; 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> /// <summary>
/// Whether all the HitObjects have been judged. /// Whether all the HitObjects have been judged.
/// </summary> /// </summary>
@ -157,6 +167,8 @@ namespace osu.Game.Modes.UI
{ {
public event Action<TJudgement> OnJudgement; public event Action<TJudgement> OnJudgement;
public sealed override bool ProvidingUserCursor => !HasReplayLoaded && Playfield.ProvidingUserCursor;
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
protected override bool AllObjectsJudged => Playfield.HitObjects.Children.All(h => h.Judgement.Result != HitResult.None); protected override bool AllObjectsJudged => Playfield.HitObjects.Children.All(h => h.Judgement.Result != HitResult.None);

View File

@ -22,6 +22,11 @@ namespace osu.Game.Modes.UI
internal Container<Drawable> ScaledContent; 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; protected override Container<Drawable> Content => content;
private readonly Container<Drawable> content; private readonly Container<Drawable> content;

View File

@ -314,7 +314,7 @@ namespace osu.Game
if (intro?.ChildScreen != null) if (intro?.ChildScreen != null)
intro.ChildScreen.Padding = new MarginPadding { Top = Toolbar.Position.Y + Toolbar.DrawHeight }; 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) private void screenAdded(Screen newScreen)

View File

@ -155,7 +155,7 @@ namespace osu.Game.Overlays.Notifications
public void MarkAllRead() public void MarkAllRead()
{ {
notifications.Children.ForEach(n => n.Read = true); notifications?.Children.ForEach(n => n.Read = true);
} }
} }
} }

View File

@ -31,9 +31,7 @@ namespace osu.Game.Screens.Play
internal override bool ShowOverlays => false; internal override bool ShowOverlays => false;
internal override bool HasLocalCursorDisplayed => !hasReplayLoaded && !IsPaused; internal override bool HasLocalCursorDisplayed => !IsPaused && HitRenderer.ProvidingUserCursor;
private bool hasReplayLoaded => HitRenderer.InputManager.ReplayInputHandler != null;
public BeatmapInfo BeatmapInfo; public BeatmapInfo BeatmapInfo;
@ -305,7 +303,7 @@ namespace osu.Game.Screens.Play
{ {
if (pauseOverlay == null) return false; if (pauseOverlay == null) return false;
if (hasReplayLoaded) if (HitRenderer.HasReplayLoaded)
return false; return false;
if (pauseOverlay.State != Visibility.Visible && !canPause) return true; if (pauseOverlay.State != Visibility.Visible && !canPause) return true;

View File

@ -179,11 +179,11 @@ namespace osu.Game.Screens.Select
public void Filter(FilterCriteria newCriteria = null, bool debounce = true) public void Filter(FilterCriteria newCriteria = null, bool debounce = true)
{ {
if (!IsLoaded) return;
if (newCriteria != null) if (newCriteria != null)
criteria = newCriteria; criteria = newCriteria;
if (!IsLoaded) return;
Action perform = delegate Action perform = delegate
{ {
filterTask = null; filterTask = null;

View File

@ -173,9 +173,9 @@ namespace osu.Game.Screens.Select
{ {
sortTabs.AccentColour = colours.GreenLight; sortTabs.AccentColour = colours.GreenLight;
if (osu != null) if (osu != null) playMode.BindTo(osu.PlayMode);
playMode.BindTo(osu.PlayMode);
playMode.ValueChanged += val => FilterChanged?.Invoke(CreateCriteria()); playMode.ValueChanged += val => FilterChanged?.Invoke(CreateCriteria());
playMode.TriggerChange();
} }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;

View File

@ -167,13 +167,12 @@ namespace osu.Game.Screens.Select
BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, promptDelete, Key.Number4, float.MaxValue); 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) if (database == null)
database = beatmaps; database = beatmaps;
playMode.ValueChanged += val => { if (Beatmap != null) Beatmap.PreferredPlayMode = val; };
if (osu != null) playMode.BindTo(osu.PlayMode);
database.BeatmapSetAdded += onBeatmapSetAdded; database.BeatmapSetAdded += onBeatmapSetAdded;
database.BeatmapSetRemoved += onBeatmapSetRemoved; database.BeatmapSetRemoved += onBeatmapSetRemoved;