mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 05:22:54 +08:00
Use auto property.
This commit is contained in:
parent
574de39b0d
commit
bbeab6fa76
@ -137,7 +137,7 @@ csharp_style_expression_bodied_properties = true:silent
|
||||
dotnet_style_object_initializer = true:warning
|
||||
dotnet_style_collection_initializer = true:warning
|
||||
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
|
||||
dotnet_style_prefer_auto_properties = true:silent
|
||||
dotnet_style_prefer_auto_properties = true:warning
|
||||
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
|
||||
dotnet_style_prefer_conditional_expression_over_return = true:silent
|
||||
dotnet_style_prefer_compound_assignment = true:silent
|
||||
|
@ -116,13 +116,7 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
|
||||
public double Duration => EndTime - StartTime;
|
||||
|
||||
private SliderPath path;
|
||||
|
||||
public SliderPath Path
|
||||
{
|
||||
get => path;
|
||||
set => path = value;
|
||||
}
|
||||
public SliderPath Path { get; set; }
|
||||
|
||||
public double Distance => Path.Distance;
|
||||
|
||||
|
@ -10,27 +10,15 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
|
||||
{
|
||||
public class TaikoPiece : BeatSyncedContainer, IHasAccentColour
|
||||
{
|
||||
private Color4 accentColour;
|
||||
|
||||
/// <summary>
|
||||
/// The colour of the inner circle and outer glows.
|
||||
/// </summary>
|
||||
public virtual Color4 AccentColour
|
||||
{
|
||||
get => accentColour;
|
||||
set => accentColour = value;
|
||||
}
|
||||
|
||||
private bool kiaiMode;
|
||||
public virtual Color4 AccentColour { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether Kiai mode effects are enabled for this circle piece.
|
||||
/// </summary>
|
||||
public virtual bool KiaiMode
|
||||
{
|
||||
get => kiaiMode;
|
||||
set => kiaiMode = value;
|
||||
}
|
||||
public virtual bool KiaiMode { get; set; }
|
||||
|
||||
public TaikoPiece()
|
||||
{
|
||||
|
@ -335,16 +335,14 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
private class TestSkinComponent : ISkinComponent
|
||||
{
|
||||
private readonly string name;
|
||||
|
||||
public TestSkinComponent(string name)
|
||||
{
|
||||
this.name = name;
|
||||
LookupName = name;
|
||||
}
|
||||
|
||||
public string ComponentGroup => string.Empty;
|
||||
|
||||
public string LookupName => name;
|
||||
public string LookupName { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -288,17 +288,15 @@ namespace osu.Game.Online.Leaderboards
|
||||
private class ScoreComponentLabel : Container, IHasTooltip
|
||||
{
|
||||
private const float icon_size = 20;
|
||||
|
||||
private readonly string name;
|
||||
private readonly FillFlowContainer content;
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos) => content.Contains(screenSpacePos);
|
||||
|
||||
public string TooltipText => name;
|
||||
public string TooltipText { get; }
|
||||
|
||||
public ScoreComponentLabel(LeaderboardScoreStatistic statistic)
|
||||
{
|
||||
name = statistic.Name;
|
||||
TooltipText = statistic.Name;
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
Child = content = new FillFlowContainer
|
||||
|
@ -74,8 +74,6 @@ namespace osu.Game
|
||||
|
||||
protected Storage Storage { get; set; }
|
||||
|
||||
private Bindable<WorkingBeatmap> beatmap; // cached via load() method
|
||||
|
||||
[Cached]
|
||||
[Cached(typeof(IBindable<RulesetInfo>))]
|
||||
protected readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
||||
@ -85,7 +83,7 @@ namespace osu.Game
|
||||
[Cached(Type = typeof(IBindable<IReadOnlyList<Mod>>))]
|
||||
protected readonly Bindable<IReadOnlyList<Mod>> Mods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
||||
|
||||
protected Bindable<WorkingBeatmap> Beatmap => beatmap;
|
||||
protected Bindable<WorkingBeatmap> Beatmap { get; private set; } // cached via load() method
|
||||
|
||||
private Bindable<bool> fpsDisplayVisible;
|
||||
|
||||
@ -201,16 +199,16 @@ namespace osu.Game
|
||||
// this adds a global reduction of track volume for the time being.
|
||||
Audio.Tracks.AddAdjustment(AdjustableProperty.Volume, new BindableDouble(0.8));
|
||||
|
||||
beatmap = new NonNullableBindable<WorkingBeatmap>(defaultBeatmap);
|
||||
beatmap.BindValueChanged(b => ScheduleAfterChildren(() =>
|
||||
Beatmap = new NonNullableBindable<WorkingBeatmap>(defaultBeatmap);
|
||||
Beatmap.BindValueChanged(b => ScheduleAfterChildren(() =>
|
||||
{
|
||||
// compare to last beatmap as sometimes the two may share a track representation (optimisation, see WorkingBeatmap.TransferTo)
|
||||
if (b.OldValue?.TrackLoaded == true && b.OldValue?.Track != b.NewValue?.Track)
|
||||
b.OldValue.RecycleTrack();
|
||||
}));
|
||||
|
||||
dependencies.CacheAs<IBindable<WorkingBeatmap>>(beatmap);
|
||||
dependencies.CacheAs(beatmap);
|
||||
dependencies.CacheAs<IBindable<WorkingBeatmap>>(Beatmap);
|
||||
dependencies.CacheAs(Beatmap);
|
||||
|
||||
FileStore.Cleanup();
|
||||
|
||||
|
@ -91,10 +91,9 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
|
||||
private class Statistic : Container, IHasTooltip
|
||||
{
|
||||
private readonly string name;
|
||||
private readonly OsuSpriteText value;
|
||||
|
||||
public string TooltipText => name;
|
||||
public string TooltipText { get; }
|
||||
|
||||
public string Value
|
||||
{
|
||||
@ -104,7 +103,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
|
||||
public Statistic(IconUsage icon, string name)
|
||||
{
|
||||
this.name = name;
|
||||
TooltipText = name;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
|
@ -58,9 +58,8 @@ namespace osu.Game.Overlays.Chat
|
||||
|
||||
private Message message;
|
||||
private OsuSpriteText username;
|
||||
private LinkFlowContainer contentFlow;
|
||||
|
||||
public LinkFlowContainer ContentFlow => contentFlow;
|
||||
public LinkFlowContainer ContentFlow { get; private set; }
|
||||
|
||||
public Message Message
|
||||
{
|
||||
@ -164,7 +163,7 @@ namespace osu.Game.Overlays.Chat
|
||||
Padding = new MarginPadding { Left = MessagePadding + HorizontalPadding },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
contentFlow = new LinkFlowContainer(t =>
|
||||
ContentFlow = new LinkFlowContainer(t =>
|
||||
{
|
||||
t.Shadow = false;
|
||||
|
||||
@ -206,8 +205,8 @@ namespace osu.Game.Overlays.Chat
|
||||
// remove non-existent channels from the link list
|
||||
message.Links.RemoveAll(link => link.Action == LinkAction.OpenChannel && chatManager?.AvailableChannels.Any(c => c.Name == link.Argument) != true);
|
||||
|
||||
contentFlow.Clear();
|
||||
contentFlow.AddLinks(message.DisplayContent, message.Links);
|
||||
ContentFlow.Clear();
|
||||
ContentFlow.AddLinks(message.DisplayContent, message.Links);
|
||||
}
|
||||
|
||||
private class MessageSender : OsuClickableContainer, IHasContextMenu
|
||||
|
@ -7,8 +7,7 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
{
|
||||
public class VariantBindingsSubsection : KeyBindingsSubsection
|
||||
{
|
||||
protected override string Header => variantName;
|
||||
private readonly string variantName;
|
||||
protected override string Header { get; }
|
||||
|
||||
public VariantBindingsSubsection(RulesetInfo ruleset, int variant)
|
||||
: base(variant)
|
||||
@ -17,7 +16,7 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
|
||||
var rulesetInstance = ruleset.CreateInstance();
|
||||
|
||||
variantName = rulesetInstance.GetVariantName(variant);
|
||||
Header = rulesetInstance.GetVariantName(variant);
|
||||
Defaults = rulesetInstance.GetDefaultKeyBindings(variant);
|
||||
}
|
||||
}
|
||||
|
@ -30,8 +30,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
private readonly BindableDouble muteAdjustment = new BindableDouble();
|
||||
|
||||
private readonly Bindable<bool> isMuted = new Bindable<bool>();
|
||||
public Bindable<bool> IsMuted => isMuted;
|
||||
public Bindable<bool> IsMuted { get; } = new Bindable<bool>();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, OsuColour colours)
|
||||
@ -66,7 +65,7 @@ namespace osu.Game.Overlays
|
||||
muteButton = new MuteButton
|
||||
{
|
||||
Margin = new MarginPadding { Top = 100 },
|
||||
Current = { BindTarget = isMuted }
|
||||
Current = { BindTarget = IsMuted }
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -76,7 +75,7 @@ namespace osu.Game.Overlays
|
||||
volumeMeterEffect.Bindable.BindTo(audio.VolumeSample);
|
||||
volumeMeterMusic.Bindable.BindTo(audio.VolumeTrack);
|
||||
|
||||
isMuted.BindValueChanged(muted =>
|
||||
IsMuted.BindValueChanged(muted =>
|
||||
{
|
||||
if (muted.NewValue)
|
||||
audio.AddAdjustment(AdjustableProperty.Volume, muteAdjustment);
|
||||
|
@ -28,14 +28,12 @@ namespace osu.Game.Skinning
|
||||
|
||||
private class SpriteComponent : ISkinComponent
|
||||
{
|
||||
private readonly string textureName;
|
||||
|
||||
public SpriteComponent(string textureName)
|
||||
{
|
||||
this.textureName = textureName;
|
||||
LookupName = textureName;
|
||||
}
|
||||
|
||||
public string LookupName => textureName;
|
||||
public string LookupName { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,8 +16,7 @@ namespace osu.Game.Storyboards.Drawables
|
||||
{
|
||||
public Storyboard Storyboard { get; private set; }
|
||||
|
||||
private readonly Container<DrawableStoryboardLayer> content;
|
||||
protected override Container<DrawableStoryboardLayer> Content => content;
|
||||
protected override Container<DrawableStoryboardLayer> Content { get; }
|
||||
|
||||
protected override Vector2 DrawScale => new Vector2(Parent.DrawHeight / 480);
|
||||
|
||||
@ -49,7 +48,7 @@ namespace osu.Game.Storyboards.Drawables
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
AddInternal(content = new Container<DrawableStoryboardLayer>
|
||||
AddInternal(Content = new Container<DrawableStoryboardLayer>
|
||||
{
|
||||
Size = new Vector2(640, 480),
|
||||
Anchor = Anchor.Centre,
|
||||
|
@ -63,7 +63,9 @@
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertIfToOrExpression/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertNullableToShortForm/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertPropertyToExpressionBody/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToAutoProperty/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToAutoProperty/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToAutoPropertyWhenPossible/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToAutoPropertyWithPrivateSetter/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToConstant_002ELocal/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToLambdaExpression/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToLocalFunction/@EntryIndexedValue">HINT</s:String>
|
||||
|
Loading…
Reference in New Issue
Block a user