private void UpdateStream() { int start = m_slider.StartTime; double length = m_slider.SpatialLength; double beatsnap = (double)GetBeatSnap(); double spacing; int count; if (radCount.Checked) { count = (int)(numericCount.Value); spacing = length / (double)Math.Max(1, count - 1); } else { spacing = m_slider.Velocity * AudioEngine.BeatLengthAt(start, false) * (double)(numericDistanceSnap.Value) / (beatsnap * 1000); count = (int)((length + 1.0d) / spacing) + 1; } if (spacing == lastSpacing || count == 0) { return; } double progress = 0.0d; double increment = AudioEngine.BeatLengthAt(start, false) / beatsnap; double time = start; editor.changeManager.AllowFinish = false; editor.Compose.DeleteSelection(); editor.FinishOnBreakUpdate = false; editor.changeManager.AllowFinish = true; editor.changeManager.PushAction(ChangeType.HitObject, ActionType.Add); bool replace = true; for (int x = 0; x < count; x++) { Vector2 position = m_slider.positionAtLength((float)progress); HitCircleOsu h = new HitCircleOsu(editor.hitObjectManager, position, (int)time, x == 0 && m_slider.NewCombo, false, false, false, 0); editor.hitObjectManager.Add(h, true); editor.Compose.Select(h); editor.changeManager.BackupData(h, replace); replace = false; time += increment; progress += spacing; } editor.hitObjectManager.Sort(true); editor.BreakDirty = true; }
/// <summary> /// /// </summary> /// <param name="line">[00111:00000100]</param> private void parseDataField(string[] arr) { int[] key = line2key(arr[0]); // 001 00 List <string> val = line2arr(arr[1]); // 00 01 AW 00 switch (key[1]) { case 1: //BGM if (IgnoreEffect) { return; } for (int i = 0; i < val.Count; i++) { if (val[i] == "00") { continue; } string fn; if (wavDict.TryGetValue(val[i], out fn)) { EventSample e = new EventSample(-1, fn, (int)getTime(key[0], 1.0 * i / val.Count), StoryLayer.Background, 70); e.WriteToOsu = true; eventManager.Add(e); effectDict[fn] = true; } } break; case 11: case 12: case 13: case 14: case 15: case 16: case 18: case 19: { for (int i = 0; i < val.Count; i++) { if (val[i] == "00") { continue; } int col = key[1] == 16 ? 0 : (key[1] < 16 ? key[1] - 10 : key[1] - 12); if (IgnoreSpecial) { col--; } if (longType == 2 && val[i] == longObj && pendingNotes[col] != null) { pendingNotes[col].EndTime = (int)getTime(key[0], 1.0 * i / val.Count); pendingNotes[col].Type = HitObjectType.Hold; pendingNotes[col] = null; continue; } HitCircleOsu h = new HitCircleOsu(hitObjectManager, new Vector2(hitObjectManager.ManiaStage.Columns[col].SnapPositionX, 192), (int)getTime(key[0], 1.0 * i / val.Count), false); string wav = ""; if (wavDict.TryGetValue(val[i], out wav) && !IgnoreSample) { noteDict[wav] = true; h.SampleFile = wav; } else { h.SampleVolume = 1; //mute sample volume if file doesn't exist in meta } hitObjectManager.Add(h, true); if (longType == 2) { pendingNotes[col] = h; } } } break; case 51: case 52: case 53: case 54: case 55: case 56: case 58: case 59: { if (longType != 1) { break; } for (int i = 0; i < val.Count; i++) { if (val[i] == "00") { continue; } int col = key[1] == 56 ? 0 : (key[1] < 56 ? key[1] - 50 : key[1] - 52); if (IgnoreSpecial) { col--; } if (pendingNotes[col] != null) { pendingNotes[col].EndTime = (int)getTime(key[0], 1.0 * i / val.Count); pendingNotes[col] = null; continue; } else { HitCircleHold h = new HitCircleHold(hitObjectManager, new Vector2(hitObjectManager.ManiaStage.Columns[col].SnapPositionX, 192), (int)getTime(key[0], 1.0 * i / val.Count), false, false, false, false, 0); string wav = ""; if (wavDict.TryGetValue(val[i], out wav) && !IgnoreSample) { noteDict[wav] = true; h.SampleFile = wav; } else { h.SampleVolume = 1; } hitObjectManager.Add(h, true); pendingNotes[col] = h; } } } break; } }