mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 03:43:01 +08:00
Merge remote-tracking branch 'origin/master' into catch-catcher-skinning
This commit is contained in:
commit
003bdda765
@ -14,16 +14,21 @@ namespace osu.Game.Tests.Visual.Components
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneIdleTracker : ManualInputManagerTestScene
|
public class TestSceneIdleTracker : ManualInputManagerTestScene
|
||||||
{
|
{
|
||||||
private readonly IdleTrackingBox box1;
|
private IdleTrackingBox box1;
|
||||||
private readonly IdleTrackingBox box2;
|
private IdleTrackingBox box2;
|
||||||
private readonly IdleTrackingBox box3;
|
private IdleTrackingBox box3;
|
||||||
private readonly IdleTrackingBox box4;
|
private IdleTrackingBox box4;
|
||||||
|
|
||||||
public TestSceneIdleTracker()
|
private IdleTrackingBox[] boxes;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp() => Schedule(() =>
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
InputManager.MoveMouseTo(Vector2.Zero);
|
||||||
|
|
||||||
|
Children = boxes = new[]
|
||||||
{
|
{
|
||||||
box1 = new IdleTrackingBox(1000)
|
box1 = new IdleTrackingBox(2000)
|
||||||
{
|
{
|
||||||
Name = "TopLeft",
|
Name = "TopLeft",
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -31,7 +36,7 @@ namespace osu.Game.Tests.Visual.Components
|
|||||||
Anchor = Anchor.TopLeft,
|
Anchor = Anchor.TopLeft,
|
||||||
Origin = Anchor.TopLeft,
|
Origin = Anchor.TopLeft,
|
||||||
},
|
},
|
||||||
box2 = new IdleTrackingBox(2000)
|
box2 = new IdleTrackingBox(4000)
|
||||||
{
|
{
|
||||||
Name = "TopRight",
|
Name = "TopRight",
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -39,7 +44,7 @@ namespace osu.Game.Tests.Visual.Components
|
|||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
},
|
},
|
||||||
box3 = new IdleTrackingBox(3000)
|
box3 = new IdleTrackingBox(6000)
|
||||||
{
|
{
|
||||||
Name = "BottomLeft",
|
Name = "BottomLeft",
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -47,7 +52,7 @@ namespace osu.Game.Tests.Visual.Components
|
|||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
},
|
},
|
||||||
box4 = new IdleTrackingBox(4000)
|
box4 = new IdleTrackingBox(8000)
|
||||||
{
|
{
|
||||||
Name = "BottomRight",
|
Name = "BottomRight",
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -56,7 +61,7 @@ namespace osu.Game.Tests.Visual.Components
|
|||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
});
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestNudge()
|
public void TestNudge()
|
||||||
@ -67,10 +72,10 @@ namespace osu.Game.Tests.Visual.Components
|
|||||||
|
|
||||||
AddStep("nudge mouse", () => InputManager.MoveMouseTo(box1.ScreenSpaceDrawQuad.Centre + new Vector2(1)));
|
AddStep("nudge mouse", () => InputManager.MoveMouseTo(box1.ScreenSpaceDrawQuad.Centre + new Vector2(1)));
|
||||||
|
|
||||||
checkIdleStatus(box1, false);
|
checkIdleStatus(1, false);
|
||||||
checkIdleStatus(box2, true);
|
checkIdleStatus(2, true);
|
||||||
checkIdleStatus(box3, true);
|
checkIdleStatus(3, true);
|
||||||
checkIdleStatus(box4, true);
|
checkIdleStatus(4, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -78,18 +83,18 @@ namespace osu.Game.Tests.Visual.Components
|
|||||||
{
|
{
|
||||||
AddStep("move to top right", () => InputManager.MoveMouseTo(box2));
|
AddStep("move to top right", () => InputManager.MoveMouseTo(box2));
|
||||||
|
|
||||||
checkIdleStatus(box1, true);
|
checkIdleStatus(1, true);
|
||||||
checkIdleStatus(box2, false);
|
checkIdleStatus(2, false);
|
||||||
checkIdleStatus(box3, true);
|
checkIdleStatus(3, true);
|
||||||
checkIdleStatus(box4, true);
|
checkIdleStatus(4, true);
|
||||||
|
|
||||||
AddStep("move to bottom left", () => InputManager.MoveMouseTo(box3));
|
AddStep("move to bottom left", () => InputManager.MoveMouseTo(box3));
|
||||||
AddStep("move to bottom right", () => InputManager.MoveMouseTo(box4));
|
AddStep("move to bottom right", () => InputManager.MoveMouseTo(box4));
|
||||||
|
|
||||||
checkIdleStatus(box1, true);
|
checkIdleStatus(1, true);
|
||||||
checkIdleStatus(box2, false);
|
checkIdleStatus(2, false);
|
||||||
checkIdleStatus(box3, false);
|
checkIdleStatus(3, false);
|
||||||
checkIdleStatus(box4, false);
|
checkIdleStatus(4, false);
|
||||||
|
|
||||||
waitForAllIdle();
|
waitForAllIdle();
|
||||||
}
|
}
|
||||||
@ -99,38 +104,38 @@ namespace osu.Game.Tests.Visual.Components
|
|||||||
{
|
{
|
||||||
AddStep("move to centre", () => InputManager.MoveMouseTo(Content));
|
AddStep("move to centre", () => InputManager.MoveMouseTo(Content));
|
||||||
|
|
||||||
checkIdleStatus(box1, false);
|
checkIdleStatus(1, false);
|
||||||
checkIdleStatus(box2, false);
|
checkIdleStatus(2, false);
|
||||||
checkIdleStatus(box3, false);
|
checkIdleStatus(3, false);
|
||||||
checkIdleStatus(box4, false);
|
checkIdleStatus(4, false);
|
||||||
|
|
||||||
AddUntilStep("Wait for idle", () => box1.IsIdle);
|
AddUntilStep("Wait for idle", () => box1.IsIdle);
|
||||||
|
|
||||||
checkIdleStatus(box1, true);
|
checkIdleStatus(1, true);
|
||||||
checkIdleStatus(box2, false);
|
checkIdleStatus(2, false);
|
||||||
checkIdleStatus(box3, false);
|
checkIdleStatus(3, false);
|
||||||
checkIdleStatus(box4, false);
|
checkIdleStatus(4, false);
|
||||||
|
|
||||||
AddUntilStep("Wait for idle", () => box2.IsIdle);
|
AddUntilStep("Wait for idle", () => box2.IsIdle);
|
||||||
|
|
||||||
checkIdleStatus(box1, true);
|
checkIdleStatus(1, true);
|
||||||
checkIdleStatus(box2, true);
|
checkIdleStatus(2, true);
|
||||||
checkIdleStatus(box3, false);
|
checkIdleStatus(3, false);
|
||||||
checkIdleStatus(box4, false);
|
checkIdleStatus(4, false);
|
||||||
|
|
||||||
AddUntilStep("Wait for idle", () => box3.IsIdle);
|
AddUntilStep("Wait for idle", () => box3.IsIdle);
|
||||||
|
|
||||||
checkIdleStatus(box1, true);
|
checkIdleStatus(1, true);
|
||||||
checkIdleStatus(box2, true);
|
checkIdleStatus(2, true);
|
||||||
checkIdleStatus(box3, true);
|
checkIdleStatus(3, true);
|
||||||
checkIdleStatus(box4, false);
|
checkIdleStatus(4, false);
|
||||||
|
|
||||||
waitForAllIdle();
|
waitForAllIdle();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkIdleStatus(IdleTrackingBox box, bool expectedIdle)
|
private void checkIdleStatus(int box, bool expectedIdle)
|
||||||
{
|
{
|
||||||
AddAssert($"{box.Name} is {(expectedIdle ? "idle" : "active")}", () => box.IsIdle == expectedIdle);
|
AddAssert($"box {box} is {(expectedIdle ? "idle" : "active")}", () => boxes[box - 1].IsIdle == expectedIdle);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void waitForAllIdle()
|
private void waitForAllIdle()
|
||||||
|
@ -134,9 +134,9 @@ namespace osu.Game.Overlays.Dialog
|
|||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Position = new Vector2(0f, -50f),
|
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Spacing = new Vector2(0f, 10f),
|
Spacing = new Vector2(0f, 10f),
|
||||||
|
Padding = new MarginPadding { Bottom = 10 },
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
@ -144,10 +144,6 @@ namespace osu.Game.Overlays.Dialog
|
|||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Size = ringSize,
|
Size = ringSize,
|
||||||
Margin = new MarginPadding
|
|
||||||
{
|
|
||||||
Bottom = 30,
|
|
||||||
},
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
ring = new CircularContainer
|
ring = new CircularContainer
|
||||||
@ -181,15 +177,15 @@ namespace osu.Game.Overlays.Dialog
|
|||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Padding = new MarginPadding(15),
|
|
||||||
TextAnchor = Anchor.TopCentre,
|
TextAnchor = Anchor.TopCentre,
|
||||||
},
|
},
|
||||||
body = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 18))
|
body = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 18))
|
||||||
{
|
{
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
TextAnchor = Anchor.TopCentre,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Padding = new MarginPadding(15),
|
|
||||||
TextAnchor = Anchor.TopCentre,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1,25 +1,29 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Colour;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Backgrounds;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using osuTK;
|
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile
|
namespace osu.Game.Overlays.Profile
|
||||||
{
|
{
|
||||||
public abstract class ProfileSection : FillFlowContainer
|
public abstract class ProfileSection : Container
|
||||||
{
|
{
|
||||||
public abstract string Title { get; }
|
public abstract string Title { get; }
|
||||||
|
|
||||||
public abstract string Identifier { get; }
|
public abstract string Identifier { get; }
|
||||||
|
|
||||||
private readonly FillFlowContainer content;
|
private readonly FillFlowContainer content;
|
||||||
|
private readonly Box background;
|
||||||
|
private readonly Box underscore;
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
@ -27,19 +31,51 @@ namespace osu.Game.Overlays.Profile
|
|||||||
|
|
||||||
protected ProfileSection()
|
protected ProfileSection()
|
||||||
{
|
{
|
||||||
Direction = FillDirection.Vertical;
|
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
background = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
new SectionTriangles
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomCentre,
|
||||||
|
Origin = Anchor.BottomCentre,
|
||||||
|
},
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Margin = new MarginPadding
|
||||||
|
{
|
||||||
|
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
|
||||||
|
Top = 15,
|
||||||
|
Bottom = 10,
|
||||||
|
},
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = Title,
|
Text = Title,
|
||||||
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Regular, italics: true),
|
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold),
|
||||||
Margin = new MarginPadding
|
},
|
||||||
|
underscore = new Box
|
||||||
{
|
{
|
||||||
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
|
Anchor = Anchor.BottomCentre,
|
||||||
Vertical = 10
|
Origin = Anchor.TopCentre,
|
||||||
|
Margin = new MarginPadding { Top = 4 },
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 2,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
content = new FillFlowContainer
|
content = new FillFlowContainer
|
||||||
@ -53,24 +89,51 @@ namespace osu.Game.Overlays.Profile
|
|||||||
Bottom = 20
|
Bottom = 20
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new Box
|
},
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Height = 1,
|
|
||||||
Colour = OsuColour.Gray(34),
|
|
||||||
EdgeSmoothness = new Vector2(1)
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// placeholder
|
[BackgroundDependencyLoader]
|
||||||
Add(new OsuSpriteText
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
Text = @"coming soon!",
|
background.Colour = colours.GreySeafoamDarker;
|
||||||
Colour = Color4.Gray,
|
underscore.Colour = colours.Seafoam;
|
||||||
Anchor = Anchor.Centre,
|
}
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Margin = new MarginPadding { Top = 100, Bottom = 100 }
|
private class SectionTriangles : Container
|
||||||
});
|
{
|
||||||
|
private readonly Triangles triangles;
|
||||||
|
private readonly Box foreground;
|
||||||
|
|
||||||
|
public SectionTriangles()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
Height = 100;
|
||||||
|
Masking = true;
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
triangles = new Triangles
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomCentre,
|
||||||
|
Origin = Anchor.BottomCentre,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
TriangleScale = 3,
|
||||||
|
},
|
||||||
|
foreground = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
triangles.ColourLight = colours.GreySeafoamDark;
|
||||||
|
triangles.ColourDark = colours.GreySeafoamDarker.Darken(0.2f);
|
||||||
|
foreground.Colour = ColourInfo.GradientVertical(colours.GreySeafoamDarker, colours.GreySeafoamDarker.Opacity(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -23,7 +24,7 @@ namespace osu.Game.Overlays
|
|||||||
private ProfileSection[] sections;
|
private ProfileSection[] sections;
|
||||||
private GetUserRequest userReq;
|
private GetUserRequest userReq;
|
||||||
protected ProfileHeader Header;
|
protected ProfileHeader Header;
|
||||||
private SectionsContainer<ProfileSection> sectionsContainer;
|
private ProfileSectionsContainer sectionsContainer;
|
||||||
private ProfileTabControl tabs;
|
private ProfileTabControl tabs;
|
||||||
|
|
||||||
public const float CONTENT_X_MARGIN = 70;
|
public const float CONTENT_X_MARGIN = 70;
|
||||||
@ -65,12 +66,11 @@ namespace osu.Game.Overlays
|
|||||||
Add(new Box
|
Add(new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = OsuColour.Gray(0.2f)
|
Colour = OsuColour.Gray(0.1f)
|
||||||
});
|
});
|
||||||
|
|
||||||
Add(sectionsContainer = new SectionsContainer<ProfileSection>
|
Add(sectionsContainer = new ProfileSectionsContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
ExpandableHeader = Header = new ProfileHeader(),
|
ExpandableHeader = Header = new ProfileHeader(),
|
||||||
FixedHeader = tabs,
|
FixedHeader = tabs,
|
||||||
HeaderBackground = new Box
|
HeaderBackground = new Box
|
||||||
@ -180,5 +180,21 @@ namespace osu.Game.Overlays
|
|||||||
bottom.Colour = colours.Yellow;
|
bottom.Colour = colours.Yellow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ProfileSectionsContainer : SectionsContainer<ProfileSection>
|
||||||
|
{
|
||||||
|
public ProfileSectionsContainer()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override FlowContainer<ProfileSection> CreateScrollContentContainer() => new FillFlowContainer<ProfileSection>
|
||||||
|
{
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Spacing = new Vector2(0, 20),
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -257,7 +257,7 @@ namespace osu.Game.Screens.Multi
|
|||||||
private void subScreenChanged(IScreen newScreen)
|
private void subScreenChanged(IScreen newScreen)
|
||||||
{
|
{
|
||||||
updatePollingRate(isIdle.Value);
|
updatePollingRate(isIdle.Value);
|
||||||
createButton.FadeTo(newScreen is MatchSubScreen ? 0 : 1, 200);
|
createButton.FadeTo(newScreen is LoungeSubScreen ? 1 : 0, 200);
|
||||||
|
|
||||||
updateTrack();
|
updateTrack();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user