From 242c905857b890917b0f10de4730294146321d98 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Wed, 23 Apr 2014 14:22:40 +0100 Subject: [PATCH] Backwards compatibility support for v1.2.0 --- .../{PageBoundsEditor.cs => PageEditor.cs} | 18 +- ...oundsEditor.cs.meta => PageEditor.cs.meta} | 0 .../{PageBounds.prefab => Page.prefab} | Bin 5984 -> 5976 bytes ...ageBounds.prefab.meta => Page.prefab.meta} | 2 +- Assets/Fungus/Scripts/Button.cs | 4 +- .../Fungus/Scripts/Commands/PageCommands.cs | 101 +-- Assets/Fungus/Scripts/Game.cs | 27 +- Assets/Fungus/Scripts/GameController.cs | 61 +- Assets/Fungus/Scripts/Page.cs | 603 +----------------- Assets/Fungus/Scripts/Page.cs.meta | 2 +- Assets/Fungus/Scripts/PageBounds.cs | 45 -- Assets/Fungus/Scripts/PageController.cs | 594 +++++++++++++++++ ...eBounds.cs.meta => PageController.cs.meta} | 2 +- Assets/Fungus/Scripts/Room.cs | 2 +- Assets/FungusExample/Scenes/Example.unity | Bin 62696 -> 62712 bytes 15 files changed, 714 insertions(+), 747 deletions(-) rename Assets/Fungus/Editor/{PageBoundsEditor.cs => PageEditor.cs} (78%) rename Assets/Fungus/Editor/{PageBoundsEditor.cs.meta => PageEditor.cs.meta} (100%) rename Assets/Fungus/Prefabs/{PageBounds.prefab => Page.prefab} (77%) rename Assets/Fungus/Prefabs/{PageBounds.prefab.meta => Page.prefab.meta} (58%) delete mode 100644 Assets/Fungus/Scripts/PageBounds.cs create mode 100644 Assets/Fungus/Scripts/PageController.cs rename Assets/Fungus/Scripts/{PageBounds.cs.meta => PageController.cs.meta} (78%) diff --git a/Assets/Fungus/Editor/PageBoundsEditor.cs b/Assets/Fungus/Editor/PageEditor.cs similarity index 78% rename from Assets/Fungus/Editor/PageBoundsEditor.cs rename to Assets/Fungus/Editor/PageEditor.cs index e4f45024..5287d4ca 100644 --- a/Assets/Fungus/Editor/PageBoundsEditor.cs +++ b/Assets/Fungus/Editor/PageEditor.cs @@ -6,12 +6,12 @@ using System.Collections.Generic; namespace Fungus { [CanEditMultipleObjects] - [CustomEditor (typeof(PageBounds))] - public class PageBoundsEditor : Editor + [CustomEditor (typeof(Page))] + public class PageEditor : Editor { void OnSceneGUI () { - PageBounds t = target as PageBounds; + Page t = target as Page; // Render the parent view to help user position the page Transform parent = t.transform.parent; @@ -37,14 +37,14 @@ namespace Fungus void EditPageBounds() { - PageBounds t = target as PageBounds; + Page t = target as Page; Vector3 pos = t.transform.position; Vector3[] verts = new Vector3[4]; - verts[0] = new Vector3(pos.x + t.bounds.min.x, pos.y + t.bounds.min.y, 0); - verts[1] = new Vector3(pos.x + t.bounds.min.x, pos.y + t.bounds.max.y, 0); - verts[2] = new Vector3(pos.x + t.bounds.max.x, pos.y + t.bounds.max.y, 0); - verts[3] = new Vector3(pos.x + t.bounds.max.x, pos.y + t.bounds.min.y, 0); + verts[0] = new Vector3(pos.x + t.pageBounds.min.x, pos.y + t.pageBounds.min.y, 0); + verts[1] = new Vector3(pos.x + t.pageBounds.min.x, pos.y + t.pageBounds.max.y, 0); + verts[2] = new Vector3(pos.x + t.pageBounds.max.x, pos.y + t.pageBounds.max.y, 0); + verts[3] = new Vector3(pos.x + t.pageBounds.max.x, pos.y + t.pageBounds.min.y, 0); Handles.DrawSolidRectangleWithOutline(verts, new Color(1,1,1,0.2f), new Color(0,0,0,1)); @@ -92,7 +92,7 @@ namespace Fungus t.transform.position = newBounds.center; newBounds.center = Vector3.zero; - t.bounds = newBounds; + t.pageBounds = newBounds; } } } diff --git a/Assets/Fungus/Editor/PageBoundsEditor.cs.meta b/Assets/Fungus/Editor/PageEditor.cs.meta similarity index 100% rename from Assets/Fungus/Editor/PageBoundsEditor.cs.meta rename to Assets/Fungus/Editor/PageEditor.cs.meta diff --git a/Assets/Fungus/Prefabs/PageBounds.prefab b/Assets/Fungus/Prefabs/Page.prefab similarity index 77% rename from Assets/Fungus/Prefabs/PageBounds.prefab rename to Assets/Fungus/Prefabs/Page.prefab index 47336e2f9d652b89021747af240c74aff19c2912..18c6bb327bd5daeb4c20da70102fde4fb8fa23fc 100644 GIT binary patch delta 120 zcmaE$cSDbZfk8}&fk8ZCBZm|VYe8aqs?%m=mN|l!kqitBj8NPl#m0~TWCs8-3luwi yUdylnD)t`;ih%3|>EBryCjSt1nd~5@!U0kl05ouNiC6&8ng&xKpJDPDu_*x5JR0Bt delta 128 zcmcbi_dt(>fkBLqfk8ZBBZm|VW71}ImN|l!i3|)3j8NPl#m0~UWCs8-3luwiUdylp zD)t`;ih%3|>EBs7CjSw2nQS1>A{)MSu&WA~8MHDZex?rI>+Xa*kL4$IN+}`~Eq} K+D<+qHU$8s@*mUy diff --git a/Assets/Fungus/Prefabs/PageBounds.prefab.meta b/Assets/Fungus/Prefabs/Page.prefab.meta similarity index 58% rename from Assets/Fungus/Prefabs/PageBounds.prefab.meta rename to Assets/Fungus/Prefabs/Page.prefab.meta index 1b238304..e3e66556 100644 --- a/Assets/Fungus/Prefabs/PageBounds.prefab.meta +++ b/Assets/Fungus/Prefabs/Page.prefab.meta @@ -1,4 +1,4 @@ fileFormatVersion: 2 -guid: fb9bec1d986874625a0d5844ea7dca74 +guid: ec557b5a76ab94961964394b8511fc9b NativeFormatImporter: userData: diff --git a/Assets/Fungus/Scripts/Button.cs b/Assets/Fungus/Scripts/Button.cs index 549f1dae..174bb476 100644 --- a/Assets/Fungus/Scripts/Button.cs +++ b/Assets/Fungus/Scripts/Button.cs @@ -80,7 +80,7 @@ namespace Fungus if (autoHide) { if (showButton && - Game.GetInstance().ShowAutoButtons()) + Game.GetInstance().GetShowAutoButtons()) { targetAlpha = 1f; @@ -125,7 +125,7 @@ namespace Fungus // Ignore button press if sprite is not fully visible or // if the game is not in an idle state if (spriteRenderer.color.a != 1f || - !Game.GetInstance().ShowAutoButtons()) + !Game.GetInstance().GetShowAutoButtons()) { return; } diff --git a/Assets/Fungus/Scripts/Commands/PageCommands.cs b/Assets/Fungus/Scripts/Commands/PageCommands.cs index 99946bfa..6e4c12ea 100644 --- a/Assets/Fungus/Scripts/Commands/PageCommands.cs +++ b/Assets/Fungus/Scripts/Commands/PageCommands.cs @@ -10,25 +10,25 @@ namespace Fungus namespace Command { /** - * Sets the display rect for the active Page using a PageBounds object. + * Sets the display rect for the PageController using a Page object. */ - public class SetPageBounds : CommandQueue.Command + public class SetPage : CommandQueue.Command { - PageBounds pageBounds; - Page.Layout pageLayout; + Page page; + PageController.Layout pageLayout; - public SetPageBounds(PageBounds _pageBounds, Page.Layout _pageLayout) + public SetPage(Page _page, PageController.Layout _pageLayout) { - pageBounds = _pageBounds; + page = _page; pageLayout = _pageLayout; } public override void Execute(CommandQueue commandQueue, Action onComplete) { - if (pageBounds != null) + if (page != null) { - pageBounds.UpdatePageRect(); - Game.GetInstance().activePage.layout = pageLayout; + page.UpdatePageRect(); + Game.GetInstance().pageController.layout = pageLayout; } if (onComplete != null) @@ -39,14 +39,14 @@ namespace Fungus } /** - * Sets the display rect for the active Page using normalized screen space coords. + * Sets the screen rect for displaying story text using normalized screen space coords. */ public class SetPageRect : CommandQueue.Command { - Page.ScreenRect screenRect; - Page.Layout layout; + PageController.ScreenRect screenRect; + PageController.Layout layout; - public SetPageRect(Page.ScreenRect _screenRect, Page.Layout _layout) + public SetPageRect(PageController.ScreenRect _screenRect, PageController.Layout _layout) { screenRect = _screenRect; layout = _layout; @@ -54,8 +54,8 @@ namespace Fungus public override void Execute(CommandQueue commandQueue, Action onComplete) { - Page page = Game.GetInstance().activePage; - page.pageRect = Page.CalcPageRect(screenRect); + PageController page = Game.GetInstance().pageController; + page.pageRect = PageController.CalcPageRect(screenRect); page.layout = layout; if (onComplete != null) @@ -66,7 +66,7 @@ namespace Fungus } /** - * Sets the currently active Page Style for rendering Pages. + * Sets the active Page Style for rendering story text. */ public class SetPageStyle : CommandQueue.Command { @@ -88,7 +88,7 @@ namespace Fungus } /** - * Sets the header text displayed at the top of the active page. + * Sets the header text displayed at the top of the page. */ public class SetHeader : CommandQueue.Command { @@ -101,15 +101,9 @@ namespace Fungus public override void Execute(CommandQueue commandQueue, Action onComplete) { - Page page = Game.GetInstance().activePage; - if (page == null) - { - Debug.LogError("Active page must not be null"); - } - else - { - page.SetHeader(titleText); - } + PageController page = Game.GetInstance().pageController; + page.SetHeader(titleText); + if (onComplete != null) { onComplete(); @@ -118,7 +112,7 @@ namespace Fungus } /** - * Sets the footer text displayed at the top of the active page. + * Sets the footer text displayed at the bottom of the page. */ public class SetFooter : CommandQueue.Command { @@ -131,15 +125,9 @@ namespace Fungus public override void Execute(CommandQueue commandQueue, Action onComplete) { - Page page = Game.GetInstance().activePage; - if (page == null) - { - Debug.LogError("Active page must not be null"); - } - else - { - page.SetFooter(titleText); - } + PageController page = Game.GetInstance().pageController; + page.SetFooter(titleText); + if (onComplete != null) { onComplete(); @@ -148,8 +136,8 @@ namespace Fungus } /** - * Writes story text to the currently active page. - * A 'continue' icon is displayed when the text has fully appeared. + * Writes story text to the page. + * A continue icon is displayed when the text has fully appeared. */ public class Say : CommandQueue.Command { @@ -162,15 +150,8 @@ namespace Fungus public override void Execute(CommandQueue commandQueue, Action onComplete) { - Page page = Game.GetInstance().activePage; - if (page == null) - { - Debug.LogError("Active page must not be null"); - } - else - { - page.Say(storyText, onComplete); - } + PageController page = Game.GetInstance().pageController; + page.Say(storyText, onComplete); } } @@ -191,15 +172,9 @@ namespace Fungus public override void Execute(CommandQueue commandQueue, Action onComplete) { - Page page = Game.GetInstance().activePage; - if (page == null) - { - Debug.LogError("Active page must not be null"); - } - else - { - page.AddOption(optionText, optionAction); - } + PageController page = Game.GetInstance().pageController; + page.AddOption(optionText, optionAction); + if (onComplete != null) { onComplete(); @@ -221,16 +196,10 @@ namespace Fungus public override void Execute(CommandQueue commandQueue, Action onComplete) { - Page page = Game.GetInstance().activePage; - if (page == null) - { - Debug.LogError("Active page must not be null"); - } - else - { - page.Choose(chooseText); - } - // Choose always clears commandQueue, so no need to call onComplete() + PageController page = Game.GetInstance().pageController; + page.Choose(chooseText); + + // Choose always clears the commandQueue, so there's no need to call onComplete() } } } diff --git a/Assets/Fungus/Scripts/Game.cs b/Assets/Fungus/Scripts/Game.cs index ea0006d5..73687117 100644 --- a/Assets/Fungus/Scripts/Game.cs +++ b/Assets/Fungus/Scripts/Game.cs @@ -82,7 +82,7 @@ namespace Fungus /** * Default screen position for Page when player enters a Room. */ - public Page.PagePosition defaultPagePosition; + public PageController.PagePosition defaultPagePosition; /** * Default width and height of Page as a fraction of screen height [0..1] @@ -106,9 +106,6 @@ namespace Fungus [HideInInspector] public Dictionary values = new Dictionary(); - [HideInInspector] - public Page activePage; - [HideInInspector] public StringTable stringTable = new StringTable(); @@ -118,6 +115,9 @@ namespace Fungus [HideInInspector] public CameraController cameraController; + [HideInInspector] + public PageController pageController; + /** * True when executing a Wait() or WaitForTap() command */ @@ -156,6 +156,7 @@ namespace Fungus // Add components for additional game functionality commandQueue = gameObject.AddComponent(); cameraController = gameObject.AddComponent(); + pageController = gameObject.AddComponent(); AudioSource audioSource = gameObject.AddComponent(); audioSource.playOnAwake = false; @@ -174,12 +175,6 @@ namespace Fungus commandQueue.AddCommand(new Command.MoveToRoom(activeRoom)); commandQueue.Execute(); } - - // Create the Page game object as a child of Game - GameObject pageObject = new GameObject(); - pageObject.name = "Page"; - pageObject.transform.parent = transform; - activePage = pageObject.AddComponent(); } public virtual void Update() @@ -215,8 +210,8 @@ namespace Fungus } } - if (activePage.mode == Page.Mode.Say && - activePage.FinishedWriting()) + if (pageController.mode == PageController.Mode.Say && + pageController.FinishedWriting()) { // Draw the continue icon if (continueIcon) @@ -261,17 +256,17 @@ namespace Fungus /** * Returns true if the game should display 'auto hide' buttons. - * Buttons will be displayed if the active page is not currently displaying story text/options, and no Wait command is in progress. + * Buttons will be displayed if the game is not currently displaying story text/options, and no Wait command is in progress. */ - public bool ShowAutoButtons() + public bool GetShowAutoButtons() { if (waiting) { return false; } - if (activePage == null || - activePage.mode == Page.Mode.Idle) + if (pageController == null || + pageController.mode == PageController.Mode.Idle) { return (autoHideButtonTimer > 0f); } diff --git a/Assets/Fungus/Scripts/GameController.cs b/Assets/Fungus/Scripts/GameController.cs index 0417c82a..4f99dce0 100644 --- a/Assets/Fungus/Scripts/GameController.cs +++ b/Assets/Fungus/Scripts/GameController.cs @@ -193,27 +193,32 @@ namespace Fungus #region Page Methods /** - * Sets the display rect for the active Page using a PageBounds object. + * Sets the screen space rectangle used to display the story text using a Page object. * PageBounds objects can be edited visually in the Unity editor which is useful for accurate placement. * The actual screen space rect used is based on both the PageBounds values and the camera transform at the time the command is executed. * This method returns immediately but it queues an asynchronous command for later execution. - * @param pageBounds The bounds object to use when calculating the Page display rect. + * @param page A Page object which defines the screen rect to use when rendering story text. */ - public static void SetPageBounds(PageBounds pageBounds, Page.Layout pageLayout = Page.Layout.FullSize) + public static void SetPage(Page page, PageController.Layout pageLayout = PageController.Layout.FullSize) { CommandQueue commandQueue = Game.GetInstance().commandQueue; - commandQueue.AddCommand(new Command.SetPageBounds(pageBounds, pageLayout)); + commandQueue.AddCommand(new Command.SetPage(page, pageLayout)); } - public static void SetPageRect(Page.ScreenRect screenRect, Page.Layout pageLayout = Page.Layout.FullSize) + /** + * Sets the screen space rectangle used to display the story text using a ScreenRect object. + * This method returns immediately but it queues an asynchronous command for later execution. + * @param screenRect A ScreenRect object which defines a rect in normalized screen space coordinates. + */ + public static void SetPageRect(PageController.ScreenRect screenRect, PageController.Layout pageLayout = PageController.Layout.FullSize) { CommandQueue commandQueue = Game.GetInstance().commandQueue; commandQueue.AddCommand(new Command.SetPageRect(screenRect, pageLayout)); } /** - * Sets the screen space rectangle used to display the Page. - * The rectangle coordinates are in normalized screen space. e.g. x1 = 0 (Far left), x1 = 1 (Far right). + * Sets the screen space rectangle used to display the story text. + * The rectangle coordinates are in normalized screen space. e.g. x1 = 0 (left), y1 = 0 (top) x2 = 1 (right) y2 = 1 (bottom). * The origin is at the top left of the screen. * This method returns immediately but it queues an asynchronous command for later execution. * @param x1 Page rect left coordinate in normalized screen space coords [0..1] @@ -222,9 +227,9 @@ namespace Fungus * @param y2 Page rect bottom coordinate in normalized screen space coords [0..1] * @param pageLayout Layout mode for positioning page within the rect. */ - public static void SetPageRect(float x1, float y1, float x2, float y2, Page.Layout pageLayout = Page.Layout.FullSize) + public static void SetPageRect(float x1, float y1, float x2, float y2, PageController.Layout pageLayout = PageController.Layout.FullSize) { - Page.ScreenRect screenRect = new Page.ScreenRect(); + PageController.ScreenRect screenRect = new PageController.ScreenRect(); screenRect.x1 = x1; screenRect.y1 = y1; screenRect.x2 = x2; @@ -233,72 +238,72 @@ namespace Fungus } /** - * Sets the active Page to display at the top of the screen. + * Display story page at the top of the screen. * This method returns immediately but it queues an asynchronous command for later execution. * @param scaleX Scales the width of the Page [0..1]. 1 = full screen width. * @param scaleY Scales the height of the Page [0..1]. 1 = full screen height. * @param pageLayout Controls how the Page is positioned and sized based on the displayed content. */ - public static void SetPageTop(float scaleX, float scaleY, Page.Layout pageLayout) + public static void SetPageTop(float scaleX, float scaleY, PageController.Layout pageLayout) { - Page.ScreenRect screenRect = Page.CalcScreenRect(new Vector2(scaleX, scaleY), Page.PagePosition.Top); + PageController.ScreenRect screenRect = PageController.CalcScreenRect(new Vector2(scaleX, scaleY), PageController.PagePosition.Top); SetPageRect(screenRect, pageLayout); } /** - * Sets the currently active Page to display at the top of the screen. + * Display story page at the top of the screen. * This method returns immediately but it queues an asynchronous command for later execution. */ public static void SetPageTop() { Vector2 pageScale = Game.GetInstance().defaultPageScale; - SetPageTop(pageScale.x, pageScale.y, Page.Layout.FullSize); + SetPageTop(pageScale.x, pageScale.y, PageController.Layout.FullSize); } /** - * Sets the active Page to display at the middle of the screen. + * Display story page at the middle of the screen. * This method returns immediately but it queues an asynchronous command for later execution. * @param scaleX Scales the width of the Page [0..1]. 1 = full screen width. * @param scaleY Scales the height of the Page [0..1]. 1 = full screen height. * @param pageLayout Controls how the Page is positioned and sized based on the displayed content. */ - public static void SetPageMiddle(float scaleX, float scaleY, Page.Layout pageLayout) + public static void SetPageMiddle(float scaleX, float scaleY, PageController.Layout pageLayout) { - Page.ScreenRect screenRect = Page.CalcScreenRect(new Vector2(scaleX, scaleY), Page.PagePosition.Middle); + PageController.ScreenRect screenRect = PageController.CalcScreenRect(new Vector2(scaleX, scaleY), PageController.PagePosition.Middle); SetPageRect(screenRect, pageLayout); } /** - * Sets the currently active Page to display at the middle of the screen. + * Display story page at the middle of the screen. * This method returns immediately but it queues an asynchronous command for later execution. */ public static void SetPageMiddle() { Vector2 pageScale = Game.GetInstance().defaultPageScale; - SetPageMiddle(pageScale.x, pageScale.y, Page.Layout.FitToMiddle); + SetPageMiddle(pageScale.x, pageScale.y, PageController.Layout.FitToMiddle); } /** - * Sets the active Page to display at the bottom of the screen. + * Display story page at the bottom of the screen. * This method returns immediately but it queues an asynchronous command for later execution. * @param scaleX Scales the width of the Page [0..1]. 1 = full screen width. * @param scaleY Scales the height of the Page [0..1]. 1 = full screen height. * @param pageLayout Controls how the Page is positioned and sized based on the displayed content. */ - public static void SetPageBottom(float scaleX, float scaleY, Page.Layout pageLayout) + public static void SetPageBottom(float scaleX, float scaleY, PageController.Layout pageLayout) { - Page.ScreenRect screenRect = Page.CalcScreenRect(new Vector2(scaleX, scaleY), Page.PagePosition.Bottom); + PageController.ScreenRect screenRect = PageController.CalcScreenRect(new Vector2(scaleX, scaleY), PageController.PagePosition.Bottom); SetPageRect(screenRect, pageLayout); } /** - * Sets the currently active Page to display at the bottom of the screen. + * Display story page at the bottom of the screen. * This method returns immediately but it queues an asynchronous command for later execution. */ public static void SetPageBottom() { Vector2 pageScale = Game.GetInstance().defaultPageScale; - SetPageBottom(pageScale.x, pageScale.y, Page.Layout.FullSize); + SetPageBottom(pageScale.x, pageScale.y, PageController.Layout.FullSize); } /** @@ -322,7 +327,7 @@ namespace Fungus } /** - * Sets the header text displayed at the top of the active Page. + * Sets the header text displayed at the top of the page. * The header text is only displayed when there is some story text or options to be shown. * This method returns immediately but it queues an asynchronous command for later execution. * @param footerText The text to display as the header of the Page. @@ -334,7 +339,7 @@ namespace Fungus } /** - * Sets the footer text displayed at the top of the active Page. + * Sets the footer text displayed at the top of the page. * The footer text is only displayed when there is some story text or options to be shown. * This method returns immediately but it queues an asynchronous command for later execution. * @param footerText The text to display as the footer of the Page. @@ -346,11 +351,11 @@ namespace Fungus } /** - * Writes story text to the currently active Page. + * Writes story text to the page. * A 'continue' button is displayed when the text has fully appeared. * Command execution halts until the user chooses to continue. * This method returns immediately but it queues an asynchronous command for later execution. - * @param storyText The text to be written to the currently active Page. + * @param storyText The text to be written to the page. */ public static void Say(string storyText) { diff --git a/Assets/Fungus/Scripts/Page.cs b/Assets/Fungus/Scripts/Page.cs index ebd9d187..d022045c 100644 --- a/Assets/Fungus/Scripts/Page.cs +++ b/Assets/Fungus/Scripts/Page.cs @@ -1,596 +1,45 @@ using UnityEngine; -using System; using System.Collections; -using System.Collections.Generic; -using System.Text.RegularExpressions; namespace Fungus { /** - * A rectangular screen area for rendering story text. - * Rooms may contain any number of Pages. - * If a Page is a child of a View, then transitioning to that View will automatically activate the Page. + * Defines a user editable screen aligned rect for setting Page bounds. */ - [ExecuteInEditMode] public class Page : MonoBehaviour { - /// Options for default Page position on screen - public enum PagePosition - { - /// Page appears full-size and horizontally centered at top of screen. - Top, - /// Page appears centered in middle of screen, with height fitted to content. - Middle, - /// Page appears full-size and horizontally centered at bottom of screen. - Bottom - } - - /** - * Defines a rect in normalized screen space coordinates. - * e.g. x1 = 0 means left of screen, x2 = 1 means right of screen. - */ - public class ScreenRect - { - public float x1; - public float y1; - public float x2; - public float y2; - } - - /// Options for controlling page layout - public enum Layout - { - /// Use the full rect to display the page. - FullSize, - /// Resize to fit displayed text and snap to top of rect. - FitToTop, - /// Resize to fit displayed text and snap to middle of rect. - FitToMiddle, - /// Resize to fit displayed text and snap to bottom of rect. - FitToBottom - } - - /// Controls layout of content within Page rect. - public Layout layout = Layout.FullSize; - - /// Supported states for Page - public enum Mode - { - /// No content to be displayed. - Idle, - /// Show a single line of text and wait for player input. - Say, - /// Show a multiple choice menu and wait for player to select an option. - Choose - }; - - [HideInInspector] - public Mode mode = Mode.Idle; - - /// Screen space rect for Page in pixels. - public Rect pageRect; - - string headerText = ""; - string footerText = ""; - - string displayedStoryText = ""; - string originalStoryText = ""; - - Action deferredAction; - Action continueAction; + /// Rectangular bounds used to display page text. + public Bounds pageBounds = new Bounds(Vector3.zero, new Vector3(0.25f, 0.25f, 0f)); - class Option - { - public string optionText; - public Action optionAction; - - public Option(string _optionText, Action _optionAction) - { - optionText = _optionText; - optionAction = _optionAction; - } - } - - List