Пример #1
0
    void OnAuthFinished(ISN_Result res)
    {
        if (res.IsSucceeded)
        {
//			IOSNativePopUpManager.showMessage("Player Authed ", "ID: " + GameCenterManager.Player.Id + "\n" + "Alias: " + GameCenterManager.Player.Alias);
            GameCenterManager.LoadCurrentPlayerScore(ConstData.LeaderBoardId);
        }
        else
        {
//			IOSNativePopUpManager.showMessage("Game Center ", "Player authentication failed");
        }
    }
Пример #2
0
    //--------------------------------------
    // Events
    //--------------------------------------

    private void OnServiceConnected()
    {
        if (_IsDataLoaded)
        {
            OnAllLoaded();
            return;
        }


        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            foreach (UM_Leaderboard leaderboard in UltimateMobileSettings.Instance.Leaderboards)
            {
                GameCenterManager.LoadCurrentPlayerScore(leaderboard.IOSId, GCBoardTimeSpan.ALL_TIME, GCCollectionType.GLOBAL);
            }
            break;

        case RuntimePlatform.Android:
            GooglePlayManager.instance.LoadAchievements();
            GooglePlayManager.instance.LoadLeaderBoards();
            break;
        }
    }
Пример #3
0
    //--------------------------------------
    //  PUBLIC METHODS
    //--------------------------------------

    void OnGUI()
    {
        UpdateToStartPos();

        if (GameCenterManager.Player != null)
        {
            GUI.Label(new Rect(100, 10, Screen.width, 40), "ID: " + GameCenterManager.Player.PlayerId);
            GUI.Label(new Rect(100, 20, Screen.width, 40), "Name: " + GameCenterManager.Player.DisplayName);
            GUI.Label(new Rect(100, 30, Screen.width, 40), "Alias: " + GameCenterManager.Player.Alias);


            //avatar loading will take a while after the user is connectd
            //so we will draw it only after instantiation to avoid null pointer check
            //if you whant to know exaxtly when the avatar is loaded, you can subscribe on
            //GameCenterManager.OnUserInfoLoaded action
            //and checl for a spesific user ID
            if (GameCenterManager.Player.Avatar != null)
            {
                GUI.DrawTexture(new Rect(10, 10, 75, 75), GameCenterManager.Player.Avatar);
            }
        }

        StartY += YLableStep;
        StartY += YLableStep;
        StartY += YLableStep;


        GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Game Center Leaderboards", style);


        StartY += YLableStep;

        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Show Leaderboards"))
        {
            GameCenterManager.ShowLeaderboards();
        }

        StartX += XButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Load Sets Info"))
        {
            GameCenterManager.OnLeaderboardSetsInfoLoaded += OnLeaderboardSetsInfoLoaded;
            GameCenterManager.LoadLeaderboardSetInfo();
        }

        StartX  = XStartPos;
        StartY += YButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Show Leaderboard 1"))
        {
            GameCenterManager.ShowLeaderboard(leaderBoardId);
        }

        StartX += XButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Report Score LB 1"))
        {
            hiScore++;
            GameCenterManager.ReportScore(hiScore, leaderBoardId);
        }

        StartX += XButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Get Score LB 1"))
        {
            GameCenterManager.LoadCurrentPlayerScore(leaderBoardId);
        }


        StartX  = XStartPos;
        StartY += YButtonStep;

        StartY += YLableStep;
        GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Leaderboard #2, user best score: " + LB2BestScores.ToString(), style);


        StartY += YLableStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Show Leader Board2"))
        {
            GameCenterManager.ShowLeaderboard(leaderBoardId2);
        }


        StartX += XButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Show Leaderboard 2 Today"))
        {
            GameCenterManager.ShowLeaderboard(leaderBoardId2, GCBoardTimeSpan.TODAY);
        }

        StartX += XButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Report Score LB2"))
        {
            hiScore++;

            GameCenterManager.OnScoreSubmitted += OnScoreSubmitted;
            GameCenterManager.ReportScore(hiScore, leaderBoardId2);
        }


        StartX += XButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Get Score LB 2"))
        {
            GameCenterManager.LoadCurrentPlayerScore(leaderBoardId2);
        }


        StartX += XButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Send Challenge"))
        {
            GameCenterManager.IssueLeaderboardChallenge(leaderBoardId2, "Here's a tiny challenge for you");
        }



        StartX  = XStartPos;
        StartY += YButtonStep;
        StartY += YLableStep;
        GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Game Center Achievements", style);

        StartY += YLableStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Show Achievements"))
        {
            GameCenterManager.ShowAchievements();
        }

        StartX += XButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Reset Achievements"))
        {
            GameCenterManager.ResetAchievements();
        }

        StartX += XButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Submit Achievements1"))
        {
            GameCenterManager.SubmitAchievement(GameCenterManager.GetAchievementProgress(TEST_ACHIEVEMENT_1_ID) + 2.432f, TEST_ACHIEVEMENT_1_ID);
        }

        StartX += XButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Submit Achievements2"))
        {
            GameCenterManager.SubmitAchievement(88.66f, TEST_ACHIEVEMENT_2_ID, false);
        }

        StartX += XButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Send Challenge"))
        {
            GameCenterManager.IssueAchievementChallenge(TEST_ACHIEVEMENT_1_ID, "Here's a tiny challenge for you");
        }



        StartX  = XStartPos;
        StartY += YButtonStep;
        StartY += YLableStep;
        GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "More", style);

        StartY += YLableStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Retrieve Signature"))
        {
            GameCenterManager.RetrievePlayerSignature();
            GameCenterManager.OnPlayerSignatureRetrieveResult += OnPlayerSignatureRetrieveResult;
        }
    }