DebugLogError() private method

private DebugLogError ( string message ) : void
message string
return void
コード例 #1
0
        void OnLoginCb(ILoginResult result)
        {
            if (result.Error != null)
            {
                DebugUtils.DebugLogError(result.Error);
                OnEventHandler(SnResultCode.kLoginFailed);
            }
            else if (!FB.IsLoggedIn)
            {
                DebugUtils.DebugLog("User cancelled login.");
                OnEventHandler(SnResultCode.kLoginFailed);
            }
            else
            {
                DebugUtils.DebugLog("Login successful!");

                // AccessToken class will have session details
                var aToken = Facebook.Unity.AccessToken.CurrentAccessToken;

                // Print current access token's granted permissions
                StringBuilder perms = new StringBuilder();
                perms.Append("Permissions: ");
                foreach (string perm in aToken.Permissions)
                {
                    perms.AppendFormat("\"{0}\", ", perm);
                }
                DebugUtils.Log(perms.ToString());

                // Reqests my info and profile picture
                FB.API("me?fields=id,name,picture.width(128).height(128)", HttpMethod.GET, OnMyProfileCb);

                OnEventHandler(SnResultCode.kLoggedIn);
            }
        }
コード例 #2
0
        void OnInviteListCb(IGraphResult result)
        {
            try
            {
                Dictionary <string, object> json = Json.Deserialize(result.RawResult) as Dictionary <string, object>;
                if (json == null)
                {
                    DebugUtils.DebugLogError("OnInviteListCb - json is null.");
                    OnEventHandler(SnResultCode.kError);
                    return;
                }

                object invitable_friends = null;
                json.TryGetValue("invitable_friends", out invitable_friends);
                if (invitable_friends == null)
                {
                    DebugUtils.DebugLogError("OnInviteListCb - invitable_friends is null.");
                    OnEventHandler(SnResultCode.kError);
                    return;
                }

                invite_friends_.Clear();

                List <object> list = ((Dictionary <string, object>)invitable_friends)["data"] as List <object>;
                foreach (object item in list)
                {
                    Dictionary <string, object> info    = item as Dictionary <string, object>;
                    Dictionary <string, object> picture = ((Dictionary <string, object>)info["picture"])["data"] as Dictionary <string, object>;

                    string   url  = picture["url"] as string;
                    UserInfo user = new UserInfo();
                    user.id   = info["id"] as string;
                    user.name = info["name"] as string;
                    user.url  = url;

                    invite_friends_.Add(user);
                    DebugUtils.DebugLog(">> id:{0} name:{1} url:{2}", user.id, user.name, user.url);
                }

                DebugUtils.Log("Succeeded in getting the invite list.");
                OnEventHandler(SnResultCode.kInviteList);

                if (auto_request_picture_ && invite_friends_.Count > 0)
                {
                    StartCoroutine(RequestPictureList(invite_friends_));
                }
            }
            catch (Exception e)
            {
                DebugUtils.DebugLogError("Failure in OnInviteListCb: " + e.ToString());
            }
        }
コード例 #3
0
        void OnFriendListCb(IGraphResult result)
        {
            try
            {
                Dictionary <string, object> json = Json.Deserialize(result.RawResult) as Dictionary <string, object>;
                if (json == null)
                {
                    DebugUtils.DebugLogError("OnFriendListCb - json is null.");
                    OnEventNotify(SNResultCode.kError);
                    return;
                }

                // friend list
                object friend_list = null;
                json.TryGetValue("friends", out friend_list);
                if (friend_list == null)
                {
                    DebugUtils.DebugLogError("OnInviteListCb - friend_list is null.");
                    OnEventNotify(SNResultCode.kError);
                    return;
                }

                friends_.Clear();

                List <object> list = ((Dictionary <string, object>)friend_list)["data"] as List <object>;
                foreach (object item in list)
                {
                    Dictionary <string, object> info    = item as Dictionary <string, object>;
                    Dictionary <string, object> picture = ((Dictionary <string, object>)info["picture"])["data"] as Dictionary <string, object>;

                    UserInfo user = new UserInfo();
                    user.id   = info["id"] as string;
                    user.name = info["name"] as string;
                    user.url  = picture["url"] as string;

                    friends_.Add(user);
                    DebugUtils.DebugLog("> id:{0} name:{1} url:{2}", user.id, user.name, user.url);
                }

                DebugUtils.Log("Succeeded in getting the friend list. count:{0}", friends_.Count);
                OnEventNotify(SNResultCode.kFriendList);

                if (auto_request_picture_ && friends_.Count > 0)
                {
                    StartCoroutine(RequestPictureList(friends_));
                }
            }
            catch (Exception e)
            {
                DebugUtils.DebugLogError("Failure in OnFriendListCb: " + e.ToString());
            }
        }
コード例 #4
0
        void PostCallback(IGraphResult result)
        {
            DebugUtils.DebugLog("PostCallback called.");
            if (result.Error != null)
            {
                DebugUtils.DebugLogError(result.Error);
                OnEventHandler(SnResultCode.kPostFailed);
                return;
            }

            DebugUtils.Log("Post successful!");
            OnEventHandler(SnResultCode.kPosted);
        }
コード例 #5
0
        void OnMyProfileCb(IGraphResult result)
        {
            DebugUtils.DebugLog("OnMyProfileCb called.");
            if (result.Error != null)
            {
                DebugUtils.DebugLogError(result.Error);
                OnEventHandler(SnResultCode.kError);
                return;
            }

            try
            {
                Dictionary <string, object> json = Json.Deserialize(result.RawResult) as Dictionary <string, object>;
                if (json == null)
                {
                    DebugUtils.DebugLogError("OnMyProfileCb - json is null.");
                    OnEventHandler(SnResultCode.kError);
                    return;
                }

                // my profile
                my_info_.id   = json["id"] as string;
                my_info_.name = json["name"] as string;
                DebugUtils.Log("Facebook id: {0}, name: {1}.", my_info_.id, my_info_.name);

                // my picture
                var picture = json["picture"] as Dictionary <string, object>;
                var data    = picture["data"] as Dictionary <string, object>;
                my_info_.url = data["url"] as string;
                StartCoroutine(RequestPicture(my_info_));

                OnEventHandler(SnResultCode.kMyProfile);
            }
            catch (Exception e)
            {
                DebugUtils.DebugLogError("Failure in OnMyProfileCb: " + e.ToString());
            }
        }