Пример #1
0
 void startGame()
 {
     foreach (LineUp2 l in spaces)
     {
         l.taken = true;
         l.player.GetComponent <PlayerStats2>().playing = true;
     }
     levelDifferential = findLvlDifferential();
     avgPing           = findPing();
     DataRecorded.logPing(avgPing);
     DataRecorded.logLvlDif(levelDifferential);
 }
Пример #2
0
        public void KeyWasPressed(char charPressed, long timeInTicks)
        {
            timeSinceLastAction = timeInTicks;
            ResetTimer();

            if (keysCurrentlyHeld.ContainsKey(charPressed))
            {
                return;
            }

            keysCurrentlyHeld.Add(charPressed, timeInTicks);



            if (CurrentState.Equals(SessionState.Inactive))
            {
                CurrentState = SessionState.Active;
            }
            else
            {
                DataRecorded.Last().SecondChar = charPressed;

                DataRecorded.Last().CombinationID = HelperFunctions.GetCombinationId(lastKeyPress, charPressed);


                if (!NextKeyAlreadyPressed(DataRecorded.Last()))
                {
                    DataRecorded.Last().FlightTime = TimeSpan.FromTicks(timeInTicks - KeysPressedAndReleased.Last().TimeReleasedInTicks);
                }

                DataRecorded.Last().Digraph1 = TimeSpan.FromTicks(timeInTicks - timeOfPreviousPress);

                DataRecorded.Last().WaitingForEvents.Remove(KeysData.WaitingForEvent.ESecondKeyPress);
            }

            KeysPressedAndReleased.Add(new KeyPressRelease(charPressed, timeInTicks));


            KeysData keysData = new KeysData
            {
                FirstChar = charPressed
            };

            DataRecorded.Add(keysData);


            UnprocessedData.Add(keysData);

            timeOfPreviousPress = timeInTicks;
            lastKeyPress        = charPressed;
        }
        /// <summary>
        /// OnThreadRecording
        /// </summary>
        private void OnThreadRecording()
        {
            while (true)
            {
                AutoResetEventDataRecorded.WaitOne();


                if (CurrentRecordedHeader->dwBytesRecorded > 0)
                {
                    Byte[] bytes = new Byte[CurrentRecordedHeader->dwBytesRecorded];
                    Marshal.Copy(CurrentRecordedHeader->lpData, bytes, 0, (int)CurrentRecordedHeader->dwBytesRecorded);

                    DataRecorded?.Invoke(bytes);

                    for (int i = 0; i < WaveInHeaders.Length; i++)
                    {
                        if ((WaveInHeaders[i]->dwFlags & Win32.WaveHdrFlags.WHDR_INQUEUE) == 0)
                        {
                            Win32.MMRESULT hr = Win32.waveInAddBuffer(hWaveIn, WaveInHeaders[i], sizeof(Win32.WAVEHDR));
                        }
                    }
                }
            }
        }
Пример #4
0
 public void RemoveLastDataItem()
 {
     DataRecorded.Remove(DataRecorded.Last());
 }
Пример #5
0
 private KeysData KeysDataWhereSecondCharIs(char secondChar)
 {
     return(DataRecorded.LastOrDefault(x => x.SecondChar == secondChar));
 }
Пример #6
0
 private KeysData KeysDataWhereFirstCharIs(char firstChar)
 {
     return(DataRecorded.LastOrDefault(x => x.FirstChar == firstChar));
 }
Пример #7
0
 void OnDestroy()
 {
     DataRecorded.logWaitTime(waitTime);
 }