Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key Counter #31

Merged
merged 19 commits into from
Sep 28, 2016
Merged

Key Counter #31

merged 19 commits into from
Sep 28, 2016

Conversation

huoyaoyuan
Copy link
Contributor

@huoyaoyuan huoyaoyuan commented Sep 23, 2016

An implementation for #29 .

Custom features:

  • Relative text position.
  • Custom text colors and fadings.

Preconditions:

@huoyaoyuan huoyaoyuan force-pushed the key-counter branch 2 times, most recently from db32f34 to 9cbe710 Compare September 24, 2016 01:16
Copy link
Member

@peppy peppy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good structure overall. suggestions attached.

private SpriteText countSpriteText;

public override string Name { get; }
public KeyCounter ParentCounter { get; set; }

This comment was marked as off-topic.


public override string Name { get; }
public KeyCounter ParentCounter { get; set; }
public int Counts { get; private set; }

This comment was marked as off-topic.


private void UpdateGlowSprite()
{
//can have a FadeTime property or const

This comment was marked as off-topic.

Origin = Anchor.Centre,
Children = new Drawable[]
{
glowSprite = new Sprite

This comment was marked as off-topic.

Colour = KeyUpTextColor
}
};
glowSprite.Hide();

This comment was marked as off-topic.

if (IsLit)
{
glowSprite.Show();
countSpriteText.FadeColour(KeyDownTextColor, 0);

This comment was marked as off-topic.

private void IncreaseCount()
{
Counts++;
countSpriteText.Text = Counts.ToString();

This comment was marked as off-topic.

@huoyaoyuan huoyaoyuan force-pushed the key-counter branch 3 times, most recently from 00a0159 to 604d896 Compare September 24, 2016 11:30
}

private List<KeyCounter> counters = new List<KeyCounter>();
//default capacity is 4, and osu! uses 4 keys usually, so it won't trouble

This comment was marked as off-topic.

@@ -0,0 +1,32 @@
using System;

This comment was marked as off-topic.

Text = Name,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Position = new Vector2(0, -buttonSprite.Height / 4),

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

private Sprite buttonSprite;
private Sprite glowSprite;
private Container textLayer;
private SpriteText keySpriteText;

This comment was marked as off-topic.

Width = buttonSprite.Width;
}

private void UpdateGlowSprite()

This comment was marked as off-topic.

This comment was marked as off-topic.

Copy link
Member

@peppy peppy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@peppy peppy merged commit cca5de2 into ppy:master Sep 28, 2016
@huoyaoyuan huoyaoyuan deleted the key-counter branch September 28, 2016 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants