Пример #1
0
    public void RunNewBoardMenu()
    {
        // caching system makes sure a new board is only generated on frames where it matters
        if (PreviousSizeX != SizeX || CachedSizeY != SizeY)
        {
            BoardFunctions.CreateNewBoard(SizeX, SizeY);
        }
        PreviousSizeX = SizeX;
        CachedSizeY   = SizeY;

        // create the menu if space or enter or V are pressed
        if (Input.GetButtonDown("Jump") || Input.GetButtonDown("Submit") || Input.GetButtonDown("BoardMenu") || Input.GetButtonDown("Confirm")) // the last check is so you can place the same new board by double tapping v
        {
            Done();
        }

        // cancel if esc is pressed
        if (Input.GetButtonDown("Cancel"))
        {
            Done(true);
        }

        // tab between input fields
        if (Input.GetButtonDown("tab"))
        {
            if (SizeXInput.isFocused)
            {
                SizeYInput.ActivateInputField();
            }
            else
            {
                SizeXInput.ActivateInputField();
            }
        }

        if (GameplayUIManager.ScrollUp(false))
        {
            if (Input.GetButton("Mod"))
            {
                SizeXSlider.value += 1;
            }
            else
            {
                SizeYSlider.value += 1;
            }
        }

        if (GameplayUIManager.ScrollDown(false))
        {
            if (Input.GetButton("Mod"))
            {
                SizeXSlider.value -= 1;
            }
            else
            {
                SizeYSlider.value -= 1;
            }
        }

        // lets you rotate in the new board menu
        StuffPlacer.PollRotationInput();
        BoardPlacer.PollForBoardRotation();
        BoardPlacer.PollForBoardFlatness();

        RaycastHit hit;

        if (Physics.Raycast(FirstPersonInteraction.Ray(), out hit, Settings.ReachDistance))
        {
            StuffPlacer.MoveThingBeingPlaced(hit, false, true);
        }
    }