Exemple #1
0
 private void SelectNote(CreatorNote target)
 {
     if (target.Selected)
     {
         Table.SelectedNote.Remove(target);
     }
     else
     {
         Table.SelectedNote.Add(target);
     }
     target.ChangeSelected();
 }
Exemple #2
0
 private void Update()
 {
     if (Input.touchSupported && Input.touchCount > 0)
     {
         for (int i = 0; i < Input.touchCount; i++)
         {
             if (Input.GetTouch(i).phase.Equals(TouchPhase.Began))
             {
                 TouchTime.Add(Input.GetTouch(i).fingerId, 0);
                 if (ExtendedInputModule.GetPointerEventData(Input.GetTouch(i).fingerId).pointerEnter != null && ExtendedInputModule.GetPointerEventData(Input.GetTouch(i).fingerId).pointerEnter.tag.Equals("CreatorNote") && ExtendedInputModule.GetPointerEventData(Input.GetTouch(i).fingerId).pointerEnter.GetComponent <CreatorNote>().ParentBlock.Equals(this))
                 {
                     CreatorNote note = ExtendedInputModule.GetPointerEventData(Input.GetTouch(i).fingerId).pointerEnter.GetComponent <CreatorNote>();
                     if (Table.NotePlaceMode.Equals(3) && !note.Flick.Equals(0) && (Table.LastFlickNote.ParentBlock.Index < Index || (Table.LastFlickNote.ParentBlock.Index.Equals(Index) && Table.LastFlickNote.YPos < note.YPos)))
                     {
                         CreateTail(Table.LastFlickNote.gameObject, note.gameObject, 30);
                         Table.LastFlickNote.NextNote = note;
                         note.PreviousNotes.Add(Table.LastFlickNote);
                         Table.PlaceModeChanged(0);
                     }
                     else
                     {
                         SelectNote(ExtendedInputModule.GetPointerEventData(Input.GetTouch(i).fingerId).pointerEnter.GetComponent <CreatorNote>());
                     }
                     TouchTime[Input.GetTouch(i).fingerId] += Time.deltaTime;
                 }
                 else if (ExtendedInputModule.GetPointerEventData(Input.GetTouch(i).fingerId).pointerEnter.Equals(gameObject))
                 {
                     if (Table.SelectedNote.Count.Equals(0))
                     {
                         CreateNote(Input.GetTouch(i).position);
                     }
                     else
                     {
                         while (Table.SelectedNote.Count > 0)
                         {
                             CreatorNote target = Table.SelectedNote[0];
                             target.ChangeSelected();
                             Table.SelectedNote.Remove(target);
                         }
                     }
                 }
             }
             else if (Input.GetTouch(i).phase.Equals(TouchPhase.Stationary))
             {
                 if (ExtendedInputModule.GetPointerEventData(Input.GetTouch(i).fingerId).pointerEnter != null && ExtendedInputModule.GetPointerEventData(Input.GetTouch(i).fingerId).pointerEnter.tag.Equals("CreatorNote") && ExtendedInputModule.GetPointerEventData(Input.GetTouch(i).fingerId).pointerEnter.GetComponent <CreatorNote>().ParentBlock.Equals(this))
                 {
                     if (TouchTime[Input.GetTouch(i).fingerId] >= 0.4f)
                     {
                         DeleteNote(ExtendedInputModule.GetPointerEventData(Input.GetTouch(i).fingerId).pointerEnter);
                     }
                     else
                     {
                         TouchTime[Input.GetTouch(i).fingerId] += Time.deltaTime;
                     }
                 }
             }
             else if (Input.GetTouch(i).phase.Equals(TouchPhase.Ended))
             {
                 TouchTime.Remove(Input.GetTouch(i).fingerId);
             }
         }
     }
     else if (Input.GetMouseButtonDown(0))
     {
         if (ExtendedInputModule.GetPointerEventData().pointerEnter != null && ExtendedInputModule.GetPointerEventData().pointerEnter.tag.Equals("CreatorNote") && ExtendedInputModule.GetPointerEventData().pointerEnter.GetComponent <CreatorNote>().ParentBlock.Equals(this))
         {
             if (inputCount.Equals(0))
             {
                 DeleteNote(ExtendedInputModule.GetPointerEventData().pointerEnter);
             }
         }
         else if (ExtendedInputModule.GetPointerEventData().pointerEnter.Equals(gameObject))
         {
             if (inputCount.Equals(0))
             {
                 CreateNote(Input.mousePosition); justAdded = true;
             }
         }
         inputCount += Time.deltaTime;
     }
     else if (Input.GetMouseButtonDown(1))
     {
         if (ExtendedInputModule.GetPointerEventData().pointerEnter != null && ExtendedInputModule.GetPointerEventData().pointerEnter.tag.Equals("CreatorNote") && ExtendedInputModule.GetPointerEventData().pointerEnter.GetComponent <CreatorNote>().ParentBlock.Equals(this))
         {
             CreatorNote note = ExtendedInputModule.GetPointerEventData().pointerEnter.GetComponent <CreatorNote>();
             if (Table.NotePlaceMode.Equals(3) && !note.Flick.Equals(0) && (Table.LastFlickNote.ParentBlock.Index < Index || (Table.LastFlickNote.ParentBlock.Index.Equals(Index) && Table.LastFlickNote.YPos < note.YPos)))
             {
                 CreateTail(Table.LastFlickNote.gameObject, note.gameObject, 30);
                 Table.LastFlickNote.NextNote = note;
                 note.PreviousNotes.Add(Table.LastFlickNote);
                 Table.PlaceModeChanged(0);
             }
             else
             {
                 SelectNote(ExtendedInputModule.GetPointerEventData().pointerEnter.GetComponent <CreatorNote>());
             }
         }
         else if (ExtendedInputModule.GetPointerEventData().pointerEnter.Equals(gameObject))
         {
             while (Table.SelectedNote.Count > 0)
             {
                 CreatorNote target = Table.SelectedNote[0];
                 target.ChangeSelected();
                 Table.SelectedNote.Remove(target);
             }
         }
     }
     else if (Input.GetMouseButtonUp(0))
     {
         if (justAdded)
         {
             justAdded = false;
         }
         inputCount = 0;
     }
 }