public void OnRandomPicture()
    {
        SocialNetwork.UserInfo info = facebook_.FindFriend(Random.Range(0, facebook_.FriendListCount));
        if (info != null && info.picture != null)
        {
            if (image_ != null)
            {
                image_.texture = info.picture;
            }

            FunDebug.Log("Sets {0}'s picture.", info.name);
        }
    }
Beispiel #2
0
    public void OnGUI()
    {
        // For debugging
        GUI.enabled = !logged_in_;
        if (GUI.Button(new Rect(30, 30, 240, 40), "Start OAuth"))
        {
            twitter_.Login();
        }

        GUI.Label(new Rect(30, 70, 240, 22), "pin code : ");

        GUIStyle style = new GUIStyle(GUI.skin.textField);

        style.fontSize  = 16;
        style.alignment = TextAnchor.MiddleCenter;
        oauth_verifier_ = GUI.TextField(new Rect(30, 93, 80, 25), oauth_verifier_, style);

        GUI.enabled = oauth_verifier_.Length > 0;
        if (GUI.Button(new Rect(120, 80, 150, 40), "Access token"))
        {
            twitter_.RequestAccess(oauth_verifier_);
        }

        GUI.enabled = logged_in_;
        if (GUI.Button(new Rect(30, 140, 240, 40), "Get friends list"))
        {
            twitter_.RequestFriendList(100);
        }

        if (GUI.Button(new Rect(30, 190, 240, 40), "Tweet post"))
        {
            twitter_.Post("Funapi plugin test~");
        }

        if (GUI.Button(new Rect(290, 30, 240, 40), "Show friend's picture (random)"))
        {
            SocialNetwork.UserInfo info = twitter_.FindFriendInfo(Random.Range(0, twitter_.friend_list_count));
            if (info != null && info.picture != null)
            {
                tex_ = info.picture;
                Debug.Log(info.name + "'s picture.");
            }
        }

        if (tex_ != null)
        {
            GUI.DrawTexture(new Rect(295, 80, 73, 73), tex_);
        }
    }
Beispiel #3
0
    public void OnGUI()
    {
        // For debugging
        if (GUI.Button(new Rect(30, 30, 240, 40), "Facebook login"))
        {
            facebook_.LogInWithPublish(new List <string>()
            {
                "public_profile", "email", "user_friends", "publish_actions"
            });
        }

        GUI.enabled = logged_in_;
        if (GUI.Button(new Rect(30, 80, 240, 40), "Request friend list"))
        {
            facebook_.RequestFriendList(100);
        }

        if (GUI.Button(new Rect(30, 130, 240, 40), "Request invite list"))
        {
            facebook_.RequestInviteList(100);
        }

        if (GUI.Button(new Rect(30, 180, 240, 40), "Post to feed"))
        {
            facebook_.PostWithScreenshot("plugin test post.");
        }

        // Picture
        if (GUI.Button(new Rect(285, 30, 240, 40), "Show friend's picture (random)"))
        {
            SocialNetwork.UserInfo info = facebook_.FindFriendInfo(Random.Range(0, facebook_.friend_list_count));
            if (info != null && info.picture != null)
            {
                tex_ = info.picture;
                Debug.Log(info.name + "'s picture.");
            }
        }

        if (tex_ != null)
        {
            GUI.DrawTexture(new Rect(285, 80, 128, 128), tex_);
        }
    }