public void SaveProfile() { if (CloudConnected()) { int profileId = -1; EmotivCloudClient.EC_GetProfileId(userCloudID, profileName.text, ref profileId); if (profileId >= 0) { if (EmotivCloudClient.EC_UpdateUserProfile(userCloudID, (int)engineUserID, profileId) == EdkDll.EDK_OK) { message_box.text = "Profile updated"; } else { message_box.text = "Error saving profile, aborting"; } } else { if (EmotivCloudClient.EC_SaveUserProfile( userCloudID, engineUserID, profileName.text, EmotivCloudClient.profileFileType.TRAINING) == EdkDll.EDK_OK) { message_box.text = "Profiled saved successfully"; } else { message_box.text = "Error saving profile, aborting"; } } } }
static void SavingLoadingFunction(int mode) { int getNumberProfile = EmotivCloudClient.EC_GetAllProfileName(userCloudID); if (mode == 0) { int profileID = EmotivCloudClient.EC_GetProfileId(userCloudID, profileName); if (profileID >= 0) { Console.WriteLine("Profile with " + profileName + " is existed"); Console.WriteLine("Updating...."); if (EmotivCloudClient.EC_UpdateUserProfile(userCloudID, 0, profileID) == EmotivCloudClient.EC_OK) { Console.WriteLine("Updating finished"); } else { Console.WriteLine("Updating failed"); } } else { Console.WriteLine("Saving..."); if (EmotivCloudClient.EC_SaveUserProfile(userCloudID, (int)0, profileName, EmotivCloudClient.profileFileType.TRAINING) == EmotivCloudClient.EC_OK) { Console.WriteLine("Saving finished"); } else { Console.WriteLine("Saving failed"); } } return; } if (mode == 1) { if (getNumberProfile > 0) { Console.WriteLine("Loading..."); if (EmotivCloudClient.EC_LoadUserProfile(userCloudID, 0, EmotivCloudClient.EC_GetProfileId(userCloudID, profileName), version) == EmotivCloudClient.EC_OK) { Console.WriteLine("Loading finished"); } else { Console.WriteLine("Loading failed"); } } return; } }
static void SavingLoadingFunction(int mode) { int getNumberProfile = EmotivCloudClient.EC_GetAllProfileName(userCloudID); if (mode == 0) { int profileID = EmotivCloudClient.EC_GetProfileId(userCloudID, profileName); if (profileID >= 0) { Console.WriteLine("Profile with " + profileName + " is existed"); if (EmotivCloudClient.EC_UpdateUserProfile(userCloudID, engineUserID, profileID, profileName)) { Console.WriteLine("Updating finished"); } else { Console.WriteLine("Updating failed"); } } else if (EmotivCloudClient.EC_SaveUserProfile(userCloudID, (int)engineUserID, profileName, EmotivCloudClient.profileFileType.TRAINING)) { Console.WriteLine("Saving finished"); } else { Console.WriteLine("Saving failed"); } Thread.Sleep(5000); return; } if (mode == 1) { if (getNumberProfile > 0) { if (EmotivCloudClient.EC_LoadUserProfile(userCloudID, engineUserID, EmotivCloudClient.EC_ProfileIDAtIndex(userCloudID, 0), version)) { Console.WriteLine("Loading finished"); } else { Console.WriteLine("Loading failed"); } } Thread.Sleep(5000); return; } }
void UploadProfileWindow(int wId) { GUI.Label(new Rect(10, 20, 200, 30), "Create new profile"); newProfileName = GUI.TextField(new Rect(10, 40, 180, 30), newProfileName); if (GUI.Button(new Rect(10, 80, 90, 30), "Cancel")) { isUploadProfile = false; } if (GUI.Button(new Rect(120, 80, 80, 30), "Upload")) { int pid = EmotivCloudClient.EC_GetProfileId(userCloudId, newProfileName); if (pid >= 0) { EmotivCloudClient.EC_UpdateUserProfile(userCloudId, EmoUserManagement.currentUser, pid); //close upload window isUploadProfile = false; } else { EmotivCloudClient.EC_SaveUserProfile(userCloudId, EmoUserManagement.currentUser, newProfileName, EmotivCloudClient.profileFileType.TRAINING); int id = EmotivCloudClient.EC_GetProfileId(userCloudId, newProfileName); PROFILE t = new PROFILE(); t.id = id; t.name = newProfileName; profiles.Add(t); //close upload window isUploadProfile = false; } } GUI.Label(new Rect(10, 110, 200, 30), "or select from your profiles"); vec2_Scoll = GUI.BeginScrollView(new Rect(10, 130, 200, 300), vec2_Scoll, new Rect(0, 0, 200, 300)); int _i = 0; foreach (PROFILE p in profiles) { if (GUI.Button(new Rect(0, 10 + _i * 35, 200, 30), p.name)) { newProfileName = p.name; } _i++; } GUI.EndScrollView(); }
static void ProfileSaving() { int profileID = -1; EmotivCloudClient.EC_GetProfileId(cloudUserID, profileName, ref profileID); if (profileID >= 0) { Console.WriteLine("Updating..."); Console.WriteLine("Profile with " + profileName + " is existed"); if (EmotivCloudClient.EC_UpdateUserProfile(cloudUserID, engineUserID, profileID) == EdkDll.EDK_OK) { Console.WriteLine("Updating finished"); } else { Console.WriteLine("Updating failed"); } } else { Console.WriteLine("Saving..."); if (EmotivCloudClient.EC_SaveUserProfile(cloudUserID, 0, profileName, EmotivCloudClient.profileFileType.TRAINING) == EdkDll.EDK_OK) { Console.WriteLine("Saving finished"); } else { Console.WriteLine("Saving failed"); } } Thread.Sleep(5000); return; }
public void SaveProfile() { if (CloudConnected()) { int profileId = -1; profileId = EmotivCloudClient.EC_GetProfileId(userCloudID, profileName.text, ref profileId); if (profileId >= 0) { if (EmotivCloudClient.EC_UpdateUserProfile(userCloudID, (int)engineUserID, profileId) == EdkDll.EDK_OK) { textOutputFunction("Status: Profile updated"); Debug.Log("Status: Profile updated"); } else { textOutputFunction("Status: Error saving profile, aborting"); Debug.Log("Status: Error saving profile, aborting"); } } else { if (EmotivCloudClient.EC_SaveUserProfile( userCloudID, engineUserID, profileName.text, EmotivCloudClient.profileFileType.TRAINING) == EdkDll.EDK_OK) { textOutputFunction("Status: Profiled saved successfully"); Debug.Log("Status: Profiled saved successfully"); } else { textOutputFunction("Status: Error saving profile, aborting"); Debug.Log("Status: Error saving profile, aborting"); } } } }