mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 08:22:56 +08:00
Cleanups
This commit is contained in:
parent
092d16bb64
commit
1502a6c631
@ -43,14 +43,11 @@ namespace osu.Game.Overlays.Comments
|
|||||||
|
|
||||||
private readonly BindableBool isVoted = new BindableBool();
|
private readonly BindableBool isVoted = new BindableBool();
|
||||||
private readonly BindableInt votesCount = new BindableInt();
|
private readonly BindableInt votesCount = new BindableInt();
|
||||||
private bool disabled;
|
|
||||||
|
|
||||||
public VotePill(Comment comment)
|
public VotePill(Comment comment)
|
||||||
{
|
{
|
||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
|
|
||||||
Action = onAction;
|
|
||||||
|
|
||||||
AutoSizeAxes = Axes.X;
|
AutoSizeAxes = Axes.X;
|
||||||
Height = 20;
|
Height = 20;
|
||||||
LoadingAnimationSize = new Vector2(10);
|
LoadingAnimationSize = new Vector2(10);
|
||||||
@ -62,7 +59,8 @@ namespace osu.Game.Overlays.Comments
|
|||||||
AccentColour = borderContainer.BorderColour = sideNumber.Colour = colours.GreenLight;
|
AccentColour = borderContainer.BorderColour = sideNumber.Colour = colours.GreenLight;
|
||||||
hoverLayer.Colour = Color4.Black.Opacity(0.5f);
|
hoverLayer.Colour = Color4.Black.Opacity(0.5f);
|
||||||
|
|
||||||
disabled = api.LocalUser.Value.Id == comment.UserId;
|
if (api.LocalUser.Value.Id != comment.UserId)
|
||||||
|
Action = onAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -148,41 +146,30 @@ namespace osu.Game.Overlays.Comments
|
|||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
if (disabled)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
onHoverAction();
|
onHoverAction();
|
||||||
return base.OnHover(e);
|
return base.OnHover(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnHoverLost(HoverLostEvent e)
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
{
|
{
|
||||||
if (disabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
base.OnHoverLost(e);
|
base.OnHoverLost(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
|
||||||
{
|
|
||||||
if (disabled)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return base.OnClick(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateDisplay()
|
private void updateDisplay()
|
||||||
{
|
{
|
||||||
if (isVoted.Value)
|
if (Action != null)
|
||||||
{
|
{
|
||||||
hoverLayer.FadeTo(IsHovered ? 1 : 0);
|
if (isVoted.Value)
|
||||||
sideNumber.Hide();
|
{
|
||||||
}
|
hoverLayer.FadeTo(IsHovered ? 1 : 0);
|
||||||
else
|
sideNumber.Hide();
|
||||||
sideNumber.FadeTo(IsHovered ? 1 : 0);
|
}
|
||||||
|
else
|
||||||
|
sideNumber.FadeTo(IsHovered ? 1 : 0);
|
||||||
|
|
||||||
borderContainer.BorderThickness = IsHovered ? 3 : 0;
|
borderContainer.BorderThickness = IsHovered ? 3 : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onHoverAction()
|
private void onHoverAction()
|
||||||
|
Loading…
Reference in New Issue
Block a user