Skip to content

Commit

Permalink
Merge branch 'master' into new-chat-drawable-channel
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed May 9, 2022
2 parents 623e2c9 + ab1d46b commit 1c63c27
Show file tree
Hide file tree
Showing 104 changed files with 1,469 additions and 416 deletions.
6 changes: 0 additions & 6 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
"version": 1,
"isRoot": true,
"tools": {
"dotnet-format": {
"version": "3.1.37601",
"commands": [
"dotnet-format"
]
},
"jetbrains.resharper.globaltools": {
"version": "2022.1.0-eap10",
"commands": [
Expand Down
42 changes: 24 additions & 18 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
# EditorConfig is awesome: http://editorconfig.org
root = true

[*.{csproj,props,targets}]
charset = utf-8-bom
end_of_line = crlf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[*.cs]
end_of_line = crlf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

#license header
file_header_template = Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.\nSee the LICENCE file in the repository root for full licence text.

#Roslyn naming styles

#PascalCase for public and protected members
dotnet_naming_style.pascalcase.capitalization = pascal_case
dotnet_naming_symbols.public_members.applicable_accessibilities = public,internal,protected,protected_internal,private_protected
dotnet_naming_symbols.public_members.applicable_kinds = property,method,field,event
dotnet_naming_rule.public_members_pascalcase.severity = error
dotnet_naming_rule.public_members_pascalcase.symbols = public_members
dotnet_naming_rule.public_members_pascalcase.style = pascalcase

#camelCase for private members
dotnet_naming_style.camelcase.capitalization = camel_case

Expand Down Expand Up @@ -172,24 +191,11 @@ csharp_style_prefer_index_operator = false:silent
csharp_style_prefer_range_operator = false:silent
csharp_style_prefer_switch_expression = false:none

#Supressing roslyn built-in analyzers
# Suppress: EC112

#Private method is unused
dotnet_diagnostic.IDE0051.severity = silent
#Private member is unused
dotnet_diagnostic.IDE0052.severity = silent

#Rules for disposable
dotnet_diagnostic.IDE0067.severity = none
dotnet_diagnostic.IDE0068.severity = none
dotnet_diagnostic.IDE0069.severity = none

#Disable operator overloads requiring alternate named methods
dotnet_diagnostic.CA2225.severity = none

# Banned APIs
dotnet_diagnostic.RS0030.severity = error
[*.{yaml,yml}]
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

dotnet_diagnostic.OLOC001.words_in_name = 5
dotnet_diagnostic.OLOC001.license_header = // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.\n// See the LICENCE file in the repository root for full licence text.
9 changes: 4 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
path: ${{ github.workspace }}/inspectcode
key: inspectcode-${{ hashFiles('.config/dotnet-tools.json') }}-${{ hashFiles('.github/workflows/ci.yml' ) }}

- name: Dotnet code style
run: dotnet build -c Debug -warnaserror osu.Desktop.slnf -p:EnforceCodeStyleInBuild=true

- name: CodeFileSanity
run: |
# TODO: Add ignore filters and GitHub Workflow Command Reporting in CFS. That way we don't have to do this workaround.
Expand All @@ -46,10 +49,6 @@ jobs:
done <<< $(dotnet codefilesanity)
exit $exit_code
# 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 --no-build --output="inspectcodereport.xml" --caches-home="inspectcode" --verbosity=WARN

Expand Down Expand Up @@ -147,4 +146,4 @@ jobs:
# cannot accept .sln(f) files as arguments.
# Build just the main game for now.
- name: Build
run: msbuild osu.iOS/osu.iOS.csproj /restore /p:Configuration=Debug
run: msbuild osu.iOS/osu.iOS.csproj /restore /p:Configuration=Debug
55 changes: 55 additions & 0 deletions .globalconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
is_global = true

# .NET Code Style
# IDE styles reference: https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/

# IDE0001: Simplify names
dotnet_diagnostic.IDE0001.severity = warning

# IDE0002: Simplify member access
dotnet_diagnostic.IDE0002.severity = warning

# IDE0003: Remove qualification
dotnet_diagnostic.IDE0003.severity = warning

# IDE0004: Remove unnecessary cast
dotnet_diagnostic.IDE0004.severity = warning

# IDE0005: Remove unnecessary imports
dotnet_diagnostic.IDE0005.severity = warning

# IDE0034: Simplify default literal
dotnet_diagnostic.IDE0034.severity = warning

# IDE0036: Sort modifiers
dotnet_diagnostic.IDE0036.severity = warning

# IDE0040: Add accessibility modifier
dotnet_diagnostic.IDE0040.severity = warning

# IDE0049: Use keyword for type name
dotnet_diagnostic.IDE0040.severity = warning

# IDE0055: Fix formatting
dotnet_diagnostic.IDE0055.severity = warning

# IDE0051: Private method is unused
dotnet_diagnostic.IDE0051.severity = silent

# IDE0052: Private member is unused
dotnet_diagnostic.IDE0052.severity = silent

# IDE0073: File header
dotnet_diagnostic.IDE0073.severity = warning

# IDE0130: Namespace mismatch with folder
dotnet_diagnostic.IDE0130.severity = warning

# IDE1006: Naming style
dotnet_diagnostic.IDE1006.severity = warning

#Disable operator overloads requiring alternate named methods
dotnet_diagnostic.CA2225.severity = none

# Banned APIs
dotnet_diagnostic.RS0030.severity = error
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Contains required properties for osu!framework projects. -->
<!-- Contains required properties for osu!framework projects. -->
<Project>
<PropertyGroup Label="C#">
<LangVersion>8.0</LangVersion>
Expand Down
4 changes: 2 additions & 2 deletions osu.Android.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project>
<Project>
<PropertyGroup>
<LangVersion>8.0</LangVersion>
<OutputPath>bin\$(Configuration)</OutputPath>
Expand Down Expand Up @@ -52,7 +52,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.422.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.430.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.509.0" />
</ItemGroup>
<ItemGroup Label="Transitive Dependencies">
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ public abstract class CatchSelectionBlueprintTestScene : SelectionBlueprintTestS

protected CatchSelectionBlueprintTestScene()
{
EditorBeatmap = new EditorBeatmap(new CatchBeatmap
var catchBeatmap = new CatchBeatmap
{
BeatmapInfo =
{
Ruleset = new CatchRuleset().RulesetInfo,
}
}) { Difficulty = { CircleSize = 0 } };
};
EditorBeatmap = new EditorBeatmap(catchBeatmap) { Difficulty = { CircleSize = 0 } };
EditorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint
{
BeatLength = 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ public void TestReversePlacement()

AddMoveStep(end_time, 0);
AddClickStep(MouseButton.Left);

AddMoveStep(start_time, 0);
AddAssert("duration is positive", () => ((BananaShower)CurrentBlueprint.HitObject).Duration > 0);

AddClickStep(MouseButton.Right);
AddAssert("start time is correct", () => Precision.AlmostEquals(LastObject.HitObject.StartTime, start_time));
AddAssert("end time is correct", () => Precision.AlmostEquals(LastObject.HitObject.GetEndTime(), end_time));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// 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 osu.Framework.Input.Events;
using osu.Game.Rulesets.Catch.Edit.Blueprints.Components;
using osu.Game.Rulesets.Catch.Objects;
Expand All @@ -13,11 +14,21 @@ public class BananaShowerPlacementBlueprint : CatchPlacementBlueprint<BananaShow
{
private readonly TimeSpanOutline outline;

private double placementStartTime;
private double placementEndTime;

public BananaShowerPlacementBlueprint()
{
InternalChild = outline = new TimeSpanOutline();
}

protected override void LoadComplete()
{
base.LoadComplete();

BeginPlacement();
}

protected override void Update()
{
base.Update();
Expand All @@ -38,13 +49,6 @@ protected override bool OnMouseDown(MouseDownEvent e)
case PlacementState.Active:
if (e.Button != MouseButton.Right) break;

// If the duration is negative, swap the start and the end time to make the duration positive.
if (HitObject.Duration < 0)
{
HitObject.StartTime = HitObject.EndTime;
HitObject.Duration = -HitObject.Duration;
}

EndPlacement(HitObject.Duration > 0);
return true;
}
Expand All @@ -61,13 +65,16 @@ public override void UpdateTimeAndPosition(SnapResult result)
switch (PlacementActive)
{
case PlacementState.Waiting:
HitObject.StartTime = time;
placementStartTime = placementEndTime = time;
break;

case PlacementState.Active:
HitObject.EndTime = time;
placementEndTime = time;
break;
}

HitObject.StartTime = Math.Min(placementStartTime, placementEndTime);
HitObject.EndTime = Math.Max(placementStartTime, placementEndTime);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ protected override void LoadComplete()
base.LoadComplete();

inputManager = GetContainingInputManager();

BeginPlacement();
}

protected override bool OnMouseDown(MouseDownEvent e)
Expand Down
12 changes: 12 additions & 0 deletions osu.Game.Rulesets.Osu/Mods/OsuModStrictTracking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,18 @@ protected override void CreateNestedHitObjects(CancellationToken cancellationTok
{
switch (e.Type)
{
case SliderEventType.Tick:
AddNested(new SliderTick
{
SpanIndex = e.SpanIndex,
SpanStartTime = e.SpanStartTime,
StartTime = e.Time,
Position = Position + Path.PositionAt(e.PathProgress),
StackHeight = StackHeight,
Scale = Scale,
});
break;

case SliderEventType.Head:
AddNested(HeadCircle = new SliderHeadCircle
{
Expand Down
Loading

0 comments on commit 1c63c27

Please sign in to comment.