Ejemplo n.º 1
0
        public static void Get(Action <Objects.Score[]> callback, int table = 0, int limit = 10, bool currentUserOnly = false)
        {
            var parameters = new Dictionary <string, string>();

            if (table != 0)
            {
                parameters.Add("table_id", table.ToString());
            }
            parameters.Add("limit", Math.Max(1, limit).ToString());

            Core.Request.Get(Constants.API_SCORES_FETCH, parameters, (Core.Response response) => {
                Objects.Score[] scores;
                if (response.success)
                {
                    int count = response.json["scores"].AsArray.Count;
                    scores    = new Objects.Score[count];

                    for (int i = 0; i < count; ++i)
                    {
                        scores[i] = new Objects.Score(response.json["scores"][i].AsObject);
                    }
                }
                else
                {
                    scores = null;
                }

                if (callback != null)
                {
                    callback(scores);
                }
            }, currentUserOnly);
        }
Ejemplo n.º 2
0
		public static void Get(Action<Objects.Score[]> callback, int table = 0, int limit = 10, bool currentUserOnly = false)
		{
			var parameters = new Dictionary<string, string>();
			if (table != 0)
			{
				parameters.Add("table_id", table.ToString());
			}
			parameters.Add("limit", Math.Max(1, limit).ToString());

			Core.Request.Get(Constants.API_SCORES_FETCH, parameters, (Core.Response response) => {
				Objects.Score[] scores;
				if (response.success)
				{
					int count = response.json["scores"].AsArray.Count;
					scores = new Objects.Score[count];

					for (int i = 0; i < count; ++i)
					{
						scores[i] = new Objects.Score(response.json["scores"][i].AsObject);
					}
				}
				else
				{
					scores = null;
				}

				if (callback != null)
				{
					callback(scores);
				}
			}, currentUserOnly);
		}
Ejemplo n.º 3
0
 public static void Add(Objects.Score score, int table = 0, Action <bool> callback = null)
 {
     Add(score.Value, score.Text, score.GuestName, table, score.Extra, callback);
 }
Ejemplo n.º 4
0
    public void Die()
    {
        if (ScoreComp.bInvincibleBoost)
        {
            return;
        }
        if (bDied)
        {
            return;
        }

        bDied = true;
        //turn off rendering of the plane - TO DO: hide the drop shadow too
        rend.enabled   = false;
        spawnTransform = transform;
        //stop airplane sound
        GetComponent <AudioSource> ().Stop();

        //spawn a broken plane
        GameObject.Instantiate(Resources.Load("DeadPlayer"), spawnTransform.position, spawnTransform.rotation);

        int DemonScore = ScoreComp.NumDemonsKilled * ScoreComp.KilledDemonBonus;
        int PieplScore = NumPieplSaved * 500;
        int WaveScore  = ScoreComp.NumWavesSurvived * ScoreComp.SurvivedWaveBonus;
        //int FireMalus = ScoreComp.NumBurningFires * ScoreComp.BurningFireMalus*(-1);
        int FinalScore = ScoreComp.Score;

        int rank = 0;

        FinalScoreDemons.text = "  x " + ScoreComp.NumDemonsKilled.ToString();
        FinalPieplSaved.text  = "    x " + NumPieplSaved.ToString();
        FinalScoreWaves.text  = "Waves x " + ScoreComp.NumWavesSurvived.ToString();
        //FinalForestFire.text = ScoreComp.NumBurningFires.ToString () + FinalForestFire.text +  FireMalus.ToString ();
        FinalScoreTotal.text = FinalScoreTotal.text + " " + FinalScore.ToString();
        FinalScoreRank.text  = FinalScoreRank.text + CalculateRank(FinalScore, out rank);

        if (GlobalSettings.Instance.UseGameJolt)
        {
            if (GameJolt.API.Manager.Instance.CurrentUser != null)
            {
                GameJolt.API.Objects.Score score = new GameJolt.API.Objects.Score(FinalScore, FinalScore.ToString());
                GameJolt.API.Scores.Add(score);
            }
            else
            {
                GameJolt.API.Scores.Add(FinalScore, string.Format("{0} points", FinalScore), "Guest");
            }
        }
        else if (GlobalSettings.Instance.UseKongregate && KongregateAPI.Instance.Connected != null)
        {
            KongregateAPI.Instance.Submit("ScorePT", FinalScore);
            KongregateAPI.Instance.Submit("ScoreOverall", FinalScore);

            KongregateAPI.Instance.Submit("KilledDemonsPT", ScoreComp.NumDemonsKilled);
            KongregateAPI.Instance.Submit("KilledDemonsOverall", ScoreComp.NumDemonsKilled);

            KongregateAPI.Instance.Submit("PiggiesSavedPT", NumPieplSaved);
            KongregateAPI.Instance.Submit("PiggiesSavedOverall", NumPieplSaved);

            KongregateAPI.Instance.Submit("DeathCount", 1);
            KongregateAPI.Instance.Submit("Rank", rank);

            KongregateAPI.Instance.Submit("WavesSurvivedPT", ScoreComp.NumWavesSurvived);
            KongregateAPI.Instance.Submit("WavesSurvivedOverall", ScoreComp.NumWavesSurvived);

            KongregateAPI.Instance.Submit("HastySkillPT", NumSpeedBonus);
            KongregateAPI.Instance.Submit("HastySkillOverall", NumSpeedBonus);

            KongregateAPI.Instance.Submit("SniperSkillPT", NumMaxShootingRange);
            KongregateAPI.Instance.Submit("SniperSkillOverall", NumMaxShootingRange);

            KongregateAPI.Instance.Submit("WhaleSkillPT", NumMaxAmmoBonus);
            KongregateAPI.Instance.Submit("WhaleSkillOverall", NumMaxAmmoBonus);
        }

        WaitingForLeaderboard = true;

        FinalScoreDisplay.enabled = true;
        FinalScoreDemons.enabled  = true;
        FinalScoreWaves.enabled   = true;
        FinalPieplSaved.enabled   = true;
        FinalForestFire.enabled   = true;
        FinalScoreTotal.enabled   = true;
        FinalScoreRank.enabled    = true;
        GameObject.Find("FinalScore").GetComponent <Image>().enabled     = true;
        GameObject.Find("FS_Demons_IMG").GetComponent <Image>().enabled  = true;
        GameObject.Find("FS_Piggies_IMG").GetComponent <Image>().enabled = true;
    }
Ejemplo n.º 5
0
    public void Die()
    {
        if (ScoreComp.bInvincibleBoost)
            return;
        if(bDied) return;

        bDied = true;
        //turn off rendering of the plane - TO DO: hide the drop shadow too
        rend.enabled = false;
        spawnTransform = transform;
        //stop airplane sound
        GetComponent<AudioSource> ().Stop ();

        //spawn a broken plane
        GameObject.Instantiate (Resources.Load ("DeadPlayer"), spawnTransform.position, spawnTransform.rotation);

        int DemonScore = ScoreComp.NumDemonsKilled * ScoreComp.KilledDemonBonus;
        int PieplScore = NumPieplSaved * 500;
        int WaveScore = ScoreComp.NumWavesSurvived * ScoreComp.SurvivedWaveBonus;
        //int FireMalus = ScoreComp.NumBurningFires * ScoreComp.BurningFireMalus*(-1);
        int FinalScore = ScoreComp.Score;

        int rank = 0;
        FinalScoreDemons.text = "  x " + ScoreComp.NumDemonsKilled.ToString ();
        FinalPieplSaved.text = "    x " + NumPieplSaved.ToString ();
        FinalScoreWaves.text = "Waves x " +ScoreComp.NumWavesSurvived.ToString ();
        //FinalForestFire.text = ScoreComp.NumBurningFires.ToString () + FinalForestFire.text +  FireMalus.ToString ();
        FinalScoreTotal.text = FinalScoreTotal.text+" " + FinalScore.ToString ();
        FinalScoreRank.text = FinalScoreRank.text + CalculateRank (FinalScore, out rank);

        if (GlobalSettings.Instance.UseGameJolt)
        {
            if (GameJolt.API.Manager.Instance.CurrentUser != null)
            {
                GameJolt.API.Objects.Score score = new GameJolt.API.Objects.Score(FinalScore, FinalScore.ToString());
                GameJolt.API.Scores.Add(score);
            }
            else
            {
                GameJolt.API.Scores.Add(FinalScore, string.Format("{0} points", FinalScore), "Guest");
            }
        }
        else if (GlobalSettings.Instance.UseKongregate && KongregateAPI.Instance.Connected != null)
        {
            KongregateAPI.Instance.Submit("ScorePT", FinalScore);
            KongregateAPI.Instance.Submit("ScoreOverall", FinalScore);

            KongregateAPI.Instance.Submit("KilledDemonsPT", ScoreComp.NumDemonsKilled);
            KongregateAPI.Instance.Submit("KilledDemonsOverall", ScoreComp.NumDemonsKilled);

            KongregateAPI.Instance.Submit("PiggiesSavedPT", NumPieplSaved);
            KongregateAPI.Instance.Submit("PiggiesSavedOverall", NumPieplSaved);

            KongregateAPI.Instance.Submit("DeathCount", 1);
            KongregateAPI.Instance.Submit("Rank", rank);

            KongregateAPI.Instance.Submit("WavesSurvivedPT", ScoreComp.NumWavesSurvived);
            KongregateAPI.Instance.Submit("WavesSurvivedOverall", ScoreComp.NumWavesSurvived);

            KongregateAPI.Instance.Submit("HastySkillPT", NumSpeedBonus);
            KongregateAPI.Instance.Submit("HastySkillOverall", NumSpeedBonus);

            KongregateAPI.Instance.Submit("SniperSkillPT", NumMaxShootingRange);
            KongregateAPI.Instance.Submit("SniperSkillOverall", NumMaxShootingRange);

            KongregateAPI.Instance.Submit("WhaleSkillPT", NumMaxAmmoBonus);
            KongregateAPI.Instance.Submit("WhaleSkillOverall", NumMaxAmmoBonus);
        }

        WaitingForLeaderboard = true;

        FinalScoreDisplay.enabled = true;
        FinalScoreDemons.enabled = true;
        FinalScoreWaves.enabled = true;
        FinalPieplSaved.enabled =true;
        FinalForestFire.enabled = true;
        FinalScoreTotal.enabled = true;
        FinalScoreRank.enabled = true;
        GameObject.Find("FinalScore").GetComponent<Image>().enabled=true;
        GameObject.Find("FS_Demons_IMG").GetComponent<Image>().enabled=true;
        GameObject.Find("FS_Piggies_IMG").GetComponent<Image>().enabled=true;
    }