mirror of
https://github.com/ppy/osu
synced 2024-12-25 08:12:41 +00:00
Use 'out var'.
This commit is contained in:
parent
0d81b96c5f
commit
31cc0d13da
@ -156,7 +156,7 @@ csharp_style_unused_value_expression_statement_preference = discard_variable:sil
|
|||||||
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
|
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
|
||||||
|
|
||||||
#Style - variable declaration
|
#Style - variable declaration
|
||||||
csharp_style_inlined_variable_declaration = true:silent
|
csharp_style_inlined_variable_declaration = true:warning
|
||||||
csharp_style_deconstructed_variable_declaration = true:warning
|
csharp_style_deconstructed_variable_declaration = true:warning
|
||||||
|
|
||||||
#Style - other C# 7.x features
|
#Style - other C# 7.x features
|
||||||
|
@ -303,8 +303,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
|
|
||||||
var pattern = new Pattern();
|
var pattern = new Pattern();
|
||||||
|
|
||||||
bool addToCentre;
|
int noteCount = getRandomNoteCountMirrored(centreProbability, p2, p3, out var addToCentre);
|
||||||
int noteCount = getRandomNoteCountMirrored(centreProbability, p2, p3, out addToCentre);
|
|
||||||
|
|
||||||
int columnLimit = (TotalColumns % 2 == 0 ? TotalColumns : TotalColumns - 1) / 2;
|
int columnLimit = (TotalColumns % 2 == 0 ? TotalColumns : TotalColumns - 1) / 2;
|
||||||
int nextColumn = GetRandomColumn(upperBound: columnLimit);
|
int nextColumn = GetRandomColumn(upperBound: columnLimit);
|
||||||
|
@ -225,9 +225,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
beatmapId.Value = Model.ID.ToString();
|
beatmapId.Value = Model.ID.ToString();
|
||||||
beatmapId.BindValueChanged(idString =>
|
beatmapId.BindValueChanged(idString =>
|
||||||
{
|
{
|
||||||
int parsed;
|
int.TryParse(idString.NewValue, out var parsed);
|
||||||
|
|
||||||
int.TryParse(idString.NewValue, out parsed);
|
|
||||||
|
|
||||||
Model.ID = parsed;
|
Model.ID = parsed;
|
||||||
|
|
||||||
|
@ -267,9 +267,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
userId.Value = user.Id.ToString();
|
userId.Value = user.Id.ToString();
|
||||||
userId.BindValueChanged(idString =>
|
userId.BindValueChanged(idString =>
|
||||||
{
|
{
|
||||||
long parsed;
|
long.TryParse(idString.NewValue, out var parsed);
|
||||||
|
|
||||||
long.TryParse(idString.NewValue, out parsed);
|
|
||||||
|
|
||||||
user.Id = parsed;
|
user.Id = parsed;
|
||||||
|
|
||||||
|
@ -293,9 +293,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
string[] split = line.Split(',');
|
string[] split = line.Split(',');
|
||||||
|
|
||||||
EventType type;
|
if (!Enum.TryParse(split[0], out EventType type))
|
||||||
|
|
||||||
if (!Enum.TryParse(split[0], out type))
|
|
||||||
throw new InvalidDataException($@"Unknown event type: {split[0]}");
|
throw new InvalidDataException($@"Unknown event type: {split[0]}");
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
|
@ -83,9 +83,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
storyboardSprite = null;
|
storyboardSprite = null;
|
||||||
|
|
||||||
EventType type;
|
if (!Enum.TryParse(split[0], out EventType type))
|
||||||
|
|
||||||
if (!Enum.TryParse(split[0], out type))
|
|
||||||
throw new InvalidDataException($@"Unknown event type: {split[0]}");
|
throw new InvalidDataException($@"Unknown event type: {split[0]}");
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
|
@ -226,9 +226,7 @@ namespace osu.Game.IO.Legacy
|
|||||||
|
|
||||||
public override Type BindToType(string assemblyName, string typeName)
|
public override Type BindToType(string assemblyName, string typeName)
|
||||||
{
|
{
|
||||||
Type typeToDeserialize;
|
if (cache.TryGetValue(assemblyName + typeName, out var typeToDeserialize))
|
||||||
|
|
||||||
if (cache.TryGetValue(assemblyName + typeName, out typeToDeserialize))
|
|
||||||
return typeToDeserialize;
|
return typeToDeserialize;
|
||||||
|
|
||||||
List<Type> tmpTypes = new List<Type>();
|
List<Type> tmpTypes = new List<Type>();
|
||||||
|
@ -177,8 +177,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
if (i >= adds.Length)
|
if (i >= adds.Length)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
int sound;
|
int.TryParse(adds[i], out var sound);
|
||||||
int.TryParse(adds[i], out sound);
|
|
||||||
nodeSoundTypes[i] = (LegacySoundType)sound;
|
nodeSoundTypes[i] = (LegacySoundType)sound;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,7 @@ namespace osu.Game.Storyboards
|
|||||||
|
|
||||||
public StoryboardLayer GetLayer(string name)
|
public StoryboardLayer GetLayer(string name)
|
||||||
{
|
{
|
||||||
StoryboardLayer layer;
|
if (!layers.TryGetValue(name, out var layer))
|
||||||
if (!layers.TryGetValue(name, out layer))
|
|
||||||
layers[name] = layer = new StoryboardLayer(name, layers.Values.Min(l => l.Depth) - 1);
|
layers[name] = layer = new StoryboardLayer(name, layers.Values.Min(l => l.Depth) - 1);
|
||||||
|
|
||||||
return layer;
|
return layer;
|
||||||
|
Loading…
Reference in New Issue
Block a user