diff --git a/Assets/Fungus/Editor/PageEditor.cs b/Assets/Fungus/Editor/PageEditor.cs deleted file mode 100644 index 25cfeb09..00000000 --- a/Assets/Fungus/Editor/PageEditor.cs +++ /dev/null @@ -1,87 +0,0 @@ -using UnityEditor; -using UnityEngine; -using System.Collections; -using System.Collections.Generic; - -namespace Fungus -{ - [CanEditMultipleObjects] - [CustomEditor (typeof(Page))] - public class PageEditor : Editor - { - void OnSceneGUI () - { - Page t = target as Page; - - if (t.enabled) - { - EditPageBounds(); - } - - if (GUI.changed) - { - EditorUtility.SetDirty(target); - } - } - - void EditPageBounds() - { - Page t = target as Page; - Vector3 pos = t.transform.position; - - Vector3[] verts = new Vector3[4]; - 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)); - - for(int i = 0; i < 4; ++i) - { - Vector3 vert = verts[i]; - Vector3 newPos = Handles.FreeMoveHandle(vert, - Quaternion.identity, - HandleUtility.GetHandleSize(pos) * 0.1f, - Vector3.zero, - Handles.CubeCap); - newPos.z = 0; - verts[i] = newPos; - - if (vert != newPos) - { - switch(i) - { - case 0: - verts[1].x = newPos.x; - verts[3].y = newPos.y; - break; - case 1: - verts[0].x = newPos.x; - verts[2].y = newPos.y; - break; - case 2: - verts[3].x = newPos.x; - verts[1].y = newPos.y; - break; - case 3: - verts[2].x = newPos.x; - verts[0].y = newPos.y; - break; - } - break; - } - } - - Bounds newBounds = new Bounds(verts[0], Vector3.zero); - newBounds.Encapsulate(verts[1]); - newBounds.Encapsulate(verts[2]); - newBounds.Encapsulate(verts[3]); - - t.transform.position = newBounds.center; - newBounds.center = Vector3.zero; - - t.pageBounds = newBounds; - } - } -} diff --git a/Assets/Fungus/Editor/PageEditor.cs.meta b/Assets/Fungus/Editor/PageEditor.cs.meta deleted file mode 100644 index 49d26ab2..00000000 --- a/Assets/Fungus/Editor/PageEditor.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: dce33924cf6804b2c94d17784a6037d1 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Fungus/Legacy/ContinueIcon.png b/Assets/Fungus/Legacy/ContinueIcon.png deleted file mode 100644 index 29cec4c4..00000000 Binary files a/Assets/Fungus/Legacy/ContinueIcon.png and /dev/null differ diff --git a/Assets/Fungus/Legacy/ContinueIcon.png.meta b/Assets/Fungus/Legacy/ContinueIcon.png.meta deleted file mode 100644 index b515c485..00000000 --- a/Assets/Fungus/Legacy/ContinueIcon.png.meta +++ /dev/null @@ -1,45 +0,0 @@ -fileFormatVersion: 2 -guid: dfdb2b7864e2d46418b308cd6c0261fc -TextureImporter: - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - linearTexture: 0 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: .25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 1024 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: .5, y: .5} - spritePixelsToUnits: 100 - alphaIsTransparency: 0 - textureType: -1 - buildTargetSettings: [] - spriteSheet: - sprites: [] - spritePackingTag: - userData: diff --git a/Assets/Fungus/Legacy/OptionButton1.psd b/Assets/Fungus/Legacy/OptionButton1.psd deleted file mode 100644 index 9125a4a9..00000000 Binary files a/Assets/Fungus/Legacy/OptionButton1.psd and /dev/null differ diff --git a/Assets/Fungus/Legacy/OptionButton1.psd.meta b/Assets/Fungus/Legacy/OptionButton1.psd.meta deleted file mode 100644 index 5ee06da0..00000000 --- a/Assets/Fungus/Legacy/OptionButton1.psd.meta +++ /dev/null @@ -1,45 +0,0 @@ -fileFormatVersion: 2 -guid: 5a1a737f1dc4e49339d16a91a1805588 -TextureImporter: - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - linearTexture: 0 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: .25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 1024 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: .5, y: .5} - spritePixelsToUnits: 100 - alphaIsTransparency: 0 - textureType: -1 - buildTargetSettings: [] - spriteSheet: - sprites: [] - spritePackingTag: - userData: diff --git a/Assets/Fungus/Legacy/OptionButton2.psd b/Assets/Fungus/Legacy/OptionButton2.psd deleted file mode 100644 index c08bec57..00000000 Binary files a/Assets/Fungus/Legacy/OptionButton2.psd and /dev/null differ diff --git a/Assets/Fungus/Legacy/OptionButton2.psd.meta b/Assets/Fungus/Legacy/OptionButton2.psd.meta deleted file mode 100644 index 5824b201..00000000 --- a/Assets/Fungus/Legacy/OptionButton2.psd.meta +++ /dev/null @@ -1,45 +0,0 @@ -fileFormatVersion: 2 -guid: 97326ada6fc364221affae285d51995b -TextureImporter: - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - linearTexture: 0 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: .25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 1024 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: .5, y: .5} - spritePixelsToUnits: 100 - alphaIsTransparency: 0 - textureType: -1 - buildTargetSettings: [] - spriteSheet: - sprites: [] - spritePackingTag: - userData: diff --git a/Assets/Fungus/Legacy/Page.cs b/Assets/Fungus/Legacy/Page.cs deleted file mode 100644 index d022045c..00000000 --- a/Assets/Fungus/Legacy/Page.cs +++ /dev/null @@ -1,45 +0,0 @@ -using UnityEngine; -using System.Collections; - -namespace Fungus -{ - /** - * Defines a user editable screen aligned rect for setting Page bounds. - */ - public class Page : MonoBehaviour - { - /// Rectangular bounds used to display page text. - public Bounds pageBounds = new Bounds(Vector3.zero, new Vector3(0.25f, 0.25f, 0f)); - - /// Layout style to use for Page - public PageController.Layout layout = PageController.Layout.FullSize; - - /** - * Modifies the PageController to use a rect defined by the bounds and the current camera transform - */ - public void UpdatePageRect() - { - // Y increases down the screen in GUI space, so top left is rect origin - Vector3 topLeft = transform.position + pageBounds.center; - topLeft.x -= pageBounds.extents.x; - topLeft.y += pageBounds.extents.y; - - Vector3 bottomRight = transform.position + pageBounds.center; - bottomRight.x += pageBounds.extents.x; - bottomRight.y -= pageBounds.extents.y; - - Vector2 tl = Camera.main.WorldToScreenPoint(topLeft); - Vector2 br = Camera.main.WorldToScreenPoint(bottomRight); - - PageController.ScreenRect screenRect = new PageController.ScreenRect(); - screenRect.x1 = (tl.x / Screen.width); - screenRect.y1 = 1f - (tl.y / Screen.height); - screenRect.x2 = (br.x / Screen.width); - screenRect.y2 = 1f - (br.y / Screen.height); - - PageController page = Game.GetInstance().pageController; - page.pageRect = PageController.CalcPageRect(screenRect); - page.layout = layout; - } - } -} \ No newline at end of file diff --git a/Assets/Fungus/Legacy/Page.prefab b/Assets/Fungus/Legacy/Page.prefab deleted file mode 100644 index ae699e9f..00000000 Binary files a/Assets/Fungus/Legacy/Page.prefab and /dev/null differ diff --git a/Assets/Fungus/Legacy/Page.prefab.meta b/Assets/Fungus/Legacy/Page.prefab.meta deleted file mode 100644 index e3e66556..00000000 --- a/Assets/Fungus/Legacy/Page.prefab.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: ec557b5a76ab94961964394b8511fc9b -NativeFormatImporter: - userData: diff --git a/Assets/Fungus/Legacy/PageCommands.cs b/Assets/Fungus/Legacy/PageCommands.cs deleted file mode 100644 index 57c5c19d..00000000 --- a/Assets/Fungus/Legacy/PageCommands.cs +++ /dev/null @@ -1,171 +0,0 @@ -using UnityEngine; -using System; -using System.Collections; - -namespace Fungus -{ - /** - * Command classes have their own namespace to prevent them popping up in code completion. - */ - namespace Command - { - /** - * Sets the display rect for the PageController using a Page object. - */ - public class SetPage : CommandQueue.Command - { - Page page; - PageController.Layout pageLayout; - - public SetPage(Page _page, PageController.Layout _pageLayout) - { - page = _page; - pageLayout = _pageLayout; - } - - public override void Execute(CommandQueue commandQueue, Action onComplete) - { - if (page != null) - { - page.UpdatePageRect(); - Game.GetInstance().pageController.layout = pageLayout; - } - - if (onComplete != null) - { - onComplete(); - } - } - } - - /** - * Sets the screen rect for displaying story text using normalized screen space coords. - */ - public class SetPageRect : CommandQueue.Command - { - PageController.ScreenRect screenRect; - PageController.Layout layout; - - public SetPageRect(PageController.ScreenRect _screenRect, PageController.Layout _layout) - { - screenRect = _screenRect; - layout = _layout; - } - - public override void Execute(CommandQueue commandQueue, Action onComplete) - { - PageController page = Game.GetInstance().pageController; - page.pageRect = PageController.CalcPageRect(screenRect); - page.layout = layout; - - if (onComplete != null) - { - onComplete(); - } - } - } - - /** - * Sets the active Page Style for rendering story text. - */ - public class SetPageStyle : CommandQueue.Command - { - PageStyle pageStyle; - - public SetPageStyle(PageStyle _pageStyle) - { - pageStyle = _pageStyle; - } - - public override void Execute(CommandQueue commandQueue, Action onComplete) - { - Game.GetInstance().pageController.activePageStyle = pageStyle; - if (onComplete != null) - { - onComplete(); - } - } - } - - /** - * Sets the header text displayed at the top of the page. - */ - public class SetHeader : CommandQueue.Command - { - string titleText; - - public SetHeader(string _titleText) - { - titleText = _titleText; - } - - public override void Execute(CommandQueue commandQueue, Action onComplete) - { - PageController page = Game.GetInstance().pageController; - page.SetHeader(titleText); - - if (onComplete != null) - { - onComplete(); - } - } - } - - /** - * Sets the footer text displayed at the bottom of the page. - */ - public class SetFooter : CommandQueue.Command - { - string titleText; - - public SetFooter(string _titleText) - { - titleText = _titleText; - } - - public override void Execute(CommandQueue commandQueue, Action onComplete) - { - PageController page = Game.GetInstance().pageController; - page.SetFooter(titleText); - - if (onComplete != null) - { - onComplete(); - } - } - } - - /** - * Displays all previously added options. - */ - public class Choose : CommandQueue.Command - { - string chooseText; - - public Choose(string _chooseText) - { - chooseText = _chooseText; - } - - public override void Execute(CommandQueue commandQueue, Action onComplete) - { - string subbedText = Variables.SubstituteStrings(chooseText); - - IDialog dialog = Game.GetInstance().GetDialog(); - PageController pageController = dialog as PageController; - if (pageController != null) - { - // Legacy support for old Pages system - pageController.Choose(subbedText); - } - else - { - // Support for modern IDialog interface - dialog.Say(subbedText, null); - } - - // Choose always clears the commandQueue, so there's no need to call onComplete() - } - } - } -} diff --git a/Assets/Fungus/Legacy/PageCommands.cs.meta b/Assets/Fungus/Legacy/PageCommands.cs.meta deleted file mode 100644 index bb3faa9b..00000000 --- a/Assets/Fungus/Legacy/PageCommands.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ae90082ad9904474ebe8554e864a0539 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Fungus/Legacy/PageController.cs b/Assets/Fungus/Legacy/PageController.cs deleted file mode 100644 index 4f880a58..00000000 --- a/Assets/Fungus/Legacy/PageController.cs +++ /dev/null @@ -1,695 +0,0 @@ -using UnityEngine; -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text.RegularExpressions; - -namespace Fungus -{ - /** - * Manages and draws a text box for rendering story text and multiple choice menus. - */ - [ExecuteInEditMode] - public class PageController : MonoBehaviour, IDialog - { - /// 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 - }; - - /** - * The style to apply when displaying Pages. - */ - public PageStyle activePageStyle; - - /// Current Page story telling state - [HideInInspector] - public Mode mode = Mode.Idle; - - /// Screen space rect for Page in pixels. - [HideInInspector] - public Rect pageRect; - - /** - * Writing speed for page text. - */ - public int charactersPerSecond = 60; - - /** - * Icon to display when waiting for player input to continue - */ - public Texture2D continueIcon; - - /** - * Position of continue and swipe icons in normalized screen space coords. - * (0,0) = top left, (1,1) = bottom right - */ - public Vector2 iconPosition = new Vector2(1,1); - - /** - * Default screen position for Page when player enters a Room. - */ - public PageController.PagePosition defaultPagePosition; - - /** - * Default width and height of Page as a fraction of screen height [0..1] - */ - public Vector2 defaultPageScale = new Vector2(0.75f, 0.25f); - - /** - * Automatically center the Page when player is choosing from multiple options. - */ - public bool centerChooseMenu = true; - - /** - * Width of Page as a fraction of screen width [0..1] when automatically centering a Choose menu. - * This setting only has an effect when centerChooseMenu is enabled. - */ - public float chooseMenuWidth = 0.5f; - - /** - * Sound effect to play when buttons are clicked. - */ - public AudioClip clickSound; - - string headerText = ""; - string footerText = ""; - - string displayedStoryText = ""; - string originalStoryText = ""; - - Action deferredAction; - Action continueAction; - - class Option - { - public string optionText; - public Action optionAction; - - public Option(string _optionText, Action _optionAction) - { - optionText = _optionText; - optionAction = _optionAction; - } - } - - List