private void ReadHitObjectsCircle(string[] strParameters, ref HitObjectClass hoHitObject) { if (strParameters.Length > 5) { ReadHitObjectsExtra(strParameters[5], ref hoHitObject); } }
private void ReadHitObjectsSpinner(string[] strParameters, ref HitObjectClass hoHitObject) { hoHitObject.IntEndtime = int.Parse(strParameters[5]); if (strParameters.Length > 6) { ReadHitObjectsExtra(strParameters[6], ref hoHitObject); } }
private void ReadHitObjectsExtra(string strExtra, ref HitObjectClass hoHitObject) { string[] strExtraParameter = strExtra.Split(':'); hoHitObject.IntExtraSampleSet = int.Parse(strExtraParameter[0]); hoHitObject.IntExtraAdditionSet = int.Parse(strExtraParameter[1]); hoHitObject.IntExtraCustomIndex = int.Parse(strExtraParameter[2]); hoHitObject.IntExtraSampleVolume = int.Parse(strExtraParameter[3]); switch (strExtraParameter.Length) { case 4: hoHitObject.StrExtraFilename = ""; break; case 5: hoHitObject.StrExtraFilename = strExtraParameter[4]; break; default: hoHitObject.StrExtraFilename = ""; BolErrorFlag = true; break; } }
private void ReadHitObjects(string strHitObjects) { strHitObjects = strHitObjects.Remove(0, strHitObjects.IndexOf('[')); string[] strLines = (strHitObjects.Trim()).Split('\n'); for (int i = 1; i < strLines.Length; i++)//跳过标题行 { string[] strParameters = (strLines[i].Trim()).Split(','); HitObjectClass hoHitObject = new HitObjectClass(); hoHitObject.Vec2Position.x = int.Parse(strParameters[0]); hoHitObject.Vec2Position.y = int.Parse(strParameters[1]); hoHitObject.IntTime = int.Parse(strParameters[2]); hoHitObject.IntUnresolvedType = int.Parse(strParameters[3]); ResolveHitObjectsType(hoHitObject.IntUnresolvedType, out hoHitObject.IntType, out hoHitObject.IntNewCombo, out hoHitObject.IntSkipColor); hoHitObject.IntUnresolvedHitSound = int.Parse(strParameters[4]); ResolveHitObjectsHitSound(hoHitObject.IntUnresolvedHitSound, out hoHitObject.IntHitSoundNormal, out hoHitObject.IntHitSoundWhistle, out hoHitObject.IntHitSoundFinish, out hoHitObject.IntHitSoundClap); switch (hoHitObject.IntType) { case 0: ReadHitObjectsCircle(strParameters, ref hoHitObject); break; case 1: ReadHitObjectsSlider(strParameters, ref hoHitObject); break; case 2: ReadHitObjectsSpinner(strParameters, ref hoHitObject); break; case 3: ReadHitObjectsManiaHoldNote(strParameters, ref hoHitObject); break; } HitObjects.LisHitObjects.Add(hoHitObject); } }
private void ReadHitObjectsManiaHoldNote(string[] strParameters, ref HitObjectClass hoHitObject) { string[] strEndTimeAndExtra = strParameters[5].Split(':'); hoHitObject.IntEndtime = int.Parse(strEndTimeAndExtra[0]); ReadHitObjectsExtra(strEndTimeAndExtra[2], ref hoHitObject); }
private void ReadHitObjectsSlider(string[] strParameters, ref HitObjectClass hoHitObject) { string[] strSliderParameter = strParameters[5].Split('|'); switch (strSliderParameter[0]) { case "L": hoHitObject.IntSliderType = 0; break; case "P": hoHitObject.IntSliderType = 1; break; case "B": hoHitObject.IntSliderType = 2; break; case "C": hoHitObject.IntSliderType = 3; break; default: BolErrorFlag = true; hoHitObject.IntSliderType = 0; break; } for (int i = 1; i < strSliderParameter.Length; i++) { Vector2 vec2Point = new Vector2(); string[] strPosition = strSliderParameter[i].Split(':'); vec2Point.x = int.Parse(strPosition[0]); vec2Point.y = int.Parse(strPosition[1]); hoHitObject.LisSliderPoints.Add(vec2Point); } hoHitObject.IntSliderRepeat = int.Parse(strParameters[6]); hoHitObject.FloSliderPixelLength = float.Parse(strParameters[7]); if (strParameters.Length > 8) { string[] strEdgeHitSoundsParameter = strParameters[8].Split('|'); for (int i = 0; i < strEdgeHitSoundsParameter.Length; i++) { hoHitObject.LisSliderEdgeHitSounds.Add(int.Parse(strEdgeHitSoundsParameter[i])); } } if (strParameters.Length > 9) { string[] strEdgeEdgeAdditionParameter = strParameters[9].Split('|'); for (int i = 0; i < strEdgeEdgeAdditionParameter.Length; i++) { string[] strSampleSetAndAdditionSet = strEdgeEdgeAdditionParameter[i].Split(':'); EdgeAddition eaEdgeAddition = new EdgeAddition(); eaEdgeAddition.IntSampleSet = int.Parse(strSampleSetAndAdditionSet[0]); eaEdgeAddition.IntAdditionSet = int.Parse(strSampleSetAndAdditionSet[1]); hoHitObject.LisSliderEdgeAddition.Add(eaEdgeAddition); } } if (strParameters.Length > 10) { ReadHitObjectsExtra(strParameters[10], ref hoHitObject); } }