public bool tempClicked = false; // whether temperature buttons are clicked void Start() { // find gameobject with tag "SelectedStore", which is Menus, and access this component store = GameObject.FindGameObjectWithTag("SelectedStore").GetComponent <MenuSelection>(); // same for "DrinccStorage" storage = GameObject.FindGameObjectWithTag("DrinccStorage").GetComponent <DrinccStorage>(); try { backButton.onClick.AddListener(BackPageClick); // this causes an unknown error (not set to an object), but still works } catch (System.Exception e) { Debug.Log(e.Message); } // same as FlavorSelect.cs, add variable in its own scope for (int i = 0; i < toppings.Length; i++) { int temp = i; toppings[i].onClick.AddListener(delegate { ToppingClick(temp); GameObject.FindGameObjectWithTag("UpdateTrigger").GetComponent <ConfirmUpdate>().update = true; }); } }
void Start() { store = GameObject.FindGameObjectWithTag("SelectedStore").GetComponent <MenuSelection>(); cameraAnimator = GameObject.FindGameObjectWithTag("CameraTrigger").GetComponent <CameraControl>(); adminBack.onClick.AddListener(CloseAdminMenu); }
public BattleMoveWithTarget(MenuSelection selection, IFighter owner) { Move = selection.Move; Target = selection.Target; Owner = owner; MoveExecutor = selection.MoveExecutor; }
public PhillyPoacherCustomization(MenuSelection m, PhillyPoacher p) { InitializeComponent(); poacher = p; menu = m; DataContext = poacher; }
public SailorSodaCustomization(MenuSelection m, SailorSoda s) { InitializeComponent(); soda = s; menu = m; DataContext = soda; }
/// <summary> /// MainMenu /// </summary> public void StartBtn() { MainUI.SetActive(false); StageUI.SetActive(true); selectMenu = MenuSelection.GameStart; SoundManager.instance.SoundPlay(SoundManager.instance.ButtonClick); }
public static string GetEnumDescription(this MenuSelection m) { FieldInfo fi = m.GetType().GetField(m.ToString()); DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false); return(attributes != null && attributes.Length > 0 ? attributes[0].Description : m.ToString()); }
public GardenOrcOmeletteCustomization(MenuSelection m, GardenOrcOmelette o) { InitializeComponent(); omelette = o; menu = m; DataContext = omelette; }
public override BattleMoveWithTarget SetupMove(Team ownTeam, Team enemyTeam) { BattleMoveWithTarget ret; BattleMove move = BeforeSelectMove(); if (move == null) { HumanControlledEnemyMenu menu = new HumanControlledEnemyMenu(_input, _output, _menuFactory); menu.Build(this, ownTeam, enemyTeam, null); MenuSelection menuSelection = menu.GetInput(); move = menuSelection.Move; _selectedTarget = menuSelection.Target; ret = new BattleMoveWithTarget(menuSelection, this); } else { ret = new BattleMoveWithTarget(move, _selectedTarget, this); } AfterSelectMove(move); return(ret); }
public void CorrectlyPassesBattleMove_SubMenuRequiresBattleMove() { MockMenu mockSubMenu = new MockMenu(requiresBattleMoveInput: true, input: _menuInput, output: _menuOutput); mockSubMenu.SetNextSelection(new MenuSelection[] { null }); MenuSelection expectedMenuSelection = new MenuSelection("foo", new DoNothingMove(), null); mockSubMenu.SetNextBattleMoveRequiredSelection(expectedMenuSelection); List <MenuAction> menuActions = new List <MenuAction> { new MenuAction("fight", move: new DoNothingMove(), subMenu: mockSubMenu) }; Menu menu = new Menu(false, false, false, "pick one", Globals.GenericErrorMessage, null, menuActions, _menuInput, _menuOutput); BuildMenu(menu); _menuInput.Push("1"); MenuSelection returnedSelection = menu.GetInput(); Assert.NotNull(returnedSelection); Assert.AreEqual(expectedMenuSelection, returnedSelection); }
public MarkarthMilkCustomizations(MenuSelection men, MarkarthMilk m) { InitializeComponent(); milk = m; menu = men; DataContext = milk; }
public void HiddenMenuActions_NotAccessibleByNumberInput() { List <MenuAction> menuActions = new List <MenuAction> { new MenuAction("fight"), new MenuAction("defend"), new MenuAction("foo", isHidden: true), new MenuAction("bar", isHidden: true) }; const string prompt = "pick one"; Menu menu = new Menu(false, false, false, prompt, Globals.GenericErrorMessage, null, menuActions, _menuInput, _menuOutput); menu.Build(null, null, null, null); _menuInput.Push("3", "1"); MenuSelection selection = menu.GetInput(); Assert.AreEqual("fight", selection.Description); MockOutputMessage[] outputs = _menuOutput.GetOutputs(); int menuOutputLength = 1 + menuActions.Count(ma => !ma.IsHidden); int expectedOutputLengh = menuOutputLength * 2 + 1; //menu displayed twice, error message displayed once. Assert.AreEqual(expectedOutputLengh, outputs.Length); MockOutputMessage output = outputs[menuOutputLength]; Assert.AreEqual(Globals.GenericErrorMessage + "\n", output.Message); Assert.AreEqual(MockOutputMessageType.Error, output.Type); }
public void GetInput_DisplaysErrorMessageIfInvalidTextSpecified( [Values("foo", "itemz", "run!")] string errorInput, [Values("fight", "item", "run")] string validInput) { _menuInput.Push(errorInput); _menuInput.Push(validInput); MenuSelection ret = _menu.GetInput(); var outputs = _menuOutput.GetOutputs(); var clearIndices = _menuOutput.GetClearIndices(); var expectedLength = (_fullMenuPromptLength * 2) + 1; //display menu twice, show error message Assert.AreEqual(expectedLength, outputs.Length); TestMenuOutput(outputs, 0, clearIndices, 0, true); Assert.AreEqual(2, clearIndices.Length); Assert.AreEqual(ErrorMessage, outputs[_fullMenuPromptLength].Message); Assert.AreEqual(MockOutputMessageType.Error, outputs[_fullMenuPromptLength].Type); TestMenuOutput(outputs, _fullMenuPromptLength + 1, clearIndices, 1); Assert.AreEqual(validInput, ret.Description); }
public WarriorWaterCustomizations(MenuSelection m, WarriorWater w) { InitializeComponent(); water = w; menu = m; DataContext = water; }
/// <summary> /// Custom screen /// </summary> /// <param name="s"></param> public SmokeHouseSkeletonCustomization(MenuSelection m, SmokehouseSkeleton s) { InitializeComponent(); skeleton = s; menu = m; DataContext = skeleton; }
public CoffeeCustomization(MenuSelection m, CandlehearthCoffee c) { InitializeComponent(); menu = m; coffee = c; DataContext = coffee; }
public AretinoAppleJuiceCustomization(MenuSelection m, AretinoAppleJuice a) { InitializeComponent(); aj = a; menu = m; DataContext = aj; }
public override MenuSelection GetInput(BattleMove move, IMoveExecutor moveExecutor) { MenuSelection ret; if (EchoBattleMoveInput) { ret = new MenuSelection(move.Description, move, Owner, moveExecutor); } else { if (_requiresBattleMoveMenuSelections.Count > 0) { PrintFullMenuPrompt(); ret = _requiresBattleMoveMenuSelections.Dequeue(); } else if (_menuSelections.Count > 0) { PrintFullMenuPrompt(); ret = _menuSelections.Dequeue(); } else { ret = InnerMenu?.GetInput() ?? base.GetInput(); } } return(ret); }
private void Update() { if (mainMenu.activeInHierarchy) { if (!isItemMenuOpen) { // Allow player move the cursor in the menu if (Input.GetKeyDown(KeyCode.UpArrow)) { menuSelection = (MenuSelection)MyMath.Wrap((int)menuSelection - 1, 0, 2); } else if (Input.GetKeyDown(KeyCode.DownArrow)) { menuSelection = (MenuSelection)MyMath.Wrap((int)menuSelection + 1, 0, 2); } // When the player makes a selection if (Input.GetKeyDown(KeyCode.Space)) { switch (menuSelection) { case MenuSelection.Item: OpenItemMenu(true); break; case MenuSelection.Exit: Show(false); break; } } if (Input.GetKeyDown(KeyCode.X)) { Show(false); } } // If the item screen is open else { if (Input.GetKeyDown(KeyCode.Space)) { if (Services.gameManager.CurrentHP >= Services.playerStats.maxHP) { return; } if (Services.potionManager.CurrentAmount <= 0) { return; } Services.potionManager.Use(); } else if (Input.GetKeyDown(KeyCode.X)) { OpenItemMenu(false); } } } }
public void BackFromOption() { MainUI.SetActive(true); StageUI.SetActive(false); OptionUI.SetActive(false); selectMenu = MenuSelection.Option_Back; SoundManager.instance.SoundPlay(SoundManager.instance.ButtonClick); }
public void TargetMenu_ReturnsCorrectSelection_SingleAllyOrSelfTargetType() { MenuSelection menuSelection = SingleAllyOrSelfTargetType_Setup("1"); IFighter targetedFighter = _playerTeamWithAllies.Fighters[0]; Assert.AreEqual(targetedFighter, menuSelection.Target); }
void Start() { store = GameObject.FindGameObjectWithTag("SelectedStore").GetComponent <MenuSelection>(); // money listener limaRibu.onClick.AddListener(delegate { addMoney(5000); windowAnimator.SetTrigger("5KInserted"); }); sepuluhRibu.onClick.AddListener(delegate { addMoney(10000); windowAnimator.SetTrigger("10KInserted"); }); duaPuluhRibu.onClick.AddListener(delegate { addMoney(20000); windowAnimator.SetTrigger("20KInserted"); }); }
void Start() { store = GameObject.FindGameObjectWithTag("SelectedStore").GetComponent <MenuSelection>(); storage = GameObject.FindGameObjectWithTag("DrinccStorage").GetComponent <DrinccStorage>(); cameraAnimator = GameObject.FindGameObjectWithTag("CameraTrigger").GetComponent <CameraControl>(); backButton.onClick.AddListener(BackPageClick); buyButton.onClick.AddListener(StartProcess); }
private void SideSelection(object sender, RoutedEventArgs e) { MenuSelection display = new MenuSelection(); display.PickSide(); var o = this.FindAncestor <OrderControl>(); o.DisplayUpdate(display); }
static void Main() { FighterFactory.SetGodRelationshipManager(Globals.GodRelationshipManager); EventHandlerPrinter printer = new EventHandlerPrinter(Globals.Output); const string testBattleOptionText = "Test Battle ('test')"; const string campaignOptionText = "Play the \"Campaign\" mode ('campaign')"; //const string demoOptionText = "Play the \"Demo\" mode (fewer battles per region)"; List <MenuAction> menuActions = new List <MenuAction> { new MenuAction(testBattleOptionText, "test"), new MenuAction(campaignOptionText, "campaign"), new MenuAction("exit") }; Menu selectGameplayModeMenu = new Menu(false, false, false, "What mode would you like to play?", null, null, menuActions, Globals.Input, Globals.Output); bool continuer = true; RegionManager regionManager; while (continuer) { Globals.Output.ClearScreen(); regionManager = Globals.RegionManager; selectGameplayModeMenu.Build(null, null, null, null); MenuSelection gameplayModeSelection = selectGameplayModeMenu.GetInput(); switch (gameplayModeSelection.Description) { case testBattleOptionText: Foo(); break; case campaignOptionText: TutorialScreens(); SetupPlayers(out var playerOne, out var playerTwo, printer); MenuManager menuManager = new MenuManager(Globals.Input, Globals.Output, Globals.MenuFactory); var playerTeam = new Team(menuManager, playerOne, playerTwo); BattleManager manager = new BattleManager(Globals.ChanceService, Globals.Input, Globals.Output); Globals.RegionManager.Battle(manager, playerTeam); break; case "exit": continuer = false; break; } } }
public void ConvertToMenuSelection_ReturnsCorrectResult([Values("foo", "bar")] string displayText) { MenuAction basicMenuAction = new MenuAction(displayText, move: DoNothingMove, fighter: Fighter); MenuSelection returnedSelection = basicMenuAction.ConvertToMenuSelection(); Assert.AreEqual(displayText, returnedSelection.Description); Assert.AreEqual(DoNothingMove, returnedSelection.Move); Assert.AreEqual(Fighter, returnedSelection.Target); }
public void ProgramLoop(string puzzleDirectory) { ConsoleColor foregroundColor = ConsoleColor.Gray; ConsoleColor backgroundColor = ConsoleColor.Black; _programHelper.SetConsoleColors(foregroundColor, backgroundColor); string[] puzzleFilePaths = _programHelper.GetPuzzleFilePathsFromPuzzleDirectory(puzzleDirectory, 9); MenuSelection menuSelection = MenuSelection.NoSelection; //main loop for selecting puzzle files do { _programHelper.WriteTitle(); _programHelper.WriteNumberedFileNamesToConsole(puzzleFilePaths); short fileListNumber = _programHelper.ReadFileNumberFromConsole(puzzleFilePaths.Count()); var(searchWords, grid) = _programHelper.ConvertPuzzleFileToSearchWordsAndGrid(puzzleFilePaths[fileListNumber - 1]); IGridManager gridManager = new GridManager(grid); _consoleWrapper.Clear(); _consoleWrapper.WriteLine(searchWords); _consoleWrapper.WriteLine(); _programHelper.WriteGridToConsole(gridManager.Grid, foregroundColor, backgroundColor); //loop for selecting menu actions (solve puzzle, search for a word, go back to main loop, exit program) do { _consoleWrapper.WriteLine(); menuSelection = _programHelper.PromptForMenuSelection(); switch (menuSelection) { case MenuSelection.ShowSolution: _programHelper.ShowPuzzleSolution(searchWords, gridManager, foregroundColor, backgroundColor); break; case MenuSelection.EnterSearchWord: _programHelper.ShowSolutionForEnteredWords(searchWords, gridManager, foregroundColor, backgroundColor); break; default: break; } } while (menuSelection != MenuSelection.SelectAnotherFile && menuSelection != MenuSelection.Exit); } while (menuSelection != MenuSelection.Exit); }
void Awake() { if (instance == null) { instance = this; } else { Destroy(this); } }
// Action menu private static void ShowActionMenu(Player myPlayer, Items[] tradingGoods, string[] TradeMenu) { bool keepLooping = true; do { bool commandNotExecuted = true; do { try { Console.Write("\nSelect from the following options:\n\n1. UserStats\n2. Store\n3. Travel\n4. Quit game\n\n>>> "); MenuSelection selection = new MenuSelection(Console.ReadLine().Trim()); if (Enumerable.Range(1, 5).Contains(selection.GetSelection())) { switch (selection.GetSelection()) { case 1: myPlayer.ShowStatus(); break; case 2: Console.Clear(); Trade(tradingGoods, myPlayer, TradeMenu); break; case 3: myPlayer.newShip(true); break; case 4: Console.WriteLine("You chose to end the game.\n"); Utilities.EndGameReport(myPlayer); keepLooping = false; break; } commandNotExecuted = false; } else { Console.Clear(); throw new Exception("\nInvalid Entry"); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } while (commandNotExecuted); Console.WriteLine("\nCommand successfully executed. Press Enter to Continue."); Console.ReadLine(); Console.Clear(); } while (keepLooping); }
public void ReturnsAppopriateResponse() { _input.Push("1"); MenuSelection menuSelection = _menu.GetInput(); NumberInputMenuSelection numberInputSelection = menuSelection as NumberInputMenuSelection; Assert.NotNull(numberInputSelection); Assert.AreEqual(1, numberInputSelection.Number); }
// Use this for initialization void Start() { manager = GameObject.Find("CanvasManager").GetComponent<MenuScript>(); oldSelection = MenuSelection.NULL; currentSelection = MenuSelection.LEVELSELECT; rotations = new Quaternion[5]; bg = GameObject.Find("bg"); rotations[0] = Quaternion.Euler(0, 0, -110.0f); rotations[1] = Quaternion.Euler(0, 0, -157.0f); rotations[2] = Quaternion.Euler(0, 0, -247.0f); rotations[3] = Quaternion.Euler(0, 0, 380.0f); rotations[4] = Quaternion.Euler(0, 0, -20.0f); bg.transform.localRotation = rotations[0]; targetRotation = rotations[0]; }
// Update is called once per frame void Update() { bg.transform.localRotation = Quaternion.Lerp(bg.transform.localRotation, targetRotation, 0.18f); Vector2 stickPos; stickPos.x = Input.GetAxis("LeftStickX"); stickPos.y = -Input.GetAxis("LeftStickY"); if (stickPos.x > 0.1f && stickPos.y > stickPos.x * 0.5f) { targetRotation = rotations[0]; oldSelection = currentSelection; currentSelection = MenuSelection.LEVELSELECT; selectionSwitched = true; } else if (stickPos.x > 0.1f && stickPos.y < stickPos.x * 0.5f && stickPos.y > -stickPos.x) { targetRotation = rotations[1]; oldSelection = currentSelection; currentSelection = MenuSelection.OPTIONS; selectionSwitched = true; } else if (stickPos.y < -0.1f && stickPos.x > stickPos.y && stickPos.x < -stickPos.y) { targetRotation = rotations[2]; oldSelection = currentSelection; currentSelection = MenuSelection.EXIT; selectionSwitched = true; } else if (stickPos.x < -0.1f && stickPos.y > stickPos.x && stickPos.y < -stickPos.x * 0.5f) { targetRotation = rotations[3]; oldSelection = currentSelection; currentSelection = MenuSelection.CREDITS; selectionSwitched = true; } else if (stickPos.x < -0.1f && stickPos.y > stickPos.x * 0.5f) { targetRotation = rotations[4]; oldSelection = currentSelection; currentSelection = MenuSelection.DATABASE; selectionSwitched = true; } if (currentSelection != oldSelection && selectionSwitched == true) { Instantiate(switchSound);//this probably works? selectionSwitched = false; } if (Input.GetButtonDown("A") || Input.GetKeyDown(KeyCode.Space)) { //Play glossy interface 01 Instantiate(acceptSound); if (currentSelection != MenuSelection.NULL) { switch (currentSelection) { case MenuSelection.LEVELSELECT: manager.Load("LevelSelect"); gameObject.SetActive(false); break; case MenuSelection.CREDITS: Application.LoadLevel("toplel"); break; case MenuSelection.EXIT: Application.Quit(); break; default: break; } } } if (Input.GetButtonDown("B") || Input.GetKeyDown(KeyCode.Backspace)) { Instantiate(backSound); manager.Load("TitleScreen"); gameObject.SetActive(false); } }