1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 09:27:34 +08:00

Update usages of Menu to reflect ValueChanged events.

This commit is contained in:
smoogipooo 2017-08-28 11:01:53 +09:00
parent ee85515d95
commit 4385edeb45
3 changed files with 64 additions and 47 deletions

@ -1 +1 @@
Subproject commit 926d7c971d059c7aeb3ccfb09d06910c46aa3a40
Subproject commit 743ad1129edbc1cb8faa14ebc9a6d1846780795c

View File

@ -111,34 +111,45 @@ namespace osu.Game.Graphics.UserInterface
return base.OnClick(state);
}
protected override Drawable CreateContent() => new Container
protected override Drawable CreateContent()
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Children = new Drawable[]
var container = new Container
{
text = new OsuSpriteText
AutoSizeAxes = Axes.Both,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Children = new Drawable[]
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
TextSize = text_size,
Text = Item.Text,
Margin = new MarginPadding { Horizontal = margin_horizontal, Vertical = MARGIN_VERTICAL },
},
textBold = new OsuSpriteText
{
AlwaysPresent = true,
Alpha = 0,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
TextSize = text_size,
Text = Item.Text,
Font = @"Exo2.0-Bold",
Margin = new MarginPadding { Horizontal = margin_horizontal, Vertical = MARGIN_VERTICAL },
text = new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
TextSize = text_size,
Text = Item.Text,
Margin = new MarginPadding { Horizontal = margin_horizontal, Vertical = MARGIN_VERTICAL },
},
textBold = new OsuSpriteText
{
AlwaysPresent = true,
Alpha = 0,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
TextSize = text_size,
Text = Item.Text,
Font = @"Exo2.0-Bold",
Margin = new MarginPadding { Horizontal = margin_horizontal, Vertical = MARGIN_VERTICAL },
}
}
}
};
};
Item.Text.ValueChanged += newText =>
{
text.Text = newText;
textBold.Text = newText;
};
return container;
}
}
#endregion
}

View File

@ -120,32 +120,38 @@ namespace osu.Game.Graphics.UserInterface
chevron.Alpha = IsHovered ? 1 : 0;
}
protected override Drawable CreateContent() => new FillFlowContainer
protected override Drawable CreateContent()
{
Direction = FillDirection.Horizontal,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
var container = new FillFlowContainer
{
chevron = new SpriteIcon
Direction = FillDirection.Horizontal,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
AlwaysPresent = true,
Icon = FontAwesome.fa_chevron_right,
Colour = Color4.Black,
Alpha = 0.5f,
Size = new Vector2(8),
Margin = new MarginPadding { Left = 3, Right = 3 },
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
},
Label = new OsuSpriteText
{
Text = Item.Text,
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
chevron = new SpriteIcon
{
AlwaysPresent = true,
Icon = FontAwesome.fa_chevron_right,
Colour = Color4.Black,
Alpha = 0.5f,
Size = new Vector2(8),
Margin = new MarginPadding { Left = 3, Right = 3 },
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
},
Label = new OsuSpriteText
{
Text = Item.Text,
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
}
}
}
};
};
Item.Text.ValueChanged += newText => Label.Text = newText;
return container;
}
}
#endregion
}