1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Fix various code inspection issues

This commit is contained in:
Dean Herbert 2022-06-02 14:36:07 +09:00
parent 624bb43eaf
commit f3d4cd3f95
6 changed files with 29 additions and 22 deletions

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
protected DrawableTaikoRuleset DrawableRuleset { get; private set; }
protected Container PlayfieldContainer { get; private set; }
protected ControlPointInfo controlPointInfo { get; private set; }
private ControlPointInfo controlPointInfo { get; set; }
[BackgroundDependencyLoader]
private void load()

View File

@ -28,7 +28,8 @@ namespace osu.Game.Rulesets.Taiko.Tests
{
List<TaikoHitObject> hitObjects = new List<TaikoHitObject>();
for (var i = 0; i < NUM_HIT_OBJECTS; i++) {
for (int i = 0; i < NUM_HIT_OBJECTS; i++)
{
hitObjects.Add(new Hit
{
StartTime = Time.Current + i * HIT_OBJECT_TIME_SPACING_MS,
@ -36,7 +37,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
Type = isOdd(i / 2) ? HitType.Centre : HitType.Rim
});
}
var beatmap = new Beatmap<TaikoHitObject>
{
BeatmapInfo = { Ruleset = ruleset },
@ -46,7 +47,8 @@ namespace osu.Game.Rulesets.Taiko.Tests
return beatmap;
}
private bool isOdd(int number) {
private bool isOdd(int number)
{
return number % 2 == 0;
}
}

View File

@ -12,10 +12,10 @@ namespace osu.Game.Rulesets.Taiko.UI
{
internal class DrumSamplePlayer : Container, IKeyBindingHandler<TaikoAction>
{
private DrumSampleTriggerSource leftRimSampleTriggerSource;
private DrumSampleTriggerSource leftCentreSampleTriggerSource;
private DrumSampleTriggerSource rightCentreSampleTriggerSource;
private DrumSampleTriggerSource rightRimSampleTriggerSource;
private readonly DrumSampleTriggerSource leftRimSampleTriggerSource;
private readonly DrumSampleTriggerSource leftCentreSampleTriggerSource;
private readonly DrumSampleTriggerSource rightCentreSampleTriggerSource;
private readonly DrumSampleTriggerSource rightRimSampleTriggerSource;
public DrumSamplePlayer(HitObjectContainer hitObjectContainer)
{
@ -35,12 +35,15 @@ namespace osu.Game.Rulesets.Taiko.UI
case TaikoAction.LeftRim:
leftRimSampleTriggerSource.Play(HitType.Rim);
break;
case TaikoAction.LeftCentre:
leftCentreSampleTriggerSource.Play(HitType.Centre);
break;
case TaikoAction.RightCentre:
rightCentreSampleTriggerSource.Play(HitType.Centre);
break;
case TaikoAction.RightRim:
rightRimSampleTriggerSource.Play(HitType.Rim);
break;

View File

@ -24,8 +24,9 @@ namespace osu.Game.Rulesets.Taiko.UI
{
// The percent of the drum that extends past the bottom of the screen (set to 0.0f to show the full drum)
private const float offscreen_percent = 0.35f;
private InputDrum touchInputDrum;
private Circle drumBackground;
private readonly InputDrum touchInputDrum;
private readonly Circle drumBackground;
private KeyBindingContainer<TaikoAction> keyBindingContainer;
@ -33,9 +34,9 @@ namespace osu.Game.Rulesets.Taiko.UI
private TaikoAction mouseAction;
// A map of (Finger Index OnTouchDown -> Which Taiko action was pressed), so that the corresponding action can be released OnTouchUp is released even if the touch position moved
private Dictionary<TouchSource, TaikoAction> touchActions = new Dictionary<TouchSource, TaikoAction>(Enum.GetNames(typeof(TouchSource)).Length);
private readonly Dictionary<TouchSource, TaikoAction> touchActions = new Dictionary<TouchSource, TaikoAction>(Enum.GetNames(typeof(TouchSource)).Length);
private Container visibleComponents;
private readonly Container visibleComponents;
public DrumTouchInputArea()
{
@ -43,7 +44,8 @@ namespace osu.Game.Rulesets.Taiko.UI
RelativePositionAxes = Axes.Both;
Children = new Drawable[]
{
visibleComponents = new Container() {
visibleComponents = new Container
{
Alpha = 0.0f,
RelativeSizeAxes = Axes.Both,
RelativePositionAxes = Axes.Both,
@ -51,7 +53,8 @@ namespace osu.Game.Rulesets.Taiko.UI
Origin = Anchor.BottomCentre,
Children = new Drawable[]
{
drumBackground = new Circle() {
drumBackground = new Circle
{
RelativeSizeAxes = Axes.Both,
RelativePositionAxes = Axes.Both,
Anchor = Anchor.Centre,
@ -59,7 +62,8 @@ namespace osu.Game.Rulesets.Taiko.UI
FillMode = FillMode.Fit,
Alpha = 0.9f,
},
touchInputDrum = new InputDrum() {
touchInputDrum = new InputDrum
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
@ -135,9 +139,7 @@ namespace osu.Game.Rulesets.Taiko.UI
bool centreHit = inputIsCenterHit(inputPosition);
bool leftSide = inputIsOnLeftSide(inputPosition);
return centreHit ?
(leftSide ? TaikoAction.LeftCentre : TaikoAction.RightCentre) :
(leftSide ? TaikoAction.LeftRim : TaikoAction.RightRim);
return centreHit ? (leftSide ? TaikoAction.LeftCentre : TaikoAction.RightCentre) : (leftSide ? TaikoAction.LeftRim : TaikoAction.RightRim);
}
private bool inputIsOnLeftSide(Vector2 inputPosition)

View File

@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Taiko.UI
private readonly Sprite centre;
private readonly Sprite centreHit;
public TaikoHalfDrum(bool flipped, float centre_size)
public TaikoHalfDrum(bool flipped, float centreSize)
{
Masking = true;
@ -112,14 +112,14 @@ namespace osu.Game.Rulesets.Taiko.UI
Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Size = new Vector2(centre_size)
Size = new Vector2(centreSize)
},
centreHit = new Sprite
{
Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Size = new Vector2(centre_size),
Size = new Vector2(centreSize),
Alpha = 0,
Blending = BlendingParameters.Additive
}

View File

@ -123,7 +123,7 @@ namespace osu.Game.Rulesets.Taiko.UI
Children = new Drawable[]
{
new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundLeft), _ => new PlayfieldBackgroundLeft()),
new InputDrum()
new InputDrum
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,