Exemplo n.º 1
0
 public void RemovePanelNoteFromList(PanelNote note)
 {
     if (panelNotes.Contains(note))
     {
         panelNotes.Remove(note);
     }
 }
Exemplo n.º 2
0
 public void OnEndDrag(PointerEventData eventData)
 {
     if (draggedNote != null)
     {
         draggedNote.OnEndDrag(eventData);
         draggedNote.FocusTextInput();
         draggedNote = null;
     }
 }
Exemplo n.º 3
0
    public PanelNote CreatePanelNote()
    {
        PanelNote newNote = Instantiate(panelNotePrefab, panelNoteParentRect).GetComponentInChildren <PanelNote>();

        newNote.onUserChangedData += OnUserChangedPanelNotes;
        newNote.SetParentRect(panelNoteParentRect);
        panelNotes.Add(newNote);
        return(newNote);
    }
Exemplo n.º 4
0
 public void OnPointerUp(PointerEventData eventData)
 {
     if (clickOnPointerUp)
     {
         clickOnPointerUp = false;
         PanelNote newNote = cardManager.CreatePanelNote();
         AutoPlaceNote(newNote);
         newNote.FocusTextInput();
     }
 }
Exemplo n.º 5
0
    private void AutoPlaceNote(PanelNote newNote)
    {
        //get screenpoint of default rect
        Vector3[] referenceCorners = new Vector3[4];
        defaultSpawnPoint.GetWorldCorners(referenceCorners);
        Vector2 referenceScreenCornerMin = RectTransformUtility.WorldToScreenPoint(null, referenceCorners[0]);

        //convert screen to relevant rect's space
        Vector2 localPos;

        RectTransformUtility.ScreenPointToLocalPointInRectangle(panelNoteParentRect, referenceScreenCornerMin, null, out localPos);
        newNote.rectTransform.anchoredPosition = localPos;
    }
Exemplo n.º 6
0
    public void OnBeginDrag(PointerEventData eventData)
    {
        clickOnPointerUp = false;
        draggedNote      = cardManager.CreatePanelNote();

        //place note under cursor
        Vector2 localPos;

        RectTransformUtility.ScreenPointToLocalPointInRectangle(panelNoteParentRect, Input.mousePosition, null, out localPos);
        draggedNote.rectTransform.anchoredPosition = localPos;

        //have to spoof the drage events for this first drag
        draggedNote.OnBeginDrag(eventData);
    }
Exemplo n.º 7
0
    private void CreatePanelNote(PanelNote.Data note)
    {
        PanelNote newNote = CreatePanelNote();

        newNote.SetData(note);
    }