1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 16:52:54 +08:00

Upodate some tab usages.

This commit is contained in:
Dean Herbert 2017-04-03 18:35:33 +09:00
parent b0ebacb06d
commit f6303d55ec
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
3 changed files with 24 additions and 33 deletions

View File

@ -36,9 +36,9 @@ namespace osu.Desktop.VisualTests.Tests
filter.PinItem(GroupMode.All);
filter.PinItem(GroupMode.RecentlyPlayed);
filter.ItemChanged += (sender, mode) =>
filter.SelectedItem.ValueChanged += (sender, args) =>
{
text.Text = "Currently Selected: " + mode.ToString();
text.Text = "Currently Selected: " + filter.SelectedItem.ToString();
};
}
}

View File

@ -21,7 +21,7 @@ namespace osu.Game.Graphics.UserInterface
{
protected override Dropdown<T> CreateDropdown() => new OsuTabDropdown();
protected override TabItem<T> CreateTabItem(T value) => new OsuTabItem { Value = value };
protected override TabItem<T> CreateTabItem(T value) => new OsuTabItem(value);
protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || Dropdown.Contains(screenSpacePos);
@ -75,16 +75,6 @@ namespace osu.Game.Graphics.UserInterface
}
}
public new T Value
{
get { return base.Value; }
set
{
base.Value = value;
text.Text = (value as Enum)?.GetDescription();
}
}
public override bool Active
{
get { return base.Active; }
@ -134,30 +124,31 @@ namespace osu.Game.Graphics.UserInterface
AccentColour = colours.Blue;
}
public OsuTabItem()
public OsuTabItem(T value) : base(value)
{
AutoSizeAxes = Axes.X;
RelativeSizeAxes = Axes.Y;
Children = new Drawable[]
{
text = new OsuSpriteText
{
Margin = new MarginPadding { Top = 5, Bottom = 5 },
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
TextSize = 14,
Font = @"Exo2.0-Bold", // Font should only turn bold when active?
},
box = new Box
{
RelativeSizeAxes = Axes.X,
Height = 1,
Alpha = 0,
Colour = Color4.White,
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
}
text = new OsuSpriteText
{
Margin = new MarginPadding { Top = 5, Bottom = 5 },
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
Text = (value as Enum)?.GetDescription(),
TextSize = 14,
Font = @"Exo2.0-Bold", // Font should only turn bold when active?
},
box = new Box
{
RelativeSizeAxes = Axes.X,
Height = 1,
Alpha = 0,
Colour = Color4.White,
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
}
};
}
}

View File

@ -61,10 +61,10 @@ namespace osu.Game.Screens.Select
},
};
tabs.ItemChanged += (sender, e) => invokeOnFilter();
tabs.SelectedItem.ValueChanged += (sender, e) => invokeOnFilter();
modsCheckbox.Action += (sender, e) => invokeOnFilter();
tabs.SelectedItem = BeatmapDetailTab.Global;
tabs.SelectedItem.Value = BeatmapDetailTab.Global;
}
}