Exemplo n.º 1
0
    public void OnDrop(PointerEventData eventData)
    {
        if (storedTemplateObject == null && DragHandler.template != null)
        {
            //disable input on the template that was just dragged into this slot
            MatrixInputTemplate draggedTemplate = DragHandler.template.GetComponent <MatrixInputTemplate>();

            draggedTemplate.SetAcceptingInput(false);

            DragHandler.template.transform.SetParent(transform);

            matrixInputManager.WorkspaceChanged();
        }
    }
Exemplo n.º 2
0
    public void OnDrop(PointerEventData eventData)
    {
        if (acceptingInput && storedTemplateObject == null && DragHandler.template != null)
        {
            //find the template that is currently being dragged
            MatrixInputTemplate draggedTemplate = DragHandler.template.GetComponent <MatrixInputTemplate>();

            draggedTemplate.SetAcceptingInput(true);

            DragHandler.template.transform.SetParent(transform);

            matrixInputManager.WorkspaceChanged();
        }
    }
Exemplo n.º 3
0
    private void SendToBackend()
    {
        List <Matrix2x2> inputMatrices = new List <Matrix2x2>();

        int accumulatedBlankSpots = 0;

        for (int i = 0; i < inputSpots.Length; i++)
        {
            TemplateInputSpot templateInputSpot = inputSpots[i];

            GameObject storedTemplateObject = templateInputSpot.storedTemplateObject;

            //check if slot is has a stored slot
            if (storedTemplateObject == null)
            {
                accumulatedBlankSpots++;
                continue;
            }

            MatrixInputTemplate workingTemplate = storedTemplateObject.GetComponent <MatrixInputTemplate>();

            if (workingTemplate == null)
            {
                Debug.Log("Can't find MatrixInputTemplate component on templateInputObject stored in a slot.");
            }

            if (accumulatedBlankSpots > 0)
            {
                for (int k = 0; k < accumulatedBlankSpots; k++)
                {
                    inputMatrices.Add(Matrix2x2.IdentityMatrix);
                }
                accumulatedBlankSpots = 0;
            }

            float[] inputValues = workingTemplate.GetValues();
            Debug.Log(inputValues);

            Matrix2x2 newMatrix = new Matrix2x2(inputValues[0], inputValues[1], inputValues[2], inputValues[3]);
            Debug.Log(newMatrix);

            inputMatrices.Add(newMatrix);
        }

        renderManager.SetMatrices(inputMatrices.ToArray());
        mathView.SetMatrices(inputMatrices.ToArray());
    }