Make VotePill background transparent for own comments

This commit is contained in:
Andrei Zavatski
2021-01-22 20:46:20 +03:00
parent 26779a9403
commit 6379381f95
2 changed files with 25 additions and 6 deletions

View File

@ -36,8 +36,10 @@ namespace osu.Game.Overlays.Comments
[Resolved]
private OverlayColourProvider colourProvider { get; set; }
protected Box Background { get; private set; }
private readonly Comment comment;
private Box background;
private Box hoverLayer;
private CircularContainer borderContainer;
private SpriteText sideNumber;
@ -62,8 +64,12 @@ namespace osu.Game.Overlays.Comments
AccentColour = borderContainer.BorderColour = sideNumber.Colour = colours.GreenLight;
hoverLayer.Colour = Color4.Black.Opacity(0.5f);
if (api.IsLoggedIn && api.LocalUser.Value.Id != comment.UserId)
var ownComment = api.LocalUser.Value.Id == comment.UserId;
if (api.IsLoggedIn && !ownComment)
Action = onAction;
Background.Alpha = ownComment ? 0 : 1;
}
protected override void LoadComplete()
@ -71,7 +77,7 @@ namespace osu.Game.Overlays.Comments
base.LoadComplete();
isVoted.Value = comment.IsVoted;
votesCount.Value = comment.VotesCount;
isVoted.BindValueChanged(voted => background.Colour = voted.NewValue ? AccentColour : colourProvider.Background6, true);
isVoted.BindValueChanged(voted => Background.Colour = voted.NewValue ? AccentColour : colourProvider.Background6, true);
votesCount.BindValueChanged(count => votesCounter.Text = $"+{count.NewValue}", true);
}
@ -102,7 +108,7 @@ namespace osu.Game.Overlays.Comments
Masking = true,
Children = new Drawable[]
{
background = new Box
Background = new Box
{
RelativeSizeAxes = Axes.Both
},