private static void PollForOffsetInput() { if (GameplayUIManager.ScrollUp()) // scroll up { if (Input.GetButton("Mod")) { PlacingOffset.y++; } else { PlacingOffset.x++; } } if (GameplayUIManager.ScrollDown()) { if (Input.GetButton("Mod")) { PlacingOffset.y--; } else { PlacingOffset.x--; } } if (Input.GetButtonDown("ResetBoardOffset")) // middle click { PlacingOffset = Vector2Int.zero; } CapPlacingOffset(); }
public void RunNoisemakerMenu() { if (SelectedThingJustChanged) { SetNote(SelectedThing); } // when scrolling past the end of the notes, change the octave if appropriate if (GameplayUIManager.ScrollUp() && SelectedThing == 0) { OctavesSlider.value--; // will automatically prevent us from going below the min } if (GameplayUIManager.ScrollDown() && SelectedThing == 11) { OctavesSlider.value++; } if (Input.GetButton("Mod")) { if (GameplayUIManager.ScrollDown()) { OctavesSlider.value--; } if (GameplayUIManager.ScrollUp()) { OctavesSlider.value++; } } else { ScrollThroughMenu(); } // hotkeys if (Input.GetButtonDown("Jump") || Input.GetButtonDown("Submit") || Input.GetButtonDown("Confirm")) { Done(); } if (Input.GetButtonDown("Cancel")) { // revert, and close the menu without setting a new FrequencyForNewNoisemakers Revert(); Canvas.enabled = false; GameplayUIManager.UIState = UIState.None; } PollForKeyCodes(); }
public bool SelectedThingJustChanged; // used for when action is needed when the player scrolls (i.e. opening a menu). True during a single frame when UpdateSelectedThing has been run // TODO change to an abstract void now that I know what those are :P public void ScrollThroughMenu() { SelectedThingJustChanged = false; // move selected thing if (GameplayUIManager.ScrollUp()) { if (SelectedThing > 0) { SelectedThing--; // go to the previous thing } else { SelectedThing = MaxSelectedThing; // allows the scrolling to loop } UpdateSelectedThing(); } if (GameplayUIManager.ScrollDown()) { if (SelectedThing < MaxSelectedThing) { SelectedThing++; // go to the next thing } else { SelectedThing = 0; // allows the scrolling to loop } UpdateSelectedThing(); } // number key selection int selectkey = GameplayUIManager.NumberKey(); if (selectkey != -1 && selectkey <= MaxSelectedThing) { SelectedThing = selectkey; UpdateSelectedThing(); } }
public void RunStackBoardMenu() { if (Input.GetButtonDown("Cancel") || Input.GetButtonDown("Delete")) { Done(); } if (Input.GetButtonDown("Confirm") || Input.GetButtonDown("BoardMenu") || Input.GetButtonDown("Place")) { Place(); } if (GameplayUIManager.ScrollUp(false)) { IterationsSlider.value++; } if (GameplayUIManager.ScrollDown(false)) { IterationsSlider.value--; } PollForStackingDirectionInput(); }
public void RunTextMenu() { if (GameplayUIManager.ScrollDown()) { if (SizeSlider.value > 1) { SizeSlider.value--; } } if (GameplayUIManager.ScrollUp()) { if (SizeSlider.value < SizeSlider.maxValue) { SizeSlider.value++; } } if (Input.GetButtonDown("Cancel")) { Done(); } }
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); } }