mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 22:22:56 +08:00
Merge branch 'master' into fix-broken-tourney-tests
This commit is contained in:
commit
0396da2170
@ -62,6 +62,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1010.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1010.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.1106.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.1108.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
// 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;
|
||||||
|
using osu.Game.Rulesets.Mania.Edit.Blueprints.Components;
|
||||||
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
||||||
|
{
|
||||||
|
public class HoldNoteNoteSelectionBlueprint : ManiaSelectionBlueprint
|
||||||
|
{
|
||||||
|
protected new DrawableHoldNote DrawableObject => (DrawableHoldNote)base.DrawableObject;
|
||||||
|
|
||||||
|
private readonly HoldNotePosition position;
|
||||||
|
|
||||||
|
public HoldNoteNoteSelectionBlueprint(DrawableHoldNote holdNote, HoldNotePosition position)
|
||||||
|
: base(holdNote)
|
||||||
|
{
|
||||||
|
this.position = position;
|
||||||
|
InternalChild = new EditNotePiece { RelativeSizeAxes = Axes.X };
|
||||||
|
|
||||||
|
Select();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
// Todo: This shouldn't exist, mania should not reference the drawable hitobject directly.
|
||||||
|
if (DrawableObject.IsLoaded)
|
||||||
|
{
|
||||||
|
DrawableNote note = position == HoldNotePosition.Start ? DrawableObject.Head : DrawableObject.Tail;
|
||||||
|
|
||||||
|
Anchor = note.Anchor;
|
||||||
|
Origin = note.Origin;
|
||||||
|
|
||||||
|
Size = note.DrawSize;
|
||||||
|
Position = note.DrawPosition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Todo: This is temporary, since the note masks don't do anything special yet. In the future they will handle input.
|
||||||
|
public override bool HandlePositionalInput => false;
|
||||||
|
}
|
||||||
|
}
|
11
osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNotePosition.cs
Normal file
11
osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNotePosition.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
||||||
|
{
|
||||||
|
public enum HoldNotePosition
|
||||||
|
{
|
||||||
|
Start,
|
||||||
|
End
|
||||||
|
}
|
||||||
|
}
|
@ -40,8 +40,8 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new HoldNoteNoteSelectionBlueprint(DrawableObject.Head),
|
new HoldNoteNoteSelectionBlueprint(DrawableObject, HoldNotePosition.Start),
|
||||||
new HoldNoteNoteSelectionBlueprint(DrawableObject.Tail),
|
new HoldNoteNoteSelectionBlueprint(DrawableObject, HoldNotePosition.End),
|
||||||
new BodyPiece
|
new BodyPiece
|
||||||
{
|
{
|
||||||
AccentColour = Color4.Transparent,
|
AccentColour = Color4.Transparent,
|
||||||
@ -54,37 +54,19 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
Size = DrawableObject.DrawSize + new Vector2(0, DrawableObject.Tail.DrawHeight);
|
// Todo: This shouldn't exist, mania should not reference the drawable hitobject directly.
|
||||||
|
if (DrawableObject.IsLoaded)
|
||||||
|
{
|
||||||
|
Size = DrawableObject.DrawSize + new Vector2(0, DrawableObject.Tail.DrawHeight);
|
||||||
|
|
||||||
// This is a side-effect of not matching the hitobject's anchors/origins, which is kinda hard to do
|
// This is a side-effect of not matching the hitobject's anchors/origins, which is kinda hard to do
|
||||||
// When scrolling upwards our origin is already at the top of the head note (which is the intended location),
|
// When scrolling upwards our origin is already at the top of the head note (which is the intended location),
|
||||||
// but when scrolling downwards our origin is at the _bottom_ of the tail note (where we need to be at the _top_ of the tail note)
|
// but when scrolling downwards our origin is at the _bottom_ of the tail note (where we need to be at the _top_ of the tail note)
|
||||||
if (direction.Value == ScrollingDirection.Down)
|
if (direction.Value == ScrollingDirection.Down)
|
||||||
Y -= DrawableObject.Tail.DrawHeight;
|
Y -= DrawableObject.Tail.DrawHeight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Quad SelectionQuad => ScreenSpaceDrawQuad;
|
public override Quad SelectionQuad => ScreenSpaceDrawQuad;
|
||||||
|
|
||||||
private class HoldNoteNoteSelectionBlueprint : NoteSelectionBlueprint
|
|
||||||
{
|
|
||||||
public HoldNoteNoteSelectionBlueprint(DrawableNote note)
|
|
||||||
: base(note)
|
|
||||||
{
|
|
||||||
Select();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
|
||||||
base.Update();
|
|
||||||
|
|
||||||
Anchor = DrawableObject.Anchor;
|
|
||||||
Origin = DrawableObject.Origin;
|
|
||||||
|
|
||||||
Position = DrawableObject.DrawPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Todo: This is temporary, since the note masks don't do anything special yet. In the future they will handle input.
|
|
||||||
public override bool HandlePositionalInput => false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,9 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
Size = DrawableObject.DrawSize;
|
// Todo: This shouldn't exist, mania should not reference the drawable hitobject directly.
|
||||||
|
if (DrawableObject.IsLoaded)
|
||||||
|
Size = DrawableObject.DrawSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
76
osu.Game.Tests/Visual/Online/TestSceneVotePill.cs
Normal file
76
osu.Game.Tests/Visual/Online/TestSceneVotePill.cs
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
// 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 System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Overlays.Comments;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Online
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestSceneVotePill : OsuTestScene
|
||||||
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
|
{
|
||||||
|
typeof(VotePill)
|
||||||
|
};
|
||||||
|
|
||||||
|
private VotePill votePill;
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestUserCommentPill()
|
||||||
|
{
|
||||||
|
AddStep("Log in", logIn);
|
||||||
|
AddStep("User comment", () => addVotePill(getUserComment()));
|
||||||
|
AddStep("Click", () => votePill.Click());
|
||||||
|
AddAssert("Not loading", () => !votePill.IsLoading);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRandomCommentPill()
|
||||||
|
{
|
||||||
|
AddStep("Log in", logIn);
|
||||||
|
AddStep("Random comment", () => addVotePill(getRandomComment()));
|
||||||
|
AddStep("Click", () => votePill.Click());
|
||||||
|
AddAssert("Loading", () => votePill.IsLoading);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestOfflineRandomCommentPill()
|
||||||
|
{
|
||||||
|
AddStep("Log out", API.Logout);
|
||||||
|
AddStep("Random comment", () => addVotePill(getRandomComment()));
|
||||||
|
AddStep("Click", () => votePill.Click());
|
||||||
|
AddAssert("Not loading", () => !votePill.IsLoading);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void logIn() => API.Login("localUser", "password");
|
||||||
|
|
||||||
|
private Comment getUserComment() => new Comment
|
||||||
|
{
|
||||||
|
IsVoted = false,
|
||||||
|
UserId = API.LocalUser.Value.Id,
|
||||||
|
VotesCount = 10,
|
||||||
|
};
|
||||||
|
|
||||||
|
private Comment getRandomComment() => new Comment
|
||||||
|
{
|
||||||
|
IsVoted = false,
|
||||||
|
UserId = 4444,
|
||||||
|
VotesCount = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
private void addVotePill(Comment comment)
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
Add(votePill = new VotePill(comment)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -48,8 +48,6 @@ namespace osu.Game.Overlays.Comments
|
|||||||
{
|
{
|
||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
|
|
||||||
Action = onAction;
|
|
||||||
|
|
||||||
AutoSizeAxes = Axes.X;
|
AutoSizeAxes = Axes.X;
|
||||||
Height = 20;
|
Height = 20;
|
||||||
LoadingAnimationSize = new Vector2(10);
|
LoadingAnimationSize = new Vector2(10);
|
||||||
@ -60,6 +58,9 @@ namespace osu.Game.Overlays.Comments
|
|||||||
{
|
{
|
||||||
AccentColour = borderContainer.BorderColour = sideNumber.Colour = colours.GreenLight;
|
AccentColour = borderContainer.BorderColour = sideNumber.Colour = colours.GreenLight;
|
||||||
hoverLayer.Colour = Color4.Black.Opacity(0.5f);
|
hoverLayer.Colour = Color4.Black.Opacity(0.5f);
|
||||||
|
|
||||||
|
if (api.IsLoggedIn && api.LocalUser.Value.Id != comment.UserId)
|
||||||
|
Action = onAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -157,6 +158,9 @@ namespace osu.Game.Overlays.Comments
|
|||||||
|
|
||||||
private void updateDisplay()
|
private void updateDisplay()
|
||||||
{
|
{
|
||||||
|
if (Action == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (isVoted.Value)
|
if (isVoted.Value)
|
||||||
{
|
{
|
||||||
hoverLayer.FadeTo(IsHovered ? 1 : 0);
|
hoverLayer.FadeTo(IsHovered ? 1 : 0);
|
||||||
|
@ -18,8 +18,6 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
{
|
{
|
||||||
public class ToolbarRulesetSelector : RulesetSelector
|
public class ToolbarRulesetSelector : RulesetSelector
|
||||||
{
|
{
|
||||||
private const float padding = 10;
|
|
||||||
|
|
||||||
protected Drawable ModeButtonLine { get; private set; }
|
protected Drawable ModeButtonLine { get; private set; }
|
||||||
|
|
||||||
public ToolbarRulesetSelector()
|
public ToolbarRulesetSelector()
|
||||||
@ -39,7 +37,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
},
|
},
|
||||||
ModeButtonLine = new Container
|
ModeButtonLine = new Container
|
||||||
{
|
{
|
||||||
Size = new Vector2(padding * 2 + ToolbarButton.WIDTH, 3),
|
Size = new Vector2(ToolbarButton.WIDTH, 3),
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.TopLeft,
|
Origin = Anchor.TopLeft,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
@ -91,7 +89,6 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
AutoSizeAxes = Axes.X,
|
AutoSizeAxes = Axes.X,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Padding = new MarginPadding { Left = padding, Right = padding },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
protected override bool OnKeyDown(KeyDownEvent e)
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1010.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1010.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.1106.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.1108.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
@ -118,8 +118,8 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1010.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1010.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.1106.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.1108.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.1106.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.1108.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
Loading…
Reference in New Issue
Block a user