private void Awake() { DontDestroyOnLoad(this.gameObject); Leaders = new List <LeaderboardEntry>(); Leaderboard = new List <Dictionary <string, object> >(); _instance = this; }
public void ShowHighScore() { if (!Social.localUser.authenticated) { Social.localUser.Authenticate((bool success) => { if (!success) { // Couldn't connect, should probably show an error Debug.Log("Logging in; Failed"); GameObject.Find("LoginFailed").transform.localScale = LoginFailed.originalScale; return; } }); } int highscoreRelax = PlayerPrefs.GetInt("highscore1"); LeaderboardControl.OnAddScoreToLeaderBorad(GooglePlayConfig.leaderboard_relax, highscoreRelax); int highscoreNormal = PlayerPrefs.GetInt("highscore2"); LeaderboardControl.OnAddScoreToLeaderBorad(GooglePlayConfig.leaderboard_normal, highscoreNormal); int highscoreDevil = PlayerPrefs.GetInt("highscore3"); LeaderboardControl.OnAddScoreToLeaderBorad(GooglePlayConfig.leaderboard_devil, highscoreDevil); Social.Active.ShowLeaderboardUI(); }
void OnSubmit() { Debug.Log("Name: " + name.text); PlayerPrefs.SetString("playerName", name.text); LeaderboardControl.addToScorePlayerLBDict((int)ScoreControl.currentScore, name.text); GOPanel.SetActive(false); //gameObject.SetActive(false); }
private void MoveGround() { speed = GetSpeedFromAngle(RecomputeBallAngle()); Color playersColor = ComputeColor(); // Move ground left foreach (Transform child in Cubes.transform) { child.gameObject.transform.position += new Vector3(-1, 0, 0) * speed; } foreach (Transform child in Cubes.transform) { if (child.gameObject.transform.position.x < -worldScreenWidth) { child.gameObject.transform.position += new Vector3(2 * worldScreenWidth, 0, 0); changedColor = false; } else if (!changedColor && child.gameObject.transform.position.x + child.transform.lossyScale.x / 2 < Ball.transform.position.x) { // check color //Debug.Log("Ball color = " + Ball.transform.FindChild("Capsule").gameObject.GetComponent<Renderer>().material.color + " Light color = " + playersColor); if (Ball.transform.Find("Capsule").gameObject.GetComponent <Renderer>().material.color.Equals(playersColor)) { Color newColor = new Color(Random.value, Random.value, Random.value, 1.0f); // apply it on current object's material ChangeBallColor(colors[Random.Range(0, colors.Length)]); ResetRGBValues(); points += ComputePoints(playersColor); CheckHighscores(points); if (points > 5) { colors = colors3; } else if (points > 2) { colors = colors2; } if (mode == 1) { rotationAngle += additionalSpeed; additionalSpeed *= 0.6f; } else if (mode == 2) { rotationAngle += additionalSpeed; additionalSpeed *= 0.66f;// * multiplCoef; //multiplCoef = multiplCoef * multiplCoef; } else if (mode == 3) { rotationAngle += additionalSpeed; additionalSpeed *= 0.66f; } } else { int highscore = PlayerPrefs.GetInt("highscore" + mode); #if UNITY_ANDROID ActualiseAchievements(); if (points > highscore) { Highscore.changed = true; if (mode == 3) { highscoreDevil = points; if (Social.localUser.authenticated) { Social.ReportProgress(GooglePlayConfig.achievement_leviathan, 10 * highscoreDevil, (bool success) => { }); Social.ReportProgress(GooglePlayConfig.achievement_mefistofeles, 2 * highscoreDevil, (bool success) => { }); Social.ReportProgress(GooglePlayConfig.achievement_beelzebub, highscoreDevil, (bool success) => { }); Social.ReportProgress(GooglePlayConfig.achievement_lucifer, highscoreDevil / 5, (bool success) => { }); LeaderboardControl.OnAddScoreToLeaderBorad(GooglePlayConfig.leaderboard_devil, highscoreDevil); } } else if (mode == 2) { highscoreNormal = points; if (Social.localUser.authenticated) { Social.ReportProgress(GooglePlayConfig.achievement_extraordinary, 10 * highscoreNormal, (bool success) => { }); Social.ReportProgress(GooglePlayConfig.achievement_rare, 2 * highscoreNormal, (bool success) => { }); Social.ReportProgress(GooglePlayConfig.achievement_epic, highscoreNormal, (bool success) => { }); Social.ReportProgress(GooglePlayConfig.achievement_phenomenal, highscoreNormal / 5, (bool success) => { }); LeaderboardControl.OnAddScoreToLeaderBorad(GooglePlayConfig.leaderboard_normal, highscoreNormal); } } else { highscoreRelax = points; if (Social.localUser.authenticated) { Social.ReportProgress(GooglePlayConfig.achievement_talented, 10 * highscoreRelax, (bool success) => { }); Social.ReportProgress(GooglePlayConfig.achievement_chiller, 2 * highscoreRelax, (bool success) => { }); Social.ReportProgress(GooglePlayConfig.achievement_patient, highscoreRelax, (bool success) => { }); Social.ReportProgress(GooglePlayConfig.achievement_nolife, highscoreRelax / 5, (bool success) => { }); LeaderboardControl.OnAddScoreToLeaderBorad(GooglePlayConfig.leaderboard_relax, highscoreRelax); } } PlayerPrefs.SetInt("highscore" + mode, points); PlayerPrefs.Save(); } #endif PlayerPrefs.SetInt("last" + mode, points); endOfTurn = true; if (!AchievementAlert.Active()) { SceneManager.LoadScene("menu"); } else { gameFinished = true; } } changedColor = true; } RefreshReflectors(child, playersColor); } }
void Start() { numbers = new string[number_of_waves,number_of_circles]; if_clicked = new bool[number_of_waves,number_of_circles]; circles = new ClickableCircle[number_of_circles]; time = 0f; circle_to_spawn = stable_circle; //this is just to make sure that it is intialized state = GameState.INTERMISSION; upper_right = Camera.main.ViewportToWorldPoint(new Vector3(1f,1f, 10f)) - Camera.main.transform.position; time_mesh.transform.position = transform.position + (-upper_right.x*transform.right) + (upper_right.y*transform.up); SetBoundaries(); leaderboard = GameObject.Find("Leaderboards").GetComponent<LeaderboardControl>(); TouchScreenKeyboard.hideInput = true; keyboard_active = false; input_name = ""; }