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

Merge remote-tracking branch 'refs/remotes/ppy/master' into break_overlay_take_three

This commit is contained in:
EVAST9919 2017-10-01 23:10:49 +03:00
commit 2f852d705e
10 changed files with 270 additions and 149 deletions

@ -1 +1 @@
Subproject commit cdb031c3a8ef693cd71458c5e19c68127ab72938 Subproject commit 9d142a8e009794dfee828392e36025d08577131d

View File

@ -55,14 +55,17 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
Beatmap<TaikoHitObject> converted = base.ConvertBeatmap(original); Beatmap<TaikoHitObject> converted = base.ConvertBeatmap(original);
// Post processing step to transform hit objects with the same start time into strong hits if (original.BeatmapInfo.RulesetID == 3)
converted.HitObjects = converted.HitObjects.GroupBy(t => t.StartTime).Select(x =>
{ {
TaikoHitObject first = x.First(); // Post processing step to transform mania hit objects with the same start time into strong hits
if (x.Skip(1).Any()) converted.HitObjects = converted.HitObjects.GroupBy(t => t.StartTime).Select(x =>
first.IsStrong = true; {
return first; TaikoHitObject first = x.First();
}).ToList(); if (x.Skip(1).Any())
first.IsStrong = true;
return first;
}).ToList();
}
return converted; return converted;
} }

View File

@ -59,7 +59,7 @@ namespace osu.Game.Graphics.UserInterface
public class OsuTabItem : TabItem<T>, IHasAccentColour public class OsuTabItem : TabItem<T>, IHasAccentColour
{ {
protected readonly SpriteText Text; protected readonly SpriteText Text;
private readonly Box box; protected readonly Box Bar;
private Color4 accentColour; private Color4 accentColour;
public Color4 AccentColour public Color4 AccentColour
@ -77,13 +77,13 @@ namespace osu.Game.Graphics.UserInterface
private void fadeActive() private void fadeActive()
{ {
box.FadeIn(transition_length, Easing.OutQuint); Bar.FadeIn(transition_length, Easing.OutQuint);
Text.FadeColour(Color4.White, transition_length, Easing.OutQuint); Text.FadeColour(Color4.White, transition_length, Easing.OutQuint);
} }
private void fadeInactive() private void fadeInactive()
{ {
box.FadeOut(transition_length, Easing.OutQuint); Bar.FadeOut(transition_length, Easing.OutQuint);
Text.FadeColour(AccentColour, transition_length, Easing.OutQuint); Text.FadeColour(AccentColour, transition_length, Easing.OutQuint);
} }
@ -123,7 +123,7 @@ namespace osu.Game.Graphics.UserInterface
TextSize = 14, TextSize = 14,
Font = @"Exo2.0-Bold", // Font should only turn bold when active? Font = @"Exo2.0-Bold", // Font should only turn bold when active?
}, },
box = new Box Bar = new Box
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = 1, Height = 1,

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -165,10 +164,8 @@ namespace osu.Game.Overlays
wavesContainer.Height = Math.Max(0, DrawHeight - (contentContainer.DrawHeight - contentContainer.Y)); wavesContainer.Height = Math.Max(0, DrawHeight - (contentContainer.DrawHeight - contentContainer.Y));
} }
private class Wave : Container, IStateful<Visibility> private class Wave : VisibilityContainer
{ {
public event Action<Visibility> StateChanged;
public float FinalPosition; public float FinalPosition;
public Wave() public Wave()
@ -183,13 +180,7 @@ namespace osu.Game.Overlays
Radius = 20f, Radius = 20f,
}; };
Children = new Drawable[] Child = new Box { RelativeSizeAxes = Axes.Both };
{
new Box
{
RelativeSizeAxes = Axes.Both,
},
};
} }
protected override void Update() protected override void Update()
@ -201,28 +192,8 @@ namespace osu.Game.Overlays
Height = Parent.Parent.DrawSize.Y * 1.5f; Height = Parent.Parent.DrawSize.Y * 1.5f;
} }
private Visibility state; protected override void PopIn() => this.MoveToY(FinalPosition, APPEAR_DURATION, easing_show);
protected override void PopOut() => this.MoveToY(Parent.Parent.DrawSize.Y, DISAPPEAR_DURATION, easing_hide);
public Visibility State
{
get { return state; }
set
{
state = value;
switch (value)
{
case Visibility.Hidden:
this.MoveToY(Parent.Parent.DrawSize.Y, DISAPPEAR_DURATION, easing_hide);
break;
case Visibility.Visible:
this.MoveToY(FinalPosition, APPEAR_DURATION, easing_show);
break;
}
StateChanged?.Invoke(State);
}
}
} }
} }
} }

View File

@ -32,16 +32,11 @@ namespace osu.Game.Screens.Edit
Height = 40, Height = 40,
Children = new Drawable[] Children = new Drawable[]
{ {
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.FromHex("111")
},
new EditorMenuBar new EditorMenuBar
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
X = 100, RelativeSizeAxes = Axes.Both,
Items = new[] Items = new[]
{ {
new EditorMenuBarItem("File") new EditorMenuBarItem("File")

View File

@ -19,8 +19,20 @@ namespace osu.Game.Screens.Edit.Menus
public EditorMenuBar() public EditorMenuBar()
: base(Direction.Horizontal, true) : base(Direction.Horizontal, true)
{ {
ItemsContainer.Padding = new MarginPadding(0); RelativeSizeAxes = Axes.X;
BackgroundColour = Color4.Transparent;
ItemsContainer.Padding = new MarginPadding { Left = 100 };
BackgroundColour = OsuColour.FromHex("111");
AddRangeInternal(new Drawable[]
{
new ScreenSelectionTabControl
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
X = -15
}
});
} }
protected override Framework.Graphics.UserInterface.Menu CreateSubMenu() => new SubMenu(); protected override Framework.Graphics.UserInterface.Menu CreateSubMenu() => new SubMenu();
@ -29,27 +41,35 @@ namespace osu.Game.Screens.Edit.Menus
private class DrawableEditorBarMenuItem : DrawableOsuMenuItem private class DrawableEditorBarMenuItem : DrawableOsuMenuItem
{ {
private Color4 openedForegroundColour; private BackgroundBox background;
private Color4 openedBackgroundColour;
public DrawableEditorBarMenuItem(MenuItem item) public DrawableEditorBarMenuItem(MenuItem item)
: base(item) : base(item)
{ {
Anchor = Anchor.CentreLeft;
Origin = Anchor.CentreLeft;
StateChanged += stateChanged;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
ForegroundColour = ForegroundColourHover = colours.BlueLight; ForegroundColour = colours.BlueLight;
BackgroundColour = BackgroundColourHover = Color4.Transparent; BackgroundColour = Color4.Transparent;
openedForegroundColour = Color4.White; ForegroundColourHover = Color4.White;
openedBackgroundColour = colours.Gray3; BackgroundColourHover = colours.Gray3;
}
public override void SetFlowDirection(Direction direction)
{
AutoSizeAxes = Axes.Both;
} }
protected override void UpdateBackgroundColour() protected override void UpdateBackgroundColour()
{ {
if (State == MenuItemState.Selected) if (State == MenuItemState.Selected)
Background.FadeColour(openedBackgroundColour); Background.FadeColour(BackgroundColourHover);
else else
base.UpdateBackgroundColour(); base.UpdateBackgroundColour();
} }
@ -57,24 +77,58 @@ namespace osu.Game.Screens.Edit.Menus
protected override void UpdateForegroundColour() protected override void UpdateForegroundColour()
{ {
if (State == MenuItemState.Selected) if (State == MenuItemState.Selected)
Foreground.FadeColour(openedForegroundColour); Foreground.FadeColour(ForegroundColourHover);
else else
base.UpdateForegroundColour(); base.UpdateForegroundColour();
} }
protected override Drawable CreateBackground() => new Container private void stateChanged(MenuItemState newState)
{ {
RelativeSizeAxes = Axes.Both, if (newState == MenuItemState.Selected)
Masking = true, background.Expand();
Child = new Container else
background.Contract();
}
protected override Drawable CreateBackground() => background = new BackgroundBox();
protected override DrawableOsuMenuItem.TextContainer CreateTextContainer() => new TextContainer();
private new class TextContainer : DrawableOsuMenuItem.TextContainer
{
public TextContainer()
{ {
RelativeSizeAxes = Axes.Both, NormalText.TextSize = BoldText.TextSize = 14;
Height = 2, NormalText.Margin = BoldText.Margin = new MarginPadding { Horizontal = 10, Vertical = MARGIN_VERTICAL };
Masking = true,
CornerRadius = 4,
Child = new Box { RelativeSizeAxes = Axes.Both }
} }
}; }
private class BackgroundBox : CompositeDrawable
{
private readonly Container innerBackground;
public BackgroundBox()
{
RelativeSizeAxes = Axes.Both;
Masking = true;
InternalChild = innerBackground = new Container
{
RelativeSizeAxes = Axes.Both,
Masking = true,
CornerRadius = 4,
Child = new Box { RelativeSizeAxes = Axes.Both }
};
}
/// <summary>
/// Expands the background such that it doesn't show the bottom corners.
/// </summary>
public void Expand() => innerBackground.Height = 2;
/// <summary>
/// Contracts the background such that it shows the bottom corners.
/// </summary>
public void Contract() => innerBackground.Height = 1;
}
} }
private class SubMenu : OsuMenu private class SubMenu : OsuMenu

View File

@ -0,0 +1,85 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using OpenTK;
using System.ComponentModel;
namespace osu.Game.Screens.Edit.Menus
{
public class ScreenSelectionTabControl : OsuTabControl<EditorScreenMode>
{
public ScreenSelectionTabControl()
{
AutoSizeAxes = Axes.X;
RelativeSizeAxes = Axes.Y;
TabContainer.RelativeSizeAxes &= ~Axes.X;
TabContainer.AutoSizeAxes = Axes.X;
TabContainer.Padding = new MarginPadding();
Add(new Box
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.X,
Height = 1,
Colour = Color4.White.Opacity(0.2f),
});
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
AccentColour = colours.Yellow;
}
protected override Dropdown<EditorScreenMode> CreateDropdown() => null;
protected override TabItem<EditorScreenMode> CreateTabItem(EditorScreenMode value) => new TabItem(value);
private class TabItem : OsuTabItem
{
private const float transition_length = 250;
public TabItem(EditorScreenMode value)
: base(value)
{
Text.Margin = new MarginPadding();
Text.Anchor = Anchor.CentreLeft;
Text.Origin = Anchor.CentreLeft;
}
protected override void OnActivated()
{
base.OnActivated();
Bar.ScaleTo(new Vector2(1, 5), transition_length, Easing.OutQuint);
}
protected override void OnDeactivated()
{
base.OnDeactivated();
Bar.ScaleTo(Vector2.One, transition_length, Easing.OutQuint);
}
}
}
public enum EditorScreenMode
{
[Description("compose")]
Compose,
[Description("design")]
Design,
[Description("timing")]
Timing,
[Description("song")]
SongSetup
}
}

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Game.Graphics.Cursor;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
@ -23,32 +24,32 @@ namespace osu.Game.Tests.Visual
public TestCaseContextMenu() public TestCaseContextMenu()
{ {
Add(container = new MyContextMenuContainer Add(new OsuContextMenuContainer
{ {
Size = new Vector2(200), RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[] Children = new Drawable[]
{ {
new Box container = new MyContextMenuContainer
{ {
RelativeSizeAxes = Axes.Both, Size = new Vector2(200),
Colour = Color4.Green, Anchor = Anchor.Centre,
} Origin = Anchor.Centre,
} Child = new Box
}); {
RelativeSizeAxes = Axes.Both,
Add(new AnotherContextMenuContainer Colour = Color4.Green,
{ }
Size = new Vector2(200), },
Anchor = Anchor.CentreLeft, new AnotherContextMenuContainer
Origin = Anchor.CentreLeft,
Children = new Drawable[]
{
new Box
{ {
RelativeSizeAxes = Axes.Both, Size = new Vector2(200),
Colour = Color4.Red, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Child = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Red,
}
} }
} }
}); });

View File

@ -1,7 +1,10 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Edit.Menus; using osu.Game.Screens.Edit.Menus;
@ -9,74 +12,82 @@ namespace osu.Game.Tests.Visual
{ {
public class TestCaseEditorMenuBar : OsuTestCase public class TestCaseEditorMenuBar : OsuTestCase
{ {
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(EditorMenuBar), typeof(ScreenSelectionTabControl) };
public TestCaseEditorMenuBar() public TestCaseEditorMenuBar()
{ {
Add(new EditorMenuBar Add(new Container
{ {
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
Height = 50,
Y = 50, Y = 50,
Items = new[] Child = new EditorMenuBar
{ {
new EditorMenuBarItem("File") RelativeSizeAxes = Axes.Both,
Items = new[]
{ {
Items = new[] new EditorMenuBarItem("File")
{ {
new EditorMenuItem("Clear All Notes"), Items = new[]
new EditorMenuItem("Open Difficulty..."), {
new EditorMenuItem("Save"), new EditorMenuItem("Clear All Notes"),
new EditorMenuItem("Create a new Difficulty..."), new EditorMenuItem("Open Difficulty..."),
new EditorMenuItemSpacer(), new EditorMenuItem("Save"),
new EditorMenuItem("Revert to Saved"), new EditorMenuItem("Create a new Difficulty..."),
new EditorMenuItem("Revert to Saved (Full)"), new EditorMenuItemSpacer(),
new EditorMenuItemSpacer(), new EditorMenuItem("Revert to Saved"),
new EditorMenuItem("Test Beatmap"), new EditorMenuItem("Revert to Saved (Full)"),
new EditorMenuItem("Open AiMod"), new EditorMenuItemSpacer(),
new EditorMenuItemSpacer(), new EditorMenuItem("Test Beatmap"),
new EditorMenuItem("Upload Beatmap..."), new EditorMenuItem("Open AiMod"),
new EditorMenuItem("Export Package"), new EditorMenuItemSpacer(),
new EditorMenuItem("Export Map Package"), new EditorMenuItem("Upload Beatmap..."),
new EditorMenuItem("Import from..."), new EditorMenuItem("Export Package"),
new EditorMenuItemSpacer(), new EditorMenuItem("Export Map Package"),
new EditorMenuItem("Open Song Folder"), new EditorMenuItem("Import from..."),
new EditorMenuItem("Open .osu in Notepad"), new EditorMenuItemSpacer(),
new EditorMenuItem("Open .osb in Notepad"), new EditorMenuItem("Open Song Folder"),
new EditorMenuItemSpacer(), new EditorMenuItem("Open .osu in Notepad"),
new EditorMenuItem("Exit"), new EditorMenuItem("Open .osb in Notepad"),
} new EditorMenuItemSpacer(),
}, new EditorMenuItem("Exit"),
new EditorMenuBarItem("Timing") }
{ },
Items = new[] new EditorMenuBarItem("Timing")
{ {
new EditorMenuItem("Time Signature"), Items = new[]
new EditorMenuItem("Metronome Clicks"), {
new EditorMenuItemSpacer(), new EditorMenuItem("Time Signature"),
new EditorMenuItem("Add Timing Section"), new EditorMenuItem("Metronome Clicks"),
new EditorMenuItem("Add Inheriting Section"), new EditorMenuItemSpacer(),
new EditorMenuItem("Reset Current Section"), new EditorMenuItem("Add Timing Section"),
new EditorMenuItem("Delete Timing Section"), new EditorMenuItem("Add Inheriting Section"),
new EditorMenuItem("Resnap Current Section"), new EditorMenuItem("Reset Current Section"),
new EditorMenuItemSpacer(), new EditorMenuItem("Delete Timing Section"),
new EditorMenuItem("Timing Setup"), new EditorMenuItem("Resnap Current Section"),
new EditorMenuItemSpacer(), new EditorMenuItemSpacer(),
new EditorMenuItem("Resnap All Notes", MenuItemType.Destructive), new EditorMenuItem("Timing Setup"),
new EditorMenuItem("Move all notes in time...", MenuItemType.Destructive), new EditorMenuItemSpacer(),
new EditorMenuItem("Recalculate Slider Lengths", MenuItemType.Destructive), new EditorMenuItem("Resnap All Notes", MenuItemType.Destructive),
new EditorMenuItem("Delete All Timing Sections", MenuItemType.Destructive), new EditorMenuItem("Move all notes in time...", MenuItemType.Destructive),
new EditorMenuItemSpacer(), new EditorMenuItem("Recalculate Slider Lengths", MenuItemType.Destructive),
new EditorMenuItem("Set Current Position as Preview Point"), new EditorMenuItem("Delete All Timing Sections", MenuItemType.Destructive),
} new EditorMenuItemSpacer(),
}, new EditorMenuItem("Set Current Position as Preview Point"),
new EditorMenuBarItem("Testing") }
{ },
Items = new[] new EditorMenuBarItem("Testing")
{ {
new EditorMenuItem("Item 1"), Items = new[]
new EditorMenuItem("Item 2"), {
new EditorMenuItem("Item 3"), new EditorMenuItem("Item 1"),
} new EditorMenuItem("Item 2"),
}, new EditorMenuItem("Item 3"),
}
},
}
} }
}); });
} }

View File

@ -625,6 +625,7 @@
<Compile Include="Screens\Edit\Menus\EditorMenuBarItem.cs" /> <Compile Include="Screens\Edit\Menus\EditorMenuBarItem.cs" />
<Compile Include="Screens\Edit\Menus\EditorMenuItem.cs" /> <Compile Include="Screens\Edit\Menus\EditorMenuItem.cs" />
<Compile Include="Screens\Edit\Menus\EditorMenuItemSpacer.cs" /> <Compile Include="Screens\Edit\Menus\EditorMenuItemSpacer.cs" />
<Compile Include="Screens\Edit\Menus\ScreenSelectionTabControl.cs" />
<Compile Include="Screens\Loader.cs" /> <Compile Include="Screens\Loader.cs" />
<Compile Include="Screens\Menu\Button.cs" /> <Compile Include="Screens\Menu\Button.cs" />
<Compile Include="Screens\Menu\ButtonSystem.cs" /> <Compile Include="Screens\Menu\ButtonSystem.cs" />