public static void Recalibration() { if (IsPortActive) { PortInput.Recalibration(); } }
public void OnGameStart() { if (PortInput != null) { PortInput.SetTest(TGData.IsTesting); } }
public void UnplugInput() { if (PortInput != null) { PortInput.Close(); } }
public static async Task <List <PortResult> > IsPortOpen(PortInput input, IPortClient portClient) { var result = new List <PortResult>(); foreach (var port in input.Ports) { var isOpen = false; Exception exception = null; for (int i = 0; i < input.Retries; i++) { try { isOpen = await portClient.Check(input.Address, port, input.Timeout); if (isOpen) { break; } } catch (Exception exc) { exception = exc; } } result.Add(new PortResult { IsOpen = isOpen, Port = port, LastException = exception }); } return(result); }
void ReleaseDesignerOutlets() { if (BufferSizeInput != null) { BufferSizeInput.Dispose(); BufferSizeInput = null; } if (BufferSizeSlider != null) { BufferSizeSlider.Dispose(); BufferSizeSlider = null; } if (ChatMessageInput != null) { ChatMessageInput.Dispose(); ChatMessageInput = null; } if (ChatMessageList != null) { ChatMessageList.Dispose(); ChatMessageList = null; } if (ConnectButton != null) { ConnectButton.Dispose(); ConnectButton = null; } if (IPAddressInput != null) { IPAddressInput.Dispose(); IPAddressInput = null; } if (NameInput != null) { NameInput.Dispose(); NameInput = null; } if (PortInput != null) { PortInput.Dispose(); PortInput = null; } if (SendButton != null) { SendButton.Dispose(); SendButton = null; } }
public void OnUpdate() { if (Touch != null) { Touch.OnUpdate(); } if (PortInput != null) { PortInput.OnUpdate(); } }
public static Vector3 GetRawValues() { Vector3 retval = Vector3.zero; if (IsPortActive) { retval.x = PortInput.GetRawValue(0); retval.y = PortInput.GetRawValue(1); retval.z = PortInput.GetRawValue(2); } return(retval); }
private IEnumerator ConnectDeviceRoutine() { if (TGData.IsTesting) { Debug.Log("开启测试模式"); } // FIXME: Temperory if (KeyportData.type == "m7b" && TGData.evalData.isFullAxis) { KeyportData.type += "2D"; } PortInput = GetProperInput(); if (TGData.IsTesting) { yield break; } while (!PortInput.IsPortActive) { yield return(StartCoroutine(PortInput.OnStart())); if (!PortInput.IsPortActive) { int result = -1; TGDebug.ErrorBox(PortInput.ErrorTxt, 1, i => result = i, "取消", "确定"); yield return(new WaitUntil(() => result >= 0)); if (result == 0) { m_controller.Quit(); yield break; } TGDebug.MessageBox("重连中..."); yield return(new WaitForSecondsRealtime(0.1f)); } } TGDebug.ClearMessageBox(); }
void ReleaseDesignerOutlets() { if (BufferSizeInput != null) { BufferSizeInput.Dispose(); BufferSizeInput = null; } if (BufferSizeSlider != null) { BufferSizeSlider.Dispose(); BufferSizeSlider = null; } if (ChatMessageInput != null) { ChatMessageInput.Dispose(); ChatMessageInput = null; } if (ChatMessageList != null) { ChatMessageList.Dispose(); ChatMessageList = null; } if (ClientList != null) { ClientList.Dispose(); ClientList = null; } if (ClientTable != null) { ClientTable.Dispose(); ClientTable = null; } if (ClientColumn != null) { ClientColumn.Dispose(); ClientColumn = null; } if (NameInput != null) { NameInput.Dispose(); NameInput = null; } if (PortInput != null) { PortInput.Dispose(); PortInput = null; } if (SendButton != null) { SendButton.Dispose(); SendButton = null; } if (StartButton != null) { StartButton.Dispose(); StartButton = null; } if (StatusIndicator != null) { StatusIndicator.Dispose(); StatusIndicator = null; } if (StatusIndicatorText != null) { StatusIndicatorText.Dispose(); StatusIndicatorText = null; } }
public override Task <List <PortResult> > ProcessItem(PortInput item) { return(ScannersCommon.IsPortOpen(item, portClient)); }
public Task <List <PortResult> > CheckPort(PortInput item, IPortClient portClient) { this.portClient = portClient; return(ProcessItem(item)); }