Пример #1
0
        public override string ToString()
        {
            var responseBodyLength = 0;

            if (ResponseBody != null)
            {
                responseBodyLength = ResponseBody.Length;
            }
            var requestTime   = RequestTime.ToString("yyyy-MM-dd HH:mm:ss.fff");
            var responseTime  = ResponseTime.ToString("yyyy-MM-dd HH:mm:ss.fff");
            var requestHeader = string.Empty;

            if (RequestHeader != null && RequestHeader.Count > 0)
            {
                requestHeader = string.Join(",", RequestHeader.Select(x => string.Format("{0}:{1}", x.Key, x.Value)));
            }
            var responseHeader = string.Empty;

            if (ResponseHeader != null && ResponseHeader.Count > 0)
            {
                responseHeader = string.Join(",", ResponseHeader.Select(x => string.Format("{0}:{1}", x.Key, x.Value)));
            }

            return(string.Format("[RequestType:{0}, RequestCode:{1}, RequestSequence:{2}, RequestTime:{3}, RequestHeader: [{4}], ResponseCode:{5}, ResponseTime:{6}, ResponseBodyLength:{7}, ResponseHeader: [{8}]]",
                                 RequestType, RequestCode, RequestSequence, requestTime, requestHeader, ResponseCode, responseTime, responseBodyLength, responseHeader));
        }
Пример #2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (scheduleTime_ != null)
            {
                hash ^= ScheduleTime.GetHashCode();
            }
            if (dispatchTime_ != null)
            {
                hash ^= DispatchTime.GetHashCode();
            }
            if (responseTime_ != null)
            {
                hash ^= ResponseTime.GetHashCode();
            }
            if (responseStatus_ != null)
            {
                hash ^= ResponseStatus.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #3
0
        public XmlNode ToXmlNode(XmlDocument xDoc)
        {
            XmlNode xInput = xDoc.CreateElement("Input");

            // TODO: Add Description and Groupings
            xInput.AppendChild(xDoc.CreateElement("Value")).InnerText        = _value;
            xInput.AppendChild(xDoc.CreateElement("RequestTime")).InnerText  = RequestTime.ToString();
            xInput.AppendChild(xDoc.CreateElement("ResponseTime")).InnerText = ResponseTime.ToString();
            xInput.AppendChild(xDoc.CreateElement("Delay")).InnerText        = Delay.Value.Ticks.ToString();
            xInput.AppendChild(xDoc.CreateElement("Method")).InnerText       = Method.ToString();
            xInput.AppendChild(xDoc.CreateElement("Description")).AppendChild(xDoc.CreateCDataSection(Description));
            if (OptionReference != null)
            {
                xInput.AppendChild(OptionReference.ToXmlNode(xDoc));
            }
            var xInputTransforms = xInput.AppendChild(xDoc.CreateElement("Transforms"));

            if (Transforms?.Length > 0)
            {
                foreach (InputTransform inputTransform in Transforms)
                {
                    xInputTransforms.AppendChild(inputTransform.ToXmlNode(xDoc));
                }
            }

            return(xInput);
        }
Пример #4
0
    void Start()

    {
        ResponseTime = GameObject.FindGameObjectWithTag("ResponseTime").GetComponent <ResponseTime>();
        updateTimer  = true;
        WaitTimer    = 00.0f;
    }
Пример #5
0
    // Update is called once per frame
    private void FixedUpdate()
    {
        position     = transform.position; positionX = position.x; positionY = position.y; positionZ = position.z;
        ResponseTime = GameObject.FindGameObjectWithTag("ResponseTime").GetComponent <ResponseTime>();
        Level2       = GameObject.FindGameObjectWithTag("Player").GetComponent <Level2>();
        frame        = Time.frameCount;
        clock       += Time.deltaTime * 1;

        if (positionZ >= forward)
        {
            transform.GetChild(0).gameObject.SetActive(true);
            if (!lean)
            {
                StreamWriter sw = File.AppendText(Variables.folder + "Error_Count_Participant" + Variables.participant + ".csv");
                sw.WriteLine(Error + "," + Level2.Trial + "," + ResponseTime.Trial + "," + frame + "," + ResponseTime.levelTimer + "," + clock);
                sw.Close();
                lean = true;
                Error++;
            }
        }
        else
        {
            lean = false;
            transform.GetChild(0).gameObject.SetActive(false);
        }
    }
Пример #6
0
    // Update is called once per frame
    private void FixedUpdate()
    {
        ResponseTime = GameObject.FindGameObjectWithTag("ResponseTime").GetComponent <ResponseTime>();

        rotation = transform.rotation; rotationX = rotation.x; rotationY = rotation.y; rotationZ = rotation.z;// These grab the rotation and position data from the object it is attached to
        position = transform.position; positionX = position.x; positionY = position.y; positionZ = position.z;

        frame = Time.frameCount; clock += Time.deltaTime * 1; trutrial = ResponseTime.trialminusprac + 1;


        if (ResponseTime.ParticipantReady == false)
        {
            IsWait = 1;
        }
        else
        {
            IsWait = 0;
        }


        if (ResponseTime.posrecording == true)
        {
            Istrial = 1;
        }
        else
        {
            Istrial = 0;
        }



        StreamWriter sw = File.AppendText(Variables.folder + "PositionDataHead" + Variables.participant + ".csv");// This is where the data will be written

        sw.WriteLine(rotationX + "," + rotationY + "," + rotationZ + "," + positionX + "," + positionY + "," + positionZ + "," + frame + "," + clock + "," + ResponseTime.levelTimer + "," + ResponseTime.trueblock + "," + trutrial + "," + ResponseTime.Trial + "," + Order.Condition + "," + Istrial + "," + IsWait);
        sw.Close();

        if (positionZ >= forward)
        {
            transform.GetChild(0).gameObject.SetActive(true);
            if (!lean)
            {
                StreamWriter sw1 = File.AppendText(Variables.folder + "Error_Count_Participant" + Variables.participant + ".csv");
                sw1.WriteLine(Error + "," + Level2.Trial + "," + ResponseTime.Trial + "," + frame + "," + ResponseTime.levelTimer + "," + clock);
                sw1.Close();
                lean = true;
                Error++;
            }
        }
        else
        {
            lean = false;
            transform.GetChild(0).gameObject.SetActive(false);
        }
    }
Пример #7
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (OVRInput.GetDown(OVRInput.Button.Two))
        {
            ButtonPress = 1;
        }
        else
        {
            ButtonPress = 0;
        }


        ResponseTime = GameObject.FindGameObjectWithTag("ResponseTime").GetComponent <ResponseTime>();

        rotation = transform.rotation; rotationX = rotation.x; rotationY = rotation.y; rotationZ = rotation.z;    // These grab the rotation and position data from the object it is attached to
        position = transform.position; positionX = position.x; positionY = position.y; positionZ = position.z;

        frame = Time.frameCount; clock += Time.deltaTime * 1; trutrial = ResponseTime.trialminusprac + 1;


        if (ResponseTime.ParticipantReady == false)
        {
            IsWait = 1;
        }
        else
        {
            IsWait = 0;
        }


        if (ResponseTime.posrecording == true)
        {
            Istrial = 1;
        }
        else
        {
            Istrial = 0;
        }



        StreamWriter sw = File.AppendText(Variables.folder + "PositionDataLeft" + Variables.participant + ".csv");    // This is where the data will be written

        sw.WriteLine(rotationX + "," + rotationY + "," + rotationZ + "," + positionX + "," + positionY + "," + positionZ + "," + ButtonPress + "," + frame + "," + clock + "," + ResponseTime.levelTimer + "," + ResponseTime.trueblock + "," + trutrial + "," + ResponseTime.Trial + "," + Order.Condition + "," + Istrial + "," + IsWait);
        sw.Close();
    }
Пример #8
0
 public XElement Serialize()
 {
     return(new XElement(UblNames.Cac + nameof(ResponseValue),
                         ID.Serialize(nameof(ID)),
                         Description.Serialize(nameof(Description)),
                         ResponseAmount.Serialize(nameof(ResponseAmount)),
                         ResponseCode.Serialize(nameof(ResponseCode)),
                         ResponseDate.Serialize(nameof(ResponseDate)),
                         ResponseTime.Serialize(nameof(ResponseTime)),
                         ResponseID.Serialize(nameof(ResponseID)),
                         ResponseIndicator.Serialize(nameof(ResponseIndicator)),
                         ResponseMeasure.Serialize(nameof(ResponseMeasure)),
                         ResponseNumeric.Serialize(nameof(ResponseNumeric)),
                         ResponseQuantity.Serialize(nameof(ResponseQuantity)),
                         ResponseURI.Serialize(nameof(ResponseURI))
                         ));
 }
Пример #9
0
 public void MergeFrom(Attempt other)
 {
     if (other == null)
     {
         return;
     }
     if (other.scheduleTime_ != null)
     {
         if (scheduleTime_ == null)
         {
             scheduleTime_ = new global::Google.Protobuf.WellKnownTypes.Timestamp();
         }
         ScheduleTime.MergeFrom(other.ScheduleTime);
     }
     if (other.dispatchTime_ != null)
     {
         if (dispatchTime_ == null)
         {
             dispatchTime_ = new global::Google.Protobuf.WellKnownTypes.Timestamp();
         }
         DispatchTime.MergeFrom(other.DispatchTime);
     }
     if (other.responseTime_ != null)
     {
         if (responseTime_ == null)
         {
             responseTime_ = new global::Google.Protobuf.WellKnownTypes.Timestamp();
         }
         ResponseTime.MergeFrom(other.ResponseTime);
     }
     if (other.responseStatus_ != null)
     {
         if (responseStatus_ == null)
         {
             responseStatus_ = new global::Google.Rpc.Status();
         }
         ResponseStatus.MergeFrom(other.ResponseStatus);
     }
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Пример #10
0
    void Update()
    {
        ResponseTime = GameObject.FindGameObjectWithTag("ResponseTime").GetComponent <ResponseTime>();
        if (ResponseTime.recording == true)
        {
            if (Testend == false)
            {
                if (TestStart == true)
                {
                    if (KeysEnabled == true)
                    {
                        if (updateTimer) //Starts the timer when the scene starts.
                        {
                            WaitTimer += Time.deltaTime * 1;
                        }
                        if (WaitTimer > 2.0f)// allows the participant to make a decition after 2 seconds

                        {
                            tempPos2 = transform.position; tempPos2.z = Distance2; transform.position = tempPos2; // moves the participant in front of the stimulus
                            if (OVRInput.GetDown(OVRInput.Button.One) || (OVRInput.GetDown(OVRInput.Button.Three)))
                            {
                                Debug.Log(Trial);
                                Trial++;
                                tempPos     = transform.position; tempPos.z = Distance; transform.position = tempPos;// moves the participant to the loading stage
                                WaitTimer   = 0.0f;
                                updateTimer = true;
                                if (scenes.Count == 0)
                                {
                                    if (Block > 2) // Loads the ending scene when the disired blocks of trials have been run
                                    {
                                        SceneManager.LoadScene("End");
                                        Testend = true;
                                        ResponseTime.recording = false;
                                    }
                                    TestStart = false;
                                }
                                // Get a random index from the list of remaining level
                                int randomIndex = Random.Range(0, scenes.Count);
                                int level       = scenes[randomIndex];
                                scenes.RemoveAt(randomIndex); // Removes the level from the list
                                SceneManager.LoadScene(level);
                            }
                        }
                    }

                    if (KeysEnabled == false)
                    {
                        if (updateTimer) //Starts the timer when the scene starts.
                        {
                            WaitTimer += Time.deltaTime * 1;
                        }
                    }
                    if (WaitTimer > 2.0f)
                    {
                        KeysEnabled = true;
                    }
                }

                if (TestStart == false)
                {
                    updateTimer = false;
                    if (Block > 2)// Ends the experiment after the 4th block/ Since the first block is practice this ends it after 3 recorded blocks have been completed
                    {
                        SceneManager.LoadScene("End");
                        Canvas3.SetActive(visible);
                        ExpFinish.SetActive(visible);
                        Testend = true;
                    }
                    if (OVRInput.GetDown(OVRInput.Button.PrimaryThumbstick))
                    {
                        thumbstick = true;
                    }
                }
            }
            if (thumbstick == true)
            {
                tempPos   = transform.position; tempPos.z = Distance; transform.position = tempPos;
                WaitTimer = 0.0f;
                scenes    = new List <int>(Enumerable.Range(1, MAX));
                int randomIndex = Random.Range(0, scenes.Count);
                int level       = scenes[randomIndex];
                scenes.RemoveAt(randomIndex); // Removes the level from the list
                SceneManager.LoadScene(level);
                updateTimer = true;
                TestStart   = true;
                thumbstick  = false;
            }
        }
    }
Пример #11
0
 public void ThenICanCheckTheResponseTimeIsUnderMilliseconds(int maxResponseTime)
 {
     ResponseTime.Should().BeLessThan(maxResponseTime);
 }
Пример #12
0
 void Awake()
 {
     Variables    = GameObject.FindGameObjectWithTag("UI").GetComponent <Variables>();
     ResponseTime = GameObject.FindGameObjectWithTag("ResponseTime").GetComponent <ResponseTime>();//This pulls the variables from the variables script. It's a handy way to call variables from objects without manualy telling unity where to look for the corisponding script every time a new scene loads.
 }