Skip to content

Commit 0590f6d

Browse files
committed
copypastedisplayer
1 parent c0afdbf commit 0590f6d

31 files changed

+1612
-109
lines changed

Assets/UXF/Examples/1_Basic/BasicExample.unity

Lines changed: 643 additions & 23 deletions
Large diffs are not rendered by default.

Assets/UXF/Examples/1_Basic/Example_BasicExampleScript.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ of an ExperimentSession component as .settings */
4343
// create our blocks & trials
4444

4545
// retrieve the n_trials setting, which was loaded from our .json file into our session settings
46-
int numMainTrials = session.settings.GetInt("n_trials");
46+
// if we dont supply a settings profile (e.g. when running in a web browser, or Oculus Quest) it will revert to valueIfNotFound (10)
47+
int numMainTrials = session.settings.GetInt("n_trials", valueIfNotFound: 2);
4748
// create the block
4849
Block mainBlock = session.CreateBlock(numMainTrials); // block 2
4950

Assets/UXF/Examples/_Shared.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
486 KB
Binary file not shown.

Assets/UXF/Examples/_Shared/Chronos.ogg.meta

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using System.Linq;
2+
using System.Collections;
3+
using System.Collections.Generic;
4+
using UnityEngine;
5+
using UnityEngine.UI;
6+
7+
// add the UXF namespace
8+
using UXF;
9+
10+
namespace UXFExamples
11+
{
12+
/// <summary>
13+
/// Example script used to test functionality of the Experiment Manager
14+
/// </summary>
15+
public class Example_DisplayEndSessionMessage : MonoBehaviour
16+
{
17+
18+
public Text displayText;
19+
20+
public void DisplayEndSessionMessage(Session session)
21+
{
22+
23+
gameObject.SetActive(true);
24+
25+
// UXF can be used with local files (e.g. on PC), or without local files
26+
// we check for that, and display a message if there is a local data handler
27+
28+
// using some LINQ
29+
30+
var localFileDataHanders = session
31+
.ActiveDataHandlers
32+
.Where(dh => dh is LocalFileDataHander);
33+
34+
if (localFileDataHanders.Count() > 0)
35+
{
36+
string path = localFileDataHanders
37+
.Cast<LocalFileDataHander>()
38+
.First()
39+
.storagePath;
40+
41+
displayText.text = "Session complete! The data are stored in " + path;
42+
}
43+
else
44+
{
45+
displayText.text = "Session complete!";
46+
}
47+
48+
}
49+
50+
}
51+
}
52+

Assets/UXF/Examples/_Shared/Example_DisplayEndSessionMessage.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)