public override IEnumerator StartRoutine() { Touch = new LMTouchCtrl(); KeyportData = TGData.KeyPortData; if (KeyportData == null) { m_controller.ErrorQuit("训练器材 " + TGData.DeviceName + "不存在!"); } // 检测是否开启触屏模式 // 如果不是则开始安排线程接受端口数据 if (KeyportData.type != "touch") { yield return(StartCoroutine(ConnectDeviceRoutine())); } // 打开热图 m_controller.SetHeatmapEnable(KeyportData.heatmap && !TGData.SceneDetail.disableHeatmap); m_controller.ProgressValue += 0.1f; Debug.Log("输入设备配置完成"); }
public override void Init(TGController _controller, KeyPortData keyportData, int _com) { base.Init(_controller, keyportData, _com); //获取keyInputConfig.json里的行列数 ColumnCount = keyportData.width; RowCount = keyportData.height; }
public void Init(TGController _controller, KeyPortData keyportData, int _udp) { Init(_controller, keyportData); m_udp = _udp; m_endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), m_udp); m_client = new UdpClient(m_endPoint); }
public virtual void Init(TGController _controller, KeyPortData keyportData, int _com) { base.Init(_controller, keyportData); SerialPortCtrl = new LMSerialPortCtrl(); portInfo = new PortInfo(); portInfo.comName = "COM" + _com; portInfo.baudRate = 115200; }
public virtual void Init(LMBasePortInput _portInput) { m_solver = new TGExpressionParser(); m_portInput = _portInput; PortData = m_portInput.KeyportData; deviceType = PortData.type; InitInputs(PortData.input); InitValues(PortData.value); }
public override bool OnStart(KeyPortData portData) { base.OnStart(portData); if (!SerialPortCtrl.CheckPortAvailable(portInfo.comName)) { throw new InvalidPortNumberException(portInfo.comName); } ConnectPort(); return(true); }
// 获取合适的解释器 protected LMBasePortResolver GetProperResolver(KeyPortData portData) { LMBasePortResolver retval = null; Debug.Log("Port Data Type: " + portData.type); if (portData.type == "jy901") { retval = new JY901(); } else if (portData.type == "m7b" || portData.type == "m7b2D") { retval = new Leadiy_M7B(); } else if (portData.type == "key" || portData.type == "key2D") { retval = new LMKeyResolver(); } return(retval); }
public override bool OnStart(KeyPortData portData) { base.OnStart(portData); try { m_endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), m_udp); m_client = new UdpClient(m_endPoint); } catch (SocketException e) { ErrorTxt = e.Message; return(false); } TGController.Instance.DebugText("正在读取UDP"); m_receiveThread = new Thread(new ThreadStart(ReceiveData)); m_receiveThread.IsBackground = true; m_receiveThread.Start(); return(true); }
public override IEnumerator SetupRoutine() { touchCtrl = GetComponent <LMTouchCtrl>(); keyInputConfig = TGUtility.ParseConfigFile(configFileName); DeviceName = m_controller.gameConfig.GetValue("训练器材", string.Empty); KeyportData = keyInputConfig.GetKeyportData(DeviceName); if (KeyportData == null) { m_controller.ErrorQuit("训练器材 " + DeviceName + "不存在!"); yield break; } touchCtrl.enabled = KeyportData.type == "touch"; if (!touchCtrl.enabled) { // FIXME: Temperory if (KeyportData.type == "m7b" && m_gameConfig.evalData.isFullAxis) { KeyportData.type += "2D"; } portInput = GetProperInput(); if (!portInput.OnStart(KeyportData)) { m_controller.DebugText(portInput.ErrorTxt); touchCtrl.enabled = true; } } m_controller.SetHeatmapEnable(KeyportData.heatmap); Debug.Log("Input Setup Success"); yield return(1); }
public virtual void Init(TGController _controller, KeyPortData keyportData) { controller = _controller; KeyportData = keyportData; }
public virtual bool OnStart(KeyPortData portData) { KeyportData = portData; return(true); }