Tic Tac Toe Example FacebookRegistration - TogetherGames/Public-Unity-CSharp GitHub Wiki

The FacebookRegistration screen when displayed allows the user to register with the Together system via their Facebook account.

The DisplayText() method displays several labels depicting the Facebook profile parameters of the Facebook account linked to the Together User. If this will be the first time the User is logging into Facebook, these labels will be empty.

void DisplayText()
{
    GUI.Label(new Rect((Screen.width - 500) * 0.5f, 15, 500, 100), "Facebook Registration", m_TitleStyle);

    GUI.Label(new Rect(110, 150, 300, 100), "FacebookID:  " + m_FacebookFacebookID, m_TextStyle);

    GUI.Label(new Rect(110, 180, 300, 100), "Name:  " + m_FacebookName, m_TextStyle);

    GUI.Label(new Rect(110, 210, 300, 100), "First Name:  " + m_FacebookFirstName, m_TextStyle);

    GUI.Label(new Rect(110, 240, 300, 100), "Last Name:  " + m_FacebookLastName, m_TextStyle);

    GUI.Label(new Rect(110, 270, 300, 100), "Link:  " + m_FacebookLink, m_TextStyle);

    GUI.Label(new Rect(110, 300, 300,100), "Username:  " + m_FacebookUsername, m_TextStyle);

    GUI.Label(new Rect(110, 330, 300,100), "Gender:  " + m_FacebookGender, m_TextStyle);

    GUI.Label(new Rect(110, 360, 300,100), "Locale:  " + m_FacebookLocale, m_TextStyle);
}

The DisplayButtons() method displays the Register button. When the Register button is pressed, an attempt is made to log into Facebook.

void DisplayButtons()
{
    //Create and set the buttons
    if( GUI.Button(new Rect(10, 50, 100, 50), "Back"))
        Application.LoadLevel("Register");

    if( GUI.Button(new Rect((Screen.width - 180) * 0.5f, Screen.height - 300, 180, 50), "Log into Facebook"))
    {
        OnLogIntoFacebookButtonClicked();
    }
}