mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 03:02:54 +08:00
Merge branch 'master' into scaleMod
This commit is contained in:
commit
f97656351d
@ -11,6 +11,7 @@ using osu.Game.Rulesets.Mods;
|
|||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Replays;
|
using osu.Game.Rulesets.Osu.Replays;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
@ -30,6 +31,8 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
|
|
||||||
private OsuInputManager inputManager;
|
private OsuInputManager inputManager;
|
||||||
|
|
||||||
|
private GameplayClock gameplayClock;
|
||||||
|
|
||||||
private List<OsuReplayFrame> replayFrames;
|
private List<OsuReplayFrame> replayFrames;
|
||||||
|
|
||||||
private int currentFrame;
|
private int currentFrame;
|
||||||
@ -38,7 +41,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
{
|
{
|
||||||
if (currentFrame == replayFrames.Count - 1) return;
|
if (currentFrame == replayFrames.Count - 1) return;
|
||||||
|
|
||||||
double time = playfield.Time.Current;
|
double time = gameplayClock.CurrentTime;
|
||||||
|
|
||||||
// Very naive implementation of autopilot based on proximity to replay frames.
|
// Very naive implementation of autopilot based on proximity to replay frames.
|
||||||
// TODO: this needs to be based on user interactions to better match stable (pausing until judgement is registered).
|
// TODO: this needs to be based on user interactions to better match stable (pausing until judgement is registered).
|
||||||
@ -53,6 +56,8 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
|
|
||||||
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
|
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
|
||||||
{
|
{
|
||||||
|
gameplayClock = drawableRuleset.FrameStableClock;
|
||||||
|
|
||||||
// Grab the input manager to disable the user's cursor, and for future use
|
// Grab the input manager to disable the user's cursor, and for future use
|
||||||
inputManager = (OsuInputManager)drawableRuleset.KeyBindingInputManager;
|
inputManager = (OsuInputManager)drawableRuleset.KeyBindingInputManager;
|
||||||
inputManager.AllowUserCursorMovement = false;
|
inputManager.AllowUserCursorMovement = false;
|
||||||
|
@ -11,6 +11,7 @@ using osu.Game.Graphics.Containers;
|
|||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
|
|
||||||
@ -221,6 +222,31 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
confirmExited();
|
confirmExited();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestPauseSoundLoop()
|
||||||
|
{
|
||||||
|
AddStep("seek before gameplay", () => Player.GameplayClockContainer.Seek(-5000));
|
||||||
|
|
||||||
|
SkinnableSound getLoop() => Player.ChildrenOfType<PauseOverlay>().FirstOrDefault()?.ChildrenOfType<SkinnableSound>().FirstOrDefault();
|
||||||
|
|
||||||
|
pauseAndConfirm();
|
||||||
|
AddAssert("loop is playing", () => getLoop().IsPlaying);
|
||||||
|
|
||||||
|
resumeAndConfirm();
|
||||||
|
AddUntilStep("loop is stopped", () => !getLoop().IsPlaying);
|
||||||
|
|
||||||
|
AddUntilStep("pause again", () =>
|
||||||
|
{
|
||||||
|
Player.Pause();
|
||||||
|
return !Player.GameplayClockContainer.GameplayClock.IsRunning;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("loop is playing", () => getLoop().IsPlaying);
|
||||||
|
|
||||||
|
resumeAndConfirm();
|
||||||
|
AddUntilStep("loop is stopped", () => !getLoop().IsPlaying);
|
||||||
|
}
|
||||||
|
|
||||||
private void pauseAndConfirm()
|
private void pauseAndConfirm()
|
||||||
{
|
{
|
||||||
pause();
|
pause();
|
||||||
|
48
osu.Game/Overlays/Comments/Buttons/ChevronButton.cs
Normal file
48
osu.Game/Overlays/Comments/Buttons/ChevronButton.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
// 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.Graphics.Containers;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osuTK;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Comments.Buttons
|
||||||
|
{
|
||||||
|
public class ChevronButton : OsuHoverContainer
|
||||||
|
{
|
||||||
|
public readonly BindableBool Expanded = new BindableBool(true);
|
||||||
|
|
||||||
|
private readonly SpriteIcon icon;
|
||||||
|
|
||||||
|
public ChevronButton()
|
||||||
|
{
|
||||||
|
Size = new Vector2(40, 22);
|
||||||
|
Child = icon = new SpriteIcon
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Size = new Vector2(12),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OverlayColourProvider colourProvider)
|
||||||
|
{
|
||||||
|
IdleColour = HoverColour = colourProvider.Foreground1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
Action = Expanded.Toggle;
|
||||||
|
Expanded.BindValueChanged(onExpandedChanged, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onExpandedChanged(ValueChangedEvent<bool> expanded)
|
||||||
|
{
|
||||||
|
icon.Icon = expanded.NewValue ? FontAwesome.Solid.ChevronUp : FontAwesome.Solid.ChevronDown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -32,10 +32,6 @@ namespace osu.Game.Overlays.Comments.Buttons
|
|||||||
protected CommentRepliesButton()
|
protected CommentRepliesButton()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
Margin = new MarginPadding
|
|
||||||
{
|
|
||||||
Vertical = 2
|
|
||||||
};
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new CircularContainer
|
new CircularContainer
|
||||||
|
@ -8,38 +8,42 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Comments
|
namespace osu.Game.Overlays.Comments.Buttons
|
||||||
{
|
{
|
||||||
public abstract class GetCommentRepliesButton : LoadingButton
|
public class ShowMoreButton : LoadingButton
|
||||||
{
|
{
|
||||||
private const int duration = 200;
|
|
||||||
|
|
||||||
protected override IEnumerable<Drawable> EffectTargets => new[] { text };
|
protected override IEnumerable<Drawable> EffectTargets => new[] { text };
|
||||||
|
|
||||||
private OsuSpriteText text;
|
private OsuSpriteText text;
|
||||||
|
|
||||||
protected GetCommentRepliesButton()
|
public ShowMoreButton()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
LoadingAnimationSize = new Vector2(8);
|
LoadingAnimationSize = new Vector2(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OverlayColourProvider colourProvider)
|
||||||
|
{
|
||||||
|
IdleColour = colourProvider.Light2;
|
||||||
|
HoverColour = colourProvider.Light1;
|
||||||
|
}
|
||||||
|
|
||||||
protected override Drawable CreateContent() => new Container
|
protected override Drawable CreateContent() => new Container
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Child = text = new OsuSpriteText
|
Child = text = new OsuSpriteText
|
||||||
{
|
{
|
||||||
AlwaysPresent = true,
|
AlwaysPresent = true,
|
||||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
|
||||||
Text = GetText()
|
Text = "show more"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
protected abstract string GetText();
|
protected override void OnLoadStarted() => text.FadeOut(200, Easing.OutQuint);
|
||||||
|
|
||||||
protected override void OnLoadStarted() => text.FadeOut(duration, Easing.OutQuint);
|
protected override void OnLoadFinished() => text.FadeIn(200, Easing.OutQuint);
|
||||||
|
|
||||||
protected override void OnLoadFinished() => text.FadeIn(duration, Easing.OutQuint);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -23,8 +23,6 @@ namespace osu.Game.Overlays.Comments
|
|||||||
public DeletedCommentsCounter()
|
public DeletedCommentsCounter()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
Margin = new MarginPadding { Vertical = 10, Left = 80 };
|
|
||||||
|
|
||||||
InternalChild = new FillFlowContainer
|
InternalChild = new FillFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
|
@ -28,7 +28,6 @@ namespace osu.Game.Overlays.Comments
|
|||||||
public class DrawableComment : CompositeDrawable
|
public class DrawableComment : CompositeDrawable
|
||||||
{
|
{
|
||||||
private const int avatar_size = 40;
|
private const int avatar_size = 40;
|
||||||
private const int margin = 10;
|
|
||||||
|
|
||||||
public Action<DrawableComment, int> RepliesRequested;
|
public Action<DrawableComment, int> RepliesRequested;
|
||||||
|
|
||||||
@ -58,7 +57,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load(OverlayColourProvider colourProvider)
|
||||||
{
|
{
|
||||||
LinkFlowContainer username;
|
LinkFlowContainer username;
|
||||||
FillFlowContainer info;
|
FillFlowContainer info;
|
||||||
@ -70,25 +69,25 @@ namespace osu.Game.Overlays.Comments
|
|||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new FillFlowContainer
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Direction = FillDirection.Vertical,
|
Padding = getPadding(Comment.IsTopLevel),
|
||||||
Children = new Drawable[]
|
Child = new FillFlowContainer
|
||||||
{
|
{
|
||||||
new Container
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
content = new GridContainer
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Padding = new MarginPadding(margin) { Left = margin + 5, Top = Comment.IsTopLevel ? 10 : 0 },
|
|
||||||
Child = content = new GridContainer
|
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
ColumnDimensions = new[]
|
ColumnDimensions = new[]
|
||||||
{
|
{
|
||||||
new Dimension(GridSizeMode.AutoSize),
|
new Dimension(GridSizeMode.Absolute, size: avatar_size + 10),
|
||||||
new Dimension(),
|
new Dimension(),
|
||||||
},
|
},
|
||||||
RowDimensions = new[]
|
RowDimensions = new[]
|
||||||
@ -99,93 +98,84 @@ namespace osu.Game.Overlays.Comments
|
|||||||
{
|
{
|
||||||
new Drawable[]
|
new Drawable[]
|
||||||
{
|
{
|
||||||
new FillFlowContainer
|
new Container
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
Size = new Vector2(avatar_size),
|
||||||
Margin = new MarginPadding { Horizontal = margin },
|
|
||||||
Direction = FillDirection.Horizontal,
|
|
||||||
Spacing = new Vector2(5, 0),
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Width = 40,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Child = votePill = new VotePill(Comment)
|
|
||||||
{
|
|
||||||
Anchor = Anchor.CentreRight,
|
|
||||||
Origin = Anchor.CentreRight,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new UpdateableAvatar(Comment.User)
|
new UpdateableAvatar(Comment.User)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Size = new Vector2(avatar_size),
|
Size = new Vector2(avatar_size),
|
||||||
Masking = true,
|
Masking = true,
|
||||||
CornerRadius = avatar_size / 2f,
|
CornerRadius = avatar_size / 2f,
|
||||||
CornerExponent = 2,
|
CornerExponent = 2,
|
||||||
},
|
},
|
||||||
|
votePill = new VotePill(Comment)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
Margin = new MarginPadding
|
||||||
|
{
|
||||||
|
Right = 5
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Spacing = new Vector2(0, 3),
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(0, 4),
|
||||||
|
Margin = new MarginPadding
|
||||||
|
{
|
||||||
|
Vertical = 2
|
||||||
|
},
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Spacing = new Vector2(7, 0),
|
Spacing = new Vector2(10, 0),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true))
|
username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold))
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both
|
||||||
},
|
},
|
||||||
new ParentUsername(Comment),
|
new ParentUsername(Comment),
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Alpha = Comment.IsDeleted ? 1 : 0,
|
Alpha = Comment.IsDeleted ? 1 : 0,
|
||||||
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
|
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold),
|
||||||
Text = @"deleted",
|
Text = "deleted"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
message = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14))
|
message = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14))
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y
|
||||||
Padding = new MarginPadding { Right = 40 }
|
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
info = new FillFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(10, 0),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
info = new FillFlowContainer
|
new DrawableDate(Comment.CreatedAt, 12, false)
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
Colour = colourProvider.Foreground1
|
||||||
Direction = FillDirection.Horizontal,
|
}
|
||||||
Spacing = new Vector2(10, 0),
|
}
|
||||||
Children = new Drawable[]
|
},
|
||||||
{
|
new Container
|
||||||
new OsuSpriteText
|
{
|
||||||
{
|
AutoSizeAxes = Axes.Both,
|
||||||
Anchor = Anchor.CentreLeft,
|
Children = new Drawable[]
|
||||||
Origin = Anchor.CentreLeft,
|
{
|
||||||
Font = OsuFont.GetFont(size: 12),
|
|
||||||
Colour = OsuColour.Gray(0.7f),
|
|
||||||
Text = HumanizerUtils.Humanize(Comment.CreatedAt)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
showRepliesButton = new ShowRepliesButton(Comment.RepliesCount)
|
showRepliesButton = new ShowRepliesButton(Comment.RepliesCount)
|
||||||
{
|
{
|
||||||
Expanded = { BindTarget = childrenExpanded }
|
Expanded = { BindTarget = childrenExpanded }
|
||||||
@ -200,41 +190,51 @@ namespace osu.Game.Overlays.Comments
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
childCommentsVisibilityContainer = new FillFlowContainer
|
||||||
childCommentsVisibilityContainer = new FillFlowContainer
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
childCommentsContainer = new FillFlowContainer
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Padding = new MarginPadding { Left = 20 },
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
Padding = new MarginPadding { Left = 20 },
|
childCommentsContainer = new FillFlowContainer
|
||||||
RelativeSizeAxes = Axes.X,
|
{
|
||||||
AutoSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.X,
|
||||||
Direction = FillDirection.Vertical
|
AutoSizeAxes = Axes.Y,
|
||||||
},
|
Direction = FillDirection.Vertical
|
||||||
deletedCommentsCounter = new DeletedCommentsCounter
|
},
|
||||||
{
|
deletedCommentsCounter = new DeletedCommentsCounter
|
||||||
ShowDeleted = { BindTarget = ShowDeleted }
|
{
|
||||||
},
|
ShowDeleted = { BindTarget = ShowDeleted },
|
||||||
showMoreButton = new ShowMoreButton
|
Margin = new MarginPadding
|
||||||
{
|
{
|
||||||
Action = () => RepliesRequested(this, ++currentPage)
|
Top = 10
|
||||||
|
}
|
||||||
|
},
|
||||||
|
showMoreButton = new ShowMoreButton
|
||||||
|
{
|
||||||
|
Action = () => RepliesRequested(this, ++currentPage)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
chevronButton = new ChevronButton
|
new Container
|
||||||
{
|
{
|
||||||
|
Size = new Vector2(70, 40),
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
Margin = new MarginPadding { Right = 30, Top = margin },
|
Margin = new MarginPadding { Horizontal = 5 },
|
||||||
Expanded = { BindTarget = childrenExpanded },
|
Child = chevronButton = new ChevronButton
|
||||||
Alpha = 0
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Expanded = { BindTarget = childrenExpanded },
|
||||||
|
Alpha = 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -247,10 +247,9 @@ namespace osu.Game.Overlays.Comments
|
|||||||
{
|
{
|
||||||
info.Add(new OsuSpriteText
|
info.Add(new OsuSpriteText
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular),
|
||||||
Origin = Anchor.CentreLeft,
|
Text = $@"edited {HumanizerUtils.Humanize(Comment.EditedAt.Value)} by {Comment.EditedUser.Username}",
|
||||||
Font = OsuFont.GetFont(size: 12),
|
Colour = colourProvider.Foreground1
|
||||||
Text = $@"edited {HumanizerUtils.Humanize(Comment.EditedAt.Value)} by {Comment.EditedUser.Username}"
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,35 +356,21 @@ namespace osu.Game.Overlays.Comments
|
|||||||
showMoreButton.IsLoading = loadRepliesButton.IsLoading = false;
|
showMoreButton.IsLoading = loadRepliesButton.IsLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ChevronButton : ShowChildrenButton
|
private MarginPadding getPadding(bool isTopLevel)
|
||||||
{
|
{
|
||||||
private readonly SpriteIcon icon;
|
if (isTopLevel)
|
||||||
|
|
||||||
public ChevronButton()
|
|
||||||
{
|
{
|
||||||
Child = icon = new SpriteIcon
|
return new MarginPadding
|
||||||
{
|
{
|
||||||
Size = new Vector2(12),
|
Horizontal = 70,
|
||||||
|
Vertical = 15
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnExpandedChanged(ValueChangedEvent<bool> expanded)
|
return new MarginPadding
|
||||||
{
|
{
|
||||||
icon.Icon = expanded.NewValue ? FontAwesome.Solid.ChevronUp : FontAwesome.Solid.ChevronDown;
|
Top = 10
|
||||||
}
|
};
|
||||||
}
|
|
||||||
|
|
||||||
private class ShowMoreButton : GetCommentRepliesButton
|
|
||||||
{
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OverlayColourProvider colourProvider)
|
|
||||||
{
|
|
||||||
Margin = new MarginPadding { Vertical = 10, Left = 80 };
|
|
||||||
IdleColour = colourProvider.Light2;
|
|
||||||
HoverColour = colourProvider.Light1;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string GetText() => @"Show More";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ParentUsername : FillFlowContainer, IHasTooltip
|
private class ParentUsername : FillFlowContainer, IHasTooltip
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
// 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.Graphics.Containers;
|
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osuTK.Graphics;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Comments
|
|
||||||
{
|
|
||||||
public abstract class ShowChildrenButton : OsuHoverContainer
|
|
||||||
{
|
|
||||||
public readonly BindableBool Expanded = new BindableBool(true);
|
|
||||||
|
|
||||||
protected ShowChildrenButton()
|
|
||||||
{
|
|
||||||
AutoSizeAxes = Axes.Both;
|
|
||||||
IdleColour = OsuColour.Gray(0.7f);
|
|
||||||
HoverColour = Color4.White;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
Action = Expanded.Toggle;
|
|
||||||
|
|
||||||
Expanded.BindValueChanged(OnExpandedChanged, true);
|
|
||||||
base.LoadComplete();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void OnExpandedChanged(ValueChangedEvent<bool> expanded);
|
|
||||||
}
|
|
||||||
}
|
|
@ -330,7 +330,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
if (Beatmap.Value.Track.IsRunning)
|
if (Beatmap.Value.Track.IsRunning)
|
||||||
{
|
{
|
||||||
var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value.Track.CurrentAmplitudes.Maximum : 0;
|
var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value.Track.CurrentAmplitudes.Maximum : 0;
|
||||||
logoAmplitudeContainer.ScaleTo(1 - Math.Max(0, maxAmplitude - scale_adjust_cutoff) * 0.04f, 75, Easing.OutQuint);
|
logoAmplitudeContainer.Scale = new Vector2((float)Interpolation.Damp(logoAmplitudeContainer.Scale.X, 1 - Math.Max(0, maxAmplitude - scale_adjust_cutoff) * 0.04f, 0.9f, Time.Elapsed));
|
||||||
|
|
||||||
if (maxAmplitude > velocity_adjust_cutoff)
|
if (maxAmplitude > velocity_adjust_cutoff)
|
||||||
triangles.Velocity = 1 + Math.Max(0, maxAmplitude - velocity_adjust_cutoff) * 50;
|
triangles.Velocity = 1 + Math.Max(0, maxAmplitude - velocity_adjust_cutoff) * 50;
|
||||||
|
@ -24,7 +24,8 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
public abstract class GameplayMenuOverlay : OverlayContainer, IKeyBindingHandler<GlobalAction>
|
public abstract class GameplayMenuOverlay : OverlayContainer, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
private const int transition_duration = 200;
|
protected const int TRANSITION_DURATION = 200;
|
||||||
|
|
||||||
private const int button_height = 70;
|
private const int button_height = 70;
|
||||||
private const float background_alpha = 0.75f;
|
private const float background_alpha = 0.75f;
|
||||||
|
|
||||||
@ -156,8 +157,8 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopIn() => this.FadeIn(transition_duration, Easing.In);
|
protected override void PopIn() => this.FadeIn(TRANSITION_DURATION, Easing.In);
|
||||||
protected override void PopOut() => this.FadeOut(transition_duration, Easing.In);
|
protected override void PopOut() => this.FadeOut(TRANSITION_DURATION, Easing.In);
|
||||||
|
|
||||||
// Don't let mouse down events through the overlay or people can click circles while paused.
|
// Don't let mouse down events through the overlay or people can click circles while paused.
|
||||||
protected override bool OnMouseDown(MouseDownEvent e) => true;
|
protected override bool OnMouseDown(MouseDownEvent e) => true;
|
||||||
|
@ -4,7 +4,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Audio;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Skinning;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
@ -13,17 +16,46 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
public Action OnResume;
|
public Action OnResume;
|
||||||
|
|
||||||
|
public override bool IsPresent => base.IsPresent || pauseLoop.IsPlaying;
|
||||||
|
|
||||||
public override string Header => "paused";
|
public override string Header => "paused";
|
||||||
public override string Description => "you're not going to do what i think you're going to do, are ya?";
|
public override string Description => "you're not going to do what i think you're going to do, are ya?";
|
||||||
|
|
||||||
|
private SkinnableSound pauseLoop;
|
||||||
|
|
||||||
protected override Action BackAction => () => InternalButtons.Children.First().Click();
|
protected override Action BackAction => () => InternalButtons.Children.First().Click();
|
||||||
|
|
||||||
|
private const float minimum_volume = 0.0001f;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
AddButton("Continue", colours.Green, () => OnResume?.Invoke());
|
AddButton("Continue", colours.Green, () => OnResume?.Invoke());
|
||||||
AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke());
|
AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke());
|
||||||
AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke());
|
AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke());
|
||||||
|
|
||||||
|
AddInternal(pauseLoop = new SkinnableSound(new SampleInfo("pause-loop"))
|
||||||
|
{
|
||||||
|
Looping = true,
|
||||||
|
});
|
||||||
|
|
||||||
|
// SkinnableSound only plays a sound if its aggregate volume is > 0, so the volume must be turned up before playing it
|
||||||
|
pauseLoop.VolumeTo(minimum_volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void PopIn()
|
||||||
|
{
|
||||||
|
base.PopIn();
|
||||||
|
|
||||||
|
pauseLoop.VolumeTo(1.0f, TRANSITION_DURATION, Easing.InQuint);
|
||||||
|
pauseLoop.Play();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void PopOut()
|
||||||
|
{
|
||||||
|
base.PopOut();
|
||||||
|
|
||||||
|
pauseLoop.VolumeTo(minimum_volume, TRANSITION_DURATION, Easing.OutQuad).Finally(_ => pauseLoop.Stop());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,10 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
public BindableNumber<double> Tempo => samplesContainer.Tempo;
|
public BindableNumber<double> Tempo => samplesContainer.Tempo;
|
||||||
|
|
||||||
|
public override bool IsPresent => Scheduler.HasPendingTasks || IsPlaying;
|
||||||
|
|
||||||
|
public bool IsPlaying => samplesContainer.Any(s => s.Playing);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Smoothly adjusts <see cref="Volume"/> over time.
|
/// Smoothly adjusts <see cref="Volume"/> over time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -97,8 +101,6 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
public void Stop() => samplesContainer.ForEach(c => c.Stop());
|
public void Stop() => samplesContainer.ForEach(c => c.Stop());
|
||||||
|
|
||||||
public override bool IsPresent => Scheduler.HasPendingTasks;
|
|
||||||
|
|
||||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||||
{
|
{
|
||||||
bool wasPlaying = samplesContainer.Any(s => s.Playing);
|
bool wasPlaying = samplesContainer.Any(s => s.Playing);
|
||||||
|
Loading…
Reference in New Issue
Block a user