/// <summary> /// /// </summary> public virtual void DeactivateAllSubmenus() { SelectorMenu.Instance.gameObject.SetActive(true); if (RenameDialog.Visible) { RenameDialog.Cancel(); } TransformMenu.Instance.Hide(); RobotSteppingMenu.Instance.Hide(); MainSettingsMenu.Instance.Hide(); ActionObjectMenu.Instance.Hide(); FavoritesButtons.SetActive(false); HomeButtons.SetActive(false); UtilityButtons.SetActive(false); AddButtons.SetActive(false); RobotButtons.SetActive(false); FavoritesButton.GetComponent <Image>().enabled = false; RobotButton.GetComponent <Image>().enabled = false; AddButton.GetComponent <Image>().enabled = false; UtilityButton.GetComponent <Image>().enabled = false; HomeButton.GetComponent <Image>().enabled = false; MainSettingsButton.GetComponent <Image>().enabled = false; MoveButton.GetComponent <Image>().enabled = false; MoveButton2.GetComponent <Image>().enabled = false; OpenMenuButton.GetComponent <Image>().enabled = false; RobotSelectorButton.GetComponent <Image>().enabled = false; RobotSteppingButton.GetComponent <Image>().enabled = false; RobotSelector.Close(false); }
public override void RespondToUtilityButtonClick( UtilityButtons clickedUtility) { // Most utility buttons should only do something if not recording. // Also, saving the record should only be active after a // timing/counting run (when readyToStartRecording is false). switch (clickedUtility) { case UtilityButtons.startRecording: { if (!recordingActivities) { TimeActivities(); } } break; case UtilityButtons.nextAnimal: { if (!readyToStartRecording) { RecordLastAnimal(); ResetRecords(); } } break; case UtilityButtons.discardAnimal: { DialogResult dialogResult = MessageBox.Show(("Are you sure that you want to discard" + " this recording?"), "Confirm that recording should be discarded", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { ResetRecords(); } } break; default: { } break; } }
public void SetActiveSubmenu(LeftMenuSelection which, bool active = true) { DeactivateAllSubmenus(); CurrentSubmenuOpened = which; if (!active) { return; } switch (which) { case LeftMenuSelection.None: break; case LeftMenuSelection.Favorites: FavoritesButtons.SetActive(active); FavoritesButton.GetComponent <Image>().enabled = active; break; case LeftMenuSelection.Add: AddButtons.SetActive(active); AddButton.GetComponent <Image>().enabled = active; break; case LeftMenuSelection.Utility: UtilityButtons.SetActive(active); UtilityButton.GetComponent <Image>().enabled = active; break; case LeftMenuSelection.Home: HomeButtons.SetActive(active); HomeButton.GetComponent <Image>().enabled = active; UpdateBuildAndSaveBtns(); break; case LeftMenuSelection.Robot: RobotButtons.SetActive(active); RobotButton.GetComponent <Image>().enabled = active; break; } }
void Awake() { moduleId = moduleIdCounter++; for (int a = 0; a < Keys.Count(); a++) { int Number = a; Keys[Number].OnInteract += delegate { PressNumber(Number); return(false); }; } for (int a = 0; a < UtilityButtons.Count(); a++) { int NumberU = a; UtilityButtons[NumberU].OnInteract += delegate { PressUtility(NumberU); return(false); }; } }
public virtual void RespondToUtilityButtonClick( UtilityButtons clickedUtility) { // This does nothing by default. }
public void DoUtility(UtilityButtons utility) { switch (utility) { case UtilityButtons.Decimal: { if (!OutputDisplay.Text.Contains(".")) { DisplayOutput('.', append: true); } } break; case UtilityButtons.Percent: { if (OutputDisplay.Text != "") { var input = double.Parse(OutputDisplay.Text); DisplayOutput(.1 * input); } } break; case UtilityButtons.OneDivX: { if (OutputDisplay.Text != "") { var input = double.Parse(OutputDisplay.Text); if (input == 0) { MessageBox.Show("Division by zero is not allowed!"); } else { DisplayOutput(1.0 / input); } } } break; case UtilityButtons.Square: { if (OutputDisplay.Text != "") { var input = double.Parse(OutputDisplay.Text); DisplayOutput(Math.Pow(input, 2)); } } break; case UtilityButtons.Cube: { if (OutputDisplay.Text != "") { var input = double.Parse(OutputDisplay.Text); DisplayOutput(Math.Pow(input, 3)); } } break; case UtilityButtons.Invert: { if (OutputDisplay.Text != "") { var input = double.Parse(OutputDisplay.Text); DisplayOutput(-input); } } break; case UtilityButtons.PI: DisplayOutput(Math.PI); break; } }