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

The FacebookWallPost screen displays the fields of a potential Facebook WallPost and lets the User submit it to either their own Facebook wall or a friend's Facebook wall.

The DisplayText() method displays several labels depicting the parameters of a potential Facebook WallPost.

void DisplayText()
{
    //Create and set the labels
    GUI.Label(new Rect((Screen.width - 600) * 0.5f, 15, 600, 50), "Facebook Wall Post", m_TitleStyle);

    GUI.DrawTexture(new Rect(Screen.width - 148, 20, 128, 128), FacebookTexture, ScaleMode.ScaleToFit, true);


    GUI.Label(new Rect((Screen.width - 600) * 0.5f, 120, 600, 50), m_WallPostName, m_TextStyle);

    GUI.Label(new Rect((Screen.width - 600) * 0.5f, 150, 600, 50), m_WallPostDescription, m_TextStyle);

    GUI.Label(new Rect((Screen.width - 600) * 0.5f, 180, 600, 50), m_WallPostMessage, m_TextStyle);

    GUI.Label(new Rect((Screen.width - 600) * 0.5f, 210, 600, 50), m_WallPostLink, m_TextStyle);

    GUI.Label(new Rect((Screen.width - 600) * 0.5f, 240, 600, 50), m_WallPostCaption, m_TextStyle);
}

The DisplayButtons() method displays the Submit button. When the Submit button is pressed, the WallPost is submitted to the logged in User's Facebook Wall. If the User hadn't logged into Facebook yet, an attempt to do so is made before submitting the WallPost.

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

    if (GUI.Button(new Rect((Screen.width - 200) * 0.5f, 340, 200, 50), "Submit"))
        OnSubmitButtonClicked();
}