1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 08:53:20 +08:00

Use Linq.Append and Prepend.

This commit is contained in:
Huo Yaoyuan 2018-04-02 12:06:34 +08:00
parent cc70f7182a
commit b842f682eb
9 changed files with 10 additions and 12 deletions

View File

@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Osu.Mods
{ {
public class OsuModAutoplay : ModAutoplay<OsuHitObject> public class OsuModAutoplay : ModAutoplay<OsuHitObject>
{ {
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot), typeof(OsuModSpunOut) }).ToArray(); public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).Append(typeof(OsuModSpunOut)).ToArray();
protected override Score CreateReplayScore(Beatmap<OsuHitObject> beatmap) protected override Score CreateReplayScore(Beatmap<OsuHitObject> beatmap)
{ {

View File

@ -9,6 +9,6 @@ namespace osu.Game.Rulesets.Osu.Mods
{ {
public class OsuModNoFail : ModNoFail public class OsuModNoFail : ModNoFail
{ {
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray(); public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).ToArray();
} }
} }

View File

@ -10,6 +10,6 @@ namespace osu.Game.Rulesets.Osu.Mods
public class OsuModRelax : ModRelax public class OsuModRelax : ModRelax
{ {
public override string Description => @"You don't need to click. Give your clicking/tapping fingers a break from the heat of things."; public override string Description => @"You don't need to click. Give your clicking/tapping fingers a break from the heat of things.";
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray(); public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).ToArray();
} }
} }

View File

@ -9,6 +9,6 @@ namespace osu.Game.Rulesets.Osu.Mods
{ {
public class OsuModSuddenDeath : ModSuddenDeath public class OsuModSuddenDeath : ModSuddenDeath
{ {
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray(); public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).ToArray();
} }
} }

View File

@ -16,7 +16,7 @@ namespace osu.Game.Beatmaps.Formats
public TOutput Decode(StreamReader primaryStream, params StreamReader[] otherStreams) public TOutput Decode(StreamReader primaryStream, params StreamReader[] otherStreams)
{ {
var output = CreateTemplateObject(); var output = CreateTemplateObject();
foreach (StreamReader stream in new[] { primaryStream }.Concat(otherStreams)) foreach (StreamReader stream in otherStreams.Prepend(primaryStream))
ParseStreamInto(stream, output); ParseStreamInto(stream, output);
return output; return output;
} }

View File

@ -45,7 +45,7 @@ namespace osu.Game.Input.Bindings
}; };
protected override IEnumerable<Drawable> KeyBindingInputQueue => protected override IEnumerable<Drawable> KeyBindingInputQueue =>
handler == null ? base.KeyBindingInputQueue : new[] { handler }.Concat(base.KeyBindingInputQueue); handler == null ? base.KeyBindingInputQueue : base.KeyBindingInputQueue.Prepend(handler);
} }
public enum GlobalAction public enum GlobalAction

View File

@ -47,7 +47,7 @@ namespace osu.Game.Overlays.KeyBinding
private FillFlowContainer<KeyButton> buttons; private FillFlowContainer<KeyButton> buttons;
public IEnumerable<string> FilterTerms => new[] { text.Text }.Concat(bindings.Select(b => b.KeyCombination.ReadableString())); public IEnumerable<string> FilterTerms => bindings.Select(b => b.KeyCombination.ReadableString()).Prepend(text.Text);
public KeyBindingRow(object action, IEnumerable<Framework.Input.Bindings.KeyBinding> bindings) public KeyBindingRow(object action, IEnumerable<Framework.Input.Bindings.KeyBinding> bindings)
{ {

View File

@ -128,10 +128,8 @@ namespace osu.Game.Rulesets.Edit
selectionLayer.SelectionFinished += hitObjectMaskLayer.AddSelectionOverlay; selectionLayer.SelectionFinished += hitObjectMaskLayer.AddSelectionOverlay;
toolboxCollection.Items = toolboxCollection.Items =
new[] { new RadioButton("Select", () => setCompositionTool(null)) } CompositionTools.Select(t => new RadioButton(t.Name, () => setCompositionTool(t)))
.Concat( .Prepend(new RadioButton("Select", () => setCompositionTool(null)))
CompositionTools.Select(t => new RadioButton(t.Name, () => setCompositionTool(t)))
)
.ToList(); .ToList();
toolboxCollection.Items[0].Select(); toolboxCollection.Items[0].Select();

View File

@ -150,7 +150,7 @@ namespace osu.Game.Screens.Select
var mods = modSelect.SelectedMods.Value; var mods = modSelect.SelectedMods.Value;
if (mods.All(m => m.GetType() != autoType)) if (mods.All(m => m.GetType() != autoType))
{ {
modSelect.SelectedMods.Value = mods.Concat(new[] { auto }); modSelect.SelectedMods.Value = mods.Append(auto);
removeAutoModOnResume = true; removeAutoModOnResume = true;
} }
} }