mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 07:06:35 +09:00
Merge branch 'master' into map-pool-autochange-fix
This commit is contained in:
@ -15,7 +15,7 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Desktop.Overlays
|
||||
{
|
||||
public class VersionManager : OverlayContainer
|
||||
public class VersionManager : VisibilityContainer
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, TextureStore textures, OsuGameBase game)
|
||||
|
39
osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs
Normal file
39
osu.Game.Tests/Visual/Online/TestSceneCommentsHeader.cs
Normal file
@ -0,0 +1,39 @@
|
||||
// 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.Bindables;
|
||||
using osu.Game.Overlays.Comments;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestSceneCommentsHeader : OsuTestScene
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(CommentsHeader),
|
||||
typeof(HeaderButton),
|
||||
typeof(SortTabControl),
|
||||
};
|
||||
|
||||
private readonly Bindable<CommentsSortCriteria> sort = new Bindable<CommentsSortCriteria>();
|
||||
private readonly BindableBool showDeleted = new BindableBool();
|
||||
|
||||
public TestSceneCommentsHeader()
|
||||
{
|
||||
Add(new CommentsHeader
|
||||
{
|
||||
Sort = { BindTarget = sort },
|
||||
ShowDeleted = { BindTarget = showDeleted }
|
||||
});
|
||||
|
||||
AddStep("Trigger ShowDeleted", () => showDeleted.Value = !showDeleted.Value);
|
||||
AddStep("Select old", () => sort.Value = CommentsSortCriteria.Old);
|
||||
AddStep("Select new", () => sort.Value = CommentsSortCriteria.New);
|
||||
AddStep("Select top", () => sort.Value = CommentsSortCriteria.Top);
|
||||
}
|
||||
}
|
||||
}
|
@ -102,7 +102,7 @@ namespace osu.Game
|
||||
|
||||
private readonly List<OverlayContainer> overlays = new List<OverlayContainer>();
|
||||
|
||||
private readonly List<OverlayContainer> toolbarElements = new List<OverlayContainer>();
|
||||
private readonly List<VisibilityContainer> toolbarElements = new List<VisibilityContainer>();
|
||||
|
||||
private readonly List<OverlayContainer> visibleBlockingOverlays = new List<OverlayContainer>();
|
||||
|
||||
|
128
osu.Game/Overlays/Comments/CommentsHeader.cs
Normal file
128
osu.Game/Overlays/Comments/CommentsHeader.cs
Normal file
@ -0,0 +1,128 @@
|
||||
// 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.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osuTK;
|
||||
using osu.Framework.Input.Events;
|
||||
|
||||
namespace osu.Game.Overlays.Comments
|
||||
{
|
||||
public class CommentsHeader : CompositeDrawable
|
||||
{
|
||||
private const int font_size = 14;
|
||||
|
||||
public readonly Bindable<CommentsSortCriteria> Sort = new Bindable<CommentsSortCriteria>();
|
||||
public readonly BindableBool ShowDeleted = new BindableBool();
|
||||
|
||||
private readonly Box background;
|
||||
|
||||
public CommentsHeader()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = 40;
|
||||
|
||||
AddRangeInternal(new Drawable[]
|
||||
{
|
||||
background = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Horizontal = 50 },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(10, 0),
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Font = OsuFont.GetFont(size: font_size),
|
||||
Text = @"Sort by"
|
||||
},
|
||||
new SortTabControl
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Current = Sort
|
||||
}
|
||||
}
|
||||
},
|
||||
new ShowDeletedButton
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
Checked = { BindTarget = ShowDeleted }
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
background.Colour = colours.Gray3;
|
||||
}
|
||||
|
||||
private class ShowDeletedButton : HeaderButton
|
||||
{
|
||||
public readonly BindableBool Checked = new BindableBool();
|
||||
|
||||
private readonly SpriteIcon checkboxIcon;
|
||||
|
||||
public ShowDeletedButton()
|
||||
{
|
||||
Add(new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(5, 0),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
checkboxIcon = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Size = new Vector2(10),
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Font = OsuFont.GetFont(size: font_size),
|
||||
Text = @"Show deleted"
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
Checked.BindValueChanged(isChecked => checkboxIcon.Icon = isChecked.NewValue ? FontAwesome.Solid.CheckSquare : FontAwesome.Regular.Square, true);
|
||||
base.LoadComplete();
|
||||
}
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
Checked.Value = !Checked.Value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
69
osu.Game/Overlays/Comments/HeaderButton.cs
Normal file
69
osu.Game/Overlays/Comments/HeaderButton.cs
Normal file
@ -0,0 +1,69 @@
|
||||
// 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.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Comments
|
||||
{
|
||||
public class HeaderButton : Container
|
||||
{
|
||||
private const int transition_duration = 200;
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
private readonly Box background;
|
||||
private readonly Container content;
|
||||
|
||||
public HeaderButton()
|
||||
{
|
||||
AutoSizeAxes = Axes.X;
|
||||
Height = 20;
|
||||
Masking = true;
|
||||
CornerRadius = 3;
|
||||
AddRangeInternal(new Drawable[]
|
||||
{
|
||||
background = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0,
|
||||
},
|
||||
content = new Container
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Margin = new MarginPadding { Horizontal = 10 }
|
||||
},
|
||||
new HoverClickSounds(),
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
background.Colour = colours.Gray4;
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
ShowBackground();
|
||||
return base.OnHover(e);
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
base.OnHoverLost(e);
|
||||
HideBackground();
|
||||
}
|
||||
|
||||
protected void ShowBackground() => background.FadeIn(transition_duration, Easing.OutQuint);
|
||||
|
||||
protected void HideBackground() => background.FadeOut(transition_duration, Easing.OutQuint);
|
||||
}
|
||||
}
|
109
osu.Game/Overlays/Comments/SortTabControl.cs
Normal file
109
osu.Game/Overlays/Comments/SortTabControl.cs
Normal file
@ -0,0 +1,109 @@
|
||||
// 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;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osuTK;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Allocation;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Comments
|
||||
{
|
||||
public class SortTabControl : OsuTabControl<CommentsSortCriteria>
|
||||
{
|
||||
protected override Dropdown<CommentsSortCriteria> CreateDropdown() => null;
|
||||
|
||||
protected override TabItem<CommentsSortCriteria> CreateTabItem(CommentsSortCriteria value) => new SortTabItem(value);
|
||||
|
||||
protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(5, 0),
|
||||
};
|
||||
|
||||
public SortTabControl()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
private class SortTabItem : TabItem<CommentsSortCriteria>
|
||||
{
|
||||
public SortTabItem(CommentsSortCriteria value)
|
||||
: base(value)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Child = new TabButton(value) { Active = { BindTarget = Active } };
|
||||
}
|
||||
|
||||
protected override void OnActivated()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDeactivated()
|
||||
{
|
||||
}
|
||||
|
||||
private class TabButton : HeaderButton
|
||||
{
|
||||
public readonly BindableBool Active = new BindableBool();
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
private readonly SpriteText text;
|
||||
|
||||
public TabButton(CommentsSortCriteria value)
|
||||
{
|
||||
Add(text = new SpriteText
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 14),
|
||||
Text = value.ToString()
|
||||
});
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Active.BindValueChanged(active =>
|
||||
{
|
||||
updateBackgroundState();
|
||||
|
||||
text.Font = text.Font.With(weight: active.NewValue ? FontWeight.Bold : FontWeight.Medium);
|
||||
text.Colour = active.NewValue ? colours.BlueLighter : Color4.White;
|
||||
}, true);
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
updateBackgroundState();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(HoverLostEvent e) => updateBackgroundState();
|
||||
|
||||
private void updateBackgroundState()
|
||||
{
|
||||
if (Active.Value || IsHovered)
|
||||
ShowBackground();
|
||||
else
|
||||
HideBackground();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum CommentsSortCriteria
|
||||
{
|
||||
New,
|
||||
Old,
|
||||
Top
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Music
|
||||
{
|
||||
public class PlaylistOverlay : OverlayContainer
|
||||
public class PlaylistOverlay : VisibilityContainer
|
||||
{
|
||||
private const float transition_duration = 600;
|
||||
private const float playlist_height = 510;
|
||||
|
@ -16,7 +16,7 @@ using osu.Game.Rulesets;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
public class Toolbar : OverlayContainer
|
||||
public class Toolbar : VisibilityContainer
|
||||
{
|
||||
public const float HEIGHT = 40;
|
||||
public const float TOOLTIP_HEIGHT = 30;
|
||||
@ -26,8 +26,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
private ToolbarUserButton userButton;
|
||||
private ToolbarRulesetSelector rulesetSelector;
|
||||
|
||||
protected override bool BlockPositionalInput => false;
|
||||
|
||||
private const double transition_time = 500;
|
||||
|
||||
private const float alpha_hovering = 0.8f;
|
||||
|
@ -19,7 +19,7 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public class VolumeOverlay : OverlayContainer
|
||||
public class VolumeOverlay : VisibilityContainer
|
||||
{
|
||||
private const float offset = 10;
|
||||
|
||||
@ -28,8 +28,6 @@ namespace osu.Game.Overlays
|
||||
private VolumeMeter volumeMeterMusic;
|
||||
private MuteButton muteButton;
|
||||
|
||||
protected override bool BlockPositionalInput => false;
|
||||
|
||||
private readonly BindableDouble muteAdjustment = new BindableDouble();
|
||||
|
||||
private readonly Bindable<bool> isMuted = new Bindable<bool>();
|
||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Screens.Play
|
||||
/// <summary>
|
||||
/// An overlay which can be used to require further user actions before gameplay is resumed.
|
||||
/// </summary>
|
||||
public abstract class ResumeOverlay : OverlayContainer
|
||||
public abstract class ResumeOverlay : VisibilityContainer
|
||||
{
|
||||
public CursorContainer GameplayCursor { get; set; }
|
||||
|
||||
@ -29,8 +29,6 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected const float TRANSITION_TIME = 500;
|
||||
|
||||
protected override bool BlockPositionalInput => false;
|
||||
|
||||
protected abstract string Message { get; }
|
||||
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
|
||||
|
@ -23,7 +23,7 @@ using osu.Game.Input.Bindings;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class SkipOverlay : OverlayContainer, IKeyBindingHandler<GlobalAction>
|
||||
public class SkipOverlay : VisibilityContainer, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
private readonly double startTime;
|
||||
|
||||
@ -36,7 +36,6 @@ namespace osu.Game.Screens.Play
|
||||
private double displayTime;
|
||||
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
|
||||
protected override bool BlockPositionalInput => false;
|
||||
|
||||
/// <summary>
|
||||
/// Displays a skip overlay, giving the user the ability to skip forward.
|
||||
|
@ -29,7 +29,7 @@ using osu.Game.Rulesets.UI;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
public class BeatmapInfoWedge : OverlayContainer
|
||||
public class BeatmapInfoWedge : VisibilityContainer
|
||||
{
|
||||
private const float shear_width = 36.75f;
|
||||
|
||||
@ -62,8 +62,6 @@ namespace osu.Game.Screens.Select
|
||||
ruleset.ValueChanged += _ => updateDisplay();
|
||||
}
|
||||
|
||||
protected override bool BlockPositionalInput => false;
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
this.MoveToX(0, 800, Easing.OutQuint);
|
||||
|
Reference in New Issue
Block a user