Naming standardisation and enforcing.

This commit is contained in:
Dean Herbert
2017-02-07 16:15:45 +09:00
parent 50bd80cb0c
commit 6b011a50d2
28 changed files with 182 additions and 136 deletions

View File

@ -55,7 +55,7 @@ namespace osu.Game.Screens.Menu
AutoSizeAxes = Axes.Both;
Alpha = 0;
Vector2 boxSize = new Vector2(ButtonSystem.button_width + Math.Abs(extraWidth), ButtonSystem.button_area_height);
Vector2 boxSize = new Vector2(ButtonSystem.BUTTON_WIDTH + Math.Abs(extraWidth), ButtonSystem.BUTTON_AREA_HEIGHT);
Children = new Drawable[]
{
@ -75,7 +75,7 @@ namespace osu.Game.Screens.Menu
Colour = colour,
Scale = new Vector2(0, 1),
Size = boxSize,
Shear = new Vector2(ButtonSystem.wedge_width / boxSize.Y, 0),
Shear = new Vector2(ButtonSystem.WEDGE_WIDTH / boxSize.Y, 0),
Children = new Drawable[]
{
new Box

View File

@ -36,9 +36,9 @@ namespace osu.Game.Screens.Menu
private FlowContainerWithOrigin buttonFlow;
//todo: make these non-internal somehow.
internal const float button_area_height = 100;
internal const float button_width = 140f;
internal const float wedge_width = 20;
internal const float BUTTON_AREA_HEIGHT = 100;
internal const float BUTTON_WIDTH = 140f;
internal const float WEDGE_WIDTH = 20;
public const int EXIT_DELAY = 3000;
@ -64,7 +64,7 @@ namespace osu.Game.Screens.Menu
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.X,
Size = new Vector2(1, button_area_height),
Size = new Vector2(1, BUTTON_AREA_HEIGHT),
Alpha = 0,
Children = new Drawable[]
{
@ -81,14 +81,14 @@ namespace osu.Game.Screens.Menu
Direction = FlowDirection.HorizontalOnly,
Anchor = Anchor.Centre,
AutoSizeAxes = Axes.Both,
Spacing = new Vector2(-wedge_width, 0),
Spacing = new Vector2(-WEDGE_WIDTH, 0),
Children = new[]
{
settingsButton = new Button(@"settings", @"options", FontAwesome.fa_gear, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -wedge_width, Key.O),
backButton = new Button(@"back", @"back", FontAwesome.fa_osu_left_o, new Color4(51, 58, 94, 255), onBack, -wedge_width, Key.Escape),
settingsButton = new Button(@"settings", @"options", FontAwesome.fa_gear, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -WEDGE_WIDTH, Key.O),
backButton = new Button(@"back", @"back", FontAwesome.fa_osu_left_o, new Color4(51, 58, 94, 255), onBack, -WEDGE_WIDTH, Key.Escape),
iconFacade = new Container //need a container to make the osu! icon flow properly.
{
Size = new Vector2(0, button_area_height)
Size = new Vector2(0, BUTTON_AREA_HEIGHT)
}
},
CentreTarget = iconFacade
@ -103,11 +103,11 @@ namespace osu.Game.Screens.Menu
}
};
buttonsPlay.Add(new Button(@"solo", @"freeplay", FontAwesome.fa_user, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), wedge_width, Key.P));
buttonsPlay.Add(new Button(@"solo", @"freeplay", FontAwesome.fa_user, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P));
buttonsPlay.Add(new Button(@"multi", @"multiplayer", FontAwesome.fa_users, new Color4(94, 63, 186, 255), () => OnMulti?.Invoke(), 0, Key.M));
buttonsPlay.Add(new Button(@"chart", @"charts", FontAwesome.fa_osu_charts, new Color4(80, 53, 160, 255), () => OnChart?.Invoke()));
buttonsTopLevel.Add(new Button(@"play", @"play", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), onPlay, wedge_width, Key.P));
buttonsTopLevel.Add(new Button(@"play", @"play", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), onPlay, WEDGE_WIDTH, Key.P));
buttonsTopLevel.Add(new Button(@"osu!editor", @"edit", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E));
buttonsTopLevel.Add(new Button(@"osu!direct", @"direct", FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), () => OnDirect?.Invoke(), 0, Key.D));
buttonsTopLevel.Add(new Button(@"exit", @"exit", FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), onExit, 0, Key.Q));
@ -127,7 +127,7 @@ namespace osu.Game.Screens.Menu
base.LoadComplete();
// osuLogo.SizeForFlow relies on loading to be complete.
buttonFlow.Position = new Vector2(wedge_width * 2 - (button_width + osuLogo.SizeForFlow / 4), 0);
buttonFlow.Position = new Vector2(WEDGE_WIDTH * 2 - (BUTTON_WIDTH + osuLogo.SizeForFlow / 4), 0);
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)

View File

@ -18,7 +18,7 @@ namespace osu.Game.Screens.Play
{
protected override BackgroundMode CreateBackground() => new BackgroundModeBeatmap(Beatmap);
private static readonly Vector2 BACKGROUND_BLUR = new Vector2(20);
private static readonly Vector2 background_blur = new Vector2(20);
public FailDialog()
{
@ -34,7 +34,7 @@ namespace osu.Game.Screens.Play
protected override void OnEntering(GameMode last)
{
base.OnEntering(last);
Background.Schedule(() => (Background as BackgroundModeBeatmap)?.BlurTo(BACKGROUND_BLUR, 1000));
Background.Schedule(() => (Background as BackgroundModeBeatmap)?.BlurTo(background_blur, 1000));
}
protected override bool OnExiting(GameMode next)

View File

@ -18,14 +18,14 @@ namespace osu.Game.Screens.Ranking
{
protected override BackgroundMode CreateBackground() => new BackgroundModeBeatmap(Beatmap);
private static readonly Vector2 BACKGROUND_BLUR = new Vector2(20);
private static readonly Vector2 background_blur = new Vector2(20);
ScoreDisplay scoreDisplay;
protected override void OnEntering(GameMode last)
{
base.OnEntering(last);
Background.Schedule(() => (Background as BackgroundModeBeatmap)?.BlurTo(BACKGROUND_BLUR, 1000));
Background.Schedule(() => (Background as BackgroundModeBeatmap)?.BlurTo(background_blur, 1000));
}
protected override bool OnExiting(GameMode next)

View File

@ -30,13 +30,13 @@ namespace osu.Game.Screens.Select
public BeatmapPanel SelectedPanel { get; private set; }
private List<float> yPositions = new List<float>();
private CarouselLifetimeList<Panel> Lifetime;
private CarouselLifetimeList<Panel> lifetime;
public CarouselContainer()
{
DistanceDecayJump = 0.01;
Add(scrollableContent = new Container<Panel>(Lifetime = new CarouselLifetimeList<Panel>(DepthComparer))
Add(scrollableContent = new Container<Panel>(lifetime = new CarouselLifetimeList<Panel>(DepthComparer))
{
RelativeSizeAxes = Axes.X,
});
@ -187,9 +187,9 @@ namespace osu.Game.Screens.Select
private static float offsetX(float dist, float halfHeight)
{
// The radius of the circle the carousel moves on.
const float CIRCLE_RADIUS = 3;
double discriminant = Math.Max(0, CIRCLE_RADIUS * CIRCLE_RADIUS - dist * dist);
float x = (CIRCLE_RADIUS - (float)Math.Sqrt(discriminant)) * halfHeight;
const float circle_radius = 3;
double discriminant = Math.Max(0, circle_radius * circle_radius - dist * dist);
float x = (circle_radius - (float)Math.Sqrt(discriminant)) * halfHeight;
return 125 + x;
}
@ -226,7 +226,7 @@ namespace osu.Game.Screens.Select
float drawHeight = DrawHeight;
float halfHeight = drawHeight / 2;
foreach (Panel p in Lifetime.AliveItems)
foreach (Panel p in lifetime.AliveItems)
{
float panelPosY = p.Position.Y;
p.IsOnScreen = panelPosY >= Current - p.DrawHeight && panelPosY <= Current + drawHeight;
@ -240,12 +240,12 @@ namespace osu.Game.Screens.Select
int lastIndex = yPositions.BinarySearch(Current + drawHeight);
if (lastIndex < 0) lastIndex = ~lastIndex;
Lifetime.StartIndex = firstIndex;
Lifetime.EndIndex = lastIndex;
lifetime.StartIndex = firstIndex;
lifetime.EndIndex = lastIndex;
for (int i = firstIndex; i < lastIndex; ++i)
{
Panel p = Lifetime[i];
Panel p = lifetime[i];
if (p.State != PanelSelectedState.Hidden)
p.IsOnScreen = true; //we don't want to update the on-screen state of hidden pannels as they have incorrect (stacked) y values.
updatePanel(p, halfHeight);

View File

@ -81,13 +81,13 @@ namespace osu.Game.Screens.Select
set { text.Text = value; }
}
private void FadeActive()
private void fadeActive()
{
box.FadeIn(300);
text.FadeColour(Color4.White, 300);
}
private void FadeInactive()
private void fadeInactive()
{
box.FadeOut(300);
text.FadeColour(fadeColour, 300);
@ -101,9 +101,9 @@ namespace osu.Game.Screens.Select
{
active = value;
if (active)
FadeActive();
fadeActive();
else
FadeInactive();
fadeInactive();
}
}
@ -114,14 +114,14 @@ namespace osu.Game.Screens.Select
protected override bool OnHover(InputState state)
{
if (!active)
FadeActive();
fadeActive();
return true;
}
protected override void OnHoverLost(InputState state)
{
if (!active)
FadeInactive();
fadeInactive();
}
public TabItem()

View File

@ -54,10 +54,10 @@ namespace osu.Game.Screens.Select
public Footer()
{
const float bottomToolHeight = 50;
const float bottom_tool_height = 50;
RelativeSizeAxes = Axes.X;
Height = bottomToolHeight;
Height = bottom_tool_height;
Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre;
Children = new Drawable[]

View File

@ -48,7 +48,7 @@ namespace osu.Game.Screens.Select
private static readonly Vector2 wedged_container_start_position = new Vector2(0, 50);
private BeatmapInfoWedge beatmapInfoWedge;
private static readonly Vector2 BACKGROUND_BLUR = new Vector2(20);
private static readonly Vector2 background_blur = new Vector2(20);
private CancellationTokenSource initialAddSetsTask;
private AudioSample sampleChangeDifficulty;
@ -116,8 +116,8 @@ namespace osu.Game.Screens.Select
private void load(BeatmapDatabase beatmaps, AudioManager audio, BaseGame game,
OsuGame osuGame, OsuColour colours)
{
const float carouselWidth = 640;
const float bottomToolHeight = 50;
const float carousel_width = 640;
const float bottom_tool_height = 50;
beatmapGroups = new List<BeatmapGroup>();
Children = new Drawable[]
{
@ -130,14 +130,14 @@ namespace osu.Game.Screens.Select
new WedgeBackground
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Right = carouselWidth * 0.76f },
Padding = new MarginPadding { Right = carousel_width * 0.76f },
},
}
},
carousel = new CarouselContainer
{
RelativeSizeAxes = Axes.Y,
Size = new Vector2(carouselWidth, 1),
Size = new Vector2(carousel_width, 1),
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
},
@ -299,7 +299,7 @@ namespace osu.Game.Screens.Select
if (backgroundModeBeatmap != null)
{
backgroundModeBeatmap.Beatmap = beatmap;
backgroundModeBeatmap.BlurTo(BACKGROUND_BLUR, 1000);
backgroundModeBeatmap.BlurTo(background_blur, 1000);
}
if (beatmap != null)