Ejemplo n.º 1
0
 // called when a player attempts to view the game's achievements
 public static void ViewAchievements()
 {
     if (isConnected == 1)
     {
         GameKitXT.ShowAchievements();
     }
 }
Ejemplo n.º 2
0
    void OnGUI()
    {
        KitchenSink.OnGUIBack();

        if (CoreXT.IsDevice)
        {
            GUILayout.BeginArea(new Rect(50, 50, Screen.width - 100, Screen.height / 2 - 50));
            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Load Player Photo", GUILayout.ExpandHeight(true)))
            {
                GameKitXT.localPlayer.LoadPhoto(GKPhotoSize.Normal, delegate(Texture2D photo) {
                    if (photo != null)
                    {
                        Log("Loaded photo");
                        GameObject.Find("PlayerPhoto").guiTexture.texture = photo;
                    }
                    else
                    {
                        Log("Local player has no photo or error loading photo.");
                    }
                });
            }

            if (GUILayout.Button("Show Game Center", GUILayout.ExpandHeight(true)))
            {
                GameKitXT.ShowGameCenter();
            }

            if (GUILayout.Button("Show Banner", GUILayout.ExpandHeight(true)))
            {
                GameKitXT.ShowBanner("Game Kit Basics", "Hello from U3DXT!");

                long score = 100;
                Debug.Log("Reporting score " + score + " on leaderboard " + leaderboardID);
                Social.ReportScore(score, leaderboardID, success => {
                    Debug.Log(success ? "Reported score successfully" : "Failed to report score");
                });
            }

            if (GUILayout.Button("Show Leaderboard", GUILayout.ExpandHeight(true)))
            {
                GameKitXT.ShowLeaderboard(leaderboardID);
            }

            if (GUILayout.Button("Show Achievement", GUILayout.ExpandHeight(true)))
            {
                GameKitXT.ShowAchievements();
            }

            if (GUILayout.Button("Get Leaderboard", GUILayout.ExpandHeight(true)))
            {
                RetrieveTopTenScores();
            }

            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();

            scoreText = GUILayout.TextField(scoreText, GUILayout.ExpandWidth(true));
            if (GUILayout.Button("Report Score", GUILayout.ExpandHeight(true)))
            {
                GameKitXT.ReportScore(leaderboardID, Convert.ToInt64(scoreText));
            }

            achievementText = GUILayout.TextField(achievementText, GUILayout.ExpandWidth(true));
            if (GUILayout.Button("Report Achievement", GUILayout.ExpandHeight(true)))
            {
                GameKitXT.ReportAchievement(achievementID, Convert.ToDouble(achievementText));
            }

            GUILayout.EndHorizontal();
            GUILayout.EndArea();
        }

        OnGUILog();
    }