public override void OnDeserialize(BinaryReader stream, StringCacheTable _) { HitSound = (HitObjectSoundType)stream.ReadByte(); SampleSet = (SampleSetType)stream.ReadByte(); SampleSetAdditions = (SampleSetType)stream.ReadByte(); CustomSampleSet = (CustomSampleSetType)stream.ReadInt32(); }
public HitSoundInfo(double Time, HitObjectSoundType SoundType, SampleSetType SampleSet, CustomSampleSetType CustomSampleSet, SampleSetType SampleSetAdditions = SampleSetType.None) { this.SoundType = SoundType; this.SampleSet = SampleSet; this.SampleSetAdditions = SampleSetAdditions; this.CustomSampleSet = CustomSampleSet; this.Time = Time; }
public HitSoundTriggerCondition(string description) { /* MAGIC > < * * HitSound -> HitSound(All)(All)(Whistle|Normal|Clap|Finish)(Default) * HitSoundNormalWhistle -> HitSound(All)(Normal)Whistle(Default) * HitSoundWhistle6 -> HitSound(All)(All)Whistle CustomSampleSet6 * HitSoundSoft -> HitSound(All)Soft(Whistle|Normal|Clap|Finish)(Default) * */ var fix_trim_expr = description.Replace("HitSound", string.Empty); //why I wrote these sh[]t? Parse(Parse(Parse(Parse(fix_trim_expr, ref SampleSet), ref SampleSetAdditions), ref HitSound), ref CustomSampleSet); if (HitSound != HitObjectSoundType.None && fix_trim_expr.StartsWith(SampleSet.ToString()) && !fix_trim_expr.Substring(SampleSet.ToString().Length).Contains(SampleSetAdditions.ToString())) { SampleSetAdditions = SampleSet; SampleSet = SampleSetType.All; } //check. var check_func = ((HitObjectSoundType[])Enum.GetValues(typeof(HitObjectSoundType))) .Where(x => HitSound.HasFlag(x) && (x != HitObjectSoundType.All && x != HitObjectSoundType.None)); var hitsound_count = check_func.Where(x => description.Contains(x.ToString())).Count(); if (HitSound != HitObjectSoundType.All && hitsound_count != 0) { Debug.Assert(HitSound != HitObjectSoundType.None && (String.IsNullOrWhiteSpace(fix_trim_expr) || check_func.All(x => description.Contains(x.ToString()))), "parse HitSoundTriggerCondition::HitSound wrong!"); } Debug.Assert(SampleSet == SampleSetType.All || SampleSet != SampleSetType.None || description.Contains(SampleSet.ToString()), "parse HitSoundTriggerCondition::SampleSet wrong!"); Debug.Assert(SampleSetAdditions == SampleSetType.All || SampleSetAdditions != SampleSetType.None || description.Contains(SampleSetAdditions.ToString()), "parse HitSoundTriggerCondition::SampleSetAdditions wrong!"); Debug.Assert(CustomSampleSet == CustomSampleSetType.Default || description.Contains(CustomSampleSet.ToString()) || description.Contains(((int)CustomSampleSet).ToString()), "parse HitSoundTriggerCondition::CustomSampleSet wrong!"); }