/// <summary>
        /// Removes a hit sample from all selected <see cref="HitObject"/>s.
        /// </summary>
        /// <param name="sampleName">The name of the hit sample.</param>
        public void RemoveHitSample(string sampleName)
        {
            EditorBeatmap.BeginChange();

            foreach (var h in EditorBeatmap.SelectedHitObjects)
            {
                h.SamplesBindable.RemoveAll(s => s.Name == sampleName);
            }

            EditorBeatmap.EndChange();
        }
Beispiel #2
0
        public void SetRimState(bool state)
        {
            var hits = EditorBeatmap.SelectedHitObjects.OfType <Hit>();

            EditorBeatmap.BeginChange();

            foreach (var h in hits)
            {
                h.Type = state ? HitType.Rim : HitType.Centre;
            }

            EditorBeatmap.EndChange();
        }
Beispiel #3
0
        public void SetStrongState(bool state)
        {
            var hits = EditorBeatmap.SelectedHitObjects.OfType <Hit>();

            EditorBeatmap.BeginChange();

            foreach (var h in hits)
            {
                if (h.IsStrong != state)
                {
                    h.IsStrong = state;
                    EditorBeatmap.Update(h);
                }
            }

            EditorBeatmap.EndChange();
        }
Beispiel #4
0
        /// <summary>
        /// Adds a hit sample to all selected <see cref="HitObject"/>s.
        /// </summary>
        /// <param name="sampleName">The name of the hit sample.</param>
        public void AddHitSample(string sampleName)
        {
            EditorBeatmap.BeginChange();

            foreach (var h in EditorBeatmap.SelectedHitObjects)
            {
                // Make sure there isn't already an existing sample
                if (h.Samples.Any(s => s.Name == sampleName))
                {
                    continue;
                }

                h.Samples.Add(new HitSampleInfo(sampleName));
            }

            EditorBeatmap.EndChange();
        }
Beispiel #5
0
        /// <summary>
        /// Set the new combo state of all selected <see cref="HitObject"/>s.
        /// </summary>
        /// <param name="state">Whether to set or unset.</param>
        /// <exception cref="InvalidOperationException">Throws if any selected object doesn't implement <see cref="IHasComboInformation"/></exception>
        public void SetNewCombo(bool state)
        {
            EditorBeatmap.BeginChange();

            foreach (var h in EditorBeatmap.SelectedHitObjects)
            {
                if (!(h is IHasComboInformation comboInfo) || comboInfo.NewCombo == state)
                {
                    continue;
                }

                comboInfo.NewCombo = state;
                EditorBeatmap.Update(h);
            }

            EditorBeatmap.EndChange();
        }
Beispiel #6
0
        public void TestSnappedSeekingAfterControlPointChange()
        {
            AddStep("seek to 0", () => EditorClock.Seek(0));
            AddAssert("time is 0", () => EditorClock.CurrentTime == 0);

            pressAndCheckTime(Key.Right, 1000);
            pressAndCheckTime(Key.Right, 2000);
            pressAndCheckTime(Key.Right, 2500);
            pressAndCheckTime(Key.Right, 3000);

            AddStep("remove 2nd timing point", () =>
            {
                EditorBeatmap.BeginChange();
                var group = EditorBeatmap.ControlPointInfo.GroupAt(2000);
                EditorBeatmap.ControlPointInfo.RemoveGroup(group);
                EditorBeatmap.EndChange();
            });

            pressAndCheckTime(Key.Left, 2000);
            pressAndCheckTime(Key.Left, 1000);

            pressAndCheckTime(Key.Right, 2000);
            pressAndCheckTime(Key.Right, 3000);
        }
Beispiel #7
0
        protected override void PerformPaste()
        {
            base.PerformPaste();

            var objects = clipboard.Value.Deserialize <ClipboardContent>().HitObjects;

            Debug.Assert(objects.Any());

            double timeOffset = clock.CurrentTime - objects.Min(o => o.StartTime);

            foreach (var h in objects)
            {
                h.StartTime += timeOffset;
            }

            EditorBeatmap.BeginChange();

            EditorBeatmap.SelectedHitObjects.Clear();

            EditorBeatmap.AddRange(objects);
            EditorBeatmap.SelectedHitObjects.AddRange(objects);

            EditorBeatmap.EndChange();
        }