AppRequest() public static method

public static AppRequest ( string message, string to = null, string filters = "", string excludeIds = null, int maxRecipients = null, string data = "", string title = "", FacebookDelegate callback = null ) : void
message string
to string
filters string
excludeIds string
maxRecipients int
data string
title string
callback FacebookDelegate
return void
示例#1
0
文件: DFB.cs 项目: Veryphone/VeryFarm
    public static void FBRequestDirect(string[] DanhSachIdNguoiNhan = null, string TieuDe = "Tieu De", string NoiDungTinNhan = "Noi Dung Tin Nhan", Facebook.FacebookDelegate callback = null)
    {
        string        DuLieuLuuTru    = "Test Du Lieu Luu Tru";
        List <object> DanhSachLocJson = null;

        if (callback == null)
        {
            callback = result =>
            {
                Debug.Log(result.Text);
            };
        }
        try
        {
            if (DanhSachIdNguoiNhan == null)
            {
                //throw new ArgumentException("Danh Sach Nguoi Nhan Khong Ton Tai", DanhSachIdNguoiNhan);
                Debug.LogError("Danh sach nguoi nhan ko hop le " + DanhSachIdNguoiNhan);
            }
            FB.AppRequest(
                NoiDungTinNhan,
                DanhSachIdNguoiNhan,
                DanhSachLocJson,
                null,
                null,
                DuLieuLuuTru,
                TieuDe,
                callback
                );
        }
        catch (Exception e)
        {
            Debug.LogError(e.Message);
        }
    }
示例#2
0
 // Native Invite!
 public void NativeInviteFriendsFB()
 {
     Debug.Log("FaceBookManager NativeInviteFriendsFB");
     currentState = STATE.SHARE;
             #if FACEBOOK_SDK
     if (FB.IsLoggedIn)
     {
         FB.AppRequest(
             "Let's play zombie street trsigger", null, null, null, null, null, "Let's play",
             callback : delegate(IAppRequestResult result) {
             if (result.RawResult != null)
             {
                 if (DeserializeJSONFriends(result.RawResult) != "")
                 {
                     if (GetFriendList(DeserializeJSONFriends(result.RawResult)).Count > 0)
                     {
                         if (PlayerPrefs.GetInt("Invite") == 0)
                         {
                         }
                     }
                 }
             }
         });
     }
     else
     {
         LoginFB();
     }
             #endif
 }
示例#3
0
文件: FBRequest.cs 项目: vishttt/PiPi
    public static void FBRequestMatch(string id)
    {
        List <string> recipient = null;
        string        title, message, data = string.Empty;

        // We have not played a game against a friend -- lets open an invite request
        title   = "Play Biladi-KSA with me!: ";
        message = "You have a new challenge request from your friend! Hurry up to the game and play your challenges before they expire!";

        if (id != null && id != "")
        {
            recipient = new List <string> ()
            {
                id
            }
        }
        ;


        // Prompt user to send a Game Request using FB.AppRequest
        // https://developers.facebook.com/docs/unity/reference/current/FB.AppRequest
        FB.AppRequest(
            message,
            recipient,
            null,
            null,
            null,
            data,
            title,
            AppRequestCallback
            );
    }
示例#4
0
文件: FBRequest.cs 项目: vishttt/PiPi
    // Prompt the player to send a Game Request to their friends with Friend Smash!
    public static void RequestChallenge(string id)
    {
        List <string> recipient = null;
        string        title, message, data = string.Empty;

        // We have not played a game against a friend -- lets open an invite request
        title   = "Download Biladi-KSA ";
        message = "show your friends what you are made of.";

        if (id != null && id != "")
        {
            recipient = new List <string> ()
            {
                id
            }
        }
        ;


        // Prompt user to send a Game Request using FB.AppRequest
        // https://developers.facebook.com/docs/unity/reference/current/FB.AppRequest
        FB.AppRequest(
            message,
            recipient,
            null,
            null,
            null,
            data,
            title,
            AppRequestCallback
            );
    }
示例#5
0
文件: DFB.cs 项目: Veryphone/VeryFarm
 public static void FBAskForLife(string[] userIds, Facebook.FacebookDelegate callback = null)
 {
     if (callback == null)
     {
         callback = result =>
         {
             if (!String.IsNullOrEmpty(result.Error))
             {
                 Debug.Log(result.Error);
             }
             else
             {
                 Debug.Log(result.Text);
             }
         };
     }
     try
     {
         FB.AppRequest(DString.ASK_LIFE, Facebook.OGActionType.AskFor, DString.OBJID, userIds, DString.DATA_ASK_LIFE, "Ask for a life", callback);
     }
     catch (Exception e)
     {
         Debug.LogError(e.Message);
     }
 }
示例#6
0
 /// <summary>
 /// A wrapper function that calls <c>AppRequest</c> from Facebook's API: "Prompts the user to
 /// send app requests, short messages between users."
 /// </summary>
 /// <param name="message">Message to send.</param>
 /// <param name="to">Who to send message to (can be 1 or more users).</param>
 /// <param name="extraData">Extra data.</param>
 /// <param name="dialogTitle">Dialog title.</param>
 /// <param name="success">Callback function that is called if App request succeeded.</param>
 /// <param name="fail">Callback function that is called if App request failed.</param>
 public override void AppRequest(string message, string[] to, string extraData, string dialogTitle, AppRequestSuccess success, AppRequestFailed fail)
 {
     FB.AppRequest(message,
                   to,
                   "", null, null,
                   extraData,
                   dialogTitle,
                   (FBResult result) => {
         if (result.Error != null)
         {
             SoomlaUtils.LogError(TAG, "AppRequest[result.Error]: " + result.Error);
             fail(result.Error);
         }
         else
         {
             SoomlaUtils.LogDebug(TAG, "AppRequest[result.Text]: " + result.Text);
             SoomlaUtils.LogDebug(TAG, "AppRequest[result.Texture]: " + result.Texture);
             JSONObject jsonResponse          = new JSONObject(result.Text);
             List <JSONObject> jsonRecipinets = jsonResponse["to"].list;
             List <string> recipients         = new List <string>();
             foreach (JSONObject o in jsonRecipinets)
             {
                 recipients.Add(o.str);
             }
             success(jsonResponse["request"].str, recipients);
         }
     });
 }
示例#7
0
        public void RequestFriends(string message, Action <bool> callBack)
        {
            if (!FB.IsInitialized)
            {
                if (callBack != null)
                {
                    callBack(false);
                    return;
                }
            }

            FB.AppRequest(message, null, null, null, null, null, null, result =>
            {
                if (string.IsNullOrEmpty(result.Error))
                {
                    if (callBack != null)
                    {
                        callBack(true);
                    }
                }
                else
                {
                    Log.e("RequestFriends2 FB Error:" + result.Error);
                    if (callBack != null)
                    {
                        callBack(false);
                    }
                }
            });
        }
示例#8
0
 private void onChallengeClicked()
 {
     Util.Log("onChallengeClicked");
     if (GameStateManager.Score != 0 && GameStateManager.FriendID != null)
     {
         string[] recipient = { GameStateManager.FriendID };
         FB.AppRequest(
             message: "I just smashed you " + GameStateManager.Score.ToString() + " times! Can you beat it?",
             to: recipient,
             filters: "",
             excludeIds: null,
             maxRecipients: null,
             data: "{\"challenge_score\":" + GameStateManager.Score.ToString() + "}",
             title: "Friend Smash Challenge!",
             callback: appRequestCallback
             );
     }
     else
     {
         FB.AppRequest(
             to: null,
             filters: "",
             excludeIds: null,
             message: "Friend Smash is smashing! Check it out.",
             title: "Play Friend Smash with me!",
             callback: appRequestCallback
             );
     }
 }
    private void CallAppRequestAsFriendSelector()
    {
        // If there's a Max Recipients specified, include it
        int?maxRecipients = null;

        if (FriendSelectorMax != "")
        {
            try
            {
                maxRecipients = Int32.Parse(FriendSelectorMax);
            }
            catch (Exception e)
            {
                status = e.Message;
            }
        }

        // include the exclude ids
        string[] excludeIds = (FriendSelectorExcludeIds == "") ? null : FriendSelectorExcludeIds.Split(',');

        FB.AppRequest(
            FriendSelectorMessage,
            null,
            FriendSelectorFilters,
            excludeIds,
            maxRecipients,
            FriendSelectorData,
            FriendSelectorTitle,
            Callback
            );
    }
        public void TestAppRequest()
        {
            IAppRequestResult result = null;

            string mockRequestId = "1234567890";
            var    toList        = new List <string>()
            {
                "1234567890", "9999999999"
            };

            this.Mock.ResultExtras = new Dictionary <string, object>()
            {
                { AppRequestResult.RequestIDKey, mockRequestId },
                { AppRequestResult.ToKey, string.Join(",", toList) },
            };

            FB.AppRequest(
                "Test message",
                callback :
                delegate(IAppRequestResult r)
            {
                result = r;
            });
            Assert.IsNotNull(result);
            Assert.AreEqual(result.RequestID, mockRequestId);
            Assert.IsTrue(new HashSet <string>(toList).SetEquals(result.To));
        }
示例#11
0
 public void InviteFriends()
 {
     FB.AppRequest(
         message: "This game is awesome, join me. now.",
         title: "Invite your friends to join you"
         );
 }
示例#12
0
 public void TestFBAppRequests()
 {
     Debug.Log("Entering Testing Facebook App Requests");
     FB.AppRequest("This is a message");
     text.text = "Done with AppRequests";
     Debug.Log("Exiting Testing Facebook AppRequests");
 }
示例#13
0
 public void OnBtnInviteFriends()
 {
     if (FB.IsLoggedIn)
     {
         FB.AppRequest(message: "Test Unity Asynchronous Multiplayer",
                       title: "Race with me!");
     }
 }
示例#14
0
 void fbCheck()
 {
     Time.timeScale = 0;
     FB.AppRequest(
         message: "Come play this great game!",
         callback: LogCallback
         );
 }
示例#15
0
 public void Invite3Friends()
 {
     FB.AppRequest(
         message: "this game is awesome, do yoou wanna check it out?",
         //	title: "Invite your friends to join you",
         callback: InviteCallback
         );
 }
示例#16
0
文件: FBHolder.cs 项目: ilhaeYe/RITS
 public void InviteFriends()
 {
     ds.debugTxt += "InviteButtonClicked!\n";
     FB.AppRequest(
         message: "This game is awesome, join me now!",
         title: "Invite your friends to join you"
         );
 }
示例#17
0
        public static void InviteInGameFriendsRequest()
        {
            List <object> filter = new List <object>()
            {
                "app_users"
            };

            FB.AppRequest("Best survival gam", null, filter, null, 0, string.Empty, string.Empty, HandleResult);
        }
示例#18
0
 // Native Invite!
 public void NativeInviteFriendsFB()
 {
     FB.AppRequest(
         FBSetup.Instance.inviteDialogMsg, null, null, null, null, null, FBSetup.Instance.inviteDialogTitle,
         callback : delegate(IAppRequestResult result)
     {
         print(result.RawResult);
     });
 }
示例#19
0
 public void InviteFriends()
 {
     FB.AppRequest(
         "Come play this great game!",
         null, null, null, null, null, null,
         delegate(IAppRequestResult result) {
         Debug.Log(result.RawResult);
     });
 }
示例#20
0
 public void FacebookGameRequest()
 {
     // COMPARTO UN ESTE APP  con un titulo y un mensaje
     //FB.AppRequest("Hey! Come and play this awesome game!", title: "Reso Coder Tutorial");
     FB.AppRequest("Come play this great game!", null, null, null, null, null, null, delegate(IAppRequestResult result) {
         Debug.Log(result.RawResult);
     }
                   );
 }
示例#21
0
 public void GiftWithDirectRequest(List <string> to, string message, string title, FacebookDelegate <IAppRequestResult> callback)
 {
     FB.AppRequest(message, OGActionType.SEND, PersistentSingleton <GameSettings> .Instance.FacebookOGObjectId, to, "DefaultGiftData", title, delegate(IAppRequestResult result)
     {
         if (callback != null)
         {
             callback(result);
         }
     });
 }
示例#22
0
 public void OnInviteClick()
 {
     if (FB.IsLoggedIn)
     {
         FB.AppRequest(
             message: "This game is awesome, join me now.",
             title: "Invite your friend to join you."
             );
     }
 }
示例#23
0
	public void FBAppInv(){
		FB.AppRequest(
			"Beat me! My new best score is: " + scores.ToString(),
			null, null, null, null, null, null,
			delegate (IAppRequestResult result) {
			Debug.Log(result.RawResult);
		}
		);

	}
示例#24
0
    public void SendAppRequest(List <string> targetUserId, Action <bool, string> onAppRequestCB)
    {
        _onAppRequestCB = onAppRequestCB;

        FB.AppRequest(
            "Come play this great game!",
            targetUserId,
            null, null, null, null, null,
            OnAppRequestCB);
    }
示例#25
0
 //친구초대
 public void InviteFriends()
 {
     // 순서 변경시 컴파일 에러 발생
     // message : 보낼 메시지
     // title : 메시지 보낼 친구목록 창의 타이틀
     FB.AppRequest(
         message: "This gmae is awesome, join me. now!",
         title: "Invite your firends to join you"
         );
 }
 public void ConvidaAmigos()
 {
     FB.AppRequest(
         "Te desafio a bater meu recorde do heX. Consegue?",
         null, null, null, null, null, null,
         delegate(IAppRequestResult result) {
         //Debug.Log(result.RawResult);
     }
         );
 }
示例#27
0
 public static void Invite(string inviteTitle, string inviteMessage)
 {
     if (IsAuthenticated)
     {
         FB.AppRequest(inviteMessage, null, "", null, null, "", inviteTitle, null);
     }
     else
     {
         AuthenticateAndInvite(inviteTitle, inviteMessage);
     }
 }
示例#28
0
 public void requestNewFriends()
 {
     //a todos tus amigos
     FB.AppRequest(
         "Invita a tus amigos a jugar",
         null, null, null, null, null, "Invita a tus amigos a jugar",
         delegate(IAppRequestResult result) {
         Debug.Log(result.RawResult);
     }
         );
 }
示例#29
0
    public void AppRequest(string message, string[] to = null, List <object> filters = null, string[] excludeIds = null, int?maxRecipients = null, string data = "", string title = "")
    {
        if (!IsLoggedIn)
        {
            Debug.LogWarning("Auth user before AppRequest, fail event generated");
            FB_AppRequestResult r = new FB_AppRequestResult("", "User isn't authed");
            OnAppRequestCompleteAction(r);
            return;
        }

        FB.AppRequest(message, to, filters, excludeIds, maxRecipients, data, title);
    }
示例#30
0
 public void ChallengeFriends()
 {
     FB.AppRequest("Hey, I just made " + GameOverManager.finalScore + " points. Can you beat that?",
                   null,
                   new List <object>()
     {
         "app_users"
     },
                   null, null, null, null, delegate(IAppRequestResult res) {
         Debug.Log(res.RawResult);
     });
 }