mirror of
https://github.com/ppy/osu.git
synced 2024-09-21 16:07:24 +08:00
Fix various code inspection issues
This commit is contained in:
parent
624bb43eaf
commit
f3d4cd3f95
@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
protected DrawableTaikoRuleset DrawableRuleset { get; private set; }
|
protected DrawableTaikoRuleset DrawableRuleset { get; private set; }
|
||||||
protected Container PlayfieldContainer { get; private set; }
|
protected Container PlayfieldContainer { get; private set; }
|
||||||
|
|
||||||
protected ControlPointInfo controlPointInfo { get; private set; }
|
private ControlPointInfo controlPointInfo { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
|
@ -28,7 +28,8 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
{
|
{
|
||||||
List<TaikoHitObject> hitObjects = new List<TaikoHitObject>();
|
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
|
hitObjects.Add(new Hit
|
||||||
{
|
{
|
||||||
StartTime = Time.Current + i * HIT_OBJECT_TIME_SPACING_MS,
|
StartTime = Time.Current + i * HIT_OBJECT_TIME_SPACING_MS,
|
||||||
@ -46,7 +47,8 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
return beatmap;
|
return beatmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool isOdd(int number) {
|
private bool isOdd(int number)
|
||||||
|
{
|
||||||
return number % 2 == 0;
|
return number % 2 == 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,10 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
{
|
{
|
||||||
internal class DrumSamplePlayer : Container, IKeyBindingHandler<TaikoAction>
|
internal class DrumSamplePlayer : Container, IKeyBindingHandler<TaikoAction>
|
||||||
{
|
{
|
||||||
private DrumSampleTriggerSource leftRimSampleTriggerSource;
|
private readonly DrumSampleTriggerSource leftRimSampleTriggerSource;
|
||||||
private DrumSampleTriggerSource leftCentreSampleTriggerSource;
|
private readonly DrumSampleTriggerSource leftCentreSampleTriggerSource;
|
||||||
private DrumSampleTriggerSource rightCentreSampleTriggerSource;
|
private readonly DrumSampleTriggerSource rightCentreSampleTriggerSource;
|
||||||
private DrumSampleTriggerSource rightRimSampleTriggerSource;
|
private readonly DrumSampleTriggerSource rightRimSampleTriggerSource;
|
||||||
|
|
||||||
public DrumSamplePlayer(HitObjectContainer hitObjectContainer)
|
public DrumSamplePlayer(HitObjectContainer hitObjectContainer)
|
||||||
{
|
{
|
||||||
@ -35,12 +35,15 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
case TaikoAction.LeftRim:
|
case TaikoAction.LeftRim:
|
||||||
leftRimSampleTriggerSource.Play(HitType.Rim);
|
leftRimSampleTriggerSource.Play(HitType.Rim);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TaikoAction.LeftCentre:
|
case TaikoAction.LeftCentre:
|
||||||
leftCentreSampleTriggerSource.Play(HitType.Centre);
|
leftCentreSampleTriggerSource.Play(HitType.Centre);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TaikoAction.RightCentre:
|
case TaikoAction.RightCentre:
|
||||||
rightCentreSampleTriggerSource.Play(HitType.Centre);
|
rightCentreSampleTriggerSource.Play(HitType.Centre);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TaikoAction.RightRim:
|
case TaikoAction.RightRim:
|
||||||
rightRimSampleTriggerSource.Play(HitType.Rim);
|
rightRimSampleTriggerSource.Play(HitType.Rim);
|
||||||
break;
|
break;
|
||||||
|
@ -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)
|
// 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 const float offscreen_percent = 0.35f;
|
||||||
private InputDrum touchInputDrum;
|
|
||||||
private Circle drumBackground;
|
private readonly InputDrum touchInputDrum;
|
||||||
|
private readonly Circle drumBackground;
|
||||||
|
|
||||||
private KeyBindingContainer<TaikoAction> keyBindingContainer;
|
private KeyBindingContainer<TaikoAction> keyBindingContainer;
|
||||||
|
|
||||||
@ -33,9 +34,9 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
private TaikoAction mouseAction;
|
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
|
// 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()
|
public DrumTouchInputArea()
|
||||||
{
|
{
|
||||||
@ -43,7 +44,8 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
RelativePositionAxes = Axes.Both;
|
RelativePositionAxes = Axes.Both;
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
visibleComponents = new Container() {
|
visibleComponents = new Container
|
||||||
|
{
|
||||||
Alpha = 0.0f,
|
Alpha = 0.0f,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
RelativePositionAxes = Axes.Both,
|
RelativePositionAxes = Axes.Both,
|
||||||
@ -51,7 +53,8 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
drumBackground = new Circle() {
|
drumBackground = new Circle
|
||||||
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
RelativePositionAxes = Axes.Both,
|
RelativePositionAxes = Axes.Both,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
@ -59,7 +62,8 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
FillMode = FillMode.Fit,
|
FillMode = FillMode.Fit,
|
||||||
Alpha = 0.9f,
|
Alpha = 0.9f,
|
||||||
},
|
},
|
||||||
touchInputDrum = new InputDrum() {
|
touchInputDrum = new InputDrum
|
||||||
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
},
|
},
|
||||||
@ -135,9 +139,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
bool centreHit = inputIsCenterHit(inputPosition);
|
bool centreHit = inputIsCenterHit(inputPosition);
|
||||||
bool leftSide = inputIsOnLeftSide(inputPosition);
|
bool leftSide = inputIsOnLeftSide(inputPosition);
|
||||||
|
|
||||||
return centreHit ?
|
return centreHit ? (leftSide ? TaikoAction.LeftCentre : TaikoAction.RightCentre) : (leftSide ? TaikoAction.LeftRim : TaikoAction.RightRim);
|
||||||
(leftSide ? TaikoAction.LeftCentre : TaikoAction.RightCentre) :
|
|
||||||
(leftSide ? TaikoAction.LeftRim : TaikoAction.RightRim);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool inputIsOnLeftSide(Vector2 inputPosition)
|
private bool inputIsOnLeftSide(Vector2 inputPosition)
|
||||||
|
@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
private readonly Sprite centre;
|
private readonly Sprite centre;
|
||||||
private readonly Sprite centreHit;
|
private readonly Sprite centreHit;
|
||||||
|
|
||||||
public TaikoHalfDrum(bool flipped, float centre_size)
|
public TaikoHalfDrum(bool flipped, float centreSize)
|
||||||
{
|
{
|
||||||
Masking = true;
|
Masking = true;
|
||||||
|
|
||||||
@ -112,14 +112,14 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight,
|
Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Size = new Vector2(centre_size)
|
Size = new Vector2(centreSize)
|
||||||
},
|
},
|
||||||
centreHit = new Sprite
|
centreHit = new Sprite
|
||||||
{
|
{
|
||||||
Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight,
|
Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Size = new Vector2(centre_size),
|
Size = new Vector2(centreSize),
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Blending = BlendingParameters.Additive
|
Blending = BlendingParameters.Additive
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundLeft), _ => new PlayfieldBackgroundLeft()),
|
new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundLeft), _ => new PlayfieldBackgroundLeft()),
|
||||||
new InputDrum()
|
new InputDrum
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
|
Loading…
Reference in New Issue
Block a user