/// <summary> /// Constructor. /// </summary> public MouseButtonMessage(Point location, XMouseButtons mouseButton, ButtonActions buttonAction, uint clickCount, bool control, bool alt, bool shift) { _location = location; _buttonAction = buttonAction; _clickCount = clickCount; _mouseButtonShortcut = new MouseButtonShortcut(mouseButton, control, alt, shift); }
public static bool ExecuteCurrentAction(Player player, Controller controller) { ButtonActions currentAction = player.GetCurrentAction(); bool success = false; switch (currentAction) { case ButtonActions.JUMP: success = ExecuteJumpAction(controller); break; case ButtonActions.DASH: success = ExecuteDashAction(controller); break; case ButtonActions.FLAP: success = ExecuteFlapAction(controller); break; case ButtonActions.SHIELD: success = ExecuteShieldAction(controller); break; default: Debug.Assert(false, "Attempting to get force for non-existent action."); break; } return(success); }
/// <summary> /// Constructor. /// </summary> public MouseButtonMessage(Point location, XMouseButtons mouseButton, ButtonActions buttonAction, uint clickCount, ModifierFlags modifierFlags) : this(location, mouseButton, buttonAction, clickCount, (modifierFlags & ModifierFlags.Control) == ModifierFlags.Control, (modifierFlags & ModifierFlags.Alt) == ModifierFlags.Alt, (modifierFlags & ModifierFlags.Shift) == ModifierFlags.Shift) { }
// Start is called before the first frame update void Start() { bodyPartSelectorManager = FindObjectOfType <BodyPartSelectorManager>(); embeddedObjectSelectorManager = FindObjectOfType <EmbeddedObjectSelectorManager>(); buttonActions = FindObjectOfType <ButtonActions>(); Update(); }
public static IEnumerator RemoveOrganCoroutine(Organ organ, float seconds, int goldCost, float bloodLossRateInduced, float damageInduced) { Clock clock = MonoBehaviour.FindObjectOfType <Clock>(); clock.StartClockUntil(seconds); ButtonActions buttonActions = MonoBehaviour.FindObjectOfType <ButtonActions>(); buttonActions.UpdateMenuButtonsInteractivity(false); buttonActions.ActionInProgress(); while (clock.isTimePassing) { RemoveOrganDuring(organ, clock, seconds, bloodLossRateInduced, damageInduced); yield return(null); } buttonActions.ActionFinished(); if (!clock.actionCancelFlag) { RemoveOrganProcess(organ); GameObject.FindObjectOfType <GoldTracker>().goldSpent += goldCost; buttonActions.SelectSurgeryAction(); } }
public static IEnumerator DeleteBodyPartCoroutine(BodyPart bodyPart, float seconds, int goldCost) { Clock clock = MonoBehaviour.FindObjectOfType <Clock>(); clock.StartClockUntil(seconds); ButtonActions buttonActions = MonoBehaviour.FindObjectOfType <ButtonActions>(); buttonActions.UpdateMenuButtonsInteractivity(false); buttonActions.ActionInProgress(); while (clock.isTimePassing) { yield return(null); } buttonActions.ActionFinished(); if (!clock.actionCancelFlag) { DeleteBodyPartProcess(bodyPart); GameObject.FindObjectOfType <GoldTracker>().goldSpent += goldCost; if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "SampleScene") { MonoBehaviour.FindObjectOfType <BodyPartStatusManager>().UpdateStatusCollection(); } buttonActions.SelectSurgeryAction(); } }
public void Explode() { if (!hasDetonated) { hasDetonated = true; if (!(parentBodyPart == null)) { FindObjectOfType <TextLog>().NewLogEntry($"A bomb just exploded, taking the {parentBodyPart.name} with it!"); parentBodyPart.SeverAllConnections(30); //I can't shake the feeling that invoking surgery to do this is not going to end particulary well //but, it has all the setup and cleanup required to make it work Actions_Surgery.DeleteBodyPartProcess(parentBodyPart); Destroy(this); } FindObjectOfType <TextLog>().NewLogEntry("A bomb just exploded!"); ButtonActions buttonActions = FindObjectOfType <ButtonActions>(); if (buttonActions.selectedGameObject == this.gameObject) { FindObjectOfType <ButtonActions>().selectedGameObject = null; } FindObjectOfType <BodyPartSelectorManager>().ResetSelectors(); FindObjectOfType <EmbeddedObjectSelectorManager>().ResetSelectors(); Destroy(this); } }
public static IEnumerator ConnectBodyPartCoroutine(BodyPart bodyPart1, BodyPart bodyPart2, float seconds, int goldCost, float bloodLossRateInduced, float damageInduced) { Clock clock = MonoBehaviour.FindObjectOfType <Clock>(); clock.StartClockUntil(seconds); ButtonActions buttonActions = MonoBehaviour.FindObjectOfType <ButtonActions>(); buttonActions.UpdateMenuButtonsInteractivity(false); buttonActions.ActionInProgress(); while (clock.isTimePassing) { ConnectBodyPartDuring(bodyPart1, bodyPart2, clock, seconds, bloodLossRateInduced, damageInduced); yield return(null); } buttonActions.ActionFinished(); if (!clock.actionCancelFlag) { ConnectBodyPartProcess(bodyPart1, bodyPart2); GameObject.FindObjectOfType <GoldTracker>().goldSpent += goldCost; MonoBehaviour.FindObjectOfType <BodyPartStatusManager>().UpdateStatusCollection(); buttonActions.SelectSurgeryAction(); } }
// Start is called before the first frame update void Start() { embeddedObjectSelectorManager = FindObjectOfType <EmbeddedObjectSelectorManager>(); buttonActions = FindObjectOfType <ButtonActions>(); Update(); borderHighlight.enabled = ShouldBeHighlighted(embeddedObject); }
// Use this for initialization void Awake() { Time.timeScale = 1; instance = this; //scoreCard.instance.isConeHeadMode(); chosenColor = Random.Range(0, colorScheme.Length); backgroundColor = colorScheme[chosenColor].backgroundColor; waveColor = colorScheme[chosenColor].waveColor; textColor = colorScheme[chosenColor].textColor; Camera.main.backgroundColor = backgroundColor; foreach (Text t in FindObjectsOfType <Text>()) { t.color = colorScheme[chosenColor].textColor; } foreach (Slider s in FindObjectsOfType <Slider>()) { s.fillRect.GetComponent <Image>().color = waveColor; s.handleRect.GetComponent <Image>().color = textColor; } if (mainButtons != null) { mainButtons.SetActive(false); } }
private bool GetButtonStatusKeyboard(ButtonActions buttonId) { switch (buttonId) { case ButtonActions.Start: return(Input.GetKeyDown(KeyCode.S)); case ButtonActions.Select: return(false); case ButtonActions.UseItem: return(Input.GetKeyDown(KeyCode.C)); case ButtonActions.Punch: return(Input.GetKeyDown(KeyCode.P)); case ButtonActions.Fire: return(Input.GetKey(KeyCode.X)); case ButtonActions.Run: return(Input.GetKey(KeyCode.R)); case ButtonActions.Crouch: return(Input.GetKey(KeyCode.Z)); case ButtonActions.Lock: return(Input.GetKey(KeyCode.V)); } return(false); }
private static IEnumerator AddBloodCoroutine(BodyPart bodyPart, float seconds, int goldCost, int blood) { Clock clock = MonoBehaviour.FindObjectOfType <Clock>(); clock.StartClockUntil(seconds); ButtonActions buttonActions = MonoBehaviour.FindObjectOfType <ButtonActions>(); buttonActions.UpdateMenuButtonsInteractivity(false); buttonActions.ActionInProgress(); while (clock.isTimePassing) { yield return(null); } buttonActions.ActionFinished(); if (!clock.actionCancelFlag) { bodyPart.GetComponent <BodyPart>().blood += blood; MonoBehaviour.FindObjectOfType <ActionTracker>().blood_injected += blood; GameObject.FindObjectOfType <GoldTracker>().goldSpent += goldCost; buttonActions.SelectBloodAction(); } else { clock.actionCancelFlag = false; } }
public static IEnumerator ApplyBloodRegenCharmCoroutine(BodyPart bodyPart, float seconds, int goldCost) { Clock clock = MonoBehaviour.FindObjectOfType <Clock>(); clock.StartClockUntil(seconds); ButtonActions buttonActions = MonoBehaviour.FindObjectOfType <ButtonActions>(); buttonActions.ActionInProgress(); while (clock.isTimePassing) { yield return(null); } buttonActions.ActionFinished(); if (!clock.actionCancelFlag) { bodyPart.gameObject.AddComponent <BloodRegenCharm>(); MonoBehaviour.FindObjectOfType <ActionTracker>().charm_petrification += 1; GameObject.FindObjectOfType <GoldTracker>().goldSpent += goldCost; } else { clock.actionCancelFlag = false; } }
public static IEnumerator ApplyPetrificationCharmCoroutine(BodyPart bodyPart, float seconds, int goldCost) { Clock clock = MonoBehaviour.FindObjectOfType <Clock>(); clock.StartClockUntil(seconds); ButtonActions buttonActions = MonoBehaviour.FindObjectOfType <ButtonActions>(); buttonActions.ActionInProgress(); while (clock.isTimePassing) { yield return(null); } buttonActions.ActionFinished(); if (!clock.actionCancelFlag) { ApplyPetrificationCharmProcess(bodyPart); GameObject.FindObjectOfType <GoldTracker>().goldSpent += goldCost; buttonActions.SelectCharmAction(); } else { clock.actionCancelFlag = false; } }
/// <summary> /// Constructor for the button that is linked to a feature. /// </summary> /// <param name="buttonType">The type of the button.</param> /// <param name="isRight">True if it represents a button on the right controller.</param> public Button(ButtonName buttonType, ButtonActions action, bool isRight, bool overridesInteraction, Action method, Type featureOwner) { this.IsRightControllerButton = isRight; Name = buttonType; Action = action; buttonDelegate = method; FeatureOwner = featureOwner; }
public bool GetButtonStatus(ButtonActions buttonId) { if (inputType == InputType.joystick) { return(GetButtonStatusJoystick(buttonId)); } else { return(GetButtonStatusKeyboard(buttonId)); } }
private ButtonActions GetSuitableButton(string itemName, List <ButtonActions> buttons) { ButtonActions returnedButton = buttons[0]; for (int i = 1; i < buttons.Count; i++) { if (returnedButton.buttonItem.slotSize > buttons[i].buttonItem.slotSize) { returnedButton = buttons[i]; } } return(returnedButton); }
public override IEnumerator Execute(GameObject target, IAction[] actions, int index) { text = canvasButton.GetComponentInChildren <Text>(); image = canvasButton.GetComponent <Image>(); button = canvasButton.GetComponent <ButtonActions>(); canvasButton.SetActive(true); if (button != null) { if (text != null) { float targetAlpha = alpha.GetValue(target); float currentAlpha = text.color.a; float startTime = Time.unscaledTime; text.CrossFadeAlpha(targetAlpha, duration, false); } if (image != null) { float targetAlpha = alpha.GetValue(target); float currentAlpha = image.color.a; float startTime = Time.unscaledTime; image.CrossFadeAlpha(targetAlpha, duration, false); } yield return(new WaitForSeconds(duration)); float targetA = alpha.GetValue(target); if (targetA == 0) { button.interactable = false; canvasButton.SetActive(false); } else if (targetA == 1) { button.interactable = true; canvasButton.SetActive(true); } } yield return(0); }
public static IEnumerator WaitSecondsCoroutine(float seconds) { Clock clock = MonoBehaviour.FindObjectOfType <Clock>(); ButtonActions buttonActions = MonoBehaviour.FindObjectOfType <ButtonActions>(); buttonActions.ActionInProgress(); while (clock.isTimePassing) { yield return(null); } buttonActions.ActionFinished(); clock.actionCancelFlag = false; }
private void GameSaveDialog_Load(object sender, EventArgs e) { // Display details in UI LabelName.Text = GameSaveItem.Name.Replace("&", "&&"); LabelCategory.Text = Categories.GetCategoryById(GameSaveItem.CategoryId).Title; LabelVersion.Text = GameSaveItem.Version; LabelRegion.Text = GameSaveItem.Region; LabelGameMode.Text = GameSaveItem.GameMode; LabelCreatedBy.Text = GameSaveItem.CreatedBy.Replace("&", "&&"); LabelSubmittedBy.Text = GameSaveItem.SubmittedBy.Replace("&", "&&"); LabelDescription.Text = string.IsNullOrWhiteSpace(GameSaveItem.Description) ? "No other details can be found for this yet." : GameSaveItem.Description.Replace("&", "&&"); StringBuilder extraDescription = new StringBuilder("\n---------------------------------------------\n") .AppendLine("Important Information:\n") .AppendLine("- You must have at least one USB device connected to the console before installing the game save files.\n") .Append("- It's suggested to use 'Apollo Tool' (Homebrew > Applications) for patching and resigning game save files directly on your console."); LabelDescription.Text += extraDescription.ToString(); InstalledModInfo installedModInfo = MainWindow.Settings.GetInstalledMods(GameSaveItem.GetPlatform(), GameSaveItem.CategoryId, GameSaveItem.Id); if (installedModInfo == null) { ButtonActions.Text = Language.GetString("Not Installed"); ButtonActions.ImageOptions.SvgImage = Images[0]; ButtonActions.SetControlTextWidth(34); } else { ButtonActions.Text = Language.GetString("Installed"); ButtonActions.ImageOptions.SvgImage = Images[1]; ButtonActions.SetControlTextWidth(32); } if (MainWindow.Settings.FavoriteIds.Exists(x => x.Platform == MainWindow.PlatformType && x.Ids.Contains(GameSaveItem.Id))) { ButtonFavorite.Text = Language.GetString("Unfavorite"); ButtonFavorite.SetControlTextWidth(30); } else { ButtonFavorite.Text = Language.GetString("Favorite"); ButtonFavorite.SetControlTextWidth(28); } }
/* * public void OnAddPressed() * { * int itemIndex = itemDropdown.value; * Item item = new Item(inventoryDatabase.itemList[itemIndex]); * AddItem(item); * } */ public void AddItem(Item item) { isInventoryChanged = true; bool createNew = ShouldCreateNew(item.itemName); if (createNew) { CreateItemButton(item); } else { List <ButtonActions> buttons = GetButtons(item.itemName); ButtonActions suitableButton = GetSuitableButton(item.itemName, buttons); suitableButton.buttonItem.slotSize++; suitableButton.SetButtonUI(); } }
void Start() { spriteRenderer = GetComponent <SpriteRenderer>(); if (spriteRenderer.sprite == null) { spriteRenderer.sprite = buttonIn; // set the sprite to sprite1 } pauseGameScript = FindObjectOfType <PauseGameStatus>(); buttonActionsScript = FindObjectOfType <ButtonActions>(); globalControlScript = FindObjectOfType <GlobalControl>(); gameSaverScript = FindObjectOfType <GameSaver>(); audioSource = GetComponent <AudioSource>(); move = false; }
public static IEnumerator DischargePatientCoroutine() { Clock clock = MonoBehaviour.FindObjectOfType <Clock>(); ButtonActions buttonActions = MonoBehaviour.FindObjectOfType <ButtonActions>(); buttonActions.ActionInProgress(); while (clock.isTimePassing) { yield return(null); } buttonActions.ActionFinished(); if (!clock.actionCancelFlag) { GameObject.FindObjectOfType <LifeMonitor>().VictoryCheck(); } clock.actionCancelFlag = false; }
private void GameModDialog_Load(object sender, EventArgs e) { // Display details in UI LabelCategory.Text = Categories.GetCategoryById(ModItem.CategoryId).Title; LabelName.Text = ModItem.Name.Replace("&", "&&"); LabelModType.Text = ModItem.ModType; LabelSystemType.Text = string.Join(" & ", ModItem.Versions).Replace("&", "&&"); LabelVersion.Text = ModItem.FirmwareType; LabelRegion.Text = string.Join(", ", ModItem.Regions); LabelCreatedBy.Text = ModItem.CreatedBy.Replace("&", "&&"); LabelSubmittedBy.Text = ModItem.SubmittedBy.Replace("&", "&&"); LabelGameMode.Text = string.Join(", ", ModItem.GameModes); LabelDescription.Text = string.IsNullOrWhiteSpace(ModItem.Description) ? "No other details can be found for this yet." : ModItem.Description.Replace("&", "&&"); InstalledModInfo installedModInfo = MainWindow.Settings.GetInstalledMods(ModItem.GetPlatform(), ModItem.CategoryId, ModItem.Id); if (installedModInfo == null) { ButtonActions.Text = Language.GetString("Not Installed"); ButtonActions.ImageOptions.SvgImage = Images[0]; ButtonActions.SetControlTextWidth(34); } else { ButtonActions.Text = Language.GetString("Installed"); ButtonActions.ImageOptions.SvgImage = Images[1]; ButtonActions.SetControlTextWidth(32); } if (MainWindow.Settings.FavoriteIds.Exists(x => x.Platform == PlatformPrefix.PS3 && x.Ids.Contains(ModItem.Id))) { ButtonFavorite.Text = Language.GetString("Unfavorite"); ButtonFavorite.SetControlTextWidth(30); } else { ButtonFavorite.Text = Language.GetString("Favorite"); ButtonFavorite.SetControlTextWidth(28); } }
public override IEnumerator Execute(GameObject target, IAction[] actions, int index) { button = canvasButton.GetComponent <ButtonActions>(); if (canvasButton != null) { if (interact.GetValue(target) == false) { button.interactable = false; } else if (interact.GetValue(target) == true) { button.interactable = true; } } yield return(0); }
public bool GetButtonDownStatusJoystick(ButtonActions buttonId) { switch (buttonId) { case ButtonActions.Start: return(GetKeyDownPressed("Start")); case ButtonActions.Select: return(GetKeyDownPressed("Select")); case ButtonActions.UseItem: return(GetKeyDownPressed("UseItem")); case ButtonActions.Punch: return(GetKeyDownPressed("Punch")); case ButtonActions.Fire: return(GetKeyDownPressed("Fire")); case ButtonActions.Run: return(GetKeyDownPressed("Run")); case ButtonActions.Crouch: return(GetKeyDownPressed("Crouch")); case ButtonActions.Lock: return(GetKeyDownPressed("Lock")); case ButtonActions.MoveLeft: return(GetKeyDownPressed("MoveLeft")); case ButtonActions.MoveRight: return(GetKeyDownPressed("MoveRight")); } return(false); }
public static IEnumerator InjectPotionCoroutine(BodyPart bodyPart, string type, float amount, float seconds, int goldCost) { Clock clock = MonoBehaviour.FindObjectOfType <Clock>(); clock.StartClockUntil(seconds); ButtonActions buttonActions = MonoBehaviour.FindObjectOfType <ButtonActions>(); buttonActions.ActionInProgress(); while (clock.isTimePassing) { yield return(null); } buttonActions.ActionFinished(); if (!clock.actionCancelFlag) { InjectPotionProcess(bodyPart.GetComponent <BodyPart>(), type, amount); GameObject.FindObjectOfType <GoldTracker>().goldSpent += goldCost; buttonActions.SelectMedicineAction(); } else { clock.actionCancelFlag = false; } }
public static IEnumerator SpawnBodyPartCoroutineTemplate(float seconds, int goldCost, string partName, Func <string, BodyPart> spawnMethod, int menuReset) { Clock clock = MonoBehaviour.FindObjectOfType <Clock>(); clock.StartClockUntil(seconds); ButtonActions buttonActions = MonoBehaviour.FindObjectOfType <ButtonActions>(); buttonActions.ActionInProgress(); while (clock.isTimePassing) { yield return(null); } buttonActions.ActionFinished(); if (!clock.actionCancelFlag) { SpawnBodyPartProcessTemplate(goldCost, partName, spawnMethod, menuReset); } else { clock.actionCancelFlag = false; } MonoBehaviour.FindObjectOfType <BodyPartSelectorManager>().ResetSelectors(); }
public bool ActionHeld(ButtonActions b) { return Pressed(keyDictionary[b]) || Pressed(gamepadDictionary[b]); }
/// <summary> /// Constructor. /// </summary> public KeyboardButtonMessage(XKeys keyData, ButtonActions buttonAction) { _buttonAction = buttonAction; _buttonShortcut = new KeyboardButtonShortcut(keyData); }
/// <summary> /// Constructor. /// </summary> public MouseButtonMessage(Point location, XMouseButtons mouseButton, ButtonActions buttonAction, uint clickCount) : this(location, mouseButton, buttonAction, clickCount, false, false, false) { }
public bool ActionReleased(ButtonActions b) { return KeyReleased(keyDictionary[b]) || KeyReleased(gamepadDictionary[b]); }
public bool IsNewAction(ButtonActions b) { return IsNewKey(keyDictionary[b]) || IsNewKey(gamepadDictionary[b]); }
public bool ActionPressed(ButtonActions b) { return IsNewKey(keyDictionary[b]) || IsNewKey(gamepadDictionary[b]); }