mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 02:13:21 +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",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch VisualTests",
|
||||
"name": "VisualTests (debug)",
|
||||
"windows": {
|
||||
"type": "clr"
|
||||
},
|
||||
"type": "mono",
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/osu.Desktop.VisualTests/bin/Debug/osu!.exe",
|
||||
"args": [],
|
||||
"cwd": "${workspaceRoot}",
|
||||
"preLaunchTask": "build",
|
||||
"preLaunchTask": "Build (Debug)",
|
||||
"runtimeExecutable": null,
|
||||
"env": {},
|
||||
"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": {
|
||||
"type": "clr"
|
||||
},
|
||||
"type": "mono",
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/osu.Desktop/bin/Debug/osu!.exe",
|
||||
"args": [],
|
||||
"cwd": "${workspaceRoot}",
|
||||
"preLaunchTask": "build",
|
||||
"preLaunchTask": "Build (Debug)",
|
||||
"runtimeExecutable": null,
|
||||
"env": {},
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"name": "Attach",
|
||||
"name": "osu! (release)",
|
||||
"windows": {
|
||||
"type": "clr",
|
||||
"request": "attach",
|
||||
"processName": "osu!"
|
||||
"type": "clr"
|
||||
},
|
||||
"type": "mono",
|
||||
"request": "attach",
|
||||
"address": "localhost",
|
||||
"port": 55555
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/osu.Desktop/bin/Release/osu!.exe",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"preLaunchTask": "Build (Release)",
|
||||
"runtimeExecutable": null,
|
||||
"env": {},
|
||||
"console": "internalConsole"
|
||||
}
|
||||
]
|
||||
}
|
77
.vscode/tasks.json
vendored
77
.vscode/tasks.json
vendored
@ -1,51 +1,50 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "0.1.0",
|
||||
"taskSelector": "/t:",
|
||||
"version": "2.0.0",
|
||||
"problemMatcher": "$msCompile",
|
||||
"isShellCommand": true,
|
||||
"command": "msbuild",
|
||||
"suppressTaskName": true,
|
||||
"showOutput": "silent",
|
||||
"args": [
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/property:DebugType=portable"
|
||||
],
|
||||
"windows": {
|
||||
"args": [
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/property:DebugType=portable",
|
||||
"/m" //parallel compiling support. doesn't work well with mono atm
|
||||
]
|
||||
},
|
||||
"tasks": [
|
||||
{
|
||||
"taskName": "build",
|
||||
"isShellCommand": true,
|
||||
"showOutput": "silent",
|
||||
"command": "msbuild",
|
||||
"args": [
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/property:DebugType=portable"
|
||||
],
|
||||
"windows": {
|
||||
"args": [
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/property:DebugType=portable",
|
||||
"/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": "Build (Debug)",
|
||||
"isBuildCommand": true
|
||||
},
|
||||
{
|
||||
"taskName": "rebuild",
|
||||
"isShellCommand": true,
|
||||
"showOutput": "silent",
|
||||
"command": "msbuild",
|
||||
"taskName": "Build (Release)",
|
||||
"args": [
|
||||
// Ask msbuild to generate full paths for file names.
|
||||
"/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",
|
||||
"isBuildCommand": true
|
||||
"/property:Configuration=Release"
|
||||
]
|
||||
},
|
||||
{
|
||||
"taskName": "Clean All",
|
||||
"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 TestWorkingBeatmap(Beatmap beatmap)
|
||||
: base(beatmap.BeatmapInfo, beatmap.BeatmapInfo.BeatmapSet)
|
||||
: base(beatmap.BeatmapInfo)
|
||||
{
|
||||
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.Framework.Testing;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using OpenTK;
|
||||
|
||||
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 ModDisplay modDisplay;
|
||||
|
||||
private RulesetDatabase rulesets;
|
||||
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RulesetDatabase rulesets)
|
||||
{
|
||||
@ -33,6 +38,16 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
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);
|
||||
|
||||
foreach (var ruleset in rulesets.AllRulesets)
|
@ -8,7 +8,7 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
|
@ -18,10 +18,14 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
private SongProgress progress;
|
||||
private SongProgressGraph graph;
|
||||
|
||||
private StopwatchClock clock;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
clock = new StopwatchClock(true);
|
||||
|
||||
Add(progress = new SongProgress
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
@ -55,6 +59,9 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
|
||||
progress.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\TestCaseGamefield.cs" />
|
||||
<Compile Include="Tests\TestCaseGraph.cs" />
|
||||
<Compile Include="Tests\TestCaseManiaHitObjects.cs" />
|
||||
<Compile Include="Tests\TestCaseManiaPlayfield.cs" />
|
||||
<Compile Include="Tests\TestCaseMenuOverlays.cs" />
|
||||
<Compile Include="Tests\TestCaseMusicController.cs" />
|
||||
@ -212,7 +213,7 @@
|
||||
<Compile Include="Platform\TestStorage.cs" />
|
||||
<Compile Include="Tests\TestCaseOptions.cs" />
|
||||
<Compile Include="Tests\TestCaseSongProgress.cs" />
|
||||
<Compile Include="Tests\TestCaseModSelectOverlay.cs" />
|
||||
<Compile Include="Tests\TestCaseMods.cs" />
|
||||
<Compile Include="Tests\TestCaseDialogOverlay.cs" />
|
||||
<Compile Include="Tests\TestCaseBeatmapOptionsOverlay.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));
|
||||
|
||||
private string basePath { get; }
|
||||
private readonly string basePath;
|
||||
|
||||
public LegacyFilesystemReader(string path)
|
||||
{
|
||||
|
@ -11,11 +11,11 @@ using osu.Game.Rulesets.Objects;
|
||||
|
||||
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<ManiaBaseHit> ConvertHitObject(HitObject original, Beatmap beatmap)
|
||||
protected override IEnumerable<ManiaHitObject> ConvertHitObject(HitObject original, Beatmap beatmap)
|
||||
{
|
||||
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
|
||||
{
|
||||
public class ManiaDifficultyCalculator : DifficultyCalculator<ManiaBaseHit>
|
||||
public class ManiaDifficultyCalculator : DifficultyCalculator<ManiaHitObject>
|
||||
{
|
||||
public ManiaDifficultyCalculator(Beatmap beatmap)
|
||||
: base(beatmap)
|
||||
@ -21,6 +21,6 @@ namespace osu.Game.Rulesets.Mania
|
||||
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 FontAwesome Icon => FontAwesome.fa_osu_mod_hidden;
|
||||
public override ModType Type => ModType.DifficultyIncrease;
|
||||
public override double ScoreMultiplier => 1;
|
||||
public override bool Ranked => true;
|
||||
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>.
|
||||
// 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
|
||||
{
|
||||
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>.
|
||||
// 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;
|
||||
|
||||
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>.
|
||||
// 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
|
||||
{
|
||||
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
|
||||
{
|
||||
internal class ManiaScoreProcessor : ScoreProcessor<ManiaBaseHit, ManiaJudgement>
|
||||
internal class ManiaScoreProcessor : ScoreProcessor<ManiaHitObject, ManiaJudgement>
|
||||
{
|
||||
public ManiaScoreProcessor()
|
||||
{
|
||||
}
|
||||
|
||||
public ManiaScoreProcessor(HitRenderer<ManiaBaseHit, ManiaJudgement> hitRenderer)
|
||||
public ManiaScoreProcessor(HitRenderer<ManiaHitObject, ManiaJudgement> hitRenderer)
|
||||
: base(hitRenderer)
|
||||
{
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ using osu.Game.Rulesets.UI;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.UI
|
||||
{
|
||||
public class ManiaHitRenderer : HitRenderer<ManiaBaseHit, ManiaJudgement>
|
||||
public class ManiaHitRenderer : HitRenderer<ManiaHitObject, ManiaJudgement>
|
||||
{
|
||||
private readonly int columns;
|
||||
|
||||
@ -25,10 +25,10 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
|
||||
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
|
||||
{
|
||||
public class ManiaPlayfield : Playfield<ManiaBaseHit, ManiaJudgement>
|
||||
public class ManiaPlayfield : Playfield<ManiaHitObject, ManiaJudgement>
|
||||
{
|
||||
/// <summary>
|
||||
/// Default column keys, expanding outwards from the middle as more column are added.
|
||||
|
@ -48,12 +48,18 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Beatmaps\ManiaBeatmapConverter.cs" />
|
||||
<Compile Include="Judgements\HitWindows.cs" />
|
||||
<Compile Include="Judgements\ManiaJudgement.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="Objects\Drawable\DrawableNote.cs" />
|
||||
<Compile Include="Objects\HoldNote.cs" />
|
||||
<Compile Include="Objects\ManiaBaseHit.cs" />
|
||||
<Compile Include="Objects\ManiaHitObject.cs" />
|
||||
<Compile Include="Objects\Note.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="UI\Column.cs" />
|
||||
|
@ -58,8 +58,8 @@ namespace osu.Game.Rulesets.Osu.Replays
|
||||
{
|
||||
public int Compare(ReplayFrame f1, ReplayFrame f2)
|
||||
{
|
||||
if (f1 == null) throw new NullReferenceException($@"{nameof(f1)} cannot be null");
|
||||
if (f2 == null) throw new NullReferenceException($@"{nameof(f2)} cannot be null");
|
||||
if (f1 == null) throw new ArgumentNullException(nameof(f1));
|
||||
if (f2 == null) throw new ArgumentNullException(nameof(f2));
|
||||
|
||||
return f1.Time.CompareTo(f2.Time);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
|
||||
protected override Beatmap<TaikoHitObject> ConvertBeatmap(Beatmap original)
|
||||
{
|
||||
// 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;
|
||||
|
||||
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));
|
||||
}
|
||||
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));
|
||||
|
||||
|
@ -54,33 +54,33 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
{
|
||||
AddInternal(new Drawable[]
|
||||
{
|
||||
rightBackgroundContainer = new Container
|
||||
{
|
||||
Name = "Transparent playfield background",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
BorderThickness = 2,
|
||||
Masking = true,
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Colour = Color4.Black.Opacity(0.2f),
|
||||
Radius = 5,
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
rightBackground = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0.6f
|
||||
},
|
||||
}
|
||||
},
|
||||
new ScaleFixContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = DEFAULT_PLAYFIELD_HEIGHT,
|
||||
Children = new[]
|
||||
{
|
||||
rightBackgroundContainer = new Container
|
||||
{
|
||||
Name = "Transparent playfield background",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
BorderThickness = 2,
|
||||
Masking = true,
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Colour = Color4.Black.Opacity(0.2f),
|
||||
Radius = 5,
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
rightBackground = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0.6f
|
||||
},
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Name = "Transparent playfield elements",
|
||||
|
@ -135,14 +135,13 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
waitAction = () =>
|
||||
{
|
||||
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);
|
||||
};
|
||||
|
||||
Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout),
|
||||
@"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());
|
||||
|
||||
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
|
||||
{
|
||||
Font = @"Exo2.0-BoldItalic",
|
||||
Text = beatmap.BeatmapSetInfo.Metadata.Title,
|
||||
TextSize = 22,
|
||||
Shadow = true,
|
||||
},
|
||||
artist = new OsuSpriteText
|
||||
{
|
||||
Font = @"Exo2.0-SemiBoldItalic",
|
||||
Text = beatmap.BeatmapSetInfo.Metadata.Artist,
|
||||
TextSize = 17,
|
||||
Shadow = true,
|
||||
},
|
||||
@ -81,8 +79,8 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(LocalisationEngine localisation)
|
||||
{
|
||||
title.Current = localisation.GetUnicodePreference(beatmap.BeatmapSetInfo.Metadata.TitleUnicode, beatmap.BeatmapSetInfo.Metadata.Title);
|
||||
artist.Current = localisation.GetUnicodePreference(beatmap.BeatmapSetInfo.Metadata.ArtistUnicode, beatmap.BeatmapSetInfo.Metadata.Artist);
|
||||
title.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title);
|
||||
artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist);
|
||||
}
|
||||
|
||||
private class PanelBackground : BufferedContainer
|
||||
|
@ -11,7 +11,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
@ -13,11 +13,11 @@ namespace osu.Game.Beatmaps.IO
|
||||
{
|
||||
private class Reader
|
||||
{
|
||||
public Func<Storage, string, bool> Test { get; set; }
|
||||
public Type Type { get; set; }
|
||||
public Func<Storage, string, bool> Test;
|
||||
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)
|
||||
{
|
||||
@ -58,11 +58,9 @@ namespace osu.Game.Beatmaps.IO
|
||||
if (input == null)
|
||||
return null;
|
||||
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
input.CopyTo(ms);
|
||||
return ms.ToArray();
|
||||
}
|
||||
byte[] buffer = new byte[input.Length];
|
||||
input.Read(buffer, 0, buffer.Length);
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,14 +18,17 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public readonly BeatmapSetInfo BeatmapSetInfo;
|
||||
|
||||
public readonly BeatmapMetadata Metadata;
|
||||
|
||||
public readonly Bindable<IEnumerable<Mod>> Mods = new Bindable<IEnumerable<Mod>>(new Mod[] { });
|
||||
|
||||
public readonly bool WithStoryboard;
|
||||
|
||||
protected WorkingBeatmap(BeatmapInfo beatmapInfo, BeatmapSetInfo beatmapSetInfo, bool withStoryboard = false)
|
||||
protected WorkingBeatmap(BeatmapInfo beatmapInfo, bool withStoryboard = false)
|
||||
{
|
||||
BeatmapInfo = beatmapInfo;
|
||||
BeatmapSetInfo = beatmapSetInfo;
|
||||
BeatmapSetInfo = beatmapInfo.BeatmapSet;
|
||||
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo.Metadata;
|
||||
WithStoryboard = withStoryboard;
|
||||
|
||||
Mods.ValueChanged += mods => applyRateAdjustments();
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Screens.Select;
|
||||
|
||||
namespace osu.Game.Configuration
|
||||
@ -19,6 +20,8 @@ namespace osu.Game.Configuration
|
||||
Set(OsuConfig.DisplayStarsMinimum, 0.0, 0, 10);
|
||||
Set(OsuConfig.DisplayStarsMaximum, 10.0, 0, 10);
|
||||
|
||||
Set(OsuConfig.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2, 1);
|
||||
|
||||
// Online settings
|
||||
|
||||
Set(OsuConfig.Username, string.Empty);
|
||||
@ -102,6 +105,7 @@ namespace osu.Game.Configuration
|
||||
DisplayStarsMaximum,
|
||||
SnakingInSliders,
|
||||
SnakingOutSliders,
|
||||
ShowFpsDisplay
|
||||
ShowFpsDisplay,
|
||||
ChatDisplayHeight
|
||||
}
|
||||
}
|
||||
|
@ -36,14 +36,12 @@ namespace osu.Game.Database
|
||||
|
||||
private void deletePending()
|
||||
{
|
||||
foreach (var b in Query<BeatmapSetInfo>().Where(b => b.DeletePending))
|
||||
foreach (var b in GetAllWithChildren<BeatmapSetInfo>(b => b.DeletePending))
|
||||
{
|
||||
try
|
||||
{
|
||||
Storage.Delete(b.Path);
|
||||
|
||||
GetChildren(b, true);
|
||||
|
||||
foreach (var i in b.Beatmaps)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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.");
|
||||
|
||||
//we need metadata
|
||||
GetChildren(beatmapSetInfo);
|
||||
//we also need a ruleset
|
||||
GetChildren(beatmapInfo);
|
||||
|
||||
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);
|
||||
|
||||
|
@ -48,11 +48,9 @@ namespace osu.Game.Database
|
||||
return Connection.Table<T>();
|
||||
}
|
||||
|
||||
public T GetWithChildren<T>(object id) where T : class
|
||||
{
|
||||
return Connection.GetWithChildren<T>(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is expensive. Use with caution.
|
||||
/// </summary>
|
||||
public List<T> GetAllWithChildren<T>(Expression<Func<T, bool>> filter = null, bool recursive = true)
|
||||
where T : class
|
||||
{
|
||||
|
@ -14,8 +14,8 @@ namespace osu.Game.Database
|
||||
{
|
||||
private readonly BeatmapDatabase database;
|
||||
|
||||
public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo, BeatmapSetInfo beatmapSetInfo, bool withStoryboard = false)
|
||||
: base(beatmapInfo, beatmapSetInfo, withStoryboard)
|
||||
public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo, bool withStoryboard = false)
|
||||
: base(beatmapInfo, withStoryboard)
|
||||
{
|
||||
this.database = database;
|
||||
}
|
||||
@ -51,13 +51,13 @@ namespace osu.Game.Database
|
||||
|
||||
protected override Texture GetBackground()
|
||||
{
|
||||
if (BeatmapInfo?.Metadata?.BackgroundFile == null)
|
||||
if (Metadata?.BackgroundFile == null)
|
||||
return null;
|
||||
|
||||
try
|
||||
{
|
||||
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; }
|
||||
}
|
||||
@ -66,7 +66,7 @@ namespace osu.Game.Database
|
||||
{
|
||||
try
|
||||
{
|
||||
var trackData = getReader()?.GetStream(BeatmapInfo.Metadata.AudioFile);
|
||||
var trackData = getReader()?.GetStream(Metadata.AudioFile);
|
||||
return trackData == null ? null : new TrackBass(trackData);
|
||||
}
|
||||
catch { return null; }
|
||||
|
@ -94,13 +94,13 @@ namespace osu.Game.Database
|
||||
{
|
||||
byte[] properties = new byte[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;
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
int v = replayInStream.ReadByte();
|
||||
if (v < 0)
|
||||
throw new Exception("Can't Read 1");
|
||||
throw new IOException("Can't Read 1");
|
||||
outSize |= (long)(byte)v << (8 * i);
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ using OpenTK.Graphics.ES30;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Timing;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace osu.Game.Graphics.Cursor
|
||||
{
|
||||
@ -39,6 +40,8 @@ namespace osu.Game.Graphics.Cursor
|
||||
|
||||
private Vector2? lastPosition;
|
||||
|
||||
private readonly InputResampler resampler = new InputResampler();
|
||||
|
||||
protected override DrawNode CreateDrawNode() => new TrailDrawNode();
|
||||
|
||||
protected override void ApplyDrawNode(DrawNode node)
|
||||
@ -75,7 +78,7 @@ namespace osu.Game.Graphics.Cursor
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ShaderManager shaders, TextureStore textures)
|
||||
{
|
||||
shader = shaders?.Load(@"CursorTrail", FragmentShaderDescriptor.Texture);
|
||||
shader = shaders?.Load(@"CursorTrail", FragmentShaderDescriptor.TEXTURE);
|
||||
texture = textures.Get(@"Cursor/cursortrail");
|
||||
Scale = new Vector2(1 / texture.ScaleAdjust);
|
||||
}
|
||||
@ -116,22 +119,26 @@ namespace osu.Game.Graphics.Cursor
|
||||
if (lastPosition == null)
|
||||
{
|
||||
lastPosition = state.Mouse.NativeState.Position;
|
||||
resampler.AddPosition(lastPosition.Value);
|
||||
return base.OnMouseMove(state);
|
||||
}
|
||||
|
||||
Vector2 pos1 = lastPosition.Value;
|
||||
Vector2 pos2 = state.Mouse.NativeState.Position;
|
||||
|
||||
Vector2 diff = pos2 - pos1;
|
||||
float distance = diff.Length;
|
||||
Vector2 direction = diff / distance;
|
||||
|
||||
float interval = size.X / 2 * 0.9f;
|
||||
|
||||
for (float d = interval; d < distance; d += interval)
|
||||
foreach (Vector2 pos2 in resampler.AddPosition(state.Mouse.NativeState.Position))
|
||||
{
|
||||
lastPosition = pos1 + direction * d;
|
||||
addPosition(lastPosition.Value);
|
||||
Trace.Assert(lastPosition.HasValue);
|
||||
|
||||
Vector2 pos1 = lastPosition.Value;
|
||||
Vector2 diff = pos2 - pos1;
|
||||
float distance = diff.Length;
|
||||
Vector2 direction = diff / distance;
|
||||
|
||||
float interval = size.X / 2 * 0.9f;
|
||||
|
||||
for (float d = interval; d < distance; d += interval)
|
||||
{
|
||||
lastPosition = pos1 + direction * d;
|
||||
addPosition(lastPosition.Value);
|
||||
}
|
||||
}
|
||||
|
||||
return base.OnMouseMove(state);
|
||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Graphics
|
||||
switch (hex.Length)
|
||||
{
|
||||
default:
|
||||
throw new Exception(@"Invalid hex string length!");
|
||||
throw new ArgumentException(@"Invalid hex string length!");
|
||||
case 3:
|
||||
return new Color4(
|
||||
(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
|
||||
public Color4 PurpleLighter = FromHex(@"eeeeff");
|
||||
public Color4 PurpleLight = FromHex(@"aa88ff");
|
||||
public Color4 Purple = FromHex(@"8866ee");
|
||||
public Color4 PurpleDark = FromHex(@"6644cc");
|
||||
public Color4 PurpleDarker = FromHex(@"441188");
|
||||
public readonly Color4 PurpleLighter = FromHex(@"eeeeff");
|
||||
public readonly Color4 PurpleLight = FromHex(@"aa88ff");
|
||||
public readonly Color4 Purple = FromHex(@"8866ee");
|
||||
public readonly Color4 PurpleDark = FromHex(@"6644cc");
|
||||
public readonly Color4 PurpleDarker = FromHex(@"441188");
|
||||
|
||||
public Color4 PinkLighter = FromHex(@"ffddee");
|
||||
public Color4 PinkLight = FromHex(@"ff99cc");
|
||||
public Color4 Pink = FromHex(@"ff66aa");
|
||||
public Color4 PinkDark = FromHex(@"cc5288");
|
||||
public Color4 PinkDarker = FromHex(@"bb1177");
|
||||
public readonly Color4 PinkLighter = FromHex(@"ffddee");
|
||||
public readonly Color4 PinkLight = FromHex(@"ff99cc");
|
||||
public readonly Color4 Pink = FromHex(@"ff66aa");
|
||||
public readonly Color4 PinkDark = FromHex(@"cc5288");
|
||||
public readonly Color4 PinkDarker = FromHex(@"bb1177");
|
||||
|
||||
public Color4 BlueLighter = FromHex(@"ddffff");
|
||||
public Color4 BlueLight = FromHex(@"99eeff");
|
||||
public Color4 Blue = FromHex(@"66ccff");
|
||||
public Color4 BlueDark = FromHex(@"44aadd");
|
||||
public Color4 BlueDarker = FromHex(@"2299bb");
|
||||
public readonly Color4 BlueLighter = FromHex(@"ddffff");
|
||||
public readonly Color4 BlueLight = FromHex(@"99eeff");
|
||||
public readonly Color4 Blue = FromHex(@"66ccff");
|
||||
public readonly Color4 BlueDark = FromHex(@"44aadd");
|
||||
public readonly Color4 BlueDarker = FromHex(@"2299bb");
|
||||
|
||||
public Color4 YellowLighter = FromHex(@"ffffdd");
|
||||
public Color4 YellowLight = FromHex(@"ffdd55");
|
||||
public Color4 Yellow = FromHex(@"ffcc22");
|
||||
public Color4 YellowDark = FromHex(@"eeaa00");
|
||||
public Color4 YellowDarker = FromHex(@"cc6600");
|
||||
public readonly Color4 YellowLighter = FromHex(@"ffffdd");
|
||||
public readonly Color4 YellowLight = FromHex(@"ffdd55");
|
||||
public readonly Color4 Yellow = FromHex(@"ffcc22");
|
||||
public readonly Color4 YellowDark = FromHex(@"eeaa00");
|
||||
public readonly Color4 YellowDarker = FromHex(@"cc6600");
|
||||
|
||||
public Color4 GreenLighter = FromHex(@"eeffcc");
|
||||
public Color4 GreenLight = FromHex(@"b3d944");
|
||||
public Color4 Green = FromHex(@"88b300");
|
||||
public Color4 GreenDark = FromHex(@"668800");
|
||||
public Color4 GreenDarker = FromHex(@"445500");
|
||||
public readonly Color4 GreenLighter = FromHex(@"eeffcc");
|
||||
public readonly Color4 GreenLight = FromHex(@"b3d944");
|
||||
public readonly Color4 Green = FromHex(@"88b300");
|
||||
public readonly Color4 GreenDark = FromHex(@"668800");
|
||||
public readonly Color4 GreenDarker = FromHex(@"445500");
|
||||
|
||||
public Color4 Gray0 = FromHex(@"000");
|
||||
public Color4 Gray1 = FromHex(@"111");
|
||||
public Color4 Gray2 = FromHex(@"222");
|
||||
public Color4 Gray3 = FromHex(@"333");
|
||||
public Color4 Gray4 = FromHex(@"444");
|
||||
public Color4 Gray5 = FromHex(@"555");
|
||||
public Color4 Gray6 = FromHex(@"666");
|
||||
public Color4 Gray7 = FromHex(@"777");
|
||||
public Color4 Gray8 = FromHex(@"888");
|
||||
public Color4 Gray9 = FromHex(@"999");
|
||||
public Color4 GrayA = FromHex(@"aaa");
|
||||
public Color4 GrayB = FromHex(@"bbb");
|
||||
public Color4 GrayC = FromHex(@"ccc");
|
||||
public Color4 GrayD = FromHex(@"ddd");
|
||||
public Color4 GrayE = FromHex(@"eee");
|
||||
public Color4 GrayF = FromHex(@"fff");
|
||||
public readonly Color4 Gray0 = FromHex(@"000");
|
||||
public readonly Color4 Gray1 = FromHex(@"111");
|
||||
public readonly Color4 Gray2 = FromHex(@"222");
|
||||
public readonly Color4 Gray3 = FromHex(@"333");
|
||||
public readonly Color4 Gray4 = FromHex(@"444");
|
||||
public readonly Color4 Gray5 = FromHex(@"555");
|
||||
public readonly Color4 Gray6 = FromHex(@"666");
|
||||
public readonly Color4 Gray7 = FromHex(@"777");
|
||||
public readonly Color4 Gray8 = FromHex(@"888");
|
||||
public readonly Color4 Gray9 = FromHex(@"999");
|
||||
public readonly Color4 GrayA = FromHex(@"aaa");
|
||||
public readonly Color4 GrayB = FromHex(@"bbb");
|
||||
public readonly Color4 GrayC = FromHex(@"ccc");
|
||||
public readonly Color4 GrayD = FromHex(@"ddd");
|
||||
public readonly Color4 GrayE = FromHex(@"eee");
|
||||
public readonly Color4 GrayF = FromHex(@"fff");
|
||||
|
||||
public Color4 RedLighter = FromHex(@"ffeded");
|
||||
public Color4 RedLight = FromHex(@"ed7787");
|
||||
public Color4 Red = FromHex(@"ed1121");
|
||||
public Color4 RedDark = FromHex(@"ba0011");
|
||||
public Color4 RedDarker = FromHex(@"870000");
|
||||
public readonly Color4 RedLighter = FromHex(@"ffeded");
|
||||
public readonly Color4 RedLight = FromHex(@"ed7787");
|
||||
public readonly Color4 Red = FromHex(@"ed1121");
|
||||
public readonly Color4 RedDark = FromHex(@"ba0011");
|
||||
public readonly Color4 RedDarker = FromHex(@"870000");
|
||||
|
||||
public readonly Color4 ChatBlue = FromHex(@"17292e");
|
||||
}
|
||||
}
|
||||
|
@ -25,15 +25,15 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || Dropdown.Contains(screenSpacePos);
|
||||
|
||||
private bool isEnumType => typeof(T).IsEnum;
|
||||
|
||||
public OsuTabControl()
|
||||
{
|
||||
TabContainer.Spacing = new Vector2(10f, 0f);
|
||||
|
||||
if (!typeof(T).IsEnum)
|
||||
throw new InvalidOperationException("OsuTabControl only supports enums as the generic type argument");
|
||||
|
||||
foreach (var val in (T[])Enum.GetValues(typeof(T)))
|
||||
AddItem(val);
|
||||
if (isEnumType)
|
||||
foreach (var val in (T[])Enum.GetValues(typeof(T)))
|
||||
AddItem(val);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -136,7 +136,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Margin = new MarginPadding { Top = 5, Bottom = 5 },
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Text = (value as Enum)?.GetDescription(),
|
||||
Text = (value as Enum)?.GetDescription() ?? value.ToString(),
|
||||
TextSize = 14,
|
||||
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>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
/// <summary>
|
||||
/// A textbox which holds focus eagerly.
|
@ -16,12 +16,13 @@ namespace osu.Game.IO.Serialization
|
||||
return JsonConvert.SerializeObject(obj);
|
||||
}
|
||||
|
||||
public static T Deserialize<T>(string objString)
|
||||
public static T Deserialize<T>(this string 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));
|
||||
}
|
||||
|
@ -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,21 +72,28 @@ namespace osu.Game.Online.API
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly object access_token_retrieval_lock = new object();
|
||||
|
||||
/// <summary>
|
||||
/// Should be run before any API request to make sure we have a valid key.
|
||||
/// </summary>
|
||||
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 not, let's try using our refresh token to request a new access token.
|
||||
if (!string.IsNullOrEmpty(Token?.RefreshToken))
|
||||
AuthenticateWithRefresh(Token.RefreshToken);
|
||||
// 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;
|
||||
|
||||
return accessTokenValid;
|
||||
// if not, let's try using our refresh token to request a new access token.
|
||||
if (!string.IsNullOrEmpty(Token?.RefreshToken))
|
||||
AuthenticateWithRefresh(Token.RefreshToken);
|
||||
|
||||
return accessTokenValid;
|
||||
}
|
||||
}
|
||||
|
||||
private bool accessTokenValid => Token?.IsValid ?? false;
|
||||
|
@ -41,13 +41,13 @@ namespace osu.Game.Online.API
|
||||
[JsonProperty(@"refresh_token")]
|
||||
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)
|
||||
{
|
||||
try
|
||||
{
|
||||
string[] parts = value.Split('/');
|
||||
string[] parts = value.Split('|');
|
||||
return new OAuthToken
|
||||
{
|
||||
AccessToken = parts[0],
|
||||
|
@ -23,10 +23,12 @@ namespace osu.Game.Online.Chat
|
||||
[JsonProperty(@"channel_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;
|
||||
|
||||
public bool ReadOnly => Name != "#lazer";
|
||||
|
||||
public const int MAX_HISTORY = 300;
|
||||
|
||||
[JsonConstructor]
|
||||
@ -53,5 +55,7 @@ namespace osu.Game.Online.Chat
|
||||
if (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.Game.Overlays;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Input;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Graphics.UserInterface.Volume;
|
||||
@ -161,7 +160,7 @@ namespace osu.Game
|
||||
});
|
||||
|
||||
//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(musicController = new MusicController
|
||||
{
|
||||
@ -321,8 +320,7 @@ namespace osu.Game
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
if (intro?.ChildScreen != null)
|
||||
intro.ChildScreen.Padding = new MarginPadding { Top = Toolbar.Position.Y + Toolbar.DrawHeight };
|
||||
mainContent.Padding = new MarginPadding { Top = Toolbar.Position.Y + Toolbar.DrawHeight };
|
||||
|
||||
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.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.Chat;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Online.Chat.Drawables
|
||||
namespace osu.Game.Overlays.Chat
|
||||
{
|
||||
public class ChatLine : Container
|
||||
{
|
||||
@ -62,7 +63,10 @@ namespace osu.Game.Online.Chat.Drawables
|
||||
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;
|
||||
|
||||
public ChatLine(Message message)
|
||||
@ -72,13 +76,13 @@ namespace osu.Game.Online.Chat.Drawables
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
Padding = new MarginPadding { Left = 15, Right = 15 };
|
||||
Padding = new MarginPadding { Left = padding, Right = padding };
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
Size = new Vector2(padding, text_size),
|
||||
Size = new Vector2(message_padding, text_size),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
@ -106,7 +110,7 @@ namespace osu.Game.Online.Chat.Drawables
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding { Left = padding + 15 },
|
||||
Padding = new MarginPadding { Left = message_padding + padding },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
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.Containers;
|
||||
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
|
||||
{
|
||||
private readonly Channel channel;
|
||||
public readonly Channel Channel;
|
||||
private readonly FillFlowContainer flow;
|
||||
private readonly ScrollContainer scroll;
|
||||
|
||||
public DrawableChannel(Channel channel)
|
||||
{
|
||||
this.channel = channel;
|
||||
Channel = channel;
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = channel.Name,
|
||||
TextSize = 50,
|
||||
Alpha = 0.3f,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
},
|
||||
scroll = new ScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -56,14 +48,14 @@ namespace osu.Game.Online.Chat.Drawables
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
newMessagesArrived(channel.Messages);
|
||||
newMessagesArrived(Channel.Messages);
|
||||
scrollToEnd();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
channel.NewMessagesArrived -= newMessagesArrived;
|
||||
Channel.NewMessagesArrived -= newMessagesArrived;
|
||||
}
|
||||
|
||||
private void newMessagesArrived(IEnumerable<Message> newMessages)
|
||||
@ -93,4 +85,4 @@ namespace osu.Game.Online.Chat.Drawables
|
||||
|
||||
private void scrollToEnd() => Scheduler.AddDelayed(() => scroll.ScrollToEnd(), 50);
|
||||
}
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using OpenTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
@ -15,24 +16,24 @@ using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Online.Chat.Drawables;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays.Chat;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public class ChatOverlay : FocusedOverlayContainer, IOnlineComponent
|
||||
{
|
||||
private const float textbox_height = 40;
|
||||
private const float textbox_height = 60;
|
||||
|
||||
private ScheduledDelegate messageRequest;
|
||||
|
||||
private readonly Container content;
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
private readonly Container currentChannelContainer;
|
||||
|
||||
private readonly FocusedTextBox inputTextBox;
|
||||
|
||||
@ -40,50 +41,114 @@ namespace osu.Game.Overlays
|
||||
|
||||
private const int transition_length = 500;
|
||||
|
||||
public const float DEFAULT_HEIGHT = 0.4f;
|
||||
|
||||
public const float TAB_AREA_HEIGHT = 50;
|
||||
|
||||
private GetMessagesRequest fetchReq;
|
||||
|
||||
private readonly ChatTabControl channelTabs;
|
||||
|
||||
private readonly Box chatBackground;
|
||||
private readonly Box tabBackground;
|
||||
|
||||
private Bindable<double> chatHeight;
|
||||
|
||||
public ChatOverlay()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Size = new Vector2(1, 300);
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
RelativePositionAxes = Axes.Both;
|
||||
Size = new Vector2(1, DEFAULT_HEIGHT);
|
||||
Anchor = Anchor.BottomLeft;
|
||||
Origin = Anchor.BottomLeft;
|
||||
|
||||
AddInternal(new Drawable[]
|
||||
const float padding = 5;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
new Container
|
||||
{
|
||||
Depth = float.MaxValue,
|
||||
Name = @"chat area",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
Alpha = 0.9f,
|
||||
},
|
||||
content = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Top = 5, Bottom = textbox_height + 5 },
|
||||
Padding = new MarginPadding { Top = TAB_AREA_HEIGHT },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
chatBackground = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
currentChannelContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Top = padding,
|
||||
Bottom = textbox_height + padding
|
||||
},
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = textbox_height,
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Top = padding * 2,
|
||||
Bottom = padding * 2,
|
||||
Left = ChatLine.LEFT_PADDING + padding * 2,
|
||||
Right = padding * 2,
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
inputTextBox = new FocusedTextBox
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Height = 1,
|
||||
PlaceholderText = "type your message",
|
||||
Exit = () => State = Visibility.Hidden,
|
||||
OnCommit = postMessage,
|
||||
HoldFocus = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Name = @"tabs area",
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = textbox_height,
|
||||
Padding = new MarginPadding(5),
|
||||
Height = TAB_AREA_HEIGHT,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
inputTextBox = new FocusedTextBox
|
||||
tabBackground = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Height = 1,
|
||||
PlaceholderText = "type your message",
|
||||
Exit = () => State = Visibility.Hidden,
|
||||
OnCommit = postMessage,
|
||||
HoldFocus = true,
|
||||
}
|
||||
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)
|
||||
@ -110,28 +175,48 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
MoveToY(0, transition_length, EasingTypes.OutQuint);
|
||||
FadeIn(transition_length, EasingTypes.OutQuint);
|
||||
|
||||
inputTextBox.HoldFocus = true;
|
||||
base.PopIn();
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
MoveToY(DrawSize.Y, transition_length, EasingTypes.InSine);
|
||||
MoveToY(Height, transition_length, EasingTypes.InSine);
|
||||
FadeOut(transition_length, EasingTypes.InSine);
|
||||
|
||||
inputTextBox.HoldFocus = false;
|
||||
base.PopOut();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(APIAccess api)
|
||||
private void load(APIAccess api, OsuConfigManager config, OsuColour colours)
|
||||
{
|
||||
this.api = api;
|
||||
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 List<Channel> careChannels;
|
||||
|
||||
private readonly List<DrawableChannel> loadedChannels = new List<DrawableChannel>();
|
||||
|
||||
private void initializeChannels()
|
||||
{
|
||||
Clear();
|
||||
currentChannelContainer.Clear();
|
||||
|
||||
loadedChannels.Clear();
|
||||
|
||||
careChannels = new List<Channel>();
|
||||
|
||||
@ -154,25 +239,67 @@ namespace osu.Game.Overlays
|
||||
Scheduler.Add(delegate
|
||||
{
|
||||
loading.FadeOut(100);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
Add(new DrawableChannel(channel));
|
||||
if (channel == null) return;
|
||||
|
||||
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;
|
||||
|
||||
fetchReq = new GetMessagesRequest(careChannels, lastMessageId);
|
||||
fetchReq = new GetMessagesRequest(specificChannel != null ? new List<Channel> { specificChannel } : careChannels, lastMessageId);
|
||||
fetchReq.Success += delegate (List<Message> messages)
|
||||
{
|
||||
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)
|
||||
{
|
||||
var currentChannel = careChannels.FirstOrDefault();
|
||||
|
||||
if (currentChannel == null) return;
|
||||
|
||||
var message = new Message
|
||||
|
@ -16,7 +16,6 @@ namespace osu.Game.Overlays.Mods
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
ButtonColour = colours.Blue;
|
||||
SelectedColour = colours.BlueLight;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@ namespace osu.Game.Overlays.Mods
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
ButtonColour = colours.Yellow;
|
||||
SelectedColour = colours.YellowLight;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@ namespace osu.Game.Overlays.Mods
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
ButtonColour = colours.Green;
|
||||
SelectedColour = colours.GreenLight;
|
||||
}
|
||||
|
||||
|
@ -19,9 +19,13 @@ using System.Linq;
|
||||
|
||||
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 Container<ModIcon> iconsContainer;
|
||||
private SampleChannel sampleOn, sampleOff;
|
||||
@ -51,7 +55,7 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
iconsContainer.RotateTo(Selected ? 5f : 0f, 300, EasingTypes.OutElastic);
|
||||
iconsContainer.ScaleTo(Selected ? 1.1f : 1f, 300, EasingTypes.OutElastic);
|
||||
foregroundIcon.Colour = Selected ? SelectedColour : ButtonColour;
|
||||
foregroundIcon.Highlighted = Selected;
|
||||
|
||||
if (mod != null)
|
||||
displayMod(SelectedMod ?? Mods[0]);
|
||||
@ -60,23 +64,6 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
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;
|
||||
public Color4 SelectedColour
|
||||
@ -127,7 +114,7 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
// 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]
|
||||
private void load(AudioManager audio)
|
||||
@ -180,50 +167,35 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
iconsContainer.Add(new[]
|
||||
{
|
||||
new ModIcon
|
||||
new ModIcon(Mods[0])
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Position = new Vector2(1.5f),
|
||||
Colour = ButtonColour
|
||||
},
|
||||
foregroundIcon = new ModIcon
|
||||
foregroundIcon = new ModIcon(Mods[0])
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Position = new Vector2(-1.5f),
|
||||
Colour = ButtonColour
|
||||
},
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
iconsContainer.Add(foregroundIcon = new ModIcon
|
||||
iconsContainer.Add(foregroundIcon = new ModIcon(Mod)
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
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[]
|
||||
{
|
||||
new Container
|
||||
@ -243,13 +215,14 @@ namespace osu.Game.Overlays.Mods
|
||||
},
|
||||
text = new OsuSpriteText
|
||||
{
|
||||
Y = 75,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
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.Rulesets.Mods;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
@ -18,7 +20,7 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
private readonly OsuSpriteText headerLabel;
|
||||
|
||||
public FillFlowContainer<ModButton> ButtonsContainer { get; }
|
||||
public FillFlowContainer<ModButtonEmpty> ButtonsContainer { get; }
|
||||
|
||||
public Action<Mod> Action;
|
||||
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 = { };
|
||||
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;
|
||||
public Color4 SelectedColour
|
||||
@ -91,17 +76,15 @@ namespace osu.Game.Overlays.Mods
|
||||
selectedColour = value;
|
||||
|
||||
foreach (ModButton button in buttons)
|
||||
{
|
||||
button.SelectedColour = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
{
|
||||
var index = Array.IndexOf(ToggleKeys, args.Key);
|
||||
if (index > -1 && index < Buttons.Length)
|
||||
Buttons[index].SelectNext();
|
||||
if (index > -1 && index < buttons.Length)
|
||||
buttons[index].SelectNext();
|
||||
|
||||
return base.OnKeyDown(state, args);
|
||||
}
|
||||
@ -109,8 +92,18 @@ namespace osu.Game.Overlays.Mods
|
||||
public void DeselectAll()
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,7 +120,7 @@ namespace osu.Game.Overlays.Mods
|
||||
Position = new Vector2(0f, 0f),
|
||||
Font = @"Exo2.0-Bold"
|
||||
},
|
||||
ButtonsContainer = new FillFlowContainer<ModButton>
|
||||
ButtonsContainer = new FillFlowContainer<ModButtonEmpty>
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Origin = Anchor.BottomLeft,
|
||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Overlays.Mods
|
||||
var instance = newRuleset.CreateInstance();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@ -103,14 +103,7 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
if (modTypes.Length == 0) return;
|
||||
foreach (ModSection section in modSectionsContainer.Children)
|
||||
foreach (ModButton button in section.Buttons)
|
||||
{
|
||||
Mod selected = button.SelectedMod;
|
||||
if (selected == null) continue;
|
||||
foreach (Type type in modTypes)
|
||||
if (type.IsInstanceOfType(selected))
|
||||
button.Deselect();
|
||||
}
|
||||
section.DeselectTypes(modTypes);
|
||||
}
|
||||
|
||||
private void modButtonPressed(Mod selectedMod)
|
||||
@ -122,7 +115,7 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
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;
|
||||
bool ranked = true;
|
||||
|
@ -10,7 +10,6 @@ using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Screens.Select;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using System;
|
||||
|
@ -315,7 +315,7 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
else
|
||||
{
|
||||
BeatmapMetadata metadata = beatmap.Beatmap.BeatmapInfo.Metadata;
|
||||
BeatmapMetadata metadata = beatmap.Metadata;
|
||||
title.Current = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title);
|
||||
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
|
||||
|
||||
using System.Collections.Generic;
|
||||
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;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Options
|
||||
{
|
||||
public class OptionDropdown<T> : FillFlowContainer
|
||||
public class OptionDropdown<T> : OptionItem<T>
|
||||
{
|
||||
private readonly Dropdown<T> dropdown;
|
||||
private readonly SpriteText text;
|
||||
private Dropdown<T> dropdown;
|
||||
|
||||
public string LabelText
|
||||
{
|
||||
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;
|
||||
private IEnumerable<KeyValuePair<string, T>> items = new KeyValuePair<string, T>[] { };
|
||||
public IEnumerable<KeyValuePair<string, T>> Items
|
||||
{
|
||||
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 },
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Items = Items,
|
||||
}
|
||||
};
|
||||
|
||||
dropdown.Current.DisabledChanged += disabled =>
|
||||
{
|
||||
Alpha = disabled ? 0.3f : 1;
|
||||
};
|
||||
}
|
||||
Margin = new MarginPadding { Top = 5 },
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Items = Items,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
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
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Overlays.Options
|
||||
{
|
||||
internal class OptionLabel : OsuSpriteText
|
||||
internal class OptionLabel : OptionItem<string>
|
||||
{
|
||||
protected override Drawable CreateControl() => null;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colour)
|
||||
{
|
||||
|
@ -1,13 +1,9 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
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 U : SliderBar<T>, new()
|
||||
{
|
||||
private readonly SliderBar<T> slider;
|
||||
private readonly SpriteText text;
|
||||
|
||||
public string LabelText
|
||||
protected override Drawable CreateControl() => new U()
|
||||
{
|
||||
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 },
|
||||
RelativeSizeAxes = Axes.X
|
||||
}
|
||||
};
|
||||
}
|
||||
Margin = new MarginPadding { Top = 5, Bottom = 5 },
|
||||
RelativeSizeAxes = Axes.X
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,13 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Options
|
||||
{
|
||||
public class OptionTextBox : OsuTextBox
|
||||
public class OptionTextBox : OptionItem<string>
|
||||
{
|
||||
private Bindable<string> bindable;
|
||||
|
||||
public Bindable<string> Bindable
|
||||
{
|
||||
set
|
||||
{
|
||||
bindable = value;
|
||||
Current.BindTo(bindable);
|
||||
}
|
||||
}
|
||||
protected override Drawable CreateControl() => new OsuTextBox();
|
||||
}
|
||||
}
|
||||
|
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.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Overlays.Options
|
||||
{
|
||||
public abstract class OptionsSection : Container
|
||||
public abstract class OptionsSection : Container, IHasFilterableChildren
|
||||
{
|
||||
protected FillFlowContainer FlowContent;
|
||||
protected override Container<Drawable> Content => FlowContent;
|
||||
@ -21,6 +23,16 @@ namespace osu.Game.Overlays.Options
|
||||
public abstract FontAwesome Icon { 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;
|
||||
|
||||
protected OptionsSection()
|
||||
|
@ -6,10 +6,12 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Overlays.Options
|
||||
{
|
||||
public abstract class OptionsSubsection : FillFlowContainer
|
||||
public abstract class OptionsSubsection : FillFlowContainer, IHasFilterableChildren
|
||||
{
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
@ -17,6 +19,16 @@ namespace osu.Game.Overlays.Options
|
||||
|
||||
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()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Options.Sections.Audio
|
||||
{
|
||||
@ -16,12 +15,12 @@ namespace osu.Game.Overlays.Options.Sections.Audio
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
new OsuCheckbox
|
||||
new OptionCheckbox
|
||||
{
|
||||
LabelText = "Interface voices",
|
||||
Bindable = config.GetBindable<bool>(OsuConfig.MenuVoice)
|
||||
},
|
||||
new OsuCheckbox
|
||||
new OptionCheckbox
|
||||
{
|
||||
LabelText = "osu! music theme",
|
||||
Bindable = config.GetBindable<bool>(OsuConfig.MenuMusic)
|
||||
@ -29,4 +28,4 @@ namespace osu.Game.Overlays.Options.Sections.Audio
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Options.Sections.Debug
|
||||
{
|
||||
@ -17,7 +16,7 @@ namespace osu.Game.Overlays.Options.Sections.Debug
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuCheckbox
|
||||
new OptionCheckbox
|
||||
{
|
||||
LabelText = "Bypass caching",
|
||||
Bindable = config.GetBindable<bool>(FrameworkDebugConfig.BypassCaching)
|
||||
|
@ -4,7 +4,6 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Options.Sections.Gameplay
|
||||
{
|
||||
@ -22,12 +21,12 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay
|
||||
LabelText = "Background dim",
|
||||
Bindable = config.GetBindable<double>(OsuConfig.DimLevel)
|
||||
},
|
||||
new OsuCheckbox
|
||||
new OptionCheckbox
|
||||
{
|
||||
LabelText = "Show score overlay",
|
||||
Bindable = config.GetBindable<bool>(OsuConfig.ShowInterface)
|
||||
},
|
||||
new OsuCheckbox
|
||||
new OptionCheckbox
|
||||
{
|
||||
LabelText = "Always show key overlay",
|
||||
Bindable = config.GetBindable<bool>(OsuConfig.KeyOverlay)
|
||||
|
@ -4,7 +4,6 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Options.Sections.General
|
||||
{
|
||||
@ -17,7 +16,7 @@ namespace osu.Game.Overlays.Options.Sections.General
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuCheckbox
|
||||
new OptionCheckbox
|
||||
{
|
||||
LabelText = "Prefer metadata in original language",
|
||||
Bindable = frameworkConfig.GetBindable<bool>(FrameworkConfig.ShowUnicode)
|
||||
|
@ -132,12 +132,12 @@ namespace osu.Game.Overlays.Options.Sections.General
|
||||
TabbableContentContainer = this,
|
||||
OnCommit = (sender, newText) => performLogin()
|
||||
},
|
||||
new OsuCheckbox
|
||||
new OptionCheckbox
|
||||
{
|
||||
LabelText = "Remember username",
|
||||
Bindable = config.GetBindable<bool>(OsuConfig.SaveUsername),
|
||||
},
|
||||
new OsuCheckbox
|
||||
new OptionCheckbox
|
||||
{
|
||||
LabelText = "Stay logged in",
|
||||
Bindable = config.GetBindable<bool>(OsuConfig.SavePassword),
|
||||
|
@ -4,7 +4,6 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Options.Sections.Graphics
|
||||
{
|
||||
@ -17,12 +16,12 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuCheckbox
|
||||
new OptionCheckbox
|
||||
{
|
||||
LabelText = "Snaking in sliders",
|
||||
Bindable = config.GetBindable<bool>(OsuConfig.SnakingInSliders)
|
||||
},
|
||||
new OsuCheckbox
|
||||
new OptionCheckbox
|
||||
{
|
||||
LabelText = "Snaking out sliders",
|
||||
Bindable = config.GetBindable<bool>(OsuConfig.SnakingOutSliders)
|
||||
@ -30,4 +29,4 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Options.Sections.Graphics
|
||||
{
|
||||
@ -29,7 +28,7 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
|
||||
LabelText = "Screen mode",
|
||||
Bindable = config.GetBindable<WindowMode>(FrameworkConfig.WindowMode),
|
||||
},
|
||||
new OsuCheckbox
|
||||
new OptionCheckbox
|
||||
{
|
||||
LabelText = "Letterboxing",
|
||||
Bindable = letterboxing,
|
||||
@ -64,4 +63,4 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Options.Sections.Graphics
|
||||
{
|
||||
@ -16,7 +15,7 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
new OsuCheckbox
|
||||
new OptionCheckbox
|
||||
{
|
||||
LabelText = "Parallax",
|
||||
Bindable = config.GetBindable<bool>(OsuConfig.MenuParallax)
|
||||
@ -24,4 +23,4 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Options.Sections.Graphics
|
||||
{
|
||||
@ -25,7 +24,7 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
|
||||
LabelText = "Frame limiter",
|
||||
Bindable = config.GetBindable<FrameSync>(FrameworkConfig.FrameSync)
|
||||
},
|
||||
new OsuCheckbox
|
||||
new OptionCheckbox
|
||||
{
|
||||
LabelText = "Show FPS",
|
||||
Bindable = osuConfig.GetBindable<bool>(OsuConfig.ShowFpsDisplay)
|
||||
@ -33,4 +32,4 @@ namespace osu.Game.Overlays.Options.Sections.Graphics
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,12 +24,12 @@ namespace osu.Game.Overlays.Options.Sections.Input
|
||||
LabelText = "Confine mouse cursor",
|
||||
Bindable = config.GetBindable<ConfineMouseMode>(FrameworkConfig.ConfineMouseMode),
|
||||
},
|
||||
new OsuCheckbox
|
||||
new OptionCheckbox
|
||||
{
|
||||
LabelText = "Disable mouse wheel during gameplay",
|
||||
Bindable = osuConfig.GetBindable<bool>(OsuConfig.MouseDisableWheel)
|
||||
},
|
||||
new OsuCheckbox
|
||||
new OptionCheckbox
|
||||
{
|
||||
LabelText = "Disable mouse buttons during gameplay",
|
||||
Bindable = osuConfig.GetBindable<bool>(OsuConfig.MouseDisableButtons)
|
||||
|
@ -10,9 +10,8 @@ using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Overlays.Options;
|
||||
using System;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Overlays.Options.Sections;
|
||||
using osu.Framework.Input;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
@ -32,6 +31,13 @@ namespace osu.Game.Overlays
|
||||
private Sidebar sidebar;
|
||||
private SidebarButton[] sidebarButtons;
|
||||
private OptionsSection[] sections;
|
||||
|
||||
private OptionsHeader header;
|
||||
|
||||
private OptionsFooter footer;
|
||||
|
||||
private SearchContainer searchContainer;
|
||||
|
||||
private float lastKnownScroll;
|
||||
|
||||
public OptionsOverlay()
|
||||
@ -41,7 +47,7 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(OsuGame game, OsuColour colours)
|
||||
private void load(OsuGame game)
|
||||
{
|
||||
sections = new OptionsSection[]
|
||||
{
|
||||
@ -69,39 +75,20 @@ namespace osu.Game.Overlays
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Width = width,
|
||||
Margin = new MarginPadding { Left = SIDEBAR_WIDTH },
|
||||
Children = new[]
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
searchContainer = new SearchContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Direction = FillDirection.Vertical,
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
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,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = sections,
|
||||
},
|
||||
new OptionsFooter()
|
||||
}
|
||||
}
|
||||
Children = sections,
|
||||
},
|
||||
footer = new OptionsFooter(),
|
||||
header = new OptionsHeader(() => scrollContainer.Current)
|
||||
{
|
||||
Exit = Hide,
|
||||
},
|
||||
}
|
||||
},
|
||||
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 };
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
base.Update();
|
||||
@ -157,6 +155,8 @@ namespace osu.Game.Overlays
|
||||
scrollContainer.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint);
|
||||
sidebar.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint);
|
||||
FadeTo(1, TRANSITION_LENGTH / 2);
|
||||
|
||||
header.SearchTextBox.HoldFocus = true;
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
@ -166,6 +166,15 @@ namespace osu.Game.Overlays
|
||||
scrollContainer.MoveToX(-width, TRANSITION_LENGTH, EasingTypes.OutQuint);
|
||||
sidebar.MoveToX(-SIDEBAR_WIDTH, TRANSITION_LENGTH, EasingTypes.OutQuint);
|
||||
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)
|
||||
{
|
||||
StateContainer = chat;
|
||||
Action = chat.ToggleVisibility;
|
||||
}
|
||||
}
|
||||
}
|
@ -17,7 +17,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
private void load(MusicController music)
|
||||
{
|
||||
StateContainer = music;
|
||||
Action = music.ToggleVisibility;
|
||||
}
|
||||
}
|
||||
}
|
@ -22,7 +22,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
private void load(NotificationManager notificationManager)
|
||||
{
|
||||
StateContainer = notificationManager;
|
||||
Action = notificationManager.ToggleVisibility;
|
||||
}
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
set
|
||||
{
|
||||
stateContainer = value;
|
||||
Action = stateContainer.ToggleVisibility;
|
||||
stateContainer.StateChanged += stateChanged;
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
private void load(OptionsOverlay options)
|
||||
{
|
||||
StateContainer = options;
|
||||
Action = options.ToggleVisibility;
|
||||
}
|
||||
}
|
||||
}
|
@ -21,6 +21,11 @@ namespace osu.Game.Rulesets.Mods
|
||||
/// </summary>
|
||||
public virtual FontAwesome Icon => FontAwesome.fa_question;
|
||||
|
||||
/// <summary>
|
||||
/// The type of this mod.
|
||||
/// </summary>
|
||||
public virtual ModType Type => ModType.Special;
|
||||
|
||||
/// <summary>
|
||||
/// The user readable description of this mod.
|
||||
/// </summary>
|
||||
|
@ -11,6 +11,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public override string Name => "Double Time";
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_doubletime;
|
||||
public override ModType Type => ModType.DifficultyIncrease;
|
||||
public override string Description => "Zoooooooooom";
|
||||
public override bool Ranked => true;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModHalfTime) };
|
||||
|
@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public override string Name => "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 double ScoreMultiplier => 0.5;
|
||||
public override bool Ranked => true;
|
||||
|
@ -9,6 +9,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public override string Name => "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 bool Ranked => true;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public override string Name => "Half Time";
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_halftime;
|
||||
public override ModType Type => ModType.DifficultyReduction;
|
||||
public override string Description => "Less zoom";
|
||||
public override bool Ranked => true;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime) };
|
||||
|
@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public override string Name => "Hard Rock";
|
||||
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 Type[] IncompatibleMods => new[] { typeof(ModEasy) };
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public override string Name => "Hidden";
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden;
|
||||
public override ModType Type => ModType.DifficultyIncrease;
|
||||
public override bool Ranked => true;
|
||||
}
|
||||
}
|
@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public override string Name => "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 double ScoreMultiplier => 0.5;
|
||||
public override bool Ranked => true;
|
||||
|
@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public override string Name => "Sudden Death";
|
||||
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 double ScoreMultiplier => 1;
|
||||
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