public int addGameSession(int score, float repititions, float time, int level, string minigame) { GameSession game = new GameSession(minigame); GameSessionDAO gameDao = new GameSessionDAO(); int repetitionsInt = (int)repititions; int timeInt = (int)time; game.Score = score; game.Repetitions = repetitionsInt; game.Time = timeInt; game.Level1 = level; int result = gameDao.InsertGameSessions(game); if (result == -1) { return(result); } else { Debug.Log("error"); } return(0); }
public void saveLastGameSession() { if (therapyId == "") { therapyId = TherapySessionDAO.GetLastTherapyId(patient.Id_num).ToString(); } GameSessionDAO.InsertGameSession(gameSessionList [gameSessionList.Count - 1], therapyId); currentGameSessionId = GameSessionDAO.GetLastGameSessionId(therapyId); }
public float getGameRecord() { return(GameSessionDAO.GetRecord(gameSessionList [gameSessionList.Count - 1], patient.Id_num)); }
public void SaveAndShowResults() { TherapySessionObject objTherapy = TherapySessionObject.tso; //if (objTherapy != null) //{ // objTherapy.fillLastSession(score, totalRepetitions, (int)totalTime, level.ToString()); // objTherapy.saveLastGameSession(); //} string idMinigame = "10"; GameSessionDAO gameDao = new GameSessionDAO(); int finalScore; if (totalRepetitions == 0) { finalScore = 0; } else { finalScore = (int)(((float)score / totalRepetitions) * 100.0f); } resultsScoreText.text = "Desempeño: " + finalScore + "%"; if (this.withTime == true) { GameSessionController gameCtrl = new GameSessionController(); gameCtrl.addGameSession(finalScore, 0, this.totalTime, score, idMinigame); } else { GameSessionController gameCtrl = new GameSessionController(); gameCtrl.addGameSession(finalScore, this.totalRepetitions, 0, score, idMinigame); } if (objTherapy != null) { resultsBestScoreText.text = "Mejor: " + objTherapy.getGameRecord() + "%"; } else { resultsBestScoreText.text = "Mejor: " + gameDao.GetScore(idMinigame) + "%"; } if (finalScore <= 60) { //resultMessage.GetComponent<TextMesh>().text = "¡Muy bien!"; star1.sprite = starOn; star2.sprite = starOff; star3.sprite = starOff; } else if (finalScore <= 90) { //resultMessage.GetComponent<TextMesh>().text = "¡Grandioso!"; star1.sprite = starOn; star2.sprite = starOn; star3.sprite = starOff; } else if (finalScore <= 100) { //resultMessage.GetComponent<TextMesh>().text = "¡Increíble!"; star1.sprite = starOn; star2.sprite = starOn; star3.sprite = starOn; } resultsPanel.SetActive(true); SendPerformance(); if (PlaylistManager.pm != null && PlaylistManager.pm.active) { PlaylistManager.pm.NextGame(); } }
public void EndGame() { player.SetActive(false); mainPanel.SetActive(false); string idMiniGame = "7"; TherapySessionObject objTherapy = TherapySessionObject.tso; if (objTherapy != null) { //objTherapy.fillLastSession(score, fullScore, (int)totalTime, "0"); //objTherapy.saveLastGameSession(); //objTherapy.savePerformance((int)kickScript.BestLeftHipFrontAngle, "4"); //objTherapy.savePerformance((int)kickScript.BestRightHipFrontAngle, "5"); } GameSessionDAO gameDao = new GameSessionDAO(); int finalScore; if (fullScore > 0) { finalScore = (int)(((float)score / fullScore) * 100.0f); } else { finalScore = 0; } resultsScoreText.text = "Desempeño: " + finalScore + "%"; //int angle = (int)_angleLeft; GameSessionController gameCtrl = new GameSessionController(); PerformanceController performanceCtrl = new PerformanceController(); if (this.withTime == true) { if (JogBool == true && CrouchBool == true && JumpBool == true) { gameCtrl.addGameSession(finalScore, 0, totalTime, score, idMiniGame); performanceCtrl.addPerformance((int)JogThreshold, "16"); performanceCtrl.addPerformance((int)CrouchThreshold, "8"); performanceCtrl.addPerformance((int)JumpThreshold, "7"); } if (JogBool == false && CrouchBool == true && JumpBool == true) { gameCtrl.addGameSession(finalScore, 0, totalTime, score, idMiniGame); performanceCtrl.addPerformance((int)CrouchThreshold, "8"); performanceCtrl.addPerformance((int)JumpThreshold, "7"); } if (JogBool == false && CrouchBool == false && JumpBool == true) { gameCtrl.addGameSession(finalScore, 0, totalTime, score, idMiniGame); performanceCtrl.addPerformance((int)JumpThreshold, "7"); } if (JogBool == false && CrouchBool == true && JumpBool == false) { gameCtrl.addGameSession(finalScore, 0, totalTime, score, idMiniGame); performanceCtrl.addPerformance((int)CrouchThreshold, "8"); } if (JogBool == true && CrouchBool == false && JumpBool == true) { gameCtrl.addGameSession(finalScore, 0, totalTime, score, idMiniGame); performanceCtrl.addPerformance((int)JogThreshold, "16"); performanceCtrl.addPerformance((int)JumpThreshold, "7"); } if (JogBool == true && CrouchBool == true && JumpBool == false) { gameCtrl.addGameSession(finalScore, 0, totalTime, score, idMiniGame); performanceCtrl.addPerformance((int)JogThreshold, "16"); performanceCtrl.addPerformance((int)CrouchThreshold, "8"); } if (JogBool == true && CrouchBool == false && JumpBool == false) { gameCtrl.addGameSession(finalScore, 0, totalTime, score, idMiniGame); performanceCtrl.addPerformance((int)JogThreshold, "16"); } } if (this.withTime == false) { if (JogBool == true && CrouchBool == true && JumpBool == true) { gameCtrl.addGameSession(finalScore, 0, totalRepetitions, score, idMiniGame); performanceCtrl.addPerformance((int)JogThreshold, "16"); performanceCtrl.addPerformance((int)CrouchThreshold, "8"); performanceCtrl.addPerformance((int)JumpThreshold, "7"); } if (JogBool == false && CrouchBool == true && JumpBool == true) { gameCtrl.addGameSession(finalScore, 0, totalRepetitions, score, idMiniGame); performanceCtrl.addPerformance((int)CrouchThreshold, "8"); performanceCtrl.addPerformance((int)JumpThreshold, "7"); } if (JogBool == false && CrouchBool == false && JumpBool == true) { gameCtrl.addGameSession(finalScore, 0, totalRepetitions, score, idMiniGame); performanceCtrl.addPerformance((int)JumpThreshold, "7"); } if (JogBool == false && CrouchBool == true && JumpBool == false) { gameCtrl.addGameSession(finalScore, 0, totalRepetitions, score, idMiniGame); performanceCtrl.addPerformance((int)CrouchThreshold, "8"); } if (JogBool == true && CrouchBool == false && JumpBool == true) { gameCtrl.addGameSession(finalScore, 0, totalRepetitions, score, idMiniGame); performanceCtrl.addPerformance((int)JogThreshold, "16"); performanceCtrl.addPerformance((int)JumpThreshold, "7"); } if (JogBool == true && CrouchBool == true && JumpBool == false) { gameCtrl.addGameSession(finalScore, 0, totalRepetitions, score, idMiniGame); performanceCtrl.addPerformance((int)JogThreshold, "16"); performanceCtrl.addPerformance((int)CrouchThreshold, "8"); } if (JogBool == true && CrouchBool == false && JumpBool == false) { gameCtrl.addGameSession(finalScore, 0, totalRepetitions, score, idMiniGame); performanceCtrl.addPerformance((int)JogThreshold, "16"); } } if (objTherapy != null) { resultsBestScoreText.text = "Mejor: " + objTherapy.getGameRecord() + "%"; } else { resultsBestScoreText.text = "Mejor:" + gameDao.GetScore(idMiniGame) + "%"; } if (finalScore <= 60) { //resultMessage.GetComponent<TextMesh>().text = "¡Muy bien!"; star1.sprite = starOn; star2.sprite = starOff; star3.sprite = starOff; } else if (finalScore <= 90) { //resultMessage.GetComponent<TextMesh>().text = "¡Grandioso!"; star1.sprite = starOn; star2.sprite = starOn; star3.sprite = starOff; } else if (finalScore <= 100) { //resultMessage.GetComponent<TextMesh>().text = "¡Increíble!"; star1.sprite = starOn; star2.sprite = starOn; star3.sprite = starOn; } StartCoroutine(DelayedFinalAnimation()); //resultsPanel.SetActive(true); }
public void SaveAndShowResults() { TherapySessionObject objTherapy = TherapySessionObject.tso; if (objTherapy != null) { objTherapy.fillLastSession(score, totalRepetitions, (int)totalTime, level.ToString()); objTherapy.saveLastGameSession(); objTherapy.savePerformance((int)kickScript.BestLeftHipFrontAngle, "4"); objTherapy.savePerformance((int)kickScript.BestRightHipFrontAngle, "5"); } string idMinigame = "5"; GameSessionDAO gameDao = new GameSessionDAO(); int finalScore; if (totalRepetitions > 0) { finalScore = (int)(((float)score / totalRepetitions) * 100.0f); } else { finalScore = 0; } resultsScoreText.text = "Desempeño: " + finalScore + "%"; float totalRepFloat = (float)totalRepetitions; ParametersScreenManagerTiroLibre pmTiroLibre = new ParametersScreenManagerTiroLibre(); pmTiroLibre.SendGame(finalScore, totalRepFloat, totalTime, score, idMinigame); if (useFrontPlane == true) { PerformanceController performanceCtrl = new PerformanceController(); performanceCtrl.addPerformance((int)this.FrontAngle1, "36"); performanceCtrl.addPerformance((int)this.FrontAngle2, "37"); performanceCtrl.addPerformance((int)this.FrontAngle3, "38"); } if (useBackPlane == true) { PerformanceController performanceCtrl = new PerformanceController(); performanceCtrl.addPerformance((int)this.BackAngle1, "33"); performanceCtrl.addPerformance((int)this.BackAngle2, "34"); performanceCtrl.addPerformance((int)this.BackAngle3, "35"); } if (objTherapy != null) { resultsBestScoreText.text = "Mejor: " + objTherapy.getGameRecord() + "%"; } else { resultsBestScoreText.text = "Mejor:" + gameDao.GetScore(idMinigame) + "%"; } if (finalScore <= 60) { //resultMessage.GetComponent<TextMesh>().text = "¡Muy bien!"; star1.sprite = starOn; star2.sprite = starOff; star3.sprite = starOff; } else if (finalScore <= 90) { //resultMessage.GetComponent<TextMesh>().text = "¡Grandioso!"; star1.sprite = starOn; star2.sprite = starOn; star3.sprite = starOff; } else if (finalScore <= 100) { //resultMessage.GetComponent<TextMesh>().text = "¡Increíble!"; star1.sprite = starOn; star2.sprite = starOn; star3.sprite = starOn; } resultsPanel.SetActive(true); //playlist block if (PlaylistManager.pm != null && PlaylistManager.pm.active) { PlaylistManager.pm.NextGame(); } }
private void EndGame() { mainPanel.SetActive(false); TherapySessionObject objTherapy = TherapySessionObject.tso; if (objTherapy != null) { //objTherapy.fillLastSession(score, fullScore, (int)totalTime, "0"); //objTherapy.saveLastGameSession(); //objTherapy.savePerformance((int)kickScript.BestLeftHipFrontAngle, "4"); //objTherapy.savePerformance((int)kickScript.BestRightHipFrontAngle, "5"); } string idMinigame = "11"; int finalScore; GameSessionDAO gameDao = new GameSessionDAO(); if (fullScore > 0) { finalScore = (int)(((float)score / fullScore) * 100.0f); } else { finalScore = 0; } resultsScoreText.text = "Desempeño: " + finalScore + "%"; GameSessionController gameCtrl = new GameSessionController(); int scoreBD = finalScore; if (withTime == true) { gameCtrl.addGameSession(score, 0, totalTime, scoreBD, idMinigame); } if (withTime == false) { gameCtrl.addGameSession(score, totalRepetitions, 0, scoreBD, idMinigame); } if (this.useFlexion == true) { sendPerformanceTouch(); } else { sendPerformancePinch(); } if (objTherapy != null) { resultsBestScoreText.text = "Mejor: " + objTherapy.getGameRecord() + "%"; } else { resultsBestScoreText.text = "Mejor:" + gameDao.GetScore(idMinigame) + "%"; } if (finalScore <= 60) { //resultMessage.GetComponent<TextMesh>().text = "¡Muy bien!"; star1.sprite = starOn; star2.sprite = starOff; star3.sprite = starOff; } else if (finalScore <= 90) { //resultMessage.GetComponent<TextMesh>().text = "¡Grandioso!"; star1.sprite = starOn; star2.sprite = starOn; star3.sprite = starOff; } else if (finalScore <= 100) { //resultMessage.GetComponent<TextMesh>().text = "¡Increíble!"; star1.sprite = starOn; star2.sprite = starOn; star3.sprite = starOn; } StartCoroutine(FinalAnimation()); }
/// <summary> /// Updates the data results /// </summary> /// <param name="percent">Percent. is the performance from 0 % to 100 % </param> /// <param name="best_percent">Best percent. is the BD loaded performance from 0 % to 100 % </param> public void updateData(int percent = 0, int best_percent = 0) { int how_do_it; if (percent <= 25) { how_do_it = DEFICIENT; } else if (percent > 25 && percent <= 75) { how_do_it = GOOD; } else { how_do_it = EXCELENT; } GameSessionDAO gameDao = new GameSessionDAO(); txt_score_results.text = "Desempeño: " + percent + "%"; txt_best_score_results.text = "Mejor Desempeño: " + gameDao.GetScore(this.Minigame) + "%"; if (mostrar_propuesta1 == true) { if (how_do_it == EXCELENT) { type_medal.sprite = getSpriteFromName(names_bands [0]); } else { type_medal.sprite = getSpriteFromName(names_bands [1]); } type_medal.sprite = getSpriteFromName(names_medals [how_do_it]); } else { switch (how_do_it) { case DEFICIENT: star1.sprite = getSpriteFromName(names_stars [1]); star2.sprite = getSpriteFromName(names_stars [0]); star3.sprite = getSpriteFromName(names_stars [0]); break; case GOOD: star1.sprite = getSpriteFromName(names_stars [1]); star2.sprite = getSpriteFromName(names_stars [1]); star3.sprite = getSpriteFromName(names_stars [0]); break; case EXCELENT: star1.sprite = getSpriteFromName(names_stars [1]); star2.sprite = getSpriteFromName(names_stars [1]); star3.sprite = getSpriteFromName(names_stars [1]); break; default: star1.sprite = getSpriteFromName(names_stars [1]); star2.sprite = getSpriteFromName(names_stars [0]); star3.sprite = getSpriteFromName(names_stars [0]); break; } } }