Ejemplo n.º 1
0
    void Update()
    {
        if (gridNodes != null)
        {
            // Next Update Cycle, check node
            if (leftMouseClicked)
            {
                foreach (UINode node in gridNodes)
                {
                    if (node.textField.GetComponent <InputField>().isFocused)
                    {
                        focusedNode = node;
                        focusedBox  = focusedNode.textField;
                        focusedBox.GetComponent <InputField>().Select();
                        break;
                    }
                }

                leftMouseClicked = false;
            }

            // Check for key presses

            if (Input.GetKeyDown(KeyCode.LeftShift) || Input.GetKeyDown(KeyCode.RightShift))
            {
                shiftPressed = true;
            }

            if (Input.GetMouseButtonDown(0))
            {
                leftMouseClicked = true;
            }

            // Checks for Tab pressed
            if (Input.GetKeyDown(KeyCode.Tab))
            {
                if (focusedBox == null)
                {
                    focusedNode = gridNodes[0, 0];
                    focusedBox  = focusedNode.textField;
                    focusedBox.GetComponent <InputField>().Select();
                }
                else
                {
                    if (shiftPressed)
                    {
                        focusedNode = focusedNode.GetPreviousNode();
                        focusedBox  = focusedNode.textField;
                        focusedBox.GetComponent <InputField>().Select();
                    }
                    else
                    {
                        focusedNode = focusedNode.GetNextNode();
                        focusedBox  = focusedNode.textField;
                        focusedBox.GetComponent <InputField>().Select();
                    }
                }
            }

            if (Input.GetKeyDown(KeyCode.Return))
            {
                RunSolver();
            }
        } //

        if (Input.GetKeyUp(KeyCode.LeftShift) || Input.GetKeyUp(KeyCode.RightShift))
        {
            shiftPressed = false;
        }

        // Exempt from code, don't put code here
    }