public GestureInputEventArguments(GestureInputEventArgs args) { GestureID = args.GestureID; CenterX = args.CenterX; CenterY = args.CenterY; NumFingers = args.NumFingers; Error = args.Error; }
public void InvokeGestureInputEvent(Action <GestureInputEventArgs> action, GestureInputEventArgs eventArgs) { // If input event is valid, invoke. if (ValidateInputEvent(eventArgs)) { action.Invoke(eventArgs); } }
public GestureInteractionEventArgs(GestureInputEventArgs inputData) { Vector3 srcOnePos; Vector3 srcTwoPos; if (inputData.TryGetDoubleGripPosition(out srcOnePos, out srcTwoPos)) { IsTwoHanded = true; HandOnePos = srcOnePos; HandTwoPos = srcTwoPos; } else if (inputData.TryGetSingleGripPosition(out srcOnePos)) { IsTwoHanded = false; HandOnePos = srcOnePos; } }
private IEnumerator ProcessGestureInputEvent(GestureInputEventArgs inputData, GestureType gesture) { if (_isProcessing && gesture != GestureType.ManipulationEnd) { yield break; } if (_isProcessing && gesture == GestureType.ManipulationEnd) { yield return(null); } _isProcessing = true; Context context = ContextManager.Instance.SafeContext; var eventArgs = new GestureInteractionEventArgs(inputData); eventArgs.Selected = context.Selected; eventArgs.Focused = context.Focused; eventArgs.Gesture = gesture; Command command = new Command(eventArgs); if (AppConfig.SharingEnabled && AppConfig.IsServerInstance) { if (gesture == GestureType.OneHandManipStart || gesture == GestureType.TwoHandManipStart || gesture == GestureType.ManipulationUpdate) { // Do nothing. } else { string sendCommand = ParseGestureCommand(command, eventArgs); SendCommandToRemote(sendCommand); } } if (CurrentState != null) { yield return(CurrentState.ProcessCommand(eventArgs, command)); } _isProcessing = false; }
private bool ValidateInputEvent(GestureInputEventArgs eventArgs) { return(AppConfig.IsServerInstance || !SyncManager.SharingStarted); }
private void OnGestureInput(GestureInputEventArgs args) { _gestureInput?.Invoke(this, new GestureInputEventArguments(args)); }
public void OnOneHandTap(GestureInputEventArgs inputData) => StartCoroutine(ProcessGestureInputEvent(inputData, GestureType.OneHandTap));
public void OnManipulationEnd(GestureInputEventArgs inputData) => StartCoroutine(ProcessGestureInputEvent(inputData, GestureType.ManipulationEnd));
public void OnTwoHandManipStart(GestureInputEventArgs inputData) => StartCoroutine(ProcessGestureInputEvent(inputData, GestureType.TwoHandManipStart));