public KeyboardHelper(InputReference inputReference) { if (inputReference.InputElement.IsLoaded) DoHookKeyboardDown(); else inputReference.InputElement.Loaded += (s, e) => DoHookKeyboardDown(); }
public CurveDrawingSurface( ICurvePool curvePool, InputReference inputReference) { RenderOptions.SetBitmapScalingMode(this, BitmapScalingMode.Linear); // Wichtig für "Pan" und "Zoom" ClipToBounds = true; _curvePool = curvePool; _curvePool.CurveAdded += OnCurveAdded; _curvePool.CurveRemoved += OnCurveRemoved; inputReference.InputElement.MouseMove += (s, e) => HandleMouseMove(e); inputReference.InputElement.MouseLeave += (s, e) => HandleMouseLeave(e); inputReference.InputElement.MouseLeftButtonUp += (s, e) => HandleMouseLeftButtonUp(e); inputReference.InputElement.MouseLeftButtonDown += (s, e) => HandleMouseLeftButtonDown(e); inputReference.InputElement.MouseRightButtonUp += (s, e) => HandleMouseRightButtonUp(e); inputReference.InputElement.MouseRightButtonDown += (s, e) => HandleMouseRightButtonDown(e); _redrawSubject = new Subject<object>(); _redrawSubject //.Skip(1) .Throttle(TimeSpan.FromMilliseconds(50)) .Subscribe(it => _redrawEvent.Set()); _redrawThread = new Thread(RedrawThreadProc); _redrawThread.IsBackground = true; _redrawThread.SetApartmentState(ApartmentState.STA); _redrawThread.Start(); }
public SectionZoomManager( InputReference inputReference, TimeAxis timeAxis, IDoubleAxesGroupPool axesGroupPool, IDrawingAreaInfo drawingAreaInfo, IOnlineMode onlineMode) { _timeAxis = timeAxis; _axesGroupPool = axesGroupPool; _drawingAreaInfo = drawingAreaInfo; _onlineMode = onlineMode; // TODO: abhängen _onlineMode.IsOnlineChanged += (s, e) => { if (_onlineMode.IsOnline) IsActive = false; }; InitializeComponent(); // Preview-Event ist wichtig, damit alle anderen Elemente nicht informiert werden inputReference.InputElement.PreviewMouseLeftButtonDown += InputElement_PreviewMouseLeftButtonDown; MouseMove += this_MouseMove; MouseLeftButtonUp += this_MouseLeftButtonUp; }
public InputButton GetInputReference(InputReference reference) { switch (reference) { case InputReference.Jump: return(jumpButton); case InputReference.Walk: return(walkButton); case InputReference.Roll: return(rollButton); case InputReference.Crouch: return(crouchButton); case InputReference.Crawl: return(crawlButton); case InputReference.Drop: return(dropButton); case InputReference.Interact: return(interactButton); case InputReference.Toggle: return(toggleWeaponButton); case InputReference.RightWeapon: return(rightWeaponButton); case InputReference.LeftWeapon: return(leftWeaponButton); case InputReference.Zoom: return(zoomButton); case InputReference.Fire: return(fireButton); case InputReference.Reload: return(reloadButton); case InputReference.Action01: return(action01); case InputReference.Action02: return(action02); case InputReference.Action03: return(action03); default: return(walkButton); } }
public override ValueTask SelectRangeAsync(int pos1, int pos2) { if (_mask == null) { return(InputReference.SelectRangeAsync(pos1, pos2)); } else { return(_maskReference.SelectRangeAsync(pos1, pos2)); } }
public override ValueTask SelectAsync() { if (_mask == null) { return(InputReference.SelectAsync()); } else { return(_maskReference.SelectAsync()); } }
/// <summary> /// Clear the text field, set Value to default(T) and Text to null /// </summary> /// <returns></returns> public Task Clear() { if (_mask == null) { return(InputReference.SetText(null)); } else { return(_maskReference.Clear()); } }
/// <summary> /// Sets the input text from outside programmatically /// </summary> /// <param name="text"></param> /// <returns></returns> public Task SetText(string text) { if (_mask == null) { return(InputReference?.SetText(text)); } else { return(_maskReference.Clear().ContinueWith(t => _maskReference.OnPaste(text))); } }
protected override void ResetValue() { if (_mask == null) { InputReference.Reset(); } else { _maskReference.Reset(); } base.ResetValue(); }
/// <summary> /// Sets the input text from outside programmatically /// </summary> /// <param name="text"></param> /// <returns></returns> public async Task SetText(string text) { if (_mask == null) { if (InputReference != null) { await InputReference.SetText(text); } return; } await _maskReference.Clear(); _maskReference.OnPaste(text); }
void Update() { if (lensCapAnimation.lensCapState == LensCapState.OPEN) { canOpenMenu = true; } if (InputReference.GetOpenMenu() && canOpenMenu) { lensCapAnimation.SwitchLensCapState(LensCapState.CLOSING); StartCoroutine(waitForLensToClose()); } if (paused) { if (InputReference.GetMenuHorizontalAxis() < 0 && canTurn) { canTurn = false; menuRotate.SetTrigger("turnClockwise"); telescopeCreak.zoomInCreak(); } else if (InputReference.GetMenuHorizontalAxis() > 0 && canTurn) { canTurn = false; menuRotate.SetTrigger("turnAnticlockwise"); telescopeCreak.zoomOutCreak(); } else if (InputReference.GetMenuHorizontalAxis() == 0) { canTurn = true; } if (InputReference.GetMenuSubmit()) { if (menuRotate.GetCurrentAnimatorStateInfo(0).IsName("MenuRotationContinue")) { CloseMenu(); } else if (menuRotate.GetCurrentAnimatorStateInfo(0).IsName("MenuRotationObservatory")) { zoomController.GoToObservatory(); CloseMenu(); } else if (menuRotate.GetCurrentAnimatorStateInfo(0).IsName("MenuRotationQuit")) { Application.Quit(); } } } }
void UpdateOverlay() { bool firstZoomBegan = InputReference.GetFirstZoomBegan(); bool firstZoomEnded = InputReference.GetFirstZoomEnded(); float zoomInput = GetZoomInput(); if (firstZoomBegan && zoomInput == 1) { telescopeOverlayAnimator.ResetTrigger("zoomOutStarted"); telescopeOverlayAnimator.ResetTrigger("zoomEnded"); telescopeOverlayAnimator.SetTrigger("zoomInStarted"); InputReference.VibrateZoomIn(); if (!menu.paused) { telescopeCreak.zoomInCreak(); } } else if (firstZoomBegan && zoomInput == -1) { telescopeOverlayAnimator.ResetTrigger("zoomInStarted"); telescopeOverlayAnimator.ResetTrigger("zoomEnded"); telescopeOverlayAnimator.SetTrigger("zoomOutStarted"); InputReference.VibrateZoomOut(); if (!menu.paused) { telescopeCreak.zoomOutCreak(); } } else if (firstZoomEnded) { telescopeOverlayAnimator.ResetTrigger("zoomInStarted"); telescopeOverlayAnimator.ResetTrigger("zoomOutStarted"); telescopeOverlayAnimator.SetTrigger("zoomEnded"); if (!menu.paused) { telescopeCreak.returnCreak(); } } telescopeRingRotate.Rotate(zoomInput * Time.deltaTime); Vector2 panAmount = new Vector2(InputReference.GetHorizontalAxis(), InputReference.GetVerticalAxis()); telescopeOverlayAnimator.transform.localPosition = Vector2.Lerp(telescopeOverlayAnimator.transform.localPosition, panAmount * overlayPanDistance, Time.deltaTime * overlayPanSpeed); }
public float GetZoomInput() { float zoomIn = InputReference.GetZoomIn() ? 1 : 0; float zoomOut = InputReference.GetZoomOut() ? -1 : 0; float zoomScroll = InputReference.GetZoomAxis() * scrollSpeed; #if UNITY_EDITOR if (Input.GetKey(KeyCode.LeftAlt)) { zoomIn *= 10; zoomOut *= 10; } #endif float zoomInput = zoomScroll + zoomIn + zoomOut; return(zoomInput); }
void UpdateView() { //zoom float scaledZoomSpeed = zoomSpeed * zoomSize; float zoomAmount = GetZoomInput() * scaledZoomSpeed * Time.deltaTime; zoomSize += zoomAmount; CheckZoomZones(); if (Camera.main.orthographic) { Camera.main.orthographicSize = zoomSize; Camera.main.transform.localScale = Vector3.one * zoomSize; } else { Camera.main.fieldOfView = zoomSize; } //pan float scaledPanSpeed = panSpeed * zoomSize; #if UNITY_EDITOR if (Input.GetKey(KeyCode.LeftAlt)) { scaledPanSpeed *= 10; } #endif Camera.main.transform.position += new Vector3(InputReference.GetHorizontalAxis(), InputReference.GetVerticalAxis()) * Time.deltaTime * scaledPanSpeed; if (gameState == GameState.INTRO) { Camera.main.transform.position = new Vector3(Mathf.Clamp(Camera.main.transform.position.x, startPos.x - distanceFromStartPos, startPos.x + distanceFromStartPos), Mathf.Clamp(Camera.main.transform.position.y, startPos.y - distanceFromStartPos, startPos.y + distanceFromStartPos), Camera.main.transform.position.z); if (zoomSize > maxZoomSize) { zoomSize = Mathf.Lerp(zoomSize, maxZoomSize, Time.deltaTime); } } }
private void Awake() { InputReference.GetPlayerID(); }