コード例 #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();
    }
コード例 #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();
    }