Browse Source

Updated Button comments

master
chrisgregan 11 years ago
parent
commit
4f8707408e
  1. 13
      Assets/Fungus/Scripts/GameController.cs
  2. 10
      Assets/FungusExample/Scripts/ButtonRoom.cs

13
Assets/Fungus/Scripts/GameController.cs

@ -318,7 +318,7 @@ namespace Fungus
}
/**
* Obsolete! Use Header() instead.
* Obsolete! Use SetHeader() instead.
*/
[System.Obsolete("use SetHeader() instead")]
public static void Title(string titleText)
@ -537,14 +537,13 @@ namespace Fungus
color.a = targetAlpha;
commandQueue.AddCommand(new Command.FadeSprite(spriteRenderer, color, duration, slideOffset));
}
/**
* Displays a button and sets
* Automatically adds a Button component to the object to respond to player input.
* Displays a button sprite object and sets the action callback method for the button.
* If no Collider2D already exists on the object, then a BoxCollider2D is automatically added.
* Use RemoveButton() to make a sprite non-clickable again.
* Use HideButton() to make the sprite invisible and non-clickable again.
* This method returns immediately but it queues an asynchronous command for later execution.
* @param spriteRenderer The sprite to be made clickable
* @param button The button component of the sprite object to be shown.
* @param buttonAction The Action delegate method to be called when the player clicks on the button
*/
public static void ShowButton(Button button, Action buttonAction)
@ -554,7 +553,7 @@ namespace Fungus
}
/**
* Makes a sprite stop behaving as a clickable button.
* Hides the button sprite and makes it stop behaving as a clickable button.
* This method returns immediately but it queues an asynchronous command for later execution.
* @param spriteRenderer The sprite to be made non-clickable
*/

10
Assets/FungusExample/Scripts/ButtonRoom.cs

@ -11,18 +11,16 @@ public class ButtonRoom : Room
public Button homeButton;
public Button soundButton;
public Button questionButton;
void OnEnter()
{
// Normal button, always visible
// Show button, always visible (because autoHide is set to false)
ShowButton(homeButton, OnHomeClicked);
// Auto hide buttons (hidden when story/options are being displayed)
// Show buttons, auto hides when text is displayed (because autoHide is set to true)
ShowButton(soundButton, OnMusicClicked);
ShowButton(questionButton, OnQuestionClicked);
// NOTE: Add auto buttons before first Say() command to ensure they start hidden
Say("The Mushroom read his book with great interest.");
Say("After turning the last page, he considered his options.");
@ -42,7 +40,7 @@ public class ButtonRoom : Room
{
PlaySound(effectClip);
// The music button has been configured to hide when this value is set
// The music button has been configured to automatically hide when this value is set
SetValue("PlayedSound");
}

Loading…
Cancel
Save