// Used for v0.1
        void CommitHold(SlideCollection col)
        {
            Hold        tempHold  = new Hold(0, 0, 0, Side.NotSet);
            List <Note> tempNotes = new List <Note>();

            for (int i = 0; i < col.Notes.Count; i++)
            {
                var    parsed  = col.Notes[i].Item1;
                double noteSub = 1.0 / parsed.Notes.Count;
                var    j       = col.Notes[i].Item2;
                Side   side    = parsed.NoteClass == 2 ? Side.Left : Side.Right;

                if (i == 0)
                {
                    tempHold = new Hold(4 * (parsed.Measure + j * noteSub), parsed.LaneIndex, parsed.Notes[j].Item2, side);
                }
                else
                {
                    switch (parsed.Notes[j].Item1)
                    {
                    case 1:     // Shouldn't happen because it was already added above
                        throw new Exception("Unexpected start note.");

                    case 2:     // End a hold note with no shuffle
                    case 4:     // Add a midpoint with no shuffle
                        tempNotes.Add(new Note(4 * (parsed.Measure + j * noteSub), parsed.LaneIndex, parsed.Notes[j].Item2, side)
                        {
                            Type = NoteType.Hold
                        });
                        break;

                    case 3:     // End a hold note with a shuffle
                    case 5:     // Add a midpoint with a shuffle
                        tempNotes.Add(new Note(4 * (parsed.Measure + j * noteSub), parsed.LaneIndex, parsed.Notes[j].Item2, side)
                        {
                            Type = NoteType.Shuffle
                        });
                        break;
                    }
                }
            }
            tempNotes.Sort((x, y) => x.BeatLocation.CompareTo(y.BeatLocation));
            foreach (var note in tempNotes)
            {
                tempHold.AddNote(note);
            }

            Holds.Add(tempHold);
        }
 // Used for v1.0
 private void CommitHold(Hold hold)
 {
     Holds.Add(hold);
 }
Esempio n. 3
0
        /// <summary>
        /// get all the current tap gestures
        /// </summary>
        private void GetGestures()
        {
            //go through the taps and get all the new ones
            while (TouchPanel.IsGestureAvailable)
            {
                GestureSample gesture = TouchPanel.ReadGesture();
                switch (gesture.GestureType)
                {
                case GestureType.Tap:
                {
                    var position = ConvertCoordinate(gesture.Position);
                    Clicks.Add(new ClickEventArgs()
                        {
                            Position = position,
                            Button   = MouseButton.Left
                        });
                }
                break;

                case GestureType.DoubleTap:
                {
                    var position = ConvertCoordinate(gesture.Position);
                    Clicks.Add(new ClickEventArgs()
                        {
                            Position    = position,
                            Button      = MouseButton.Left,
                            DoubleClick = true,
                        });
                }
                break;

                case GestureType.Flick:
                {
                    AddFlickEvent(gesture.Delta);
                }
                break;

                case GestureType.Pinch:
                {
                    var position1 = ConvertCoordinate(gesture.Position);
                    var position2 = ConvertCoordinate(gesture.Position2);

                    if (null == Pinch)
                    {
                        Pinch = new PinchManager(position1, position2);
                    }
                    else
                    {
                        Pinch.Update(position1, position2);
                    }
                }
                break;

                case GestureType.PinchComplete:
                {
                    if (null == Pinch)
                    {
                        Pinch = new PinchManager()
                        {
                            Finished = true
                        };
                    }
                    else
                    {
                        Pinch.Finished = true;
                    }
                }
                break;

                case GestureType.Hold:
                {
                    var position = ConvertCoordinate(gesture.Position);
                    Holds.Add(new HoldEventArgs()
                        {
                            Position = position
                        });
                }
                break;
                }
            }
        }