1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-07 13:07:25 +08:00

Merge branch 'master' into fix-replay-initial-frames

This commit is contained in:
Dan Balasescu 2020-01-30 15:16:24 +09:00 committed by GitHub
commit 3604730027
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 28 deletions

View File

@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual.Online
typeof(HeaderButton),
typeof(SortTabControl),
typeof(ShowChildrenButton),
typeof(DeletedChildrenPlaceholder),
typeof(DeletedCommentsCounter),
typeof(VotePill)
};

View File

@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Comments
private int currentPage;
private FillFlowContainer content;
private DeletedChildrenPlaceholder deletedChildrenPlaceholder;
private DeletedCommentsCounter deletedCommentsCounter;
private CommentsShowMoreButton moreButton;
private TotalCommentsCounter commentCounter;
@ -84,7 +84,7 @@ namespace osu.Game.Overlays.Comments
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
deletedChildrenPlaceholder = new DeletedChildrenPlaceholder
deletedCommentsCounter = new DeletedCommentsCounter
{
ShowDeleted = { BindTarget = ShowDeleted }
},
@ -153,7 +153,7 @@ namespace osu.Game.Overlays.Comments
private void clearComments()
{
currentPage = 1;
deletedChildrenPlaceholder.DeletedCount.Value = 0;
deletedCommentsCounter.Count.Value = 0;
moreButton.IsLoading = true;
content.Clear();
}
@ -184,7 +184,7 @@ namespace osu.Game.Overlays.Comments
{
content.Add(loaded);
deletedChildrenPlaceholder.DeletedCount.Value += response.Comments.Count(c => c.IsDeleted && c.IsTopLevel);
deletedCommentsCounter.Count.Value += response.Comments.Count(c => c.IsDeleted && c.IsTopLevel);
if (response.HasMore)
{

View File

@ -12,19 +12,24 @@ using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Comments
{
public class DeletedChildrenPlaceholder : FillFlowContainer
public class DeletedCommentsCounter : CompositeDrawable
{
public readonly BindableBool ShowDeleted = new BindableBool();
public readonly BindableInt DeletedCount = new BindableInt();
public readonly BindableInt Count = new BindableInt();
private readonly SpriteText countText;
public DeletedChildrenPlaceholder()
public DeletedCommentsCounter()
{
AutoSizeAxes = Axes.Both;
Direction = FillDirection.Horizontal;
Spacing = new Vector2(3, 0);
Margin = new MarginPadding { Vertical = 10, Left = 80 };
InternalChild = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(3, 0),
Children = new Drawable[]
{
new SpriteIcon
@ -36,27 +41,27 @@ namespace osu.Game.Overlays.Comments
{
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
}
}
};
}
protected override void LoadComplete()
{
DeletedCount.BindValueChanged(_ => updateDisplay(), true);
ShowDeleted.BindValueChanged(_ => updateDisplay(), true);
base.LoadComplete();
Count.BindValueChanged(_ => updateDisplay(), true);
ShowDeleted.BindValueChanged(_ => updateDisplay(), true);
}
private void updateDisplay()
{
if (DeletedCount.Value != 0)
if (!ShowDeleted.Value && Count.Value != 0)
{
countText.Text = @"deleted comment".ToQuantity(DeletedCount.Value);
this.FadeTo(ShowDeleted.Value ? 0 : 1);
countText.Text = @"deleted comment".ToQuantity(Count.Value);
Show();
}
else
{
Hide();
}
}
}
}

View File

@ -42,7 +42,7 @@ namespace osu.Game.Overlays.Comments
{
LinkFlowContainer username;
FillFlowContainer childCommentsContainer;
DeletedChildrenPlaceholder deletedChildrenPlaceholder;
DeletedCommentsCounter deletedCommentsCounter;
FillFlowContainer info;
LinkFlowContainer message;
GridContainer content;
@ -184,7 +184,7 @@ namespace osu.Game.Overlays.Comments
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical
},
deletedChildrenPlaceholder = new DeletedChildrenPlaceholder
deletedCommentsCounter = new DeletedCommentsCounter
{
ShowDeleted = { BindTarget = ShowDeleted }
}
@ -193,7 +193,7 @@ namespace osu.Game.Overlays.Comments
}
};
deletedChildrenPlaceholder.DeletedCount.Value = comment.DeletedChildrenCount;
deletedCommentsCounter.Count.Value = comment.DeletedChildrenCount;
if (comment.UserId.HasValue)
username.AddUserLink(comment.User);

View File

@ -24,6 +24,8 @@ namespace osu.Game.Screens.Select
[Resolved(typeof(Room))]
protected Bindable<PlaylistItem> CurrentItem { get; private set; }
public override bool AllowEditing => false;
[Resolved]
private BeatmapManager beatmaps { get; set; }

View File

@ -35,6 +35,7 @@ using System.Linq;
using System.Threading.Tasks;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings;
using osu.Game.Overlays.Notifications;
using osu.Game.Scoring;
namespace osu.Game.Screens.Select
@ -66,6 +67,14 @@ namespace osu.Game.Screens.Select
/// </summary>
protected Container FooterPanels { get; private set; }
/// <summary>
/// Whether entering editor mode should be allowed.
/// </summary>
public virtual bool AllowEditing => true;
[Resolved(canBeNull: true)]
private NotificationOverlay notificationOverlay { get; set; }
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
protected BeatmapCarousel Carousel { get; private set; }
@ -295,6 +304,12 @@ namespace osu.Game.Screens.Select
public void Edit(BeatmapInfo beatmap = null)
{
if (!AllowEditing)
{
notificationOverlay?.Post(new SimpleNotification { Text = "Editing is not available from the current mode." });
return;
}
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap ?? beatmapNoDebounce);
this.Push(new Editor());
}