1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 21:03:08 +08:00

Merge branch 'master' into moarOptions

This commit is contained in:
Jorolf 2017-03-04 16:11:27 +01:00 committed by GitHub
commit 7eebee36ab
43 changed files with 177 additions and 178 deletions

@ -1 +1 @@
Subproject commit 798409058a421307b5a92aeea4cd60a065f5a0d4 Subproject commit 288236eaba95dfa15268a55f38c009a97d806f25

View File

@ -61,13 +61,13 @@ namespace osu.Desktop.Overlays
new FillFlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
new FillFlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FillDirection.Right, Direction = FillDirection.Horizontal,
Spacing = new Vector2(5), Spacing = new Vector2(5),
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,

View File

@ -25,7 +25,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Origin = Anchor.Centre; Origin = Anchor.Centre;
Direction = FillDirection.Down; Direction = FillDirection.Vertical;
Spacing = new Vector2(0, 2); Spacing = new Vector2(0, 2);
Position = (h?.StackedEndPosition ?? Vector2.Zero) + judgement.PositionOffset; Position = (h?.StackedEndPosition ?? Vector2.Zero) + judgement.PositionOffset;

View File

@ -12,6 +12,7 @@ namespace osu.Game.Modes.Osu
: base(hitObjectCount) : base(hitObjectCount)
{ {
Health.Value = 1; Health.Value = 1;
Accuracy.Value = 1;
} }
protected override void UpdateCalculations(JudgementInfo judgement) protected override void UpdateCalculations(JudgementInfo judgement)

View File

@ -86,7 +86,7 @@ namespace osu.Game.Beatmaps.Drawables
new FillFlowContainer new FillFlowContainer
{ {
Padding = new MarginPadding(5), Padding = new MarginPadding(5),
Direction = FillDirection.Right, Direction = FillDirection.Horizontal,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
@ -95,19 +95,17 @@ namespace osu.Game.Beatmaps.Drawables
new DifficultyIcon(beatmap) new DifficultyIcon(beatmap)
{ {
Scale = new Vector2(1.8f), Scale = new Vector2(1.8f),
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
}, },
new FillFlowContainer new FillFlowContainer
{ {
Padding = new MarginPadding { Left = 5 }, Padding = new MarginPadding { Left = 5 },
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
new FillFlowContainer new FillFlowContainer
{ {
Direction = FillDirection.Right, Direction = FillDirection.Horizontal,
Spacing = new Vector2(4, 0), Spacing = new Vector2(4, 0),
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = new[] Children = new[]

View File

@ -38,7 +38,7 @@ namespace osu.Game.Beatmaps.Drawables
}, },
new FillFlowContainer new FillFlowContainer
{ {
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
Padding = new MarginPadding { Top = 5, Left = 18, Right = 10, Bottom = 10 }, Padding = new MarginPadding { Top = 5, Left = 18, Right = 10, Bottom = 10 },
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = new[] Children = new[]
@ -111,7 +111,7 @@ namespace osu.Game.Beatmaps.Drawables
new FillFlowContainer new FillFlowContainer
{ {
Depth = -1, Depth = -1,
Direction = FillDirection.Right, Direction = FillDirection.Horizontal,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
// This makes the gradient not be perfectly horizontal, but diagonal at a ~40° angle // This makes the gradient not be perfectly horizontal, but diagonal at a ~40° angle
Shear = new Vector2(0.8f, 0), Shear = new Vector2(0.8f, 0),

View File

@ -18,10 +18,6 @@ namespace osu.Game.Beatmaps.Drawables
public override bool RemoveWhenNotAlive => false; public override bool RemoveWhenNotAlive => false;
public bool IsOnScreen;
public override bool IsAlive => IsOnScreen && base.IsAlive;
private Container nestedContainer; private Container nestedContainer;
protected override Container<Drawable> Content => nestedContainer; protected override Container<Drawable> Content => nestedContainer;

View File

@ -21,7 +21,7 @@ namespace osu.Game.Graphics.UserInterface
{ {
new FillFlowContainer new FillFlowContainer
{ {
Direction = FillDirection.Right, Direction = FillDirection.Horizontal,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Children = new Drawable[] Children = new Drawable[]

View File

@ -26,7 +26,7 @@ namespace osu.Game.Graphics.UserInterface
public PercentageCounter() public PercentageCounter()
{ {
DisplayedCountSpriteText.FixedWidth = true; DisplayedCountSpriteText.FixedWidth = true;
Count = 1.0f; Count = DisplayedCount = 1.0f;
} }
protected override string FormatCount(float count) protected override string FormatCount(float count)

View File

@ -71,7 +71,7 @@ namespace osu.Game.Graphics.UserInterface
stars = new FillFlowContainer<Star> stars = new FillFlowContainer<Star>
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FillDirection.Right, Direction = FillDirection.Horizontal,
Spacing = new Vector2(star_spacing), Spacing = new Vector2(star_spacing),
} }
}; };

View File

@ -41,7 +41,7 @@ namespace osu.Game.Online.Chat.Drawables
{ {
flow = new FillFlowContainer flow = new FillFlowContainer
{ {
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Left = 20, Right = 20 } Padding = new MarginPadding { Left = 20, Right = 20 }

View File

@ -173,7 +173,7 @@ namespace osu.Game.Overlays.Dialog
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Position = new Vector2(0f, -50f), Position = new Vector2(0f, -50f),
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
Spacing = new Vector2(0f, 10f), Spacing = new Vector2(0f, 10f),
Children = new Drawable[] Children = new Drawable[]
{ {
@ -236,7 +236,7 @@ namespace osu.Game.Overlays.Dialog
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
}, },
}, },
}, },

View File

@ -236,7 +236,7 @@ namespace osu.Game.Overlays.Mods
public ModButton(Mod m) public ModButton(Mod m)
{ {
Direction = FillDirection.Down; Direction = FillDirection.Vertical;
Spacing = new Vector2(0f, -5f); Spacing = new Vector2(0f, -5f);
Size = new Vector2(100f); Size = new Vector2(100f);

View File

@ -33,7 +33,7 @@ namespace osu.Game.Overlays.Mods
private FillFlowContainer<ModSection> modSectionsContainer; private FillFlowContainer<ModSection> modSectionsContainer;
public Bindable<Mod[]> SelectedMods = new Bindable<Mod[]>(); public readonly Bindable<Mod[]> SelectedMods = new Bindable<Mod[]>();
public readonly Bindable<PlayMode> PlayMode = new Bindable<PlayMode>(); public readonly Bindable<PlayMode> PlayMode = new Bindable<PlayMode>();
@ -95,8 +95,6 @@ namespace osu.Game.Overlays.Mods
section.ButtonsContainer.MoveToX(100f, APPEAR_DURATION, EasingTypes.InSine); section.ButtonsContainer.MoveToX(100f, APPEAR_DURATION, EasingTypes.InSine);
section.ButtonsContainer.FadeOut(APPEAR_DURATION, EasingTypes.InSine); section.ButtonsContainer.FadeOut(APPEAR_DURATION, EasingTypes.InSine);
} }
TriggerFocusLost();
} }
protected override void PopIn() protected override void PopIn()
@ -112,8 +110,6 @@ namespace osu.Game.Overlays.Mods
section.ButtonsContainer.MoveToX(0, button_duration, EasingTypes.OutQuint); section.ButtonsContainer.MoveToX(0, button_duration, EasingTypes.OutQuint);
section.ButtonsContainer.FadeIn(button_duration, EasingTypes.OutQuint); section.ButtonsContainer.FadeIn(button_duration, EasingTypes.OutQuint);
} }
Schedule(TriggerFocusContention);
} }
public void DeselectAll() public void DeselectAll()
@ -244,7 +240,7 @@ namespace osu.Game.Overlays.Mods
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
Spacing = new Vector2(0f, 10f), Spacing = new Vector2(0f, 10f),
Children = new Drawable[] Children = new Drawable[]
{ {
@ -268,7 +264,7 @@ namespace osu.Game.Overlays.Mods
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
Width = content_width, Width = content_width,
Padding = new MarginPadding Padding = new MarginPadding
{ {
@ -336,7 +332,7 @@ namespace osu.Game.Overlays.Mods
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Width = content_width, Width = content_width,
Direction = FillDirection.Right, Direction = FillDirection.Horizontal,
Padding = new MarginPadding Padding = new MarginPadding
{ {
Top = 20, Top = 20,

View File

@ -46,7 +46,7 @@ namespace osu.Game.Overlays
{ {
sections = new FillFlowContainer<NotificationSection> sections = new FillFlowContainer<NotificationSection>
{ {
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Children = new [] Children = new []

View File

@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Notifications
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Direction = FillDirection.Down; Direction = FillDirection.Vertical;
Padding = new MarginPadding Padding = new MarginPadding
{ {

View File

@ -89,7 +89,7 @@ namespace osu.Game.Overlays.Options
{ {
Items = new KeyValuePair<string, T>[0]; Items = new KeyValuePair<string, T>[0];
Direction = FillDirection.Down; Direction = FillDirection.Vertical;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Children = new Drawable[] Children = new Drawable[]

View File

@ -61,7 +61,7 @@ namespace osu.Game.Overlays.Options
FlowContent = new FillFlowContainer FlowContent = new FillFlowContainer
{ {
Margin = new MarginPadding { Top = header_size + header_margin }, Margin = new MarginPadding { Top = header_size + header_margin },
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 30), Spacing = new Vector2(0, 30),
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,

View File

@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Options
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Direction = FillDirection.Down; Direction = FillDirection.Vertical;
AddInternal(new Drawable[] AddInternal(new Drawable[]
{ {
new OsuSpriteText new OsuSpriteText
@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Options
}, },
content = new FillFlowContainer content = new FillFlowContainer
{ {
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 5), Spacing = new Vector2(0, 5),
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,

View File

@ -100,7 +100,7 @@ namespace osu.Game.Overlays.Options.Sections.General
private void load(APIAccess api, OsuConfigManager config) private void load(APIAccess api, OsuConfigManager config)
{ {
this.api = api; this.api = api;
Direction = FillDirection.Down; Direction = FillDirection.Vertical;
Spacing = new Vector2(0, 5); Spacing = new Vector2(0, 5);
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;

View File

@ -39,12 +39,20 @@ namespace osu.Game.Overlays.Options.Sections
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = "Run osu! updater", Text = "Run osu! updater",
}, },
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new[]
{
new OptionLabel new OptionLabel
{ {
Text = "TODO: osu version here", Text = "osu!lazer",
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
}, },
}
}
}; };
} }
} }

View File

@ -40,7 +40,7 @@ namespace osu.Game.Overlays.Options
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
} }
} }
}, },

View File

@ -77,7 +77,7 @@ namespace osu.Game.Overlays
{ {
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
@ -98,7 +98,7 @@ namespace osu.Game.Overlays
{ {
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
Children = sections, Children = sections,
} }
} }

View File

@ -43,7 +43,7 @@ namespace osu.Game.Overlays.Toolbar
new ToolbarBackground(), new ToolbarBackground(),
new FillFlowContainer new FillFlowContainer
{ {
Direction = FillDirection.Right, Direction = FillDirection.Horizontal,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
Children = new Drawable[] Children = new Drawable[]
@ -66,7 +66,7 @@ namespace osu.Game.Overlays.Toolbar
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Direction = FillDirection.Right, Direction = FillDirection.Horizontal,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
Children = new Drawable[] Children = new Drawable[]

View File

@ -84,7 +84,7 @@ namespace osu.Game.Overlays.Toolbar
}, },
Flow = new FillFlowContainer Flow = new FillFlowContainer
{ {
Direction = FillDirection.Right, Direction = FillDirection.Horizontal,
Spacing = new Vector2(5), Spacing = new Vector2(5),
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
@ -107,7 +107,7 @@ namespace osu.Game.Overlays.Toolbar
}, },
tooltipContainer = new FillFlowContainer tooltipContainer = new FillFlowContainer
{ {
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
RelativeSizeAxes = Axes.Both, //stops us being considered in parent's autosize RelativeSizeAxes = Axes.Both, //stops us being considered in parent's autosize
Anchor = (TooltipAnchor & Anchor.x0) > 0 ? Anchor.BottomLeft : Anchor.BottomRight, Anchor = (TooltipAnchor & Anchor.x0) > 0 ? Anchor.BottomLeft : Anchor.BottomRight,
Origin = TooltipAnchor, Origin = TooltipAnchor,

View File

@ -36,7 +36,7 @@ namespace osu.Game.Overlays.Toolbar
{ {
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
Direction = FillDirection.Right, Direction = FillDirection.Horizontal,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Padding = new MarginPadding { Left = padding, Right = padding }, Padding = new MarginPadding { Left = padding, Right = padding },

View File

@ -9,6 +9,8 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using OpenTK; using OpenTK;
using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.Transforms;
using osu.Framework.Graphics.Primitives;
using System;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
@ -86,9 +88,10 @@ namespace osu.Game.Overlays
AddInternal(wavesContainer = new Container<Wave> AddInternal(wavesContainer = new Container<Wave>
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Masking = true,
Children = new[] Children = new[]
{ {
firstWave = new Wave firstWave = new Wave
@ -123,19 +126,13 @@ namespace osu.Game.Overlays
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.White.Opacity(50),
},
},
}); });
} }
protected override void PopIn() protected override void PopIn()
{ {
base.PopIn();
foreach (var w in wavesContainer.Children) foreach (var w in wavesContainer.Children)
w.State = Visibility.Visible; w.State = Visibility.Visible;
@ -145,6 +142,8 @@ namespace osu.Game.Overlays
protected override void PopOut() protected override void PopOut()
{ {
base.PopOut();
contentContainer.FadeOut(DISAPPEAR_DURATION, EasingTypes.In); contentContainer.FadeOut(DISAPPEAR_DURATION, EasingTypes.In);
contentContainer.MoveToY(DrawHeight * 2f, DISAPPEAR_DURATION, EasingTypes.In); contentContainer.MoveToY(DrawHeight * 2f, DISAPPEAR_DURATION, EasingTypes.In);
@ -152,14 +151,23 @@ namespace osu.Game.Overlays
w.State = Visibility.Hidden; w.State = Visibility.Hidden;
} }
protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();
// This is done as an optimization, such that invisible parts of the waves
// are masked away, and thus do not consume fill rate.
wavesContainer.Height = Math.Max(0, DrawHeight - (contentContainer.DrawHeight - contentContainer.Y));
}
private class Wave : Container, IStateful<Visibility> private class Wave : Container, IStateful<Visibility>
{ {
public float FinalPosition; public float FinalPosition;
public Wave() public Wave()
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.X;
Size = new Vector2(1.5f); Width = 1.5f;
Masking = true; Masking = true;
EdgeEffect = new EdgeEffect EdgeEffect = new EdgeEffect
{ {
@ -177,6 +185,15 @@ namespace osu.Game.Overlays
}; };
} }
protected override void Update()
{
base.Update();
// We can not use RelativeSizeAxes for Height, because the height
// of our parent diminishes as the content moves up.
Height = Parent.Parent.DrawSize.Y * 1.5f;
}
private Visibility state; private Visibility state;
public Visibility State public Visibility State
{ {
@ -188,7 +205,7 @@ namespace osu.Game.Overlays
switch (value) switch (value)
{ {
case Visibility.Hidden: case Visibility.Hidden:
MoveToY(DrawHeight / Height, DISAPPEAR_DURATION, easing_hide); MoveToY(Parent.Parent.DrawSize.Y, DISAPPEAR_DURATION, easing_hide);
break; break;
case Visibility.Visible: case Visibility.Visible:
MoveToY(FinalPosition, APPEAR_DURATION, easing_show); MoveToY(FinalPosition, APPEAR_DURATION, easing_show);

View File

@ -126,7 +126,7 @@ namespace osu.Game.Screens
}, },
childModeButtons = new FillFlowContainer childModeButtons = new FillFlowContainer
{ {
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,

View File

@ -78,7 +78,7 @@ namespace osu.Game.Screens.Menu
}, },
buttonFlow = new FlowContainerWithOrigin buttonFlow = new FlowContainerWithOrigin
{ {
Direction = FillDirection.Right, Direction = FillDirection.Horizontal,
Spacing = new Vector2(-WEDGE_WIDTH, 0), Spacing = new Vector2(-WEDGE_WIDTH, 0),
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,

View File

@ -32,7 +32,7 @@ namespace osu.Game.Screens.Menu
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 2), Spacing = new Vector2(0, 2),
Children = new Drawable[] Children = new Drawable[]
{ {

View File

@ -12,7 +12,7 @@ namespace osu.Game.Screens.Play
{ {
public KeyCounterCollection() public KeyCounterCollection()
{ {
Direction = FillDirection.Right; Direction = FillDirection.Horizontal;
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
} }

View File

@ -105,7 +105,7 @@ namespace osu.Game.Screens.Play
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 50), Spacing = new Vector2(0, 50),
Origin = Anchor.Centre, Origin = Anchor.Centre,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
@ -113,11 +113,12 @@ namespace osu.Game.Screens.Play
{ {
new FillFlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Down,
Spacing = new Vector2(0, 20),
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 20),
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText new OsuSpriteText
@ -144,6 +145,8 @@ namespace osu.Game.Screens.Play
}, },
new FillFlowContainer new FillFlowContainer
{ {
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Masking = true, Masking = true,
@ -188,9 +191,9 @@ namespace osu.Game.Screens.Play
}, },
retryCounterContainer = new FillFlowContainer retryCounterContainer = new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre Anchor = Anchor.TopCentre,
AutoSizeAxes = Axes.Both,
} }
} }
}, },

View File

@ -136,7 +136,7 @@ namespace osu.Game.Screens.Play
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText new OsuSpriteText

View File

@ -68,7 +68,7 @@ namespace osu.Game.Screens.Ranking
new FillFlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText new OsuSpriteText

View File

@ -125,7 +125,7 @@ namespace osu.Game.Screens.Select
{ {
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 }, Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 },
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
@ -147,7 +147,7 @@ namespace osu.Game.Screens.Select
new FillFlowContainer new FillFlowContainer
{ {
Margin = new MarginPadding { Top = 10 }, Margin = new MarginPadding { Top = 10 },
Direction = FillDirection.Right, Direction = FillDirection.Horizontal,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = new [] Children = new []
{ {

View File

@ -16,6 +16,7 @@ using osu.Framework.Input;
using OpenTK.Input; using OpenTK.Input;
using System.Collections; using System.Collections;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using System.Diagnostics;
namespace osu.Game.Screens.Select namespace osu.Game.Screens.Select
{ {
@ -23,73 +24,33 @@ namespace osu.Game.Screens.Select
{ {
private Container<Panel> scrollableContent; private Container<Panel> scrollableContent;
private List<BeatmapGroup> groups = new List<BeatmapGroup>(); private List<BeatmapGroup> groups = new List<BeatmapGroup>();
private List<Panel> panels = new List<Panel>();
public BeatmapGroup SelectedGroup { get; private set; } public BeatmapGroup SelectedGroup { get; private set; }
public BeatmapPanel SelectedPanel { get; private set; } public BeatmapPanel SelectedPanel { get; private set; }
private List<float> yPositions = new List<float>(); private List<float> yPositions = new List<float>();
private CarouselLifetimeList<Panel> lifetime;
public CarouselContainer() public CarouselContainer()
{ {
DistanceDecayJump = 0.01; DistanceDecayJump = 0.01;
Add(scrollableContent = new Container<Panel>(lifetime = new CarouselLifetimeList<Panel>(DepthComparer)) Add(scrollableContent = new Container<Panel>
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
}); });
} }
internal class CarouselLifetimeList<T> : LifetimeList<Panel>
{
public CarouselLifetimeList(IComparer<Panel> comparer)
: base(comparer)
{
}
public int StartIndex;
public int EndIndex;
public override bool Update(FrameTimeInfo time)
{
bool anyAliveChanged = false;
//check existing items to make sure they haven't died.
foreach (var item in AliveItems.ToArray())
{
item.UpdateTime(time);
if (!item.IsAlive)
{
//todo: make this more efficient
int i = IndexOf(item);
anyAliveChanged |= CheckItem(item, ref i);
}
}
//handle custom range
for (int i = StartIndex; i < EndIndex; i++)
{
var item = this[i];
item.UpdateTime(time);
anyAliveChanged |= CheckItem(item, ref i);
}
return anyAliveChanged;
}
}
public void AddGroup(BeatmapGroup group) public void AddGroup(BeatmapGroup group)
{ {
group.State = BeatmapGroupState.Collapsed;
groups.Add(group); groups.Add(group);
group.Header.Depth = -scrollableContent.Children.Count(); panels.Add(group.Header);
scrollableContent.Add(group.Header); group.Header.UpdateClock(Clock);
foreach (BeatmapPanel panel in group.BeatmapPanels) foreach (BeatmapPanel panel in group.BeatmapPanels)
{ {
panel.Depth = -scrollableContent.Children.Count(); panels.Add(panel);
scrollableContent.Add(panel); panel.UpdateClock(Clock);
} }
computeYPositions(); computeYPositions();
@ -98,6 +59,9 @@ namespace osu.Game.Screens.Select
public void RemoveGroup(BeatmapGroup group) public void RemoveGroup(BeatmapGroup group)
{ {
groups.Remove(group); groups.Remove(group);
foreach (var p in group.BeatmapPanels)
panels.Remove(p);
scrollableContent.Remove(group.Header); scrollableContent.Remove(group.Header);
scrollableContent.Remove(group.BeatmapPanels); scrollableContent.Remove(group.BeatmapPanels);
@ -107,7 +71,7 @@ namespace osu.Game.Screens.Select
private void movePanel(Panel panel, bool advance, bool animated, ref float currentY) private void movePanel(Panel panel, bool advance, bool animated, ref float currentY)
{ {
yPositions.Add(currentY); yPositions.Add(currentY);
panel.MoveToY(currentY, animated && (panel.IsOnScreen || panel.State != PanelSelectedState.Hidden) ? 750 : 0, EasingTypes.OutExpo); panel.MoveToY(currentY, animated ? 750 : 0, EasingTypes.OutExpo);
if (advance) if (advance)
currentY += panel.DrawHeight + 5; currentY += panel.DrawHeight + 5;
@ -172,14 +136,16 @@ namespace osu.Game.Screens.Select
var panel = group.BeatmapPanels.FirstOrDefault(p => p.Beatmap.Equals(beatmap)); var panel = group.BeatmapPanels.FirstOrDefault(p => p.Beatmap.Equals(beatmap));
if (panel != null) if (panel != null)
{ {
SelectGroup(group, panel, animated); selectGroup(group, panel, animated);
return; return;
} }
} }
} }
public void SelectGroup(BeatmapGroup group, BeatmapPanel panel, bool animated = true) private void selectGroup(BeatmapGroup group, BeatmapPanel panel, bool animated = true)
{ {
Trace.Assert(group.BeatmapPanels.Contains(panel), @"Selected panel must be in provided group");
if (SelectedGroup != null && SelectedGroup != group && SelectedGroup.State != BeatmapGroupState.Hidden) if (SelectedGroup != null && SelectedGroup != group && SelectedGroup.State != BeatmapGroupState.Hidden)
SelectedGroup.State = BeatmapGroupState.Collapsed; SelectedGroup.State = BeatmapGroupState.Collapsed;
@ -194,19 +160,20 @@ namespace osu.Game.Screens.Select
public void Sort(FilterControl.SortMode mode) public void Sort(FilterControl.SortMode mode)
{ {
List<BeatmapGroup> sortedGroups = new List<BeatmapGroup>(groups);
switch (mode) switch (mode)
{ {
case FilterControl.SortMode.Artist: case FilterControl.SortMode.Artist:
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Artist, y.BeatmapSet.Metadata.Artist)); sortedGroups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Artist, y.BeatmapSet.Metadata.Artist));
break; break;
case FilterControl.SortMode.Title: case FilterControl.SortMode.Title:
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Title, y.BeatmapSet.Metadata.Title)); sortedGroups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Title, y.BeatmapSet.Metadata.Title));
break; break;
case FilterControl.SortMode.Author: case FilterControl.SortMode.Author:
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Author, y.BeatmapSet.Metadata.Author)); sortedGroups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Author, y.BeatmapSet.Metadata.Author));
break; break;
case FilterControl.SortMode.Difficulty: case FilterControl.SortMode.Difficulty:
groups.Sort((x, y) => sortedGroups.Sort((x, y) =>
{ {
float xAverage = 0, yAverage = 0; float xAverage = 0, yAverage = 0;
int counter = 0; int counter = 0;
@ -232,22 +199,23 @@ namespace osu.Game.Screens.Select
default: default:
throw new NotImplementedException(); throw new NotImplementedException();
} }
scrollableContent.Clear(false); scrollableContent.Clear(false);
lifetime.Clear(); panels.Clear();
foreach (BeatmapGroup group in groups) groups.Clear();
{
group.Header.Depth = -scrollableContent.Children.Count();
scrollableContent.Add(group.Header);
foreach (BeatmapPanel panel in group.BeatmapPanels)
{
panel.Depth = -scrollableContent.Children.Count();
scrollableContent.Add(panel);
}
}
foreach (BeatmapGroup group in sortedGroups)
AddGroup(group);
} }
/// <summary>
/// Computes the x-offset of currently visible panels. Makes the carousel appear round.
/// </summary>
/// <param name="dist">
/// Vertical distance from the center of the carousel container
/// ranging from -1 to 1.
/// </param>
/// <param name="halfHeight">Half the height of the carousel container.</param>
private static float offsetX(float dist, float halfHeight) private static float offsetX(float dist, float halfHeight)
{ {
// The radius of the circle the carousel moves on. // The radius of the circle the carousel moves on.
@ -286,36 +254,48 @@ namespace osu.Game.Screens.Select
{ {
base.Update(); base.Update();
// Determine which items stopped being on screen for future removal from the lifetimelist.
float drawHeight = DrawHeight; float drawHeight = DrawHeight;
float halfHeight = drawHeight / 2;
foreach (Panel p in lifetime.AliveItems) // Remove all panels that should no longer be on-screen
scrollableContent.RemoveAll(delegate (Panel p)
{ {
float panelPosY = p.Position.Y; float panelPosY = p.Position.Y;
p.IsOnScreen = panelPosY >= Current - p.DrawHeight && panelPosY <= Current + drawHeight; bool remove = panelPosY < Current - p.DrawHeight || panelPosY > Current + drawHeight || !p.IsPresent;
updatePanel(p, halfHeight); return remove;
} });
// Find index range of all panels that should be on-screen
Trace.Assert(panels.Count == yPositions.Count);
// Determine range of indices for items that are now definitely on screen to be added
// to the lifetimelist in the future.
int firstIndex = yPositions.BinarySearch(Current - Panel.MAX_HEIGHT); int firstIndex = yPositions.BinarySearch(Current - Panel.MAX_HEIGHT);
if (firstIndex < 0) firstIndex = ~firstIndex; if (firstIndex < 0) firstIndex = ~firstIndex;
int lastIndex = yPositions.BinarySearch(Current + drawHeight); int lastIndex = yPositions.BinarySearch(Current + drawHeight);
if (lastIndex < 0) lastIndex = ~lastIndex; if (lastIndex < 0) lastIndex = ~lastIndex;
lifetime.StartIndex = firstIndex; // Add those panels within the previously found index range that should be displayed.
lifetime.EndIndex = lastIndex;
for (int i = firstIndex; i < lastIndex; ++i) for (int i = firstIndex; i < lastIndex; ++i)
{ {
Panel p = lifetime[i]; Panel panel = panels[i];
if (p.State != PanelSelectedState.Hidden) if (panel.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. continue;
updatePanel(p, halfHeight);
// Only add if we're not already part of the content.
if (!scrollableContent.Contains(panel))
{
// Makes sure headers are always _below_ panels,
// and depth flows downward.
panel.Depth = i + (panel is BeatmapSetHeader ? panels.Count : 0);
scrollableContent.Add(panel);
} }
} }
// Update externally controlled state of currently visible panels
// (e.g. x-offset and opacity).
float halfHeight = drawHeight / 2;
foreach (Panel p in scrollableContent.Children)
updatePanel(p, halfHeight);
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{ {
int direction = 0; int direction = 0;
@ -355,7 +335,7 @@ namespace osu.Game.Screens.Select
if (i >= 0 && i < SelectedGroup.BeatmapPanels.Count) if (i >= 0 && i < SelectedGroup.BeatmapPanels.Count)
{ {
//changing difficulty panel, not set. //changing difficulty panel, not set.
SelectGroup(SelectedGroup, SelectedGroup.BeatmapPanels[i]); selectGroup(SelectedGroup, SelectedGroup.BeatmapPanels[i]);
return; return;
} }
} }
@ -381,9 +361,11 @@ namespace osu.Game.Screens.Select
return; return;
BeatmapGroup group = visibleGroups[RNG.Next(visibleGroups.Count)]; BeatmapGroup group = visibleGroups[RNG.Next(visibleGroups.Count)];
BeatmapPanel panel = group?.BeatmapPanels.First(); BeatmapPanel panel = group?.BeatmapPanels.First();
if (panel == null) if (panel == null)
return; return;
SelectGroup(group, panel);
selectGroup(group, panel);
} }
public IEnumerator<BeatmapGroup> GetEnumerator() => groups.GetEnumerator(); public IEnumerator<BeatmapGroup> GetEnumerator() => groups.GetEnumerator();

View File

@ -55,7 +55,7 @@ namespace osu.Game.Screens.Select
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Width = 0.4f, // TODO: InnerWidth property or something Width = 0.4f, // TODO: InnerWidth property or something
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
searchTextBox = new SearchTextBox { searchTextBox = new SearchTextBox {
@ -188,7 +188,7 @@ namespace osu.Game.Screens.Select
new FillFlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FillDirection.Right, Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0), Spacing = new Vector2(10, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
@ -210,17 +210,16 @@ namespace osu.Game.Screens.Select
groupsEllipsis = new TextAwesome groupsEllipsis = new TextAwesome
{ {
Icon = FontAwesome.fa_ellipsis_h, Icon = FontAwesome.fa_ellipsis_h,
Origin = Anchor.TopLeft,
TextSize = 14, TextSize = 14,
Margin = new MarginPadding { Top = 5, Bottom = 5 }, Margin = new MarginPadding { Top = 5, Bottom = 5 },
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
} }
} }
}, },
new FillFlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FillDirection.Right, Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0), Spacing = new Vector2(10, 0),
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
@ -241,10 +240,9 @@ namespace osu.Game.Screens.Select
sortEllipsis = new TextAwesome sortEllipsis = new TextAwesome
{ {
Icon = FontAwesome.fa_ellipsis_h, Icon = FontAwesome.fa_ellipsis_h,
Origin = Anchor.TopLeft,
TextSize = 14, TextSize = 14,
Margin = new MarginPadding { Top = 5, Bottom = 5 }, Margin = new MarginPadding { Top = 5, Bottom = 5 },
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
} }
} }
}, },

View File

@ -98,13 +98,13 @@ namespace osu.Game.Screens.Select
Position = new Vector2(BackButton.SIZE_EXTENDED.X + padding, 0), Position = new Vector2(BackButton.SIZE_EXTENDED.X + padding, 0),
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
Direction = FillDirection.Right, Direction = FillDirection.Horizontal,
Spacing = new Vector2(padding, 0), Spacing = new Vector2(padding, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
buttons = new FillFlowContainer buttons = new FillFlowContainer
{ {
Direction = FillDirection.Right, Direction = FillDirection.Horizontal,
Spacing = new Vector2(0.2f, 0), Spacing = new Vector2(0.2f, 0),
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
} }

View File

@ -115,7 +115,7 @@ namespace osu.Game.Screens.Select.Options
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
iconText = new TextAwesome iconText = new TextAwesome

View File

@ -132,7 +132,7 @@ namespace osu.Game.Screens.Select.Options
public ButtonFlow() public ButtonFlow()
{ {
Direction = FillDirection.Right; Direction = FillDirection.Horizontal;
} }
} }
} }

View File

@ -396,6 +396,7 @@ namespace osu.Game.Screens.Select
{ {
beatmapGroups.Add(group); beatmapGroups.Add(group);
group.State = BeatmapGroupState.Collapsed;
carousel.AddGroup(group); carousel.AddGroup(group);
filterChanged(false, false); filterChanged(false, false);
@ -403,11 +404,7 @@ namespace osu.Game.Screens.Select
if (Beatmap == null || select) if (Beatmap == null || select)
carousel.SelectBeatmap(beatmapSet.Beatmaps.First()); carousel.SelectBeatmap(beatmapSet.Beatmaps.First());
else else
{ carousel.SelectBeatmap(Beatmap.BeatmapInfo);
var panel = group.BeatmapPanels.FirstOrDefault(p => p.Beatmap.Equals(Beatmap.BeatmapInfo));
if (panel != null)
carousel.SelectGroup(group, panel);
}
})); }));
} }

View File

@ -77,7 +77,7 @@ namespace osu.Game.Screens.Tournament
new FillFlowContainer new FillFlowContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Direction = FillDirection.Right, Direction = FillDirection.Horizontal,
Children = new Drawable[] Children = new Drawable[]
{ {
@ -173,7 +173,7 @@ namespace osu.Game.Screens.Tournament
Position = new Vector2(0, 35f), Position = new Vector2(0, 35f),
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 5f), Spacing = new Vector2(0, 5f),
Children = new Drawable[] Children = new Drawable[]
@ -212,7 +212,7 @@ namespace osu.Game.Screens.Tournament
Position = new Vector2(0, -5f), Position = new Vector2(0, -5f),
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 5f), Spacing = new Vector2(0, 5f),
Children = new Drawable[] Children = new Drawable[]
@ -294,6 +294,9 @@ namespace osu.Game.Screens.Tournament
reloadTeams(); reloadTeams();
if (!storage.Exists(results_filename))
return;
if (loadLastResults) if (loadLastResults)
{ {
try try

View File

@ -144,7 +144,7 @@ namespace osu.Game.Screens.Tournament
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Down, Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 5f), Spacing = new Vector2(0, 5f),
Children = new Drawable[] Children = new Drawable[]