From 1ea5539a9fb511322c2b89f830c106e2a1869c02 Mon Sep 17 00:00:00 2001 From: Shawdooow Date: Sun, 18 Mar 2018 22:46:41 -0400 Subject: [PATCH] its been a long time --- osu.Game/Online/Chat/Channel.cs | 2 +- osu.Game/Overlays/ChatOverlay.cs | 17 + osu.Game/Overlays/Toolbar/Toolbar.cs | 1 + .../Overlays/Toolbar/ToolbarSystemClock.cs | 47 ++ osu.Game/Screens/Evast/BeatmapScreen.cs | 51 ++ .../MusicVisualizers/CircularVisualizer.cs | 106 ++++ .../CircularVisualizerTestScreen.cs | 154 +++++ .../MusicVisualizers/LinearVisualizer.cs | 95 +++ .../LinearVisualizerTestScreen.cs | 140 +++++ .../MusicVisualizerContainer.cs | 163 ++++++ .../VisualizerBarTestScreen.cs | 134 +++++ .../MusicVisualizers/VisualizerTestScreen.cs | 76 +++ osu.Game/Screens/Evast/PixelField.cs | 178 ++++++ osu.Game/Screens/Evast/TestScreen.cs | 52 ++ osu.Game/Screens/Menu/ButtonSystem.cs | 2 + osu.Game/Screens/Menu/MainMenu.cs | 2 + osu.Game/Screens/OsuTalk/OsuTalkBackground.cs | 23 + osu.Game/Screens/OsuTalk/osuTalkMenu.cs | 80 +++ osu.Game/Screens/Pokeosu/PokeosuAPI.cs | 7 + osu.Game/Screens/Pokeosu/PokeosuMenu.cs | 541 ++++++++++++++++++ osu.Game/Screens/Pokeosu/PokeosuProfilePic.cs | 92 +++ .../Screens/Symcol/Pieces/ChibiCharacter.cs | 114 ++++ .../Screens/Symcol/Pieces/GeneralButton.cs | 34 ++ .../Screens/Symcol/Pieces/HitSoundBoard.cs | 236 ++++++++ osu.Game/Screens/Symcol/Pieces/Pippi.cs | 21 + osu.Game/Screens/Symcol/Pieces/Snow.cs | 83 +++ .../Screens/Symcol/Pieces/SymcolBackground.cs | 23 + .../Screens/Symcol/Pieces/SymcolButton.cs | 179 ++++++ .../Screens/Symcol/Pieces/SymcolVisualiser.cs | 163 ++++++ .../Symcol/Pieces/TutorialCharacter.cs | 168 ++++++ .../Shawdooow/ShawdooowLazerLiveWallpaper.cs | 100 ++++ .../Screens/Symcol/Screens/SymcolMapMixer.cs | 478 ++++++++++++++++ .../Symcol/Screens/SymcolOffsetTicker.cs | 237 ++++++++ .../Symcol/Screens/SymcolTestScreen.cs | 15 + osu.Game/Screens/Symcol/SymcolMenu.cs | 259 +++++++++ osu.Game/osu.Game.csproj | 20 + 36 files changed, 4092 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Overlays/Toolbar/ToolbarSystemClock.cs create mode 100644 osu.Game/Screens/Evast/BeatmapScreen.cs create mode 100644 osu.Game/Screens/Evast/MusicVisualizers/CircularVisualizer.cs create mode 100644 osu.Game/Screens/Evast/MusicVisualizers/CircularVisualizerTestScreen.cs create mode 100644 osu.Game/Screens/Evast/MusicVisualizers/LinearVisualizer.cs create mode 100644 osu.Game/Screens/Evast/MusicVisualizers/LinearVisualizerTestScreen.cs create mode 100644 osu.Game/Screens/Evast/MusicVisualizers/MusicVisualizerContainer.cs create mode 100644 osu.Game/Screens/Evast/MusicVisualizers/VisualizerBarTestScreen.cs create mode 100644 osu.Game/Screens/Evast/MusicVisualizers/VisualizerTestScreen.cs create mode 100644 osu.Game/Screens/Evast/PixelField.cs create mode 100644 osu.Game/Screens/Evast/TestScreen.cs create mode 100644 osu.Game/Screens/OsuTalk/OsuTalkBackground.cs create mode 100644 osu.Game/Screens/OsuTalk/osuTalkMenu.cs create mode 100644 osu.Game/Screens/Pokeosu/PokeosuAPI.cs create mode 100644 osu.Game/Screens/Pokeosu/PokeosuMenu.cs create mode 100644 osu.Game/Screens/Pokeosu/PokeosuProfilePic.cs create mode 100644 osu.Game/Screens/Symcol/Pieces/ChibiCharacter.cs create mode 100644 osu.Game/Screens/Symcol/Pieces/GeneralButton.cs create mode 100644 osu.Game/Screens/Symcol/Pieces/HitSoundBoard.cs create mode 100644 osu.Game/Screens/Symcol/Pieces/Pippi.cs create mode 100644 osu.Game/Screens/Symcol/Pieces/Snow.cs create mode 100644 osu.Game/Screens/Symcol/Pieces/SymcolBackground.cs create mode 100644 osu.Game/Screens/Symcol/Pieces/SymcolButton.cs create mode 100644 osu.Game/Screens/Symcol/Pieces/SymcolVisualiser.cs create mode 100644 osu.Game/Screens/Symcol/Pieces/TutorialCharacter.cs create mode 100644 osu.Game/Screens/Symcol/Screens/Shawdooow/ShawdooowLazerLiveWallpaper.cs create mode 100644 osu.Game/Screens/Symcol/Screens/SymcolMapMixer.cs create mode 100644 osu.Game/Screens/Symcol/Screens/SymcolOffsetTicker.cs create mode 100644 osu.Game/Screens/Symcol/Screens/SymcolTestScreen.cs create mode 100644 osu.Game/Screens/Symcol/SymcolMenu.cs diff --git a/osu.Game/Online/Chat/Channel.cs b/osu.Game/Online/Chat/Channel.cs index 35952fbc6e..321fa9582e 100644 --- a/osu.Game/Online/Chat/Channel.cs +++ b/osu.Game/Online/Chat/Channel.cs @@ -32,7 +32,7 @@ namespace osu.Game.Online.Chat public bool ReadOnly => false; - public const int MAX_HISTORY = 300; + public const int MAX_HISTORY = 600; [JsonConstructor] public Channel() diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 7c6e563c5b..76f3e68de0 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -25,6 +25,7 @@ using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.Chat; using osu.Game.Overlays.Chat; +using osu.Game.Graphics.Backgrounds; namespace osu.Game.Overlays { @@ -56,6 +57,7 @@ namespace osu.Game.Overlays private readonly Container chatContainer; private readonly Container tabsArea; private readonly Box chatBackground; + private readonly Triangles chatBackgroundTriangles; private readonly Box tabBackground; public Bindable ChatHeight { get; set; } @@ -110,6 +112,21 @@ namespace osu.Game.Overlays { RelativeSizeAxes = Axes.Both, }, + new Container + { + RelativeSizeAxes = Axes.Both, + Masking = true, + Children = new Drawable[] + { + chatBackgroundTriangles = new Triangles + { + RelativeSizeAxes = Axes.Both, + ColourDark = OsuColour.FromHex(@"132226"), + ColourLight = OsuColour.FromHex(@"1f3b42"), + TriangleScale = 3, + } + } + }, currentChannelContainer = new Container { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 8ac4e44a84..9377b9ee6b 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -58,6 +58,7 @@ namespace osu.Game.Overlays.Toolbar AutoSizeAxes = Axes.X, Children = new Drawable[] { + new ToolbarSystemClock(), new ToolbarDirectButton(), new ToolbarChatButton(), new ToolbarSocialButton(), diff --git a/osu.Game/Overlays/Toolbar/ToolbarSystemClock.cs b/osu.Game/Overlays/Toolbar/ToolbarSystemClock.cs new file mode 100644 index 0000000000..fc9a6e011d --- /dev/null +++ b/osu.Game/Overlays/Toolbar/ToolbarSystemClock.cs @@ -0,0 +1,47 @@ +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using System; + +namespace osu.Game.Overlays.Toolbar +{ + class ToolbarSystemClock : Container + { + private SystemClock time; + + public ToolbarSystemClock() + { + AutoSizeAxes = Axes.X; + Add(time = new SystemClock()); + } + } + public class SystemClock : Container + { + private static DateTime t = DateTime.Now; + private string time = t.ToString("hh:mm:ss tt"); + SpriteText clockText; + + public SystemClock() + { + clockText = new SpriteText + { + Font = @"Exo2.0-Medium", + Text = time, + Anchor = Anchor.BottomCentre, + Origin = Anchor.Centre, + Position = new OpenTK.Vector2(-70, 20), + TextSize = 28, + Colour = Color4.White, + }; + Add(clockText); + } + + protected override void Update() + { + t = DateTime.Now; + time = t.ToString("hh:mm:ss tt"); + clockText.Text = time; + } + } +} \ No newline at end of file diff --git a/osu.Game/Screens/Evast/BeatmapScreen.cs b/osu.Game/Screens/Evast/BeatmapScreen.cs new file mode 100644 index 0000000000..1709ccd318 --- /dev/null +++ b/osu.Game/Screens/Evast/BeatmapScreen.cs @@ -0,0 +1,51 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Screens; +using osu.Game.Beatmaps; +using osu.Game.Screens.Backgrounds; + +namespace osu.Game.Screens.Evast +{ + public class BeatmapScreen : OsuScreen + { + protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(); + private readonly Bindable beatmap = new Bindable(); + private readonly Vector2 backgroundBlur = new Vector2(20); + + [BackgroundDependencyLoader] + private void load(OsuGameBase game) + { + beatmap.BindTo(game.Beatmap); + beatmap.ValueChanged += OnBeatmapChange; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + beatmap.TriggerChange(); + } + + protected virtual void OnBeatmapChange(WorkingBeatmap beatmap) + { + var backgroundModeBeatmap = Background as BackgroundScreenBeatmap; + if (backgroundModeBeatmap != null) + { + backgroundModeBeatmap.Beatmap = beatmap; + backgroundModeBeatmap.BlurTo(backgroundBlur, 1000); + backgroundModeBeatmap.FadeTo(1, 250); + } + } + + protected override bool OnExiting(Screen next) + { + beatmap.ValueChanged -= OnBeatmapChange; + beatmap.UnbindAll(); + return base.OnExiting(next); + } + } +} diff --git a/osu.Game/Screens/Evast/MusicVisualizers/CircularVisualizer.cs b/osu.Game/Screens/Evast/MusicVisualizers/CircularVisualizer.cs new file mode 100644 index 0000000000..5f5854e82e --- /dev/null +++ b/osu.Game/Screens/Evast/MusicVisualizers/CircularVisualizer.cs @@ -0,0 +1,106 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; +using System; + +namespace osu.Game.Screens.Evast.MusicVisualizers +{ + public class CircularVisualizer : MusicVisualizerContainer + { + protected override VisualizerBar CreateNewBar() => new DefaultBar(); + + private float circleSize = 200; + public float CircleSize + { + set + { + if (circleSize == value) + return; + circleSize = value; + + if (!IsLoaded) + return; + + foreach (var bar in EqualizerBars) + bar.Position = calculateBarPosition(bar.Rotation); + } + get { return circleSize; } + } + + private float degreeValue = 360; + public float DegreeValue + { + set + { + if (degreeValue == value) + return; + degreeValue = value; + + if (!IsLoaded) + return; + + calculateBarProperties(); + } + get { return degreeValue; } + } + + protected override void AddBars() + { + calculateBarProperties(); + base.AddBars(); + } + + private void calculateBarProperties() + { + float spacing = DegreeValue / BarsAmount; + + for (int i = 0; i < BarsAmount; i++) + { + VisualizerBar bar = EqualizerBars[i]; + bar.Origin = Anchor.BottomCentre; + + float rotationValue = i * spacing; + + bar.Rotation = rotationValue; + bar.Position = calculateBarPosition(rotationValue); + } + } + + private Vector2 calculateBarPosition(float rotationValue) + { + float rotation = MathHelper.DegreesToRadians(rotationValue); + float rotationCos = (float)Math.Cos(rotation); + float rotationSin = (float)Math.Sin(rotation); + return new Vector2(rotationSin / 2, -rotationCos / 2) * circleSize; + } + + protected class DefaultBar : VisualizerBar + { + public DefaultBar() + { + Child = new Box + { + EdgeSmoothness = Vector2.One, + RelativeSizeAxes = Axes.Both, + Colour = Color4.White, + }; + } + + public override void SetValue(float amplitudeValue, float valueMultiplier, int softness, int faloff) + { + var newValue = amplitudeValue * valueMultiplier; + + if (newValue <= Height) + return; + + this.ResizeHeightTo(newValue) + .Then() + .ResizeHeightTo(0, softness); + } + } + } +} diff --git a/osu.Game/Screens/Evast/MusicVisualizers/CircularVisualizerTestScreen.cs b/osu.Game/Screens/Evast/MusicVisualizers/CircularVisualizerTestScreen.cs new file mode 100644 index 0000000000..7419cf3ce7 --- /dev/null +++ b/osu.Game/Screens/Evast/MusicVisualizers/CircularVisualizerTestScreen.cs @@ -0,0 +1,154 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// 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.Screens.Play.ReplaySettings; + +namespace osu.Game.Screens.Evast.MusicVisualizers +{ + public class CircularVisualizerTestScreen : TestScreen + { + private CircularVisualizer visualizer; + private Settings settings; + + protected override void AddTestObject(Container parent) + { + parent.Children = new Drawable[] + { + visualizer = new CircularVisualizer() + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + BarWidth = 2, + CircleSize = 250, + }, + }; + } + + protected override void AddSettings(FillFlowContainer parent) + { + parent.Children = new Drawable[] + { + settings = new Settings( + visualizer.ValueMultiplier, + visualizer.UpdateDelay, + visualizer.Softness, + visualizer.BarWidth, + visualizer.CircleSize, + visualizer.BarsAmount, + visualizer.DegreeValue, + visualizer.IsReversed) + }; + } + + protected override void Connect() + { + settings.MultiplierBindable.ValueChanged += newValue => visualizer.ValueMultiplier = newValue; + settings.UpdateBindable.ValueChanged += newValue => visualizer.UpdateDelay = newValue; + settings.SoftnessBindable.ValueChanged += newValue => visualizer.Softness = newValue; + settings.WidthBindable.ValueChanged += newValue => visualizer.BarWidth = newValue; + settings.ReverseBindable.ValueChanged += newValue => visualizer.IsReversed = newValue; + settings.SizeBindable.ValueChanged += newValue => visualizer.CircleSize = newValue; + settings.AmountBindable.ValueChanged += newValue => visualizer.BarsAmount = newValue; + settings.DegreeBindable.ValueChanged += newValue => visualizer.DegreeValue = newValue; + } + + private class Settings : ReplayGroup + { + protected override string Title => @"settings"; + + public readonly BindableFloat MultiplierBindable; + public readonly BindableInt UpdateBindable; + public readonly BindableInt SoftnessBindable; + public readonly BindableFloat WidthBindable; + public readonly BindableBool ReverseBindable; + public readonly BindableFloat SizeBindable; + public readonly BindableInt AmountBindable; + public readonly BindableFloat DegreeBindable; + + public Settings(float multiplier, int updateDelay, int softnessValue, float width, float circleSize, int barsAmount, float degreeValue, bool reverse) + { + Children = new Drawable[] + { + new ReplaySliderBar + { + LabelText = "Amplitude Multiplier", + Bindable = MultiplierBindable = new BindableFloat(multiplier) + { + Default = multiplier, + MinValue = 0, + MaxValue = 1000, + } + }, + new ReplaySliderBar + { + LabelText = "Update Delay", + Bindable = UpdateBindable = new BindableInt(updateDelay) + { + Default = updateDelay, + MinValue = 1, + MaxValue = 100, + } + }, + new ReplaySliderBar + { + LabelText = "Softness Value", + Bindable = SoftnessBindable = new BindableInt(softnessValue) + { + Default = softnessValue, + MinValue = 1, + MaxValue = 1000, + } + }, + new ReplaySliderBar + { + LabelText = "Bar Width", + Bindable = WidthBindable = new BindableFloat(width) + { + Default = width, + MinValue = 1, + MaxValue = 50, + } + }, + new ReplaySliderBar + { + LabelText = "Circle Size", + Bindable = SizeBindable = new BindableFloat(circleSize) + { + Default = circleSize, + MinValue = 0, + MaxValue = 500, + } + }, + new ReplaySliderBar + { + LabelText = "Bars Amount", + Bindable = AmountBindable = new BindableInt(barsAmount) + { + Default = barsAmount, + MinValue = 1, + MaxValue = 200, + } + }, + new ReplaySliderBar + { + LabelText = "Degree Value", + Bindable = DegreeBindable = new BindableFloat(degreeValue) + { + Default = degreeValue, + MinValue = 0, + MaxValue = 360, + } + }, + new ReplayCheckbox + { + LabelText = "Reversed", + Bindable = ReverseBindable = new BindableBool(reverse) { Default = reverse } + } + }; + } + } + } +} diff --git a/osu.Game/Screens/Evast/MusicVisualizers/LinearVisualizer.cs b/osu.Game/Screens/Evast/MusicVisualizers/LinearVisualizer.cs new file mode 100644 index 0000000000..1c039d890b --- /dev/null +++ b/osu.Game/Screens/Evast/MusicVisualizers/LinearVisualizer.cs @@ -0,0 +1,95 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; + +namespace osu.Game.Screens.Evast.MusicVisualizers +{ + public class LinearVisualizer : MusicVisualizerContainer + { + protected override VisualizerBar CreateNewBar() => new DefaultBar(); + + private readonly FillFlowContainer flow; + + private float spacing = 2; + public float Spacing + { + set { flow.Spacing = new Vector2(value); } + get { return flow.Spacing.X; } + } + + public LinearVisualizer() + { + AutoSizeAxes = Axes.Both; + Child = flow = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(spacing), + }; + } + + protected override void ClearBars() + { + if (flow.Children.Count > 0) + flow.Clear(true); + } + + protected override void AddBars() + { + foreach (var bar in EqualizerBars) + flow.Add(bar); + + if (!IsLoaded) + return; + + setOrigins(); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + setOrigins(); + } + + private void setOrigins() + { + flow.Anchor = Origin; + flow.Origin = Origin; + + foreach (var bar in EqualizerBars) + { + bar.Anchor = Origin; + bar.Origin = Origin; + } + } + + protected class DefaultBar : VisualizerBar + { + public DefaultBar() + { + Child = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White, + }; + } + + public override void SetValue(float amplitudeValue, float valueMultiplier, int softness, int faloff) + { + var newValue = amplitudeValue * valueMultiplier; + + if (newValue <= Height) + return; + + this.ResizeHeightTo(newValue) + .Then() + .ResizeHeightTo(0, softness); + } + } + } +} diff --git a/osu.Game/Screens/Evast/MusicVisualizers/LinearVisualizerTestScreen.cs b/osu.Game/Screens/Evast/MusicVisualizers/LinearVisualizerTestScreen.cs new file mode 100644 index 0000000000..5f82d9b3f4 --- /dev/null +++ b/osu.Game/Screens/Evast/MusicVisualizers/LinearVisualizerTestScreen.cs @@ -0,0 +1,140 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// 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.Screens.Play.ReplaySettings; + +namespace osu.Game.Screens.Evast.MusicVisualizers +{ + public class LinearVisualizerTestScreen : TestScreen + { + private LinearVisualizer visualizer; + private Settings settings; + + protected override void AddTestObject(Container parent) + { + parent.Children = new Drawable[] + { + visualizer = new LinearVisualizer() + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + BarWidth = 2, + }, + }; + } + + protected override void AddSettings(FillFlowContainer parent) + { + parent.Children = new Drawable[] + { + settings = new Settings( + visualizer.ValueMultiplier, + visualizer.UpdateDelay, + visualizer.Softness, + visualizer.BarWidth, + visualizer.Spacing, + visualizer.BarsAmount, + visualizer.IsReversed) + }; + } + + protected override void Connect() + { + settings.MultiplierBindable.ValueChanged += newValue => visualizer.ValueMultiplier = newValue; + settings.UpdateBindable.ValueChanged += newValue => visualizer.UpdateDelay = newValue; + settings.SoftnessBindable.ValueChanged += newValue => visualizer.Softness = newValue; + settings.WidthBindable.ValueChanged += newValue => visualizer.BarWidth = newValue; + settings.ReverseBindable.ValueChanged += newValue => visualizer.IsReversed = newValue; + settings.SpacingBindable.ValueChanged += newValue => visualizer.Spacing = newValue; + settings.AmountBindable.ValueChanged += newValue => visualizer.BarsAmount = newValue; + } + + private class Settings : ReplayGroup + { + protected override string Title => @"settings"; + + public readonly BindableFloat MultiplierBindable; + public readonly BindableInt UpdateBindable; + public readonly BindableInt SoftnessBindable; + public readonly BindableFloat WidthBindable; + public readonly BindableBool ReverseBindable; + public readonly BindableFloat SpacingBindable; + public readonly BindableInt AmountBindable; + + public Settings(float multiplier, int updateDelay, int softnessValue, float width, float spacing, int barsAmount, bool reverse) + { + Children = new Drawable[] + { + new ReplaySliderBar + { + LabelText = "Amplitude Multiplier", + Bindable = MultiplierBindable = new BindableFloat(multiplier) + { + Default = multiplier, + MinValue = 0, + MaxValue = 1000, + } + }, + new ReplaySliderBar + { + LabelText = "Update Delay", + Bindable = UpdateBindable = new BindableInt(updateDelay) + { + Default = updateDelay, + MinValue = 1, + MaxValue = 100, + } + }, + new ReplaySliderBar + { + LabelText = "Softness Value", + Bindable = SoftnessBindable = new BindableInt(softnessValue) + { + Default = softnessValue, + MinValue = 1, + MaxValue = 1000, + } + }, + new ReplaySliderBar + { + LabelText = "Bar Width", + Bindable = WidthBindable = new BindableFloat(width) + { + Default = width, + MinValue = 1, + MaxValue = 50, + } + }, + new ReplaySliderBar + { + LabelText = "Spacing", + Bindable = SpacingBindable = new BindableFloat(spacing) + { + Default = spacing, + MinValue = 0, + MaxValue = 20, + } + }, + new ReplaySliderBar + { + LabelText = "Bars Amount", + Bindable = AmountBindable = new BindableInt(barsAmount) + { + Default = barsAmount, + MinValue = 1, + MaxValue = 200, + } + }, + new ReplayCheckbox + { + LabelText = "Reversed", + Bindable = ReverseBindable = new BindableBool(reverse) { Default = reverse } + } + }; + } + } + } +} diff --git a/osu.Game/Screens/Evast/MusicVisualizers/MusicVisualizerContainer.cs b/osu.Game/Screens/Evast/MusicVisualizers/MusicVisualizerContainer.cs new file mode 100644 index 0000000000..1d1f4dbf74 --- /dev/null +++ b/osu.Game/Screens/Evast/MusicVisualizers/MusicVisualizerContainer.cs @@ -0,0 +1,163 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// 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.Containers; +using osu.Game.Beatmaps; + +namespace osu.Game.Screens.Evast.MusicVisualizers +{ + public abstract class MusicVisualizerContainer : Container + { + private readonly Bindable beatmap = new Bindable(); + + protected abstract VisualizerBar CreateNewBar(); + + private int updateDelay = 1; + public int UpdateDelay + { + set + { + if (updateDelay == value) + return; + updateDelay = value; + + if (!IsLoaded) + return; + + restart(); + } + get { return updateDelay; } + } + + private int softness = 100; + public int Softness + { + set + { + if (softness == value) + return; + softness = value; + + if (!IsLoaded) + return; + + restart(); + } + get { return softness; } + } + + private float barWidth = 4.5f; + public float BarWidth + { + set + { + if (barWidth == value) + return; + barWidth = value; + + if (!IsLoaded) + return; + + foreach (var bar in EqualizerBars) + bar.Width = barWidth; + } + get { return barWidth; } + } + + private int barsAmount = 200; + public int BarsAmount + { + set + { + if (barsAmount == value) + return; + barsAmount = value; + + if (!IsLoaded) + return; + + Scheduler.CancelDelayedTasks(); + resetBars(); + updateAmplitudes(); + } + get { return barsAmount; } + } + + protected virtual void ClearBars() + { + if (Children.Count > 0) + Clear(true); + } + + private void resetBars() + { + ClearBars(); + rearrangeBars(); + AddBars(); + } + + private void rearrangeBars() + { + EqualizerBars = new VisualizerBar[barsAmount]; + for (int i = 0; i < barsAmount; i++) + { + EqualizerBars[i] = CreateNewBar(); + EqualizerBars[i].Width = barWidth; + } + } + + public float ValueMultiplier { get; set; } = 400; + + protected int RealAmplitudeFor(int barNumber) => 200 / BarsAmount * barNumber; + + protected VisualizerBar[] EqualizerBars; + + public bool IsReversed { get; set; } + + [BackgroundDependencyLoader] + private void load(OsuGameBase game) + { + beatmap.BindTo(game.Beatmap); + rearrangeBars(); + AddBars(); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + updateAmplitudes(); + } + + protected virtual void AddBars() + { + foreach (var bar in EqualizerBars) + Add(bar); + } + + private void updateAmplitudes() + { + var frequencyAmplitudes = beatmap.Value.Track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256]; + + for (int i = 0; i < BarsAmount; i++) + { + var currentAmplitude = frequencyAmplitudes[RealAmplitudeFor(i)]; + EqualizerBars[IsReversed ? BarsAmount - 1 - i : i].SetValue(currentAmplitude, ValueMultiplier, Softness, UpdateDelay); + } + + Scheduler.AddDelayed(updateAmplitudes, UpdateDelay); + } + + private void restart() + { + Scheduler.CancelDelayedTasks(); + updateAmplitudes(); + } + + protected abstract class VisualizerBar : Container + { + public abstract void SetValue(float amplitudeValue, float valueMultiplier, int softness, int faloff); + } + } +} diff --git a/osu.Game/Screens/Evast/MusicVisualizers/VisualizerBarTestScreen.cs b/osu.Game/Screens/Evast/MusicVisualizers/VisualizerBarTestScreen.cs new file mode 100644 index 0000000000..aaa00a1ef3 --- /dev/null +++ b/osu.Game/Screens/Evast/MusicVisualizers/VisualizerBarTestScreen.cs @@ -0,0 +1,134 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; + +namespace osu.Game.Screens.Evast.MusicVisualizers +{ + public class VisualizerBarTestScreen : BeatmapScreen + { + public VisualizerBarTestScreen() + { + Children = new Drawable[] + { + new FallBarVisualizer() + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + BarsAmount = 100, + BarWidth = 5, + CircleSize = 250, + X = -400, + }, + new CircularVisualizer() + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + BarsAmount = 100, + BarWidth = 5, + CircleSize = 250, + }, + new CircularBarVisualizer() + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + BarsAmount = 100, + BarWidth = 5, + CircleSize = 250, + X = 400, + } + }; + } + + private class CircularBarVisualizer : CircularVisualizer + { + protected override VisualizerBar CreateNewBar() => new CircularBar() { Masking = true }; + + private class CircularBar : DefaultBar + { + public override void SetValue(float amplitudeValue, float valueMultiplier, int softness, int faloff) + { + var newValue = Width + amplitudeValue * valueMultiplier; + + if (newValue <= Height) + return; + + this.ResizeHeightTo(newValue) + .Then() + .ResizeHeightTo(0, softness); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + CornerRadius = Width / 2; + } + } + } + + private class FallBarVisualizer : CircularVisualizer + { + protected override VisualizerBar CreateNewBar() => new FallBar(); + + private class FallBar : VisualizerBar + { + private readonly Container mainBar; + private readonly Container fallingPiece; + + public FallBar() + { + AutoSizeAxes = Axes.Y; + Children = new Drawable[] + { + mainBar = new Container + { + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + Child = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White, + EdgeSmoothness = Vector2.One, + } + }, + fallingPiece = new Container + { + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + Height = 2, + Child = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White, + EdgeSmoothness = Vector2.One, + } + } + }; + } + + public override void SetValue(float amplitudeValue, float valueMultiplier, int softness, int faloff) + { + var newValue = amplitudeValue * valueMultiplier; + + if (newValue > mainBar.Height) + { + mainBar.ResizeHeightTo(newValue) + .Then() + .ResizeHeightTo(0, softness); + } + + if (mainBar.Height > -fallingPiece.Y) + { + fallingPiece.MoveToY(-newValue) + .Then() + .MoveToY(0, softness * 7); + } + } + } + } + } +} diff --git a/osu.Game/Screens/Evast/MusicVisualizers/VisualizerTestScreen.cs b/osu.Game/Screens/Evast/MusicVisualizers/VisualizerTestScreen.cs new file mode 100644 index 0000000000..3a98b54c78 --- /dev/null +++ b/osu.Game/Screens/Evast/MusicVisualizers/VisualizerTestScreen.cs @@ -0,0 +1,76 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; + +namespace osu.Game.Screens.Evast.MusicVisualizers +{ + public class VisualizerTestScreen : BeatmapScreen + { + public VisualizerTestScreen() + { + Children = new Drawable[] + { + new LinearVisualizer() + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + }, + new LinearVisualizer() + { + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + }, + new CircularVisualizer() + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + BarsAmount = 30, + DegreeValue = 180, + BarWidth = 5, + CircleSize = 150, + X = -400, + }, + new CircularVisualizer() + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + DegreeValue = 180, + CircleSize = 150, + BarsAmount = 30, + BarWidth = 5, + X = -400, + Rotation = 180, + IsReversed = true, + }, + new CircularVisualizer() + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + DegreeValue = 180, + BarsAmount = 50, + BarWidth = 2, + }, + new CircularVisualizer() + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + DegreeValue = 180, + BarsAmount = 50, + BarWidth = 2, + Rotation = 180, + }, + new CircularVisualizer() + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + ValueMultiplier = 200, + BarsAmount = 200, + CircleSize = 250, + BarWidth = 1, + X = 400, + } + }; + } + } +} diff --git a/osu.Game/Screens/Evast/PixelField.cs b/osu.Game/Screens/Evast/PixelField.cs new file mode 100644 index 0000000000..3a36ed454b --- /dev/null +++ b/osu.Game/Screens/Evast/PixelField.cs @@ -0,0 +1,178 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +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.Evast +{ + public class PixelField : Container + { + protected virtual Pixel CreateNewPixel(int size) => new Pixel(size); + + protected readonly Pixel[,] Pixels; + + private double updateDelay; + public double UpdateDelay + { + set { updateDelay = value; } + get { return updateDelay; } + } + + protected readonly int XCount; + protected readonly int YCount; + + public PixelField(int xCount, int yCount, int pixelSize = 15) + { + XCount = xCount; + YCount = yCount; + updateDelay = 200; + + Pixels = new Pixel[xCount, yCount]; + + Size = new Vector2(xCount * pixelSize, yCount * pixelSize); + + for (int y = 0; y < yCount; y++) + { + for (int x = 0; x < xCount; x++) + { + Pixels[x, y] = CreateNewPixel(pixelSize); + Pixels[x, y].Position = new Vector2(x * pixelSize, y * pixelSize); + + Add(Pixels[x, y]); + } + } + + for (int x = 0; x <= xCount; x++) + { + Add(new Container + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + RelativeSizeAxes = Axes.Y, + Width = 2, + Position = new Vector2(x * pixelSize - 1, 0), + Child = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Gray, + } + }); + } + + // horizontal lines + for (int y = 0; y <= yCount; y++) + { + Add(new Container + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + RelativeSizeAxes = Axes.X, + Height = 2, + Position = new Vector2(0, y * pixelSize - 1), + Child = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Gray, + } + }); + } + } + + protected virtual void OnRestart() + { + } + + protected virtual void OnPause() + { + } + + protected virtual void OnContinue() + { + if (!isGoing) + { + isGoing = true; + NewUpdate(); + } + } + + protected virtual void OnStop() + { + } + + protected virtual void OnNewUpdate() + { + } + + private bool isGoing; + + public void Restart() + { + Scheduler.CancelDelayedTasks(); + OnRestart(); + + isGoing = true; + + NewUpdate(); + } + + public void Stop() + { + Scheduler.CancelDelayedTasks(); + OnStop(); + + isGoing = false; + } + + public void Pause() + { + Scheduler.CancelDelayedTasks(); + OnPause(); + + isGoing = false; + } + + public void Continue() => OnContinue(); + + public void NewUpdate() + { + OnNewUpdate(); + + if (isGoing) + Scheduler.AddDelayed(NewUpdate, updateDelay); + } + + protected class Pixel : Container + { + protected readonly Box Background; + + private bool isActive; + public bool IsActive + { + set + { + if (isActive == value) + return; + isActive = value; + + Background.Colour = isActive ? Color4.White : Color4.Black.Opacity(170); + } + get { return isActive; } + } + + public Pixel(int size) + { + Size = new Vector2(size); + Child = Background = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black.Opacity(170), + }; + } + } + } +} diff --git a/osu.Game/Screens/Evast/TestScreen.cs b/osu.Game/Screens/Evast/TestScreen.cs new file mode 100644 index 0000000000..9df9144339 --- /dev/null +++ b/osu.Game/Screens/Evast/TestScreen.cs @@ -0,0 +1,52 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; + +namespace osu.Game.Screens.Evast +{ + public abstract class TestScreen : BeatmapScreen + { + private readonly Container objectParent; + private readonly FillFlowContainer settingParent; + + public TestScreen() + { + Children = new Drawable[] + { + objectParent = new Container + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + RelativeSizeAxes = Axes.Both, + Width = 0.7f + }, + settingParent = new FillFlowContainer + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 20), + Margin = new MarginPadding(20) + }, + }; + + AddTestObject(objectParent); + AddSettings(settingParent); + Connect(); + } + + protected virtual void AddTestObject(Container parent) + { + } + protected virtual void AddSettings(FillFlowContainer parent) + { + } + protected virtual void Connect() + { + } + } +} diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 72c26af2a6..124f0f5ae7 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -34,6 +34,7 @@ namespace osu.Game.Screens.Menu public Action OnSettings; public Action OnMulti; public Action OnChart; + public Action OnSymcol; public Action OnTest; private readonly FlowContainerWithOrigin buttonFlow; @@ -120,6 +121,7 @@ namespace osu.Game.Screens.Menu buttonsPlay.Add(new Button(@"solo", @"button-solo-select", FontAwesome.fa_user, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P)); buttonsPlay.Add(new Button(@"multi", @"button-generic-select", FontAwesome.fa_users, new Color4(94, 63, 186, 255), () => OnMulti?.Invoke(), 0, Key.M)); buttonsPlay.Add(new Button(@"chart", @"button-generic-select", FontAwesome.fa_osu_charts, new Color4(80, 53, 160, 255), () => OnChart?.Invoke())); + buttonsPlay.Add(new Button(@"symcol", @"select-5", FontAwesome.fa_osu_gear, new Color4(70, 48, 146, 255), () => OnSymcol?.Invoke())); buttonsTopLevel.Add(new Button(@"play", @"button-play-select", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), onPlay, WEDGE_WIDTH, Key.P)); buttonsTopLevel.Add(new Button(@"osu!editor", @"button-generic-select", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E)); diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 1e68b2a22d..ba57039744 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -16,6 +16,7 @@ using osu.Game.Screens.Direct; using osu.Game.Screens.Edit; using osu.Game.Screens.Multiplayer; using osu.Game.Screens.Select; +using osu.Game.Screens.Symcol; using osu.Game.Screens.Tournament; namespace osu.Game.Screens.Menu @@ -52,6 +53,7 @@ namespace osu.Game.Screens.Menu OnSolo = delegate { Push(consumeSongSelect()); }, OnMulti = delegate { Push(new Lobby()); }, OnExit = Exit, + OnSymcol = delegate { Push(new SymcolMenu()); }, } } }, diff --git a/osu.Game/Screens/OsuTalk/OsuTalkBackground.cs b/osu.Game/Screens/OsuTalk/OsuTalkBackground.cs new file mode 100644 index 0000000000..c971482a6b --- /dev/null +++ b/osu.Game/Screens/OsuTalk/OsuTalkBackground.cs @@ -0,0 +1,23 @@ +using osu.Game.Graphics.Containers; +using System; +using osu.Framework.Audio.Track; +using osu.Game.Beatmaps.ControlPoints; +using OpenTK; +using osu.Framework.Graphics; +using OpenTK.Graphics; +using osu.Game.Graphics; + +namespace osu.Game.Screens.OsuTalk +{ + public class OsuTalkBackground : BeatSyncedContainer + { + protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) + { + base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); + + Scale = new Vector2(1); + using (BeginDelayedSequence(100)) + this.ScaleTo(1.005f , Math.Max(0, timingPoint.BeatLength - 100) , Easing.OutQuad); + } + } +} diff --git a/osu.Game/Screens/OsuTalk/osuTalkMenu.cs b/osu.Game/Screens/OsuTalk/osuTalkMenu.cs new file mode 100644 index 0000000000..c800c391f4 --- /dev/null +++ b/osu.Game/Screens/OsuTalk/osuTalkMenu.cs @@ -0,0 +1,80 @@ +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Framework.Platform; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osu.Game.Screens.Backgrounds; +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.IO.Stores; +using osu.Framework.Extensions.Color4Extensions; +using osu.Game.Online.API; +using osu.Game.Graphics.Backgrounds; +using osu.Game.Screens.Pokeosu.PokeosuScreens; +using osu.Framework.Graphics.Colour; +using osu.Game.Users; +using osu.Framework.Graphics.Shapes; + +namespace osu.Game.Screens.OsuTalk +{ + public class OsuTalkMenu : OsuScreen + { + public override bool ShowOverlaysOnEnter => false; + + public static bool AssetsLoaded = false; + + protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault(); + + private OsuTalkBackground background; + + private Sprite pippi; + + private DependencyContainer dependencies; + protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => + dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + Children = new Drawable[] + { + pippi = new Sprite + { + Depth = -1, + FillMode = FillMode.Fill, + Texture = textures.Get(@"Backgrounds/Talk/BG_talk.png") + }, + new Box + { + Depth = 2, + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Colour = new Color4(21 , 37 , 51 , 255), + }, + background = new OsuTalkBackground + { + Depth = 1, + Scale = new Vector2(1.005f), + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + new Triangles + { + Depth = 0, + RelativeSizeAxes = Axes.Both, + ColourDark = new Color4(33 , 58 , 79 , 255), + ColourLight = new Color4(17 , 31 , 42 , 255), + TriangleScale = 4, + } + } + }, + }; + } + } +} diff --git a/osu.Game/Screens/Pokeosu/PokeosuAPI.cs b/osu.Game/Screens/Pokeosu/PokeosuAPI.cs new file mode 100644 index 0000000000..7fa3f88adc --- /dev/null +++ b/osu.Game/Screens/Pokeosu/PokeosuAPI.cs @@ -0,0 +1,7 @@ +namespace osu.Game.Screens.Pokeosu +{ + public class PokeosuAPI + { + + } +} diff --git a/osu.Game/Screens/Pokeosu/PokeosuMenu.cs b/osu.Game/Screens/Pokeosu/PokeosuMenu.cs new file mode 100644 index 0000000000..b7d6aafc19 --- /dev/null +++ b/osu.Game/Screens/Pokeosu/PokeosuMenu.cs @@ -0,0 +1,541 @@ +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Framework.Platform; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osu.Game.Screens.Backgrounds; +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.IO.Stores; +using osu.Framework.Extensions.Color4Extensions; +using osu.Game.Online.API; +using osu.Game.Graphics.Backgrounds; +using osu.Game.Screens.Pokeosu.PokeosuScreens; +using osu.Framework.Graphics.Colour; +using osu.Game.Users; +using osu.Framework.Graphics.Shapes; + +namespace osu.Game.Screens.Pokeosu +{ + public class PokeosuMenu : OsuScreen, IOnlineComponent + { + public override bool ShowOverlaysOnEnter => false; + + public static bool AssetsLoaded = false; + + protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault(); + + private PokeosuBackground background; + + public Container StartScreen; + private OsuButton startButton; + private SpriteText stateText; + private PokeosuProfilePic profilePic; + + public Container IntroScreen; + private SpriteText hi; + private SpriteText ready; + + public Container PlayerScreen; + private Container badgesChart; + + private Container badge1; + private SpriteText badge1Description; + private Sprite badge1Sprite; + /* + private Container badge2; + private SpriteText badge2Description; + private Sprite badge2Sprite; + + private Container badge3; + private SpriteText badge3Description; + private Sprite badge3Sprite; + */ + private OsuButton nextButton; + + private DependencyContainer dependencies; + protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => + dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + + [BackgroundDependencyLoader] + private void load(TextureStore textures, Storage storage, APIAccess api) + { + api.Register(this); + + User user = api.LocalUser.Value; + + TextureStore flagStore = new TextureStore(); + // Local flag store + flagStore.AddStore(new RawTextureLoaderStore(new NamespacedResourceStore(new StorageBackedResourceStore(storage), "Drawings"))); + // Default texture store + flagStore.AddStore(textures); + + dependencies.Cache(flagStore); + + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = new Color4(77, 77, 77, 255) + }, + new Sprite + { + FillMode = FillMode.Fill, + Texture = textures.Get(@"Backgrounds/Drawings/background.png") + }, + background = new PokeosuBackground + { + Scale = new Vector2(1.005f), + Alpha = 0.8f, + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + new Triangles + { + RelativeSizeAxes = Axes.Both, + ColourDark = new Color4(0.25f, 0.25f, 0.25f, 1), + ColourLight = new Color4(0.5f, 0.5f, 0.5f, 1), + TriangleScale = 4, + } + } + }, + StartScreen = new Container + { + Alpha = 1, + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Children = new Drawable[] + { + new SpriteText + { + Position = new Vector2(0 , -200), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = "Pokemosu", + TextSize = 32, + Colour = Color4.Yellow, + }, + new SpriteText + { + Position = new Vector2(0), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = "a tournement based on not just one gamemode", + TextSize = 20, + Colour = Color4.Yellow, + }, + stateText = new SpriteText + { + Alpha = 0, + Position = new Vector2(0 , 400), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = "null", + TextSize = 16, + Colour = Color4.Red, + }, + new Container + { + Position = new Vector2(0 , 60), + Size = new Vector2(220 , 40), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + CornerRadius = 4, + Children = new Drawable[] + { + startButton = new OsuButton + { + RelativeSizeAxes = Axes.X, + Text = "Start your journey", + Action = hiScreen, + } + } + }, + profilePic = new PokeosuProfilePic + { + Position = new Vector2(0 , -100), + Size = new Vector2(140), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + } + } + }, + IntroScreen = new Container + { + Alpha = 0, + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Children = new Drawable[] + { + hi = new SpriteText + { + Alpha = 1, + Position = new Vector2(0), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = "Hi", + TextSize = 80, + Colour = Color4.Yellow, + }, + ready = new SpriteText + { + Alpha = 0, + Position = new Vector2(0), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = "Welcome to Pokeosu!", + TextSize = 80, + Colour = Color4.Yellow, + }, + new Container + { + Position = new Vector2(0 , 80), + Size = new Vector2(100 , 40), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + CornerRadius = 4, + Children = new Drawable[] + { + nextButton = new OsuButton + { + RelativeSizeAxes = Axes.X, + Text = "Next", + Action = welcomeScreen, + } + } + } + } + }, + PlayerScreen = new Container + { + Alpha = 0, + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Children = new Drawable[] + { + /* + new AsyncLoadWrapper(new CoverBackgroundSprite(user) + { + Depth = 11, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + FillMode = FillMode.Fill, + }), + */ + new DrawableFlag(user.Country) + { + Position = new Vector2(10 , -10), + Size = new Vector2(3 , 2), + Scale = new Vector2(20), + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Width = 0.12f, + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + + Children = new Drawable[] + { + new Triangles + { + RelativeSizeAxes = Axes.Both, + ColourDark = Color4.DarkGoldenrod, + ColourLight = Color4.LightYellow, + TriangleScale = 2, + }, + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + + Text = "Pokeosu!", + TextSize = 22f, + Font = "Exo2.0-Bold" + }, + new FillFlowContainer + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Width = 0.75f, + + Position = new Vector2(0, 35f), + + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 5f), + + Children = new Drawable[] + { + new OsuButton + { + RelativeSizeAxes = Axes.X, + + Text = "Find Match", + }, + new OsuButton + { + RelativeSizeAxes = Axes.X, + + Text = "Start Match", + }, + new OsuButton + { + RelativeSizeAxes = Axes.X, + + Text = "Open Discord", + }, + } + }, + new FillFlowContainer + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Width = 0.75f, + + Position = new Vector2(0, -5f), + + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 5f), + + Children = new Drawable[] + { + new OsuButton + { + RelativeSizeAxes = Axes.X, + + Text = "Leave Pokeosu :(", + } + } + } + } + }, + profilePic = new PokeosuProfilePic + { + Position = new Vector2(10), + Size = new Vector2(140), + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + }, + badgesChart = new Container + { + Masking = true, + Depth = 0, + Position = new Vector2(0), + Size = new Vector2(600, 400), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + BorderColour = Color4.White, + BorderThickness = 10, + CornerRadius = 20, + Children = new Drawable[] + { + badge1 = new Container + { + Depth = -3, + Position = new Vector2(0), + Size = new Vector2(40), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Colour = Color4.Brown, + Children = new Drawable[] + { + badge1Sprite = new Sprite + { + Position = new Vector2(0 , -20), + Size = new Vector2(40), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Alpha = 1, + }, + badge1Description = new SpriteText + { + Position = new Vector2(0), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = "Standard Tier 1", + TextSize = 20, + } + } + },/* + badge2 = new Container + { + Position = new Vector2(0), + Size = new Vector2(40), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + badge2Sprite = new Sprite + { + + }, + badge2Description = new SpriteText + { + + } + } + }, + badge3 = new Container + { + Position = new Vector2(0), + Size = new Vector2(40), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + badge3Sprite = new Sprite + { + + }, + badge3Description = new SpriteText + { + + } + } + },*/ + new SpriteText + { + Depth = -1, + Position = new Vector2 (0 , 6), + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Text = "Badges", + Colour = Color4.White, + TextSize = 32, + }, + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = ColourInfo.GradientVertical(Color4.DarkBlue , Color4.Blue), + }, + new Container + { + Depth = 0, + Alpha = 0.5f, + Masking = true, + RelativeSizeAxes = Axes.Both, + CornerRadius = 20, + Children = new Drawable[] + { + new Triangles + { + TriangleScale = 2, + RelativeSizeAxes = Axes.Both, + ColourDark = Color4.DarkBlue, + ColourLight = Color4.LightBlue, + } + } + }, + }, + EdgeEffect = new EdgeEffectParameters + { + Radius = 10, + Type = EdgeEffectType.Shadow, + Colour = Color4.Cyan.Opacity(0.5f), + }, + }, + } + } + }; + + //badge1Sprite.Texture = PokeosuTextures.Get("pokeosuIcon"); + //badge2Sprite.Texture = PokeosuTextures.Get("pokeosuIcon"); + //badge3Sprite.Texture = PokeosuTextures.Get("pokeosuIcon"); + } + + private class CoverBackgroundSprite : Sprite + { + private readonly User user; + + public CoverBackgroundSprite(User user) + { + this.user = user; + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + if (!string.IsNullOrEmpty(user.CoverUrl)) + Texture = textures.Get(user.CoverUrl); + } + } + + public void APIStateChanged(APIAccess api, APIState state) + { + switch (state) + { + default: + startButton.Text = "Start your journey"; + break; + case APIState.Online: + startButton.Text = "Start your journey, " + api.Username; + break; + } + } + /* + public void PokeosuAPIStateChanged() + { + switch (state) + { + case PokeosuAPIState.Connecting: + stateText.Text = "Connecting. . ."; + stateText.Alpha = 0; + break; + case PokeosuAPIState.Online: + stateText.Text = "We have connected!"; + stateText.FadeOut(1000 , EasingTypes.InSine); + break; + } + } + */ + private void testMatch() + { + //Lol multiplayer has to be made first + + //string matchID = "Pokeosu Test Match 34Gj7"; + //string matchPASSWORD = "34Gj7" + } + + private void testLink() + { + //System.Diagnostics.Process.Start("https://discord.gg/5U6QDEA"); + } + + private void hiScreen() + { + StartScreen.FadeOutFromOne(1000, Easing.InOutQuad); + IntroScreen.FadeInFromZero(1000, Easing.InOutQuad); + } + private void welcomeScreen() + { + hi.FadeOutFromOne(500, Easing.InOutQuad); + ready.FadeInFromZero(500, Easing.InOutQuad); + nextButton.Action = playerPage; + } + private void playerPage() + { + IntroScreen.FadeOutFromOne(1000, Easing.InOutQuad); + PlayerScreen.FadeInFromZero(1000, Easing.InOutQuad); + } + } +} diff --git a/osu.Game/Screens/Pokeosu/PokeosuProfilePic.cs b/osu.Game/Screens/Pokeosu/PokeosuProfilePic.cs new file mode 100644 index 0000000000..62a86eae20 --- /dev/null +++ b/osu.Game/Screens/Pokeosu/PokeosuProfilePic.cs @@ -0,0 +1,92 @@ +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Input; +using osu.Game.Online.API; +using osu.Game.Users; +using System; + +namespace osu.Game.Screens.Pokeosu +{ + public class PokeosuProfilePic : Container, IOnlineComponent + { + private Container dragContainer; + + private FillFlowContainer user; + private UpdateableAvatar avatar; + + protected override bool OnDragStart(InputState state) => true; + + protected override bool OnDrag(InputState state) + { + Vector2 change = state.Mouse.Position - state.Mouse.PositionMouseDown.Value; + + // Diminish the drag distance as we go further to simulate "rubber band" feeling. + change *= change.Length <= 0 ? 0 : (float)Math.Pow(change.Length, 0.7f) / change.Length; + + dragContainer.MoveTo(change); + return base.OnDrag(state); + } + + protected override bool OnDragEnd(InputState state) + { + dragContainer.MoveTo(Vector2.Zero, 800, Easing.OutElastic); + return base.OnDragEnd(state); + } + + [BackgroundDependencyLoader] + private void load(APIAccess api) + { + api.Register(this); + + Children = new Drawable[] + { + dragContainer = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Size = new Vector2(140), + Children = new Drawable[] + { + user = new FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.X, + }, + } + } + }; + user.Add(avatar = new UpdateableAvatar + { + Masking = true, + Size = new Vector2(140), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + CornerRadius = (16), + EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Shadow, + Radius = 8, + Colour = Color4.Black.Opacity(0.1f), + } + }); + } + public void APIStateChanged(APIAccess api, APIState state) + { + switch (state) + { + default: + avatar.User = new User(); + break; + case APIState.Online: + avatar.User = api.LocalUser; + break; + } + } + } +} diff --git a/osu.Game/Screens/Symcol/Pieces/ChibiCharacter.cs b/osu.Game/Screens/Symcol/Pieces/ChibiCharacter.cs new file mode 100644 index 0000000000..96f862b02f --- /dev/null +++ b/osu.Game/Screens/Symcol/Pieces/ChibiCharacter.cs @@ -0,0 +1,114 @@ +using OpenTK; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; +using osu.Framework.MathUtils; +using System.Diagnostics; +using osu.Game.Graphics.Containers; +using osu.Framework.Graphics; + +namespace osu.Game.Screens.Symcol.Pieces +{ + public abstract class ChibiCharacter : BeatSyncedContainer + { + protected Sprite CharacterIdleSprite; + protected Sprite CharacterGrabbedSprite; + + public Vector2 Velocity = Vector2.Zero; + + public ChibiCharacter(string characterName) + { + Origin = Anchor.Centre; + + Children = new Drawable[] + { + CharacterIdleSprite = new Sprite + { + Origin = Anchor.Centre, + FillMode = FillMode.Fill, + //Texture = OsuGame.SymcolTextures.Get(characterName + "Idle") + }, + CharacterGrabbedSprite = new Sprite + { + Origin = Anchor.Centre, + FillMode = FillMode.Fill, + //Texture = OsuGame.SymcolTextures.Get(characterName + "Grabbed") + } + }; + } + + protected override void Update() + { + base.Update(); + + //Just a IsGrabbed bool basically + if (CharacterGrabbedSprite.Alpha < 1) + movement(); + + float r = RNG.Next(0, 1001); + if (r == 500) + jump(RNG.NextBool()); + } + + private void movement() + { + //Gravity + Velocity.Y += (float)Clock.ElapsedFrameTime / 1000 * 9.8f; + //Air Friction + Velocity *= new Vector2((float)Clock.ElapsedFrameTime / 1000 * 0.1f); + + //Lets make sure we don't fall through the floor + if (Position.Y <= 0 && Velocity.Y >= 9.8f) + Velocity.Y *= 0.5f; + else if (Position.Y <= 0 && Velocity.Y > 0) + Velocity.Y = 0; + + //"Move that gear up" -Engineer + this.MoveToOffset(Velocity); + } + + private void jump(bool left) + { + if (left) + { + + } + else + { + + } + } + + #region Drag Crap + protected override bool OnDragStart(InputState state) => true; + + private Vector2 startPosition; + + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + { + startPosition = Position; + + CharacterIdleSprite.Alpha = 0; + CharacterGrabbedSprite.Alpha = 1; + + return base.OnMouseDown(state, args); + } + + protected override bool OnDrag(InputState state) + { + Trace.Assert(state.Mouse.PositionMouseDown != null, "state.Mouse.PositionMouseDown != null"); + + Position = startPosition + state.Mouse.Position - state.Mouse.PositionMouseDown.Value; + + return base.OnDrag(state); + } + + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + { + CharacterIdleSprite.Alpha = 1; + CharacterGrabbedSprite.Alpha = 0; + + return base.OnMouseUp(state, args); + } + #endregion + } +} diff --git a/osu.Game/Screens/Symcol/Pieces/GeneralButton.cs b/osu.Game/Screens/Symcol/Pieces/GeneralButton.cs new file mode 100644 index 0000000000..fc64ae5c21 --- /dev/null +++ b/osu.Game/Screens/Symcol/Pieces/GeneralButton.cs @@ -0,0 +1,34 @@ +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Framework.Graphics.Colour; +using osu.Game.Graphics.Backgrounds; +using osu.Game.Beatmaps.ControlPoints; +using System; +using osu.Framework.Configuration; +using osu.Framework.Audio.Track; +using System.Collections.Generic; +using OpenTK.Input; + +namespace osu.Game.Screens.Symcol.Pieces +{ + public class GeneralButton : Sprite + { + public Action Action; + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => this.ReceiveMouseInputAt(screenSpacePos); + + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + { + Action(); + return true; + } + } +} diff --git a/osu.Game/Screens/Symcol/Pieces/HitSoundBoard.cs b/osu.Game/Screens/Symcol/Pieces/HitSoundBoard.cs new file mode 100644 index 0000000000..56cb9263e2 --- /dev/null +++ b/osu.Game/Screens/Symcol/Pieces/HitSoundBoard.cs @@ -0,0 +1,236 @@ +using OpenTK; +using OpenTK.Graphics; +using OpenTK.Input; +using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; + +namespace osu.Game.Screens.Symcol.Pieces +{ + public class HitSoundBoard : Container + { + public int ButtonSize = 100; + + private SampleChannel nNormal; + private SampleChannel sNormal; + private SampleChannel dNormal; + + private SampleChannel nWhistle; + private SampleChannel sWhistle; + private SampleChannel dWhistle; + + private SampleChannel nFinish; + private SampleChannel sFinish; + private SampleChannel dFinish; + + private SampleChannel nClap; + private SampleChannel sClap; + private SampleChannel dClap; + + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + nNormal = audio.Sample.Get($@"Gameplay/normal-hitnormal"); + sNormal = audio.Sample.Get($@"Gameplay/soft-hitnormal"); + dNormal = audio.Sample.Get($@"Gameplay/drum-hitnormal"); + + nWhistle = audio.Sample.Get($@"Gameplay/normal-hitwhistle"); + sWhistle = audio.Sample.Get($@"Gameplay/soft-hitwhistle"); + dWhistle = audio.Sample.Get($@"Gameplay/drum-hitwhistle"); + + nFinish = audio.Sample.Get($@"Gameplay/normal-hitfinish"); + sFinish = audio.Sample.Get($@"Gameplay/soft-hitfinish"); + dFinish = audio.Sample.Get($@"Gameplay/drum-hitfinish"); + + nClap = audio.Sample.Get($@"Gameplay/normal-hitclap"); + sClap = audio.Sample.Get($@"Gameplay/soft-hitclap"); + dClap = audio.Sample.Get($@"Gameplay/drum-hitclap"); + + Children = new Drawable[] + { + //Noramal + new SymcolButton + { + ButtonName = "Normal", + ButtonLabel = 'N', + Depth = -2, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.DarkRed, + ButtonColorBottom = Color4.Red, + ButtonSize = ButtonSize, + Action = () => playSample(nNormal), + Position = new Vector2(-ButtonSize - ButtonSize / 2 , -ButtonSize), + Bind = Key.Number1 + }, + new SymcolButton + { + ButtonName = "Normal", + ButtonLabel = 'S', + Depth = -2, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.DarkBlue, + ButtonColorBottom = Color4.Blue, + ButtonSize = ButtonSize, + Action = () => playSample(sNormal), + Position = new Vector2(-ButtonSize - ButtonSize / 2 , ButtonSize), + Bind = Key.A + }, + new SymcolButton + { + ButtonName = "Normal", + ButtonLabel = 'D', + Depth = -2, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.DarkGreen, + ButtonColorBottom = Color4.Green, + ButtonSize = ButtonSize, + Action = () => playSample(dNormal), + Position = new Vector2(-ButtonSize - ButtonSize / 2, 0), + Bind = Key.Q + }, + + //Whistle + new SymcolButton + { + ButtonName = "Whistle", + ButtonLabel = 'N', + Depth = -2, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.DarkRed, + ButtonColorBottom = Color4.Red, + ButtonSize = ButtonSize, + Action = () => playSample(nWhistle), + Position = new Vector2(-ButtonSize / 2 , -ButtonSize), + Bind = Key.Number2 + }, + new SymcolButton + { + ButtonName = "Whistle", + ButtonLabel = 'S', + Depth = -2, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.DarkBlue, + ButtonColorBottom = Color4.Blue, + ButtonSize = ButtonSize, + Action = () => playSample(sWhistle), + Position = new Vector2(-ButtonSize / 2 , ButtonSize), + Bind = Key.S + }, + new SymcolButton + { + ButtonName = "Whistle", + ButtonLabel = 'D', + Depth = -2, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.DarkGreen, + ButtonColorBottom = Color4.Green, + ButtonSize = ButtonSize, + Action = () => playSample(dWhistle), + Position = new Vector2(-ButtonSize / 2, 0), + Bind = Key.W + }, + + //Finish + new SymcolButton + { + ButtonName = "Finish", + ButtonLabel = 'N', + Depth = -2, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.DarkRed, + ButtonColorBottom = Color4.Red, + ButtonSize = ButtonSize, + Action = () => playSample(nFinish), + Position = new Vector2(ButtonSize / 2 , -ButtonSize), + Bind = Key.Number3 + }, + new SymcolButton + { + ButtonName = "Finish", + ButtonLabel = 'S', + Depth = -2, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.DarkBlue, + ButtonColorBottom = Color4.Blue, + ButtonSize = ButtonSize, + Action = () => playSample(sFinish), + Position = new Vector2(ButtonSize * 0.5f , ButtonSize), + Bind = Key.D + }, + new SymcolButton + { + ButtonName = "Finish", + ButtonLabel = 'D', + Depth = -2, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.DarkGreen, + ButtonColorBottom = Color4.Green, + ButtonSize = ButtonSize, + Action = () => playSample(dFinish), + Position = new Vector2(ButtonSize * 0.5f, 0), + Bind = Key.E + }, + + //Clap + new SymcolButton + { + ButtonName = "Clap", + ButtonLabel = 'N', + Depth = -2, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.DarkRed, + ButtonColorBottom = Color4.Red, + ButtonSize = ButtonSize, + Action = () => playSample(nClap), + Position = new Vector2(ButtonSize * 1.5f , -ButtonSize), + Bind = Key.Number4 + }, + new SymcolButton + { + ButtonName = "Clap", + ButtonLabel = 'S', + Depth = -2, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.DarkBlue, + ButtonColorBottom = Color4.Blue, + ButtonSize = ButtonSize, + Action = () => playSample(sClap), + Position = new Vector2(ButtonSize * 1.5f , ButtonSize), + Bind = Key.F + }, + new SymcolButton + { + ButtonName = "Clap", + ButtonLabel = 'D', + Depth = -2, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.DarkGreen, + ButtonColorBottom = Color4.Green, + ButtonSize = ButtonSize, + Action = () => playSample(dClap), + Position = new Vector2(ButtonSize * 1.5f, 0), + Bind = Key.R + }, + }; + } + + private void playSample(SampleChannel sample) + { + sample.Play(); + } + } +} diff --git a/osu.Game/Screens/Symcol/Pieces/Pippi.cs b/osu.Game/Screens/Symcol/Pieces/Pippi.cs new file mode 100644 index 0000000000..3c1b1154dd --- /dev/null +++ b/osu.Game/Screens/Symcol/Pieces/Pippi.cs @@ -0,0 +1,21 @@ +using osu.Framework.Allocation; +using osu.Framework.Graphics.Textures; +using osu.Game.Graphics; + +namespace osu.Game.Screens.Symcol.Pieces +{ + public class Pippi : Mascot + { + public Pippi() + { + + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures, OsuColour colors) + { + SpeechBubbleBackground.Colour = colors.Pink; + Idle.Texture = textures.Get("Menu/comboburst@2x"); + } + } +} diff --git a/osu.Game/Screens/Symcol/Pieces/Snow.cs b/osu.Game/Screens/Symcol/Pieces/Snow.cs new file mode 100644 index 0000000000..7650732236 --- /dev/null +++ b/osu.Game/Screens/Symcol/Pieces/Snow.cs @@ -0,0 +1,83 @@ +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; +using osu.Framework.MathUtils; +using osu.Game.Graphics.Containers; + +namespace osu.Game.Screens.Symcol.Pieces +{ + public class Snow : BeatSyncedContainer + { + public Snow() + { + RelativeSizeAxes = Axes.Both; + Masking = false; + } + + protected override void Update() + { + base.Update(); + + float randomPositionXValue = ((float)RNG.NextDouble(0, (int)ScreenSpaceDrawQuad.TopRight.X)); + + float spawn = (float)RNG.NextDouble(1, 5000 * ((float)Clock.ElapsedFrameTime / 1000)); + + if (spawn < 2) + addSnowParticle(randomPositionXValue); + } + + private void addSnowParticle(float x) + { + Add(new SnowParticle(new Vector2(ScreenSpaceDrawQuad.TopRight.X / 1.8f, ScreenSpaceDrawQuad.BottomLeft.Y / 2)) + { + Anchor = Anchor.TopLeft, + Origin = Anchor.Centre, + Position = new Vector2 (x, -100) + }); + } + } + + public class SnowParticle : Sprite + { + private float randomMovementYValue = 1; + private float randomMovementXValue = 1; + private float randomRotationValue = 1; + private bool randomRotateDirection = false; + private readonly Vector2 screenSize; + + public SnowParticle(Vector2 screenSize) + { + //Texture = OsuGame.SymcolTextures.Get("snowflake"); + + this.screenSize = screenSize; + + randomMovementYValue = ((float)RNG.NextDouble(10, 40) * 2); + randomMovementXValue = ((float)RNG.NextDouble(-10, 10) * 2); + randomRotationValue = ((float)RNG.NextDouble(10, 16)) / 10; + randomRotateDirection = RNG.NextBool(); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + float randomScaleValue = ((float)RNG.NextDouble(50, 100) / 500); + Scale = new Vector2(randomScaleValue); + } + + protected override void Update() + { + base.Update(); + + if (randomRotateDirection) + this.RotateTo((float)((Clock.CurrentTime / 1000) * 90) * randomRotationValue); + else + this.RotateTo(((float)((Clock.CurrentTime / 1000) * 90) * -1) * randomRotationValue); + + this.MoveToOffset(new Vector2(randomMovementXValue * ((float)Clock.ElapsedFrameTime / 1000), randomMovementYValue * ((float)Clock.ElapsedFrameTime / 1000))); + + if (Position.X > screenSize.X + 40 || Position.Y > screenSize.Y + 40 || Position.Y < -100 || Position.X < -40) + Expire(); + } + } +} diff --git a/osu.Game/Screens/Symcol/Pieces/SymcolBackground.cs b/osu.Game/Screens/Symcol/Pieces/SymcolBackground.cs new file mode 100644 index 0000000000..b08462801c --- /dev/null +++ b/osu.Game/Screens/Symcol/Pieces/SymcolBackground.cs @@ -0,0 +1,23 @@ +using osu.Game.Graphics.Containers; +using System; +using osu.Framework.Audio.Track; +using osu.Game.Beatmaps.ControlPoints; +using OpenTK; +using osu.Framework.Graphics; +using OpenTK.Graphics; +using osu.Game.Graphics; + +namespace osu.Game.Screens.Symcol.Pieces +{ + public class SymcolBackground : BeatSyncedContainer + { + protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) + { + base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); + + Scale = new Vector2(1); + using (BeginDelayedSequence(100)) + this.ScaleTo(1.0025f , Math.Max(0, timingPoint.BeatLength - 100) , Easing.OutQuad); + } + } +} diff --git a/osu.Game/Screens/Symcol/Pieces/SymcolButton.cs b/osu.Game/Screens/Symcol/Pieces/SymcolButton.cs new file mode 100644 index 0000000000..d62f317c34 --- /dev/null +++ b/osu.Game/Screens/Symcol/Pieces/SymcolButton.cs @@ -0,0 +1,179 @@ +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Framework.Graphics.Colour; +using osu.Game.Graphics.Backgrounds; +using osu.Game.Beatmaps.ControlPoints; +using System; +using osu.Framework.Configuration; +using osu.Framework.Audio.Track; +using System.Collections.Generic; +using OpenTK.Input; + +namespace osu.Game.Screens.Symcol.Pieces +{ + public class SymcolButton : BeatSyncedContainer + { + private Box hover; + private Container content; + private Sprite icon; + private SpriteText buttonName; + + public float ButtonSize { get; set; } + public Color4 ButtonColorTop { get; set; } + public Color4 ButtonColorBottom { get; set; } + public Vector2 ButtonPosition { get; set; } + public string ButtonName { get; set; } + public float ButtonFontSizeMultiplier { get; set; } = 1; + public char ButtonLabel { get; set; } + public Key Bind = Key.Unknown; + + protected override void LoadComplete() + { + base.LoadComplete(); + + Children = new Drawable[] + { + content = new Container + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Size = new Vector2 (ButtonSize), + + BorderColour = Color4.White, + BorderThickness = ButtonSize / 12, + + CornerRadius = ButtonSize / 2, + Masking = true, + EdgeEffect = new EdgeEffectParameters + { + Colour = Color4.Black.Opacity(0.1f), + Type = EdgeEffectType.Shadow, + Radius = ButtonSize / 4, + }, + Children = new Drawable[] + { + new Triangles + { + Depth = -1, + TriangleScale = 1, + ColourLight = ButtonColorBottom, + ColourDark = ButtonColorTop, + RelativeSizeAxes = Axes.Both, + }, + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = ColourInfo.GradientVertical(ButtonColorTop , ButtonColorBottom), + }, + hover = new Box + { + Depth = -2, + RelativeSizeAxes = Axes.Both, + Alpha = 0, + Colour = Color4.White, + }, + icon = new Sprite + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + } + } + }, + buttonName = new SpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = ButtonName, + TextSize = (ButtonSize / 4) * ButtonFontSizeMultiplier, + }, + new SpriteText + { + Position = new Vector2(0 , -10), + Anchor = Anchor.TopCentre, + Origin = Anchor.BottomCentre, + Text = ButtonLabel.ToString(), + TextSize = ButtonSize / 4, + } + }; + } + + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => content.ReceiveMouseInputAt(screenSpacePos); + + private const double early_activation = 60; + + private int lastBeatIndex; + + protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) + { + { + base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); + + lastBeatIndex = beatIndex; + + var beatLength = timingPoint.BeatLength; + + float amplitudeAdjust = Math.Min(1, 0.4f + amplitudes.Maximum); + + if (beatIndex < 0) return; + + this.ScaleTo(1 - 0.02f * amplitudeAdjust, early_activation, Easing.Out); + using (BeginDelayedSequence(early_activation)) + this.ScaleTo(1, beatLength * 2, Easing.OutQuint); + } + } + + private bool recieveInput = false; + + protected override bool OnHover(InputState state) + { + hover.FadeTo(0.25f , 500, Easing.OutQuint); + recieveInput = true; + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + hover.FadeOut(500, Easing.OutQuint); + recieveInput = false; + base.OnHoverLost(state); + } + + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + { + content.ScaleTo(0.75f, 2000, Easing.OutQuint); + if (Enabled.Value) + { + hover.FlashColour(Color4.White.Opacity(0.25f), 800, Easing.OutQuint); + Action?.Invoke(); + } + + return true; + } + + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + { + content.ScaleTo(1, 1000, Easing.OutElastic); + return base.OnMouseUp(state, args); + } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (recieveInput && args.Key == Key.X || args.Key == Key.Z && recieveInput || args.Key == Bind && Bind != Key.Unknown) + Action?.Invoke(); + + return base.OnKeyDown(state, args); + } + + public Action Action; + public readonly BindableBool Enabled = new BindableBool(true); + } +} diff --git a/osu.Game/Screens/Symcol/Pieces/SymcolVisualiser.cs b/osu.Game/Screens/Symcol/Pieces/SymcolVisualiser.cs new file mode 100644 index 0000000000..7ea03b209f --- /dev/null +++ b/osu.Game/Screens/Symcol/Pieces/SymcolVisualiser.cs @@ -0,0 +1,163 @@ +using System; +using osu.Framework.Graphics.Shaders; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using OpenTK.Graphics; +using osu.Framework.Configuration; +using osu.Framework.Allocation; +using osu.Game.Beatmaps; +using osu.Framework.Graphics.Textures; +using OpenTK; +using OpenTK.Graphics.ES30; +using osu.Framework.Graphics.Batches; +using osu.Framework.Graphics.OpenGL.Vertices; +using osu.Framework.Graphics.Primitives; + +namespace osu.Game.Screens.Symcol.Pieces +{ + internal class SymcolVisualiser : Drawable + { + private readonly Bindable beatmap = new Bindable(); + private float[] audioData = new float[256]; + + private const float minimumAmplitude = 1f / bar_length; + + //Needs to be a multiple of 3 + private const int bars = 255; + + private const float bar_length = 300; + + private Color4 barColor; + + public override bool HandleInput => false; + + private Shader shader; + private readonly Texture texture; + + public SymcolVisualiser() + { + Alpha = 1; + Anchor = Anchor.TopLeft; + Origin = Anchor.TopLeft; + RelativeSizeAxes = Axes.Y; + texture = Texture.WhitePixel; + barColor = new Color4(1, 1, 1, 0.2f); + Blending = BlendingMode.Additive; + } + + [BackgroundDependencyLoader] + private void load(OsuGame game, ShaderManager shaders) + { + if (game?.Beatmap != null) + beatmap.BindTo(game.Beatmap); + shader = shaders?.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED); + } + + protected override void Update() + { + base.Update(); + float[] tempData = beatmap?.Value?.Track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256]; + for (int i = 0; i < 256; i++) + if (beatmap?.Value?.Track?.IsRunning ?? false) + { + float targetAmplitude = tempData[i] + Math.Min(tempData[i] * (tempData[i] / (1f / 3)), 0.3f); + if (audioData[i] < targetAmplitude) + audioData[i] = targetAmplitude; + } + float decayFactor = (float)Time.Elapsed * 0.0024f; + for (int i = 0; i < bars; i++) + { + //4% of extra bar length to make it a little faster when bar is almost at it's minimum + audioData[i] -= decayFactor * (audioData[i] + 0.04f); + if (audioData[i] < 0) + audioData[i] = 0; + } + + Invalidate(Invalidation.DrawNode, shallPropagate: true); + } + + protected override DrawNode CreateDrawNode() => new SymcolVisDrawNode(); + + private readonly SymcolVisSharedData sharedData = new SymcolVisSharedData(); + + private class SymcolVisSharedData + { + public readonly LinearBatch VertexBatch = new LinearBatch(100 * 4, 10, PrimitiveType.Quads); + } + + protected override void ApplyDrawNode(DrawNode node) + { + base.ApplyDrawNode(node); + + var visNode = (SymcolVisDrawNode)node; + + visNode.Shader = shader; + visNode.Texture = texture; + visNode.Size = DrawSize.Y; + visNode.Shared = sharedData; + visNode.Colour = barColor; + visNode.AudioData = audioData; + } + + private class SymcolVisDrawNode : DrawNode + { + public Shader Shader; + public Texture Texture; + public SymcolVisSharedData Shared; + //Vertical size m8. + public float Size; + + public Color4 Colour; + public float[] AudioData; + + + public override void Draw(Action vertexAction) + { + base.Draw(vertexAction); + + Shader.Bind(); + Texture.TextureGL.Bind(); + + Vector2 inflation = DrawInfo.MatrixInverse.ExtractScale().Xy; + + ColourInfo colourInfo = DrawInfo.Colour; + colourInfo.ApplyChild(Colour); + + if (AudioData != null) + { + for (int j = 0; j < 3; j++) + { + for (int i = 0; i < bars / 3; i++) + { + float targetAmplitude = AudioData[i + j * (bars / 3)]; + if (targetAmplitude < minimumAmplitude) + continue; + + var barSize = new Vector2(bar_length * targetAmplitude, (Size - (1f * bars / 3)) / (bars / 3)); + var barPosition = new Vector2(0, barSize.Y * i + 1f * i); + //The distance between the position and the sides of the bar. + var bottomOffset = new Vector2(0, barSize.Y); + //The distance between the bottom side of the bar and the top side. + var amplitudeOffset = new Vector2(barSize.X, 0); + + var rectangle = new Quad( + (barPosition) * DrawInfo.Matrix, + (barPosition + amplitudeOffset) * DrawInfo.Matrix, + (barPosition + bottomOffset) * DrawInfo.Matrix, + (barPosition + bottomOffset + amplitudeOffset) * DrawInfo.Matrix + ); + + Texture.DrawQuad( + rectangle, + colourInfo, + null, + Shared.VertexBatch.Add, + Vector2.Divide(inflation, barSize)); + } + } + } + Shader.Unbind(); + } + } + } +} diff --git a/osu.Game/Screens/Symcol/Pieces/TutorialCharacter.cs b/osu.Game/Screens/Symcol/Pieces/TutorialCharacter.cs new file mode 100644 index 0000000000..9caaf7cbe0 --- /dev/null +++ b/osu.Game/Screens/Symcol/Pieces/TutorialCharacter.cs @@ -0,0 +1,168 @@ +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Screens.Symcol.Pieces +{ + public abstract class Mascot : Container + { + protected Sprite Idle; + protected Container SpeechBubble; + protected Box SpeechBubbleBackground; + protected OsuTextFlowContainer Speech; + + public bool LeftSide = true; + private bool speaking = false; + + private double speakingDuration = 0; + + public double ReadyToSpeakTime = double.MaxValue; + public double CloseTime = double.MaxValue; + public double LeaveTime = double.MaxValue; + + public Mascot() + { + AutoSizeAxes = Axes.Both; + Anchor = Anchor.BottomLeft; + Origin = Anchor.BottomLeft; + AlwaysPresent = true; + + Children = new Drawable[] + { + Idle = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AlwaysPresent = true, + FillMode = FillMode.Fill + }, + SpeechBubble = new Container + { + Masking = true, + Position = new Vector2(0), + Anchor = Anchor.TopRight, + Origin = Anchor.TopLeft, + Size = new Vector2(400, 200), + Scale = new Vector2(1, 0), + BorderColour = Color4.White, + BorderThickness = 10, + CornerRadius = 8, + + Children = new Drawable[] + { + SpeechBubbleBackground = new Box + { + RelativeSizeAxes = Axes.Both + }, + Speech = new OsuTextFlowContainer + { + RelativeSizeAxes = Axes.X, + Scale = new Vector2(0.95f, 1), + Margin = new MarginPadding { Top = 12, Right = 12 }, + Position = new Vector2(12, 6) + } + } + } + }; + } + + public void Speak(string text, double duration = -1) + { + if (duration == -1) + { + string[] args = text.Split(' '); + foreach (string arg in args) + duration += 250; + } + + Speech.Text = text; + speakingDuration = duration; + + if (!speaking) + enter(); + else + CloseTime = Time.Current + speakingDuration + 200; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + Position = new Vector2(-Idle.Width, 0); + } + + private void enter(double duration = 1000) + { + ReadyToSpeakTime = Time.Current + duration; + this.MoveTo(Vector2.Zero, duration) + .FadeInFromZero(duration); + } + + private void exit(double duration = 1000) + { + if (LeftSide) + this.MoveTo(new Vector2(-Idle.Width, 0), duration) + .FadeOutFromOne(duration); + else + this.MoveTo(new Vector2(Idle.Width, 0), duration) + .FadeOutFromOne(duration); + } + + protected override void Update() + { + base.Update(); + + if (Time.Current >= ReadyToSpeakTime && !speaking) + { + speaking = true; + ReadyToSpeakTime = double.MaxValue; + SpeechBubble.ScaleTo(Vector2.One, 200) + .FadeInFromZero(200); + CloseTime = Time.Current + speakingDuration + 200; + } + + if (Time.Current >= CloseTime && speaking) + { + speaking = false; + CloseTime = double.MaxValue; + LeaveTime = Time.Current + 200; + SpeechBubble.ScaleTo(new Vector2(1, 0), 200) + .FadeOutFromOne(200); + } + + if (Time.Current >= LeaveTime) + { + LeaveTime = double.MaxValue; + exit(); + } + } + + public void ToggleDirection() + { + if (LeftSide) + { + LeftSide = false; + SpeechBubble.Anchor = Anchor.TopLeft; + SpeechBubble.Origin = Anchor.TopRight; + Anchor = Anchor.BottomRight; + Origin = Anchor.BottomRight; + Idle.Scale = new Vector2(-1, 1); + Position = new Vector2(Idle.Width, 0); + } + else + { + LeftSide = true; + SpeechBubble.Anchor = Anchor.TopRight; + SpeechBubble.Origin = Anchor.TopLeft; + Anchor = Anchor.BottomLeft; + Origin = Anchor.BottomLeft; + Idle.Scale = Vector2.One; + Position = new Vector2(-Idle.Width, 0); + } + } + } +} diff --git a/osu.Game/Screens/Symcol/Screens/Shawdooow/ShawdooowLazerLiveWallpaper.cs b/osu.Game/Screens/Symcol/Screens/Shawdooow/ShawdooowLazerLiveWallpaper.cs new file mode 100644 index 0000000000..7567aa3a62 --- /dev/null +++ b/osu.Game/Screens/Symcol/Screens/Shawdooow/ShawdooowLazerLiveWallpaper.cs @@ -0,0 +1,100 @@ +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Screens.Symcol.Pieces; +using osu.Framework.Audio; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Graphics.Sprites; + +namespace osu.Game.Screens.Symcol.Screens.Shawdooow +{ + class ShawdooowLazerLiveWallpaper : OsuScreen + { + private SymcolBackground background; + private CircularContainer visualizer; + + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + Children = new Drawable[] + { + background = new SymcolBackground + { + Depth = 0, + Colour = Color4.Yellow, + RelativeSizeAxes = Axes.Both, + Origin = Anchor.BottomCentre, + Anchor = Anchor.BottomCentre, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + } + } + }, + new Box + { + Depth = -1, + Position = new Vector2(0 , -140), + Colour = Color4.Black, + Height = 20, + RelativeSizeAxes = Axes.X, + Origin = Anchor.Centre, + Anchor = Anchor.BottomCentre, + }, + visualizer = new CircularContainer + { + Masking = true, + Depth = -2, + Position = new Vector2(200 , -140), + Colour = Color4.Black, + Size = new Vector2(60), + Origin = Anchor.Centre, + Anchor = Anchor.BottomLeft, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + } + } + }, + new SpriteText + { + Colour = Color4.Black, + Position = new Vector2(10), + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + Text = "CAUTION:", + TextSize = 100, + }, + new SpriteText + { + Colour = Color4.Black, + Position = new Vector2(10 , 120), + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + Text = "CLASS 05Z2 LAZER RADIATION", + TextSize = 80, + }, + new SpriteText + { + Colour = Color4.Black, + Position = new Vector2(10 , 210), + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + Text = "July 31, 2017", + TextSize = 60, + }, + }; + } + + protected override void Update() + { + base.Update(); + } + } +} diff --git a/osu.Game/Screens/Symcol/Screens/SymcolMapMixer.cs b/osu.Game/Screens/Symcol/Screens/SymcolMapMixer.cs new file mode 100644 index 0000000000..575ff89f21 --- /dev/null +++ b/osu.Game/Screens/Symcol/Screens/SymcolMapMixer.cs @@ -0,0 +1,478 @@ +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using OpenTK; +using OpenTK.Graphics; +using osu.Game.Screens.Symcol.Pieces; +using osu.Framework.Audio.Sample; +using osu.Framework.Audio; +using osu.Game.Overlays.Settings; +using osu.Framework.Configuration; +using osu.Framework.Timing; +using osu.Framework.Audio.Track; +using osu.Game.Database; +using osu.Framework.Graphics.Containers; +using osu.Game.Beatmaps; +using osu.Framework.Screens; +using osu.Game.Screens.Menu; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.Containers; +using osu.Framework.Extensions.Color4Extensions; +using osu.Game.Beatmaps.ControlPoints; +using System; +using osu.Game.Screens.Play; +using osu.Game.Screens.Backgrounds; +using osu.Game.Configuration; +using OpenTK.Input; + +namespace osu.Game.Screens.Symcol.Screens +{ + public class SymcolMapMixer : OsuScreen + { + private SettingsSlider clockPitch; + private SettingsSlider clockSpeed; + private double pitch = 1; + private double speed = 1; + public static BindableDouble ClockPitch; + public static BindableDouble ClockSpeed; + private Bindable dimLevel; + private static Bindable syncPitch = new Bindable { Default = true, Value = true }; + protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); + private bool suspended = false; + private readonly Bindable workingBeatmap = new Bindable(); + + private OsuScreen player; + + [BackgroundDependencyLoader] + private void load(AudioManager audio, OsuConfigManager config, OsuGameBase game) + { + workingBeatmap.BindTo(game.Beatmap); + + dimLevel = config.GetBindable(OsuSetting.DimLevel); + + ClockPitch = new BindableDouble() { MinValue = 0f, Default = 1, Value = pitch, MaxValue = 2 }; + ClockSpeed = new BindableDouble() { MinValue = 0f, Default = 1, Value = speed, MaxValue = 2 }; + + Children = new Drawable[] + { + new Container + { + Position = new Vector2(0 , -25), + Height = 50, + RelativeSizeAxes = Axes.X, + Origin = Anchor.BottomCentre, + Anchor = Anchor.BottomCentre, + Children = new Drawable[] + { + clockPitch = new SettingsSlider + { + Origin = Anchor.BottomCentre, + Anchor = Anchor.Centre, + LabelText = "Pitch", + Bindable = ClockPitch, + }, + clockSpeed = new SettingsSlider + { + Origin = Anchor.TopCentre, + Anchor = Anchor.Centre, + LabelText = "Clock Speed", + Bindable = ClockSpeed, + }, + new SettingsCheckbox + { + Origin = Anchor.BottomLeft, + Anchor = Anchor.TopLeft, + Bindable = syncPitch + } + } + }, + new SymcolButton + { + ButtonName = "Play", + Depth = -2, + Origin = Anchor.BottomRight, + Anchor = Anchor.BottomRight, + ButtonColorTop = Color4.DarkBlue, + ButtonColorBottom = Color4.Blue, + ButtonSize = 40, + Action = play, + Position = new Vector2(-60 , -100), + }, + new SymcolButton + { + ButtonName = "BG", + Depth = -2, + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, + ButtonColorTop = Color4.DarkBlue, + ButtonColorBottom = Color4.Blue, + ButtonSize = 40, + Action = evastBackground, + Position = new Vector2(60 , 100), + }, + + //Sounds Bar + new MusicBar + { + RelativeSizeAxes = Axes.X, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Position = new Vector2(0 , 180), + }, + new HitSoundBoard + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + }, + + //Pitch Settings + new SymcolButton + { + ButtonName = "1x", + Depth = -2, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.DarkGoldenrod, + ButtonColorBottom = Color4.Goldenrod, + ButtonSize = 50, + Action = () => changeClockSpeeds(1f), + Position = new Vector2(0 , 250), + Bind = Key.V + }, + new SymcolButton + { + ButtonName = "1.5x", + Depth = -2, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.DarkGoldenrod, + ButtonColorBottom = Color4.Goldenrod, + ButtonSize = 50, + Action = () => changeClockSpeeds(1.5f), + Position = new Vector2(200 , 250), + Bind = Key.B + }, + new SymcolButton + { + ButtonName = "0.75x", + Depth = -2, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.DarkGoldenrod, + ButtonColorBottom = Color4.Goldenrod, + ButtonSize = 50, + Action = () => changeClockSpeeds(0.75f), + Position = new Vector2(-200, 250), + Bind = Key.C + }, + }; + } + + private void play() + { + if (player != null) return; + + LoadComponentAsync(player = new PlayerLoader(new Player()), l => Push(player)); + } + + private void evastBackground() + { + + } + + protected override void Update() + { + base.Update(); + + if (syncPitch.Value) + { + ClockSpeed.Value = ClockPitch.Value; + clockSpeed.Bindable.Value = clockPitch.Bindable.Value; + } + + applyRateAdjustments(); + + if(!suspended) + changeBackground(Beatmap, 1, 0); + } + + private void changeBackground(WorkingBeatmap beatmap, float alpha, double duration) + { + var backgroundModeBeatmap = Background as BackgroundScreenBeatmap; + if (backgroundModeBeatmap != null) + { + backgroundModeBeatmap.Beatmap = beatmap; + backgroundModeBeatmap.BlurTo(new Vector2(10), duration); + backgroundModeBeatmap.FadeTo(alpha, duration); + } + } + + protected override void OnEntering(Screen last) + { + base.OnEntering(last); + changeBackground(Beatmap, 1 , 0); + setClockSpeed(workingBeatmap.Value.Track); + } + + protected override void OnResuming(Screen last) + { + base.OnResuming(last); + suspended = false; + changeBackground(Beatmap, 1, 1500); + } + + protected override void OnSuspending(Screen next) + { + base.OnSuspending(next); + suspended = true; + changeBackground(Beatmap, 0, 1500); + } + + private void changeClockSpeeds(float value) + { + ClockPitch.Value = value; + ClockSpeed.Value = value; + } + + private void setClockSpeed(IAdjustableClock clock) + { + var pitchAdjust = clock as IHasPitchAdjust; + clockPitch.Bindable.Value = pitchAdjust.PitchAdjust; + clockSpeed.Bindable.Value = clock.Rate; + } + + private void applyRateAdjustments() + { + if (workingBeatmap.Value.Track == null) return; + else + ApplyToClock(workingBeatmap.Value.Track); + } + + private void ApplyToClock(IAdjustableClock clock) + { + var pitchAdjust = clock as IHasPitchAdjust; + if (pitchAdjust != null) + { + if (clockPitch.Bindable.Value > 1) + { + pitchAdjust.PitchAdjust = clockPitch.Bindable.Value; + pitch = pitchAdjust.PitchAdjust; + + if (clockSpeed.Bindable.Value > 1) + clock.Rate = (clockSpeed.Bindable.Value - ((clockPitch.Bindable.Value - 1) / 2)) - ((clockSpeed.Bindable.Value - 1) / 2); + else + clock.Rate = (clockSpeed.Bindable.Value - ((clockPitch.Bindable.Value - 1) / 2)) + ((clockSpeed.Bindable.Value - 1) * 0.5f); + + speed = clock.Rate; + } + else if (clockPitch.Bindable.Value < 1) + { + pitchAdjust.PitchAdjust = clockPitch.Bindable.Value; + pitch = pitchAdjust.PitchAdjust; + + if (clockSpeed.Bindable.Value < 1) + clock.Rate = (clockSpeed.Bindable.Value + ((clockPitch.Bindable.Value - 1) * -2)) + ((clockSpeed.Bindable.Value - 1) * 0.5f); + else + clock.Rate = (clockSpeed.Bindable.Value + ((clockPitch.Bindable.Value - 1) * -2)) - ((clockSpeed.Bindable.Value - 1) / 2); + + speed = clock.Rate; + } + else + { + pitchAdjust.PitchAdjust = clockPitch.Bindable.Value; + pitch = pitchAdjust.PitchAdjust; + + if (clockSpeed.Bindable.Value < 1) + clock.Rate = clockSpeed.Bindable.Value + ((clockSpeed.Bindable.Value - 1) * -0.5f); + else + clock.Rate = clockSpeed.Bindable.Value - ((clockSpeed.Bindable.Value - 1) / 2); + + speed = clock.Rate; + } + } + + else + clock.Rate = clockSpeed.Bindable.Value; + } + } + + internal class MusicBar : BeatSyncedContainer + { + private Box seekBar; + private float beatLength = 1; + private float lastBeatTime = 1; + private int measure = 0; + private float measureLength = 1; + private float lastMeasureTime = 1; + private readonly Bindable workingBeatmap = new Bindable(); + + [BackgroundDependencyLoader] + private void load(OsuGameBase game) + { + workingBeatmap.BindTo(game.Beatmap); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + Children = new Drawable[] + { + new Box + { + Colour = Color4.White, + Size = new Vector2(600 , 4), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + new Box + { + Position = new Vector2(300 , 0), + Colour = Color4.White, + Size = new Vector2(4 , 30), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + new Box + { + Position = new Vector2(-300 , 0), + Colour = Color4.White, + Size = new Vector2(4 , 30), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + new Box + { + Position = new Vector2(-300 / 2 , 0), + Colour = Color4.White, + Size = new Vector2(3.5f , 22), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + new Box + { + Position = new Vector2(-0 , 0), + Colour = Color4.White, + Size = new Vector2(4 , 26), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + new Box + { + Position = new Vector2(300 / 2 , 0), + Colour = Color4.White, + Size = new Vector2(3.5f , 22), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + seekBar = new Box + { + Position = new Vector2(-300 , 0), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(2 , 20), + }, + }; + } + + protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) + { + base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); + beatLength = (float)timingPoint.BeatLength; + measureLength = (float)timingPoint.BeatLength * 4; + if (lastMeasureTime <= (float)(workingBeatmap.Value.Track.CurrentTime - measureLength * 0.9f) || lastMeasureTime > (float)workingBeatmap.Value.Track.CurrentTime) + lastMeasureTime = (float)workingBeatmap.Value.Track.CurrentTime; + lastBeatTime = (float)workingBeatmap.Value.Track.CurrentTime; + if(SymcolMapMixer.ClockPitch.Value > 0) + measure++; + if (SymcolMapMixer.ClockPitch.Value < 0) + measure--; + if (measure > 4) + measure = 1; + if (measure < 1) + measure = 4; + } + + protected override void Update() + { + base.Update(); + + if (workingBeatmap.Value.Track.IsRunning) + seekBarPosition(); + } + + private Vector2 seekBarPosition() + { + measure = (int)((((float)workingBeatmap.Value.Track.CurrentTime - lastMeasureTime) / measureLength) * 4); + float minX = (measure) * 150; + + Vector2 position = new Vector2((((((float)workingBeatmap.Value.Track.CurrentTime - lastBeatTime) / beatLength) * 150) + 300), 0); + + position.X %= 150; + position.X += minX - 300; + + seekBar.Position = position; + return seekBar.Position; + } + + private void halfBeat() + { + + } + + private void quarterBeat() + { + + } + + private void generateMeasure(float x) + { + + } + } + + + + internal class MusicBarTick : Container + { + private Box box; + private Container glow; + + protected override void LoadComplete() + { + base.LoadComplete(); + Children = new Drawable[] + { + box = new Box + { + Depth = -2, + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + glow = new Container + { + Alpha = 0.25f, + Depth = 0, + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + EdgeEffect = new EdgeEffectParameters + { + Radius = 4, + }, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both + } + } + }, + }; + } + public void Activate(float beatLength , float flashIntensity) + { + glow.Alpha = 0.5f * flashIntensity; + glow.FadeTo(0.25f, beatLength); + } + } +} diff --git a/osu.Game/Screens/Symcol/Screens/SymcolOffsetTicker.cs b/osu.Game/Screens/Symcol/Screens/SymcolOffsetTicker.cs new file mode 100644 index 0000000000..971f240a60 --- /dev/null +++ b/osu.Game/Screens/Symcol/Screens/SymcolOffsetTicker.cs @@ -0,0 +1,237 @@ +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using OpenTK; +using OpenTK.Graphics; +using osu.Game.Screens.Symcol.Pieces; +using osu.Framework.Audio.Sample; +using osu.Framework.Audio; +using osu.Game.Overlays.Settings; +using osu.Framework.Configuration; +using osu.Framework.Timing; +using osu.Framework.Audio.Track; +using osu.Game.Database; +using osu.Framework.Graphics.Containers; +using osu.Game.Beatmaps; +using osu.Framework.Screens; +using osu.Game.Screens.Menu; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.Containers; +using osu.Framework.Extensions.Color4Extensions; +using osu.Game.Beatmaps.ControlPoints; +using System; +using osu.Game.Configuration; + +namespace osu.Game.Screens.Symcol.Screens +{ + public class SymcolOffsetTicker : OsuScreen + { + private SampleChannel tick; + private double savedTime = 0; + private double savedTime2 = 0; + private tickBar bar; + private SettingsSlider offset; + + protected override void OnResuming(Screen last) + { + Beatmap.Value.Track?.Stop(); + base.OnResuming(last); + } + protected override void OnEntering(Screen last) + { + base.OnEntering(last); + Background.FadeColour(Color4.DarkGray, 500); + Beatmap.Value.Track?.Stop(); + } + protected override bool OnExiting(Screen next) + { + Background.FadeColour(Color4.White, 500); + Beatmap.Value.Track?.Start(); + return base.OnExiting(next); + } + + [BackgroundDependencyLoader] + private void load(AudioManager audio, OsuConfigManager config) + { + savedTime = Time.Current; + savedTime2 = savedTime; + tick = audio.Sample.Get($@"Gameplay/tick"); + Children = new Drawable[] + { + bar = new tickBar + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + new Container + { + Position = new Vector2(0 , -25), + Height = 50, + RelativeSizeAxes = Axes.X, + Origin = Anchor.BottomCentre, + Anchor = Anchor.BottomCentre, + Children = new Drawable[] + { + offset = new SettingsSlider + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + LabelText = "Offset", + Bindable = config.GetBindable(OsuSetting.AudioOffset), + }, + } + }, + }; + } + + protected override void Update() + { + base.Update(); + if (Time.Current >= savedTime2 + 500 + offset.Bindable.Value && offset.Bindable.Value < 0) + { + savedTime2 = savedTime + 500; + try + { + //tick.Play(); + } + catch + { + + } + bar.SeekBarPop.Position = bar.SeekBar.Position; + bar.SeekBarPop.FadeOutFromOne(500); + bar.SeekBarPop.Scale = new Vector2(1, 5); + bar.SeekBarPop.ScaleTo(new Vector2(1), 500); + } + if (Time.Current >= savedTime2 + 500 + offset.Bindable.Value && offset.Bindable.Value >= 0) + { + savedTime2 = savedTime; + try + { + //tick.Play(); + } + catch + { + + } + bar.SeekBarPop.Position = bar.SeekBar.Position; + bar.SeekBarPop.FadeOutFromOne(500); + bar.SeekBarPop.Scale = new Vector2(1, 5); + bar.SeekBarPop.ScaleTo(new Vector2(1) , 500); + } + if (Time.Current >= savedTime + 500) + { + savedTime = savedTime + 500; + bar.SavedTime = savedTime; + } + } + } + + internal class tickBar : BeatSyncedContainer + { + public Box SeekBar; + public Box SeekBarPop; + private int measure = 0; + public double SavedTime; + + private SampleChannel tick; + [BackgroundDependencyLoader] + private void load(AudioManager audio, OsuConfigManager config) + { + tick = audio.Sample.Get($@"Gameplay/tick"); + } + protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) + { + base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); + tick.Play(); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + Children = new Drawable[] + { + new Box + { + Colour = Color4.White, + Size = new Vector2(600 , 4), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + new Box + { + Position = new Vector2(300 , 0), + Colour = Color4.White, + Size = new Vector2(4 , 30), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + new Box + { + Position = new Vector2(-300 , 0), + Colour = Color4.White, + Size = new Vector2(4 , 30), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + new Box + { + Position = new Vector2(-300 / 2 , 0), + Colour = Color4.White, + Size = new Vector2(3.5f , 22), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + new Box + { + Position = new Vector2(-0 , 0), + Colour = Color4.White, + Size = new Vector2(4 , 26), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + new Box + { + Position = new Vector2(300 / 2 , 0), + Colour = Color4.White, + Size = new Vector2(3.5f , 22), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + SeekBar = new Box + { + Position = new Vector2(-300 , 0), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(2 , 20), + }, + SeekBarPop = new Box + { + Position = new Vector2(0 , 0), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(1 , 30), + AlwaysPresent = true, + }, + }; + } + + protected override void Update() + { + base.Update(); + seekBarPosition(); + } + + private Vector2 seekBarPosition() + { + float minX = (measure) * 150; + + Vector2 position = new Vector2((((((float)Time.Current - (float)SavedTime) / 500) * 150) + 300), 0); + + position.X %= 150; + position.X += minX - 300; + + SeekBar.Position = position; + return SeekBar.Position; + } + } +} diff --git a/osu.Game/Screens/Symcol/Screens/SymcolTestScreen.cs b/osu.Game/Screens/Symcol/Screens/SymcolTestScreen.cs new file mode 100644 index 0000000000..aea23e7dc4 --- /dev/null +++ b/osu.Game/Screens/Symcol/Screens/SymcolTestScreen.cs @@ -0,0 +1,15 @@ +using osu.Framework.Graphics; + +namespace osu.Game.Screens.Symcol.Screens +{ + public class SymcolTestScreen : OsuScreen + { + public SymcolTestScreen() + { + Children = new Drawable[] + { + + }; + } + } +} diff --git a/osu.Game/Screens/Symcol/SymcolMenu.cs b/osu.Game/Screens/Symcol/SymcolMenu.cs new file mode 100644 index 0000000000..5665e8f236 --- /dev/null +++ b/osu.Game/Screens/Symcol/SymcolMenu.cs @@ -0,0 +1,259 @@ +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Screens; +using osu.Game.Beatmaps; +using osu.Game.Screens.Backgrounds; +using osu.Game.Screens.Menu; +using osu.Game.Screens.Symcol.Pieces; +using osu.Game.Screens.Symcol.Screens; +using osu.Framework.Configuration; +using osu.Game.Screens.Symcol.Screens.Shawdooow; +using osu.Framework.Allocation; +using osu.Framework.IO.Stores; +using osu.Framework.Graphics.Textures; + +namespace osu.Game.Screens.Symcol +{ + public class SymcolMenu : OsuScreen + { + private const int animation_duration = 600; + private readonly Vector2 background_blur = new Vector2(10); + + public static OsuScreen RulesetMultiplayerScreen; + + public static ResourceStore SymcolResources; + public static TextureStore SymcolTextures; + + public static Bindable AllowConverts = new Bindable { Value = true }; + + private readonly Bindable workingBeatmap = new Bindable(); + + protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); + + private readonly OsuLogo logo; + private readonly Container buttonsContainer; + + public static void LoadSymcolAssets() + { + SymcolResources = new ResourceStore(); + SymcolResources.AddStore(new NamespacedResourceStore(new DllResourceStore("osu.Game.Symcol.Resources.dll"), ("Assets"))); + SymcolResources.AddStore(new DllResourceStore("osu.Game.Symcol.Resources.dll")); + SymcolTextures = new TextureStore(new RawTextureLoaderStore(new NamespacedResourceStore(SymcolResources, @"Textures"))); + SymcolTextures.AddStore(new RawTextureLoaderStore(new OnlineStore())); + } + + public SymcolMenu() + { + Children = new Drawable[] + { + new MenuSideFlashes(), + buttonsContainer = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Children = new[] + { + /* + new SymcolButton + { + ButtonName = "osu!Talk", + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = new Color4(33 , 58 , 79 , 255), + ButtonColorBottom = new Color4(17 , 31 , 42 , 255), + ButtonSize = 60, + Action = delegate { Push(new OsuTalkMenu()); }, + ButtonPosition = new Vector2(250 , 175), + }, + */ + new SymcolButton + { + ButtonName = "Lazer", + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.Black, + ButtonColorBottom = Color4.Yellow, + ButtonSize = 90, + Action = delegate { Push(new ShawdooowLazerLiveWallpaper()); }, + ButtonPosition = new Vector2(170 , 190), + }, + /* + new SymcolButton + { + ButtonName = "Offset", + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.Black, + ButtonColorBottom = Color4.White, + ButtonSize = 90, + Action = delegate { Push(new SymcolOffsetTicker()); }, + ButtonPosition = new Vector2(-10 , -190), + }, + new SymcolButton + { + ButtonName = "Pokeosu", + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.DarkOrange, + ButtonColorBottom = Color4.Orange, + ButtonSize = 75, + Action = delegate { Push(new PokeosuMenu()); }, + ButtonPosition = new Vector2(200 , 100), + }, + */ + new SymcolButton + { + ButtonName = "Map Mixer", + ButtonFontSizeMultiplier = 0.8f, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.Purple, + ButtonColorBottom = Color4.HotPink, + ButtonSize = 120, + Action = delegate { Push(new SymcolMapMixer()); }, + ButtonPosition = new Vector2(-200 , -150), + }, + /* + new SymcolButton + { + ButtonName = "Play", + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.DarkGreen, + ButtonColorBottom = Color4.Green, + ButtonSize = 130, + Action = delegate { Push(new PlaySongSelect()); }, + ButtonPosition = new Vector2(300 , -20), + }, + */ + new SymcolButton + { + ButtonName = "Multi", + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.Blue, + ButtonColorBottom = Color4.Red, + ButtonSize = 120, + Action = delegate { Push(RulesetMultiplayerScreen); }, + ButtonPosition = new Vector2(180 , -100), + }, + /* + new SymcolButton + { + ButtonName = "Edit", + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.DarkGoldenrod, + ButtonColorBottom = Color4.Gold, + ButtonSize = 90, + Action = delegate { Push(new Editor()); }, + ButtonPosition = new Vector2(250 , -150), + },*/ + new SymcolButton + { + ButtonName = "Tests", + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.DarkCyan, + ButtonColorBottom = Color4.Cyan, + ButtonSize = 100, + Action = delegate { Push(new SymcolTestScreen()); }, + ButtonPosition = new Vector2(-150 , 200), + }, + new SymcolButton + { + ButtonName = "Back", + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + ButtonColorTop = Color4.DarkRed, + ButtonColorBottom = Color4.Red, + ButtonSize = 80, + Action = Exit, + ButtonPosition = new Vector2(-350 , 300), + }, + }, + }, + logo = new OsuLogo + { + Scale = new Vector2(1.25f), + Action = () => open(logo), + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuGameBase game) + { + workingBeatmap.BindTo(game.Beatmap); + workingBeatmap.ValueChanged += changeBackground; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + workingBeatmap.TriggerChange(); + } + + private bool open(Container container) + { + logo.Action = () => close(container); + container.ScaleTo(new Vector2(0.5f), animation_duration, Easing.InOutBack); + + foreach(var button in buttonsContainer) + button.MoveTo(button.ButtonPosition, animation_duration, Easing.InOutBack); + return true; + } + + private bool close(Container container) + { + logo.Action = () => open(container); + container.ScaleTo(new Vector2(1.25f), animation_duration, Easing.InOutBack); + + foreach (var button in buttonsContainer) + button.MoveTo(Vector2.Zero, animation_duration, Easing.InOutBack); + return true; + } + + private void changeBackground(WorkingBeatmap beatmap) + { + var backgroundModeBeatmap = Background as BackgroundScreenBeatmap; + if (backgroundModeBeatmap != null) + { + backgroundModeBeatmap.Beatmap = beatmap; + backgroundModeBeatmap.BlurTo(background_blur, 1500); + backgroundModeBeatmap.FadeTo(1, 250); + } + } + + protected override void OnEntering(Screen last) + { + base.OnEntering(last); + Content.FadeInFromZero(250); + } + + protected override void OnResuming(Screen last) + { + base.OnResuming(last); + Content.FadeIn(250); + Content.ScaleTo(1, 250, Easing.OutSine); + } + + protected override void OnSuspending(Screen next) + { + base.OnSuspending(next); + Content.ScaleTo(1.1f, 250, Easing.InSine); + Content.FadeOut(250); + } + + protected override bool OnExiting(Screen next) + { + Content.FadeOut(100); + return base.OnExiting(next); + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 091ec3f7ac..d4c3d27955 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -649,8 +649,28 @@ + + + + + + + + + + + + + + + + + + + +