// Start is called before the first frame update void Start() { //Get score from level float score = Score.GetInstance().GetPoints(); //Calculate which enum value score corresponds to ScoreLevel level = CalculateLevel(score); //Display score & correct comment SetScoreText(score); SetComment(level, score); //Initially hide all stars oneStar.enabled = false; twoStar.enabled = false; threeStar.enabled = false; //Display correct no. of stars SetStars(level); //Play the appropriate music if (level == ScoreLevel.NONE) { if (GameSettings.music) { failMusic.Play(); } } else if (GameSettings.sounds) { victoryMusic.Play(); } // Update HighScoreManager to save potential highscore highScoreDisplayText.SetActive(HighScoreManager.recieveNewScore((int)levelIndex, (int)score)); }
private void SetComment(ScoreLevel level, float score) { switch (level) { case ScoreLevel.NONE: commentDisplayText.text = ZEROSTARCOMMENT; //Display 'you need at least one star' text failedText.SetActive(true); //Hide continue button continueButton.SetActive(false); break; case ScoreLevel.ONE: commentDisplayText.text = ONESTARCOMMENT; break; case ScoreLevel.TWO: commentDisplayText.text = TWOSTARCOMMENT; break; case ScoreLevel.THREE: commentDisplayText.text = THREESTARCOMMENT; break; } //Convert score back to percentage to display string commentSuffix = (score / 100).ToString() + "%"; commentDisplayText.text += commentSuffix; }
private void SetStars(ScoreLevel level) { switch (level) { case ScoreLevel.NONE: break; case ScoreLevel.ONE: //Enable first star oneStar.enabled = true; break; case ScoreLevel.TWO: //Enable second star & call this method again for first star twoStar.enabled = true; SetStars(ScoreLevel.ONE); break; case ScoreLevel.THREE: //Enable third star & call this method again for second star threeStar.enabled = true; SetStars(ScoreLevel.TWO); break; } }
public bool Score(int scoreTaskID, ScoreLevel level, CustomerAccount currentAccount, out string message) { var scoreTask = this.GetByID(scoreTaskID); if (scoreTask != null) { var fileResults = this._fileResultService.GetEffectiveRecords(scoreTask.ItemID, currentAccount.CustomerCompanyID); if (fileResults.Where(o => o.Status != FileStatus.Audit).Count() > 0) { message = "只有所有文件审核完毕才可评分"; return(false); } if (scoreTask.ScorePersonID != currentAccount.Id) { message = "只有评分人才可进行评分"; return(false); } using (var tran = this.BeginTransaction()) { try { var dt = DateTime.Now; scoreTask.Score = level; scoreTask.ScoreTime = dt; this.Update(scoreTask); this._scoreOperationNoteService.Add(new ScoreOperationNote() { ScoreTask = scoreTask, Operationer = currentAccount, Score = level, Description = GetScoreLevelDescription(level), CreateTime = dt }); tran.Commit(); message = ""; return(true); } catch (Exception ex) { message = ex.Message; tran.Rollback(); return(false); } } } else { message = "该数据不存在"; } return(false); }
void ShowScoreLevel(ScoreLevel level) { SetText("Text_scoreLevel", ShowlevelContent(level)); //if(GameLogic.c) if (GameLogic.ComboCount > 2) { SetText("Text_combo", LanguageManager.GetContent(LanguageManager.c_defaultModuleKey, "combo", GameLogic.ComboCount)); } else { SetText("Text_combo", ""); } AnimSystem.StopAnim(GetGameObject("Image_scoreLevel"), false); AnimSystem.UguiSizeDelta(GetGameObject("Image_scoreLevel"), new Vector2(400, -1), new Vector2(400, 100), repeatCount: 2, repeatType: RepeatType.PingPang, interp: InterpType.OutBack); }
string ShowlevelContent(ScoreLevel level) { switch (level) { case ScoreLevel.bad: return(LanguageManager.GetContent(LanguageManager.c_defaultModuleKey, "bad")); case ScoreLevel.normal: return(LanguageManager.GetContent(LanguageManager.c_defaultModuleKey, "normal")); case ScoreLevel.good: return(LanguageManager.GetContent(LanguageManager.c_defaultModuleKey, "good")); case ScoreLevel.nice: return(LanguageManager.GetContent(LanguageManager.c_defaultModuleKey, "nice")); case ScoreLevel.perfect: return(LanguageManager.GetContent(LanguageManager.c_defaultModuleKey, "perfect")); default: return(""); } }
public string GetScoreLevelDescription(ScoreLevel level) { string Description; switch (level) { case ScoreLevel.NotApplicable: Description = "不适用(-)"; break; case ScoreLevel.Substandard: Description = "不达标(-2)"; break; case ScoreLevel.PartiallyCompliant: Description = "部分达标(-1)"; break; case ScoreLevel.ReachStandard: Description = "达标(0)"; break; case ScoreLevel.Conform: Description = "符合(2)"; break; case ScoreLevel.NotApplicableV2: Description = "不适用(0)"; break; default: Description = "其他"; break; } return(Description); }
static void LevelJudge(bool isError) { if (isError) { ComboCount = 0; //Score -= 30; GlobalEvent.DispatchEvent(GameEventEnum.ShowScoreLevel, ScoreLevel.bad); if (s_GameModel == GameModel.Arcade) { HP--; GlobalEvent.DispatchEvent(GameEventEnum.ScoreChange); if (HP == 0) { ApplicationStatusManager.GetStatus <GameStatus>().OpenFinishUI(); } } } else { ComboCount++; if (ComboCount > s_maxCombo) { s_maxCombo = ComboCount; } float useTime = Time.time - s_questionTime; int scoreTmp = 0; ScoreLevel level = ScoreLevel.normal; if (useTime < 4) { level = ScoreLevel.perfect; scoreTmp = 50; } else if (useTime < 6) { level = ScoreLevel.nice; scoreTmp = 20; } else if (useTime < 10) { level = ScoreLevel.good; scoreTmp = 10; } else { level = ScoreLevel.normal; scoreTmp = 5; } Score += ComboCount * scoreTmp; GlobalEvent.DispatchEvent(GameEventEnum.ShowScoreLevel, level); if (s_GameModel == GameModel.Arcade) { GlobalEvent.DispatchEvent(GameEventEnum.ScoreChange); } } }