コード例 #1
0
ファイル: DL_LEDCue.cs プロジェクト: GiocomoLab/Unity
    public void Awake()
    {
        // for saving data
        GameObject player = GameObject.Find("Player");

        pc = player.GetComponent <PC_LEDCue>();
    }
コード例 #2
0
ファイル: SP_LEDCue.cs プロジェクト: GiocomoLab/Unity
    public void Awake()
    {
        player = GameObject.Find("Player");
        rr     = player.GetComponent <RR_FlashLED>();
        dl     = player.GetComponent <DL_LEDCue>();
        pc     = player.GetComponent <PC_LEDCue>();


        today = DateTime.Today;
        Debug.Log(today.ToString("dd_MM_yyyy"));
        sceneName       = SceneManager.GetActiveScene().name;
        localDirectory  = localDirectory_pre + mouse + '/' + today.ToString("dd_MM_yyy") + '/';
        serverDirectory = serverDirectory_pre + mouse + '/' + today.ToString("dd_MM_yyy") + '/';
        if (!Directory.Exists(localDirectory))
        {
            Directory.CreateDirectory(localDirectory);
        }
        if (!Directory.Exists(serverDirectory))
        {
            Directory.CreateDirectory(serverDirectory);
        }



        bool nameFlag = true;

        session = 1;
        while (nameFlag)
        {
            localPrefix  = localDirectory + "/" + sceneName + "_" + session.ToString();
            serverPrefix = serverDirectory + "/" + sceneName + "_" + session.ToString();
            if (File.Exists(localPrefix + ".sqlite"))
            {
                session++;
            }
            else
            {
                nameFlag = false;
                SqliteConnection.CreateFile(localPrefix + ".sqlite");
            }
        }

        string connectionString = "Data Source=" + localPrefix + ".sqlite;Version=3;";

        _connection = (IDbConnection) new SqliteConnection(connectionString);
        _connection.Open();
        _command             = _connection.CreateCommand();
        _command.CommandText = "create table data (time REAL, dz REAL, lick INT, reward INT, manrewards INT)";
        _command.ExecuteNonQuery();
    }