Beispiel #1
0
    void OnGUI()
    {
#if !UNITY_EDITOR
        GUI.matrix = GetScaleMatrix();
#endif
        Rect area = (IsPortraitOrientation() ? new Rect(0, 0, 320, 480) : new Rect(0, 0, 480, 320));
        GUILayout.BeginArea(area);
        GUILayoutOption h = GUILayout.Height(35);

        GUILayout.Label("OpenKit Demo Scene");

        if (GUILayout.Button("Show Leaderboards & Achievements", h))
        {
            ShowLeaderboards();
        }

        if (GUILayout.Button("Show Single Leaderboard", h))
        {
            // Instead of showing a list of leaderboards, show a single specified leaderboard ID
            OKManager.ShowLeaderboard(SampleLeaderboardID);;
        }

        if (GUILayout.Button("Show Login UI", h))
        {
            ShowLoginUI();
        }

        if (GUILayout.Button("Submit Score to Level 1 Leaderboard", h))
        {
            SubmitSampleScore();
        }

        if (GUILayout.Button("Unlock Achievement", h))
        {
            UnlockSampleAchievement();
        }

        if (GUILayout.Button("Logout from OpenKit", h))
        {
            OKManager.LogoutCurrentUserFromOpenKit();
            OKLog.Info("logout of OpenKit");
        }

        if (GUILayout.Button("Get Leaderboards in C#", h))
        {
            GetLeaderboards();
        }

        if (GUILayout.Button("Get social scores", h))
        {
            GetSocialScores();
        }

        if (GUILayout.Button("Get my best score (in C#)", h))
        {
            GetMyBestScore();
        }

        GUILayout.EndArea();
    }
Beispiel #2
0
    void OnGUI()
    {
#if !UNITY_EDITOR
        GUI.matrix = GetScaleMatrix();
#endif
        Rect area = (IsPortraitOrientation() ? new Rect(0, 0, 320, 480) : new Rect(0, 0, 480, 320));
        GUILayout.BeginArea(area);
        GUILayoutOption h = GUILayout.Height(35);

        GUILayout.Label("OpenKit Demo Scene");

        if (GUILayout.Button("Show Leaderboards", h))
        {
            ShowLeaderboards();
        }

        if (GUILayout.Button("Show Achievements", h))
        {
            ShowAchievements();
        }

        if (GUILayout.Button("Show Single Leaderboard", h))
        {
            // Instead of showing a list of leaderboards, show a single specified leaderboard ID
            OKManager.ShowLeaderboard(SampleLeaderboardID);;
        }

        if (GUILayout.Button("Show Leaderboards & Achievements", h))
        {
            OKManager.ShowLeaderboardsAndAchivements();
        }

        if (GUILayout.Button("Show Login UI", h))
        {
            ShowLoginUI();
        }

        if (GUILayout.Button("Submit Score to Level 1 Leaderboard", h))
        {
            SubmitSampleScore();
        }

        if (GUILayout.Button("Unlock Achievement", h))
        {
            UnlockSampleAchievement();
        }

        if (GUILayout.Button("Logout from OpenKit", h))
        {
            OKManager.LogoutCurrentUserFromOpenKit();
            OKLog.Info("logout of OpenKit");
        }

        if (GUILayout.Button("Get Leaderboards and global scores in C#", h))
        {
            GetLeaderboards();
        }

        if (GUILayout.Button("Get my best score (in C#)", h))
        {
            GetMyBestScore();
        }

        if (GUILayout.Button("Get friends scores in C#", h))
        {
            GetSocialScores();
        }

        /*
         * if(GUILayout.Button("FB SDK Test",h)) {
         *
         *      if(FB.IsLoggedIn) {
         *              GetFBInfo();
         *              return;
         *      }
         *
         *      FB.Init(() => {
         *              OKLog.Info("FB Init called");
         *
         *              if(FB.IsLoggedIn) {
         *                      OKLog.Info("logged into FB in Unity");
         *                      GetFBInfo();
         *              } else {
         *                      OKLog.Info("not logged into FB unity");
         *                      FB.Login("email",(FBResult result) => {
         *                              OKLog.Info("Result of calling fb login: "******"Get scores with metadata", h))
        {
            GetScoresWithMetadata();
        }

        GUILayout.EndArea();
    }
    void OnGUI()
    {
#if !UNITY_EDITOR
        GUI.matrix = GetScaleMatrix();
#endif
        Rect area = (IsPortraitOrientation() ? new Rect(0, 0, 320, 480) : new Rect(0, 0, 480, 320));
        GUILayout.BeginArea(area);
        GUILayoutOption h = GUILayout.Height(35);

        GUILayout.Label("Testing OpenKit...");

        if (GUILayout.Button("Show Leaderboards & Achievements", h))
        {
            ShowLeaderboards();
        }

        if (GUILayout.Button("Show Leaderboards Landscape Only (iOS)", h))
        {
            // For Android, to show Leaderboards landscape only you simply need to modify the AndroidManifest.xml file
            OKManager.ShowLeaderboardsLandscapeOnly();
        }

        if (GUILayout.Button("Show Login UI", h))
        {
            ShowLoginUI();
        }

        if (GUILayout.Button("Submit Score to Level 2 Leaderboard", h))
        {
            SubmitSampleScore();
        }

        if (GUILayout.Button("Unlock Achievement", h))
        {
            UnlockSampleAchievement();
        }

        if (GUILayout.Button("Store dictionary", h))
        {
            StoreSampleDictionary();
        }

        if (GUILayout.Button("Retrieve Dictionary", h))
        {
            RetrieveSampleDictionary();
        }


        if (GUILayout.Button("Logout from OpenKit", h))
        {
            OKManager.LogoutCurrentUserFromOpenKit();
            OKLog.Info("logout of OpenKit");
        }

        if (GUILayout.Button("Get Leaderboards", h))
        {
            OKLeaderboard.GetLeaderboards((List <OKLeaderboard> leaderboards, OKException exception) => {
                if (leaderboards != null)
                {
                    Debug.Log("Received " + leaderboards.Count + " leaderboards ");

                    OKLeaderboard leaderboard = (OKLeaderboard)leaderboards[0];

                    Debug.Log("Getting scores for leaderboard ID: " + leaderboard.LeaderboardID + " named: " + leaderboard.Name);
                    leaderboard.GetGlobalScores(1, (List <OKScore> scores, OKException exception2) => {
                        if (exception2 == null)
                        {
                            Debug.Log("Got global scores in the callback");
                        }
                    });
                }
                else
                {
                    Debug.Log("Error getting leaderboards");
                }
            });
        }

        if (GUILayout.Button("Get social scores Friends", h))
        {
            GetSocialScores();
        }

        if (GUILayout.Button("Get my best score!", h))
        {
            GetMyBestScore();
        }

        GUILayout.EndArea();
    }