Exemplo n.º 1
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.PerformOnSelection(h =>
            {
                // Make sure there isn't already an existing sample
                if (h.Samples.Any(s => s.Name == sampleName))
                {
                    return;
                }

                h.Samples.Add(new HitSampleInfo(sampleName));
            });
        }
Exemplo n.º 2
0
            /// <summary>
            /// Nudge the current selection by the specified multiple of beat divisor lengths,
            /// based on the timing at the first object in the selection.
            /// </summary>
            /// <param name="amount">The direction and count of beat divisor lengths to adjust.</param>
            private void nudgeSelection(int amount)
            {
                var selected = EditorBeatmap.SelectedHitObjects;

                if (selected.Count == 0)
                {
                    return;
                }

                var    timingPoint = EditorBeatmap.ControlPointInfo.TimingPointAt(selected.First().StartTime);
                double adjustment  = timingPoint.BeatLength / EditorBeatmap.BeatDivisor * amount;

                EditorBeatmap.PerformOnSelection(h => h.StartTime += adjustment);
            }
Exemplo n.º 3
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.PerformOnSelection(h =>
            {
                var comboInfo = h as IHasComboInformation;

                if (comboInfo == null || comboInfo.NewCombo == state)
                {
                    return;
                }

                comboInfo.NewCombo = state;
                EditorBeatmap.Update(h);
            });
        }
Exemplo n.º 4
0
        private void performColumnMovement(int lastColumn, MoveSelectionEvent <HitObject> moveEvent)
        {
            var maniaPlayfield = ((ManiaHitObjectComposer)composer).Playfield;

            var currentColumn = maniaPlayfield.GetColumnByPosition(moveEvent.Blueprint.ScreenSpaceSelectionPoint + moveEvent.ScreenSpaceDelta);

            if (currentColumn == null)
            {
                return;
            }

            int columnDelta = currentColumn.Index - lastColumn;

            if (columnDelta == 0)
            {
                return;
            }

            int minColumn = int.MaxValue;
            int maxColumn = int.MinValue;

            // find min/max in an initial pass before actually performing the movement.
            foreach (var obj in EditorBeatmap.SelectedHitObjects.OfType <ManiaHitObject>())
            {
                if (obj.Column < minColumn)
                {
                    minColumn = obj.Column;
                }
                if (obj.Column > maxColumn)
                {
                    maxColumn = obj.Column;
                }
            }

            columnDelta = Math.Clamp(columnDelta, -minColumn, maniaPlayfield.TotalColumns - 1 - maxColumn);

            EditorBeatmap.PerformOnSelection(h =>
            {
                maniaPlayfield.Remove(h);
                ((ManiaHitObject)h).Column += columnDelta;
                maniaPlayfield.Add(h);
            });
        }
Exemplo n.º 5
0
 /// <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.PerformOnSelection(h => h.SamplesBindable.RemoveAll(s => s.Name == sampleName));
 }