public void OnPointerDown(PointerEventData data)
 {
     if (!MatrixParent.OperationInProgress)
     {
         MatrixParent.StartOperation(this);
     }
 }
    protected override void Start()
    {
        base.Start();

        MatrixParent.OnOperationFinish.AddListener(OnOperationFinish);
        history.Insert(new MatrixHistoryItem(MatrixParent.CurrentMatrix));
        operationUI = MatrixParent.GetComponentInChildren <MatrixOperationUI>(true);

        OnHistoryUpdate();
    }
 public void AttemptRedoPreview()
 {
     if (RedoIsValid && redoButton.IsPointerPresent)
     {
         MatrixParent.SetPreviewMatrix(history.Next.Matrix, history.Next.PreviousOperation);
         MatrixParent.HighlightOperationParticipants(history.Next.PreviousOperation);
         operationUI.ShowText(history.Next.PreviousOperation, "REDO: {0}");
     }
     else
     {
         ClearPreview();
     }
 }
    public bool Redo()
    {
        // Try to redo
        bool success = history.Redo();

        // If redo succeeds then update the matrix
        if (success)
        {
            MatrixParent.CurrentMatrix = history.Current.Matrix;
            MatrixParent.IncreaseMovesMade();
            OnHistoryUpdate();
            AttemptRedoPreview();
        }

        return(success);
    }
 // When the source stops dragging, ask the matrix to confirm operation
 public void OnEndDrag(PointerEventData data)
 {
     // Attempt to confirm the operation
     MatrixParent.FinishOperation();
 }
示例#6
0
 private void OnPointerExit()
 {
     MatrixParent.UnsetOperationDestination();
 }
示例#7
0
 private void OnPointerEnter()
 {
     MatrixParent.SetOperationDestination(this);
 }
 public void ClearPreview()
 {
     MatrixParent.ClearOperationParticipantHighlights();
     MatrixParent.ShowCurrent();
     operationUI.HideText();
 }