コード例 #1
0
 public void ShowLeaderboardByID()
 {
     Debug.Log("ShowLeaderboardByID");
     GameCenterManager.OnFriendsListLoaded += (SA.Common.Models.Result obj) => {
         Debug.Log("Loaded: " + GameCenterManager.FriendsList.Count + " fiends");
     };
     GameCenterManager.RetrieveFriends();
 }
コード例 #2
0
    //--------------------------------------
    // Friends
    //--------------------------------------

    public void LoadFriends()
    {
        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            GameCenterManager.RetrieveFriends();
            break;

        case RuntimePlatform.Android:
            GooglePlayManager.Instance.LoadFriends();
            break;
        }
    }
コード例 #3
0
    //--------------------------------------
    // Friends
    //--------------------------------------

    public void LoadFriends()
    {
        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            GameCenterManager.RetrieveFriends();
            break;

        case RuntimePlatform.Android:
            if (UltimateMobileSettings.Instance.PlatformEngine == UM_PlatformDependencies.Amazon)
            {
                //Just do nothing for Amazon
            }
            else
            {
                GooglePlayManager.Instance.LoadFriends();
            }
            break;
        }
    }
コード例 #4
0
    void OnGUI()
    {
        GUI.Label(new Rect(10, 20, 400, 40), "Friend List Load Example", headerStyle);

        if (GUI.Button(new Rect(300, 10, 150, 50), "Load Friends"))
        {
            GameCenterManager.OnFriendsListLoaded += OnFriendsListLoaded;
            GameCenterManager.RetrieveFriends();
        }


        if (GUI.Button(new Rect(500, 10, 150, 50), "Invite Friends"))
        {
            GK_FriendRequest r = new GK_FriendRequest();
            r.Send();
        }

        if (GUI.Button(new Rect(700, 10, 150, 50), "Invite with Emails"))
        {
            GK_FriendRequest r = new GK_FriendRequest();
            r.addRecipientsWithEmailAddresses("*****@*****.**", "*****@*****.**");
            r.Send();
        }



        if (!renderFriendsList)
        {
            return;
        }

        if (GUI.Button(new Rect(500, 10, 180, 50), "Leaberboard Challenge All"))
        {
            GameCenterManager.IssueLeaderboardChallenge(ChallengeLeaderboard, "Your message here", GameCenterManager.FriendsList.ToArray());
        }


        if (GUI.Button(new Rect(730, 10, 180, 50), "Achievement Challenge All"))
        {
            GameCenterManager.IssueAchievementChallenge(ChallengeAchievement, "Your message here", GameCenterManager.FriendsList.ToArray());
        }


        GUI.Label(new Rect(10, 90, 100, 40), "id", boardStyle);
        GUI.Label(new Rect(150, 90, 100, 40), "name", boardStyle);;
        GUI.Label(new Rect(300, 90, 100, 40), "avatar ", boardStyle);

        int i = 1;

        foreach (string FriendId in GameCenterManager.FriendsList)
        {
            GK_Player player = GameCenterManager.GetPlayerById(FriendId);
            if (player != null)
            {
                GUI.Label(new Rect(10, 90 + 70 * i, 100, 40), player.Id, boardStyle);
                GUI.Label(new Rect(150, 90 + 70 * i, 100, 40), player.Alias, boardStyle);
                if (player.SmallPhoto != null)
                {
                    GUI.DrawTexture(new Rect(300, 75 + 70 * i, 50, 50), player.SmallPhoto);
                }
                else
                {
                    GUI.Label(new Rect(300, 90 + 70 * i, 100, 40), "no photo ", boardStyle);
                }

                if (GUI.Button(new Rect(450, 90 + 70 * i, 150, 30), "Challenge Leaderboard"))
                {
                    GameCenterManager.IssueLeaderboardChallenge(ChallengeLeaderboard, "Your message here", FriendId);
                }

                if (GUI.Button(new Rect(650, 90 + 70 * i, 150, 30), "Challenge Achievement"))
                {
                    GameCenterManager.IssueAchievementChallenge(ChallengeAchievement, "Your message here", FriendId);
                }


                i++;
            }
        }
    }
コード例 #5
0
    void OnGUI()
    {
        GUI.Label(new Rect(10, 20, 400, 40), "Friend List Load Example", headerStyle);

        if (GUI.Button(new Rect(300, 10, 150, 50), "Load Friends"))
        {
            GameCenterManager.RetrieveFriends();
        }


        if (!renderFriendsList)
        {
            return;
        }

        if (GUI.Button(new Rect(500, 10, 180, 50), "Leaberboard Chalange All"))
        {
            GameCenterManager.issueLeaderboardChallenge(ChalangeLeadeboard, "Your message here", GameCenterManager.friendsList.ToArray());
        }


        if (GUI.Button(new Rect(730, 10, 180, 50), "Achievement Chalange All"))
        {
            GameCenterManager.issueAchievementChallenge(ChalangeAchivment, "Your message here", GameCenterManager.friendsList.ToArray());
        }


        GUI.Label(new Rect(10, 90, 100, 40), "id", boardStyle);
        GUI.Label(new Rect(150, 90, 100, 40), "name", boardStyle);;
        GUI.Label(new Rect(300, 90, 100, 40), "avatar ", boardStyle);

        int i = 1;

        foreach (string FriendId in GameCenterManager.friendsList)
        {
            GameCenterPlayerTemplate player = GameCenterManager.GetPlayerById(FriendId);
            if (player != null)
            {
                GUI.Label(new Rect(10, 90 + 70 * i, 100, 40), player.playerId, boardStyle);
                GUI.Label(new Rect(150, 90 + 70 * i, 100, 40), player.alias, boardStyle);
                if (player.avatar != null)
                {
                    GUI.DrawTexture(new Rect(300, 75 + 70 * i, 50, 50), player.avatar);
                }
                else
                {
                    GUI.Label(new Rect(300, 90 + 70 * i, 100, 40), "no photo ", boardStyle);
                }

                if (GUI.Button(new Rect(450, 90 + 70 * i, 150, 30), "Chalange Leaberboard"))
                {
                    GameCenterManager.issueLeaderboardChallenge(ChalangeLeadeboard, "Your message here", FriendId);
                }

                if (GUI.Button(new Rect(650, 90 + 70 * i, 150, 30), "Chalange Achievement"))
                {
                    GameCenterManager.issueAchievementChallenge(ChalangeAchivment, "Your message here", FriendId);
                }


                i++;
            }
        }
    }