Game Development Reference
In-Depth Information
Step 8. Modify the Start() function of PostTweet to that shown
in Listing 8.10 .
Listing 8.10 Retrieving Previously Stored User Twitter
Authentication Tokens
function Start()
//Get any saved user twitter authentication information
AuthToken = PlayerPrefs.GetString("AUTHTOKEN");
AuthTokenSecret = PlayerPrefs.GetString("AUTHTOKENSECRET");
UserId = PlayerPrefs.GetString("USERID");
ScreenName = PlayerPrefs.GetString("SCREENNAME");
//user hasn't connected to Twitter and allowed access
if(UserId == "" && ScreenName == "")
Connected = true;
Step 9. After the user has submitted the PIN for the first time and
has been authenticated successfully, you'll want to set the PlayerPrefs.
To do this, modify the SubmitPIN() function of PostTweet to that in
Listing 8.11 .
Listing 8.11 Saving User Twitter Authentication Values
for the Application
function SubmitPIN()
var emptyBody: byte[] = new byte[1];
emptyBody[0] = 0;
var authStep2 = new WWW(AccessTokenURL, emptyBody, headers);
yield authStep2;
//remember player tokens and details for posting
//so next time they use the app you don't have to
//authenticate with Twitter again
AuthToken = TwitterHelpers.GetAuthToken(authStep2.text);
Search Nedrilad ::

Custom Search