public void LogoutPatient(string filePath) { if (!QuestFileManager.UpdatePatientOnFile(CurrentPatient, filePath)) { PrintToLog("The patient " + CurrentPatient.FullName + " (" + CurrentPatient.Id + ") file could not be found in order to update.", LogType.Error); } CurrentPatient = null; ShowScreen(ScreensIndex.TherapistScreen); }
public void OnConfirmClicked() { int id; try { m_statusText.text = string.Empty; if (m_fullNameField.text == string.Empty || m_heightField.text == string.Empty || m_weightField.text == string.Empty) { m_statusText.text = "Please fill all data"; return; } if (!m_fullNameField.text.All(char.IsLetter) && !m_fullNameField.text.Contains(" ")) { m_statusText.text = "Please enter only letters on full name field"; return; } if (!int.TryParse(m_heightField.text, out id)) { m_statusText.text = "Please enter only numbers on height field"; return; } if (!int.TryParse(m_weightField.text, out id)) { m_statusText.text = "Please enter only numbers on weight field"; return; } if (QuestFileManager.GetPatientFromFile(FilePath) == null) { m_statusText.text = "Patient doesn't exists"; return; } Patient patient = GetUserFromGui(); m_mainController.CurrentPatient.FullName = patient.FullName; m_mainController.CurrentPatient.Gender = patient.Gender; m_mainController.CurrentPatient.Height = patient.Height; m_mainController.CurrentPatient.Weight = patient.Weight; m_mainController.CurrentPatient.Hand = patient.Hand; QuestFileManager.UpdatePatientOnFile(m_mainController.CurrentPatient, FilePath); m_mainController.ShowPopup(MessageController.MessageType.Succsess, "Patient details has been updated!", OnPopupAnswerFromConfirm); m_statusText.text = string.Empty; PrintToLog("Patient's details update: " + m_mainController.CurrentPatient.FullName + " " + ", id: " + m_mainController.CurrentPatient.Id + ". Updated by the therapist: " + m_mainController.LoggedInTherapist.FirstName + " " + m_mainController.LoggedInTherapist.LastName + ", id: " + m_mainController.LoggedInTherapist.Username + ".", MainController.LogType.Information); } catch (Exception e) { PrintToLog(e.ToString(), MainController.LogType.Error); } }
private void LevelEnded() { m_mainController.m_audioSource.volume = 0.1f; try { m_floatTextController.UpdateFloatTextSettings(AnimationTypeIndex.BottomToTop, "Level up!", Color.green); } catch (Exception e) { MainController.PrintToLog("Can't do level up animation - " + e.ToString(), MainController.LogType.Error); } try { m_audioSource.clip = m_winningSound; m_audioSource.Play(); } catch (Exception e) { MainController.PrintToLog("Can't play winning sound - " + e.ToString(), MainController.LogType.Error); } m_mainController.CurrentPatient.TreatmentsHistory.Add(m_mainController.CurrentPatient.CurrentTreatment); int newTreatmentNumber = m_mainController.CurrentPatient.CurrentTreatment.TreatmentNumber + 1; int ST = 0; foreach (Challenge c in m_mainController.CurrentPatient.CurrentTreatment.Plan) { ST += c.ActionsList.Count; } m_mainController.CurrentPatient.CurrentTreatment = new TreatmentPlan() { TreatmentNumber = newTreatmentNumber, CreationTime = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(), Plan = Algorithm.GenerateNewLevel(m_mainController.CurrentPatient.CurrentTreatment.Plan, PinchManager.PT, ST) }; PinchManager.PT = 0; try { QuestFileManager.UpdatePatientOnFile(m_mainController.CurrentPatient, PinchConstants.PatientsDirectoryPath + m_mainController.CurrentPatient.Id); } catch (Exception e) { MainController.PrintToLog("Can't update patient file in TherapyManager - " + e.ToString(), MainController.LogType.Error); } InitilizeSceneAccordingToPlan(); }
private IEnumerator NextLevel() { isReady = false; float secondsToWait = 5; switch (stepNum)// the level that we just finished { case 0: StartCoroutine(PlayInstructionsSounds(3, 1)); m_2tipHand.SetActive(true); stopwatch.Start(); m_feedbackText.text = "Let's Start!"; yield return(new WaitForSeconds(secondsToWait)); break; case 1: m_2tipHand.SetActive(false); m_feedbackText.text = "Good job! 3 more"; yield return(new WaitForSeconds(secondsToWait)); m_3tipHand.SetActive(true); break; case 2: m_3tipHand.SetActive(false); m_feedbackText.text = "Good job! 2 more"; yield return(new WaitForSeconds(secondsToWait)); m_2padHand.SetActive(true); break; case 3: m_2padHand.SetActive(false); m_feedbackText.text = "Good job! 1 more"; yield return(new WaitForSeconds(secondsToWait)); m_3padHand.SetActive(true); break; case 4: StartCoroutine(PlayInstructionsSounds(2, 0)); m_3padHand.SetActive(false); m_feedbackText.text = "Finished!\nGoing back to main menu..."; m_mainController.CurrentPatient.MotionRange.IsCalibrated = true; try { QuestFileManager.UpdatePatientOnFile(m_mainController.CurrentPatient, PinchConstants.PatientsDirectoryPath + m_mainController.CurrentPatient.Id); } catch (Exception e) { MainController.PrintToLog("Can't update patient file in CalibrationManager - " + e.ToString(), MainController.LogType.Error); } yield return(new WaitForSeconds(secondsToWait + 2)); MainController.LoadMainScene(); break; } stepNum++; isReady = true; stopwatch.Reset(); stopwatch.Start(); }