Merge pull request #2702 from DrabWeb/participant-count-default

Default ParticipantCount.Max to null
This commit is contained in:
Dean Herbert 2018-06-03 03:55:23 +09:00 committed by GitHub
commit 68910745d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 13 deletions

View File

@ -12,28 +12,23 @@ public class ParticipantCount : FillFlowContainer
private const float text_size = 30;
private const float transition_duration = 100;
private readonly OsuSpriteText count, slash, max;
private readonly OsuSpriteText count, slash, maxText;
public int Count
{
set => count.Text = value.ToString();
}
private int? max;
public int? Max
{
get => max;
set
{
if (value == null)
{
slash.FadeOut(transition_duration);
max.FadeOut(transition_duration);
}
else
{
slash.FadeIn(transition_duration);
max.Text = value.ToString();
max.FadeIn(transition_duration);
}
if (value == max) return;
max = value;
updateMax();
}
}
@ -56,12 +51,29 @@ public ParticipantCount()
TextSize = text_size,
Font = @"Exo2.0-Light"
},
max = new OsuSpriteText
maxText = new OsuSpriteText
{
TextSize = text_size,
Font = @"Exo2.0-Light"
},
};
updateMax();
}
private void updateMax()
{
if (Max == null)
{
slash.FadeOut(transition_duration);
maxText.FadeOut(transition_duration);
}
else
{
slash.FadeIn(transition_duration);
maxText.Text = Max.ToString();
maxText.FadeIn(transition_duration);
}
}
}
}