Skip to content

Commit

Permalink
Merge pull request #1503 from andy840119/upgrade-to-net-10
Browse files Browse the repository at this point in the history
Upgrade to net 10
  • Loading branch information
andy840119 authored Aug 8, 2022
2 parents eea6573 + e3a101c commit d3f8cf1
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 22 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ csharp_style_prefer_index_operator = false:silent
csharp_style_prefer_range_operator = false:silent
csharp_style_prefer_switch_expression = false:none

#Style - C# 10 features
csharp_style_namespace_declarations = file_scoped:none

[*.{yaml,yml}]
insert_final_newline = true
indent_style = space
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- Contains required properties for osu!framework projects. -->
<Project>
<PropertyGroup Label="C#">
<LangVersion>9.0</LangVersion>
<LangVersion>10.0</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence.
// See the LICENCE file in the repository root for full licence text.

using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Notes;
using osu.Game.Rulesets.Karaoke.Objects;
using osu.Game.Rulesets.Karaoke.Tests.Helper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using osu.Game.IO;
using osu.Game.Rulesets.Karaoke.Edit.Generator.Notes;
using osu.Game.Rulesets.Karaoke.Objects;
using osu.Game.Rulesets.Karaoke.Utils;

namespace osu.Game.Rulesets.Karaoke.Beatmaps.Formats
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#nullable disable

using System;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,12 @@ protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnl
return dependencies;
}

public T GetLyricEditorModeState<T>() where T : Enum
{
switch (typeof(T))
public T GetLyricEditorModeState<T>() where T : Enum =>
typeof(T) switch
{
case Type t when t == typeof(TextingEditMode):
return EnumUtils.Casting<T>(textingModeState.EditMode);

default:
throw new NotSupportedException();
}
}
Type t when t == typeof(TextingEditMode) => EnumUtils.Casting<T>(textingModeState.EditMode),
_ => throw new NotSupportedException()
};

public void SwitchToEditModeState<T>(T mode) where T : Enum
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Collections.Generic;
using osu.Game.Graphics;
using osu.Game.Overlays;
using osu.Game.Rulesets.Karaoke.Edit.Lyrics.Extends.Components;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
public bool OnPressed(KeyBindingPressEvent<KaraokeScoringAction> e)
{
// Make sure the action happened within the body of the hold note
if (Time.Current < HitObject.StartTime && holdStartTime == null || Time.Current > HitObject.EndTime && holdStartTime == null)
if ((Time.Current < HitObject.StartTime && holdStartTime == null) || (Time.Current > HitObject.EndTime && holdStartTime == null))
return false;

if (holdStartTime == null)
Expand Down
5 changes: 2 additions & 3 deletions osu.Game.Rulesets.Karaoke/Objects/Tone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ public override bool Equals(object obj)

public static Tone operator -(Tone tone) => negate(tone);

private static Tone negate(Tone tone) => new()
private static Tone negate(Tone tone) => tone with
{
Scale = -tone.Scale + (tone.Half ? -1 : 0),
Half = tone.Half
Scale = -tone.Scale + (tone.Half ? -1 : 0)
};

public static bool operator ==(Tone tone1, Tone tone2) => tone1.Equals(tone2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ internal static IDictionary<int, Character> GenerateCharacters(BitmapFontInfo or
character.Y = currentTopLeftPosition.Y;

// assign next position for drawing.
currentTopLeftPosition = new
currentTopLeftPosition = currentTopLeftPosition with
{
X = currentTopLeftPosition.X + character.Width + spacing.X, currentTopLeftPosition.Y,
X = currentTopLeftPosition.X + character.Width + spacing.X
};
}

Expand Down

0 comments on commit d3f8cf1

Please sign in to comment.