Exemplo n.º 1
0
 //unlocks the splitter with the given name
 public void Unlock_Splitter(string name)
 {
     splittersUnlocked [Splitter_Lookup_Index_by_Name(name)] = true;
     PlayerPrefs.SetInt(name + " Splitter unlocked", 1);
     if (notification != null)
     {
         notification.Achievement_Unlocked(name, "Splitter");
     }
     if (gpgh != null && gpgh.isSignedIn())
     {
         Social.ReportProgress(Name_to_ID(true, name), 100.0f, (bool success) => {
             // handle success or failure, dunno if necessary here
         });
     }
 }
Exemplo n.º 2
0
    public void activate()
    {
        if (isActive || isBusy)
        {
            return;
        }

        if (!gpgh.isSignedIn())
        {
            stage            = 0;
            description.text = prompts[0];
        }
        else
        {
            stage            = 1;
            description.text = prompts[1];
        }
        isActive  = true;
        isBusy    = true;
        startTime = Time.time;
    }
Exemplo n.º 3
0
    //use this to add new high scores
    public void Add_Score(string gameMode, int score)
    {
        //you need to actually score to save a high score
        if (score == 0)
        {
            return;
        }
        int tempScore = score;

        GameObject temp = GameObject.FindGameObjectWithTag("Google Play");

        if (temp != null)
        {
            gpgh = temp.GetComponent <GPG_Handler>();
            if (gpgh.isSignedIn())
            {
                gpgh.Post_Score(gameMode, score);
            }
        }

        for (int i = 0; i < 15; i++)
        {
            int currScore = PlayerPrefs.GetInt(gameMode + " score " + i, 0);
            if (currScore == 0)
            {
                //We've hit the end of the list. Place the score here and exit
                PlayerPrefs.SetInt(gameMode + " score " + i, tempScore);
                break;
            }
            else if (currScore <= tempScore)
            {
                //continue looking through the list
                PlayerPrefs.SetInt(gameMode + " score " + i, tempScore);
                tempScore = currScore;
            }
        }
    }
Exemplo n.º 4
0
    //this actually fills the list in
    public void Populate_Scores_List()
    {
        if (Lookup_Scope(Scopes.CurrentScreen()) == "Local")
        {
            string gameMode = Lookup_Game_Type(Modes.CurrentScreen());
            for (int i = 0; i < 15; i++)
            {
                int currScore = PlayerPrefs.GetInt(gameMode + " score " + i, 0);
                if (currScore == 0)
                {
                    ScoreList[i].text = (i + 1) + ". -------";
                }
                else
                {
                    ScoreList[i].text = (i + 1) + ". " + currScore;
                }
            }
        }
        else
        {
            //TODO: Implement global and friends lists for real
            for (int i = 0; i < 14; i++)
            {
                ScoreList[i].text = (i + 1) + " -------";
            }
            if (gpgh != null && gpgh.isSignedIn())
            {
                ScoreList[14].text = "Called this";
                ILeaderboard lb = PlayGamesPlatform.Instance.CreateLeaderboard();
                switch (Lookup_Game_Type(Modes.CurrentScreen()))
                {
                case "Wiz":
                    lb.id = GPG_Ids.leaderboard_wiz_split_leaderboard;
                    break;

                case "Quick":
                    lb.id = GPG_Ids.leaderboard_quick_split_leaderboard;
                    break;

                case "Wit":
                    lb.id = GPG_Ids.leaderboard_wit_split_leaderboard;
                    break;

                case "Holy":
                    lb.id = GPG_Ids.leaderboard_holy_split_leaderboard;
                    break;

                default:
                    lb.id = GPG_Ids.leaderboard_wiz_split_leaderboard;
                    break;
                }
                ScoreList[3].text = Lookup_Game_Type(Modes.CurrentScreen());
                lb.LoadScores(ok => {
                    if (ok)
                    {
                        ScoreList[4].text = "Good";
                        LoadUsersandScores(lb);
                    }
                    else
                    {
                        Debug.Log("Error retrieving leaderboardi");
                        ScoreList[4].text = "Error";
                        LoadUsersandScores(null);
                    }
                });
            }
        }
    }