Skip to content

Commit

Permalink
Quick restructure with unity meta files
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmed-shariff committed Aug 2, 2023
1 parent 2bceaf8 commit 9ed92c3
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 31 deletions.
8 changes: 8 additions & 0 deletions Assets.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/Scripts.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,58 +4,30 @@
using UnityEngine.Networking;
using UXF;
using Newtonsoft.Json;
using ubc.ok.ovilab.HPUI.Core;
using System.Linq;
using System;
using UnityEngine.UI;
using ubc.ok.ovilab.ViconUnityStream;

namespace ubc.ok.ovilab.uxf.extensions
{
public class ExperimentManager : MonoBehaviour
public class ExperimentManager<T> : MonoBehaviour
{
private const string ASK_PROMPT = "When ready ask researcher to proceed with the experiment";
[SerializeField]
[Tooltip("The url address to the experiment server.")]
string experimentServerUrl = "http://127.0.0.1:5000";

public List<Transform> buttonsRoots;
public Color defaultColor = Color.white;
public Color defaultHoverColor = Color.yellow;
public Color targetButtonColor = Color.red;
public Color defaultHighlightColor = Color.green;
public AudioClip hoverAudio;
public AudioClip contactAudio;
public AudioSource audioSource;
public bool disableHover;
public bool disableHoverAudio;
public bool trackJoints = true; // Adding this for performance reasons
public List<string> forceTrackJoints = new List<string>(); // When trackJoints is false, bypass that for the coordinates in this list
public Button startNextButton;
public TMPro.TMP_Text outputText;
public TMPro.TMP_Text displayText;
public TMPro.TMP_Text countText;
public ButtonController thumbBaseButton;
public TargetManager targetManager;

// NOTE: If a calibration function is set, when appropriate
// the CalibrationComplete function also should be
// called. Until then the next block will not get called.
private Dictionary<string, Action> calibrationFunctions = new Dictionary<string, Action>();

#region HIDDEN_VARIABLES
private Dictionary<string, (ButtonController controller, Tracker tracker, Vector3 localScale)> buttons;
private List<string> activeButtons;
private ButtonController targetButton;
private System.Random random;
private bool blockEnded = true;
private CalibrationState calibrationState = CalibrationState.none;
private Dictionary<string, object> calibrationParameters;
private bool sessionStarted = false;
private int participant_index = -1;
private Dictionary<string, List<string>> XORGroupFlattened;
private int countDisplay_blockNum, countDisplay_blockTotal, countDisplay_trialTotal;
private bool hideNonTargets = false;
private BlockData blockData;
#endregion

Expand All @@ -77,7 +49,6 @@ public virtual void Start()

startNextButton.onClick.AddListener(OnGoToNextButtonClicked);


// Strating the session after a few seconds
StartCoroutine(StartSessionAfterWait(session));
}
Expand All @@ -93,7 +64,7 @@ private IEnumerator StartSessionAfterWait(Session session)
(idx) =>
StartCoroutine(GetJsonUrl("api/global-data", (jsonText) =>
{
ConfigGlobalData data = JsonConvert.DeserializeObject<ConfigGlobalData>(jsonText);
ConfigGlobalData data = JsonConvert.DeserializeObject<T>(jsonText);
participant_index = data.participant_index;
countDisplay_blockTotal = data.config_length;
Debug.Log($"Recieved session data (pp# {participant_index}): {jsonText}");
Expand Down
11 changes: 11 additions & 0 deletions Assets/Scripts/ExperimentManager.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Assets/ubc.ok.ovilab.uxf.extensions.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "ubc.ok.ovilab.uxf.extensions",
"rootNamespace": "",
"references": [
"GUID:581cccc347938044e8ae3adc4e6d3640",
"GUID:6055be8ebefd69e48b49212b09b47b2f"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
7 changes: 7 additions & 0 deletions Assets/ubc.ok.ovilab.uxf.extensions.asmdef.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions CHANGELOG.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions LICENSE.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions README.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"description": "Extensions for UXF",
"unity": "2019.1",
"dependencies": {
"com.unity.test-framework": "1.1.31",
"com.unity.textmeshpro": "3.0.6"
},
"author": {
"name": "MFA Shariff",
Expand Down
7 changes: 7 additions & 0 deletions package.json.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9ed92c3

Please sign in to comment.