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 transitiong to that View will automatically activate the Page. [ExecuteInEditMode] public class Page : MonoBehaviour { public Bounds pageBounds = new Bounds(Vector3.zero, new Vector3(0.25f, 0.25f, 0f)); // The font size for title, say and option text is calculated by dividing the screen height // by the number of allowed rows for each type of text. This gives a consistent font size // regardless of the device resolution. public int titleRows = 20; public int sayRows = 25; public int optionRows = 25; public GUIStyle titleStyle; public GUIStyle sayStyle; public GUIStyle optionStyle; public GUIStyle boxStyle; string titleText = ""; string originalStoryText = ""; string displayedStoryText = ""; Action deferredAction; public enum Mode { Idle, Say, Choose }; Mode mode = Mode.Idle; class Option { public string optionText; public Action optionAction; public Option(string _optionText, Action _optionAction) { optionText = _optionText; optionAction = _optionAction; } } List