mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Merge from ppy/master
This commit is contained in:
@ -8,11 +8,15 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Screens.Edit.Menus;
|
||||
using osu.Game.Screens.Edit.Components.Timelines.Summary;
|
||||
using OpenTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Screens.Edit.Screens;
|
||||
using osu.Game.Screens.Edit.Screens.Compose;
|
||||
using osu.Game.Screens.Edit.Screens.Design;
|
||||
|
||||
namespace osu.Game.Screens.Edit
|
||||
{
|
||||
@ -23,209 +27,88 @@ namespace osu.Game.Screens.Edit
|
||||
internal override bool ShowOverlays => false;
|
||||
|
||||
private readonly Box bottomBackground;
|
||||
private readonly Container screenContainer;
|
||||
|
||||
private EditorScreen currentScreen;
|
||||
|
||||
public Editor()
|
||||
{
|
||||
Add(new Container
|
||||
EditorMenuBar menuBar;
|
||||
SummaryTimeline timeline;
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 40,
|
||||
Children = new Drawable[]
|
||||
new Container
|
||||
{
|
||||
new Box
|
||||
Name = "Screen container",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Top = 40, Bottom = 60 },
|
||||
Child = screenContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.FromHex("111")
|
||||
},
|
||||
new EditorMenuBar
|
||||
Masking = true
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Name = "Top bar",
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 40,
|
||||
Child = menuBar = new EditorMenuBar
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
X = 100,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Items = new[]
|
||||
{
|
||||
new EditorMenuBarItem("File")
|
||||
new MenuItem("File")
|
||||
{
|
||||
Items = new[]
|
||||
{
|
||||
new EditorMenuItem("Clear all notes"),
|
||||
new EditorMenuItem("Open difficulty..."),
|
||||
new EditorMenuItem("Save"),
|
||||
new EditorMenuItem("Create new difficulty..."),
|
||||
new EditorMenuItemSpacer(),
|
||||
new EditorMenuItem("Revert to saved"),
|
||||
new EditorMenuItem("Revert to saved (full"),
|
||||
new EditorMenuItemSpacer(),
|
||||
new EditorMenuItem("Test beatmap"),
|
||||
new EditorMenuItem("Open AiMod"),
|
||||
new EditorMenuItemSpacer(),
|
||||
new EditorMenuItem("Upload Beatmap..."),
|
||||
new EditorMenuItem("Export package"),
|
||||
new EditorMenuItem("Export map package"),
|
||||
new EditorMenuItem("Import from..."),
|
||||
new EditorMenuItemSpacer(),
|
||||
new EditorMenuItem("Open song folder"),
|
||||
new EditorMenuItem("Open .osu in Notepad"),
|
||||
new EditorMenuItem("Open .osb in Notepad"),
|
||||
new EditorMenuItemSpacer(),
|
||||
new EditorMenuItem("Exit", MenuItemType.Standard, Exit)
|
||||
}
|
||||
},
|
||||
new EditorMenuBarItem("Edit")
|
||||
{
|
||||
Items = new[]
|
||||
{
|
||||
new EditorMenuItem("Undo"),
|
||||
new EditorMenuItem("Redo"),
|
||||
new EditorMenuItemSpacer(),
|
||||
new EditorMenuItem("Cut"),
|
||||
new EditorMenuItem("Copy"),
|
||||
new EditorMenuItem("Paste"),
|
||||
new EditorMenuItem("Delete"),
|
||||
new EditorMenuItemSpacer(),
|
||||
new EditorMenuItem("Select all"),
|
||||
new EditorMenuItem("Clone"),
|
||||
new EditorMenuItemSpacer(),
|
||||
new EditorMenuItem("Reverse selection"),
|
||||
new EditorMenuItem("Flip horizontally"),
|
||||
new EditorMenuItem("Flip vertically"),
|
||||
new EditorMenuItem("Rotate 90deg clockwise"),
|
||||
new EditorMenuItem("Rotate 90deg anticlockwise"),
|
||||
new EditorMenuItem("Rotate by..."),
|
||||
new EditorMenuItem("Scale by..."),
|
||||
new EditorMenuItemSpacer(),
|
||||
new EditorMenuItem("Reset selected objects' samples"),
|
||||
new EditorMenuItem("Reset all samples", MenuItemType.Destructive),
|
||||
new EditorMenuItem("Reset combo colours", MenuItemType.Destructive),
|
||||
new EditorMenuItem("Reset breaks", MenuItemType.Destructive),
|
||||
new EditorMenuItemSpacer(),
|
||||
new EditorMenuItem("Nudge backward"),
|
||||
new EditorMenuItem("Nudge forward")
|
||||
}
|
||||
},
|
||||
new EditorMenuBarItem("View")
|
||||
{
|
||||
Items = new[]
|
||||
{
|
||||
new EditorMenuItem("Compose"),
|
||||
new EditorMenuItem("Design"),
|
||||
new EditorMenuItem("Timing"),
|
||||
new EditorMenuItemSpacer(),
|
||||
new EditorMenuItem("Song setup..."),
|
||||
new EditorMenuItem("Timing setup..."),
|
||||
new EditorMenuItemSpacer(),
|
||||
new EditorMenuItem("Volume"),
|
||||
new EditorMenuItem("Grid level"),
|
||||
new EditorMenuItem("Show video"),
|
||||
new EditorMenuItem("Show sample name"),
|
||||
new EditorMenuItem("Snaking sliders"),
|
||||
new EditorMenuItem("Hit animations"),
|
||||
new EditorMenuItem("Follow points"),
|
||||
new EditorMenuItem("Stacking")
|
||||
}
|
||||
},
|
||||
new EditorMenuBarItem("Compose")
|
||||
{
|
||||
Items = new[]
|
||||
{
|
||||
new EditorMenuItem("Snap divisor"),
|
||||
new EditorMenuItem("Audio rate"),
|
||||
new EditorMenuItem("Grid snapping"),
|
||||
new EditorMenuItemSpacer(),
|
||||
new EditorMenuItem("Create polygon cricles..."),
|
||||
new EditorMenuItem("Convert slider to stream"),
|
||||
new EditorMenuItem("Enable live mapping mode"),
|
||||
new EditorMenuItem("Sample import")
|
||||
}
|
||||
},
|
||||
new EditorMenuBarItem("Design")
|
||||
{
|
||||
Items = new[]
|
||||
{
|
||||
new EditorMenuItem("Move all elements in time...")
|
||||
}
|
||||
},
|
||||
new EditorMenuBarItem("Timing")
|
||||
{
|
||||
Items = new[]
|
||||
{
|
||||
new EditorMenuItem("Time signature"),
|
||||
new EditorMenuItem("Metronome clicks"),
|
||||
new EditorMenuItemSpacer(),
|
||||
new EditorMenuItem("Add timing section"),
|
||||
new EditorMenuItem("Add inheriting section"),
|
||||
new EditorMenuItem("Reset current section"),
|
||||
new EditorMenuItem("Delete timing section"),
|
||||
new EditorMenuItem("Resnap current section"),
|
||||
new EditorMenuItemSpacer(),
|
||||
new EditorMenuItem("Timing setup..."),
|
||||
new EditorMenuItemSpacer(),
|
||||
new EditorMenuItem("Resnap all notes", MenuItemType.Destructive),
|
||||
new EditorMenuItem("Move all notes in time...", MenuItemType.Destructive),
|
||||
new EditorMenuItem("Recalculate slider lengths", MenuItemType.Destructive),
|
||||
new EditorMenuItem("Delete all timing sections", MenuItemType.Destructive),
|
||||
new EditorMenuItemSpacer(),
|
||||
new EditorMenuItem("Set current position as preview point")
|
||||
}
|
||||
},
|
||||
new EditorMenuBarItem("Web")
|
||||
{
|
||||
Items = new[]
|
||||
{
|
||||
new EditorMenuItem("This Beatmap's information page"),
|
||||
new EditorMenuItem("This Beatmap's thread"),
|
||||
new EditorMenuItem("Quick reply")
|
||||
}
|
||||
},
|
||||
new EditorMenuBarItem("Help")
|
||||
{
|
||||
Items = new[]
|
||||
{
|
||||
new EditorMenuItem("Show in-game help"),
|
||||
new EditorMenuItem("View FAQ")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
SummaryTimeline summaryTimeline;
|
||||
Add(new Container
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 60,
|
||||
Children = new Drawable[]
|
||||
},
|
||||
new Container
|
||||
{
|
||||
bottomBackground = new Box { RelativeSizeAxes = Axes.Both },
|
||||
new Container
|
||||
Name = "Bottom bar",
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 60,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Top = 5, Bottom = 5, Left = 10, Right = 10 },
|
||||
Child = new FillFlowContainer
|
||||
bottomBackground = new Box { RelativeSizeAxes = Axes.Both },
|
||||
new Container
|
||||
{
|
||||
Name = "Bottom bar",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(10, 0),
|
||||
Children = new[]
|
||||
Padding = new MarginPadding { Top = 5, Bottom = 5, Left = 10, Right = 10 },
|
||||
Child = new FillFlowContainer
|
||||
{
|
||||
summaryTimeline = new SummaryTimeline
|
||||
Name = "Bottom bar",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(10, 0),
|
||||
Children = new[]
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 0.65f
|
||||
timeline = new SummaryTimeline
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 0.65f
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
summaryTimeline.Beatmap.BindTo(Beatmap);
|
||||
timeline.Beatmap.BindTo(Beatmap);
|
||||
menuBar.Mode.ValueChanged += onModeChanged;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -234,6 +117,27 @@ namespace osu.Game.Screens.Edit
|
||||
bottomBackground.Colour = colours.Gray2;
|
||||
}
|
||||
|
||||
private void onModeChanged(EditorScreenMode mode)
|
||||
{
|
||||
currentScreen?.Exit();
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case EditorScreenMode.Compose:
|
||||
currentScreen = new Compose();
|
||||
break;
|
||||
case EditorScreenMode.Design:
|
||||
currentScreen = new Design();
|
||||
break;
|
||||
default:
|
||||
currentScreen = new EditorScreen();
|
||||
break;
|
||||
}
|
||||
|
||||
currentScreen.Beatmap.BindTo(Beatmap);
|
||||
screenContainer.Add(currentScreen);
|
||||
}
|
||||
|
||||
protected override void OnResuming(Screen last)
|
||||
{
|
||||
Beatmap.Value.Track?.Stop();
|
||||
|
@ -11,16 +11,42 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Game.Screens.Edit.Screens;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Menus
|
||||
{
|
||||
public class EditorMenuBar : OsuMenu
|
||||
{
|
||||
public readonly Bindable<EditorScreenMode> Mode = new Bindable<EditorScreenMode>();
|
||||
|
||||
public EditorMenuBar()
|
||||
: base(Direction.Horizontal, true)
|
||||
{
|
||||
ItemsContainer.Padding = new MarginPadding(0);
|
||||
BackgroundColour = Color4.Transparent;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
|
||||
MaskingContainer.CornerRadius = 0;
|
||||
ItemsContainer.Padding = new MarginPadding { Left = 100 };
|
||||
BackgroundColour = OsuColour.FromHex("111");
|
||||
|
||||
ScreenSelectionTabControl tabControl;
|
||||
AddRangeInternal(new Drawable[]
|
||||
{
|
||||
tabControl = new ScreenSelectionTabControl
|
||||
{
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight,
|
||||
X = -15
|
||||
}
|
||||
});
|
||||
|
||||
Mode.BindTo(tabControl.Current);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
Mode.TriggerChange();
|
||||
}
|
||||
|
||||
protected override Framework.Graphics.UserInterface.Menu CreateSubMenu() => new SubMenu();
|
||||
@ -29,27 +55,35 @@ namespace osu.Game.Screens.Edit.Menus
|
||||
|
||||
private class DrawableEditorBarMenuItem : DrawableOsuMenuItem
|
||||
{
|
||||
private Color4 openedForegroundColour;
|
||||
private Color4 openedBackgroundColour;
|
||||
private BackgroundBox background;
|
||||
|
||||
public DrawableEditorBarMenuItem(MenuItem item)
|
||||
: base(item)
|
||||
{
|
||||
Anchor = Anchor.CentreLeft;
|
||||
Origin = Anchor.CentreLeft;
|
||||
|
||||
StateChanged += stateChanged;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
ForegroundColour = ForegroundColourHover = colours.BlueLight;
|
||||
BackgroundColour = BackgroundColourHover = Color4.Transparent;
|
||||
openedForegroundColour = Color4.White;
|
||||
openedBackgroundColour = colours.Gray3;
|
||||
ForegroundColour = colours.BlueLight;
|
||||
BackgroundColour = Color4.Transparent;
|
||||
ForegroundColourHover = Color4.White;
|
||||
BackgroundColourHover = colours.Gray3;
|
||||
}
|
||||
|
||||
public override void SetFlowDirection(Direction direction)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
protected override void UpdateBackgroundColour()
|
||||
{
|
||||
if (State == MenuItemState.Selected)
|
||||
Background.FadeColour(openedBackgroundColour);
|
||||
Background.FadeColour(BackgroundColourHover);
|
||||
else
|
||||
base.UpdateBackgroundColour();
|
||||
}
|
||||
@ -57,24 +91,58 @@ namespace osu.Game.Screens.Edit.Menus
|
||||
protected override void UpdateForegroundColour()
|
||||
{
|
||||
if (State == MenuItemState.Selected)
|
||||
Foreground.FadeColour(openedForegroundColour);
|
||||
Foreground.FadeColour(ForegroundColourHover);
|
||||
else
|
||||
base.UpdateForegroundColour();
|
||||
}
|
||||
|
||||
protected override Drawable CreateBackground() => new Container
|
||||
private void stateChanged(MenuItemState newState)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
Child = new Container
|
||||
if (newState == MenuItemState.Selected)
|
||||
background.Expand();
|
||||
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,
|
||||
Height = 2,
|
||||
Masking = true,
|
||||
CornerRadius = 4,
|
||||
Child = new Box { RelativeSizeAxes = Axes.Both }
|
||||
NormalText.TextSize = BoldText.TextSize = 14;
|
||||
NormalText.Margin = BoldText.Margin = new MarginPadding { Horizontal = 10, Vertical = MARGIN_VERTICAL };
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -1,15 +0,0 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Menus
|
||||
{
|
||||
public class EditorMenuBarItem : MenuItem
|
||||
{
|
||||
public EditorMenuBarItem(string text)
|
||||
: base(text)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
75
osu.Game/Screens/Edit/Menus/ScreenSelectionTabControl.cs
Normal file
75
osu.Game/Screens/Edit/Menus/ScreenSelectionTabControl.cs
Normal file
@ -0,0 +1,75 @@
|
||||
// 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 osu.Game.Screens.Edit.Screens;
|
||||
using OpenTK;
|
||||
|
||||
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),
|
||||
});
|
||||
|
||||
Current.Value = EditorScreenMode.Compose;
|
||||
}
|
||||
|
||||
[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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
41
osu.Game/Screens/Edit/Screens/Compose/Compose.cs
Normal file
41
osu.Game/Screens/Edit/Screens/Compose/Compose.cs
Normal file
@ -0,0 +1,41 @@
|
||||
// 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.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Screens.Compose
|
||||
{
|
||||
public class Compose : EditorScreen
|
||||
{
|
||||
public Compose()
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
Name = "Timeline",
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 110,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black.Opacity(0.5f)
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Name = "Content",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Horizontal = 17, Vertical = 10 }
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
52
osu.Game/Screens/Edit/Screens/Design/Design.cs
Normal file
52
osu.Game/Screens/Edit/Screens/Design/Design.cs
Normal file
@ -0,0 +1,52 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Screens.Design
|
||||
{
|
||||
internal class Design : EditorScreen
|
||||
{
|
||||
public Design()
|
||||
{
|
||||
Add(new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
Alpha = 0.35f
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
Alpha = 0.5f
|
||||
},
|
||||
new Container
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding(20),
|
||||
Child = new OsuSpriteText { Text = "Design screen" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
41
osu.Game/Screens/Edit/Screens/EditorScreen.cs
Normal file
41
osu.Game/Screens/Edit/Screens/EditorScreen.cs
Normal file
@ -0,0 +1,41 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Beatmaps;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Screens
|
||||
{
|
||||
public class EditorScreen : Container
|
||||
{
|
||||
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
private readonly Container content;
|
||||
|
||||
public EditorScreen()
|
||||
{
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
InternalChild = content = new Container { RelativeSizeAxes = Axes.Both };
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
this.FadeTo(0)
|
||||
.Then()
|
||||
.FadeTo(1f, 250, Easing.OutQuint);
|
||||
}
|
||||
|
||||
public void Exit()
|
||||
{
|
||||
this.FadeOut(250).Expire();
|
||||
}
|
||||
}
|
||||
}
|
19
osu.Game/Screens/Edit/Screens/EditorScreenMode.cs
Normal file
19
osu.Game/Screens/Edit/Screens/EditorScreenMode.cs
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Screens
|
||||
{
|
||||
public enum EditorScreenMode
|
||||
{
|
||||
[Description("setup")]
|
||||
SongSetup,
|
||||
[Description("compose")]
|
||||
Compose,
|
||||
[Description("design")]
|
||||
Design,
|
||||
[Description("timing")]
|
||||
Timing,
|
||||
}
|
||||
}
|
103
osu.Game/Screens/Play/BreaksOverlay/ArrowsOverlay.cs
Normal file
103
osu.Game/Screens/Play/BreaksOverlay/ArrowsOverlay.cs
Normal file
@ -0,0 +1,103 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using OpenTK;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Beatmaps.Timing;
|
||||
|
||||
namespace osu.Game.Screens.Play.BreaksOverlay
|
||||
{
|
||||
public class ArrowsOverlay : VisibilityContainer
|
||||
{
|
||||
private const double fade_duration = BreakPeriod.MIN_BREAK_DURATION / 2;
|
||||
|
||||
private const int glow_icon_size = 60;
|
||||
private const int glow_icon_blur_sigma = 10;
|
||||
private const float glow_icon_final_offset = 0.22f;
|
||||
private const float glow_icon_offscreen_offset = 0.6f;
|
||||
|
||||
private const int blurred_icon_blur_sigma = 20;
|
||||
private const int blurred_icon_size = 130;
|
||||
private const float blurred_icon_final_offset = 0.35f;
|
||||
private const float blurred_icon_offscreen_offset = 0.7f;
|
||||
|
||||
private readonly GlowIcon leftGlowIcon;
|
||||
private readonly GlowIcon rightGlowIcon;
|
||||
|
||||
private readonly BlurredIcon leftBlurredIcon;
|
||||
private readonly BlurredIcon rightBlurredIcon;
|
||||
|
||||
public ArrowsOverlay()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
leftGlowIcon = new GlowIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreRight,
|
||||
X = -glow_icon_offscreen_offset,
|
||||
Icon = Graphics.FontAwesome.fa_chevron_right,
|
||||
BlurSigma = new Vector2(glow_icon_blur_sigma),
|
||||
Size = new Vector2(glow_icon_size),
|
||||
},
|
||||
rightGlowIcon = new GlowIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreLeft,
|
||||
X = glow_icon_offscreen_offset,
|
||||
Icon = Graphics.FontAwesome.fa_chevron_left,
|
||||
BlurSigma = new Vector2(glow_icon_blur_sigma),
|
||||
Size = new Vector2(glow_icon_size),
|
||||
},
|
||||
new ParallaxContainer
|
||||
{
|
||||
ParallaxAmount = -0.02f,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
leftBlurredIcon = new BlurredIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreRight,
|
||||
Alpha = 0.7f,
|
||||
X = -blurred_icon_offscreen_offset,
|
||||
Icon = Graphics.FontAwesome.fa_chevron_right,
|
||||
BlurSigma = new Vector2(blurred_icon_blur_sigma),
|
||||
Size = new Vector2(blurred_icon_size),
|
||||
},
|
||||
rightBlurredIcon = new BlurredIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Alpha = 0.7f,
|
||||
X = blurred_icon_offscreen_offset,
|
||||
Icon = Graphics.FontAwesome.fa_chevron_left,
|
||||
BlurSigma = new Vector2(blurred_icon_blur_sigma),
|
||||
Size = new Vector2(blurred_icon_size),
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
leftGlowIcon.MoveToX(-glow_icon_final_offset, fade_duration, Easing.OutQuint);
|
||||
rightGlowIcon.MoveToX(glow_icon_final_offset, fade_duration, Easing.OutQuint);
|
||||
|
||||
leftBlurredIcon.MoveToX(-blurred_icon_final_offset, fade_duration, Easing.OutQuint);
|
||||
rightBlurredIcon.MoveToX(blurred_icon_final_offset, fade_duration, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
leftGlowIcon.MoveToX(-glow_icon_offscreen_offset, fade_duration, Easing.OutQuint);
|
||||
rightGlowIcon.MoveToX(glow_icon_offscreen_offset, fade_duration, Easing.OutQuint);
|
||||
|
||||
leftBlurredIcon.MoveToX(-blurred_icon_offscreen_offset, fade_duration, Easing.OutQuint);
|
||||
rightBlurredIcon.MoveToX(blurred_icon_offscreen_offset, fade_duration, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
51
osu.Game/Screens/Play/BreaksOverlay/BlurredIcon.cs
Normal file
51
osu.Game/Screens/Play/BreaksOverlay/BlurredIcon.cs
Normal file
@ -0,0 +1,51 @@
|
||||
// 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;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
|
||||
namespace osu.Game.Screens.Play.BreaksOverlay
|
||||
{
|
||||
public class BlurredIcon : BufferedContainer
|
||||
{
|
||||
private readonly SpriteIcon icon;
|
||||
|
||||
public FontAwesome Icon
|
||||
{
|
||||
set { icon.Icon = value; }
|
||||
get { return icon.Icon; }
|
||||
}
|
||||
|
||||
public override Vector2 Size
|
||||
{
|
||||
set
|
||||
{
|
||||
icon.Size = value;
|
||||
base.Size = value + BlurSigma * 2.5f;
|
||||
ForceRedraw();
|
||||
}
|
||||
get { return base.Size; }
|
||||
}
|
||||
|
||||
public BlurredIcon()
|
||||
{
|
||||
RelativePositionAxes = Axes.X;
|
||||
CacheDrawnFrameBuffer = true;
|
||||
Child = icon = new SpriteIcon
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Shadow = false,
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Colour = colours.BlueLighter;
|
||||
}
|
||||
}
|
||||
}
|
151
osu.Game/Screens/Play/BreaksOverlay/BreakOverlay.cs
Normal file
151
osu.Game/Screens/Play/BreaksOverlay/BreakOverlay.cs
Normal file
@ -0,0 +1,151 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Beatmaps.Timing;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.Screens.Play.BreaksOverlay
|
||||
{
|
||||
public class BreakOverlay : Container
|
||||
{
|
||||
private const double fade_duration = BreakPeriod.MIN_BREAK_DURATION / 2;
|
||||
private const float remaining_time_container_max_size = 0.3f;
|
||||
private const int vertical_margin = 25;
|
||||
|
||||
private List<BreakPeriod> breaks;
|
||||
public List<BreakPeriod> Breaks
|
||||
{
|
||||
set
|
||||
{
|
||||
breaks = value;
|
||||
initializeBreaks();
|
||||
}
|
||||
get
|
||||
{
|
||||
return breaks;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly bool letterboxing;
|
||||
private readonly LetterboxOverlay letterboxOverlay;
|
||||
private readonly Container remainingTimeAdjustmentBox;
|
||||
private readonly Container remainingTimeBox;
|
||||
private readonly RemainingTimeCounter remainingTimeCounter;
|
||||
private readonly InfoContainer info;
|
||||
private readonly ArrowsOverlay arrowsOverlay;
|
||||
|
||||
public BreakOverlay(bool letterboxing)
|
||||
{
|
||||
this.letterboxing = letterboxing;
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
letterboxOverlay = new LetterboxOverlay
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
remainingTimeAdjustmentBox = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Width = 0,
|
||||
Child = remainingTimeBox = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 8,
|
||||
CornerRadius = 4,
|
||||
Masking = true,
|
||||
Child = new Box { RelativeSizeAxes = Axes.Both }
|
||||
}
|
||||
},
|
||||
remainingTimeCounter = new RemainingTimeCounter
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Margin = new MarginPadding { Bottom = vertical_margin },
|
||||
},
|
||||
info = new InfoContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Margin = new MarginPadding { Top = vertical_margin },
|
||||
},
|
||||
arrowsOverlay = new ArrowsOverlay
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void initializeBreaks()
|
||||
{
|
||||
FinishTransforms(true);
|
||||
Scheduler.CancelDelayedTasks();
|
||||
|
||||
if (breaks == null)
|
||||
return;
|
||||
|
||||
foreach (var b in breaks)
|
||||
{
|
||||
if (!b.HasEffect)
|
||||
continue;
|
||||
|
||||
using (BeginAbsoluteSequence(b.StartTime))
|
||||
{
|
||||
Schedule(() => onBreakIn(b));
|
||||
using (BeginDelayedSequence(b.Duration - fade_duration))
|
||||
Schedule(onBreakOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void onBreakIn(BreakPeriod b)
|
||||
{
|
||||
if (letterboxing)
|
||||
letterboxOverlay.Show();
|
||||
|
||||
remainingTimeAdjustmentBox
|
||||
.ResizeWidthTo(remaining_time_container_max_size, fade_duration, Easing.OutQuint)
|
||||
.Delay(b.Duration - fade_duration)
|
||||
.ResizeWidthTo(0);
|
||||
|
||||
remainingTimeBox
|
||||
.ResizeWidthTo(0, b.Duration - fade_duration)
|
||||
.Then()
|
||||
.ResizeWidthTo(1);
|
||||
|
||||
remainingTimeCounter.StartCounting(b.EndTime);
|
||||
|
||||
remainingTimeCounter.Show();
|
||||
info.Show();
|
||||
arrowsOverlay.Show();
|
||||
}
|
||||
|
||||
private void onBreakOut()
|
||||
{
|
||||
if (letterboxing)
|
||||
letterboxOverlay.Hide();
|
||||
|
||||
remainingTimeCounter.Hide();
|
||||
info.Hide();
|
||||
arrowsOverlay.Hide();
|
||||
}
|
||||
|
||||
public void BindProcessor(ScoreProcessor processor)
|
||||
{
|
||||
info.AccuracyDisplay.Current.BindTo(processor.Accuracy);
|
||||
info.GradeDisplay.Current.BindTo(processor.Rank);
|
||||
}
|
||||
}
|
||||
}
|
65
osu.Game/Screens/Play/BreaksOverlay/GlowIcon.cs
Normal file
65
osu.Game/Screens/Play/BreaksOverlay/GlowIcon.cs
Normal file
@ -0,0 +1,65 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using OpenTK;
|
||||
using osu.Framework.Allocation;
|
||||
|
||||
namespace osu.Game.Screens.Play.BreaksOverlay
|
||||
{
|
||||
public class GlowIcon : Container
|
||||
{
|
||||
private readonly SpriteIcon spriteIcon;
|
||||
private readonly BlurredIcon blurredIcon;
|
||||
|
||||
public override Vector2 Size
|
||||
{
|
||||
set
|
||||
{
|
||||
blurredIcon.Size = spriteIcon.Size = value;
|
||||
blurredIcon.ForceRedraw();
|
||||
}
|
||||
get { return base.Size; }
|
||||
}
|
||||
|
||||
public Vector2 BlurSigma
|
||||
{
|
||||
set { blurredIcon.BlurSigma = value; }
|
||||
get { return blurredIcon.BlurSigma; }
|
||||
}
|
||||
|
||||
public FontAwesome Icon
|
||||
{
|
||||
set { spriteIcon.Icon = blurredIcon.Icon = value; }
|
||||
get { return spriteIcon.Icon; }
|
||||
}
|
||||
|
||||
public GlowIcon()
|
||||
{
|
||||
RelativePositionAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
blurredIcon = new BlurredIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
spriteIcon = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Shadow = false,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
blurredIcon.Colour = colours.Blue;
|
||||
}
|
||||
}
|
||||
}
|
58
osu.Game/Screens/Play/BreaksOverlay/InfoContainer.cs
Normal file
58
osu.Game/Screens/Play/BreaksOverlay/InfoContainer.cs
Normal file
@ -0,0 +1,58 @@
|
||||
// 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;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Beatmaps.Timing;
|
||||
|
||||
namespace osu.Game.Screens.Play.BreaksOverlay
|
||||
{
|
||||
public class InfoContainer : VisibilityContainer
|
||||
{
|
||||
private const double fade_duration = BreakPeriod.MIN_BREAK_DURATION / 2;
|
||||
|
||||
public PercentageInfoLine AccuracyDisplay;
|
||||
public InfoLine<int> RankDisplay;
|
||||
public InfoLine<ScoreRank> GradeDisplay;
|
||||
|
||||
public InfoContainer()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Child = new FillFlowContainer
|
||||
{
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(5),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Text = "current progress".ToUpper(),
|
||||
TextSize = 15,
|
||||
Font = "Exo2.0-Black",
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
AccuracyDisplay = new PercentageInfoLine("Accuracy"),
|
||||
RankDisplay = new InfoLine<int>("Rank"),
|
||||
GradeDisplay = new InfoLine<ScoreRank>("Grade"),
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
protected override void PopIn() => this.FadeIn(fade_duration);
|
||||
protected override void PopOut() => this.FadeOut(fade_duration);
|
||||
}
|
||||
}
|
82
osu.Game/Screens/Play/BreaksOverlay/InfoLine.cs
Normal file
82
osu.Game/Screens/Play/BreaksOverlay/InfoLine.cs
Normal file
@ -0,0 +1,82 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Screens.Play.BreaksOverlay
|
||||
{
|
||||
public class InfoLine<T> : Container
|
||||
where T : struct
|
||||
{
|
||||
private const int margin = 2;
|
||||
|
||||
public Bindable<T> Current = new Bindable<T>();
|
||||
|
||||
private readonly OsuSpriteText text;
|
||||
private readonly OsuSpriteText valueText;
|
||||
|
||||
private readonly string prefix;
|
||||
|
||||
public InfoLine(string name, string prefix = @"")
|
||||
{
|
||||
this.prefix = prefix;
|
||||
|
||||
AutoSizeAxes = Axes.Y;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
text = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreRight,
|
||||
Text = name,
|
||||
TextSize = 17,
|
||||
Margin = new MarginPadding { Right = margin }
|
||||
},
|
||||
valueText = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Text = prefix + @"-",
|
||||
TextSize = 17,
|
||||
Font = "Exo2.0-Bold",
|
||||
Margin = new MarginPadding { Left = margin }
|
||||
}
|
||||
};
|
||||
|
||||
Current.ValueChanged += currentValueChanged;
|
||||
}
|
||||
|
||||
private void currentValueChanged(T newValue)
|
||||
{
|
||||
var newText = prefix + Format(newValue);
|
||||
|
||||
if (valueText.Text == newText)
|
||||
return;
|
||||
|
||||
valueText.Text = newText;
|
||||
}
|
||||
|
||||
protected virtual string Format(T count) => count.ToString();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
text.Colour = colours.Yellow;
|
||||
valueText.Colour = colours.YellowLight;
|
||||
}
|
||||
}
|
||||
|
||||
public class PercentageInfoLine : InfoLine<double>
|
||||
{
|
||||
public PercentageInfoLine(string name, string prefix = "") : base(name, prefix)
|
||||
{
|
||||
}
|
||||
|
||||
protected override string Format(double count) => $@"{count:P2}";
|
||||
}
|
||||
}
|
67
osu.Game/Screens/Play/BreaksOverlay/LetterboxOverlay.cs
Normal file
67
osu.Game/Screens/Play/BreaksOverlay/LetterboxOverlay.cs
Normal file
@ -0,0 +1,67 @@
|
||||
// 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.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Beatmaps.Timing;
|
||||
|
||||
namespace osu.Game.Screens.Play.BreaksOverlay
|
||||
{
|
||||
public class LetterboxOverlay : VisibilityContainer
|
||||
{
|
||||
private const double fade_duration = BreakPeriod.MIN_BREAK_DURATION / 2;
|
||||
private const int height = 350;
|
||||
|
||||
private static readonly Color4 transparent_black = new Color4(0, 0, 0, 0);
|
||||
|
||||
public LetterboxOverlay()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
Anchor = Anchor.TopLeft,
|
||||
Origin = Anchor.TopLeft,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = height,
|
||||
Child = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = new ColourInfo
|
||||
{
|
||||
TopLeft = Color4.Black,
|
||||
TopRight = Color4.Black,
|
||||
BottomLeft = transparent_black,
|
||||
BottomRight = transparent_black,
|
||||
}
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = height,
|
||||
Child = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = new ColourInfo
|
||||
{
|
||||
TopLeft = transparent_black,
|
||||
TopRight = transparent_black,
|
||||
BottomLeft = Color4.Black,
|
||||
BottomRight = Color4.Black,
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void PopIn() => this.FadeIn(fade_duration);
|
||||
protected override void PopOut() => this.FadeOut(fade_duration);
|
||||
}
|
||||
}
|
65
osu.Game/Screens/Play/BreaksOverlay/RemainingTimeCounter.cs
Normal file
65
osu.Game/Screens/Play/BreaksOverlay/RemainingTimeCounter.cs
Normal file
@ -0,0 +1,65 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Framework.Graphics;
|
||||
using System;
|
||||
using osu.Game.Beatmaps.Timing;
|
||||
|
||||
namespace osu.Game.Screens.Play.BreaksOverlay
|
||||
{
|
||||
public class RemainingTimeCounter : VisibilityContainer
|
||||
{
|
||||
private const double fade_duration = BreakPeriod.MIN_BREAK_DURATION / 2;
|
||||
|
||||
private readonly OsuSpriteText counter;
|
||||
|
||||
private int? previousSecond;
|
||||
|
||||
private double endTime;
|
||||
|
||||
private bool isCounting;
|
||||
|
||||
public RemainingTimeCounter()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Child = counter = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
TextSize = 33,
|
||||
Font = "Venera",
|
||||
};
|
||||
}
|
||||
|
||||
public void StartCounting(double endTime)
|
||||
{
|
||||
this.endTime = endTime;
|
||||
isCounting = true;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (isCounting)
|
||||
{
|
||||
var currentTime = Clock.CurrentTime;
|
||||
if (currentTime < endTime)
|
||||
{
|
||||
int currentSecond = (int)Math.Ceiling((endTime - Clock.CurrentTime) / 1000.0);
|
||||
if (currentSecond != previousSecond)
|
||||
{
|
||||
counter.Text = currentSecond.ToString();
|
||||
previousSecond = currentSecond;
|
||||
}
|
||||
}
|
||||
else isCounting = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void PopIn() => this.FadeIn(fade_duration);
|
||||
protected override void PopOut() => this.FadeOut(fade_duration);
|
||||
}
|
||||
}
|
@ -24,6 +24,7 @@ using osu.Game.Screens.Ranking;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Screens.Play.BreaksOverlay;
|
||||
using osu.Game.Storyboards.Drawables;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
@ -69,6 +70,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
#endregion
|
||||
|
||||
private BreakOverlay breakOverlay;
|
||||
private Container storyboardContainer;
|
||||
private DrawableStoryboard storyboard;
|
||||
|
||||
@ -179,16 +181,20 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Clock = offsetClock,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
RulesetContainer,
|
||||
}
|
||||
Child = RulesetContainer,
|
||||
},
|
||||
hudOverlay = new HUDOverlay
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
},
|
||||
breakOverlay = new BreakOverlay(beatmap.BeatmapInfo.LetterboxInBreaks)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Clock = decoupledClock,
|
||||
Breaks = beatmap.Breaks
|
||||
},
|
||||
}
|
||||
},
|
||||
failOverlay = new FailOverlay
|
||||
@ -222,6 +228,8 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
hudOverlay.ModDisplay.Current.BindTo(working.Mods);
|
||||
|
||||
breakOverlay.BindProcessor(scoreProcessor);
|
||||
|
||||
// Bind ScoreProcessor to ourselves
|
||||
scoreProcessor.AllJudged += onCompletion;
|
||||
scoreProcessor.Failed += onFail;
|
||||
|
@ -177,6 +177,8 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
public Action<BeatmapSetInfo> RestoreRequested;
|
||||
|
||||
public Action<BeatmapInfo> EditRequested;
|
||||
|
||||
public Action<BeatmapInfo> HideDifficultyRequested;
|
||||
|
||||
public void SelectNext(int direction = 1, bool skipDifficulties = true)
|
||||
@ -347,6 +349,7 @@ namespace osu.Game.Screens.Select
|
||||
StartRequested = b => StartRequested?.Invoke(),
|
||||
DeleteRequested = b => DeleteRequested?.Invoke(b),
|
||||
RestoreHiddenRequested = s => RestoreRequested?.Invoke(s),
|
||||
EditRequested = b => EditRequested?.Invoke(b),
|
||||
HideDifficultyRequested = b => HideDifficultyRequested?.Invoke(b),
|
||||
State = BeatmapGroupState.Collapsed
|
||||
};
|
||||
|
@ -19,6 +19,7 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Select.Options;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
@ -108,6 +109,7 @@ namespace osu.Game.Screens.Select
|
||||
BeatmapsChanged = carouselBeatmapsLoaded,
|
||||
DeleteRequested = promptDelete,
|
||||
RestoreRequested = s => { foreach (var b in s.Beatmaps) manager.Restore(b); },
|
||||
EditRequested = editRequested,
|
||||
HideDifficultyRequested = b => manager.Hide(b),
|
||||
StartRequested = () => carouselRaisedStart(),
|
||||
});
|
||||
@ -195,6 +197,12 @@ namespace osu.Game.Screens.Select
|
||||
carousel.AllowSelection = !Beatmap.Disabled;
|
||||
}
|
||||
|
||||
private void editRequested(BeatmapInfo beatmap)
|
||||
{
|
||||
Beatmap.Value = manager.GetWorkingBeatmap(beatmap, Beatmap);
|
||||
Push(new Editor());
|
||||
}
|
||||
|
||||
private void onBeatmapRestored(BeatmapInfo b) => carousel.UpdateBeatmap(b);
|
||||
private void onBeatmapHidden(BeatmapInfo b) => carousel.UpdateBeatmap(b);
|
||||
|
||||
|
Reference in New Issue
Block a user