diff --git a/osu-resources b/osu-resources
index 651e598b01..694cb03f19 160000
--- a/osu-resources
+++ b/osu-resources
@@ -1 +1 @@
-Subproject commit 651e598b016b43e31ab1c1b29d5b30c92361b8d9
+Subproject commit 694cb03f19c93106ed0f2593f3e506e835fb652a
diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs
index 79ac24a1da..93fd3935c6 100644
--- a/osu.Desktop/OsuGameDesktop.cs
+++ b/osu.Desktop/OsuGameDesktop.cs
@@ -10,7 +10,7 @@ using osu.Desktop.Overlays;
using osu.Framework.Graphics.Containers;
using osu.Framework.Platform;
using osu.Game;
-using OpenTK.Input;
+using osuTK.Input;
using Microsoft.Win32;
using osu.Desktop.Updater;
using osu.Framework;
diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs
index 96857d6b4f..f31bba1e1e 100644
--- a/osu.Desktop/Overlays/VersionManager.cs
+++ b/osu.Desktop/Overlays/VersionManager.cs
@@ -15,8 +15,8 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
using osu.Game.Utils;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Desktop.Overlays
{
diff --git a/osu.Desktop/Updater/SquirrelUpdateManager.cs b/osu.Desktop/Updater/SquirrelUpdateManager.cs
index 1f8bff74f4..19383d617f 100644
--- a/osu.Desktop/Updater/SquirrelUpdateManager.cs
+++ b/osu.Desktop/Updater/SquirrelUpdateManager.cs
@@ -2,6 +2,8 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
+using System.IO;
+using System.Reflection;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
@@ -12,9 +14,10 @@ using osu.Game;
using osu.Game.Graphics;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using Squirrel;
+using LogLevel = Splat.LogLevel;
namespace osu.Desktop.Updater
{
@@ -35,7 +38,10 @@ namespace osu.Desktop.Updater
notificationOverlay = notification;
if (game.IsDeployedBuild)
+ {
+ Splat.Locator.CurrentMutable.Register(() => new SquirrelLogger(), typeof(Splat.ILogger));
Schedule(() => Task.Run(() => checkForUpdateAsync()));
+ }
}
private async void checkForUpdateAsync(bool useDeltaPatching = true, UpdateProgressNotification notification = null)
@@ -159,5 +165,31 @@ namespace osu.Desktop.Updater
});
}
}
+
+ private class SquirrelLogger : Splat.ILogger, IDisposable
+ {
+ private readonly string path;
+ private readonly object locker = new object();
+ public LogLevel Level { get; set; } = LogLevel.Info;
+
+ public SquirrelLogger()
+ {
+ var file = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "SquirrelSetupUpdater.log");
+ if (File.Exists(file)) File.Delete(file);
+ path = file;
+ }
+
+ public void Write(string message, LogLevel logLevel)
+ {
+ if (logLevel < Level)
+ return;
+
+ lock (locker) File.AppendAllText(path, message + "\r\n");
+ }
+
+ public void Dispose()
+ {
+ }
+ }
}
}
diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj
index e1e59804e5..09bfdc67d4 100644
--- a/osu.Desktop/osu.Desktop.csproj
+++ b/osu.Desktop/osu.Desktop.csproj
@@ -27,7 +27,7 @@
-
+
diff --git a/osu.Game.Rulesets.Catch.Tests/TestCaseAutoJuiceStream.cs b/osu.Game.Rulesets.Catch.Tests/TestCaseAutoJuiceStream.cs
index bea64302c3..fc3809fae4 100644
--- a/osu.Game.Rulesets.Catch.Tests/TestCaseAutoJuiceStream.cs
+++ b/osu.Game.Rulesets.Catch.Tests/TestCaseAutoJuiceStream.cs
@@ -9,7 +9,7 @@ using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Screens.Play;
using osu.Game.Tests.Visual;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Catch.Tests
{
diff --git a/osu.Game.Rulesets.Catch.Tests/TestCaseFruitObjects.cs b/osu.Game.Rulesets.Catch.Tests/TestCaseFruitObjects.cs
index 5c41e4136c..7b6773ad58 100644
--- a/osu.Game.Rulesets.Catch.Tests/TestCaseFruitObjects.cs
+++ b/osu.Game.Rulesets.Catch.Tests/TestCaseFruitObjects.cs
@@ -10,7 +10,7 @@ using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Objects.Drawable;
using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces;
using osu.Game.Tests.Visual;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Catch.Tests
{
diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs
index c7ea29f8c0..22c1180c09 100644
--- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs
+++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs
@@ -8,7 +8,7 @@ using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Objects.Types;
-using OpenTK;
+using osuTK;
using osu.Game.Rulesets.Catch.MathUtils;
namespace osu.Game.Rulesets.Catch.Beatmaps
diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyHitObject.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyHitObject.cs
index 720c1d8653..bd7796ed91 100644
--- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyHitObject.cs
+++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyHitObject.cs
@@ -4,7 +4,7 @@
using System;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.UI;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Catch.Difficulty
{
diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs
index 21e09f991c..9cfba0236a 100644
--- a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs
+++ b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs
@@ -1,12 +1,66 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+using osu.Framework.Graphics;
+using osu.Game.Rulesets.Catch.Objects;
+using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Mods;
+using osu.Game.Rulesets.UI;
+using osuTK;
namespace osu.Game.Rulesets.Catch.Mods
{
- public class CatchModFlashlight : ModFlashlight
+ public class CatchModFlashlight : ModFlashlight
{
public override double ScoreMultiplier => 1.12;
+
+ private const float default_flashlight_size = 350;
+
+ public override Flashlight CreateFlashlight() => new CatchFlashlight(playfield);
+
+ private CatchPlayfield playfield;
+
+ public override void ApplyToRulesetContainer(RulesetContainer rulesetContainer)
+ {
+ playfield = (CatchPlayfield)rulesetContainer.Playfield;
+ base.ApplyToRulesetContainer(rulesetContainer);
+ }
+
+ private class CatchFlashlight : Flashlight
+ {
+ private readonly CatchPlayfield playfield;
+
+ public CatchFlashlight(CatchPlayfield playfield)
+ {
+ this.playfield = playfield;
+ FlashlightSize = new Vector2(0, getSizeFor(0));
+ }
+
+ protected override void Update()
+ {
+ base.Update();
+
+ var catcherArea = playfield.CatcherArea;
+
+ FlashlightPosition = catcherArea.ToSpaceOfOtherDrawable(catcherArea.MovableCatcher.DrawPosition, this);
+ }
+
+ private float getSizeFor(int combo)
+ {
+ if (combo > 200)
+ return default_flashlight_size * 0.8f;
+ else if (combo > 100)
+ return default_flashlight_size * 0.9f;
+ else
+ return default_flashlight_size;
+ }
+
+ protected override void OnComboChange(int newCombo)
+ {
+ this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(newCombo)), FLASHLIGHT_FADE_DURATION);
+ }
+
+ protected override string FragmentShader => "CircularFlashlight";
+ }
}
}
diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs
index 9e840301fd..2db252ebc6 100644
--- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs
+++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs
@@ -2,8 +2,8 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Objects.Types;
diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs
index 5c8a7c4a7c..a896d13132 100644
--- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs
+++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs
@@ -4,8 +4,8 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Rulesets.Catch.Objects.Drawable
{
diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs
index 534c3cb4e0..4bd50f29f6 100644
--- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs
+++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs
@@ -9,8 +9,8 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.MathUtils;
using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Rulesets.Catch.Objects.Drawable
{
diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableTinyDroplet.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableTinyDroplet.cs
index e0f02454c4..2f167121aa 100644
--- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableTinyDroplet.cs
+++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableTinyDroplet.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Catch.Objects.Drawable
{
diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/Pieces/Pulp.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/Pieces/Pulp.cs
index 250dc8c7f1..f21c14f076 100644
--- a/osu.Game.Rulesets.Catch/Objects/Drawable/Pieces/Pulp.cs
+++ b/osu.Game.Rulesets.Catch/Objects/Drawable/Pieces/Pulp.cs
@@ -6,7 +6,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Rulesets.Catch.Objects.Drawable.Pieces
{
diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs
index 925e7aaac9..0697a72325 100644
--- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs
+++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs
@@ -5,13 +5,12 @@ using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
-using osu.Game.Configuration;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Objects.Drawable;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI.Scrolling;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Catch.UI
{
@@ -19,16 +18,10 @@ namespace osu.Game.Rulesets.Catch.UI
{
public const float BASE_WIDTH = 512;
- private readonly CatcherArea catcherArea;
-
- protected override bool UserScrollSpeedAdjustment => false;
-
- protected override SpeedChangeVisualisationMethod VisualisationMethod => SpeedChangeVisualisationMethod.Constant;
+ internal readonly CatcherArea CatcherArea;
public CatchPlayfield(BeatmapDifficulty difficulty, Func> getVisualRepresentation)
{
- Direction.Value = ScrollingDirection.Down;
-
Container explodingFruitContainer;
Anchor = Anchor.TopCentre;
@@ -45,7 +38,7 @@ namespace osu.Game.Rulesets.Catch.UI
{
RelativeSizeAxes = Axes.Both,
},
- catcherArea = new CatcherArea(difficulty)
+ CatcherArea = new CatcherArea(difficulty)
{
GetVisualRepresentation = getVisualRepresentation,
ExplodingFruitTarget = explodingFruitContainer,
@@ -55,11 +48,9 @@ namespace osu.Game.Rulesets.Catch.UI
HitObjectContainer
}
};
-
- VisibleTimeRange.Value = BeatmapDifficulty.DifficultyRange(difficulty.ApproachRate, 1800, 1200, 450);
}
- public bool CheckIfWeCanCatch(CatchHitObject obj) => catcherArea.AttemptCatch(obj);
+ public bool CheckIfWeCanCatch(CatchHitObject obj) => CatcherArea.AttemptCatch(obj);
public override void Add(DrawableHitObject h)
{
@@ -72,6 +63,6 @@ namespace osu.Game.Rulesets.Catch.UI
}
private void onNewResult(DrawableHitObject judgedObject, JudgementResult result)
- => catcherArea.OnResult((DrawableCatchHitObject)judgedObject, result);
+ => CatcherArea.OnResult((DrawableCatchHitObject)judgedObject, result);
}
}
diff --git a/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs b/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs
index 94233bc9f0..ef1bb7767f 100644
--- a/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs
+++ b/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs
@@ -3,6 +3,7 @@
using osu.Framework.Input;
using osu.Game.Beatmaps;
+using osu.Game.Configuration;
using osu.Game.Input.Handlers;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Objects.Drawable;
@@ -18,9 +19,15 @@ namespace osu.Game.Rulesets.Catch.UI
{
public class CatchRulesetContainer : ScrollingRulesetContainer
{
+ protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Constant;
+
+ protected override bool UserScrollSpeedAdjustment => false;
+
public CatchRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap)
: base(ruleset, beatmap)
{
+ Direction.Value = ScrollingDirection.Down;
+ TimeRange.Value = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450);
}
public override ScoreProcessor CreateScoreProcessor() => new CatchScoreProcessor(this);
diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs
index 06453ac32d..3637fe0c36 100644
--- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs
+++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs
@@ -18,8 +18,8 @@ using osu.Game.Rulesets.Catch.Replays;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Rulesets.Catch.UI
{
@@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Catch.UI
{
public const float CATCHER_SIZE = 100;
- protected readonly Catcher MovableCatcher;
+ protected internal readonly Catcher MovableCatcher;
public Func> GetVisualRepresentation;
diff --git a/osu.Game.Rulesets.Catch/UI/PlayfieldAdjustmentContainer.cs b/osu.Game.Rulesets.Catch/UI/PlayfieldAdjustmentContainer.cs
index ad0073ff12..fa1a7ee868 100644
--- a/osu.Game.Rulesets.Catch/UI/PlayfieldAdjustmentContainer.cs
+++ b/osu.Game.Rulesets.Catch/UI/PlayfieldAdjustmentContainer.cs
@@ -3,7 +3,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Catch.UI
{
diff --git a/osu.Game.Rulesets.Mania.Tests/ScrollingTestContainer.cs b/osu.Game.Rulesets.Mania.Tests/ScrollingTestContainer.cs
deleted file mode 100644
index 29663c2093..0000000000
--- a/osu.Game.Rulesets.Mania.Tests/ScrollingTestContainer.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (c) 2007-2018 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.Rulesets.Mania.UI;
-using osu.Game.Rulesets.UI.Scrolling;
-
-namespace osu.Game.Rulesets.Mania.Tests
-{
- ///
- /// A container which provides a to children.
- ///
- public class ScrollingTestContainer : Container
- {
- [Cached(Type = typeof(IScrollingInfo))]
- private readonly TestScrollingInfo scrollingInfo = new TestScrollingInfo();
-
- public ScrollingTestContainer(ScrollingDirection direction)
- {
- scrollingInfo.Direction.Value = direction;
- }
-
- public void Flip() => scrollingInfo.Direction.Value = scrollingInfo.Direction.Value == ScrollingDirection.Up ? ScrollingDirection.Down : ScrollingDirection.Up;
- }
-
- public class TestScrollingInfo : IScrollingInfo
- {
- public readonly Bindable Direction = new Bindable();
- IBindable IScrollingInfo.Direction => Direction;
- }
-}
diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseColumn.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseColumn.cs
index cceee718ca..9bdb5ec1b2 100644
--- a/osu.Game.Rulesets.Mania.Tests/TestCaseColumn.cs
+++ b/osu.Game.Rulesets.Mania.Tests/TestCaseColumn.cs
@@ -14,8 +14,9 @@ using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Mania.UI.Components;
using osu.Game.Rulesets.UI.Scrolling;
-using OpenTK;
-using OpenTK.Graphics;
+using osu.Game.Tests.Visual;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Rulesets.Mania.Tests
{
@@ -93,7 +94,6 @@ namespace osu.Game.Rulesets.Mania.Tests
Height = 0.85f,
AccentColour = Color4.OrangeRed,
Action = { Value = action },
- VisibleTimeRange = { Value = 2000 }
};
columns.Add(column);
@@ -104,6 +104,7 @@ namespace osu.Game.Rulesets.Mania.Tests
Origin = Anchor.Centre,
AutoSizeAxes = Axes.X,
RelativeSizeAxes = Axes.Y,
+ TimeRange = 2000,
Child = column
};
}
diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseHoldNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseHoldNoteSelectionBlueprint.cs
new file mode 100644
index 0000000000..993f7520e8
--- /dev/null
+++ b/osu.Game.Rulesets.Mania.Tests/TestCaseHoldNoteSelectionBlueprint.cs
@@ -0,0 +1,57 @@
+// Copyright (c) 2007-2018 ppy Pty Ltd .
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Game.Beatmaps;
+using osu.Game.Beatmaps.ControlPoints;
+using osu.Game.Graphics;
+using osu.Game.Rulesets.Edit;
+using osu.Game.Rulesets.Mania.Edit.Blueprints;
+using osu.Game.Rulesets.Mania.Objects;
+using osu.Game.Rulesets.Mania.Objects.Drawables;
+using osu.Game.Rulesets.UI.Scrolling;
+using osu.Game.Tests.Visual;
+
+namespace osu.Game.Rulesets.Mania.Tests
+{
+ public class TestCaseHoldNoteSelectionBlueprint : SelectionBlueprintTestCase
+ {
+ private readonly DrawableHoldNote drawableObject;
+
+ protected override Container Content => content ?? base.Content;
+ private readonly Container content;
+
+ public TestCaseHoldNoteSelectionBlueprint()
+ {
+ var holdNote = new HoldNote { Column = 0, Duration = 1000 };
+ holdNote.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
+
+ base.Content.Child = content = new ScrollingTestContainer(ScrollingDirection.Down)
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ AutoSizeAxes = Axes.Y,
+ Width = 50,
+ Child = drawableObject = new DrawableHoldNote(holdNote)
+ {
+ Height = 300,
+ AccentColour = OsuColour.Gray(0.3f)
+ }
+ };
+ }
+
+ protected override void Update()
+ {
+ base.Update();
+
+ foreach (var nested in drawableObject.NestedHitObjects)
+ {
+ double finalPosition = (nested.HitObject.StartTime - drawableObject.HitObject.StartTime) / drawableObject.HitObject.Duration;
+ nested.Y = (float)(-finalPosition * content.DrawHeight);
+ }
+ }
+
+ protected override SelectionBlueprint CreateBlueprint() => new HoldNoteSelectionBlueprint(drawableObject);
+ }
+}
diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseNoteSelectionBlueprint.cs
new file mode 100644
index 0000000000..67370be66c
--- /dev/null
+++ b/osu.Game.Rulesets.Mania.Tests/TestCaseNoteSelectionBlueprint.cs
@@ -0,0 +1,41 @@
+// Copyright (c) 2007-2018 ppy Pty Ltd .
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Game.Beatmaps;
+using osu.Game.Beatmaps.ControlPoints;
+using osu.Game.Rulesets.Edit;
+using osu.Game.Rulesets.Mania.Edit.Blueprints;
+using osu.Game.Rulesets.Mania.Objects;
+using osu.Game.Rulesets.Mania.Objects.Drawables;
+using osu.Game.Rulesets.UI.Scrolling;
+using osu.Game.Tests.Visual;
+using osuTK;
+
+namespace osu.Game.Rulesets.Mania.Tests
+{
+ public class TestCaseNoteSelectionBlueprint : SelectionBlueprintTestCase
+ {
+ private readonly DrawableNote drawableObject;
+
+ protected override Container Content => content ?? base.Content;
+ private readonly Container content;
+
+ public TestCaseNoteSelectionBlueprint()
+ {
+ var note = new Note { Column = 0 };
+ note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
+
+ base.Content.Child = content = new ScrollingTestContainer(ScrollingDirection.Down)
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Size = new Vector2(50, 20),
+ Child = drawableObject = new DrawableNote(note)
+ };
+ }
+
+ protected override SelectionBlueprint CreateBlueprint() => new NoteSelectionBlueprint(drawableObject);
+ }
+}
diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs
index a8b2b20fda..6344aee6bd 100644
--- a/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs
+++ b/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs
@@ -20,8 +20,8 @@ using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Tests.Visual;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Rulesets.Mania.Tests
{
diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseStage.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseStage.cs
index 5c5d955168..7acc37cb67 100644
--- a/osu.Game.Rulesets.Mania.Tests/TestCaseStage.cs
+++ b/osu.Game.Rulesets.Mania.Tests/TestCaseStage.cs
@@ -14,7 +14,8 @@ using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.UI.Scrolling;
-using OpenTK;
+using osu.Game.Tests.Visual;
+using osuTK;
namespace osu.Game.Rulesets.Mania.Tests
{
@@ -122,7 +123,7 @@ namespace osu.Game.Rulesets.Mania.Tests
{
var specialAction = ManiaAction.Special1;
- var stage = new ManiaStage(0, new StageDefinition { Columns = 2 }, ref action, ref specialAction) { VisibleTimeRange = { Value = 2000 } };
+ var stage = new ManiaStage(0, new StageDefinition { Columns = 2 }, ref action, ref specialAction);
stages.Add(stage);
return new ScrollingTestContainer(direction)
@@ -131,6 +132,7 @@ namespace osu.Game.Rulesets.Mania.Tests
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
+ TimeRange = 2000,
Child = stage
};
}
diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs
index d86ebc9a09..2770a6ff5b 100644
--- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs
+++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs
@@ -12,7 +12,7 @@ using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Mania.Beatmaps.Patterns;
using osu.Game.Rulesets.Mania.MathUtils;
using osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy;
-using OpenTK;
+using osuTK;
using osu.Game.Audio;
namespace osu.Game.Rulesets.Mania.Beatmaps
diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs
index da1dd62cf5..8463e209e4 100644
--- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs
+++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using OpenTK;
+using osuTK;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs
index 7bd39adb45..f412e127c5 100644
--- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs
+++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs
@@ -7,7 +7,7 @@ using JetBrains.Annotations;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mania.MathUtils;
using osu.Game.Rulesets.Objects;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
{
diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs
new file mode 100644
index 0000000000..424ff1118c
--- /dev/null
+++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/Components/EditNotePiece.cs
@@ -0,0 +1,29 @@
+// Copyright (c) 2007-2018 ppy Pty Ltd .
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using osu.Framework.Allocation;
+using osu.Framework.Graphics.Containers;
+using osu.Game.Graphics;
+using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
+
+namespace osu.Game.Rulesets.Mania.Edit.Blueprints.Components
+{
+ public class EditNotePiece : CompositeDrawable
+ {
+ public EditNotePiece()
+ {
+ Height = NotePiece.NOTE_HEIGHT;
+
+ CornerRadius = 5;
+ Masking = true;
+
+ InternalChild = new NotePiece();
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ Colour = colours.Yellow;
+ }
+ }
+}
diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs
index 3da2538497..afeb0a585e 100644
--- a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs
@@ -4,13 +4,13 @@
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
+using osu.Framework.Graphics.Primitives;
using osu.Game.Graphics;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
-using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.UI.Scrolling;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
{
@@ -58,6 +58,8 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
Y -= HitObject.Tail.DrawHeight;
}
+ public override Quad SelectionQuad => ScreenSpaceDrawQuad;
+
private class HoldNoteNoteSelectionBlueprint : NoteSelectionBlueprint
{
public HoldNoteNoteSelectionBlueprint(DrawableNote note)
diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs
index 474b8c662e..53f9dd8752 100644
--- a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs
@@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects.Drawables;
@@ -12,6 +13,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
public ManiaSelectionBlueprint(DrawableHitObject hitObject)
: base(hitObject)
{
+ RelativeSizeAxes = Axes.None;
}
public override void AdjustPosition(DragEvent dragEvent)
diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs
index 7c0337dc4e..7df7924c51 100644
--- a/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs
@@ -1,10 +1,9 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using osu.Framework.Allocation;
-using osu.Game.Graphics;
+using osu.Framework.Graphics;
+using osu.Game.Rulesets.Mania.Edit.Blueprints.Components;
using osu.Game.Rulesets.Mania.Objects.Drawables;
-using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
{
@@ -13,18 +12,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
public NoteSelectionBlueprint(DrawableNote note)
: base(note)
{
- Scale = note.Scale;
-
- CornerRadius = 5;
- Masking = true;
-
- AddInternal(new NotePiece());
- }
-
- [BackgroundDependencyLoader]
- private void load(OsuColour colours)
- {
- Colour = colours.Yellow;
+ AddInternal(new EditNotePiece { RelativeSizeAxes = Axes.X });
}
protected override void Update()
diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs
index 138a2c0273..f605ad0a22 100644
--- a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs
+++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs
@@ -2,15 +2,18 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
-using OpenTK;
+using osuTK;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.UI;
+using osu.Game.Rulesets.UI.Scrolling;
namespace osu.Game.Rulesets.Mania.Edit
{
public class ManiaEditRulesetContainer : ManiaRulesetContainer
{
+ public new IScrollingInfo ScrollingInfo => base.ScrollingInfo;
+
public ManiaEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap)
: base(ruleset, beatmap)
{
diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs
index 06d67821a9..3531b81e68 100644
--- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs
+++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs
@@ -10,31 +10,32 @@ using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Objects.Drawables;
using System.Collections.Generic;
using osu.Framework.Allocation;
-using osu.Game.Rulesets.Mania.Configuration;
using osu.Game.Rulesets.Mania.Edit.Blueprints;
-using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Mania.Edit
{
public class ManiaHitObjectComposer : HitObjectComposer
{
- protected new ManiaConfigManager Config => (ManiaConfigManager)base.Config;
-
public ManiaHitObjectComposer(Ruleset ruleset)
: base(ruleset)
{
}
+ private DependencyContainer dependencies;
+
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
- {
- var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
- dependencies.CacheAs(new ManiaScrollingInfo(Config));
- return dependencies;
- }
+ => dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap)
- => new ManiaEditRulesetContainer(ruleset, beatmap);
+ {
+ var rulesetContainer = new ManiaEditRulesetContainer(ruleset, beatmap);
+
+ // This is the earliest we can cache the scrolling info to ourselves, before masks are added to the hierarchy and inject it
+ dependencies.CacheAs(rulesetContainer.ScrollingInfo);
+
+ return rulesetContainer;
+ }
protected override IReadOnlyList CompositionTools => Array.Empty();
diff --git a/osu.Game.Rulesets.Mania/Edit/Masks/ManiaSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Masks/ManiaSelectionBlueprint.cs
new file mode 100644
index 0000000000..81a2728ad4
--- /dev/null
+++ b/osu.Game.Rulesets.Mania/Edit/Masks/ManiaSelectionBlueprint.cs
@@ -0,0 +1,18 @@
+// Copyright (c) 2007-2018 ppy Pty Ltd .
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using osu.Framework.Graphics;
+using osu.Game.Rulesets.Edit;
+using osu.Game.Rulesets.Objects.Drawables;
+
+namespace osu.Game.Rulesets.Mania.Edit.Masks
+{
+ public abstract class ManiaSelectionBlueprint : SelectionBlueprint
+ {
+ protected ManiaSelectionBlueprint(DrawableHitObject hitObject)
+ : base(hitObject)
+ {
+ RelativeSizeAxes = Axes.None;
+ }
+ }
+}
diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModFadeIn.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModFadeIn.cs
index 08815ede09..73942cbb53 100644
--- a/osu.Game.Rulesets.Mania/Mods/ManiaModFadeIn.cs
+++ b/osu.Game.Rulesets.Mania/Mods/ManiaModFadeIn.cs
@@ -3,6 +3,7 @@
using System;
using osu.Game.Graphics;
+using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Mania.Mods
@@ -16,6 +17,6 @@ namespace osu.Game.Rulesets.Mania.Mods
public override string Description => @"Keys appear out of nowhere!";
public override double ScoreMultiplier => 1;
public override bool Ranked => true;
- public override Type[] IncompatibleMods => new[] { typeof(ModFlashlight) };
+ public override Type[] IncompatibleMods => new[] { typeof(ModFlashlight) };
}
}
diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs
index d7a1bc4fbe..cd84483eb9 100644
--- a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs
+++ b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs
@@ -2,13 +2,60 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
+using osu.Framework.Caching;
+using osu.Framework.Graphics;
+using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mods;
+using osuTK;
namespace osu.Game.Rulesets.Mania.Mods
{
- public class ManiaModFlashlight : ModFlashlight
+ public class ManiaModFlashlight : ModFlashlight
{
public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => new[] { typeof(ModHidden) };
+
+ private const float default_flashlight_size = 180;
+
+ public override Flashlight CreateFlashlight() => new ManiaFlashlight();
+
+ private class ManiaFlashlight : Flashlight
+ {
+ private readonly Cached flashlightProperties = new Cached();
+
+ public ManiaFlashlight()
+ {
+ FlashlightSize = new Vector2(0, default_flashlight_size);
+ }
+
+ public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true)
+ {
+ if ((invalidation & Invalidation.DrawSize) > 0)
+ {
+ flashlightProperties.Invalidate();
+ }
+
+ return base.Invalidate(invalidation, source, shallPropagate);
+ }
+
+ protected override void Update()
+ {
+ base.Update();
+
+ if (!flashlightProperties.IsValid)
+ {
+ FlashlightSize = new Vector2(DrawWidth, FlashlightSize.Y);
+
+ FlashlightPosition = DrawPosition + DrawSize / 2;
+ flashlightProperties.Validate();
+ }
+ }
+
+ protected override void OnComboChange(int newCombo)
+ {
+ }
+
+ protected override string FragmentShader => "RectangularFlashlight";
+ }
}
}
diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModHidden.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModHidden.cs
index 2ef68a35fa..9bc2502a8f 100644
--- a/osu.Game.Rulesets.Mania/Mods/ManiaModHidden.cs
+++ b/osu.Game.Rulesets.Mania/Mods/ManiaModHidden.cs
@@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
+using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Mania.Mods
@@ -10,6 +11,6 @@ namespace osu.Game.Rulesets.Mania.Mods
{
public override string Description => @"Keys fade out before you hit them!";
public override double ScoreMultiplier => 1;
- public override Type[] IncompatibleMods => new[] { typeof(ModFlashlight) };
+ public override Type[] IncompatibleMods => new[] { typeof(ModFlashlight) };
}
}
diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs
index d0fc6aa3d6..cf718ebdb0 100644
--- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs
+++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs
@@ -1,11 +1,11 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
+using osuTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Objects.Drawables;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs
index 6a0457efc6..5fcc71a039 100644
--- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs
+++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs
@@ -5,7 +5,7 @@ using System.Linq;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings;
using osu.Game.Rulesets.Scoring;
diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs
index 01d5bc6fd4..3e014ec35c 100644
--- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs
+++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs
@@ -2,8 +2,8 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs
index cb6196a890..8c96c6dfe7 100644
--- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs
+++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs
@@ -5,7 +5,6 @@ using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
-using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI.Scrolling;
diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs
index 7567f40b2f..423712b026 100644
--- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs
+++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Extensions.Color4Extensions;
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings;
diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs
index 619fe06c73..4e5bcf64e7 100644
--- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs
+++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs
@@ -3,7 +3,7 @@
using System;
using osu.Framework.Caching;
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/GlowPiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/GlowPiece.cs
index 68c9ce07d4..3a524bfc90 100644
--- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/GlowPiece.cs
+++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/GlowPiece.cs
@@ -6,7 +6,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
{
diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/LaneGlowPiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/LaneGlowPiece.cs
index 445abc28e2..8325cb8ac0 100644
--- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/LaneGlowPiece.cs
+++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/LaneGlowPiece.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs
index 2c74f5b168..26d5a7f188 100644
--- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs
+++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs
@@ -3,13 +3,12 @@
using osu.Framework.Allocation;
using osu.Framework.Configuration;
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
-using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.UI.Scrolling;
namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs
index 09976e5994..2f456f7479 100644
--- a/osu.Game.Rulesets.Mania/UI/Column.cs
+++ b/osu.Game.Rulesets.Mania/UI/Column.cs
@@ -1,12 +1,12 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK.Graphics;
+using System.Linq;
+using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
-using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Input.Bindings;
@@ -16,7 +16,7 @@ using osu.Game.Rulesets.UI.Scrolling;
namespace osu.Game.Rulesets.Mania.UI
{
- public class Column : ManiaScrollingPlayfield, IKeyBindingHandler, IHasAccentColour
+ public class Column : ScrollingPlayfield, IKeyBindingHandler, IHasAccentColour
{
private const float column_width = 45;
private const float special_column_width = 70;
@@ -134,7 +134,7 @@ namespace osu.Game.Rulesets.Mania.UI
hitObject.AccentColour = AccentColour;
hitObject.OnNewResult += OnNewResult;
- HitObjects.Add(hitObject);
+ HitObjectContainer.Add(hitObject);
}
internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result)
@@ -144,7 +144,7 @@ namespace osu.Game.Rulesets.Mania.UI
explosionContainer.Add(new HitExplosion(judgedObject)
{
- Anchor = Direction == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre
+ Anchor = Direction.Value == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre
});
}
@@ -154,10 +154,10 @@ namespace osu.Game.Rulesets.Mania.UI
return false;
var nextObject =
- HitObjects.AliveObjects.FirstOrDefault(h => h.HitObject.StartTime > Time.Current) ??
+ HitObjectContainer.AliveObjects.FirstOrDefault(h => h.HitObject.StartTime > Time.Current) ??
// fallback to non-alive objects to find next off-screen object
- HitObjects.Objects.FirstOrDefault(h => h.HitObject.StartTime > Time.Current) ??
- HitObjects.Objects.LastOrDefault();
+ HitObjectContainer.Objects.FirstOrDefault(h => h.HitObject.StartTime > Time.Current) ??
+ HitObjectContainer.Objects.LastOrDefault();
nextObject?.PlaySamples();
diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs
index 19cc8fffef..6aef158205 100644
--- a/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs
+++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs
@@ -11,7 +11,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Bindings;
using osu.Game.Graphics;
using osu.Game.Rulesets.UI.Scrolling;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Rulesets.Mania.UI.Components
{
diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs
index 5a4adfd72e..f158d5be07 100644
--- a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs
+++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs
@@ -10,7 +10,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.UI.Scrolling;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Rulesets.Mania.UI.Components
{
diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs
index e30a033831..228e81fef3 100644
--- a/osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs
+++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs
@@ -11,8 +11,8 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Bindings;
using osu.Game.Graphics;
using osu.Game.Rulesets.UI.Scrolling;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Rulesets.Mania.UI.Components
{
diff --git a/osu.Game.Rulesets.Mania/UI/HitExplosion.cs b/osu.Game.Rulesets.Mania/UI/HitExplosion.cs
index c74745868a..817b60d14a 100644
--- a/osu.Game.Rulesets.Mania/UI/HitExplosion.cs
+++ b/osu.Game.Rulesets.Mania/UI/HitExplosion.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@@ -9,7 +9,7 @@ using osu.Framework.MathUtils;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
using osu.Game.Rulesets.Objects.Drawables;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Mania.UI
{
diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs
index 5c3a618a19..85d1c0c4b0 100644
--- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs
+++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs
@@ -1,20 +1,19 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using System;
using System.Collections.Generic;
using osu.Game.Rulesets.Mania.Beatmaps;
-using osu.Game.Rulesets.Mania.Configuration;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Objects.Drawables;
-using OpenTK;
+using osu.Game.Rulesets.UI.Scrolling;
+using osuTK;
namespace osu.Game.Rulesets.Mania.UI
{
- public class ManiaPlayfield : ManiaScrollingPlayfield
+ public class ManiaPlayfield : ScrollingPlayfield
{
private readonly List stages = new List();
@@ -41,7 +40,6 @@ namespace osu.Game.Rulesets.Mania.UI
for (int i = 0; i < stageDefinitions.Count; i++)
{
var newStage = new ManiaStage(firstColumnIndex, stageDefinitions[i], ref normalColumnAction, ref specialColumnAction);
- newStage.VisibleTimeRange.BindTo(VisibleTimeRange);
playfieldGrid.Content[0][i] = newStage;
@@ -68,11 +66,5 @@ namespace osu.Game.Rulesets.Mania.UI
return null;
}
-
- [BackgroundDependencyLoader]
- private void load(ManiaConfigManager maniaConfig)
- {
- maniaConfig.BindWith(ManiaSetting.ScrollTime, VisibleTimeRange);
- }
}
}
diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs
index 500fb5a631..321dd4e1cb 100644
--- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs
+++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs
@@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
+using osu.Framework.Configuration;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Input;
@@ -35,6 +36,8 @@ namespace osu.Game.Rulesets.Mania.UI
protected new ManiaConfigManager Config => (ManiaConfigManager)base.Config;
+ private readonly Bindable configDirection = new Bindable();
+
public ManiaRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap)
: base(ruleset, beatmap)
{
@@ -70,18 +73,11 @@ namespace osu.Game.Rulesets.Mania.UI
private void load()
{
BarLines.ForEach(Playfield.Add);
- }
- private DependencyContainer dependencies;
+ Config.BindWith(ManiaSetting.ScrollDirection, configDirection);
+ configDirection.BindValueChanged(v => Direction.Value = (ScrollingDirection)v, true);
- protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
- {
- dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
-
- if (dependencies.Get() == null)
- dependencies.CacheAs(new ManiaScrollingInfo(Config));
-
- return dependencies;
+ Config.BindWith(ManiaSetting.ScrollTime, TimeRange);
}
protected override Playfield CreatePlayfield() => new ManiaPlayfield(Beatmap.Stages)
diff --git a/osu.Game.Rulesets.Mania/UI/ManiaScrollingInfo.cs b/osu.Game.Rulesets.Mania/UI/ManiaScrollingInfo.cs
deleted file mode 100644
index 624ea13e1b..0000000000
--- a/osu.Game.Rulesets.Mania/UI/ManiaScrollingInfo.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2007-2018 ppy Pty Ltd .
-// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-
-using osu.Framework.Configuration;
-using osu.Game.Rulesets.Mania.Configuration;
-using osu.Game.Rulesets.UI.Scrolling;
-
-namespace osu.Game.Rulesets.Mania.UI
-{
- public class ManiaScrollingInfo : IScrollingInfo
- {
- private readonly Bindable configDirection = new Bindable();
-
- public readonly Bindable Direction = new Bindable();
- IBindable IScrollingInfo.Direction => Direction;
-
- public ManiaScrollingInfo(ManiaConfigManager config)
- {
- config.BindWith(ManiaSetting.ScrollDirection, configDirection);
- configDirection.BindValueChanged(v => Direction.Value = (ScrollingDirection)v, true);
- }
- }
-}
diff --git a/osu.Game.Rulesets.Mania/UI/ManiaScrollingPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaScrollingPlayfield.cs
deleted file mode 100644
index 8ee0fbf7fe..0000000000
--- a/osu.Game.Rulesets.Mania/UI/ManiaScrollingPlayfield.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2007-2018 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.Game.Rulesets.UI.Scrolling;
-
-namespace osu.Game.Rulesets.Mania.UI
-{
- public abstract class ManiaScrollingPlayfield : ScrollingPlayfield
- {
- private readonly IBindable direction = new Bindable();
-
- [BackgroundDependencyLoader]
- private void load(IScrollingInfo scrollingInfo)
- {
- direction.BindTo(scrollingInfo.Direction);
- direction.BindValueChanged(direction => Direction.Value = direction, true);
- }
- }
-}
diff --git a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs
index 8cf49686b9..73c080ffba 100644
--- a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs
+++ b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs
@@ -15,15 +15,15 @@ using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.UI.Scrolling;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Rulesets.Mania.UI
{
///
/// A collection of s.
///
- public class ManiaStage : ManiaScrollingPlayfield
+ public class ManiaStage : ScrollingPlayfield
{
public const float HIT_TARGET_POSITION = 50;
@@ -144,8 +144,6 @@ namespace osu.Game.Rulesets.Mania.UI
public void AddColumn(Column c)
{
- c.VisibleTimeRange.BindTo(VisibleTimeRange);
-
topLevelContainer.Add(c.TopLevelContainer.CreateProxy());
columnFlow.Add(c);
AddNested(c);
diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs
index 6b67188791..1c1a027411 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs
@@ -8,7 +8,7 @@ using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
-using OpenTK;
+using osuTK;
using System.Collections.Generic;
using System;
using osu.Game.Rulesets.Mods;
diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionBlueprint.cs
index 9662e0018f..fed62188ab 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionBlueprint.cs
@@ -8,7 +8,7 @@ using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Tests
{
diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs
index 5b638782fb..1895913917 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs
@@ -11,8 +11,8 @@ using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Game.Rulesets.Mods;
using System.Linq;
using NUnit.Framework;
diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs
index cacbcb2cd6..cd07369ccf 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs
@@ -13,7 +13,7 @@ using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Tests
{
diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionBlueprint.cs
index a0cfd4487e..d7ba5d8105 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionBlueprint.cs
@@ -13,7 +13,7 @@ using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Tests
{
diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs
index 4fc4f3edc3..510c32fd9f 100644
--- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs
+++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
+using osuTK;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.Objects;
diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs
index 39e3c009da..d8e3b340c9 100644
--- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs
+++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs
@@ -4,7 +4,7 @@
using System;
using System.Linq;
using osu.Game.Rulesets.Osu.Objects;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
{
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs
index 9c33435285..de219ed5a5 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs
@@ -3,19 +3,19 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
-using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
{
- public class HitCirclePiece : CompositeDrawable
+ public class HitCirclePiece : HitObjectPiece
{
private readonly HitCircle hitCircle;
public HitCirclePiece(HitCircle hitCircle)
+ : base(hitCircle)
{
this.hitCircle = hitCircle;
Origin = Anchor.Centre;
@@ -25,10 +25,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
CornerRadius = Size.X / 2;
InternalChild = new RingPiece();
-
- hitCircle.PositionChanged += _ => UpdatePosition();
- hitCircle.StackHeightChanged += _ => UpdatePosition();
- hitCircle.ScaleChanged += _ => Scale = new Vector2(hitCircle.Scale);
}
[BackgroundDependencyLoader]
@@ -36,7 +32,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
{
Colour = colours.Yellow;
- UpdatePosition();
+ PositionBindable.BindValueChanged(_ => UpdatePosition(), true);
+ StackHeightBindable.BindValueChanged(_ => UpdatePosition());
+ ScaleBindable.BindValueChanged(v => Scale = new Vector2(v), true);
}
protected virtual void UpdatePosition() => Position = hitCircle.StackedPosition;
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitObjectPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitObjectPiece.cs
new file mode 100644
index 0000000000..882a9a3d81
--- /dev/null
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitObjectPiece.cs
@@ -0,0 +1,36 @@
+// Copyright (c) 2007-2018 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.Rulesets.Osu.Objects;
+using osuTK;
+
+namespace osu.Game.Rulesets.Osu.Edit.Blueprints
+{
+ ///
+ /// A piece of a blueprint which responds to changes in the state of a .
+ ///
+ public abstract class HitObjectPiece : CompositeDrawable
+ {
+ protected readonly IBindable PositionBindable = new Bindable();
+ protected readonly IBindable StackHeightBindable = new Bindable();
+ protected readonly IBindable ScaleBindable = new Bindable();
+
+ private readonly OsuHitObject hitObject;
+
+ protected HitObjectPiece(OsuHitObject hitObject)
+ {
+ this.hitObject = hitObject;
+ }
+
+ [BackgroundDependencyLoader]
+ private void load()
+ {
+ PositionBindable.BindTo(hitObject.PositionBindable);
+ StackHeightBindable.BindTo(hitObject.StackHeightBindable);
+ ScaleBindable.BindTo(hitObject.ScaleBindable);
+ }
+ }
+}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/SliderPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/SliderPiece.cs
new file mode 100644
index 0000000000..ef7254d9c9
--- /dev/null
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/SliderPiece.cs
@@ -0,0 +1,32 @@
+// Copyright (c) 2007-2018 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.Game.Rulesets.Objects;
+using osu.Game.Rulesets.Osu.Objects;
+
+namespace osu.Game.Rulesets.Osu.Edit.Blueprints
+{
+ ///
+ /// A piece of a blueprint which responds to changes in the state of a .
+ ///
+ public abstract class SliderPiece : HitObjectPiece
+ {
+ protected readonly IBindable PathBindable = new Bindable();
+
+ private readonly Slider slider;
+
+ protected SliderPiece(Slider slider)
+ : base(slider)
+ {
+ this.slider = slider;
+ }
+
+ [BackgroundDependencyLoader]
+ private void load()
+ {
+ PathBindable.BindTo(slider.PathBindable);
+ }
+ }
+}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs
index 7100d9443e..18efe21404 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs
@@ -10,7 +10,7 @@ using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.Objects;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
index ab9d81574a..0089c2dddd 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
@@ -1,26 +1,31 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Osu.Objects;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
- public class PathControlPointVisualiser : CompositeDrawable
+ public class PathControlPointVisualiser : SliderPiece
{
private readonly Slider slider;
private readonly Container pieces;
public PathControlPointVisualiser(Slider slider)
+ : base(slider)
{
this.slider = slider;
InternalChild = pieces = new Container { RelativeSizeAxes = Axes.Both };
+ }
- slider.PathChanged += _ => updatePathControlPoints();
- updatePathControlPoints();
+ [BackgroundDependencyLoader]
+ private void load()
+ {
+ PathBindable.BindValueChanged(_ => updatePathControlPoints(), true);
}
private void updatePathControlPoints()
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs
index 06bc265258..5ea85676b5 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs
@@ -3,21 +3,21 @@
using System.Collections.Generic;
using osu.Framework.Allocation;
-using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
- public class SliderBodyPiece : CompositeDrawable
+ public class SliderBodyPiece : SliderPiece
{
private readonly Slider slider;
private readonly ManualSliderBody body;
public SliderBodyPiece(Slider slider)
+ : base(slider)
{
this.slider = slider;
@@ -26,9 +26,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
AccentColour = Color4.Transparent,
PathWidth = slider.Scale * 64
};
-
- slider.PositionChanged += _ => updatePosition();
- slider.ScaleChanged += _ => body.PathWidth = slider.Scale * 64;
}
[BackgroundDependencyLoader]
@@ -36,7 +33,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
body.BorderColour = colours.Yellow;
- updatePosition();
+ PositionBindable.BindValueChanged(_ => updatePosition(), true);
+ ScaleBindable.BindValueChanged(v => body.PathWidth = v * 64, true);
}
private void updatePosition() => Position = slider.StackedPosition;
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs
index 1ee765f5e0..205ac6bea3 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs
@@ -1,6 +1,9 @@
// Copyright (c) 2007-2018 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.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
using osu.Game.Rulesets.Osu.Objects;
@@ -8,6 +11,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
public class SliderCirclePiece : HitCirclePiece
{
+ private readonly IBindable pathBindable = new Bindable();
+
private readonly Slider slider;
private readonly SliderPosition position;
@@ -16,8 +21,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
this.slider = slider;
this.position = position;
+ }
- slider.PathChanged += _ => UpdatePosition();
+ [BackgroundDependencyLoader]
+ private void load()
+ {
+ pathBindable.BindTo(slider.PathBindable);
+ pathBindable.BindValueChanged(_ => UpdatePosition(), true);
}
protected override void UpdatePosition()
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs
index d59cd35f19..ba3501cb2b 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs
@@ -12,8 +12,8 @@ using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components;
-using OpenTK;
-using OpenTK.Input;
+using osuTK;
+using osuTK.Input;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs
index 4810d76bf8..2206a36738 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs
@@ -5,7 +5,7 @@ using osu.Framework.Graphics;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs
index bd63a3e607..af648cfa1b 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs
@@ -8,16 +8,18 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components
{
- public class SpinnerPiece : CompositeDrawable
+ public class SpinnerPiece : HitObjectPiece
{
private readonly Spinner spinner;
private readonly CircularContainer circle;
+ private readonly RingPiece ring;
public SpinnerPiece(Spinner spinner)
+ : base(spinner)
{
this.spinner = spinner;
@@ -27,7 +29,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components
FillMode = FillMode.Fit;
Size = new Vector2(1.3f);
- RingPiece ring;
InternalChildren = new Drawable[]
{
circle = new CircularContainer
@@ -45,18 +46,16 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components
};
ring.Scale = new Vector2(spinner.Scale);
-
- spinner.PositionChanged += _ => updatePosition();
- spinner.StackHeightChanged += _ => updatePosition();
- spinner.ScaleChanged += _ => ring.Scale = new Vector2(spinner.Scale);
-
- updatePosition();
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Colour = colours.Yellow;
+
+ PositionBindable.BindValueChanged(_ => updatePosition(), true);
+ StackHeightBindable.BindValueChanged(_ => updatePosition());
+ ScaleBindable.BindValueChanged(v => ring.Scale = new Vector2(v), true);
}
private void updatePosition() => Position = spinner.Position;
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs
index c97adde427..804a4fcba0 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs
@@ -37,6 +37,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
isPlacingEnd = true;
piece.FadeTo(1f, 150, Easing.OutQuint);
+
+ BeginPlacement();
}
return true;
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs
index 9e9cc87c5e..4b98866613 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs
@@ -5,7 +5,7 @@ using osu.Framework.Input.Events;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
{
diff --git a/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs b/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs
index 8571de39f4..05bc7dada0 100644
--- a/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs
+++ b/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs
@@ -5,7 +5,7 @@ using osu.Framework.Graphics.Cursor;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Rulesets.UI;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Edit
{
diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs
index a337439593..84a35b04fe 100644
--- a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs
+++ b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs
@@ -1,12 +1,52 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+using osu.Framework.Graphics;
+using osu.Framework.Input;
+using osu.Framework.Input.Events;
using osu.Game.Rulesets.Mods;
+using osu.Game.Rulesets.Osu.Objects;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Mods
{
- public class OsuModFlashlight : ModFlashlight
+ public class OsuModFlashlight : ModFlashlight
{
public override double ScoreMultiplier => 1.12;
+
+ private const float default_flashlight_size = 180;
+
+ public override Flashlight CreateFlashlight() => new OsuFlashlight();
+
+ private class OsuFlashlight : Flashlight, IRequireHighFrequencyMousePosition
+ {
+ public OsuFlashlight()
+ {
+ FlashlightSize = new Vector2(0, getSizeFor(0));
+ }
+
+ protected override bool OnMouseMove(MouseMoveEvent e)
+ {
+ FlashlightPosition = e.MousePosition;
+ return base.OnMouseMove(e);
+ }
+
+ private float getSizeFor(int combo)
+ {
+ if (combo > 200)
+ return default_flashlight_size * 0.8f;
+ else if (combo > 100)
+ return default_flashlight_size * 0.9f;
+ else
+ return default_flashlight_size;
+ }
+
+ protected override void OnComboChange(int newCombo)
+ {
+ this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(newCombo)), FLASHLIGHT_FADE_DURATION);
+ }
+
+ protected override string FragmentShader => "CircularFlashlight";
+ }
}
}
diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModHardRock.cs b/osu.Game.Rulesets.Osu/Mods/OsuModHardRock.cs
index 223e4df844..32d2d40671 100644
--- a/osu.Game.Rulesets.Osu/Mods/OsuModHardRock.cs
+++ b/osu.Game.Rulesets.Osu/Mods/OsuModHardRock.cs
@@ -7,7 +7,7 @@ using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.UI;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Mods
{
diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs
index 440b314e5f..dcd1896601 100644
--- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs
+++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs
@@ -8,7 +8,7 @@ using osu.Game.Graphics;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Mods
{
diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs
index e0a93453ce..93f1070231 100644
--- a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs
+++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs
@@ -9,7 +9,7 @@ using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Objects;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Mods
{
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs
index 908b9cb3c6..bd329266aa 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs
@@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs
index 61a6e6404a..61219d9bb9 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs
@@ -3,7 +3,7 @@
using System;
using System.Collections.Generic;
-using OpenTK;
+using osuTK;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Objects.Types;
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs
index e663989eeb..9b562745fa 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs
@@ -2,12 +2,14 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
+using osu.Framework.Allocation;
+using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
-using OpenTK;
+using osuTK;
using osu.Game.Rulesets.Scoring;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
@@ -21,6 +23,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private readonly NumberPiece number;
private readonly GlowPiece glow;
+ private readonly IBindable positionBindable = new Bindable();
+ private readonly IBindable stackHeightBindable = new Bindable();
+ private readonly IBindable scaleBindable = new Bindable();
+
public DrawableHitCircle(HitCircle h)
: base(h)
{
@@ -59,10 +65,18 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
//may not be so correct
Size = circle.DrawSize;
+ }
- HitObject.PositionChanged += _ => Position = HitObject.StackedPosition;
- HitObject.StackHeightChanged += _ => Position = HitObject.StackedPosition;
- HitObject.ScaleChanged += s => Scale = new Vector2(s);
+ [BackgroundDependencyLoader]
+ private void load()
+ {
+ positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
+ stackHeightBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
+ scaleBindable.BindValueChanged(v => Scale = new Vector2(v));
+
+ positionBindable.BindTo(HitObject.PositionBindable);
+ stackHeightBindable.BindTo(HitObject.StackHeightBindable);
+ scaleBindable.BindTo(HitObject.ScaleBindable);
}
public override Color4 AccentColour
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs
index 10cd246172..1081f185ad 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs
@@ -9,7 +9,7 @@ using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Judgements;
using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning;
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Game.Graphics.Containers;
namespace osu.Game.Rulesets.Osu.Objects.Drawables
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs
index 04ec3f13c7..17f6ddd211 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
-using OpenTK;
+using osuTK;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs
index dfe7937e81..8c9252a2da 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Game.Rulesets.Objects.Drawables;
-using OpenTK;
+using osuTK;
using osu.Game.Graphics;
using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning;
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs
index a90182cecb..eed9a53ad7 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs
@@ -1,17 +1,19 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
+using osuTK;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
+using osu.Framework.Configuration;
using osu.Framework.Graphics.Containers;
using osu.Game.Configuration;
+using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
@@ -26,6 +28,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
public readonly SnakingSliderBody Body;
public readonly SliderBall Ball;
+ private readonly IBindable positionBindable = new Bindable();
+ private readonly IBindable scaleBindable = new Bindable();
+ private readonly IBindable pathBindable = new Bindable();
+
public DrawableSlider(Slider s)
: base(s)
{
@@ -83,15 +89,26 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
components.Add(drawableRepeatPoint);
AddNested(drawableRepeatPoint);
}
+ }
- HitObject.PositionChanged += _ => Position = HitObject.StackedPosition;
- HitObject.ScaleChanged += _ =>
+ [BackgroundDependencyLoader]
+ private void load(OsuConfigManager config)
+ {
+ config.BindWith(OsuSetting.SnakingInSliders, Body.SnakingIn);
+ config.BindWith(OsuSetting.SnakingOutSliders, Body.SnakingOut);
+
+ positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
+ scaleBindable.BindValueChanged(v =>
{
Body.PathWidth = HitObject.Scale * 64;
Ball.Scale = new Vector2(HitObject.Scale);
- };
+ });
- slider.PathChanged += _ => Body.Refresh();
+ positionBindable.BindTo(HitObject.PositionBindable);
+ scaleBindable.BindTo(HitObject.ScaleBindable);
+ pathBindable.BindTo(slider.PathBindable);
+
+ pathBindable.BindValueChanged(_ => Body.Refresh());
}
public override Color4 AccentColour
@@ -108,13 +125,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
}
}
- [BackgroundDependencyLoader]
- private void load(OsuConfigManager config)
- {
- config.BindWith(OsuSetting.SnakingInSliders, Body.SnakingIn);
- config.BindWith(OsuSetting.SnakingOutSliders, Body.SnakingOut);
- }
-
public bool Tracking;
protected override void Update()
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs
index b933364887..f4962f6113 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs
@@ -2,24 +2,35 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
+using osu.Framework.Allocation;
+using osu.Framework.Configuration;
+using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
public class DrawableSliderHead : DrawableHitCircle
{
+ private readonly IBindable positionBindable = new Bindable();
+ private readonly IBindable pathBindable = new Bindable();
+
private readonly Slider slider;
public DrawableSliderHead(Slider slider, HitCircle h)
: base(h)
{
this.slider = slider;
+ }
- h.PositionChanged += _ => updatePosition();
- slider.PathChanged += _ => updatePosition();
+ [BackgroundDependencyLoader]
+ private void load()
+ {
+ positionBindable.BindTo(HitObject.PositionBindable);
+ pathBindable.BindTo(slider.PathBindable);
- updatePosition();
+ positionBindable.BindValueChanged(_ => updatePosition());
+ pathBindable.BindValueChanged(_ => updatePosition(), true);
}
protected override void Update()
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs
index 6946a55d8e..4ff05d8995 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs
@@ -1,8 +1,11 @@
// Copyright (c) 2007-2018 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.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
@@ -17,6 +20,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
public bool Tracking { get; set; }
+ private readonly IBindable positionBindable = new Bindable();
+ private readonly IBindable pathBindable = new Bindable();
+
public DrawableSliderTail(Slider slider, SliderTailCircle hitCircle)
: base(hitCircle)
{
@@ -29,10 +35,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
AlwaysPresent = true;
- hitCircle.PositionChanged += _ => updatePosition();
- slider.PathChanged += _ => updatePosition();
+ positionBindable.BindTo(hitCircle.PositionBindable);
+ pathBindable.BindTo(slider.PathBindable);
- updatePosition();
+ positionBindable.BindValueChanged(_ => updatePosition());
+ pathBindable.BindValueChanged(_ => updatePosition(), true);
}
protected override void CheckForResult(bool userTriggered, double timeOffset)
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs
index 964c75131a..531e6a37af 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs
@@ -3,8 +3,8 @@
using osu.Framework.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning;
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs
index f3846bd52f..d0d9479ed1 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs
@@ -6,11 +6,12 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Game.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Allocation;
+using osu.Framework.Configuration;
using osu.Game.Screens.Ranking;
using osu.Game.Rulesets.Scoring;
@@ -36,6 +37,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private readonly Color4 baseColour = OsuColour.FromHex(@"002c3c");
private readonly Color4 fillColour = OsuColour.FromHex(@"005b7c");
+ private readonly IBindable positionBindable = new Bindable();
+
private Color4 normalColour;
private Color4 completeColour;
@@ -112,8 +115,23 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Alpha = 0
}
};
+ }
- s.PositionChanged += _ => Position = s.Position;
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ normalColour = baseColour;
+
+ Background.AccentColour = normalColour;
+
+ completeColour = colours.YellowLight.Opacity(0.75f);
+
+ Disc.AccentColour = fillColour;
+ circle.Colour = colours.BlueDark;
+ glow.Colour = colours.BlueDark;
+
+ positionBindable.BindValueChanged(v => Position = v);
+ positionBindable.BindTo(HitObject.PositionBindable);
}
public float Progress => MathHelper.Clamp(Disc.RotationAbsolute / 360 / Spinner.SpinsRequired, 0, 1);
@@ -153,20 +171,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
});
}
- [BackgroundDependencyLoader]
- private void load(OsuColour colours)
- {
- normalColour = baseColour;
-
- Background.AccentColour = normalColour;
-
- completeColour = colours.YellowLight.Opacity(0.75f);
-
- Disc.AccentColour = fillColour;
- circle.Colour = colours.BlueDark;
- glow.Colour = colours.BlueDark;
- }
-
protected override void Update()
{
Disc.Tracking = OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false;
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/ITrackSnaking.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/ITrackSnaking.cs
index a05e51a460..23903e1b5e 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/ITrackSnaking.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/ITrackSnaking.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs
index 6bb6991cc0..1a9acf708a 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs
@@ -6,7 +6,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings;
using osu.Game.Skinning;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ExplodePiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ExplodePiece.cs
index ed1b042939..2a2c845143 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ExplodePiece.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ExplodePiece.cs
@@ -4,7 +4,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Skinning;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/FlashPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/FlashPiece.cs
index 0a1339a6ca..8880c96e3c 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/FlashPiece.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/FlashPiece.cs
@@ -3,7 +3,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
-using OpenTK;
+using osuTK;
using osu.Framework.Graphics.Shapes;
using osu.Game.Skinning;
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ManualSliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ManualSliderBody.cs
index 9d239c15f2..6f4ccd60a9 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ManualSliderBody.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ManualSliderBody.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs
index acb3ee92ff..87ca2f05e1 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs
@@ -5,7 +5,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Sprites;
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Skinning;
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/RingPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/RingPiece.cs
index f3e0a0ef43..75b34959bd 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/RingPiece.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/RingPiece.cs
@@ -3,8 +3,8 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Skinning;
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs
index 3081ae49fc..5144ce4e7a 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs
@@ -7,9 +7,9 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Objects.Types;
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Game.Skinning;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs
index ca2daa3adb..4604a00fdd 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs
@@ -6,9 +6,9 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Lines;
using osu.Framework.Graphics.Primitives;
-using OpenTK;
-using OpenTK.Graphics;
-using OpenTK.Graphics.ES30;
+using osuTK;
+using osuTK.Graphics;
+using osuTK.Graphics.ES30;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs
index 0e6f3ad16c..49c66c4063 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Game.Rulesets.Objects.Types;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs
index 584fd93a70..e2d67f16a9 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs
index 4dd1c5f218..59400a71ea 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs
@@ -6,8 +6,8 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerTicks.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerTicks.cs
index 61387d796e..cc9bb1975d 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerTicks.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerTicks.cs
@@ -5,8 +5,8 @@ using System;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs
index 61d199a7dc..462df43b65 100644
--- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs
+++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs
@@ -1,10 +1,10 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using System;
+using osu.Framework.Configuration;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Objects;
-using OpenTK;
+using osuTK;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Beatmaps.ControlPoints;
@@ -14,26 +14,15 @@ namespace osu.Game.Rulesets.Osu.Objects
{
public const double OBJECT_RADIUS = 64;
- public event Action PositionChanged;
- public event Action StackHeightChanged;
- public event Action ScaleChanged;
-
public double TimePreempt = 600;
public double TimeFadeIn = 400;
- private Vector2 position;
+ public readonly Bindable PositionBindable = new Bindable();
public virtual Vector2 Position
{
- get => position;
- set
- {
- if (position == value)
- return;
- position = value;
-
- PositionChanged?.Invoke(value);
- }
+ get => PositionBindable;
+ set => PositionBindable.Value = value;
}
public float X => Position.X;
@@ -45,38 +34,24 @@ namespace osu.Game.Rulesets.Osu.Objects
public Vector2 StackedEndPosition => EndPosition + StackOffset;
- private int stackHeight;
+ public readonly Bindable StackHeightBindable = new Bindable();
public int StackHeight
{
- get => stackHeight;
- set
- {
- if (stackHeight == value)
- return;
- stackHeight = value;
-
- StackHeightChanged?.Invoke(value);
- }
+ get => StackHeightBindable;
+ set => StackHeightBindable.Value = value;
}
public Vector2 StackOffset => new Vector2(StackHeight * Scale * -6.4f);
public double Radius => OBJECT_RADIUS * Scale;
- private float scale = 1;
+ public readonly Bindable ScaleBindable = new Bindable(1);
public float Scale
{
- get => scale;
- set
- {
- if (scale == value)
- return;
- scale = value;
-
- ScaleChanged?.Invoke(value);
- }
+ get => ScaleBindable;
+ set => ScaleBindable.Value = value;
}
public virtual bool NewCombo { get; set; }
diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs
index cf57f24b83..d508ec2636 100644
--- a/osu.Game.Rulesets.Osu/Objects/Slider.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs
@@ -2,11 +2,12 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
-using OpenTK;
+using osuTK;
using osu.Game.Rulesets.Objects.Types;
using System.Collections.Generic;
using osu.Game.Rulesets.Objects;
using System.Linq;
+using osu.Framework.Configuration;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
@@ -22,8 +23,6 @@ namespace osu.Game.Rulesets.Osu.Objects
///
private const float base_scoring_distance = 100;
- public event Action PathChanged;
-
public double EndTime => StartTime + this.SpanCount() * Path.Distance / Velocity;
public double Duration => EndTime - StartTime;
@@ -52,20 +51,12 @@ namespace osu.Game.Rulesets.Osu.Objects
}
}
- private SliderPath path;
+ public readonly Bindable PathBindable = new Bindable();
public SliderPath Path
{
- get => path;
- set
- {
- path = value;
-
- PathChanged?.Invoke(value);
-
- if (TailCircle != null)
- TailCircle.Position = EndPosition;
- }
+ get => PathBindable.Value;
+ set => PathBindable.Value = value;
}
public double Distance => Path.Distance;
@@ -164,7 +155,7 @@ namespace osu.Game.Rulesets.Osu.Objects
ComboIndex = ComboIndex,
};
- TailCircle = new SliderTailCircle
+ TailCircle = new SliderTailCircle(this)
{
StartTime = EndTime,
Position = EndPosition,
diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs
index b567bd8423..74a7a8d446 100644
--- a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs
+++ b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs
@@ -1,13 +1,23 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+using osu.Framework.Configuration;
using osu.Game.Rulesets.Judgements;
+using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.Judgements;
namespace osu.Game.Rulesets.Osu.Objects
{
public class SliderTailCircle : SliderCircle
{
+ private readonly IBindable pathBindable = new Bindable();
+
+ public SliderTailCircle(Slider slider)
+ {
+ pathBindable.BindTo(slider.PathBindable);
+ pathBindable.BindValueChanged(_ => Position = slider.EndPosition);
+ }
+
public override Judgement CreateJudgement() => new OsuSliderTailJudgement();
}
}
diff --git a/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs b/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs
index 7322f65066..a0d040c40b 100644
--- a/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs
+++ b/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
+using osuTK;
using osu.Framework.MathUtils;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Osu.Objects;
diff --git a/osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs b/osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs
index bb0bd891b3..2530644413 100644
--- a/osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs
+++ b/osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
+using osuTK;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Osu.Objects;
using System;
diff --git a/osu.Game.Rulesets.Osu/Replays/OsuReplayFrame.cs b/osu.Game.Rulesets.Osu/Replays/OsuReplayFrame.cs
index 4412b6efab..82dfa7f0ad 100644
--- a/osu.Game.Rulesets.Osu/Replays/OsuReplayFrame.cs
+++ b/osu.Game.Rulesets.Osu/Replays/OsuReplayFrame.cs
@@ -6,7 +6,7 @@ using osu.Game.Beatmaps;
using osu.Game.Rulesets.Replays;
using osu.Game.Rulesets.Replays.Legacy;
using osu.Game.Rulesets.Replays.Types;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Replays
{
diff --git a/osu.Game.Rulesets.Osu/Replays/OsuReplayInputHandler.cs b/osu.Game.Rulesets.Osu/Replays/OsuReplayInputHandler.cs
index 5c07860b19..230709a4aa 100644
--- a/osu.Game.Rulesets.Osu/Replays/OsuReplayInputHandler.cs
+++ b/osu.Game.Rulesets.Osu/Replays/OsuReplayInputHandler.cs
@@ -6,7 +6,7 @@ using System.Linq;
using osu.Framework.Input.StateChanges;
using osu.Framework.MathUtils;
using osu.Game.Rulesets.Replays;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.Replays
{
diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs
index 4b5513ff9c..b25b3e5cb8 100644
--- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs
+++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs
@@ -14,9 +14,9 @@ using osu.Framework.Graphics.Textures;
using osu.Framework.Input;
using osu.Framework.Input.Events;
using osu.Framework.Timing;
-using OpenTK;
-using OpenTK.Graphics;
-using OpenTK.Graphics.ES30;
+using osuTK;
+using osuTK.Graphics;
+using osuTK.Graphics.ES30;
namespace osu.Game.Rulesets.Osu.UI.Cursor
{
diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs
index 4a45d4fb31..4aa30777e9 100644
--- a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs
+++ b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs
@@ -12,8 +12,8 @@ using osu.Framework.Input.Bindings;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Skinning;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Rulesets.Osu.UI.Cursor
{
diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs
index 398680cb8d..3399fdb9a0 100644
--- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs
+++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
+using osuTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Objects.Drawables;
@@ -84,5 +84,7 @@ namespace osu.Game.Rulesets.Osu.UI
judgementLayer.Add(explosion);
}
+
+ public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => HitObjectContainer.ReceivePositionalInputAt(screenSpacePos);
}
}
diff --git a/osu.Game.Rulesets.Osu/UI/PlayfieldAdjustmentContainer.cs b/osu.Game.Rulesets.Osu/UI/PlayfieldAdjustmentContainer.cs
index 00d5692fda..df5bd84e75 100644
--- a/osu.Game.Rulesets.Osu/UI/PlayfieldAdjustmentContainer.cs
+++ b/osu.Game.Rulesets.Osu/UI/PlayfieldAdjustmentContainer.cs
@@ -3,7 +3,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Osu.UI
{
diff --git a/osu.Game.Rulesets.Taiko.Tests/TestCaseInputDrum.cs b/osu.Game.Rulesets.Taiko.Tests/TestCaseInputDrum.cs
index 322e9b6bd4..b88aea0bbd 100644
--- a/osu.Game.Rulesets.Taiko.Tests/TestCaseInputDrum.cs
+++ b/osu.Game.Rulesets.Taiko.Tests/TestCaseInputDrum.cs
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using NUnit.Framework;
-using OpenTK;
+using osuTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Audio;
diff --git a/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs b/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs
index fc103e4c72..dad7f34e71 100644
--- a/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs
+++ b/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs
@@ -19,7 +19,7 @@ using osu.Game.Rulesets.Taiko.Objects.Drawables;
using osu.Game.Rulesets.Taiko.UI;
using osu.Game.Tests.Beatmaps;
using osu.Game.Tests.Visual;
-using OpenTK;
+using osuTK;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Taiko.Tests
diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs
index f530b6725c..734d5d0ad7 100644
--- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs
+++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs
@@ -8,6 +8,7 @@ using osu.Game.Beatmaps;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring;
+using osu.Game.Rulesets.Taiko.Objects;
namespace osu.Game.Rulesets.Taiko.Difficulty
{
@@ -82,7 +83,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
if (mods.Any(m => m is ModHidden))
strainValue *= 1.025;
- if (mods.Any(m => m is ModFlashlight))
+ if (mods.Any(m => m is ModFlashlight))
// Apply length bonus again if flashlight is on simply because it becomes a lot harder on longer maps.
strainValue *= 1.05 * lengthBonus;
diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs
index 49f7786f59..79dad84696 100644
--- a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs
+++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs
@@ -1,12 +1,80 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+using osu.Framework.Caching;
+using osu.Framework.Graphics;
using osu.Game.Rulesets.Mods;
+using osu.Game.Rulesets.Taiko.Objects;
+using osu.Game.Rulesets.Taiko.UI;
+using osu.Game.Rulesets.UI;
+using osuTK;
namespace osu.Game.Rulesets.Taiko.Mods
{
- public class TaikoModFlashlight : ModFlashlight
+ public class TaikoModFlashlight : ModFlashlight
{
public override double ScoreMultiplier => 1.12;
+
+ private const float default_flashlight_size = 250;
+
+ public override Flashlight CreateFlashlight() => new TaikoFlashlight(playfield);
+
+ private TaikoPlayfield playfield;
+
+ public override void ApplyToRulesetContainer(RulesetContainer rulesetContainer)
+ {
+ playfield = (TaikoPlayfield)rulesetContainer.Playfield;
+ base.ApplyToRulesetContainer(rulesetContainer);
+ }
+
+ private class TaikoFlashlight : Flashlight
+ {
+ private readonly Cached flashlightProperties = new Cached();
+ private readonly TaikoPlayfield taikoPlayfield;
+
+ public TaikoFlashlight(TaikoPlayfield taikoPlayfield)
+ {
+ this.taikoPlayfield = taikoPlayfield;
+ FlashlightSize = new Vector2(0, getSizeFor(0));
+ }
+
+ private float getSizeFor(int combo)
+ {
+ if (combo > 200)
+ return default_flashlight_size * 0.8f;
+ else if (combo > 100)
+ return default_flashlight_size * 0.9f;
+ else
+ return default_flashlight_size;
+ }
+
+ protected override void OnComboChange(int newCombo)
+ {
+ this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(newCombo)), FLASHLIGHT_FADE_DURATION);
+ }
+
+ protected override string FragmentShader => "CircularFlashlight";
+
+ public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true)
+ {
+ if ((invalidation & Invalidation.DrawSize) > 0)
+ {
+ flashlightProperties.Invalidate();
+ }
+
+ return base.Invalidate(invalidation, source, shallPropagate);
+ }
+
+ protected override void Update()
+ {
+ base.Update();
+
+ if (!flashlightProperties.IsValid)
+ {
+ FlashlightPosition = taikoPlayfield.HitTarget.ToSpaceOfOtherDrawable(taikoPlayfield.HitTarget.OriginPosition, this);
+ flashlightProperties.Validate();
+ }
+ }
+ }
}
}
diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs
index db5f418e18..d6f8522b77 100644
--- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs
+++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs
@@ -3,7 +3,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
-using OpenTK;
+using osuTK;
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLineMajor.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLineMajor.cs
index 300edd2e76..3a1b4e33d2 100644
--- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLineMajor.cs
+++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLineMajor.cs
@@ -3,7 +3,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
-using OpenTK;
+using osuTK;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs
index 5142f125ac..632dff4525 100644
--- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs
+++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs
@@ -6,8 +6,8 @@ using osu.Framework.Allocation;
using osu.Framework.MathUtils;
using osu.Game.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs
index 5059734663..1412bd3cea 100644
--- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs
+++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs
@@ -11,8 +11,8 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Scoring;
diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs
index 51e39dc648..cee9b40730 100644
--- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs
+++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs
@@ -5,7 +5,7 @@ using osu.Framework.Graphics;
using osu.Framework.Input.Bindings;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
-using OpenTK;
+using osuTK;
using System.Linq;
using osu.Game.Audio;
using System.Collections.Generic;
@@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
RelativeSizeAxes = Axes.Both,
Child = Content = new Container { RelativeSizeAxes = Axes.Both }
},
- proxiedContent = new Container { RelativeSizeAxes = Axes.Both }
+ proxiedContent = new ProxiedContentContainer { RelativeSizeAxes = Axes.Both }
};
}
@@ -75,6 +75,12 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
public abstract bool OnPressed(TaikoAction action);
public virtual bool OnReleased(TaikoAction action) => false;
+
+ private class ProxiedContentContainer : Container
+ {
+ public override double LifetimeStart => Parent?.LifetimeStart ?? base.LifetimeStart;
+ public override double LifetimeEnd => Parent?.LifetimeEnd ?? base.LifetimeEnd;
+ }
}
public abstract class DrawableTaikoHitObject : DrawableTaikoHitObject
diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs
index 27e2b3c762..b4cb3a35f6 100644
--- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs
+++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs
@@ -3,7 +3,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
-using OpenTK;
+using osuTK;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs
index 7a4931dc71..fdb73235de 100644
--- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs
+++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs
@@ -6,7 +6,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Backgrounds;
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Game.Beatmaps.ControlPoints;
using osu.Framework.Audio.Track;
diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs
index d3487fb65c..613d8debb5 100644
--- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs
+++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs
@@ -3,8 +3,8 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs
index d70ac64a27..8455f4af58 100644
--- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs
+++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
+using osuTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs
index e630847aec..6795338a83 100644
--- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs
+++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Graphics;
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Game.Graphics.Containers;
using osu.Framework.Graphics;
diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs
index 976836a5ed..7327b9c565 100644
--- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs
+++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs
@@ -3,8 +3,8 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
diff --git a/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs
index 4dd0ba4d3d..84e40427f2 100644
--- a/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs
+++ b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs
@@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Game.Rulesets.Taiko/UI/HitTarget.cs b/osu.Game.Rulesets.Taiko/UI/HitTarget.cs
index 9d824ca5b7..ab5bc841a6 100644
--- a/osu.Game.Rulesets.Taiko/UI/HitTarget.cs
+++ b/osu.Game.Rulesets.Taiko/UI/HitTarget.cs
@@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
diff --git a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs
index 524535bfde..6d84b69638 100644
--- a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs
+++ b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
-using OpenTK;
+using osuTK;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs
index 287d59972a..ad9b967ac6 100644
--- a/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs
+++ b/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
+using osuTK;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Game.Rulesets.Taiko/UI/PlayfieldAdjustmentContainer.cs b/osu.Game.Rulesets.Taiko/UI/PlayfieldAdjustmentContainer.cs
index 661a4e135c..73751e845e 100644
--- a/osu.Game.Rulesets.Taiko/UI/PlayfieldAdjustmentContainer.cs
+++ b/osu.Game.Rulesets.Taiko/UI/PlayfieldAdjustmentContainer.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics.Containers;
-using OpenTK;
+using osuTK;
namespace osu.Game.Rulesets.Taiko.UI
{
diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs
index 40ed659bd6..333b1ba83a 100644
--- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs
+++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs
@@ -8,7 +8,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps.ControlPoints;
-using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Judgements;
@@ -17,8 +16,8 @@ using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.Taiko.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Judgements;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Rulesets.Taiko.UI
{
@@ -39,13 +38,10 @@ namespace osu.Game.Rulesets.Taiko.UI
///
private const float left_area_size = 240;
- protected override bool UserScrollSpeedAdjustment => false;
-
- protected override SpeedChangeVisualisationMethod VisualisationMethod => SpeedChangeVisualisationMethod.Overlapping;
-
private readonly Container hitExplosionContainer;
private readonly Container kiaiExplosionContainer;
private readonly JudgementContainer judgementContainer;
+ internal readonly HitTarget HitTarget;
private readonly Container topLevelHitContainer;
@@ -59,8 +55,6 @@ namespace osu.Game.Rulesets.Taiko.UI
public TaikoPlayfield(ControlPointInfo controlPoints)
{
- Direction.Value = ScrollingDirection.Left;
-
InternalChild = new PlayfieldAdjustmentContainer
{
Anchor = Anchor.CentreLeft,
@@ -109,7 +103,7 @@ namespace osu.Game.Rulesets.Taiko.UI
FillMode = FillMode.Fit,
Blending = BlendingMode.Additive,
},
- new HitTarget
+ HitTarget = new HitTarget
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.Centre,
@@ -200,8 +194,6 @@ namespace osu.Game.Rulesets.Taiko.UI
}
}
};
-
- VisibleTimeRange.Value = 7000;
}
[BackgroundDependencyLoader]
diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs b/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs
index c94ced3390..99c83c243b 100644
--- a/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs
+++ b/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs
@@ -14,6 +14,7 @@ using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.Taiko.Replays;
using System.Linq;
using osu.Framework.Input;
+using osu.Game.Configuration;
using osu.Game.Input.Handlers;
using osu.Game.Rulesets.UI.Scrolling;
@@ -21,9 +22,15 @@ namespace osu.Game.Rulesets.Taiko.UI
{
public class TaikoRulesetContainer : ScrollingRulesetContainer
{
+ protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Overlapping;
+
+ protected override bool UserScrollSpeedAdjustment => false;
+
public TaikoRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap)
: base(ruleset, beatmap)
{
+ Direction.Value = ScrollingDirection.Left;
+ TimeRange.Value = 7000;
}
[BackgroundDependencyLoader]
diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs
index 464cfbf5e9..6d64b25906 100644
--- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs
+++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs
@@ -3,8 +3,8 @@
using System.IO;
using NUnit.Framework;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Game.Tests.Resources;
using System.Linq;
using osu.Game.Audio;
diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyStoryboardDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyStoryboardDecoderTest.cs
index 82adc88c6b..40857198f1 100644
--- a/osu.Game.Tests/Beatmaps/Formats/LegacyStoryboardDecoderTest.cs
+++ b/osu.Game.Tests/Beatmaps/Formats/LegacyStoryboardDecoderTest.cs
@@ -4,7 +4,7 @@
using System.IO;
using System.Linq;
using NUnit.Framework;
-using OpenTK;
+using osuTK;
using osu.Framework.Graphics;
using osu.Game.Beatmaps.Formats;
using osu.Game.Storyboards;
diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs
index 64bd563897..f7e1653cdd 100644
--- a/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs
+++ b/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs
@@ -12,7 +12,7 @@ using osu.Game.IO.Serialization;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Tests.Resources;
-using OpenTK;
+using osuTK;
namespace osu.Game.Tests.Beatmaps.Formats
{
diff --git a/osu.Game.Tests/ScrollAlgorithms/ConstantScrollTest.cs b/osu.Game.Tests/ScrollAlgorithms/ConstantScrollTest.cs
new file mode 100644
index 0000000000..5e01213a48
--- /dev/null
+++ b/osu.Game.Tests/ScrollAlgorithms/ConstantScrollTest.cs
@@ -0,0 +1,54 @@
+// Copyright (c) 2007-2018 ppy Pty Ltd .
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using NUnit.Framework;
+using osu.Game.Rulesets.UI.Scrolling.Algorithms;
+
+namespace osu.Game.Tests.ScrollAlgorithms
+{
+ [TestFixture]
+ public class ConstantScrollTest
+ {
+ private IScrollAlgorithm algorithm;
+
+ [SetUp]
+ public void Setup()
+ {
+ algorithm = new ConstantScrollAlgorithm();
+ }
+
+ [Test]
+ public void TestDisplayStartTime()
+ {
+ Assert.AreEqual(-8000, algorithm.GetDisplayStartTime(2000, 10000));
+ Assert.AreEqual(-3000, algorithm.GetDisplayStartTime(2000, 5000));
+ Assert.AreEqual(2000, algorithm.GetDisplayStartTime(7000, 5000));
+ Assert.AreEqual(7000, algorithm.GetDisplayStartTime(17000, 10000));
+ }
+
+ [Test]
+ public void TestLength()
+ {
+ Assert.AreEqual(1f / 5, algorithm.GetLength(0, 1000, 5000, 1));
+ Assert.AreEqual(1f / 5, algorithm.GetLength(6000, 7000, 5000, 1));
+ }
+
+ [Test]
+ public void TestPosition()
+ {
+ Assert.AreEqual(1f / 5, algorithm.PositionAt(1000, 0, 5000, 1));
+ Assert.AreEqual(1f / 5, algorithm.PositionAt(6000, 5000, 5000, 1));
+ }
+
+ [TestCase(1000)]
+ [TestCase(10000)]
+ [TestCase(15000)]
+ [TestCase(20000)]
+ [TestCase(25000)]
+ public void TestTime(double time)
+ {
+ Assert.AreEqual(time, algorithm.TimeAt(algorithm.PositionAt(time, 0, 5000, 1), 0, 5000, 1), 0.001);
+ Assert.AreEqual(time, algorithm.TimeAt(algorithm.PositionAt(time, 5000, 5000, 1), 5000, 5000, 1), 0.001);
+ }
+ }
+}
diff --git a/osu.Game.Tests/ScrollAlgorithms/OverlappingScrollTest.cs b/osu.Game.Tests/ScrollAlgorithms/OverlappingScrollTest.cs
new file mode 100644
index 0000000000..c1a5a0f3c9
--- /dev/null
+++ b/osu.Game.Tests/ScrollAlgorithms/OverlappingScrollTest.cs
@@ -0,0 +1,67 @@
+// Copyright (c) 2007-2018 ppy Pty Ltd .
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using NUnit.Framework;
+using osu.Framework.Lists;
+using osu.Game.Rulesets.Timing;
+using osu.Game.Rulesets.UI.Scrolling.Algorithms;
+
+namespace osu.Game.Tests.ScrollAlgorithms
+{
+ [TestFixture]
+ public class OverlappingScrollTest
+ {
+ private IScrollAlgorithm algorithm;
+
+ [SetUp]
+ public void Setup()
+ {
+ var controlPoints = new SortedList
+ {
+ new MultiplierControlPoint(0) { Velocity = 1 },
+ new MultiplierControlPoint(10000) { Velocity = 2f },
+ new MultiplierControlPoint(20000) { Velocity = 0.5f }
+ };
+
+ algorithm = new OverlappingScrollAlgorithm(controlPoints);
+ }
+
+ [Test]
+ public void TestDisplayStartTime()
+ {
+ Assert.AreEqual(1000, algorithm.GetDisplayStartTime(2000, 1000)); // Like constant
+ Assert.AreEqual(10000, algorithm.GetDisplayStartTime(10500, 1000)); // 10500 - (1000 * 0.5)
+ Assert.AreEqual(20000, algorithm.GetDisplayStartTime(22000, 1000)); // 23000 - (1000 / 0.5)
+ }
+
+ [Test]
+ public void TestLength()
+ {
+ Assert.AreEqual(1f / 5, algorithm.GetLength(0, 1000, 5000, 1)); // Like constant
+ Assert.AreEqual(1f / 5, algorithm.GetLength(10000, 10500, 5000, 1)); // (10500 - 10000) / 0.5 / 5000
+ Assert.AreEqual(1f / 5, algorithm.GetLength(20000, 22000, 5000, 1)); // (22000 - 20000) * 0.5 / 5000
+ }
+
+ [Test]
+ public void TestPosition()
+ {
+ // Basically same calculations as TestLength()
+ Assert.AreEqual(1f / 5, algorithm.PositionAt(1000, 0, 5000, 1));
+ Assert.AreEqual(1f / 5, algorithm.PositionAt(10500, 10000, 5000, 1));
+ Assert.AreEqual(1f / 5, algorithm.PositionAt(22000, 20000, 5000, 1));
+ }
+
+ [TestCase(1000)]
+ [TestCase(10000)]
+ [TestCase(15000)]
+ [TestCase(20000)]
+ [TestCase(25000)]
+ [Ignore("Disabled for now because overlapping control points have multiple time values under the same position."
+ + "Ideally, scrolling should be changed to constant or sequential during editing of hitobjects.")]
+ public void TestTime(double time)
+ {
+ Assert.AreEqual(time, algorithm.TimeAt(algorithm.PositionAt(time, 0, 5000, 1), 0, 5000, 1), 0.001);
+ Assert.AreEqual(time, algorithm.TimeAt(algorithm.PositionAt(time, 5000, 5000, 1), 5000, 5000, 1), 0.001);
+ }
+ }
+}
diff --git a/osu.Game.Tests/ScrollAlgorithms/SequentialScrollTest.cs b/osu.Game.Tests/ScrollAlgorithms/SequentialScrollTest.cs
new file mode 100644
index 0000000000..990fb92e6c
--- /dev/null
+++ b/osu.Game.Tests/ScrollAlgorithms/SequentialScrollTest.cs
@@ -0,0 +1,64 @@
+// Copyright (c) 2007-2018 ppy Pty Ltd .
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using NUnit.Framework;
+using osu.Framework.Lists;
+using osu.Game.Rulesets.Timing;
+using osu.Game.Rulesets.UI.Scrolling.Algorithms;
+
+namespace osu.Game.Tests.ScrollAlgorithms
+{
+ [TestFixture]
+ public class SequentialScrollTest
+ {
+ private IScrollAlgorithm algorithm;
+
+ [SetUp]
+ public void Setup()
+ {
+ var controlPoints = new SortedList
+ {
+ new MultiplierControlPoint(0) { Velocity = 1 },
+ new MultiplierControlPoint(10000) { Velocity = 2f },
+ new MultiplierControlPoint(20000) { Velocity = 0.5f }
+ };
+
+ algorithm = new SequentialScrollAlgorithm(controlPoints);
+ }
+
+ [Test]
+ public void TestDisplayStartTime()
+ {
+ // Sequential scroll algorithm approximates the start time
+ // This should be fixed in the future
+ }
+
+ [Test]
+ public void TestLength()
+ {
+ Assert.AreEqual(1f / 5, algorithm.GetLength(0, 1000, 5000, 1)); // Like constant
+ Assert.AreEqual(1f / 5, algorithm.GetLength(10000, 10500, 5000, 1)); // (10500 - 10000) / 0.5 / 5000
+ Assert.AreEqual(1f / 5, algorithm.GetLength(20000, 22000, 5000, 1)); // (22000 - 20000) * 0.5 / 5000
+ }
+
+ [Test]
+ public void TestPosition()
+ {
+ // Basically same calculations as TestLength()
+ Assert.AreEqual(1f / 5, algorithm.PositionAt(1000, 0, 5000, 1));
+ Assert.AreEqual(1f / 5, algorithm.PositionAt(10500, 10000, 5000, 1));
+ Assert.AreEqual(1f / 5, algorithm.PositionAt(22000, 20000, 5000, 1));
+ }
+
+ [TestCase(1000)]
+ [TestCase(10000)]
+ [TestCase(15000)]
+ [TestCase(20000)]
+ [TestCase(25000)]
+ public void TestTime(double time)
+ {
+ Assert.AreEqual(time, algorithm.TimeAt(algorithm.PositionAt(time, 0, 5000, 1), 0, 5000, 1), 0.001);
+ Assert.AreEqual(time, algorithm.TimeAt(algorithm.PositionAt(time, 5000, 5000, 1), 5000, 5000, 1), 0.001);
+ }
+ }
+}
diff --git a/osu.Game.Tests/Visual/TestCaseBeatDivisorControl.cs b/osu.Game.Tests/Visual/TestCaseBeatDivisorControl.cs
index 6c607acd11..c11bb5d17b 100644
--- a/osu.Game.Tests/Visual/TestCaseBeatDivisorControl.cs
+++ b/osu.Game.Tests/Visual/TestCaseBeatDivisorControl.cs
@@ -7,7 +7,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Compose.Components;
-using OpenTK;
+using osuTK;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs b/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs
index 596b7839e0..ff383b6723 100644
--- a/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs
+++ b/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs
@@ -13,7 +13,7 @@ using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays;
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Lists;
namespace osu.Game.Tests.Visual
diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapDetailArea.cs b/osu.Game.Tests/Visual/TestCaseBeatmapDetailArea.cs
index 41d85673f8..4d19667926 100644
--- a/osu.Game.Tests/Visual/TestCaseBeatmapDetailArea.cs
+++ b/osu.Game.Tests/Visual/TestCaseBeatmapDetailArea.cs
@@ -4,7 +4,7 @@
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Screens.Select;
-using OpenTK;
+using osuTK;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs
index 175db7d246..35cdfda92c 100644
--- a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs
+++ b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs
@@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using NUnit.Framework;
-using OpenTK;
+using osuTK;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapOptionsOverlay.cs b/osu.Game.Tests/Visual/TestCaseBeatmapOptionsOverlay.cs
index ffa433ef11..a56b82d887 100644
--- a/osu.Game.Tests/Visual/TestCaseBeatmapOptionsOverlay.cs
+++ b/osu.Game.Tests/Visual/TestCaseBeatmapOptionsOverlay.cs
@@ -4,8 +4,8 @@
using System.ComponentModel;
using osu.Game.Graphics;
using osu.Game.Screens.Select.Options;
-using OpenTK.Graphics;
-using OpenTK.Input;
+using osuTK.Graphics;
+using osuTK.Input;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseButtonSystem.cs b/osu.Game.Tests/Visual/TestCaseButtonSystem.cs
index 7f8133d638..0506783310 100644
--- a/osu.Game.Tests/Visual/TestCaseButtonSystem.cs
+++ b/osu.Game.Tests/Visual/TestCaseButtonSystem.cs
@@ -9,7 +9,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Shapes;
using osu.Game.Screens.Menu;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseChannelTabControl.cs b/osu.Game.Tests/Visual/TestCaseChannelTabControl.cs
new file mode 100644
index 0000000000..447337bef0
--- /dev/null
+++ b/osu.Game.Tests/Visual/TestCaseChannelTabControl.cs
@@ -0,0 +1,123 @@
+// Copyright (c) 2007-2018 ppy Pty Ltd .
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+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.MathUtils;
+using osu.Game.Online.API;
+using osu.Game.Online.API.Requests;
+using osu.Game.Online.Chat;
+using osu.Game.Overlays.Chat.Tabs;
+using osu.Game.Users;
+using osuTK.Graphics;
+
+namespace osu.Game.Tests.Visual
+{
+ public class TestCaseChannelTabControl : OsuTestCase
+ {
+ public override IReadOnlyList RequiredTypes => new[]
+ {
+ typeof(ChannelTabControl),
+ };
+
+ private readonly ChannelTabControl channelTabControl;
+
+ public TestCaseChannelTabControl()
+ {
+ SpriteText currentText;
+ Add(new Container
+ {
+ RelativeSizeAxes = Axes.X,
+ Origin = Anchor.Centre,
+ Anchor = Anchor.Centre,
+ Children = new Drawable[]
+ {
+ channelTabControl = new ChannelTabControl
+ {
+ RelativeSizeAxes = Axes.X,
+ Origin = Anchor.Centre,
+ Anchor = Anchor.Centre,
+ Height = 50
+ },
+ new Box
+ {
+ Colour = Color4.Black.Opacity(0.1f),
+ RelativeSizeAxes = Axes.X,
+ Height = 50,
+ Depth = -1,
+ Origin = Anchor.Centre,
+ Anchor = Anchor.Centre,
+ }
+ }
+ });
+
+ Add(new Container
+ {
+ Origin = Anchor.TopLeft,
+ Anchor = Anchor.TopLeft,
+ Children = new Drawable[]
+ {
+ currentText = new SpriteText
+ {
+ Text = "Currently selected channel:"
+ }
+ }
+ });
+
+ channelTabControl.OnRequestLeave += channel => channelTabControl.RemoveChannel(channel);
+ channelTabControl.Current.ValueChanged += channel => currentText.Text = "Currently selected channel: " + channel.ToString();
+
+ AddStep("Add random private channel", addRandomUser);
+ AddAssert("There is only one channels", () => channelTabControl.Items.Count() == 2);
+ AddRepeatStep("Add 3 random private channels", addRandomUser, 3);
+ AddAssert("There are four channels", () => channelTabControl.Items.Count() == 5);
+ AddStep("Add random public channel", () => addChannel(RNG.Next().ToString()));
+
+ AddRepeatStep("Select a random channel", () => channelTabControl.Current.Value = channelTabControl.Items.ElementAt(RNG.Next(channelTabControl.Items.Count())), 20);
+ }
+
+ private List users;
+
+ private void addRandomUser()
+ {
+ channelTabControl.AddChannel(new Channel
+ {
+ Users =
+ {
+ users?.Count > 0
+ ? users[RNG.Next(0, users.Count - 1)]
+ : new User
+ {
+ Id = RNG.Next(),
+ Username = "testuser" + RNG.Next(1000)
+ }
+ }
+ });
+ }
+
+ private void addChannel(string name)
+ {
+ channelTabControl.AddChannel(new Channel
+ {
+ Type = ChannelType.Public,
+ Name = name
+ });
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(IAPIProvider api)
+ {
+ GetUsersRequest req = new GetUsersRequest();
+ req.Success += list => users = list.Select(e => e.User).ToList();
+
+ api.Queue(req);
+ }
+ }
+}
diff --git a/osu.Game.Tests/Visual/TestCaseChatDisplay.cs b/osu.Game.Tests/Visual/TestCaseChatDisplay.cs
index c03b12bdc1..e3bd4026b3 100644
--- a/osu.Game.Tests/Visual/TestCaseChatDisplay.cs
+++ b/osu.Game.Tests/Visual/TestCaseChatDisplay.cs
@@ -1,21 +1,45 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+using System;
+using System.Collections.Generic;
using System.ComponentModel;
+using osu.Framework.Allocation;
+using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
+using osu.Game.Online.Chat;
using osu.Game.Overlays;
+using osu.Game.Overlays.Chat;
+using osu.Game.Overlays.Chat.Tabs;
namespace osu.Game.Tests.Visual
{
[Description("Testing chat api and overlay")]
public class TestCaseChatDisplay : OsuTestCase
{
- public TestCaseChatDisplay()
+ public override IReadOnlyList RequiredTypes => new[]
{
- Add(new ChatOverlay
+ typeof(ChatOverlay),
+ typeof(ChatLine),
+ typeof(DrawableChannel),
+ typeof(ChannelSelectorTabItem),
+ typeof(ChannelTabControl),
+ typeof(ChannelTabItem),
+ typeof(PrivateChannelTabItem),
+ typeof(TabCloseButton)
+ };
+
+ [Cached]
+ private readonly ChannelManager channelManager = new ChannelManager();
+
+ [BackgroundDependencyLoader]
+ private void load()
+ {
+ Children = new Drawable[]
{
- State = Visibility.Visible
- });
+ channelManager,
+ new ChatOverlay { State = Visibility.Visible }
+ };
}
}
}
diff --git a/osu.Game.Tests/Visual/TestCaseChatLink.cs b/osu.Game.Tests/Visual/TestCaseChatLink.cs
index 12a7ee9c12..eddcd16b93 100644
--- a/osu.Game.Tests/Visual/TestCaseChatLink.cs
+++ b/osu.Game.Tests/Visual/TestCaseChatLink.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -23,6 +23,7 @@ namespace osu.Game.Tests.Visual
public class TestCaseChatLink : OsuTestCase
{
private readonly TestChatLineContainer textContainer;
+ private readonly DialogOverlay dialogOverlay;
private Color4 linkColour;
public override IReadOnlyList RequiredTypes => new[]
@@ -37,6 +38,7 @@ namespace osu.Game.Tests.Visual
public TestCaseChatLink()
{
+ Add(dialogOverlay = new DialogOverlay { Depth = float.MinValue });
Add(textContainer = new TestChatLineContainer
{
Padding = new MarginPadding { Left = 20, Right = 20 },
@@ -50,14 +52,14 @@ namespace osu.Game.Tests.Visual
private void load(OsuColour colours)
{
linkColour = colours.Blue;
- Dependencies.Cache(new ChatOverlay
- {
- AvailableChannels =
- {
- new Channel { Name = "#english" },
- new Channel { Name = "#japanese" }
- }
- });
+
+ var chatManager = new ChannelManager();
+ chatManager.AvailableChannels.Add(new Channel { Name = "#english"});
+ chatManager.AvailableChannels.Add(new Channel { Name = "#japanese" });
+ Dependencies.Cache(chatManager);
+
+ Dependencies.Cache(new ChatOverlay());
+ Dependencies.Cache(dialogOverlay);
testLinksGeneral();
testEcho();
diff --git a/osu.Game.Tests/Visual/TestCaseContextMenu.cs b/osu.Game.Tests/Visual/TestCaseContextMenu.cs
index 80505b219b..a0d0eaf015 100644
--- a/osu.Game.Tests/Visual/TestCaseContextMenu.cs
+++ b/osu.Game.Tests/Visual/TestCaseContextMenu.cs
@@ -8,8 +8,8 @@ using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Game.Graphics.Cursor;
namespace osu.Game.Tests.Visual
diff --git a/osu.Game.Tests/Visual/TestCaseCursors.cs b/osu.Game.Tests/Visual/TestCaseCursors.cs
index 1f409f043e..293ca392ab 100644
--- a/osu.Game.Tests/Visual/TestCaseCursors.cs
+++ b/osu.Game.Tests/Visual/TestCaseCursors.cs
@@ -11,8 +11,8 @@ using osu.Framework.Input.Events;
using osu.Framework.MathUtils;
using osu.Game.Graphics.Cursor;
using osu.Game.Graphics.Sprites;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseDisclaimer.cs b/osu.Game.Tests/Visual/TestCaseDisclaimer.cs
index a8253a991a..b6b9a7adb4 100644
--- a/osu.Game.Tests/Visual/TestCaseDisclaimer.cs
+++ b/osu.Game.Tests/Visual/TestCaseDisclaimer.cs
@@ -5,7 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Screens.Menu;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs b/osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs
index d2c1127f4c..f548dfe666 100644
--- a/osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs
+++ b/osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
-using OpenTK;
+using osuTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@@ -14,7 +14,7 @@ using osu.Framework.Graphics.UserInterface;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseEditorSeekSnapping.cs b/osu.Game.Tests/Visual/TestCaseEditorSeekSnapping.cs
index dace6e20ef..8bbbe6b918 100644
--- a/osu.Game.Tests/Visual/TestCaseEditorSeekSnapping.cs
+++ b/osu.Game.Tests/Visual/TestCaseEditorSeekSnapping.cs
@@ -11,8 +11,8 @@ using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Tests.Beatmaps;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs b/osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs
index cafd1b6f1a..ff28a0aad2 100644
--- a/osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs
+++ b/osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
-using OpenTK;
+using osuTK;
using osu.Game.Screens.Edit.Components.Timelines.Summary;
using osu.Game.Rulesets.Osu;
using osu.Game.Tests.Beatmaps;
diff --git a/osu.Game.Tests/Visual/TestCaseExternalLinkButton.cs b/osu.Game.Tests/Visual/TestCaseExternalLinkButton.cs
index 7d8535f428..07bc59b29c 100644
--- a/osu.Game.Tests/Visual/TestCaseExternalLinkButton.cs
+++ b/osu.Game.Tests/Visual/TestCaseExternalLinkButton.cs
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using osu.Game.Graphics.UserInterface;
-using OpenTK;
+using osuTK;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs
index 417b0f94d7..ee97ff7af7 100644
--- a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs
+++ b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs
@@ -5,12 +5,12 @@ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
-using OpenTK.Input;
+using osuTK.Input;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers;
using osu.Framework.Logging;
using osu.Game.Screens.Play;
-using OpenTK;
+using osuTK;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseGraph.cs b/osu.Game.Tests/Visual/TestCaseGraph.cs
index 40b05d51e6..0b0a80648b 100644
--- a/osu.Game.Tests/Visual/TestCaseGraph.cs
+++ b/osu.Game.Tests/Visual/TestCaseGraph.cs
@@ -5,7 +5,7 @@ using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
-using OpenTK;
+using osuTK;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs
index d894d2738e..4109b72989 100644
--- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs
+++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs
@@ -7,7 +7,7 @@ using JetBrains.Annotations;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Timing;
-using OpenTK;
+using osuTK;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
diff --git a/osu.Game.Tests/Visual/TestCaseQuitButton.cs b/osu.Game.Tests/Visual/TestCaseHoldForMenuButton.cs
similarity index 75%
rename from osu.Game.Tests/Visual/TestCaseQuitButton.cs
rename to osu.Game.Tests/Visual/TestCaseHoldForMenuButton.cs
index a427b7a20a..944921bc2e 100644
--- a/osu.Game.Tests/Visual/TestCaseQuitButton.cs
+++ b/osu.Game.Tests/Visual/TestCaseHoldForMenuButton.cs
@@ -7,31 +7,31 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Screens.Play.HUD;
-using OpenTK;
-using OpenTK.Input;
+using osuTK;
+using osuTK.Input;
namespace osu.Game.Tests.Visual
{
[Description("'Hold to Quit' UI element")]
- public class TestCaseQuitButton : ManualInputManagerTestCase
+ public class TestCaseHoldForMenuButton : ManualInputManagerTestCase
{
private bool exitAction;
[BackgroundDependencyLoader]
private void load()
{
- QuitButton quitButton;
+ HoldForMenuButton holdForMenuButton;
- Add(quitButton = new QuitButton
+ Add(holdForMenuButton = new HoldForMenuButton
{
Origin = Anchor.BottomRight,
Anchor = Anchor.BottomRight,
Action = () => exitAction = true
});
- var text = quitButton.Children.OfType().First();
+ var text = holdForMenuButton.Children.OfType().First();
- AddStep("Trigger text fade in", () => InputManager.MoveMouseTo(quitButton));
+ AddStep("Trigger text fade in", () => InputManager.MoveMouseTo(holdForMenuButton));
AddUntilStep(() => text.IsPresent && !exitAction, "Text visible");
AddStep("Trigger text fade out", () => InputManager.MoveMouseTo(Vector2.One));
AddUntilStep(() => !text.IsPresent && !exitAction, "Text is not visible");
@@ -39,7 +39,7 @@ namespace osu.Game.Tests.Visual
AddStep("Trigger exit action", () =>
{
exitAction = false;
- InputManager.MoveMouseTo(quitButton);
+ InputManager.MoveMouseTo(holdForMenuButton);
InputManager.PressButton(MouseButton.Left);
});
@@ -47,7 +47,7 @@ namespace osu.Game.Tests.Visual
AddAssert("action not triggered", () => !exitAction);
AddStep("Trigger exit action", () => InputManager.PressButton(MouseButton.Left));
- AddUntilStep(() => exitAction, $"{nameof(quitButton.Action)} was triggered");
+ AddUntilStep(() => exitAction, $"{nameof(holdForMenuButton.Action)} was triggered");
}
}
}
diff --git a/osu.Game.Tests/Visual/TestCaseIconButton.cs b/osu.Game.Tests/Visual/TestCaseIconButton.cs
index 14cba71ec8..d1f0727af5 100644
--- a/osu.Game.Tests/Visual/TestCaseIconButton.cs
+++ b/osu.Game.Tests/Visual/TestCaseIconButton.cs
@@ -2,8 +2,8 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using NUnit.Framework;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
diff --git a/osu.Game.Tests/Visual/TestCaseIntroSequence.cs b/osu.Game.Tests/Visual/TestCaseIntroSequence.cs
index 4982686505..9ce8a4ddd6 100644
--- a/osu.Game.Tests/Visual/TestCaseIntroSequence.cs
+++ b/osu.Game.Tests/Visual/TestCaseIntroSequence.cs
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using NUnit.Framework;
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
diff --git a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs
index 178b47ed33..465b943651 100644
--- a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs
+++ b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs
@@ -9,7 +9,7 @@ using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Framework.Timing;
using osu.Game.Screens.Play;
-using OpenTK.Input;
+using osuTK.Input;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseLeaderboard.cs b/osu.Game.Tests/Visual/TestCaseLeaderboard.cs
index e8ac19e7fc..d4a2fcc62c 100644
--- a/osu.Game.Tests/Visual/TestCaseLeaderboard.cs
+++ b/osu.Game.Tests/Visual/TestCaseLeaderboard.cs
@@ -9,7 +9,7 @@ using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Users;
using osu.Framework.Allocation;
-using OpenTK;
+using osuTK;
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
diff --git a/osu.Game.Tests/Visual/TestCaseLoaderAnimation.cs b/osu.Game.Tests/Visual/TestCaseLoaderAnimation.cs
index 600784f8db..da2427ff6f 100644
--- a/osu.Game.Tests/Visual/TestCaseLoaderAnimation.cs
+++ b/osu.Game.Tests/Visual/TestCaseLoaderAnimation.cs
@@ -6,7 +6,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Screens;
using osu.Game.Screens.Menu;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseLoadingAnimation.cs b/osu.Game.Tests/Visual/TestCaseLoadingAnimation.cs
index ebbc673d36..e52564c40d 100644
--- a/osu.Game.Tests/Visual/TestCaseLoadingAnimation.cs
+++ b/osu.Game.Tests/Visual/TestCaseLoadingAnimation.cs
@@ -5,7 +5,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Testing;
using osu.Game.Graphics.UserInterface;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseLounge.cs b/osu.Game.Tests/Visual/TestCaseLounge.cs
index 174873b011..e0e6332ef0 100644
--- a/osu.Game.Tests/Visual/TestCaseLounge.cs
+++ b/osu.Game.Tests/Visual/TestCaseLounge.cs
@@ -13,7 +13,7 @@ using osu.Game.Screens.Backgrounds;
using osu.Game.Screens.Multi.Components;
using osu.Game.Screens.Multi.Screens.Lounge;
using osu.Game.Users;
-using OpenTK.Input;
+using osuTK.Input;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseMods.cs b/osu.Game.Tests/Visual/TestCaseMods.cs
index ab53dbd968..029f7da5a9 100644
--- a/osu.Game.Tests/Visual/TestCaseMods.cs
+++ b/osu.Game.Tests/Visual/TestCaseMods.cs
@@ -7,7 +7,7 @@ using osu.Framework.Graphics;
using osu.Game.Overlays.Mods;
using osu.Game.Rulesets;
using osu.Game.Screens.Play.HUD;
-using OpenTK;
+using osuTK;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Mods;
using System.Linq;
@@ -19,7 +19,7 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Overlays.Mods.Sections;
using osu.Game.Rulesets.Mania.Mods;
using osu.Game.Rulesets.UI;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseOsuGame.cs b/osu.Game.Tests/Visual/TestCaseOsuGame.cs
index 7a4e4c1210..924a2b5e15 100644
--- a/osu.Game.Tests/Visual/TestCaseOsuGame.cs
+++ b/osu.Game.Tests/Visual/TestCaseOsuGame.cs
@@ -8,7 +8,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Screens;
using osu.Game.Screens.Menu;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCasePlaybackControl.cs b/osu.Game.Tests/Visual/TestCasePlaybackControl.cs
index 36fb1bcedd..4352b2bc3a 100644
--- a/osu.Game.Tests/Visual/TestCasePlaybackControl.cs
+++ b/osu.Game.Tests/Visual/TestCasePlaybackControl.cs
@@ -8,7 +8,7 @@ using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Screens.Edit.Components;
using osu.Game.Tests.Beatmaps;
-using OpenTK;
+using osuTK;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseRankGraph.cs b/osu.Game.Tests/Visual/TestCaseRankGraph.cs
index f5558620ad..f8eea7d63c 100644
--- a/osu.Game.Tests/Visual/TestCaseRankGraph.cs
+++ b/osu.Game.Tests/Visual/TestCaseRankGraph.cs
@@ -3,7 +3,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
-using OpenTK;
+using osuTK;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using System.Collections.Generic;
diff --git a/osu.Game.Tests/Visual/TestCaseScoreCounter.cs b/osu.Game.Tests/Visual/TestCaseScoreCounter.cs
index 4dff7547d9..c32ca104ed 100644
--- a/osu.Game.Tests/Visual/TestCaseScoreCounter.cs
+++ b/osu.Game.Tests/Visual/TestCaseScoreCounter.cs
@@ -7,7 +7,7 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.MathUtils;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Play.HUD;
-using OpenTK;
+using osuTK;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs b/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs
index b70117a3ad..82da609e49 100644
--- a/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs
+++ b/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs
@@ -11,7 +11,7 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens;
-using OpenTK;
+using osuTK;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs b/osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs
index b254325472..3ac85cd846 100644
--- a/osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs
+++ b/osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs
@@ -5,10 +5,11 @@ using System;
using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Extensions.IEnumerableExtensions;
-using OpenTK;
+using osuTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
+using osu.Game.Configuration;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Timing;
@@ -22,6 +23,7 @@ namespace osu.Game.Tests.Visual
{
public override IReadOnlyList RequiredTypes => new[] { typeof(Playfield) };
+ private readonly ScrollingTestContainer[] scrollContainers = new ScrollingTestContainer[4];
private readonly TestPlayfield[] playfields = new TestPlayfield[4];
public TestCaseScrollingHitObjects()
@@ -33,18 +35,38 @@ namespace osu.Game.Tests.Visual
{
new Drawable[]
{
- playfields[0] = new TestPlayfield(ScrollingDirection.Up),
- playfields[1] = new TestPlayfield(ScrollingDirection.Down)
+ scrollContainers[0] = new ScrollingTestContainer(ScrollingDirection.Up)
+ {
+ RelativeSizeAxes = Axes.Both,
+ Child = playfields[0] = new TestPlayfield()
+ },
+ scrollContainers[1] = new ScrollingTestContainer(ScrollingDirection.Up)
+ {
+ RelativeSizeAxes = Axes.Both,
+ Child = playfields[1] = new TestPlayfield()
+ },
},
new Drawable[]
{
- playfields[2] = new TestPlayfield(ScrollingDirection.Left),
- playfields[3] = new TestPlayfield(ScrollingDirection.Right)
+ scrollContainers[2] = new ScrollingTestContainer(ScrollingDirection.Up)
+ {
+ RelativeSizeAxes = Axes.Both,
+ Child = playfields[2] = new TestPlayfield()
+ },
+ scrollContainers[3] = new ScrollingTestContainer(ScrollingDirection.Up)
+ {
+ RelativeSizeAxes = Axes.Both,
+ Child = playfields[3] = new TestPlayfield()
+ }
}
}
});
- AddSliderStep("Time range", 100, 10000, 5000, v => playfields.ForEach(p => p.VisibleTimeRange.Value = v));
+ AddStep("Constant scroll", () => setScrollAlgorithm(ScrollVisualisationMethod.Constant));
+ AddStep("Overlapping scroll", () => setScrollAlgorithm(ScrollVisualisationMethod.Overlapping));
+ AddStep("Sequential scroll", () => setScrollAlgorithm(ScrollVisualisationMethod.Sequential));
+
+ AddSliderStep("Time range", 100, 10000, 5000, v => scrollContainers.ForEach(c => c.TimeRange = v));
AddStep("Add control point", () => addControlPoint(Time.Current + 5000));
}
@@ -52,7 +74,7 @@ namespace osu.Game.Tests.Visual
{
base.LoadComplete();
- playfields.ForEach(p => p.HitObjects.AddControlPoint(new MultiplierControlPoint(0)));
+ scrollContainers.ForEach(c => c.ControlPoints.Add(new MultiplierControlPoint(0)));
for (int i = 0; i <= 5000; i += 1000)
addHitObject(Time.Current + i);
@@ -73,12 +95,15 @@ namespace osu.Game.Tests.Visual
private void addControlPoint(double time)
{
+ scrollContainers.ForEach(c =>
+ {
+ c.ControlPoints.Add(new MultiplierControlPoint(time) { DifficultyPoint = { SpeedMultiplier = 3 } });
+ c.ControlPoints.Add(new MultiplierControlPoint(time + 2000) { DifficultyPoint = { SpeedMultiplier = 2 } });
+ c.ControlPoints.Add(new MultiplierControlPoint(time + 3000) { DifficultyPoint = { SpeedMultiplier = 1 } });
+ });
+
playfields.ForEach(p =>
{
- p.HitObjects.AddControlPoint(new MultiplierControlPoint(time) { DifficultyPoint = { SpeedMultiplier = 3 } });
- p.HitObjects.AddControlPoint(new MultiplierControlPoint(time + 2000) { DifficultyPoint = { SpeedMultiplier = 2 } });
- p.HitObjects.AddControlPoint(new MultiplierControlPoint(time + 3000) { DifficultyPoint = { SpeedMultiplier = 1 } });
-
TestDrawableControlPoint createDrawablePoint(double t)
{
var obj = new TestDrawableControlPoint(p.Direction, t);
@@ -111,15 +136,14 @@ namespace osu.Game.Tests.Visual
}
}
+ private void setScrollAlgorithm(ScrollVisualisationMethod algorithm) => scrollContainers.ForEach(c => c.ScrollAlgorithm = algorithm);
private class TestPlayfield : ScrollingPlayfield
{
- public new readonly ScrollingDirection Direction;
+ public new ScrollingDirection Direction => base.Direction.Value;
- public TestPlayfield(ScrollingDirection direction)
+ public TestPlayfield()
{
- Direction = direction;
-
Padding = new MarginPadding(2);
InternalChildren = new Drawable[]
diff --git a/osu.Game.Tests/Visual/TestCaseStoryboard.cs b/osu.Game.Tests/Visual/TestCaseStoryboard.cs
index b63881ffa7..42c0134afa 100644
--- a/osu.Game.Tests/Visual/TestCaseStoryboard.cs
+++ b/osu.Game.Tests/Visual/TestCaseStoryboard.cs
@@ -10,7 +10,7 @@ using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Overlays;
using osu.Game.Storyboards.Drawables;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseTabControl.cs b/osu.Game.Tests/Visual/TestCaseTabControl.cs
index 63708c5662..00b69fd415 100644
--- a/osu.Game.Tests/Visual/TestCaseTabControl.cs
+++ b/osu.Game.Tests/Visual/TestCaseTabControl.cs
@@ -6,7 +6,7 @@ using osu.Framework.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Select.Filter;
-using OpenTK;
+using osuTK;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseTextAwesome.cs b/osu.Game.Tests/Visual/TestCaseTextAwesome.cs
index 75b149af29..50ebd3a6e5 100644
--- a/osu.Game.Tests/Visual/TestCaseTextAwesome.cs
+++ b/osu.Game.Tests/Visual/TestCaseTextAwesome.cs
@@ -7,7 +7,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Game.Graphics;
-using OpenTK;
+using osuTK;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseUserPanel.cs b/osu.Game.Tests/Visual/TestCaseUserPanel.cs
index 8e2e708cc7..a53af247f3 100644
--- a/osu.Game.Tests/Visual/TestCaseUserPanel.cs
+++ b/osu.Game.Tests/Visual/TestCaseUserPanel.cs
@@ -5,7 +5,7 @@ using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Users;
-using OpenTK;
+using osuTK;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseVolumePieces.cs b/osu.Game.Tests/Visual/TestCaseVolumePieces.cs
index 3c5b91ccd2..5d7b7088e7 100644
--- a/osu.Game.Tests/Visual/TestCaseVolumePieces.cs
+++ b/osu.Game.Tests/Visual/TestCaseVolumePieces.cs
@@ -5,8 +5,8 @@ using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Game.Overlays.Volume;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseWaveContainer.cs b/osu.Game.Tests/Visual/TestCaseWaveContainer.cs
index 2163d7c3aa..69f1e33579 100644
--- a/osu.Game.Tests/Visual/TestCaseWaveContainer.cs
+++ b/osu.Game.Tests/Visual/TestCaseWaveContainer.cs
@@ -9,8 +9,8 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game.Tests/Visual/TestCaseWaveform.cs b/osu.Game.Tests/Visual/TestCaseWaveform.cs
index 46d46863ad..f97091e58d 100644
--- a/osu.Game.Tests/Visual/TestCaseWaveform.cs
+++ b/osu.Game.Tests/Visual/TestCaseWaveform.cs
@@ -2,8 +2,8 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using NUnit.Framework;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Audio;
diff --git a/osu.Game.Tests/Visual/TestCaseZoomableScrollContainer.cs b/osu.Game.Tests/Visual/TestCaseZoomableScrollContainer.cs
index 3bf809ebde..7dca99685e 100644
--- a/osu.Game.Tests/Visual/TestCaseZoomableScrollContainer.cs
+++ b/osu.Game.Tests/Visual/TestCaseZoomableScrollContainer.cs
@@ -11,8 +11,8 @@ using osu.Framework.MathUtils;
using osu.Game.Graphics;
using osu.Game.Graphics.Cursor;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Tests.Visual
{
diff --git a/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs
index 526bddf51a..dc981cd934 100644
--- a/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs
+++ b/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
+using osuTK;
namespace osu.Game.Beatmaps.ControlPoints
{
diff --git a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs
index 81eddaa43a..ecd7ff252c 100644
--- a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs
+++ b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
+using osuTK;
using osu.Game.Beatmaps.Timing;
namespace osu.Game.Beatmaps.ControlPoints
diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs
index 5b5dbec9c8..160d081b8a 100644
--- a/osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs
+++ b/osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs
@@ -78,17 +78,17 @@ namespace osu.Game.Beatmaps.Drawables
}
}
- private void setAdded(BeatmapSetInfo s)
+ private void setAdded(BeatmapSetInfo s) => Schedule(() =>
{
if (s.OnlineBeatmapSetID == set.OnlineBeatmapSetID)
DownloadState.Value = DownloadStatus.Downloaded;
- }
+ });
- private void setRemoved(BeatmapSetInfo s)
+ private void setRemoved(BeatmapSetInfo s) => Schedule(() =>
{
if (s.OnlineBeatmapSetID == set.OnlineBeatmapSetID)
DownloadState.Value = DownloadStatus.NotDownloaded;
- }
+ });
private void downloadBegan(DownloadBeatmapSetRequest d)
{
diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs
index da281b4db3..a7dff1aefc 100644
--- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs
+++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs
@@ -5,7 +5,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Sprites;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Beatmaps.Drawables
{
diff --git a/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs b/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs
index 7d00c35862..0d421ff690 100644
--- a/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs
+++ b/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs
@@ -5,7 +5,7 @@ using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Beatmaps.Drawables
{
diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs
index 24604711d4..14162c35c0 100644
--- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs
+++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs
@@ -9,8 +9,8 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Beatmaps.Drawables
{
diff --git a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs
index 1976db907c..9a1617b550 100644
--- a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs
+++ b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs
@@ -4,7 +4,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Beatmaps.Drawables
{
diff --git a/osu.Game/Beatmaps/Formats/IHasComboColours.cs b/osu.Game/Beatmaps/Formats/IHasComboColours.cs
index d3377c2717..d47377dc8d 100644
--- a/osu.Game/Beatmaps/Formats/IHasComboColours.cs
+++ b/osu.Game/Beatmaps/Formats/IHasComboColours.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Beatmaps.Formats
{
diff --git a/osu.Game/Beatmaps/Formats/IHasCustomColours.cs b/osu.Game/Beatmaps/Formats/IHasCustomColours.cs
index 32390ac484..a319d0e48e 100644
--- a/osu.Game/Beatmaps/Formats/IHasCustomColours.cs
+++ b/osu.Game/Beatmaps/Formats/IHasCustomColours.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Beatmaps.Formats
{
diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs
index 2ef7c5de30..217f16b263 100644
--- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs
+++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs
@@ -7,7 +7,7 @@ using System.IO;
using osu.Framework.Logging;
using osu.Game.Audio;
using osu.Game.Beatmaps.ControlPoints;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Beatmaps.Formats
{
diff --git a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs
index 375c0b29c0..d30c78cb17 100644
--- a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs
+++ b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs
@@ -5,8 +5,8 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.IO.File;
using osu.Game.Storyboards;
diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs
index 9ac2cabe9f..8975ab8a0e 100644
--- a/osu.Game/Configuration/OsuConfigManager.cs
+++ b/osu.Game/Configuration/OsuConfigManager.cs
@@ -42,6 +42,8 @@ namespace osu.Game.Configuration
if (!val) Set(OsuSetting.SavePassword, false);
};
+ Set(OsuSetting.ExternalLinkWarning, true);
+
// Audio
Set(OsuSetting.VolumeInactive, 0.25, 0, 1, 0.01);
@@ -148,6 +150,7 @@ namespace osu.Game.Configuration
BeatmapSkins,
BeatmapHitsounds,
IncreaseFirstObjectVisibility,
- ScoreDisplayMode
+ ScoreDisplayMode,
+ ExternalLinkWarning
}
}
diff --git a/osu.Game/Configuration/SpeedChangeVisualisationMethod.cs b/osu.Game/Configuration/ScrollVisualisationMethod.cs
similarity index 89%
rename from osu.Game/Configuration/SpeedChangeVisualisationMethod.cs
rename to osu.Game/Configuration/ScrollVisualisationMethod.cs
index 39c6e5649c..cc7dcdbc0e 100644
--- a/osu.Game/Configuration/SpeedChangeVisualisationMethod.cs
+++ b/osu.Game/Configuration/ScrollVisualisationMethod.cs
@@ -5,7 +5,7 @@ using System.ComponentModel;
namespace osu.Game.Configuration
{
- public enum SpeedChangeVisualisationMethod
+ public enum ScrollVisualisationMethod
{
[Description("Sequential")]
Sequential,
diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs
index 4a86d0e4f6..eb8dc7243e 100644
--- a/osu.Game/Graphics/Backgrounds/Triangles.cs
+++ b/osu.Game/Graphics/Backgrounds/Triangles.cs
@@ -3,12 +3,12 @@
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using System;
using osu.Framework.Graphics.Shaders;
using osu.Framework.Graphics.Textures;
-using OpenTK.Graphics.ES30;
+using osuTK.Graphics.ES30;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Allocation;
diff --git a/osu.Game/Graphics/Containers/ConstrainedIconContainer.cs b/osu.Game/Graphics/Containers/ConstrainedIconContainer.cs
index 7289bfe52c..aae05ca767 100644
--- a/osu.Game/Graphics/Containers/ConstrainedIconContainer.cs
+++ b/osu.Game/Graphics/Containers/ConstrainedIconContainer.cs
@@ -4,7 +4,7 @@
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
-using OpenTK;
+using osuTK;
namespace osu.Game.Graphics.Containers
{
diff --git a/osu.Game/Graphics/Containers/LinkFlowContainer.cs b/osu.Game/Graphics/Containers/LinkFlowContainer.cs
index e4e7828d0e..54a2ea47f9 100644
--- a/osu.Game/Graphics/Containers/LinkFlowContainer.cs
+++ b/osu.Game/Graphics/Containers/LinkFlowContainer.cs
@@ -7,7 +7,7 @@ using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
using System.Collections.Generic;
-using osu.Framework.Platform;
+using osu.Framework.Logging;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
@@ -21,16 +21,15 @@ namespace osu.Game.Graphics.Containers
}
private OsuGame game;
-
+ private ChannelManager channelManager;
private Action showNotImplementedError;
- private GameHost host;
[BackgroundDependencyLoader(true)]
- private void load(OsuGame game, NotificationOverlay notifications, GameHost host)
+ private void load(OsuGame game, NotificationOverlay notifications, ChannelManager channelManager)
{
// will be null in tests
this.game = game;
- this.host = host;
+ this.channelManager = channelManager;
showNotImplementedError = () => notifications?.Post(new SimpleNotification
{
@@ -80,7 +79,15 @@ namespace osu.Game.Graphics.Containers
game?.ShowBeatmapSet(setId);
break;
case LinkAction.OpenChannel:
- game?.OpenChannel(linkArgument);
+ try
+ {
+ channelManager?.OpenChannel(linkArgument);
+ }
+ catch (ChannelNotFoundException e)
+ {
+ Logger.Log($"The requested channel \"{linkArgument}\" does not exist");
+ }
+
break;
case LinkAction.OpenEditorTimestamp:
case LinkAction.JoinMultiplayerMatch:
@@ -88,7 +95,7 @@ namespace osu.Game.Graphics.Containers
showNotImplementedError?.Invoke();
break;
case LinkAction.External:
- host.OpenUrlExternally(url);
+ game?.OpenUrlExternally(url);
break;
case LinkAction.OpenUserProfile:
if (long.TryParse(linkArgument, out long userId))
diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs
index 2aa3fede2c..a24b6594e0 100644
--- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs
+++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs
@@ -5,7 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics.Containers;
-using OpenTK;
+using osuTK;
using osu.Framework.Configuration;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
diff --git a/osu.Game/Graphics/Containers/OsuHoverContainer.cs b/osu.Game/Graphics/Containers/OsuHoverContainer.cs
index 577d889be3..af804735a8 100644
--- a/osu.Game/Graphics/Containers/OsuHoverContainer.cs
+++ b/osu.Game/Graphics/Containers/OsuHoverContainer.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
diff --git a/osu.Game/Graphics/Containers/OsuScrollContainer.cs b/osu.Game/Graphics/Containers/OsuScrollContainer.cs
index 4f18eb9e7b..8aeade9265 100644
--- a/osu.Game/Graphics/Containers/OsuScrollContainer.cs
+++ b/osu.Game/Graphics/Containers/OsuScrollContainer.cs
@@ -3,7 +3,7 @@
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
-using OpenTK.Input;
+using osuTK.Input;
namespace osu.Game.Graphics.Containers
{
diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs
index a6b79a20dc..97e12ec0f9 100644
--- a/osu.Game/Graphics/Containers/ParallaxContainer.cs
+++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs
@@ -4,7 +4,7 @@
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics;
using osu.Framework.Input;
-using OpenTK;
+using osuTK;
using osu.Framework.Allocation;
using osu.Game.Configuration;
using osu.Framework.Configuration;
diff --git a/osu.Game/Graphics/Containers/WaveContainer.cs b/osu.Game/Graphics/Containers/WaveContainer.cs
index 82432c6ee7..96a2304ed1 100644
--- a/osu.Game/Graphics/Containers/WaveContainer.cs
+++ b/osu.Game/Graphics/Containers/WaveContainer.cs
@@ -6,7 +6,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Graphics.Containers
{
diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs
index ba858bf52d..87d97806cd 100644
--- a/osu.Game/Graphics/Cursor/MenuCursor.cs
+++ b/osu.Game/Graphics/Cursor/MenuCursor.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
+using osuTK;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
@@ -13,7 +13,7 @@ using System;
using JetBrains.Annotations;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input.Events;
-using OpenTK.Input;
+using osuTK.Input;
namespace osu.Game.Graphics.Cursor
{
diff --git a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs
index 44156f6e83..e7a9aab622 100644
--- a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs
+++ b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs
@@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
diff --git a/osu.Game/Graphics/IHasAccentColour.cs b/osu.Game/Graphics/IHasAccentColour.cs
index 64c240aa84..0718e84a34 100644
--- a/osu.Game/Graphics/IHasAccentColour.cs
+++ b/osu.Game/Graphics/IHasAccentColour.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Transforms;
diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs
index 7236248f18..fc627fa501 100644
--- a/osu.Game/Graphics/OsuColour.cs
+++ b/osu.Game/Graphics/OsuColour.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Graphics
{
diff --git a/osu.Game/Graphics/SpriteIcon.cs b/osu.Game/Graphics/SpriteIcon.cs
index 1b1df45c77..2d63d0a52c 100644
--- a/osu.Game/Graphics/SpriteIcon.cs
+++ b/osu.Game/Graphics/SpriteIcon.cs
@@ -7,8 +7,8 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics;
using osu.Framework.IO.Stores;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Caching;
namespace osu.Game.Graphics
diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs
index 16c63a12f4..89bd6f6118 100644
--- a/osu.Game/Graphics/UserInterface/Bar.cs
+++ b/osu.Game/Graphics/UserInterface/Bar.cs
@@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs
index 0ba49929e9..f461a0f296 100644
--- a/osu.Game/Graphics/UserInterface/BarGraph.cs
+++ b/osu.Game/Graphics/UserInterface/BarGraph.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
+using osuTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using System.Collections.Generic;
diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs
index ebb7b686e4..d4ef335c3e 100644
--- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs
+++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
-using OpenTK;
+using osuTK;
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs
index b2220267ff..24bac05384 100644
--- a/osu.Game/Graphics/UserInterface/DialogButton.cs
+++ b/osu.Game/Graphics/UserInterface/DialogButton.cs
@@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Shapes;
diff --git a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs
index d82448e8a2..8f8ba1ede8 100644
--- a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs
+++ b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs
@@ -7,8 +7,8 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Input.Events;
using osu.Framework.Platform;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Graphics.UserInterface
{
diff --git a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs
index 122ac7b627..0564d364ed 100644
--- a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs
+++ b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs
@@ -1,11 +1,11 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK.Graphics;
+using osuTK.Graphics;
using System;
using osu.Framework.Input.Events;
using osu.Game.Input.Bindings;
-using OpenTK.Input;
+using osuTK.Input;
namespace osu.Game.Graphics.UserInterface
{
diff --git a/osu.Game/Graphics/UserInterface/IconButton.cs b/osu.Game/Graphics/UserInterface/IconButton.cs
index f10f03873d..c59326a256 100644
--- a/osu.Game/Graphics/UserInterface/IconButton.cs
+++ b/osu.Game/Graphics/UserInterface/IconButton.cs
@@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
diff --git a/osu.Game/Graphics/UserInterface/LineGraph.cs b/osu.Game/Graphics/UserInterface/LineGraph.cs
index ff2c4cf7cd..c84c500201 100644
--- a/osu.Game/Graphics/UserInterface/LineGraph.cs
+++ b/osu.Game/Graphics/UserInterface/LineGraph.cs
@@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Caching;
-using OpenTK;
+using osuTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Lines;
diff --git a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs
index 8d45b03a43..e503436d47 100644
--- a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs
+++ b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs
@@ -3,8 +3,8 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Graphics.UserInterface
{
diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs
index 84b7fd9dae..974708af97 100644
--- a/osu.Game/Graphics/UserInterface/Nub.cs
+++ b/osu.Game/Graphics/UserInterface/Nub.cs
@@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
diff --git a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs
index 4516d7ce76..89760a9873 100644
--- a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs
+++ b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs
@@ -8,7 +8,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Game.Graphics.Containers;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Graphics.UserInterface
{
diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs
index ab880cd473..0ff4542678 100644
--- a/osu.Game/Graphics/UserInterface/OsuButton.cs
+++ b/osu.Game/Graphics/UserInterface/OsuButton.cs
@@ -9,7 +9,7 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Graphics.Sprites;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Graphics.UserInterface
{
diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs
index e267a7f848..194e81dae1 100644
--- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs
+++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs
@@ -10,7 +10,7 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Graphics.Sprites;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Graphics.UserInterface
{
diff --git a/osu.Game/Graphics/UserInterface/OsuContextMenu.cs b/osu.Game/Graphics/UserInterface/OsuContextMenu.cs
index 9b697f291f..2dd6d4fe78 100644
--- a/osu.Game/Graphics/UserInterface/OsuContextMenu.cs
+++ b/osu.Game/Graphics/UserInterface/OsuContextMenu.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs
index 30803d1545..3f15616d6c 100644
--- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs
+++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
@@ -10,7 +10,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.Sprites;
-using OpenTK;
+using osuTK;
namespace osu.Game.Graphics.UserInterface
{
diff --git a/osu.Game/Graphics/UserInterface/OsuEnumDropdown.cs b/osu.Game/Graphics/UserInterface/OsuEnumDropdown.cs
index 502f468ec9..5c6a2a0569 100644
--- a/osu.Game/Graphics/UserInterface/OsuEnumDropdown.cs
+++ b/osu.Game/Graphics/UserInterface/OsuEnumDropdown.cs
@@ -2,9 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
-using System.ComponentModel;
-using System.Reflection;
-using System.Collections.Generic;
namespace osu.Game.Graphics.UserInterface
{
@@ -15,18 +12,7 @@ namespace osu.Game.Graphics.UserInterface
if (!typeof(T).IsEnum)
throw new InvalidOperationException("OsuEnumDropdown only supports enums as the generic type argument");
- List> items = new List>();
- foreach (var val in (T[])Enum.GetValues(typeof(T)))
- {
- var field = typeof(T).GetField(Enum.GetName(typeof(T), val));
- items.Add(
- new KeyValuePair(
- field.GetCustomAttribute()?.Description ?? Enum.GetName(typeof(T), val),
- val
- )
- );
- }
- Items = items;
+ Items = (T[])Enum.GetValues(typeof(T));
}
}
}
diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs
index fe3e866a70..570ed368d8 100644
--- a/osu.Game/Graphics/UserInterface/OsuMenu.cs
+++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs
@@ -4,7 +4,7 @@
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -12,7 +12,7 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Graphics.Sprites;
-using OpenTK;
+using osuTK;
namespace osu.Game.Graphics.UserInterface
{
diff --git a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs
index f4ec67db23..c8a1bf9178 100644
--- a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs
+++ b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs
@@ -1,9 +1,9 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
-using OpenTK.Graphics;
-using OpenTK.Input;
+using osuTK;
+using osuTK.Graphics;
+using osuTK.Input;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs
index eecc10469e..a59abcbcee 100644
--- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs
+++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs
@@ -3,8 +3,8 @@
using System;
using System.Globalization;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs
index e7d6a87349..488e16b6fb 100644
--- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs
+++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs
@@ -3,8 +3,8 @@
using System;
using System.Linq;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Extensions;
diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs
index 1355ffdb8e..cb951898da 100644
--- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs
+++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs
@@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Game/Graphics/UserInterface/OsuTextBox.cs b/osu.Game/Graphics/UserInterface/OsuTextBox.cs
index 37464faa73..523b60fdd2 100644
--- a/osu.Game/Graphics/UserInterface/OsuTextBox.cs
+++ b/osu.Game/Graphics/UserInterface/OsuTextBox.cs
@@ -6,7 +6,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.Sprites;
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
diff --git a/osu.Game/Graphics/UserInterface/PageTabControl.cs b/osu.Game/Graphics/UserInterface/PageTabControl.cs
index fb7b4c5676..50e4743028 100644
--- a/osu.Game/Graphics/UserInterface/PageTabControl.cs
+++ b/osu.Game/Graphics/UserInterface/PageTabControl.cs
@@ -2,8 +2,8 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
diff --git a/osu.Game/Graphics/UserInterface/PercentageCounter.cs b/osu.Game/Graphics/UserInterface/PercentageCounter.cs
index ef3fc156e7..b1514cb8c8 100644
--- a/osu.Game/Graphics/UserInterface/PercentageCounter.cs
+++ b/osu.Game/Graphics/UserInterface/PercentageCounter.cs
@@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
+using osu.Framework.Allocation;
namespace osu.Game.Graphics.UserInterface
{
@@ -25,6 +26,9 @@ namespace osu.Game.Graphics.UserInterface
Current.Value = DisplayedCount = 1.0f;
}
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours) => AccentColour = colours.BlueLighter;
+
protected override string FormatCount(double count)
{
return $@"{count:P2}";
diff --git a/osu.Game/Graphics/UserInterface/ProgressBar.cs b/osu.Game/Graphics/UserInterface/ProgressBar.cs
index beb1d0055e..ee64c7c25c 100644
--- a/osu.Game/Graphics/UserInterface/ProgressBar.cs
+++ b/osu.Game/Graphics/UserInterface/ProgressBar.cs
@@ -5,7 +5,7 @@ using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Graphics.UserInterface
{
diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs
index c2162b8a42..5a9dd4e05e 100644
--- a/osu.Game/Graphics/UserInterface/RollingCounter.cs
+++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs
@@ -8,7 +8,7 @@ using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.Sprites;
using System;
using System.Collections.Generic;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Graphics.UserInterface
{
diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs
index df26f81629..8bf30c32c6 100644
--- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs
+++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs
@@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+using osu.Framework.Allocation;
using osu.Framework.Graphics;
namespace osu.Game.Graphics.UserInterface
@@ -31,6 +32,9 @@ namespace osu.Game.Graphics.UserInterface
LeadingZeroes = leading;
}
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours) => AccentColour = colours.BlueLighter;
+
protected override double GetProportionalDuration(double currentValue, double newValue)
{
return currentValue > newValue ? currentValue - newValue : newValue - currentValue;
diff --git a/osu.Game/Graphics/UserInterface/SearchTextBox.cs b/osu.Game/Graphics/UserInterface/SearchTextBox.cs
index 08e93fad18..40db6677f5 100644
--- a/osu.Game/Graphics/UserInterface/SearchTextBox.cs
+++ b/osu.Game/Graphics/UserInterface/SearchTextBox.cs
@@ -3,8 +3,8 @@
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
-using OpenTK;
-using OpenTK.Input;
+using osuTK;
+using osuTK.Input;
namespace osu.Game.Graphics.UserInterface
{
diff --git a/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs b/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs
index cf55240e71..ddc48c9be7 100644
--- a/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs
+++ b/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs
@@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
+using osu.Framework.Allocation;
namespace osu.Game.Graphics.UserInterface
{
@@ -17,6 +18,9 @@ namespace osu.Game.Graphics.UserInterface
Current.Value = DisplayedCount = 0;
}
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours) => AccentColour = colours.BlueLighter;
+
protected override string FormatCount(int count)
{
return $@"{count}x";
diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs
index 621b5dcf11..009a2a2e1b 100644
--- a/osu.Game/Graphics/UserInterface/StarCounter.cs
+++ b/osu.Game/Graphics/UserInterface/StarCounter.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
+using osuTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.MathUtils;
diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs
index 2000eb47e4..16f727b783 100644
--- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs
+++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs
@@ -4,8 +4,8 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Framework.Extensions.Color4Extensions;
using osu.Game.Graphics.Containers;
diff --git a/osu.Game/IO/Serialization/Converters/Vector2Converter.cs b/osu.Game/IO/Serialization/Converters/Vector2Converter.cs
index ba2158df28..4b057c0f2f 100644
--- a/osu.Game/IO/Serialization/Converters/Vector2Converter.cs
+++ b/osu.Game/IO/Serialization/Converters/Vector2Converter.cs
@@ -4,7 +4,7 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
-using OpenTK;
+using osuTK;
namespace osu.Game.IO.Serialization.Converters
{
diff --git a/osu.Game/Input/Handlers/ReplayInputHandler.cs b/osu.Game/Input/Handlers/ReplayInputHandler.cs
index 0a62c6ca72..c8c5657e41 100644
--- a/osu.Game/Input/Handlers/ReplayInputHandler.cs
+++ b/osu.Game/Input/Handlers/ReplayInputHandler.cs
@@ -10,7 +10,7 @@ using osu.Framework.Input.StateChanges.Events;
using osu.Framework.Input.States;
using osu.Framework.Platform;
using osu.Game.Rulesets.UI;
-using OpenTK;
+using osuTK;
namespace osu.Game.Input.Handlers
{
diff --git a/osu.Game/Online/API/APIMessagesRequest.cs b/osu.Game/Online/API/APIMessagesRequest.cs
new file mode 100644
index 0000000000..991096c0af
--- /dev/null
+++ b/osu.Game/Online/API/APIMessagesRequest.cs
@@ -0,0 +1,28 @@
+// Copyright (c) 2007-2018 ppy Pty Ltd .
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using System.Collections.Generic;
+using osu.Framework.IO.Network;
+using osu.Game.Online.Chat;
+
+namespace osu.Game.Online.API
+{
+ public abstract class APIMessagesRequest : APIRequest>
+ {
+ private readonly long? sinceId;
+
+ protected APIMessagesRequest(long? sinceId)
+ {
+ this.sinceId = sinceId;
+ }
+
+ protected override WebRequest CreateWebRequest()
+ {
+ var req = base.CreateWebRequest();
+
+ if (sinceId.HasValue) req.AddParameter(@"since", sinceId.Value.ToString());
+
+ return req;
+ }
+ }
+}
diff --git a/osu.Game/Online/API/Requests/CreateNewPrivateMessageRequest.cs b/osu.Game/Online/API/Requests/CreateNewPrivateMessageRequest.cs
new file mode 100644
index 0000000000..00dab10c75
--- /dev/null
+++ b/osu.Game/Online/API/Requests/CreateNewPrivateMessageRequest.cs
@@ -0,0 +1,34 @@
+// Copyright (c) 2007-2018 ppy Pty Ltd .
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using System.Net.Http;
+using osu.Framework.IO.Network;
+using osu.Game.Online.Chat;
+using osu.Game.Users;
+
+namespace osu.Game.Online.API.Requests
+{
+ public class CreateNewPrivateMessageRequest : APIRequest
+ {
+ private readonly User user;
+ private readonly Message message;
+
+ public CreateNewPrivateMessageRequest(User user, Message message)
+ {
+ this.user = user;
+ this.message = message;
+ }
+
+ protected override WebRequest CreateWebRequest()
+ {
+ var req = base.CreateWebRequest();
+ req.Method = HttpMethod.Post;
+ req.AddParameter(@"target_id", user.Id.ToString());
+ req.AddParameter(@"message", message.Content);
+ req.AddParameter(@"is_action", message.IsAction.ToString().ToLowerInvariant());
+ return req;
+ }
+
+ protected override string Target => @"chat/new";
+ }
+}
diff --git a/osu.Game/Online/API/Requests/CreateNewPrivateMessageResponse.cs b/osu.Game/Online/API/Requests/CreateNewPrivateMessageResponse.cs
new file mode 100644
index 0000000000..84f1593c31
--- /dev/null
+++ b/osu.Game/Online/API/Requests/CreateNewPrivateMessageResponse.cs
@@ -0,0 +1,16 @@
+// Copyright (c) 2007-2018 ppy Pty Ltd .
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using Newtonsoft.Json;
+using osu.Game.Online.Chat;
+
+namespace osu.Game.Online.API.Requests
+{
+ public class CreateNewPrivateMessageResponse
+ {
+ [JsonProperty("new_channel_id")]
+ public int ChannelID;
+
+ public Message Message;
+ }
+}
diff --git a/osu.Game/Online/Chat/Channel.cs b/osu.Game/Online/Chat/Channel.cs
index bbe74fcac0..9d3b7b5cc9 100644
--- a/osu.Game/Online/Chat/Channel.cs
+++ b/osu.Game/Online/Chat/Channel.cs
@@ -3,15 +3,64 @@
using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Linq;
using Newtonsoft.Json;
using osu.Framework.Configuration;
using osu.Framework.Lists;
+using osu.Game.Users;
namespace osu.Game.Online.Chat
{
public class Channel
{
+ public readonly int MaxHistory = 300;
+
+ ///
+ /// Contains every joined user except the current logged in user. Currently only returned for PM channels.
+ ///
+ public readonly ObservableCollection Users = new ObservableCollection();
+
+ [JsonProperty(@"users")]
+ private long[] userIds
+ {
+ set
+ {
+ foreach (var id in value)
+ Users.Add(new User { Id = id });
+ }
+ }
+
+ ///
+ /// Contains all the messages send in the channel.
+ ///
+ public readonly SortedList Messages = new SortedList(Comparer.Default);
+
+ ///
+ /// Contains all the messages that are still pending for submission to the server.
+ ///
+ private readonly List pendingMessages = new List();
+
+
+ ///
+ /// An event that fires when new messages arrived.
+ ///
+ public event Action> NewMessagesArrived;
+
+ ///
+ /// An event that fires when a pending message gets resolved.
+ ///
+ public event Action PendingMessageResolved;
+
+ ///
+ /// An event that fires when a pending message gets removed.
+ ///
+ public event Action MessageRemoved;
+
+ public bool ReadOnly => false; //todo not yet used.
+
+ public override string ToString() => Name;
+
[JsonProperty(@"name")]
public string Name;
@@ -22,19 +71,16 @@ namespace osu.Game.Online.Chat
public ChannelType Type;
[JsonProperty(@"channel_id")]
- public int Id;
+ public long Id;
[JsonProperty(@"last_message_id")]
public long? LastMessageId;
- public readonly SortedList Messages = new SortedList(Comparer.Default);
-
- private readonly List pendingMessages = new List();
-
+ ///
+ /// Signalles if the current user joined this channel or not. Defaults to false.
+ ///
public Bindable Joined = new Bindable();
- public bool ReadOnly => false;
-
public const int MAX_HISTORY = 300;
[JsonConstructor]
@@ -42,10 +88,10 @@ namespace osu.Game.Online.Chat
{
}
- public event Action> NewMessagesArrived;
- public event Action PendingMessageResolved;
- public event Action MessageRemoved;
-
+ ///
+ /// Adds the argument message as a local echo. When this local echo is resolved will get called.
+ ///
+ ///
public void AddLocalEcho(LocalEchoMessage message)
{
pendingMessages.Add(message);
@@ -54,8 +100,12 @@ namespace osu.Game.Online.Chat
NewMessagesArrived?.Invoke(new[] { message });
}
- public bool MessagesLoaded { get; private set; }
+ public bool MessagesLoaded;
+ ///
+ /// Adds new messages to the channel and purges old messages. Triggers the event.
+ ///
+ ///
public void AddNewMessages(params Message[] messages)
{
messages = messages.Except(Messages).ToArray();
@@ -63,7 +113,6 @@ namespace osu.Game.Online.Chat
if (messages.Length == 0) return;
Messages.AddRange(messages);
- MessagesLoaded = true;
var maxMessageId = messages.Max(m => m.Id);
if (maxMessageId > LastMessageId)
@@ -74,14 +123,6 @@ namespace osu.Game.Online.Chat
NewMessagesArrived?.Invoke(messages);
}
- private void purgeOldMessages()
- {
- // never purge local echos
- int messageCount = Messages.Count - pendingMessages.Count;
- if (messageCount > MAX_HISTORY)
- Messages.RemoveRange(0, messageCount - MAX_HISTORY);
- }
-
///
/// Replace or remove a message from the channel.
///
@@ -101,17 +142,18 @@ namespace osu.Game.Online.Chat
}
if (Messages.Contains(final))
- {
- // message already inserted, so let's throw away this update.
- // we may want to handle this better in the future, but for the time being api requests are single-threaded so order is assumed.
- MessageRemoved?.Invoke(echo);
- return;
- }
+ throw new InvalidOperationException("Attempted to add the same message again");
Messages.Add(final);
PendingMessageResolved?.Invoke(echo, final);
}
- public override string ToString() => Name;
+ private void purgeOldMessages()
+ {
+ // never purge local echos
+ int messageCount = Messages.Count - pendingMessages.Count;
+ if (messageCount > MaxHistory)
+ Messages.RemoveRange(0, messageCount - MaxHistory);
+ }
}
}
diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs
new file mode 100644
index 0000000000..73ac7c9df4
--- /dev/null
+++ b/osu.Game/Online/Chat/ChannelManager.cs
@@ -0,0 +1,440 @@
+// Copyright (c) 2007-2018 ppy Pty Ltd .
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using osu.Framework.Allocation;
+using osu.Framework.Configuration;
+using osu.Framework.Graphics;
+using osu.Framework.Logging;
+using osu.Framework.Threading;
+using osu.Game.Online.API;
+using osu.Game.Online.API.Requests;
+using osu.Game.Users;
+
+namespace osu.Game.Online.Chat
+{
+ ///
+ /// Manages everything channel related
+ ///
+ public class ChannelManager : Component, IOnlineComponent
+ {
+ ///
+ /// The channels the player joins on startup
+ ///
+ private readonly string[] defaultChannels =
+ {
+ @"#lazer",
+ @"#osu",
+ @"#lobby"
+ };
+
+ ///
+ /// The currently opened channel
+ ///
+ public Bindable CurrentChannel { get; } = new Bindable();
+
+ ///
+ /// The Channels the player has joined
+ ///
+ public ObservableCollection JoinedChannels { get; } = new ObservableCollection(); //todo: should be publicly readonly
+
+ ///
+ /// The channels available for the player to join
+ ///
+ public ObservableCollection AvailableChannels { get; } = new ObservableCollection(); //todo: should be publicly readonly
+
+ private IAPIProvider api;
+ private ScheduledDelegate fetchMessagesScheduleder;
+
+ public ChannelManager()
+ {
+ CurrentChannel.ValueChanged += currentChannelChanged;
+ }
+
+ ///
+ /// Opens a channel or switches to the channel if already opened.
+ ///
+ /// If the name of the specifed channel was not found this exception will be thrown.
+ ///
+ public void OpenChannel(string name)
+ {
+ if (name == null)
+ throw new ArgumentNullException(nameof(name));
+
+ CurrentChannel.Value = AvailableChannels.FirstOrDefault(c => c.Name == name) ?? throw new ChannelNotFoundException(name);
+ }
+
+ ///
+ /// Opens a new private channel.
+ ///
+ /// The user the private channel is opened with.
+ public void OpenPrivateChannel(User user)
+ {
+ if (user == null)
+ throw new ArgumentNullException(nameof(user));
+
+ CurrentChannel.Value = JoinedChannels.FirstOrDefault(c => c.Type == ChannelType.PM && c.Users.Count == 1 && c.Users.Any(u => u.Id == user.Id))
+ ?? new Channel { Name = user.Username, Users = { user }, Type = ChannelType.PM };
+ }
+
+ private void currentChannelChanged(Channel channel) => JoinChannel(channel);
+
+ ///
+ /// Ensure we run post actions in sequence, once at a time.
+ ///
+ private readonly Queue postQueue = new Queue();
+
+ ///
+ /// Posts a message to the currently opened channel.
+ ///
+ /// The message text that is going to be posted
+ /// Is true if the message is an action, e.g.: user is currently eating
+ public void PostMessage(string text, bool isAction = false)
+ {
+ if (CurrentChannel.Value == null)
+ return;
+
+ var currentChannel = CurrentChannel.Value;
+
+ void dequeueAndRun()
+ {
+ if (postQueue.Count > 0)
+ postQueue.Dequeue().Invoke();
+ }
+
+ postQueue.Enqueue(() =>
+ {
+ if (!api.IsLoggedIn)
+ {
+ currentChannel.AddNewMessages(new ErrorMessage("Please sign in to participate in chat!"));
+ return;
+ }
+
+ var message = new LocalEchoMessage
+ {
+ Sender = api.LocalUser.Value,
+ Timestamp = DateTimeOffset.Now,
+ ChannelId = CurrentChannel.Value.Id,
+ IsAction = isAction,
+ Content = text
+ };
+
+ currentChannel.AddLocalEcho(message);
+
+ // if this is a PM and the first message, we need to do a special request to create the PM channel
+ if (currentChannel.Type == ChannelType.PM && !currentChannel.Joined)
+ {
+ var createNewPrivateMessageRequest = new CreateNewPrivateMessageRequest(currentChannel.Users.First(), message);
+
+ createNewPrivateMessageRequest.Success += createRes =>
+ {
+ currentChannel.Id = createRes.ChannelID;
+ currentChannel.ReplaceMessage(message, createRes.Message);
+ dequeueAndRun();
+ };
+
+ createNewPrivateMessageRequest.Failure += exception =>
+ {
+ Logger.Error(exception, "Posting message failed.");
+ currentChannel.ReplaceMessage(message, null);
+ dequeueAndRun();
+ };
+
+ api.Queue(createNewPrivateMessageRequest);
+ return;
+ }
+
+ var req = new PostMessageRequest(message);
+
+ req.Success += m =>
+ {
+ currentChannel.ReplaceMessage(message, m);
+ dequeueAndRun();
+ };
+
+ req.Failure += exception =>
+ {
+ Logger.Error(exception, "Posting message failed.");
+ currentChannel.ReplaceMessage(message, null);
+ dequeueAndRun();
+ };
+
+ api.Queue(req);
+ });
+
+ // always run if the queue is empty
+ if (postQueue.Count == 1)
+ dequeueAndRun();
+ }
+
+ ///
+ /// Posts a command locally. Commands like /help will result in a help message written in the current channel.
+ ///
+ /// the text containing the command identifier and command parameters.
+ public void PostCommand(string text)
+ {
+ if (CurrentChannel.Value == null)
+ return;
+
+ var parameters = text.Split(new[] { ' ' }, 2);
+ string command = parameters[0];
+ string content = parameters.Length == 2 ? parameters[1] : string.Empty;
+
+ switch (command)
+ {
+ case "me":
+ if (string.IsNullOrWhiteSpace(content))
+ {
+ CurrentChannel.Value.AddNewMessages(new ErrorMessage("Usage: /me [action]"));
+ break;
+ }
+
+ PostMessage(content, true);
+ break;
+
+ case "help":
+ CurrentChannel.Value.AddNewMessages(new InfoMessage("Supported commands: /help, /me [action]"));
+ break;
+
+ default:
+ CurrentChannel.Value.AddNewMessages(new ErrorMessage($@"""/{command}"" is not supported! For a list of supported commands see /help"));
+ break;
+ }
+ }
+
+ private void handleChannelMessages(IEnumerable messages)
+ {
+ var channels = JoinedChannels.ToList();
+
+ foreach (var group in messages.GroupBy(m => m.ChannelId))
+ channels.Find(c => c.Id == group.Key)?.AddNewMessages(group.ToArray());
+ }
+
+ private void initializeChannels()
+ {
+ var req = new ListChannelsRequest();
+
+ var joinDefaults = JoinedChannels.Count == 0;
+
+ req.Success += channels =>
+ {
+ foreach (var channel in channels)
+ {
+ var ch = getChannel(channel, addToAvailable: true);
+
+ // join any channels classified as "defaults"
+ if (joinDefaults && defaultChannels.Any(c => c.Equals(channel.Name, StringComparison.OrdinalIgnoreCase)))
+ JoinChannel(ch);
+ }
+ };
+ req.Failure += error =>
+ {
+ Logger.Error(error, "Fetching channel list failed");
+ initializeChannels();
+ };
+
+ api.Queue(req);
+ }
+
+ ///
+ /// Fetches inital messages of a channel
+ ///
+ /// TODO: remove this when the API supports returning initial fetch messages for more than one channel by specifying the last message id per channel instead of one last message id globally.
+ /// right now it caps out at 50 messages and therefore only returns one channel's worth of content.
+ ///
+ /// The channel
+ private void fetchInitalMessages(Channel channel)
+ {
+ if (channel.Id <= 0) return;
+
+ var fetchInitialMsgReq = new GetMessagesRequest(channel);
+ fetchInitialMsgReq.Success += messages =>
+ {
+ handleChannelMessages(messages);
+ channel.MessagesLoaded = true; // this will mark the channel as having received messages even if there were none.
+ };
+
+ api.Queue(fetchInitialMsgReq);
+ }
+
+ ///
+ /// Find an existing channel instance for the provided channel. Lookup is performed basd on ID.
+ /// The provided channel may be used if an existing instance is not found.
+ ///
+ /// A candidate channel to be used for lookup or permanently on lookup failure.
+ /// Whether the channel should be added to if not already.
+ /// Whether the channel should be added to if not already.
+ /// The found channel.
+ private Channel getChannel(Channel lookup, bool addToAvailable = false, bool addToJoined = false)
+ {
+ Channel found = null;
+
+ bool lookupCondition(Channel ch) => lookup.Id > 0 ? ch.Id == lookup.Id : lookup.Name == ch.Name;
+
+ var available = AvailableChannels.FirstOrDefault(lookupCondition);
+ if (available != null)
+ found = available;
+
+ var joined = JoinedChannels.FirstOrDefault(lookupCondition);
+ if (found == null && joined != null)
+ found = joined;
+
+ if (found == null)
+ {
+ found = lookup;
+
+ // if we're using a channel object from the server, we want to remove ourselves from the users list.
+ // this is because we check the first user in the channel to display a name/icon on tabs for now.
+ var foundSelf = found.Users.FirstOrDefault(u => u.Id == api.LocalUser.Value.Id);
+ if (foundSelf != null)
+ found.Users.Remove(foundSelf);
+ }
+
+ if (joined == null && addToJoined) JoinedChannels.Add(found);
+ if (available == null && addToAvailable) AvailableChannels.Add(found);
+
+ return found;
+ }
+
+ ///
+ /// Joins a channel if it has not already been joined.
+ ///
+ /// The channel to join.
+ /// Whether the channel has already been joined server-side. Will skip a join request.
+ /// The joined channel. Note that this may not match the parameter channel as it is a backed object.
+ public Channel JoinChannel(Channel channel, bool alreadyJoined = false)
+ {
+ if (channel == null) return null;
+
+ channel = getChannel(channel, addToJoined: true);
+
+ // ensure we are joined to the channel
+ if (!channel.Joined.Value)
+ {
+ if (alreadyJoined)
+ channel.Joined.Value = true;
+ else
+ {
+ switch (channel.Type)
+ {
+ case ChannelType.Public:
+ var req = new JoinChannelRequest(channel, api.LocalUser);
+ req.Success += () => JoinChannel(channel, true);
+ req.Failure += ex => LeaveChannel(channel);
+ api.Queue(req);
+ return channel;
+ }
+ }
+ }
+
+ if (CurrentChannel.Value == null)
+ CurrentChannel.Value = channel;
+
+ if (!channel.MessagesLoaded)
+ {
+ // let's fetch a small number of messages to bring us up-to-date with the backlog.
+ fetchInitalMessages(channel);
+ }
+
+ return channel;
+ }
+
+ public void LeaveChannel(Channel channel)
+ {
+ if (channel == null) return;
+
+ if (channel == CurrentChannel.Value) CurrentChannel.Value = null;
+
+ JoinedChannels.Remove(channel);
+
+ if (channel.Joined.Value)
+ {
+ api.Queue(new LeaveChannelRequest(channel, api.LocalUser));
+ channel.Joined.Value = false;
+ }
+ }
+
+ public void APIStateChanged(APIAccess api, APIState state)
+ {
+ switch (state)
+ {
+ case APIState.Online:
+ fetchUpdates();
+ break;
+ default:
+ fetchMessagesScheduleder?.Cancel();
+ fetchMessagesScheduleder = null;
+ break;
+ }
+ }
+
+ private long lastMessageId;
+ private const int update_poll_interval = 1000;
+
+ private bool channelsInitialised;
+
+ private void fetchUpdates()
+ {
+ fetchMessagesScheduleder?.Cancel();
+ fetchMessagesScheduleder = Scheduler.AddDelayed(() =>
+ {
+ var fetchReq = new GetUpdatesRequest(lastMessageId);
+
+ fetchReq.Success += updates =>
+ {
+ if (updates?.Presence != null)
+ {
+ foreach (var channel in updates.Presence)
+ {
+ // we received this from the server so should mark the channel already joined.
+ JoinChannel(channel, true);
+ }
+
+ //todo: handle left channels
+
+ handleChannelMessages(updates.Messages);
+
+ foreach (var group in updates.Messages.GroupBy(m => m.ChannelId))
+ JoinedChannels.FirstOrDefault(c => c.Id == group.Key)?.AddNewMessages(group.ToArray());
+
+ lastMessageId = updates.Messages.LastOrDefault()?.Id ?? lastMessageId;
+ }
+
+ if (!channelsInitialised)
+ {
+ channelsInitialised = true;
+ // we want this to run after the first presence so we can see if the user is in any channels already.
+ initializeChannels();
+ }
+
+ fetchUpdates();
+ };
+
+ fetchReq.Failure += delegate { fetchUpdates(); };
+
+ api.Queue(fetchReq);
+ }, update_poll_interval);
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(IAPIProvider api)
+ {
+ this.api = api;
+ api.Register(this);
+ }
+ }
+
+ ///
+ /// An exception thrown when a channel could not been found.
+ ///
+ public class ChannelNotFoundException : Exception
+ {
+ public ChannelNotFoundException(string channelName)
+ : base($"A channel with the name {channelName} could not be found.")
+ {
+ }
+ }
+}
diff --git a/osu.Game/Online/Chat/ChannelType.cs b/osu.Game/Online/Chat/ChannelType.cs
index 4ac0a99fc6..c8b9463ded 100644
--- a/osu.Game/Online/Chat/ChannelType.cs
+++ b/osu.Game/Online/Chat/ChannelType.cs
@@ -5,7 +5,12 @@ namespace osu.Game.Online.Chat
{
public enum ChannelType
{
+ Public,
+ Private,
+ Multiplayer,
+ Spectator,
+ Temporary,
PM,
- Public
+ Group,
}
}
diff --git a/osu.Game/Online/Chat/DrawableLinkCompiler.cs b/osu.Game/Online/Chat/DrawableLinkCompiler.cs
index 0148d1d2c3..de017baf35 100644
--- a/osu.Game/Online/Chat/DrawableLinkCompiler.cs
+++ b/osu.Game/Online/Chat/DrawableLinkCompiler.cs
@@ -10,7 +10,7 @@ using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
-using OpenTK;
+using osuTK;
namespace osu.Game.Online.Chat
{
diff --git a/osu.Game/Online/Chat/ExternalLinkOpener.cs b/osu.Game/Online/Chat/ExternalLinkOpener.cs
new file mode 100644
index 0000000000..d8b8adbbad
--- /dev/null
+++ b/osu.Game/Online/Chat/ExternalLinkOpener.cs
@@ -0,0 +1,36 @@
+// Copyright (c) 2007-2018 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;
+using osu.Framework.Platform;
+using osu.Game.Configuration;
+using osu.Game.Overlays;
+using osu.Game.Overlays.Chat;
+
+namespace osu.Game.Online.Chat
+{
+ public class ExternalLinkOpener : Component
+ {
+ private GameHost host;
+ private DialogOverlay dialogOverlay;
+ private Bindable externalLinkWarning;
+
+ [BackgroundDependencyLoader(true)]
+ private void load(GameHost host, DialogOverlay dialogOverlay, OsuConfigManager config)
+ {
+ this.host = host;
+ this.dialogOverlay = dialogOverlay;
+ externalLinkWarning = config.GetBindable(OsuSetting.ExternalLinkWarning);
+ }
+
+ public void OpenUrlExternally(string url)
+ {
+ if (externalLinkWarning)
+ dialogOverlay.Push(new ExternalLinkDialog(url, () => host.OpenUrlExternally(url)));
+ else
+ host.OpenUrlExternally(url);
+ }
+ }
+}
diff --git a/osu.Game/Online/Chat/Message.cs b/osu.Game/Online/Chat/Message.cs
index 65e0415cd3..3f0f352ac7 100644
--- a/osu.Game/Online/Chat/Message.cs
+++ b/osu.Game/Online/Chat/Message.cs
@@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
using Newtonsoft.Json;
using osu.Game.Users;
@@ -16,10 +15,10 @@ namespace osu.Game.Online.Chat
//todo: this should be inside sender.
[JsonProperty(@"sender_id")]
- public int UserId;
+ public long UserId;
[JsonProperty(@"channel_id")]
- public int ChannelId;
+ public long ChannelId;
[JsonProperty(@"is_action")]
public bool IsAction;
@@ -69,12 +68,4 @@ namespace osu.Game.Online.Chat
// ReSharper disable once ImpureMethodCallOnReadonlyValueField
public override int GetHashCode() => Id.GetHashCode();
}
-
- public enum TargetType
- {
- [Description(@"channel")]
- Channel,
- [Description(@"user")]
- User
- }
}
diff --git a/osu.Game/Online/Multiplayer/GameType.cs b/osu.Game/Online/Multiplayer/GameType.cs
index 571d3df681..750401c067 100644
--- a/osu.Game/Online/Multiplayer/GameType.cs
+++ b/osu.Game/Online/Multiplayer/GameType.cs
@@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
diff --git a/osu.Game/Online/Multiplayer/RoomStatus.cs b/osu.Game/Online/Multiplayer/RoomStatus.cs
index 6b82e5f059..7c6e71a360 100644
--- a/osu.Game/Online/Multiplayer/RoomStatus.cs
+++ b/osu.Game/Online/Multiplayer/RoomStatus.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Game.Graphics;
namespace osu.Game.Online.Multiplayer
diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs
index b75a37e9df..1b0a0b2210 100644
--- a/osu.Game/OsuGame.cs
+++ b/osu.Game/OsuGame.cs
@@ -14,7 +14,7 @@ using osu.Framework.Allocation;
using osu.Game.Overlays.Toolbar;
using osu.Game.Screens;
using osu.Game.Screens.Menu;
-using OpenTK;
+using osuTK;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@@ -31,9 +31,10 @@ using osu.Game.Overlays.Notifications;
using osu.Game.Rulesets;
using osu.Game.Screens.Play;
using osu.Game.Input.Bindings;
+using osu.Game.Online.Chat;
using osu.Game.Rulesets.Mods;
using osu.Game.Skinning;
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Game.Overlays.Volume;
using osu.Game.Screens.Select;
using osu.Game.Utils;
@@ -49,7 +50,9 @@ namespace osu.Game
{
public Toolbar Toolbar;
- private ChatOverlay chat;
+ private ChatOverlay chatOverlay;
+
+ private ChannelManager channelManager;
private MusicController musicController;
@@ -178,13 +181,10 @@ namespace osu.Game
LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust);
}
- private ScheduledDelegate scoreLoad;
+ private ExternalLinkOpener externalLinkOpener;
+ public void OpenUrlExternally(string url) => externalLinkOpener.OpenUrlExternally(url);
- ///
- /// Open chat to a channel matching the provided name, if present.
- ///
- /// The name of the channel.
- public void OpenChannel(string channelName) => chat.OpenChannel(chat.AvailableChannels.Find(c => c.Name == channelName));
+ private ScheduledDelegate scoreLoad;
///
/// Show a beatmap set as an overlay.
@@ -343,7 +343,8 @@ namespace osu.Game
//overlay elements
loadComponentSingleFile(direct = new DirectOverlay { Depth = -1 }, mainContent.Add);
loadComponentSingleFile(social = new SocialOverlay { Depth = -1 }, mainContent.Add);
- loadComponentSingleFile(chat = new ChatOverlay { Depth = -1 }, mainContent.Add);
+ loadComponentSingleFile(channelManager = new ChannelManager(), AddInternal);
+ loadComponentSingleFile(chatOverlay = new ChatOverlay { Depth = -1 }, mainContent.Add);
loadComponentSingleFile(settings = new MainSettings
{
GetToolbarHeight = () => ToolbarOffset,
@@ -376,13 +377,16 @@ namespace osu.Game
dependencies.Cache(onscreenDisplay);
dependencies.Cache(social);
dependencies.Cache(direct);
- dependencies.Cache(chat);
+ dependencies.Cache(chatOverlay);
+ dependencies.Cache(channelManager);
dependencies.Cache(userProfile);
dependencies.Cache(musicController);
dependencies.Cache(beatmapSetOverlay);
dependencies.Cache(notifications);
dependencies.Cache(dialogOverlay);
+ Add(externalLinkOpener = new ExternalLinkOpener());
+
var singleDisplaySideOverlays = new OverlayContainer[] { settings, notifications };
overlays.AddRange(singleDisplaySideOverlays);
@@ -409,7 +413,7 @@ namespace osu.Game
}
// ensure only one of these overlays are open at once.
- var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct };
+ var singleDisplayOverlays = new OverlayContainer[] { chatOverlay, social, direct };
overlays.AddRange(singleDisplayOverlays);
foreach (var overlay in singleDisplayOverlays)
@@ -534,7 +538,7 @@ namespace osu.Game
switch (action)
{
case GlobalAction.ToggleChat:
- chat.ToggleVisibility();
+ chatOverlay.ToggleVisibility();
return true;
case GlobalAction.ToggleSocial:
social.ToggleVisibility();
diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs
index 73c970ce5d..c267c323a6 100644
--- a/osu.Game/OsuGameBase.cs
+++ b/osu.Game/OsuGameBase.cs
@@ -30,7 +30,7 @@ using osu.Game.IO;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning;
-using OpenTK.Input;
+using osuTK.Input;
using DebugUtils = osu.Game.Utils.DebugUtils;
namespace osu.Game
diff --git a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs
index 398518ef2b..c2f03a4b66 100644
--- a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs
+++ b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs
@@ -7,8 +7,8 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Sprites;
using osu.Game.Users;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Game.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
diff --git a/osu.Game/Overlays/BeatmapSet/BasicStats.cs b/osu.Game/Overlays/BeatmapSet/BasicStats.cs
index a7b6b16dcc..26402b6e37 100644
--- a/osu.Game/Overlays/BeatmapSet/BasicStats.cs
+++ b/osu.Game/Overlays/BeatmapSet/BasicStats.cs
@@ -9,7 +9,7 @@ using osu.Framework.Graphics.Cursor;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
-using OpenTK;
+using osuTK;
namespace osu.Game.Overlays.BeatmapSet
{
diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs
index bd9d65ccd8..64a8a1062c 100644
--- a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs
+++ b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs
@@ -16,8 +16,8 @@ using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Overlays.BeatmapSet
{
diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs
index f3e49f68b1..8406dada44 100644
--- a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs
+++ b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs
@@ -12,8 +12,8 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.API;
using osu.Game.Users;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Overlays.BeatmapSet.Buttons
{
diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs
index 3821c96369..929f89482c 100644
--- a/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs
+++ b/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs
@@ -8,7 +8,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds;
-using OpenTK;
+using osuTK;
namespace osu.Game.Overlays.BeatmapSet.Buttons
{
diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs
index 1988b7d222..b971403443 100644
--- a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs
+++ b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs
@@ -13,8 +13,8 @@ using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Overlays.Direct;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Overlays.BeatmapSet.Buttons
{
diff --git a/osu.Game/Overlays/BeatmapSet/Details.cs b/osu.Game/Overlays/BeatmapSet/Details.cs
index ccd0fa04ab..709d163eaa 100644
--- a/osu.Game/Overlays/BeatmapSet/Details.cs
+++ b/osu.Game/Overlays/BeatmapSet/Details.cs
@@ -9,8 +9,8 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps;
using osu.Game.Overlays.BeatmapSet.Buttons;
using osu.Game.Screens.Select.Details;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Overlays.BeatmapSet
{
diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs
index 6f01fae92d..d353522d8d 100644
--- a/osu.Game/Overlays/BeatmapSet/Header.cs
+++ b/osu.Game/Overlays/BeatmapSet/Header.cs
@@ -13,8 +13,8 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.BeatmapSet.Buttons;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Overlays.BeatmapSet
{
diff --git a/osu.Game/Overlays/BeatmapSet/Info.cs b/osu.Game/Overlays/BeatmapSet/Info.cs
index 53216ad666..e985da0eb7 100644
--- a/osu.Game/Overlays/BeatmapSet/Info.cs
+++ b/osu.Game/Overlays/BeatmapSet/Info.cs
@@ -10,8 +10,8 @@ using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Overlays.BeatmapSet
{
diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs
index 309d75f60a..b172954c43 100644
--- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs
+++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
+using osuTK;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs
index d954b48b86..aa785385ba 100644
--- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs
+++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs
@@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs
index 60811d8b12..38107c047d 100644
--- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs
+++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
+using osuTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs
index 23c8ec3aab..5aff50a68a 100644
--- a/osu.Game/Overlays/BeatmapSetOverlay.cs
+++ b/osu.Game/Overlays/BeatmapSetOverlay.cs
@@ -16,8 +16,8 @@ using osu.Game.Online.API.Requests;
using osu.Game.Overlays.BeatmapSet;
using osu.Game.Overlays.BeatmapSet.Scores;
using osu.Game.Rulesets;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Overlays
{
diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs
index 1fccaeb123..c11de48430 100644
--- a/osu.Game/Overlays/Chat/ChatLine.cs
+++ b/osu.Game/Overlays/Chat/ChatLine.cs
@@ -1,9 +1,10 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+using System;
using System.Linq;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
@@ -81,6 +82,8 @@ namespace osu.Game.Overlays.Chat
Padding = new MarginPadding { Left = padding, Right = padding };
}
+ private ChannelManager chatManager;
+
private Message message;
private OsuSpriteText username;
private LinkFlowContainer contentFlow;
@@ -104,9 +107,9 @@ namespace osu.Game.Overlays.Chat
}
[BackgroundDependencyLoader(true)]
- private void load(OsuColour colours, ChatOverlay chat)
+ private void load(OsuColour colours, ChannelManager chatManager)
{
- this.chat = chat;
+ this.chatManager = chatManager;
customUsernameColour = colours.ChatBlue;
}
@@ -215,8 +218,6 @@ namespace osu.Game.Overlays.Chat
FinishTransforms(true);
}
- private ChatOverlay chat;
-
private void updateMessageContent()
{
this.FadeTo(message is LocalEchoMessage ? 0.4f : 1.0f, 500, Easing.OutQuint);
@@ -226,7 +227,7 @@ namespace osu.Game.Overlays.Chat
username.Text = $@"{message.Sender.Username}" + (senderHasBackground || message.IsAction ? "" : ":");
// remove non-existent channels from the link list
- message.Links.RemoveAll(link => link.Action == LinkAction.OpenChannel && chat?.AvailableChannels.Any(c => c.Name == link.Argument) != true);
+ message.Links.RemoveAll(link => link.Action == LinkAction.OpenChannel && chatManager?.AvailableChannels.Any(c => c.Name == link.Argument) != true);
contentFlow.Clear();
contentFlow.AddLinks(message.DisplayContent, message.Links);
@@ -236,20 +237,24 @@ namespace osu.Game.Overlays.Chat
{
private readonly User sender;
+ private Action startChatAction;
+
public MessageSender(User sender)
{
this.sender = sender;
}
[BackgroundDependencyLoader(true)]
- private void load(UserProfileOverlay profile)
+ private void load(UserProfileOverlay profile, ChannelManager chatManager)
{
Action = () => profile?.ShowUser(sender);
+ startChatAction = () => chatManager?.OpenPrivateChannel(sender);
}
public MenuItem[] ContextMenuItems => new MenuItem[]
{
new OsuMenuItem("View Profile", MenuItemType.Highlighted, Action),
+ new OsuMenuItem("Start Chat", MenuItemType.Standard, startChatAction),
};
}
}
diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs
index ec4fd85901..1f8c5d38b9 100644
--- a/osu.Game/Overlays/Chat/ChatTabControl.cs
+++ b/osu.Game/Overlays/Chat/ChatTabControl.cs
@@ -12,9 +12,9 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Chat;
-using OpenTK;
-using OpenTK.Input;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Input;
+using osuTK.Graphics;
using osu.Framework.Configuration;
using System;
using osu.Framework.Input.Events;
diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs
index c57e71b5ad..ce5d961282 100644
--- a/osu.Game/Overlays/Chat/DrawableChannel.cs
+++ b/osu.Game/Overlays/Chat/DrawableChannel.cs
@@ -5,8 +5,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
-using OpenTK.Graphics;
-using osu.Framework.Allocation;
+using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Containers;
@@ -55,15 +54,11 @@ namespace osu.Game.Overlays.Chat
Channel.PendingMessageResolved += pendingMessageResolved;
}
- [BackgroundDependencyLoader]
- private void load()
- {
- newMessagesArrived(Channel.Messages);
- }
-
protected override void LoadComplete()
{
base.LoadComplete();
+
+ newMessagesArrived(Channel.Messages);
scrollToEnd();
}
@@ -79,7 +74,7 @@ namespace osu.Game.Overlays.Chat
private void newMessagesArrived(IEnumerable newMessages)
{
// Add up to last Channel.MAX_HISTORY messages
- var displayMessages = newMessages.Skip(Math.Max(0, newMessages.Count() - Channel.MAX_HISTORY));
+ var displayMessages = newMessages.Skip(Math.Max(0, newMessages.Count() - Channel.MaxHistory));
flow.AddRange(displayMessages.Select(m => new ChatLine(m)));
@@ -89,7 +84,7 @@ namespace osu.Game.Overlays.Chat
scrollToEnd();
var staleMessages = flow.Children.Where(c => c.LifetimeEnd == double.MaxValue).ToArray();
- int count = staleMessages.Length - Channel.MAX_HISTORY;
+ int count = staleMessages.Length - Channel.MaxHistory;
for (int i = 0; i < count; i++)
{
diff --git a/osu.Game/Overlays/Chat/ExternalLinkDialog.cs b/osu.Game/Overlays/Chat/ExternalLinkDialog.cs
new file mode 100644
index 0000000000..b3f7b282a9
--- /dev/null
+++ b/osu.Game/Overlays/Chat/ExternalLinkDialog.cs
@@ -0,0 +1,33 @@
+// Copyright (c) 2007-2018 ppy Pty Ltd .
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using System;
+using osu.Game.Graphics;
+using osu.Game.Overlays.Dialog;
+
+namespace osu.Game.Overlays.Chat
+{
+ public class ExternalLinkDialog : PopupDialog
+ {
+ public ExternalLinkDialog(string url, Action openExternalLinkAction)
+ {
+ HeaderText = "Just checking...";
+ BodyText = $"You are about to leave osu! and open the following link in a web browser:\n\n{url}";
+
+ Icon = FontAwesome.fa_warning;
+
+ Buttons = new PopupDialogButton[]
+ {
+ new PopupDialogOkButton
+ {
+ Text = @"Yes. Go for it.",
+ Action = openExternalLinkAction
+ },
+ new PopupDialogCancelButton
+ {
+ Text = @"No! Abort mission!"
+ },
+ };
+ }
+ }
+}
diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs
similarity index 98%
rename from osu.Game/Overlays/Chat/ChannelListItem.cs
rename to osu.Game/Overlays/Chat/Selection/ChannelListItem.cs
index 8df29c89f2..5a96465520 100644
--- a/osu.Game/Overlays/Chat/ChannelListItem.cs
+++ b/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs
@@ -3,8 +3,8 @@
using System;
using System.Collections.Generic;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
@@ -15,7 +15,7 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Online.Chat;
using osu.Game.Graphics.Containers;
-namespace osu.Game.Overlays.Chat
+namespace osu.Game.Overlays.Chat.Selection
{
public class ChannelListItem : OsuClickableContainer, IFilterable
{
diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/Selection/ChannelSection.cs
similarity index 97%
rename from osu.Game/Overlays/Chat/ChannelSection.cs
rename to osu.Game/Overlays/Chat/Selection/ChannelSection.cs
index 85fdecaaba..94ee9d4bf6 100644
--- a/osu.Game/Overlays/Chat/ChannelSection.cs
+++ b/osu.Game/Overlays/Chat/Selection/ChannelSection.cs
@@ -3,13 +3,13 @@
using System.Collections.Generic;
using System.Linq;
-using OpenTK;
+using osuTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.Chat;
-namespace osu.Game.Overlays.Chat
+namespace osu.Game.Overlays.Chat.Selection
{
public class ChannelSection : Container, IHasFilterableChildren
{
diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs
similarity index 93%
rename from osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs
rename to osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs
index a86465b77b..3afac211f1 100644
--- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs
+++ b/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs
@@ -3,8 +3,8 @@
using System;
using System.Collections.Generic;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
@@ -18,7 +18,7 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Chat;
using osu.Game.Graphics.Containers;
-namespace osu.Game.Overlays.Chat
+namespace osu.Game.Overlays.Chat.Selection
{
public class ChannelSelectionOverlay : OsuFocusedOverlayContainer
{
@@ -35,23 +35,6 @@ namespace osu.Game.Overlays.Chat
public Action OnRequestJoin;
public Action OnRequestLeave;
- public IEnumerable Sections
- {
- set
- {
- sectionsFlow.ChildrenEnumerable = value;
-
- foreach (ChannelSection s in sectionsFlow.Children)
- {
- foreach (ChannelListItem c in s.ChannelFlow.Children)
- {
- c.OnRequestJoin = channel => { OnRequestJoin?.Invoke(channel); };
- c.OnRequestLeave = channel => { OnRequestLeave?.Invoke(channel); };
- }
- }
- }
- }
-
public ChannelSelectionOverlay()
{
RelativeSizeAxes = Axes.X;
@@ -140,6 +123,30 @@ namespace osu.Game.Overlays.Chat
search.Current.ValueChanged += newValue => sectionsFlow.SearchTerm = newValue;
}
+ public void UpdateAvailableChannels(IEnumerable channels)
+ {
+ Scheduler.Add(() =>
+ {
+ sectionsFlow.ChildrenEnumerable = new[]
+ {
+ new ChannelSection
+ {
+ Header = "All Channels",
+ Channels = channels,
+ },
+ };
+
+ foreach (ChannelSection s in sectionsFlow.Children)
+ {
+ foreach (ChannelListItem c in s.ChannelFlow.Children)
+ {
+ c.OnRequestJoin = channel => { OnRequestJoin?.Invoke(channel); };
+ c.OnRequestLeave = channel => { OnRequestLeave?.Invoke(channel); };
+ }
+ }
+ });
+ }
+
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs b/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs
new file mode 100644
index 0000000000..0b1721741a
--- /dev/null
+++ b/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs
@@ -0,0 +1,32 @@
+// Copyright (c) 2007-2018 ppy Pty Ltd .
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using osu.Framework.Allocation;
+using osu.Game.Graphics;
+using osu.Game.Online.Chat;
+
+namespace osu.Game.Overlays.Chat.Tabs
+{
+ public class ChannelSelectorTabItem : ChannelTabItem
+ {
+ public override bool IsRemovable => false;
+
+ public ChannelSelectorTabItem(Channel value) : base(value)
+ {
+ Depth = float.MaxValue;
+ Width = 45;
+
+ Icon.Alpha = 0;
+
+ Text.TextSize = 45;
+ TextBold.TextSize = 45;
+ }
+
+ [BackgroundDependencyLoader]
+ private new void load(OsuColour colour)
+ {
+ BackgroundInactive = colour.Gray2;
+ BackgroundActive = colour.Gray3;
+ }
+ }
+}
diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs
new file mode 100644
index 0000000000..79cb0a4d14
--- /dev/null
+++ b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs
@@ -0,0 +1,121 @@
+// Copyright (c) 2007-2018 ppy Pty Ltd .
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.UserInterface;
+using osu.Game.Graphics;
+using osu.Game.Graphics.UserInterface;
+using osu.Game.Online.Chat;
+using osuTK;
+using osu.Framework.Configuration;
+using System;
+using System.Linq;
+
+namespace osu.Game.Overlays.Chat.Tabs
+{
+ public class ChannelTabControl : OsuTabControl
+ {
+ public static readonly float SHEAR_WIDTH = 10;
+
+ public Action OnRequestLeave;
+
+ public readonly Bindable ChannelSelectorActive = new Bindable();
+
+ private readonly ChannelSelectorTabItem selectorTab;
+
+ public ChannelTabControl()
+ {
+ TabContainer.Margin = new MarginPadding { Left = 50 };
+ TabContainer.Spacing = new Vector2(-SHEAR_WIDTH, 0);
+ TabContainer.Masking = false;
+
+ AddInternal(new SpriteIcon
+ {
+ Icon = FontAwesome.fa_comments,
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Size = new Vector2(20),
+ Margin = new MarginPadding(10),
+ });
+
+ AddTabItem(selectorTab = new ChannelSelectorTabItem(new Channel { Name = "+" }));
+
+ ChannelSelectorActive.BindTo(selectorTab.Active);
+ }
+
+ protected override void AddTabItem(TabItem item, bool addToDropdown = true)
+ {
+ if (item != selectorTab && TabContainer.GetLayoutPosition(selectorTab) < float.MaxValue)
+ // performTabSort might've made selectorTab's position wonky, fix it
+ TabContainer.SetLayoutPosition(selectorTab, float.MaxValue);
+
+ base.AddTabItem(item, addToDropdown);
+ }
+
+ protected override TabItem CreateTabItem(Channel value)
+ {
+ switch (value.Type)
+ {
+ default:
+ return new ChannelTabItem(value) { OnRequestClose = tabCloseRequested };
+ case ChannelType.PM:
+ return new PrivateChannelTabItem(value) { OnRequestClose = tabCloseRequested };
+ }
+ }
+
+ ///
+ /// Adds a channel to the ChannelTabControl.
+ /// The first channel added will automaticly selected.
+ ///
+ /// The channel that is going to be added.
+ public void AddChannel(Channel channel)
+ {
+ if (!Items.Contains(channel))
+ AddItem(channel);
+
+ if (Current.Value == null)
+ Current.Value = channel;
+ }
+
+ ///
+ /// Removes a channel from the ChannelTabControl.
+ /// If the selected channel is the one that is beeing removed, the next available channel will be selected.
+ ///
+ /// The channel that is going to be removed.
+ public void RemoveChannel(Channel channel)
+ {
+ RemoveItem(channel);
+
+ if (Current.Value == channel)
+ Current.Value = Items.FirstOrDefault();
+ }
+
+ protected override void SelectTab(TabItem tab)
+ {
+ if (tab is ChannelSelectorTabItem)
+ {
+ tab.Active.Toggle();
+ return;
+ }
+
+ selectorTab.Active.Value = false;
+
+ base.SelectTab(tab);
+ }
+
+ private void tabCloseRequested(TabItem tab)
+ {
+ int totalTabs = TabContainer.Count - 1; // account for selectorTab
+ int currentIndex = MathHelper.Clamp(TabContainer.IndexOf(tab), 1, totalTabs);
+
+ if (tab == SelectedTab && totalTabs > 1)
+ // Select the tab after tab-to-be-removed's index, or the tab before if current == last
+ SelectTab(TabContainer[currentIndex == totalTabs ? currentIndex - 1 : currentIndex + 1]);
+ else if (totalTabs == 1 && !selectorTab.Active)
+ // Open channel selection overlay if all channel tabs will be closed after removing this tab
+ SelectTab(selectorTab);
+
+ OnRequestLeave?.Invoke(tab.Value);
+ }
+ }
+}
diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs b/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs
new file mode 100644
index 0000000000..e98eac0aa2
--- /dev/null
+++ b/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs
@@ -0,0 +1,212 @@
+// Copyright (c) 2007-2018 ppy Pty Ltd .
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using System;
+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.Graphics.UserInterface;
+using osu.Framework.Input.Events;
+using osu.Game.Graphics;
+using osu.Game.Graphics.Sprites;
+using osu.Game.Online.Chat;
+using osuTK;
+using osuTK.Graphics;
+
+namespace osu.Game.Overlays.Chat.Tabs
+{
+ public class ChannelTabItem : TabItem
+ {
+ protected Color4 BackgroundInactive;
+ private Color4 backgroundHover;
+ protected Color4 BackgroundActive;
+
+ public override bool IsRemovable => !Pinned;
+
+ protected readonly SpriteText Text;
+ protected readonly SpriteText TextBold;
+ protected readonly ClickableContainer CloseButton;
+ private readonly Box box;
+ private readonly Box highlightBox;
+ protected readonly SpriteIcon Icon;
+
+ public Action OnRequestClose;
+ private readonly Container content;
+
+ protected override Container Content => content;
+
+ public ChannelTabItem(Channel value)
+ : base(value)
+ {
+ Width = 150;
+
+ RelativeSizeAxes = Axes.Y;
+
+ Anchor = Anchor.BottomLeft;
+ Origin = Anchor.BottomLeft;
+
+ Shear = new Vector2(ChannelTabControl.SHEAR_WIDTH / ChatOverlay.TAB_AREA_HEIGHT, 0);
+
+ Masking = true;
+
+ InternalChildren = new Drawable[]
+ {
+ box = new Box
+ {
+ EdgeSmoothness = new Vector2(1, 0),
+ RelativeSizeAxes = Axes.Both,
+ },
+ highlightBox = new Box
+ {
+ Width = 5,
+ Alpha = 0,
+ Anchor = Anchor.BottomRight,
+ Origin = Anchor.BottomRight,
+ EdgeSmoothness = new Vector2(1, 0),
+ RelativeSizeAxes = Axes.Y,
+ },
+ content = new Container
+ {
+ Shear = new Vector2(-ChannelTabControl.SHEAR_WIDTH / ChatOverlay.TAB_AREA_HEIGHT, 0),
+ RelativeSizeAxes = Axes.Both,
+ Children = new Drawable[]
+ {
+ Icon = new SpriteIcon
+ {
+ Icon = DisplayIcon,
+ Anchor = Anchor.CentreLeft,
+ Origin = Anchor.CentreLeft,
+ Colour = Color4.Black,
+ X = -10,
+ Alpha = 0.2f,
+ Size = new Vector2(ChatOverlay.TAB_AREA_HEIGHT),
+ },
+ Text = new OsuSpriteText
+ {
+ Margin = new MarginPadding(5),
+ Origin = Anchor.CentreLeft,
+ Anchor = Anchor.CentreLeft,
+ Text = value.ToString(),
+ TextSize = 18,
+ },
+ TextBold = new OsuSpriteText
+ {
+ Alpha = 0,
+ Margin = new MarginPadding(5),
+ Origin = Anchor.CentreLeft,
+ Anchor = Anchor.CentreLeft,
+ Text = value.ToString(),
+ Font = @"Exo2.0-Bold",
+ TextSize = 18,
+ },
+ CloseButton = new TabCloseButton
+ {
+ Alpha = 0,
+ Margin = new MarginPadding { Right = 20 },
+ Origin = Anchor.CentreRight,
+ Anchor = Anchor.CentreRight,
+ Action = delegate
+ {
+ if (IsRemovable) OnRequestClose?.Invoke(this);
+ },
+ },
+ },
+ },
+ };
+ }
+
+ protected virtual FontAwesome DisplayIcon => FontAwesome.fa_hashtag;
+
+ protected virtual bool ShowCloseOnHover => true;
+
+ protected override bool OnHover(HoverEvent e)
+ {
+ if (IsRemovable && ShowCloseOnHover)
+ CloseButton.FadeIn(200, Easing.OutQuint);
+
+ if (!Active)
+ box.FadeColour(backgroundHover, TRANSITION_LENGTH, Easing.OutQuint);
+ return true;
+ }
+
+ protected override void OnHoverLost(HoverLostEvent e)
+ {
+ CloseButton.FadeOut(200, Easing.OutQuint);
+ updateState();
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ BackgroundActive = colours.ChatBlue;
+ BackgroundInactive = colours.Gray4;
+ backgroundHover = colours.Gray7;
+
+ highlightBox.Colour = colours.Yellow;
+ }
+
+ protected override void LoadComplete()
+ {
+ base.LoadComplete();
+
+ updateState();
+ FinishTransforms(true);
+ }
+
+ private void updateState()
+ {
+ if (Active)
+ FadeActive();
+ else
+ FadeInactive();
+ }
+
+ protected const float TRANSITION_LENGTH = 400;
+
+ private readonly EdgeEffectParameters activateEdgeEffect = new EdgeEffectParameters
+ {
+ Type = EdgeEffectType.Shadow,
+ Radius = 15,
+ Colour = Color4.Black.Opacity(0.4f),
+ };
+
+ private readonly EdgeEffectParameters deactivateEdgeEffect = new EdgeEffectParameters
+ {
+ Type = EdgeEffectType.Shadow,
+ Radius = 10,
+ Colour = Color4.Black.Opacity(0.2f),
+ };
+
+ protected virtual void FadeActive()
+ {
+ this.ResizeHeightTo(1.1f, TRANSITION_LENGTH, Easing.OutQuint);
+
+ TweenEdgeEffectTo(activateEdgeEffect, TRANSITION_LENGTH);
+
+ box.FadeColour(BackgroundActive, TRANSITION_LENGTH, Easing.OutQuint);
+ highlightBox.FadeIn(TRANSITION_LENGTH, Easing.OutQuint);
+
+ Text.FadeOut(TRANSITION_LENGTH, Easing.OutQuint);
+ TextBold.FadeIn(TRANSITION_LENGTH, Easing.OutQuint);
+ }
+
+ protected virtual void FadeInactive()
+ {
+ this.ResizeHeightTo(1, TRANSITION_LENGTH, Easing.OutQuint);
+
+ TweenEdgeEffectTo(deactivateEdgeEffect, TRANSITION_LENGTH);
+
+ box.FadeColour(BackgroundInactive, TRANSITION_LENGTH, Easing.OutQuint);
+ highlightBox.FadeOut(TRANSITION_LENGTH, Easing.OutQuint);
+
+ Text.FadeIn(TRANSITION_LENGTH, Easing.OutQuint);
+ TextBold.FadeOut(TRANSITION_LENGTH, Easing.OutQuint);
+ }
+
+ protected override void OnActivated() => updateState();
+ protected override void OnDeactivated() => updateState();
+ }
+}
diff --git a/osu.Game/Overlays/Chat/Tabs/PrivateChannelTabItem.cs b/osu.Game/Overlays/Chat/Tabs/PrivateChannelTabItem.cs
new file mode 100644
index 0000000000..e04d7891f8
--- /dev/null
+++ b/osu.Game/Overlays/Chat/Tabs/PrivateChannelTabItem.cs
@@ -0,0 +1,97 @@
+// Copyright (c) 2007-2018 ppy Pty Ltd .
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using System;
+using System.Linq;
+using osu.Framework.Allocation;
+using osu.Framework.Extensions.Color4Extensions;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Game.Graphics;
+using osu.Game.Graphics.Sprites;
+using osu.Game.Online.Chat;
+using osu.Game.Users;
+using osuTK;
+
+namespace osu.Game.Overlays.Chat.Tabs
+{
+ public class PrivateChannelTabItem : ChannelTabItem
+ {
+ private readonly OsuSpriteText username;
+ private readonly Avatar avatarContainer;
+
+ protected override FontAwesome DisplayIcon => FontAwesome.fa_at;
+
+ public PrivateChannelTabItem(Channel value)
+ : base(value)
+ {
+ if (value.Type != ChannelType.PM)
+ throw new ArgumentException("Argument value needs to have the targettype user!");
+
+ AddRange(new Drawable[]
+ {
+ new Container
+ {
+ RelativeSizeAxes = Axes.Y,
+ AutoSizeAxes = Axes.X,
+ Margin = new MarginPadding
+ {
+ Horizontal = 3
+ },
+ Origin = Anchor.BottomLeft,
+ Anchor = Anchor.BottomLeft,
+ Children = new Drawable[]
+ {
+ new CircularContainer
+ {
+ Scale = new Vector2(0.95f),
+ Size = new Vector2(ChatOverlay.TAB_AREA_HEIGHT),
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Masking = true,
+ Child = new DelayedLoadWrapper(new Avatar(value.Users.First())
+ {
+ RelativeSizeAxes = Axes.Both,
+ OnLoadComplete = d => d.FadeInFromZero(300, Easing.OutQuint),
+ })
+ {
+ RelativeSizeAxes = Axes.Both,
+ }
+ },
+ }
+ },
+ });
+
+ Text.X = ChatOverlay.TAB_AREA_HEIGHT;
+ TextBold.X = ChatOverlay.TAB_AREA_HEIGHT;
+ }
+
+ protected override bool ShowCloseOnHover => false;
+
+ protected override void FadeActive()
+ {
+ base.FadeActive();
+
+ this.ResizeWidthTo(200, TRANSITION_LENGTH, Easing.OutQuint);
+ CloseButton.FadeIn(TRANSITION_LENGTH, Easing.OutQuint);
+ }
+
+
+ protected override void FadeInactive()
+ {
+ base.FadeInactive();
+
+ this.ResizeWidthTo(ChatOverlay.TAB_AREA_HEIGHT + 10, TRANSITION_LENGTH, Easing.OutQuint);
+ CloseButton.FadeOut(TRANSITION_LENGTH, Easing.OutQuint);
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours)
+ {
+ var user = Value.Users.First();
+
+ BackgroundActive = user.Colour != null ? OsuColour.FromHex(user.Colour) : colours.BlueDark;
+ BackgroundInactive = BackgroundActive.Darken(0.5f);
+ }
+ }
+}
diff --git a/osu.Game/Overlays/Chat/Tabs/TabCloseButton.cs b/osu.Game/Overlays/Chat/Tabs/TabCloseButton.cs
new file mode 100644
index 0000000000..d7d9b3f95c
--- /dev/null
+++ b/osu.Game/Overlays/Chat/Tabs/TabCloseButton.cs
@@ -0,0 +1,55 @@
+// Copyright (c) 2007-2018 ppy Pty Ltd .
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using osu.Framework.Graphics;
+using osu.Framework.Input.Events;
+using osu.Game.Graphics;
+using osu.Game.Graphics.Containers;
+using osuTK;
+using osuTK.Graphics;
+
+namespace osu.Game.Overlays.Chat.Tabs
+{
+ public class TabCloseButton : OsuClickableContainer
+ {
+ private readonly SpriteIcon icon;
+
+ public TabCloseButton()
+ {
+ Size = new Vector2(20);
+
+ Child = icon = new SpriteIcon
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Scale = new Vector2(0.75f),
+ Icon = FontAwesome.fa_close,
+ RelativeSizeAxes = Axes.Both,
+ };
+ }
+
+ protected override bool OnMouseDown(MouseDownEvent e)
+ {
+ icon.ScaleTo(0.5f, 1000, Easing.OutQuint);
+ return base.OnMouseDown(e);
+ }
+
+ protected override bool OnMouseUp(MouseUpEvent e)
+ {
+ icon.ScaleTo(0.75f, 1000, Easing.OutElastic);
+ return base.OnMouseUp(e);
+ }
+
+ protected override bool OnHover(HoverEvent e)
+ {
+ icon.FadeColour(Color4.Red, 200, Easing.OutQuint);
+ return base.OnHover(e);
+ }
+
+ protected override void OnHoverLost(HoverLostEvent e)
+ {
+ icon.FadeColour(Color4.White, 200, Easing.OutQuint);
+ base.OnHoverLost(e);
+ }
+ }
+}
diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs
index ff2ff9af14..b1edfe0548 100644
--- a/osu.Game/Overlays/ChatOverlay.cs
+++ b/osu.Game/Overlays/ChatOverlay.cs
@@ -1,11 +1,10 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using System;
using System.Collections.Generic;
-using System.Linq;
-using OpenTK;
-using OpenTK.Graphics;
+using System.Collections.Specialized;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
@@ -13,42 +12,38 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
-using osu.Framework.Threading;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
-using osu.Game.Online.API;
-using osu.Game.Online.API.Requests;
using osu.Game.Online.Chat;
using osu.Game.Overlays.Chat;
+using osu.Game.Overlays.Chat.Selection;
+using osu.Game.Overlays.Chat.Tabs;
namespace osu.Game.Overlays
{
- public class ChatOverlay : OsuFocusedOverlayContainer, IOnlineComponent
+ public class ChatOverlay : OsuFocusedOverlayContainer
{
private const float textbox_height = 60;
private const float channel_selection_min_height = 0.3f;
- private ScheduledDelegate messageRequest;
+ private ChannelManager channelManager;
private readonly Container currentChannelContainer;
+ private readonly List loadedChannels = new List();
private readonly LoadingAnimation loading;
private readonly FocusedTextBox textbox;
- private APIAccess api;
-
private const int transition_length = 500;
public const float DEFAULT_HEIGHT = 0.4f;
public const float TAB_AREA_HEIGHT = 50;
- private GetUpdatesRequest fetchReq;
-
- private readonly ChatTabControl channelTabs;
+ private readonly ChannelTabControl channelTabControl;
private readonly Container chatContainer;
private readonly TabsArea tabsArea;
@@ -57,7 +52,6 @@ namespace osu.Game.Overlays
public Bindable ChatHeight { get; set; }
- public List AvailableChannels { get; private set; } = new List();
private readonly Container channelSelectionContainer;
private readonly ChannelSelectionOverlay channelSelection;
@@ -154,10 +148,12 @@ namespace osu.Game.Overlays
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
},
- channelTabs = new ChatTabControl
+ channelTabControl = new ChannelTabControl
{
+ Anchor = Anchor.BottomLeft,
+ Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.Both,
- OnRequestLeave = removeChannel,
+ OnRequestLeave = channel => channelManager.LeaveChannel(channel)
},
}
},
@@ -165,11 +161,11 @@ namespace osu.Game.Overlays
},
};
- channelTabs.Current.ValueChanged += newChannel => CurrentChannel = newChannel;
- channelTabs.ChannelSelectorActive.ValueChanged += value => channelSelection.State = value ? Visibility.Visible : Visibility.Hidden;
+ channelTabControl.Current.ValueChanged += chat => channelManager.CurrentChannel.Value = chat;
+ channelTabControl.ChannelSelectorActive.ValueChanged += value => channelSelection.State = value ? Visibility.Visible : Visibility.Hidden;
channelSelection.StateChanged += state =>
{
- channelTabs.ChannelSelectorActive.Value = state == Visibility.Visible;
+ channelTabControl.ChannelSelectorActive.Value = state == Visibility.Visible;
if (state == Visibility.Visible)
{
@@ -180,13 +176,74 @@ namespace osu.Game.Overlays
else
textbox.HoldFocus = true;
};
+
+ channelSelection.OnRequestJoin = channel => channelManager.JoinChannel(channel);
+ channelSelection.OnRequestLeave = channel => channelManager.LeaveChannel(channel);
+ }
+
+ private void joinedChannelsChanged(object sender, NotifyCollectionChangedEventArgs args)
+ {
+ switch (args.Action)
+ {
+ case NotifyCollectionChangedAction.Add:
+ foreach (Channel newChannel in args.NewItems)
+ {
+ channelTabControl.AddChannel(newChannel);
+ }
+
+ break;
+ case NotifyCollectionChangedAction.Remove:
+ foreach (Channel removedChannel in args.OldItems)
+ {
+ channelTabControl.RemoveChannel(removedChannel);
+ loadedChannels.Remove(loadedChannels.Find(c => c.Channel == removedChannel));
+ }
+
+ break;
+ }
+ }
+
+ private void currentChannelChanged(Channel channel)
+ {
+ if (channel == null)
+ {
+ textbox.Current.Disabled = true;
+ currentChannelContainer.Clear(false);
+ return;
+ }
+
+ textbox.Current.Disabled = channel.ReadOnly;
+
+ if (channelTabControl.Current.Value != channel)
+ Scheduler.Add(() => channelTabControl.Current.Value = channel);
+
+ var loaded = loadedChannels.Find(d => d.Channel == channel);
+ if (loaded == null)
+ {
+ currentChannelContainer.FadeOut(500, Easing.OutQuint);
+ loading.Show();
+
+ loaded = new DrawableChannel(channel);
+ loadedChannels.Add(loaded);
+ LoadComponentAsync(loaded, l =>
+ {
+ loading.Hide();
+
+ currentChannelContainer.Clear(false);
+ currentChannelContainer.Add(loaded);
+ currentChannelContainer.FadeIn(500, Easing.OutQuint);
+ });
+ }
+ else
+ {
+ currentChannelContainer.Clear(false);
+ Scheduler.Add(() => currentChannelContainer.Add(loaded));
+ }
}
private double startDragChatHeight;
private bool isDragging;
- public void OpenChannel(Channel channel) => addChannel(channel);
-
protected override bool OnDragStart(DragStartEvent e)
{
isDragging = tabsArea.IsHovered;
@@ -220,19 +277,6 @@ namespace osu.Game.Overlays
return base.OnDragEnd(e);
}
- public void APIStateChanged(APIAccess api, APIState state)
- {
- switch (state)
- {
- case APIState.Online:
- initializeChannels();
- break;
- default:
- messageRequest?.Cancel();
- break;
- }
- }
-
public override bool AcceptsFocus => true;
protected override void OnFocus(FocusEvent e)
@@ -261,11 +305,8 @@ namespace osu.Game.Overlays
}
[BackgroundDependencyLoader]
- private void load(APIAccess api, OsuConfigManager config, OsuColour colours)
+ private void load(OsuConfigManager config, OsuColour colours, ChannelManager channelManager)
{
- this.api = api;
- api.Register(this);
-
ChatHeight = config.GetBindable(OsuSetting.ChatDisplayHeight);
ChatHeight.ValueChanged += h =>
{
@@ -276,255 +317,49 @@ namespace osu.Game.Overlays
ChatHeight.TriggerChange();
chatBackground.Colour = colours.ChatBlue;
- }
- private long lastMessageId;
-
- private readonly List careChannels = new List();
-
- private readonly List loadedChannels = new List();
-
- private void initializeChannels()
- {
loading.Show();
- messageRequest?.Cancel();
+ this.channelManager = channelManager;
+ channelManager.CurrentChannel.ValueChanged += currentChannelChanged;
+ channelManager.JoinedChannels.CollectionChanged += joinedChannelsChanged;
+ channelManager.AvailableChannels.CollectionChanged += availableChannelsChanged;
- ListChannelsRequest req = new ListChannelsRequest();
- req.Success += delegate(List channels)
- {
- AvailableChannels = channels;
-
- Scheduler.Add(delegate
- {
- //todo: decide how to handle default channels for a user now that they are saved server-side.
- addChannel(channels.Find(c => c.Name == @"#lazer"));
- addChannel(channels.Find(c => c.Name == @"#osu"));
-
- channelSelection.OnRequestJoin = addChannel;
- channelSelection.OnRequestLeave = removeChannel;
- channelSelection.Sections = new[]
- {
- new ChannelSection
- {
- Header = "All Channels",
- Channels = channels,
- },
- };
- });
-
- messageRequest = Scheduler.AddDelayed(fetchUpdates, 1000, true);
- };
-
- api.Queue(req);
+ //for the case that channelmanager was faster at fetching the channels than our attachment to CollectionChanged.
+ channelSelection.UpdateAvailableChannels(channelManager.AvailableChannels);
+ joinedChannelsChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, channelManager.JoinedChannels));
}
- private Channel currentChannel;
-
- protected Channel CurrentChannel
+ private void availableChannelsChanged(object sender, NotifyCollectionChangedEventArgs e)
{
- get { return currentChannel; }
+ channelSelection.UpdateAvailableChannels(channelManager.AvailableChannels);
+ }
- set
+ protected override void Dispose(bool isDisposing)
+ {
+ base.Dispose(isDisposing);
+
+ if (channelManager != null)
{
- if (currentChannel == value) return;
-
- if (value == null)
- {
- currentChannel = null;
- textbox.Current.Disabled = true;
- currentChannelContainer.Clear(false);
- return;
- }
-
- currentChannel = value;
-
- textbox.Current.Disabled = currentChannel.ReadOnly;
- channelTabs.Current.Value = value;
-
- var loaded = loadedChannels.Find(d => d.Channel == value);
- if (loaded == null)
- {
- currentChannelContainer.FadeOut(500, Easing.OutQuint);
- loading.Show();
-
- loaded = new DrawableChannel(currentChannel);
- loadedChannels.Add(loaded);
- LoadComponentAsync(loaded, l =>
- {
- if (currentChannel.MessagesLoaded)
- loading.Hide();
-
- currentChannelContainer.Clear(false);
- currentChannelContainer.Add(loaded);
- currentChannelContainer.FadeIn(500, Easing.OutQuint);
- });
- }
- else
- {
- currentChannelContainer.Clear(false);
- currentChannelContainer.Add(loaded);
- }
+ channelManager.CurrentChannel.ValueChanged -= currentChannelChanged;
+ channelManager.JoinedChannels.CollectionChanged -= joinedChannelsChanged;
+ channelManager.AvailableChannels.CollectionChanged -= availableChannelsChanged;
}
}
- private void addChannel(Channel channel)
- {
- if (channel == null) return;
-
- // ReSharper disable once AccessToModifiedClosure
- var existing = careChannels.Find(c => c.Id == channel.Id);
-
- if (existing != null)
- {
- // if we already have this channel loaded, we don't want to make a second one.
- channel = existing;
- }
- else
- {
- careChannels.Add(channel);
- channelTabs.AddItem(channel);
-
- if (channel.Type == ChannelType.Public && !channel.Joined)
- {
- var req = new JoinChannelRequest(channel, api.LocalUser);
- req.Success += () => addChannel(channel);
- req.Failure += ex => removeChannel(channel);
- api.Queue(req);
- return;
- }
- }
-
- // let's fetch a small number of messages to bring us up-to-date with the backlog.
- fetchInitialMessages(channel);
-
- if (CurrentChannel == null)
- CurrentChannel = channel;
-
- channel.Joined.Value = true;
- }
-
- private void removeChannel(Channel channel)
- {
- if (channel == null) return;
-
- if (channel == CurrentChannel) CurrentChannel = null;
-
- careChannels.Remove(channel);
- loadedChannels.Remove(loadedChannels.Find(c => c.Channel == channel));
- channelTabs.RemoveItem(channel);
-
- api.Queue(new LeaveChannelRequest(channel, api.LocalUser));
- channel.Joined.Value = false;
- }
-
- private void fetchInitialMessages(Channel channel)
- {
- var req = new GetMessagesRequest(channel);
- req.Success += messages =>
- {
- channel.AddNewMessages(messages.ToArray());
- if (channel == currentChannel)
- loading.Hide();
- };
-
- api.Queue(req);
- }
-
- private void fetchUpdates()
- {
- if (fetchReq != null) return;
-
- fetchReq = new GetUpdatesRequest(lastMessageId);
-
- fetchReq.Success += updates =>
- {
- if (updates?.Presence != null)
- {
- foreach (var channel in updates.Presence)
- addChannel(AvailableChannels.Find(c => c.Id == channel.Id));
-
- foreach (var group in updates.Messages.GroupBy(m => m.ChannelId))
- careChannels.Find(c => c.Id == group.Key)?.AddNewMessages(group.ToArray());
-
- lastMessageId = updates.Messages.LastOrDefault()?.Id ?? lastMessageId;
- }
-
- fetchReq = null;
- };
-
- fetchReq.Failure += delegate { fetchReq = null; };
-
- api.Queue(fetchReq);
- }
-
private void postMessage(TextBox textbox, bool newText)
{
- var postText = textbox.Text;
+ var text = textbox.Text.Trim();
+
+ if (string.IsNullOrWhiteSpace(text))
+ return;
+
+ if (text[0] == '/')
+ channelManager.PostCommand(text.Substring(1));
+ else
+ channelManager.PostMessage(text);
textbox.Text = string.Empty;
-
- if (string.IsNullOrWhiteSpace(postText))
- return;
-
- var target = currentChannel;
-
- if (target == null) return;
-
- if (!api.IsLoggedIn)
- {
- target.AddNewMessages(new ErrorMessage("Please sign in to participate in chat!"));
- return;
- }
-
- bool isAction = false;
-
- if (postText[0] == '/')
- {
- string[] parameters = postText.Substring(1).Split(new[] { ' ' }, 2);
- string command = parameters[0];
- string content = parameters.Length == 2 ? parameters[1] : string.Empty;
-
- switch (command)
- {
- case "me":
-
- if (string.IsNullOrWhiteSpace(content))
- {
- currentChannel.AddNewMessages(new ErrorMessage("Usage: /me [action]"));
- return;
- }
-
- isAction = true;
- postText = content;
- break;
-
- case "help":
- currentChannel.AddNewMessages(new InfoMessage("Supported commands: /help, /me [action]"));
- return;
-
- default:
- currentChannel.AddNewMessages(new ErrorMessage($@"""/{command}"" is not supported! For a list of supported commands see /help"));
- return;
- }
- }
-
- var message = new LocalEchoMessage
- {
- Sender = api.LocalUser.Value,
- Timestamp = DateTimeOffset.Now,
- ChannelId = target.Id,
- IsAction = isAction,
- Content = postText
- };
-
- var req = new PostMessageRequest(message);
-
- target.AddLocalEcho(message);
- req.Failure += e => target.ReplaceMessage(message, null);
- req.Success += m => target.ReplaceMessage(message, m);
-
- api.Queue(req);
}
private class TabsArea : Container
diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs
index f421d2202c..ca921b7882 100644
--- a/osu.Game/Overlays/Dialog/PopupDialog.cs
+++ b/osu.Game/Overlays/Dialog/PopupDialog.cs
@@ -7,16 +7,14 @@ 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.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Containers;
-using osu.Game.Graphics.Sprites;
using osu.Game.Input.Bindings;
-using OpenTK;
-using OpenTK.Graphics;
-using OpenTK.Input;
+using osuTK;
+using osuTK.Graphics;
+using osuTK.Input;
namespace osu.Game.Overlays.Dialog
{
@@ -35,7 +33,7 @@ namespace osu.Game.Overlays.Dialog
private readonly Container ring;
private readonly FillFlowContainer buttonsContainer;
private readonly SpriteIcon icon;
- private readonly SpriteText header;
+ private readonly TextFlowContainer header;
private readonly TextFlowContainer body;
private bool actionInvoked;
@@ -46,10 +44,19 @@ namespace osu.Game.Overlays.Dialog
set => icon.Icon = value;
}
+ private string text;
+
public string HeaderText
{
- get => header.Text;
- set => header.Text = value;
+ get => text;
+ set
+ {
+ if (text == value)
+ return;
+ text = value;
+
+ header.Text = value;
+ }
}
public string BodyText
@@ -164,18 +171,20 @@ namespace osu.Game.Overlays.Dialog
},
},
},
- header = new OsuSpriteText
+ header = new OsuTextFlowContainer(t => t.TextSize = 25)
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
- TextSize = 25,
- Shadow = true,
+ RelativeSizeAxes = Axes.X,
+ AutoSizeAxes = Axes.Y,
+ Padding = new MarginPadding(15),
+ TextAnchor = Anchor.TopCentre,
},
body = new OsuTextFlowContainer(t => t.TextSize = 18)
{
- Padding = new MarginPadding(15),
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
+ Padding = new MarginPadding(15),
TextAnchor = Anchor.TopCentre,
},
},
diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs
index 1c462e3a73..006e3a034b 100644
--- a/osu.Game/Overlays/Direct/DirectGridPanel.cs
+++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs
@@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs
index 6cb5ebad4e..a922ceb484 100644
--- a/osu.Game/Overlays/Direct/DirectListPanel.cs
+++ b/osu.Game/Overlays/Direct/DirectListPanel.cs
@@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs
index 5c7c34a0ed..44f7b6d49c 100644
--- a/osu.Game/Overlays/Direct/DirectPanel.cs
+++ b/osu.Game/Overlays/Direct/DirectPanel.cs
@@ -18,8 +18,8 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API.Requests;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Overlays.Direct
{
@@ -174,11 +174,11 @@ namespace osu.Game.Overlays.Direct
};
}
- private void setAdded(BeatmapSetInfo s)
+ private void setAdded(BeatmapSetInfo s) => Schedule(() =>
{
if (s.OnlineBeatmapSetID == SetInfo.OnlineBeatmapSetID)
progressBar.FadeOut(500);
- }
+ });
protected override void LoadComplete()
{
diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs
index 99a5881487..e326f5e592 100644
--- a/osu.Game/Overlays/Direct/DownloadButton.cs
+++ b/osu.Game/Overlays/Direct/DownloadButton.cs
@@ -8,7 +8,7 @@ using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
-using OpenTK;
+using osuTK;
namespace osu.Game.Overlays.Direct
{
diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs
index c4825f72fe..3f2c3a4fbf 100644
--- a/osu.Game/Overlays/Direct/FilterControl.cs
+++ b/osu.Game/Overlays/Direct/FilterControl.cs
@@ -10,8 +10,8 @@ using osu.Game.Graphics.Containers;
using osu.Game.Online.API.Requests;
using osu.Game.Overlays.SearchableList;
using osu.Game.Rulesets;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Overlays.Direct
{
diff --git a/osu.Game/Overlays/Direct/Header.cs b/osu.Game/Overlays/Direct/Header.cs
index 01180f1fde..2ca7b558ba 100644
--- a/osu.Game/Overlays/Direct/Header.cs
+++ b/osu.Game/Overlays/Direct/Header.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel;
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
diff --git a/osu.Game/Overlays/Direct/IconPill.cs b/osu.Game/Overlays/Direct/IconPill.cs
index 61a0c63814..9ac544ea78 100644
--- a/osu.Game/Overlays/Direct/IconPill.cs
+++ b/osu.Game/Overlays/Direct/IconPill.cs
@@ -5,8 +5,8 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Overlays.Direct
{
diff --git a/osu.Game/Overlays/Direct/PlayButton.cs b/osu.Game/Overlays/Direct/PlayButton.cs
index ac7a26fca3..d9b36e2367 100644
--- a/osu.Game/Overlays/Direct/PlayButton.cs
+++ b/osu.Game/Overlays/Direct/PlayButton.cs
@@ -10,8 +10,8 @@ using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Overlays.Direct
{
diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs
index 641f57d25f..765c86e6ad 100644
--- a/osu.Game/Overlays/DirectOverlay.cs
+++ b/osu.Game/Overlays/DirectOverlay.cs
@@ -18,8 +18,8 @@ using osu.Game.Online.API.Requests;
using osu.Game.Overlays.Direct;
using osu.Game.Overlays.SearchableList;
using osu.Game.Rulesets;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Overlays
{
diff --git a/osu.Game/Overlays/HoldToConfirmOverlay.cs b/osu.Game/Overlays/HoldToConfirmOverlay.cs
index 7e2f6f5891..b2c1ad20be 100644
--- a/osu.Game/Overlays/HoldToConfirmOverlay.cs
+++ b/osu.Game/Overlays/HoldToConfirmOverlay.cs
@@ -5,7 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Containers;
-using OpenTK.Graphics;
+using osuTK.Graphics;
namespace osu.Game.Overlays
{
diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs
index 63ddc25fde..fe2903d393 100644
--- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs
+++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs
@@ -15,8 +15,8 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Input;
-using OpenTK.Graphics;
-using OpenTK.Input;
+using osuTK.Graphics;
+using osuTK.Input;
namespace osu.Game.Overlays.KeyBinding
{
diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingsSubsection.cs b/osu.Game/Overlays/KeyBinding/KeyBindingsSubsection.cs
index 895dda872a..9e57b9eefa 100644
--- a/osu.Game/Overlays/KeyBinding/KeyBindingsSubsection.cs
+++ b/osu.Game/Overlays/KeyBinding/KeyBindingsSubsection.cs
@@ -10,7 +10,7 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Input;
using osu.Game.Overlays.Settings;
using osu.Game.Rulesets;
-using OpenTK;
+using osuTK;
using osu.Game.Graphics;
namespace osu.Game.Overlays.KeyBinding
diff --git a/osu.Game/Overlays/LoginOverlay.cs b/osu.Game/Overlays/LoginOverlay.cs
index 731c5ee973..e094f8ef48 100644
--- a/osu.Game/Overlays/LoginOverlay.cs
+++ b/osu.Game/Overlays/LoginOverlay.cs
@@ -6,7 +6,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Overlays.Settings.Sections.General;
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Cursor;
diff --git a/osu.Game/Overlays/MainSettings.cs b/osu.Game/Overlays/MainSettings.cs
index 736843ee4d..cd9cf8d50e 100644
--- a/osu.Game/Overlays/MainSettings.cs
+++ b/osu.Game/Overlays/MainSettings.cs
@@ -14,8 +14,8 @@ using osu.Game.Input.Bindings;
using osu.Game.Overlays.Settings;
using osu.Game.Overlays.Settings.Sections;
using osu.Game.Screens.Ranking;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Overlays
{
diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs
index dcd325490a..85875d2052 100644
--- a/osu.Game/Overlays/MedalOverlay.cs
+++ b/osu.Game/Overlays/MedalOverlay.cs
@@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -16,7 +16,7 @@ using osu.Framework.Allocation;
using osu.Framework.Audio.Sample;
using osu.Framework.Audio;
using osu.Framework.Graphics.Textures;
-using OpenTK.Input;
+using osuTK.Input;
using osu.Framework.Graphics.Shapes;
using System;
using osu.Framework.Input.Events;
diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs
index 629b6d6fa4..87d5724d24 100644
--- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs
+++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs
@@ -3,7 +3,7 @@
using System;
using osu.Framework;
-using OpenTK;
+using osuTK;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs
index ecb65f6df2..239688e284 100644
--- a/osu.Game/Overlays/Mods/ModButton.cs
+++ b/osu.Game/Overlays/Mods/ModButton.cs
@@ -1,9 +1,9 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
-using OpenTK.Graphics;
-using OpenTK.Input;
+using osuTK;
+using osuTK.Graphics;
+using osuTK.Input;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
diff --git a/osu.Game/Overlays/Mods/ModButtonEmpty.cs b/osu.Game/Overlays/Mods/ModButtonEmpty.cs
index 9129856c8f..dfe14e066e 100644
--- a/osu.Game/Overlays/Mods/ModButtonEmpty.cs
+++ b/osu.Game/Overlays/Mods/ModButtonEmpty.cs
@@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
+using osuTK;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Overlays.Mods
diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs
index c0d2d889c6..8ac98ddff6 100644
--- a/osu.Game/Overlays/Mods/ModSection.cs
+++ b/osu.Game/Overlays/Mods/ModSection.cs
@@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
-using OpenTK.Input;
+using osuTK;
+using osuTK.Input;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Sprites;
diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs
index 55d5d797e7..742a3830b4 100644
--- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs
+++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs
@@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Extensions.Color4Extensions;
diff --git a/osu.Game/Overlays/Mods/Sections/AutomationSection.cs b/osu.Game/Overlays/Mods/Sections/AutomationSection.cs
index 2b509d539e..c14ed270f7 100644
--- a/osu.Game/Overlays/Mods/Sections/AutomationSection.cs
+++ b/osu.Game/Overlays/Mods/Sections/AutomationSection.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Mods;
-using OpenTK.Input;
+using osuTK.Input;
namespace osu.Game.Overlays.Mods.Sections
{
diff --git a/osu.Game/Overlays/Mods/Sections/ConversionSection.cs b/osu.Game/Overlays/Mods/Sections/ConversionSection.cs
index 568f0ecfce..90ff879265 100644
--- a/osu.Game/Overlays/Mods/Sections/ConversionSection.cs
+++ b/osu.Game/Overlays/Mods/Sections/ConversionSection.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Mods;
-using OpenTK.Input;
+using osuTK.Input;
namespace osu.Game.Overlays.Mods.Sections
{
diff --git a/osu.Game/Overlays/Mods/Sections/DifficultyIncreaseSection.cs b/osu.Game/Overlays/Mods/Sections/DifficultyIncreaseSection.cs
index 5aced7ed5d..f1b7edf98b 100644
--- a/osu.Game/Overlays/Mods/Sections/DifficultyIncreaseSection.cs
+++ b/osu.Game/Overlays/Mods/Sections/DifficultyIncreaseSection.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Mods;
-using OpenTK.Input;
+using osuTK.Input;
namespace osu.Game.Overlays.Mods.Sections
{
diff --git a/osu.Game/Overlays/Mods/Sections/DifficultyReductionSection.cs b/osu.Game/Overlays/Mods/Sections/DifficultyReductionSection.cs
index 29fae2c70a..8ab9251431 100644
--- a/osu.Game/Overlays/Mods/Sections/DifficultyReductionSection.cs
+++ b/osu.Game/Overlays/Mods/Sections/DifficultyReductionSection.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Mods;
-using OpenTK.Input;
+using osuTK.Input;
namespace osu.Game.Overlays.Mods.Sections
{
diff --git a/osu.Game/Overlays/Mods/Sections/FunSection.cs b/osu.Game/Overlays/Mods/Sections/FunSection.cs
index ef975d9d75..29329f9c1d 100644
--- a/osu.Game/Overlays/Mods/Sections/FunSection.cs
+++ b/osu.Game/Overlays/Mods/Sections/FunSection.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Mods;
-using OpenTK.Input;
+using osuTK.Input;
namespace osu.Game.Overlays.Mods.Sections
{
diff --git a/osu.Game/Overlays/Music/CollectionsDropdown.cs b/osu.Game/Overlays/Music/CollectionsDropdown.cs
index e06688e8f0..7b2f81b60c 100644
--- a/osu.Game/Overlays/Music/CollectionsDropdown.cs
+++ b/osu.Game/Overlays/Music/CollectionsDropdown.cs
@@ -1,8 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
diff --git a/osu.Game/Overlays/Music/FilterControl.cs b/osu.Game/Overlays/Music/FilterControl.cs
index 2d492dcf1e..598b99b9a6 100644
--- a/osu.Game/Overlays/Music/FilterControl.cs
+++ b/osu.Game/Overlays/Music/FilterControl.cs
@@ -1,14 +1,13 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using System;
namespace osu.Game.Overlays.Music
@@ -37,7 +36,7 @@ namespace osu.Game.Overlays.Music
new CollectionsDropdown
{
RelativeSizeAxes = Axes.X,
- Items = new[] { new KeyValuePair(@"All", PlaylistCollection.All) },
+ Items = new[] { PlaylistCollection.All },
}
},
},
diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs
index c0a59df767..5d89e53081 100644
--- a/osu.Game/Overlays/Music/PlaylistItem.cs
+++ b/osu.Game/Overlays/Music/PlaylistItem.cs
@@ -3,7 +3,7 @@
using System;
using System.Collections.Generic;
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -13,7 +13,7 @@ using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
-using OpenTK;
+using osuTK;
namespace osu.Game.Overlays.Music
{
diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs
index 17c8d2f154..ef7f946859 100644
--- a/osu.Game/Overlays/Music/PlaylistList.cs
+++ b/osu.Game/Overlays/Music/PlaylistList.cs
@@ -11,7 +11,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Containers;
-using OpenTK;
+using osuTK;
namespace osu.Game.Overlays.Music
{
@@ -83,20 +83,20 @@ namespace osu.Game.Overlays.Music
beatmapBacking.ValueChanged += _ => updateSelectedSet();
}
- private void addBeatmapSet(BeatmapSetInfo obj)
+ private void addBeatmapSet(BeatmapSetInfo obj) => Schedule(() =>
{
var newItem = new PlaylistItem(obj) { OnSelect = set => Selected?.Invoke(set) };
items.Add(newItem);
items.SetLayoutPosition(newItem, items.Count - 1);
- }
+ });
- private void removeBeatmapSet(BeatmapSetInfo obj)
+ private void removeBeatmapSet(BeatmapSetInfo obj) => Schedule(() =>
{
var itemToRemove = items.FirstOrDefault(i => i.BeatmapSetInfo.ID == obj.ID);
if (itemToRemove != null)
items.Remove(itemToRemove);
- }
+ });
private void updateSelectedSet()
{
diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs
index b74e7e1178..6c45c63145 100644
--- a/osu.Game/Overlays/Music/PlaylistOverlay.cs
+++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs
@@ -11,8 +11,8 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Overlays.Music
{
diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs
index b32fd265cb..58e03bd0cd 100644
--- a/osu.Game/Overlays/MusicController.cs
+++ b/osu.Game/Overlays/MusicController.cs
@@ -22,8 +22,8 @@ using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Music;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Overlays
{
@@ -214,8 +214,8 @@ namespace osu.Game.Overlays
beatmapSets.Insert(index, beatmapSetInfo);
}
- private void handleBeatmapAdded(BeatmapSetInfo obj) => beatmapSets.Add(obj);
- private void handleBeatmapRemoved(BeatmapSetInfo obj) => beatmapSets.RemoveAll(s => s.ID == obj.ID);
+ private void handleBeatmapAdded(BeatmapSetInfo obj) => Schedule(() => beatmapSets.Add(obj));
+ private void handleBeatmapRemoved(BeatmapSetInfo obj) => Schedule(() => beatmapSets.RemoveAll(s => s.ID == obj.ID));
protected override void LoadComplete()
{
@@ -245,10 +245,10 @@ namespace osu.Game.Overlays
{
base.Update();
- if (current?.TrackLoaded ?? false)
- {
- var track = current.Track;
+ var track = current?.TrackLoaded ?? false ? current.Track : null;
+ if (track?.IsDummyDevice == false)
+ {
progressBar.EndTime = track.Length;
progressBar.CurrentTime = track.CurrentTime;
@@ -258,7 +258,11 @@ namespace osu.Game.Overlays
next();
}
else
+ {
+ progressBar.CurrentTime = 0;
+ progressBar.EndTime = 1;
playButton.Icon = FontAwesome.fa_play_circle_o;
+ }
}
private void play()
@@ -402,6 +406,10 @@ namespace osu.Game.Overlays
{
base.PopOut();
+ // This is here mostly as a performance fix.
+ // If the playlist is not hidden it will update children even when the music controller is hidden (due to AlwaysPresent).
+ playlist.State = Visibility.Hidden;
+
this.FadeOut(transition_length, Easing.OutQuint);
dragContainer.ScaleTo(0.9f, transition_length, Easing.OutQuint);
}
diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs
index 78f8f57343..b9c5151e26 100644
--- a/osu.Game/Overlays/NotificationOverlay.cs
+++ b/osu.Game/Overlays/NotificationOverlay.cs
@@ -6,7 +6,7 @@ using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Overlays.Notifications;
-using OpenTK.Graphics;
+using osuTK.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Containers;
using System;
diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs
index aa2b248bc4..ad20e6cd01 100644
--- a/osu.Game/Overlays/Notifications/Notification.cs
+++ b/osu.Game/Overlays/Notifications/Notification.cs
@@ -8,8 +8,8 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Game.Graphics.Containers;
diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs
index f41e3e876f..6958835f03 100644
--- a/osu.Game/Overlays/Notifications/NotificationSection.cs
+++ b/osu.Game/Overlays/Notifications/NotificationSection.cs
@@ -10,7 +10,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
-using OpenTK;
+using osuTK;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays.Notifications
diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs
index 254258d098..56342ea4c4 100644
--- a/osu.Game/Overlays/Notifications/ProgressNotification.cs
+++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs
@@ -8,8 +8,8 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
namespace osu.Game.Overlays.Notifications
{
diff --git a/osu.Game/Overlays/Notifications/SimpleNotification.cs b/osu.Game/Overlays/Notifications/SimpleNotification.cs
index 25a832941e..d0f49a74c0 100644
--- a/osu.Game/Overlays/Notifications/SimpleNotification.cs
+++ b/osu.Game/Overlays/Notifications/SimpleNotification.cs
@@ -8,7 +8,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
-using OpenTK;
+using osuTK;
namespace osu.Game.Overlays.Notifications
{
diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs
index 97c6554908..9cf42c3a29 100644
--- a/osu.Game/Overlays/OnScreenDisplay.cs
+++ b/osu.Game/Overlays/OnScreenDisplay.cs
@@ -11,8 +11,8 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Threading;
diff --git a/osu.Game/Overlays/Profile/Header/BadgeContainer.cs b/osu.Game/Overlays/Profile/Header/BadgeContainer.cs
index 6a87db4211..06fef22309 100644
--- a/osu.Game/Overlays/Profile/Header/BadgeContainer.cs
+++ b/osu.Game/Overlays/Profile/Header/BadgeContainer.cs
@@ -13,7 +13,7 @@ using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Users;
-using OpenTK;
+using osuTK;
namespace osu.Game.Overlays.Profile.Header
{
diff --git a/osu.Game/Overlays/Profile/Header/RankGraph.cs b/osu.Game/Overlays/Profile/Header/RankGraph.cs
index bfb01ce1c8..f74c8b5069 100644
--- a/osu.Game/Overlays/Profile/Header/RankGraph.cs
+++ b/osu.Game/Overlays/Profile/Header/RankGraph.cs
@@ -15,7 +15,7 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Users;
-using OpenTK;
+using osuTK;
namespace osu.Game.Overlays.Profile.Header
{
diff --git a/osu.Game/Overlays/Profile/Header/SupporterIcon.cs b/osu.Game/Overlays/Profile/Header/SupporterIcon.cs
index 37ad63464c..1325ea4e9a 100644
--- a/osu.Game/Overlays/Profile/Header/SupporterIcon.cs
+++ b/osu.Game/Overlays/Profile/Header/SupporterIcon.cs
@@ -8,7 +8,7 @@ using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds;
-using OpenTK;
+using osuTK;
namespace osu.Game.Overlays.Profile.Header
{
diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs
index 4839348e0e..a8075ec295 100644
--- a/osu.Game/Overlays/Profile/ProfileHeader.cs
+++ b/osu.Game/Overlays/Profile/ProfileHeader.cs
@@ -2,8 +2,8 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
-using OpenTK;
-using OpenTK.Graphics;
+using osuTK;
+using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
diff --git a/osu.Game/Overlays/Profile/ProfileSection.cs b/osu.Game/Overlays/Profile/ProfileSection.cs
index c408f69cd7..1aa43feb8c 100644
--- a/osu.Game/Overlays/Profile/ProfileSection.cs
+++ b/osu.Game/Overlays/Profile/ProfileSection.cs
@@ -1,14 +1,14 @@
// Copyright (c) 2007-2018 ppy Pty Ltd