diff --git a/Assets/RockVR/Video/Scripts/VideoCaptureCtrl.cs b/Assets/RockVR/Video/Scripts/VideoCaptureCtrl.cs index b804f6847af242fe5b1818d7f9c6c8c2cf2d634a..a3e9de891567a39183a09b9679b2391ace39c8f3 100644 --- a/Assets/RockVR/Video/Scripts/VideoCaptureCtrl.cs +++ b/Assets/RockVR/Video/Scripts/VideoCaptureCtrl.cs @@ -96,7 +96,7 @@ namespace RockVR.Video // Check if can start a capture session. if (!isCaptureAudio && videoCaptures.Length == 0) { - Debug.LogError( + Debug.LogWarning( "[VideoCaptureCtrl::StartCapture] StartCapture called " + "but no attached VideoRecorder or AudioRecorder were found!" ); diff --git a/Assets/Scripts/EyeTrackingCSV_Recorder.cs b/Assets/Scripts/EyeTrackingCSV_Recorder.cs index bc35fa9460618c5ab9a0894fe46422f601b75c2c..7a9a27f3cfb07b6eff6f9725c131971943309376 100644 --- a/Assets/Scripts/EyeTrackingCSV_Recorder.cs +++ b/Assets/Scripts/EyeTrackingCSV_Recorder.cs @@ -54,7 +54,7 @@ public class EyeTrackingCSV_Recorder : MonoBehaviour { //Create File Name and Path where the logged Data should be Saved - dateTimeFileName = DateTime.Now.ToString("MM/dd/yyyy hh-mm tt"); + dateTimeFileName = "EyeTracking-" + DateTime.Now.ToString("MM/dd/yyyy hh-mm tt"); dateTimeFileName = dateTimeFileName.Replace("/", "-"); FilePath = Application.dataPath; FilePath = FilePath + "/Data"; @@ -76,7 +76,7 @@ public class EyeTrackingCSV_Recorder : MonoBehaviour if (counter == 0) { //Header at top of CSV - await sw.WriteLineAsync("UnixTimeStamp;Time since GameStart;Origin V3(x,y,z);Direction V3(x,y,z);GazeRay isValid;isLeftEyeBlinking;isRightEyeBlinking;ScreenPositionfromWorldspace(pixelWidth, pixelHeight, WorldUnitsfromCamera);TriggerState;BallPosition(x,y,z);BallLockedonTarget;GazeHitPoint;Gaze to Target Distance; Ball to Target Distance"); + await sw.WriteLineAsync("UnixTimeStamp;Time since GameStart;Origin V3 X;Y;Z;Direction V3 X;Y;Z;GazeRay isValid;isLeftEyeBlinking;isRightEyeBlinking;ScreenPositionfromWorldspace pixelWidth;pixelHeight;WorldUnitsfromCamera;TriggerState;BallPositionX;Y;Z;BallLockedonTarget;GazeHitPoint;Gaze to Target Distance; Ball to Target Distance"); await sw.WriteLineAsync("SubjectID: " + RecordingController.Instance.SubjectID.ToString() + ";" + "ExperimentName: " + RecordingController.Instance.ExperimentName.ToString()); counter += 1; } diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 24371ffa70fb60de39dedd79d1a90741ed2314d3..fede0ca80194a453014aacff8595756e7d44e6f6 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -6,9 +6,12 @@ using UnityEngine; public class GameManager : MonoBehaviour { + [Record("SubjectID")] public int SubjectID; //Field to enter SUbj ID public String ExpName; public enum Group { A, B}; + + [Record("Group")] public Group group; public enum Hand { LeftHand, RightHand }; //select Hand that user is using public Hand hand; @@ -27,6 +30,7 @@ public class GameManager : MonoBehaviour End } + [Record("GameState")] public GameState _currentState; @@ -40,23 +44,29 @@ public class GameManager : MonoBehaviour public enum Condition { Motor, Gaze, Motor2Gaze, Gaze2Motor, BullsEye2Motor, Motor2BullsEye }; //Options to select Condition that shall be Played in Unity + [Record("Condition")] public Condition condition; //Debug Points shall be displayed or not? - + [Record("ThrowCounter")] public int ThrowCounter; public bool first; + [Record("ActiveTargetNr")] public int ActiveTargetNr; public bool ActGame; public bool finishedFirstCond; - private int Points; + [Record("Points")] + public int Points; - private string SysTimestampGamestart; - private string GameTimestampstart; - private string GameTimestampEnd; + [Record("SysTimestampGamestart")] + public string SysTimestampGamestart; + [Record("GameTimestampstart")] + public string GameTimestampstart; + [Record("GameTimestampEnd")] + public string GameTimestampEnd; private string SysTimestampGameEnd; public Material BWMaterial; @@ -128,6 +138,7 @@ public class GameManager : MonoBehaviour } Debug.Log("Finished Calibration"); _currentState = GameState.AfterEyeCalibration; + RecordingController.Instance.StartRecording(); ContinueStudy(); break; case GameState.AfterEyeCalibration: @@ -221,14 +232,29 @@ public class GameManager : MonoBehaviour { BallHandler.instance.ForceBallReset(Ball); } - - // if (ThrowCounter > (ThrowsInExperimentCondition-1) && ActGame == true) //Automatically end Game after desired number of throws have been reached - // { - // EndGame(); - // } + if (Input.GetKeyDown(KeyCode.Alpha1)) + { + var btn = FindObjectsOfType<ScaleButton>(); + if(btn.Length > 0) + QuestionnaireUIHandler.instance.ButtonSelected(btn[UnityEngine.Random.Range(0, btn.Length)]); + + } + + if (Input.GetKeyDown(KeyCode.Alpha2)) + { + QuestionnaireUIHandler.instance.ConfirmButtonSelected(); + + } + + + + // if (ThrowCounter > (ThrowsInExperimentCondition-1) && ActGame == true) //Automatically end Game after desired number of throws have been reached + // { + // EndGame(); + // } + - } public void StartQuestionnaire() diff --git a/Assets/Scripts/MainStudy_Recorder.cs b/Assets/Scripts/MainStudy_Recorder.cs index d40d792939bae67f5c51717f3aacb8dfaefb2371..6b9cc912cf6050b384bad1aa4df70ed7457039bd 100644 --- a/Assets/Scripts/MainStudy_Recorder.cs +++ b/Assets/Scripts/MainStudy_Recorder.cs @@ -19,10 +19,12 @@ public class MainStudy_Recorder : MonoBehaviour //string FilePath; public List<string> EyeTrackingDataBuffer = new List<string>(); - - Vector3 rayOrigin = new Vector3(); - Vector3 rayDirection = new Vector3(); - Vector3 screenPosition = new Vector3(); + [Record("rayOrigin")] + public Vector3 rayOrigin = new Vector3(); + [Record("rayDirection")] + public Vector3 rayDirection = new Vector3(); + [Record("screenPosition")] + public Vector3 screenPosition = new Vector3(); public Camera cam; @@ -52,10 +54,11 @@ public class MainStudy_Recorder : MonoBehaviour private void Start() //Initialize File Name and Path of Logging File. { - dateTimeFileName = DateTime.Now.ToString("MM/dd/yyyy hh-mm tt"); + dateTimeFileName = "Main-" + DateTime.Now.ToString("MM/dd/yyyy hh-mm tt"); dateTimeFileName = dateTimeFileName.Replace("/", "-"); FilePath = Application.dataPath; FilePath = FilePath + "/Data/Main"; + Directory.CreateDirectory(FilePath); Debug.Log("The EyeTracking Data will be Saved @:" + FilePath); } @@ -74,7 +77,7 @@ public class MainStudy_Recorder : MonoBehaviour { await sw.WriteLineAsync("UnixTime;GameTime;Cond;usedHand;BallsThrown;Round;Weight;Target;TargetActive?;GazeValid?;TriggerState;BallonTarget?;LockedGazetoTargDist;Gaze2Targ Dist;Ball2Targ Dist; Motor2Targ Dist;Motor2Gaze Dist;" + - "PointsMotor;ScorethisRound;TotalScore;MotorHitPoint X; Y;Z; Ball X;Y;Z;LockedGazePointX;Y;Z;GazeHitPointX;Y;Z;rayOriginX;Y;Z;rayDirectionX;Y;Z"); + "PointsMotor;ScorethisRound;TotalScore;MotorHitPoint X;Y;Z; Ball X;Y;Z;LockedGazePointX;Y;Z;GazeHitPointX;Y;Z;rayOriginX;Y;Z;rayDirectionX;Y;Z"); await sw.WriteLineAsync("SubjectID: " + RecordingController.Instance.SubjectID.ToString() + ";" + "ExperimentName: " + RecordingController.Instance.ExperimentName.ToString()); diff --git a/Assets/Scripts/UIScripts/QuestionnaireManager.cs b/Assets/Scripts/UIScripts/QuestionnaireManager.cs index c2bf940ccd6ba3cc774f04e4944ac357f9e22757..7e49febe1e115b7b422225d171dc6da3bc3823c9 100644 --- a/Assets/Scripts/UIScripts/QuestionnaireManager.cs +++ b/Assets/Scripts/UIScripts/QuestionnaireManager.cs @@ -16,6 +16,8 @@ public class QuestionnaireManager : MonoBehaviour public List<answer> AnswersduringTrial = new List<answer>(); public List<answer> AnswersFullQuestionnaire = new List<answer>(); + private int QuestionID = 0; + private void Awake() { if (instance != null && instance != this) @@ -41,7 +43,7 @@ public class QuestionnaireManager : MonoBehaviour public void logAnswer(string question, int answer) { - + RecordingController.Instance.Info.AddSetting($"{QuestionID++} - {question}", $"{answer}"); if (fullQuestionnaireActive) { AnswersFullQuestionnaire.Add(new answer(question, answer)); diff --git a/Assets/VRRecorder/RecordingController.cs b/Assets/VRRecorder/RecordingController.cs index 27ce2c88f9120575c5ac4c99e11b10498cab4071..53fe4966f41411973e565648e01bbd1f88065386 100644 --- a/Assets/VRRecorder/RecordingController.cs +++ b/Assets/VRRecorder/RecordingController.cs @@ -22,7 +22,7 @@ public class RecordingController : MonoBehaviour private List<GameObjectRecording> GameObjectRecordings; private RecordingModel Model; - private RecordingInfo Info; + public RecordingInfo Info; private RecordingStatus Status; private VideoCaptureCtrl _videoCapture; @@ -142,7 +142,7 @@ public class RecordingController : MonoBehaviour Status = RecordingStatus.Recording; CaptureScreenshotForOverview(); - _videoCapture.StartCapture(); + //_videoCapture.StartCapture(); } // Uses the screenshot camera to capture a screenshot