From 6c369de409f90c7c7a8189aa434a784110faf546 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Tue, 1 Jul 2014 15:50:10 +0100 Subject: [PATCH] Added tooltip annotations for properties --- Assets/Fungus/Scripts/Button.cs | 3 ++ Assets/Fungus/Scripts/Dialog.cs | 57 ++++++++++++++++++++++-------- Assets/Fungus/Scripts/GUIButton.cs | 14 +++++--- Assets/Fungus/Scripts/Game.cs | 18 ++++++---- Assets/Fungus/Scripts/View.cs | 7 +++- 5 files changed, 74 insertions(+), 25 deletions(-) diff --git a/Assets/Fungus/Scripts/Button.cs b/Assets/Fungus/Scripts/Button.cs index 3ea8cc59..178951c5 100644 --- a/Assets/Fungus/Scripts/Button.cs +++ b/Assets/Fungus/Scripts/Button.cs @@ -20,16 +20,19 @@ namespace Fungus /** * 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; /** * 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; /** * Sound effect to play when button is clicked. */ + [Tooltip("Sound effect to play when button is clicked.")] public AudioClip clickSound; float targetAlpha; diff --git a/Assets/Fungus/Scripts/Dialog.cs b/Assets/Fungus/Scripts/Dialog.cs index d73f7a53..2dc04f17 100644 --- a/Assets/Fungus/Scripts/Dialog.cs +++ b/Assets/Fungus/Scripts/Dialog.cs @@ -71,42 +71,48 @@ namespace Fungus 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; /** - * 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; /** - * 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; /** - * 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; /** - * 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. - * 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); /** - * 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] */ + [Tooltip("Offset the dialog relative to the top left corner of the screen.")] public Vector2 offset; } /** * 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; /** @@ -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; /** - * 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. */ + [Tooltip("Name text to display for the character on the dialog.")] 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. */ + [Tooltip("The color of the name text label.")] public Color nameColor; /** * Image to display for the character. * If no image is specified then no character image will be displayed. */ + [Tooltip("Image to display for the character.")] public Texture2D image; /** * Side of dialog where character image will be displayed. */ + [Tooltip("Side of dialog where character image will be displayed.")] public ImageSide imageSide; } /** * 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; /** - * 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; /** - * Writing speed for say text in Characters Per Second. + * Writing speed for say text in characters per second. */ [Range(0, 1000)] + [Tooltip("Writing speed for say text in characters per second.")] public int writingSpeed = 100; /** * 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; /** * 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; /** * Sound effect to play when the player taps to continue. */ + [Tooltip("Sound effect to play when the player taps to continue.")] public AudioClip continueSound; /** * 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; /** - * 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)] + [Tooltip("Number of buttons to display in the same row when showing multiple options.")] public int buttonsPerRow = 2; /** @@ -202,53 +221,63 @@ namespace Fungus * This is useful to create a column of buttons with matching width. */ [Range(0, 1)] + [Tooltip("Minimum width of each button as a fraction of the screen width [0..1].")] public float minButtonWidth = 0; /** * Padding offset to apply around the character image, in pixels. */ + [Tooltip("Padding offset to apply around the character image, in pixels.")] public RectOffset imagePadding; /** * Scale of character image, specified as a fraction of current screen height [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; /** - * 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; /** * Scale of timer image, specified as a fraction of current screen height [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; /** * Sound effect to play when time indicator advances. */ + [Tooltip("Sound effect to play when time indicator advances.")] public AudioClip timerSound; /** * Style for dialog box background. */ + [Tooltip("Style for dialog box background.")] public GUIStyle boxStyle; /** * Style for name text. */ + [Tooltip("Style for name text.")] public GUIStyle nameTextStyle; /** * Style for say text. */ + [Tooltip("Style for say text.")] public GUIStyle sayTextStyle; /** * Style for option buttons */ + [Tooltip("Style for option buttons.")] public GUIStyle buttonStyle; DialogMode dialogMode; diff --git a/Assets/Fungus/Scripts/GUIButton.cs b/Assets/Fungus/Scripts/GUIButton.cs index 3140b007..4decb011 100644 --- a/Assets/Fungus/Scripts/GUIButton.cs +++ b/Assets/Fungus/Scripts/GUIButton.cs @@ -11,17 +11,21 @@ namespace Fungus */ 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; - /// Fraction of screen height (for resolution independent sizing). + /// Button size as a fraction of screen height [0..1]. [Range(0, 1)] + [Tooltip("Button size as a fraction of screen height [0..1].")] 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; - /// 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; /// Supported actions to perform when player clicks the button. @@ -36,9 +40,11 @@ namespace Fungus }; /// Action to perform when player clicks the button. + [Tooltip("Action to perform when player clicks the button.")] public ClickAction clickAction; /// Parameter associated with the click action. + [Tooltip("Parameter associated with the click action.")] public string actionParameter; void OnGUI() diff --git a/Assets/Fungus/Scripts/Game.cs b/Assets/Fungus/Scripts/Game.cs index 72ad9a14..1444aab4 100644 --- a/Assets/Fungus/Scripts/Game.cs +++ b/Assets/Fungus/Scripts/Game.cs @@ -22,41 +22,47 @@ namespace Fungus { /** * The currently active Room. - * Only one Room may be active at a time. */ + [Tooltip("The currently active Room.")] 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; /** - * Time for fade transition to complete when moving to a different Room. + * Fade transition time when moving between Rooms. */ [Range(0,5)] + [Tooltip("Fade transition time when moving between Rooms.")] public float roomFadeDuration = 1f; /** - * Time for fade transition to complete when hiding/showing buttons. + * Fade transition time when hiding/showing buttons. */ [Range(0,5)] + [Tooltip("Fade transition time when hiding/showing buttons.")] public float buttonFadeDuration = 0.25f; /** - * Time which must elapse before buttons will automatically hide. + * Time to elapse before buttons hide automatically. */ [Range(0, 60)] + [Tooltip("Time to elapse before buttons hide automatically.")] public float autoHideButtonDuration = 5f; /** * 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; /** - * 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; [HideInInspector] diff --git a/Assets/Fungus/Scripts/View.cs b/Assets/Fungus/Scripts/View.cs index 56f06d4c..35fed94f 100644 --- a/Assets/Fungus/Scripts/View.cs +++ b/Assets/Fungus/Scripts/View.cs @@ -12,30 +12,35 @@ namespace Fungus 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; /** * Aspect ratio of the primary view rectangle. * 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); /** * Color of the primary view rectangle. */ + [Tooltip("Color of the primary view rectangle.")] public Color primaryColor = Color.green; /** * Aspect ratio of the secondary view rectangle. * 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); /** * Color of the secondary view rectangle. */ + [Tooltip("Color of the secondary view rectangle.")] public Color secondaryColor = Color.grey; void Update()