public bool createTable([PexAssumeUnderTest] HighScoresTable target) { bool result = target.createTable(); return(result); // TODO: add assertions to method HighScoresTableTest.createTable(HighScoresTable) }
public void saveHighScore() { string name = newHighScore.GetComponent <RectTransform>().Find("Name Input").GetComponent <TMPro.TMP_InputField>().text; HighScoresTable.addEntry(scoreCounter.totalScore, name); newHighScore.GetComponent <RectTransform>().anchoredPosition = new Vector2(0f, -850f); newHighScore.GetComponent <RectTransform>().Find("Save Button").GetComponent <Button>().enabled = false; newHighScoreActive = false; menuButton.GetComponent <Button>().enabled = true; startOverButton.GetComponent <Button>().enabled = true; }
public void createTable278() { using (PexTraceListenerContext.Create()) { HighScoresTable highScoresTable; bool b; highScoresTable = new HighScoresTable(); b = this.createTable(highScoresTable); Assert.AreEqual <bool>(false, b); Assert.IsNotNull((object)highScoresTable); Assert.AreEqual <string>("Failed to open database connection", ((DBTable)highScoresTable).errorMessage); } }
/// <summary> /// Make up to 3 times to executeUpdateIfQualified and quietly return if all 3 attempts fail /// </summary> /// <param name="hsd">High Score Data</param> private void updateHighScores(HighScoreData hsd) { HighScoresTable hst = new HighScoresTable(); bool success = hst.updateIfQualified(hsd); int attempts = 1; while (!success) { success = hst.updateIfQualified(hsd); attempts++; if (attempts >= 3) { break; } } }
/// <summary> /// Try up to 3 times to get high scores /// </summary> /// <returns>List of all high scores or null if all three attempts fail</returns> private List <object> getHighScores() { HighScoresTable hst = new HighScoresTable(); hst.errorMessage = ""; bool hadSuccess = false; int attempts = 0; while (!hadSuccess) { List <object> result = hst.readAll(); if (hst.errorMessage.Equals("")) { return(result); } attempts++; if (attempts >= 3) { break; } } return(null); }
public UIScoresPresenter(HighScoresTable highScoresTable) { _highScoresTable = highScoresTable; IsVisible = true; }
// Update is called once per frame void Update() { // level failed if (time == 0 && scoreCounter.score < scoreCounter.targetScore) { MoveSight.computedLogistic = false; PlayerPrefs.DeleteKey("Delta Time"); levelFailed = true; levelPassed = false; timerText.text = "Time: " + stopTimer(); if (!decreaseScore) { StartCoroutine(WaitDecreaseScore()); } continueButton.SetActive(false); retryButton.GetComponentInChildren <TMPro.TextMeshProUGUI>().text = "Retry (" + retriesLeft + " left)"; if (retriesLeft > 0) { retryButton.SetActive(true); PlayerPrefs.SetInt("Last Level Failed", 1); } // no retries left else { // check if new high score if (!flashing && HighScoresTable.checkNewHighScore(scoreCounter.totalScore)) { newHighScore.GetComponent <RectTransform>().anchoredPosition = new Vector2(0f, -20f); newHighScore.GetComponent <RectTransform>().Find("Score Text").GetComponent <TMPro.TextMeshProUGUI>().text = "Score: " + scoreCounter.totalScore; newHighScoreActive = true; menuButton.GetComponent <Button>().enabled = false; startOverButton.GetComponent <Button>().enabled = false; } PlayerPrefs.DeleteKey("Total Score"); PlayerPrefs.DeleteKey("Level"); PlayerPrefs.DeleteKey("Time For Level"); PlayerPrefs.DeleteKey("Last Level Failed"); startOverButton.SetActive(true); if (!rewardedAdUsed) { videoAdButton.SetActive(true); } } } // level passed else if (time == 0 && scoreCounter.score >= scoreCounter.targetScore) { MoveSight.computedLogistic = false; PlayerPrefs.DeleteKey("Delta Time"); timerText.text = "Time: " + stopTimer(); if (!levelPassed) { WaitStopLevel(); } if ((levelScript.level + 1) % 5 == 0) { PlayerPrefs.SetFloat("Time For Level", timeForLevel + 2.5f); } PlayerPrefs.SetInt("Coins", CoinScript.totalCoinCount); PlayerPrefs.SetInt("Level", levelScript.level + 1); PlayerPrefs.SetInt("Total Score", scoreCounter.totalScore); levelPassed = true; levelFailed = false; } // in middle of level else if (keepTiming) { updateTime(); } // update timer text color if (MoveSight.speedBoosted) { timerText.color = new Color32(30, 149, 19, 255); } else { timerText.color = new Color32(247, 156, 17, 255); } }