mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 05:42:56 +08:00
Merge branch 'master' into skin-editor-closest-anchor
This commit is contained in:
commit
c751e087ca
@ -2,12 +2,6 @@
|
|||||||
"version": 1,
|
"version": 1,
|
||||||
"isRoot": true,
|
"isRoot": true,
|
||||||
"tools": {
|
"tools": {
|
||||||
"cake.tool": {
|
|
||||||
"version": "0.35.0",
|
|
||||||
"commands": [
|
|
||||||
"dotnet-cake"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"dotnet-format": {
|
"dotnet-format": {
|
||||||
"version": "3.1.37601",
|
"version": "3.1.37601",
|
||||||
"commands": [
|
"commands": [
|
||||||
@ -20,20 +14,20 @@
|
|||||||
"jb"
|
"jb"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"nvika": {
|
"smoogipoo.nvika": {
|
||||||
"version": "2.0.0",
|
"version": "1.0.1",
|
||||||
"commands": [
|
"commands": [
|
||||||
"nvika"
|
"nvika"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"codefilesanity": {
|
"codefilesanity": {
|
||||||
"version": "15.0.0",
|
"version": "0.0.36",
|
||||||
"commands": [
|
"commands": [
|
||||||
"CodeFileSanity"
|
"CodeFileSanity"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"ppy.localisationanalyser.tools": {
|
"ppy.localisationanalyser.tools": {
|
||||||
"version": "2021.524.0",
|
"version": "2021.608.0",
|
||||||
"commands": [
|
"commands": [
|
||||||
"localisation"
|
"localisation"
|
||||||
]
|
]
|
||||||
|
93
.github/workflows/ci.yml
vendored
Normal file
93
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
on: [push, pull_request]
|
||||||
|
name: Continuous Integration
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
name: Test
|
||||||
|
runs-on: ${{matrix.os.fullname}}
|
||||||
|
env:
|
||||||
|
OSU_EXECUTION_MODE: ${{matrix.threadingMode}}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- { prettyname: Windows, fullname: windows-latest }
|
||||||
|
- { prettyname: macOS, fullname: macos-latest }
|
||||||
|
- { prettyname: Linux, fullname: ubuntu-latest }
|
||||||
|
threadingMode: ['SingleThread', 'MultiThreaded']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install .NET 5.0.x
|
||||||
|
uses: actions/setup-dotnet@v1
|
||||||
|
with:
|
||||||
|
dotnet-version: "5.0.x"
|
||||||
|
|
||||||
|
# FIXME: libavformat is not included in Ubuntu. Let's fix that.
|
||||||
|
# https://github.com/ppy/osu-framework/issues/4349
|
||||||
|
# Remove this once https://github.com/actions/virtual-environments/issues/3306 has been resolved.
|
||||||
|
- name: Install libavformat-dev
|
||||||
|
if: ${{matrix.os.fullname == 'ubuntu-latest'}}
|
||||||
|
run: |
|
||||||
|
sudo apt-get update && \
|
||||||
|
sudo apt-get -y install libavformat-dev
|
||||||
|
|
||||||
|
- name: Compile
|
||||||
|
run: dotnet build -c Debug -warnaserror osu.Desktop.slnf
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: dotnet test $pwd/*.Tests/bin/Debug/*/*.Tests.dll --logger "trx;LogFileName=TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx"
|
||||||
|
shell: pwsh
|
||||||
|
|
||||||
|
# Attempt to upload results even if test fails.
|
||||||
|
# https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#always
|
||||||
|
- name: Upload Test Results
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
if: ${{ always() }}
|
||||||
|
with:
|
||||||
|
name: osu-test-results-${{matrix.os.prettyname}}-${{matrix.threadingMode}}
|
||||||
|
path: ${{github.workspace}}/TestResults/TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx
|
||||||
|
|
||||||
|
inspect-code:
|
||||||
|
name: Code Quality
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# FIXME: Tools won't run in .NET 5.0 unless you install 3.1.x LTS side by side.
|
||||||
|
# https://itnext.io/how-to-support-multiple-net-sdks-in-github-actions-workflows-b988daa884e
|
||||||
|
- name: Install .NET 3.1.x LTS
|
||||||
|
uses: actions/setup-dotnet@v1
|
||||||
|
with:
|
||||||
|
dotnet-version: "3.1.x"
|
||||||
|
|
||||||
|
- name: Install .NET 5.0.x
|
||||||
|
uses: actions/setup-dotnet@v1
|
||||||
|
with:
|
||||||
|
dotnet-version: "5.0.x"
|
||||||
|
|
||||||
|
- name: Restore Tools
|
||||||
|
run: dotnet tool restore
|
||||||
|
|
||||||
|
- name: Restore Packages
|
||||||
|
run: dotnet restore
|
||||||
|
|
||||||
|
- name: CodeFileSanity
|
||||||
|
run: |
|
||||||
|
# TODO: Add ignore filters and GitHub Workflow Command Reporting in CFS. That way we don't have to do this workaround.
|
||||||
|
# FIXME: Suppress warnings from templates project
|
||||||
|
dotnet codefilesanity | while read -r line; do
|
||||||
|
echo "::warning::$line"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Temporarily disabled due to test failures, but it won't work anyway until the tool is upgraded.
|
||||||
|
# - name: .NET Format (Dry Run)
|
||||||
|
# run: dotnet format --dry-run --check
|
||||||
|
|
||||||
|
- name: InspectCode
|
||||||
|
run: dotnet jb inspectcode $(pwd)/osu.Desktop.slnf --output=$(pwd)/inspectcodereport.xml --cachesDir=$(pwd)/inspectcode --verbosity=WARN
|
||||||
|
|
||||||
|
- name: NVika
|
||||||
|
run: dotnet nvika parsereport "${{github.workspace}}/inspectcodereport.xml" --treatwarningsaserrors
|
31
.github/workflows/report-nunit.yml
vendored
Normal file
31
.github/workflows/report-nunit.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# This is a workaround to allow PRs to report their coverage. This will run inside the base repository.
|
||||||
|
# See:
|
||||||
|
# * https://github.com/dorny/test-reporter#recommended-setup-for-public-repositories
|
||||||
|
# * https://docs.github.com/en/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token
|
||||||
|
name: Annotate CI run with test results
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows: ["Continuous Integration"]
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
jobs:
|
||||||
|
annotate:
|
||||||
|
name: Annotate CI run with test results
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.event.workflow_run.conclusion != 'cancelled' }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- { prettyname: Windows }
|
||||||
|
- { prettyname: macOS }
|
||||||
|
- { prettyname: Linux }
|
||||||
|
threadingMode: ['SingleThread', 'MultiThreaded']
|
||||||
|
steps:
|
||||||
|
- name: Annotate CI run with test results
|
||||||
|
uses: dorny/test-reporter@v1.4.2
|
||||||
|
with:
|
||||||
|
artifact: osu-test-results-${{matrix.os.prettyname}}-${{matrix.threadingMode}}
|
||||||
|
name: Test Results (${{matrix.os.prettyname}}, ${{matrix.threadingMode}})
|
||||||
|
path: "*.trx"
|
||||||
|
reporter: dotnet-trx
|
14
.vscode/launch.json
vendored
14
.vscode/launch.json
vendored
@ -113,20 +113,6 @@
|
|||||||
"cwd": "${workspaceRoot}",
|
"cwd": "${workspaceRoot}",
|
||||||
"preLaunchTask": "Build benchmarks",
|
"preLaunchTask": "Build benchmarks",
|
||||||
"console": "internalConsole"
|
"console": "internalConsole"
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Cake: Debug Script",
|
|
||||||
"type": "coreclr",
|
|
||||||
"request": "launch",
|
|
||||||
"program": "${workspaceRoot}/build/tools/Cake.CoreCLR/0.30.0/Cake.dll",
|
|
||||||
"args": [
|
|
||||||
"${workspaceRoot}/build/build.cake",
|
|
||||||
"--debug",
|
|
||||||
"--verbosity=diagnostic"
|
|
||||||
],
|
|
||||||
"cwd": "${workspaceRoot}/build",
|
|
||||||
"stopAtEntry": true,
|
|
||||||
"externalConsole": false
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,11 @@
|
|||||||
[CmdletBinding()]
|
|
||||||
Param(
|
|
||||||
[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
|
|
||||||
)
|
|
||||||
|
|
||||||
# Build Cake arguments
|
|
||||||
$cakeArguments = "";
|
|
||||||
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
|
|
||||||
|
|
||||||
dotnet tool restore
|
dotnet tool restore
|
||||||
dotnet cake ./build/InspectCode.cake --bootstrap
|
|
||||||
dotnet cake ./build/InspectCode.cake $cakeArguments
|
# Temporarily disabled until the tool is upgraded to 5.0.
|
||||||
|
# The version specified in .config/dotnet-tools.json (3.1.37601) won't run on .NET hosts >=5.0.7.
|
||||||
|
# - cmd: dotnet format --dry-run --check
|
||||||
|
|
||||||
|
dotnet CodeFileSanity
|
||||||
|
dotnet jb inspectcode "osu.Desktop.slnf" --output="inspectcodereport.xml" --caches-home="inspectcode" --verbosity=WARN
|
||||||
|
dotnet nvika parsereport "inspectcodereport.xml" --treatwarningsaserrors
|
||||||
|
|
||||||
exit $LASTEXITCODE
|
exit $LASTEXITCODE
|
6
InspectCode.sh
Executable file
6
InspectCode.sh
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
dotnet tool restore
|
||||||
|
dotnet CodeFileSanity
|
||||||
|
dotnet jb inspectcode "osu.Desktop.slnf" --output="inspectcodereport.xml" --caches-home="inspectcode" --verbosity=WARN
|
||||||
|
dotnet nvika parsereport "inspectcodereport.xml" --treatwarningsaserrors
|
15
appveyor.yml
15
appveyor.yml
@ -1,24 +1,27 @@
|
|||||||
clone_depth: 1
|
clone_depth: 1
|
||||||
version: '{branch}-{build}'
|
version: '{branch}-{build}'
|
||||||
image: Visual Studio 2019
|
image: Visual Studio 2019
|
||||||
|
cache:
|
||||||
|
- '%LOCALAPPDATA%\NuGet\v3-cache -> appveyor.yml'
|
||||||
|
|
||||||
dotnet_csproj:
|
dotnet_csproj:
|
||||||
patch: true
|
patch: true
|
||||||
file: 'osu.Game\osu.Game.csproj' # Use wildcard when it's able to exclude Xamarin projects
|
file: 'osu.Game\osu.Game.csproj' # Use wildcard when it's able to exclude Xamarin projects
|
||||||
version: '0.0.{build}'
|
version: '0.0.{build}'
|
||||||
cache:
|
|
||||||
- '%LOCALAPPDATA%\NuGet\v3-cache -> appveyor.yml'
|
|
||||||
before_build:
|
before_build:
|
||||||
- ps: dotnet --info # Useful when version mismatch between CI and local
|
- cmd: dotnet --info # Useful when version mismatch between CI and local
|
||||||
- ps: nuget restore -verbosity quiet # Only nuget.exe knows both new (.NET Core) and old (Xamarin) projects
|
- cmd: nuget restore -verbosity quiet # Only nuget.exe knows both new (.NET Core) and old (Xamarin) projects
|
||||||
|
|
||||||
build:
|
build:
|
||||||
project: osu.sln
|
project: osu.sln
|
||||||
parallel: true
|
parallel: true
|
||||||
verbosity: minimal
|
verbosity: minimal
|
||||||
publish_nuget: true
|
publish_nuget: true
|
||||||
|
|
||||||
after_build:
|
after_build:
|
||||||
- ps: dotnet tool restore
|
|
||||||
- ps: dotnet format --dry-run --check
|
|
||||||
- ps: .\InspectCode.ps1
|
- ps: .\InspectCode.ps1
|
||||||
|
|
||||||
test:
|
test:
|
||||||
assemblies:
|
assemblies:
|
||||||
except:
|
except:
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.Build.Traversal">
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\osu.Desktop\osu.Desktop.csproj" />
|
|
||||||
<ProjectReference Include="..\osu.Game.Rulesets.Catch.Tests\osu.Game.Rulesets.Catch.Tests.csproj" />
|
|
||||||
<ProjectReference Include="..\osu.Game.Rulesets.Catch\osu.Game.Rulesets.Catch.csproj" />
|
|
||||||
<ProjectReference Include="..\osu.Game.Rulesets.Mania.Tests\osu.Game.Rulesets.Mania.Tests.csproj" />
|
|
||||||
<ProjectReference Include="..\osu.Game.Rulesets.Mania\osu.Game.Rulesets.Mania.csproj" />
|
|
||||||
<ProjectReference Include="..\osu.Game.Rulesets.Osu.Tests\osu.Game.Rulesets.Osu.Tests.csproj" />
|
|
||||||
<ProjectReference Include="..\osu.Game.Rulesets.Osu\osu.Game.Rulesets.Osu.csproj" />
|
|
||||||
<ProjectReference Include="..\osu.Game.Rulesets.Taiko.Tests\osu.Game.Rulesets.Taiko.Tests.csproj" />
|
|
||||||
<ProjectReference Include="..\osu.Game.Rulesets.Taiko\osu.Game.Rulesets.Taiko.csproj" />
|
|
||||||
<ProjectReference Include="..\osu.Game.Tests\osu.Game.Tests.csproj" />
|
|
||||||
<ProjectReference Include="..\osu.Game.Tournament.Tests\osu.Game.Tournament.Tests.csproj" />
|
|
||||||
<ProjectReference Include="..\osu.Game.Tournament\osu.Game.Tournament.csproj" />
|
|
||||||
<ProjectReference Include="..\osu.Game\osu.Game.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
@ -1,41 +0,0 @@
|
|||||||
#addin "nuget:?package=CodeFileSanity&version=0.0.36"
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// ARGUMENTS
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
var target = Argument("target", "CodeAnalysis");
|
|
||||||
var configuration = Argument("configuration", "Release");
|
|
||||||
|
|
||||||
var rootDirectory = new DirectoryPath("..");
|
|
||||||
var sln = rootDirectory.CombineWithFilePath("osu.sln");
|
|
||||||
var desktopSlnf = rootDirectory.CombineWithFilePath("osu.Desktop.slnf");
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// TASKS
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
Task("InspectCode")
|
|
||||||
.Does(() => {
|
|
||||||
var inspectcodereport = "inspectcodereport.xml";
|
|
||||||
var cacheDir = "inspectcode";
|
|
||||||
var verbosity = AppVeyor.IsRunningOnAppVeyor ? "WARN" : "INFO"; // Don't flood CI output
|
|
||||||
|
|
||||||
DotNetCoreTool(rootDirectory.FullPath,
|
|
||||||
"jb", $@"inspectcode ""{desktopSlnf}"" --output=""{inspectcodereport}"" --caches-home=""{cacheDir}"" --verbosity={verbosity}");
|
|
||||||
DotNetCoreTool(rootDirectory.FullPath, "nvika", $@"parsereport ""{inspectcodereport}"" --treatwarningsaserrors");
|
|
||||||
});
|
|
||||||
|
|
||||||
Task("CodeFileSanity")
|
|
||||||
.Does(() => {
|
|
||||||
ValidateCodeSanity(new ValidateCodeSanitySettings {
|
|
||||||
RootDirectory = rootDirectory.FullPath,
|
|
||||||
IsAppveyorBuild = AppVeyor.IsRunningOnAppVeyor
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Task("CodeAnalysis")
|
|
||||||
.IsDependentOn("CodeFileSanity")
|
|
||||||
.IsDependentOn("InspectCode");
|
|
||||||
|
|
||||||
RunTarget(target);
|
|
@ -1,5 +0,0 @@
|
|||||||
|
|
||||||
[Nuget]
|
|
||||||
Source=https://api.nuget.org/v3/index.json
|
|
||||||
UseInProcessClient=true
|
|
||||||
LoadDependencies=true
|
|
@ -51,7 +51,7 @@
|
|||||||
<Reference Include="Java.Interop" />
|
<Reference Include="Java.Interop" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.525.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.614.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.601.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.616.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -20,7 +20,8 @@ namespace osu.Android
|
|||||||
[Activity(Theme = "@android:style/Theme.NoTitleBar", MainLauncher = true, ScreenOrientation = ScreenOrientation.FullUser, SupportsPictureInPicture = false, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, HardwareAccelerated = false, LaunchMode = LaunchMode.SingleInstance, Exported = true)]
|
[Activity(Theme = "@android:style/Theme.NoTitleBar", MainLauncher = true, ScreenOrientation = ScreenOrientation.FullUser, SupportsPictureInPicture = false, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, HardwareAccelerated = false, LaunchMode = LaunchMode.SingleInstance, Exported = true)]
|
||||||
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault }, DataScheme = "content", DataPathPattern = ".*\\\\.osz", DataHost = "*", DataMimeType = "*/*")]
|
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault }, DataScheme = "content", DataPathPattern = ".*\\\\.osz", DataHost = "*", DataMimeType = "*/*")]
|
||||||
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault }, DataScheme = "content", DataPathPattern = ".*\\\\.osk", DataHost = "*", DataMimeType = "*/*")]
|
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault }, DataScheme = "content", DataPathPattern = ".*\\\\.osk", DataHost = "*", DataMimeType = "*/*")]
|
||||||
[IntentFilter(new[] { Intent.ActionSend, Intent.ActionSendMultiple }, Categories = new[] { Intent.CategoryDefault }, DataMimeTypes = new[] { "application/zip", "application/octet-stream", "application/download", "application/x-zip", "application/x-zip-compressed" })]
|
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault }, DataScheme = "content", DataMimeType = "application/x-osu-archive")]
|
||||||
|
[IntentFilter(new[] { Intent.ActionSend, Intent.ActionSendMultiple }, Categories = new[] { Intent.CategoryDefault }, DataMimeTypes = new[] { "application/zip", "application/octet-stream", "application/download", "application/x-zip", "application/x-zip-compressed", "application/x-osu-archive" })]
|
||||||
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryBrowsable, Intent.CategoryDefault }, DataSchemes = new[] { "osu", "osump" })]
|
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryBrowsable, Intent.CategoryDefault }, DataSchemes = new[] { "osu", "osump" })]
|
||||||
public class OsuGameActivity : AndroidGameActivity
|
public class OsuGameActivity : AndroidGameActivity
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
[General]
|
||||||
|
// no version specified means v1
|
@ -4,10 +4,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
|
||||||
using osu.Game.Rulesets.Catch.Mods;
|
using osu.Game.Rulesets.Catch.Mods;
|
||||||
using osu.Game.Rulesets.Catch.Objects;
|
using osu.Game.Rulesets.Catch.Objects;
|
||||||
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
||||||
@ -21,12 +19,6 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
{
|
{
|
||||||
public class TestSceneCatchModHidden : ModTestScene
|
public class TestSceneCatchModHidden : ModTestScene
|
||||||
{
|
{
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
LocalConfig.SetValue(OsuSetting.IncreaseFirstObjectVisibility, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestJuiceStream()
|
public void TestJuiceStream()
|
||||||
{
|
{
|
||||||
|
@ -174,8 +174,8 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
|
|
||||||
private void addToPlayfield(DrawableCatchHitObject drawable)
|
private void addToPlayfield(DrawableCatchHitObject drawable)
|
||||||
{
|
{
|
||||||
foreach (var mod in SelectedMods.Value.OfType<IApplicableToDrawableHitObjects>())
|
foreach (var mod in SelectedMods.Value.OfType<IApplicableToDrawableHitObject>())
|
||||||
mod.ApplyToDrawableHitObjects(new[] { drawable });
|
mod.ApplyToDrawableHitObject(drawable);
|
||||||
|
|
||||||
drawableRuleset.Playfield.Add(drawable);
|
drawableRuleset.Playfield.Add(drawable);
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,7 @@ namespace osu.Game.Rulesets.Catch
|
|||||||
Fruit,
|
Fruit,
|
||||||
Banana,
|
Banana,
|
||||||
Droplet,
|
Droplet,
|
||||||
CatcherIdle,
|
Catcher,
|
||||||
CatcherFail,
|
|
||||||
CatcherKiai,
|
|
||||||
CatchComboCounter
|
CatchComboCounter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,6 @@ namespace osu.Game.Rulesets.Catch.Difficulty
|
|||||||
{
|
{
|
||||||
public class CatchDifficultyAttributes : DifficultyAttributes
|
public class CatchDifficultyAttributes : DifficultyAttributes
|
||||||
{
|
{
|
||||||
public double ApproachRate;
|
public double ApproachRate { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,10 +39,6 @@ namespace osu.Game.Rulesets.Catch.Difficulty
|
|||||||
tinyTicksMissed = Score.Statistics.GetOrDefault(HitResult.SmallTickMiss);
|
tinyTicksMissed = Score.Statistics.GetOrDefault(HitResult.SmallTickMiss);
|
||||||
misses = Score.Statistics.GetOrDefault(HitResult.Miss);
|
misses = Score.Statistics.GetOrDefault(HitResult.Miss);
|
||||||
|
|
||||||
// Don't count scores made with supposedly unranked mods
|
|
||||||
if (mods.Any(m => !m.Ranked))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// We are heavily relying on aim in catch the beat
|
// We are heavily relying on aim in catch the beat
|
||||||
double value = Math.Pow(5.0 * Math.Max(1.0, Attributes.StarRating / 0.0049) - 4.0, 2.0) / 100000.0;
|
double value = Math.Pow(5.0 * Math.Max(1.0, Attributes.StarRating / 0.0049) - 4.0, 2.0) / 100000.0;
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ namespace osu.Game.Rulesets.Catch.Mods
|
|||||||
public class CatchModHardRock : ModHardRock, IApplicableToBeatmap
|
public class CatchModHardRock : ModHardRock, IApplicableToBeatmap
|
||||||
{
|
{
|
||||||
public override double ScoreMultiplier => 1.12;
|
public override double ScoreMultiplier => 1.12;
|
||||||
public override bool Ranked => true;
|
|
||||||
|
|
||||||
public void ApplyToBeatmap(IBeatmap beatmap) => CatchBeatmapProcessor.ApplyPositionOffsets(beatmap, this);
|
public void ApplyToBeatmap(IBeatmap beatmap) => CatchBeatmapProcessor.ApplyPositionOffsets(beatmap, this);
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,7 @@ namespace osu.Game.Rulesets.Catch.Mods
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
||||||
{
|
=> ApplyNormalVisibilityState(hitObject, state);
|
||||||
}
|
|
||||||
|
|
||||||
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
||||||
{
|
{
|
||||||
|
@ -33,13 +33,13 @@ namespace osu.Game.Rulesets.Catch.Mods
|
|||||||
|
|
||||||
private class MouseInputHelper : Drawable, IKeyBindingHandler<CatchAction>, IRequireHighFrequencyMousePosition
|
private class MouseInputHelper : Drawable, IKeyBindingHandler<CatchAction>, IRequireHighFrequencyMousePosition
|
||||||
{
|
{
|
||||||
private readonly Catcher catcher;
|
private readonly CatcherArea catcherArea;
|
||||||
|
|
||||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
|
||||||
|
|
||||||
public MouseInputHelper(CatchPlayfield playfield)
|
public MouseInputHelper(CatchPlayfield playfield)
|
||||||
{
|
{
|
||||||
catcher = playfield.CatcherArea.MovableCatcher;
|
catcherArea = playfield.CatcherArea;
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Catch.Mods
|
|||||||
|
|
||||||
protected override bool OnMouseMove(MouseMoveEvent e)
|
protected override bool OnMouseMove(MouseMoveEvent e)
|
||||||
{
|
{
|
||||||
catcher.UpdatePosition(e.MousePosition.X / DrawSize.X * CatchPlayfield.WIDTH);
|
catcherArea.SetCatcherPosition(e.MousePosition.X / DrawSize.X * CatchPlayfield.WIDTH);
|
||||||
return base.OnMouseMove(e);
|
return base.OnMouseMove(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osu.Game.Rulesets.Catch.Skinning.Default;
|
using osu.Game.Rulesets.Catch.Skinning.Default;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||||
@ -9,21 +8,11 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a <see cref="Fruit"/> caught by the catcher.
|
/// Represents a <see cref="Fruit"/> caught by the catcher.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CaughtFruit : CaughtObject, IHasFruitState
|
public class CaughtFruit : CaughtObject
|
||||||
{
|
{
|
||||||
public Bindable<FruitVisualRepresentation> VisualRepresentation { get; } = new Bindable<FruitVisualRepresentation>();
|
|
||||||
|
|
||||||
public CaughtFruit()
|
public CaughtFruit()
|
||||||
: base(CatchSkinComponents.Fruit, _ => new FruitPiece())
|
: base(CatchSkinComponents.Fruit, _ => new FruitPiece())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void CopyStateFrom(IHasCatchObjectState objectState)
|
|
||||||
{
|
|
||||||
base.CopyStateFrom(objectState);
|
|
||||||
|
|
||||||
var fruitState = (IHasFruitState)objectState;
|
|
||||||
VisualRepresentation.Value = fruitState.VisualRepresentation.Value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
public PalpableCatchHitObject HitObject { get; private set; }
|
public PalpableCatchHitObject HitObject { get; private set; }
|
||||||
public Bindable<Color4> AccentColour { get; } = new Bindable<Color4>();
|
public Bindable<Color4> AccentColour { get; } = new Bindable<Color4>();
|
||||||
public Bindable<bool> HyperDash { get; } = new Bindable<bool>();
|
public Bindable<bool> HyperDash { get; } = new Bindable<bool>();
|
||||||
|
public Bindable<int> IndexInBeatmap { get; } = new Bindable<int>();
|
||||||
|
|
||||||
public Vector2 DisplaySize => Size * Scale;
|
public Vector2 DisplaySize => Size * Scale;
|
||||||
|
|
||||||
@ -51,6 +52,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
Rotation = objectState.DisplayRotation;
|
Rotation = objectState.DisplayRotation;
|
||||||
AccentColour.Value = objectState.AccentColour.Value;
|
AccentColour.Value = objectState.AccentColour.Value;
|
||||||
HyperDash.Value = objectState.HyperDash.Value;
|
HyperDash.Value = objectState.HyperDash.Value;
|
||||||
|
IndexInBeatmap.Value = objectState.IndexInBeatmap.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void FreeAfterUse()
|
protected override void FreeAfterUse()
|
||||||
|
@ -3,17 +3,14 @@
|
|||||||
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets.Catch.Skinning.Default;
|
using osu.Game.Rulesets.Catch.Skinning.Default;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||||
{
|
{
|
||||||
public class DrawableFruit : DrawablePalpableCatchHitObject, IHasFruitState
|
public class DrawableFruit : DrawablePalpableCatchHitObject
|
||||||
{
|
{
|
||||||
public Bindable<FruitVisualRepresentation> VisualRepresentation { get; } = new Bindable<FruitVisualRepresentation>();
|
|
||||||
|
|
||||||
public DrawableFruit()
|
public DrawableFruit()
|
||||||
: this(null)
|
: this(null)
|
||||||
{
|
{
|
||||||
@ -27,11 +24,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
IndexInBeatmap.BindValueChanged(change =>
|
|
||||||
{
|
|
||||||
VisualRepresentation.Value = (FruitVisualRepresentation)(change.NewValue % 4);
|
|
||||||
}, true);
|
|
||||||
|
|
||||||
ScalingContainer.Child = new SkinnableDrawable(
|
ScalingContainer.Child = new SkinnableDrawable(
|
||||||
new CatchSkinComponent(CatchSkinComponents.Fruit),
|
new CatchSkinComponent(CatchSkinComponents.Fruit),
|
||||||
_ => new FruitPiece());
|
_ => new FruitPiece());
|
||||||
@ -44,12 +36,4 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
ScalingContainer.RotateTo((RandomSingle(1) - 0.5f) * 40);
|
ScalingContainer.RotateTo((RandomSingle(1) - 0.5f) * 40);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum FruitVisualRepresentation
|
|
||||||
{
|
|
||||||
Pear,
|
|
||||||
Grape,
|
|
||||||
Pineapple,
|
|
||||||
Raspberry,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
|
|
||||||
Bindable<bool> HyperDash { get; }
|
Bindable<bool> HyperDash { get; }
|
||||||
|
|
||||||
|
Bindable<int> IndexInBeatmap { get; }
|
||||||
|
|
||||||
Vector2 DisplaySize { get; }
|
Vector2 DisplaySize { get; }
|
||||||
|
|
||||||
float DisplayRotation { get; }
|
float DisplayRotation { get; }
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Bindables;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Provides a visual state of a <see cref="Fruit"/>.
|
|
||||||
/// </summary>
|
|
||||||
public interface IHasFruitState : IHasCatchObjectState
|
|
||||||
{
|
|
||||||
Bindable<FruitVisualRepresentation> VisualRepresentation { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -9,5 +9,7 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
public class Fruit : PalpableCatchHitObject
|
public class Fruit : PalpableCatchHitObject
|
||||||
{
|
{
|
||||||
public override Judgement CreateJudgement() => new CatchJudgement();
|
public override Judgement CreateJudgement() => new CatchJudgement();
|
||||||
|
|
||||||
|
public static FruitVisualRepresentation GetVisualRepresentation(int indexInBeatmap) => (FruitVisualRepresentation)(indexInBeatmap % 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
13
osu.Game.Rulesets.Catch/Objects/FruitVisualRepresentation.cs
Normal file
13
osu.Game.Rulesets.Catch/Objects/FruitVisualRepresentation.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Catch.Objects
|
||||||
|
{
|
||||||
|
public enum FruitVisualRepresentation
|
||||||
|
{
|
||||||
|
Pear,
|
||||||
|
Grape,
|
||||||
|
Pineapple,
|
||||||
|
Raspberry,
|
||||||
|
}
|
||||||
|
}
|
@ -1,22 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Scoring
|
|
||||||
{
|
|
||||||
public class CatchHitWindows : HitWindows
|
|
||||||
{
|
|
||||||
public override bool IsHitResultAllowed(HitResult result)
|
|
||||||
{
|
|
||||||
switch (result)
|
|
||||||
{
|
|
||||||
case HitResult.Great:
|
|
||||||
case HitResult.Miss:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -15,6 +15,7 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default
|
|||||||
{
|
{
|
||||||
public readonly Bindable<Color4> AccentColour = new Bindable<Color4>();
|
public readonly Bindable<Color4> AccentColour = new Bindable<Color4>();
|
||||||
public readonly Bindable<bool> HyperDash = new Bindable<bool>();
|
public readonly Bindable<bool> HyperDash = new Bindable<bool>();
|
||||||
|
public readonly Bindable<int> IndexInBeatmap = new Bindable<int>();
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
protected IHasCatchObjectState ObjectState { get; private set; }
|
protected IHasCatchObjectState ObjectState { get; private set; }
|
||||||
@ -37,6 +38,7 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default
|
|||||||
|
|
||||||
AccentColour.BindTo(ObjectState.AccentColour);
|
AccentColour.BindTo(ObjectState.AccentColour);
|
||||||
HyperDash.BindTo(ObjectState.HyperDash);
|
HyperDash.BindTo(ObjectState.HyperDash);
|
||||||
|
IndexInBeatmap.BindTo(ObjectState.IndexInBeatmap);
|
||||||
|
|
||||||
HyperDash.BindValueChanged(hyper =>
|
HyperDash.BindValueChanged(hyper =>
|
||||||
{
|
{
|
||||||
|
52
osu.Game.Rulesets.Catch/Skinning/Default/DefaultCatcher.cs
Normal file
52
osu.Game.Rulesets.Catch/Skinning/Default/DefaultCatcher.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Game.Rulesets.Catch.UI;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Catch.Skinning.Default
|
||||||
|
{
|
||||||
|
public class DefaultCatcher : CompositeDrawable
|
||||||
|
{
|
||||||
|
public Bindable<CatcherAnimationState> CurrentState { get; } = new Bindable<CatcherAnimationState>();
|
||||||
|
|
||||||
|
private readonly Sprite sprite;
|
||||||
|
|
||||||
|
private readonly Dictionary<CatcherAnimationState, Texture> textures = new Dictionary<CatcherAnimationState, Texture>();
|
||||||
|
|
||||||
|
public DefaultCatcher()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
InternalChild = sprite = new Sprite
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
FillMode = FillMode.Fit
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(TextureStore store, Bindable<CatcherAnimationState> currentState)
|
||||||
|
{
|
||||||
|
CurrentState.BindTo(currentState);
|
||||||
|
|
||||||
|
textures[CatcherAnimationState.Idle] = store.Get(@"Gameplay/catch/fruit-catcher-idle");
|
||||||
|
textures[CatcherAnimationState.Fail] = store.Get(@"Gameplay/catch/fruit-catcher-fail");
|
||||||
|
textures[CatcherAnimationState.Kiai] = store.Get(@"Gameplay/catch/fruit-catcher-kiai");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
CurrentState.BindValueChanged(state => sprite.Texture = textures[state.NewValue], true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
using osu.Game.Rulesets.Catch.Objects;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Skinning.Default
|
namespace osu.Game.Rulesets.Catch.Skinning.Default
|
||||||
{
|
{
|
||||||
@ -39,8 +39,10 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
var fruitState = (IHasFruitState)ObjectState;
|
IndexInBeatmap.BindValueChanged(index =>
|
||||||
VisualRepresentation.BindTo(fruitState.VisualRepresentation);
|
{
|
||||||
|
VisualRepresentation.Value = Fruit.GetVisualRepresentation(index.NewValue);
|
||||||
|
}, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
using osu.Game.Rulesets.Catch.Objects;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Skinning.Default
|
namespace osu.Game.Rulesets.Catch.Skinning.Default
|
||||||
|
@ -65,17 +65,21 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
case CatchSkinComponents.CatcherIdle:
|
case CatchSkinComponents.Catcher:
|
||||||
return this.GetAnimation("fruit-catcher-idle", true, true, true) ??
|
var version = Source.GetConfig<LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version)?.Value ?? 1;
|
||||||
this.GetAnimation("fruit-ryuuta", true, true, true);
|
|
||||||
|
|
||||||
case CatchSkinComponents.CatcherFail:
|
if (version < 2.3m)
|
||||||
return this.GetAnimation("fruit-catcher-fail", true, true, true) ??
|
{
|
||||||
this.GetAnimation("fruit-ryuuta", true, true, true);
|
if (GetTexture(@"fruit-ryuuta") != null ||
|
||||||
|
GetTexture(@"fruit-ryuuta-0") != null)
|
||||||
|
return new LegacyCatcherOld();
|
||||||
|
}
|
||||||
|
|
||||||
case CatchSkinComponents.CatcherKiai:
|
if (GetTexture(@"fruit-catcher-idle") != null ||
|
||||||
return this.GetAnimation("fruit-catcher-kiai", true, true, true) ??
|
GetTexture(@"fruit-catcher-idle-0") != null)
|
||||||
this.GetAnimation("fruit-ryuuta", true, true, true);
|
return new LegacyCatcherNew();
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
case CatchSkinComponents.CatchComboCounter:
|
case CatchSkinComponents.CatchComboCounter:
|
||||||
if (providesComboCounter)
|
if (providesComboCounter)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Skinning
|
namespace osu.Game.Rulesets.Catch.Skinning.Legacy
|
||||||
{
|
{
|
||||||
public class LegacyBananaPiece : LegacyCatchHitObjectPiece
|
public class LegacyBananaPiece : LegacyCatchHitObjectPiece
|
||||||
{
|
{
|
@ -13,12 +13,13 @@ using osu.Game.Skinning;
|
|||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Skinning
|
namespace osu.Game.Rulesets.Catch.Skinning.Legacy
|
||||||
{
|
{
|
||||||
public abstract class LegacyCatchHitObjectPiece : PoolableDrawable
|
public abstract class LegacyCatchHitObjectPiece : PoolableDrawable
|
||||||
{
|
{
|
||||||
public readonly Bindable<Color4> AccentColour = new Bindable<Color4>();
|
public readonly Bindable<Color4> AccentColour = new Bindable<Color4>();
|
||||||
public readonly Bindable<bool> HyperDash = new Bindable<bool>();
|
public readonly Bindable<bool> HyperDash = new Bindable<bool>();
|
||||||
|
public readonly Bindable<int> IndexInBeatmap = new Bindable<int>();
|
||||||
|
|
||||||
private readonly Sprite colouredSprite;
|
private readonly Sprite colouredSprite;
|
||||||
private readonly Sprite overlaySprite;
|
private readonly Sprite overlaySprite;
|
||||||
@ -64,6 +65,7 @@ namespace osu.Game.Rulesets.Catch.Skinning
|
|||||||
|
|
||||||
AccentColour.BindTo(ObjectState.AccentColour);
|
AccentColour.BindTo(ObjectState.AccentColour);
|
||||||
HyperDash.BindTo(ObjectState.HyperDash);
|
HyperDash.BindTo(ObjectState.HyperDash);
|
||||||
|
IndexInBeatmap.BindTo(ObjectState.IndexInBeatmap);
|
||||||
|
|
||||||
hyperSprite.Colour = Skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDashFruit)?.Value ??
|
hyperSprite.Colour = Skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDashFruit)?.Value ??
|
||||||
Skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDash)?.Value ??
|
Skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDash)?.Value ??
|
69
osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherNew.cs
Normal file
69
osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherNew.cs
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Animations;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Rulesets.Catch.UI;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Catch.Skinning.Legacy
|
||||||
|
{
|
||||||
|
public class LegacyCatcherNew : CompositeDrawable
|
||||||
|
{
|
||||||
|
[Resolved]
|
||||||
|
private Bindable<CatcherAnimationState> currentState { get; set; }
|
||||||
|
|
||||||
|
private readonly Dictionary<CatcherAnimationState, Drawable> drawables = new Dictionary<CatcherAnimationState, Drawable>();
|
||||||
|
|
||||||
|
private Drawable currentDrawable;
|
||||||
|
|
||||||
|
public LegacyCatcherNew()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(ISkinSource skin)
|
||||||
|
{
|
||||||
|
foreach (var state in Enum.GetValues(typeof(CatcherAnimationState)).Cast<CatcherAnimationState>())
|
||||||
|
{
|
||||||
|
AddInternal(drawables[state] = getDrawableFor(state).With(d =>
|
||||||
|
{
|
||||||
|
d.Anchor = Anchor.TopCentre;
|
||||||
|
d.Origin = Anchor.TopCentre;
|
||||||
|
d.RelativeSizeAxes = Axes.Both;
|
||||||
|
d.Size = Vector2.One;
|
||||||
|
d.FillMode = FillMode.Fit;
|
||||||
|
d.Alpha = 0;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
currentDrawable = drawables[CatcherAnimationState.Idle];
|
||||||
|
|
||||||
|
Drawable getDrawableFor(CatcherAnimationState state) =>
|
||||||
|
skin.GetAnimation(@$"fruit-catcher-{state.ToString().ToLowerInvariant()}", true, true, true) ??
|
||||||
|
skin.GetAnimation(@"fruit-catcher-idle", true, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
currentState.BindValueChanged(state =>
|
||||||
|
{
|
||||||
|
currentDrawable.Alpha = 0;
|
||||||
|
currentDrawable = drawables[state.NewValue];
|
||||||
|
currentDrawable.Alpha = 1;
|
||||||
|
|
||||||
|
(currentDrawable as IFramedAnimation)?.GotoFrame(0);
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
32
osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherOld.cs
Normal file
32
osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherOld.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Catch.Skinning.Legacy
|
||||||
|
{
|
||||||
|
public class LegacyCatcherOld : CompositeDrawable
|
||||||
|
{
|
||||||
|
public LegacyCatcherOld()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(ISkinSource skin)
|
||||||
|
{
|
||||||
|
InternalChild = skin.GetAnimation(@"fruit-ryuuta", true, true, true).With(d =>
|
||||||
|
{
|
||||||
|
d.Anchor = Anchor.TopCentre;
|
||||||
|
d.Origin = Anchor.TopCentre;
|
||||||
|
d.RelativeSizeAxes = Axes.Both;
|
||||||
|
d.Size = Vector2.One;
|
||||||
|
d.FillMode = FillMode.Fit;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,7 @@
|
|||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Skinning
|
namespace osu.Game.Rulesets.Catch.Skinning.Legacy
|
||||||
{
|
{
|
||||||
public class LegacyDropletPiece : LegacyCatchHitObjectPiece
|
public class LegacyDropletPiece : LegacyCatchHitObjectPiece
|
||||||
{
|
{
|
@ -1,23 +1,20 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Game.Rulesets.Catch.Objects;
|
||||||
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Skinning.Legacy
|
namespace osu.Game.Rulesets.Catch.Skinning.Legacy
|
||||||
{
|
{
|
||||||
internal class LegacyFruitPiece : LegacyCatchHitObjectPiece
|
internal class LegacyFruitPiece : LegacyCatchHitObjectPiece
|
||||||
{
|
{
|
||||||
public readonly Bindable<FruitVisualRepresentation> VisualRepresentation = new Bindable<FruitVisualRepresentation>();
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
var fruitState = (IHasFruitState)ObjectState;
|
IndexInBeatmap.BindValueChanged(index =>
|
||||||
VisualRepresentation.BindTo(fruitState.VisualRepresentation);
|
{
|
||||||
|
setTexture(Fruit.GetVisualRepresentation(index.NewValue));
|
||||||
VisualRepresentation.BindValueChanged(visual => setTexture(visual.NewValue), true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTexture(FruitVisualRepresentation visualRepresentation)
|
private void setTexture(FruitVisualRepresentation visualRepresentation)
|
||||||
|
@ -25,9 +25,9 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
protected override void SkinChanged(ISkinSource skin)
|
||||||
{
|
{
|
||||||
base.SkinChanged(skin, allowFallback);
|
base.SkinChanged(skin);
|
||||||
ComboCounter?.UpdateCombo(currentCombo);
|
ComboCounter?.UpdateCombo(currentCombo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,10 +7,8 @@ using JetBrains.Annotations;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Animations;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Pooling;
|
using osu.Framework.Graphics.Pooling;
|
||||||
using osu.Framework.Input.Bindings;
|
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
@ -25,7 +23,7 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.UI
|
namespace osu.Game.Rulesets.Catch.UI
|
||||||
{
|
{
|
||||||
public class Catcher : SkinReloadableDrawable, IKeyBindingHandler<CatchAction>
|
public class Catcher : SkinReloadableDrawable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The default colour used to tint hyper-dash fruit, along with the moving catcher, its trail
|
/// The default colour used to tint hyper-dash fruit, along with the moving catcher, its trail
|
||||||
@ -53,6 +51,11 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const double BASE_SPEED = 1.0;
|
public const double BASE_SPEED = 1.0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The current speed of the catcher.
|
||||||
|
/// </summary>
|
||||||
|
public double Speed => (Dashing ? 1 : 0.5) * BASE_SPEED * hyperDashModifier;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The amount by which caught fruit should be offset from the plate surface to make them look visually "caught".
|
/// The amount by which caught fruit should be offset from the plate surface to make them look visually "caught".
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -78,24 +81,23 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Container<CaughtObject> droppedObjectTarget;
|
private readonly Container<CaughtObject> droppedObjectTarget;
|
||||||
|
|
||||||
public CatcherAnimationState CurrentState { get; private set; }
|
public CatcherAnimationState CurrentState
|
||||||
|
{
|
||||||
|
get => body.AnimationState.Value;
|
||||||
|
private set => body.AnimationState.Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The width of the catcher which can receive fruit. Equivalent to "catchMargin" in osu-stable.
|
/// The width of the catcher which can receive fruit. Equivalent to "catchMargin" in osu-stable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const float ALLOWED_CATCH_RANGE = 0.8f;
|
public const float ALLOWED_CATCH_RANGE = 0.8f;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The drawable catcher for <see cref="CurrentState"/>.
|
|
||||||
/// </summary>
|
|
||||||
internal Drawable CurrentDrawableCatcher => currentCatcher.Drawable;
|
|
||||||
|
|
||||||
private bool dashing;
|
private bool dashing;
|
||||||
|
|
||||||
public bool Dashing
|
public bool Dashing
|
||||||
{
|
{
|
||||||
get => dashing;
|
get => dashing;
|
||||||
protected set
|
set
|
||||||
{
|
{
|
||||||
if (value == dashing) return;
|
if (value == dashing) return;
|
||||||
|
|
||||||
@ -105,22 +107,22 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Direction VisualDirection
|
||||||
|
{
|
||||||
|
get => Scale.X > 0 ? Direction.Right : Direction.Left;
|
||||||
|
set => Scale = new Vector2((value == Direction.Right ? 1 : -1) * Math.Abs(Scale.X), Scale.Y);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Width of the area that can be used to attempt catches during gameplay.
|
/// Width of the area that can be used to attempt catches during gameplay.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly float catchWidth;
|
private readonly float catchWidth;
|
||||||
|
|
||||||
private readonly CatcherSprite catcherIdle;
|
private readonly SkinnableCatcher body;
|
||||||
private readonly CatcherSprite catcherKiai;
|
|
||||||
private readonly CatcherSprite catcherFail;
|
|
||||||
|
|
||||||
private CatcherSprite currentCatcher;
|
|
||||||
|
|
||||||
private Color4 hyperDashColour = DEFAULT_HYPER_DASH_COLOUR;
|
private Color4 hyperDashColour = DEFAULT_HYPER_DASH_COLOUR;
|
||||||
private Color4 hyperDashEndGlowColour = DEFAULT_HYPER_DASH_COLOUR;
|
private Color4 hyperDashEndGlowColour = DEFAULT_HYPER_DASH_COLOUR;
|
||||||
|
|
||||||
private int currentDirection;
|
|
||||||
|
|
||||||
private double hyperDashModifier = 1;
|
private double hyperDashModifier = 1;
|
||||||
private int hyperDashDirection;
|
private int hyperDashDirection;
|
||||||
private float hyperDashTargetPosition;
|
private float hyperDashTargetPosition;
|
||||||
@ -156,21 +158,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
},
|
},
|
||||||
catcherIdle = new CatcherSprite(CatcherAnimationState.Idle)
|
body = new SkinnableCatcher(),
|
||||||
{
|
|
||||||
Anchor = Anchor.TopCentre,
|
|
||||||
Alpha = 0,
|
|
||||||
},
|
|
||||||
catcherKiai = new CatcherSprite(CatcherAnimationState.Kiai)
|
|
||||||
{
|
|
||||||
Anchor = Anchor.TopCentre,
|
|
||||||
Alpha = 0,
|
|
||||||
},
|
|
||||||
catcherFail = new CatcherSprite(CatcherAnimationState.Fail)
|
|
||||||
{
|
|
||||||
Anchor = Anchor.TopCentre,
|
|
||||||
Alpha = 0,
|
|
||||||
},
|
|
||||||
hitExplosionContainer = new HitExplosionContainer
|
hitExplosionContainer = new HitExplosionContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
@ -184,8 +172,6 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
{
|
{
|
||||||
hitLighting = config.GetBindable<bool>(OsuSetting.HitLighting);
|
hitLighting = config.GetBindable<bool>(OsuSetting.HitLighting);
|
||||||
trails = new CatcherTrailDisplay(this);
|
trails = new CatcherTrailDisplay(this);
|
||||||
|
|
||||||
updateCatcher();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -273,17 +259,16 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
SetHyperDashState();
|
SetHyperDashState();
|
||||||
|
|
||||||
if (result.IsHit)
|
if (result.IsHit)
|
||||||
updateState(hitObject.Kiai ? CatcherAnimationState.Kiai : CatcherAnimationState.Idle);
|
CurrentState = hitObject.Kiai ? CatcherAnimationState.Kiai : CatcherAnimationState.Idle;
|
||||||
else if (!(hitObject is Banana))
|
else if (!(hitObject is Banana))
|
||||||
updateState(CatcherAnimationState.Fail);
|
CurrentState = CatcherAnimationState.Fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnRevertResult(DrawableCatchHitObject drawableObject, JudgementResult result)
|
public void OnRevertResult(DrawableCatchHitObject drawableObject, JudgementResult result)
|
||||||
{
|
{
|
||||||
var catchResult = (CatchJudgementResult)result;
|
var catchResult = (CatchJudgementResult)result;
|
||||||
|
|
||||||
if (CurrentState != catchResult.CatcherAnimationState)
|
CurrentState = catchResult.CatcherAnimationState;
|
||||||
updateState(catchResult.CatcherAnimationState);
|
|
||||||
|
|
||||||
if (HyperDashing != catchResult.CatcherHyperDash)
|
if (HyperDashing != catchResult.CatcherHyperDash)
|
||||||
{
|
{
|
||||||
@ -328,55 +313,6 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdatePosition(float position)
|
|
||||||
{
|
|
||||||
position = Math.Clamp(position, 0, CatchPlayfield.WIDTH);
|
|
||||||
|
|
||||||
if (position == X)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Scale = new Vector2(Math.Abs(Scale.X) * (position > X ? 1 : -1), Scale.Y);
|
|
||||||
X = position;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool OnPressed(CatchAction action)
|
|
||||||
{
|
|
||||||
switch (action)
|
|
||||||
{
|
|
||||||
case CatchAction.MoveLeft:
|
|
||||||
currentDirection--;
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case CatchAction.MoveRight:
|
|
||||||
currentDirection++;
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case CatchAction.Dash:
|
|
||||||
Dashing = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnReleased(CatchAction action)
|
|
||||||
{
|
|
||||||
switch (action)
|
|
||||||
{
|
|
||||||
case CatchAction.MoveLeft:
|
|
||||||
currentDirection++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CatchAction.MoveRight:
|
|
||||||
currentDirection--;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CatchAction.Dash:
|
|
||||||
Dashing = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Drop any fruit off the plate.
|
/// Drop any fruit off the plate.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -396,9 +332,9 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
|
|
||||||
private void updateTrailVisibility() => trails.DisplayTrail = Dashing || HyperDashing;
|
private void updateTrailVisibility() => trails.DisplayTrail = Dashing || HyperDashing;
|
||||||
|
|
||||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
protected override void SkinChanged(ISkinSource skin)
|
||||||
{
|
{
|
||||||
base.SkinChanged(skin, allowFallback);
|
base.SkinChanged(skin);
|
||||||
|
|
||||||
hyperDashColour =
|
hyperDashColour =
|
||||||
skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDash)?.Value ??
|
skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDash)?.Value ??
|
||||||
@ -418,15 +354,6 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
if (currentDirection == 0) return;
|
|
||||||
|
|
||||||
var direction = Math.Sign(currentDirection);
|
|
||||||
|
|
||||||
var dashModifier = Dashing ? 1 : 0.5;
|
|
||||||
var speed = BASE_SPEED * dashModifier * hyperDashModifier;
|
|
||||||
|
|
||||||
UpdatePosition((float)(X + direction * Clock.ElapsedFrameTime * speed));
|
|
||||||
|
|
||||||
// Correct overshooting.
|
// Correct overshooting.
|
||||||
if ((hyperDashDirection > 0 && hyperDashTargetPosition < X) ||
|
if ((hyperDashDirection > 0 && hyperDashTargetPosition < X) ||
|
||||||
(hyperDashDirection < 0 && hyperDashTargetPosition > X))
|
(hyperDashDirection < 0 && hyperDashTargetPosition > X))
|
||||||
@ -436,38 +363,6 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateCatcher()
|
|
||||||
{
|
|
||||||
currentCatcher?.Hide();
|
|
||||||
|
|
||||||
switch (CurrentState)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
currentCatcher = catcherIdle;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CatcherAnimationState.Fail:
|
|
||||||
currentCatcher = catcherFail;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CatcherAnimationState.Kiai:
|
|
||||||
currentCatcher = catcherKiai;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentCatcher.Show();
|
|
||||||
(currentCatcher.Drawable as IFramedAnimation)?.GotoFrame(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateState(CatcherAnimationState state)
|
|
||||||
{
|
|
||||||
if (CurrentState == state)
|
|
||||||
return;
|
|
||||||
|
|
||||||
CurrentState = state;
|
|
||||||
updateCatcher();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void placeCaughtObject(DrawablePalpableCatchHitObject drawableObject, Vector2 position)
|
private void placeCaughtObject(DrawablePalpableCatchHitObject drawableObject, Vector2 position)
|
||||||
{
|
{
|
||||||
var caughtObject = getCaughtObject(drawableObject.HitObject);
|
var caughtObject = getCaughtObject(drawableObject.HitObject);
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Catch.Judgements;
|
using osu.Game.Rulesets.Catch.Judgements;
|
||||||
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
||||||
@ -14,13 +16,20 @@ using osuTK;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.UI
|
namespace osu.Game.Rulesets.Catch.UI
|
||||||
{
|
{
|
||||||
public class CatcherArea : Container
|
public class CatcherArea : Container, IKeyBindingHandler<CatchAction>
|
||||||
{
|
{
|
||||||
public const float CATCHER_SIZE = 106.75f;
|
public const float CATCHER_SIZE = 106.75f;
|
||||||
|
|
||||||
public readonly Catcher MovableCatcher;
|
public readonly Catcher MovableCatcher;
|
||||||
private readonly CatchComboDisplay comboDisplay;
|
private readonly CatchComboDisplay comboDisplay;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <c>-1</c> when only left button is pressed.
|
||||||
|
/// <c>1</c> when only right button is pressed.
|
||||||
|
/// <c>0</c> when none or both left and right buttons are pressed.
|
||||||
|
/// </summary>
|
||||||
|
private int currentDirection;
|
||||||
|
|
||||||
public CatcherArea(Container<CaughtObject> droppedObjectContainer, BeatmapDifficulty difficulty = null)
|
public CatcherArea(Container<CaughtObject> droppedObjectContainer, BeatmapDifficulty difficulty = null)
|
||||||
{
|
{
|
||||||
Size = new Vector2(CatchPlayfield.WIDTH, CATCHER_SIZE);
|
Size = new Vector2(CatchPlayfield.WIDTH, CATCHER_SIZE);
|
||||||
@ -63,16 +72,73 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
MovableCatcher.OnRevertResult(hitObject, result);
|
MovableCatcher.OnRevertResult(hitObject, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
var replayState = (GetContainingInputManager().CurrentState as RulesetInputManagerInputState<CatchAction>)?.LastReplayState as CatchFramedReplayInputHandler.CatchReplayState;
|
||||||
|
|
||||||
|
SetCatcherPosition(
|
||||||
|
replayState?.CatcherX ??
|
||||||
|
(float)(MovableCatcher.X + MovableCatcher.Speed * currentDirection * Clock.ElapsedFrameTime));
|
||||||
|
}
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
{
|
{
|
||||||
base.UpdateAfterChildren();
|
base.UpdateAfterChildren();
|
||||||
|
|
||||||
var state = (GetContainingInputManager().CurrentState as RulesetInputManagerInputState<CatchAction>)?.LastReplayState as CatchFramedReplayInputHandler.CatchReplayState;
|
|
||||||
|
|
||||||
if (state?.CatcherX != null)
|
|
||||||
MovableCatcher.X = state.CatcherX.Value;
|
|
||||||
|
|
||||||
comboDisplay.X = MovableCatcher.X;
|
comboDisplay.X = MovableCatcher.X;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetCatcherPosition(float X)
|
||||||
|
{
|
||||||
|
float lastPosition = MovableCatcher.X;
|
||||||
|
float newPosition = Math.Clamp(X, 0, CatchPlayfield.WIDTH);
|
||||||
|
|
||||||
|
MovableCatcher.X = newPosition;
|
||||||
|
|
||||||
|
if (lastPosition < newPosition)
|
||||||
|
MovableCatcher.VisualDirection = Direction.Right;
|
||||||
|
else if (lastPosition > newPosition)
|
||||||
|
MovableCatcher.VisualDirection = Direction.Left;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool OnPressed(CatchAction action)
|
||||||
|
{
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case CatchAction.MoveLeft:
|
||||||
|
currentDirection--;
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case CatchAction.MoveRight:
|
||||||
|
currentDirection++;
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case CatchAction.Dash:
|
||||||
|
MovableCatcher.Dashing = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnReleased(CatchAction action)
|
||||||
|
{
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case CatchAction.MoveLeft:
|
||||||
|
currentDirection++;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CatchAction.MoveRight:
|
||||||
|
currentDirection--;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CatchAction.Dash:
|
||||||
|
MovableCatcher.Dashing = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,59 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Graphics.Textures;
|
|
||||||
using osu.Game.Skinning;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.UI
|
|
||||||
{
|
|
||||||
public class CatcherSprite : SkinnableDrawable
|
|
||||||
{
|
|
||||||
protected override bool ApplySizeRestrictionsToDefault => true;
|
|
||||||
|
|
||||||
public CatcherSprite(CatcherAnimationState state)
|
|
||||||
: base(new CatchSkinComponent(componentFromState(state)), _ =>
|
|
||||||
new DefaultCatcherSprite(state), confineMode: ConfineMode.ScaleToFit)
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.None;
|
|
||||||
Size = new Vector2(CatcherArea.CATCHER_SIZE);
|
|
||||||
|
|
||||||
// Sets the origin roughly to the centre of the catcher's plate to allow for correct scaling.
|
|
||||||
OriginPosition = new Vector2(0.5f, 0.06f) * CatcherArea.CATCHER_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static CatchSkinComponents componentFromState(CatcherAnimationState state)
|
|
||||||
{
|
|
||||||
switch (state)
|
|
||||||
{
|
|
||||||
case CatcherAnimationState.Fail:
|
|
||||||
return CatchSkinComponents.CatcherFail;
|
|
||||||
|
|
||||||
case CatcherAnimationState.Kiai:
|
|
||||||
return CatchSkinComponents.CatcherKiai;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return CatchSkinComponents.CatcherIdle;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class DefaultCatcherSprite : Sprite
|
|
||||||
{
|
|
||||||
private readonly CatcherAnimationState state;
|
|
||||||
|
|
||||||
public DefaultCatcherSprite(CatcherAnimationState state)
|
|
||||||
{
|
|
||||||
this.state = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(TextureStore textures)
|
|
||||||
{
|
|
||||||
Texture = textures.Get($"Gameplay/catch/fruit-catcher-{state.ToString().ToLower()}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
43
osu.Game.Rulesets.Catch/UI/CatcherTrail.cs
Normal file
43
osu.Game.Rulesets.Catch/UI/CatcherTrail.cs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Pooling;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Catch.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A trail of the catcher.
|
||||||
|
/// It also represents a hyper dash afterimage.
|
||||||
|
/// </summary>
|
||||||
|
public class CatcherTrail : PoolableDrawable
|
||||||
|
{
|
||||||
|
public CatcherAnimationState AnimationState
|
||||||
|
{
|
||||||
|
set => body.AnimationState.Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly SkinnableCatcher body;
|
||||||
|
|
||||||
|
public CatcherTrail()
|
||||||
|
{
|
||||||
|
Size = new Vector2(CatcherArea.CATCHER_SIZE);
|
||||||
|
Origin = Anchor.TopCentre;
|
||||||
|
Blending = BlendingParameters.Additive;
|
||||||
|
InternalChild = body = new SkinnableCatcher
|
||||||
|
{
|
||||||
|
// Using a frozen clock because trails should not be animated when the skin has an animated catcher.
|
||||||
|
// TODO: The animation should be frozen at the animation frame at the time of the trail generation.
|
||||||
|
Clock = new FramedClock(new ManualClock()),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void FreeAfterUse()
|
||||||
|
{
|
||||||
|
ClearTransforms();
|
||||||
|
base.FreeAfterUse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,10 +4,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Animations;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Pooling;
|
using osu.Framework.Graphics.Pooling;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -21,11 +19,11 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
{
|
{
|
||||||
private readonly Catcher catcher;
|
private readonly Catcher catcher;
|
||||||
|
|
||||||
private readonly DrawablePool<CatcherTrailSprite> trailPool;
|
private readonly DrawablePool<CatcherTrail> trailPool;
|
||||||
|
|
||||||
private readonly Container<CatcherTrailSprite> dashTrails;
|
private readonly Container<CatcherTrail> dashTrails;
|
||||||
private readonly Container<CatcherTrailSprite> hyperDashTrails;
|
private readonly Container<CatcherTrail> hyperDashTrails;
|
||||||
private readonly Container<CatcherTrailSprite> endGlowSprites;
|
private readonly Container<CatcherTrail> endGlowSprites;
|
||||||
|
|
||||||
private Color4 hyperDashTrailsColour = Catcher.DEFAULT_HYPER_DASH_COLOUR;
|
private Color4 hyperDashTrailsColour = Catcher.DEFAULT_HYPER_DASH_COLOUR;
|
||||||
|
|
||||||
@ -85,10 +83,10 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
trailPool = new DrawablePool<CatcherTrailSprite>(30),
|
trailPool = new DrawablePool<CatcherTrail>(30),
|
||||||
dashTrails = new Container<CatcherTrailSprite> { RelativeSizeAxes = Axes.Both },
|
dashTrails = new Container<CatcherTrail> { RelativeSizeAxes = Axes.Both },
|
||||||
hyperDashTrails = new Container<CatcherTrailSprite> { RelativeSizeAxes = Axes.Both, Colour = Catcher.DEFAULT_HYPER_DASH_COLOUR },
|
hyperDashTrails = new Container<CatcherTrail> { RelativeSizeAxes = Axes.Both, Colour = Catcher.DEFAULT_HYPER_DASH_COLOUR },
|
||||||
endGlowSprites = new Container<CatcherTrailSprite> { RelativeSizeAxes = Axes.Both, Colour = Catcher.DEFAULT_HYPER_DASH_COLOUR },
|
endGlowSprites = new Container<CatcherTrail> { RelativeSizeAxes = Axes.Both, Colour = Catcher.DEFAULT_HYPER_DASH_COLOUR },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,17 +116,12 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
Scheduler.AddDelayed(displayTrail, catcher.HyperDashing ? 25 : 50);
|
Scheduler.AddDelayed(displayTrail, catcher.HyperDashing ? 25 : 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CatcherTrailSprite createTrailSprite(Container<CatcherTrailSprite> target)
|
private CatcherTrail createTrailSprite(Container<CatcherTrail> target)
|
||||||
{
|
{
|
||||||
var texture = (catcher.CurrentDrawableCatcher as TextureAnimation)?.CurrentFrame ?? ((Sprite)catcher.CurrentDrawableCatcher).Texture;
|
CatcherTrail sprite = trailPool.Get();
|
||||||
|
|
||||||
CatcherTrailSprite sprite = trailPool.Get();
|
sprite.AnimationState = catcher.CurrentState;
|
||||||
|
|
||||||
sprite.Texture = texture;
|
|
||||||
sprite.Anchor = catcher.Anchor;
|
|
||||||
sprite.Scale = catcher.Scale;
|
sprite.Scale = catcher.Scale;
|
||||||
sprite.Blending = BlendingParameters.Additive;
|
|
||||||
sprite.RelativePositionAxes = catcher.RelativePositionAxes;
|
|
||||||
sprite.Position = catcher.Position;
|
sprite.Position = catcher.Position;
|
||||||
|
|
||||||
target.Add(sprite);
|
target.Add(sprite);
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Pooling;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Graphics.Textures;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.UI
|
|
||||||
{
|
|
||||||
public class CatcherTrailSprite : PoolableDrawable
|
|
||||||
{
|
|
||||||
public Texture Texture
|
|
||||||
{
|
|
||||||
set => sprite.Texture = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly Sprite sprite;
|
|
||||||
|
|
||||||
public CatcherTrailSprite()
|
|
||||||
{
|
|
||||||
InternalChild = sprite = new Sprite
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both
|
|
||||||
};
|
|
||||||
|
|
||||||
Size = new Vector2(CatcherArea.CATCHER_SIZE);
|
|
||||||
|
|
||||||
// Sets the origin roughly to the centre of the catcher's plate to allow for correct scaling.
|
|
||||||
OriginPosition = new Vector2(0.5f, 0.06f) * CatcherArea.CATCHER_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void FreeAfterUse()
|
|
||||||
{
|
|
||||||
ClearTransforms();
|
|
||||||
base.FreeAfterUse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +1,11 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
namespace osu.Game.Rulesets.Catch.UI
|
||||||
{
|
{
|
||||||
public enum HoldNotePosition
|
public enum Direction
|
||||||
{
|
{
|
||||||
Start,
|
Right = 1,
|
||||||
End
|
Left = -1
|
||||||
}
|
}
|
||||||
}
|
}
|
33
osu.Game.Rulesets.Catch/UI/SkinnableCatcher.cs
Normal file
33
osu.Game.Rulesets.Catch/UI/SkinnableCatcher.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Rulesets.Catch.Skinning.Default;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Catch.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The visual representation of the <see cref="Catcher"/>.
|
||||||
|
/// It includes the body part of the catcher and the catcher plate.
|
||||||
|
/// </summary>
|
||||||
|
public class SkinnableCatcher : SkinnableDrawable
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This is used by skin elements to determine which texture of the catcher is used.
|
||||||
|
/// </summary>
|
||||||
|
[Cached]
|
||||||
|
public readonly Bindable<CatcherAnimationState> AnimationState = new Bindable<CatcherAnimationState>();
|
||||||
|
|
||||||
|
public SkinnableCatcher()
|
||||||
|
: base(new CatchSkinComponent(CatchSkinComponents.Catcher), _ => new DefaultCatcher())
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre;
|
||||||
|
// Sets the origin roughly to the centre of the catcher's plate to allow for correct scaling.
|
||||||
|
OriginPosition = new Vector2(0.5f, 0.06f) * CatcherArea.CATCHER_SIZE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,31 +1,54 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Tests.Editor
|
namespace osu.Game.Rulesets.Mania.Tests.Editor
|
||||||
{
|
{
|
||||||
public abstract class ManiaSelectionBlueprintTestScene : SelectionBlueprintTestScene
|
public abstract class ManiaSelectionBlueprintTestScene : SelectionBlueprintTestScene
|
||||||
{
|
{
|
||||||
[Cached(Type = typeof(IAdjustableClock))]
|
protected override Container<Drawable> Content => blueprints ?? base.Content;
|
||||||
private readonly IAdjustableClock clock = new StopwatchClock();
|
|
||||||
|
|
||||||
protected ManiaSelectionBlueprintTestScene()
|
private readonly Container blueprints;
|
||||||
|
|
||||||
|
[Cached(typeof(Playfield))]
|
||||||
|
public Playfield Playfield { get; }
|
||||||
|
|
||||||
|
private readonly ScrollingTestContainer scrollingTestContainer;
|
||||||
|
|
||||||
|
protected ScrollingDirection Direction
|
||||||
{
|
{
|
||||||
Add(new Column(0)
|
set => scrollingTestContainer.Direction = value;
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
AccentColour = Color4.OrangeRed,
|
|
||||||
Clock = new FramedClock(new StopwatchClock()), // No scroll
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ManiaPlayfield Playfield => null;
|
protected ManiaSelectionBlueprintTestScene(int columns)
|
||||||
|
{
|
||||||
|
var stageDefinitions = new List<StageDefinition> { new StageDefinition { Columns = columns } };
|
||||||
|
base.Content.Child = scrollingTestContainer = new ScrollingTestContainer(ScrollingDirection.Up)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
Playfield = new ManiaPlayfield(stageDefinitions)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
blueprints = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
AddToggleStep("Downward scroll", b => Direction = b ? ScrollingDirection.Down : ScrollingDirection.Up);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,55 +1,32 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
||||||
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.UI.Scrolling;
|
|
||||||
using osu.Game.Tests.Visual;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Tests.Editor
|
namespace osu.Game.Rulesets.Mania.Tests.Editor
|
||||||
{
|
{
|
||||||
public class TestSceneHoldNoteSelectionBlueprint : ManiaSelectionBlueprintTestScene
|
public class TestSceneHoldNoteSelectionBlueprint : ManiaSelectionBlueprintTestScene
|
||||||
{
|
{
|
||||||
private readonly DrawableHoldNote drawableObject;
|
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content ?? base.Content;
|
|
||||||
private readonly Container content;
|
|
||||||
|
|
||||||
public TestSceneHoldNoteSelectionBlueprint()
|
public TestSceneHoldNoteSelectionBlueprint()
|
||||||
|
: base(4)
|
||||||
{
|
{
|
||||||
var holdNote = new HoldNote { Column = 0, Duration = 1000 };
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
var holdNote = new HoldNote
|
||||||
|
{
|
||||||
|
Column = i,
|
||||||
|
StartTime = i * 100,
|
||||||
|
Duration = 500
|
||||||
|
};
|
||||||
holdNote.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
holdNote.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||||
|
|
||||||
base.Content.Child = content = new ScrollingTestContainer(ScrollingDirection.Down)
|
var drawableHitObject = new DrawableHoldNote(holdNote);
|
||||||
{
|
Playfield.Add(drawableHitObject);
|
||||||
Anchor = Anchor.Centre,
|
AddBlueprint(new HoldNoteSelectionBlueprint(holdNote), drawableHitObject);
|
||||||
Origin = Anchor.Centre,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Width = 50,
|
|
||||||
Child = drawableObject = new DrawableHoldNote(holdNote)
|
|
||||||
{
|
|
||||||
Height = 300,
|
|
||||||
AccentColour = { Value = OsuColour.Gray(0.3f) }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
AddBlueprint(new HoldNoteSelectionBlueprint(holdNote), drawableObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
|
||||||
base.Update();
|
|
||||||
|
|
||||||
foreach (var nested in drawableObject.NestedHitObjects)
|
|
||||||
{
|
|
||||||
double finalPosition = (nested.HitObject.StartTime - drawableObject.HitObject.StartTime) / drawableObject.HitObject.Duration;
|
|
||||||
nested.Y = (float)(-finalPosition * content.DrawHeight);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ using osu.Framework.Utils;
|
|||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.Edit;
|
using osu.Game.Rulesets.Mania.Edit;
|
||||||
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
using osu.Game.Rulesets.Mania.Edit.Blueprints.Components;
|
||||||
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.Mania.Skinning.Default;
|
using osu.Game.Rulesets.Mania.Skinning.Default;
|
||||||
@ -184,8 +184,8 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
|
|||||||
AddAssert("head note positioned correctly", () => Precision.AlmostEquals(holdNote.ScreenSpaceDrawQuad.BottomLeft, holdNote.Head.ScreenSpaceDrawQuad.BottomLeft));
|
AddAssert("head note positioned correctly", () => Precision.AlmostEquals(holdNote.ScreenSpaceDrawQuad.BottomLeft, holdNote.Head.ScreenSpaceDrawQuad.BottomLeft));
|
||||||
AddAssert("tail note positioned correctly", () => Precision.AlmostEquals(holdNote.ScreenSpaceDrawQuad.TopLeft, holdNote.Tail.ScreenSpaceDrawQuad.BottomLeft));
|
AddAssert("tail note positioned correctly", () => Precision.AlmostEquals(holdNote.ScreenSpaceDrawQuad.TopLeft, holdNote.Tail.ScreenSpaceDrawQuad.BottomLeft));
|
||||||
|
|
||||||
AddAssert("head blueprint positioned correctly", () => this.ChildrenOfType<HoldNoteNoteOverlay>().ElementAt(0).DrawPosition == holdNote.Head.DrawPosition);
|
AddAssert("head blueprint positioned correctly", () => this.ChildrenOfType<EditNotePiece>().ElementAt(0).DrawPosition == holdNote.Head.DrawPosition);
|
||||||
AddAssert("tail blueprint positioned correctly", () => this.ChildrenOfType<HoldNoteNoteOverlay>().ElementAt(1).DrawPosition == holdNote.Tail.DrawPosition);
|
AddAssert("tail blueprint positioned correctly", () => this.ChildrenOfType<EditNotePiece>().ElementAt(1).DrawPosition == holdNote.Tail.DrawPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setScrollStep(ScrollingDirection direction)
|
private void setScrollStep(ScrollingDirection direction)
|
||||||
|
@ -1,40 +1,32 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
||||||
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.UI.Scrolling;
|
|
||||||
using osu.Game.Tests.Visual;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Tests.Editor
|
namespace osu.Game.Rulesets.Mania.Tests.Editor
|
||||||
{
|
{
|
||||||
public class TestSceneNoteSelectionBlueprint : ManiaSelectionBlueprintTestScene
|
public class TestSceneNoteSelectionBlueprint : ManiaSelectionBlueprintTestScene
|
||||||
{
|
{
|
||||||
protected override Container<Drawable> Content => content ?? base.Content;
|
|
||||||
private readonly Container content;
|
|
||||||
|
|
||||||
public TestSceneNoteSelectionBlueprint()
|
public TestSceneNoteSelectionBlueprint()
|
||||||
|
: base(4)
|
||||||
{
|
{
|
||||||
var note = new Note { Column = 0 };
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
var note = new Note
|
||||||
|
{
|
||||||
|
Column = i,
|
||||||
|
StartTime = i * 200,
|
||||||
|
};
|
||||||
note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||||
|
|
||||||
DrawableNote drawableObject;
|
var drawableHitObject = new DrawableNote(note);
|
||||||
|
Playfield.Add(drawableHitObject);
|
||||||
base.Content.Child = content = new ScrollingTestContainer(ScrollingDirection.Down)
|
AddBlueprint(new NoteSelectionBlueprint(note), drawableHitObject);
|
||||||
{
|
}
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Size = new Vector2(50, 20),
|
|
||||||
Child = drawableObject = new DrawableNote(note)
|
|
||||||
};
|
|
||||||
|
|
||||||
AddBlueprint(new NoteSelectionBlueprint(note), drawableObject);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty
|
|||||||
{
|
{
|
||||||
public class ManiaDifficultyAttributes : DifficultyAttributes
|
public class ManiaDifficultyAttributes : DifficultyAttributes
|
||||||
{
|
{
|
||||||
public double GreatHitWindow;
|
public double GreatHitWindow { get; set; }
|
||||||
public double ScoreMultiplier;
|
public double ScoreMultiplier { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,9 +44,6 @@ namespace osu.Game.Rulesets.Mania.Difficulty
|
|||||||
countMeh = Score.Statistics.GetOrDefault(HitResult.Meh);
|
countMeh = Score.Statistics.GetOrDefault(HitResult.Meh);
|
||||||
countMiss = Score.Statistics.GetOrDefault(HitResult.Miss);
|
countMiss = Score.Statistics.GetOrDefault(HitResult.Miss);
|
||||||
|
|
||||||
if (mods.Any(m => !m.Ranked))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
IEnumerable<Mod> scoreIncreaseMods = Ruleset.GetModsFor(ModType.DifficultyIncrease);
|
IEnumerable<Mod> scoreIncreaseMods = Ruleset.GetModsFor(ModType.DifficultyIncrease);
|
||||||
|
|
||||||
double scoreMultiplier = 1.0;
|
double scoreMultiplier = 1.0;
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Game.Rulesets.Mania.Edit.Blueprints.Components;
|
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|
||||||
{
|
|
||||||
public class HoldNoteNoteOverlay : CompositeDrawable
|
|
||||||
{
|
|
||||||
private readonly HoldNoteSelectionBlueprint holdNoteBlueprint;
|
|
||||||
private readonly HoldNotePosition position;
|
|
||||||
|
|
||||||
public HoldNoteNoteOverlay(HoldNoteSelectionBlueprint holdNoteBlueprint, HoldNotePosition position)
|
|
||||||
{
|
|
||||||
this.holdNoteBlueprint = holdNoteBlueprint;
|
|
||||||
this.position = position;
|
|
||||||
|
|
||||||
InternalChild = new EditNotePiece { RelativeSizeAxes = Axes.X };
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
|
||||||
base.Update();
|
|
||||||
|
|
||||||
var drawableObject = holdNoteBlueprint.DrawableObject;
|
|
||||||
|
|
||||||
// Todo: This shouldn't exist, mania should not reference the drawable hitobject directly.
|
|
||||||
if (drawableObject.IsLoaded)
|
|
||||||
{
|
|
||||||
DrawableNote note = position == HoldNotePosition.Start ? (DrawableNote)drawableObject.Head : drawableObject.Tail;
|
|
||||||
|
|
||||||
Anchor = note.Anchor;
|
|
||||||
Origin = note.Origin;
|
|
||||||
|
|
||||||
Size = note.DrawSize;
|
|
||||||
Position = note.DrawPosition;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,14 +2,13 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Rulesets.Mania.Edit.Blueprints.Components;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -17,13 +16,12 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
{
|
{
|
||||||
public class HoldNoteSelectionBlueprint : ManiaSelectionBlueprint<HoldNote>
|
public class HoldNoteSelectionBlueprint : ManiaSelectionBlueprint<HoldNote>
|
||||||
{
|
{
|
||||||
public new DrawableHoldNote DrawableObject => (DrawableHoldNote)base.DrawableObject;
|
|
||||||
|
|
||||||
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuColour colours { get; set; }
|
private OsuColour colours { get; set; }
|
||||||
|
|
||||||
|
private EditNotePiece head;
|
||||||
|
private EditNotePiece tail;
|
||||||
|
|
||||||
public HoldNoteSelectionBlueprint(HoldNote hold)
|
public HoldNoteSelectionBlueprint(HoldNote hold)
|
||||||
: base(hold)
|
: base(hold)
|
||||||
{
|
{
|
||||||
@ -32,12 +30,10 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(IScrollingInfo scrollingInfo)
|
private void load(IScrollingInfo scrollingInfo)
|
||||||
{
|
{
|
||||||
direction.BindTo(scrollingInfo.Direction);
|
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new HoldNoteNoteOverlay(this, HoldNotePosition.Start),
|
head = new EditNotePiece { RelativeSizeAxes = Axes.X },
|
||||||
new HoldNoteNoteOverlay(this, HoldNotePosition.End),
|
tail = new EditNotePiece { RelativeSizeAxes = Axes.X },
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -58,21 +54,13 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
// Todo: This shouldn't exist, mania should not reference the drawable hitobject directly.
|
head.Y = HitObjectContainer.PositionAtTime(HitObject.Head.StartTime, HitObject.StartTime);
|
||||||
if (DrawableObject.IsLoaded)
|
tail.Y = HitObjectContainer.PositionAtTime(HitObject.Tail.StartTime, HitObject.StartTime);
|
||||||
{
|
Height = HitObjectContainer.LengthAtTime(HitObject.StartTime, HitObject.EndTime) + tail.DrawHeight;
|
||||||
Size = DrawableObject.DrawSize + new Vector2(0, DrawableObject.Tail.DrawHeight);
|
|
||||||
|
|
||||||
// This is a side-effect of not matching the hitobject's anchors/origins, which is kinda hard to do
|
|
||||||
// When scrolling upwards our origin is already at the top of the head note (which is the intended location),
|
|
||||||
// but when scrolling downwards our origin is at the _bottom_ of the tail note (where we need to be at the _top_ of the tail note)
|
|
||||||
if (direction.Value == ScrollingDirection.Down)
|
|
||||||
Y -= DrawableObject.Tail.DrawHeight;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Quad SelectionQuad => ScreenSpaceDrawQuad;
|
public override Quad SelectionQuad => ScreenSpaceDrawQuad;
|
||||||
|
|
||||||
public override Vector2 ScreenSpaceSelectionPoint => DrawableObject.Head.ScreenSpaceDrawQuad.Centre;
|
public override Vector2 ScreenSpaceSelectionPoint => head.ScreenSpaceDrawQuad.Centre;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,20 +5,23 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
||||||
{
|
{
|
||||||
public abstract class ManiaSelectionBlueprint<T> : HitObjectSelectionBlueprint<T>
|
public abstract class ManiaSelectionBlueprint<T> : HitObjectSelectionBlueprint<T>
|
||||||
where T : ManiaHitObject
|
where T : ManiaHitObject
|
||||||
{
|
{
|
||||||
public new DrawableManiaHitObject DrawableObject => (DrawableManiaHitObject)base.DrawableObject;
|
[Resolved]
|
||||||
|
private Playfield playfield { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IScrollingInfo scrollingInfo { get; set; }
|
private IScrollingInfo scrollingInfo { get; set; }
|
||||||
|
|
||||||
|
protected ScrollingHitObjectContainer HitObjectContainer => ((ManiaPlayfield)playfield).GetColumn(HitObject.Column).HitObjectContainer;
|
||||||
|
|
||||||
protected ManiaSelectionBlueprint(T hitObject)
|
protected ManiaSelectionBlueprint(T hitObject)
|
||||||
: base(hitObject)
|
: base(hitObject)
|
||||||
{
|
{
|
||||||
@ -29,19 +32,13 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
Position = Parent.ToLocalSpace(DrawableObject.ToScreenSpace(Vector2.Zero));
|
var anchor = scrollingInfo.Direction.Value == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
|
||||||
}
|
Anchor = Origin = anchor;
|
||||||
|
foreach (var child in InternalChildren)
|
||||||
|
child.Anchor = child.Origin = anchor;
|
||||||
|
|
||||||
public override void Show()
|
Position = Parent.ToLocalSpace(HitObjectContainer.ScreenSpacePositionAtTime(HitObject.StartTime)) - AnchorPosition;
|
||||||
{
|
Width = HitObjectContainer.DrawWidth;
|
||||||
DrawableObject.AlwaysAlive = true;
|
|
||||||
base.Show();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Hide()
|
|
||||||
{
|
|
||||||
DrawableObject.AlwaysAlive = false;
|
|
||||||
base.Hide();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,14 +14,5 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
{
|
{
|
||||||
AddInternal(new EditNotePiece { RelativeSizeAxes = Axes.X });
|
AddInternal(new EditNotePiece { RelativeSizeAxes = Axes.X });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
|
||||||
base.Update();
|
|
||||||
|
|
||||||
// Todo: This shouldn't exist, mania should not reference the drawable hitobject directly.
|
|
||||||
if (DrawableObject.IsLoaded)
|
|
||||||
Size = DrawableObject.DrawSize;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@ namespace osu.Game.Rulesets.Mania.Mods
|
|||||||
public abstract int KeyCount { get; }
|
public abstract int KeyCount { get; }
|
||||||
public override ModType Type => ModType.Conversion;
|
public override ModType Type => ModType.Conversion;
|
||||||
public override double ScoreMultiplier => 1; // TODO: Implement the mania key mod score multiplier
|
public override double ScoreMultiplier => 1; // TODO: Implement the mania key mod score multiplier
|
||||||
public override bool Ranked => true;
|
|
||||||
|
|
||||||
public void ApplyToBeatmapConverter(IBeatmapConverter beatmapConverter)
|
public void ApplyToBeatmapConverter(IBeatmapConverter beatmapConverter)
|
||||||
{
|
{
|
||||||
|
@ -24,8 +24,6 @@ namespace osu.Game.Rulesets.Mania.Mods
|
|||||||
|
|
||||||
public override ModType Type => ModType.Conversion;
|
public override ModType Type => ModType.Conversion;
|
||||||
|
|
||||||
public override bool Ranked => false;
|
|
||||||
|
|
||||||
public void ApplyToDrawableRuleset(DrawableRuleset<ManiaHitObject> drawableRuleset)
|
public void ApplyToDrawableRuleset(DrawableRuleset<ManiaHitObject> drawableRuleset)
|
||||||
{
|
{
|
||||||
var maniaRuleset = (DrawableManiaRuleset)drawableRuleset;
|
var maniaRuleset = (DrawableManiaRuleset)drawableRuleset;
|
||||||
|
@ -17,7 +17,6 @@ namespace osu.Game.Rulesets.Mania.Mods
|
|||||||
public override ModType Type => ModType.Conversion;
|
public override ModType Type => ModType.Conversion;
|
||||||
public override string Description => "Notes are flipped horizontally.";
|
public override string Description => "Notes are flipped horizontally.";
|
||||||
public override double ScoreMultiplier => 1;
|
public override double ScoreMultiplier => 1;
|
||||||
public override bool Ranked => true;
|
|
||||||
|
|
||||||
public void ApplyToBeatmap(IBeatmap beatmap)
|
public void ApplyToBeatmap(IBeatmap beatmap)
|
||||||
{
|
{
|
||||||
|
@ -85,63 +85,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
AccentColour.UnbindFrom(ParentHitObject.AccentColour);
|
AccentColour.UnbindFrom(ParentHitObject.AccentColour);
|
||||||
}
|
}
|
||||||
|
|
||||||
private double computedLifetimeStart;
|
|
||||||
|
|
||||||
public override double LifetimeStart
|
|
||||||
{
|
|
||||||
get => base.LifetimeStart;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
computedLifetimeStart = value;
|
|
||||||
|
|
||||||
if (!AlwaysAlive)
|
|
||||||
base.LifetimeStart = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private double computedLifetimeEnd;
|
|
||||||
|
|
||||||
public override double LifetimeEnd
|
|
||||||
{
|
|
||||||
get => base.LifetimeEnd;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
computedLifetimeEnd = value;
|
|
||||||
|
|
||||||
if (!AlwaysAlive)
|
|
||||||
base.LifetimeEnd = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool alwaysAlive;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether this <see cref="DrawableManiaHitObject"/> should always remain alive.
|
|
||||||
/// </summary>
|
|
||||||
internal bool AlwaysAlive
|
|
||||||
{
|
|
||||||
get => alwaysAlive;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (alwaysAlive == value)
|
|
||||||
return;
|
|
||||||
|
|
||||||
alwaysAlive = value;
|
|
||||||
|
|
||||||
if (value)
|
|
||||||
{
|
|
||||||
// Set the base lifetimes directly, to avoid mangling the computed lifetimes
|
|
||||||
base.LifetimeStart = double.MinValue;
|
|
||||||
base.LifetimeEnd = double.MaxValue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LifetimeStart = computedLifetimeStart;
|
|
||||||
LifetimeEnd = computedLifetimeEnd;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void OnDirectionChanged(ValueChangedEvent<ScrollingDirection> e)
|
protected virtual void OnDirectionChanged(ValueChangedEvent<ScrollingDirection> e)
|
||||||
{
|
{
|
||||||
Anchor = Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
|
Anchor = Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
|
||||||
|
@ -69,10 +69,10 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
|
|||||||
|
|
||||||
private void sourceChanged()
|
private void sourceChanged()
|
||||||
{
|
{
|
||||||
isLegacySkin = new Lazy<bool>(() => Source.GetConfig<LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version) != null);
|
isLegacySkin = new Lazy<bool>(() => FindProvider(s => s.GetConfig<LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version) != null) != null);
|
||||||
hasKeyTexture = new Lazy<bool>(() => Source.GetAnimation(
|
hasKeyTexture = new Lazy<bool>(() => FindProvider(s => s.GetAnimation(
|
||||||
this.GetManiaSkinConfig<string>(LegacyManiaSkinConfigurationLookups.KeyImage, 0)?.Value
|
s.GetManiaSkinConfig<string>(LegacyManiaSkinConfigurationLookups.KeyImage, 0)?.Value
|
||||||
?? "mania-key1", true, true) != null);
|
?? "mania-key1", true, true) != null) != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Drawable GetDrawableComponent(ISkinComponent component)
|
public override Drawable GetDrawableComponent(ISkinComponent component)
|
||||||
|
@ -33,9 +33,9 @@ namespace osu.Game.Rulesets.Mania.UI.Components
|
|||||||
Direction.BindValueChanged(onDirectionChanged, true);
|
Direction.BindValueChanged(onDirectionChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
protected override void SkinChanged(ISkinSource skin)
|
||||||
{
|
{
|
||||||
base.SkinChanged(skin, allowFallback);
|
base.SkinChanged(skin);
|
||||||
UpdateHitPosition();
|
UpdateHitPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
osu file format v14
|
||||||
|
|
||||||
|
[General]
|
||||||
|
Mode: 0
|
||||||
|
|
||||||
|
[TimingPoints]
|
||||||
|
0,300,4,1,2,100,1,0
|
||||||
|
|
||||||
|
[HitObjects]
|
||||||
|
444,320,1000,5,0,0:0:0:0:
|
@ -1,5 +1,5 @@
|
|||||||
[General]
|
[General]
|
||||||
Version: 1.0
|
// no version specified means v1
|
||||||
|
|
||||||
[Fonts]
|
[Fonts]
|
||||||
HitCircleOverlap: 3
|
HitCircleOverlap: 3
|
||||||
|
@ -39,18 +39,28 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestLegacySmoothCursorTrail()
|
public void TestLegacySmoothCursorTrail()
|
||||||
{
|
{
|
||||||
createTest(() => new LegacySkinContainer(false)
|
createTest(() =>
|
||||||
{
|
{
|
||||||
Child = new LegacyCursorTrail()
|
var skinContainer = new LegacySkinContainer(false);
|
||||||
|
var legacyCursorTrail = new LegacyCursorTrail(skinContainer);
|
||||||
|
|
||||||
|
skinContainer.Child = legacyCursorTrail;
|
||||||
|
|
||||||
|
return skinContainer;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestLegacyDisjointCursorTrail()
|
public void TestLegacyDisjointCursorTrail()
|
||||||
{
|
{
|
||||||
createTest(() => new LegacySkinContainer(true)
|
createTest(() =>
|
||||||
{
|
{
|
||||||
Child = new LegacyCursorTrail()
|
var skinContainer = new LegacySkinContainer(true);
|
||||||
|
var legacyCursorTrail = new LegacyCursorTrail(skinContainer);
|
||||||
|
|
||||||
|
skinContainer.Child = legacyCursorTrail;
|
||||||
|
|
||||||
|
return skinContainer;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,6 +112,8 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => null;
|
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => null;
|
||||||
|
|
||||||
|
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => null;
|
||||||
|
|
||||||
public event Action SourceChanged
|
public event Action SourceChanged
|
||||||
{
|
{
|
||||||
add { }
|
add { }
|
||||||
|
@ -113,6 +113,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
public Drawable GetDrawableComponent(ISkinComponent component) => null;
|
public Drawable GetDrawableComponent(ISkinComponent component) => null;
|
||||||
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => null;
|
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => null;
|
||||||
public ISample GetSample(ISampleInfo sampleInfo) => null;
|
public ISample GetSample(ISampleInfo sampleInfo) => null;
|
||||||
|
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => null;
|
||||||
|
|
||||||
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
|
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
|
||||||
{
|
{
|
||||||
|
@ -21,20 +21,37 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
private int depthIndex;
|
private int depthIndex;
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestVariousHitCircles()
|
public void TestHits()
|
||||||
|
{
|
||||||
|
AddStep("Hit Big Single", () => SetContents(_ => testSingle(2, true)));
|
||||||
|
AddStep("Hit Medium Single", () => SetContents(_ => testSingle(5, true)));
|
||||||
|
AddStep("Hit Small Single", () => SetContents(_ => testSingle(7, true)));
|
||||||
|
AddStep("Hit Big Stream", () => SetContents(_ => testStream(2, true)));
|
||||||
|
AddStep("Hit Medium Stream", () => SetContents(_ => testStream(5, true)));
|
||||||
|
AddStep("Hit Small Stream", () => SetContents(_ => testStream(7, true)));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHittingEarly()
|
||||||
|
{
|
||||||
|
AddStep("Hit stream early", () => SetContents(_ => testStream(5, true, -150)));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestMisses()
|
||||||
{
|
{
|
||||||
AddStep("Miss Big Single", () => SetContents(_ => testSingle(2)));
|
AddStep("Miss Big Single", () => SetContents(_ => testSingle(2)));
|
||||||
AddStep("Miss Medium Single", () => SetContents(_ => testSingle(5)));
|
AddStep("Miss Medium Single", () => SetContents(_ => testSingle(5)));
|
||||||
AddStep("Miss Small Single", () => SetContents(_ => testSingle(7)));
|
AddStep("Miss Small Single", () => SetContents(_ => testSingle(7)));
|
||||||
AddStep("Hit Big Single", () => SetContents(_ => testSingle(2, true)));
|
|
||||||
AddStep("Hit Medium Single", () => SetContents(_ => testSingle(5, true)));
|
|
||||||
AddStep("Hit Small Single", () => SetContents(_ => testSingle(7, true)));
|
|
||||||
AddStep("Miss Big Stream", () => SetContents(_ => testStream(2)));
|
AddStep("Miss Big Stream", () => SetContents(_ => testStream(2)));
|
||||||
AddStep("Miss Medium Stream", () => SetContents(_ => testStream(5)));
|
AddStep("Miss Medium Stream", () => SetContents(_ => testStream(5)));
|
||||||
AddStep("Miss Small Stream", () => SetContents(_ => testStream(7)));
|
AddStep("Miss Small Stream", () => SetContents(_ => testStream(7)));
|
||||||
AddStep("Hit Big Stream", () => SetContents(_ => testStream(2, true)));
|
}
|
||||||
AddStep("Hit Medium Stream", () => SetContents(_ => testStream(5, true)));
|
|
||||||
AddStep("Hit Small Stream", () => SetContents(_ => testStream(7, true)));
|
[Test]
|
||||||
|
public void TestHittingLate()
|
||||||
|
{
|
||||||
|
AddStep("Hit stream late", () => SetContents(_ => testStream(5, true, 150)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable testSingle(float circleSize, bool auto = false, double timeOffset = 0, Vector2? positionOffset = null)
|
private Drawable testSingle(float circleSize, bool auto = false, double timeOffset = 0, Vector2? positionOffset = null)
|
||||||
@ -46,7 +63,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
return playfield;
|
return playfield;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable testStream(float circleSize, bool auto = false)
|
private Drawable testStream(float circleSize, bool auto = false, double hitOffset = 0)
|
||||||
{
|
{
|
||||||
var playfield = new TestOsuPlayfield();
|
var playfield = new TestOsuPlayfield();
|
||||||
|
|
||||||
@ -54,14 +71,14 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
for (int i = 0; i <= 1000; i += 100)
|
for (int i = 0; i <= 1000; i += 100)
|
||||||
{
|
{
|
||||||
playfield.Add(createSingle(circleSize, auto, i, pos));
|
playfield.Add(createSingle(circleSize, auto, i, pos, hitOffset));
|
||||||
pos.X += 50;
|
pos.X += 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
return playfield;
|
return playfield;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TestDrawableHitCircle createSingle(float circleSize, bool auto, double timeOffset, Vector2? positionOffset)
|
private TestDrawableHitCircle createSingle(float circleSize, bool auto, double timeOffset, Vector2? positionOffset, double hitOffset = 0)
|
||||||
{
|
{
|
||||||
positionOffset ??= Vector2.Zero;
|
positionOffset ??= Vector2.Zero;
|
||||||
|
|
||||||
@ -73,14 +90,14 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = circleSize });
|
circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = circleSize });
|
||||||
|
|
||||||
var drawable = CreateDrawableHitCircle(circle, auto);
|
var drawable = CreateDrawableHitCircle(circle, auto, hitOffset);
|
||||||
|
|
||||||
foreach (var mod in SelectedMods.Value.OfType<IApplicableToDrawableHitObjects>())
|
foreach (var mod in SelectedMods.Value.OfType<IApplicableToDrawableHitObject>())
|
||||||
mod.ApplyToDrawableHitObjects(new[] { drawable });
|
mod.ApplyToDrawableHitObject(drawable);
|
||||||
return drawable;
|
return drawable;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual TestDrawableHitCircle CreateDrawableHitCircle(HitCircle circle, bool auto) => new TestDrawableHitCircle(circle, auto)
|
protected virtual TestDrawableHitCircle CreateDrawableHitCircle(HitCircle circle, bool auto, double hitOffset = 0) => new TestDrawableHitCircle(circle, auto, hitOffset)
|
||||||
{
|
{
|
||||||
Depth = depthIndex++
|
Depth = depthIndex++
|
||||||
};
|
};
|
||||||
@ -88,18 +105,20 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
protected class TestDrawableHitCircle : DrawableHitCircle
|
protected class TestDrawableHitCircle : DrawableHitCircle
|
||||||
{
|
{
|
||||||
private readonly bool auto;
|
private readonly bool auto;
|
||||||
|
private readonly double hitOffset;
|
||||||
|
|
||||||
public TestDrawableHitCircle(HitCircle h, bool auto)
|
public TestDrawableHitCircle(HitCircle h, bool auto, double hitOffset)
|
||||||
: base(h)
|
: base(h)
|
||||||
{
|
{
|
||||||
this.auto = auto;
|
this.auto = auto;
|
||||||
|
this.hitOffset = hitOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TriggerJudgement() => UpdateResult(true);
|
public void TriggerJudgement() => Schedule(() => UpdateResult(true));
|
||||||
|
|
||||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||||
{
|
{
|
||||||
if (auto && !userTriggered && timeOffset > 0)
|
if (auto && !userTriggered && timeOffset > hitOffset && CheckHittable?.Invoke(this, Time.Current) != false)
|
||||||
{
|
{
|
||||||
// force success
|
// force success
|
||||||
ApplyResult(r => r.Type = HitResult.Great);
|
ApplyResult(r => r.Type = HitResult.Great);
|
||||||
|
@ -16,11 +16,11 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
Scheduler.AddDelayed(() => comboIndex.Value++, 250, true);
|
Scheduler.AddDelayed(() => comboIndex.Value++, 250, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override TestDrawableHitCircle CreateDrawableHitCircle(HitCircle circle, bool auto)
|
protected override TestDrawableHitCircle CreateDrawableHitCircle(HitCircle circle, bool auto, double hitOffset = 0)
|
||||||
{
|
{
|
||||||
circle.ComboIndexBindable.BindTo(comboIndex);
|
circle.ComboIndexBindable.BindTo(comboIndex);
|
||||||
circle.IndexInCurrentComboBindable.BindTo(comboIndex);
|
circle.IndexInCurrentComboBindable.BindTo(comboIndex);
|
||||||
return base.CreateDrawableHitCircle(circle, auto);
|
return base.CreateDrawableHitCircle(circle, auto, hitOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
49
osu.Game.Rulesets.Osu.Tests/TestSceneOsuHitObjectSamples.cs
Normal file
49
osu.Game.Rulesets.Osu.Tests/TestSceneOsuHitObjectSamples.cs
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Reflection;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.IO.Stores;
|
||||||
|
using osu.Game.Tests.Beatmaps;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
|
{
|
||||||
|
public class TestSceneOsuHitObjectSamples : HitObjectSampleTest
|
||||||
|
{
|
||||||
|
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
|
||||||
|
|
||||||
|
protected override IResourceStore<byte[]> RulesetResources => new DllResourceStore(Assembly.GetAssembly(typeof(TestSceneOsuHitObjectSamples)));
|
||||||
|
|
||||||
|
[TestCase("normal-hitnormal")]
|
||||||
|
[TestCase("hitnormal")]
|
||||||
|
public void TestDefaultCustomSampleFromBeatmap(string expectedSample)
|
||||||
|
{
|
||||||
|
SetupSkins(expectedSample, expectedSample);
|
||||||
|
|
||||||
|
CreateTestWithBeatmap("osu-hitobject-beatmap-custom-sample-bank.osu");
|
||||||
|
|
||||||
|
AssertBeatmapLookup(expectedSample);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase("normal-hitnormal")]
|
||||||
|
[TestCase("hitnormal")]
|
||||||
|
public void TestDefaultCustomSampleFromUserSkinFallback(string expectedSample)
|
||||||
|
{
|
||||||
|
SetupSkins(string.Empty, expectedSample);
|
||||||
|
|
||||||
|
CreateTestWithBeatmap("osu-hitobject-beatmap-custom-sample-bank.osu");
|
||||||
|
|
||||||
|
AssertUserLookup(expectedSample);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase("normal-hitnormal2")]
|
||||||
|
public void TestUserSkinLookupIgnoresSampleBank(string unwantedSample)
|
||||||
|
{
|
||||||
|
SetupSkins(string.Empty, unwantedSample);
|
||||||
|
|
||||||
|
CreateTestWithBeatmap("osu-hitobject-beatmap-custom-sample-bank.osu");
|
||||||
|
|
||||||
|
AssertNoLookup(unwantedSample);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -26,9 +26,9 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
return base.CreateBeatmapForSkinProvider();
|
return base.CreateBeatmapForSkinProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override TestDrawableHitCircle CreateDrawableHitCircle(HitCircle circle, bool auto)
|
protected override TestDrawableHitCircle CreateDrawableHitCircle(HitCircle circle, bool auto, double hitOffset = 0)
|
||||||
{
|
{
|
||||||
var drawableHitObject = base.CreateDrawableHitCircle(circle, auto);
|
var drawableHitObject = base.CreateDrawableHitCircle(circle, auto, hitOffset);
|
||||||
|
|
||||||
Debug.Assert(drawableHitObject.HitObject.HitWindows != null);
|
Debug.Assert(drawableHitObject.HitObject.HitWindows != null);
|
||||||
|
|
||||||
|
@ -166,6 +166,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration => default;
|
public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration => default;
|
||||||
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => null;
|
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => null;
|
||||||
|
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => null;
|
||||||
|
|
||||||
public event Action SourceChanged;
|
public event Action SourceChanged;
|
||||||
|
|
||||||
|
@ -335,8 +335,8 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
var drawable = CreateDrawableSlider(slider);
|
var drawable = CreateDrawableSlider(slider);
|
||||||
|
|
||||||
foreach (var mod in SelectedMods.Value.OfType<IApplicableToDrawableHitObjects>())
|
foreach (var mod in SelectedMods.Value.OfType<IApplicableToDrawableHitObject>())
|
||||||
mod.ApplyToDrawableHitObjects(new[] { drawable });
|
mod.ApplyToDrawableHitObject(drawable);
|
||||||
|
|
||||||
drawable.OnNewResult += onNewResult;
|
drawable.OnNewResult += onNewResult;
|
||||||
|
|
||||||
|
@ -85,8 +85,8 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
Scale = new Vector2(0.75f)
|
Scale = new Vector2(0.75f)
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var mod in SelectedMods.Value.OfType<IApplicableToDrawableHitObjects>())
|
foreach (var mod in SelectedMods.Value.OfType<IApplicableToDrawableHitObject>())
|
||||||
mod.ApplyToDrawableHitObjects(new[] { drawableSpinner });
|
mod.ApplyToDrawableHitObject(drawableSpinner);
|
||||||
|
|
||||||
return drawableSpinner;
|
return drawableSpinner;
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
|||||||
{
|
{
|
||||||
public class OsuDifficultyAttributes : DifficultyAttributes
|
public class OsuDifficultyAttributes : DifficultyAttributes
|
||||||
{
|
{
|
||||||
public double AimStrain;
|
public double AimStrain { get; set; }
|
||||||
public double SpeedStrain;
|
public double SpeedStrain { get; set; }
|
||||||
public double ApproachRate;
|
public double ApproachRate { get; set; }
|
||||||
public double OverallDifficulty;
|
public double OverallDifficulty { get; set; }
|
||||||
public int HitCircleCount;
|
public int HitCircleCount { get; set; }
|
||||||
public int SpinnerCount;
|
public int SpinnerCount { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,10 +41,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
|||||||
countMeh = Score.Statistics.GetOrDefault(HitResult.Meh);
|
countMeh = Score.Statistics.GetOrDefault(HitResult.Meh);
|
||||||
countMiss = Score.Statistics.GetOrDefault(HitResult.Miss);
|
countMiss = Score.Statistics.GetOrDefault(HitResult.Miss);
|
||||||
|
|
||||||
// Don't count scores made with supposedly unranked mods
|
|
||||||
if (mods.Any(m => !m.Ranked))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// Custom multipliers for NoFail and SpunOut.
|
// Custom multipliers for NoFail and SpunOut.
|
||||||
double multiplier = 1.12; // This is being adjusted to keep the final pp value scaled around what it used to be when changing things
|
double multiplier = 1.12; // This is being adjusted to keep the final pp value scaled around what it used to be when changing things
|
||||||
|
|
||||||
|
97
osu.Game.Rulesets.Osu/Mods/OsuModApproachDifferent.cs
Normal file
97
osu.Game.Rulesets.Osu/Mods/OsuModApproachDifferent.cs
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
|
{
|
||||||
|
public class OsuModApproachDifferent : Mod, IApplicableToDrawableHitObject
|
||||||
|
{
|
||||||
|
public override string Name => "Approach Different";
|
||||||
|
public override string Acronym => "AD";
|
||||||
|
public override string Description => "Never trust the approach circles...";
|
||||||
|
public override double ScoreMultiplier => 1;
|
||||||
|
public override IconUsage? Icon { get; } = FontAwesome.Regular.Circle;
|
||||||
|
|
||||||
|
[SettingSource("Initial size", "Change the initial size of the approach circle, relative to hit circles.", 0)]
|
||||||
|
public BindableFloat Scale { get; } = new BindableFloat(4)
|
||||||
|
{
|
||||||
|
Precision = 0.1f,
|
||||||
|
MinValue = 2,
|
||||||
|
MaxValue = 10,
|
||||||
|
};
|
||||||
|
|
||||||
|
[SettingSource("Style", "Change the animation style of the approach circles.", 1)]
|
||||||
|
public Bindable<AnimationStyle> Style { get; } = new Bindable<AnimationStyle>();
|
||||||
|
|
||||||
|
public void ApplyToDrawableHitObject(DrawableHitObject drawable)
|
||||||
|
{
|
||||||
|
drawable.ApplyCustomUpdateState += (drawableObject, state) =>
|
||||||
|
{
|
||||||
|
if (!(drawableObject is DrawableHitCircle drawableHitCircle)) return;
|
||||||
|
|
||||||
|
var hitCircle = drawableHitCircle.HitObject;
|
||||||
|
|
||||||
|
drawableHitCircle.ApproachCircle.ClearTransforms(targetMember: nameof(Scale));
|
||||||
|
|
||||||
|
using (drawableHitCircle.BeginAbsoluteSequence(hitCircle.StartTime - hitCircle.TimePreempt))
|
||||||
|
drawableHitCircle.ApproachCircle.ScaleTo(Scale.Value).ScaleTo(1f, hitCircle.TimePreempt, getEasing(Style.Value));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private Easing getEasing(AnimationStyle style)
|
||||||
|
{
|
||||||
|
switch (style)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
return Easing.None;
|
||||||
|
|
||||||
|
case AnimationStyle.Accelerate1:
|
||||||
|
return Easing.In;
|
||||||
|
|
||||||
|
case AnimationStyle.Accelerate2:
|
||||||
|
return Easing.InCubic;
|
||||||
|
|
||||||
|
case AnimationStyle.Accelerate3:
|
||||||
|
return Easing.InQuint;
|
||||||
|
|
||||||
|
case AnimationStyle.Gravity:
|
||||||
|
return Easing.InBack;
|
||||||
|
|
||||||
|
case AnimationStyle.Decelerate1:
|
||||||
|
return Easing.Out;
|
||||||
|
|
||||||
|
case AnimationStyle.Decelerate2:
|
||||||
|
return Easing.OutCubic;
|
||||||
|
|
||||||
|
case AnimationStyle.Decelerate3:
|
||||||
|
return Easing.OutQuint;
|
||||||
|
|
||||||
|
case AnimationStyle.InOut1:
|
||||||
|
return Easing.InOutCubic;
|
||||||
|
|
||||||
|
case AnimationStyle.InOut2:
|
||||||
|
return Easing.InOutQuint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum AnimationStyle
|
||||||
|
{
|
||||||
|
Gravity,
|
||||||
|
InOut1,
|
||||||
|
InOut2,
|
||||||
|
Accelerate1,
|
||||||
|
Accelerate2,
|
||||||
|
Accelerate3,
|
||||||
|
Decelerate1,
|
||||||
|
Decelerate2,
|
||||||
|
Decelerate3,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
@ -9,11 +8,9 @@ using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
public class OsuModBarrelRoll : ModBarrelRoll<OsuHitObject>, IApplicableToDrawableHitObjects
|
public class OsuModBarrelRoll : ModBarrelRoll<OsuHitObject>, IApplicableToDrawableHitObject
|
||||||
{
|
{
|
||||||
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
public void ApplyToDrawableHitObject(DrawableHitObject d)
|
||||||
{
|
|
||||||
foreach (var d in drawables)
|
|
||||||
{
|
{
|
||||||
d.OnUpdate += _ =>
|
d.OnUpdate += _ =>
|
||||||
{
|
{
|
||||||
@ -26,5 +23,4 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,6 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
public override IconUsage? Icon => FontAwesome.Solid.Adjust;
|
public override IconUsage? Icon => FontAwesome.Solid.Adjust;
|
||||||
public override ModType Type => ModType.DifficultyIncrease;
|
public override ModType Type => ModType.DifficultyIncrease;
|
||||||
|
|
||||||
public override bool Ranked => false;
|
|
||||||
|
|
||||||
public override double ScoreMultiplier => 1.12;
|
public override double ScoreMultiplier => 1.12;
|
||||||
private DrawableOsuBlinds blinds;
|
private DrawableOsuBlinds blinds;
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
@ -15,7 +14,7 @@ using osu.Game.Rulesets.UI;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
public class OsuModClassic : ModClassic, IApplicableToHitObject, IApplicableToDrawableHitObjects, IApplicableToDrawableRuleset<OsuHitObject>
|
public class OsuModClassic : ModClassic, IApplicableToHitObject, IApplicableToDrawableHitObject, IApplicableToDrawableRuleset<OsuHitObject>
|
||||||
{
|
{
|
||||||
[SettingSource("No slider head accuracy requirement", "Scores sliders proportionally to the number of ticks hit.")]
|
[SettingSource("No slider head accuracy requirement", "Scores sliders proportionally to the number of ticks hit.")]
|
||||||
public Bindable<bool> NoSliderHeadAccuracy { get; } = new BindableBool(true);
|
public Bindable<bool> NoSliderHeadAccuracy { get; } = new BindableBool(true);
|
||||||
@ -54,9 +53,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
osuRuleset.Playfield.HitPolicy = new ObjectOrderedHitPolicy();
|
osuRuleset.Playfield.HitPolicy = new ObjectOrderedHitPolicy();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
public void ApplyToDrawableHitObject(DrawableHitObject obj)
|
||||||
{
|
|
||||||
foreach (var obj in drawables)
|
|
||||||
{
|
{
|
||||||
switch (obj)
|
switch (obj)
|
||||||
{
|
{
|
||||||
@ -74,5 +71,4 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
@ -19,7 +17,7 @@ using osuTK;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
public class OsuModFlashlight : ModFlashlight<OsuHitObject>, IApplicableToDrawableHitObjects
|
public class OsuModFlashlight : ModFlashlight<OsuHitObject>, IApplicableToDrawableHitObject
|
||||||
{
|
{
|
||||||
public override double ScoreMultiplier => 1.12;
|
public override double ScoreMultiplier => 1.12;
|
||||||
|
|
||||||
@ -31,13 +29,11 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
|
|
||||||
public override Flashlight CreateFlashlight() => flashlight = new OsuFlashlight();
|
public override Flashlight CreateFlashlight() => flashlight = new OsuFlashlight();
|
||||||
|
|
||||||
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
public void ApplyToDrawableHitObject(DrawableHitObject drawable)
|
||||||
{
|
|
||||||
foreach (var s in drawables.OfType<DrawableSlider>())
|
|
||||||
{
|
{
|
||||||
|
if (drawable is DrawableSlider s)
|
||||||
s.Tracking.ValueChanged += flashlight.OnSliderTrackingChange;
|
s.Tracking.ValueChanged += flashlight.OnSliderTrackingChange;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public override void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
|
public override void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,6 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
public class OsuModHardRock : ModHardRock, IApplicableToHitObject
|
public class OsuModHardRock : ModHardRock, IApplicableToHitObject
|
||||||
{
|
{
|
||||||
public override double ScoreMultiplier => 1.06;
|
public override double ScoreMultiplier => 1.06;
|
||||||
public override bool Ranked => true;
|
|
||||||
|
|
||||||
public void ApplyToHitObject(HitObject hitObject)
|
public void ApplyToHitObject(HitObject hitObject)
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
@ -21,7 +22,6 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
public class OsuModRandom : ModRandom, IApplicableToBeatmap
|
public class OsuModRandom : ModRandom, IApplicableToBeatmap
|
||||||
{
|
{
|
||||||
public override string Description => "It never gets boring!";
|
public override string Description => "It never gets boring!";
|
||||||
public override bool Ranked => false;
|
|
||||||
|
|
||||||
// The relative distance to the edge of the playfield before objects' positions should start to "turn around" and curve towards the middle.
|
// The relative distance to the edge of the playfield before objects' positions should start to "turn around" and curve towards the middle.
|
||||||
// The closer the hit objects draw to the border, the sharper the turn
|
// The closer the hit objects draw to the border, the sharper the turn
|
||||||
@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
private static readonly float border_distance_x = OsuPlayfield.BASE_SIZE.X * playfield_edge_ratio;
|
private static readonly float border_distance_x = OsuPlayfield.BASE_SIZE.X * playfield_edge_ratio;
|
||||||
private static readonly float border_distance_y = OsuPlayfield.BASE_SIZE.Y * playfield_edge_ratio;
|
private static readonly float border_distance_y = OsuPlayfield.BASE_SIZE.Y * playfield_edge_ratio;
|
||||||
|
|
||||||
private static readonly Vector2 playfield_middle = Vector2.Divide(OsuPlayfield.BASE_SIZE, 2);
|
private static readonly Vector2 playfield_middle = OsuPlayfield.BASE_SIZE / 2;
|
||||||
|
|
||||||
private static readonly float playfield_diagonal = OsuPlayfield.BASE_SIZE.LengthFast;
|
private static readonly float playfield_diagonal = OsuPlayfield.BASE_SIZE.LengthFast;
|
||||||
|
|
||||||
@ -74,23 +74,9 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
// update end position as it may have changed as a result of the position update.
|
// update end position as it may have changed as a result of the position update.
|
||||||
current.EndPositionRandomised = current.PositionRandomised;
|
current.EndPositionRandomised = current.PositionRandomised;
|
||||||
|
|
||||||
switch (hitObject)
|
if (hitObject is Slider slider)
|
||||||
{
|
|
||||||
case Slider slider:
|
|
||||||
// Shift nested objects the same distance as the slider got shifted in the randomisation process
|
|
||||||
// so that moveSliderIntoPlayfield() can determine their relative distances to slider.Position and thus minMargin
|
|
||||||
shiftNestedObjects(slider, Vector2.Subtract(slider.Position, current.PositionOriginal));
|
|
||||||
|
|
||||||
var oldPos = new Vector2(slider.Position.X, slider.Position.Y);
|
|
||||||
|
|
||||||
moveSliderIntoPlayfield(slider, current);
|
moveSliderIntoPlayfield(slider, current);
|
||||||
|
|
||||||
// Shift them again to move them to their final position after the slider got moved into the playfield
|
|
||||||
shiftNestedObjects(slider, Vector2.Subtract(slider.Position, oldPos));
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
previous = current;
|
previous = current;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,7 +117,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
|
|
||||||
current.AngleRad = (float)Math.Atan2(posRelativeToPrev.Y, posRelativeToPrev.X);
|
current.AngleRad = (float)Math.Atan2(posRelativeToPrev.Y, posRelativeToPrev.X);
|
||||||
|
|
||||||
var position = Vector2.Add(previous.EndPositionRandomised, posRelativeToPrev);
|
var position = previous.EndPositionRandomised + posRelativeToPrev;
|
||||||
|
|
||||||
// Move hit objects back into the playfield if they are outside of it,
|
// Move hit objects back into the playfield if they are outside of it,
|
||||||
// which would sometimes happen during big jumps otherwise.
|
// which would sometimes happen during big jumps otherwise.
|
||||||
@ -146,34 +132,41 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void moveSliderIntoPlayfield(Slider slider, RandomObjectInfo currentObjectInfo)
|
private void moveSliderIntoPlayfield(Slider slider, RandomObjectInfo currentObjectInfo)
|
||||||
{
|
{
|
||||||
// Min. distances from the slider's position to the playfield border
|
var minMargin = getMinSliderMargin(slider);
|
||||||
var minMargin = new MarginPadding();
|
|
||||||
|
|
||||||
foreach (var hitObject in slider.NestedHitObjects.Where(o => o is SliderTick || o is SliderEndCircle))
|
slider.Position = new Vector2(
|
||||||
{
|
Math.Clamp(slider.Position.X, minMargin.Left, OsuPlayfield.BASE_SIZE.X - minMargin.Right),
|
||||||
if (!(hitObject is OsuHitObject osuHitObject))
|
Math.Clamp(slider.Position.Y, minMargin.Top, OsuPlayfield.BASE_SIZE.Y - minMargin.Bottom)
|
||||||
continue;
|
);
|
||||||
|
|
||||||
var relativePos = Vector2.Subtract(osuHitObject.Position, slider.Position);
|
|
||||||
|
|
||||||
minMargin.Left = Math.Max(minMargin.Left, -relativePos.X);
|
|
||||||
minMargin.Right = Math.Max(minMargin.Right, relativePos.X);
|
|
||||||
minMargin.Top = Math.Max(minMargin.Top, -relativePos.Y);
|
|
||||||
minMargin.Bottom = Math.Max(minMargin.Bottom, relativePos.Y);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (slider.Position.X < minMargin.Left)
|
|
||||||
slider.Position = new Vector2(minMargin.Left, slider.Position.Y);
|
|
||||||
else if (slider.Position.X + minMargin.Right > OsuPlayfield.BASE_SIZE.X)
|
|
||||||
slider.Position = new Vector2(OsuPlayfield.BASE_SIZE.X - minMargin.Right, slider.Position.Y);
|
|
||||||
|
|
||||||
if (slider.Position.Y < minMargin.Top)
|
|
||||||
slider.Position = new Vector2(slider.Position.X, minMargin.Top);
|
|
||||||
else if (slider.Position.Y + minMargin.Bottom > OsuPlayfield.BASE_SIZE.Y)
|
|
||||||
slider.Position = new Vector2(slider.Position.X, OsuPlayfield.BASE_SIZE.Y - minMargin.Bottom);
|
|
||||||
|
|
||||||
currentObjectInfo.PositionRandomised = slider.Position;
|
currentObjectInfo.PositionRandomised = slider.Position;
|
||||||
currentObjectInfo.EndPositionRandomised = slider.EndPosition;
|
currentObjectInfo.EndPositionRandomised = slider.EndPosition;
|
||||||
|
|
||||||
|
shiftNestedObjects(slider, currentObjectInfo.PositionRandomised - currentObjectInfo.PositionOriginal);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calculates the min. distances from the <see cref="Slider"/>'s position to the playfield border for the slider to be fully inside of the playfield.
|
||||||
|
/// </summary>
|
||||||
|
private MarginPadding getMinSliderMargin(Slider slider)
|
||||||
|
{
|
||||||
|
var pathPositions = new List<Vector2>();
|
||||||
|
slider.Path.GetPathToProgress(pathPositions, 0, 1);
|
||||||
|
|
||||||
|
var minMargin = new MarginPadding();
|
||||||
|
|
||||||
|
foreach (var pos in pathPositions)
|
||||||
|
{
|
||||||
|
minMargin.Left = Math.Max(minMargin.Left, -pos.X);
|
||||||
|
minMargin.Right = Math.Max(minMargin.Right, pos.X);
|
||||||
|
minMargin.Top = Math.Max(minMargin.Top, -pos.Y);
|
||||||
|
minMargin.Bottom = Math.Max(minMargin.Bottom, pos.Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
minMargin.Left = Math.Min(minMargin.Left, OsuPlayfield.BASE_SIZE.X - minMargin.Right);
|
||||||
|
minMargin.Top = Math.Min(minMargin.Top, OsuPlayfield.BASE_SIZE.Y - minMargin.Bottom);
|
||||||
|
|
||||||
|
return minMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -188,7 +181,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
if (!(hitObject is OsuHitObject osuHitObject))
|
if (!(hitObject is OsuHitObject osuHitObject))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
osuHitObject.Position = Vector2.Add(osuHitObject.Position, shift);
|
osuHitObject.Position += shift;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
@ -13,7 +12,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
public class OsuModSpunOut : Mod, IApplicableToDrawableHitObjects
|
public class OsuModSpunOut : Mod, IApplicableToDrawableHitObject
|
||||||
{
|
{
|
||||||
public override string Name => "Spun Out";
|
public override string Name => "Spun Out";
|
||||||
public override string Acronym => "SO";
|
public override string Acronym => "SO";
|
||||||
@ -21,12 +20,9 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
public override ModType Type => ModType.Automation;
|
public override ModType Type => ModType.Automation;
|
||||||
public override string Description => @"Spinners will be automatically completed.";
|
public override string Description => @"Spinners will be automatically completed.";
|
||||||
public override double ScoreMultiplier => 0.9;
|
public override double ScoreMultiplier => 0.9;
|
||||||
public override bool Ranked => true;
|
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(OsuModAutopilot) };
|
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(OsuModAutopilot) };
|
||||||
|
|
||||||
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
public void ApplyToDrawableHitObject(DrawableHitObject hitObject)
|
||||||
{
|
|
||||||
foreach (var hitObject in drawables)
|
|
||||||
{
|
{
|
||||||
if (hitObject is DrawableSpinner spinner)
|
if (hitObject is DrawableSpinner spinner)
|
||||||
{
|
{
|
||||||
@ -34,7 +30,6 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
spinner.OnUpdate += onSpinnerUpdate;
|
spinner.OnUpdate += onSpinnerUpdate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void onSpinnerUpdate(Drawable drawable)
|
private void onSpinnerUpdate(Drawable drawable)
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,5 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
public override double ScoreMultiplier => 1;
|
public override double ScoreMultiplier => 1;
|
||||||
|
|
||||||
public override ModType Type => ModType.System;
|
public override ModType Type => ModType.System;
|
||||||
|
|
||||||
public override bool Ranked => true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,6 +172,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
base.UpdateStartTimeStateTransforms();
|
base.UpdateStartTimeStateTransforms();
|
||||||
|
|
||||||
|
// always fade out at the circle's start time (to match user expectations).
|
||||||
ApproachCircle.FadeOut(50);
|
ApproachCircle.FadeOut(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,6 +183,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
// todo: temporary / arbitrary, used for lifetime optimisation.
|
// todo: temporary / arbitrary, used for lifetime optimisation.
|
||||||
this.Delay(800).FadeOut();
|
this.Delay(800).FadeOut();
|
||||||
|
|
||||||
|
// in the case of an early state change, the fade should be expedited to the current point in time.
|
||||||
|
if (HitStateUpdateTime < HitObject.StartTime)
|
||||||
|
ApproachCircle.FadeOut(50);
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case ArmedState.Idle:
|
case ArmedState.Idle:
|
||||||
|
@ -152,7 +152,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
while (Math.Abs(aimRotation - Arrow.Rotation) > 180)
|
while (Math.Abs(aimRotation - Arrow.Rotation) > 180)
|
||||||
aimRotation += aimRotation < Arrow.Rotation ? 360 : -360;
|
aimRotation += aimRotation < Arrow.Rotation ? 360 : -360;
|
||||||
|
|
||||||
if (!hasRotation)
|
// The clock may be paused in a scenario like the editor.
|
||||||
|
if (!hasRotation || !Clock.IsRunning)
|
||||||
{
|
{
|
||||||
Arrow.Rotation = aimRotation;
|
Arrow.Rotation = aimRotation;
|
||||||
hasRotation = true;
|
hasRotation = true;
|
||||||
|
@ -18,9 +18,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
protected override void SkinChanged(ISkinSource skin)
|
||||||
{
|
{
|
||||||
base.SkinChanged(skin, allowFallback);
|
base.SkinChanged(skin);
|
||||||
updateColour();
|
updateColour();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,6 +187,7 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
new MultiMod(new ModWindUp(), new ModWindDown()),
|
new MultiMod(new ModWindUp(), new ModWindDown()),
|
||||||
new OsuModTraceable(),
|
new OsuModTraceable(),
|
||||||
new OsuModBarrelRoll(),
|
new OsuModBarrelRoll(),
|
||||||
|
new OsuModApproachDifferent(),
|
||||||
};
|
};
|
||||||
|
|
||||||
case ModType.System:
|
case ModType.System:
|
||||||
|
@ -128,5 +128,13 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
spmContainer.FadeIn(drawableSpinner.HitObject.TimeFadeIn);
|
spmContainer.FadeIn(drawableSpinner.HitObject.TimeFadeIn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
|
if (drawableSpinner != null)
|
||||||
|
drawableSpinner.ApplyCustomUpdateState -= updateStateTransforms;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
|
|
||||||
private readonly IBindable<Color4> accentColour = new Bindable<Color4>();
|
private readonly IBindable<Color4> accentColour = new Bindable<Color4>();
|
||||||
private readonly IBindable<int> indexInCurrentCombo = new Bindable<int>();
|
private readonly IBindable<int> indexInCurrentCombo = new Bindable<int>();
|
||||||
private readonly IBindable<ArmedState> armedState = new Bindable<ArmedState>();
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private DrawableHitObject drawableObject { get; set; }
|
private DrawableHitObject drawableObject { get; set; }
|
||||||
@ -54,7 +53,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
|
|
||||||
accentColour.BindTo(drawableObject.AccentColour);
|
accentColour.BindTo(drawableObject.AccentColour);
|
||||||
indexInCurrentCombo.BindTo(drawableOsuObject.IndexInCurrentComboBindable);
|
indexInCurrentCombo.BindTo(drawableOsuObject.IndexInCurrentComboBindable);
|
||||||
armedState.BindTo(drawableObject.State);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -70,19 +68,18 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
|
|
||||||
indexInCurrentCombo.BindValueChanged(index => number.Text = (index.NewValue + 1).ToString(), true);
|
indexInCurrentCombo.BindValueChanged(index => number.Text = (index.NewValue + 1).ToString(), true);
|
||||||
|
|
||||||
armedState.BindValueChanged(animate, true);
|
drawableObject.ApplyCustomUpdateState += updateStateTransforms;
|
||||||
|
updateStateTransforms(drawableObject, drawableObject.State.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void animate(ValueChangedEvent<ArmedState> state)
|
private void updateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state)
|
||||||
{
|
{
|
||||||
ClearTransforms(true);
|
|
||||||
|
|
||||||
using (BeginAbsoluteSequence(drawableObject.StateUpdateTime))
|
using (BeginAbsoluteSequence(drawableObject.StateUpdateTime))
|
||||||
glow.FadeOut(400);
|
glow.FadeOut(400);
|
||||||
|
|
||||||
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime))
|
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime))
|
||||||
{
|
{
|
||||||
switch (state.NewValue)
|
switch (state)
|
||||||
{
|
{
|
||||||
case ArmedState.Hit:
|
case ArmedState.Hit:
|
||||||
const double flash_in = 40;
|
const double flash_in = 40;
|
||||||
@ -109,5 +106,13 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
|
if (drawableObject != null)
|
||||||
|
drawableObject.ApplyCustomUpdateState -= updateStateTransforms;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,10 +11,12 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
{
|
{
|
||||||
public class LegacyCursor : OsuCursorSprite
|
public class LegacyCursor : OsuCursorSprite
|
||||||
{
|
{
|
||||||
|
private readonly ISkin skin;
|
||||||
private bool spin;
|
private bool spin;
|
||||||
|
|
||||||
public LegacyCursor()
|
public LegacyCursor(ISkin skin)
|
||||||
{
|
{
|
||||||
|
this.skin = skin;
|
||||||
Size = new Vector2(50);
|
Size = new Vector2(50);
|
||||||
|
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
@ -22,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(ISkinSource skin)
|
private void load()
|
||||||
{
|
{
|
||||||
bool centre = skin.GetConfig<OsuSkinConfiguration, bool>(OsuSkinConfiguration.CursorCentre)?.Value ?? true;
|
bool centre = skin.GetConfig<OsuSkinConfiguration, bool>(OsuSkinConfiguration.CursorCentre)?.Value ?? true;
|
||||||
spin = skin.GetConfig<OsuSkinConfiguration, bool>(OsuSkinConfiguration.CursorRotate)?.Value ?? true;
|
spin = skin.GetConfig<OsuSkinConfiguration, bool>(OsuSkinConfiguration.CursorRotate)?.Value ?? true;
|
||||||
|
@ -14,14 +14,20 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
{
|
{
|
||||||
public class LegacyCursorTrail : CursorTrail
|
public class LegacyCursorTrail : CursorTrail
|
||||||
{
|
{
|
||||||
|
private readonly ISkin skin;
|
||||||
private const double disjoint_trail_time_separation = 1000 / 60.0;
|
private const double disjoint_trail_time_separation = 1000 / 60.0;
|
||||||
|
|
||||||
private bool disjointTrail;
|
private bool disjointTrail;
|
||||||
private double lastTrailTime;
|
private double lastTrailTime;
|
||||||
private IBindable<float> cursorSize;
|
private IBindable<float> cursorSize;
|
||||||
|
|
||||||
|
public LegacyCursorTrail(ISkin skin)
|
||||||
|
{
|
||||||
|
this.skin = skin;
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(ISkinSource skin, OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
Texture = skin.GetTexture("cursortrail");
|
Texture = skin.GetTexture("cursortrail");
|
||||||
disjointTrail = skin.GetTexture("cursormiddle") == null;
|
disjointTrail = skin.GetTexture("cursormiddle") == null;
|
||||||
|
@ -20,6 +20,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
{
|
{
|
||||||
public class LegacyMainCirclePiece : CompositeDrawable
|
public class LegacyMainCirclePiece : CompositeDrawable
|
||||||
{
|
{
|
||||||
|
public override bool RemoveCompletedTransforms => false;
|
||||||
|
|
||||||
private readonly string priorityLookup;
|
private readonly string priorityLookup;
|
||||||
private readonly bool hasNumber;
|
private readonly bool hasNumber;
|
||||||
|
|
||||||
@ -39,7 +41,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
|
|
||||||
private readonly Bindable<Color4> accentColour = new Bindable<Color4>();
|
private readonly Bindable<Color4> accentColour = new Bindable<Color4>();
|
||||||
private readonly IBindable<int> indexInCurrentCombo = new Bindable<int>();
|
private readonly IBindable<int> indexInCurrentCombo = new Bindable<int>();
|
||||||
private readonly IBindable<ArmedState> armedState = new Bindable<ArmedState>();
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private DrawableHitObject drawableObject { get; set; }
|
private DrawableHitObject drawableObject { get; set; }
|
||||||
@ -114,7 +115,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
|
|
||||||
accentColour.BindTo(drawableObject.AccentColour);
|
accentColour.BindTo(drawableObject.AccentColour);
|
||||||
indexInCurrentCombo.BindTo(drawableOsuObject.IndexInCurrentComboBindable);
|
indexInCurrentCombo.BindTo(drawableOsuObject.IndexInCurrentComboBindable);
|
||||||
armedState.BindTo(drawableObject.State);
|
|
||||||
|
|
||||||
Texture getTextureWithFallback(string name)
|
Texture getTextureWithFallback(string name)
|
||||||
{
|
{
|
||||||
@ -140,18 +140,17 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
if (hasNumber)
|
if (hasNumber)
|
||||||
indexInCurrentCombo.BindValueChanged(index => hitCircleText.Text = (index.NewValue + 1).ToString(), true);
|
indexInCurrentCombo.BindValueChanged(index => hitCircleText.Text = (index.NewValue + 1).ToString(), true);
|
||||||
|
|
||||||
armedState.BindValueChanged(animate, true);
|
drawableObject.ApplyCustomUpdateState += updateStateTransforms;
|
||||||
|
updateStateTransforms(drawableObject, drawableObject.State.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void animate(ValueChangedEvent<ArmedState> state)
|
private void updateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state)
|
||||||
{
|
{
|
||||||
const double legacy_fade_duration = 240;
|
const double legacy_fade_duration = 240;
|
||||||
|
|
||||||
ClearTransforms(true);
|
|
||||||
|
|
||||||
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime))
|
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime))
|
||||||
{
|
{
|
||||||
switch (state.NewValue)
|
switch (state)
|
||||||
{
|
{
|
||||||
case ArmedState.Hit:
|
case ArmedState.Hit:
|
||||||
circleSprites.FadeOut(legacy_fade_duration, Easing.Out);
|
circleSprites.FadeOut(legacy_fade_duration, Easing.Out);
|
||||||
@ -176,5 +175,13 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
|
if (drawableObject != null)
|
||||||
|
drawableObject.ApplyCustomUpdateState -= updateStateTransforms;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ using osu.Game.Rulesets.Osu.Objects;
|
|||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||||
{
|
{
|
||||||
@ -40,6 +41,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Texture = source.GetTexture("spinner-background"),
|
Texture = source.GetTexture("spinner-background"),
|
||||||
|
Colour = source.GetConfig<OsuSkinColour, Color4>(OsuSkinColour.SpinnerBackground)?.Value ?? new Color4(100, 100, 100, 255),
|
||||||
Scale = new Vector2(SPRITE_SCALE),
|
Scale = new Vector2(SPRITE_SCALE),
|
||||||
Y = SPINNER_Y_CENTRE,
|
Y = SPINNER_Y_CENTRE,
|
||||||
},
|
},
|
||||||
|
@ -14,18 +14,21 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
{
|
{
|
||||||
private readonly Drawable animationContent;
|
private readonly Drawable animationContent;
|
||||||
|
|
||||||
|
private readonly ISkin skin;
|
||||||
|
|
||||||
private Sprite layerNd;
|
private Sprite layerNd;
|
||||||
private Sprite layerSpec;
|
private Sprite layerSpec;
|
||||||
|
|
||||||
public LegacySliderBall(Drawable animationContent)
|
public LegacySliderBall(Drawable animationContent, ISkin skin)
|
||||||
{
|
{
|
||||||
this.animationContent = animationContent;
|
this.animationContent = animationContent;
|
||||||
|
this.skin = skin;
|
||||||
|
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(ISkinSource skin)
|
private void load()
|
||||||
{
|
{
|
||||||
var ballColour = skin.GetConfig<OsuSkinColour, Color4>(OsuSkinColour.SliderBall)?.Value ?? Color4.White;
|
var ballColour = skin.GetConfig<OsuSkinColour, Color4>(OsuSkinColour.SliderBall)?.Value ?? Color4.White;
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
|
|
||||||
private void sourceChanged()
|
private void sourceChanged()
|
||||||
{
|
{
|
||||||
hasHitCircle = new Lazy<bool>(() => Source.GetTexture("hitcircle") != null);
|
hasHitCircle = new Lazy<bool>(() => FindProvider(s => s.GetTexture("hitcircle") != null) != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Drawable GetDrawableComponent(ISkinComponent component)
|
public override Drawable GetDrawableComponent(ISkinComponent component)
|
||||||
@ -49,13 +49,16 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
return followCircle;
|
return followCircle;
|
||||||
|
|
||||||
case OsuSkinComponents.SliderBall:
|
case OsuSkinComponents.SliderBall:
|
||||||
var sliderBallContent = this.GetAnimation("sliderb", true, true, animationSeparator: "");
|
// specular and nd layers must come from the same source as the ball texure.
|
||||||
|
var ballProvider = Source.FindProvider(s => s.GetTexture("sliderb") != null || s.GetTexture("sliderb0") != null);
|
||||||
|
|
||||||
|
var sliderBallContent = ballProvider.GetAnimation("sliderb", true, true, animationSeparator: "");
|
||||||
|
|
||||||
// todo: slider ball has a custom frame delay based on velocity
|
// todo: slider ball has a custom frame delay based on velocity
|
||||||
// Math.Max((150 / Velocity) * GameBase.SIXTY_FRAME_TIME, GameBase.SIXTY_FRAME_TIME);
|
// Math.Max((150 / Velocity) * GameBase.SIXTY_FRAME_TIME, GameBase.SIXTY_FRAME_TIME);
|
||||||
|
|
||||||
if (sliderBallContent != null)
|
if (sliderBallContent != null)
|
||||||
return new LegacySliderBall(sliderBallContent);
|
return new LegacySliderBall(sliderBallContent, ballProvider);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@ -84,14 +87,18 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
case OsuSkinComponents.Cursor:
|
case OsuSkinComponents.Cursor:
|
||||||
if (Source.GetTexture("cursor") != null)
|
var cursorProvider = Source.FindProvider(s => s.GetTexture("cursor") != null);
|
||||||
return new LegacyCursor();
|
|
||||||
|
if (cursorProvider != null)
|
||||||
|
return new LegacyCursor(cursorProvider);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
case OsuSkinComponents.CursorTrail:
|
case OsuSkinComponents.CursorTrail:
|
||||||
if (Source.GetTexture("cursortrail") != null)
|
var trailProvider = Source.FindProvider(s => s.GetTexture("cursortrail") != null);
|
||||||
return new LegacyCursorTrail();
|
|
||||||
|
if (trailProvider != null)
|
||||||
|
return new LegacyCursorTrail(trailProvider);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
|||||||
{
|
{
|
||||||
SliderTrackOverride,
|
SliderTrackOverride,
|
||||||
SliderBorder,
|
SliderBorder,
|
||||||
SliderBall
|
SliderBall,
|
||||||
|
SpinnerBackground,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user