Ejemplo n.º 1
0
    void Awake()
    {
        logCollection = new Dictionary <string, List <string> >();

        // Add the database columns
        logCollection.Add("Email", new List <string>());
        logCollection.Add("DateAdded", new List <string>());
        logCollection.Add("ParticipantNumber", new List <string>());
        logCollection.Add("CircleName", new List <string>());
        logCollection.Add("EyeTrackAccuracy", new List <string>());
        logCollection.Add("CustomCondition", new List <string>());
        logCollection.Add("ShowGazeDot", new List <string>());
        logCollection.Add("ShowGrid", new List <string>());
        logCollection.Add("SpacebarInteract", new List <string>());

        metaCollection = new Dictionary <string, List <string> >();
        metaCollection.Add("Email", new List <string>());
        metaCollection.Add("DateAdded", new List <string>());
        metaCollection.Add("ParticipantNumber", new List <string>());
        metaCollection.Add("CircleName", new List <string>());
        metaCollection.Add("EyeTrackAccuracy", new List <string>());
        metaCollection.Add("CustomCondition", new List <string>());
        metaCollection.Add("ShowGazeDot", new List <string>());
        metaCollection.Add("ShowGrid", new List <string>());
        metaCollection.Add("SpacebarInteract", new List <string>());

        mySQL = gameObject.GetComponent <ConnectToMySQL>();

        DontDestroyOnLoad(this.gameObject);
    }
Ejemplo n.º 2
0
    void Awake()
    {
        // Setting the headers in order to get through the security of the server
        //wwwHeader["Accept"] = "*/*";
        //wwwHeader["Accept-Encoding"] = "gzip, deflate";
        //wwwHeader["User-Agent"] = "runscope/0.1";

        securityCode = serverUrl.GetSecurityCode();
        //string[] splitArray = serverUrl.text.Split(char.Parse(","));
        //url = "http://" + splitArray [0] + "/" + splitArray [1] + "/" + splitArray [2];
        url = serverUrl.GetServerUrl();
        WWWForm testForm = new WWWForm();

        testForm.AddField("purposePost", "connectionTest");
        secHash = Utils.Md5Sum(securityCode);
        testForm.AddField("secHashPost", secHash);

        if (instance == null)
        {
            instance = this;
            if (!isConnected)
            {
                StartCoroutine(ConnectToServer(testForm));
            }
        }
    }
Ejemplo n.º 3
0
    void Awake()
    {
        if (statusMessage != null)
        {
            defaultColor = statusMessage.color;
        }
        //credentials = new Dictionary<string, string>();
        //logsToUpload = new List<Dictionary<string, List<string>>>();

        directory = Application.persistentDataPath + "/Data/";
        string authDirectory = Application.persistentDataPath + "/Auth/";

        if (!Directory.Exists(directory))
        {
            Directory.CreateDirectory(directory);
        }

        if (!Directory.Exists(authDirectory))
        {
            Directory.CreateDirectory(authDirectory);
        }

        if (builtInCredentials == null || builtInCredentials.Length == 0)
        {
            if (Application.platform != RuntimePlatform.WebGLPlayer)
            {
                DetectCredentialsOnDisk();
            }
        }
        else
        {
            LoadBuiltInCredentials();
        }

        if (instance == null)
        {
            instance = this;
            if (!isConnected && dataTargets.Keys.Count > 0)
            {
                TestConnectionToServer();
            }
        }
        if (Application.platform != RuntimePlatform.WebGLPlayer)
        {
            DetectDumpedLogs();
        }
    }
    void Awake()
    {
        if (statusMessage != null)
        {
            defaultColor = statusMessage.color;
        }
        dataDumps    = new List <string>();
        colDumps     = new List <string>();
        credentials  = new Dictionary <string, string>();
        logsToUpload = new List <Dictionary <string, List <string> > >();

        directory = Application.persistentDataPath + "/Data/";
        string authDirectory = Application.persistentDataPath + "/Auth/";

        if (!Directory.Exists(directory))
        {
            Directory.CreateDirectory(directory);
        }

        if (!Directory.Exists(authDirectory))
        {
            Directory.CreateDirectory(authDirectory);
        }

        if (builtInCredentials == null)
        {
            DetectCredentialsOnDisk();
        }
        else
        {
            LoadBuiltInCredentials();
        }

        if (instance == null)
        {
            instance = this;
            if (!isConnected && credentials.Keys.Count > 0)
            {
                TestConnectionToServer();
            }
        }

        DetectDumpedLogs();
    }
Ejemplo n.º 5
0
 public Form3()
 {
     InitializeComponent();
     _connectToMySql = new ConnectToMySQL();
 }
Ejemplo n.º 6
0
    public void Awake()
    {
        connectToMySQL = FindObjectOfType <ConnectToMySQL>();
        PID            = "1";
        TrialNo        = "1";
        cdgain         = "NULL";
        logs           = new Dictionary <string, List <string> >() //create a new dictionary

        {
            { "Email", new List <string>() },
            { "GameType", new List <string>() },
            { "InputType", new List <string>() },
            { "InputResponders", new List <string>() },
            { "HitType", new List <string>() },
            { "TargetNumber", new List <string>() },
            { "TargetID", new List <string>() },
            { "SessionTime", new List <string>() },
            { "DeltaTime", new List <string>() },
            { "TargetX", new List <string>() },
            { "TargetY", new List <string>() },
            { "HitX", new List <string>() },
            { "HitY", new List <string>() },
            { "HitOffsetX", new List <string>() },
            { "HitOffsetY", new List <string>() },
            { "OutsetTargetX", new List <string>() },
            { "OutsetTargetY", new List <string>() },
            { "TargetDeltaX", new List <string>() },
            { "TargetDeltaY", new List <string>() },
            { "OutsetHitX", new List <string>() },
            { "OutsetHitY", new List <string>() },
            { "DeltaHitX", new List <string>() },
            { "DeltaHitY", new List <string>() },
            { "TargetDiameter", new List <string>() },
            { "ColliderDiameter", new List <string>() },
            { "Backtracking", new List <string>() },
            { "ErrorTargetID", new List <string>() },
            { "TargetsDistance", new List <string>() },
            { "Timestamp", new List <string>() },
            { "PID", new List <string>() },
            { "ObjectWidthCm", new List <string>() },
            { "ObjectHeightCm", new List <string>() },
            { "ObjectDistanceCm", new List <string>() },
            { "TrialNo", new List <string>() },
            { "CDGain", new List <string>() }
        };

        var optionsList = Enum.GetNames(typeof(InputResponders)).ToList();

        inputResponderDropdown.AddOptions(optionsList);

        var inputTypeList = Enum.GetNames(typeof(InputType)).ToList();

        inputTypeDropdown.AddOptions(inputTypeList);

        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(this);
        }

        // Don't run if UserID isn't set

        /*		if(userID == ""){
         *      Debug.LogError("Please set User ID");
         *      EditorApplication.ExecuteMenuItem("Edit/Play");
         * }
         */


        // directory = Application.persistentDataPath + "/Data/";

        if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor)
        {
            directory = "C:\\rtii\\" + "tunnelgoalfitts" + "\\";
            print("Windows");
        }
        else if (Application.platform == RuntimePlatform.LinuxPlayer || Application.platform == RuntimePlatform.LinuxEditor)
        {
            directory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop) + "\\rtii\\" + "tunnelgoalfitts" + "\\";
            print("Linux");
        }
        else if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer)
        {
            directory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop) + "\\rtii\\" + "tunnelgoalfitts" + "\\";
            print("Mac OSX");
        }
        else
        {
            directory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop) + "\\rtii\\" + "tunnelgoalfitts" + "\\";
            print("Unknown");
        }

/*
 *      directory = Application.dataPath + "/../Data/";
 */

        if (!Directory.Exists(directory))
        {
            Directory.CreateDirectory(directory);
        }

        userID          = GameObject.Find("ConnectToArduino").GetComponent <ConnectToArduino>().email;
        inputType       = System.Enum.GetName(typeof(InputType), inputTypeDropdown.value);
        inputResponders = System.Enum.GetName(typeof(InputResponders), inputResponderDropdown.value);
    }