Exemple #1
0
        protected override IEnumerable <MenuItem> GetContextMenuItemsForSelection(IEnumerable <SelectionBlueprint> selection)
        {
            if (selection.All(s => s.HitObject is Hit))
            {
                var hits = selection.Select(s => s.HitObject).OfType <Hit>();

                yield return(new TernaryStateMenuItem("Rim", action: state =>
                {
                    foreach (var h in hits)
                    {
                        switch (state)
                        {
                        case TernaryState.True:
                            h.Type = HitType.Rim;
                            break;

                        case TernaryState.False:
                            h.Type = HitType.Centre;
                            break;
                        }
                    }
                })
                {
                    State = { Value = getTernaryState(hits, h => h.Type == HitType.Rim) }
                });
            }

            if (selection.All(s => s.HitObject is TaikoHitObject))
            {
                var hits = selection.Select(s => s.HitObject).OfType <TaikoHitObject>();

                yield return(new TernaryStateMenuItem("Strong", action: state =>
                {
                    foreach (var h in hits)
                    {
                        switch (state)
                        {
                        case TernaryState.True:
                            h.IsStrong = true;
                            break;

                        case TernaryState.False:
                            h.IsStrong = false;
                            break;
                        }

                        EditorBeatmap?.UpdateHitObject(h);
                    }
                })
                {
                    State = { Value = getTernaryState(hits, h => h.IsStrong) }
                });
            }
        }
Exemple #2
0
        public override bool HandleMovement(MoveSelectionEvent moveEvent)
        {
            foreach (var h in SelectedHitObjects.OfType <TauHitObject>())
            {
                if (h is HardBeat)
                {
                    continue;
                }

                h.Angle = ScreenSpaceDrawQuad.Centre.GetDegreesFromPosition(moveEvent.ScreenSpacePosition);

                EditorBeatmap?.UpdateHitObject(h);
            }

            return(true);
        }
        public void SetStrongState(bool state)
        {
            var hits = SelectedHitObjects.OfType <Hit>();

            ChangeHandler.BeginChange();

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

            ChangeHandler.EndChange();
        }
        /// <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)
        {
            ChangeHandler?.BeginChange();

            foreach (var h in SelectedHitObjects)
            {
                var comboInfo = h as IHasComboInformation;

                if (comboInfo == null)
                {
                    throw new InvalidOperationException($"Tried to change combo state of a {h.GetType()}, which doesn't implement {nameof(IHasComboInformation)}");
                }

                comboInfo.NewCombo = state;
                EditorBeatmap?.UpdateHitObject(h);
            }

            ChangeHandler?.EndChange();
        }
Exemple #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)
        {
            ChangeHandler?.BeginChange();

            foreach (var h in SelectedHitObjects)
            {
                var comboInfo = h as IHasComboInformation;

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

                comboInfo.NewCombo = state;
                EditorBeatmap?.UpdateHitObject(h);
            }

            ChangeHandler?.EndChange();
        }
 private void updatePath()
 {
     HitObject.Path.ExpectedDistance.Value = composer?.GetSnappedDistanceFromDistance(HitObject.StartTime, (float)HitObject.Path.CalculatedDistance) ?? (float)HitObject.Path.CalculatedDistance;
     editorBeatmap?.UpdateHitObject(HitObject);
 }