mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:07:52 +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)
|
||||
{
|
||||
base.LoadSamples(changed);
|
||||
|
||||
if (changed)
|
||||
type.Value = rimSamples.Any() ? HitType.Rim : HitType.Centre;
|
||||
type.Value = getRimSamples().Any() ? HitType.Rim : HitType.Centre;
|
||||
}
|
||||
|
||||
private void updateSamplesFromTypeChange()
|
||||
{
|
||||
var samples = rimSamples;
|
||||
var rimSamples = getRimSamples();
|
||||
|
||||
bool isRimType = HitObject.Type == HitType.Rim;
|
||||
|
||||
if (isRimType != samples.Any())
|
||||
if (isRimType != rimSamples.Any())
|
||||
{
|
||||
if (isRimType)
|
||||
HitObject.Samples.Add(new HitSampleInfo { Name = HitSampleInfo.HIT_CLAP });
|
||||
else
|
||||
{
|
||||
foreach (var sample in samples)
|
||||
foreach (var sample in rimSamples)
|
||||
HitObject.Samples.Remove(sample);
|
||||
}
|
||||
}
|
||||
|
@ -152,27 +152,27 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
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)
|
||||
{
|
||||
base.LoadSamples(changed);
|
||||
|
||||
if (changed)
|
||||
isStrong.Value = strongSamples.Any();
|
||||
isStrong.Value = getStrongSamples().Any();
|
||||
}
|
||||
|
||||
private void updateSamplesFromStrong()
|
||||
{
|
||||
var samples = strongSamples;
|
||||
var strongSamples = getStrongSamples();
|
||||
|
||||
if (isStrong.Value != samples.Any())
|
||||
if (isStrong.Value != strongSamples.Any())
|
||||
{
|
||||
if (isStrong.Value)
|
||||
HitObject.Samples.Add(new HitSampleInfo { Name = HitSampleInfo.HIT_FINISH });
|
||||
else
|
||||
{
|
||||
foreach (var sample in samples)
|
||||
foreach (var sample in strongSamples)
|
||||
HitObject.Samples.Remove(sample);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user