mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 02:22:56 +08:00
Change properties to methods and improve naming
This commit is contained in:
parent
00b0228b61
commit
156edf24c2
@ -61,29 +61,29 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private HitSampleInfo[] rimSamples => HitObject.Samples.Where(s => s.Name == HitSampleInfo.HIT_CLAP || s.Name == HitSampleInfo.HIT_WHISTLE).ToArray();
|
private HitSampleInfo[] getRimSamples() => HitObject.Samples.Where(s => s.Name == HitSampleInfo.HIT_CLAP || s.Name == HitSampleInfo.HIT_WHISTLE).ToArray();
|
||||||
|
|
||||||
protected override void LoadSamples(bool changed)
|
protected override void LoadSamples(bool changed)
|
||||||
{
|
{
|
||||||
base.LoadSamples(changed);
|
base.LoadSamples(changed);
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
type.Value = rimSamples.Any() ? HitType.Rim : HitType.Centre;
|
type.Value = getRimSamples().Any() ? HitType.Rim : HitType.Centre;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSamplesFromTypeChange()
|
private void updateSamplesFromTypeChange()
|
||||||
{
|
{
|
||||||
var samples = rimSamples;
|
var rimSamples = getRimSamples();
|
||||||
|
|
||||||
bool isRimType = HitObject.Type == HitType.Rim;
|
bool isRimType = HitObject.Type == HitType.Rim;
|
||||||
|
|
||||||
if (isRimType != samples.Any())
|
if (isRimType != rimSamples.Any())
|
||||||
{
|
{
|
||||||
if (isRimType)
|
if (isRimType)
|
||||||
HitObject.Samples.Add(new HitSampleInfo { Name = HitSampleInfo.HIT_CLAP });
|
HitObject.Samples.Add(new HitSampleInfo { Name = HitSampleInfo.HIT_CLAP });
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (var sample in samples)
|
foreach (var sample in rimSamples)
|
||||||
HitObject.Samples.Remove(sample);
|
HitObject.Samples.Remove(sample);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,27 +152,27 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
RecreatePieces();
|
RecreatePieces();
|
||||||
}
|
}
|
||||||
|
|
||||||
private HitSampleInfo[] strongSamples => HitObject.Samples.Where(s => s.Name == HitSampleInfo.HIT_FINISH).ToArray();
|
private HitSampleInfo[] getStrongSamples() => HitObject.Samples.Where(s => s.Name == HitSampleInfo.HIT_FINISH).ToArray();
|
||||||
|
|
||||||
protected override void LoadSamples(bool changed)
|
protected override void LoadSamples(bool changed)
|
||||||
{
|
{
|
||||||
base.LoadSamples(changed);
|
base.LoadSamples(changed);
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
isStrong.Value = strongSamples.Any();
|
isStrong.Value = getStrongSamples().Any();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSamplesFromStrong()
|
private void updateSamplesFromStrong()
|
||||||
{
|
{
|
||||||
var samples = strongSamples;
|
var strongSamples = getStrongSamples();
|
||||||
|
|
||||||
if (isStrong.Value != samples.Any())
|
if (isStrong.Value != strongSamples.Any())
|
||||||
{
|
{
|
||||||
if (isStrong.Value)
|
if (isStrong.Value)
|
||||||
HitObject.Samples.Add(new HitSampleInfo { Name = HitSampleInfo.HIT_FINISH });
|
HitObject.Samples.Add(new HitSampleInfo { Name = HitSampleInfo.HIT_FINISH });
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (var sample in samples)
|
foreach (var sample in strongSamples)
|
||||||
HitObject.Samples.Remove(sample);
|
HitObject.Samples.Remove(sample);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user