1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 04:52:57 +08:00

Merge branch 'master' into sprite-icon-compatibility

This commit is contained in:
Dean Herbert 2019-03-29 11:15:34 +09:00 committed by GitHub
commit 7715606188
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 80 additions and 46 deletions

View File

@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
Origin = Anchor.BottomLeft;
X = 0;
InternalChild = bananaContainer = new Container { RelativeSizeAxes = Axes.Both };
AddInternal(bananaContainer = new Container { RelativeSizeAxes = Axes.Both });
foreach (var b in s.NestedHitObjects.Cast<Banana>())
AddNested(getVisualRepresentation?.Invoke(b));

View File

@ -26,10 +26,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
[BackgroundDependencyLoader]
private void load()
{
InternalChild = pulp = new Pulp
{
Size = Size
};
AddInternal(pulp = new Pulp { Size = Size });
}
public override Color4 AccentColour

View File

@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
// todo: this should come from the skin.
AccentColour = colourForRepresentation(HitObject.VisualRepresentation);
InternalChildren = new[]
AddRangeInternal(new[]
{
createPulp(HitObject.VisualRepresentation),
border = new Circle
@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
}
}
},
};
});
if (HitObject.HyperDash)
{

View File

@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
Origin = Anchor.BottomLeft;
X = 0;
InternalChild = dropletContainer = new Container { RelativeSizeAxes = Axes.Both, };
AddInternal(dropletContainer = new Container { RelativeSizeAxes = Axes.Both, });
foreach (var o in s.NestedHitObjects.Cast<CatchHitObject>())
AddNested(getVisualRepresentation?.Invoke(o));

View File

@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
RelativeSizeAxes = Axes.X;
InternalChildren = new Drawable[]
AddRangeInternal(new Drawable[]
{
bodyPiece = new BodyPiece
{
@ -67,7 +67,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre
}
};
});
foreach (var tick in tickContainer)
AddNested(tick);

View File

@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
RelativeSizeAxes = Axes.X;
Size = new Vector2(1);
InternalChildren = new[]
AddRangeInternal(new[]
{
glowContainer = new CircularContainer
{
@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
}
}
}
};
});
}
public override Color4 AccentColour

View File

@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
CornerRadius = 5;
Masking = true;
InternalChild = headPiece = new NotePiece();
AddInternal(headPiece = new NotePiece());
}
protected override void OnDirectionChanged(ValueChangedEvent<ScrollingDirection> e)

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Game.Graphics.Cursor;
using osu.Game.Rulesets.Osu.UI.Cursor;
using osu.Game.Rulesets.UI;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Osu.Tests
@ -27,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Tests
[BackgroundDependencyLoader]
private void load()
{
Add(cursorContainer = new GameplayCursorContainer { RelativeSizeAxes = Axes.Both });
Add(cursorContainer = new OsuCursorContainer { RelativeSizeAxes = Axes.Both });
}
}
}

View File

@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics.Cursor;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Rulesets.UI;
@ -20,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.Edit
private class OsuPlayfieldNoCursor : OsuPlayfield
{
protected override CursorContainer CreateCursor() => null;
protected override GameplayCursorContainer CreateCursor() => null;
}
}
}

View File

@ -6,7 +6,6 @@ using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Bindings;
using osu.Game.Beatmaps;
@ -14,10 +13,11 @@ using osu.Game.Configuration;
using osu.Game.Skinning;
using osuTK;
using osuTK.Graphics;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Osu.UI.Cursor
{
public class GameplayCursorContainer : CursorContainer, IKeyBindingHandler<OsuAction>
public class OsuCursorContainer : GameplayCursorContainer, IKeyBindingHandler<OsuAction>
{
protected override Drawable CreateCursor() => new OsuCursor();
@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
private readonly Container<Drawable> fadeContainer;
public GameplayCursorContainer()
public OsuCursorContainer()
{
InternalChild = fadeContainer = new Container
{

View File

@ -10,7 +10,6 @@ using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables.Connections;
using osu.Game.Rulesets.UI;
using System.Linq;
using osu.Framework.Graphics.Cursor;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Osu.UI.Cursor;
@ -28,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.UI
protected override Container CursorTargetContainer => adjustmentContainer;
protected override CursorContainer CreateCursor() => new GameplayCursorContainer();
protected override GameplayCursorContainer CreateCursor() => new OsuCursorContainer();
public OsuPlayfield()
{

View File

@ -44,17 +44,14 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
RelativeSizeAxes = Axes.Y;
Width = tracker_width;
InternalChildren = new[]
AddInternal(Tracker = new Box
{
Tracker = new Box
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
EdgeSmoothness = new Vector2(0.5f, 0),
Alpha = 0.75f
}
};
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
EdgeSmoothness = new Vector2(0.5f, 0),
Alpha = 0.75f
});
}
protected override void UpdateState(ArmedState state)

View File

@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
protected DrawableTaikoHitObject(TaikoHitObject hitObject)
: base(hitObject)
{
InternalChildren = new[]
AddRangeInternal(new[]
{
nonProxiedContent = new Container
{
@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
Child = Content = new Container { RelativeSizeAxes = Axes.Both }
},
proxiedContent = new ProxiedContentContainer { RelativeSizeAxes = Axes.Both }
};
});
}
/// <summary>

View File

@ -170,12 +170,12 @@ namespace osu.Game.Tests.Visual.Gameplay
{
Origin = Anchor.Centre;
InternalChild = new Box
AddInternal(new Box
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both
};
});
switch (direction)
{
@ -205,7 +205,7 @@ namespace osu.Game.Tests.Visual.Gameplay
Origin = Anchor.Centre;
AutoSizeAxes = Axes.Both;
InternalChild = new Box { Size = new Vector2(75) };
AddInternal(new Box { Size = new Vector2(75) });
}
protected override void UpdateState(ArmedState state)

View File

@ -27,7 +27,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
[Cached(Type = typeof(IRoomManager))]
private TestRoomManager roomManager = new TestRoomManager();
public TestCaseLoungeRoomsContainer()
[BackgroundDependencyLoader]
private void load()
{
RoomsContainer container;

View File

@ -120,6 +120,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
}
}
protected override void ClearInternal(bool disposeChildren = true) => throw new InvalidOperationException($"Should never clear a {nameof(DrawableHitObject)}");
protected override void LoadComplete()
{
base.LoadComplete();

View File

@ -263,7 +263,9 @@ namespace osu.Game.Rulesets.UI
protected override bool OnHover(HoverEvent e) => true; // required for IProvideCursor
public override CursorContainer Cursor => Playfield.Cursor;
CursorContainer IProvideCursor.Cursor => Playfield.Cursor;
public override GameplayCursorContainer Cursor => Playfield.Cursor;
public bool ProvidingUserCursor => Playfield.Cursor != null && !HasReplayLoaded.Value;
@ -333,7 +335,7 @@ namespace osu.Game.Rulesets.UI
/// <summary>
/// The cursor being displayed by the <see cref="Playfield"/>. May be null if no cursor is provided.
/// </summary>
public abstract CursorContainer Cursor { get; }
public abstract GameplayCursorContainer Cursor { get; }
/// <summary>
/// Sets a replay to be used, overriding local input.

View File

@ -36,7 +36,10 @@ namespace osu.Game.Rulesets.UI
private void load(GameplayClock clock)
{
if (clock != null)
{
parentGameplayClock = clock;
gameplayClock.IsPaused.BindTo(clock.IsPaused);
}
}
protected override void LoadComplete()
@ -68,7 +71,7 @@ namespace osu.Game.Rulesets.UI
public override bool UpdateSubTree()
{
requireMoreUpdateLoops = true;
validState = true;
validState = !gameplayClock.IsPaused.Value;
int loops = 0;

View File

@ -0,0 +1,25 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
namespace osu.Game.Rulesets.UI
{
public class GameplayCursorContainer : CursorContainer
{
/// <summary>
/// Because Show/Hide are executed by a parent, <see cref="State"/> is updated immediately even if the cursor
/// is in a non-updating state (via <see cref="FrameStabilityContainer"/> limitations).
///
/// This holds the true visibility value.
/// </summary>
public Visibility LastFrameState;
protected override void Update()
{
base.Update();
LastFrameState = State;
}
}
}

View File

@ -10,7 +10,6 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mods;
using osuTK;
@ -90,14 +89,14 @@ namespace osu.Game.Rulesets.UI
/// <summary>
/// The cursor currently being used by this <see cref="Playfield"/>. May be null if no cursor is provided.
/// </summary>
public CursorContainer Cursor { get; private set; }
public GameplayCursorContainer Cursor { get; private set; }
/// <summary>
/// Provide an optional cursor which is to be used for gameplay.
/// If providing a cursor, <see cref="CursorTargetContainer"/> must also point to a valid target container.
/// </summary>
/// <returns>The cursor, or null if a cursor is not rqeuired.</returns>
protected virtual CursorContainer CreateCursor() => null;
protected virtual GameplayCursorContainer CreateCursor() => null;
/// <summary>
/// The target container to add the cursor after it is created.

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Framework.Timing;
namespace osu.Game.Screens.Play
@ -17,6 +18,8 @@ namespace osu.Game.Screens.Play
{
private readonly IFrameBasedClock underlyingClock;
public readonly BindableBool IsPaused = new BindableBool();
public GameplayClock(IFrameBasedClock underlyingClock)
{
this.underlyingClock = underlyingClock;

View File

@ -79,6 +79,8 @@ namespace osu.Game.Screens.Play
// the clock to be exposed via DI to children.
GameplayClock = new GameplayClock(offsetClock);
GameplayClock.IsPaused.BindTo(IsPaused);
}
[BackgroundDependencyLoader]

View File

@ -14,8 +14,7 @@ namespace osu.Game.Tests.Visual
protected ManualInputManagerTestCase()
{
base.Content.Add(InputManager = new ManualInputManager());
ReturnUserInput();
base.Content.Add(InputManager = new ManualInputManager { UseParentInput = true });
}
/// <summary>

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Testing;
@ -23,7 +24,11 @@ namespace osu.Game.Tests.Visual
protected PlayerTestCase(Ruleset ruleset)
{
this.ruleset = ruleset;
}
[BackgroundDependencyLoader]
private void load()
{
Add(new Box
{
RelativeSizeAxes = Axes.Both,

View File

@ -10,7 +10,7 @@ namespace osu.Game.Tests.Visual
/// <summary>
/// A test case which can be used to test a screen (that relies on OnEntering being called to execute startup instructions).
/// </summary>
public abstract class ScreenTestCase : OsuTestCase
public abstract class ScreenTestCase : ManualInputManagerTestCase
{
private OsuScreenStack stack;