mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 01:02:56 +08:00
Merge remote-tracking branch 'upstream/master' into tournament-tools
This commit is contained in:
commit
0f1ffe392f
7
.gitignore
vendored
7
.gitignore
vendored
@ -10,6 +10,10 @@
|
|||||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
*.userprefs
|
*.userprefs
|
||||||
|
|
||||||
|
### Cake ###
|
||||||
|
tools/*
|
||||||
|
!tools/cakebuild.csproj
|
||||||
|
|
||||||
# Build results
|
# Build results
|
||||||
bin/[Dd]ebug/
|
bin/[Dd]ebug/
|
||||||
[Dd]ebugPublic/
|
[Dd]ebugPublic/
|
||||||
@ -98,6 +102,7 @@ $tf/
|
|||||||
_ReSharper*/
|
_ReSharper*/
|
||||||
*.[Rr]e[Ss]harper
|
*.[Rr]e[Ss]harper
|
||||||
*.DotSettings.user
|
*.DotSettings.user
|
||||||
|
inspectcode
|
||||||
|
|
||||||
# JustCode is a .NET coding add-in
|
# JustCode is a .NET coding add-in
|
||||||
.JustCode
|
.JustCode
|
||||||
@ -257,3 +262,5 @@ paket-files/
|
|||||||
__pycache__/
|
__pycache__/
|
||||||
*.pyc
|
*.pyc
|
||||||
Staging/
|
Staging/
|
||||||
|
|
||||||
|
inspectcodereport.xml
|
||||||
|
@ -25,6 +25,7 @@ Build and run
|
|||||||
|
|
||||||
- Using Visual Studio 2017, Rider or Visual Studio Code (configurations are included)
|
- Using Visual Studio 2017, Rider or Visual Studio Code (configurations are included)
|
||||||
- From command line using `dotnet run --project osu.Desktop`. When building for non-development purposes, add `-c Release` to gain higher performance.
|
- From command line using `dotnet run --project osu.Desktop`. When building for non-development purposes, add `-c Release` to gain higher performance.
|
||||||
|
- To run with code analysis, instead use `powershell ./build.ps1` or `build.sh`. This is currently only supported under windows due to [resharper cli shortcomings](https://youtrack.jetbrains.com/issue/RSRP-410004). Alternative, you can install resharper or use rider to get inline support in your IDE of choice.
|
||||||
|
|
||||||
Note: If you run from command line under linux, you will need to prefix the output folder to your `LD_LIBRARY_PATH`. See `.vscode/launch.json` for an example
|
Note: If you run from command line under linux, you will need to prefix the output folder to your `LD_LIBRARY_PATH`. See `.vscode/launch.json` for an example
|
||||||
|
|
||||||
|
20
appveyor.yml
20
appveyor.yml
@ -1,22 +1,8 @@
|
|||||||
clone_depth: 1
|
clone_depth: 1
|
||||||
version: '{branch}-{build}'
|
version: '{branch}-{build}'
|
||||||
image: Visual Studio 2017
|
image: Visual Studio 2017
|
||||||
configuration: Debug
|
test: off
|
||||||
cache:
|
|
||||||
- C:\ProgramData\chocolatey\bin -> appveyor.yml
|
|
||||||
- C:\ProgramData\chocolatey\lib -> appveyor.yml
|
|
||||||
install:
|
install:
|
||||||
- cmd: git submodule update --init --recursive --depth=5
|
- cmd: git submodule update --init --recursive --depth=5
|
||||||
- cmd: choco install resharper-clt -y
|
build_script:
|
||||||
- cmd: choco install nvika -y
|
- cmd: PowerShell -Version 2.0 .\build.ps1
|
||||||
- cmd: dotnet tool install CodeFileSanity --version 0.0.16 --global
|
|
||||||
before_build:
|
|
||||||
- cmd: CodeFileSanity
|
|
||||||
- cmd: nuget restore -verbosity quiet
|
|
||||||
build:
|
|
||||||
project: osu.sln
|
|
||||||
parallel: true
|
|
||||||
verbosity: minimal
|
|
||||||
after_build:
|
|
||||||
- cmd: inspectcode --o="inspectcodereport.xml" --projects:osu.Game* --caches-home="inspectcode" osu.sln > NUL
|
|
||||||
- cmd: NVika parsereport "inspectcodereport.xml" --treatwarningsaserrors
|
|
||||||
|
72
build.cake
Normal file
72
build.cake
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
#addin "nuget:?package=CodeFileSanity&version=0.0.21"
|
||||||
|
#addin "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2018.2.2"
|
||||||
|
#tool "nuget:?package=NVika.MSBuild&version=1.0.1"
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// ARGUMENTS
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
var target = Argument("target", "Build");
|
||||||
|
var configuration = Argument("configuration", "Release");
|
||||||
|
|
||||||
|
var osuSolution = new FilePath("./osu.sln");
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// TASKS
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
Task("Restore")
|
||||||
|
.Does(() => {
|
||||||
|
DotNetCoreRestore(osuSolution.FullPath);
|
||||||
|
});
|
||||||
|
|
||||||
|
Task("Compile")
|
||||||
|
.IsDependentOn("Restore")
|
||||||
|
.Does(() => {
|
||||||
|
DotNetCoreBuild(osuSolution.FullPath, new DotNetCoreBuildSettings {
|
||||||
|
Configuration = configuration,
|
||||||
|
NoRestore = true,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
Task("Test")
|
||||||
|
.IsDependentOn("Compile")
|
||||||
|
.Does(() => {
|
||||||
|
var testAssemblies = GetFiles("**/*.Tests/bin/**/*.Tests.dll");
|
||||||
|
|
||||||
|
DotNetCoreVSTest(testAssemblies, new DotNetCoreVSTestSettings {
|
||||||
|
Logger = AppVeyor.IsRunningOnAppVeyor ? "Appveyor" : $"trx",
|
||||||
|
Parallel = true,
|
||||||
|
ToolTimeout = TimeSpan.FromMinutes(10),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// windows only because both inspectcore and nvika depend on net45
|
||||||
|
Task("InspectCode")
|
||||||
|
.WithCriteria(IsRunningOnWindows())
|
||||||
|
.IsDependentOn("Compile")
|
||||||
|
.Does(() => {
|
||||||
|
var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First();
|
||||||
|
|
||||||
|
InspectCode(osuSolution, new InspectCodeSettings {
|
||||||
|
CachesHome = "inspectcode",
|
||||||
|
OutputFile = "inspectcodereport.xml",
|
||||||
|
});
|
||||||
|
|
||||||
|
StartProcess(nVikaToolPath, @"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors");
|
||||||
|
});
|
||||||
|
|
||||||
|
Task("CodeFileSanity")
|
||||||
|
.Does(() => {
|
||||||
|
ValidateCodeSanity(new ValidateCodeSanitySettings {
|
||||||
|
RootDirectory = ".",
|
||||||
|
IsAppveyorBuild = AppVeyor.IsRunningOnAppVeyor
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
Task("Build")
|
||||||
|
.IsDependentOn("CodeFileSanity")
|
||||||
|
.IsDependentOn("InspectCode")
|
||||||
|
.IsDependentOn("Test");
|
||||||
|
|
||||||
|
RunTarget(target);
|
79
build.ps1
Normal file
79
build.ps1
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
##########################################################################
|
||||||
|
# This is a customized Cake bootstrapper script for PowerShell.
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
|
<#
|
||||||
|
|
||||||
|
.SYNOPSIS
|
||||||
|
This is a Powershell script to bootstrap a Cake build.
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
This Powershell script restores NuGet tools (including Cake)
|
||||||
|
and execute your Cake build script with the parameters you provide.
|
||||||
|
|
||||||
|
.PARAMETER Script
|
||||||
|
The build script to execute.
|
||||||
|
.PARAMETER Target
|
||||||
|
The build script target to run.
|
||||||
|
.PARAMETER Configuration
|
||||||
|
The build configuration to use.
|
||||||
|
.PARAMETER Verbosity
|
||||||
|
Specifies the amount of information to be displayed.
|
||||||
|
.PARAMETER ShowDescription
|
||||||
|
Shows description about tasks.
|
||||||
|
.PARAMETER DryRun
|
||||||
|
Performs a dry run.
|
||||||
|
.PARAMETER ScriptArgs
|
||||||
|
Remaining arguments are added here.
|
||||||
|
|
||||||
|
.LINK
|
||||||
|
https://cakebuild.net
|
||||||
|
|
||||||
|
#>
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[string]$Script = "build.cake",
|
||||||
|
[string]$Target,
|
||||||
|
[string]$Configuration,
|
||||||
|
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
|
||||||
|
[string]$Verbosity,
|
||||||
|
[switch]$ShowDescription,
|
||||||
|
[Alias("WhatIf", "Noop")]
|
||||||
|
[switch]$DryRun,
|
||||||
|
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
|
||||||
|
[string[]]$ScriptArgs
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-Host "Preparing to run build script..."
|
||||||
|
|
||||||
|
# Determine the script root for resolving other paths.
|
||||||
|
if(!$PSScriptRoot){
|
||||||
|
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||||
|
}
|
||||||
|
|
||||||
|
# Resolve the paths for resources used for debugging.
|
||||||
|
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
|
||||||
|
$CAKE_CSPROJ = Join-Path $TOOLS_DIR "cakebuild.csproj"
|
||||||
|
|
||||||
|
# Install the required tools locally.
|
||||||
|
Write-Host "Restoring cake tools..."
|
||||||
|
Invoke-Expression "dotnet restore `"$CAKE_CSPROJ`" --packages `"$TOOLS_DIR`"" | Out-Null
|
||||||
|
|
||||||
|
# Find the Cake executable
|
||||||
|
$CAKE_EXECUTABLE = (Get-ChildItem -Path ./tools/cake.coreclr/ -Filter Cake.dll -Recurse).FullName
|
||||||
|
|
||||||
|
# Build Cake arguments
|
||||||
|
$cakeArguments = @("$Script");
|
||||||
|
if ($Target) { $cakeArguments += "-target=$Target" }
|
||||||
|
if ($Configuration) { $cakeArguments += "-configuration=$Configuration" }
|
||||||
|
if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
|
||||||
|
if ($ShowDescription) { $cakeArguments += "-showdescription" }
|
||||||
|
if ($DryRun) { $cakeArguments += "-dryrun" }
|
||||||
|
if ($Experimental) { $cakeArguments += "-experimental" }
|
||||||
|
$cakeArguments += $ScriptArgs
|
||||||
|
|
||||||
|
# Start Cake
|
||||||
|
Write-Host "Running build script..."
|
||||||
|
Invoke-Expression "dotnet `"$CAKE_EXECUTABLE`" $cakeArguments"
|
||||||
|
exit $LASTEXITCODE
|
37
build.sh
Normal file
37
build.sh
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##########################################################################
|
||||||
|
# This is a customized Cake bootstrapper script for Shell.
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
|
echo "Preparing to run build script..."
|
||||||
|
|
||||||
|
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||||
|
TOOLS_DIR=$SCRIPT_DIR/tools
|
||||||
|
CAKE_BINARY_PATH=$TOOLS_DIR/"cake.coreclr"
|
||||||
|
|
||||||
|
SCRIPT="build.cake"
|
||||||
|
CAKE_CSPROJ=$TOOLS_DIR/"cakebuild.csproj"
|
||||||
|
|
||||||
|
# Parse arguments.
|
||||||
|
CAKE_ARGUMENTS=()
|
||||||
|
for i in "$@"; do
|
||||||
|
case $1 in
|
||||||
|
-s|--script) SCRIPT="$2"; shift ;;
|
||||||
|
--) shift; CAKE_ARGUMENTS+=("$@"); break ;;
|
||||||
|
*) CAKE_ARGUMENTS+=("$1") ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
# Install the required tools locally.
|
||||||
|
echo "Restoring cake tools..."
|
||||||
|
dotnet restore $CAKE_CSPROJ --packages $TOOLS_DIR > /dev/null 2>&1
|
||||||
|
|
||||||
|
# Search for the CakeBuild binary.
|
||||||
|
CAKE_BINARY=$(find $CAKE_BINARY_PATH -name "Cake.dll")
|
||||||
|
|
||||||
|
# Start Cake
|
||||||
|
echo "Running build script..."
|
||||||
|
|
||||||
|
dotnet "$CAKE_BINARY" $SCRIPT "${CAKE_ARGUMENTS[@]}"
|
5
cake.config
Normal file
5
cake.config
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
[Nuget]
|
||||||
|
Source=https://api.nuget.org/v3/index.json
|
||||||
|
UseInProcessClient=true
|
||||||
|
LoadDependencies=true
|
@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
|
|
||||||
public override PassThroughInputManager CreateInputManager() => new CatchInputManager(Ruleset.RulesetInfo);
|
public override PassThroughInputManager CreateInputManager() => new CatchInputManager(Ruleset.RulesetInfo);
|
||||||
|
|
||||||
protected override DrawableHitObject<CatchHitObject> GetVisualRepresentation(CatchHitObject h)
|
public override DrawableHitObject<CatchHitObject> GetVisualRepresentation(CatchHitObject h)
|
||||||
{
|
{
|
||||||
switch (h)
|
switch (h)
|
||||||
{
|
{
|
||||||
|
@ -1,22 +1,23 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Edit.Tools;
|
using osu.Game.Rulesets.Edit.Tools;
|
||||||
using osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays;
|
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.UI;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Rulesets.Mania.Configuration;
|
using osu.Game.Rulesets.Mania.Configuration;
|
||||||
|
using osu.Game.Rulesets.Mania.Edit.Masks;
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Edit
|
namespace osu.Game.Rulesets.Mania.Edit
|
||||||
{
|
{
|
||||||
public class ManiaHitObjectComposer : HitObjectComposer
|
public class ManiaHitObjectComposer : HitObjectComposer<ManiaHitObject>
|
||||||
{
|
{
|
||||||
protected new ManiaConfigManager Config => (ManiaConfigManager)base.Config;
|
protected new ManiaConfigManager Config => (ManiaConfigManager)base.Config;
|
||||||
|
|
||||||
@ -32,22 +33,19 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
return dependencies;
|
return dependencies;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new ManiaEditRulesetContainer(ruleset, beatmap);
|
protected override RulesetContainer<ManiaHitObject> CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap)
|
||||||
|
=> new ManiaEditRulesetContainer(ruleset, beatmap);
|
||||||
|
|
||||||
protected override IReadOnlyList<ICompositionTool> CompositionTools => new ICompositionTool[]
|
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => Array.Empty<HitObjectCompositionTool>();
|
||||||
{
|
|
||||||
new HitObjectCompositionTool<Note>("Note"),
|
|
||||||
new HitObjectCompositionTool<HoldNote>("Hold"),
|
|
||||||
};
|
|
||||||
|
|
||||||
public override HitObjectMask CreateMaskFor(DrawableHitObject hitObject)
|
public override SelectionMask CreateMaskFor(DrawableHitObject hitObject)
|
||||||
{
|
{
|
||||||
switch (hitObject)
|
switch (hitObject)
|
||||||
{
|
{
|
||||||
case DrawableNote note:
|
case DrawableNote note:
|
||||||
return new NoteMask(note);
|
return new NoteSelectionMask(note);
|
||||||
case DrawableHoldNote holdNote:
|
case DrawableHoldNote holdNote:
|
||||||
return new HoldNoteMask(holdNote);
|
return new HoldNoteSelectionMask(holdNote);
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.CreateMaskFor(hitObject);
|
return base.CreateMaskFor(hitObject);
|
||||||
|
@ -13,9 +13,9 @@ using osu.Game.Rulesets.UI.Scrolling;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
|
namespace osu.Game.Rulesets.Mania.Edit.Masks
|
||||||
{
|
{
|
||||||
public class HoldNoteMask : HitObjectMask
|
public class HoldNoteSelectionMask : SelectionMask
|
||||||
{
|
{
|
||||||
public new DrawableHoldNote HitObject => (DrawableHoldNote)base.HitObject;
|
public new DrawableHoldNote HitObject => (DrawableHoldNote)base.HitObject;
|
||||||
|
|
||||||
@ -23,13 +23,13 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
|
|||||||
|
|
||||||
private readonly BodyPiece body;
|
private readonly BodyPiece body;
|
||||||
|
|
||||||
public HoldNoteMask(DrawableHoldNote hold)
|
public HoldNoteSelectionMask(DrawableHoldNote hold)
|
||||||
: base(hold)
|
: base(hold)
|
||||||
{
|
{
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new HoldNoteNoteMask(hold.Head),
|
new HoldNoteNoteSelectionMask(hold.Head),
|
||||||
new HoldNoteNoteMask(hold.Tail),
|
new HoldNoteNoteSelectionMask(hold.Tail),
|
||||||
body = new BodyPiece
|
body = new BodyPiece
|
||||||
{
|
{
|
||||||
AccentColour = Color4.Transparent
|
AccentColour = Color4.Transparent
|
||||||
@ -59,9 +59,9 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
|
|||||||
Y -= HitObject.Tail.DrawHeight;
|
Y -= HitObject.Tail.DrawHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class HoldNoteNoteMask : NoteMask
|
private class HoldNoteNoteSelectionMask : NoteSelectionMask
|
||||||
{
|
{
|
||||||
public HoldNoteNoteMask(DrawableNote note)
|
public HoldNoteNoteSelectionMask(DrawableNote note)
|
||||||
: base(note)
|
: base(note)
|
||||||
{
|
{
|
||||||
Select();
|
Select();
|
@ -7,11 +7,11 @@ using osu.Game.Rulesets.Edit;
|
|||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
|
namespace osu.Game.Rulesets.Mania.Edit.Masks
|
||||||
{
|
{
|
||||||
public class NoteMask : HitObjectMask
|
public class NoteSelectionMask : SelectionMask
|
||||||
{
|
{
|
||||||
public NoteMask(DrawableNote note)
|
public NoteSelectionMask(DrawableNote note)
|
||||||
: base(note)
|
: base(note)
|
||||||
{
|
{
|
||||||
Scale = note.Scale;
|
Scale = note.Scale;
|
@ -5,13 +5,11 @@ using System.Collections.Generic;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.UI;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Mods
|
namespace osu.Game.Rulesets.Mania.Mods
|
||||||
{
|
{
|
||||||
public class ManiaModDualStages : Mod, IPlayfieldTypeMod, IApplicableToBeatmapConverter, IApplicableToRulesetContainer<ManiaHitObject>
|
public class ManiaModDualStages : Mod, IPlayfieldTypeMod, IApplicableToBeatmapConverter, IApplicableToBeatmap<ManiaHitObject>
|
||||||
{
|
{
|
||||||
public override string Name => "Dual Stages";
|
public override string Name => "Dual Stages";
|
||||||
public override string ShortenedName => "DS";
|
public override string ShortenedName => "DS";
|
||||||
@ -34,22 +32,21 @@ namespace osu.Game.Rulesets.Mania.Mods
|
|||||||
mbc.TargetColumns *= 2;
|
mbc.TargetColumns *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyToRulesetContainer(RulesetContainer<ManiaHitObject> rulesetContainer)
|
public void ApplyToBeatmap(Beatmap<ManiaHitObject> beatmap)
|
||||||
{
|
{
|
||||||
var mrc = (ManiaRulesetContainer)rulesetContainer;
|
|
||||||
|
|
||||||
// Although this can work, for now let's not allow keymods for mania-specific beatmaps
|
|
||||||
if (isForCurrentRuleset)
|
if (isForCurrentRuleset)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var maniaBeatmap = (ManiaBeatmap)beatmap;
|
||||||
|
|
||||||
var newDefinitions = new List<StageDefinition>();
|
var newDefinitions = new List<StageDefinition>();
|
||||||
foreach (var existing in mrc.Beatmap.Stages)
|
foreach (var existing in maniaBeatmap.Stages)
|
||||||
{
|
{
|
||||||
newDefinitions.Add(new StageDefinition { Columns = existing.Columns / 2 });
|
newDefinitions.Add(new StageDefinition { Columns = existing.Columns / 2 });
|
||||||
newDefinitions.Add(new StageDefinition { Columns = existing.Columns / 2 });
|
newDefinitions.Add(new StageDefinition { Columns = existing.Columns / 2 });
|
||||||
}
|
}
|
||||||
|
|
||||||
mrc.Beatmap.Stages = newDefinitions;
|
maniaBeatmap.Stages = newDefinitions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayfieldType PlayfieldType => PlayfieldType.Dual;
|
public PlayfieldType PlayfieldType => PlayfieldType.Dual;
|
||||||
|
@ -96,7 +96,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
public override PassThroughInputManager CreateInputManager() => new ManiaInputManager(Ruleset.RulesetInfo, Variant);
|
public override PassThroughInputManager CreateInputManager() => new ManiaInputManager(Ruleset.RulesetInfo, Variant);
|
||||||
|
|
||||||
protected override DrawableHitObject<ManiaHitObject> GetVisualRepresentation(ManiaHitObject h)
|
public override DrawableHitObject<ManiaHitObject> GetVisualRepresentation(ManiaHitObject h)
|
||||||
{
|
{
|
||||||
switch (h)
|
switch (h)
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
|
{
|
||||||
|
public class TestCaseHitCirclePlacementMask : HitObjectPlacementMaskTestCase
|
||||||
|
{
|
||||||
|
protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableHitCircle((HitCircle)hitObject);
|
||||||
|
protected override PlacementMask CreateMask() => new HitCirclePlacementMask();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
|
{
|
||||||
|
public class TestCaseHitCircleSelectionMask : HitObjectSelectionMaskTestCase
|
||||||
|
{
|
||||||
|
private readonly DrawableHitCircle drawableObject;
|
||||||
|
|
||||||
|
public TestCaseHitCircleSelectionMask()
|
||||||
|
{
|
||||||
|
var hitCircle = new HitCircle { Position = new Vector2(256, 192) };
|
||||||
|
hitCircle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 });
|
||||||
|
|
||||||
|
Add(drawableObject = new DrawableHitCircle(hitCircle));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override SelectionMask CreateMask() => new HitCircleSelectionMask(drawableObject);
|
||||||
|
}
|
||||||
|
}
|
42
osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs
Normal file
42
osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
|
{
|
||||||
|
public class TestCaseSliderSelectionMask : HitObjectSelectionMaskTestCase
|
||||||
|
{
|
||||||
|
private readonly DrawableSlider drawableObject;
|
||||||
|
|
||||||
|
public TestCaseSliderSelectionMask()
|
||||||
|
{
|
||||||
|
var slider = new Slider
|
||||||
|
{
|
||||||
|
Position = new Vector2(256, 192),
|
||||||
|
ControlPoints = new[]
|
||||||
|
{
|
||||||
|
Vector2.Zero,
|
||||||
|
new Vector2(150, 150),
|
||||||
|
new Vector2(300, 0)
|
||||||
|
},
|
||||||
|
CurveType = CurveType.Bezier,
|
||||||
|
Distance = 350
|
||||||
|
};
|
||||||
|
|
||||||
|
slider.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 });
|
||||||
|
|
||||||
|
Add(drawableObject = new DrawableSlider(slider));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override SelectionMask CreateMask() => new SliderSelectionMask(drawableObject);
|
||||||
|
}
|
||||||
|
}
|
@ -43,7 +43,10 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
|
|||||||
Position = positionData?.Position ?? Vector2.Zero,
|
Position = positionData?.Position ?? Vector2.Zero,
|
||||||
NewCombo = comboData?.NewCombo ?? false,
|
NewCombo = comboData?.NewCombo ?? false,
|
||||||
ComboOffset = comboData?.ComboOffset ?? 0,
|
ComboOffset = comboData?.ComboOffset ?? 0,
|
||||||
LegacyLastTickOffset = legacyOffset?.LegacyLastTickOffset
|
LegacyLastTickOffset = legacyOffset?.LegacyLastTickOffset,
|
||||||
|
// prior to v8, speed multipliers don't adjust for how many ticks are generated over the same distance.
|
||||||
|
// this results in more (or less) ticks being generated in <v8 maps for the same time duration.
|
||||||
|
TickDistanceMultiplier = beatmap.BeatmapInfo.BeatmapVersion < 8 ? 1f / beatmap.ControlPointInfo.DifficultyPointAt(original.StartTime).SpeedMultiplier : 1
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if (endTimeData != null)
|
else if (endTimeData != null)
|
||||||
|
@ -75,15 +75,13 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
|||||||
{
|
{
|
||||||
computeSliderCursorPosition(lastSlider);
|
computeSliderCursorPosition(lastSlider);
|
||||||
lastCursorPosition = lastSlider.LazyEndPosition ?? lastCursorPosition;
|
lastCursorPosition = lastSlider.LazyEndPosition ?? lastCursorPosition;
|
||||||
|
|
||||||
|
TravelDistance = lastSlider.LazyTravelDistance * scalingFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't need to jump to reach spinners
|
// Don't need to jump to reach spinners
|
||||||
if (!(BaseObject is Spinner))
|
if (!(BaseObject is Spinner))
|
||||||
JumpDistance = (BaseObject.StackedPosition * scalingFactor - lastCursorPosition * scalingFactor).Length;
|
JumpDistance = (BaseObject.StackedPosition * scalingFactor - lastCursorPosition * scalingFactor).Length;
|
||||||
|
|
||||||
// Todo: BUG!!! Last slider's travel distance is considered ONLY IF we ourselves are also a slider!
|
|
||||||
if (BaseObject is Slider)
|
|
||||||
TravelDistance = (lastSlider?.LazyTravelDistance ?? 0) * scalingFactor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTimingValues()
|
private void setTimingValues()
|
||||||
|
20
osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs
Normal file
20
osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Edit.Tools;
|
||||||
|
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Edit
|
||||||
|
{
|
||||||
|
public class HitCircleCompositionTool : HitObjectCompositionTool
|
||||||
|
{
|
||||||
|
public HitCircleCompositionTool()
|
||||||
|
: base(nameof(HitCircle))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override PlacementMask CreatePlacementMask() => new HitCirclePlacementMask();
|
||||||
|
}
|
||||||
|
}
|
@ -1,37 +0,0 @@
|
|||||||
// Copyright (c) 2007-2018 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.Allocation;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Rulesets.Edit;
|
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
|
|
||||||
{
|
|
||||||
public class HitCircleMask : HitObjectMask
|
|
||||||
{
|
|
||||||
public HitCircleMask(DrawableHitCircle hitCircle)
|
|
||||||
: base(hitCircle)
|
|
||||||
{
|
|
||||||
Origin = Anchor.Centre;
|
|
||||||
|
|
||||||
Position = hitCircle.Position;
|
|
||||||
Size = hitCircle.Size;
|
|
||||||
Scale = hitCircle.Scale;
|
|
||||||
|
|
||||||
CornerRadius = Size.X / 2;
|
|
||||||
|
|
||||||
AddInternal(new RingPiece());
|
|
||||||
|
|
||||||
hitCircle.HitObject.PositionChanged += _ => Position = hitCircle.Position;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours)
|
|
||||||
{
|
|
||||||
Colour = colours.Yellow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
// Copyright (c) 2007-2018 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;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Rulesets.Edit;
|
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
|
||||||
using OpenTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
|
|
||||||
{
|
|
||||||
public class SliderCircleMask : HitObjectMask
|
|
||||||
{
|
|
||||||
public SliderCircleMask(DrawableHitCircle sliderHead, DrawableSlider slider)
|
|
||||||
: this(sliderHead, Vector2.Zero, slider)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public SliderCircleMask(DrawableSliderTail sliderTail, DrawableSlider slider)
|
|
||||||
: this(sliderTail, ((Slider)slider.HitObject).Curve.PositionAt(1), slider)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly DrawableOsuHitObject hitObject;
|
|
||||||
|
|
||||||
private SliderCircleMask(DrawableOsuHitObject hitObject, Vector2 position, DrawableSlider slider)
|
|
||||||
: base(hitObject)
|
|
||||||
{
|
|
||||||
this.hitObject = hitObject;
|
|
||||||
|
|
||||||
Origin = Anchor.Centre;
|
|
||||||
|
|
||||||
Position = position;
|
|
||||||
Size = slider.HeadCircle.Size;
|
|
||||||
Scale = slider.HeadCircle.Scale;
|
|
||||||
|
|
||||||
AddInternal(new RingPiece());
|
|
||||||
|
|
||||||
Select();
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours)
|
|
||||||
{
|
|
||||||
Colour = colours.Yellow;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
|
||||||
base.Update();
|
|
||||||
|
|
||||||
RelativeAnchorPosition = hitObject.RelativeAnchorPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Todo: This is temporary, since the slider circle masks don't do anything special yet. In the future they will handle input.
|
|
||||||
public override bool HandlePositionalInput => false;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
// Copyright (c) 2007-2018 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;
|
|
||||||
using osu.Framework.Graphics.Primitives;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Rulesets.Edit;
|
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
|
||||||
using OpenTK;
|
|
||||||
using OpenTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
|
|
||||||
{
|
|
||||||
public class SliderMask : HitObjectMask
|
|
||||||
{
|
|
||||||
private readonly SliderBody body;
|
|
||||||
private readonly DrawableSlider slider;
|
|
||||||
|
|
||||||
public SliderMask(DrawableSlider slider)
|
|
||||||
: base(slider)
|
|
||||||
{
|
|
||||||
this.slider = slider;
|
|
||||||
|
|
||||||
Position = slider.Position;
|
|
||||||
|
|
||||||
var sliderObject = (Slider)slider.HitObject;
|
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
|
||||||
{
|
|
||||||
body = new SliderBody(sliderObject)
|
|
||||||
{
|
|
||||||
AccentColour = Color4.Transparent,
|
|
||||||
PathWidth = sliderObject.Scale * 64
|
|
||||||
},
|
|
||||||
new SliderCircleMask(slider.HeadCircle, slider),
|
|
||||||
new SliderCircleMask(slider.TailCircle, slider),
|
|
||||||
};
|
|
||||||
|
|
||||||
sliderObject.PositionChanged += _ => Position = slider.Position;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours)
|
|
||||||
{
|
|
||||||
body.BorderColour = colours.Yellow;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
|
||||||
base.Update();
|
|
||||||
|
|
||||||
Size = slider.Size;
|
|
||||||
OriginPosition = slider.OriginPosition;
|
|
||||||
|
|
||||||
// Need to cause one update
|
|
||||||
body.UpdateProgress(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => body.ReceivePositionalInputAt(screenSpacePos);
|
|
||||||
|
|
||||||
public override Vector2 SelectionPoint => ToScreenSpace(OriginPosition);
|
|
||||||
public override Quad SelectionQuad => body.PathDrawQuad;
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,44 @@
|
|||||||
|
// Copyright (c) 2007-2018 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;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components
|
||||||
|
{
|
||||||
|
public class HitCirclePiece : CompositeDrawable
|
||||||
|
{
|
||||||
|
private readonly HitCircle hitCircle;
|
||||||
|
|
||||||
|
public HitCirclePiece(HitCircle hitCircle)
|
||||||
|
{
|
||||||
|
this.hitCircle = hitCircle;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
|
Size = new Vector2((float)OsuHitObject.OBJECT_RADIUS * 2);
|
||||||
|
Scale = new Vector2(hitCircle.Scale);
|
||||||
|
CornerRadius = Size.X / 2;
|
||||||
|
|
||||||
|
InternalChild = new RingPiece();
|
||||||
|
|
||||||
|
hitCircle.PositionChanged += _ => UpdatePosition();
|
||||||
|
hitCircle.StackHeightChanged += _ => UpdatePosition();
|
||||||
|
hitCircle.ScaleChanged += _ => Scale = new Vector2(hitCircle.Scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
Colour = colours.Yellow;
|
||||||
|
|
||||||
|
UpdatePosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void UpdatePosition() => Position = hitCircle.StackedPosition;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks
|
||||||
|
{
|
||||||
|
public class HitCirclePlacementMask : PlacementMask
|
||||||
|
{
|
||||||
|
public new HitCircle HitObject => (HitCircle)base.HitObject;
|
||||||
|
|
||||||
|
public HitCirclePlacementMask()
|
||||||
|
: base(new HitCircle())
|
||||||
|
{
|
||||||
|
InternalChild = new HitCirclePiece(HitObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
// Fixes a 1-frame position discrpancy due to the first mouse move event happening in the next frame
|
||||||
|
HitObject.Position = GetContainingInputManager().CurrentState.Mouse.Position;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnClick(ClickEvent e)
|
||||||
|
{
|
||||||
|
HitObject.StartTime = EditorClock.CurrentTime;
|
||||||
|
EndPlacement();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnMouseMove(MouseMoveEvent e)
|
||||||
|
{
|
||||||
|
HitObject.Position = e.MousePosition;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks
|
||||||
|
{
|
||||||
|
public class HitCircleSelectionMask : SelectionMask
|
||||||
|
{
|
||||||
|
public HitCircleSelectionMask(DrawableHitCircle hitCircle)
|
||||||
|
: base(hitCircle)
|
||||||
|
{
|
||||||
|
InternalChild = new HitCirclePiece((HitCircle)hitCircle.HitObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
// Copyright (c) 2007-2018 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.Containers;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components
|
||||||
|
{
|
||||||
|
public class SliderBodyPiece : CompositeDrawable
|
||||||
|
{
|
||||||
|
private readonly Slider slider;
|
||||||
|
private readonly SnakingSliderBody body;
|
||||||
|
|
||||||
|
public SliderBodyPiece(Slider slider)
|
||||||
|
{
|
||||||
|
this.slider = slider;
|
||||||
|
InternalChild = body = new SnakingSliderBody(slider)
|
||||||
|
{
|
||||||
|
AccentColour = Color4.Transparent,
|
||||||
|
PathWidth = slider.Scale * 64
|
||||||
|
};
|
||||||
|
|
||||||
|
slider.PositionChanged += _ => updatePosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
body.BorderColour = colours.Yellow;
|
||||||
|
|
||||||
|
updatePosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updatePosition() => Position = slider.StackedPosition;
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
Size = body.Size;
|
||||||
|
OriginPosition = body.PathOffset;
|
||||||
|
|
||||||
|
// Need to cause one update
|
||||||
|
body.UpdateProgress(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components
|
||||||
|
{
|
||||||
|
public class SliderCirclePiece : HitCirclePiece
|
||||||
|
{
|
||||||
|
private readonly Slider slider;
|
||||||
|
private readonly SliderPosition position;
|
||||||
|
|
||||||
|
public SliderCirclePiece(Slider slider, SliderPosition position)
|
||||||
|
: base(slider.HeadCircle)
|
||||||
|
{
|
||||||
|
this.slider = slider;
|
||||||
|
this.position = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdatePosition()
|
||||||
|
{
|
||||||
|
switch (position)
|
||||||
|
{
|
||||||
|
case SliderPosition.Start:
|
||||||
|
Position = slider.StackedPosition + slider.Curve.PositionAt(0);
|
||||||
|
break;
|
||||||
|
case SliderPosition.End:
|
||||||
|
Position = slider.StackedPosition + slider.Curve.PositionAt(1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks
|
||||||
|
{
|
||||||
|
public class SliderCircleSelectionMask : SelectionMask
|
||||||
|
{
|
||||||
|
public SliderCircleSelectionMask(DrawableOsuHitObject hitObject, Slider slider, SliderPosition position)
|
||||||
|
: base(hitObject)
|
||||||
|
{
|
||||||
|
InternalChild = new SliderCirclePiece(slider, position);
|
||||||
|
|
||||||
|
Select();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Todo: This is temporary, since the slider circle masks don't do anything special yet. In the future they will handle input.
|
||||||
|
public override bool HandlePositionalInput => false;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks
|
||||||
|
{
|
||||||
|
public enum SliderPosition
|
||||||
|
{
|
||||||
|
Start,
|
||||||
|
End
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
// Copyright (c) 2007-2018 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.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks
|
||||||
|
{
|
||||||
|
public class SliderSelectionMask : SelectionMask
|
||||||
|
{
|
||||||
|
private readonly SliderCircleSelectionMask headMask;
|
||||||
|
|
||||||
|
public SliderSelectionMask(DrawableSlider slider)
|
||||||
|
: base(slider)
|
||||||
|
{
|
||||||
|
var sliderObject = (Slider)slider.HitObject;
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
new SliderBodyPiece(sliderObject),
|
||||||
|
headMask = new SliderCircleSelectionMask(slider.HeadCircle, sliderObject, SliderPosition.Start),
|
||||||
|
new SliderCircleSelectionMask(slider.TailCircle, sliderObject, SliderPosition.End),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Vector2 SelectionPoint => headMask.SelectionPoint;
|
||||||
|
}
|
||||||
|
}
|
@ -8,7 +8,8 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Edit.Tools;
|
using osu.Game.Rulesets.Edit.Tools;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays;
|
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks;
|
||||||
|
using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Osu.UI;
|
using osu.Game.Rulesets.Osu.UI;
|
||||||
@ -16,32 +17,31 @@ using osu.Game.Rulesets.UI;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit
|
namespace osu.Game.Rulesets.Osu.Edit
|
||||||
{
|
{
|
||||||
public class OsuHitObjectComposer : HitObjectComposer
|
public class OsuHitObjectComposer : HitObjectComposer<OsuHitObject>
|
||||||
{
|
{
|
||||||
public OsuHitObjectComposer(Ruleset ruleset)
|
public OsuHitObjectComposer(Ruleset ruleset)
|
||||||
: base(ruleset)
|
: base(ruleset)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new OsuEditRulesetContainer(ruleset, beatmap);
|
protected override RulesetContainer<OsuHitObject> CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap)
|
||||||
|
=> new OsuEditRulesetContainer(ruleset, beatmap);
|
||||||
|
|
||||||
protected override IReadOnlyList<ICompositionTool> CompositionTools => new ICompositionTool[]
|
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new[]
|
||||||
{
|
{
|
||||||
new HitObjectCompositionTool<HitCircle>(),
|
new HitCircleCompositionTool(),
|
||||||
new HitObjectCompositionTool<Slider>(),
|
|
||||||
new HitObjectCompositionTool<Spinner>()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
protected override Container CreateLayerContainer() => new PlayfieldAdjustmentContainer { RelativeSizeAxes = Axes.Both };
|
protected override Container CreateLayerContainer() => new PlayfieldAdjustmentContainer { RelativeSizeAxes = Axes.Both };
|
||||||
|
|
||||||
public override HitObjectMask CreateMaskFor(DrawableHitObject hitObject)
|
public override SelectionMask CreateMaskFor(DrawableHitObject hitObject)
|
||||||
{
|
{
|
||||||
switch (hitObject)
|
switch (hitObject)
|
||||||
{
|
{
|
||||||
case DrawableHitCircle circle:
|
case DrawableHitCircle circle:
|
||||||
return new HitCircleMask(circle);
|
return new HitCircleSelectionMask(circle);
|
||||||
case DrawableSlider slider:
|
case DrawableSlider slider:
|
||||||
return new SliderMask(slider);
|
return new SliderSelectionMask(slider);
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.CreateMaskFor(hitObject);
|
return base.CreateMaskFor(hitObject);
|
||||||
|
@ -61,6 +61,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
Size = circle.DrawSize;
|
Size = circle.DrawSize;
|
||||||
|
|
||||||
HitObject.PositionChanged += _ => Position = HitObject.StackedPosition;
|
HitObject.PositionChanged += _ => Position = HitObject.StackedPosition;
|
||||||
|
HitObject.StackHeightChanged += _ => Position = HitObject.StackedPosition;
|
||||||
|
HitObject.ScaleChanged += s => Scale = new Vector2(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Color4 AccentColour
|
public override Color4 AccentColour
|
||||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
public readonly DrawableHitCircle HeadCircle;
|
public readonly DrawableHitCircle HeadCircle;
|
||||||
public readonly DrawableSliderTail TailCircle;
|
public readonly DrawableSliderTail TailCircle;
|
||||||
|
|
||||||
public readonly SliderBody Body;
|
public readonly SnakingSliderBody Body;
|
||||||
public readonly SliderBall Ball;
|
public readonly SliderBall Ball;
|
||||||
|
|
||||||
public DrawableSlider(Slider s)
|
public DrawableSlider(Slider s)
|
||||||
@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
Body = new SliderBody(s)
|
Body = new SnakingSliderBody(s)
|
||||||
{
|
{
|
||||||
PathWidth = s.Scale * 64,
|
PathWidth = s.Scale * 64,
|
||||||
},
|
},
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="SliderBody"/> with the ability to set the drawn vertices manually.
|
||||||
|
/// </summary>
|
||||||
|
public class ManualSliderBody : SliderBody
|
||||||
|
{
|
||||||
|
public new void SetVertices(IReadOnlyList<Vector2> vertices)
|
||||||
|
{
|
||||||
|
base.SetVertices(vertices);
|
||||||
|
Size = Path.Size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,6 @@
|
|||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
@ -14,7 +13,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
{
|
{
|
||||||
public class NumberPiece : Container
|
public class NumberPiece : Container
|
||||||
{
|
{
|
||||||
private readonly SpriteText number;
|
private readonly SkinnableSpriteText number;
|
||||||
|
|
||||||
public string Text
|
public string Text
|
||||||
{
|
{
|
||||||
@ -41,15 +40,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
},
|
},
|
||||||
Child = new Box()
|
Child = new Box()
|
||||||
}, s => s.GetTexture("Play/osu/hitcircle") == null),
|
}, s => s.GetTexture("Play/osu/hitcircle") == null),
|
||||||
number = new OsuSpriteText
|
number = new SkinnableSpriteText("Play/osu/number-text", _ => new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = @"1",
|
|
||||||
Font = @"Venera",
|
Font = @"Venera",
|
||||||
UseFullGlyphHeight = false,
|
UseFullGlyphHeight = false,
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
TextSize = 40,
|
TextSize = 40,
|
||||||
Alpha = 1
|
}, restrictSize: false)
|
||||||
|
{
|
||||||
|
Text = @"1"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,22 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Lines;
|
using osu.Framework.Graphics.Lines;
|
||||||
using OpenTK.Graphics.ES30;
|
|
||||||
using OpenTK.Graphics;
|
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using OpenTK.Graphics.ES30;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||||
{
|
{
|
||||||
public class SliderBody : Container, ISliderProgress
|
public abstract class SliderBody : CompositeDrawable
|
||||||
{
|
{
|
||||||
private readonly SliderPath path;
|
private readonly SliderPath path;
|
||||||
|
protected Path Path => path;
|
||||||
|
|
||||||
private readonly BufferedContainer container;
|
private readonly BufferedContainer container;
|
||||||
|
|
||||||
public float PathWidth
|
public float PathWidth
|
||||||
@ -30,15 +28,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Offset in absolute coordinates from the start of the curve.
|
/// Offset in absolute coordinates from the start of the curve.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2 PathOffset { get; private set; }
|
public virtual Vector2 PathOffset => path.PositionInBoundingBox(path.Vertices[0]);
|
||||||
|
|
||||||
public readonly List<Vector2> CurrentCurve = new List<Vector2>();
|
|
||||||
|
|
||||||
public readonly Bindable<bool> SnakingIn = new Bindable<bool>();
|
|
||||||
public readonly Bindable<bool> SnakingOut = new Bindable<bool>();
|
|
||||||
|
|
||||||
public double? SnakedStart { get; private set; }
|
|
||||||
public double? SnakedEnd { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to colour the path.
|
/// Used to colour the path.
|
||||||
@ -74,28 +64,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
|
|
||||||
public Quad PathDrawQuad => container.ScreenSpaceDrawQuad;
|
public Quad PathDrawQuad => container.ScreenSpaceDrawQuad;
|
||||||
|
|
||||||
private Vector2 topLeftOffset;
|
protected SliderBody()
|
||||||
|
|
||||||
private readonly Slider slider;
|
|
||||||
|
|
||||||
public SliderBody(Slider s)
|
|
||||||
{
|
{
|
||||||
slider = s;
|
InternalChild = container = new BufferedContainer
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
container = new BufferedContainer
|
RelativeSizeAxes = Axes.Both,
|
||||||
{
|
CacheDrawnFrameBuffer = true,
|
||||||
RelativeSizeAxes = Axes.Both,
|
Child = path = new SliderPath { Blending = BlendingMode.None }
|
||||||
CacheDrawnFrameBuffer = true,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
path = new SliderPath
|
|
||||||
{
|
|
||||||
Blending = BlendingMode.None,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
container.Attach(RenderbufferInternalFormat.DepthComponent16);
|
container.Attach(RenderbufferInternalFormat.DepthComponent16);
|
||||||
@ -103,80 +78,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
|
|
||||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => path.ReceivePositionalInputAt(screenSpacePos);
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => path.ReceivePositionalInputAt(screenSpacePos);
|
||||||
|
|
||||||
public void SetRange(double p0, double p1)
|
/// <summary>
|
||||||
|
/// Sets the vertices of the path which should be drawn by this <see cref="SliderBody"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="vertices">The vertices</param>
|
||||||
|
protected void SetVertices(IReadOnlyList<Vector2> vertices)
|
||||||
{
|
{
|
||||||
if (p0 > p1)
|
path.Vertices = vertices;
|
||||||
MathHelper.Swap(ref p0, ref p1);
|
container.ForceRedraw();
|
||||||
|
|
||||||
if (updateSnaking(p0, p1))
|
|
||||||
{
|
|
||||||
// The path is generated such that its size encloses it. This change of size causes the path
|
|
||||||
// to move around while snaking, so we need to offset it to make sure it maintains the
|
|
||||||
// same position as when it is fully snaked.
|
|
||||||
var newTopLeftOffset = path.PositionInBoundingBox(Vector2.Zero);
|
|
||||||
path.Position = topLeftOffset - newTopLeftOffset;
|
|
||||||
|
|
||||||
container.ForceRedraw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
computeSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void computeSize()
|
|
||||||
{
|
|
||||||
// Generate the entire curve
|
|
||||||
slider.Curve.GetPathToProgress(CurrentCurve, 0, 1);
|
|
||||||
foreach (Vector2 p in CurrentCurve)
|
|
||||||
path.AddVertex(p);
|
|
||||||
|
|
||||||
Size = path.Size;
|
|
||||||
|
|
||||||
topLeftOffset = path.PositionInBoundingBox(Vector2.Zero);
|
|
||||||
PathOffset = path.PositionInBoundingBox(CurrentCurve[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool updateSnaking(double p0, double p1)
|
|
||||||
{
|
|
||||||
if (SnakedStart == p0 && SnakedEnd == p1) return false;
|
|
||||||
|
|
||||||
SnakedStart = p0;
|
|
||||||
SnakedEnd = p1;
|
|
||||||
|
|
||||||
slider.Curve.GetPathToProgress(CurrentCurve, p0, p1);
|
|
||||||
|
|
||||||
path.ClearVertices();
|
|
||||||
foreach (Vector2 p in CurrentCurve)
|
|
||||||
path.AddVertex(p);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateProgress(double completionProgress)
|
|
||||||
{
|
|
||||||
var span = slider.SpanAt(completionProgress);
|
|
||||||
var spanProgress = slider.ProgressAt(completionProgress);
|
|
||||||
|
|
||||||
double start = 0;
|
|
||||||
double end = SnakingIn ? MathHelper.Clamp((Time.Current - (slider.StartTime - slider.TimePreempt)) / slider.TimeFadeIn, 0, 1) : 1;
|
|
||||||
|
|
||||||
if (span >= slider.SpanCount() - 1)
|
|
||||||
{
|
|
||||||
if (Math.Min(span, slider.SpanCount() - 1) % 2 == 1)
|
|
||||||
{
|
|
||||||
start = 0;
|
|
||||||
end = SnakingOut ? spanProgress : 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
start = SnakingOut ? spanProgress : 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SetRange(start, end);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SliderPath : SmoothPath
|
private class SliderPath : SmoothPath
|
||||||
|
@ -0,0 +1,105 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="SliderBody"/> which changes its curve depending on the snaking progress.
|
||||||
|
/// </summary>
|
||||||
|
public class SnakingSliderBody : SliderBody, ISliderProgress
|
||||||
|
{
|
||||||
|
public readonly List<Vector2> CurrentCurve = new List<Vector2>();
|
||||||
|
|
||||||
|
public readonly Bindable<bool> SnakingIn = new Bindable<bool>();
|
||||||
|
public readonly Bindable<bool> SnakingOut = new Bindable<bool>();
|
||||||
|
|
||||||
|
public double? SnakedStart { get; private set; }
|
||||||
|
public double? SnakedEnd { get; private set; }
|
||||||
|
|
||||||
|
public override Vector2 PathOffset => snakedPathOffset;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The top-left position of the path when fully snaked.
|
||||||
|
/// </summary>
|
||||||
|
private Vector2 snakedPosition;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The offset of the path from <see cref="snakedPosition"/> when fully snaked.
|
||||||
|
/// </summary>
|
||||||
|
private Vector2 snakedPathOffset;
|
||||||
|
|
||||||
|
private readonly Slider slider;
|
||||||
|
|
||||||
|
public SnakingSliderBody(Slider slider)
|
||||||
|
{
|
||||||
|
this.slider = slider;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
// Generate the entire curve
|
||||||
|
slider.Curve.GetPathToProgress(CurrentCurve, 0, 1);
|
||||||
|
SetVertices(CurrentCurve);
|
||||||
|
|
||||||
|
// The body is sized to the full path size to avoid excessive autosize computations
|
||||||
|
Size = Path.Size;
|
||||||
|
|
||||||
|
snakedPosition = Path.PositionInBoundingBox(Vector2.Zero);
|
||||||
|
snakedPathOffset = Path.PositionInBoundingBox(Path.Vertices[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateProgress(double completionProgress)
|
||||||
|
{
|
||||||
|
var span = slider.SpanAt(completionProgress);
|
||||||
|
var spanProgress = slider.ProgressAt(completionProgress);
|
||||||
|
|
||||||
|
double start = 0;
|
||||||
|
double end = SnakingIn ? MathHelper.Clamp((Time.Current - (slider.StartTime - slider.TimePreempt)) / slider.TimeFadeIn, 0, 1) : 1;
|
||||||
|
|
||||||
|
if (span >= slider.SpanCount() - 1)
|
||||||
|
{
|
||||||
|
if (Math.Min(span, slider.SpanCount() - 1) % 2 == 1)
|
||||||
|
{
|
||||||
|
start = 0;
|
||||||
|
end = SnakingOut ? spanProgress : 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
start = SnakingOut ? spanProgress : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setRange(start, end);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setRange(double p0, double p1)
|
||||||
|
{
|
||||||
|
if (p0 > p1)
|
||||||
|
MathHelper.Swap(ref p0, ref p1);
|
||||||
|
|
||||||
|
if (SnakedStart == p0 && SnakedEnd == p1) return;
|
||||||
|
|
||||||
|
SnakedStart = p0;
|
||||||
|
SnakedEnd = p1;
|
||||||
|
|
||||||
|
slider.Curve.GetPathToProgress(CurrentCurve, p0, p1);
|
||||||
|
|
||||||
|
SetVertices(CurrentCurve);
|
||||||
|
|
||||||
|
// The bounding box of the path expands as it snakes, which in turn shifts the position of the path.
|
||||||
|
// Depending on the direction of expansion, it may appear as if the path is expanding towards the position of the slider
|
||||||
|
// rather than expanding out from the position of the slider.
|
||||||
|
// To remove this effect, the path's position is shifted towards its final snaked position
|
||||||
|
|
||||||
|
Path.Position = snakedPosition - Path.PositionInBoundingBox(Vector2.Zero);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -16,13 +16,15 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
public const double OBJECT_RADIUS = 64;
|
public const double OBJECT_RADIUS = 64;
|
||||||
|
|
||||||
public event Action<Vector2> PositionChanged;
|
public event Action<Vector2> PositionChanged;
|
||||||
|
public event Action<int> StackHeightChanged;
|
||||||
|
public event Action<float> ScaleChanged;
|
||||||
|
|
||||||
public double TimePreempt = 600;
|
public double TimePreempt = 600;
|
||||||
public double TimeFadeIn = 400;
|
public double TimeFadeIn = 400;
|
||||||
|
|
||||||
private Vector2 position;
|
private Vector2 position;
|
||||||
|
|
||||||
public Vector2 Position
|
public virtual Vector2 Position
|
||||||
{
|
{
|
||||||
get => position;
|
get => position;
|
||||||
set
|
set
|
||||||
@ -44,13 +46,39 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
|
|
||||||
public Vector2 StackedEndPosition => EndPosition + StackOffset;
|
public Vector2 StackedEndPosition => EndPosition + StackOffset;
|
||||||
|
|
||||||
public virtual int StackHeight { get; set; }
|
private int stackHeight;
|
||||||
|
|
||||||
|
public int StackHeight
|
||||||
|
{
|
||||||
|
get => stackHeight;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (stackHeight == value)
|
||||||
|
return;
|
||||||
|
stackHeight = value;
|
||||||
|
|
||||||
|
StackHeightChanged?.Invoke(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Vector2 StackOffset => new Vector2(StackHeight * Scale * -6.4f);
|
public Vector2 StackOffset => new Vector2(StackHeight * Scale * -6.4f);
|
||||||
|
|
||||||
public double Radius => OBJECT_RADIUS * Scale;
|
public double Radius => OBJECT_RADIUS * Scale;
|
||||||
|
|
||||||
public float Scale { get; set; } = 1;
|
private float scale = 1;
|
||||||
|
|
||||||
|
public float Scale
|
||||||
|
{
|
||||||
|
get => scale;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (scale == value)
|
||||||
|
return;
|
||||||
|
scale = value;
|
||||||
|
|
||||||
|
ScaleChanged?.Invoke(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public virtual bool NewCombo { get; set; }
|
public virtual bool NewCombo { get; set; }
|
||||||
|
|
||||||
|
@ -70,6 +70,21 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
set { Curve.Distance = value; }
|
set { Curve.Distance = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Vector2 Position
|
||||||
|
{
|
||||||
|
get => base.Position;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
base.Position = value;
|
||||||
|
|
||||||
|
if (HeadCircle != null)
|
||||||
|
HeadCircle.Position = value;
|
||||||
|
|
||||||
|
if (TailCircle != null)
|
||||||
|
TailCircle.Position = EndPosition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public double? LegacyLastTickOffset { get; set; }
|
public double? LegacyLastTickOffset { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -92,8 +107,21 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public double SpanDuration => Duration / this.SpanCount();
|
public double SpanDuration => Duration / this.SpanCount();
|
||||||
|
|
||||||
public double Velocity;
|
/// <summary>
|
||||||
public double TickDistance;
|
/// Velocity of this <see cref="Slider"/>.
|
||||||
|
/// </summary>
|
||||||
|
public double Velocity { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Spacing between <see cref="SliderTick"/>s of this <see cref="Slider"/>.
|
||||||
|
/// </summary>
|
||||||
|
public double TickDistance { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An extra multiplier that affects the number of <see cref="SliderTick"/>s generated by this <see cref="Slider"/>.
|
||||||
|
/// An increase in this value increases <see cref="TickDistance"/>, which reduces the number of ticks generated.
|
||||||
|
/// </summary>
|
||||||
|
public double TickDistanceMultiplier = 1;
|
||||||
|
|
||||||
public HitCircle HeadCircle;
|
public HitCircle HeadCircle;
|
||||||
public SliderTailCircle TailCircle;
|
public SliderTailCircle TailCircle;
|
||||||
@ -108,7 +136,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier * difficultyPoint.SpeedMultiplier;
|
double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier * difficultyPoint.SpeedMultiplier;
|
||||||
|
|
||||||
Velocity = scoringDistance / timingPoint.BeatLength;
|
Velocity = scoringDistance / timingPoint.BeatLength;
|
||||||
TickDistance = scoringDistance / difficulty.SliderTickRate;
|
TickDistance = scoringDistance / difficulty.SliderTickRate * TickDistanceMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CreateNestedHitObjects()
|
protected override void CreateNestedHitObjects()
|
||||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
|
|
||||||
public override PassThroughInputManager CreateInputManager() => new OsuInputManager(Ruleset.RulesetInfo);
|
public override PassThroughInputManager CreateInputManager() => new OsuInputManager(Ruleset.RulesetInfo);
|
||||||
|
|
||||||
protected override DrawableHitObject<OsuHitObject> GetVisualRepresentation(OsuHitObject h)
|
public override DrawableHitObject<OsuHitObject> GetVisualRepresentation(OsuHitObject h)
|
||||||
{
|
{
|
||||||
switch (h)
|
switch (h)
|
||||||
{
|
{
|
||||||
|
@ -78,7 +78,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
|
|
||||||
protected override Playfield CreatePlayfield() => new TaikoPlayfield(Beatmap.ControlPointInfo);
|
protected override Playfield CreatePlayfield() => new TaikoPlayfield(Beatmap.ControlPointInfo);
|
||||||
|
|
||||||
protected override DrawableHitObject<TaikoHitObject> GetVisualRepresentation(TaikoHitObject h)
|
public override DrawableHitObject<TaikoHitObject> GetVisualRepresentation(TaikoHitObject h)
|
||||||
{
|
{
|
||||||
switch (h)
|
switch (h)
|
||||||
{
|
{
|
||||||
|
@ -8,11 +8,13 @@ using OpenTK.Graphics;
|
|||||||
using osu.Game.Tests.Resources;
|
using osu.Game.Tests.Resources;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
using osu.Game.Beatmaps.Timing;
|
using osu.Game.Beatmaps.Timing;
|
||||||
using osu.Game.Rulesets.Catch.Beatmaps;
|
using osu.Game.Rulesets.Catch.Beatmaps;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Osu.Beatmaps;
|
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
@ -21,6 +23,25 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class LegacyBeatmapDecoderTest
|
public class LegacyBeatmapDecoderTest
|
||||||
{
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestDecodeBeatmapVersion()
|
||||||
|
{
|
||||||
|
using (var resStream = Resource.OpenResource("beatmap-version.osu"))
|
||||||
|
using (var stream = new StreamReader(resStream))
|
||||||
|
{
|
||||||
|
var decoder = Decoder.GetDecoder<Beatmap>(stream);
|
||||||
|
|
||||||
|
stream.BaseStream.Position = 0;
|
||||||
|
stream.DiscardBufferedData();
|
||||||
|
|
||||||
|
var working = new TestWorkingBeatmap(decoder.Decode(stream));
|
||||||
|
|
||||||
|
Assert.AreEqual(6, working.BeatmapInfo.BeatmapVersion);
|
||||||
|
Assert.AreEqual(6, working.Beatmap.BeatmapInfo.BeatmapVersion);
|
||||||
|
Assert.AreEqual(6, working.GetPlayableBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo.BeatmapVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestDecodeBeatmapGeneral()
|
public void TestDecodeBeatmapGeneral()
|
||||||
{
|
{
|
||||||
|
1
osu.Game.Tests/Resources/beatmap-version.osu
Normal file
1
osu.Game.Tests/Resources/beatmap-version.osu
Normal file
@ -0,0 +1 @@
|
|||||||
|
osu file format v6
|
@ -13,14 +13,18 @@ using osu.Game.Rulesets.Edit;
|
|||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Osu.Edit;
|
using osu.Game.Rulesets.Osu.Edit;
|
||||||
|
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks;
|
||||||
|
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Screens.Edit.Screens.Compose;
|
||||||
using osu.Game.Screens.Edit.Screens.Compose.Layers;
|
using osu.Game.Screens.Edit.Screens.Compose.Layers;
|
||||||
using osu.Game.Tests.Beatmaps;
|
using osu.Game.Tests.Beatmaps;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestCaseHitObjectComposer : OsuTestCase
|
[Cached(Type = typeof(IPlacementHandler))]
|
||||||
|
public class TestCaseHitObjectComposer : OsuTestCase, IPlacementHandler
|
||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
@ -29,9 +33,14 @@ namespace osu.Game.Tests.Visual
|
|||||||
typeof(HitObjectComposer),
|
typeof(HitObjectComposer),
|
||||||
typeof(OsuHitObjectComposer),
|
typeof(OsuHitObjectComposer),
|
||||||
typeof(HitObjectMaskLayer),
|
typeof(HitObjectMaskLayer),
|
||||||
typeof(NotNullAttribute)
|
typeof(NotNullAttribute),
|
||||||
|
typeof(HitCirclePiece),
|
||||||
|
typeof(HitCircleSelectionMask),
|
||||||
|
typeof(HitCirclePlacementMask),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private HitObjectComposer composer;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
@ -49,9 +58,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
Vector2.Zero,
|
Vector2.Zero,
|
||||||
new Vector2(216, 0),
|
new Vector2(216, 0),
|
||||||
},
|
},
|
||||||
Distance = 400,
|
Distance = 216,
|
||||||
Velocity = 1,
|
|
||||||
TickDistance = 100,
|
|
||||||
Scale = 0.5f,
|
Scale = 0.5f,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -61,7 +68,15 @@ namespace osu.Game.Tests.Visual
|
|||||||
Dependencies.CacheAs<IAdjustableClock>(clock);
|
Dependencies.CacheAs<IAdjustableClock>(clock);
|
||||||
Dependencies.CacheAs<IFrameBasedClock>(clock);
|
Dependencies.CacheAs<IFrameBasedClock>(clock);
|
||||||
|
|
||||||
Child = new OsuHitObjectComposer(new OsuRuleset());
|
Child = composer = new OsuHitObjectComposer(new OsuRuleset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void BeginPlacement(HitObject hitObject)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EndPlacement(HitObject hitObject) => composer.Add(hitObject);
|
||||||
|
|
||||||
|
public void Delete(HitObject hitObject) => composer.Remove(hitObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ namespace osu.Game.Beatmaps
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
|
|
||||||
//TODO: should be in database
|
|
||||||
public int BeatmapVersion;
|
public int BeatmapVersion;
|
||||||
|
|
||||||
private int? onlineBeatmapID;
|
private int? onlineBeatmapID;
|
||||||
|
@ -148,11 +148,12 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="beatmapSetInfo">The <see cref="BeatmapSetInfo"/> to be downloaded.</param>
|
/// <param name="beatmapSetInfo">The <see cref="BeatmapSetInfo"/> to be downloaded.</param>
|
||||||
/// <param name="noVideo">Whether the beatmap should be downloaded without video. Defaults to false.</param>
|
/// <param name="noVideo">Whether the beatmap should be downloaded without video. Defaults to false.</param>
|
||||||
public void Download(BeatmapSetInfo beatmapSetInfo, bool noVideo = false)
|
/// <returns>Downloading can happen</returns>
|
||||||
|
public bool Download(BeatmapSetInfo beatmapSetInfo, bool noVideo = false)
|
||||||
{
|
{
|
||||||
var existing = GetExistingDownload(beatmapSetInfo);
|
var existing = GetExistingDownload(beatmapSetInfo);
|
||||||
|
|
||||||
if (existing != null || api == null) return;
|
if (existing != null || api == null) return false;
|
||||||
|
|
||||||
if (!api.LocalUser.Value.IsSupporter)
|
if (!api.LocalUser.Value.IsSupporter)
|
||||||
{
|
{
|
||||||
@ -161,7 +162,7 @@ namespace osu.Game.Beatmaps
|
|||||||
Icon = FontAwesome.fa_superpowers,
|
Icon = FontAwesome.fa_superpowers,
|
||||||
Text = "You gotta be an osu!supporter to download for now 'yo"
|
Text = "You gotta be an osu!supporter to download for now 'yo"
|
||||||
});
|
});
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var downloadNotification = new DownloadNotification
|
var downloadNotification = new DownloadNotification
|
||||||
@ -227,6 +228,7 @@ namespace osu.Game.Beatmaps
|
|||||||
// don't run in the main api queue as this is a long-running task.
|
// don't run in the main api queue as this is a long-running task.
|
||||||
Task.Factory.StartNew(() => request.Perform(api), TaskCreationOptions.LongRunning);
|
Task.Factory.StartNew(() => request.Perform(api), TaskCreationOptions.LongRunning);
|
||||||
BeatmapDownloadBegan?.Invoke(request);
|
BeatmapDownloadBegan?.Invoke(request);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PresentCompletedImport(IEnumerable<BeatmapSetInfo> imported)
|
protected override void PresentCompletedImport(IEnumerable<BeatmapSetInfo> imported)
|
||||||
@ -348,7 +350,7 @@ namespace osu.Game.Beatmaps
|
|||||||
OnlineBeatmapSetID = beatmap.BeatmapInfo.BeatmapSet?.OnlineBeatmapSetID,
|
OnlineBeatmapSetID = beatmap.BeatmapInfo.BeatmapSet?.OnlineBeatmapSetID,
|
||||||
Beatmaps = new List<BeatmapInfo>(),
|
Beatmaps = new List<BeatmapInfo>(),
|
||||||
Hash = computeBeatmapSetHash(reader),
|
Hash = computeBeatmapSetHash(reader),
|
||||||
Metadata = beatmap.Metadata
|
Metadata = beatmap.Metadata,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,9 +71,11 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
if (DownloadState.Value > DownloadStatus.NotDownloaded)
|
if (DownloadState.Value > DownloadStatus.NotDownloaded)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
beatmaps.Download(set, noVideo);
|
if (beatmaps.Download(set, noVideo))
|
||||||
|
{
|
||||||
DownloadState.Value = DownloadStatus.Downloading;
|
// Only change state if download can happen
|
||||||
|
DownloadState.Value = DownloadStatus.Downloading;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAdded(BeatmapSetInfo s)
|
private void setAdded(BeatmapSetInfo s)
|
||||||
|
@ -41,8 +41,13 @@ namespace osu.Game.Beatmaps
|
|||||||
beatmap = new RecyclableLazy<IBeatmap>(() =>
|
beatmap = new RecyclableLazy<IBeatmap>(() =>
|
||||||
{
|
{
|
||||||
var b = GetBeatmap() ?? new Beatmap();
|
var b = GetBeatmap() ?? new Beatmap();
|
||||||
// use the database-backed info.
|
|
||||||
|
// The original beatmap version needs to be preserved as the database doesn't contain it
|
||||||
|
BeatmapInfo.BeatmapVersion = b.BeatmapInfo.BeatmapVersion;
|
||||||
|
|
||||||
|
// Use the database-backed info for more up-to-date values (beatmap id, ranked status, etc)
|
||||||
b.BeatmapInfo = BeatmapInfo;
|
b.BeatmapInfo = BeatmapInfo;
|
||||||
|
|
||||||
return b;
|
return b;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Direct;
|
using osu.Game.Overlays.Direct;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
|
||||||
namespace osu.Game.Online.API.Requests
|
namespace osu.Game.Online.API.Requests
|
||||||
{
|
{
|
||||||
public class SearchBeatmapSetsRequest : APIRequest<IEnumerable<APIBeatmapSet>>
|
public class SearchBeatmapSetsRequest : APIRequest<SearchBeatmapSetsResponse>
|
||||||
{
|
{
|
||||||
private readonly string query;
|
private readonly string query;
|
||||||
private readonly RulesetInfo ruleset;
|
private readonly RulesetInfo ruleset;
|
||||||
@ -35,6 +33,7 @@ namespace osu.Game.Online.API.Requests
|
|||||||
public enum BeatmapSearchCategory
|
public enum BeatmapSearchCategory
|
||||||
{
|
{
|
||||||
Any = 7,
|
Any = 7,
|
||||||
|
|
||||||
[Description("Ranked & Approved")]
|
[Description("Ranked & Approved")]
|
||||||
RankedApproved = 0,
|
RankedApproved = 0,
|
||||||
Approved = 1,
|
Approved = 1,
|
||||||
@ -43,6 +42,7 @@ namespace osu.Game.Online.API.Requests
|
|||||||
Qualified = 3,
|
Qualified = 3,
|
||||||
Pending = 4,
|
Pending = 4,
|
||||||
Graveyard = 5,
|
Graveyard = 5,
|
||||||
|
|
||||||
[Description("My Maps")]
|
[Description("My Maps")]
|
||||||
MyMaps = 6,
|
MyMaps = 6,
|
||||||
}
|
}
|
||||||
|
20
osu.Game/Online/API/Requests/SearchBeatmapSetsResponse.cs
Normal file
20
osu.Game/Online/API/Requests/SearchBeatmapSetsResponse.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
|
||||||
|
namespace osu.Game.Online.API.Requests
|
||||||
|
{
|
||||||
|
public class SearchBeatmapSetsResponse
|
||||||
|
{
|
||||||
|
public IEnumerable<APIBeatmapSet> BeatmapSets;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A collection of parameters which should be passed to the search endpoint to fetch the next page.
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("cursor")]
|
||||||
|
public dynamic CursorJson;
|
||||||
|
}
|
||||||
|
}
|
@ -288,7 +288,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
var sets = response.Select(r => r.ToBeatmapSet(rulesets)).ToList();
|
var sets = response.BeatmapSets.Select(r => r.ToBeatmapSet(rulesets)).ToList();
|
||||||
|
|
||||||
// may not need scheduling; loads async internally.
|
// may not need scheduling; loads async internally.
|
||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
|
106
osu.Game/Rulesets/Edit/EditRulesetContainer.cs
Normal file
106
osu.Game/Rulesets/Edit/EditRulesetContainer.cs
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Edit
|
||||||
|
{
|
||||||
|
public abstract class EditRulesetContainer : CompositeDrawable
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="Playfield"/> contained by this <see cref="EditRulesetContainer"/>.
|
||||||
|
/// </summary>
|
||||||
|
public abstract Playfield Playfield { get; }
|
||||||
|
|
||||||
|
internal EditRulesetContainer()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a <see cref="HitObject"/> to the <see cref="Beatmap"/> and displays a visual representation of it.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
|
||||||
|
/// <returns>The visual representation of <paramref name="hitObject"/>.</returns>
|
||||||
|
internal abstract DrawableHitObject Add(HitObject hitObject);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes a <see cref="HitObject"/> from the <see cref="Beatmap"/> and the display.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObject">The <see cref="HitObject"/> to remove.</param>
|
||||||
|
/// <returns>The visual representation of the removed <paramref name="hitObject"/>.</returns>
|
||||||
|
internal abstract DrawableHitObject Remove(HitObject hitObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class EditRulesetContainer<TObject> : EditRulesetContainer
|
||||||
|
where TObject : HitObject
|
||||||
|
{
|
||||||
|
public override Playfield Playfield => rulesetContainer.Playfield;
|
||||||
|
|
||||||
|
private Ruleset ruleset => rulesetContainer.Ruleset;
|
||||||
|
private Beatmap<TObject> beatmap => rulesetContainer.Beatmap;
|
||||||
|
|
||||||
|
private readonly RulesetContainer<TObject> rulesetContainer;
|
||||||
|
|
||||||
|
public EditRulesetContainer(RulesetContainer<TObject> rulesetContainer)
|
||||||
|
{
|
||||||
|
this.rulesetContainer = rulesetContainer;
|
||||||
|
|
||||||
|
InternalChild = rulesetContainer;
|
||||||
|
|
||||||
|
Playfield.DisplayJudgements.Value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override DrawableHitObject Add(HitObject hitObject)
|
||||||
|
{
|
||||||
|
var tObject = (TObject)hitObject;
|
||||||
|
|
||||||
|
// Add to beatmap, preserving sorting order
|
||||||
|
var insertionIndex = beatmap.HitObjects.FindLastIndex(h => h.StartTime <= hitObject.StartTime);
|
||||||
|
beatmap.HitObjects.Insert(insertionIndex + 1, tObject);
|
||||||
|
|
||||||
|
// Process object
|
||||||
|
var processor = ruleset.CreateBeatmapProcessor(beatmap);
|
||||||
|
|
||||||
|
processor.PreProcess();
|
||||||
|
tObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BaseDifficulty);
|
||||||
|
processor.PostProcess();
|
||||||
|
|
||||||
|
// Add visual representation
|
||||||
|
var drawableObject = rulesetContainer.GetVisualRepresentation(tObject);
|
||||||
|
|
||||||
|
rulesetContainer.Playfield.Add(drawableObject);
|
||||||
|
rulesetContainer.Playfield.PostProcess();
|
||||||
|
|
||||||
|
return drawableObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override DrawableHitObject Remove(HitObject hitObject)
|
||||||
|
{
|
||||||
|
var tObject = (TObject)hitObject;
|
||||||
|
|
||||||
|
// Remove from beatmap
|
||||||
|
beatmap.HitObjects.Remove(tObject);
|
||||||
|
|
||||||
|
// Process the beatmap
|
||||||
|
var processor = ruleset.CreateBeatmapProcessor(beatmap);
|
||||||
|
|
||||||
|
processor.PreProcess();
|
||||||
|
processor.PostProcess();
|
||||||
|
|
||||||
|
// Remove visual representation
|
||||||
|
var drawableObject = Playfield.AllHitObjects.Single(d => d.HitObject == hitObject);
|
||||||
|
|
||||||
|
rulesetContainer.Playfield.Remove(drawableObject);
|
||||||
|
rulesetContainer.Playfield.PostProcess();
|
||||||
|
|
||||||
|
return drawableObject;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,7 @@ using osu.Framework.Timing;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Configuration;
|
using osu.Game.Rulesets.Configuration;
|
||||||
using osu.Game.Rulesets.Edit.Tools;
|
using osu.Game.Rulesets.Edit.Tools;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Screens.Edit.Screens.Compose.Layers;
|
using osu.Game.Screens.Edit.Screens.Compose.Layers;
|
||||||
@ -22,21 +23,24 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
{
|
{
|
||||||
public abstract class HitObjectComposer : CompositeDrawable
|
public abstract class HitObjectComposer : CompositeDrawable
|
||||||
{
|
{
|
||||||
private readonly Ruleset ruleset;
|
|
||||||
|
|
||||||
public IEnumerable<DrawableHitObject> HitObjects => rulesetContainer.Playfield.AllHitObjects;
|
public IEnumerable<DrawableHitObject> HitObjects => rulesetContainer.Playfield.AllHitObjects;
|
||||||
|
|
||||||
protected ICompositionTool CurrentTool { get; private set; }
|
protected readonly Ruleset Ruleset;
|
||||||
|
|
||||||
|
protected readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
protected IRulesetConfigManager Config { get; private set; }
|
protected IRulesetConfigManager Config { get; private set; }
|
||||||
|
|
||||||
private readonly List<Container> layerContainers = new List<Container>();
|
private readonly List<Container> layerContainers = new List<Container>();
|
||||||
private readonly IBindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
|
||||||
|
|
||||||
private RulesetContainer rulesetContainer;
|
private EditRulesetContainer rulesetContainer;
|
||||||
|
|
||||||
protected HitObjectComposer(Ruleset ruleset)
|
private HitObjectMaskLayer maskLayer;
|
||||||
|
private PlacementContainer placementContainer;
|
||||||
|
|
||||||
|
internal HitObjectComposer(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
this.ruleset = ruleset;
|
Ruleset = ruleset;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
@ -44,11 +48,11 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(IBindableBeatmap beatmap, IFrameBasedClock framedClock)
|
private void load(IBindableBeatmap beatmap, IFrameBasedClock framedClock)
|
||||||
{
|
{
|
||||||
this.beatmap.BindTo(beatmap);
|
Beatmap.BindTo(beatmap);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
rulesetContainer = CreateRulesetContainer(ruleset, beatmap.Value);
|
rulesetContainer = CreateRulesetContainer();
|
||||||
rulesetContainer.Clock = framedClock;
|
rulesetContainer.Clock = framedClock;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@ -57,14 +61,15 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var layerBelowRuleset = new BorderLayer
|
var layerBelowRuleset = CreateLayerContainer();
|
||||||
{
|
layerBelowRuleset.Child = new BorderLayer { RelativeSizeAxes = Axes.Both };
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Child = CreateLayerContainer()
|
|
||||||
};
|
|
||||||
|
|
||||||
var layerAboveRuleset = CreateLayerContainer();
|
var layerAboveRuleset = CreateLayerContainer();
|
||||||
layerAboveRuleset.Child = new HitObjectMaskLayer();
|
layerAboveRuleset.Children = new Drawable[]
|
||||||
|
{
|
||||||
|
maskLayer = new HitObjectMaskLayer(),
|
||||||
|
placementContainer = new PlacementContainer(),
|
||||||
|
};
|
||||||
|
|
||||||
layerContainers.Add(layerBelowRuleset);
|
layerContainers.Add(layerBelowRuleset);
|
||||||
layerContainers.Add(layerAboveRuleset);
|
layerContainers.Add(layerAboveRuleset);
|
||||||
@ -107,8 +112,8 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
};
|
};
|
||||||
|
|
||||||
toolboxCollection.Items =
|
toolboxCollection.Items =
|
||||||
CompositionTools.Select(t => new RadioButton(t.Name, () => setCompositionTool(t)))
|
CompositionTools.Select(t => new RadioButton(t.Name, () => placementContainer.CurrentTool = t))
|
||||||
.Prepend(new RadioButton("Select", () => setCompositionTool(null)))
|
.Prepend(new RadioButton("Select", () => placementContainer.CurrentTool = null))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
toolboxCollection.Items[0].Select();
|
toolboxCollection.Items[0].Select();
|
||||||
@ -119,18 +124,11 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
|
|
||||||
dependencies.CacheAs(this);
|
dependencies.CacheAs(this);
|
||||||
Config = dependencies.Get<RulesetConfigCache>().GetConfigFor(ruleset);
|
Config = dependencies.Get<RulesetConfigCache>().GetConfigFor(Ruleset);
|
||||||
|
|
||||||
return dependencies;
|
return dependencies;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
rulesetContainer.Playfield.DisplayJudgements.Value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
{
|
{
|
||||||
base.UpdateAfterChildren();
|
base.UpdateAfterChildren();
|
||||||
@ -144,17 +142,27 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setCompositionTool(ICompositionTool tool) => CurrentTool = tool;
|
/// <summary>
|
||||||
|
/// Adds a <see cref="HitObject"/> to the <see cref="Beatmaps.Beatmap"/> and visualises it.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
|
||||||
|
public void Add(HitObject hitObject)
|
||||||
|
{
|
||||||
|
maskLayer.AddMaskFor(rulesetContainer.Add(hitObject));
|
||||||
|
placementContainer.Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => ruleset.CreateRulesetContainerWith(beatmap);
|
public void Remove(HitObject hitObject) => maskLayer.RemoveMaskFor(rulesetContainer.Remove(hitObject));
|
||||||
|
|
||||||
protected abstract IReadOnlyList<ICompositionTool> CompositionTools { get; }
|
internal abstract EditRulesetContainer CreateRulesetContainer();
|
||||||
|
|
||||||
|
protected abstract IReadOnlyList<HitObjectCompositionTool> CompositionTools { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a <see cref="HitObjectMask"/> for a specific <see cref="DrawableHitObject"/>.
|
/// Creates a <see cref="SelectionMask"/> for a specific <see cref="DrawableHitObject"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="hitObject">The <see cref="DrawableHitObject"/> to create the overlay for.</param>
|
/// <param name="hitObject">The <see cref="DrawableHitObject"/> to create the overlay for.</param>
|
||||||
public virtual HitObjectMask CreateMaskFor(DrawableHitObject hitObject) => null;
|
public virtual SelectionMask CreateMaskFor(DrawableHitObject hitObject) => null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a <see cref="MaskSelection"/> which outlines <see cref="DrawableHitObject"/>s
|
/// Creates a <see cref="MaskSelection"/> which outlines <see cref="DrawableHitObject"/>s
|
||||||
@ -167,4 +175,18 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual Container CreateLayerContainer() => new Container { RelativeSizeAxes = Axes.Both };
|
protected virtual Container CreateLayerContainer() => new Container { RelativeSizeAxes = Axes.Both };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract class HitObjectComposer<TObject> : HitObjectComposer
|
||||||
|
where TObject : HitObject
|
||||||
|
{
|
||||||
|
protected HitObjectComposer(Ruleset ruleset)
|
||||||
|
: base(ruleset)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override EditRulesetContainer CreateRulesetContainer()
|
||||||
|
=> new EditRulesetContainer<TObject>(CreateRulesetContainer(Ruleset, Beatmap.Value));
|
||||||
|
|
||||||
|
protected abstract RulesetContainer<TObject> CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
96
osu.Game/Rulesets/Edit/PlacementMask.cs
Normal file
96
osu.Game/Rulesets/Edit/PlacementMask.cs
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Screens.Edit.Screens.Compose;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Edit
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A mask which governs the creation of a new <see cref="HitObject"/> to actualisation.
|
||||||
|
/// </summary>
|
||||||
|
public abstract class PlacementMask : CompositeDrawable, IRequireHighFrequencyMousePosition
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="HitObject"/> that is being placed.
|
||||||
|
/// </summary>
|
||||||
|
protected readonly HitObject HitObject;
|
||||||
|
|
||||||
|
protected IClock EditorClock { get; private set; }
|
||||||
|
|
||||||
|
private readonly IBindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IPlacementHandler placementHandler { get; set; }
|
||||||
|
|
||||||
|
protected PlacementMask(HitObject hitObject)
|
||||||
|
{
|
||||||
|
HitObject = hitObject;
|
||||||
|
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(IBindableBeatmap beatmap, IAdjustableClock clock)
|
||||||
|
{
|
||||||
|
this.beatmap.BindTo(beatmap);
|
||||||
|
|
||||||
|
EditorClock = clock;
|
||||||
|
|
||||||
|
ApplyDefaultsToHitObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool placementBegun;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Signals that the placement of <see cref="HitObject"/> has started.
|
||||||
|
/// </summary>
|
||||||
|
protected void BeginPlacement()
|
||||||
|
{
|
||||||
|
placementHandler.BeginPlacement(HitObject);
|
||||||
|
placementBegun = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Signals that the placement of <see cref="HitObject"/> has finished.
|
||||||
|
/// This will destroy this <see cref="PlacementMask"/>, and add the <see cref="HitObject"/> to the <see cref="Beatmap"/>.
|
||||||
|
/// </summary>
|
||||||
|
protected void EndPlacement()
|
||||||
|
{
|
||||||
|
if (!placementBegun)
|
||||||
|
BeginPlacement();
|
||||||
|
placementHandler.EndPlacement(HitObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invokes <see cref="HitObject.ApplyDefaults"/>, refreshing <see cref="HitObject.NestedHitObjects"/> and parameters for the <see cref="HitObject"/>.
|
||||||
|
/// </summary>
|
||||||
|
protected void ApplyDefaultsToHitObject() => HitObject.ApplyDefaults(beatmap.Value.Beatmap.ControlPointInfo, beatmap.Value.Beatmap.BeatmapInfo.BaseDifficulty);
|
||||||
|
|
||||||
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent?.ReceivePositionalInputAt(screenSpacePos) ?? false;
|
||||||
|
|
||||||
|
protected override bool Handle(UIEvent e)
|
||||||
|
{
|
||||||
|
base.Handle(e);
|
||||||
|
|
||||||
|
switch (e)
|
||||||
|
{
|
||||||
|
case ScrollEvent _:
|
||||||
|
return false;
|
||||||
|
case MouseEvent _:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
@ -16,31 +17,31 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A mask placed above a <see cref="DrawableHitObject"/> adding editing functionality.
|
/// A mask placed above a <see cref="DrawableHitObject"/> adding editing functionality.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class HitObjectMask : CompositeDrawable, IStateful<SelectionState>
|
public class SelectionMask : CompositeDrawable, IStateful<SelectionState>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when this <see cref="HitObjectMask"/> has been selected.
|
/// Invoked when this <see cref="SelectionMask"/> has been selected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<HitObjectMask> Selected;
|
public event Action<SelectionMask> Selected;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when this <see cref="HitObjectMask"/> has been deselected.
|
/// Invoked when this <see cref="SelectionMask"/> has been deselected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<HitObjectMask> Deselected;
|
public event Action<SelectionMask> Deselected;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when this <see cref="HitObjectMask"/> has requested selection.
|
/// Invoked when this <see cref="SelectionMask"/> has requested selection.
|
||||||
/// Will fire even if already selected. Does not actually perform selection.
|
/// Will fire even if already selected. Does not actually perform selection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<HitObjectMask, InputState> SelectionRequested;
|
public event Action<SelectionMask, InputState> SelectionRequested;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when this <see cref="HitObjectMask"/> has requested drag.
|
/// Invoked when this <see cref="SelectionMask"/> has requested drag.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<HitObjectMask, Vector2, InputState> DragRequested;
|
public event Action<SelectionMask, Vector2, InputState> DragRequested;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="DrawableHitObject"/> which this <see cref="HitObjectMask"/> applies to.
|
/// The <see cref="DrawableHitObject"/> which this <see cref="SelectionMask"/> applies to.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly DrawableHitObject HitObject;
|
public readonly DrawableHitObject HitObject;
|
||||||
|
|
||||||
@ -48,10 +49,12 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
public override bool HandlePositionalInput => ShouldBeAlive;
|
public override bool HandlePositionalInput => ShouldBeAlive;
|
||||||
public override bool RemoveWhenNotAlive => false;
|
public override bool RemoveWhenNotAlive => false;
|
||||||
|
|
||||||
public HitObjectMask(DrawableHitObject hitObject)
|
public SelectionMask(DrawableHitObject hitObject)
|
||||||
{
|
{
|
||||||
HitObject = hitObject;
|
HitObject = hitObject;
|
||||||
|
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
AlwaysPresent = true;
|
AlwaysPresent = true;
|
||||||
Alpha = 0;
|
Alpha = 0;
|
||||||
}
|
}
|
||||||
@ -83,17 +86,19 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Selects this <see cref="HitObjectMask"/>, causing it to become visible.
|
/// Selects this <see cref="SelectionMask"/>, causing it to become visible.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Select() => State = SelectionState.Selected;
|
public void Select() => State = SelectionState.Selected;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deselects this <see cref="HitObjectMask"/>, causing it to become invisible.
|
/// Deselects this <see cref="SelectionMask"/>, causing it to become invisible.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Deselect() => State = SelectionState.NotSelected;
|
public void Deselect() => State = SelectionState.NotSelected;
|
||||||
|
|
||||||
public bool IsSelected => State == SelectionState.Selected;
|
public bool IsSelected => State == SelectionState.Selected;
|
||||||
|
|
||||||
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => HitObject.ReceivePositionalInputAt(screenSpacePos);
|
||||||
|
|
||||||
private bool selectionRequested;
|
private bool selectionRequested;
|
||||||
|
|
||||||
protected override bool OnMouseDown(MouseDownEvent e)
|
protected override bool OnMouseDown(MouseDownEvent e)
|
||||||
@ -130,13 +135,13 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The screen-space point that causes this <see cref="HitObjectMask"/> to be selected.
|
/// The screen-space point that causes this <see cref="SelectionMask"/> to be selected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual Vector2 SelectionPoint => ScreenSpaceDrawQuad.Centre;
|
public virtual Vector2 SelectionPoint => HitObject.ScreenSpaceDrawQuad.Centre;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The screen-space quad that outlines this <see cref="HitObjectMask"/> for selections.
|
/// The screen-space quad that outlines this <see cref="SelectionMask"/> for selections.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual Quad SelectionQuad => ScreenSpaceDrawQuad;
|
public virtual Quad SelectionQuad => HitObject.ScreenSpaceDrawQuad;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,23 +1,17 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Edit.Tools
|
namespace osu.Game.Rulesets.Edit.Tools
|
||||||
{
|
{
|
||||||
public class HitObjectCompositionTool<T> : ICompositionTool
|
public abstract class HitObjectCompositionTool
|
||||||
where T : HitObject
|
|
||||||
{
|
{
|
||||||
public string Name { get; }
|
public readonly string Name;
|
||||||
|
|
||||||
public HitObjectCompositionTool()
|
protected HitObjectCompositionTool(string name)
|
||||||
: this(typeof(T).Name)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public HitObjectCompositionTool(string name)
|
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract PlacementMask CreatePlacementMask();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Edit.Tools
|
|
||||||
{
|
|
||||||
public interface ICompositionTool
|
|
||||||
{
|
|
||||||
string Name { get; }
|
|
||||||
}
|
|
||||||
}
|
|
22
osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs
Normal file
22
osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mods
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interface for a <see cref="Mod"/> that applies changes to a <see cref="Beatmap"/>
|
||||||
|
/// after conversion and post-processing has completed.
|
||||||
|
/// </summary>
|
||||||
|
public interface IApplicableToBeatmap<TObject> : IApplicableMod
|
||||||
|
where TObject : HitObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Applies this <see cref="IApplicableToBeatmap{TObject}"/> to a <see cref="Beatmap{TObject}"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="beatmap">The <see cref="Beatmap{TObject}"/> to apply to.</param>
|
||||||
|
void ApplyToBeatmap(Beatmap<TObject> beatmap);
|
||||||
|
}
|
||||||
|
}
|
@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly CursorContainer Cursor;
|
public readonly CursorContainer Cursor;
|
||||||
|
|
||||||
protected readonly Ruleset Ruleset;
|
public readonly Ruleset Ruleset;
|
||||||
|
|
||||||
protected IRulesetConfigManager Config { get; private set; }
|
protected IRulesetConfigManager Config { get; private set; }
|
||||||
|
|
||||||
@ -238,6 +238,8 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
KeyBindingInputManager = CreateInputManager();
|
KeyBindingInputManager = CreateInputManager();
|
||||||
KeyBindingInputManager.RelativeSizeAxes = Axes.Both;
|
KeyBindingInputManager.RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
applyBeatmapMods(Mods);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -255,16 +257,29 @@ namespace osu.Game.Rulesets.UI
|
|||||||
KeyBindingInputManager.Add(Cursor);
|
KeyBindingInputManager.Add(Cursor);
|
||||||
|
|
||||||
// Apply mods
|
// Apply mods
|
||||||
applyMods(Mods, config);
|
applyRulesetMods(Mods, config);
|
||||||
|
|
||||||
loadObjects();
|
loadObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Applies the active mods to the Beatmap.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mods"></param>
|
||||||
|
private void applyBeatmapMods(IEnumerable<Mod> mods)
|
||||||
|
{
|
||||||
|
if (mods == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (var mod in mods.OfType<IApplicableToBeatmap<TObject>>())
|
||||||
|
mod.ApplyToBeatmap(Beatmap);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Applies the active mods to this RulesetContainer.
|
/// Applies the active mods to this RulesetContainer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mods"></param>
|
/// <param name="mods"></param>
|
||||||
private void applyMods(IEnumerable<Mod> mods, OsuConfigManager config)
|
private void applyRulesetMods(IEnumerable<Mod> mods, OsuConfigManager config)
|
||||||
{
|
{
|
||||||
if (mods == null)
|
if (mods == null)
|
||||||
return;
|
return;
|
||||||
@ -290,17 +305,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
private void loadObjects()
|
private void loadObjects()
|
||||||
{
|
{
|
||||||
foreach (TObject h in Beatmap.HitObjects)
|
foreach (TObject h in Beatmap.HitObjects)
|
||||||
{
|
AddRepresentation(h);
|
||||||
var drawableObject = GetVisualRepresentation(h);
|
|
||||||
|
|
||||||
if (drawableObject == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
drawableObject.OnNewResult += (_, r) => OnNewResult?.Invoke(r);
|
|
||||||
drawableObject.OnRevertResult += (_, r) => OnRevertResult?.Invoke(r);
|
|
||||||
|
|
||||||
Playfield.Add(drawableObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
Playfield.PostProcess();
|
Playfield.PostProcess();
|
||||||
|
|
||||||
@ -308,12 +313,30 @@ namespace osu.Game.Rulesets.UI
|
|||||||
mod.ApplyToDrawableHitObjects(Playfield.HitObjectContainer.Objects);
|
mod.ApplyToDrawableHitObjects(Playfield.HitObjectContainer.Objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates and adds the visual representation of a <see cref="TObject"/> to this <see cref="RulesetContainer{TObject}"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObject">The <see cref="TObject"/> to add the visual representation for.</param>
|
||||||
|
internal void AddRepresentation(TObject hitObject)
|
||||||
|
{
|
||||||
|
var drawableObject = GetVisualRepresentation(hitObject);
|
||||||
|
|
||||||
|
if (drawableObject == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
drawableObject.OnNewResult += (_, r) => OnNewResult?.Invoke(r);
|
||||||
|
drawableObject.OnRevertResult += (_, r) => OnRevertResult?.Invoke(r);
|
||||||
|
|
||||||
|
Playfield.Add(drawableObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a DrawableHitObject from a HitObject.
|
/// Creates a DrawableHitObject from a HitObject.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="h">The HitObject to make drawable.</param>
|
/// <param name="h">The HitObject to make drawable.</param>
|
||||||
/// <returns>The DrawableHitObject.</returns>
|
/// <returns>The DrawableHitObject.</returns>
|
||||||
protected abstract DrawableHitObject<TObject> GetVisualRepresentation(TObject h);
|
public abstract DrawableHitObject<TObject> GetVisualRepresentation(TObject h);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -9,18 +9,21 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Screens.Edit.Screens.Compose.Timeline;
|
using osu.Game.Screens.Edit.Screens.Compose.Timeline;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Screens.Compose
|
namespace osu.Game.Screens.Edit.Screens.Compose
|
||||||
{
|
{
|
||||||
public class Compose : EditorScreen
|
[Cached(Type = typeof(IPlacementHandler))]
|
||||||
|
public class Compose : EditorScreen, IPlacementHandler
|
||||||
{
|
{
|
||||||
private const float vertical_margins = 10;
|
private const float vertical_margins = 10;
|
||||||
private const float horizontal_margins = 20;
|
private const float horizontal_margins = 20;
|
||||||
|
|
||||||
private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
|
private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
|
||||||
|
|
||||||
private Container composerContainer;
|
private HitObjectComposer composer;
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load([CanBeNull] BindableBeatDivisor beatDivisor)
|
private void load([CanBeNull] BindableBeatDivisor beatDivisor)
|
||||||
@ -28,6 +31,8 @@ namespace osu.Game.Screens.Edit.Screens.Compose
|
|||||||
if (beatDivisor != null)
|
if (beatDivisor != null)
|
||||||
this.beatDivisor.BindTo(beatDivisor);
|
this.beatDivisor.BindTo(beatDivisor);
|
||||||
|
|
||||||
|
Container composerContainer;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new GridContainer
|
new GridContainer
|
||||||
@ -101,7 +106,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var composer = ruleset.CreateHitObjectComposer();
|
composer = ruleset.CreateHitObjectComposer();
|
||||||
if (composer == null)
|
if (composer == null)
|
||||||
{
|
{
|
||||||
Logger.Log($"Ruleset {ruleset.Description} doesn't support hitobject composition.");
|
Logger.Log($"Ruleset {ruleset.Description} doesn't support hitobject composition.");
|
||||||
@ -111,5 +116,13 @@ namespace osu.Game.Screens.Edit.Screens.Compose
|
|||||||
|
|
||||||
composerContainer.Child = composer;
|
composerContainer.Child = composer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void BeginPlacement(HitObject hitObject)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EndPlacement(HitObject hitObject) => composer.Add(hitObject);
|
||||||
|
|
||||||
|
public void Delete(HitObject hitObject) => composer.Remove(hitObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
28
osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs
Normal file
28
osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Edit.Screens.Compose
|
||||||
|
{
|
||||||
|
public interface IPlacementHandler
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Notifies that a placement has begun.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObject">The <see cref="HitObject"/> being placed.</param>
|
||||||
|
void BeginPlacement(HitObject hitObject);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Notifies that a placement has finished.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObject">The <see cref="HitObject"/> that has been placed.</param>
|
||||||
|
void EndPlacement(HitObject hitObject);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes a <see cref="HitObject"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObject">The <see cref="HitObject"/> to delete.</param>
|
||||||
|
void Delete(HitObject hitObject);
|
||||||
|
}
|
||||||
|
}
|
@ -14,7 +14,7 @@ using OpenTK.Graphics;
|
|||||||
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A layer that handles and displays drag selection for a collection of <see cref="HitObjectMask"/>s.
|
/// A layer that handles and displays drag selection for a collection of <see cref="SelectionMask"/>s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DragLayer : CompositeDrawable
|
public class DragLayer : CompositeDrawable
|
||||||
{
|
{
|
||||||
@ -30,7 +30,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new <see cref="DragLayer"/>.
|
/// Creates a new <see cref="DragLayer"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="maskContainer">The selectable <see cref="HitObjectMask"/>s.</param>
|
/// <param name="maskContainer">The selectable <see cref="SelectionMask"/>s.</param>
|
||||||
public DragLayer(Action<RectangleF> performSelection)
|
public DragLayer(Action<RectangleF> performSelection)
|
||||||
{
|
{
|
||||||
this.performSelection = performSelection;
|
this.performSelection = performSelection;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -13,7 +14,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
public class HitObjectMaskLayer : CompositeDrawable
|
public class HitObjectMaskLayer : CompositeDrawable
|
||||||
{
|
{
|
||||||
private MaskContainer maskContainer;
|
private MaskContainer maskContainer;
|
||||||
private HitObjectComposer composer;
|
|
||||||
|
[Resolved]
|
||||||
|
private HitObjectComposer composer { get; set; }
|
||||||
|
|
||||||
public HitObjectMaskLayer()
|
public HitObjectMaskLayer()
|
||||||
{
|
{
|
||||||
@ -21,10 +24,8 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(HitObjectComposer composer)
|
private void load()
|
||||||
{
|
{
|
||||||
this.composer = composer;
|
|
||||||
|
|
||||||
maskContainer = new MaskContainer();
|
maskContainer = new MaskContainer();
|
||||||
|
|
||||||
var maskSelection = composer.CreateMaskSelection();
|
var maskSelection = composer.CreateMaskSelection();
|
||||||
@ -48,7 +49,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
};
|
};
|
||||||
|
|
||||||
foreach (var obj in composer.HitObjects)
|
foreach (var obj in composer.HitObjects)
|
||||||
addMask(obj);
|
AddMaskFor(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseDown(MouseDownEvent e)
|
protected override bool OnMouseDown(MouseDownEvent e)
|
||||||
@ -61,7 +62,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
/// Adds a mask for a <see cref="DrawableHitObject"/> which adds movement support.
|
/// Adds a mask for a <see cref="DrawableHitObject"/> which adds movement support.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="hitObject">The <see cref="DrawableHitObject"/> to create a mask for.</param>
|
/// <param name="hitObject">The <see cref="DrawableHitObject"/> to create a mask for.</param>
|
||||||
private void addMask(DrawableHitObject hitObject)
|
public void AddMaskFor(DrawableHitObject hitObject)
|
||||||
{
|
{
|
||||||
var mask = composer.CreateMaskFor(hitObject);
|
var mask = composer.CreateMaskFor(hitObject);
|
||||||
if (mask == null)
|
if (mask == null)
|
||||||
@ -69,5 +70,19 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
|
|
||||||
maskContainer.Add(mask);
|
maskContainer.Add(mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes a mask for a <see cref="DrawableHitObject"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObject">The <see cref="DrawableHitObject"/> for which to remove the mask.</param>
|
||||||
|
public void RemoveMaskFor(DrawableHitObject hitObject)
|
||||||
|
{
|
||||||
|
var maskToRemove = maskContainer.Single(m => m.HitObject == hitObject);
|
||||||
|
if (maskToRemove == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
maskToRemove.Deselect();
|
||||||
|
maskContainer.Remove(maskToRemove);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,36 +13,36 @@ using RectangleF = osu.Framework.Graphics.Primitives.RectangleF;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||||
{
|
{
|
||||||
public class MaskContainer : Container<HitObjectMask>
|
public class MaskContainer : Container<SelectionMask>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when any <see cref="HitObjectMask"/> is selected.
|
/// Invoked when any <see cref="SelectionMask"/> is selected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<HitObjectMask> MaskSelected;
|
public event Action<SelectionMask> MaskSelected;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when any <see cref="HitObjectMask"/> is deselected.
|
/// Invoked when any <see cref="SelectionMask"/> is deselected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<HitObjectMask> MaskDeselected;
|
public event Action<SelectionMask> MaskDeselected;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when any <see cref="HitObjectMask"/> requests selection.
|
/// Invoked when any <see cref="SelectionMask"/> requests selection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<HitObjectMask, InputState> MaskSelectionRequested;
|
public event Action<SelectionMask, InputState> MaskSelectionRequested;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when any <see cref="HitObjectMask"/> requests drag.
|
/// Invoked when any <see cref="SelectionMask"/> requests drag.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<HitObjectMask, Vector2, InputState> MaskDragRequested;
|
public event Action<SelectionMask, Vector2, InputState> MaskDragRequested;
|
||||||
|
|
||||||
private IEnumerable<HitObjectMask> aliveMasks => AliveInternalChildren.Cast<HitObjectMask>();
|
private IEnumerable<SelectionMask> aliveMasks => AliveInternalChildren.Cast<SelectionMask>();
|
||||||
|
|
||||||
public MaskContainer()
|
public MaskContainer()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Add(HitObjectMask drawable)
|
public override void Add(SelectionMask drawable)
|
||||||
{
|
{
|
||||||
if (drawable == null) throw new ArgumentNullException(nameof(drawable));
|
if (drawable == null) throw new ArgumentNullException(nameof(drawable));
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
drawable.DragRequested += onDragRequested;
|
drawable.DragRequested += onDragRequested;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Remove(HitObjectMask drawable)
|
public override bool Remove(SelectionMask drawable)
|
||||||
{
|
{
|
||||||
if (drawable == null) throw new ArgumentNullException(nameof(drawable));
|
if (drawable == null) throw new ArgumentNullException(nameof(drawable));
|
||||||
|
|
||||||
@ -87,33 +87,33 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deselects all selected <see cref="HitObjectMask"/>s.
|
/// Deselects all selected <see cref="SelectionMask"/>s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void DeselectAll() => aliveMasks.ToList().ForEach(m => m.Deselect());
|
public void DeselectAll() => aliveMasks.ToList().ForEach(m => m.Deselect());
|
||||||
|
|
||||||
private void onMaskSelected(HitObjectMask mask)
|
private void onMaskSelected(SelectionMask mask)
|
||||||
{
|
{
|
||||||
MaskSelected?.Invoke(mask);
|
MaskSelected?.Invoke(mask);
|
||||||
ChangeChildDepth(mask, 1);
|
ChangeChildDepth(mask, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onMaskDeselected(HitObjectMask mask)
|
private void onMaskDeselected(SelectionMask mask)
|
||||||
{
|
{
|
||||||
MaskDeselected?.Invoke(mask);
|
MaskDeselected?.Invoke(mask);
|
||||||
ChangeChildDepth(mask, 0);
|
ChangeChildDepth(mask, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSelectionRequested(HitObjectMask mask, InputState state) => MaskSelectionRequested?.Invoke(mask, state);
|
private void onSelectionRequested(SelectionMask mask, InputState state) => MaskSelectionRequested?.Invoke(mask, state);
|
||||||
private void onDragRequested(HitObjectMask mask, Vector2 delta, InputState state) => MaskDragRequested?.Invoke(mask, delta, state);
|
private void onDragRequested(SelectionMask mask, Vector2 delta, InputState state) => MaskDragRequested?.Invoke(mask, delta, state);
|
||||||
|
|
||||||
protected override int Compare(Drawable x, Drawable y)
|
protected override int Compare(Drawable x, Drawable y)
|
||||||
{
|
{
|
||||||
if (!(x is HitObjectMask xMask) || !(y is HitObjectMask yMask))
|
if (!(x is SelectionMask xMask) || !(y is SelectionMask yMask))
|
||||||
return base.Compare(x, y);
|
return base.Compare(x, y);
|
||||||
return Compare(xMask, yMask);
|
return Compare(xMask, yMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Compare(HitObjectMask x, HitObjectMask y)
|
public int Compare(SelectionMask x, SelectionMask y)
|
||||||
{
|
{
|
||||||
// dpeth is used to denote selected status (we always want selected masks to handle input first).
|
// dpeth is used to denote selected status (we always want selected masks to handle input first).
|
||||||
int d = x.Depth.CompareTo(y.Depth);
|
int d = x.Depth.CompareTo(y.Depth);
|
||||||
|
@ -3,32 +3,38 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Input.States;
|
using osu.Framework.Input.States;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Edit.Types;
|
using osu.Game.Rulesets.Edit.Types;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using OpenTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A box which surrounds <see cref="HitObjectMask"/>s and provides interactive handles, context menus etc.
|
/// A box which surrounds <see cref="SelectionMask"/>s and provides interactive handles, context menus etc.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MaskSelection : CompositeDrawable
|
public class MaskSelection : CompositeDrawable
|
||||||
{
|
{
|
||||||
public const float BORDER_RADIUS = 2;
|
public const float BORDER_RADIUS = 2;
|
||||||
|
|
||||||
private readonly List<HitObjectMask> selectedMasks;
|
private readonly List<SelectionMask> selectedMasks;
|
||||||
|
|
||||||
private Drawable outline;
|
private Drawable outline;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IPlacementHandler placementHandler { get; set; }
|
||||||
|
|
||||||
public MaskSelection()
|
public MaskSelection()
|
||||||
{
|
{
|
||||||
selectedMasks = new List<HitObjectMask>();
|
selectedMasks = new List<SelectionMask>();
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
AlwaysPresent = true;
|
AlwaysPresent = true;
|
||||||
@ -54,7 +60,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
|
|
||||||
#region User Input Handling
|
#region User Input Handling
|
||||||
|
|
||||||
public void HandleDrag(HitObjectMask m, Vector2 delta, InputState state)
|
public void HandleDrag(SelectionMask m, Vector2 delta, InputState state)
|
||||||
{
|
{
|
||||||
// Todo: Various forms of snapping
|
// Todo: Various forms of snapping
|
||||||
|
|
||||||
@ -69,6 +75,22 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
|
{
|
||||||
|
if (e.Repeat)
|
||||||
|
return base.OnKeyDown(e);
|
||||||
|
|
||||||
|
switch (e.Key)
|
||||||
|
{
|
||||||
|
case Key.Delete:
|
||||||
|
foreach (var h in selectedMasks.ToList())
|
||||||
|
placementHandler.Delete(h.HitObject.HitObject);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.OnKeyDown(e);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Selection Handling
|
#region Selection Handling
|
||||||
@ -82,13 +104,13 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
/// Handle a mask becoming selected.
|
/// Handle a mask becoming selected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mask">The mask.</param>
|
/// <param name="mask">The mask.</param>
|
||||||
public void HandleSelected(HitObjectMask mask) => selectedMasks.Add(mask);
|
public void HandleSelected(SelectionMask mask) => selectedMasks.Add(mask);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handle a mask becoming deselected.
|
/// Handle a mask becoming deselected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mask">The mask.</param>
|
/// <param name="mask">The mask.</param>
|
||||||
public void HandleDeselected(HitObjectMask mask)
|
public void HandleDeselected(SelectionMask mask)
|
||||||
{
|
{
|
||||||
selectedMasks.Remove(mask);
|
selectedMasks.Remove(mask);
|
||||||
|
|
||||||
@ -101,7 +123,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
/// Handle a mask requesting selection.
|
/// Handle a mask requesting selection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mask">The mask.</param>
|
/// <param name="mask">The mask.</param>
|
||||||
public void HandleSelectionRequested(HitObjectMask mask, InputState state)
|
public void HandleSelectionRequested(SelectionMask mask, InputState state)
|
||||||
{
|
{
|
||||||
if (state.Keyboard.ControlPressed)
|
if (state.Keyboard.ControlPressed)
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
// Copyright (c) 2007-2018 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.Game.Rulesets.Edit.Tools;
|
||||||
|
using Container = System.ComponentModel.Container;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||||
|
{
|
||||||
|
public class PlacementContainer : CompositeDrawable
|
||||||
|
{
|
||||||
|
private readonly Container maskContainer;
|
||||||
|
|
||||||
|
public PlacementContainer()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
}
|
||||||
|
|
||||||
|
private HitObjectCompositionTool currentTool;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The current placement tool.
|
||||||
|
/// </summary>
|
||||||
|
public HitObjectCompositionTool CurrentTool
|
||||||
|
{
|
||||||
|
get => currentTool;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (currentTool == value)
|
||||||
|
return;
|
||||||
|
currentTool = value;
|
||||||
|
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Refreshes the current placement tool.
|
||||||
|
/// </summary>
|
||||||
|
public void Refresh()
|
||||||
|
{
|
||||||
|
ClearInternal();
|
||||||
|
|
||||||
|
var mask = CurrentTool?.CreatePlacementMask();
|
||||||
|
if (mask != null)
|
||||||
|
InternalChild = mask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -134,11 +134,13 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
PlayerSettingsOverlay.Show();
|
PlayerSettingsOverlay.Show();
|
||||||
ModDisplay.FadeIn(200);
|
ModDisplay.FadeIn(200);
|
||||||
|
KeyCounter.Margin = new MarginPadding(10) { Bottom = 30 };
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PlayerSettingsOverlay.Hide();
|
PlayerSettingsOverlay.Hide();
|
||||||
ModDisplay.Delay(2000).FadeOut(200);
|
ModDisplay.Delay(2000).FadeOut(200);
|
||||||
|
KeyCounter.Margin = new MarginPadding(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
private const int bottom_bar_height = 5;
|
private const int bottom_bar_height = 5;
|
||||||
|
|
||||||
private static readonly Vector2 handle_size = new Vector2(14, 25);
|
private static readonly Vector2 handle_size = new Vector2(10, 18);
|
||||||
|
|
||||||
private const float transition_duration = 200;
|
private const float transition_duration = 200;
|
||||||
|
|
||||||
@ -135,6 +135,8 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
bar.FadeTo(allowSeeking ? 1 : 0, transition_duration, Easing.In);
|
bar.FadeTo(allowSeeking ? 1 : 0, transition_duration, Easing.In);
|
||||||
this.MoveTo(new Vector2(0, allowSeeking ? 0 : bottom_bar_height), transition_duration, Easing.In);
|
this.MoveTo(new Vector2(0, allowSeeking ? 0 : bottom_bar_height), transition_duration, Easing.In);
|
||||||
|
|
||||||
|
info.Margin = new MarginPadding { Bottom = Height - (allowSeeking ? 0 : handle_size.Y) };
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
|
@ -307,10 +307,10 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
Alpha = 0;
|
|
||||||
|
|
||||||
InternalChild = textContainer = new FillFlowContainer
|
InternalChild = textContainer = new FillFlowContainer
|
||||||
{
|
{
|
||||||
|
Alpha = 0,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Spacing = new Vector2(spacing / 2),
|
Spacing = new Vector2(spacing / 2),
|
||||||
@ -337,7 +337,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(value))
|
if (string.IsNullOrEmpty(value))
|
||||||
{
|
{
|
||||||
this.FadeOut(transition_duration);
|
textContainer.FadeOut(transition_duration);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,8 +345,6 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsPresent => base.IsPresent || textFlow == null; // Visibility is updated in the LoadComponentAsync callback
|
|
||||||
|
|
||||||
private void setTextAsync(string text)
|
private void setTextAsync(string text)
|
||||||
{
|
{
|
||||||
LoadComponentAsync(new OsuTextFlowContainer(s => s.TextSize = 14)
|
LoadComponentAsync(new OsuTextFlowContainer(s => s.TextSize = 14)
|
||||||
@ -361,7 +359,7 @@ namespace osu.Game.Screens.Select
|
|||||||
textContainer.Add(textFlow = loaded);
|
textContainer.Add(textFlow = loaded);
|
||||||
|
|
||||||
// fade in if we haven't yet.
|
// fade in if we haven't yet.
|
||||||
this.FadeIn(transition_duration);
|
textContainer.FadeIn(transition_duration);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Mods;
|
using osu.Game.Overlays.Mods;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Screens.Edit;
|
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Screens.Ranking;
|
using osu.Game.Screens.Ranking;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
@ -68,7 +67,7 @@ namespace osu.Game.Screens.Select
|
|||||||
BeatmapOptions.AddButton(@"Edit", @"beatmap", FontAwesome.fa_pencil, colours.Yellow, () =>
|
BeatmapOptions.AddButton(@"Edit", @"beatmap", FontAwesome.fa_pencil, colours.Yellow, () =>
|
||||||
{
|
{
|
||||||
ValidForResume = false;
|
ValidForResume = false;
|
||||||
Push(new Editor());
|
Edit();
|
||||||
}, Key.Number3);
|
}, Key.Number3);
|
||||||
|
|
||||||
if (dialogOverlay != null)
|
if (dialogOverlay != null)
|
||||||
|
@ -223,9 +223,9 @@ namespace osu.Game.Screens.Select
|
|||||||
Carousel.LoadBeatmapSetsFromManager(this.beatmaps);
|
Carousel.LoadBeatmapSetsFromManager(this.beatmaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Edit(BeatmapInfo beatmap)
|
public void Edit(BeatmapInfo beatmap = null)
|
||||||
{
|
{
|
||||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value);
|
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap ?? beatmapNoDebounce);
|
||||||
Push(new Editor());
|
Push(new Editor());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,7 +350,7 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ensurePlayingSelected(preview);
|
if (IsCurrentScreen) ensurePlayingSelected(preview);
|
||||||
UpdateBeatmap(Beatmap.Value);
|
UpdateBeatmap(Beatmap.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Skinning
|
namespace osu.Game.Skinning
|
||||||
@ -56,30 +57,39 @@ namespace osu.Game.Skinning
|
|||||||
case "Play/Great":
|
case "Play/Great":
|
||||||
componentName = "hit300";
|
componentName = "hit300";
|
||||||
break;
|
break;
|
||||||
|
case "Play/osu/number-text":
|
||||||
|
return !hasFont(Configuration.HitCircleFont) ? null : new LegacySpriteText(Textures, Configuration.HitCircleFont) { Scale = new Vector2(0.96f) };
|
||||||
}
|
}
|
||||||
|
|
||||||
float ratio = 0.72f; // brings sizing roughly in-line with stable
|
var texture = GetTexture(componentName);
|
||||||
|
|
||||||
var texture = GetTexture($"{componentName}@2x");
|
|
||||||
if (texture == null)
|
if (texture == null)
|
||||||
{
|
return null;
|
||||||
ratio *= 2;
|
|
||||||
texture = GetTexture(componentName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (texture == null) return null;
|
return new Sprite { Texture = texture };
|
||||||
|
|
||||||
return new Sprite
|
|
||||||
{
|
|
||||||
Texture = texture,
|
|
||||||
Scale = new Vector2(ratio),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Texture GetTexture(string componentName) => Textures.Get(componentName);
|
public override Texture GetTexture(string componentName)
|
||||||
|
{
|
||||||
|
float ratio = 2;
|
||||||
|
|
||||||
|
var texture = Textures.Get($"{componentName}@2x");
|
||||||
|
if (texture == null)
|
||||||
|
{
|
||||||
|
ratio = 1;
|
||||||
|
texture = Textures.Get(componentName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (texture != null)
|
||||||
|
texture.ScaleAdjust = ratio / 0.72f; // brings sizing roughly in-line with stable
|
||||||
|
|
||||||
|
return texture;
|
||||||
|
}
|
||||||
|
|
||||||
public override SampleChannel GetSample(string sampleName) => Samples.Get(sampleName);
|
public override SampleChannel GetSample(string sampleName) => Samples.Get(sampleName);
|
||||||
|
|
||||||
|
private bool hasFont(string fontName) => GetTexture($"{fontName}-0") != null;
|
||||||
|
|
||||||
protected class LegacySkinResourceStore<T> : IResourceStore<byte[]>
|
protected class LegacySkinResourceStore<T> : IResourceStore<byte[]>
|
||||||
where T : INamedFileInfo
|
where T : INamedFileInfo
|
||||||
{
|
{
|
||||||
@ -142,5 +152,40 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class LegacySpriteText : OsuSpriteText
|
||||||
|
{
|
||||||
|
private readonly TextureStore textures;
|
||||||
|
private readonly string font;
|
||||||
|
|
||||||
|
public LegacySpriteText(TextureStore textures, string font)
|
||||||
|
{
|
||||||
|
this.textures = textures;
|
||||||
|
this.font = font;
|
||||||
|
|
||||||
|
Shadow = false;
|
||||||
|
UseFullGlyphHeight = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Texture GetTextureForCharacter(char c)
|
||||||
|
{
|
||||||
|
string textureName = $"{font}-{c}";
|
||||||
|
|
||||||
|
// Approximate value that brings character sizing roughly in-line with stable
|
||||||
|
float ratio = 36;
|
||||||
|
|
||||||
|
var texture = textures.Get($"{textureName}@2x");
|
||||||
|
if (texture == null)
|
||||||
|
{
|
||||||
|
ratio = 18;
|
||||||
|
texture = textures.Get(textureName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (texture != null)
|
||||||
|
texture.ScaleAdjust = ratio;
|
||||||
|
|
||||||
|
return texture;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ namespace osu.Game.Skinning
|
|||||||
switch (section)
|
switch (section)
|
||||||
{
|
{
|
||||||
case Section.General:
|
case Section.General:
|
||||||
|
{
|
||||||
var pair = SplitKeyVal(line);
|
var pair = SplitKeyVal(line);
|
||||||
|
|
||||||
switch (pair.Key)
|
switch (pair.Key)
|
||||||
@ -32,6 +33,20 @@ namespace osu.Game.Skinning
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
case Section.Fonts:
|
||||||
|
{
|
||||||
|
var pair = SplitKeyVal(line);
|
||||||
|
|
||||||
|
switch (pair.Key)
|
||||||
|
{
|
||||||
|
case "HitCirclePrefix":
|
||||||
|
skin.HitCircleFont = pair.Value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
base.ParseLine(skin, section, line);
|
base.ParseLine(skin, section, line);
|
||||||
|
@ -14,5 +14,7 @@ namespace osu.Game.Skinning
|
|||||||
public List<Color4> ComboColours { get; set; } = new List<Color4>();
|
public List<Color4> ComboColours { get; set; } = new List<Color4>();
|
||||||
|
|
||||||
public Dictionary<string, Color4> CustomColours { get; set; } = new Dictionary<string, Color4>();
|
public Dictionary<string, Color4> CustomColours { get; set; } = new Dictionary<string, Color4>();
|
||||||
|
|
||||||
|
public string HitCircleFont { get; set; } = "default";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,11 @@ namespace osu.Game.Skinning
|
|||||||
public class SkinnableDrawable<T> : SkinReloadableDrawable
|
public class SkinnableDrawable<T> : SkinReloadableDrawable
|
||||||
where T : Drawable
|
where T : Drawable
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The displayed component. May or may not be a type-<typeparamref name="T"/> member.
|
||||||
|
/// </summary>
|
||||||
|
protected Drawable Drawable { get; private set; }
|
||||||
|
|
||||||
private readonly Func<string, T> createDefault;
|
private readonly Func<string, T> createDefault;
|
||||||
|
|
||||||
private readonly string componentName;
|
private readonly string componentName;
|
||||||
@ -31,7 +36,8 @@ namespace osu.Game.Skinning
|
|||||||
/// <param name="defaultImplementation">A function to create the default skin implementation of this element.</param>
|
/// <param name="defaultImplementation">A function to create the default skin implementation of this element.</param>
|
||||||
/// <param name="allowFallback">A conditional to decide whether to allow fallback to the default implementation if a skinned element is not present.</param>
|
/// <param name="allowFallback">A conditional to decide whether to allow fallback to the default implementation if a skinned element is not present.</param>
|
||||||
/// <param name="restrictSize">Whether a user-skin drawable should be limited to the size of our parent.</param>
|
/// <param name="restrictSize">Whether a user-skin drawable should be limited to the size of our parent.</param>
|
||||||
public SkinnableDrawable(string name, Func<string, T> defaultImplementation, Func<ISkinSource, bool> allowFallback = null, bool restrictSize = true) : base(allowFallback)
|
public SkinnableDrawable(string name, Func<string, T> defaultImplementation, Func<ISkinSource, bool> allowFallback = null, bool restrictSize = true)
|
||||||
|
: base(allowFallback)
|
||||||
{
|
{
|
||||||
componentName = name;
|
componentName = name;
|
||||||
createDefault = defaultImplementation;
|
createDefault = defaultImplementation;
|
||||||
@ -42,26 +48,27 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||||
{
|
{
|
||||||
var drawable = skin.GetDrawableComponent(componentName);
|
Drawable = skin.GetDrawableComponent(componentName);
|
||||||
if (drawable != null)
|
|
||||||
|
if (Drawable != null)
|
||||||
{
|
{
|
||||||
if (restrictSize)
|
if (restrictSize)
|
||||||
{
|
{
|
||||||
drawable.RelativeSizeAxes = Axes.Both;
|
Drawable.RelativeSizeAxes = Axes.Both;
|
||||||
drawable.Size = Vector2.One;
|
Drawable.Size = Vector2.One;
|
||||||
drawable.Scale = Vector2.One;
|
Drawable.Scale = Vector2.One;
|
||||||
drawable.FillMode = FillMode.Fit;
|
Drawable.FillMode = FillMode.Fit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (allowFallback)
|
else if (allowFallback)
|
||||||
drawable = createDefault(componentName);
|
Drawable = createDefault(componentName);
|
||||||
|
|
||||||
if (drawable != null)
|
if (Drawable != null)
|
||||||
{
|
{
|
||||||
drawable.Origin = Anchor.Centre;
|
Drawable.Origin = Anchor.Centre;
|
||||||
drawable.Anchor = Anchor.Centre;
|
Drawable.Anchor = Anchor.Centre;
|
||||||
|
|
||||||
InternalChild = drawable;
|
InternalChild = Drawable;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ClearInternal();
|
ClearInternal();
|
||||||
|
40
osu.Game/Skinning/SkinnableSpriteText.cs
Normal file
40
osu.Game/Skinning/SkinnableSpriteText.cs
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
// Copyright (c) 2007-2018 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.Sprites;
|
||||||
|
|
||||||
|
namespace osu.Game.Skinning
|
||||||
|
{
|
||||||
|
public class SkinnableSpriteText : SkinnableDrawable<SpriteText>, IHasText
|
||||||
|
{
|
||||||
|
public SkinnableSpriteText(string name, Func<string, SpriteText> defaultImplementation, Func<ISkinSource, bool> allowFallback = null, bool restrictSize = true)
|
||||||
|
: base(name, defaultImplementation, allowFallback, restrictSize)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||||
|
{
|
||||||
|
base.SkinChanged(skin, allowFallback);
|
||||||
|
|
||||||
|
if (Drawable is IHasText textDrawable)
|
||||||
|
textDrawable.Text = Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string text;
|
||||||
|
|
||||||
|
public string Text
|
||||||
|
{
|
||||||
|
get => text;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (text == value)
|
||||||
|
return;
|
||||||
|
text = value;
|
||||||
|
|
||||||
|
if (Drawable is IHasText textDrawable)
|
||||||
|
textDrawable.Text = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
65
osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs
Normal file
65
osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
// Copyright (c) 2007-2018 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;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Screens.Edit.Screens.Compose;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual
|
||||||
|
{
|
||||||
|
[Cached(Type = typeof(IPlacementHandler))]
|
||||||
|
public abstract class HitObjectPlacementMaskTestCase : OsuTestCase, IPlacementHandler
|
||||||
|
{
|
||||||
|
private readonly Container hitObjectContainer;
|
||||||
|
private PlacementMask currentMask;
|
||||||
|
|
||||||
|
protected HitObjectPlacementMaskTestCase()
|
||||||
|
{
|
||||||
|
Beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize = 2;
|
||||||
|
|
||||||
|
Add(hitObjectContainer = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Clock = new FramedClock(new StopwatchClock())
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
Add(currentMask = CreateMask());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
|
{
|
||||||
|
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
|
dependencies.CacheAs<IAdjustableClock>(new StopwatchClock());
|
||||||
|
|
||||||
|
return dependencies;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void BeginPlacement(HitObject hitObject)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EndPlacement(HitObject hitObject)
|
||||||
|
{
|
||||||
|
hitObjectContainer.Add(CreateHitObject(hitObject));
|
||||||
|
|
||||||
|
Remove(currentMask);
|
||||||
|
Add(currentMask = CreateMask());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Delete(HitObject hitObject)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract DrawableHitObject CreateHitObject(HitObject hitObject);
|
||||||
|
protected abstract PlacementMask CreateMask();
|
||||||
|
}
|
||||||
|
}
|
47
osu.Game/Tests/Visual/HitObjectSelectionMaskTestCase.cs
Normal file
47
osu.Game/Tests/Visual/HitObjectSelectionMaskTestCase.cs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
// Copyright (c) 2007-2018 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;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual
|
||||||
|
{
|
||||||
|
public abstract class HitObjectSelectionMaskTestCase : OsuTestCase
|
||||||
|
{
|
||||||
|
private SelectionMask mask;
|
||||||
|
|
||||||
|
protected override Container<Drawable> Content => content ?? base.Content;
|
||||||
|
private readonly Container content;
|
||||||
|
|
||||||
|
protected HitObjectSelectionMaskTestCase()
|
||||||
|
{
|
||||||
|
base.Content.Add(content = new Container
|
||||||
|
{
|
||||||
|
Clock = new FramedClock(new StopwatchClock()),
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
base.Content.Add(mask = CreateMask());
|
||||||
|
mask.SelectionRequested += (_, __) => mask.Select();
|
||||||
|
|
||||||
|
AddStep("Select", () => mask.Select());
|
||||||
|
AddStep("Deselect", () => mask.Deselect());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnClick(ClickEvent e)
|
||||||
|
{
|
||||||
|
mask.Deselect();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract SelectionMask CreateMask();
|
||||||
|
}
|
||||||
|
}
|
@ -19,6 +19,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.4" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.4" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||||
|
<PackageReference Include="ppy.osu.Framework" Version="2018.1030.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
11
tools/cakebuild.csproj
Normal file
11
tools/cakebuild.csproj
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<PackAsTool>true</PackAsTool>
|
||||||
|
<TargetFrameworks>netcoreapp2.0</TargetFrameworks>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Cake" Version="0.30.0" />
|
||||||
|
<PackageReference Include="Cake.CoreCLR" Version="0.30.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
Loading…
Reference in New Issue
Block a user