/// <summary> /// Ends the experiment session. /// </summary> public void End() { if (hasInitialised) { if (InTrial) { CurrentTrial.End(); } SaveResults(); // raise cleanup event if (cleanUp != null) { cleanUp(); } // end FileIOManager - forces immediate writing of all files fileIOManager.End(); onSessionEnd.Invoke(this); currentTrialNum = 0; currentBlockNum = 0; blocks = new List <Block>(); _hasInitialised = false; Debug.Log("Ended session."); } }
/// <summary> /// Ends the experiment session. /// </summary> public void End() { if (hasInitialised) { isEnding = true; if (InTrial) { try { CurrentTrial.End(); } catch (Exception e) { Debug.LogException(e); } } SaveResults(); try { preSessionEnd.Invoke(this); } catch (Exception e) { Debug.LogException(e); } // end DataHandler - forces completion of tasks foreach (var dataHandler in ActiveDataHandlers) { dataHandler.CleanUp(); } try { onSessionEnd.Invoke(this); } catch (Exception e) { Debug.LogException(e); } currentTrialNum = 0; currentBlockNum = 0; blocks = new List <Block>(); _hasInitialised = false; Debug.Log("Ended session."); isEnding = false; } }
/// <summary> /// Ends the experiment session. /// </summary> public void End() { if (hasInitialised) { isEnding = true; if (InTrial) { try { CurrentTrial.End(); } catch (Exception e) { Debug.LogException(e); } } SaveResults(); try { preSessionEnd.Invoke(this); } catch (Exception e) { Debug.LogException(e); } if (storeSessionSettings) { // copy Settings to session folder SaveJSONSerializableObject(new Dictionary <string, object>(settings.baseDict), "settings", dataType: UXFDataType.Settings); } if (storeParticipantDetails) { // copy participant details to session folder // we convert to a DataTable because we know the dictionary will be "flat" (one value per key) UXFDataTable ppDetailsTable = new UXFDataTable(participantDetails.Keys.ToArray()); var row = new UXFDataRow(); foreach (var kvp in participantDetails) { row.Add((kvp.Key, kvp.Value)); } ppDetailsTable.AddCompleteRow(row); var ppDetailsLines = ppDetailsTable.GetCSVLines(); SaveDataTable(ppDetailsTable, "participant_details", dataType: UXFDataType.ParticipantDetails); } // end DataHandlers - forces completion of tasks foreach (var dataHandler in ActiveDataHandlers) { try { dataHandler.CleanUp(); } catch (Exception e) { Debug.LogException(e); } } try { onSessionEnd.Invoke(this); } catch (Exception e) { Debug.LogException(e); } currentTrialNum = 0; currentBlockNum = 0; blocks = new List <Block>(); _hasInitialised = false; Utilities.UXFDebugLog("Ended session."); isEnding = false; } }
/// <summary> /// Ends currently running trial. Useful to call from an inspector event /// </summary> public void EndCurrentTrial() { CurrentTrial.End(); }