Beispiel #1
0
    public static void postScore(int score)
    {
        Debug.Log("Posting score int Twitter");
        if (!IsAuntifivated)
        {
            SPTwitter.AuthificateUser();
        }
        else
        {
            /////////////////////////////////////////////
            // SET POSTING MESSAGE HEAR FOR TWITTER...
            /////////////////////////////////////////////

//			SPTwitter.Post("I just Scored " +score+ " On #CirclePong iOS game , can you beat my score ?  \n Game Link : bit.ly/1v2KpyG",adScreen);
            SPTwitter.Post("OMG! I got \"" + score + "\" points in #CirclePong http://bit.ly/1v2KpyG", adScreen);
        }
    }
    void OnGUI()
    {
        if (!IsAuntifivated)
        {
            GUI.Label(new Rect(10, 10, Screen.width, 100), "App do not have permission to use your twitter account, press the button to auntificate", style);
            if (GUI.Button(new Rect(10, 70, 150, 50), "Twitter Auth"))
            {
                SPTwitter.AuthificateUser();
            }
        }
        else
        {
            if (!IsUserInfoLoaded)
            {
                GUI.Label(new Rect(10, 10, Screen.width, 100), "Great, app have  permission to use your twitter account, see the avaliable action bellow", style);

                if (GUI.Button(new Rect(10, 70, 150, 50), "Load User Data"))
                {
                    SPTwitter.LoadUserData();
                }

                if (GUI.Button(new Rect(10, 130, 150, 50), "Post Message"))
                {
                    SPTwitter.Post("Hello, I'am posting this from my app");
                }

                if (GUI.Button(new Rect(10, 190, 150, 50), "Post ScreehShot"))
                {
                    StartCoroutine(PostScreenshot());
                }

                if (GUI.Button(new Rect(10, 250, 150, 50), "Log out"))
                {
                    LogOut();
                }
            }
            else
            {
                if (SPTwitter.twitter.userInfo.profile_background != null)
                {
                    GUI.DrawTexture(new Rect(0, 0, SPTwitter.twitter.userInfo.profile_background.width, SPTwitter.twitter.userInfo.profile_background.height), SPTwitter.twitter.userInfo.profile_background);
                }


                if (SPTwitter.twitter.userInfo.profile_image != null)
                {
                    GUI.DrawTexture(new Rect(10, 10, 60, 60), SPTwitter.twitter.userInfo.profile_image);
                }


                GUI.Label(new Rect(150, 10, Screen.width, 100), SPTwitter.twitter.userInfo.name + " aka " + SPTwitter.twitter.userInfo.screen_name, style2);
                GUI.Label(new Rect(150, 30, Screen.width, 100), "Location:  " + SPTwitter.twitter.userInfo.location, style2);
                GUI.Label(new Rect(150, 50, Screen.width, 100), "Language:  " + SPTwitter.twitter.userInfo.lang, style2);

                GUI.Label(new Rect(150, 70, Screen.width, 100), "Status:  " + SPTwitter.twitter.userInfo.status.text, style2);

                GUI.Label(new Rect(150, 90, Screen.width, 100), SPTwitter.twitter.userInfo.name + " has  " + SPTwitter.twitter.userInfo.friends_count + " friends and " + SPTwitter.twitter.userInfo.statuses_count + " twits", style2);


                if (GUI.Button(new Rect(10, 130, 150, 50), "Post Message"))
                {
                    SPTwitter.Post("Hello, I'am posting this from my app");
                }

                if (GUI.Button(new Rect(10, 190, 150, 50), "Post ScreehShot"))
                {
                    StartCoroutine(PostScreenshot());
                }

                if (GUI.Button(new Rect(10, 250, 150, 50), "Log out"))
                {
                    LogOut();
                }
            }
        }
    }