예제 #1
0
    public void exitToMainMenu()
    {
        Debug.Log("exiting to main");
        PhotonNetwork.LeaveRoom();
        for (int i = 0; i < dontDestroyObjects.Length; i++)
        {
            if (dontDestroyObjects[i].tag.Equals("gsh"))
            {
                dontDestroyObjects[i].GetComponent <GameSparksHandler>().destroyMe();
            }
            else
            {
                Destroy(dontDestroyObjects[i]);
            }
        }
        destroyed = true;
        //GS.Reset();
        GS.Disconnect();
        PhotonNetwork.Disconnect();
        SceneManager.LoadScene(0);
        PhotonNetwork.Destroy(gameObject);


        //PhotonNetwork.Destroy(gameObject.GetComponent<PhotonView>());

        //PhotonNetwork.LoadLevel(0);
        //numAIPlayers = 0;
        //resetSceneStillConnected.Invoke();
        //hostOfRoom = false;
        //gameBegun = false;
        //inRoom = false;
    }
예제 #2
0
 void HandlePlayModeStateChanged(PlayModeStateChange state)
 {
     if (state == PlayModeStateChange.ExitingPlayMode)
     {
         GS.Disconnect();
     }
 }
예제 #3
0
 void HandlePlayModeStateChanged()
 {
     if (!EditorApplication.isCompiling && !EditorApplication.isUpdating &&
         !EditorApplication.isPlaying && !EditorApplication.isPlayingOrWillChangePlaymode)
     {
         GS.Disconnect();
     }
 }
예제 #4
0
        static void StopPlayingIfRecompiling()
        {
            if (EditorApplication.isCompiling && EditorApplication.isPlaying)
            {
                GS.Disconnect();

                EditorApplication.isPlaying = false;
            }
        }
예제 #5
0
 virtual protected void OnApplicationPause(bool paused)
 {
     if (paused)
     {
         GS.Disconnect();
     }
     else
     {
         GS.Reconnect();
     }
 }
예제 #6
0
 public void Logout()
 {
     GS.Reset();
     GS.Disconnect();
     logoutSuccess.Fire();
     leaderboardData.Reset();
     fbFriends.Reset();
     email.Reset();
     userId.Reset();
     userName.Reset();
     print("Game Sparks logged out!!");
 }
예제 #7
0
        virtual protected void OnApplicationPause(bool paused)
        {
            if (paused)
            {
#if UNITY_EDITOR
                GS.Disconnect();
#endif
            }
            else
            {
                GS.Reconnect();
            }
        }
예제 #8
0
 /// <summary> Disconnect the user from the servers when they quit. Used for whole game as this persists due to DontDestroyOnLoad</summary>
 private void OnApplicationQuit()
 {
     new LogEventRequest().SetEventKey("UpdateOnlineStatus").SetEventAttribute("DisconnectFlag", "false").Send((_disconnectResponse) => {});
     Instance()?.GetRTSession()?.Disconnect();
     new LogEventRequest().SetEventKey("Disconnect").SetEventAttribute("MatchShortCode", m_MatchShortCode).Send((_disconnectResponse) =>
     {
         //Wait for the response from the event and then kill the process. Ideally we would quit nicely, but that's not working.
         GS.Disconnect();
         if (!Application.isEditor)
         {
             System.Diagnostics.Process.GetCurrentProcess().Kill();
         }
     });
 }
예제 #9
0
        virtual protected void OnApplicationQuit()
        {
#if UNITY_EDITOR
            GS.Disconnect();
#else
            GS.ShutDown();

            StartCoroutine("DelayedQuit");

            if (!_allowQuitting)
            {
                Application.CancelQuit();
            }
#endif
        }
    void Update()
    {
        if (GS.Available)
        {
            m_GSConnectRetryTimer = 0f;
            GSReconnecting        = false;
        }
        else
        {
            m_GSConnectRetryTimer += Time.unscaledDeltaTime;

            if (m_GSConnectRetryTimer >= m_GSConnectRetryTime)
            {
                m_GSConnectRetryTimer = 0f;
                GS.Disconnect();
                GS.Reconnect();
            }
        }
    }
예제 #11
0
        virtual protected void OnApplicationPause(bool paused)
        {
            if (paused)
            {
#if UNITY_EDITOR
                GS.Disconnect();
#endif
            }
            else
            {
                try{
                    GS.Reconnect();
                }catch (Exception e) {
                    if (ExceptionReporter != null)
                    {
                        ExceptionReporter(e);
                    }
                }
            }
        }
    public void Logout()
    {
        string registrationId = PlayerPrefs.GetString("PushRegistrationId", "");

        new LogEventRequest()
        .SetEventKey("Logout")
        .SetEventAttribute("PushRegistrationId", registrationId)
        .Send(((response) => {
            GS.Disconnect();
            GS.Reset();
        }));

        PlayerPrefs.DeleteKey("PushRegistrationId");

        if (PlayerPrefs.HasKey("LastProgressSyncDate"))
        {
            PlayerPrefs.DeleteKey("LastProgressSyncDate");
        }

        PlayerPrefs.Save();
    }
예제 #13
0
    void OnGUI()
    {
        // center labels
        GUI.skin.label.alignment     = TextAnchor.MiddleCenter;
        GUI.skin.textField.alignment = TextAnchor.MiddleCenter;

        GUILayout.BeginHorizontal();

        GUILayout.Label((GS.Available ? "AVAILABLE" : "NOT AVAILABLE"), GUILayout.Width(itemWidth), GUILayout.Height(itemHeight));
        GUILayout.Label(("SDK Version: " + GS.Version.ToString()), GUILayout.Width(itemWidth), GUILayout.Height(itemHeight));

        GUILayout.EndHorizontal();

        GUILayout.Label((GS.Authenticated ? "AUTHENTICATED" : "NOT AUTHENTICATED"), GUILayout.Width(itemWidth), GUILayout.Height(itemHeight));

        if (GUILayout.Button("Clear Log", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            myLog = "";
            myLogQueue.Clear();
        }

        if (GUILayout.Button("Logout", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            GS.Reset();
        }

        if (GS.Available)
        {
            if (GUILayout.Button("Disconnect", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
            {
                GS.Disconnect();
            }
        }
        else
        {
            if (GUILayout.Button("Reconnect", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
            {
                GS.Reconnect();
            }
        }

        if (GUILayout.Button("DeviceAuthenticationRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new DeviceAuthenticationRequest().Send((response) => {
                HandleLog("DeviceAuthenticationRequest.JSON:" + response.JSONString);
                HandleLog("DeviceAuthenticationRequest.HasErrors:" + response.HasErrors);
                HandleLog("DeviceAuthenticationRequest.UserId:" + response.UserId);
            });
        }

        if (GUILayout.Button("durableAccountDetailsRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new AccountDetailsRequest().SetDurable(true).Send(null);
        }

        if (GUILayout.Button("accountDetailsRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new AccountDetailsRequest().Send((response) => {
                HandleLog("AccountDetailsRequest.UserId:" + response.UserId);
            });
        }
        GUILayout.BeginHorizontal();

        if (GUILayout.Button("facebookConnectRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new FacebookConnectRequest().SetAccessToken(fbToken).Send((response) => {
                HandleLog("FacebookConnectRequest.HasErrors:" + response.HasErrors);
                HandleLog("FacebookConnectRequest.UserId:" + response.UserId);
            });
        }

        fbToken = GUILayout.TextField(fbToken, GUILayout.Width(itemWidth), GUILayout.Height(itemHeight));

        GUILayout.EndHorizontal();

        if (GUILayout.Button("listAchievementsRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new ListAchievementsRequest().Send((response) => {
                foreach (var c in response.Achievements)
                {
                    HandleLog("ListAchievementsRequest:shortCode:" + c.ShortCode);
                }
            });
        }

        if (GUILayout.Button("listGameFriendsRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new ListGameFriendsRequest().Send((response) => {
                foreach (var c in response.Friends)
                {
                    HandleLog("ListGameFriendsRequest.DisplayName:" + c.DisplayName);
                }
            });
        }

        if (GUILayout.Button("listVirtualGoodsRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new ListVirtualGoodsRequest().Send((response) => {
                foreach (var c in response.VirtualGoods)
                {
                    HandleLog("ListVirtualGoodsRequest.Description:" + c.Description);
                }
            });
        }

        if (GUILayout.Button("listChallengeTypeRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new ListChallengeTypeRequest().Send((response) => {
                foreach (var c in response.ChallengeTemplates)
                {
                    HandleLog("ListAchievementsRequest.Challenge:" + c.ChallengeShortCode);
                }
            });
        }

        if (GUILayout.Button("authenticationRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new AuthenticationRequest().SetUserName("gabs").SetPassword("gabs").Send((AR) => {
                if (AR.HasErrors)
                {
                    Debug.Log("Didnt Work");
                }
                else
                {
                    Debug.Log("Worked");
                }
            });
        }


        if (GUILayout.Button("leaderboardData", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new LeaderboardDataRequest().SetLeaderboardShortCode("HSCORE").SetEntryCount(10).Send((leadResponse) => {
                if (leadResponse.HasErrors)
                {
                    Debug.Log("Leaderboard data retrieval failed ...");
                }
                else
                {
                    Debug.Log("Leaderboard data retrieval succeeded ..." + leadResponse);

                    // Render the leaderboard entries on the screen

                    foreach (var entry in leadResponse.Data)
                    {
                        string myText = "Rank: " + entry.Rank.ToString() + "    UserName: "******"    Score: " + entry.GetNumberValue("SCORE").ToString();
                        Debug.Log(myText);
                    }
                }
            });
        }

        if (GUILayout.Button("listMessageRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new ListMessageRequest().Send((response) => {
                foreach (var c in response.MessageList)
                {
                    HandleLog("ListMessageRequest.MessageList:" + c.GetString("messageId"));
                }
            });
        }

        GUILayout.BeginHorizontal();

        if (GUILayout.Button("dismissMessageRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new DismissMessageRequest().SetMessageId(dismissMessageId).Send((response) => {
                HandleLog("DismissMessageRequest.HasErrors:" + response.HasErrors);
            });
        }


        dismissMessageId = GUILayout.TextField(dismissMessageId, GUILayout.Width(itemWidth), GUILayout.Height(itemHeight));

        GUILayout.EndHorizontal();

        if (GUILayout.Button("TRACE " + (GS.TraceMessages ? "ON" : "OFF"), GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            GS.TraceMessages = !GS.TraceMessages;
        }


        GUI.TextArea(new Rect(420, 5, Screen.width - 425, Screen.height - 10), myLog);
    }
예제 #14
0
 private void OnDestroy()
 {
     GS.Disconnect();
 }
    public void Update()
    {
#if (UNITY_PS4 || UNITY_XBOXONE) && !UNITY_EDITOR
        //if (Input.GetKeyUp(KeyCode.UpArrow))
        if (Input.GetKeyUp(KeyCode.Joystick1Button4))
        {
            if (currSelectedButton > 0)
            {
                currSelectedButton--;
            }
            else
            {
                currSelectedButton = numButtons - 1;
            }
        }
        //else if (Input.GetKeyUp(KeyCode.DownArrow))
        else if (Input.GetKeyUp(KeyCode.Joystick1Button5))
        {
            if (currSelectedButton < numButtons - 1)
            {
                currSelectedButton++;
            }
            else
            {
                currSelectedButton = 0;
            }
        }
        else if (Input.GetButtonDown("Fire1") || Input.GetKeyDown(KeyCode.Space))
        {
            clickedButton = true;
        }
        else if (Input.GetButtonUp("Fire1") || Input.GetKeyUp(KeyCode.Space))
        {
            clickedButton = false;

            if (currSelectedButton == 0)
            {
                myLog = "";
                myLogQueue.Clear();
            }
            else if (currSelectedButton == 1)
            {
                GS.Reset();
            }
            else if (currSelectedButton == 2)
            {
                if (GS.Available)
                {
                    GS.Disconnect();
                }
                else
                {
                    GS.Reconnect();
                }
            }
            else if (currSelectedButton == 3)
            {
                new DeviceAuthenticationRequest().Send((response) =>
                {
                    HandleLog("DeviceAuthenticationRequest.JSON:" + response.JSONString);
                    HandleLog("DeviceAuthenticationRequest.HasErrors:" + response.HasErrors);
                    HandleLog("DeviceAuthenticationRequest.UserId:" + response.UserId);
                });
            }
            else if (currSelectedButton == 4)
            {
                new AccountDetailsRequest().SetDurable(true).Send(null);
            }
            else if (currSelectedButton == 5)
            {
                new AccountDetailsRequest().Send((response) =>
                {
                    HandleLog("AccountDetailsRequest.UserId:" + response.UserId);
                });
            }
            else if (currSelectedButton == 6)
            {
                new FacebookConnectRequest().SetAccessToken(fbToken).Send((response) =>
                {
                    HandleLog("FacebookConnectRequest.HasErrors:" + response.HasErrors);
                    HandleLog("FacebookConnectRequest.UserId:" + response.UserId);
                });
            }
            else if (currSelectedButton == 7)
            {
                new ListAchievementsRequest().Send((response) =>
                {
                    foreach (var c in response.Achievements)
                    {
                        HandleLog("ListAchievementsRequest:shortCode:" + c.ShortCode);
                    }
                });
            }
            else if (currSelectedButton == 8)
            {
                new ListGameFriendsRequest().Send((response) =>
                {
                    foreach (var c in response.Friends)
                    {
                        HandleLog("ListGameFriendsRequest.DisplayName:" + c.DisplayName);
                    }
                });
            }
            else if (currSelectedButton == 9)
            {
                new ListVirtualGoodsRequest().Send((response) =>
                {
                    foreach (var c in response.VirtualGoods)
                    {
                        HandleLog("ListVirtualGoodsRequest.Description:" + c.Description);
                    }
                });
            }
            else if (currSelectedButton == 10)
            {
                new ListChallengeTypeRequest().Send((response) =>
                {
                    foreach (var c in response.ChallengeTemplates)
                    {
                        HandleLog("ListAchievementsRequest.Challenge:" + c.ChallengeShortCode);
                    }
                });
            }
            else if (currSelectedButton == 11)
            {
                new AuthenticationRequest().SetUserName("gabs").SetPassword("gabs").Send((AR) =>
                {
                    if (AR.HasErrors)
                    {
                        Debug.Log("Didnt Work");
                    }
                    else
                    {
                        Debug.Log("Worked");
                    }
                });
            }
            else if (currSelectedButton == 12)
            {
                new LeaderboardDataRequest().SetLeaderboardShortCode("HSCORE").SetEntryCount(10).Send((leadResponse) =>
                {
                    if (leadResponse.HasErrors)
                    {
                        Debug.Log("Leaderboard data retrieval failed ...");
                    }
                    else
                    {
                        Debug.Log("Leaderboard data retrieval succeeded ..." + leadResponse);

                        // Render the leaderboard entries on the screen

                        foreach (var entry in leadResponse.Data)
                        {
                            string myText = "Rank: " + entry.Rank.ToString() + "    UserName: "******"    Score: " + entry.GetNumberValue("SCORE").ToString();
                            Debug.Log(myText);
                        }
                    }
                });
            }
            else if (currSelectedButton == 13)
            {
                new ListMessageRequest().Send((response) =>
                {
                    foreach (var c in response.MessageList)
                    {
                        HandleLog("ListMessageRequest.MessageList:" + c.GetString("messageId"));
                    }
                });
            }
            else if (currSelectedButton == 14)
            {
                new DismissMessageRequest().SetMessageId(dismissMessageId).Send((response) =>
                {
                    HandleLog("DismissMessageRequest.HasErrors:" + response.HasErrors);
                });
            }
            else if (currSelectedButton == 15)
            {
                GS.TraceMessages = !GS.TraceMessages;
            }
        }
#endif
    }
    void OnGUI()
    {
        // center labels
        GUI.skin.label.alignment     = TextAnchor.MiddleCenter;
        GUI.skin.textField.alignment = TextAnchor.MiddleCenter;
        GUI.skin.textArea.alignment  = TextAnchor.LowerLeft;

        GUILayout.BeginHorizontal();

        GUILayout.Label((GS.Available ? "AVAILABLE" : "NOT AVAILABLE"), GUILayout.Width(itemWidth), GUILayout.Height(itemHeight));
        GUILayout.Label(("SDK Version: " + GS.Version.ToString()), GUILayout.Width(itemWidth), GUILayout.Height(itemHeight));

        GUILayout.EndHorizontal();

        GUILayout.Label((GS.Authenticated ? "AUTHENTICATED" : "NOT AUTHENTICATED"), GUILayout.Width(itemWidth), GUILayout.Height(itemHeight));

#if (UNITY_PS4 || UNITY_XBOXONE) && !UNITY_EDITOR
        GUI.Button(rectClearLog, "Clear Log");
        if (currSelectedButton == 0)
        {
            GUI.Box(rectClearLog, GUIContent.none, clickedButton ? rectClickedStyle : rectNormalStyle);
        }

        GUI.Button(rectLogout, "Logout");
        if (currSelectedButton == 1)
        {
            GUI.Box(rectLogout, GUIContent.none, clickedButton ? rectClickedStyle : rectNormalStyle);
        }
#else
        if (GUILayout.Button("Clear Log", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            myLog = "";
            myLogQueue.Clear();
        }

        if (GUILayout.Button("Logout", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            GS.Reset();
        }

        if (GUILayout.Button("Disconnect", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            GS.Disconnect();
        }
#endif

        if (GS.Available)
        {
#if (UNITY_PS4 || UNITY_XBOXONE) && !UNITY_EDITOR
            GUI.Button(rectDisconnect, "Disconnect");
            if (currSelectedButton == 2)
            {
                GUI.Box(rectDisconnect, GUIContent.none, clickedButton ? rectClickedStyle : rectNormalStyle);
            }
#else
#endif
        }
        else
        {
#if (UNITY_PS4 || UNITY_XBOXONE) && !UNITY_EDITOR
            GUI.Button(rectDisconnect, "Reconnect");
            if (currSelectedButton == 2)
            {
                GUI.Box(rectDisconnect, GUIContent.none, clickedButton ? rectClickedStyle : rectNormalStyle);
            }
#else
            if (GUILayout.Button("Reconnect", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
            {
                GS.Reconnect();
            }
#endif
        }

#if (UNITY_PS4 || UNITY_XBOXONE) && !UNITY_EDITOR
        GUI.Button(rectDevAuthReq, "DeviceAuthenticationRequest");
        if (currSelectedButton == 3)
        {
            GUI.Box(rectDevAuthReq, GUIContent.none, clickedButton ? rectClickedStyle : rectNormalStyle);
        }

        GUI.Button(rectDurAccDetReq, "durableAccountDetailsRequest");
        if (currSelectedButton == 4)
        {
            GUI.Box(rectDurAccDetReq, GUIContent.none, clickedButton ? rectClickedStyle : rectNormalStyle);
        }

        GUI.Button(rectAccDetReq, "accountDetailsRequest");
        if (currSelectedButton == 5)
        {
            GUI.Box(rectAccDetReq, GUIContent.none, clickedButton ? rectClickedStyle : rectNormalStyle);
        }
#else
        if (GUILayout.Button("DeviceAuthenticationRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new DeviceAuthenticationRequest().Send((response) => {
                HandleLog("DeviceAuthenticationRequest.JSON:" + response.JSONString);
                HandleLog("DeviceAuthenticationRequest.HasErrors:" + response.HasErrors);
                HandleLog("DeviceAuthenticationRequest.UserId:" + response.UserId);
            });
        }

        if (GUILayout.Button("durableAccountDetailsRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new AccountDetailsRequest().SetDurable(true).Send(null);
        }

        if (GUILayout.Button("accountDetailsRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new AccountDetailsRequest().Send((response) => {
                HandleLog("AccountDetailsRequest.UserId:" + response.UserId);
            });
        }
#endif
        GUILayout.BeginHorizontal();

#if (UNITY_PS4 || UNITY_XBOXONE) && !UNITY_EDITOR
        GUI.Button(rectFbConnectReq, "facebookConnectRequest");
        if (currSelectedButton == 6)
        {
            GUI.Box(rectFbConnectReq, GUIContent.none, clickedButton ? rectClickedStyle : rectNormalStyle);
        }

        GUILayout.Space(itemWidth + 5.0f);
#else
        if (GUILayout.Button("facebookConnectRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new FacebookConnectRequest().SetAccessToken(fbToken).Send((response) => {
                HandleLog("FacebookConnectRequest.HasErrors:" + response.HasErrors);
                HandleLog("FacebookConnectRequest.UserId:" + response.UserId);
            });
        }
#endif

        fbToken = GUILayout.TextField(fbToken, GUILayout.Width(itemWidth), GUILayout.Height(itemHeight));

        GUILayout.EndHorizontal();

#if (UNITY_PS4 || UNITY_XBOXONE) && !UNITY_EDITOR
        GUI.Button(rectListAchReq, "listAchievementsRequest");
        if (currSelectedButton == 7)
        {
            GUI.Box(rectListAchReq, GUIContent.none, clickedButton ? rectClickedStyle : rectNormalStyle);
        }

        GUI.Button(rectListGameFriendsReq, "listGameFriendsRequest");
        if (currSelectedButton == 8)
        {
            GUI.Box(rectListGameFriendsReq, GUIContent.none, clickedButton ? rectClickedStyle : rectNormalStyle);
        }

        GUI.Button(rectListVirtGoodsReq, "listVirtualGoodsRequest");
        if (currSelectedButton == 9)
        {
            GUI.Box(rectListVirtGoodsReq, GUIContent.none, clickedButton ? rectClickedStyle : rectNormalStyle);
        }

        GUI.Button(rectListChalTypeReq, "listChallengeTypeRequest");
        if (currSelectedButton == 10)
        {
            GUI.Box(rectListChalTypeReq, GUIContent.none, clickedButton ? rectClickedStyle : rectNormalStyle);
        }

        GUI.Button(rectAuthReq, "authenticationRequest");
        if (currSelectedButton == 11)
        {
            GUI.Box(rectAuthReq, GUIContent.none, clickedButton ? rectClickedStyle : rectNormalStyle);
        }

        GUI.Button(rectLeadData, "leaderboardData");
        if (currSelectedButton == 12)
        {
            GUI.Box(rectLeadData, GUIContent.none, clickedButton ? rectClickedStyle : rectNormalStyle);
        }

        GUI.Button(rectListMsgReq, "listMessageRequest");
        if (currSelectedButton == 13)
        {
            GUI.Box(rectListMsgReq, GUIContent.none, clickedButton ? rectClickedStyle : rectNormalStyle);
        }
#else
        if (GUILayout.Button("listAchievementsRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new ListAchievementsRequest().Send((response) => {
                foreach (var c in response.Achievements)
                {
                    HandleLog("ListAchievementsRequest:shortCode:" + c.ShortCode);
                }
            });
        }

        if (GUILayout.Button("listGameFriendsRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new ListGameFriendsRequest().Send((response) => {
                foreach (var c in response.Friends)
                {
                    HandleLog("ListGameFriendsRequest.DisplayName:" + c.DisplayName);
                }
            });
        }

        if (GUILayout.Button("listVirtualGoodsRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new ListVirtualGoodsRequest().Send((response) => {
                foreach (var c in response.VirtualGoods)
                {
                    HandleLog("ListVirtualGoodsRequest.Description:" + c.Description);
                }
            });
        }

        if (GUILayout.Button("listChallengeTypeRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new ListChallengeTypeRequest().Send((response) => {
                foreach (var c in response.ChallengeTemplates)
                {
                    HandleLog("ListAchievementsRequest.Challenge:" + c.ChallengeShortCode);
                }
            });
        }

        if (GUILayout.Button("authenticationRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new AuthenticationRequest().SetUserName("gabs").SetPassword("gabs").Send((AR) => {
                if (AR.HasErrors)
                {
                    Debug.Log("Didnt Work");
                }
                else
                {
                    Debug.Log("Worked");
                }
            });
        }


        if (GUILayout.Button("leaderboardData", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new LeaderboardDataRequest().SetLeaderboardShortCode("HIGHSCORE").SetEntryCount(10).Send((leadResponse) => {
                if (leadResponse.HasErrors)
                {
                    Debug.Log("Leaderboard data retrieval failed ...");
                }
                else
                {
                    Debug.Log("Leaderboard data retrieval succeeded ..." + leadResponse);

                    // Render the leaderboard entries on the screen

                    foreach (var entry in leadResponse.Data)
                    {
                        string myText = "Rank: " + entry.Rank.ToString() + "    UserName: "******"    Score: " + entry.GetNumberValue("MAX-score").ToString();
                        Debug.Log(myText);
                    }
                }
            });
        }

        if (GUILayout.Button("listMessageRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new ListMessageRequest().Send((response) => {
                foreach (var c in response.MessageList)
                {
                    HandleLog("ListMessageRequest.MessageList:" + c.GetString("messageId"));
                }
            });
        }
#endif

        GUILayout.BeginHorizontal();

#if (UNITY_PS4 || UNITY_XBOXONE) && !UNITY_EDITOR
        GUILayout.Space(itemWidth + 5.0f);

        GUI.Button(rectDismMsgReq, "dismissMessageRequest");
        if (currSelectedButton == 14)
        {
            GUI.Box(rectDismMsgReq, GUIContent.none, clickedButton ? rectClickedStyle : rectNormalStyle);
        }
#else
        if (GUILayout.Button("dismissMessageRequest", GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            new DismissMessageRequest().SetMessageId(dismissMessageId).Send((response) => {
                HandleLog("DismissMessageRequest.HasErrors:" + response.HasErrors);
            });
        }
#endif

        dismissMessageId = GUILayout.TextField(dismissMessageId, GUILayout.Width(itemWidth), GUILayout.Height(itemHeight));

        GUILayout.EndHorizontal();

#if (UNITY_PS4 || UNITY_XBOXONE) && !UNITY_EDITOR
        GUI.Button(rectTrace, "TRACE " + (GS.TraceMessages ? "ON" : "OFF"));
        if (currSelectedButton == 15)
        {
            GUI.Box(rectTrace, GUIContent.none, clickedButton ? rectClickedStyle : rectNormalStyle);
        }
#else
        if (GUILayout.Button("TRACE " + (GS.TraceMessages ? "ON" : "OFF"), GUILayout.Width(itemWidth), GUILayout.Height(itemHeight)))
        {
            GS.TraceMessages = !GS.TraceMessages;
        }
#endif

        GUI.TextArea(new Rect(420, 5, Screen.width - 425, Screen.height - 10), myLog);
    }
예제 #17
0
 virtual protected void OnApplicationQuit()
 {
     GS.Disconnect();
 }