Browse Source

Added tooltip annotations for properties

master
chrisgregan 11 years ago
parent
commit
6c369de409
  1. 3
      Assets/Fungus/Scripts/Button.cs
  2. 57
      Assets/Fungus/Scripts/Dialog.cs
  3. 14
      Assets/Fungus/Scripts/GUIButton.cs
  4. 18
      Assets/Fungus/Scripts/Game.cs
  5. 7
      Assets/Fungus/Scripts/View.cs

3
Assets/Fungus/Scripts/Button.cs

@ -20,16 +20,19 @@ namespace Fungus
/** /**
* Automatically hides the button when displaying story text/options or waiting. * Automatically hides the button when displaying story text/options or waiting.
*/ */
[Tooltip("Automatically hides the button when displaying story text/options or waiting.")]
public bool autoHide = true; public bool autoHide = true;
/** /**
* Automatically hides the button when the named boolean variable is set using SetBoolean() * Automatically hides the button when the named boolean variable is set using SetBoolean()
*/ */
[Tooltip("Automatically hides the button when the named boolean variable is set using the SetBoolean() command.")]
public string hideOnBoolean; public string hideOnBoolean;
/** /**
* Sound effect to play when button is clicked. * Sound effect to play when button is clicked.
*/ */
[Tooltip("Sound effect to play when button is clicked.")]
public AudioClip clickSound; public AudioClip clickSound;
float targetAlpha; float targetAlpha;

57
Assets/Fungus/Scripts/Dialog.cs

@ -71,42 +71,48 @@ namespace Fungus
public class Layout public class Layout
{ {
/** /**
* Pushes the left dialog edge away from the left side of the screen. * Push the left dialog edge away from the left side of the screen.
*/ */
[Tooltip("Push the left dialog edge away from the left side of the screen.")]
public bool leftSpace = false; public bool leftSpace = false;
/** /**
* Pushes the top dialog edge away from the top side of the screen. * Push the top dialog edge away from the top side of the screen.
*/ */
[Tooltip("Push the top dialog edge away from the top side of the screen.")]
public bool topSpace = true; public bool topSpace = true;
/** /**
* Pushes the right dialog edge away from the right side of the screen. * Push the right dialog edge away from the right side of the screen.
*/ */
[Tooltip("Push the right dialog edge away from the right side of the screen.")]
public bool rightSpace = false; public bool rightSpace = false;
/** /**
* Pushes the bottom dialog edge away from the bottom side of the screen. * Push the bottom dialog edge away from the bottom side of the screen.
*/ */
[Tooltip("Push the bottom dialog edge away from the bottom side of the screen.")]
public bool bottomSpace = false; public bool bottomSpace = false;
/** /**
* Minimum dimensions of the dialog. * Minimum dimensions of the dialog in normalized screen coordinates [0..1].
* The dialog may expand beyond these dimensions to fit content. * The dialog may expand beyond these dimensions to fit content.
* Coordinates are in normalized screen coordinates [0..1]
*/ */
[Tooltip("Minimum dimensions of the dialog in normalized screen coordinates [0..1].")]
public Vector2 size = new Vector2(1f, 0.25f); public Vector2 size = new Vector2(1f, 0.25f);
/** /**
* Offsets the dialog relative to the top left corner of the screen. * Offset the dialog relative to the top left corner of the screen.
* Coordinates are in normalized screen coordinates [0..1] * Coordinates are in normalized screen coordinates [0..1]
*/ */
[Tooltip("Offset the dialog relative to the top left corner of the screen.")]
public Vector2 offset; public Vector2 offset;
} }
/** /**
* Layout values used to control size and position of the dialog. * Layout values used to control size and position of the dialog.
*/ */
[Tooltip("Layout values used to control size and position of the dialog.")]
public Layout layout; public Layout layout;
/** /**
@ -127,74 +133,87 @@ namespace Fungus
} }
/** /**
* Indentifier for this character for use with the SetCharacter() method. * Identifier for this character for use with the SetCharacter() command.
*/ */
[Tooltip("Identifier for this character for use with the SetCharacter() command.")]
public string characterID; public string characterID;
/** /**
* Name text to display for the character. * Name text to display for the character on the dialog.
* If empty then the name field is not displayed. * If empty then the name field is not displayed.
*/ */
[Tooltip("Name text to display for the character on the dialog.")]
public string name; public string name;
/** /**
* The color for the name text. * The color of the name text label.
* This always overrides any color value specified in the NameStyle property. * This always overrides any color value specified in the NameStyle property.
*/ */
[Tooltip("The color of the name text label.")]
public Color nameColor; public Color nameColor;
/** /**
* Image to display for the character. * Image to display for the character.
* If no image is specified then no character image will be displayed. * If no image is specified then no character image will be displayed.
*/ */
[Tooltip("Image to display for the character.")]
public Texture2D image; public Texture2D image;
/** /**
* Side of dialog where character image will be displayed. * Side of dialog where character image will be displayed.
*/ */
[Tooltip("Side of dialog where character image will be displayed.")]
public ImageSide imageSide; public ImageSide imageSide;
} }
/** /**
* List of game characters that can be displayed using this dialog. * List of game characters that can be displayed using this dialog.
*/ */
[Tooltip("List of game characters that can be displayed using this dialog.")]
public Character[] characters; public Character[] characters;
/** /**
* Active character to use when displaying dialog. * Active character to use when displaying dialog (set using the SetCharacter() command).
*/ */
[Tooltip("Active character to use when displaying dialog.")]
public int activeCharacter; public int activeCharacter;
/** /**
* Writing speed for say text in Characters Per Second. * Writing speed for say text in characters per second.
*/ */
[Range(0, 1000)] [Range(0, 1000)]
[Tooltip("Writing speed for say text in characters per second.")]
public int writingSpeed = 100; public int writingSpeed = 100;
/** /**
* Sound to play while text is being written in the dialog. * Sound to play while text is being written in the dialog.
*/ */
[Tooltip("Sound to play while text is being written in the dialog.")]
public AudioClip writingSound; public AudioClip writingSound;
/** /**
* Loop the writing sound as long as text is being written. * Loop the writing sound as long as text is being written.
*/ */
[Tooltip("Loop the writing sound while text is being written.")]
public bool loopWritingSound = true; public bool loopWritingSound = true;
/** /**
* Sound effect to play when the player taps to continue. * Sound effect to play when the player taps to continue.
*/ */
[Tooltip("Sound effect to play when the player taps to continue.")]
public AudioClip continueSound; public AudioClip continueSound;
/** /**
* Icon to display under the story text when waiting for player to tap to continue. * Icon to display under the story text when waiting for player to tap to continue.
*/ */
[Tooltip("Icon to display under the story text when waiting for player to tap to continue.")]
public Texture2D continueIcon; public Texture2D continueIcon;
/** /**
* Number of buttons to display in the same row when showing multiple options * Number of buttons to display in the same row when showing multiple options.
*/ */
[Range(0, 10)] [Range(0, 10)]
[Tooltip("Number of buttons to display in the same row when showing multiple options.")]
public int buttonsPerRow = 2; public int buttonsPerRow = 2;
/** /**
@ -202,53 +221,63 @@ namespace Fungus
* This is useful to create a column of buttons with matching width. * This is useful to create a column of buttons with matching width.
*/ */
[Range(0, 1)] [Range(0, 1)]
[Tooltip("Minimum width of each button as a fraction of the screen width [0..1].")]
public float minButtonWidth = 0; public float minButtonWidth = 0;
/** /**
* Padding offset to apply around the character image, in pixels. * Padding offset to apply around the character image, in pixels.
*/ */
[Tooltip("Padding offset to apply around the character image, in pixels.")]
public RectOffset imagePadding; public RectOffset imagePadding;
/** /**
* Scale of character image, specified as a fraction of current screen height [0..1]. * Scale of character image, specified as a fraction of current screen height [0..1].
*/ */
[Range(0, 1)] [Range(0, 1)]
[Tooltip("Scale of character image, specified as a fraction of current screen height [0..1].")]
public float imageScale = 0.25f; public float imageScale = 0.25f;
/** /**
* Animation frames for multiple choice time indicator * Animation frames for multiple choice time indicator.
*/ */
[Tooltip("Animation frames for multiple choice time indicator.")]
public Texture2D[] timerAnimation; public Texture2D[] timerAnimation;
/** /**
* Scale of timer image, specified as a fraction of current screen height [0..1]. * Scale of timer image, specified as a fraction of current screen height [0..1].
*/ */
[Range(0, 1)] [Range(0, 1)]
[Tooltip("Scale of timer image, specified as a fraction of current screen height [0..1].")]
public float timerScale = 0.2f; public float timerScale = 0.2f;
/** /**
* Sound effect to play when time indicator advances. * Sound effect to play when time indicator advances.
*/ */
[Tooltip("Sound effect to play when time indicator advances.")]
public AudioClip timerSound; public AudioClip timerSound;
/** /**
* Style for dialog box background. * Style for dialog box background.
*/ */
[Tooltip("Style for dialog box background.")]
public GUIStyle boxStyle; public GUIStyle boxStyle;
/** /**
* Style for name text. * Style for name text.
*/ */
[Tooltip("Style for name text.")]
public GUIStyle nameTextStyle; public GUIStyle nameTextStyle;
/** /**
* Style for say text. * Style for say text.
*/ */
[Tooltip("Style for say text.")]
public GUIStyle sayTextStyle; public GUIStyle sayTextStyle;
/** /**
* Style for option buttons * Style for option buttons
*/ */
[Tooltip("Style for option buttons.")]
public GUIStyle buttonStyle; public GUIStyle buttonStyle;
DialogMode dialogMode; DialogMode dialogMode;

14
Assets/Fungus/Scripts/GUIButton.cs

@ -11,17 +11,21 @@ namespace Fungus
*/ */
public class GUIButton : MonoBehaviour public class GUIButton : MonoBehaviour
{ {
/// Texture to draw on the screen. /// Button texture to draw on the screen.
[Tooltip("Button texture to draw on the screen.")]
public Texture2D texture; public Texture2D texture;
/// Fraction of screen height (for resolution independent sizing). /// Button size as a fraction of screen height [0..1].
[Range(0, 1)] [Range(0, 1)]
[Tooltip("Button size as a fraction of screen height [0..1].")]
public float verticalScale = 0.2f; public float verticalScale = 0.2f;
/// Texture position on screen in localized screen coords ([0..1], [0..1]) /// Texture position on screen in localized screen coords [0..1]
[Tooltip("Texture position on screen in localized screen coords [0..1]")]
public Vector2 screenPosition; public Vector2 screenPosition;
/// Vertical and horizontal space between edge of screen and texture (in pixels). /// Space between edge of screen and texture (in pixels).
[Tooltip("Space between edge of screen and texture (in pixels).")]
public Vector2 padding; public Vector2 padding;
/// Supported actions to perform when player clicks the button. /// Supported actions to perform when player clicks the button.
@ -36,9 +40,11 @@ namespace Fungus
}; };
/// Action to perform when player clicks the button. /// Action to perform when player clicks the button.
[Tooltip("Action to perform when player clicks the button.")]
public ClickAction clickAction; public ClickAction clickAction;
/// Parameter associated with the click action. /// Parameter associated with the click action.
[Tooltip("Parameter associated with the click action.")]
public string actionParameter; public string actionParameter;
void OnGUI() void OnGUI()

18
Assets/Fungus/Scripts/Game.cs

@ -22,41 +22,47 @@ namespace Fungus
{ {
/** /**
* The currently active Room. * The currently active Room.
* Only one Room may be active at a time.
*/ */
[Tooltip("The currently active Room.")]
public Room activeRoom; public Room activeRoom;
/** /**
* Automatically display links between connected Rooms. * Show links between Rooms in scene view.
*/ */
[Tooltip("Show links between Rooms in scene view.")]
public bool showLinks = true; public bool showLinks = true;
/** /**
* Time for fade transition to complete when moving to a different Room. * Fade transition time when moving between Rooms.
*/ */
[Range(0,5)] [Range(0,5)]
[Tooltip("Fade transition time when moving between Rooms.")]
public float roomFadeDuration = 1f; public float roomFadeDuration = 1f;
/** /**
* Time for fade transition to complete when hiding/showing buttons. * Fade transition time when hiding/showing buttons.
*/ */
[Range(0,5)] [Range(0,5)]
[Tooltip("Fade transition time when hiding/showing buttons.")]
public float buttonFadeDuration = 0.25f; public float buttonFadeDuration = 0.25f;
/** /**
* Time which must elapse before buttons will automatically hide. * Time to elapse before buttons hide automatically.
*/ */
[Range(0, 60)] [Range(0, 60)]
[Tooltip("Time to elapse before buttons hide automatically.")]
public float autoHideButtonDuration = 5f; public float autoHideButtonDuration = 5f;
/** /**
* Currently active Dialog object used to display character text and menus. * Currently active Dialog object used to display character text and menus.
*/ */
[Tooltip("Currently active Dialog object used to display character text and menus.")]
public Dialog dialog; public Dialog dialog;
/** /**
* Loading image displayed when loading a scene using MoveToScene() * Loading image displayed when loading a scene using MoveToScene() command.
*/ */
[Tooltip("Loading image displayed when loading a scene using MoveToScene() command.")]
public Texture2D loadingImage; public Texture2D loadingImage;
[HideInInspector] [HideInInspector]

7
Assets/Fungus/Scripts/View.cs

@ -12,30 +12,35 @@ namespace Fungus
public class View : MonoBehaviour public class View : MonoBehaviour
{ {
/** /**
* Orthographic size of the camera view in world space coordinates. * Orthographic size of the camera view in world units.
*/ */
[Tooltip("Orthographic size of the camera view in world units.")]
public float viewSize = 0.5f; public float viewSize = 0.5f;
/** /**
* Aspect ratio of the primary view rectangle. * Aspect ratio of the primary view rectangle.
* e.g. a 4:3 aspect ratio = 1.333 * e.g. a 4:3 aspect ratio = 1.333
*/ */
[Tooltip("Aspect ratio of the primary view rectangle. (e.g. 4:3 aspect ratio = 1.333)")]
public float primaryAspectRatio = (4f / 3f); public float primaryAspectRatio = (4f / 3f);
/** /**
* Color of the primary view rectangle. * Color of the primary view rectangle.
*/ */
[Tooltip("Color of the primary view rectangle.")]
public Color primaryColor = Color.green; public Color primaryColor = Color.green;
/** /**
* Aspect ratio of the secondary view rectangle. * Aspect ratio of the secondary view rectangle.
* e.g. a 2:1 aspect ratio = 2/1 = 2.0 * e.g. a 2:1 aspect ratio = 2/1 = 2.0
*/ */
[Tooltip("Aspect ratio of the secondary view rectangle. (e.g. 2:1 aspect ratio = 2.0)")]
public float secondaryAspectRatio = (2f / 1f); public float secondaryAspectRatio = (2f / 1f);
/** /**
* Color of the secondary view rectangle. * Color of the secondary view rectangle.
*/ */
[Tooltip("Color of the secondary view rectangle.")]
public Color secondaryColor = Color.grey; public Color secondaryColor = Color.grey;
void Update() void Update()

Loading…
Cancel
Save