1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 17:47:29 +08:00

Merge branch 'master' into gameplay-paused-no-update

This commit is contained in:
Dan Balasescu 2019-03-29 10:53:32 +09:00 committed by GitHub
commit 7ab24e35f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 71 additions and 102 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

@ -6,6 +6,7 @@ using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Objects.Types;
using osuTK.Graphics;
@ -14,7 +15,7 @@ using osuTK;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
public class SliderBall : CircularContainer, ISliderProgress
public class SliderBall : CircularContainer, ISliderProgress, IRequireHighFrequencyMousePosition
{
private const float width = 128;
@ -107,18 +108,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
private Vector2? lastScreenSpaceMousePosition;
protected override bool OnMouseDown(MouseDownEvent e)
{
lastScreenSpaceMousePosition = e.ScreenSpaceMousePosition;
return base.OnMouseDown(e);
}
protected override bool OnMouseUp(MouseUpEvent e)
{
lastScreenSpaceMousePosition = e.ScreenSpaceMousePosition;
return base.OnMouseUp(e);
}
protected override bool OnMouseMove(MouseMoveEvent e)
{
lastScreenSpaceMousePosition = e.ScreenSpaceMousePosition;

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

@ -92,7 +92,7 @@ namespace osu.Game.Tests.Visual.Background
public void PlayerLoaderSettingsHoverTest()
{
setupUserSettings();
AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer())));
AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer { BlockLoad = true })));
AddUntilStep("Wait for Player Loader to load", () => playerLoader?.IsLoaded ?? false);
AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent());
AddStep("Trigger background preview", () =>
@ -255,14 +255,7 @@ namespace osu.Game.Tests.Visual.Background
{
setupUserSettings();
AddStep("Start player loader", () =>
{
songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer
{
AllowPause = allowPause,
Ready = true,
}));
});
AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer { AllowPause = allowPause, })));
AddUntilStep("Wait for Player Loader to load", () => playerLoader.IsLoaded);
AddStep("Move mouse to center of screen", () => InputManager.MoveMouseTo(playerLoader.ScreenPos));
AddUntilStep("Wait for player to load", () => player.IsLoaded);
@ -351,7 +344,7 @@ namespace osu.Game.Tests.Visual.Background
public UserDimContainer CurrentStoryboardContainer => StoryboardContainer;
// Whether or not the player should be allowed to load.
public bool Ready;
public bool BlockLoad;
public Bindable<bool> StoryboardEnabled;
public readonly Bindable<bool> ReplacesBackground = new Bindable<bool>();
@ -362,10 +355,11 @@ namespace osu.Game.Tests.Visual.Background
public bool IsStoryboardInvisible() => ((TestUserDimContainer)CurrentStoryboardContainer).CurrentAlpha <= 1;
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
private void load(OsuConfigManager config, CancellationToken token)
{
while (!Ready)
while (BlockLoad && !token.IsCancellationRequested)
Thread.Sleep(1);
StoryboardEnabled = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
ReplacesBackground.BindTo(Background.StoryboardReplacesBackground);
DrawableRuleset.IsPaused.BindTo(IsPaused);

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

@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using osu.Framework.Allocation;
using osu.Game.Screens.Tournament;
using osu.Game.Screens.Tournament.Teams;
@ -11,7 +12,8 @@ namespace osu.Game.Tests.Visual.Tournament
[Description("for tournament use")]
public class TestCaseDrawings : ScreenTestCase
{
public TestCaseDrawings()
[BackgroundDependencyLoader]
private void load()
{
LoadScreen(new Drawings
{

View File

@ -390,11 +390,9 @@ namespace osu.Game
logoContainer = new Container { RelativeSizeAxes = Axes.Both },
}
},
overlayContent = new Container
{
RelativeSizeAxes = Axes.Both,
},
floatingOverlayContent = new Container { RelativeSizeAxes = Axes.Both, Depth = float.MinValue },
overlayContent = new Container { RelativeSizeAxes = Axes.Both },
floatingOverlayContent = new Container { RelativeSizeAxes = Axes.Both },
topMostOverlayContent = new Container { RelativeSizeAxes = Axes.Both },
idleTracker = new GameIdleTracker(6000)
});
@ -414,13 +412,12 @@ namespace osu.Game
loadComponentSingleFile(Toolbar = new Toolbar
{
Depth = -5,
OnHome = delegate
{
CloseAllOverlays(false);
menuScreen?.MakeCurrent();
},
}, floatingOverlayContent.Add);
}, topMostOverlayContent.Add);
loadComponentSingleFile(volume = new VolumeOverlay(), floatingOverlayContent.Add);
loadComponentSingleFile(onscreenDisplay = new OnScreenDisplay(), Add);
@ -428,47 +425,32 @@ namespace osu.Game
loadComponentSingleFile(screenshotManager, Add);
//overlay elements
loadComponentSingleFile(direct = new DirectOverlay { Depth = -1 }, overlayContent.Add);
loadComponentSingleFile(social = new SocialOverlay { Depth = -1 }, overlayContent.Add);
loadComponentSingleFile(direct = new DirectOverlay(), overlayContent.Add);
loadComponentSingleFile(social = new SocialOverlay(), overlayContent.Add);
loadComponentSingleFile(channelManager = new ChannelManager(), AddInternal);
loadComponentSingleFile(chatOverlay = new ChatOverlay { Depth = -1 }, overlayContent.Add);
loadComponentSingleFile(settings = new MainSettings
loadComponentSingleFile(chatOverlay = new ChatOverlay(), overlayContent.Add);
loadComponentSingleFile(settings = new MainSettings { GetToolbarHeight = () => ToolbarOffset }, floatingOverlayContent.Add);
loadComponentSingleFile(userProfile = new UserProfileOverlay(), overlayContent.Add);
loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay(), overlayContent.Add);
loadComponentSingleFile(notifications = new NotificationOverlay
{
GetToolbarHeight = () => ToolbarOffset,
Depth = -1
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
}, floatingOverlayContent.Add);
loadComponentSingleFile(userProfile = new UserProfileOverlay { Depth = -2 }, overlayContent.Add);
loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay { Depth = -3 }, overlayContent.Add);
loadComponentSingleFile(musicController = new MusicController
{
Depth = -5,
Position = new Vector2(0, Toolbar.HEIGHT),
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
}, floatingOverlayContent.Add);
loadComponentSingleFile(notifications = new NotificationOverlay
{
GetToolbarHeight = () => ToolbarOffset,
Depth = -4,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
}, floatingOverlayContent.Add);
loadComponentSingleFile(accountCreation = new AccountCreationOverlay(), topMostOverlayContent.Add);
loadComponentSingleFile(accountCreation = new AccountCreationOverlay
{
Depth = -6,
}, floatingOverlayContent.Add);
loadComponentSingleFile(dialogOverlay = new DialogOverlay(), topMostOverlayContent.Add);
loadComponentSingleFile(dialogOverlay = new DialogOverlay
{
Depth = -7,
}, floatingOverlayContent.Add);
loadComponentSingleFile(externalLinkOpener = new ExternalLinkOpener
{
Depth = -8,
}, floatingOverlayContent.Add);
loadComponentSingleFile(externalLinkOpener = new ExternalLinkOpener(), topMostOverlayContent.Add);
dependencies.CacheAs(idleTracker);
dependencies.Cache(settings);
@ -714,6 +696,8 @@ namespace osu.Game
private Container floatingOverlayContent;
private Container topMostOverlayContent;
private FrameworkConfigManager frameworkConfig;
private ScalingContainer screenContainer;

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

@ -14,8 +14,6 @@ namespace osu.Game.Screens.Multi
{
public override bool DisallowExternalBeatmapRulesetChanges => false;
public override bool RemoveWhenNotAlive => false;
public virtual string ShortTitle => Title;
[Resolved(CanBeNull = true)]

View File

@ -7,7 +7,6 @@ using osu.Framework.Graphics.Textures;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osuTK;
namespace osu.Game.Tests.Beatmaps
{
@ -68,7 +67,7 @@ namespace osu.Game.Tests.Beatmaps
public override bool Seek(double seek)
{
offset = MathHelper.Clamp(seek, 0, Length);
offset = Math.Min(seek, Length);
lastReferenceTime = null;
return true;
}

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

@ -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.Allocation;
using osu.Framework.Graphics;
using osu.Game.Screens;
@ -9,11 +10,12 @@ 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 readonly OsuScreenStack stack;
private OsuScreenStack stack;
protected ScreenTestCase()
[BackgroundDependencyLoader]
private void load()
{
Child = stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both };
}

View File

@ -16,7 +16,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.3" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.323.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.325.0" />
<PackageReference Include="SharpCompress" Version="0.23.0" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" />

View File

@ -105,8 +105,8 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.323.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.323.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.325.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.325.0" />
<PackageReference Include="SharpCompress" Version="0.22.0" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" />