mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 06:42:56 +08:00
Merge remote-tracking branch 'upstream/master' into playlist-commit
This commit is contained in:
commit
24db423c4f
40
.vscode/launch.json
vendored
40
.vscode/launch.json
vendored
@ -2,46 +2,60 @@
|
|||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "Launch VisualTests",
|
"name": "VisualTests (debug)",
|
||||||
"windows": {
|
"windows": {
|
||||||
"type": "clr"
|
"type": "clr"
|
||||||
},
|
},
|
||||||
"type": "mono",
|
"type": "mono",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "${workspaceRoot}/osu.Desktop.VisualTests/bin/Debug/osu!.exe",
|
"program": "${workspaceRoot}/osu.Desktop.VisualTests/bin/Debug/osu!.exe",
|
||||||
"args": [],
|
|
||||||
"cwd": "${workspaceRoot}",
|
"cwd": "${workspaceRoot}",
|
||||||
"preLaunchTask": "build",
|
"preLaunchTask": "Build (Debug)",
|
||||||
"runtimeExecutable": null,
|
"runtimeExecutable": null,
|
||||||
"env": {},
|
"env": {},
|
||||||
"console": "internalConsole"
|
"console": "internalConsole"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Launch Desktop",
|
"name": "VisualTests (release)",
|
||||||
|
"windows": {
|
||||||
|
"type": "clr"
|
||||||
|
},
|
||||||
|
"type": "mono",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceRoot}/osu.Desktop.VisualTests/bin/Release/osu!.exe",
|
||||||
|
"cwd": "${workspaceRoot}",
|
||||||
|
"preLaunchTask": "Build (Release)",
|
||||||
|
"runtimeExecutable": null,
|
||||||
|
"env": {},
|
||||||
|
"console": "internalConsole"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "osu! (debug)",
|
||||||
"windows": {
|
"windows": {
|
||||||
"type": "clr"
|
"type": "clr"
|
||||||
},
|
},
|
||||||
"type": "mono",
|
"type": "mono",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "${workspaceRoot}/osu.Desktop/bin/Debug/osu!.exe",
|
"program": "${workspaceRoot}/osu.Desktop/bin/Debug/osu!.exe",
|
||||||
"args": [],
|
|
||||||
"cwd": "${workspaceRoot}",
|
"cwd": "${workspaceRoot}",
|
||||||
"preLaunchTask": "build",
|
"preLaunchTask": "Build (Debug)",
|
||||||
"runtimeExecutable": null,
|
"runtimeExecutable": null,
|
||||||
"env": {},
|
"env": {},
|
||||||
"console": "internalConsole"
|
"console": "internalConsole"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Attach",
|
"name": "osu! (release)",
|
||||||
"windows": {
|
"windows": {
|
||||||
"type": "clr",
|
"type": "clr"
|
||||||
"request": "attach",
|
|
||||||
"processName": "osu!"
|
|
||||||
},
|
},
|
||||||
"type": "mono",
|
"type": "mono",
|
||||||
"request": "attach",
|
"request": "launch",
|
||||||
"address": "localhost",
|
"program": "${workspaceRoot}/osu.Desktop/bin/Release/osu!.exe",
|
||||||
"port": 55555
|
"cwd": "${workspaceRoot}",
|
||||||
|
"preLaunchTask": "Build (Release)",
|
||||||
|
"runtimeExecutable": null,
|
||||||
|
"env": {},
|
||||||
|
"console": "internalConsole"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
51
.vscode/tasks.json
vendored
51
.vscode/tasks.json
vendored
@ -1,14 +1,12 @@
|
|||||||
{
|
{
|
||||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
// for the documentation about the tasks.json format
|
// for the documentation about the tasks.json format
|
||||||
"version": "0.1.0",
|
"version": "2.0.0",
|
||||||
"taskSelector": "/t:",
|
"problemMatcher": "$msCompile",
|
||||||
"tasks": [
|
|
||||||
{
|
|
||||||
"taskName": "build",
|
|
||||||
"isShellCommand": true,
|
"isShellCommand": true,
|
||||||
"showOutput": "silent",
|
|
||||||
"command": "msbuild",
|
"command": "msbuild",
|
||||||
|
"suppressTaskName": true,
|
||||||
|
"showOutput": "silent",
|
||||||
"args": [
|
"args": [
|
||||||
"/property:GenerateFullPaths=true",
|
"/property:GenerateFullPaths=true",
|
||||||
"/property:DebugType=portable"
|
"/property:DebugType=portable"
|
||||||
@ -20,32 +18,33 @@
|
|||||||
"/m" //parallel compiling support. doesn't work well with mono atm
|
"/m" //parallel compiling support. doesn't work well with mono atm
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
// Use the standard MS compiler pattern to detect errors, warnings and infos
|
"tasks": [
|
||||||
"problemMatcher": "$msCompile",
|
{
|
||||||
|
"taskName": "Build (Debug)",
|
||||||
"isBuildCommand": true
|
"isBuildCommand": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskName": "rebuild",
|
"taskName": "Build (Release)",
|
||||||
"isShellCommand": true,
|
|
||||||
"showOutput": "silent",
|
|
||||||
"command": "msbuild",
|
|
||||||
"args": [
|
"args": [
|
||||||
// Ask msbuild to generate full paths for file names.
|
"/property:Configuration=Release"
|
||||||
"/property:GenerateFullPaths=true",
|
|
||||||
"/property:DebugType=portable",
|
|
||||||
"/target:Clean,Build"
|
|
||||||
],
|
|
||||||
"windows": {
|
|
||||||
"args": [
|
|
||||||
"/property:GenerateFullPaths=true",
|
|
||||||
"/property:DebugType=portable",
|
|
||||||
"/target:Clean,Build",
|
|
||||||
"/m" //parallel compiling support. doesn't work well with mono atm
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
// Use the standard MS compiler pattern to detect errors, warnings and infos
|
{
|
||||||
"problemMatcher": "$msCompile",
|
"taskName": "Clean All",
|
||||||
"isBuildCommand": true
|
"dependsOn": ["Clean (Debug)", "Clean (Release)"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"taskName": "Clean (Debug)",
|
||||||
|
"args": [
|
||||||
|
"/target:Clean"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"taskName": "Clean (Release)",
|
||||||
|
"args": [
|
||||||
|
"/target:Clean",
|
||||||
|
"/property:Configuration=Release"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -1 +1 @@
|
|||||||
Subproject commit cebdfb1bbb260e5aaca0a01e06d7128b3d1faae4
|
Subproject commit e1ac6316aa3862efb8e79e585a7b4c901a4e1b3c
|
@ -10,7 +10,7 @@ namespace osu.Desktop.VisualTests.Beatmaps
|
|||||||
public class TestWorkingBeatmap : WorkingBeatmap
|
public class TestWorkingBeatmap : WorkingBeatmap
|
||||||
{
|
{
|
||||||
public TestWorkingBeatmap(Beatmap beatmap)
|
public TestWorkingBeatmap(Beatmap beatmap)
|
||||||
: base(beatmap.BeatmapInfo, beatmap.BeatmapInfo.BeatmapSet)
|
: base(beatmap.BeatmapInfo)
|
||||||
{
|
{
|
||||||
this.beatmap = beatmap;
|
this.beatmap = beatmap;
|
||||||
}
|
}
|
||||||
|
89
osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs
Normal file
89
osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
|
{
|
||||||
|
internal class TestCaseManiaHitObjects : TestCase
|
||||||
|
{
|
||||||
|
public override void Reset()
|
||||||
|
{
|
||||||
|
base.Reset();
|
||||||
|
|
||||||
|
Add(new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(10, 0),
|
||||||
|
// Imagine that the containers containing the drawable notes are the "columns"
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Name = "Normal note column",
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Width = 50,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Name = "Timing section",
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
RelativeCoordinateSpace = new Vector2(1, 10000),
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new DrawableNote(new Note
|
||||||
|
{
|
||||||
|
StartTime = 5000
|
||||||
|
})
|
||||||
|
{
|
||||||
|
AccentColour = Color4.Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Name = "Hold note column",
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Width = 50,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Name = "Timing section",
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
RelativeCoordinateSpace = new Vector2(1, 10000),
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new DrawableHoldNote(new HoldNote
|
||||||
|
{
|
||||||
|
StartTime = 5000,
|
||||||
|
Duration = 1000
|
||||||
|
})
|
||||||
|
{
|
||||||
|
AccentColour = Color4.Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,16 +6,21 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Game.Overlays.Mods;
|
using osu.Game.Overlays.Mods;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Screens.Play.HUD;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
{
|
{
|
||||||
internal class TestCaseModSelectOverlay : TestCase
|
internal class TestCaseMods : TestCase
|
||||||
{
|
{
|
||||||
public override string Description => @"Tests the mod select overlay";
|
public override string Description => @"Mod select overlay and in-game display";
|
||||||
|
|
||||||
private ModSelectOverlay modSelect;
|
private ModSelectOverlay modSelect;
|
||||||
|
private ModDisplay modDisplay;
|
||||||
|
|
||||||
private RulesetDatabase rulesets;
|
private RulesetDatabase rulesets;
|
||||||
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(RulesetDatabase rulesets)
|
private void load(RulesetDatabase rulesets)
|
||||||
{
|
{
|
||||||
@ -33,6 +38,16 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Add(modDisplay = new ModDisplay
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Position = new Vector2(0, 25),
|
||||||
|
});
|
||||||
|
|
||||||
|
modDisplay.Current.BindTo(modSelect.SelectedMods);
|
||||||
|
|
||||||
AddStep("Toggle", modSelect.ToggleVisibility);
|
AddStep("Toggle", modSelect.ToggleVisibility);
|
||||||
|
|
||||||
foreach (var ruleset in rulesets.AllRulesets)
|
foreach (var ruleset in rulesets.AllRulesets)
|
@ -8,7 +8,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Screens.Play.HUD;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
{
|
{
|
||||||
|
@ -18,10 +18,14 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
private SongProgress progress;
|
private SongProgress progress;
|
||||||
private SongProgressGraph graph;
|
private SongProgressGraph graph;
|
||||||
|
|
||||||
|
private StopwatchClock clock;
|
||||||
|
|
||||||
public override void Reset()
|
public override void Reset()
|
||||||
{
|
{
|
||||||
base.Reset();
|
base.Reset();
|
||||||
|
|
||||||
|
clock = new StopwatchClock(true);
|
||||||
|
|
||||||
Add(progress = new SongProgress
|
Add(progress = new SongProgress
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -55,6 +59,9 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
progress.Objects = objects;
|
progress.Objects = objects;
|
||||||
graph.Objects = objects;
|
graph.Objects = objects;
|
||||||
|
|
||||||
|
progress.AudioClock = clock;
|
||||||
|
progress.OnSeek = pos => clock.Seek(pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,6 +190,7 @@
|
|||||||
<Compile Include="Tests\TestCaseDrawings.cs" />
|
<Compile Include="Tests\TestCaseDrawings.cs" />
|
||||||
<Compile Include="Tests\TestCaseGamefield.cs" />
|
<Compile Include="Tests\TestCaseGamefield.cs" />
|
||||||
<Compile Include="Tests\TestCaseGraph.cs" />
|
<Compile Include="Tests\TestCaseGraph.cs" />
|
||||||
|
<Compile Include="Tests\TestCaseManiaHitObjects.cs" />
|
||||||
<Compile Include="Tests\TestCaseManiaPlayfield.cs" />
|
<Compile Include="Tests\TestCaseManiaPlayfield.cs" />
|
||||||
<Compile Include="Tests\TestCaseMenuOverlays.cs" />
|
<Compile Include="Tests\TestCaseMenuOverlays.cs" />
|
||||||
<Compile Include="Tests\TestCaseMusicController.cs" />
|
<Compile Include="Tests\TestCaseMusicController.cs" />
|
||||||
@ -212,7 +213,7 @@
|
|||||||
<Compile Include="Platform\TestStorage.cs" />
|
<Compile Include="Platform\TestStorage.cs" />
|
||||||
<Compile Include="Tests\TestCaseOptions.cs" />
|
<Compile Include="Tests\TestCaseOptions.cs" />
|
||||||
<Compile Include="Tests\TestCaseSongProgress.cs" />
|
<Compile Include="Tests\TestCaseSongProgress.cs" />
|
||||||
<Compile Include="Tests\TestCaseModSelectOverlay.cs" />
|
<Compile Include="Tests\TestCaseMods.cs" />
|
||||||
<Compile Include="Tests\TestCaseDialogOverlay.cs" />
|
<Compile Include="Tests\TestCaseDialogOverlay.cs" />
|
||||||
<Compile Include="Tests\TestCaseBeatmapOptionsOverlay.cs" />
|
<Compile Include="Tests\TestCaseBeatmapOptionsOverlay.cs" />
|
||||||
<Compile Include="Tests\TestCaseLeaderboard.cs" />
|
<Compile Include="Tests\TestCaseLeaderboard.cs" />
|
||||||
|
@ -14,7 +14,7 @@ namespace osu.Desktop.Beatmaps.IO
|
|||||||
{
|
{
|
||||||
public static void Register() => AddReader<LegacyFilesystemReader>((storage, path) => Directory.Exists(path));
|
public static void Register() => AddReader<LegacyFilesystemReader>((storage, path) => Directory.Exists(path));
|
||||||
|
|
||||||
private string basePath { get; }
|
private readonly string basePath;
|
||||||
|
|
||||||
public LegacyFilesystemReader(string path)
|
public LegacyFilesystemReader(string path)
|
||||||
{
|
{
|
||||||
|
@ -11,11 +11,11 @@ using osu.Game.Rulesets.Objects;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Beatmaps
|
namespace osu.Game.Rulesets.Mania.Beatmaps
|
||||||
{
|
{
|
||||||
internal class ManiaBeatmapConverter : BeatmapConverter<ManiaBaseHit>
|
internal class ManiaBeatmapConverter : BeatmapConverter<ManiaHitObject>
|
||||||
{
|
{
|
||||||
protected override IEnumerable<Type> ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) };
|
protected override IEnumerable<Type> ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) };
|
||||||
|
|
||||||
protected override IEnumerable<ManiaBaseHit> ConvertHitObject(HitObject original, Beatmap beatmap)
|
protected override IEnumerable<ManiaHitObject> ConvertHitObject(HitObject original, Beatmap beatmap)
|
||||||
{
|
{
|
||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
|
179
osu.Game.Rulesets.Mania/Judgements/HitWindows.cs
Normal file
179
osu.Game.Rulesets.Mania/Judgements/HitWindows.cs
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Database;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Judgements
|
||||||
|
{
|
||||||
|
public class HitWindows
|
||||||
|
{
|
||||||
|
#region Constants
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PERFECT hit window at OD = 10.
|
||||||
|
/// </summary>
|
||||||
|
private const double perfect_min = 27.8;
|
||||||
|
/// <summary>
|
||||||
|
/// PERFECT hit window at OD = 5.
|
||||||
|
/// </summary>
|
||||||
|
private const double perfect_mid = 38.8;
|
||||||
|
/// <summary>
|
||||||
|
/// PERFECT hit window at OD = 0.
|
||||||
|
/// </summary>
|
||||||
|
private const double perfect_max = 44.8;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// GREAT hit window at OD = 10.
|
||||||
|
/// </summary>
|
||||||
|
private const double great_min = 68;
|
||||||
|
/// <summary>
|
||||||
|
/// GREAT hit window at OD = 5.
|
||||||
|
/// </summary>
|
||||||
|
private const double great_mid = 98;
|
||||||
|
/// <summary>
|
||||||
|
/// GREAT hit window at OD = 0.
|
||||||
|
/// </summary>
|
||||||
|
private const double great_max = 128;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// GOOD hit window at OD = 10.
|
||||||
|
/// </summary>
|
||||||
|
private const double good_min = 134;
|
||||||
|
/// <summary>
|
||||||
|
/// GOOD hit window at OD = 5.
|
||||||
|
/// </summary>
|
||||||
|
private const double good_mid = 164;
|
||||||
|
/// <summary>
|
||||||
|
/// GOOD hit window at OD = 0.
|
||||||
|
/// </summary>
|
||||||
|
private const double good_max = 194;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// OK hit window at OD = 10.
|
||||||
|
/// </summary>
|
||||||
|
private const double ok_min = 194;
|
||||||
|
/// <summary>
|
||||||
|
/// OK hit window at OD = 5.
|
||||||
|
/// </summary>
|
||||||
|
private const double ok_mid = 224;
|
||||||
|
/// <summary>
|
||||||
|
/// OK hit window at OD = 0.
|
||||||
|
/// </summary>
|
||||||
|
private const double ok_max = 254;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// BAD hit window at OD = 10.
|
||||||
|
/// </summary>
|
||||||
|
private const double bad_min = 242;
|
||||||
|
/// <summary>
|
||||||
|
/// BAD hit window at OD = 5.
|
||||||
|
/// </summary>
|
||||||
|
private const double bad_mid = 272;
|
||||||
|
/// <summary>
|
||||||
|
/// BAD hit window at OD = 0.
|
||||||
|
/// </summary>
|
||||||
|
private const double bad_max = 302;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// MISS hit window at OD = 10.
|
||||||
|
/// </summary>
|
||||||
|
private const double miss_min = 316;
|
||||||
|
/// <summary>
|
||||||
|
/// MISS hit window at OD = 5.
|
||||||
|
/// </summary>
|
||||||
|
private const double miss_mid = 346;
|
||||||
|
/// <summary>
|
||||||
|
/// MISS hit window at OD = 0.
|
||||||
|
/// </summary>
|
||||||
|
private const double miss_max = 376;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hit window for a PERFECT hit.
|
||||||
|
/// </summary>
|
||||||
|
public double Perfect = perfect_mid;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hit window for a GREAT hit.
|
||||||
|
/// </summary>
|
||||||
|
public double Great = great_mid;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hit window for a GOOD hit.
|
||||||
|
/// </summary>
|
||||||
|
public double Good = good_mid;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hit window for an OK hit.
|
||||||
|
/// </summary>
|
||||||
|
public double Ok = ok_mid;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hit window for a BAD hit.
|
||||||
|
/// </summary>
|
||||||
|
public double Bad = bad_mid;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hit window for a MISS hit.
|
||||||
|
/// </summary>
|
||||||
|
public double Miss = miss_mid;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructs default hit windows.
|
||||||
|
/// </summary>
|
||||||
|
public HitWindows()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructs hit windows by fitting a parameter to a 2-part piecewise linear function for each hit window.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="difficulty">The parameter.</param>
|
||||||
|
public HitWindows(double difficulty)
|
||||||
|
{
|
||||||
|
Perfect = BeatmapDifficulty.DifficultyRange(difficulty, perfect_max, perfect_mid, perfect_min);
|
||||||
|
Great = BeatmapDifficulty.DifficultyRange(difficulty, great_max, great_mid, great_min);
|
||||||
|
Good = BeatmapDifficulty.DifficultyRange(difficulty, good_max, good_mid, good_min);
|
||||||
|
Ok = BeatmapDifficulty.DifficultyRange(difficulty, ok_max, ok_mid, ok_min);
|
||||||
|
Bad = BeatmapDifficulty.DifficultyRange(difficulty, bad_max, bad_mid, bad_min);
|
||||||
|
Miss = BeatmapDifficulty.DifficultyRange(difficulty, miss_max, miss_mid, miss_min);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructs new hit windows which have been multiplied by a value.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="windows">The original hit windows.</param>
|
||||||
|
/// <param name="value">The value to multiply each hit window by.</param>
|
||||||
|
public static HitWindows operator *(HitWindows windows, double value)
|
||||||
|
{
|
||||||
|
return new HitWindows
|
||||||
|
{
|
||||||
|
Perfect = windows.Perfect * value,
|
||||||
|
Great = windows.Great * value,
|
||||||
|
Good = windows.Good * value,
|
||||||
|
Ok = windows.Ok * value,
|
||||||
|
Bad = windows.Bad * value,
|
||||||
|
Miss = windows.Miss * value
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructs new hit windows which have been divided by a value.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="windows">The original hit windows.</param>
|
||||||
|
/// <param name="value">The value to divide each hit window by.</param>
|
||||||
|
public static HitWindows operator /(HitWindows windows, double value)
|
||||||
|
{
|
||||||
|
return new HitWindows
|
||||||
|
{
|
||||||
|
Perfect = windows.Perfect / value,
|
||||||
|
Great = windows.Great / value,
|
||||||
|
Good = windows.Good / value,
|
||||||
|
Ok = windows.Ok / value,
|
||||||
|
Bad = windows.Bad / value,
|
||||||
|
Miss = windows.Miss / value
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -9,7 +9,7 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania
|
namespace osu.Game.Rulesets.Mania
|
||||||
{
|
{
|
||||||
public class ManiaDifficultyCalculator : DifficultyCalculator<ManiaBaseHit>
|
public class ManiaDifficultyCalculator : DifficultyCalculator<ManiaHitObject>
|
||||||
{
|
{
|
||||||
public ManiaDifficultyCalculator(Beatmap beatmap)
|
public ManiaDifficultyCalculator(Beatmap beatmap)
|
||||||
: base(beatmap)
|
: base(beatmap)
|
||||||
@ -21,6 +21,6 @@ namespace osu.Game.Rulesets.Mania
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override BeatmapConverter<ManiaBaseHit> CreateBeatmapConverter() => new ManiaBeatmapConverter();
|
protected override BeatmapConverter<ManiaHitObject> CreateBeatmapConverter() => new ManiaBeatmapConverter();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -64,6 +64,7 @@ namespace osu.Game.Rulesets.Mania.Mods
|
|||||||
{
|
{
|
||||||
public override string Name => "FadeIn";
|
public override string Name => "FadeIn";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden;
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden;
|
||||||
|
public override ModType Type => ModType.DifficultyIncrease;
|
||||||
public override double ScoreMultiplier => 1;
|
public override double ScoreMultiplier => 1;
|
||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(ModFlashlight) };
|
public override Type[] IncompatibleMods => new[] { typeof(ModFlashlight) };
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Graphics.Textures;
|
|
||||||
using osu.Framework.Graphics.Transforms;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using OpenTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Objects.Drawable
|
|
||||||
{
|
|
||||||
public class DrawableNote : Sprite
|
|
||||||
{
|
|
||||||
private readonly ManiaBaseHit note;
|
|
||||||
|
|
||||||
public DrawableNote(ManiaBaseHit note)
|
|
||||||
{
|
|
||||||
this.note = note;
|
|
||||||
Origin = Anchor.Centre;
|
|
||||||
Scale = new Vector2(0.1f);
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(TextureStore textures)
|
|
||||||
{
|
|
||||||
Texture = textures.Get(@"Menu/logo");
|
|
||||||
|
|
||||||
const double duration = 0;
|
|
||||||
|
|
||||||
Transforms.Add(new TransformPositionY { StartTime = note.StartTime - 200, EndTime = note.StartTime, StartValue = -0.1f, EndValue = 0.9f });
|
|
||||||
Transforms.Add(new TransformAlpha { StartTime = note.StartTime + duration + 200, EndTime = note.StartTime + duration + 400, StartValue = 1, EndValue = 0 });
|
|
||||||
Expire(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,69 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||||
|
{
|
||||||
|
public class DrawableHoldNote : DrawableManiaHitObject<HoldNote>
|
||||||
|
{
|
||||||
|
private readonly NotePiece headPiece;
|
||||||
|
private readonly BodyPiece bodyPiece;
|
||||||
|
private readonly NotePiece tailPiece;
|
||||||
|
|
||||||
|
public DrawableHoldNote(HoldNote hitObject)
|
||||||
|
: base(hitObject)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
Height = (float)HitObject.Duration;
|
||||||
|
|
||||||
|
Add(new Drawable[]
|
||||||
|
{
|
||||||
|
// For now the body piece covers the entire height of the container
|
||||||
|
// whereas possibly in the future we don't want to extend under the head/tail.
|
||||||
|
// This will be fixed when new designs are given or the current design is finalized.
|
||||||
|
bodyPiece = new BodyPiece
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomCentre,
|
||||||
|
Origin = Anchor.BottomCentre,
|
||||||
|
},
|
||||||
|
headPiece = new NotePiece
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomCentre,
|
||||||
|
Origin = Anchor.BottomCentre
|
||||||
|
},
|
||||||
|
tailPiece = new NotePiece
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// The "length" of the hold note stops at the "base" of the tail piece
|
||||||
|
// but we want to contain the tail piece within our bounds
|
||||||
|
Height += (float)HitObject.Duration / headPiece.Height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Color4 AccentColour
|
||||||
|
{
|
||||||
|
get { return base.AccentColour; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (base.AccentColour == value)
|
||||||
|
return;
|
||||||
|
base.AccentColour = value;
|
||||||
|
|
||||||
|
headPiece.AccentColour = value;
|
||||||
|
bodyPiece.AccentColour = value;
|
||||||
|
tailPiece.AccentColour = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateState(ArmedState state)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Rulesets.Mania.Judgements;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||||
|
{
|
||||||
|
public abstract class DrawableManiaHitObject<TObject> : DrawableHitObject<ManiaHitObject, ManiaJudgement>
|
||||||
|
where TObject : ManiaHitObject
|
||||||
|
{
|
||||||
|
public new TObject HitObject;
|
||||||
|
|
||||||
|
private readonly Container glowContainer;
|
||||||
|
|
||||||
|
protected DrawableManiaHitObject(TObject hitObject)
|
||||||
|
: base(hitObject)
|
||||||
|
{
|
||||||
|
HitObject = hitObject;
|
||||||
|
|
||||||
|
Anchor = Anchor.TopCentre;
|
||||||
|
Origin = Anchor.BottomCentre;
|
||||||
|
|
||||||
|
RelativePositionAxes = Axes.Y;
|
||||||
|
Y = (float)HitObject.StartTime;
|
||||||
|
|
||||||
|
Add(glowContainer = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Masking = true,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Alpha = 0,
|
||||||
|
AlwaysPresent = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Color4 AccentColour
|
||||||
|
{
|
||||||
|
get { return base.AccentColour; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (base.AccentColour == value)
|
||||||
|
return;
|
||||||
|
base.AccentColour = value;
|
||||||
|
|
||||||
|
glowContainer.EdgeEffect = new EdgeEffect
|
||||||
|
{
|
||||||
|
Type = EdgeEffectType.Glow,
|
||||||
|
Radius = 5,
|
||||||
|
Colour = value
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override ManiaJudgement CreateJudgement() => new ManiaJudgement();
|
||||||
|
}
|
||||||
|
}
|
45
osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs
Normal file
45
osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||||
|
{
|
||||||
|
public class DrawableNote : DrawableManiaHitObject<Note>
|
||||||
|
{
|
||||||
|
private readonly NotePiece headPiece;
|
||||||
|
|
||||||
|
public DrawableNote(Note hitObject)
|
||||||
|
: base(hitObject)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
|
Add(headPiece = new NotePiece
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomCentre,
|
||||||
|
Origin = Anchor.BottomCentre
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Color4 AccentColour
|
||||||
|
{
|
||||||
|
get { return base.AccentColour; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (base.AccentColour == value)
|
||||||
|
return;
|
||||||
|
base.AccentColour = value;
|
||||||
|
|
||||||
|
headPiece.AccentColour = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateState(ArmedState state)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents length-wise portion of a hold note.
|
||||||
|
/// </summary>
|
||||||
|
internal class BodyPiece : Container, IHasAccentColour
|
||||||
|
{
|
||||||
|
private readonly Box box;
|
||||||
|
|
||||||
|
public BodyPiece()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
Masking = true;
|
||||||
|
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
box = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Alpha = 0.3f
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color4 accentColour;
|
||||||
|
public Color4 AccentColour
|
||||||
|
{
|
||||||
|
get { return accentColour; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (accentColour == value)
|
||||||
|
return;
|
||||||
|
accentColour = value;
|
||||||
|
|
||||||
|
box.Colour = accentColour;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents the static hit markers of notes.
|
||||||
|
/// </summary>
|
||||||
|
internal class NotePiece : Container, IHasAccentColour
|
||||||
|
{
|
||||||
|
private const float head_height = 10;
|
||||||
|
private const float head_colour_height = 6;
|
||||||
|
|
||||||
|
private readonly Box colouredBox;
|
||||||
|
|
||||||
|
public NotePiece()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
Height = head_height;
|
||||||
|
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
},
|
||||||
|
colouredBox = new Box
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = head_colour_height,
|
||||||
|
Alpha = 0.2f
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color4 accentColour;
|
||||||
|
public Color4 AccentColour
|
||||||
|
{
|
||||||
|
get { return accentColour; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (accentColour == value)
|
||||||
|
return;
|
||||||
|
accentColour = value;
|
||||||
|
|
||||||
|
colouredBox.Colour = AccentColour.Lighten(0.9f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,37 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Beatmaps.Timing;
|
||||||
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Rulesets.Mania.Judgements;
|
||||||
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Objects
|
namespace osu.Game.Rulesets.Mania.Objects
|
||||||
{
|
{
|
||||||
public class HoldNote : Note
|
/// <summary>
|
||||||
|
/// Represents a hit object which requires pressing, holding, and releasing a key.
|
||||||
|
/// </summary>
|
||||||
|
public class HoldNote : Note, IHasEndTime
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Lenience of release hit windows. This is to make cases where the hold note release
|
||||||
|
/// is timed alongside presses of other hit objects less awkward.
|
||||||
|
/// </summary>
|
||||||
|
private const double release_window_lenience = 1.5;
|
||||||
|
|
||||||
|
public double Duration { get; set; }
|
||||||
|
public double EndTime => StartTime + Duration;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The key-release hit windows for this hold note.
|
||||||
|
/// </summary>
|
||||||
|
protected HitWindows ReleaseHitWindows = new HitWindows();
|
||||||
|
|
||||||
|
public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty)
|
||||||
|
{
|
||||||
|
base.ApplyDefaults(timing, difficulty);
|
||||||
|
|
||||||
|
ReleaseHitWindows = HitWindows * release_window_lenience;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Rulesets.Mania.Objects.Types;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Objects
|
namespace osu.Game.Rulesets.Mania.Objects
|
||||||
{
|
{
|
||||||
public abstract class ManiaBaseHit : HitObject
|
public abstract class ManiaHitObject : HitObject, IHasColumn
|
||||||
{
|
{
|
||||||
public int Column;
|
public int Column { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,9 +1,27 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Beatmaps.Timing;
|
||||||
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Rulesets.Mania.Judgements;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Objects
|
namespace osu.Game.Rulesets.Mania.Objects
|
||||||
{
|
{
|
||||||
public class Note : ManiaBaseHit
|
/// <summary>
|
||||||
|
/// Represents a hit object which has a single hit press.
|
||||||
|
/// </summary>
|
||||||
|
public class Note : ManiaHitObject
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The key-press hit window for this note.
|
||||||
|
/// </summary>
|
||||||
|
protected HitWindows HitWindows = new HitWindows();
|
||||||
|
|
||||||
|
public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty)
|
||||||
|
{
|
||||||
|
base.ApplyDefaults(timing, difficulty);
|
||||||
|
|
||||||
|
HitWindows = new HitWindows(difficulty.OverallDifficulty);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
16
osu.Game.Rulesets.Mania/Objects/Types/IHasColumn.cs
Normal file
16
osu.Game.Rulesets.Mania/Objects/Types/IHasColumn.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Objects.Types
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A type of hit object which lies in one of a number of predetermined columns.
|
||||||
|
/// </summary>
|
||||||
|
public interface IHasColumn
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The column which the hit object lies in.
|
||||||
|
/// </summary>
|
||||||
|
int Column { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -8,13 +8,13 @@ using osu.Game.Rulesets.UI;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Scoring
|
namespace osu.Game.Rulesets.Mania.Scoring
|
||||||
{
|
{
|
||||||
internal class ManiaScoreProcessor : ScoreProcessor<ManiaBaseHit, ManiaJudgement>
|
internal class ManiaScoreProcessor : ScoreProcessor<ManiaHitObject, ManiaJudgement>
|
||||||
{
|
{
|
||||||
public ManiaScoreProcessor()
|
public ManiaScoreProcessor()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public ManiaScoreProcessor(HitRenderer<ManiaBaseHit, ManiaJudgement> hitRenderer)
|
public ManiaScoreProcessor(HitRenderer<ManiaHitObject, ManiaJudgement> hitRenderer)
|
||||||
: base(hitRenderer)
|
: base(hitRenderer)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ using osu.Game.Rulesets.UI;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.UI
|
namespace osu.Game.Rulesets.Mania.UI
|
||||||
{
|
{
|
||||||
public class ManiaHitRenderer : HitRenderer<ManiaBaseHit, ManiaJudgement>
|
public class ManiaHitRenderer : HitRenderer<ManiaHitObject, ManiaJudgement>
|
||||||
{
|
{
|
||||||
private readonly int columns;
|
private readonly int columns;
|
||||||
|
|
||||||
@ -25,10 +25,10 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor() => new ManiaScoreProcessor(this);
|
public override ScoreProcessor CreateScoreProcessor() => new ManiaScoreProcessor(this);
|
||||||
|
|
||||||
protected override BeatmapConverter<ManiaBaseHit> CreateBeatmapConverter() => new ManiaBeatmapConverter();
|
protected override BeatmapConverter<ManiaHitObject> CreateBeatmapConverter() => new ManiaBeatmapConverter();
|
||||||
|
|
||||||
protected override Playfield<ManiaBaseHit, ManiaJudgement> CreatePlayfield() => new ManiaPlayfield(columns);
|
protected override Playfield<ManiaHitObject, ManiaJudgement> CreatePlayfield() => new ManiaPlayfield(columns);
|
||||||
|
|
||||||
protected override DrawableHitObject<ManiaBaseHit, ManiaJudgement> GetVisualRepresentation(ManiaBaseHit h) => null;
|
protected override DrawableHitObject<ManiaHitObject, ManiaJudgement> GetVisualRepresentation(ManiaHitObject h) => null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.UI
|
namespace osu.Game.Rulesets.Mania.UI
|
||||||
{
|
{
|
||||||
public class ManiaPlayfield : Playfield<ManiaBaseHit, ManiaJudgement>
|
public class ManiaPlayfield : Playfield<ManiaHitObject, ManiaJudgement>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default column keys, expanding outwards from the middle as more column are added.
|
/// Default column keys, expanding outwards from the middle as more column are added.
|
||||||
|
@ -48,12 +48,18 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Beatmaps\ManiaBeatmapConverter.cs" />
|
<Compile Include="Beatmaps\ManiaBeatmapConverter.cs" />
|
||||||
|
<Compile Include="Judgements\HitWindows.cs" />
|
||||||
<Compile Include="Judgements\ManiaJudgement.cs" />
|
<Compile Include="Judgements\ManiaJudgement.cs" />
|
||||||
<Compile Include="ManiaDifficultyCalculator.cs" />
|
<Compile Include="ManiaDifficultyCalculator.cs" />
|
||||||
|
<Compile Include="Objects\Drawables\DrawableHoldNote.cs" />
|
||||||
|
<Compile Include="Objects\Drawables\DrawableManiaHitObject.cs" />
|
||||||
|
<Compile Include="Objects\Drawables\DrawableNote.cs" />
|
||||||
|
<Compile Include="Objects\Drawables\Pieces\BodyPiece.cs" />
|
||||||
|
<Compile Include="Objects\Drawables\Pieces\NotePiece.cs" />
|
||||||
|
<Compile Include="Objects\Types\IHasColumn.cs" />
|
||||||
<Compile Include="Scoring\ManiaScoreProcessor.cs" />
|
<Compile Include="Scoring\ManiaScoreProcessor.cs" />
|
||||||
<Compile Include="Objects\Drawable\DrawableNote.cs" />
|
|
||||||
<Compile Include="Objects\HoldNote.cs" />
|
<Compile Include="Objects\HoldNote.cs" />
|
||||||
<Compile Include="Objects\ManiaBaseHit.cs" />
|
<Compile Include="Objects\ManiaHitObject.cs" />
|
||||||
<Compile Include="Objects\Note.cs" />
|
<Compile Include="Objects\Note.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="UI\Column.cs" />
|
<Compile Include="UI\Column.cs" />
|
||||||
|
@ -58,8 +58,8 @@ namespace osu.Game.Rulesets.Osu.Replays
|
|||||||
{
|
{
|
||||||
public int Compare(ReplayFrame f1, ReplayFrame f2)
|
public int Compare(ReplayFrame f1, ReplayFrame f2)
|
||||||
{
|
{
|
||||||
if (f1 == null) throw new NullReferenceException($@"{nameof(f1)} cannot be null");
|
if (f1 == null) throw new ArgumentNullException(nameof(f1));
|
||||||
if (f2 == null) throw new NullReferenceException($@"{nameof(f2)} cannot be null");
|
if (f2 == null) throw new ArgumentNullException(nameof(f2));
|
||||||
|
|
||||||
return f1.Time.CompareTo(f2.Time);
|
return f1.Time.CompareTo(f2.Time);
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
|
|||||||
protected override Beatmap<TaikoHitObject> ConvertBeatmap(Beatmap original)
|
protected override Beatmap<TaikoHitObject> ConvertBeatmap(Beatmap original)
|
||||||
{
|
{
|
||||||
// Rewrite the beatmap info to add the slider velocity multiplier
|
// Rewrite the beatmap info to add the slider velocity multiplier
|
||||||
BeatmapInfo info = original.BeatmapInfo.DeepClone<BeatmapInfo>();
|
BeatmapInfo info = original.BeatmapInfo.DeepClone();
|
||||||
info.Difficulty.SliderMultiplier *= legacy_velocity_multiplier;
|
info.Difficulty.SliderMultiplier *= legacy_velocity_multiplier;
|
||||||
|
|
||||||
Beatmap<TaikoHitObject> converted = base.ConvertBeatmap(original);
|
Beatmap<TaikoHitObject> converted = base.ConvertBeatmap(original);
|
||||||
|
@ -109,7 +109,7 @@ namespace osu.Game.Rulesets.Taiko.Replays
|
|||||||
Frames.Add(new ReplayFrame(h.StartTime, null, null, button));
|
Frames.Add(new ReplayFrame(h.StartTime, null, null, button));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new Exception("Unknown hit object type.");
|
throw new InvalidOperationException("Unknown hit object type.");
|
||||||
|
|
||||||
Frames.Add(new ReplayFrame(endTime + KEY_UP_DELAY, null, null, ReplayButtonState.None));
|
Frames.Add(new ReplayFrame(endTime + KEY_UP_DELAY, null, null, ReplayButtonState.None));
|
||||||
|
|
||||||
|
@ -53,6 +53,12 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
public TaikoPlayfield()
|
public TaikoPlayfield()
|
||||||
{
|
{
|
||||||
AddInternal(new Drawable[]
|
AddInternal(new Drawable[]
|
||||||
|
{
|
||||||
|
new ScaleFixContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = DEFAULT_PLAYFIELD_HEIGHT,
|
||||||
|
Children = new[]
|
||||||
{
|
{
|
||||||
rightBackgroundContainer = new Container
|
rightBackgroundContainer = new Container
|
||||||
{
|
{
|
||||||
@ -75,12 +81,6 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new ScaleFixContainer
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Height = DEFAULT_PLAYFIELD_HEIGHT,
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
Name = "Transparent playfield elements",
|
Name = "Transparent playfield elements",
|
||||||
|
@ -135,14 +135,13 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
waitAction = () =>
|
waitAction = () =>
|
||||||
{
|
{
|
||||||
while ((resultBeatmaps = host.Dependencies.Get<BeatmapDatabase>()
|
while ((resultBeatmaps = host.Dependencies.Get<BeatmapDatabase>()
|
||||||
.Query<BeatmapInfo>().Where(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12)
|
.GetAllWithChildren<BeatmapInfo>(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12)
|
||||||
Thread.Sleep(50);
|
Thread.Sleep(50);
|
||||||
};
|
};
|
||||||
|
|
||||||
Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout),
|
Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout),
|
||||||
@"Beatmaps did not import to the database in allocated time");
|
@"Beatmaps did not import to the database in allocated time");
|
||||||
|
|
||||||
//fetch children and check we can load from the post-storage path...
|
|
||||||
var set = host.Dependencies.Get<BeatmapDatabase>().GetChildren(resultSets.First());
|
var set = host.Dependencies.Get<BeatmapDatabase>().GetChildren(resultSets.First());
|
||||||
|
|
||||||
Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count(),
|
Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count(),
|
||||||
|
@ -11,9 +11,8 @@ namespace osu.Game.Audio
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public SampleInfoList(IEnumerable<SampleInfo> elements)
|
public SampleInfoList(IEnumerable<SampleInfo> elements) : base(elements)
|
||||||
{
|
{
|
||||||
AddRange(elements);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -51,14 +51,12 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
title = new OsuSpriteText
|
title = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = @"Exo2.0-BoldItalic",
|
Font = @"Exo2.0-BoldItalic",
|
||||||
Text = beatmap.BeatmapSetInfo.Metadata.Title,
|
|
||||||
TextSize = 22,
|
TextSize = 22,
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
},
|
},
|
||||||
artist = new OsuSpriteText
|
artist = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = @"Exo2.0-SemiBoldItalic",
|
Font = @"Exo2.0-SemiBoldItalic",
|
||||||
Text = beatmap.BeatmapSetInfo.Metadata.Artist,
|
|
||||||
TextSize = 17,
|
TextSize = 17,
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
},
|
},
|
||||||
@ -81,8 +79,8 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(LocalisationEngine localisation)
|
private void load(LocalisationEngine localisation)
|
||||||
{
|
{
|
||||||
title.Current = localisation.GetUnicodePreference(beatmap.BeatmapSetInfo.Metadata.TitleUnicode, beatmap.BeatmapSetInfo.Metadata.Title);
|
title.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title);
|
||||||
artist.Current = localisation.GetUnicodePreference(beatmap.BeatmapSetInfo.Metadata.ArtistUnicode, beatmap.BeatmapSetInfo.Metadata.Artist);
|
artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PanelBackground : BufferedContainer
|
private class PanelBackground : BufferedContainer
|
||||||
|
@ -11,7 +11,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
public abstract class BeatmapDecoder
|
public abstract class BeatmapDecoder
|
||||||
{
|
{
|
||||||
private static Dictionary<string, Type> decoders { get; } = new Dictionary<string, Type>();
|
private static readonly Dictionary<string, Type> decoders = new Dictionary<string, Type>();
|
||||||
|
|
||||||
public static BeatmapDecoder GetDecoder(StreamReader stream)
|
public static BeatmapDecoder GetDecoder(StreamReader stream)
|
||||||
{
|
{
|
||||||
|
@ -13,11 +13,11 @@ namespace osu.Game.Beatmaps.IO
|
|||||||
{
|
{
|
||||||
private class Reader
|
private class Reader
|
||||||
{
|
{
|
||||||
public Func<Storage, string, bool> Test { get; set; }
|
public Func<Storage, string, bool> Test;
|
||||||
public Type Type { get; set; }
|
public Type Type;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Reader> readers { get; } = new List<Reader>();
|
private static readonly List<Reader> readers = new List<Reader>();
|
||||||
|
|
||||||
public static ArchiveReader GetReader(Storage storage, string path)
|
public static ArchiveReader GetReader(Storage storage, string path)
|
||||||
{
|
{
|
||||||
@ -58,11 +58,9 @@ namespace osu.Game.Beatmaps.IO
|
|||||||
if (input == null)
|
if (input == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
using (MemoryStream ms = new MemoryStream())
|
byte[] buffer = new byte[input.Length];
|
||||||
{
|
input.Read(buffer, 0, buffer.Length);
|
||||||
input.CopyTo(ms);
|
return buffer;
|
||||||
return ms.ToArray();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,14 +18,17 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public readonly BeatmapSetInfo BeatmapSetInfo;
|
public readonly BeatmapSetInfo BeatmapSetInfo;
|
||||||
|
|
||||||
|
public readonly BeatmapMetadata Metadata;
|
||||||
|
|
||||||
public readonly Bindable<IEnumerable<Mod>> Mods = new Bindable<IEnumerable<Mod>>(new Mod[] { });
|
public readonly Bindable<IEnumerable<Mod>> Mods = new Bindable<IEnumerable<Mod>>(new Mod[] { });
|
||||||
|
|
||||||
public readonly bool WithStoryboard;
|
public readonly bool WithStoryboard;
|
||||||
|
|
||||||
protected WorkingBeatmap(BeatmapInfo beatmapInfo, BeatmapSetInfo beatmapSetInfo, bool withStoryboard = false)
|
protected WorkingBeatmap(BeatmapInfo beatmapInfo, bool withStoryboard = false)
|
||||||
{
|
{
|
||||||
BeatmapInfo = beatmapInfo;
|
BeatmapInfo = beatmapInfo;
|
||||||
BeatmapSetInfo = beatmapSetInfo;
|
BeatmapSetInfo = beatmapInfo.BeatmapSet;
|
||||||
|
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo.Metadata;
|
||||||
WithStoryboard = withStoryboard;
|
WithStoryboard = withStoryboard;
|
||||||
|
|
||||||
Mods.ValueChanged += mods => applyRateAdjustments();
|
Mods.ValueChanged += mods => applyRateAdjustments();
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
|
|
||||||
namespace osu.Game.Configuration
|
namespace osu.Game.Configuration
|
||||||
@ -19,6 +20,8 @@ namespace osu.Game.Configuration
|
|||||||
Set(OsuConfig.DisplayStarsMinimum, 0.0, 0, 10);
|
Set(OsuConfig.DisplayStarsMinimum, 0.0, 0, 10);
|
||||||
Set(OsuConfig.DisplayStarsMaximum, 10.0, 0, 10);
|
Set(OsuConfig.DisplayStarsMaximum, 10.0, 0, 10);
|
||||||
|
|
||||||
|
Set(OsuConfig.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2, 1);
|
||||||
|
|
||||||
// Online settings
|
// Online settings
|
||||||
|
|
||||||
Set(OsuConfig.Username, string.Empty);
|
Set(OsuConfig.Username, string.Empty);
|
||||||
@ -102,6 +105,7 @@ namespace osu.Game.Configuration
|
|||||||
DisplayStarsMaximum,
|
DisplayStarsMaximum,
|
||||||
SnakingInSliders,
|
SnakingInSliders,
|
||||||
SnakingOutSliders,
|
SnakingOutSliders,
|
||||||
ShowFpsDisplay
|
ShowFpsDisplay,
|
||||||
|
ChatDisplayHeight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,14 +36,12 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
private void deletePending()
|
private void deletePending()
|
||||||
{
|
{
|
||||||
foreach (var b in Query<BeatmapSetInfo>().Where(b => b.DeletePending))
|
foreach (var b in GetAllWithChildren<BeatmapSetInfo>(b => b.DeletePending))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Storage.Delete(b.Path);
|
Storage.Delete(b.Path);
|
||||||
|
|
||||||
GetChildren(b, true);
|
|
||||||
|
|
||||||
foreach (var i in b.Beatmaps)
|
foreach (var i in b.Beatmaps)
|
||||||
{
|
{
|
||||||
if (i.Metadata != null) Connection.Delete(i.Metadata);
|
if (i.Metadata != null) Connection.Delete(i.Metadata);
|
||||||
@ -269,20 +267,16 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null, bool withStoryboard = false)
|
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null, bool withStoryboard = false)
|
||||||
{
|
{
|
||||||
var beatmapSetInfo = Query<BeatmapSetInfo>().FirstOrDefault(s => s.ID == beatmapInfo.BeatmapSetInfoID);
|
if (beatmapInfo.BeatmapSet == null || beatmapInfo.Ruleset == null)
|
||||||
|
beatmapInfo = GetChildren(beatmapInfo, true);
|
||||||
|
|
||||||
if (beatmapSetInfo == null)
|
if (beatmapInfo.BeatmapSet == null)
|
||||||
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database.");
|
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database.");
|
||||||
|
|
||||||
//we need metadata
|
|
||||||
GetChildren(beatmapSetInfo);
|
|
||||||
//we also need a ruleset
|
|
||||||
GetChildren(beatmapInfo);
|
|
||||||
|
|
||||||
if (beatmapInfo.Metadata == null)
|
if (beatmapInfo.Metadata == null)
|
||||||
beatmapInfo.Metadata = beatmapSetInfo.Metadata;
|
beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata;
|
||||||
|
|
||||||
WorkingBeatmap working = new DatabaseWorkingBeatmap(this, beatmapInfo, beatmapSetInfo, withStoryboard);
|
WorkingBeatmap working = new DatabaseWorkingBeatmap(this, beatmapInfo, withStoryboard);
|
||||||
|
|
||||||
previous?.TransferTo(working);
|
previous?.TransferTo(working);
|
||||||
|
|
||||||
|
@ -48,11 +48,9 @@ namespace osu.Game.Database
|
|||||||
return Connection.Table<T>();
|
return Connection.Table<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public T GetWithChildren<T>(object id) where T : class
|
/// <summary>
|
||||||
{
|
/// This is expensive. Use with caution.
|
||||||
return Connection.GetWithChildren<T>(id);
|
/// </summary>
|
||||||
}
|
|
||||||
|
|
||||||
public List<T> GetAllWithChildren<T>(Expression<Func<T, bool>> filter = null, bool recursive = true)
|
public List<T> GetAllWithChildren<T>(Expression<Func<T, bool>> filter = null, bool recursive = true)
|
||||||
where T : class
|
where T : class
|
||||||
{
|
{
|
||||||
|
@ -14,8 +14,8 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
private readonly BeatmapDatabase database;
|
private readonly BeatmapDatabase database;
|
||||||
|
|
||||||
public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo, BeatmapSetInfo beatmapSetInfo, bool withStoryboard = false)
|
public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo, bool withStoryboard = false)
|
||||||
: base(beatmapInfo, beatmapSetInfo, withStoryboard)
|
: base(beatmapInfo, withStoryboard)
|
||||||
{
|
{
|
||||||
this.database = database;
|
this.database = database;
|
||||||
}
|
}
|
||||||
@ -51,13 +51,13 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
protected override Texture GetBackground()
|
protected override Texture GetBackground()
|
||||||
{
|
{
|
||||||
if (BeatmapInfo?.Metadata?.BackgroundFile == null)
|
if (Metadata?.BackgroundFile == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var reader = getReader())
|
using (var reader = getReader())
|
||||||
return new TextureStore(new RawTextureLoaderStore(reader), false).Get(BeatmapInfo.Metadata.BackgroundFile);
|
return new TextureStore(new RawTextureLoaderStore(reader), false).Get(Metadata.BackgroundFile);
|
||||||
}
|
}
|
||||||
catch { return null; }
|
catch { return null; }
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var trackData = getReader()?.GetStream(BeatmapInfo.Metadata.AudioFile);
|
var trackData = getReader()?.GetStream(Metadata.AudioFile);
|
||||||
return trackData == null ? null : new TrackBass(trackData);
|
return trackData == null ? null : new TrackBass(trackData);
|
||||||
}
|
}
|
||||||
catch { return null; }
|
catch { return null; }
|
||||||
|
@ -94,13 +94,13 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
byte[] properties = new byte[5];
|
byte[] properties = new byte[5];
|
||||||
if (replayInStream.Read(properties, 0, 5) != 5)
|
if (replayInStream.Read(properties, 0, 5) != 5)
|
||||||
throw new Exception("input .lzma is too short");
|
throw new IOException("input .lzma is too short");
|
||||||
long outSize = 0;
|
long outSize = 0;
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
int v = replayInStream.ReadByte();
|
int v = replayInStream.ReadByte();
|
||||||
if (v < 0)
|
if (v < 0)
|
||||||
throw new Exception("Can't Read 1");
|
throw new IOException("Can't Read 1");
|
||||||
outSize |= (long)(byte)v << (8 * i);
|
outSize |= (long)(byte)v << (8 * i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ using OpenTK.Graphics.ES30;
|
|||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Graphics.Colour;
|
using osu.Framework.Graphics.Colour;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Cursor
|
namespace osu.Game.Graphics.Cursor
|
||||||
{
|
{
|
||||||
@ -39,6 +40,8 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
|
|
||||||
private Vector2? lastPosition;
|
private Vector2? lastPosition;
|
||||||
|
|
||||||
|
private readonly InputResampler resampler = new InputResampler();
|
||||||
|
|
||||||
protected override DrawNode CreateDrawNode() => new TrailDrawNode();
|
protected override DrawNode CreateDrawNode() => new TrailDrawNode();
|
||||||
|
|
||||||
protected override void ApplyDrawNode(DrawNode node)
|
protected override void ApplyDrawNode(DrawNode node)
|
||||||
@ -75,7 +78,7 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(ShaderManager shaders, TextureStore textures)
|
private void load(ShaderManager shaders, TextureStore textures)
|
||||||
{
|
{
|
||||||
shader = shaders?.Load(@"CursorTrail", FragmentShaderDescriptor.Texture);
|
shader = shaders?.Load(@"CursorTrail", FragmentShaderDescriptor.TEXTURE);
|
||||||
texture = textures.Get(@"Cursor/cursortrail");
|
texture = textures.Get(@"Cursor/cursortrail");
|
||||||
Scale = new Vector2(1 / texture.ScaleAdjust);
|
Scale = new Vector2(1 / texture.ScaleAdjust);
|
||||||
}
|
}
|
||||||
@ -116,12 +119,15 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
if (lastPosition == null)
|
if (lastPosition == null)
|
||||||
{
|
{
|
||||||
lastPosition = state.Mouse.NativeState.Position;
|
lastPosition = state.Mouse.NativeState.Position;
|
||||||
|
resampler.AddPosition(lastPosition.Value);
|
||||||
return base.OnMouseMove(state);
|
return base.OnMouseMove(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2 pos1 = lastPosition.Value;
|
foreach (Vector2 pos2 in resampler.AddPosition(state.Mouse.NativeState.Position))
|
||||||
Vector2 pos2 = state.Mouse.NativeState.Position;
|
{
|
||||||
|
Trace.Assert(lastPosition.HasValue);
|
||||||
|
|
||||||
|
Vector2 pos1 = lastPosition.Value;
|
||||||
Vector2 diff = pos2 - pos1;
|
Vector2 diff = pos2 - pos1;
|
||||||
float distance = diff.Length;
|
float distance = diff.Length;
|
||||||
Vector2 direction = diff / distance;
|
Vector2 direction = diff / distance;
|
||||||
@ -133,6 +139,7 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
lastPosition = pos1 + direction * d;
|
lastPosition = pos1 + direction * d;
|
||||||
addPosition(lastPosition.Value);
|
addPosition(lastPosition.Value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return base.OnMouseMove(state);
|
return base.OnMouseMove(state);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Graphics
|
|||||||
switch (hex.Length)
|
switch (hex.Length)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
throw new Exception(@"Invalid hex string length!");
|
throw new ArgumentException(@"Invalid hex string length!");
|
||||||
case 3:
|
case 3:
|
||||||
return new Color4(
|
return new Color4(
|
||||||
(byte)(Convert.ToByte(hex.Substring(0, 1), 16) * 17),
|
(byte)(Convert.ToByte(hex.Substring(0, 1), 16) * 17),
|
||||||
@ -33,57 +33,59 @@ namespace osu.Game.Graphics
|
|||||||
}
|
}
|
||||||
|
|
||||||
// See https://github.com/ppy/osu-web/blob/master/resources/assets/less/colors.less
|
// See https://github.com/ppy/osu-web/blob/master/resources/assets/less/colors.less
|
||||||
public Color4 PurpleLighter = FromHex(@"eeeeff");
|
public readonly Color4 PurpleLighter = FromHex(@"eeeeff");
|
||||||
public Color4 PurpleLight = FromHex(@"aa88ff");
|
public readonly Color4 PurpleLight = FromHex(@"aa88ff");
|
||||||
public Color4 Purple = FromHex(@"8866ee");
|
public readonly Color4 Purple = FromHex(@"8866ee");
|
||||||
public Color4 PurpleDark = FromHex(@"6644cc");
|
public readonly Color4 PurpleDark = FromHex(@"6644cc");
|
||||||
public Color4 PurpleDarker = FromHex(@"441188");
|
public readonly Color4 PurpleDarker = FromHex(@"441188");
|
||||||
|
|
||||||
public Color4 PinkLighter = FromHex(@"ffddee");
|
public readonly Color4 PinkLighter = FromHex(@"ffddee");
|
||||||
public Color4 PinkLight = FromHex(@"ff99cc");
|
public readonly Color4 PinkLight = FromHex(@"ff99cc");
|
||||||
public Color4 Pink = FromHex(@"ff66aa");
|
public readonly Color4 Pink = FromHex(@"ff66aa");
|
||||||
public Color4 PinkDark = FromHex(@"cc5288");
|
public readonly Color4 PinkDark = FromHex(@"cc5288");
|
||||||
public Color4 PinkDarker = FromHex(@"bb1177");
|
public readonly Color4 PinkDarker = FromHex(@"bb1177");
|
||||||
|
|
||||||
public Color4 BlueLighter = FromHex(@"ddffff");
|
public readonly Color4 BlueLighter = FromHex(@"ddffff");
|
||||||
public Color4 BlueLight = FromHex(@"99eeff");
|
public readonly Color4 BlueLight = FromHex(@"99eeff");
|
||||||
public Color4 Blue = FromHex(@"66ccff");
|
public readonly Color4 Blue = FromHex(@"66ccff");
|
||||||
public Color4 BlueDark = FromHex(@"44aadd");
|
public readonly Color4 BlueDark = FromHex(@"44aadd");
|
||||||
public Color4 BlueDarker = FromHex(@"2299bb");
|
public readonly Color4 BlueDarker = FromHex(@"2299bb");
|
||||||
|
|
||||||
public Color4 YellowLighter = FromHex(@"ffffdd");
|
public readonly Color4 YellowLighter = FromHex(@"ffffdd");
|
||||||
public Color4 YellowLight = FromHex(@"ffdd55");
|
public readonly Color4 YellowLight = FromHex(@"ffdd55");
|
||||||
public Color4 Yellow = FromHex(@"ffcc22");
|
public readonly Color4 Yellow = FromHex(@"ffcc22");
|
||||||
public Color4 YellowDark = FromHex(@"eeaa00");
|
public readonly Color4 YellowDark = FromHex(@"eeaa00");
|
||||||
public Color4 YellowDarker = FromHex(@"cc6600");
|
public readonly Color4 YellowDarker = FromHex(@"cc6600");
|
||||||
|
|
||||||
public Color4 GreenLighter = FromHex(@"eeffcc");
|
public readonly Color4 GreenLighter = FromHex(@"eeffcc");
|
||||||
public Color4 GreenLight = FromHex(@"b3d944");
|
public readonly Color4 GreenLight = FromHex(@"b3d944");
|
||||||
public Color4 Green = FromHex(@"88b300");
|
public readonly Color4 Green = FromHex(@"88b300");
|
||||||
public Color4 GreenDark = FromHex(@"668800");
|
public readonly Color4 GreenDark = FromHex(@"668800");
|
||||||
public Color4 GreenDarker = FromHex(@"445500");
|
public readonly Color4 GreenDarker = FromHex(@"445500");
|
||||||
|
|
||||||
public Color4 Gray0 = FromHex(@"000");
|
public readonly Color4 Gray0 = FromHex(@"000");
|
||||||
public Color4 Gray1 = FromHex(@"111");
|
public readonly Color4 Gray1 = FromHex(@"111");
|
||||||
public Color4 Gray2 = FromHex(@"222");
|
public readonly Color4 Gray2 = FromHex(@"222");
|
||||||
public Color4 Gray3 = FromHex(@"333");
|
public readonly Color4 Gray3 = FromHex(@"333");
|
||||||
public Color4 Gray4 = FromHex(@"444");
|
public readonly Color4 Gray4 = FromHex(@"444");
|
||||||
public Color4 Gray5 = FromHex(@"555");
|
public readonly Color4 Gray5 = FromHex(@"555");
|
||||||
public Color4 Gray6 = FromHex(@"666");
|
public readonly Color4 Gray6 = FromHex(@"666");
|
||||||
public Color4 Gray7 = FromHex(@"777");
|
public readonly Color4 Gray7 = FromHex(@"777");
|
||||||
public Color4 Gray8 = FromHex(@"888");
|
public readonly Color4 Gray8 = FromHex(@"888");
|
||||||
public Color4 Gray9 = FromHex(@"999");
|
public readonly Color4 Gray9 = FromHex(@"999");
|
||||||
public Color4 GrayA = FromHex(@"aaa");
|
public readonly Color4 GrayA = FromHex(@"aaa");
|
||||||
public Color4 GrayB = FromHex(@"bbb");
|
public readonly Color4 GrayB = FromHex(@"bbb");
|
||||||
public Color4 GrayC = FromHex(@"ccc");
|
public readonly Color4 GrayC = FromHex(@"ccc");
|
||||||
public Color4 GrayD = FromHex(@"ddd");
|
public readonly Color4 GrayD = FromHex(@"ddd");
|
||||||
public Color4 GrayE = FromHex(@"eee");
|
public readonly Color4 GrayE = FromHex(@"eee");
|
||||||
public Color4 GrayF = FromHex(@"fff");
|
public readonly Color4 GrayF = FromHex(@"fff");
|
||||||
|
|
||||||
public Color4 RedLighter = FromHex(@"ffeded");
|
public readonly Color4 RedLighter = FromHex(@"ffeded");
|
||||||
public Color4 RedLight = FromHex(@"ed7787");
|
public readonly Color4 RedLight = FromHex(@"ed7787");
|
||||||
public Color4 Red = FromHex(@"ed1121");
|
public readonly Color4 Red = FromHex(@"ed1121");
|
||||||
public Color4 RedDark = FromHex(@"ba0011");
|
public readonly Color4 RedDark = FromHex(@"ba0011");
|
||||||
public Color4 RedDarker = FromHex(@"870000");
|
public readonly Color4 RedDarker = FromHex(@"870000");
|
||||||
|
|
||||||
|
public readonly Color4 ChatBlue = FromHex(@"17292e");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,13 +25,13 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || Dropdown.Contains(screenSpacePos);
|
protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || Dropdown.Contains(screenSpacePos);
|
||||||
|
|
||||||
|
private bool isEnumType => typeof(T).IsEnum;
|
||||||
|
|
||||||
public OsuTabControl()
|
public OsuTabControl()
|
||||||
{
|
{
|
||||||
TabContainer.Spacing = new Vector2(10f, 0f);
|
TabContainer.Spacing = new Vector2(10f, 0f);
|
||||||
|
|
||||||
if (!typeof(T).IsEnum)
|
if (isEnumType)
|
||||||
throw new InvalidOperationException("OsuTabControl only supports enums as the generic type argument");
|
|
||||||
|
|
||||||
foreach (var val in (T[])Enum.GetValues(typeof(T)))
|
foreach (var val in (T[])Enum.GetValues(typeof(T)))
|
||||||
AddItem(val);
|
AddItem(val);
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Margin = new MarginPadding { Top = 5, Bottom = 5 },
|
Margin = new MarginPadding { Top = 5, Bottom = 5 },
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Text = (value as Enum)?.GetDescription(),
|
Text = (value as Enum)?.GetDescription() ?? value.ToString(),
|
||||||
TextSize = 14,
|
TextSize = 14,
|
||||||
Font = @"Exo2.0-Bold", // Font should only turn bold when active?
|
Font = @"Exo2.0-Bold", // Font should only turn bold when active?
|
||||||
},
|
},
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK.Input;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Game.Graphics;
|
using OpenTK.Input;
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A textbox which holds focus eagerly.
|
/// A textbox which holds focus eagerly.
|
@ -16,12 +16,13 @@ namespace osu.Game.IO.Serialization
|
|||||||
return JsonConvert.SerializeObject(obj);
|
return JsonConvert.SerializeObject(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static T Deserialize<T>(string objString)
|
public static T Deserialize<T>(this string objString)
|
||||||
{
|
{
|
||||||
return JsonConvert.DeserializeObject<T>(objString);
|
return JsonConvert.DeserializeObject<T>(objString);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static T DeepClone<T>(this IJsonSerializable obj)
|
public static T DeepClone<T>(this T obj)
|
||||||
|
where T : IJsonSerializable
|
||||||
{
|
{
|
||||||
return Deserialize<T>(Serialize(obj));
|
return Deserialize<T>(Serialize(obj));
|
||||||
}
|
}
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Input;
|
|
||||||
|
|
||||||
namespace osu.Game.Input
|
|
||||||
{
|
|
||||||
public class GlobalHotkeys : Drawable
|
|
||||||
{
|
|
||||||
public Func<InputState, KeyDownEventArgs, bool> Handler;
|
|
||||||
|
|
||||||
public override bool HandleInput => true;
|
|
||||||
|
|
||||||
public GlobalHotkeys()
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
|
||||||
{
|
|
||||||
return Handler(state, args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -72,22 +72,29 @@ namespace osu.Game.Online.API
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static readonly object access_token_retrieval_lock = new object();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Should be run before any API request to make sure we have a valid key.
|
/// Should be run before any API request to make sure we have a valid key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool ensureAccessToken()
|
private bool ensureAccessToken()
|
||||||
{
|
{
|
||||||
//todo: we need to mutex this to ensure only one authentication request is running at a time.
|
// if we already have a valid access token, let's use it.
|
||||||
|
|
||||||
//If we already have a valid access token, let's use it.
|
|
||||||
if (accessTokenValid) return true;
|
if (accessTokenValid) return true;
|
||||||
|
|
||||||
//If not, let's try using our refresh token to request a new access token.
|
// we want to ensure only a single authentication update is happening at once.
|
||||||
|
lock (access_token_retrieval_lock)
|
||||||
|
{
|
||||||
|
// re-check if valid, in case another request completed and revalidated our access.
|
||||||
|
if (accessTokenValid) return true;
|
||||||
|
|
||||||
|
// if not, let's try using our refresh token to request a new access token.
|
||||||
if (!string.IsNullOrEmpty(Token?.RefreshToken))
|
if (!string.IsNullOrEmpty(Token?.RefreshToken))
|
||||||
AuthenticateWithRefresh(Token.RefreshToken);
|
AuthenticateWithRefresh(Token.RefreshToken);
|
||||||
|
|
||||||
return accessTokenValid;
|
return accessTokenValid;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool accessTokenValid => Token?.IsValid ?? false;
|
private bool accessTokenValid => Token?.IsValid ?? false;
|
||||||
|
|
||||||
|
@ -41,13 +41,13 @@ namespace osu.Game.Online.API
|
|||||||
[JsonProperty(@"refresh_token")]
|
[JsonProperty(@"refresh_token")]
|
||||||
public string RefreshToken;
|
public string RefreshToken;
|
||||||
|
|
||||||
public override string ToString() => $@"{AccessToken}/{AccessTokenExpiry.ToString(NumberFormatInfo.InvariantInfo)}/{RefreshToken}";
|
public override string ToString() => $@"{AccessToken}|{AccessTokenExpiry.ToString(NumberFormatInfo.InvariantInfo)}|{RefreshToken}";
|
||||||
|
|
||||||
public static OAuthToken Parse(string value)
|
public static OAuthToken Parse(string value)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string[] parts = value.Split('/');
|
string[] parts = value.Split('|');
|
||||||
return new OAuthToken
|
return new OAuthToken
|
||||||
{
|
{
|
||||||
AccessToken = parts[0],
|
AccessToken = parts[0],
|
||||||
|
@ -23,10 +23,12 @@ namespace osu.Game.Online.Chat
|
|||||||
[JsonProperty(@"channel_id")]
|
[JsonProperty(@"channel_id")]
|
||||||
public int Id;
|
public int Id;
|
||||||
|
|
||||||
public SortedList<Message> Messages = new SortedList<Message>((m1, m2) => m1.Id.CompareTo(m2.Id));
|
public readonly SortedList<Message> Messages = new SortedList<Message>((m1, m2) => m1.Id.CompareTo(m2.Id));
|
||||||
|
|
||||||
//internal bool Joined;
|
//internal bool Joined;
|
||||||
|
|
||||||
|
public bool ReadOnly => Name != "#lazer";
|
||||||
|
|
||||||
public const int MAX_HISTORY = 300;
|
public const int MAX_HISTORY = 300;
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
@ -53,5 +55,7 @@ namespace osu.Game.Online.Chat
|
|||||||
if (messageCount > MAX_HISTORY)
|
if (messageCount > MAX_HISTORY)
|
||||||
Messages.RemoveRange(0, messageCount - MAX_HISTORY);
|
Messages.RemoveRange(0, messageCount - MAX_HISTORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString() => Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Game.Input;
|
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Game.Graphics.UserInterface.Volume;
|
using osu.Game.Graphics.UserInterface.Volume;
|
||||||
@ -161,7 +160,7 @@ namespace osu.Game
|
|||||||
});
|
});
|
||||||
|
|
||||||
//overlay elements
|
//overlay elements
|
||||||
LoadComponentAsync(chat = new ChatOverlay { Depth = 0 }, overlayContent.Add);
|
LoadComponentAsync(chat = new ChatOverlay { Depth = -1 }, mainContent.Add);
|
||||||
LoadComponentAsync(options = new OptionsOverlay { Depth = -1 }, overlayContent.Add);
|
LoadComponentAsync(options = new OptionsOverlay { Depth = -1 }, overlayContent.Add);
|
||||||
LoadComponentAsync(musicController = new MusicController
|
LoadComponentAsync(musicController = new MusicController
|
||||||
{
|
{
|
||||||
@ -321,8 +320,7 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
base.UpdateAfterChildren();
|
base.UpdateAfterChildren();
|
||||||
|
|
||||||
if (intro?.ChildScreen != null)
|
mainContent.Padding = new MarginPadding { Top = Toolbar.Position.Y + Toolbar.DrawHeight };
|
||||||
intro.ChildScreen.Padding = new MarginPadding { Top = Toolbar.Position.Y + Toolbar.DrawHeight };
|
|
||||||
|
|
||||||
Cursor.State = currentScreen?.HasLocalCursorDisplayed == false ? Visibility.Visible : Visibility.Hidden;
|
Cursor.State = currentScreen?.HasLocalCursorDisplayed == false ? Visibility.Visible : Visibility.Hidden;
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,11 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Online.Chat;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Online.Chat.Drawables
|
namespace osu.Game.Overlays.Chat
|
||||||
{
|
{
|
||||||
public class ChatLine : Container
|
public class ChatLine : Container
|
||||||
{
|
{
|
||||||
@ -62,7 +63,10 @@ namespace osu.Game.Online.Chat.Drawables
|
|||||||
return username_colours[message.UserId % username_colours.Length];
|
return username_colours[message.UserId % username_colours.Length];
|
||||||
}
|
}
|
||||||
|
|
||||||
private const float padding = 200;
|
public const float LEFT_PADDING = message_padding + padding * 2;
|
||||||
|
|
||||||
|
private const float padding = 15;
|
||||||
|
private const float message_padding = 200;
|
||||||
private const float text_size = 20;
|
private const float text_size = 20;
|
||||||
|
|
||||||
public ChatLine(Message message)
|
public ChatLine(Message message)
|
||||||
@ -72,13 +76,13 @@ namespace osu.Game.Online.Chat.Drawables
|
|||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
Padding = new MarginPadding { Left = 15, Right = 15 };
|
Padding = new MarginPadding { Left = padding, Right = padding };
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
Size = new Vector2(padding, text_size),
|
Size = new Vector2(message_padding, text_size),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
@ -106,7 +110,7 @@ namespace osu.Game.Online.Chat.Drawables
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Padding = new MarginPadding { Left = padding + 15 },
|
Padding = new MarginPadding { Left = message_padding + padding },
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
182
osu.Game/Overlays/Chat/ChatTabControl.cs
Normal file
182
osu.Game/Overlays/Chat/ChatTabControl.cs
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Online.Chat;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Chat
|
||||||
|
{
|
||||||
|
public class ChatTabControl : OsuTabControl<Channel>
|
||||||
|
{
|
||||||
|
protected override TabItem<Channel> CreateTabItem(Channel value) => new ChannelTabItem(value);
|
||||||
|
|
||||||
|
private const float shear_width = 10;
|
||||||
|
|
||||||
|
public ChatTabControl()
|
||||||
|
{
|
||||||
|
TabContainer.Margin = new MarginPadding { Left = 50 };
|
||||||
|
TabContainer.Spacing = new Vector2(-shear_width, 0);
|
||||||
|
TabContainer.Masking = false;
|
||||||
|
|
||||||
|
AddInternal(new TextAwesome
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.fa_comments,
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
TextSize = 20,
|
||||||
|
Padding = new MarginPadding(10),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ChannelTabItem : TabItem<Channel>
|
||||||
|
{
|
||||||
|
private Color4 backgroundInactive;
|
||||||
|
private Color4 backgroundHover;
|
||||||
|
private Color4 backgroundActive;
|
||||||
|
|
||||||
|
private readonly SpriteText text;
|
||||||
|
private readonly Box box;
|
||||||
|
private readonly Box highlightBox;
|
||||||
|
|
||||||
|
public override bool Active
|
||||||
|
{
|
||||||
|
get { return base.Active; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (Active == value) return;
|
||||||
|
|
||||||
|
base.Active = value;
|
||||||
|
updateState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateState()
|
||||||
|
{
|
||||||
|
if (Active)
|
||||||
|
fadeActive();
|
||||||
|
else
|
||||||
|
fadeInactive();
|
||||||
|
}
|
||||||
|
|
||||||
|
private const float transition_length = 400;
|
||||||
|
|
||||||
|
private void fadeActive()
|
||||||
|
{
|
||||||
|
ResizeTo(new Vector2(Width, 1.1f), transition_length, EasingTypes.OutQuint);
|
||||||
|
|
||||||
|
box.FadeColour(backgroundActive, transition_length, EasingTypes.OutQuint);
|
||||||
|
highlightBox.FadeIn(transition_length, EasingTypes.OutQuint);
|
||||||
|
text.Font = @"Exo2.0-Bold";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fadeInactive()
|
||||||
|
{
|
||||||
|
ResizeTo(new Vector2(Width, 1), transition_length, EasingTypes.OutQuint);
|
||||||
|
|
||||||
|
box.FadeColour(backgroundInactive, transition_length, EasingTypes.OutQuint);
|
||||||
|
highlightBox.FadeOut(transition_length, EasingTypes.OutQuint);
|
||||||
|
text.Font = @"Exo2.0-Regular";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnHover(InputState state)
|
||||||
|
{
|
||||||
|
if (!Active)
|
||||||
|
box.FadeColour(backgroundHover, transition_length, EasingTypes.OutQuint);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(InputState state)
|
||||||
|
{
|
||||||
|
updateState();
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
backgroundActive = colours.ChatBlue;
|
||||||
|
backgroundInactive = colours.Gray4;
|
||||||
|
backgroundHover = colours.Gray7;
|
||||||
|
|
||||||
|
highlightBox.Colour = colours.Yellow;
|
||||||
|
|
||||||
|
updateState();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChannelTabItem(Channel value) : base(value)
|
||||||
|
{
|
||||||
|
Width = 150;
|
||||||
|
|
||||||
|
RelativeSizeAxes = Axes.Y;
|
||||||
|
|
||||||
|
Anchor = Anchor.BottomLeft;
|
||||||
|
Origin = Anchor.BottomLeft;
|
||||||
|
|
||||||
|
Shear = new Vector2(shear_width / ChatOverlay.TAB_AREA_HEIGHT, 0);
|
||||||
|
|
||||||
|
Masking = true;
|
||||||
|
EdgeEffect = new EdgeEffect
|
||||||
|
{
|
||||||
|
Type = EdgeEffectType.Shadow,
|
||||||
|
Radius = 10,
|
||||||
|
Colour = Color4.Black.Opacity(0.2f),
|
||||||
|
};
|
||||||
|
|
||||||
|
Children = 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,
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Shear = new Vector2(-shear_width / ChatOverlay.TAB_AREA_HEIGHT, 0),
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new TextAwesome
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.fa_hashtag,
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Colour = Color4.Black,
|
||||||
|
X = -10,
|
||||||
|
Alpha = 0.2f,
|
||||||
|
TextSize = ChatOverlay.TAB_AREA_HEIGHT,
|
||||||
|
},
|
||||||
|
text = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Margin = new MarginPadding(5),
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Text = value.ToString(),
|
||||||
|
TextSize = 18,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -7,32 +7,24 @@ using System.Linq;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Online.Chat;
|
||||||
|
|
||||||
namespace osu.Game.Online.Chat.Drawables
|
namespace osu.Game.Overlays.Chat
|
||||||
{
|
{
|
||||||
public class DrawableChannel : Container
|
public class DrawableChannel : Container
|
||||||
{
|
{
|
||||||
private readonly Channel channel;
|
public readonly Channel Channel;
|
||||||
private readonly FillFlowContainer flow;
|
private readonly FillFlowContainer flow;
|
||||||
private readonly ScrollContainer scroll;
|
private readonly ScrollContainer scroll;
|
||||||
|
|
||||||
public DrawableChannel(Channel channel)
|
public DrawableChannel(Channel channel)
|
||||||
{
|
{
|
||||||
this.channel = channel;
|
Channel = channel;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuSpriteText
|
|
||||||
{
|
|
||||||
Text = channel.Name,
|
|
||||||
TextSize = 50,
|
|
||||||
Alpha = 0.3f,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre
|
|
||||||
},
|
|
||||||
scroll = new ScrollContainer
|
scroll = new ScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -56,14 +48,14 @@ namespace osu.Game.Online.Chat.Drawables
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
newMessagesArrived(channel.Messages);
|
newMessagesArrived(Channel.Messages);
|
||||||
scrollToEnd();
|
scrollToEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
channel.NewMessagesArrived -= newMessagesArrived;
|
Channel.NewMessagesArrived -= newMessagesArrived;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void newMessagesArrived(IEnumerable<Message> newMessages)
|
private void newMessagesArrived(IEnumerable<Message> newMessages)
|
@ -7,6 +7,7 @@ using System.Diagnostics;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
@ -15,24 +16,24 @@ using osu.Game.Graphics.Sprites;
|
|||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Online.Chat;
|
using osu.Game.Online.Chat;
|
||||||
using osu.Game.Online.Chat.Drawables;
|
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Overlays.Chat;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public class ChatOverlay : FocusedOverlayContainer, IOnlineComponent
|
public class ChatOverlay : FocusedOverlayContainer, IOnlineComponent
|
||||||
{
|
{
|
||||||
private const float textbox_height = 40;
|
private const float textbox_height = 60;
|
||||||
|
|
||||||
private ScheduledDelegate messageRequest;
|
private ScheduledDelegate messageRequest;
|
||||||
|
|
||||||
private readonly Container content;
|
private readonly Container currentChannelContainer;
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
|
||||||
|
|
||||||
private readonly FocusedTextBox inputTextBox;
|
private readonly FocusedTextBox inputTextBox;
|
||||||
|
|
||||||
@ -40,28 +41,50 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private const int transition_length = 500;
|
private const int transition_length = 500;
|
||||||
|
|
||||||
|
public const float DEFAULT_HEIGHT = 0.4f;
|
||||||
|
|
||||||
|
public const float TAB_AREA_HEIGHT = 50;
|
||||||
|
|
||||||
private GetMessagesRequest fetchReq;
|
private GetMessagesRequest fetchReq;
|
||||||
|
|
||||||
|
private readonly ChatTabControl channelTabs;
|
||||||
|
|
||||||
|
private readonly Box chatBackground;
|
||||||
|
private readonly Box tabBackground;
|
||||||
|
|
||||||
|
private Bindable<double> chatHeight;
|
||||||
|
|
||||||
public ChatOverlay()
|
public ChatOverlay()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.Both;
|
||||||
Size = new Vector2(1, 300);
|
RelativePositionAxes = Axes.Both;
|
||||||
|
Size = new Vector2(1, DEFAULT_HEIGHT);
|
||||||
Anchor = Anchor.BottomLeft;
|
Anchor = Anchor.BottomLeft;
|
||||||
Origin = Anchor.BottomLeft;
|
Origin = Anchor.BottomLeft;
|
||||||
|
|
||||||
AddInternal(new Drawable[]
|
const float padding = 5;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Container
|
||||||
|
{
|
||||||
|
Name = @"chat area",
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Padding = new MarginPadding { Top = TAB_AREA_HEIGHT },
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
chatBackground = new Box
|
||||||
{
|
{
|
||||||
Depth = float.MaxValue,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.Black,
|
|
||||||
Alpha = 0.9f,
|
|
||||||
},
|
},
|
||||||
content = new Container
|
currentChannelContainer = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Top = 5, Bottom = textbox_height + 5 },
|
Padding = new MarginPadding
|
||||||
|
{
|
||||||
|
Top = padding,
|
||||||
|
Bottom = textbox_height + padding
|
||||||
|
},
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
@ -69,7 +92,13 @@ namespace osu.Game.Overlays
|
|||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = textbox_height,
|
Height = textbox_height,
|
||||||
Padding = new MarginPadding(5),
|
Padding = new MarginPadding
|
||||||
|
{
|
||||||
|
Top = padding * 2,
|
||||||
|
Bottom = padding * 2,
|
||||||
|
Left = ChatLine.LEFT_PADDING + padding * 2,
|
||||||
|
Right = padding * 2,
|
||||||
|
},
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
inputTextBox = new FocusedTextBox
|
inputTextBox = new FocusedTextBox
|
||||||
@ -83,7 +112,43 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Name = @"tabs area",
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = TAB_AREA_HEIGHT,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
tabBackground = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.Black,
|
||||||
|
},
|
||||||
|
channelTabs = new ChatTabControl
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
channelTabs.Current.ValueChanged += newChannel => CurrentChannel = newChannel;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnDragStart(InputState state)
|
||||||
|
{
|
||||||
|
if (channelTabs.Hovering)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return base.OnDragStart(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnDrag(InputState state)
|
||||||
|
{
|
||||||
|
chatHeight.Value = Height - state.Mouse.Delta.Y / Parent.DrawSize.Y;
|
||||||
|
return base.OnDrag(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void APIStateChanged(APIAccess api, APIState state)
|
public void APIStateChanged(APIAccess api, APIState state)
|
||||||
@ -110,28 +175,48 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
MoveToY(0, transition_length, EasingTypes.OutQuint);
|
MoveToY(0, transition_length, EasingTypes.OutQuint);
|
||||||
FadeIn(transition_length, EasingTypes.OutQuint);
|
FadeIn(transition_length, EasingTypes.OutQuint);
|
||||||
|
|
||||||
|
inputTextBox.HoldFocus = true;
|
||||||
|
base.PopIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopOut()
|
protected override void PopOut()
|
||||||
{
|
{
|
||||||
MoveToY(DrawSize.Y, transition_length, EasingTypes.InSine);
|
MoveToY(Height, transition_length, EasingTypes.InSine);
|
||||||
FadeOut(transition_length, EasingTypes.InSine);
|
FadeOut(transition_length, EasingTypes.InSine);
|
||||||
|
|
||||||
|
inputTextBox.HoldFocus = false;
|
||||||
|
base.PopOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(APIAccess api)
|
private void load(APIAccess api, OsuConfigManager config, OsuColour colours)
|
||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
api.Register(this);
|
api.Register(this);
|
||||||
|
|
||||||
|
chatHeight = config.GetBindable<double>(OsuConfig.ChatDisplayHeight);
|
||||||
|
chatHeight.ValueChanged += h =>
|
||||||
|
{
|
||||||
|
Height = (float)h;
|
||||||
|
tabBackground.FadeTo(Height == 1 ? 1 : 0.8f, 200);
|
||||||
|
};
|
||||||
|
chatHeight.TriggerChange();
|
||||||
|
|
||||||
|
chatBackground.Colour = colours.ChatBlue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private long? lastMessageId;
|
private long? lastMessageId;
|
||||||
|
|
||||||
private List<Channel> careChannels;
|
private List<Channel> careChannels;
|
||||||
|
|
||||||
|
private readonly List<DrawableChannel> loadedChannels = new List<DrawableChannel>();
|
||||||
|
|
||||||
private void initializeChannels()
|
private void initializeChannels()
|
||||||
{
|
{
|
||||||
Clear();
|
currentChannelContainer.Clear();
|
||||||
|
|
||||||
|
loadedChannels.Clear();
|
||||||
|
|
||||||
careChannels = new List<Channel>();
|
careChannels = new List<Channel>();
|
||||||
|
|
||||||
@ -154,25 +239,67 @@ namespace osu.Game.Overlays
|
|||||||
Scheduler.Add(delegate
|
Scheduler.Add(delegate
|
||||||
{
|
{
|
||||||
loading.FadeOut(100);
|
loading.FadeOut(100);
|
||||||
|
|
||||||
addChannel(channels.Find(c => c.Name == @"#lazer"));
|
addChannel(channels.Find(c => c.Name == @"#lazer"));
|
||||||
|
addChannel(channels.Find(c => c.Name == @"#osu"));
|
||||||
|
addChannel(channels.Find(c => c.Name == @"#lobby"));
|
||||||
});
|
});
|
||||||
|
|
||||||
messageRequest = Scheduler.AddDelayed(fetchNewMessages, 1000, true);
|
messageRequest = Scheduler.AddDelayed(() => fetchNewMessages(), 1000, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
api.Queue(req);
|
api.Queue(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Channel currentChannel;
|
||||||
|
|
||||||
|
protected Channel CurrentChannel
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return currentChannel;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (currentChannel == value) return;
|
||||||
|
|
||||||
|
if (currentChannel != null)
|
||||||
|
currentChannelContainer.Clear(false);
|
||||||
|
|
||||||
|
currentChannel = value;
|
||||||
|
|
||||||
|
var loaded = loadedChannels.Find(d => d.Channel == value);
|
||||||
|
if (loaded == null)
|
||||||
|
loadedChannels.Add(loaded = new DrawableChannel(currentChannel));
|
||||||
|
|
||||||
|
inputTextBox.Current.Disabled = currentChannel.ReadOnly;
|
||||||
|
|
||||||
|
currentChannelContainer.Add(loaded);
|
||||||
|
|
||||||
|
channelTabs.Current.Value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void addChannel(Channel channel)
|
private void addChannel(Channel channel)
|
||||||
{
|
{
|
||||||
Add(new DrawableChannel(channel));
|
if (channel == null) return;
|
||||||
|
|
||||||
careChannels.Add(channel);
|
careChannels.Add(channel);
|
||||||
|
channelTabs.AddItem(channel);
|
||||||
|
|
||||||
|
// we need to get a good number of messages initially for each channel we care about.
|
||||||
|
fetchNewMessages(channel);
|
||||||
|
|
||||||
|
if (CurrentChannel == null)
|
||||||
|
CurrentChannel = channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fetchNewMessages()
|
private void fetchNewMessages(Channel specificChannel = null)
|
||||||
{
|
{
|
||||||
if (fetchReq != null) return;
|
if (fetchReq != null) return;
|
||||||
|
|
||||||
fetchReq = new GetMessagesRequest(careChannels, lastMessageId);
|
fetchReq = new GetMessagesRequest(specificChannel != null ? new List<Channel> { specificChannel } : careChannels, lastMessageId);
|
||||||
fetchReq.Success += delegate (List<Message> messages)
|
fetchReq.Success += delegate (List<Message> messages)
|
||||||
{
|
{
|
||||||
var ids = messages.Where(m => m.TargetType == TargetType.Channel).Select(m => m.TargetId).Distinct();
|
var ids = messages.Where(m => m.TargetType == TargetType.Channel).Select(m => m.TargetId).Distinct();
|
||||||
@ -201,8 +328,6 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(postText) && api.LocalUser.Value != null)
|
if (!string.IsNullOrEmpty(postText) && api.LocalUser.Value != null)
|
||||||
{
|
{
|
||||||
var currentChannel = careChannels.FirstOrDefault();
|
|
||||||
|
|
||||||
if (currentChannel == null) return;
|
if (currentChannel == null) return;
|
||||||
|
|
||||||
var message = new Message
|
var message = new Message
|
||||||
|
@ -16,7 +16,6 @@ namespace osu.Game.Overlays.Mods
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
ButtonColour = colours.Blue;
|
|
||||||
SelectedColour = colours.BlueLight;
|
SelectedColour = colours.BlueLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ namespace osu.Game.Overlays.Mods
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
ButtonColour = colours.Yellow;
|
|
||||||
SelectedColour = colours.YellowLight;
|
SelectedColour = colours.YellowLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ namespace osu.Game.Overlays.Mods
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
ButtonColour = colours.Green;
|
|
||||||
SelectedColour = colours.GreenLight;
|
SelectedColour = colours.GreenLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,9 +19,13 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays.Mods
|
namespace osu.Game.Overlays.Mods
|
||||||
{
|
{
|
||||||
public class ModButton : FillFlowContainer
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a clickable button which can cycle through one of more mods.
|
||||||
|
/// </summary>
|
||||||
|
public class ModButton : ModButtonEmpty
|
||||||
{
|
{
|
||||||
private ModIcon foregroundIcon { get; set; }
|
private ModIcon foregroundIcon;
|
||||||
private readonly SpriteText text;
|
private readonly SpriteText text;
|
||||||
private readonly Container<ModIcon> iconsContainer;
|
private readonly Container<ModIcon> iconsContainer;
|
||||||
private SampleChannel sampleOn, sampleOff;
|
private SampleChannel sampleOn, sampleOff;
|
||||||
@ -51,7 +55,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
iconsContainer.RotateTo(Selected ? 5f : 0f, 300, EasingTypes.OutElastic);
|
iconsContainer.RotateTo(Selected ? 5f : 0f, 300, EasingTypes.OutElastic);
|
||||||
iconsContainer.ScaleTo(Selected ? 1.1f : 1f, 300, EasingTypes.OutElastic);
|
iconsContainer.ScaleTo(Selected ? 1.1f : 1f, 300, EasingTypes.OutElastic);
|
||||||
foregroundIcon.Colour = Selected ? SelectedColour : ButtonColour;
|
foregroundIcon.Highlighted = Selected;
|
||||||
|
|
||||||
if (mod != null)
|
if (mod != null)
|
||||||
displayMod(SelectedMod ?? Mods[0]);
|
displayMod(SelectedMod ?? Mods[0]);
|
||||||
@ -60,23 +64,6 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
public bool Selected => selectedIndex != -1;
|
public bool Selected => selectedIndex != -1;
|
||||||
|
|
||||||
private Color4 buttonColour;
|
|
||||||
public Color4 ButtonColour
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return buttonColour;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == buttonColour) return;
|
|
||||||
buttonColour = value;
|
|
||||||
foreach (ModIcon icon in iconsContainer.Children)
|
|
||||||
{
|
|
||||||
icon.Colour = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Color4 selectedColour;
|
private Color4 selectedColour;
|
||||||
public Color4 SelectedColour
|
public Color4 SelectedColour
|
||||||
@ -127,7 +114,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
// the mods from Mod, only multiple if Mod is a MultiMod
|
// the mods from Mod, only multiple if Mod is a MultiMod
|
||||||
|
|
||||||
public Mod SelectedMod => Mods.ElementAtOrDefault(selectedIndex);
|
public override Mod SelectedMod => Mods.ElementAtOrDefault(selectedIndex);
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio)
|
||||||
@ -180,50 +167,35 @@ namespace osu.Game.Overlays.Mods
|
|||||||
{
|
{
|
||||||
iconsContainer.Add(new[]
|
iconsContainer.Add(new[]
|
||||||
{
|
{
|
||||||
new ModIcon
|
new ModIcon(Mods[0])
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Position = new Vector2(1.5f),
|
Position = new Vector2(1.5f),
|
||||||
Colour = ButtonColour
|
|
||||||
},
|
},
|
||||||
foregroundIcon = new ModIcon
|
foregroundIcon = new ModIcon(Mods[0])
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Position = new Vector2(-1.5f),
|
Position = new Vector2(-1.5f),
|
||||||
Colour = ButtonColour
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iconsContainer.Add(foregroundIcon = new ModIcon
|
iconsContainer.Add(foregroundIcon = new ModIcon(Mod)
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Colour = ButtonColour
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
public ModButton(Mod mod)
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
|
||||||
foreach (ModIcon icon in iconsContainer.Children)
|
|
||||||
icon.Colour = ButtonColour;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModButton(Mod m)
|
|
||||||
{
|
|
||||||
Direction = FillDirection.Vertical;
|
|
||||||
Spacing = new Vector2(0f, -5f);
|
|
||||||
Size = new Vector2(100f);
|
|
||||||
AlwaysPresent = true;
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
@ -243,13 +215,14 @@ namespace osu.Game.Overlays.Mods
|
|||||||
},
|
},
|
||||||
text = new OsuSpriteText
|
text = new OsuSpriteText
|
||||||
{
|
{
|
||||||
|
Y = 75,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
TextSize = 18,
|
TextSize = 18,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Mod = m;
|
Mod = mod;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
23
osu.Game/Overlays/Mods/ModButtonEmpty.cs
Normal file
23
osu.Game/Overlays/Mods/ModButtonEmpty.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using OpenTK;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Mods
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A mod button used exclusively for providing an empty space the size of a mod button.
|
||||||
|
/// </summary>
|
||||||
|
public class ModButtonEmpty : Container
|
||||||
|
{
|
||||||
|
public virtual Mod SelectedMod => null;
|
||||||
|
|
||||||
|
public ModButtonEmpty()
|
||||||
|
{
|
||||||
|
Size = new Vector2(100f);
|
||||||
|
AlwaysPresent = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,8 @@ using osu.Framework.Input;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Mods
|
namespace osu.Game.Overlays.Mods
|
||||||
{
|
{
|
||||||
@ -18,7 +20,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
{
|
{
|
||||||
private readonly OsuSpriteText headerLabel;
|
private readonly OsuSpriteText headerLabel;
|
||||||
|
|
||||||
public FillFlowContainer<ModButton> ButtonsContainer { get; }
|
public FillFlowContainer<ModButtonEmpty> ButtonsContainer { get; }
|
||||||
|
|
||||||
public Action<Mod> Action;
|
public Action<Mod> Action;
|
||||||
protected abstract Key[] ToggleKeys { get; }
|
protected abstract Key[] ToggleKeys { get; }
|
||||||
@ -36,47 +38,30 @@ namespace osu.Game.Overlays.Mods
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Mod> SelectedMods => buttons.Select(b => b.SelectedMod).Where(m => m != null);
|
||||||
|
|
||||||
|
public IEnumerable<Mod> Mods
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
var modContainers = value.Select(m =>
|
||||||
|
{
|
||||||
|
if (m == null)
|
||||||
|
return new ModButtonEmpty();
|
||||||
|
else
|
||||||
|
return new ModButton(m)
|
||||||
|
{
|
||||||
|
SelectedColour = selectedColour,
|
||||||
|
Action = Action,
|
||||||
|
};
|
||||||
|
}).ToArray();
|
||||||
|
|
||||||
|
ButtonsContainer.Children = modContainers;
|
||||||
|
buttons = modContainers.OfType<ModButton>().ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private ModButton[] buttons = { };
|
private ModButton[] buttons = { };
|
||||||
public ModButton[] Buttons
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return buttons;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == buttons) return;
|
|
||||||
buttons = value;
|
|
||||||
|
|
||||||
foreach (ModButton button in value)
|
|
||||||
{
|
|
||||||
button.ButtonColour = ButtonColour;
|
|
||||||
button.SelectedColour = selectedColour;
|
|
||||||
button.Action = Action;
|
|
||||||
}
|
|
||||||
|
|
||||||
ButtonsContainer.Children = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Color4 buttonsBolour = Color4.White;
|
|
||||||
public Color4 ButtonColour
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return buttonsBolour;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == buttonsBolour) return;
|
|
||||||
buttonsBolour = value;
|
|
||||||
|
|
||||||
foreach (ModButton button in buttons)
|
|
||||||
{
|
|
||||||
button.ButtonColour = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Color4 selectedColour = Color4.White;
|
private Color4 selectedColour = Color4.White;
|
||||||
public Color4 SelectedColour
|
public Color4 SelectedColour
|
||||||
@ -91,17 +76,15 @@ namespace osu.Game.Overlays.Mods
|
|||||||
selectedColour = value;
|
selectedColour = value;
|
||||||
|
|
||||||
foreach (ModButton button in buttons)
|
foreach (ModButton button in buttons)
|
||||||
{
|
|
||||||
button.SelectedColour = value;
|
button.SelectedColour = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
{
|
{
|
||||||
var index = Array.IndexOf(ToggleKeys, args.Key);
|
var index = Array.IndexOf(ToggleKeys, args.Key);
|
||||||
if (index > -1 && index < Buttons.Length)
|
if (index > -1 && index < buttons.Length)
|
||||||
Buttons[index].SelectNext();
|
buttons[index].SelectNext();
|
||||||
|
|
||||||
return base.OnKeyDown(state, args);
|
return base.OnKeyDown(state, args);
|
||||||
}
|
}
|
||||||
@ -109,7 +92,17 @@ namespace osu.Game.Overlays.Mods
|
|||||||
public void DeselectAll()
|
public void DeselectAll()
|
||||||
{
|
{
|
||||||
foreach (ModButton button in buttons)
|
foreach (ModButton button in buttons)
|
||||||
|
button.Deselect();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeselectTypes(Type[] modTypes)
|
||||||
{
|
{
|
||||||
|
foreach (var button in buttons)
|
||||||
|
{
|
||||||
|
Mod selected = button.SelectedMod;
|
||||||
|
if (selected == null) continue;
|
||||||
|
foreach (Type type in modTypes)
|
||||||
|
if (type.IsInstanceOfType(selected))
|
||||||
button.Deselect();
|
button.Deselect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,7 +120,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
Position = new Vector2(0f, 0f),
|
Position = new Vector2(0f, 0f),
|
||||||
Font = @"Exo2.0-Bold"
|
Font = @"Exo2.0-Bold"
|
||||||
},
|
},
|
||||||
ButtonsContainer = new FillFlowContainer<ModButton>
|
ButtonsContainer = new FillFlowContainer<ModButtonEmpty>
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
var instance = newRuleset.CreateInstance();
|
var instance = newRuleset.CreateInstance();
|
||||||
|
|
||||||
foreach (ModSection section in modSectionsContainer.Children)
|
foreach (ModSection section in modSectionsContainer.Children)
|
||||||
section.Buttons = instance.GetModsFor(section.ModType).Select(m => new ModButton(m)).ToArray();
|
section.Mods = instance.GetModsFor(section.ModType);
|
||||||
refreshSelectedMods();
|
refreshSelectedMods();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,14 +103,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
{
|
{
|
||||||
if (modTypes.Length == 0) return;
|
if (modTypes.Length == 0) return;
|
||||||
foreach (ModSection section in modSectionsContainer.Children)
|
foreach (ModSection section in modSectionsContainer.Children)
|
||||||
foreach (ModButton button in section.Buttons)
|
section.DeselectTypes(modTypes);
|
||||||
{
|
|
||||||
Mod selected = button.SelectedMod;
|
|
||||||
if (selected == null) continue;
|
|
||||||
foreach (Type type in modTypes)
|
|
||||||
if (type.IsInstanceOfType(selected))
|
|
||||||
button.Deselect();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void modButtonPressed(Mod selectedMod)
|
private void modButtonPressed(Mod selectedMod)
|
||||||
@ -122,7 +115,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
private void refreshSelectedMods()
|
private void refreshSelectedMods()
|
||||||
{
|
{
|
||||||
SelectedMods.Value = modSectionsContainer.Children.SelectMany(s => s.Buttons.Select(x => x.SelectedMod).Where(x => x != null)).ToArray();
|
SelectedMods.Value = modSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray();
|
||||||
|
|
||||||
double multiplier = 1.0;
|
double multiplier = 1.0;
|
||||||
bool ranked = true;
|
bool ranked = true;
|
||||||
|
@ -10,7 +10,6 @@ using osu.Framework.Graphics.Primitives;
|
|||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Screens.Select;
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using System;
|
using System;
|
||||||
|
@ -315,7 +315,7 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BeatmapMetadata metadata = beatmap.Beatmap.BeatmapInfo.Metadata;
|
BeatmapMetadata metadata = beatmap.Metadata;
|
||||||
title.Current = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title);
|
title.Current = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title);
|
||||||
artist.Current = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist);
|
artist.Current = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist);
|
||||||
}
|
}
|
||||||
|
21
osu.Game/Overlays/Options/OptionCheckbox.cs
Normal file
21
osu.Game/Overlays/Options/OptionCheckbox.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Options
|
||||||
|
{
|
||||||
|
public class OptionCheckbox : OptionItem<bool>
|
||||||
|
{
|
||||||
|
private OsuCheckbox checkbox;
|
||||||
|
|
||||||
|
protected override Drawable CreateControl() => checkbox = new OsuCheckbox();
|
||||||
|
|
||||||
|
public override string LabelText
|
||||||
|
{
|
||||||
|
get { return checkbox.LabelText; }
|
||||||
|
set { checkbox.LabelText = value; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,45 +2,18 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options
|
namespace osu.Game.Overlays.Options
|
||||||
{
|
{
|
||||||
public class OptionDropdown<T> : FillFlowContainer
|
public class OptionDropdown<T> : OptionItem<T>
|
||||||
{
|
{
|
||||||
private readonly Dropdown<T> dropdown;
|
private Dropdown<T> dropdown;
|
||||||
private readonly SpriteText text;
|
|
||||||
|
|
||||||
public string LabelText
|
private IEnumerable<KeyValuePair<string, T>> items = new KeyValuePair<string, T>[] { };
|
||||||
{
|
|
||||||
get { return text.Text; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
text.Text = value;
|
|
||||||
text.Alpha = !string.IsNullOrEmpty(value) ? 1 : 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Bindable<T> Bindable
|
|
||||||
{
|
|
||||||
get { return bindable; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
bindable = value;
|
|
||||||
dropdown.Current.BindTo(bindable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Bindable<T> bindable;
|
|
||||||
|
|
||||||
private IEnumerable<KeyValuePair<string, T>> items;
|
|
||||||
public IEnumerable<KeyValuePair<string, T>> Items
|
public IEnumerable<KeyValuePair<string, T>> Items
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -55,30 +28,11 @@ namespace osu.Game.Overlays.Options
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public OptionDropdown()
|
protected override Drawable CreateControl() => dropdown = new OsuDropdown<T>
|
||||||
{
|
|
||||||
Items = new KeyValuePair<string, T>[0];
|
|
||||||
|
|
||||||
Direction = FillDirection.Vertical;
|
|
||||||
RelativeSizeAxes = Axes.X;
|
|
||||||
AutoSizeAxes = Axes.Y;
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
text = new OsuSpriteText {
|
|
||||||
Alpha = 0,
|
|
||||||
},
|
|
||||||
dropdown = new OsuDropdown<T>
|
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding { Top = 5 },
|
Margin = new MarginPadding { Top = 5 },
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Items = Items,
|
Items = Items,
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
dropdown.Current.DisabledChanged += disabled =>
|
|
||||||
{
|
|
||||||
Alpha = disabled ? 0.3f : 1;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
82
osu.Game/Overlays/Options/OptionItem.cs
Normal file
82
osu.Game/Overlays/Options/OptionItem.cs
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Options
|
||||||
|
{
|
||||||
|
public abstract class OptionItem<T> : FillFlowContainer, IFilterable
|
||||||
|
{
|
||||||
|
protected abstract Drawable CreateControl();
|
||||||
|
|
||||||
|
protected Drawable Control { get; }
|
||||||
|
|
||||||
|
private IHasCurrentValue<T> controlWithCurrent => Control as IHasCurrentValue<T>;
|
||||||
|
|
||||||
|
private SpriteText text;
|
||||||
|
|
||||||
|
public virtual string LabelText
|
||||||
|
{
|
||||||
|
get { return text?.Text ?? string.Empty; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (text == null)
|
||||||
|
{
|
||||||
|
// construct lazily for cases where the label is not needed (may be provided by the Control).
|
||||||
|
Add(text = new OsuSpriteText() { Depth = 1 });
|
||||||
|
}
|
||||||
|
|
||||||
|
text.Text = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// hold a reference to the provided bindable so we don't have to in every options section.
|
||||||
|
private Bindable<T> bindable;
|
||||||
|
|
||||||
|
public Bindable<T> Bindable
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return bindable;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
bindable = value;
|
||||||
|
controlWithCurrent?.Current.BindTo(bindable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string[] FilterTerms => new[] { LabelText };
|
||||||
|
|
||||||
|
public bool MatchingCurrentFilter
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
// probably needs a better transition.
|
||||||
|
FadeTo(value ? 1 : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected OptionItem()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
Padding = new MarginPadding { Right = 5 };
|
||||||
|
|
||||||
|
if ((Control = CreateControl()) != null)
|
||||||
|
{
|
||||||
|
if (controlWithCurrent != null)
|
||||||
|
controlWithCurrent.Current.DisabledChanged += disabled => { Colour = disabled ? Color4.Gray : Color4.White; };
|
||||||
|
Add(Control);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,13 +2,15 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options
|
namespace osu.Game.Overlays.Options
|
||||||
{
|
{
|
||||||
internal class OptionLabel : OsuSpriteText
|
internal class OptionLabel : OptionItem<string>
|
||||||
{
|
{
|
||||||
|
protected override Drawable CreateControl() => null;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colour)
|
private void load(OsuColour colour)
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options
|
namespace osu.Game.Overlays.Options
|
||||||
@ -17,52 +13,14 @@ namespace osu.Game.Overlays.Options
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OptionSlider<T, U> : FillFlowContainer
|
public class OptionSlider<T, U> : OptionItem<T>
|
||||||
where T : struct
|
where T : struct
|
||||||
where U : SliderBar<T>, new()
|
where U : SliderBar<T>, new()
|
||||||
{
|
{
|
||||||
private readonly SliderBar<T> slider;
|
protected override Drawable CreateControl() => new U()
|
||||||
private readonly SpriteText text;
|
|
||||||
|
|
||||||
public string LabelText
|
|
||||||
{
|
|
||||||
get { return text.Text; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
text.Text = value;
|
|
||||||
text.Alpha = string.IsNullOrEmpty(value) ? 0 : 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Bindable<T> bindable;
|
|
||||||
|
|
||||||
public Bindable<T> Bindable
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
bindable = value;
|
|
||||||
slider.Current.BindTo(bindable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public OptionSlider()
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X;
|
|
||||||
AutoSizeAxes = Axes.Y;
|
|
||||||
Padding = new MarginPadding { Right = 5 };
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
text = new OsuSpriteText
|
|
||||||
{
|
|
||||||
Alpha = 0,
|
|
||||||
},
|
|
||||||
slider = new U()
|
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding { Top = 5, Bottom = 5 },
|
Margin = new MarginPadding { Top = 5, Bottom = 5 },
|
||||||
RelativeSizeAxes = Axes.X
|
RelativeSizeAxes = Axes.X
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,22 +1,13 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options
|
namespace osu.Game.Overlays.Options
|
||||||
{
|
{
|
||||||
public class OptionTextBox : OsuTextBox
|
public class OptionTextBox : OptionItem<string>
|
||||||
{
|
{
|
||||||
private Bindable<string> bindable;
|
protected override Drawable CreateControl() => new OsuTextBox();
|
||||||
|
|
||||||
public Bindable<string> Bindable
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
bindable = value;
|
|
||||||
Current.BindTo(bindable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
108
osu.Game/Overlays/Options/OptionsHeader.cs
Normal file
108
osu.Game/Overlays/Options/OptionsHeader.cs
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Options
|
||||||
|
{
|
||||||
|
public class OptionsHeader : Container
|
||||||
|
{
|
||||||
|
public SearchTextBox SearchTextBox;
|
||||||
|
|
||||||
|
private Box background;
|
||||||
|
|
||||||
|
private readonly Func<float> currentScrollOffset;
|
||||||
|
|
||||||
|
public Action Exit;
|
||||||
|
|
||||||
|
/// <param name="currentScrollOffset">A reference to the current scroll position of the ScrollContainer we are contained within.</param>
|
||||||
|
public OptionsHeader(Func<float> currentScrollOffset)
|
||||||
|
{
|
||||||
|
this.currentScrollOffset = currentScrollOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
background = new Box
|
||||||
|
{
|
||||||
|
Colour = Color4.Black,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Text = "settings",
|
||||||
|
TextSize = 40,
|
||||||
|
Margin = new MarginPadding {
|
||||||
|
Left = OptionsOverlay.CONTENT_MARGINS,
|
||||||
|
Top = Toolbar.Toolbar.TOOLTIP_HEIGHT
|
||||||
|
},
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Colour = colours.Pink,
|
||||||
|
Text = "Change the way osu! behaves",
|
||||||
|
TextSize = 18,
|
||||||
|
Margin = new MarginPadding {
|
||||||
|
Left = OptionsOverlay.CONTENT_MARGINS,
|
||||||
|
Bottom = 30
|
||||||
|
},
|
||||||
|
},
|
||||||
|
SearchTextBox = new SearchTextBox
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Width = 0.95f,
|
||||||
|
Margin = new MarginPadding {
|
||||||
|
Top = 20,
|
||||||
|
Bottom = 20
|
||||||
|
},
|
||||||
|
Exit = () => Exit(),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateAfterChildren()
|
||||||
|
{
|
||||||
|
base.UpdateAfterChildren();
|
||||||
|
|
||||||
|
// the point at which we will start anchoring to the top.
|
||||||
|
float anchorOffset = SearchTextBox.Y;
|
||||||
|
|
||||||
|
float scrollPosition = currentScrollOffset();
|
||||||
|
|
||||||
|
// we want to anchor the search field to the top of the screen when scrolling.
|
||||||
|
Margin = new MarginPadding { Top = Math.Max(0, scrollPosition - anchorOffset) };
|
||||||
|
|
||||||
|
// we don't want the header to scroll when scrolling beyond the upper extent.
|
||||||
|
Y = Math.Min(0, scrollPosition);
|
||||||
|
|
||||||
|
// we get darker as scroll progresses
|
||||||
|
background.Alpha = Math.Min(1, scrollPosition / anchorOffset) * 0.5f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -10,10 +10,12 @@ using osu.Framework.Graphics.Primitives;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options
|
namespace osu.Game.Overlays.Options
|
||||||
{
|
{
|
||||||
public abstract class OptionsSection : Container
|
public abstract class OptionsSection : Container, IHasFilterableChildren
|
||||||
{
|
{
|
||||||
protected FillFlowContainer FlowContent;
|
protected FillFlowContainer FlowContent;
|
||||||
protected override Container<Drawable> Content => FlowContent;
|
protected override Container<Drawable> Content => FlowContent;
|
||||||
@ -21,6 +23,16 @@ namespace osu.Game.Overlays.Options
|
|||||||
public abstract FontAwesome Icon { get; }
|
public abstract FontAwesome Icon { get; }
|
||||||
public abstract string Header { get; }
|
public abstract string Header { get; }
|
||||||
|
|
||||||
|
public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>();
|
||||||
|
public string[] FilterTerms => new[] { Header };
|
||||||
|
public bool MatchingCurrentFilter
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
FadeTo(value ? 1 : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private readonly SpriteText headerLabel;
|
private readonly SpriteText headerLabel;
|
||||||
|
|
||||||
protected OptionsSection()
|
protected OptionsSection()
|
||||||
|
@ -6,10 +6,12 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options
|
namespace osu.Game.Overlays.Options
|
||||||
{
|
{
|
||||||
public abstract class OptionsSubsection : FillFlowContainer
|
public abstract class OptionsSubsection : FillFlowContainer, IHasFilterableChildren
|
||||||
{
|
{
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
@ -17,6 +19,16 @@ namespace osu.Game.Overlays.Options
|
|||||||
|
|
||||||
protected abstract string Header { get; }
|
protected abstract string Header { get; }
|
||||||
|
|
||||||
|
public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>();
|
||||||
|
public string[] FilterTerms => new[] { Header };
|
||||||
|
public bool MatchingCurrentFilter
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
FadeTo(value ? 1 : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected OptionsSubsection()
|
protected OptionsSubsection()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options.Sections.Audio
|
namespace osu.Game.Overlays.Options.Sections.Audio
|
||||||
{
|
{
|
||||||
@ -16,12 +15,12 @@ namespace osu.Game.Overlays.Options.Sections.Audio
|
|||||||
{
|
{
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new OsuCheckbox
|
new OptionCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "Interface voices",
|
LabelText = "Interface voices",
|
||||||
Bindable = config.GetBindable<bool>(OsuConfig.MenuVoice)
|
Bindable = config.GetBindable<bool>(OsuConfig.MenuVoice)
|
||||||
},
|
},
|
||||||
new OsuCheckbox
|
new OptionCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "osu! music theme",
|
LabelText = "osu! music theme",
|
||||||
Bindable = config.GetBindable<bool>(OsuConfig.MenuMusic)
|
Bindable = config.GetBindable<bool>(OsuConfig.MenuMusic)
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options.Sections.Debug
|
namespace osu.Game.Overlays.Options.Sections.Debug
|
||||||
{
|
{
|
||||||
@ -17,7 +16,7 @@ namespace osu.Game.Overlays.Options.Sections.Debug
|
|||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuCheckbox
|
new OptionCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "Bypass caching",
|
LabelText = "Bypass caching",
|
||||||
Bindable = config.GetBindable<bool>(FrameworkDebugConfig.BypassCaching)
|
Bindable = config.GetBindable<bool>(FrameworkDebugConfig.BypassCaching)
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options.Sections.Gameplay
|
namespace osu.Game.Overlays.Options.Sections.Gameplay
|
||||||
{
|
{
|
||||||
@ -22,12 +21,12 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay
|
|||||||
LabelText = "Background dim",
|
LabelText = "Background dim",
|
||||||
Bindable = config.GetBindable<double>(OsuConfig.DimLevel)
|
Bindable = config.GetBindable<double>(OsuConfig.DimLevel)
|
||||||
},
|
},
|
||||||
new OsuCheckbox
|
new OptionCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "Show score overlay",
|
LabelText = "Show score overlay",
|
||||||
Bindable = config.GetBindable<bool>(OsuConfig.ShowInterface)
|
Bindable = config.GetBindable<bool>(OsuConfig.ShowInterface)
|
||||||
},
|
},
|
||||||
new OsuCheckbox
|
new OptionCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "Always show key overlay",
|
LabelText = "Always show key overlay",
|
||||||
Bindable = config.GetBindable<bool>(OsuConfig.KeyOverlay)
|
Bindable = config.GetBindable<bool>(OsuConfig.KeyOverlay)
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options.Sections.General
|
namespace osu.Game.Overlays.Options.Sections.General
|
||||||
{
|
{
|
||||||
@ -17,7 +16,7 @@ namespace osu.Game.Overlays.Options.Sections.General
|
|||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuCheckbox
|
new OptionCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "Prefer metadata in original language",
|
LabelText = "Prefer metadata in original language",
|
||||||
Bindable = frameworkConfig.GetBindable<bool>(FrameworkConfig.ShowUnicode)
|
Bindable = frameworkConfig.GetBindable<bool>(FrameworkConfig.ShowUnicode)
|
||||||
|
@ -132,12 +132,12 @@ namespace osu.Game.Overlays.Options.Sections.General
|
|||||||
TabbableContentContainer = this,
|
TabbableContentContainer = this,
|
||||||
OnCommit = (sender, newText) => performLogin()
|
OnCommit = (sender, newText) => performLogin()
|
||||||
},
|
},
|
||||||
new OsuCheckbox
|
new OptionCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "Remember username",
|
LabelText = "Remember username",
|
||||||
Bindable = config.GetBindable<bool>(OsuConfig.SaveUsername),
|
Bindable = config.GetBindable<bool>(OsuConfig.SaveUsername),
|
||||||
},
|
},
|
||||||
new OsuCheckbox
|
new OptionCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "Stay logged in",
|
LabelText = "Stay logged in",
|
||||||
Bindable = config.GetBindable<bool>(OsuConfig.SavePassword),
|
Bindable = config.GetBindable<bool>(OsuConfig.SavePassword),
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options.Sections.Graphics
|
namespace osu.Game.Overlays.Options.Sections.Graphics
|
||||||
{
|
{
|
||||||
@ -17,12 +16,12 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
|
|||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuCheckbox
|
new OptionCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "Snaking in sliders",
|
LabelText = "Snaking in sliders",
|
||||||
Bindable = config.GetBindable<bool>(OsuConfig.SnakingInSliders)
|
Bindable = config.GetBindable<bool>(OsuConfig.SnakingInSliders)
|
||||||
},
|
},
|
||||||
new OsuCheckbox
|
new OptionCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "Snaking out sliders",
|
LabelText = "Snaking out sliders",
|
||||||
Bindable = config.GetBindable<bool>(OsuConfig.SnakingOutSliders)
|
Bindable = config.GetBindable<bool>(OsuConfig.SnakingOutSliders)
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options.Sections.Graphics
|
namespace osu.Game.Overlays.Options.Sections.Graphics
|
||||||
{
|
{
|
||||||
@ -29,7 +28,7 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
|
|||||||
LabelText = "Screen mode",
|
LabelText = "Screen mode",
|
||||||
Bindable = config.GetBindable<WindowMode>(FrameworkConfig.WindowMode),
|
Bindable = config.GetBindable<WindowMode>(FrameworkConfig.WindowMode),
|
||||||
},
|
},
|
||||||
new OsuCheckbox
|
new OptionCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "Letterboxing",
|
LabelText = "Letterboxing",
|
||||||
Bindable = letterboxing,
|
Bindable = letterboxing,
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options.Sections.Graphics
|
namespace osu.Game.Overlays.Options.Sections.Graphics
|
||||||
{
|
{
|
||||||
@ -16,7 +15,7 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
|
|||||||
{
|
{
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new OsuCheckbox
|
new OptionCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "Parallax",
|
LabelText = "Parallax",
|
||||||
Bindable = config.GetBindable<bool>(OsuConfig.MenuParallax)
|
Bindable = config.GetBindable<bool>(OsuConfig.MenuParallax)
|
||||||
|
@ -5,7 +5,6 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options.Sections.Graphics
|
namespace osu.Game.Overlays.Options.Sections.Graphics
|
||||||
{
|
{
|
||||||
@ -25,7 +24,7 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
|
|||||||
LabelText = "Frame limiter",
|
LabelText = "Frame limiter",
|
||||||
Bindable = config.GetBindable<FrameSync>(FrameworkConfig.FrameSync)
|
Bindable = config.GetBindable<FrameSync>(FrameworkConfig.FrameSync)
|
||||||
},
|
},
|
||||||
new OsuCheckbox
|
new OptionCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "Show FPS",
|
LabelText = "Show FPS",
|
||||||
Bindable = osuConfig.GetBindable<bool>(OsuConfig.ShowFpsDisplay)
|
Bindable = osuConfig.GetBindable<bool>(OsuConfig.ShowFpsDisplay)
|
||||||
|
@ -24,12 +24,12 @@ namespace osu.Game.Overlays.Options.Sections.Input
|
|||||||
LabelText = "Confine mouse cursor",
|
LabelText = "Confine mouse cursor",
|
||||||
Bindable = config.GetBindable<ConfineMouseMode>(FrameworkConfig.ConfineMouseMode),
|
Bindable = config.GetBindable<ConfineMouseMode>(FrameworkConfig.ConfineMouseMode),
|
||||||
},
|
},
|
||||||
new OsuCheckbox
|
new OptionCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "Disable mouse wheel during gameplay",
|
LabelText = "Disable mouse wheel during gameplay",
|
||||||
Bindable = osuConfig.GetBindable<bool>(OsuConfig.MouseDisableWheel)
|
Bindable = osuConfig.GetBindable<bool>(OsuConfig.MouseDisableWheel)
|
||||||
},
|
},
|
||||||
new OsuCheckbox
|
new OptionCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "Disable mouse buttons during gameplay",
|
LabelText = "Disable mouse buttons during gameplay",
|
||||||
Bindable = osuConfig.GetBindable<bool>(OsuConfig.MouseDisableButtons)
|
Bindable = osuConfig.GetBindable<bool>(OsuConfig.MouseDisableButtons)
|
||||||
|
@ -10,9 +10,8 @@ using osu.Framework.Graphics.Primitives;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Overlays.Options;
|
using osu.Game.Overlays.Options;
|
||||||
using System;
|
using System;
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
using osu.Game.Overlays.Options.Sections;
|
using osu.Game.Overlays.Options.Sections;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
@ -32,6 +31,13 @@ namespace osu.Game.Overlays
|
|||||||
private Sidebar sidebar;
|
private Sidebar sidebar;
|
||||||
private SidebarButton[] sidebarButtons;
|
private SidebarButton[] sidebarButtons;
|
||||||
private OptionsSection[] sections;
|
private OptionsSection[] sections;
|
||||||
|
|
||||||
|
private OptionsHeader header;
|
||||||
|
|
||||||
|
private OptionsFooter footer;
|
||||||
|
|
||||||
|
private SearchContainer searchContainer;
|
||||||
|
|
||||||
private float lastKnownScroll;
|
private float lastKnownScroll;
|
||||||
|
|
||||||
public OptionsOverlay()
|
public OptionsOverlay()
|
||||||
@ -41,7 +47,7 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
private void load(OsuGame game, OsuColour colours)
|
private void load(OsuGame game)
|
||||||
{
|
{
|
||||||
sections = new OptionsSection[]
|
sections = new OptionsSection[]
|
||||||
{
|
{
|
||||||
@ -69,39 +75,20 @@ namespace osu.Game.Overlays
|
|||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Width = width,
|
Width = width,
|
||||||
Margin = new MarginPadding { Left = SIDEBAR_WIDTH },
|
Margin = new MarginPadding { Left = SIDEBAR_WIDTH },
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
new FillFlowContainer
|
|
||||||
{
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuSpriteText
|
searchContainer = new SearchContainer
|
||||||
{
|
|
||||||
Text = "settings",
|
|
||||||
TextSize = 40,
|
|
||||||
Margin = new MarginPadding { Left = CONTENT_MARGINS, Top = Toolbar.Toolbar.TOOLTIP_HEIGHT },
|
|
||||||
},
|
|
||||||
new OsuSpriteText
|
|
||||||
{
|
|
||||||
Colour = colours.Pink,
|
|
||||||
Text = "Change the way osu! behaves",
|
|
||||||
TextSize = 18,
|
|
||||||
Margin = new MarginPadding { Left = CONTENT_MARGINS, Bottom = 30 },
|
|
||||||
},
|
|
||||||
new FillFlowContainer
|
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Children = sections,
|
Children = sections,
|
||||||
},
|
},
|
||||||
new OptionsFooter()
|
footer = new OptionsFooter(),
|
||||||
}
|
header = new OptionsHeader(() => scrollContainer.Current)
|
||||||
}
|
{
|
||||||
|
Exit = Hide,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sidebar = new Sidebar
|
sidebar = new Sidebar
|
||||||
@ -118,9 +105,20 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
header.SearchTextBox.Current.ValueChanged += newValue => searchContainer.SearchTerm = newValue;
|
||||||
|
|
||||||
scrollContainer.Padding = new MarginPadding { Top = game?.Toolbar.DrawHeight ?? 0 };
|
scrollContainer.Padding = new MarginPadding { Top = game?.Toolbar.DrawHeight ?? 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void UpdateAfterChildren()
|
||||||
|
{
|
||||||
|
base.UpdateAfterChildren();
|
||||||
|
|
||||||
|
//we need to update these manually because we can't put the OptionsHeader inside the SearchContainer (due to its anchoring).
|
||||||
|
searchContainer.Y = header.DrawHeight;
|
||||||
|
footer.Y = searchContainer.Y + searchContainer.DrawHeight;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
@ -157,6 +155,8 @@ namespace osu.Game.Overlays
|
|||||||
scrollContainer.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint);
|
scrollContainer.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint);
|
||||||
sidebar.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint);
|
sidebar.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint);
|
||||||
FadeTo(1, TRANSITION_LENGTH / 2);
|
FadeTo(1, TRANSITION_LENGTH / 2);
|
||||||
|
|
||||||
|
header.SearchTextBox.HoldFocus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopOut()
|
protected override void PopOut()
|
||||||
@ -166,6 +166,15 @@ namespace osu.Game.Overlays
|
|||||||
scrollContainer.MoveToX(-width, TRANSITION_LENGTH, EasingTypes.OutQuint);
|
scrollContainer.MoveToX(-width, TRANSITION_LENGTH, EasingTypes.OutQuint);
|
||||||
sidebar.MoveToX(-SIDEBAR_WIDTH, TRANSITION_LENGTH, EasingTypes.OutQuint);
|
sidebar.MoveToX(-SIDEBAR_WIDTH, TRANSITION_LENGTH, EasingTypes.OutQuint);
|
||||||
FadeTo(0, TRANSITION_LENGTH / 2);
|
FadeTo(0, TRANSITION_LENGTH / 2);
|
||||||
|
|
||||||
|
header.SearchTextBox.HoldFocus = false;
|
||||||
|
header.SearchTextBox.TriggerFocusLost();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnFocus(InputState state)
|
||||||
|
{
|
||||||
|
header.SearchTextBox.TriggerFocus(state);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
private void load(ChatOverlay chat)
|
private void load(ChatOverlay chat)
|
||||||
{
|
{
|
||||||
StateContainer = chat;
|
StateContainer = chat;
|
||||||
Action = chat.ToggleVisibility;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,7 +17,6 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
private void load(MusicController music)
|
private void load(MusicController music)
|
||||||
{
|
{
|
||||||
StateContainer = music;
|
StateContainer = music;
|
||||||
Action = music.ToggleVisibility;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -22,7 +22,6 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
private void load(NotificationManager notificationManager)
|
private void load(NotificationManager notificationManager)
|
||||||
{
|
{
|
||||||
StateContainer = notificationManager;
|
StateContainer = notificationManager;
|
||||||
Action = notificationManager.ToggleVisibility;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,6 +21,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
stateContainer = value;
|
stateContainer = value;
|
||||||
|
Action = stateContainer.ToggleVisibility;
|
||||||
stateContainer.StateChanged += stateChanged;
|
stateContainer.StateChanged += stateChanged;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
private void load(OptionsOverlay options)
|
private void load(OptionsOverlay options)
|
||||||
{
|
{
|
||||||
StateContainer = options;
|
StateContainer = options;
|
||||||
Action = options.ToggleVisibility;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,6 +21,11 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual FontAwesome Icon => FontAwesome.fa_question;
|
public virtual FontAwesome Icon => FontAwesome.fa_question;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The type of this mod.
|
||||||
|
/// </summary>
|
||||||
|
public virtual ModType Type => ModType.Special;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The user readable description of this mod.
|
/// The user readable description of this mod.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -11,6 +11,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
public override string Name => "Double Time";
|
public override string Name => "Double Time";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_doubletime;
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_doubletime;
|
||||||
|
public override ModType Type => ModType.DifficultyIncrease;
|
||||||
public override string Description => "Zoooooooooom";
|
public override string Description => "Zoooooooooom";
|
||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(ModHalfTime) };
|
public override Type[] IncompatibleMods => new[] { typeof(ModHalfTime) };
|
||||||
|
@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
public override string Name => "Easy";
|
public override string Name => "Easy";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_easy;
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_easy;
|
||||||
|
public override ModType Type => ModType.DifficultyReduction;
|
||||||
public override string Description => "Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required.";
|
public override string Description => "Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required.";
|
||||||
public override double ScoreMultiplier => 0.5;
|
public override double ScoreMultiplier => 0.5;
|
||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
|
@ -9,6 +9,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
public override string Name => "Flashlight";
|
public override string Name => "Flashlight";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_flashlight;
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_flashlight;
|
||||||
|
public override ModType Type => ModType.DifficultyIncrease;
|
||||||
public override string Description => "Restricted view area.";
|
public override string Description => "Restricted view area.";
|
||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
public override string Name => "Half Time";
|
public override string Name => "Half Time";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_halftime;
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_halftime;
|
||||||
|
public override ModType Type => ModType.DifficultyReduction;
|
||||||
public override string Description => "Less zoom";
|
public override string Description => "Less zoom";
|
||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime) };
|
public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime) };
|
||||||
|
@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
public override string Name => "Hard Rock";
|
public override string Name => "Hard Rock";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hardrock;
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hardrock;
|
||||||
|
public override ModType Type => ModType.DifficultyIncrease;
|
||||||
public override string Description => "Everything just got a bit harder...";
|
public override string Description => "Everything just got a bit harder...";
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(ModEasy) };
|
public override Type[] IncompatibleMods => new[] { typeof(ModEasy) };
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
public override string Name => "Hidden";
|
public override string Name => "Hidden";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden;
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden;
|
||||||
|
public override ModType Type => ModType.DifficultyIncrease;
|
||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
public override string Name => "NoFail";
|
public override string Name => "NoFail";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_nofail;
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_nofail;
|
||||||
|
public override ModType Type => ModType.DifficultyReduction;
|
||||||
public override string Description => "You can't fail, no matter what.";
|
public override string Description => "You can't fail, no matter what.";
|
||||||
public override double ScoreMultiplier => 0.5;
|
public override double ScoreMultiplier => 0.5;
|
||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
|
@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
public override string Name => "Sudden Death";
|
public override string Name => "Sudden Death";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_suddendeath;
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_suddendeath;
|
||||||
|
public override ModType Type => ModType.DifficultyIncrease;
|
||||||
public override string Description => "Miss a note and fail.";
|
public override string Description => "Miss a note and fail.";
|
||||||
public override double ScoreMultiplier => 1;
|
public override double ScoreMultiplier => 1;
|
||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user