void onEnable()
 {
     //transform.localPosition = Vector3.forward * settings.stimulusDepth;
     //transform.localRotation = Quaternion.Euler(0, 90, 0);
     trialManagerScript = trialManager.GetComponent <TrialManager>();
     Debug.Log("bar says head out of place");
 }
예제 #2
0
    void Start()
    {
        if (tm == null)
        {
            //Debug.Log("New trial manager made");
            tm = new TrialManager();
            if (tm.IsTrialSetFilled())
            {
                //Do nothing
            }
            else
            {
                Debug.LogError("Stack is empty");
                //I really should throw an exception here if the stack is not filled.
            }
        }

        if (im == null)
        {
            //Debug.Log("New input manager made");
            im = GameObject.FindWithTag("GameManager").GetComponent <InputManager>();
        }

        if (om == null)
        {
            //Debug.Log("New output manager made");
            om = GameObject.FindWithTag("GameManager").GetComponent <OutputManager>();
        }
    }
예제 #3
0
 private void OnLoaded(object sender, RoutedEventArgs e)
 {
     if (!_moved)
     {
         TrialManager.CheckToastState();
     }
 }
예제 #4
0
    // TrialManagerをInstantiateして、1試行を行う
    void Run1Trial()
    {
        // trial manager
        trialManagerObj = (GameObject)Instantiate(trialManagerPrefab, Vector3.zero, Quaternion.identity);
        trialManager    = trialManagerObj.GetComponent <TrialManager>();
        trialManager.SetExpeimentalParameters(protocol[iTrial - 1]);
        trialManager.RunTrial();

        // Debug.Log(protocol[iTrial - 1]["Target Direction"]);

        readyForNextTrial = false;
    }
예제 #5
0
    // for debugging purposes
    //int RF1 = 0;
    //int RF2 = 0;
    //int GF1 = 0;
    //int GF2 = 0;

    void Start()
    {
        m_ExpSetup   = this.GetComponent <TrialSetup>();
        m_ExpManager = this.GetComponent <TrialManager>();

        // Find all the HUD elements
        redArray   = GameObject.FindGameObjectsWithTag("RedHUD");
        greenArray = GameObject.FindGameObjectsWithTag("GreenHUD");

        for (int i = 0; i < 2; i++)
        {
            arrayHUD[i]     = redArray[i];
            arrayHUD[i + 2] = greenArray[i];
        }
    }
예제 #6
0
 public void Start(GameObject newParent, TrialManager newTM, bool server)
 {
     parent       = newParent;
     trialManager = newTM;
     if (!server)
     {
         //SetupClient ();
         SetupClientUDP();
     }
     else
     {
         //StartServer ();
         StartServerUDP();
     }
 }
예제 #7
0
    // Handle trial manager instancing between scene loads.
    void Awake()
    {
        // If there is no instance, let this be the new instance, otherwise, destroy this object.
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        // If this object was set as the instance, make sure it is not destroyed on scene loads.
        DontDestroyOnLoad(gameObject);
    }
예제 #8
0
    // target destroyed ( hit by cursor / timeout )
    void OnDestroy()
    {
        // trial manager
        GameObject   trialManagerObj = GameObject.FindGameObjectWithTag("Trial Manager");
        TrialManager trialManager    = trialManagerObj.GetComponent <TrialManager>();

        // animation (not implemented 2016-01-28)



        // time
        trialManager.timeTargetDestroyed = Time.time;

        // send result to TrialManager
        trialManager.OnTargetDestroyed();
    }
    public void NewFile()
    {
        e_expManagerRef = this.GetComponent <TrialManager>();
        e_ExpTrial      = this.GetComponent <TrialSpawn>();
        csv             = new StringBuilder();

        // Start new stream writer
        int trialnum = e_expManagerRef.trialNumber;

        expPath = FileName(trialnum + 1);

        // Write first line with data information
        string newLine = string.Format("{0},{1},{2},{3}",
                                       "Color", "Orientation", "X Location", "Y Location");

        csv.AppendLine(newLine);
    }
예제 #10
0
    void Start()
    {
        // Start new stream writer
        expPath = FileName();
        Debug.Log(expPath);
        e_expManagerRef = this.GetComponent <TrialManager>();
        redFlickRef     = redFlickObject.GetComponent <FlickerControl>();
        greenFlickRef   = greenFlickObject.GetComponent <FlickerControl>();

        // Write first line with data information
        string newLine = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12}",
                                       "Red Freq", "Green Freq", "Target Color", "Target Orientation",
                                       "Target 1", "Target 2", "Target 3", "Target 4", "Target 5", "Target 6",
                                       "Response", "Actual", "Correct");

        csv.AppendLine(newLine);
    }
예제 #11
0
    // Use this for initialization
    void Start()
    {
        _humanMover  = GameObject.Find("TestObject");
        _maze        = GameObject.Find("Maze");
        _voronoi     = GameObject.Find("Voronoi");
        _textMessage = GameObject.Find("Canvas");
        _voronoi.SetActive(true);
        _textMessage.SetActive(false);

        myTrials = new TrialManager();


        //setup portion
        _maze.SetActive(false);

        //Networking for controls
        networkControlCenter = new NetworkControlCenter();
        networkControlCenter.Start(this.gameObject, myTrials, true);
    }
예제 #12
0
    /// <summary>
    /// Called when a scene is loaded. Currently, looks for a TrialManager and passes it
    /// the TrialJSON for initialization. If no TrialManager is found, assumes is in menu
    /// and rebuilds UI for current trial setup.
    /// </summary>
    /// <param name="trialScene"></param>
    /// <param name="loadMode"></param>
    private void OnSceneLoaded(Scene trialScene, LoadSceneMode loadMode)
    {
        TrialManager manager = FindObjectOfType <TrialManager> ();

        if (manager != null)
        {
            manager.InitializeTrials(CurrentExperiment.ExperimentTrials [CurrentTrial].TrialData);
        }
        else
        {
            ExperimentDesignUI = FindObjectOfType <ExperimentDesignUI> ();
            if (ExperimentDesignUI != null)
            {
                ExperimentDesignUI.SetExperiment(CurrentExperiment);
                ExperimentDesignUI.SetParticipantId(CurrentParticipantId);
                ExperimentDesignUI.SetExperimentName(CurrentExperimentName);
            }
        }
    }
        public static void ShowBuy()
        {
#if TRIAL_SIMULATION && !RELEASE
            if (MessageBox.Show("Buy app?", "BodyArchitect", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                TrialManager.Buy();
                new TrialManager().DetermineIsTrail();
            }
            return;
#endif
            try
            {
                MarketplaceDetailTask task = new MarketplaceDetailTask();
                task.ContentIdentifier = Constants.MarketplaceId;
                task.Show();
            }
            catch (Exception)
            {
            }
        }
예제 #14
0
    /// <summary>
    /// Exports all the results of the trials to CSV format.
    /// </summary>
    public void ExportResults()
    {
        int numBasicTrialQuestions;
        List <BasicTrialManager.BasicTrialSettings> basicTrialSettings = new List <BasicTrialManager.BasicTrialSettings> ();
        List <BasicTrialManager.BasicTrialResults>  basicTrialResults  = new List <BasicTrialManager.BasicTrialResults> ();

        //Seperate out results by trial type.
        foreach (TrialManager.TrialResults results in ExperimentResults)
        {
            if (results is BasicTrialManager.BasicTrialResults)
            {
                basicTrialResults.Add((BasicTrialManager.BasicTrialResults)results);
            }
        }

        //Seperate out trial conditions by trial type.
        foreach (TrialSave condition in CurrentExperiment.ExperimentTrials)
        {
            switch (condition.TrialType)
            {
            case TrialManager.TrialType.BasicTrial:
                basicTrialSettings.Add((BasicTrialManager.BasicTrialSettings)condition.TrialData);
                break;
            }
        }

        //Export each type of trial in its own file.

        string BouncingObjectData = TrialManager.GetCsvHeader(TrialManager.TrialType.BasicTrial, basicTrialSettings.ToArray(), out numBasicTrialQuestions);

        for (int i = 0; i < basicTrialResults.Count; i++)
        {
            BouncingObjectData += basicTrialResults[i].GetCsvData(numBasicTrialQuestions);
            if (i < basicTrialResults.Count - 1)
            {
                BouncingObjectData += "," + System.Environment.NewLine;
            }
        }

        File.WriteAllText(Application.dataPath + SAVED_RESULTS + Path.DirectorySeparatorChar + CurrentExperimentName + " participant " + CurrentParticipantId + "." + CSV_EXTENTION, BouncingObjectData);
    }
예제 #15
0
        private static void AutoConnect()
        {
            if (SelectedServerInfo == null)
            {
                return;
            }

            if (CurrentServer == null)
            {
                DACPServer newServer = GetDACPServer(SelectedServerInfo);
                if (newServer == null)
                {
                    ConnectionState = ServerConnectionState.LookingForLibrary;
                    return;
                }

                CurrentServer = newServer;
            }
            else
            {
                if (CurrentServer.IsConnected)
                {
                    return;
                }

                bool forceReconnect = false;

                // Update the IP from Bonjour if we can
                if (BonjourManager.DiscoveredServers.ContainsKey(SelectedServerInfo.ServiceID))
                {
                    var service = BonjourManager.DiscoveredServers[SelectedServerInfo.ServiceID];
                    var ips     = service.IPAddresses.Select(ip => ip.ToString()).ToList();
                    if (ips.Count > 0 && !ips.Contains(CurrentServer.Hostname))
                    {
                        CurrentServer.Hostname = ips[0];
                        forceReconnect         = true;
                    }
                    if (CurrentServer.Port != service.Port)
                    {
                        CurrentServer.Port = service.Port;
                        forceReconnect     = true;
                    }
                }

                if (ConnectionState == ServerConnectionState.ConnectingToLibrary && !forceReconnect)
                {
                    return;
                }

                if (forceReconnect)
                {
                    _log.Info("Forcing reconnection with a new address/port from Bonjour...");
                    DisconnectCurrentServer();
                }
            }

            TrialManager.StartTrial();
            if (TrialManager.TrialState == TrialState.Expired)
            {
                return;
            }

            ConnectionState = ServerConnectionState.ConnectingToLibrary;
            _log.Info("Connecting to server...");

            ConnectCurrentServer();
        }
예제 #16
0
 private void Awake()
 {
     _trialManager = GameObject.Find("TrialManager").GetComponent<TrialManager>();
 }
 void Start()
 {
     expManagerScript = expManagerObject.GetComponent <TrialManager>();
     expSetupScript   = expManagerObject.GetComponent <TrialSetup>();
     uitext           = this.GetComponent <Text>();
 }
예제 #18
0
 private void Awake()
 {
     _bikeController = FindObjectOfType<BikeController>();
     _trialManager = GameObject.Find("TrialManager").GetComponent<TrialManager>();
 }
예제 #19
0
 // Use this for initialization
 void Start()
 {
     networkControlCenter = new NetworkControlCenter();
     myTrials             = new TrialManager();
     networkControlCenter.Start(this.gameObject, myTrials, false);
 }
예제 #20
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            //CultureInfo culture = new CultureInfo("de-DE");
            //Thread.CurrentThread.CurrentCulture = culture;
            //Thread.CurrentThread.CurrentUICulture = culture;

            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            RemoteUtility.Initialize();
            ThreadUtility.Initialize();

            // Update settings if necessary
            SettingsUpdater.CheckForUpdate();

            // Standard XAML initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Show graphics profiling information while debugging.
            if (System.Diagnostics.Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are being GPU accelerated with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Prevent the screen from turning off while under the debugger by disabling
                // the application's idle detection.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;

#if DEBUG
                Komodex.Remote.Controls.MemoryCounters.Show();
#endif
            }

            // Initialize trial manager
            //TrialManager.SimulateTrialMode = true;
            //TrialManager.SimulateTrialExpired = true;
            TrialManager.TrialDays      = TrialDays;
            TrialManager.AutoStartTrial = false;
            TrialManager.Initialize();

            // Error reporter initialization
            PhoneAppCrashReporter.Initialize(this, RootFrame);
            CrashReporter.AdditionalLogInfoCallbacks.Add(RemoteUtility.DACPInfoCrashReporterCallback);

            ServerManager.Initialize();
            NetworkManager.Initialize();
            BonjourManager.Initialize();
            ConnectionStatusPopupManager.Initialize();

            // Other initialization
            SettingsManager.Initialize();

            // Tilt Effect
            TiltEffect.TiltableItems.Add(typeof(FakeButton));

#if WP7
            // Remove LongListSelector from the TiltableItems list
            TiltEffect.TiltableItems.Remove(typeof(LongListSelector));
#endif
        }