コード例 #1
0
 private void OnPointerUp(PointerEventData data)
 {
     eventVisualizer.gameObject.SetActive(false);
     if (_currentEventType == HoldEventRawData.EventType.Low || _isDataReceiving == false)
     {
         return;
     }
     releaseTime       = _threadTimer;
     _currentEventType = HoldEventRawData.EventType.Low;
     eventDataList.Add(new HoldEventRawData
     {
         StartAtInMillis = pressTime,
         EndAtInMillis   = releaseTime,
         HoldEventType   = HoldEventRawData.EventType.High
     });
 }
コード例 #2
0
    /// <summary>
    /// データ送信開始ビットを受け取ったら起動するコルーチン
    /// 10bitを受け取る時間が経過したら、_isDataReceivingフラグをOFFにする
    /// </summary>
    private IEnumerator DataReceivingCoroutine()
    {
        _isDataReceiving = true;
        _threadTimer     = 0;
        pressTime        = _threadTimer;
        releaseTime      = _threadTimer;
        yield return(new WaitForSeconds(touchWaitInSeconds));

        _timerLock        = false;
        _currentEventType = HoldEventRawData.EventType.Low;
        yield return(new WaitForSeconds(holdDurationInMillis / 1000.0f * bitDataLength + 0.5f));

        _isDataReceiving = false;
        _timerLock       = true;
        PrintAllQueue();
        DecodeHoldEventRawDataListToBits(eventDataList);
        eventDataList.Clear();
    }