void Awake() { var score = PlayerPrefs.GetInt(_level + "_score"); //var sprite = GetComponent<UISprite>(); var btn = GetComponent <UIButton>(); switch (ScoreCounter.GetCountStars((int)score)) { case 1: btn.normalSprite = "04_level_1_star"; //sprite.spriteName = "04_level_1_star"; break; case 2: btn.normalSprite = "05_level_2_star"; //sprite.spriteName = "05_level_2_star"; break; case 3: btn.normalSprite = "06_level_3_star"; //sprite.spriteName = "06_level_3_star"; break; } }
private void EndGameProcess() { CurrentGameMode = GameMode.Victory; Screen.showCursor = true; GlobalVariables.AdditionalExplosionLevel = 0; var score = PlayerStats.Instance.LevelScore; SaveManager.SaveScoreCount(score, Getters.Application.GetBattleSceneNumber(Application.loadedLevelName)); SaveManager.SaveStarsCount(ScoreCounter.GetCountStars(score), Getters.Application.GetBattleSceneNumber(Application.loadedLevelName)); SaveManager.Save(); }
// Use this for initialization void Awake() { var score = PlayerPrefs.GetInt(Consts.SceneNames.Level1 + "_score"); var btn = GetComponent <UIButton>(); switch (ScoreCounter.GetCountStars((int)score)) { case 1: btn.normalSprite = "08_level_random_1_star"; break; case 2: btn.normalSprite = "08_level_random_2_star"; break; case 3: btn.normalSprite = "08_level_random_3_star"; break; } }
private void Victory() { bool isUsedHelp = (CurrentGameMode == GameMode.InvokeAdjuster); //Debug.LogWarning("<color=green>VICTORY</color>"); CurrentGameMode = GameMode.Victory; EventMessenger.SendMessage(GameEvent.EngGameProcess, this); if (Application.loadedLevelName.Contains("Tutorial")) { return; } var victoryPanel = _UIRoot.transform.Find("VictoryPanel"); NGUITools.SetActive(victoryPanel.gameObject, true); var timer = _UIRoot.GetComponentsInChildren <LabelTimer>().FirstOrDefault(); timer.enabled = false; int score = isUsedHelp ? 0 : ScoreCounter.TimeToStore(timer.StartTime, timer.RemainTime); var prevScore = PlayerPrefs.GetInt(Application.loadedLevelName + "_score"); //Debug.LogWarning(Application.loadedLevelName + "_score = " + prevScore); if (prevScore < score) { PlayerPrefs.SetInt(Application.loadedLevelName + "_score", score); } var scoreLabel = _UIRoot.transform.FindChild("MainGamePanel/01_spriteForText/02_lblScore"); var victorySpriteTransform = _UIRoot.transform.FindChild("VictoryPanel/02_spriteTop"); var scoreLabelInVictoryPanel = victorySpriteTransform.FindChild("03_lblScore"); scoreLabelInVictoryPanel.GetComponent <UILabel>().text = score.ToString(); var victorySprite = victorySpriteTransform.GetComponent <UISprite>(); switch (ScoreCounter.GetCountStars(score)) { case 1: victorySprite.spriteName = "08_result_1_star"; break; case 2: victorySprite.spriteName = "09_result_2_star"; break; case 3: victorySprite.spriteName = "10_result_3_star"; break; } StartCoroutine( SumScoreCoroutine(scoreLabel.GetComponent <UILabel>(), scoreLabelInVictoryPanel.GetComponent <UILabel>(), score)); }