public void Init(Touchscreen touchscreen) { this.touchscreen = touchscreen; this.lbName.Text = this.touchscreen.Name; this.lbIsReadyScan1.Text = ""; this.lbIsReadyScan2.Text = ""; }
protected void OnEnable() { if (simulatedTouchscreen != null) { if (!simulatedTouchscreen.added) { InputSystem.AddDevice(simulatedTouchscreen); } } else { simulatedTouchscreen = InputSystem.GetDevice("Simulated Touchscreen") as Touchscreen; if (simulatedTouchscreen == null) { simulatedTouchscreen = InputSystem.AddDevice <Touchscreen>("Simulated Touchscreen"); } } if (m_Touches == null) { m_Touches = new SimulatedTouch[simulatedTouchscreen.touches.Count]; } foreach (var device in InputSystem.devices) { OnDeviceChange(device, InputDeviceChange.Added); } InputSystem.onDeviceChange += OnDeviceChange; }
private Page(Session client, Target target, FrameTree frameTree, bool ignoreHTTPSErrors, TaskQueue screenshotTaskQueue) { _client = client; _target = target; Keyboard = new Keyboard(client); _mouse = new Mouse(client, Keyboard); Touchscreen = new Touchscreen(client, Keyboard); _frameManager = new FrameManager(client, frameTree, this); _networkManager = new NetworkManager(client, _frameManager); _emulationManager = new EmulationManager(client); Tracing = new Tracing(client); _pageBindings = new Dictionary <string, Func <object> >(); _ignoreHTTPSErrors = ignoreHTTPSErrors; _screenshotTaskQueue = screenshotTaskQueue; //TODO: Do we need this bubble? _frameManager.FrameAttached += (sender, e) => FrameAttached?.Invoke(this, e); _frameManager.FrameDetached += (sender, e) => FrameDetached?.Invoke(this, e); _frameManager.FrameNavigated += (sender, e) => FrameNavigated?.Invoke(this, e); _networkManager.RequestCreated += (sender, e) => RequestCreated?.Invoke(this, e); _networkManager.RequestFailed += (sender, e) => RequestFailed?.Invoke(this, e); _networkManager.ResponseCreated += (sender, e) => ResponseCreated?.Invoke(this, e); _networkManager.RequestFinished += (sender, e) => RequestFinished?.Invoke(this, e); _client.MessageReceived += client_MessageReceived; }
public static void Initialize() { Keyboard = GetOrAddDevice <Keyboard>(); RemoteMouse = InputSystem.AddDevice <Mouse>(); Touch = GetOrAddDevice <Touchscreen>(); m_isInitialized = true; }
public override void OnCreate() { var playerSettings = PlayerSettings.GetSerializedObject(); #if UNITY_2020_2_OR_NEWER var activeInputHandler = playerSettings.FindProperty("activeInputHandler").intValue; m_InputSystemEnabled = activeInputHandler == 1 || activeInputHandler == 2; #else m_InputSystemEnabled = playerSettings.FindProperty("enableNativePlatformBackendsForNewInputSystem").boolValue; #endif if (m_InputSystemEnabled) { m_DisabledDevices = new List <InputDevice>(); // deviceSimulator is never null when the plugin is instantiated by a simulator window, but it can be null during unit tests if (deviceSimulator != null) { deviceSimulator.touchScreenInput += OnTouchEvent; } InputSystem.onDeviceChange += OnDeviceChange; // UGUI elements like a button don't get pressed when multiple pointers for example mouse and touchscreen are sending data at the same time foreach (var device in InputSystem.devices) { DisableConflictingDevice(device); } SimulatorTouchscreen = InputSystem.AddDevice <Touchscreen>("Device Simulator Touchscreen"); } }
public void SetTouch(int touchId, TouchPhase phase, Vector2 position, float pressure, Vector2 delta = default, bool queueEventOnly = true, Touchscreen screen = null, double time = -1, double timeOffset = 0) { if (screen == null) { screen = Touchscreen.current; if (screen == null) { screen = InputSystem.AddDevice <Touchscreen>(); } } InputSystem.QueueStateEvent(screen, new TouchState { touchId = touchId, phase = phase, position = position, delta = delta, pressure = pressure, }, (time >= 0 ? time : InputState.currentTime) + timeOffset); if (!queueEventOnly) { InputSystem.Update(); } }
void Update() { Touchscreen touchscreen = Touchscreen.current; if (touchscreen != null && m_touchInfo != null) { int j = 0; for (int i = 0; i < touchscreen.touches.Count; i++) { TouchControl touch = touchscreen.touches[i]; if (touch.isInProgress) { string touchInfo = touch.touchId.ReadValue() + "\n" + touch.phase.ReadValue().ToString() + "\n" + touch.position.ReadValue().ToString() + "\n" + touch.pressure.ReadValue().ToString() + "\n" + touch.radius.ReadValue().ToString() + "\n" + touch.delta.ReadValue().ToString(); m_touchInfo.AddNewInputInfo(touchInfo, j); j++; } } m_touchInfo.MaxISXCount = j; } }
public void SetTouch(int touchId, TouchPhase phase, Vector2 position, float pressure, Vector2 delta = default, bool queueEventOnly = true, Touchscreen screen = null, double time = -1, double timeOffset = 0) { if (screen == null) { screen = Touchscreen.current; if (screen == null) { throw new InvalidOperationException("No touchscreen has been added"); } } InputSystem.QueueStateEvent(screen, new TouchState { touchId = touchId, phase = phase, position = position, delta = delta, pressure = pressure, }, (time >= 0 ? time : InputRuntime.s_Instance.currentTime) + timeOffset); if (!queueEventOnly) { InputSystem.Update(); } }
public void SetDevice(InputDevice device, bool add = false) { switch (device) { case Mouse mouse: m_mouse = add ? mouse : null; return; case Keyboard keyboard: m_keyboard = add ? keyboard : null; if (add) { m_keyboard.onTextInput += OnTextInput; } return; case Touchscreen screen: m_screen = add ? screen : null; if (noticeTouchControl != null) { noticeTouchControl.SetActive(add); } return; } }
void OnPlaceJoystick(InputAction.CallbackContext context) { if (!m_WalkModeEnableSelector.GetValue() || m_FirstPersonController.GetJoystickTouch() != null) { return; } Touchscreen touchscreen = Touchscreen.current; if (touchscreen != null) { foreach (var touch in touchscreen.touches) { var pos = touch.position.ReadValue(); if (touch.isInProgress && (IsLeftSide(pos) || m_FirstPersonController.GetJoystickTouch() == touch) && m_FirstPersonController.IsTouchControlDifferent()) { m_LeftJoystick.transform.position = pos; m_FirstPersonController.SetJoystickTouch(touch); EnableJoystick(true); } } } }
private void OnDisable() { if (m_FakeTouchScreen != null) { InputSystem.RemoveDevice(m_FakeTouchScreen); m_FakeTouchScreen = null; } }
public static void Initialize() { Keyboard = InputSystem.AddDevice <Keyboard>(); RemoteMouse = InputSystem.AddDevice <Mouse>(); EnhancedTouchSupport.Enable(); RemoteTouch = InputSystem.AddDevice <Touchscreen>(); m_isInitialized = true; }
public void SetInput(IInput input) { m_mouse = input.RemoteMouse; m_keyboard = input.RemoteKeyboard; m_screen = input.RemoteTouchscreen; m_gamepad = input.RemoteGamepad; m_keyboard.onTextInput += OnTextInput; }
public void SetInput(IInput input) { m_mouse = input.RemoteMouse; m_keyboard = input.RemoteKeyboard; m_screen = input.RemoteTouchscreen; m_gamepad = input.RemoteGamepad; uiController.SetInput(input); }
public static void Initialize() { Keyboard = InputSystem.AddDevice <Keyboard>(); RemoteMouse = InputSystem.AddDevice <Mouse>(); EnhancedTouchSupport.Enable(); RemoteTouch = InputSystem.AddDevice <Touchscreen>(); GamepadsStates = new Dictionary <double, GamepadState>(); GamepadsMap = new Dictionary <double, int>(); m_isInitialized = true; }
//--------------------------------------------------------------------------------------------------------------------- public static void Destroy() { InputSystem.RemoveDevice(RemoteMouse); InputSystem.RemoveDevice(Keyboard); EnhancedTouchSupport.Disable(); InputSystem.RemoveDevice(RemoteTouch); RemoteMouse = null; Keyboard = null; RemoteTouch = null; m_isInitialized = false; }
// Start is called before the first frame update void Start() { m_Devices = new Devices(); bool injectFakeTouchscreen = Configuration.Instance.OldInputEnabled; #if UNITY_EDITOR injectFakeTouchscreen = true; #endif if (injectFakeTouchscreen) { m_FakeTouchScreen = InputSystem.AddDevice <Touchscreen>("Fake Touchscreen"); } }
// Update is called once per frame void Update() { Touchscreen touchscreen = UnityEngine.Experimental.Input.Touchscreen.current; Vector3 averagePosition = Vector2.zero; if (touchscreen == null) { Debug.Log("No touchscreen :-("); return; } if (touchscreen.activeTouches.Count == 0) { m_AveragePositionMarker.SetActive(false); DeleteExtraTouches(touchscreen.activeTouches.Count); return; } else { m_AveragePositionMarker.SetActive(true); } // Set touch indicator position values, creating them if necessary // Also start accumulating average position // for (int i = 0; i < touchscreen.activeTouches.Count; i++) { // Create new indicator if necessary if (i >= m_Touches.Count) { m_Touches.Add(Instantiate <GameObject>(touchPositionIndicatorPrefab)); } m_Touches[i].transform.position = m_MainCamera.ScreenToWorldPoint( new Vector3(touchscreen.activeTouches[i].position.ReadValue().x, touchscreen.activeTouches[i].position.ReadValue().y, m_MainCamera.nearClipPlane)); // Accumulate average position. Division happens later averagePosition += m_Touches[i].transform.position; } // Set average indicator value // averagePosition /= touchscreen.activeTouches.Count; m_AveragePositionMarker.transform.position = averagePosition; DeleteExtraTouches(touchscreen.activeTouches.Count); }
public void SetInput(IInput input) { m_mouse = input.RemoteMouse; m_keyboard = input.RemoteKeyboard; m_screen = input.RemoteTouchscreen; m_gamepad = input.RemoteGamepad; hasInputBeenSet = true; if (uiController != null) { uiController.SetInput(input); } }
void Update() { Touchscreen touchscreen = UnityEngine.Experimental.Input.Touchscreen.current; if ((touchscreen != null) && (touchIndex < touchscreen.activeTouches.Count)) { coordinateText.text = touchscreen.activeTouches[touchIndex].ReadValue().position.x.ToString("0000") + ", " + touchscreen.activeTouches[touchIndex].ReadValue().position.y.ToString("0000"); image.color = Color.red; } else { image.color = Color.white; } }
public void RunTouchscreenTest(bool single, bool stop) { if (single) { Touchscreen touchscreen = new Touchscreen(F1, COMPort); touchscreen.Start_Test(); } else { if (F1.getCheckStatus((COMPort == 1) ? (F1.TouchscreenCheck) : (F1.TouchscreenCheck2)) && !stop) { Touchscreen touchscreen = new Touchscreen(F1, COMPort); touchscreen.Start_Test(); } } }
protected internal virtual void Update() { Elapsed = timeScale * step * 0.001f; lock (motionEvents) { Touchscreen.ProcessTouchEvents(motionEvents); motionEvents.Clear(); } lock (keysEvents) { Keys.ProcessTouchEvents(keysEvents); keysEvents.Clear(); } Scene.Update(); Camera.UpdateAll(); }
//--------------------------------------------------------------------------------------------------------------------- public static void Destroy() { InputSystem.RemoveDevice(RemoteMouse); InputSystem.RemoveDevice(Keyboard); EnhancedTouchSupport.Disable(); InputSystem.RemoveDevice(RemoteTouch); var totalRemoteGamepads = Gamepad.all.Count - GamepadsMap.Count; for (int i = Gamepad.all.Count - 1; i >= totalRemoteGamepads; i--) { InputSystem.RemoveDevice(Gamepad.all[i]); } GamepadsStates.Clear(); RemoteMouse = null; Keyboard = null; RemoteTouch = null; m_isInitialized = false; }
public InputSystemBackend() { // UGUI gets confused when multiple pointers for example mouse and touchscreen are sending data at the same time. // @rene recommended disabling all native mice. m_DisabledDevices = new List <InputDevice>(); foreach (var device in InputSystem.devices) { if (device.native && device is Mouse && device.enabled) { InputSystem.DisableDevice(device); m_DisabledDevices.Add(device); } } if (Touchscreen.current == null) { m_SimulatorTouchscreen = InputSystem.AddDevice <Touchscreen>(); } }
public void SetDevice(InputDevice device) { switch (device) { case Mouse mouse: m_mouse = mouse; return; case Keyboard keyboard: m_keyboard = keyboard; return; case Touchscreen screen: m_screen = screen; return; case Gamepad pad: m_gamepad = pad; return; } }
public override void OnCreate() { m_InputSystemEnabled = EditorPlayerSettingHelpers.newSystemBackendsEnabled; if (m_InputSystemEnabled) { m_DisabledDevices = new List <InputDevice>(); // deviceSimulator is never null when the plugin is instantiated by a simulator window, but it can be null during unit tests if (deviceSimulator != null) { deviceSimulator.touchScreenInput += OnTouchEvent; } InputSystem.onDeviceChange += OnDeviceChange; // UGUI elements like a button don't get pressed when multiple pointers for example mouse and touchscreen are sending data at the same time foreach (var device in InputSystem.devices) { DisableConflictingDevice(device); } SimulatorTouchscreen = InputSystem.AddDevice <Touchscreen>("Device Simulator Touchscreen"); } }
void SetDevice(InputDevice device, bool add = true) { uiController?.SetDevice(device, add); switch (device) { case Mouse mouse: m_mouse = add ? mouse : null; return; case Keyboard keyboard: m_keyboard = add ? keyboard : null; return; case Touchscreen screen: m_screen = add ? screen : null; return; case Gamepad pad: m_gamepad = add ? pad : null; return; case Gyroscope gyroscope: m_gyroscpe = add ? gyroscope : null; return; case TrackedDevice tracker: m_tracker = add ? tracker : null; return; #if URS_USE_AR_SUBSYSTEMS case HandheldARInputDevice handheld: m_handheld = handheld; return; #endif } }
public void OnResizeObject() { if (!enabled) { return; } if (EventSystem.current.IsPointerOverGameObject(0)) { return; } Touchscreen ts = Touchscreen.current; if (ts.touches[0].isInProgress && ts.touches[1].isInProgress) { Vector2 pos = ts.touches[0].position.ReadValue(); Vector2 pos1 = ts.touches[1].position.ReadValue(); TouchToResize(pos, pos1); } else { previousDistance = 0; } }
public void CancelTouch(int touchId, Vector2 position, Vector2 delta = default, bool queueEventOnly = false, Touchscreen screen = null, double time = -1, double timeOffset = 0) { SetTouch(touchId, TouchPhase.Canceled, position, delta, queueEventOnly, screen: screen, time: time, timeOffset: timeOffset); }
public void BeginTouch(int touchId, Vector2 position, bool queueEventOnly = false, Touchscreen screen = null, double time = -1, double timeOffset = 0) { SetTouch(touchId, TouchPhase.Began, position, queueEventOnly: queueEventOnly, screen: screen, time: time, timeOffset: timeOffset); }