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:
commit
3604730027
@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
typeof(HeaderButton),
|
typeof(HeaderButton),
|
||||||
typeof(SortTabControl),
|
typeof(SortTabControl),
|
||||||
typeof(ShowChildrenButton),
|
typeof(ShowChildrenButton),
|
||||||
typeof(DeletedChildrenPlaceholder),
|
typeof(DeletedCommentsCounter),
|
||||||
typeof(VotePill)
|
typeof(VotePill)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
private int currentPage;
|
private int currentPage;
|
||||||
|
|
||||||
private FillFlowContainer content;
|
private FillFlowContainer content;
|
||||||
private DeletedChildrenPlaceholder deletedChildrenPlaceholder;
|
private DeletedCommentsCounter deletedCommentsCounter;
|
||||||
private CommentsShowMoreButton moreButton;
|
private CommentsShowMoreButton moreButton;
|
||||||
private TotalCommentsCounter commentCounter;
|
private TotalCommentsCounter commentCounter;
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
deletedChildrenPlaceholder = new DeletedChildrenPlaceholder
|
deletedCommentsCounter = new DeletedCommentsCounter
|
||||||
{
|
{
|
||||||
ShowDeleted = { BindTarget = ShowDeleted }
|
ShowDeleted = { BindTarget = ShowDeleted }
|
||||||
},
|
},
|
||||||
@ -153,7 +153,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
private void clearComments()
|
private void clearComments()
|
||||||
{
|
{
|
||||||
currentPage = 1;
|
currentPage = 1;
|
||||||
deletedChildrenPlaceholder.DeletedCount.Value = 0;
|
deletedCommentsCounter.Count.Value = 0;
|
||||||
moreButton.IsLoading = true;
|
moreButton.IsLoading = true;
|
||||||
content.Clear();
|
content.Clear();
|
||||||
}
|
}
|
||||||
@ -184,7 +184,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
{
|
{
|
||||||
content.Add(loaded);
|
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)
|
if (response.HasMore)
|
||||||
{
|
{
|
||||||
|
@ -12,51 +12,56 @@ using osu.Game.Graphics.Sprites;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays.Comments
|
namespace osu.Game.Overlays.Comments
|
||||||
{
|
{
|
||||||
public class DeletedChildrenPlaceholder : FillFlowContainer
|
public class DeletedCommentsCounter : CompositeDrawable
|
||||||
{
|
{
|
||||||
public readonly BindableBool ShowDeleted = new BindableBool();
|
public readonly BindableBool ShowDeleted = new BindableBool();
|
||||||
public readonly BindableInt DeletedCount = new BindableInt();
|
|
||||||
|
public readonly BindableInt Count = new BindableInt();
|
||||||
|
|
||||||
private readonly SpriteText countText;
|
private readonly SpriteText countText;
|
||||||
|
|
||||||
public DeletedChildrenPlaceholder()
|
public DeletedCommentsCounter()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
Direction = FillDirection.Horizontal;
|
|
||||||
Spacing = new Vector2(3, 0);
|
|
||||||
Margin = new MarginPadding { Vertical = 10, Left = 80 };
|
Margin = new MarginPadding { Vertical = 10, Left = 80 };
|
||||||
Children = new Drawable[]
|
|
||||||
|
InternalChild = new FillFlowContainer
|
||||||
{
|
{
|
||||||
new SpriteIcon
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(3, 0),
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
Icon = FontAwesome.Solid.Trash,
|
new SpriteIcon
|
||||||
Size = new Vector2(14),
|
{
|
||||||
},
|
Icon = FontAwesome.Solid.Trash,
|
||||||
countText = new OsuSpriteText
|
Size = new Vector2(14),
|
||||||
{
|
},
|
||||||
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
|
countText = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
DeletedCount.BindValueChanged(_ => updateDisplay(), true);
|
|
||||||
ShowDeleted.BindValueChanged(_ => updateDisplay(), true);
|
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
|
Count.BindValueChanged(_ => updateDisplay(), true);
|
||||||
|
ShowDeleted.BindValueChanged(_ => updateDisplay(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDisplay()
|
private void updateDisplay()
|
||||||
{
|
{
|
||||||
if (DeletedCount.Value != 0)
|
if (!ShowDeleted.Value && Count.Value != 0)
|
||||||
{
|
{
|
||||||
countText.Text = @"deleted comment".ToQuantity(DeletedCount.Value);
|
countText.Text = @"deleted comment".ToQuantity(Count.Value);
|
||||||
this.FadeTo(ShowDeleted.Value ? 0 : 1);
|
Show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Hide();
|
Hide();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -42,7 +42,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
{
|
{
|
||||||
LinkFlowContainer username;
|
LinkFlowContainer username;
|
||||||
FillFlowContainer childCommentsContainer;
|
FillFlowContainer childCommentsContainer;
|
||||||
DeletedChildrenPlaceholder deletedChildrenPlaceholder;
|
DeletedCommentsCounter deletedCommentsCounter;
|
||||||
FillFlowContainer info;
|
FillFlowContainer info;
|
||||||
LinkFlowContainer message;
|
LinkFlowContainer message;
|
||||||
GridContainer content;
|
GridContainer content;
|
||||||
@ -184,7 +184,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Direction = FillDirection.Vertical
|
Direction = FillDirection.Vertical
|
||||||
},
|
},
|
||||||
deletedChildrenPlaceholder = new DeletedChildrenPlaceholder
|
deletedCommentsCounter = new DeletedCommentsCounter
|
||||||
{
|
{
|
||||||
ShowDeleted = { BindTarget = ShowDeleted }
|
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)
|
if (comment.UserId.HasValue)
|
||||||
username.AddUserLink(comment.User);
|
username.AddUserLink(comment.User);
|
||||||
|
@ -24,6 +24,8 @@ namespace osu.Game.Screens.Select
|
|||||||
[Resolved(typeof(Room))]
|
[Resolved(typeof(Room))]
|
||||||
protected Bindable<PlaylistItem> CurrentItem { get; private set; }
|
protected Bindable<PlaylistItem> CurrentItem { get; private set; }
|
||||||
|
|
||||||
|
public override bool AllowEditing => false;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapManager beatmaps { get; set; }
|
private BeatmapManager beatmaps { get; set; }
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
|
using osu.Game.Overlays.Notifications;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
@ -66,6 +67,14 @@ namespace osu.Game.Screens.Select
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected Container FooterPanels { get; private set; }
|
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 override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
|
||||||
|
|
||||||
protected BeatmapCarousel Carousel { get; private set; }
|
protected BeatmapCarousel Carousel { get; private set; }
|
||||||
@ -295,6 +304,12 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
public void Edit(BeatmapInfo beatmap = null)
|
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);
|
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap ?? beatmapNoDebounce);
|
||||||
this.Push(new Editor());
|
this.Push(new Editor());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user