public override bool Execute(CommandExecuteEventArgs args) { if (args.KeyBinding.KeyChord.HasAxis) { // make sure the keybinding and value change are going the // same "direction" (for the case where the axis is involved) if (!MathUtilities.SameSign(args.Data, _amount)) { return(false); } } SuperController sc = SuperController.singleton; var multiplier = _multiplier * Mathf.Abs(args.Data); if (InputWrapper.GetKey(KeyCode.LeftShift) || InputWrapper.GetKey(KeyCode.RightShift)) { multiplier *= 5.0f; } var scale = sc.motionAnimationMaster.playbackSpeed + (_amount * multiplier); sc.motionAnimationMaster.playbackSpeed = Mathf.Clamp(scale, _min, _max); return(true); }
public override bool Execute(CommandExecuteEventArgs args) { if (args.KeyBinding.KeyChord.HasAxis) { // make sure the keybinding and value change are going the // same "direction" (for the case where the axis is involved) if (!MathUtilities.SameSign(args.Data, _rotationsPerSecond)) { return(false); } } var controller = SuperController.singleton.GetFreeController(_atomUid, _controllerName) ?? TargetAtom(args)?.mainController; if (controller != null) { var rotate = 360 * Time.deltaTime * _rotationsPerSecond * Mathf.Abs(args.Data); var target = controller.transform; if (_axis == Axis.X) { target.Rotate(rotate, 0, 0); } else if (_axis == Axis.Y) { target.Rotate(0, rotate, 0); } else if (_axis == Axis.Z) { target.Rotate(0, 0, rotate); } } return(true); }
public override bool Execute(CommandExecuteEventArgs args) { if (args.KeyBinding.KeyChord.HasAxis) { // make sure the keybinding and value change are going the // same "direction" (for the case where the axis is involved) if (!MathUtilities.SameSign(args.Data, _amount)) { return(false); } } SuperController sc = SuperController.singleton; var multiplier = _multiplier * Mathf.Abs(args.Data); if (InputWrapper.GetKey(KeyCode.LeftShift) || InputWrapper.GetKey(KeyCode.RightShift)) { multiplier *= 5.0f; } var scale = sc.worldScale + (_amount * multiplier); SuperController.singleton.worldScale = Mathf.Clamp(scale, _worldScaleMin, _worldScaleMax); //// Modify player height with scale Vector3 dir = Vector3.down; dir *= multiplier * 0.0011f; sc.navigationRig.position += dir; return(true); }
public override bool Execute(CommandExecuteEventArgs args) { var controller = SuperController.singleton.GetFreeController(_atomUid, _controllerName) ?? TargetAtom(args)?.mainController; if (controller != null) { float proportion = Mathf.Lerp(0, 1, Mathf.Abs(args.Data)); var transform = controller.transform; var newPosition = new Vector3(transform.position.x, transform.position.y, transform.position.z); var newValue = Mathf.Lerp(_min, _max, proportion); if (_axis == Axis.X) { newPosition.x = newValue; } else if (_axis == Axis.Y) { newPosition.y = newValue; } else if (_axis == Axis.Z) { newPosition.z = newValue; } transform.position = newPosition; } return(true); }
public override bool Execute(CommandExecuteEventArgs args) { if (args.KeyBinding.KeyChord.HasAxis) { // make sure the keybinding and value change are going the // same "direction" (for the case where the axis is involved) if (!MathUtilities.SameSign(args.Data, _unitsPerSecond)) { return(false); } } if (_windowCamera != null) { var rotate = 360 * Time.deltaTime * _unitsPerSecond * Mathf.Abs(args.Data); var target = _windowCamera.transform; if (_axis == Axis.X) { target.Rotate(rotate, 0, 0); } else if (_axis == Axis.Y) { target.Rotate(0, rotate, 0); } else if (_axis == Axis.Z) { target.Rotate(0, 0, rotate); } } return(true); }
public override bool Execute(CommandExecuteEventArgs args) { if (args.KeyBinding.KeyChord.HasAxis) { // make sure the keybinding and value change are going the // same "direction" (for the case where the axis is involved) if (!MathUtilities.SameSign(args.Data, _unitsPerSecond)) { return(false); } if (_direction == Vector3.forward) { // invert the direction for forward/back if using an axis _direction = Vector3.back; } } if (_windowCamera != null) { var multiplier = 1.0f; if (InputWrapper.GetKey(KeyCode.LeftShift) || InputWrapper.GetKey(KeyCode.RightShift) || args.KeyBinding.KeyChord.HasAxis) { multiplier *= 3.0f; } _windowCamera.transform.Translate(_direction * Time.deltaTime * _unitsPerSecond * multiplier * Mathf.Abs(args.Data)); } return(true); }
public override bool Execute(CommandExecuteEventArgs args) { var plugin = SuperController.singleton.GetPluginStorable(_atomUid, _pluginName); plugin?.CallAction(_key); return(true); }
public override bool Execute(CommandExecuteEventArgs args) { if (args.KeyBinding.KeyChord.HasAxis) { // make sure the keybinding and value change are going the // same "direction" (for the case where the axis is involved) if (!MathUtilities.SameSign(args.Data, _unitsPerSecond)) { return(false); } } var controller = SuperController.singleton.GetFreeController(_atomUid, _controllerName) ?? TargetController(args); if (controller != null) { var direction = Vector3.right; if (_axis == Axis.X) { direction = Vector3.right; } else if (_axis == Axis.Y) { direction = Vector3.up; } else if (_axis == Axis.Z) { direction = Vector3.forward; } controller.transform.Translate(direction * Time.deltaTime * _unitsPerSecond * Mathf.Abs(args.Data)); } return(true); }
public override bool Execute(CommandExecuteEventArgs args) { var controller = SuperController.singleton.GetFreeController(_atomUid, _controllerName) ?? TargetAtom(args)?.mainController; SuperController.singleton.SelectController(controller); return(true); }
public override bool Execute(CommandExecuteEventArgs args) { var plugin = SuperController.singleton.GetPluginStorable(_atomUid, _pluginName); plugin?.SetBoolParamValue(_key, _value); return(true); }
public override bool Execute(CommandExecuteEventArgs args) { if (args.KeyBinding.KeyChord.HasAxis) { // make sure the keybinding and value change are going the // same "direction" (for the case where the axis is involved) if (!MathUtilities.SameSign(args.Data, _amount)) { return(false); } } var plugin = SuperController.singleton.GetPluginStorable(_atomUid, _pluginName); var floatParam = plugin?.GetFloatJSONParam(_key) ?? null; if (floatParam == null) { return(false); } var newValue = Mathf.Clamp(floatParam.val + _amount, floatParam.min, floatParam.max); plugin?.SetFloatParamValue(_key, newValue); return(true); }
public override bool Execute(CommandExecuteEventArgs args) { var target = TargetAtom(args); // there is some polling that is done with a timeout // so do this work async without blocking any run loop SuperController.singleton.StartCoroutine(DoWorkCoroutine(target)); return(true); }
public override bool Execute(CommandExecuteEventArgs args) { var selected = TargetAtom(args); if (selected != null) { SuperController.singleton.StartCoroutine(DeleteAtom(selected)); } return(true); }
public override bool Execute(CommandExecuteEventArgs args) { var target = TargetAtom(args); if (target != null) { target.hidden = !target.hidden; } return(true); }
// TODO: consider integrating with acidbubbles debug plugin public override bool Execute(CommandExecuteEventArgs args) { var selected = TargetAtom(args); if (selected != null) { DumpObject(selected); } return(true); }
public override bool Execute(CommandExecuteEventArgs args) { var selected = TargetAtom(args); if (selected != null) { var trigger = selected.GetComponentInChildren <UIButtonTrigger>(); trigger?.button?.onClick?.Invoke(); } return(true); }
public virtual Atom TargetAtom(CommandExecuteEventArgs args) { if (_predicate == null) { return(SuperController.singleton.GetSelectedAtom()); } else { return(SelectableAtoms().Where(_predicate).FirstOrDefault()); } }
public override bool Execute(CommandExecuteEventArgs args) { var perfMonitorButton = UserPreferences.singleton.transform .Find((p) => p.EndsWith("PerfMon Toggle")) .FirstOrDefault() ?.GetComponent <UnityEngine.UI.Toggle>(); if (perfMonitorButton != null) { perfMonitorButton.isOn = !perfMonitorButton.isOn; } return(true); }
public override bool Execute(CommandExecuteEventArgs args) { if (args.KeyBinding.KeyChord.HasAxis) { // make sure the keybinding and value change are going the // same "direction" (for the case where the axis is involved) if (!MathUtilities.SameSign(args.Data, _value)) { return(false); } } SuperController.singleton.monitorCameraFOV = Mathf.Clamp(SuperController.singleton.monitorCameraFOV + _value, _min, _max); return(true); }
public override Atom TargetAtom(CommandExecuteEventArgs args) { if (args.KeyBinding.KeyChord.HasAxis) { // make sure the keybinding and value change are going the // same "direction" (for the case where the axis is involved) if (!MathUtilities.SameSign(args.Data, 1)) { return(null); } } var current = SuperController.singleton.GetSelectedAtom(); return(SelectableAtoms() .LoopOnceStartingWhen((a) => a.uid.Equals(current?.uid)) .First(_predicate) ?? current); }
public override bool Execute(CommandExecuteEventArgs args) { if (args.KeyBinding.KeyChord.HasAxis) { // make sure the keybinding and value change are going the // same "direction" (for the case where the axis is involved) if (!MathUtilities.SameSign(args.Data, _indexDelta)) { return(false); } } var values = UserPreferences.singleton.msaaPopup.popupValues; var currentIndex = values.ToList().FindIndex((val) => UserPreferences.singleton.msaaPopup.currentValue.Equals(val)); var newValue = values[Mathf.Clamp(currentIndex + _indexDelta, 0, values.Length - 1)]; UserPreferences.singleton.SetMsaaFromString(newValue); return(true); }
public override bool Execute(CommandExecuteEventArgs args) { var atom = SuperController.singleton.GetAtomByUid(_atomUid); if (atom == null) { return(false); } // select the atom plugin tab first new AtomSelectTab("Plugins", atom).Execute(args); // click the "add" button var ui = atom.GetComponentInChildren <MVRPluginManagerUI>(); if (ui != null) { ui?.addPluginButton?.onClick?.Invoke(); if (_showFilePrompt) { // find the newest empty plugin ui section that was added var lastAddedPluginUi = atom.GetComponentsInChildren <MVRPluginUI>() .Where((x) => x.urlText.text.Equals(string.Empty)) .LastOrDefault(); if (lastAddedPluginUi != null) { // prompt the user to select a file lastAddedPluginUi.fileBrowseButton?.onClick?.Invoke(); // wait up to 120 seconds for user to have made a choice and open atom.StartCoroutine(Waiter(120, lastAddedPluginUi, (found) => { if (found != null && _openPluginUi) { found.openUIButton?.onClick?.Invoke(); } return; })); } } } return(true); }
public override bool Execute(CommandExecuteEventArgs args) { if (args.KeyBinding.KeyChord.HasAxis) { // make sure the keybinding and value change are going the // same "direction" (for the case where the axis is involved) if (!MathUtilities.SameSign(args.Data, _unitsPerSecond)) { return(false); } } // this algorithm from Supercontroller.cs ProcessMouseControl() var navigation = SuperController.singleton.navigationRig; var target = _target(); if (navigation != null && target != null) { var amount = _unitsPerSecond * Mathf.Abs(args.Data) * Time.deltaTime; // from SuperController ProcessMouseControl // float num3 = 0.1f; // if (amount < -0.5f) // { // num3 = 0f - amount; // } Vector3 forward = target.forward; Vector3 val8 = amount * forward * SuperController.singleton.focusDistance; Vector3 val9 = navigation.position + val8; SuperController.singleton.focusDistance *= 1f - amount; Vector3 up3 = navigation.up; float num4 = Vector3.Dot(val8, up3); val9 += up3 * (0f - num4); navigation.position = val9; SuperController.singleton.playerHeightAdjust += num4; } return(true); }
public override bool Execute(CommandExecuteEventArgs args) { if (args.KeyBinding.KeyChord.HasAxis) { // make sure the keybinding and value change are going the // same "direction" (for the case where the axis is involved) if (!MathUtilities.SameSign(args.Data, _incrementBy)) { return(false); } } var plugin = SuperController.singleton.GetPluginStorable(_atomUid, _pluginName); var choices = plugin.GetStringChooserJSONParamChoices(_key); var selectedIndex = choices.FindIndex((c) => c.Equals(plugin.GetStringChooserParamValue(_key))); var newValue = choices[Mathf.Clamp(selectedIndex + _incrementBy, 0, choices.Count - 1)]; plugin?.SetStringChooserParamValue(_key, newValue); return(true); }
public override bool Execute(CommandExecuteEventArgs args) { var selected = TargetAtom(args); if (selected != null) { var pattern = selected.GetComponentInChildren <AnimationPattern>(); if (pattern != null) { switch (_action) { case PLAY: pattern.Play(); break; case RESET_AND_PLAY: pattern.ResetAndPlay(); break; case PAUSE: pattern.Pause(); break; case UNPAUSE: pattern.UnPause(); break; case TOGGLE_PAUSE: pattern.TogglePause(); break; case RESET: pattern.ResetAnimation(); break; } } } return(true); }
public override bool Execute(CommandExecuteEventArgs args) { var plugin = SuperController.singleton.GetPluginStorable(_atomUid, _pluginName); if (plugin == null) { return(false); } // make sure the atom plugin tab is showing if (new AtomSelectTab("Plugins", plugin.containingAtom).Execute(args)) { var atom = plugin.containingAtom; foreach (var scriptController in atom.GetComponentsInChildren <MVRScriptControllerUI>()) { if (scriptController.label.text.Equals(plugin.name)) { scriptController.openUIButton?.onClick?.Invoke(); return(true); } } } return(true); }
public override bool Execute(CommandExecuteEventArgs args) { if (args.KeyBinding.KeyChord.HasAxis) { // make sure the keybinding and value change are going the // same "direction" (for the case where the axis is involved) if (!MathUtilities.SameSign(args.Data, _value)) { return(false); } } var multiplier = _multiplier; if (InputWrapper.GetKey(KeyCode.LeftShift) || InputWrapper.GetKey(KeyCode.RightShift)) { multiplier *= 5.0f; } var scale = TimeControl.singleton.currentScale + (_value * multiplier); TimeControl.singleton.currentScale = Mathf.Clamp(scale, _min, _max); return(true); }
public override bool Execute(CommandExecuteEventArgs args) { if (args.KeyBinding.KeyChord.HasAxis) { // make sure the keybinding and value change are going the // same "direction" (for the case where the axis is involved) if (!MathUtilities.SameSign(args.Data, _unitsPerSecond)) { return(false); } } // this algorithm from Supercontroller.cs ProcessMouseControl() var navigation = SuperController.singleton.navigationRig; var target = _target(); if (navigation != null && target != null) { var rotate = 360 * Time.deltaTime * _unitsPerSecond * Mathf.Abs(args.Data); if (_axis == Axis.X) { navigation.RotateAround(target.Value, navigation.up, rotate); } else if (_axis == Axis.Y) { navigation.RotateAround(target.Value, navigation.right, rotate); } else if (_axis == Axis.Z) { navigation.RotateAround(target.Value, navigation.forward, rotate); } } return(true); }
public override bool Execute(CommandExecuteEventArgs args) { SuperController.singleton.StartCoroutine(SuperController.singleton.AddAtomByType(_type, useuid: null, userInvoked: false)); return(true); }