Browse Source

Merge pull request #538 from snozbot/revert-interfaces

Revert interfaces
master
Chris Gregan 8 years ago committed by GitHub
parent
commit
e55db97a70
  1. 24
      Assets/Fungus/Resources/Sprites/HandPointer.png.meta
  2. 2
      Assets/Fungus/Scripts/Commands/Else.cs
  3. 2
      Assets/Fungus/Scripts/Commands/ElseIf.cs
  4. 2
      Assets/Fungus/Scripts/Commands/FadeScreen.cs
  5. 2
      Assets/Fungus/Scripts/Commands/FadeToView.cs
  6. 4
      Assets/Fungus/Scripts/Commands/Menu.cs
  7. 2
      Assets/Fungus/Scripts/Commands/MenuTimer.cs
  8. 2
      Assets/Fungus/Scripts/Commands/MoveToView.cs
  9. 2
      Assets/Fungus/Scripts/Commands/PlayMusic.cs
  10. 2
      Assets/Fungus/Scripts/Commands/PlaySound.cs
  11. 9
      Assets/Fungus/Scripts/Commands/Say.cs
  12. 2
      Assets/Fungus/Scripts/Commands/SetAudioPitch.cs
  13. 2
      Assets/Fungus/Scripts/Commands/SetAudioVolume.cs
  14. 2
      Assets/Fungus/Scripts/Commands/SetMenuDialog.cs
  15. 2
      Assets/Fungus/Scripts/Commands/SetSayDialog.cs
  16. 2
      Assets/Fungus/Scripts/Commands/StartSwipe.cs
  17. 2
      Assets/Fungus/Scripts/Commands/StopBlock.cs
  18. 4
      Assets/Fungus/Scripts/Commands/StopFlowchart.cs
  19. 2
      Assets/Fungus/Scripts/Commands/StopMusic.cs
  20. 2
      Assets/Fungus/Scripts/Commands/StopSwipe.cs
  21. 6
      Assets/Fungus/Scripts/Commands/Write.cs
  22. 83
      Assets/Fungus/Scripts/Components/Block.cs
  23. 64
      Assets/Fungus/Scripts/Components/CameraController.cs
  24. 47
      Assets/Fungus/Scripts/Components/Character.cs
  25. 7
      Assets/Fungus/Scripts/Components/Clickable2D.cs
  26. 12
      Assets/Fungus/Scripts/Components/Command.cs
  27. 16
      Assets/Fungus/Scripts/Components/CustomTag.cs
  28. 25
      Assets/Fungus/Scripts/Components/DialogInput.cs
  29. 8
      Assets/Fungus/Scripts/Components/Draggable2D.cs
  30. 13
      Assets/Fungus/Scripts/Components/EventHandler.cs
  31. 259
      Assets/Fungus/Scripts/Components/Flowchart.cs
  32. 7
      Assets/Fungus/Scripts/Components/FungusState.cs
  33. 75
      Assets/Fungus/Scripts/Components/Localization.cs
  34. 120
      Assets/Fungus/Scripts/Components/MenuDialog.cs
  35. 36
      Assets/Fungus/Scripts/Components/MusicController.cs
  36. 137
      Assets/Fungus/Scripts/Components/PortraitController.cs
  37. 135
      Assets/Fungus/Scripts/Components/SayDialog.cs
  38. 40
      Assets/Fungus/Scripts/Components/Stage.cs
  39. 43
      Assets/Fungus/Scripts/Components/Variable.cs
  40. 13
      Assets/Fungus/Scripts/Components/View.cs
  41. 212
      Assets/Fungus/Scripts/Components/Writer.cs
  42. 2
      Assets/Fungus/Scripts/Editor/FlowchartWindow.cs
  43. 119
      Assets/Fungus/Scripts/Interfaces/IBlock.cs
  44. 12
      Assets/Fungus/Scripts/Interfaces/IBlock.cs.meta
  45. 49
      Assets/Fungus/Scripts/Interfaces/ICameraController.cs
  46. 12
      Assets/Fungus/Scripts/Interfaces/ICameraController.cs.meta
  47. 74
      Assets/Fungus/Scripts/Interfaces/ICharacter.cs
  48. 12
      Assets/Fungus/Scripts/Interfaces/ICharacter.cs.meta
  49. 18
      Assets/Fungus/Scripts/Interfaces/IClickable2D.cs
  50. 12
      Assets/Fungus/Scripts/Interfaces/IClickable2D.cs.meta
  51. 166
      Assets/Fungus/Scripts/Interfaces/ICommand.cs
  52. 12
      Assets/Fungus/Scripts/Interfaces/ICommand.cs.meta
  53. 23
      Assets/Fungus/Scripts/Interfaces/IConversationManager.cs
  54. 12
      Assets/Fungus/Scripts/Interfaces/IConversationManager.cs.meta
  55. 31
      Assets/Fungus/Scripts/Interfaces/ICustomTag.cs
  56. 12
      Assets/Fungus/Scripts/Interfaces/ICustomTag.cs.meta
  57. 34
      Assets/Fungus/Scripts/Interfaces/IDialogInput.cs
  58. 10
      Assets/Fungus/Scripts/Interfaces/IDialogInputListener.cs
  59. 0
      Assets/Fungus/Scripts/Interfaces/IDialogInputListener.cs.meta
  60. 21
      Assets/Fungus/Scripts/Interfaces/IDraggable2D.cs
  61. 12
      Assets/Fungus/Scripts/Interfaces/IDraggable2D.cs.meta
  62. 31
      Assets/Fungus/Scripts/Interfaces/IEventHandler.cs
  63. 12
      Assets/Fungus/Scripts/Interfaces/IEventHandler.cs.meta
  64. 296
      Assets/Fungus/Scripts/Interfaces/IFlowchart.cs
  65. 12
      Assets/Fungus/Scripts/Interfaces/IFlowchart.cs.meta
  66. 17
      Assets/Fungus/Scripts/Interfaces/IFungusState.cs
  67. 12
      Assets/Fungus/Scripts/Interfaces/IFungusState.cs.meta
  68. 35
      Assets/Fungus/Scripts/Interfaces/ILocalizable.cs
  69. 0
      Assets/Fungus/Scripts/Interfaces/ILocalizable.cs.meta
  70. 83
      Assets/Fungus/Scripts/Interfaces/ILocalization.cs
  71. 81
      Assets/Fungus/Scripts/Interfaces/IMenuDialog.cs
  72. 12
      Assets/Fungus/Scripts/Interfaces/IMenuDialog.cs.meta
  73. 48
      Assets/Fungus/Scripts/Interfaces/IMusicController.cs
  74. 12
      Assets/Fungus/Scripts/Interfaces/IMusicController.cs.meta
  75. 139
      Assets/Fungus/Scripts/Interfaces/IPortraitController.cs
  76. 12
      Assets/Fungus/Scripts/Interfaces/IPortraitController.cs.meta
  77. 75
      Assets/Fungus/Scripts/Interfaces/ISayDialog.cs
  78. 12
      Assets/Fungus/Scripts/Interfaces/ISayDialog.cs.meta
  79. 66
      Assets/Fungus/Scripts/Interfaces/IStage.cs
  80. 12
      Assets/Fungus/Scripts/Interfaces/IStage.cs.meta
  81. 12
      Assets/Fungus/Scripts/Interfaces/ITextTagParser.cs.meta
  82. 56
      Assets/Fungus/Scripts/Interfaces/IVariable.cs
  83. 12
      Assets/Fungus/Scripts/Interfaces/IVariable.cs.meta
  84. 29
      Assets/Fungus/Scripts/Interfaces/IView.cs
  85. 12
      Assets/Fungus/Scripts/Interfaces/IView.cs.meta
  86. 85
      Assets/Fungus/Scripts/Interfaces/IWriter.cs
  87. 43
      Assets/Fungus/Scripts/Interfaces/IWriterListener.cs
  88. 0
      Assets/Fungus/Scripts/Interfaces/IWriterListener.cs.meta
  89. 19
      Assets/Fungus/Scripts/Utils/ConversationManager.cs
  90. 78
      Assets/Fungus/Scripts/Utils/TextTagParser.cs
  91. 35
      Assets/Fungus/Thirdparty/FungusLua/Resources/Types/FungusTypes.txt
  92. 4
      Assets/Fungus/Thirdparty/FungusLua/Scripts/Components/LuaUtils.cs
  93. 2
      Assets/Fungus/Thirdparty/FungusLua/Scripts/Interfaces/ILuaUtils.cs
  94. 6
      Assets/Fungus/Thirdparty/FungusLua/Scripts/Utils/FungusPrefs.cs
  95. 242
      Assets/FungusExamples/DragAndDrop/DragAndDrop(EventSystem).unity
  96. 244
      Assets/FungusExamples/DragAndDrop/DragAndDrop.unity
  97. 35
      Assets/Tests/Narrative/NarrativeTests.unity
  98. 8
      Assets/Tests/UI/Editor/TextTagParserTests.cs
  99. 39
      ProjectSettings/ProjectSettings.asset

24
Assets/Fungus/Resources/Sprites/HandPointer.png.meta

@ -7,8 +7,8 @@ TextureImporter:
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
@ -17,38 +17,42 @@ TextureImporter:
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureFormat: -3
maxTextureSize: 512
textureSettings:
filterMode: -1
aniso: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 1
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
textureType: 8
spriteTessellationDetail: -1
textureType: 7
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:

2
Assets/Fungus/Scripts/Commands/Else.cs

@ -32,7 +32,7 @@ namespace Fungus.Commands
int indent = indentLevel;
for (int i = CommandIndex + 1; i < ParentBlock.CommandList.Count; ++i)
{
ICommand command = ParentBlock.CommandList[i];
var command = ParentBlock.CommandList[i];
if (command.IndentLevel == indent)
{

2
Assets/Fungus/Scripts/Commands/ElseIf.cs

@ -40,7 +40,7 @@ namespace Fungus.Commands
int indent = indentLevel;
for (int i = CommandIndex + 1; i < ParentBlock.CommandList.Count; ++i)
{
ICommand command = ParentBlock.CommandList[i];
var command = ParentBlock.CommandList[i];
if (command.IndentLevel == indent)
{

2
Assets/Fungus/Scripts/Commands/FadeScreen.cs

@ -33,7 +33,7 @@ namespace Fungus.Commands
public override void OnEnter()
{
ICameraController cameraController = CameraController.GetInstance();
var cameraController = CameraController.GetInstance();
if (fadeTexture)
{

2
Assets/Fungus/Scripts/Commands/FadeToView.cs

@ -65,7 +65,7 @@ namespace Fungus.Commands
return;
}
ICameraController cameraController = CameraController.GetInstance();
var cameraController = CameraController.GetInstance();
if (fadeTexture)
{

4
Assets/Fungus/Scripts/Commands/Menu.cs

@ -41,14 +41,14 @@ namespace Fungus.Commands
if (setMenuDialog != null)
{
// Override the active menu dialog
MenuDialog.activeMenuDialog = setMenuDialog;
MenuDialog.ActiveMenuDialog = setMenuDialog;
}
bool hideOption = (hideIfVisited && targetBlock != null && targetBlock.GetExecutionCount() > 0);
if (!hideOption)
{
IMenuDialog menuDialog = MenuDialog.GetMenuDialog();
var menuDialog = MenuDialog.GetMenuDialog();
if (menuDialog != null)
{
menuDialog.SetActive(true);

2
Assets/Fungus/Scripts/Commands/MenuTimer.cs

@ -27,7 +27,7 @@ namespace Fungus.Commands
public override void OnEnter()
{
IMenuDialog menuDialog = MenuDialog.GetMenuDialog();
var menuDialog = MenuDialog.GetMenuDialog();
if (menuDialog != null &&
targetBlock != null)

2
Assets/Fungus/Scripts/Commands/MoveToView.cs

@ -56,7 +56,7 @@ namespace Fungus.Commands
return;
}
ICameraController cameraController = CameraController.GetInstance();
var cameraController = CameraController.GetInstance();
Vector3 targetPosition = targetView.transform.position;
Quaternion targetRotation = targetView.transform.rotation;

2
Assets/Fungus/Scripts/Commands/PlayMusic.cs

@ -28,7 +28,7 @@ namespace Fungus.Commands
public override void OnEnter()
{
IMusicController musicController = MusicController.GetInstance();
var musicController = MusicController.GetInstance();
if (musicController != null)
{
float startTime = Mathf.Max(0, atTime);

2
Assets/Fungus/Scripts/Commands/PlaySound.cs

@ -32,7 +32,7 @@ namespace Fungus.Commands
return;
}
IMusicController musicController = MusicController.GetInstance();
var musicController = MusicController.GetInstance();
if (musicController != null)
{
musicController.PlaySound(soundClip, volume);

9
Assets/Fungus/Scripts/Commands/Say.cs

@ -69,16 +69,15 @@ namespace Fungus.Commands
// Override the active say dialog if needed
if (character != null && character.SetSayDialog != null)
{
SayDialog.activeSayDialog = character.SetSayDialog;
SayDialog.ActiveSayDialog = character.SetSayDialog;
}
if (setSayDialog != null)
{
SayDialog.activeSayDialog = setSayDialog;
SayDialog.ActiveSayDialog = setSayDialog;
}
ISayDialog sayDialog = SayDialog.GetSayDialog();
var sayDialog = SayDialog.GetSayDialog();
if (sayDialog == null)
{
Continue();
@ -136,7 +135,7 @@ namespace Fungus.Commands
public override void OnStopExecuting()
{
ISayDialog sayDialog = SayDialog.GetSayDialog();
var sayDialog = SayDialog.GetSayDialog();
if (sayDialog == null)
{
return;

2
Assets/Fungus/Scripts/Commands/SetAudioPitch.cs

@ -34,7 +34,7 @@ namespace Fungus.Commands
}
};
IMusicController musicController = MusicController.GetInstance();
var musicController = MusicController.GetInstance();
if (musicController != null)
{
musicController.SetAudioPitch(pitch, fadeDuration, onComplete);

2
Assets/Fungus/Scripts/Commands/SetAudioVolume.cs

@ -27,7 +27,7 @@ namespace Fungus.Commands
public override void OnEnter()
{
IMusicController musicController = MusicController.GetInstance();
var musicController = MusicController.GetInstance();
if (musicController != null)
{
musicController.SetAudioVolume(volume, fadeDuration, () => {

2
Assets/Fungus/Scripts/Commands/SetMenuDialog.cs

@ -21,7 +21,7 @@ namespace Fungus.Commands
{
if (menuDialog != null)
{
MenuDialog.activeMenuDialog = menuDialog;
MenuDialog.ActiveMenuDialog = menuDialog;
}
Continue();

2
Assets/Fungus/Scripts/Commands/SetSayDialog.cs

@ -21,7 +21,7 @@ namespace Fungus.Commands
{
if (sayDialog != null)
{
SayDialog.activeSayDialog = sayDialog;
SayDialog.ActiveSayDialog = sayDialog;
}
Continue();

2
Assets/Fungus/Scripts/Commands/StartSwipe.cs

@ -51,7 +51,7 @@ namespace Fungus.Commands
return;
}
ICameraController cameraController = CameraController.GetInstance();
var cameraController = CameraController.GetInstance();
cameraController.StartSwipePan(targetCamera, viewA, viewB, duration, speedMultiplier, () => Continue() );
}

2
Assets/Fungus/Scripts/Commands/StopBlock.cs

@ -32,7 +32,7 @@ namespace Fungus.Commands
flowchart = (Flowchart)GetFlowchart();
}
IBlock block = flowchart.FindBlock(blockName.Value);
var block = flowchart.FindBlock(blockName.Value);
if (block == null ||
!block.IsExecuting())
{

4
Assets/Fungus/Scripts/Commands/StopFlowchart.cs

@ -23,14 +23,14 @@ namespace Fungus.Commands
public override void OnEnter()
{
IFlowchart flowchart = GetFlowchart();
var flowchart = GetFlowchart();
if (stopParentFlowchart)
{
flowchart.StopAllBlocks();
}
foreach (IFlowchart f in targetFlowcharts)
foreach (var f in targetFlowcharts)
{
if (f == flowchart)
{

2
Assets/Fungus/Scripts/Commands/StopMusic.cs

@ -16,7 +16,7 @@ namespace Fungus.Commands
{
public override void OnEnter()
{
IMusicController musicController = MusicController.GetInstance();
var musicController = MusicController.GetInstance();
if (musicController != null)
{
musicController.StopMusic();

2
Assets/Fungus/Scripts/Commands/StopSwipe.cs

@ -16,7 +16,7 @@ namespace Fungus.Commands
{
public override void OnEnter()
{
ICameraController cameraController = CameraController.GetInstance();
var cameraController = CameraController.GetInstance();
cameraController.StopSwipePan();

6
Assets/Fungus/Scripts/Commands/Write.cs

@ -51,9 +51,9 @@ namespace Fungus.Commands
[SerializeField] protected ColorData setColor = new ColorData(Color.white);
protected IWriter GetWriter()
protected Writer GetWriter()
{
IWriter writer = textObject.GetComponent<IWriter>();
var writer = textObject.GetComponent<Writer>();
if (writer == null)
{
writer = textObject.AddComponent<Writer>();
@ -70,7 +70,7 @@ namespace Fungus.Commands
return;
}
IWriter writer = GetWriter();
var writer = GetWriter();
if (writer == null)
{
Continue();

83
Assets/Fungus/Scripts/Components/Block.cs

@ -11,13 +11,24 @@ using Fungus.Utils;
namespace Fungus
{
/// <summary>
/// Execution state of a Block.
/// </summary>
public enum ExecutionState
{
/// <summary> No command executing </summary>
Idle,
/// <summary> Executing a command </summary>
Executing,
}
/// <summary>
/// A container for a sequence of Fungus comands.
/// </summary>
[ExecuteInEditMode]
[RequireComponent(typeof(Flowchart))]
[AddComponentMenu("")]
public class Block : Node, IBlock
public class Block : Node
{
[SerializeField] protected int itemId = -1; // Invalid flowchart item id
@ -63,7 +74,7 @@ namespace Fungus
// Give each child command a reference back to its parent block
// and tell each command its index in the list.
int index = 0;
foreach (ICommand command in commandList)
foreach (var command in commandList)
{
if (command == null)
{
@ -89,7 +100,7 @@ namespace Fungus
protected virtual void Update()
{
int index = 0;
foreach (ICommand command in commandList)
foreach (var command in commandList)
{
if (command == null) // Null entry will be deleted automatically later
{
@ -101,46 +112,91 @@ namespace Fungus
}
#endif
#region IBlock implementation
#region Public methods
/// <summary>
/// The execution state of the Block.
/// </summary>
public virtual ExecutionState State { get { return executionState; } }
/// <summary>
/// Unique identifier for the Block.
/// </summary>
public virtual int ItemId { get { return itemId; } set { itemId = value; } }
/// <summary>
/// The name of the block node as displayed in the Flowchart window.
/// </summary>
public virtual string BlockName { get { return blockName; } set { blockName = value; } }
/// <summary>
/// Description text to display under the block node
/// </summary>
public virtual string Description { get { return description; } }
/// <summary>
/// An optional Event Handler which can execute the block when an event occurs.
/// Note: Using the concrete class instead of the interface here because of weird editor behaviour.
/// </summary>
public virtual EventHandler _EventHandler { get { return eventHandler; } set { eventHandler = value; } }
/// <summary>
/// The currently executing command.
/// </summary>
public virtual Command ActiveCommand { get { return activeCommand; } }
/// <summary>
/// Timer for fading Block execution icon.
/// </summary>
public virtual float ExecutingIconTimer { get; set; }
/// <summary>
/// The list of commands in the sequence.
/// </summary>
public virtual List<Command> CommandList { get { return commandList; } }
/// <summary>
/// Controls the next command to execute in the block execution coroutine.
/// </summary>
public virtual int JumpToCommandIndex { set { jumpToCommandIndex = value; } }
public virtual IFlowchart GetFlowchart()
/// <summary>
/// Returns the parent Flowchart for this Block.
/// </summary>
public virtual Flowchart GetFlowchart()
{
return GetComponent<IFlowchart>();
return GetComponent<Flowchart>();
}
/// <summary>
/// Returns true if the Block is executing a command.
/// </summary>
public virtual bool IsExecuting()
{
return (executionState == ExecutionState.Executing);
}
/// <summary>
/// Returns the number of times this Block has executed.
/// </summary>
public virtual int GetExecutionCount()
{
return executionCount;
}
/// <summary>
/// Start a coroutine which executes all commands in the Block. Only one running instance of each Block is permitted.
/// </summary>
public virtual void StartExecution()
{
StartCoroutine(Execute());
}
/// <summary>
/// A coroutine method that executes all commands in the Block. Only one running instance of each Block is permitted.
/// </summary>
/// <param name="commandIndex">Index of command to start execution at</param>
/// <param name="onComplete">Delegate function to call when execution completes</param>
public virtual IEnumerator Execute(int commandIndex = 0, Action onComplete = null)
{
if (executionState != ExecutionState.Idle)
@ -249,6 +305,9 @@ namespace Fungus
}
}
/// <summary>
/// Stop executing commands in this Block.
/// </summary>
public virtual void Stop()
{
// Tell the executing command to stop immediately
@ -262,6 +321,9 @@ namespace Fungus
jumpToCommandIndex = int.MaxValue;
}
/// <summary>
/// Returns a list of all Blocks connected to this one.
/// </summary>
public virtual List<Block> GetConnectedBlocks()
{
var connectedBlocks = new List<Block>();
@ -275,6 +337,10 @@ namespace Fungus
return connectedBlocks;
}
/// <summary>
/// Returns the type of the previously executing command.
/// </summary>
/// <returns>The previous active command type.</returns>
public virtual System.Type GetPreviousActiveCommandType()
{
if (previousActiveCommandIndex >= 0 &&
@ -286,10 +352,13 @@ namespace Fungus
return null;
}
/// <summary>
/// Recalculate the indent levels for all commands in the list.
/// </summary>
public virtual void UpdateIndentLevels()
{
int indentLevel = 0;
foreach (ICommand command in commandList)
foreach (var command in commandList)
{
if (command == null)
{

64
Assets/Fungus/Scripts/Components/CameraController.cs

@ -9,7 +9,10 @@ using Fungus;
namespace Fungus
{
public class CameraController : MonoBehaviour, ICameraController
/// <summary>
/// Controller for main camera.Supports several types of camera transition including snap, pan & fade.
/// </summary>
public class CameraController : MonoBehaviour
{
[Tooltip("Full screen texture used for screen fade effect.")]
[SerializeField] protected Texture2D screenFadeTexture;
@ -48,13 +51,13 @@ namespace Fungus
protected Dictionary<string, CameraView> storedViews = new Dictionary<string, CameraView>();
protected static ICameraController instance;
protected static CameraController instance;
/// <summary>
/// Returns the CameraController singleton instance.
/// Will create a CameraController game object if none currently exists.
/// </summary>
static public ICameraController GetInstance()
static public CameraController GetInstance()
{
if (instance == null)
{
@ -65,20 +68,6 @@ namespace Fungus
return instance;
}
public static Texture2D CreateColorTexture(Color color, int width, int height)
{
Color[] pixels = new Color[width * height];
for (int i = 0; i < pixels.Length; i++)
{
pixels[i] = color;
}
Texture2D texture = new Texture2D(width, height, TextureFormat.ARGB32, false);
texture.SetPixels(pixels);
texture.Apply();
return texture;
}
protected virtual void OnGUI()
{
if (swipePanActive)
@ -361,15 +350,42 @@ namespace Fungus
return cameraSize;
}
#region ICameraController implementation
#region Public methods
/// <summary>
/// Creates a flat colored texture.
/// </summary>
public static Texture2D CreateColorTexture(Color color, int width, int height)
{
Color[] pixels = new Color[width * height];
for (int i = 0; i < pixels.Length; i++)
{
pixels[i] = color;
}
Texture2D texture = new Texture2D(width, height, TextureFormat.ARGB32, false);
texture.SetPixels(pixels);
texture.Apply();
return texture;
}
/// <summary>
/// Full screen texture used for screen fade effect.
/// </summary>
/// <value>The screen fade texture.</value>
public Texture2D ScreenFadeTexture { set { screenFadeTexture = value; } }
/// <summary>
/// Perform a fullscreen fade over a duration.
/// </summary>
public virtual void Fade(float targetAlpha, float fadeDuration, Action fadeAction)
{
StartCoroutine(FadeInternal(targetAlpha, fadeDuration, fadeAction));
}
/// <summary>
/// Fade out, move camera to view and then fade back in.
/// </summary>
public virtual void FadeToView(Camera camera, View view, float fadeDuration, bool fadeOut, Action fadeAction)
{
swipePanActive = false;
@ -405,11 +421,17 @@ namespace Fungus
});
}
/// <summary>
/// Stop all camera tweening.
/// </summary>
public virtual void Stop()
{
StopAllCoroutines();
}
/// <summary>
/// Moves camera from current position to a target position over a period of time.
/// </summary>
public virtual void PanToPosition(Camera camera, Vector3 targetPosition, Quaternion targetRotation, float targetSize, float duration, Action arriveAction)
{
if (camera == null)
@ -443,6 +465,9 @@ namespace Fungus
}
}
/// <summary>
/// Activates swipe panning mode. The player can pan the camera within the area between viewA & viewB.
/// </summary>
public virtual void StartSwipePan(Camera camera, View viewA, View viewB, float duration, float speedMultiplier, Action arriveAction)
{
if (camera == null)
@ -472,6 +497,9 @@ namespace Fungus
});
}
/// <summary>
/// Deactivates swipe panning mode.
/// </summary>
public virtual void StopSwipePan()
{
swipePanActive = false;

47
Assets/Fungus/Scripts/Components/Character.cs

@ -13,7 +13,7 @@ namespace Fungus
/// A Character that can be used in dialogue via the Say, Conversation and Portrait commands.
/// </summary>
[ExecuteInEditMode]
public class Character : MonoBehaviour, ICharacter, ILocalizable
public class Character : MonoBehaviour, ILocalizable
{
[Tooltip("Character name as displayed in Say Dialog.")]
[SerializeField] protected string nameText; // We need a separate name as the object name is used for character variations (e.g. "Smurf Happy", "Smurf Sad")
@ -54,32 +54,69 @@ namespace Fungus
activeCharacters.Remove(this);
}
#region ICharacter implementation
#region Public methods
/// <summary>
/// Character name as displayed in Say Dialog.
/// </summary>
public virtual string NameText { get { return nameText; } }
/// <summary>
/// Color to display the character name in Say Dialog.
/// </summary>
public virtual Color NameColor { get { return nameColor; } }
/// <summary>
/// Sound effect to play when this character is speaking.
/// </summary>
/// <value>The sound effect.</value>
public virtual AudioClip SoundEffect { get { return soundEffect; } }
public virtual Sprite ProfileSprite { get; set; }
/// <summary>
/// List of portrait images that can be displayed for this character.
/// </summary>
public virtual List<Sprite> Portraits { get { return portraits; } }
/// <summary>
/// Direction that portrait sprites face.
/// </summary>
public virtual FacingDirection PortraitsFace { get { return portraitsFace; } }
/// <summary>
/// Currently display profile sprite for this character.
/// </summary>
/// <value>The profile sprite.</value>
public virtual Sprite ProfileSprite { get; set; }
/// <summary>
/// Current display state of this character's portrait.
/// </summary>
/// <value>The state.</value>
public virtual PortraitState State { get { return portaitState; } }
public virtual ISayDialog SetSayDialog { get { return setSayDialog; } }
/// <summary>
/// Sets the active Say dialog with a reference to a Say Dialog object in the scene. This Say Dialog will be used whenever the character speaks.
/// </summary>
public virtual SayDialog SetSayDialog { get { return setSayDialog; } }
/// <summary>
/// Returns the name of the game object.
/// </summary>
public string GetObjectName() { return gameObject.name; }
/// <summary>
/// Returns true if the character name starts with the specified string. Case insensitive.
/// </summary>
public virtual bool NameStartsWith(string matchString)
{
return name.StartsWith(matchString, true, System.Globalization.CultureInfo.CurrentCulture)
|| nameText.StartsWith(matchString, true, System.Globalization.CultureInfo.CurrentCulture);
}
/// <summary>
/// Looks for a portrait by name on a character
/// If none is found, give a warning and return a blank sprite
/// </summary>
public virtual Sprite GetPortrait(string portraitString)
{
if (String.IsNullOrEmpty(portraitString))

7
Assets/Fungus/Scripts/Components/Clickable2D.cs

@ -13,7 +13,7 @@ namespace Fungus
/// The Game Object must have a Collider or Collider2D component attached.
/// Use in conjunction with the ObjectClicked Flowchart event handler.
/// </summary>
public class Clickable2D : MonoBehaviour, IClickable2D, IPointerClickHandler, IPointerEnterHandler, IPointerExitHandler
public class Clickable2D : MonoBehaviour, IPointerClickHandler, IPointerEnterHandler, IPointerExitHandler
{
[Tooltip("Is object clicking enabled")]
[SerializeField] protected bool clickEnabled = true;
@ -88,8 +88,11 @@ namespace Fungus
#endregion
#region IClickable2D implementation
#region Public methods
/// <summary>
/// Is object clicking enabled.
/// </summary>
public bool ClickEnabled { set { clickEnabled = value; } }
#endregion

12
Assets/Fungus/Scripts/Components/Command.cs

@ -37,7 +37,7 @@ namespace Fungus
/// <summary>
/// Base class for Commands. Commands can be added to Blocks to create an execution sequence.
/// </summary>
public class Command : MonoBehaviour, ICommand
public abstract class Command : MonoBehaviour
{
[FormerlySerializedAs("commandId")]
[HideInInspector]
@ -48,7 +48,7 @@ namespace Fungus
protected string errorMessage = "";
#region ICommand implementation
#region Public methods
/// <summary>
/// Unique identifier for this command.
@ -92,13 +92,13 @@ namespace Fungus
/// <summary>
/// Returns the Flowchart that this command belongs to.
/// </summary>
public virtual IFlowchart GetFlowchart()
public virtual Flowchart GetFlowchart()
{
IFlowchart flowchart = GetComponent<IFlowchart>();
var flowchart = GetComponent<Flowchart>();
if (flowchart == null &&
transform.parent != null)
{
flowchart = transform.parent.GetComponent<IFlowchart>();
flowchart = transform.parent.GetComponent<Flowchart>();
}
return flowchart;
}
@ -267,7 +267,7 @@ namespace Fungus
public virtual string GetFlowchartLocalizationId()
{
// If no localization id has been set then use the Flowchart name
IFlowchart flowchart = GetFlowchart();
var flowchart = GetFlowchart();
if (flowchart == null)
{
return "";

16
Assets/Fungus/Scripts/Components/CustomTag.cs

@ -10,7 +10,7 @@ namespace Fungus
/// Create custom tags for use in Say text.
/// </summary>
[ExecuteInEditMode]
public class CustomTag : MonoBehaviour, ICustomTag
public class CustomTag : MonoBehaviour
{
[Tooltip("String that defines the start of the tag.")]
[SerializeField] protected string tagStartSymbol;
@ -39,14 +39,26 @@ namespace Fungus
activeCustomTags.Remove(this);
}
#region ICustomTag implementation
#region Public methods
/// <summary>
/// String that defines the start of the tag.
/// </summary>
public virtual string TagStartSymbol { get { return tagStartSymbol; } }
/// <summary>
/// String that defines the end of the tag.
/// </summary>
public virtual string TagEndSymbol { get { return tagEndSymbol; } }
/// <summary>
/// String to replace the start tag with.
/// </summary>
public virtual string ReplaceTagStartWith { get { return replaceTagStartWith; } }
/// <summary>
/// String to replace the end tag with.
/// </summary>
public virtual string ReplaceTagEndWith { get { return replaceTagEndWith; } }
#endregion

25
Assets/Fungus/Scripts/Components/DialogInput.cs

@ -24,7 +24,7 @@ namespace Fungus
/// <summary>
/// Input handler for say dialogs.
/// </summary>
public class DialogInput : MonoBehaviour, IDialogInput
public class DialogInput : MonoBehaviour
{
[Tooltip("Click to advance story")]
[SerializeField] protected ClickMode clickMode;
@ -102,9 +102,9 @@ namespace Fungus
if (ignoreMenuClicks)
{
// Ignore input events if a Menu is being displayed
if (MenuDialog.activeMenuDialog != null &&
MenuDialog.activeMenuDialog.IsActive() &&
MenuDialog.activeMenuDialog.DisplayedOptionsCount > 0)
if (MenuDialog.ActiveMenuDialog != null &&
MenuDialog.ActiveMenuDialog.IsActive() &&
MenuDialog.ActiveMenuDialog.DisplayedOptionsCount > 0)
{
dialogClickedFlag = false;
nextLineInputFlag = false;
@ -123,14 +123,20 @@ namespace Fungus
}
}
#region IDialogInput
#region Public methods
public void SetNextLineFlag()
/// <summary>
/// Trigger next line input event from script.
/// </summary>
public virtual void SetNextLineFlag()
{
nextLineInputFlag = true;
}
public void SetDialogClickedFlag()
/// <summary>
/// Set the dialog clicked flag (usually from an Event Trigger component in the dialog UI).
/// </summary>
public virtual void SetDialogClickedFlag()
{
// Ignore repeat clicks for a short time to prevent accidentally clicking through the character dialogue
if (ignoreClickTimer > 0f)
@ -146,7 +152,10 @@ namespace Fungus
}
}
public void SetButtonClickedFlag()
/// <summary>
/// Sets the button clicked flag.
/// </summary>
public virtual void SetButtonClickedFlag()
{
// Only applies if clicking is not disabled
if (clickMode != ClickMode.Disabled)

8
Assets/Fungus/Scripts/Components/Draggable2D.cs

@ -16,7 +16,7 @@ namespace Fungus
/// The RigidBody would typically have the Is Kinematic property set to true, unless you want the object to move around using physics.
/// Use in conjunction with the Drag Started, Drag Completed, Drag Cancelled, Drag Entered & Drag Exited event handlers.
/// </summary>
public class Draggable2D : MonoBehaviour, IDraggable2D, IBeginDragHandler, IDragHandler, IEndDragHandler, IPointerEnterHandler, IPointerExitHandler
public class Draggable2D : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler, IPointerEnterHandler, IPointerExitHandler
{
[Tooltip("Is object dragging enabled")]
[SerializeField] protected bool dragEnabled = true;
@ -232,8 +232,12 @@ namespace Fungus
#endregion
#region IDraggable2D implementation
#region Public methods
/// <summary>
/// Is object drag and drop enabled.
/// </summary>
/// <value><c>true</c> if drag enabled; otherwise, <c>false</c>.</value>
public virtual bool DragEnabled { get { return dragEnabled; } set { dragEnabled = value; } }
#endregion

13
Assets/Fungus/Scripts/Components/EventHandler.cs

@ -35,16 +35,22 @@ namespace Fungus
[RequireComponent(typeof(Block))]
[RequireComponent(typeof(Flowchart))]
[AddComponentMenu("")]
public class EventHandler : MonoBehaviour, IEventHandler
public class EventHandler : MonoBehaviour
{
[HideInInspector]
[FormerlySerializedAs("parentSequence")]
[SerializeField] protected Block parentBlock;
#region IEventHandler
#region Public methods
/// <summary>
/// The parent Block which owns this Event Handler.
/// </summary>
public virtual Block ParentBlock { get { return parentBlock; } set { parentBlock = value; } }
/// <summary>
/// The Event Handler should call this method when the event is detected to start executing the Block.
/// </summary>
public virtual bool ExecuteBlock()
{
if (ParentBlock == null)
@ -68,6 +74,9 @@ namespace Fungus
return flowchart.ExecuteBlock(ParentBlock);
}
/// <summary>
/// Returns custom summary text for the event handler.
/// </summary>
public virtual string GetSummary()
{
return "";

259
Assets/Fungus/Scripts/Components/Flowchart.cs

@ -21,7 +21,7 @@ namespace Fungus
/// Flowchart objects may be edited visually using the Flowchart editor window.
/// </summary>
[ExecuteInEditMode]
public class Flowchart : MonoBehaviour, IFlowchart, ISubstitutionHandler
public class Flowchart : MonoBehaviour, ISubstitutionHandler
{
[HideInInspector]
[SerializeField] protected int version = 0; // Default to 0 to always trigger an update for older versions of Fungus.
@ -86,28 +86,12 @@ namespace Fungus
[Tooltip("The ExecuteLua command adds a global Lua variable with this name bound to the flowchart prior to executing.")]
[SerializeField] protected string luaBindingName = "flowchart";
protected static List<Flowchart> cachedFlowcharts = new List<Flowchart>();
protected static bool eventSystemPresent;
protected StringSubstituter stringSubstituer;
/// <summary>
/// Cached list of flowchart objects in the scene for fast lookup.
/// </summary>
public static List<Flowchart> cachedFlowcharts = new List<Flowchart>();
/// <summary>
/// Sends a message to all Flowchart objects in the current scene.
/// Any block with a matching MessageReceived event handler will start executing.
/// </summary>
public static void BroadcastFungusMessage(string messageName)
{
MessageReceived[] eventHandlers = UnityEngine.Object.FindObjectsOfType<MessageReceived>();
foreach (MessageReceived eventHandler in eventHandlers)
{
eventHandler.OnSendFungusMessage(messageName);
}
}
#if UNITY_5_4_OR_NEWER
protected virtual void Awake()
{
@ -200,7 +184,7 @@ namespace Fungus
// Make sure item ids are unique and monotonically increasing.
// This should always be the case, but some legacy Flowcharts may have issues.
List<int> usedIds = new List<int>();
var blocks = GetComponents<IBlock>();
var blocks = GetComponents<Block>();
foreach (var block in blocks)
{
if (block.ItemId == -1 ||
@ -211,7 +195,7 @@ namespace Fungus
usedIds.Add(block.ItemId);
}
var commands = GetComponents<ICommand>();
var commands = GetComponents<Command>();
foreach (var command in commands)
{
if (command.ItemId == -1 ||
@ -241,7 +225,7 @@ namespace Fungus
}
}
var blocks = GetComponents<IBlock>();
var blocks = GetComponents<Block>();
foreach (var command in GetComponents<Command>())
{
@ -286,66 +270,152 @@ namespace Fungus
return block;
}
#region IFlowchart implementation
#region Public methods
/// <summary>
/// Cached list of flowchart objects in the scene for fast lookup.
/// </summary>
public static List<Flowchart> CachedFlowcharts { get { return cachedFlowcharts; } }
/// <summary>
/// Sends a message to all Flowchart objects in the current scene.
/// Any block with a matching MessageReceived event handler will start executing.
/// </summary>
public static void BroadcastFungusMessage(string messageName)
{
MessageReceived[] eventHandlers = UnityEngine.Object.FindObjectsOfType<MessageReceived>();
foreach (MessageReceived eventHandler in eventHandlers)
{
eventHandler.OnSendFungusMessage(messageName);
}
}
/// <summary>
/// Scroll position of Flowchart editor window.
/// </summary>
public virtual Vector2 ScrollPos { get { return scrollPos; } set { scrollPos = value; } }
/// <summary>
/// Scroll position of Flowchart variables window.
/// </summary>
public virtual Vector2 VariablesScrollPos { get { return variablesScrollPos; } set { variablesScrollPos = value; } }
/// <summary>
/// Show the variables pane.
/// </summary>
public virtual bool VariablesExpanded { get { return variablesExpanded; } set { variablesExpanded = value; } }
/// <summary>
/// Height of command block view in inspector.
/// </summary>
public virtual float BlockViewHeight { get { return blockViewHeight; } set { blockViewHeight = value; } }
/// <summary>
/// Zoom level of Flowchart editor window.
/// </summary>
public virtual float Zoom { get { return zoom; } set { zoom = value; } }
/// <summary>
/// Scrollable area for Flowchart editor window.
/// </summary>
public virtual Rect ScrollViewRect { get { return scrollViewRect; } set { scrollViewRect = value; } }
/// <summary>
/// Currently selected block in the Flowchart editor.
/// </summary>
public virtual Block SelectedBlock { get { return selectedBlock; } set { selectedBlock = value; } }
/// <summary>
/// Currently selected command in the Flowchart editor.
/// </summary>
public virtual List<Command> SelectedCommands { get { return selectedCommands; } }
/// <summary>
/// The list of variables that can be accessed by the Flowchart.
/// </summary>
public virtual List<Variable> Variables { get { return variables; } }
/// <summary>
/// Description text displayed in the Flowchart editor window
/// </summary>
public virtual string Description { get { return description; } }
/// <summary>
/// Slow down execution in the editor to make it easier to visualise program flow.
/// </summary>
public virtual float StepPause { get { return stepPause; } }
/// <summary>
/// Use command color when displaying the command list in the inspector.
/// </summary>
public virtual bool ColorCommands { get { return colorCommands; } }
/// <summary>
/// Saves the selected block and commands when saving the scene. Helps avoid version control conflicts if you've only changed the active selection.
/// </summary>
public virtual bool SaveSelection { get { return saveSelection; } }
/// <summary>
/// Unique identifier for identifying this flowchart in localized string keys.
/// </summary>
public virtual string LocalizationId { get { return localizationId; } }
/// <summary>
/// Display line numbers in the command list in the Block inspector.
/// </summary>
public virtual bool ShowLineNumbers { get { return showLineNumbers; } }
/// <summary>
/// Lua Environment to be used by default for all Execute Lua commands in this Flowchart.
/// </summary>
public virtual ILuaEnvironment LuaEnv { get { return luaEnvironment; } }
/// <summary>
/// The ExecuteLua command adds a global Lua variable with this name bound to the flowchart prior to executing.
/// </summary>
public virtual string LuaBindingName { get { return luaBindingName; } }
/// <summary>
/// Position in the center of all blocks in the flowchart.
/// </summary>
public virtual Vector2 CenterPosition { set; get; }
/// <summary>
/// Variable to track flowchart's version so components can update to new versions.
/// </summary>
public int Version { set { version = value; } }
/// <summary>
/// Returns true if the Flowchart gameobject is active.
/// </summary>
public bool IsActive()
{
return gameObject.activeInHierarchy;
}
/// <summary>
/// Returns the Flowchart gameobject name.
/// </summary>
public string GetName()
{
return gameObject.name;
}
/// <summary>
/// Returns the next id to assign to a new flowchart item.
/// Item ids increase monotically so they are guaranteed to
/// be unique within a Flowchart.
/// </summary>
public int NextItemId()
{
int maxId = -1;
var blocks = GetComponents<IBlock>();
var blocks = GetComponents<Block>();
foreach (var block in blocks)
{
maxId = Math.Max(maxId, block.ItemId);
}
var commands = GetComponents<ICommand>();
var commands = GetComponents<Command>();
foreach (var command in commands)
{
maxId = Math.Max(maxId, command.ItemId);
@ -353,6 +423,9 @@ namespace Fungus
return maxId + 1;
}
/// <summary>
/// Create a new block node which you can then add commands to.
/// </summary>
public virtual Block CreateBlock(Vector2 position)
{
Block b = CreateBlockComponent(gameObject);
@ -363,9 +436,12 @@ namespace Fungus
return b;
}
public virtual IBlock FindBlock(string blockName)
/// <summary>
/// Returns the named Block in the flowchart, or null if not found.
/// </summary>
public virtual Block FindBlock(string blockName)
{
var blocks = GetComponents<IBlock>();
var blocks = GetComponents<Block>();
foreach (var block in blocks)
{
if (block.BlockName == blockName)
@ -377,6 +453,9 @@ namespace Fungus
return null;
}
/// <summary>
/// Execute a child block in the Flowchart.
/// You can use this method in a UI event. e.g. to handle a button click.
public virtual void ExecuteBlock(string blockName)
{
var block = FindBlock(blockName);
@ -393,7 +472,13 @@ namespace Fungus
}
}
public virtual bool ExecuteBlock(IBlock block, int commandIndex = 0, Action onComplete = null)
/// <summary>
/// Execute a child block in the flowchart.
/// The block must be in an idle state to be executed.
/// This version provides extra options to control how the block is executed.
/// Returns true if the Block started execution.
/// </summary>
public virtual bool ExecuteBlock(Block block, int commandIndex = 0, Action onComplete = null)
{
if (block == null)
{
@ -419,10 +504,13 @@ namespace Fungus
return true;
}
/// <summary>
/// Stop all executing Blocks in this Flowchart.
/// </summary>
public virtual void StopAllBlocks()
{
var blocks = GetComponents<IBlock>();
foreach (IBlock block in blocks)
var blocks = GetComponents<Block>();
foreach (Block block in blocks)
{
if (block.IsExecuting())
{
@ -431,6 +519,10 @@ namespace Fungus
}
}
/// <summary>
/// Sends a message to this Flowchart only.
/// Any block with a matching MessageReceived event handler will start executing.
/// </summary>
public virtual void SendFungusMessage(string messageName)
{
MessageReceived[] eventHandlers = GetComponents<MessageReceived>();
@ -440,6 +532,9 @@ namespace Fungus
}
}
/// <summary>
/// Returns a new variable key that is guaranteed not to clash with any existing variable in the list.
/// </summary>
public virtual string GetUniqueVariableKey(string originalKey, Variable ignoreVariable = null)
{
int suffix = 0;
@ -486,7 +581,10 @@ namespace Fungus
}
}
public virtual string GetUniqueBlockKey(string originalKey, IBlock ignoreBlock = null)
/// <summary>
/// Returns a new Block key that is guaranteed not to clash with any existing Block in the Flowchart.
/// </summary>
public virtual string GetUniqueBlockKey(string originalKey, Block ignoreBlock = null)
{
int suffix = 0;
string baseKey = originalKey.Trim();
@ -497,7 +595,7 @@ namespace Fungus
baseKey = FungusConstants.DefaultBlockName;
}
var blocks = GetComponents<IBlock>();
var blocks = GetComponents<Block>();
string key = baseKey;
while (true)
@ -526,6 +624,9 @@ namespace Fungus
}
}
/// <summary>
/// Returns a new Label key that is guaranteed not to clash with any existing Label in the Block.
/// </summary>
public virtual string GetUniqueLabelKey(string originalKey, Label ignoreLabel)
{
int suffix = 0;
@ -537,7 +638,7 @@ namespace Fungus
baseKey = "New Label";
}
IBlock block = ignoreLabel.ParentBlock;
var block = ignoreLabel.ParentBlock;
string key = baseKey;
while (true)
@ -567,6 +668,13 @@ namespace Fungus
}
}
/// <summary>
/// Returns the variable with the specified key, or null if the key is not found.
/// You will need to cast the returned variable to the correct sub-type.
/// You can then access the variable's value using the Value property. e.g.
/// BooleanVariable boolVar = flowchart.GetVariable("MyBool") as BooleanVariable;
/// boolVar.Value = false;
/// </summary>
public Variable GetVariable(string key)
{
foreach (Variable variable in variables)
@ -580,6 +688,12 @@ namespace Fungus
return null;
}
/// <summary>
/// Returns the variable with the specified key, or null if the key is not found.
/// You can then access the variable's value using the Value property. e.g.
/// BooleanVariable boolVar = flowchart.GetVariable<BooleanVariable>("MyBool");
/// boolVar.Value = false;
/// </summary>
public T GetVariable<T>(string key) where T : Variable
{
foreach (Variable variable in variables)
@ -594,6 +708,10 @@ namespace Fungus
return null;
}
/// <summary>
/// Register a new variable with the Flowchart at runtime.
/// The variable should be added as a component on the Flowchart game object.
/// </summary>
public void SetVariable<T>(string key, T newvariable) where T : Variable
{
foreach (Variable v in variables)
@ -612,6 +730,9 @@ namespace Fungus
Debug.LogWarning("Variable " + key + " not found.");
}
/// <summary>
/// Gets a list of all variables with public scope in this Flowchart.
/// </summary>
public virtual List<Variable> GetPublicVariables()
{
List<Variable> publicVariables = new List<Variable>();
@ -626,6 +747,10 @@ namespace Fungus
return publicVariables;
}
/// <summary>
/// Gets the value of a boolean variable.
/// Returns false if the variable key does not exist.
/// </summary>
public virtual bool GetBooleanVariable(string key)
{
BooleanVariable variable = GetVariable<BooleanVariable>(key);
@ -640,6 +765,10 @@ namespace Fungus
}
}
/// <summary>
/// Sets the value of a boolean variable.
/// The variable must already be added to the list of variables for this Flowchart.
/// </summary>
public virtual void SetBooleanVariable(string key, bool value)
{
BooleanVariable variable = GetVariable<BooleanVariable>(key);
@ -649,6 +778,10 @@ namespace Fungus
}
}
/// <summary>
/// Gets the value of an integer variable.
/// Returns 0 if the variable key does not exist.
/// </summary>
public virtual int GetIntegerVariable(string key)
{
IntegerVariable variable = GetVariable<IntegerVariable>(key);
@ -663,6 +796,10 @@ namespace Fungus
}
}
/// <summary>
/// Sets the value of an integer variable.
/// The variable must already be added to the list of variables for this Flowchart.
/// </summary>
public virtual void SetIntegerVariable(string key, int value)
{
IntegerVariable variable = GetVariable<IntegerVariable>(key);
@ -672,6 +809,10 @@ namespace Fungus
}
}
/// <summary>
/// Gets the value of a float variable.
/// Returns 0 if the variable key does not exist.
/// </summary>
public virtual float GetFloatVariable(string key)
{
FloatVariable variable = GetVariable<FloatVariable>(key);
@ -686,6 +827,10 @@ namespace Fungus
}
}
/// <summary>
/// Sets the value of a float variable.
/// The variable must already be added to the list of variables for this Flowchart.
/// </summary>
public virtual void SetFloatVariable(string key, float value)
{
FloatVariable variable = GetVariable<FloatVariable>(key);
@ -695,6 +840,10 @@ namespace Fungus
}
}
/// <summary>
/// Gets the value of a string variable.
/// Returns the empty string if the variable key does not exist.
/// </summary>
public virtual string GetStringVariable(string key)
{
StringVariable variable = GetVariable<StringVariable>(key);
@ -709,6 +858,10 @@ namespace Fungus
}
}
/// <summary>
/// Sets the value of a string variable.
/// The variable must already be added to the list of variables for this Flowchart.
/// </summary>
public virtual void SetStringVariable(string key, string value)
{
StringVariable variable = GetVariable<StringVariable>(key);
@ -718,6 +871,9 @@ namespace Fungus
}
}
/// <summary>
/// Set the block objects to be hidden or visible depending on the hideComponents property.
/// </summary>
public virtual void UpdateHideFlags()
{
if (hideComponents)
@ -758,14 +914,19 @@ namespace Fungus
monoBehaviour.gameObject.hideFlags = HideFlags.None;
}
}
}
/// <summary>
/// Clears the list of selected commands.
/// </summary>
public virtual void ClearSelectedCommands()
{
selectedCommands.Clear();
}
/// <summary>
/// Adds a command to the list of selected commands.
/// </summary>
public virtual void AddSelectedCommand(Command command)
{
if (!selectedCommands.Contains(command))
@ -774,11 +935,14 @@ namespace Fungus
}
}
/// <summary>
/// Reset the commands and variables in the Flowchart.
/// </summary>
public virtual void Reset(bool resetCommands, bool resetVariables)
{
if (resetCommands)
{
ICommand[] commands = GetComponents<ICommand>();
var commands = GetComponents<Command>();
foreach (var command in commands)
{
command.OnReset();
@ -794,6 +958,9 @@ namespace Fungus
}
}
/// <summary>
/// Override this in a Flowchart subclass to filter which commands are shown in the Add Command list.
/// </summary>
public virtual bool IsCommandSupported(CommandInfoAttribute commandInfo)
{
foreach (string key in hideCommands)
@ -809,10 +976,13 @@ namespace Fungus
return true;
}
/// <summary>
/// Returns true if there are any executing blocks in this Flowchart.
/// </summary>
public virtual bool HasExecutingBlocks()
{
var blocks = GetComponents<IBlock>();
foreach (IBlock block in blocks)
var blocks = GetComponents<Block>();
foreach (var block in blocks)
{
if (block.IsExecuting())
{
@ -822,10 +992,13 @@ namespace Fungus
return false;
}
public virtual List<IBlock> GetExecutingBlocks()
/// <summary>
/// Returns a list of all executing blocks in this Flowchart.
/// </summary>
public virtual List<Block> GetExecutingBlocks()
{
var executingBlocks = new List<IBlock>();
var blocks = GetComponents<IBlock>();
var executingBlocks = new List<Block>();
var blocks = GetComponents<Block>();
foreach (var block in blocks)
{
if (block.IsExecuting())
@ -837,6 +1010,12 @@ namespace Fungus
return executingBlocks;
}
/// <summary>
/// Substitute variables in the input text with the format {$VarName}
/// This will first match with private variables in this Flowchart, and then
/// with public variables in all Flowcharts in the scene (and any component
/// in the scene that implements StringSubstituter.ISubstitutionHandler).
/// </summary>
public virtual string SubstituteVariables(string input)
{
if (stringSubstituer == null)

7
Assets/Fungus/Scripts/Components/FungusState.cs

@ -10,12 +10,15 @@ namespace Fungus
/// so that the same Flowchart can be displayed while editing & playing.
/// </summary>
[AddComponentMenu("")]
public class FungusState : MonoBehaviour, IFungusState
public class FungusState : MonoBehaviour
{
[SerializeField] protected Flowchart selectedFlowchart;
#region IFungusState implementation
#region Public methods
/// <summary>
/// The currently selected Flowchart.
/// </summary>
public virtual Flowchart SelectedFlowchart { get { return selectedFlowchart; } set { selectedFlowchart = value; } }
#endregion

75
Assets/Fungus/Scripts/Components/Localization.cs

@ -16,7 +16,7 @@ namespace Fungus
/// <summary>
/// Multi-language localization support.
/// </summary>
public class Localization : MonoBehaviour, ILocalization, ISubstitutionHandler
public class Localization : MonoBehaviour, ISubstitutionHandler
{
/// <summary>
/// Temp storage for a single item of standard text and its localizations.
@ -93,26 +93,6 @@ namespace Fungus
initialized = true;
}
/// <summary>
/// Looks up the specified string in the localized strings table.
/// For this to work, a localization file and active language must have been set previously.
/// Return null if the string is not found.
/// </summary>
public static string GetLocalizedString(string stringId)
{
if (localizedStrings == null)
{
return null;
}
if (localizedStrings.ContainsKey(stringId))
{
return localizedStrings[stringId];
}
return null;
}
// Build a cache of all the localizeable objects in the scene
protected virtual void CacheLocalizeableObjects()
{
@ -139,7 +119,7 @@ namespace Fungus
var flowcharts = GameObject.FindObjectsOfType<Flowchart>();
foreach (var flowchart in flowcharts)
{
var blocks = flowchart.GetComponents<IBlock>();
var blocks = flowchart.GetComponents<Block>();
foreach (var block in blocks)
{
foreach (var command in block.CommandList)
@ -247,19 +227,54 @@ namespace Fungus
}
}
#region ILocalization interface
#region Public methods
/// <summary>
/// Looks up the specified string in the localized strings table.
/// For this to work, a localization file and active language must have been set previously.
/// Return null if the string is not found.
/// </summary>
public static string GetLocalizedString(string stringId)
{
if (localizedStrings == null)
{
return null;
}
if (localizedStrings.ContainsKey(stringId))
{
return localizedStrings[stringId];
}
return null;
}
/// <summary>
/// Language to use at startup, usually defined by a two letter language code (e.g DE = German).
/// </summary>
public virtual string ActiveLanguage { get { return activeLanguage; } }
/// <summary>
/// CSV file containing localization data which can be easily edited in a spreadsheet tool.
/// </summary>
public virtual TextAsset LocalizationFile { get { return localizationFile; } set { localizationFile = value; } }
/// <summary>
/// Stores any notification message from export / import methods.
/// </summary>
public virtual string NotificationText { get { return notificationText; } set { notificationText = value; } }
/// <summary>
/// Clears the cache of localizeable objects.
/// </summary>
public virtual void ClearLocalizeableCache()
{
localizeableObjects.Clear();
}
/// <summary>
/// Convert all text items and localized strings to an easy to edit CSV format.
/// </summary>
public virtual string GetCSVData()
{
// Collect all the text items present in the scene
@ -319,6 +334,10 @@ namespace Fungus
return csvData;
}
/// <summary>
/// Scan a localization CSV file and copies the strings for the specified language code
/// into the text properties of the appropriate scene objects.
/// </summary>
public virtual void SetActiveLanguage(string languageCode, bool forceUpdateSceneText = false)
{
if (!Application.isPlaying)
@ -411,6 +430,9 @@ namespace Fungus
}
}
/// <summary>
/// Populates the text property of a single scene object with a new text value.
/// </summary>
public virtual bool PopulateTextProperty(string stringId, string newText)
{
// Ensure that all localizeable objects have been cached
@ -430,6 +452,10 @@ namespace Fungus
return false;
}
/// <summary>
/// Returns all standard text for localizeable text in the scene using an
/// easy to edit custom text format.
/// </summary>
public virtual string GetStandardText()
{
// Collect all the text items present in the scene
@ -451,6 +477,9 @@ namespace Fungus
return textData;
}
/// <summary>
/// Sets standard text on scene objects by parsing a text data file.
/// </summary>
public virtual void SetStandardText(string textData)
{
string[] lines = textData.Split('\n');

120
Assets/Fungus/Scripts/Components/MenuDialog.cs

@ -10,7 +10,10 @@ using MoonSharp.Interpreter;
namespace Fungus
{
public class MenuDialog : MonoBehaviour, IMenuDialog
/// <summary>
/// Presents multiple choice buttons to the players.
/// </summary>
public class MenuDialog : MonoBehaviour
{
[Tooltip("Automatically select the first interactable button when the menu is shown.")]
[SerializeField] protected bool autoSelectFirstButton = false;
@ -19,37 +22,6 @@ namespace Fungus
protected Slider cachedSlider;
// Currently active Menu Dialog used to display Menu options
public static IMenuDialog activeMenuDialog;
public static IMenuDialog GetMenuDialog()
{
if (activeMenuDialog == null)
{
// Use first Menu Dialog found in the scene (if any)
IMenuDialog md = GameObject.FindObjectOfType<MenuDialog>();
if (md != null)
{
activeMenuDialog = md;
}
if (activeMenuDialog == null)
{
// Auto spawn a menu dialog object from the prefab
GameObject prefab = Resources.Load<GameObject>("Prefabs/MenuDialog");
if (prefab != null)
{
GameObject go = Instantiate(prefab) as GameObject;
go.SetActive(false);
go.name = "MenuDialog";
activeMenuDialog = go.GetComponent<IMenuDialog>();
}
}
}
return activeMenuDialog;
}
protected virtual void Awake()
{
Button[] optionButtons = GetComponentsInChildren<Button>();
@ -102,17 +74,67 @@ namespace Fungus
}
}
#region IMenuDialog implementation
#region Public methods
/// <summary>
/// Currently active Menu Dialog used to display Menu options
/// </summary>
public static MenuDialog ActiveMenuDialog { get; set; }
/// <summary>
/// Returns a menu dialog by searching for one in the scene or creating one if none exists.
/// </summary>
public static MenuDialog GetMenuDialog()
{
if (ActiveMenuDialog == null)
{
// Use first Menu Dialog found in the scene (if any)
var md = GameObject.FindObjectOfType<MenuDialog>();
if (md != null)
{
ActiveMenuDialog = md;
}
if (ActiveMenuDialog == null)
{
// Auto spawn a menu dialog object from the prefab
GameObject prefab = Resources.Load<GameObject>("Prefabs/MenuDialog");
if (prefab != null)
{
GameObject go = Instantiate(prefab) as GameObject;
go.SetActive(false);
go.name = "MenuDialog";
ActiveMenuDialog = go.GetComponent<MenuDialog>();
}
}
}
return ActiveMenuDialog;
}
/// <summary>
/// A cached list of button objects in the menu dialog.
/// </summary>
/// <value>The cached buttons.</value>
public virtual Button[] CachedButtons { get { return cachedButtons; } }
/// <summary>
/// A cached slider object used for the timer in the menu dialog.
/// </summary>
/// <value>The cached slider.</value>
public virtual Slider CachedSlider { get { return cachedSlider; } }
/// <summary>
/// Sets the active state of the Menu Dialog gameobject.
/// </summary>
public virtual void SetActive(bool state)
{
gameObject.SetActive(state);
}
/// <summary>
/// Clear all displayed options in the Menu Dialog.
/// </summary>
public virtual void Clear()
{
StopAllCoroutines();
@ -138,15 +160,26 @@ namespace Fungus
}
}
/// <summary>
/// Hides any currently displayed Say Dialog.
/// </summary>
public virtual void HideSayDialog()
{
ISayDialog sayDialog = SayDialog.GetSayDialog();
var sayDialog = SayDialog.GetSayDialog();
if (sayDialog != null)
{
sayDialog.FadeWhenDone = true;
}
}
/// <summary>
/// Adds the option to the list of displayed options. Calls a Block when selected.
/// Will cause the Menu dialog to become visible if it is not already visible.
/// </summary>
/// <returns><c>true</c>, if the option was added successfully.</returns>
/// <param name="text">The option text to display on the button.</param>
/// <param name="interactable">If false, the option is displayed but is not selectable.</param>
/// <param name="targetBlock">Block to execute when the option is selected.</param>
public virtual bool AddOption(string text, bool interactable, Block targetBlock)
{
bool addedOption = false;
@ -202,6 +235,11 @@ namespace Fungus
return addedOption;
}
/// <summary>
/// Adds the option to the list of displayed options, calls a Lua function when selected.
/// Will cause the Menu dialog to become visible if it is not already visible.
/// </summary>
/// <returns><c>true</c>, if the option was added successfully.</returns>
public bool AddOption(string text, bool interactable, ILuaEnvironment luaEnv, Closure callBack)
{
if (!gameObject.activeSelf)
@ -244,6 +282,11 @@ namespace Fungus
return addedOption;
}
/// <summary>
/// Show a timer during which the player can select an option. Calls a Block when the timer expires.
/// </summary>
/// <param name="duration">The duration during which the player can select an option.</param>
/// <param name="targetBlock">Block to execute if the player does not select an option in time.</param>
public virtual void ShowTimer(float duration, Block targetBlock)
{
if (cachedSlider != null)
@ -255,6 +298,9 @@ namespace Fungus
}
}
/// <summary>
/// Show a timer during which the player can select an option. Calls a Lua function when the timer expires.
/// </summary>
public IEnumerator ShowTimer(float duration, ILuaEnvironment luaEnv, Closure callBack)
{
if (CachedSlider == null ||
@ -292,11 +338,17 @@ namespace Fungus
}
}
/// <summary>
/// Returns true if the Menu Dialog is currently displayed.
/// </summary>
public virtual bool IsActive()
{
return gameObject.activeInHierarchy;
}
/// <summary>
/// Returns the number of currently displayed options.
/// </summary>
public virtual int DisplayedOptionsCount
{
get {

36
Assets/Fungus/Scripts/Components/MusicController.cs

@ -5,16 +5,20 @@
namespace Fungus
{
/// <summary>
/// Music manager which provides basic music and sound effect functionality.
/// Music playback persists across scene loads.
/// </summary>
[RequireComponent(typeof(AudioSource))]
public class MusicController : MonoBehaviour, IMusicController
public class MusicController : MonoBehaviour
{
static IMusicController instance;
static MusicController instance;
/// <summary>
/// Returns the MusicController singleton instance.
/// Will create a MusicController game object if none currently exists.
/// </summary>
static public IMusicController GetInstance()
static public MusicController GetInstance()
{
if (instance == null)
{
@ -32,8 +36,12 @@ namespace Fungus
GetComponent<AudioSource>().loop = true;
}
#region IMusicController implementation
#region Public methods
/// <summary>
/// Plays game music using an audio clip.
/// One music clip may be played at a time.
/// </summary>
public void PlayMusic(AudioClip musicClip, bool loop, float fadeDuration, float atTime)
{
AudioSource audioSource = GetComponent<AudioSource>();
@ -68,11 +76,22 @@ namespace Fungus
}
}
/// <summary>
/// Plays a sound effect once, at the specified volume.
/// </summary>
/// <param name="soundClip">The sound effect clip to play.</param>
/// <param name="volume">The volume level of the sound effect.</param>
public virtual void PlaySound(AudioClip soundClip, float volume)
{
GetComponent<AudioSource>().PlayOneShot(soundClip, volume);
}
/// <summary>
/// Shifts the game music pitch to required value over a period of time.
/// </summary>
/// <param name="pitch">The new music pitch value.</param>
/// <param name="duration">The length of time in seconds needed to complete the pitch change.</param>
/// <param name="onComplete">A delegate method to call when the pitch shift has completed.</param>
public virtual void SetAudioPitch(float pitch, float duration, System.Action onComplete)
{
AudioSource audio = GetComponent<AudioSource>();
@ -100,6 +119,12 @@ namespace Fungus
});
}
/// <summary>
/// Fades the game music volume to required level over a period of time.
/// </summary>
/// <param name="volume">The new music volume value [0..1]</param>
/// <param name="duration">The length of time in seconds needed to complete the volume change.</param>
/// <param name="onComplete">Delegate function to call when fade completes.</param>
public virtual void SetAudioVolume(float volume, float duration, System.Action onComplete)
{
AudioSource audio = GetComponent<AudioSource>();
@ -123,6 +148,9 @@ namespace Fungus
});
}
/// <summary>
/// Stops playing game music.
/// </summary>
public virtual void StopMusic()
{
GetComponent<AudioSource>().Stop();

137
Assets/Fungus/Scripts/Components/PortraitController.cs

@ -10,29 +10,59 @@ using Fungus.Utils;
namespace Fungus
{
/// <summary>
/// Types of display operations supported by portraits.
/// </summary>
public enum DisplayType
{
/// <summary> Do nothing. </summary>
None,
/// <summary> Show the portrait. </summary>
Show,
/// <summary> Hide the portrait. </summary>
Hide,
/// <summary> Replace the existing portrait. </summary>
Replace,
/// <summary> Move portrait to the front. </summary>
MoveToFront
}
/// <summary>
/// Directions that character portraits can face.
/// </summary>
public enum FacingDirection
{
/// <summary> Unknown direction </summary>
None,
/// <summary> Facing left. </summary>
Left,
/// <summary> Facing right. </summary>
Right
}
/// <summary>
/// Offset direction for position.
/// </summary>
public enum PositionOffset
{
/// <summary> Unknown offset direction. </summary>
None,
/// <summary> Offset applies to the left. </summary>
OffsetLeft,
/// <summary> Offset applies to the right. </summary>
OffsetRight
}
/// <summary>
/// Controls the Portrait sprites on stage
/// </summary>
public class PortraitController : MonoBehaviour, IPortraitController
public class PortraitController : MonoBehaviour
{
// Timer for waitUntilFinished functionality
protected float waitTimer;
protected Stage stage;
public static void SetRectTransform(RectTransform oldRectTransform, RectTransform newRectTransform)
{
oldRectTransform.eulerAngles = newRectTransform.eulerAngles;
oldRectTransform.position = newRectTransform.position;
oldRectTransform.rotation = newRectTransform.rotation;
oldRectTransform.anchoredPosition = newRectTransform.anchoredPosition;
oldRectTransform.sizeDelta = newRectTransform.sizeDelta;
oldRectTransform.anchorMax = newRectTransform.anchorMax;
oldRectTransform.anchorMin = newRectTransform.anchorMin;
oldRectTransform.pivot = newRectTransform.pivot;
oldRectTransform.localScale = newRectTransform.localScale;
}
protected virtual void Awake()
{
stage = GetComponentInParent<Stage>();
@ -249,8 +279,29 @@ namespace Fungus
}
}
#region IPortraitController implentation
#region Public methods
/// <summary>
/// Performs a deep copy of all values from one RectTransform to another.
/// </summary>
public static void SetRectTransform(RectTransform oldRectTransform, RectTransform newRectTransform)
{
oldRectTransform.eulerAngles = newRectTransform.eulerAngles;
oldRectTransform.position = newRectTransform.position;
oldRectTransform.rotation = newRectTransform.rotation;
oldRectTransform.anchoredPosition = newRectTransform.anchoredPosition;
oldRectTransform.sizeDelta = newRectTransform.sizeDelta;
oldRectTransform.anchorMax = newRectTransform.anchorMax;
oldRectTransform.anchorMin = newRectTransform.anchorMin;
oldRectTransform.pivot = newRectTransform.pivot;
oldRectTransform.localScale = newRectTransform.localScale;
}
/// <summary>
/// Using all portrait options available, run any portrait command.
/// </summary>
/// <param name="options">Portrait Options</param>
/// <param name="onComplete">The function that will run once the portrait command finishes</param>
public virtual void RunPortraitCommand(PortraitOptions options, Action onComplete)
{
waitTimer = 0f;
@ -301,6 +352,9 @@ namespace Fungus
}
}
/// <summary>
/// Moves Character in front of other characters on stage
/// </summary>
public virtual void MoveToFront(Character character)
{
PortraitOptions options = new PortraitOptions(true);
@ -309,6 +363,9 @@ namespace Fungus
MoveToFront(CleanPortraitOptions(options));
}
/// <summary>
/// Moves Character in front of other characters on stage
/// </summary>
public virtual void MoveToFront(PortraitOptions options)
{
options.character.State.portraitImage.transform.SetSiblingIndex(options.character.State.portraitImage.transform.parent.childCount);
@ -316,6 +373,11 @@ namespace Fungus
FinishCommand(options);
}
/// <summary>
/// Shows character at a named position in the stage
/// </summary>
/// <param name="character"></param>
/// <param name="position">Named position on stage</param>
public virtual void Show(Character character, string position)
{
PortraitOptions options = new PortraitOptions(true);
@ -325,6 +387,13 @@ namespace Fungus
Show(options);
}
/// <summary>
/// Shows character moving from a position to a position
/// </summary>
/// <param name="character"></param>
/// <param name="portrait"></param>
/// <param name="fromPosition">Where the character will appear</param>
/// <param name="toPosition">Where the character will move to</param>
public virtual void Show(Character character, string portrait, string fromPosition, string toPosition)
{
PortraitOptions options = new PortraitOptions(true);
@ -337,11 +406,22 @@ namespace Fungus
Show(options);
}
/// <summary>
/// From lua, you can pass an options table with named arguments
/// example:
/// stage.show{character=jill, portrait="happy", fromPosition="right", toPosition="left"}
/// Any option available in the PortraitOptions is available from Lua
/// </summary>
/// <param name="optionsTable">Moonsharp Table</param>
public virtual void Show(Table optionsTable)
{
Show(PortraitUtil.ConvertTableToPortraitOptions(optionsTable, stage));
}
/// <summary>
/// Show portrait with the supplied portrait options
/// </summary>
/// <param name="options"></param>
public virtual void Show(PortraitOptions options)
{
options = CleanPortraitOptions(options);
@ -416,6 +496,11 @@ namespace Fungus
options.character.State.position = options.toPosition;
}
/// <summary>
/// Simple show command that shows the character with an available named portrait
/// </summary>
/// <param name="character">Character to show</param>
/// <param name="portrait">Named portrait to show for the character, i.e. "angry", "happy", etc</param>
public virtual void ShowPortrait(Character character, string portrait)
{
PortraitOptions options = new PortraitOptions(true);
@ -434,6 +519,10 @@ namespace Fungus
Show(options);
}
/// <summary>
/// Simple character hide command
/// </summary>
/// <param name="character">Character to hide</param>
public virtual void Hide(Character character)
{
PortraitOptions options = new PortraitOptions(true);
@ -442,6 +531,11 @@ namespace Fungus
Hide(options);
}
/// <summary>
/// Move the character to a position then hide it
/// </summary>
/// <param name="character">Character to hide</param>
/// <param name="toPosition">Where the character will disapear to</param>
public virtual void Hide(Character character, string toPosition)
{
PortraitOptions options = new PortraitOptions(true);
@ -452,11 +546,21 @@ namespace Fungus
Hide(options);
}
/// <summary>
/// From lua, you can pass an options table with named arguments
/// example:
/// stage.hide{character=jill, toPosition="left"}
/// Any option available in the PortraitOptions is available from Lua
/// </summary>
/// <param name="optionsTable">Moonsharp Table</param>
public virtual void Hide(Table optionsTable)
{
Hide(PortraitUtil.ConvertTableToPortraitOptions(optionsTable, stage));
}
/// <summary>
/// Hide portrait with provided options
/// </summary>
public virtual void Hide(PortraitOptions options)
{
CleanPortraitOptions(options);
@ -487,6 +591,9 @@ namespace Fungus
FinishCommand(options);
}
/// <summary>
/// Sets the dimmed state of a character on the stage.
/// </summary>
public virtual void SetDimmed(Character character, bool dimmedState)
{
if (character.State.dimmed == dimmedState)

135
Assets/Fungus/Scripts/Components/SayDialog.cs

@ -9,9 +9,9 @@ using System.Collections;
namespace Fungus
{
/// <summary>
/// Presents story text to the player in a dialogue box.
/// Display story text in a visual novel style dialog box.
/// </summary>
public class SayDialog : MonoBehaviour, ISayDialog
public class SayDialog : MonoBehaviour
{
[Tooltip("Duration to fade dialogue in/out")]
[SerializeField] protected float fadeDuration = 0.25f;
@ -40,7 +40,7 @@ namespace Fungus
protected float startStoryTextInset;
protected WriterAudio writerAudio;
protected IWriter writer;
protected Writer writer;
protected CanvasGroup canvasGroup;
protected bool fadeWhenDone = true;
@ -49,48 +49,17 @@ namespace Fungus
protected Sprite currentCharacterImage;
// Currently active Say Dialog used to display Say text
public static ISayDialog activeSayDialog;
// Most recent speaking character
public static ICharacter speakingCharacter;
public static ISayDialog GetSayDialog()
{
if (activeSayDialog == null)
{
// Use first Say Dialog found in the scene (if any)
SayDialog sd = GameObject.FindObjectOfType<SayDialog>();
if (sd != null)
{
activeSayDialog = sd;
}
if (activeSayDialog == null)
{
// Auto spawn a say dialog object from the prefab
GameObject prefab = Resources.Load<GameObject>("Prefabs/SayDialog");
if (prefab != null)
{
GameObject go = Instantiate(prefab) as GameObject;
go.SetActive(false);
go.name = "SayDialog";
activeSayDialog = go.GetComponent<ISayDialog>();
}
}
}
protected static Character speakingCharacter;
return activeSayDialog;
}
protected IWriter GetWriter()
protected Writer GetWriter()
{
if (writer != null)
{
return writer;
}
writer = GetComponent<IWriter>();
writer = GetComponent<Writer>();
if (writer == null)
{
writer = gameObject.AddComponent<Writer>();
@ -213,6 +182,47 @@ namespace Fungus
}
}
#region Public methods
/// <summary>
/// Currently active Say Dialog used to display Say text
/// </summary>
public static SayDialog ActiveSayDialog { get; set; }
/// <summary>
/// Returns a SayDialog by searching for one in the scene or creating one if none exists.
/// </summary>
public static SayDialog GetSayDialog()
{
if (ActiveSayDialog == null)
{
// Use first Say Dialog found in the scene (if any)
SayDialog sd = GameObject.FindObjectOfType<SayDialog>();
if (sd != null)
{
ActiveSayDialog = sd;
}
if (ActiveSayDialog == null)
{
// Auto spawn a say dialog object from the prefab
GameObject prefab = Resources.Load<GameObject>("Prefabs/SayDialog");
if (prefab != null)
{
GameObject go = Instantiate(prefab) as GameObject;
go.SetActive(false);
go.name = "SayDialog";
ActiveSayDialog = go.GetComponent<SayDialog>();
}
}
}
return ActiveSayDialog;
}
/// <summary>
/// Stops all active portrait tweens.
/// </summary>
public static void StopPortraitTweens()
{
// Stop all tweening portraits
@ -238,14 +248,20 @@ namespace Fungus
}
}
#region ISayDialog implementation
/// <summary>
/// Sets the active state of the Say Dialog gameobject.
/// </summary>
public virtual void SetActive(bool state)
{
gameObject.SetActive(state);
}
public virtual void SetCharacter(ICharacter character, IFlowchart flowchart = null)
/// <summary>
/// Sets the active speaking character.
/// </summary>
/// <param name="character">The active speaking character.</param>
/// <param name="flowchart">An optional Flowchart to use for variable substitution in the character name string.</param>
public virtual void SetCharacter(Character character, Flowchart flowchart = null)
{
if (character == null)
{
@ -261,7 +277,7 @@ namespace Fungus
}
else
{
ICharacter prevSpeakingCharacter = speakingCharacter;
var prevSpeakingCharacter = speakingCharacter;
speakingCharacter = character;
// Dim portraits of non-speaking characters
@ -304,6 +320,9 @@ namespace Fungus
}
}
/// <summary>
/// Sets the character image to display on the Say Dialog.
/// </summary>
public virtual void SetCharacterImage(Sprite image)
{
if (characterImage == null)
@ -356,6 +375,9 @@ namespace Fungus
}
}
/// <summary>
/// Sets the character name to display on the Say Dialog.
/// </summary>
public virtual void SetCharacterName(string name, Color color)
{
if (nameText != null)
@ -365,14 +387,34 @@ namespace Fungus
}
}
/// <summary>
/// Write a line of story text to the Say Dialog. Starts coroutine automatically.
/// </summary>
/// <param name="text">The text to display.</param>
/// <param name="clearPrevious">Clear any previous text in the Say Dialog.</param>
/// <param name="waitForInput">Wait for player input before continuing once text is written.</param>
/// <param name="fadeWhenDone">Fade out the Say Dialog when writing and player input has finished.</param>
/// <param name="stopVoiceover">Stop any existing voiceover audio before writing starts.</param>
/// <param name="voiceOverClip">Voice over audio clip to play.</param>
/// <param name="onComplete">Callback to execute when writing and player input have finished.</param>
public virtual void Say(string text, bool clearPrevious, bool waitForInput, bool fadeWhenDone, bool stopVoiceover, AudioClip voiceOverClip, Action onComplete)
{
StartCoroutine(DoSay(text, clearPrevious, waitForInput, fadeWhenDone, stopVoiceover, voiceOverClip, onComplete));
}
/// <summary>
/// Write a line of story text to the Say Dialog. Must be started as a coroutine.
/// </summary>
/// <param name="text">The text to display.</param>
/// <param name="clearPrevious">Clear any previous text in the Say Dialog.</param>
/// <param name="waitForInput">Wait for player input before continuing once text is written.</param>
/// <param name="fadeWhenDone">Fade out the Say Dialog when writing and player input has finished.</param>
/// <param name="stopVoiceover">Stop any existing voiceover audio before writing starts.</param>
/// <param name="voiceOverClip">Voice over audio clip to play.</param>
/// <param name="onComplete">Callback to execute when writing and player input have finished.</param>
public virtual IEnumerator DoSay(string text, bool clearPrevious, bool waitForInput, bool fadeWhenDone, bool stopVoiceover, AudioClip voiceOverClip, Action onComplete)
{
IWriter writer = GetWriter();
var writer = GetWriter();
if (writer.IsWriting || writer.IsWaitingForInput)
{
@ -403,14 +445,23 @@ namespace Fungus
yield return StartCoroutine(writer.Write(text, clearPrevious, waitForInput, stopVoiceover, soundEffectClip, onComplete));
}
/// <summary>
/// Tell the Say Dialog to fade out once writing and player input have finished.
/// </summary>
public virtual bool FadeWhenDone { set { fadeWhenDone = value; } }
/// <summary>
/// Stop the Say Dialog while its writing text.
/// </summary>
public virtual void Stop()
{
fadeWhenDone = true;
GetWriter().Stop();
}
/// <summary>
/// Stops writing text and clears the Say Dialog.
/// </summary>
public virtual void Clear()
{
ClearStoryText();

40
Assets/Fungus/Scripts/Components/Stage.cs

@ -12,7 +12,7 @@ namespace Fungus
/// Define a set of screen positions where character sprites can be displayed.
/// </summary>
[ExecuteInEditMode]
public class Stage : PortraitController, IStage
public class Stage : PortraitController
{
[Tooltip("Canvas object containing the stage positions.")]
[SerializeField] protected Canvas portraitCanvas;
@ -65,6 +65,11 @@ namespace Fungus
}
}
#region Public methods
/// <summary>
/// Returns the currently active stage.
/// </summary>
public static Stage GetActiveStage()
{
if (Stage.activeStages == null ||
@ -76,26 +81,55 @@ namespace Fungus
return Stage.activeStages[0];
}
#region IStage implementation
/// <summary>
/// Canvas object containing the stage positions.
/// </summary>
public virtual Canvas PortraitCanvas { get { return portraitCanvas; } }
/// <summary>
/// Dim portraits when a character is not speaking.
/// </summary>
public virtual bool DimPortraits { get { return dimPortraits; } set { dimPortraits = value; } }
/// <summary>
/// Duration for fading character portraits in / out.
/// </summary>
public virtual float FadeDuration { get { return fadeDuration; } set { fadeDuration = value; } }
/// <summary>
/// Duration for moving characters to a new position.
/// </summary>
public virtual float MoveDuration { get { return moveDuration; } set { moveDuration = value; } }
/// <summary>
/// Ease type for the fade tween.
/// </summary>
public virtual LeanTweenType FadeEaseType { get { return fadeEaseType; } }
/// <summary>
/// Constant offset to apply to portrait position.
/// </summary>
public virtual Vector2 ShiftOffset { get { return shiftOffset; } }
/// <summary>
/// The position object where characters appear by default.
/// </summary>
public virtual Image DefaultPosition { get { return defaultPosition; } }
/// <summary>
/// List of stage position rect transforms in the stage.
/// </summary>
public virtual List<RectTransform> Positions { get { return positions; } }
/// <summary>
/// List of currently active characters on the stage.
/// </summary>
public virtual List<Character> CharactersOnStage { get { return charactersOnStage; } }
/// <summary>
/// Searches the stage's named positions
/// If none matches the string provided, give a warning and return a new RectTransform
/// </summary>
public RectTransform GetPosition(string positionString)
{
if (string.IsNullOrEmpty(positionString))

43
Assets/Fungus/Scripts/Components/Variable.cs

@ -6,6 +6,36 @@ using System;
namespace Fungus
{
/// <summary>
/// Standard comparison operators.
/// </summary>
public enum CompareOperator
{
/// <summary> == mathematical operator.</summary>
Equals,
/// <summary> != mathematical operator.</summary>
NotEquals,
/// <summary> < mathematical operator.</summary>
LessThan,
/// <summary> > mathematical operator.</summary>
GreaterThan,
/// <summary> <= mathematical operator.</summary>
LessThanOrEquals,
/// <summary> >= mathematical operator.</summary>
GreaterThanOrEquals
}
/// <summary>
/// Scope types for Variables.
/// </summary>
public enum VariableScope
{
/// <summary> Can only be accessed by commands in the same Flowchart. </summary>
Private,
/// <summary> Can be accessed from any command in any Flowchart. </summary>
Public
}
/// <summary>
/// Attribute class for variables.
/// </summary>
@ -48,18 +78,27 @@ namespace Fungus
/// Abstract base class for variables.
/// </summary>
[RequireComponent(typeof(Flowchart))]
public abstract class Variable : MonoBehaviour, IVariable
public abstract class Variable : MonoBehaviour
{
[SerializeField] protected VariableScope scope;
[SerializeField] protected string key = "";
#region IVariable implementation
#region Public methods
/// <summary>
/// Visibility scope for the variable.
/// </summary>
public virtual VariableScope Scope { get { return scope; } }
/// <summary>
/// String identifier for the variable.
/// </summary>
public virtual string Key { get { return key; } set { key = value; } }
/// <summary>
/// Callback to reset the variable if the Flowchart is reset.
/// </summary>
public abstract void OnReset();
#endregion

13
Assets/Fungus/Scripts/Components/View.cs

@ -10,7 +10,7 @@ namespace Fungus
/// The position and rotation are specified using the game object's transform, so this class only needs to specify the ortographic view size.
/// </summary>
[ExecuteInEditMode]
public class View : MonoBehaviour, IView
public class View : MonoBehaviour
{
[Tooltip("Orthographic size of the camera view in world units.")]
[SerializeField] protected float viewSize = 0.5f;
@ -27,12 +27,21 @@ namespace Fungus
transform.localScale = new Vector3(1,1,1);
}
#region IView implementation
#region Public methods
/// <summary>
/// Orthographic size of the camera view in world units.
/// </summary>
public virtual float ViewSize { get { return viewSize; } set { viewSize = value; } }
/// <summary>
/// Aspect ratio of the primary view rectangle. e.g. a 4:3 aspect ratio = 1.333.
/// </summary>
public virtual Vector2 PrimaryAspectRatio { get { return primaryAspectRatio; } set { primaryAspectRatio = value; } }
/// <summary>
/// Aspect ratio of the secondary view rectangle. e.g. a 2:1 aspect ratio = 2/1 = 2.0.
/// </summary>
public virtual Vector2 SecondaryAspectRatio { get { return secondaryAspectRatio; } set { secondaryAspectRatio = value; } }
#endregion

212
Assets/Fungus/Scripts/Components/Writer.cs

@ -15,7 +15,7 @@ namespace Fungus
/// <summary>
/// Writes text using a typewriter effect to a UI text object.
/// </summary>
public class Writer : MonoBehaviour, IWriter, IDialogInputListener
public class Writer : MonoBehaviour, IDialogInputListener
{
[Tooltip("Gameobject containing a Text, Inout Field or Text Mesh object to write to")]
[SerializeField] protected GameObject targetTextObject;
@ -75,51 +75,6 @@ namespace Fungus
protected string hiddenColorOpen = "";
protected string hiddenColorClose = "";
public virtual string text
{
get
{
if (textUI != null)
{
return textUI.text;
}
else if (inputField != null)
{
return inputField.text;
}
else if (textMesh != null)
{
return textMesh.text;
}
else if (textProperty != null)
{
return textProperty.GetValue(textComponent, null) as string;
}
return "";
}
set
{
if (textUI != null)
{
textUI.text = value;
}
else if (inputField != null)
{
inputField.text = value;
}
else if (textMesh != null)
{
textMesh.text = value;
}
else if (textProperty != null)
{
textProperty.SetValue(textComponent, value, null);
}
}
}
protected virtual void Awake()
{
GameObject go = targetTextObject;
@ -180,28 +135,6 @@ namespace Fungus
}
}
public virtual bool HasTextObject()
{
return (textUI != null || inputField != null || textMesh != null || textComponent != null);
}
public virtual bool SupportsRichText()
{
if (textUI != null)
{
return textUI.supportRichText;
}
if (inputField != null)
{
return false;
}
if (textMesh != null)
{
return textMesh.richText;
}
return false;
}
protected virtual void UpdateOpenMarkup()
{
openString.Length = 0;
@ -256,7 +189,7 @@ namespace Fungus
}
}
virtual protected bool CheckParamCount(List<string> paramList, int count)
protected virtual bool CheckParamCount(List<string> paramList, int count)
{
if (paramList == null)
{
@ -368,7 +301,7 @@ namespace Fungus
break;
case TokenType.Clear:
text = "";
Text = "";
break;
case TokenType.SpeedStart:
@ -522,7 +455,7 @@ namespace Fungus
param = param.TrimStart(' ', '\t', '\r', '\n');
}
string startText = text;
string startText = Text;
UpdateOpenMarkup();
UpdateCloseMarkup();
@ -538,7 +471,7 @@ namespace Fungus
PartitionString(writeWholeWords, param, i);
ConcatenateString(startText);
text = outputString.ToString();
Text = outputString.ToString();
NotifyGlyph();
@ -571,7 +504,7 @@ namespace Fungus
}
}
protected void PartitionString(bool wholeWords, string inputString, int i)
protected virtual void PartitionString(bool wholeWords, string inputString, int i)
{
leftString.Length = 0;
rightString.Length = 0;
@ -605,7 +538,7 @@ namespace Fungus
}
}
protected void ConcatenateString(string startText)
protected virtual void ConcatenateString(string startText)
{
outputString.Length = 0;
@ -625,11 +558,6 @@ namespace Fungus
}
}
public virtual string GetTagHelp()
{
return "";
}
protected virtual IEnumerator DoWait(List<string> paramList)
{
var param = "";
@ -716,7 +644,7 @@ namespace Fungus
protected virtual void Flash(float duration)
{
ICameraController cameraController = CameraController.GetInstance();
var cameraController = CameraController.GetInstance();
cameraController.ScreenFadeTexture = CameraController.CreateColorTexture(new Color(1f,1f,1f,1f), 32, 32);
cameraController.Fade(1f, duration, delegate {
cameraController.ScreenFadeTexture = CameraController.CreateColorTexture(new Color(1f,1f,1f,1f), 32, 32);
@ -743,7 +671,6 @@ namespace Fungus
}
}
protected virtual void NotifyStart(AudioClip audioClip)
{
foreach (IWriterListener writerListener in writerListeners)
@ -784,26 +711,69 @@ namespace Fungus
}
}
#region IDialogInputListener implementation
#region Public methods
public virtual void OnNextLineEvent()
/// <summary>
/// Gets or sets the text property of the attached text object.
/// </summary>
public virtual string Text
{
inputFlag = true;
get
{
if (textUI != null)
{
return textUI.text;
}
else if (inputField != null)
{
return inputField.text;
}
else if (textMesh != null)
{
return textMesh.text;
}
else if (textProperty != null)
{
return textProperty.GetValue(textComponent, null) as string;
}
if (isWriting)
return "";
}
set
{
NotifyInput();
if (textUI != null)
{
textUI.text = value;
}
else if (inputField != null)
{
inputField.text = value;
}
else if (textMesh != null)
{
textMesh.text = value;
}
else if (textProperty != null)
{
textProperty.SetValue(textComponent, value, null);
}
}
}
#endregion
#region IWriter implementation
/// <summary>
/// This property is true when the writer is writing text or waiting (i.e. still processing tokens).
/// </summary>
public virtual bool IsWriting { get { return isWriting; } }
/// <summary>
/// This property is true when the writer is waiting for user input to continue.
/// </summary>
public virtual bool IsWaitingForInput { get { return isWaitingForInput; } }
/// <summary>
/// Stop writing text.
/// </summary>
public virtual void Stop()
{
if (isWriting || isWaitingForInput)
@ -812,11 +782,20 @@ namespace Fungus
}
}
/// <summary>
/// Writes text using a typewriter effect to a UI text object.
/// </summary>
/// <param name="content">Text to be written</param>
/// <param name="clear">If true clears the previous text.</param>
/// <param name="waitForInput">Writes the text and then waits for player input before calling onComplete.</param>
/// <param name="stopAudio">Stops any currently playing audioclip.</param>
/// <param name="audioClip">Audio clip to play when text starts writing.</param>
/// <param name="onComplete">Callback to call when writing is finished.</param>
public virtual IEnumerator Write(string content, bool clear, bool waitForInput, bool stopAudio, AudioClip audioClip, Action onComplete)
{
if (clear)
{
this.text = "";
this.Text = "";
}
if (!HasTextObject())
@ -833,14 +812,16 @@ namespace Fungus
tokenText += "{wi}";
}
ITextTagParser tagParser = new TextTagParser();
List<TextTagToken> tokens = tagParser.Tokenize(tokenText);
List<TextTagToken> tokens = TextTagParser.Tokenize(tokenText);
gameObject.SetActive(true);
yield return StartCoroutine(ProcessTokens(tokens, stopAudio, onComplete));
}
/// <summary>
/// Sets the color property of the text UI object.
/// </summary>
public virtual void SetTextColor(Color textColor)
{
if (textUI != null)
@ -860,6 +841,9 @@ namespace Fungus
}
}
/// <summary>
/// Sets the alpha component of the color property of the text UI object.
/// </summary>
public virtual void SetTextAlpha(float textAlpha)
{
if (textUI != null)
@ -885,6 +869,48 @@ namespace Fungus
}
}
/// <summary>
/// Returns true if there is a supported text object attached to this writer.
/// </summary>
public virtual bool HasTextObject()
{
return (textUI != null || inputField != null || textMesh != null || textComponent != null);
}
/// <summary>
/// Returns true if the text object has rich text support.
/// </summary>
public virtual bool SupportsRichText()
{
if (textUI != null)
{
return textUI.supportRichText;
}
if (inputField != null)
{
return false;
}
if (textMesh != null)
{
return textMesh.richText;
}
return false;
}
#endregion
#region IDialogInputListener implementation
public virtual void OnNextLineEvent()
{
inputFlag = true;
if (isWriting)
{
NotifyInput();
}
}
#endregion
}
}

2
Assets/Fungus/Scripts/Editor/FlowchartWindow.cs

@ -551,7 +551,7 @@ namespace Fungus.EditorUtils
return newBlock;
}
protected virtual void DeleteBlock(Flowchart flowchart, IBlock block)
protected virtual void DeleteBlock(Flowchart flowchart, Block block)
{
foreach (var command in block.CommandList)
{

119
Assets/Fungus/Scripts/Interfaces/IBlock.cs

@ -1,119 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// Execution state of a Block.
/// </summary>
public enum ExecutionState
{
/// <summary> No command executing </summary>
Idle,
/// <summary> Executing a command </summary>
Executing,
}
/// <summary>
/// A container for a sequence of Fungus comands.
/// </summary>
public interface IBlock
{
/// <summary>
/// The execution state of the Block.
/// </summary>
ExecutionState State { get; }
/// <summary>
/// Unique identifier for the Block.
/// </summary>
int ItemId { get; set; }
/// <summary>
/// The name of the block node as displayed in the Flowchart window.
/// </summary>
string BlockName { get; set; }
/// <summary>
/// Description text to display under the block node
/// </summary>
string Description { get; }
/// <summary>
/// An optional Event Handler which can execute the block when an event occurs.
/// Note: Using the concrete class instead of the interface here because of weird editor behaviour.
/// </summary>
EventHandler _EventHandler { get; set; }
/// <summary>
/// The currently executing command.
/// </summary>
Command ActiveCommand { get; }
/// <summary>
/// Timer for fading Block execution icon.
/// </summary>
float ExecutingIconTimer { get; set; }
/// <summary>
/// The list of commands in the sequence.
/// </summary>
List<Command> CommandList { get; }
/// <summary>
/// Controls the next command to execute in the block execution coroutine.
/// </summary>
int JumpToCommandIndex { set; }
/// <summary>
/// Returns the parent Flowchart for this Block.
/// </summary>
IFlowchart GetFlowchart();
/// <summary>
/// Returns true if the Block is executing a command.
/// </summary>
bool IsExecuting();
/// <summary>
/// Returns the number of times this Block has executed.
/// </summary>
int GetExecutionCount();
/// <summary>
/// Start a coroutine which executes all commands in the Block. Only one running instance of each Block is permitted.
/// </summary>
void StartExecution();
/// <summary>
/// A coroutine method that executes all commands in the Block. Only one running instance of each Block is permitted.
/// </summary>
/// <param name="commandIndex">Index of command to start execution at</param>
/// <param name="onComplete">Delegate function to call when execution completes</param>
IEnumerator Execute(int commandIndex = 0, System.Action onComplete = null);
/// <summary>
/// Stop executing commands in this Block.
/// </summary>
void Stop();
/// <summary>
/// Returns a list of all Blocks connected to this one.
/// </summary>
List<Block> GetConnectedBlocks();
/// <summary>
/// Returns the type of the previously executing command.
/// </summary>
/// <returns>The previous active command type.</returns>
System.Type GetPreviousActiveCommandType();
/// <summary>
/// Recalculate the indent levels for all commands in the list.
/// </summary>
void UpdateIndentLevels();
}
}

12
Assets/Fungus/Scripts/Interfaces/IBlock.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 3a23dd66c807e4fab86a64184c3faa9a
timeCreated: 1473856388
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

49
Assets/Fungus/Scripts/Interfaces/ICameraController.cs

@ -1,49 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEngine;
namespace Fungus
{
/// <summary>
/// Controller for main camera.Supports several types of camera transition including snap, pan & fade.
/// </summary>
public interface ICameraController
{
/// <summary>
/// Full screen texture used for screen fade effect.
/// </summary>
/// <value>The screen fade texture.</value>
Texture2D ScreenFadeTexture { set; }
/// <summary>
/// Perform a fullscreen fade over a duration.
/// </summary>
void Fade(float targetAlpha, float fadeDuration, System.Action fadeAction);
/// <summary>
/// Fade out, move camera to view and then fade back in.
/// </summary>
void FadeToView(Camera camera, View view, float fadeDuration, bool fadeOut, System.Action fadeAction);
/// <summary>
/// Stop all camera tweening.
/// </summary>
void Stop();
/// <summary>
/// Moves camera from current position to a target position over a period of time.
/// </summary>
void PanToPosition(Camera camera, Vector3 targetPosition, Quaternion targetRotation, float targetSize, float duration, System.Action arriveAction);
/// <summary>
/// Activates swipe panning mode. The player can pan the camera within the area between viewA & viewB.
/// </summary>
void StartSwipePan(Camera camera, View viewA, View viewB, float duration, float speedMultiplier, System.Action arriveAction);
/// <summary>
/// Deactivates swipe panning mode.
/// </summary>
void StopSwipePan();
}
}

12
Assets/Fungus/Scripts/Interfaces/ICameraController.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 182888cc7e1a0470c81e9ea6966d6fc6
timeCreated: 1473431064
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

74
Assets/Fungus/Scripts/Interfaces/ICharacter.cs

@ -1,74 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEngine;
using System.Collections.Generic;
using Fungus.Utils;
namespace Fungus
{
/// <summary>
/// A Character that can be used in dialogue via the Say, Conversation and Portrait commands.
/// </summary>
public interface ICharacter
{
/// <summary>
/// Character name as displayed in Say Dialog.
/// </summary>
string NameText { get; }
/// <summary>
/// Color to display the character name in Say Dialog.
/// </summary>
Color NameColor { get; }
/// <summary>
/// Sound effect to play when this character is speaking.
/// </summary>
/// <value>The sound effect.</value>
AudioClip SoundEffect { get; }
/// <summary>
/// List of portrait images that can be displayed for this character.
/// </summary>
List<Sprite> Portraits { get; }
/// <summary>
/// Direction that portrait sprites face.
/// </summary>
FacingDirection PortraitsFace { get; }
/// <summary>
/// Currently display profile sprite for this character.
/// </summary>
/// <value>The profile sprite.</value>
Sprite ProfileSprite { get; set; }
/// <summary>
/// Current display state of this character's portrait.
/// </summary>
/// <value>The state.</value>
PortraitState State { get; }
/// <summary>
/// Sets the active Say dialog with a reference to a Say Dialog object in the scene. This Say Dialog will be used whenever the character speaks.
/// </summary>
ISayDialog SetSayDialog { get; }
/// <summary>
/// Returns the name of the game object.
/// </summary>
string GetObjectName();
/// <summary>
/// Returns true if the character name starts with the specified string. Case insensitive.
/// </summary>
bool NameStartsWith(string matchString);
/// <summary>
/// Looks for a portrait by name on a character
/// If none is found, give a warning and return a blank sprite
/// </summary>
Sprite GetPortrait(string portraitString);
}
}

12
Assets/Fungus/Scripts/Interfaces/ICharacter.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 07a9457a850c147049f1fb7ea4b860cf
timeCreated: 1473676955
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

18
Assets/Fungus/Scripts/Interfaces/IClickable2D.cs

@ -1,18 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
namespace Fungus
{
/// <summary>
/// Detects mouse clicks and touches on a Game Object, and sends an event to all Flowchart event handlers in the scene.
/// The Game Object must have a Collider or Collider2D component attached.
/// Use in conjunction with the ObjectClicked Flowchart event handler.
/// </summary>
public interface IClickable2D
{
/// <summary>
/// Is object clicking enabled.
/// </summary>
bool ClickEnabled { set; }
}
}

12
Assets/Fungus/Scripts/Interfaces/IClickable2D.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 477f75d30919449dfa922f74038ceaa4
timeCreated: 1473690975
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

166
Assets/Fungus/Scripts/Interfaces/ICommand.cs

@ -1,166 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEngine;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// Commands can be added to Blocks to create an execution sequence.
/// </summary>
public interface ICommand
{
/// <summary>
/// Unique identifier for this command.
/// Unique for this Flowchart.
/// </summary>
int ItemId { get; set; }
/// <summary>
/// Error message to display in the command inspector.
/// </summary>
string ErrorMessage { get; }
/// <summary>
/// Indent depth of the current commands.
/// Commands are indented inside If, While, etc. sections.
/// </summary>
int IndentLevel { get; set; }
/// <summary>
/// Index of the command in the parent block's command list.
/// </summary>
int CommandIndex { get; set; }
/// <summary>
/// Set to true by the parent block while the command is executing.
/// </summary>
bool IsExecuting { get; set; }
/// <summary>
/// Timer used to control appearance of executing icon in inspector.
/// </summary>
float ExecutingIconTimer { get; set; }
/// <summary>
/// Reference to the Block object that this command belongs to.
/// This reference is only populated at runtime and in the editor when the
/// block is selected.
/// </summary>
Block ParentBlock { get; set; }
/// <summary>
/// Returns the Flowchart that this command belongs to.
/// </summary>
IFlowchart GetFlowchart();
/// <summary>
/// Execute the command.
/// </summary>
void Execute();
/// <summary>
/// End execution of this command and continue execution at the next command.
/// </summary>
void Continue();
/// <summary>
/// End execution of this command and continue execution at a specific command index.
/// </summary>
/// <param name="nextCommandIndex">Next command index.</param>
void Continue(int nextCommandIndex);
/// <summary>
/// Stops the parent Block executing.
/// </summary>
void StopParentBlock();
/// <summary>
/// Called when the parent block has been requested to stop executing, and
/// this command is the currently executing command.
/// Use this callback to terminate any asynchronous operations and
/// cleanup state so that the command is ready to execute again later on.
/// </summary>
void OnStopExecuting();
/// <summary>
/// Called when the new command is added to a block in the editor.
/// </summary>
void OnCommandAdded(Block parentBlock);
/// <summary>
/// Called when the command is deleted from a block in the editor.
/// </summary>
void OnCommandRemoved(Block parentBlock);
/// <summary>
/// Called when this command starts execution.
/// </summary>
void OnEnter();
/// <summary>
/// Called when this command ends execution.
/// </summary>
void OnExit();
/// <summary>
/// Called when this command is reset. This happens when the Reset command is used.
/// </summary>
void OnReset();
/// <summary>
/// Populates a list with the Blocks that this command references.
/// </summary>
void GetConnectedBlocks(ref List<Block> connectedBlocks);
/// <summary>
/// Returns true if this command references the variable.
/// Used to highlight variables in the variable list when a command is selected.
/// </summary>
bool HasReference(Variable variable);
/// <summary>
/// Returns the summary text to display in the command inspector.
/// </summary>
string GetSummary();
/// <summary>
/// Returns the help text to display for this command.
/// </summary>
string GetHelpText();
/// <summary>
/// Return true if this command opens a block of commands. Used for indenting commands.
/// </summary>
bool OpenBlock();
/// <summary>
/// Return true if this command closes a block of commands. Used for indenting commands.
/// </summary>
bool CloseBlock();
/// <summary>
/// Return the color for the command background in inspector.
/// </summary>
/// <returns>The button color.</returns>
Color GetButtonColor();
/// <summary>
/// Returns true if the specified property should be displayed in the inspector.
/// This is useful for hiding certain properties based on the value of another property.
/// </summary>
bool IsPropertyVisible(string propertyName);
/// <summary>
/// Returns true if the specified property should be displayed as a reorderable list in the inspector.
/// This only applies for array properties and has no effect for non-array properties.
/// </summary>
bool IsReorderableArray(string propertyName);
/// <summary>
/// Returns the localization id for the Flowchart that contains this command.
/// </summary>
string GetFlowchartLocalizationId();
}
}

12
Assets/Fungus/Scripts/Interfaces/ICommand.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 189c3f33fdd4b47608ac0aa3a2b971bb
timeCreated: 1473856401
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

23
Assets/Fungus/Scripts/Interfaces/IConversationManager.cs

@ -1,23 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using System.Collections;
namespace Fungus
{
/// <summary>
/// Helper class to manage parsing and executing the conversation format.
/// </summary>
public interface IConversationManager
{
/// <summary>
/// Caches the character objects in the scene for fast lookup during conversations.
/// </summary>
void PopulateCharacterCache();
/// <summary>
/// Parse and execute a conversation string.
/// </summary>
IEnumerator DoConversation(string conv);
}
}

12
Assets/Fungus/Scripts/Interfaces/IConversationManager.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 3a7ff247990a84e1a96765d1c03735b6
timeCreated: 1473679803
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

31
Assets/Fungus/Scripts/Interfaces/ICustomTag.cs

@ -1,31 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
namespace Fungus
{
/// <summary>
/// Create custom tags for use in Say text.
/// </summary>
public interface ICustomTag
{
/// <summary>
/// String that defines the start of the tag.
/// </summary>
string TagStartSymbol { get; }
/// <summary>
/// String that defines the end of the tag.
/// </summary>
string TagEndSymbol { get; }
/// <summary>
/// String to replace the start tag with.
/// </summary>
string ReplaceTagStartWith { get; }
/// <summary>
/// String to replace the end tag with.
/// </summary>
string ReplaceTagEndWith { get; }
}
}

12
Assets/Fungus/Scripts/Interfaces/ICustomTag.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 59af36c15380c4854860339298d3779e
timeCreated: 1473680400
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

34
Assets/Fungus/Scripts/Interfaces/IDialogInput.cs

@ -1,34 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
namespace Fungus
{
/// <summary>
/// Input handler for say dialogues.
/// </summary>
public interface IDialogInput
{
/// <summary>
/// Trigger next line input event from script.
/// </summary>
void SetNextLineFlag();
/// <summary>
/// Set the dialog clicked flag (usually from an Event Trigger component in the dialog UI).
/// </summary>
void SetDialogClickedFlag();
/// <summary>
/// Sets the button clicked flag.
/// </summary>
void SetButtonClickedFlag();
}
/// <summary>
/// Interface for listening for dialogue input events.
/// </summary>
public interface IDialogInputListener
{
void OnNextLineEvent();
}
}

10
Assets/Fungus/Scripts/Interfaces/ITextTagParser.cs → Assets/Fungus/Scripts/Interfaces/IDialogInputListener.cs

@ -1,13 +1,13 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using System.Collections.Generic;
using Fungus.Utils;
namespace Fungus
{
public interface ITextTagParser
/// <summary>
/// Interface for listening for dialogue input events.
/// </summary>
public interface IDialogInputListener
{
List<TextTagToken> Tokenize(string storyText);
void OnNextLineEvent();
}
}

0
Assets/Fungus/Scripts/Interfaces/IDialogInput.cs.meta → Assets/Fungus/Scripts/Interfaces/IDialogInputListener.cs.meta

21
Assets/Fungus/Scripts/Interfaces/IDraggable2D.cs

@ -1,21 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
namespace Fungus
{
/// <summary>
/// Detects drag and drop interactions on a Game Object, and sends events to all Flowchart event handlers in the scene.
/// The Game Object must have Collider2D & RigidBody components attached.
/// The Collider2D must have the Is Trigger property set to true.
/// The RigidBody would typically have the Is Kinematic property set to true, unless you want the object to move around using physics.
/// Use in conjunction with the Drag Started, Drag Completed, Drag Cancelled, Drag Entered & Drag Exited event handlers.
/// </summary>
public interface IDraggable2D
{
/// <summary>
/// Is object drag and drop enabled.
/// </summary>
/// <value><c>true</c> if drag enabled; otherwise, <c>false</c>.</value>
bool DragEnabled { get; set; }
}
}

12
Assets/Fungus/Scripts/Interfaces/IDraggable2D.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: be9f3ca656cc14276b86e6f41cb87d9d
timeCreated: 1473691259
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

31
Assets/Fungus/Scripts/Interfaces/IEventHandler.cs

@ -1,31 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
namespace Fungus
{
/// <summary>
/// A Block may have an associated Event Handler which starts executing commands when
/// a specific event occurs.
/// To create a custom Event Handler, simply subclass EventHandler and call the ExecuteBlock() method
/// when the event occurs.
/// Add an EventHandlerInfo attibute and your new EventHandler class will automatically appear in the
/// 'Execute On Event' dropdown menu when a block is selected.
/// </summary>
public interface IEventHandler
{
/// <summary>
/// The parent Block which owns this Event Handler.
/// </summary>
Block ParentBlock { get; set; }
/// <summary>
/// The Event Handler should call this method when the event is detected to start executing the Block.
/// </summary>
bool ExecuteBlock();
/// <summary>
/// Returns custom summary text for the event handler.
/// </summary>
string GetSummary();
}
}

12
Assets/Fungus/Scripts/Interfaces/IEventHandler.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 5ae3dddb3147c4a07a851843721affe8
timeCreated: 1473856414
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

296
Assets/Fungus/Scripts/Interfaces/IFlowchart.cs

@ -1,296 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEngine;
using System.Collections.Generic;
using Fungus.Commands;
namespace Fungus
{
/// <summary>
/// Visual scripting controller for the Flowchart programming language.
/// Flowchart objects may be edited visually using the Flowchart editor window.
/// </summary>
public interface IFlowchart
{
/// <summary>
/// Scroll position of Flowchart editor window.
/// </summary>
Vector2 ScrollPos { get; set; }
/// <summary>
/// Scroll position of Flowchart variables window.
/// </summary>
Vector2 VariablesScrollPos { get; set; }
/// <summary>
/// Show the variables pane.
/// </summary>
bool VariablesExpanded { get; set; }
/// <summary>
/// Height of command block view in inspector.
/// </summary>
float BlockViewHeight { get; set; }
/// <summary>
/// Zoom level of Flowchart editor window.
/// </summary>
float Zoom { get; set; }
/// <summary>
/// Scrollable area for Flowchart editor window.
/// </summary>
Rect ScrollViewRect { get; set; }
/// <summary>
/// Currently selected block in the Flowchart editor.
/// </summary>
Block SelectedBlock { get; set; }
/// <summary>
/// Currently selected command in the Flowchart editor.
/// </summary>
List<Command> SelectedCommands { get; }
/// <summary>
/// The list of variables that can be accessed by the Flowchart.
/// </summary>
List<Variable> Variables { get; }
/// <summary>
/// Description text displayed in the Flowchart editor window
/// </summary>
string Description { get; }
/// <summary>
/// Slow down execution in the editor to make it easier to visualise program flow.
/// </summary>
float StepPause { get; }
/// <summary>
/// Use command color when displaying the command list in the inspector.
/// </summary>
bool ColorCommands { get; }
/// <summary>
/// Saves the selected block and commands when saving the scene. Helps avoid version control conflicts if you've only changed the active selection.
/// </summary>
bool SaveSelection { get; }
/// <summary>
/// Unique identifier for identifying this flowchart in localized string keys.
/// </summary>
string LocalizationId { get; }
/// <summary>
/// Display line numbers in the command list in the Block inspector.
/// </summary>
bool ShowLineNumbers { get; }
/// <summary>
/// Lua Environment to be used by default for all Execute Lua commands in this Flowchart.
/// </summary>
ILuaEnvironment LuaEnv { get; }
/// <summary>
/// The ExecuteLua command adds a global Lua variable with this name bound to the flowchart prior to executing.
/// </summary>
string LuaBindingName { get; }
/// <summary>
/// Position in the center of all blocks in the flowchart.
/// </summary>
Vector2 CenterPosition { set; get; }
/// <summary>
/// Variable to track flowchart's version so components can update to new versions.
/// </summary>
int Version { set; }
/// <summary>
/// Returns the next id to assign to a new flowchart item.
/// Item ids increase monotically so they are guaranteed to
/// be unique within a Flowchart.
/// </summary>
int NextItemId();
/// <summary>
/// Returns true if the Flowchart gameobject is active.
/// </summary>
bool IsActive();
/// <summary>
/// Returns the Flowchart gameobject name.
/// </summary>
string GetName();
/// <summary>
/// Create a new block node which you can then add commands to.
/// </summary>
Block CreateBlock(Vector2 position);
/// <summary>
/// Returns the named Block in the flowchart, or null if not found.
/// </summary>
IBlock FindBlock(string blockName);
/// <summary>
/// Execute a child block in the Flowchart.
/// You can use this method in a UI event. e.g. to handle a button click.
void ExecuteBlock(string blockName);
/// <summary>
/// Execute a child block in the flowchart.
/// The block must be in an idle state to be executed.
/// This version provides extra options to control how the block is executed.
/// Returns true if the Block started execution.
/// </summary>
bool ExecuteBlock(IBlock block, int commandIndex = 0, System.Action onComplete = null);
/// <summary>
/// Stop all executing Blocks in this Flowchart.
/// </summary>
void StopAllBlocks();
/// <summary>
/// Sends a message to this Flowchart only.
/// Any block with a matching MessageReceived event handler will start executing.
/// </summary>
void SendFungusMessage(string messageName);
/// <summary>
/// Returns a new variable key that is guaranteed not to clash with any existing variable in the list.
/// </summary>
string GetUniqueVariableKey(string originalKey, Variable ignoreVariable = null);
/// <summary>
/// Returns a new Block key that is guaranteed not to clash with any existing Block in the Flowchart.
/// </summary>
string GetUniqueBlockKey(string originalKey, IBlock ignoreBlock = null);
/// <summary>
/// Returns a new Label key that is guaranteed not to clash with any existing Label in the Block.
/// </summary>
string GetUniqueLabelKey(string originalKey, Label ignoreLabel);
/// <summary>
/// Returns the variable with the specified key, or null if the key is not found.
/// You will need to cast the returned variable to the correct sub-type.
/// You can then access the variable's value using the Value property. e.g.
/// BooleanVariable boolVar = flowchart.GetVariable("MyBool") as BooleanVariable;
/// boolVar.Value = false;
/// </summary>
Variable GetVariable(string key);
/// <summary>
/// Returns the variable with the specified key, or null if the key is not found.
/// You can then access the variable's value using the Value property. e.g.
/// BooleanVariable boolVar = flowchart.GetVariable<BooleanVariable>("MyBool");
/// boolVar.Value = false;
/// </summary>
T GetVariable<T>(string key) where T : Variable;
/// <summary>
/// Register a new variable with the Flowchart at runtime.
/// The variable should be added as a component on the Flowchart game object.
/// </summary>
void SetVariable<T>(string key, T newvariable) where T : Variable;
/// <summary>
/// Gets a list of all variables with public scope in this Flowchart.
/// </summary>
List<Variable> GetPublicVariables();
/// <summary>
/// Gets the value of a boolean variable.
/// Returns false if the variable key does not exist.
/// </summary>
bool GetBooleanVariable(string key);
/// <summary>
/// Sets the value of a boolean variable.
/// The variable must already be added to the list of variables for this Flowchart.
/// </summary>
void SetBooleanVariable(string key, bool value);
/// <summary>
/// Gets the value of an integer variable.
/// Returns 0 if the variable key does not exist.
/// </summary>
int GetIntegerVariable(string key);
/// <summary>
/// Sets the value of an integer variable.
/// The variable must already be added to the list of variables for this Flowchart.
/// </summary>
void SetIntegerVariable(string key, int value);
/// <summary>
/// Gets the value of a float variable.
/// Returns 0 if the variable key does not exist.
/// </summary>
float GetFloatVariable(string key);
/// <summary>
/// Sets the value of a float variable.
/// The variable must already be added to the list of variables for this Flowchart.
/// </summary>
void SetFloatVariable(string key, float value);
/// <summary>
/// Gets the value of a string variable.
/// Returns the empty string if the variable key does not exist.
/// </summary>
string GetStringVariable(string key);
/// <summary>
/// Sets the value of a string variable.
/// The variable must already be added to the list of variables for this Flowchart.
/// </summary>
void SetStringVariable(string key, string value);
/// <summary>
/// Set the block objects to be hidden or visible depending on the hideComponents property.
/// </summary>
void UpdateHideFlags();
/// <summary>
/// Clears the list of selected commands.
/// </summary>
void ClearSelectedCommands();
/// <summary>
/// Adds a command to the list of selected commands.
/// </summary>
void AddSelectedCommand(Command command);
/// <summary>
/// Reset the commands and variables in the Flowchart.
/// </summary>
void Reset(bool resetCommands, bool resetVariables);
/// <summary>
/// Override this in a Flowchart subclass to filter which commands are shown in the Add Command list.
/// </summary>
bool IsCommandSupported(CommandInfoAttribute commandInfo);
/// <summary>
/// Returns true if there are any executing blocks in this Flowchart.
/// </summary>
bool HasExecutingBlocks();
/// <summary>
/// Returns a list of all executing blocks in this Flowchart.
/// </summary>
List<IBlock> GetExecutingBlocks();
/// <summary>
/// Substitute variables in the input text with the format {$VarName}
/// This will first match with private variables in this Flowchart, and then
/// with public variables in all Flowcharts in the scene (and any component
/// in the scene that implements StringSubstituter.ISubstitutionHandler).
/// </summary>
string SubstituteVariables(string input);
}
}

12
Assets/Fungus/Scripts/Interfaces/IFlowchart.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: e0dd617b954d242bdb37e9c5de4f63cc
timeCreated: 1473856422
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

17
Assets/Fungus/Scripts/Interfaces/IFungusState.cs

@ -1,17 +0,0 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Used by the Flowchart window to serialize the currently active Flowchart object
/// so that the same Flowchart can be displayed while editing & playing.
/// </summary>
public interface IFungusState
{
/// <summary>
/// The currently selected Flowchart.
/// </summary>
Flowchart SelectedFlowchart { get; set; }
}
}

12
Assets/Fungus/Scripts/Interfaces/IFungusState.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 36cb688eedcc4436780e68405a4ba494
timeCreated: 1474015940
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

35
Assets/Fungus/Scripts/Interfaces/ILocalizable.cs

@ -0,0 +1,35 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEngine;
namespace Fungus
{
/// <summary>
/// An item of localizeable text.
/// </summary>
public interface ILocalizable
{
/// <summary>
/// Gets the standard (non-localized) text.
/// </summary>
string GetStandardText();
/// <summary>
/// Sets the standard (non-localized) text.
/// </summary>
/// <param name="standardText">Standard text.</param>
void SetStandardText(string standardText);
/// <summary>
/// Gets the description used to help localizers.
/// </summary>
/// <returns>The description.</returns>
string GetDescription();
/// <summary>
/// Gets the unique string identifier.
/// </summary>
string GetStringId();
}
}

0
Assets/Fungus/Scripts/Interfaces/ILocalization.cs.meta → Assets/Fungus/Scripts/Interfaces/ILocalizable.cs.meta

83
Assets/Fungus/Scripts/Interfaces/ILocalization.cs

@ -1,83 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEngine;
namespace Fungus
{
/// <summary>
/// Multi-language localization support.
/// </summary>
public interface ILocalization
{
/// <summary>
/// Language to use at startup, usually defined by a two letter language code (e.g DE = German).
/// </summary>
string ActiveLanguage { get; }
/// <summary>
/// CSV file containing localization data which can be easily edited in a spreadsheet tool.
/// </summary>
TextAsset LocalizationFile { get; }
/// <summary>
/// Stores any notification message from export / import methods.
/// </summary>
string NotificationText { get; set; }
/// <summary>
/// Convert all text items and localized strings to an easy to edit CSV format.
/// </summary>
string GetCSVData();
/// <summary>
/// Scan a localization CSV file and copies the strings for the specified language code
/// into the text properties of the appropriate scene objects.
/// </summary>
void SetActiveLanguage(string languageCode, bool forceUpdateSceneText = false);
/// <summary>
/// Populates the text property of a single scene object with a new text value.
/// </summary>
bool PopulateTextProperty(string stringId, string newText);
/// <summary>
/// Returns all standard text for localizeable text in the scene using an
/// easy to edit custom text format.
/// </summary>
string GetStandardText();
/// <summary>
/// Sets standard text on scene objects by parsing a text data file.
/// </summary>
void SetStandardText(string textData);
}
/// <summary>
/// An item of localizeable text.
/// </summary>
public interface ILocalizable
{
/// <summary>
/// Gets the standard (non-localized) text.
/// </summary>
string GetStandardText();
/// <summary>
/// Sets the standard (non-localized) text.
/// </summary>
/// <param name="standardText">Standard text.</param>
void SetStandardText(string standardText);
/// <summary>
/// Gets the description used to help localizers.
/// </summary>
/// <returns>The description.</returns>
string GetDescription();
/// <summary>
/// Gets the unique string identifier.
/// </summary>
string GetStringId();
}
}

81
Assets/Fungus/Scripts/Interfaces/IMenuDialog.cs

@ -1,81 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEngine.UI;
using MoonSharp.Interpreter;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Presents multiple choice buttons to the players.
/// </summary>
public interface IMenuDialog
{
/// <summary>
/// A cached list of button objects in the menu dialog.
/// </summary>
/// <value>The cached buttons.</value>
Button[] CachedButtons { get; }
/// <summary>
/// A cached slider object used for the timer in the menu dialog.
/// </summary>
/// <value>The cached slider.</value>
Slider CachedSlider { get; }
/// <summary>
/// Sets the active state of the Menu Dialog gameobject.
/// </summary>
void SetActive(bool state);
/// <summary>
/// Clear all displayed options in the Menu Dialog.
/// </summary>
void Clear();
/// <summary>
/// Hides any currently displayed Say Dialog.
/// </summary>
void HideSayDialog();
/// <summary>
/// Adds the option to the list of displayed options. Calls a Block when selected.
/// Will cause the Menu dialog to become visible if it is not already visible.
/// </summary>
/// <returns><c>true</c>, if the option was added successfully.</returns>
/// <param name="text">The option text to display on the button.</param>
/// <param name="interactable">If false, the option is displayed but is not selectable.</param>
/// <param name="targetBlock">Block to execute when the option is selected.</param>
bool AddOption(string text, bool interactable, Block targetBlock);
/// <summary>
/// Adds the option to the list of displayed options, calls a Lua function when selected.
/// Will cause the Menu dialog to become visible if it is not already visible.
/// </summary>
/// <returns><c>true</c>, if the option was added successfully.</returns>
bool AddOption(string text, bool interactable, ILuaEnvironment luaEnv, Closure callBack);
/// <summary>
/// Show a timer during which the player can select an option. Calls a Block when the timer expires.
/// </summary>
/// <param name="duration">The duration during which the player can select an option.</param>
/// <param name="targetBlock">Block to execute if the player does not select an option in time.</param>
void ShowTimer(float duration, Block targetBlock);
/// <summary>
/// Show a timer during which the player can select an option. Calls a Lua function when the timer expires.
/// </summary>
IEnumerator ShowTimer(float duration, ILuaEnvironment luaEnv, Closure callBack);
/// <summary>
/// Returns true if the Menu Dialog is currently displayed.
/// </summary>
bool IsActive();
/// <summary>
/// Returns the number of currently displayed options.
/// </summary>
int DisplayedOptionsCount { get; }
}
}

12
Assets/Fungus/Scripts/Interfaces/IMenuDialog.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 88b3741e7161f40d3b6166170b69c55e
timeCreated: 1473425656
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

48
Assets/Fungus/Scripts/Interfaces/IMusicController.cs

@ -1,48 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEngine;
namespace Fungus
{
/// <summary>
/// Music manager which provides basic music and sound effect functionality.
/// Music playback persists across scene loads.
/// </summary>
public interface IMusicController
{
/// <summary>
/// Plays game music using an audio clip.
/// One music clip may be played at a time.
/// </summary>
void PlayMusic(AudioClip musicClip, bool loop, float fadeDuration, float atTime);
/// <summary>
/// Plays a sound effect once, at the specified volume.
/// </summary>
/// <param name="soundClip">The sound effect clip to play.</param>
/// <param name="volume">The volume level of the sound effect.</param>
void PlaySound(AudioClip soundClip, float volume);
/// <summary>
/// Shifts the game music pitch to required value over a period of time.
/// </summary>
/// <param name="pitch">The new music pitch value.</param>
/// <param name="duration">The length of time in seconds needed to complete the pitch change.</param>
/// <param name="onComplete">A delegate method to call when the pitch shift has completed.</param>
void SetAudioPitch(float pitch, float duration, System.Action onComplete);
/// <summary>
/// Fades the game music volume to required level over a period of time.
/// </summary>
/// <param name="volume">The new music volume value [0..1]</param>
/// <param name="duration">The length of time in seconds needed to complete the volume change.</param>
/// <param name="onComplete">Delegate function to call when fade completes.</param>
void SetAudioVolume(float volume, float duration, System.Action onComplete);
/// <summary>
/// Stops playing game music.
/// </summary>
void StopMusic();
}
}

12
Assets/Fungus/Scripts/Interfaces/IMusicController.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: efedec0242be143678aaa7075aa5467e
timeCreated: 1473429999
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

139
Assets/Fungus/Scripts/Interfaces/IPortraitController.cs

@ -1,139 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using MoonSharp.Interpreter;
using Fungus.Utils;
namespace Fungus
{
/// <summary>
/// Types of display operations supported by portraits.
/// </summary>
public enum DisplayType
{
/// <summary> Do nothing. </summary>
None,
/// <summary> Show the portrait. </summary>
Show,
/// <summary> Hide the portrait. </summary>
Hide,
/// <summary> Replace the existing portrait. </summary>
Replace,
/// <summary> Move portrait to the front. </summary>
MoveToFront
}
/// <summary>
/// Directions that character portraits can face.
/// </summary>
public enum FacingDirection
{
/// <summary> Unknown direction </summary>
None,
/// <summary> Facing left. </summary>
Left,
/// <summary> Facing right. </summary>
Right
}
/// <summary>
/// Offset direction for position.
/// </summary>
public enum PositionOffset
{
/// <summary> Unknown offset direction. </summary>
None,
/// <summary> Offset applies to the left. </summary>
OffsetLeft,
/// <summary> Offset applies to the right. </summary>
OffsetRight
}
/// <summary>
/// Controls the Portrait sprites on stage
/// </summary>
public interface IPortraitController
{
/// <summary>
/// Using all portrait options available, run any portrait command.
/// </summary>
/// <param name="options">Portrait Options</param>
/// <param name="onComplete">The function that will run once the portrait command finishes</param>
void RunPortraitCommand(PortraitOptions options, System.Action onComplete);
/// <summary>
/// Moves Character in front of other characters on stage
/// </summary>
void MoveToFront(Character character);
/// <summary>
/// Moves Character in front of other characters on stage
/// </summary>
void MoveToFront(PortraitOptions options);
/// <summary>
/// Shows character at a named position in the stage
/// </summary>
/// <param name="character"></param>
/// <param name="position">Named position on stage</param>
void Show(Character character, string position);
/// <summary>
/// Shows character moving from a position to a position
/// </summary>
/// <param name="character"></param>
/// <param name="portrait"></param>
/// <param name="fromPosition">Where the character will appear</param>
/// <param name="toPosition">Where the character will move to</param>
void Show(Character character, string portrait, string fromPosition, string toPosition);
/// <summary>
/// From lua, you can pass an options table with named arguments
/// example:
/// stage.show{character=jill, portrait="happy", fromPosition="right", toPosition="left"}
/// Any option available in the PortraitOptions is available from Lua
/// </summary>
/// <param name="optionsTable">Moonsharp Table</param>
void Show(Table optionsTable);
/// <summary>
/// Show portrait with the supplied portrait options
/// </summary>
/// <param name="options"></param>
void Show(PortraitOptions options);
/// <summary>
/// Simple show command that shows the character with an available named portrait
/// </summary>
/// <param name="character">Character to show</param>
/// <param name="portrait">Named portrait to show for the character, i.e. "angry", "happy", etc</param>
void ShowPortrait(Character character, string portrait);
/// <summary>
/// Simple character hide command
/// </summary>
/// <param name="character">Character to hide</param>
void Hide(Character character);
/// <summary>
/// Move the character to a position then hide it
/// </summary>
/// <param name="character">Character to hide</param>
/// <param name="toPosition">Where the character will disapear to</param>
void Hide(Character character, string toPosition);
/// <summary>
/// From lua, you can pass an options table with named arguments
/// example:
/// stage.hide{character=jill, toPosition="left"}
/// Any option available in the PortraitOptions is available from Lua
/// </summary>
/// <param name="optionsTable">Moonsharp Table</param>
void Hide(Table optionsTable);
/// <summary>
/// Hide portrait with provided options
/// </summary>
void Hide(PortraitOptions options);
}
}

12
Assets/Fungus/Scripts/Interfaces/IPortraitController.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 51067f95c67324a0ba05a260dced682f
timeCreated: 1473685101
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

75
Assets/Fungus/Scripts/Interfaces/ISayDialog.cs

@ -1,75 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEngine;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Display story text in a visual novel style dialog box.
/// </summary>
public interface ISayDialog
{
/// <summary>
/// Sets the active state of the Say Dialog gameobject.
/// </summary>
void SetActive(bool state);
/// <summary>
/// Sets the active speaking character.
/// </summary>
/// <param name="character">The active speaking character.</param>
/// <param name="flowchart">An optional Flowchart to use for variable substitution in the character name string.</param>
void SetCharacter(ICharacter character, IFlowchart flowchart = null);
/// <summary>
/// Sets the character image to display on the Say Dialog.
/// </summary>
void SetCharacterImage(Sprite image);
/// <summary>
/// Sets the character name to display on the Say Dialog.
/// </summary>
void SetCharacterName(string name, Color color);
/// <summary>
/// Write a line of story text to the Say Dialog. Starts coroutine automatically.
/// </summary>
/// <param name="text">The text to display.</param>
/// <param name="clearPrevious">Clear any previous text in the Say Dialog.</param>
/// <param name="waitForInput">Wait for player input before continuing once text is written.</param>
/// <param name="fadeWhenDone">Fade out the Say Dialog when writing and player input has finished.</param>
/// <param name="stopVoiceover">Stop any existing voiceover audio before writing starts.</param>
/// <param name="voiceOverClip">Voice over audio clip to play.</param>
/// <param name="onComplete">Callback to execute when writing and player input have finished.</param>
void Say(string text, bool clearPrevious, bool waitForInput, bool fadeWhenDone, bool stopVoiceover, AudioClip voiceOverClip, System.Action onComplete);
/// <summary>
/// Write a line of story text to the Say Dialog. Must be started as a coroutine.
/// </summary>
/// <param name="text">The text to display.</param>
/// <param name="clearPrevious">Clear any previous text in the Say Dialog.</param>
/// <param name="waitForInput">Wait for player input before continuing once text is written.</param>
/// <param name="fadeWhenDone">Fade out the Say Dialog when writing and player input has finished.</param>
/// <param name="stopVoiceover">Stop any existing voiceover audio before writing starts.</param>
/// <param name="voiceOverClip">Voice over audio clip to play.</param>
/// <param name="onComplete">Callback to execute when writing and player input have finished.</param>
IEnumerator DoSay(string text, bool clearPrevious, bool waitForInput, bool fadeWhenDone, bool stopVoiceover, AudioClip voiceOverClip, System.Action onComplete);
/// <summary>
/// Tell the Say Dialog to fade out once writing and player input have finished.
/// </summary>
bool FadeWhenDone { set; }
/// <summary>
/// Stop the Say Dialog while its writing text.
/// </summary>
void Stop();
/// <summary>
/// Stops writing text and clears the Say Dialog.
/// </summary>
void Clear();
}
}

12
Assets/Fungus/Scripts/Interfaces/ISayDialog.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: a1a9184c86a4048d5973b766e9fd6803
timeCreated: 1473421269
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

66
Assets/Fungus/Scripts/Interfaces/IStage.cs

@ -1,66 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// Define a set of screen positions where character sprites can be displayed.
/// </summary>
public interface IStage
{
/// <summary>
/// Canvas object containing the stage positions.
/// </summary>
Canvas PortraitCanvas { get; }
/// <summary>
/// Dim portraits when a character is not speaking.
/// </summary>
bool DimPortraits { get; set; }
/// <summary>
/// Duration for fading character portraits in / out.
/// </summary>
float FadeDuration { get; set; }
/// <summary>
/// Duration for moving characters to a new position.
/// </summary>
float MoveDuration { get; set; }
/// <summary>
/// Ease type for the fade tween.
/// </summary>
LeanTweenType FadeEaseType { get; }
/// <summary>
/// Constant offset to apply to portrait position.
/// </summary>
Vector2 ShiftOffset { get; }
/// <summary>
/// The position object where characters appear by default.
/// </summary>
Image DefaultPosition { get; }
/// <summary>
/// List of stage position rect transforms in the stage.
/// </summary>
List<RectTransform> Positions { get; }
/// <summary>
/// List of currently active characters on the stage.
/// </summary>
List<Character> CharactersOnStage { get; }
/// <summary>
/// Searches the stage's named positions
/// If none matches the string provided, give a warning and return a new RectTransform
/// </summary>
RectTransform GetPosition(string positionString);
}
}

12
Assets/Fungus/Scripts/Interfaces/IStage.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: a88bde623f95a46e49febd46fe50b19c
timeCreated: 1473689190
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

12
Assets/Fungus/Scripts/Interfaces/ITextTagParser.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 1e3f4aab68276483e9d40b120cc1cafc
timeCreated: 1473756939
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

56
Assets/Fungus/Scripts/Interfaces/IVariable.cs

@ -1,56 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
namespace Fungus
{
/// <summary>
/// Standard comparison operators.
/// </summary>
public enum CompareOperator
{
/// <summary> == mathematical operator.</summary>
Equals,
/// <summary> != mathematical operator.</summary>
NotEquals,
/// <summary> < mathematical operator.</summary>
LessThan,
/// <summary> > mathematical operator.</summary>
GreaterThan,
/// <summary> <= mathematical operator.</summary>
LessThanOrEquals,
/// <summary> >= mathematical operator.</summary>
GreaterThanOrEquals
}
/// <summary>
/// Scope types for Variables.
/// </summary>
public enum VariableScope
{
/// <summary> Can only be accessed by commands in the same Flowchart. </summary>
Private,
/// <summary> Can be accessed from any command in any Flowchart. </summary>
Public
}
/// <summary>
/// A Fungus variable that can be used with Commands.
/// </summary>
public interface IVariable
{
/// <summary>
/// Visibility scope for the variable.
/// </summary>
VariableScope Scope { get; }
/// <summary>
/// String identifier for the variable.
/// </summary>
string Key { get; set; }
/// <summary>
/// Callback to reset the variable if the Flowchart is reset.
/// </summary>
void OnReset();
}
}

12
Assets/Fungus/Scripts/Interfaces/IVariable.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 75ff90e0b811142d39cc9031dbf4b992
timeCreated: 1473856441
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

29
Assets/Fungus/Scripts/Interfaces/IView.cs

@ -1,29 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEngine;
namespace Fungus
{
/// <summary>
/// Defines a camera view point.
/// The position and rotation are specified using the game object's transform, so this class only needs to specify the ortographic view size.
/// </summary>
public interface IView
{
/// <summary>
/// Orthographic size of the camera view in world units.
/// </summary>
float ViewSize { get; set; }
/// <summary>
/// Aspect ratio of the primary view rectangle. e.g. a 4:3 aspect ratio = 1.333.
/// </summary>
Vector2 PrimaryAspectRatio { get; set; }
/// <summary>
/// Aspect ratio of the secondary view rectangle. e.g. a 2:1 aspect ratio = 2/1 = 2.0.
/// </summary>
Vector2 SecondaryAspectRatio { get; set; }
}
}

12
Assets/Fungus/Scripts/Interfaces/IView.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: d50490011ddfc4e6ea394a4bfbf815e0
timeCreated: 1473676064
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

85
Assets/Fungus/Scripts/Interfaces/IWriter.cs

@ -1,85 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEngine;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Writes text using a typewriter effect to a UI text object.
/// </summary>
public interface IWriter
{
/// <summary>
/// This property is true when the writer is writing text or waiting (i.e. still processing tokens).
/// </summary>
bool IsWriting { get; }
/// <summary>
/// This property is true when the writer is waiting for user input to continue.
/// </summary>
bool IsWaitingForInput { get; }
/// <summary>
/// Stop writing text.
/// </summary>
void Stop();
/// <summary>
/// Writes text using a typewriter effect to a UI text object.
/// </summary>
/// <param name="content">Text to be written</param>
/// <param name="clear">If true clears the previous text.</param>
/// <param name="waitForInput">Writes the text and then waits for player input before calling onComplete.</param>
/// <param name="stopAudio">Stops any currently playing audioclip.</param>
/// <param name="audioClip">Audio clip to play when text starts writing.</param>
/// <param name="onComplete">Callback to call when writing is finished.</param>
IEnumerator Write(string content, bool clear, bool waitForInput, bool stopAudio, AudioClip audioClip, System.Action onComplete);
/// <summary>
/// Sets the color property of the text UI object.
/// </summary>
void SetTextColor(Color textColor);
/// <summary>
/// Sets the alpha component of the color property of the text UI object.
/// </summary>
void SetTextAlpha(float textAlpha);
}
/// <summary>
/// Implement this interface to be notified about Writer events.
/// </summary>
public interface IWriterListener
{
///
/// Called when a user input event (e.g. a click) has been handled by the Writer.
///
void OnInput();
/// <summary>
/// Called when the Writer starts writing new text.
/// </summary>
/// <param name="audioClip">An optional audioClip sound effect can be supplied (e.g. for voiceover)</param>
void OnStart(AudioClip audioClip);
/// Called when the Writer has paused writing text (e.g. on a {wi} tag).
void OnPause();
/// Called when the Writer has resumed writing text.
void OnResume();
/// Called when the Writer has finished writing text.
/// <param name="stopAudio">Controls whether audio should be stopped when writing ends.</param>
void OnEnd(bool stopAudio);
/// Called every time the Writer writes a new character glyph.
void OnGlyph();
/// <summary>
/// Called when voiceover should start.
/// </summary>
void OnVoiceover(AudioClip voiceOverClip);
}
}

43
Assets/Fungus/Scripts/Interfaces/IWriterListener.cs

@ -0,0 +1,43 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEngine;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Implement this interface to be notified about Writer events.
/// </summary>
public interface IWriterListener
{
///
/// Called when a user input event (e.g. a click) has been handled by the Writer.
///
void OnInput();
/// <summary>
/// Called when the Writer starts writing new text.
/// </summary>
/// <param name="audioClip">An optional audioClip sound effect can be supplied (e.g. for voiceover)</param>
void OnStart(AudioClip audioClip);
/// Called when the Writer has paused writing text (e.g. on a {wi} tag).
void OnPause();
/// Called when the Writer has resumed writing text.
void OnResume();
/// Called when the Writer has finished writing text.
/// <param name="stopAudio">Controls whether audio should be stopped when writing ends.</param>
void OnEnd(bool stopAudio);
/// Called every time the Writer writes a new character glyph.
void OnGlyph();
/// <summary>
/// Called when voiceover should start.
/// </summary>
void OnVoiceover(AudioClip voiceOverClip);
}
}

0
Assets/Fungus/Scripts/Interfaces/IWriter.cs.meta → Assets/Fungus/Scripts/Interfaces/IWriterListener.cs.meta

19
Assets/Fungus/Scripts/Utils/ConversationManager.cs

@ -9,7 +9,10 @@ using System.Text;
namespace Fungus.Utils
{
public class ConversationManager : IConversationManager
/// <summary>
/// Helper class to manage parsing and executing the conversation format.
/// </summary>
public class ConversationManager
{
protected struct ConversationItem
{
@ -73,9 +76,9 @@ namespace Fungus.Utils
return results.ToArray();
}
protected ISayDialog GetSayDialog(Character character)
protected SayDialog GetSayDialog(Character character)
{
ISayDialog sayDialog = null;
SayDialog sayDialog = null;
if (character != null)
{
if (character.SetSayDialog != null)
@ -261,14 +264,20 @@ namespace Fungus.Utils
return item;
}
#region IConversationManager
#region Public methods
/// <summary>
/// Caches the character objects in the scene for fast lookup during conversations.
/// </summary>
public void PopulateCharacterCache()
{
// cache characters for faster lookup
characters = UnityEngine.Object.FindObjectsOfType<Character>();
}
/// <summary>
/// Parse and execute a conversation string.
/// </summary>
public IEnumerator DoConversation(string conv)
{
if (string.IsNullOrEmpty(conv))
@ -302,7 +311,7 @@ namespace Fungus.Utils
currentPortrait = item.Portrait;
currentPosition = item.Position;
ISayDialog sayDialog = GetSayDialog(currentCharacter);
var sayDialog = GetSayDialog(currentCharacter);
if (sayDialog == null)
{

78
Assets/Fungus/Scripts/Utils/TextTagParser.cs

@ -10,39 +10,9 @@ namespace Fungus.Utils
/// <summary>
/// Parses a string for special Fungus text tags.
/// </summary>
public class TextTagParser : ITextTagParser
public static class TextTagParser
{
public static string GetTagHelp()
{
return "" +
"\t{b} Bold Text {/b}\n" +
"\t{i} Italic Text {/i}\n" +
"\t{color=red} Color Text (color){/color}\n" +
"\t{size=30} Text size {/size}\n" +
"\n" +
"\t{s}, {s=60} Writing speed (chars per sec){/s}\n" +
"\t{w}, {w=0.5} Wait (seconds)\n" +
"\t{wi} Wait for input\n" +
"\t{wc} Wait for input and clear\n" +
"\t{wp}, {wp=0.5} Wait on punctuation (seconds){/wp}\n" +
"\t{c} Clear\n" +
"\t{x} Exit, advance to the next command without waiting for input\n" +
"\n" +
"\t{vpunch=10,0.5} Vertically punch screen (intensity,time)\n" +
"\t{hpunch=10,0.5} Horizontally punch screen (intensity,time)\n" +
"\t{punch=10,0.5} Punch screen (intensity,time)\n" +
"\t{flash=0.5} Flash screen (duration)\n" +
"\n" +
"\t{audio=AudioObjectName} Play Audio Once\n" +
"\t{audioloop=AudioObjectName} Play Audio Loop\n" +
"\t{audiopause=AudioObjectName} Pause Audio\n" +
"\t{audiostop=AudioObjectName} Stop Audio\n" +
"\n" +
"\t{m=MessageName} Broadcast message\n" +
"\t{$VarName} Substitute variable";
}
protected virtual void AddWordsToken(List<TextTagToken> tokenList, string words)
private static void AddWordsToken(List<TextTagToken> tokenList, string words)
{
TextTagToken token = new TextTagToken();
token.type = TokenType.Words;
@ -51,7 +21,7 @@ namespace Fungus.Utils
tokenList.Add(token);
}
protected virtual void AddTagToken(List<TextTagToken> tokenList, string tagText)
private static void AddTagToken(List<TextTagToken> tokenList, string tagText)
{
if (tagText.Length < 3 ||
tagText.Substring(0,1) != "{" ||
@ -199,7 +169,7 @@ namespace Fungus.Utils
}
}
protected virtual List<string> ExtractParameters(string input)
private static List<string> ExtractParameters(string input)
{
List<string> paramsList = new List<string>();
int index = input.IndexOf('=');
@ -217,9 +187,45 @@ namespace Fungus.Utils
return paramsList;
}
#region ITextTagParser implementation
#region Public methods
/// <summary>
/// Returns a description of the supported tags.
/// </summary>
public static string GetTagHelp()
{
return "" +
"\t{b} Bold Text {/b}\n" +
"\t{i} Italic Text {/i}\n" +
"\t{color=red} Color Text (color){/color}\n" +
"\t{size=30} Text size {/size}\n" +
"\n" +
"\t{s}, {s=60} Writing speed (chars per sec){/s}\n" +
"\t{w}, {w=0.5} Wait (seconds)\n" +
"\t{wi} Wait for input\n" +
"\t{wc} Wait for input and clear\n" +
"\t{wp}, {wp=0.5} Wait on punctuation (seconds){/wp}\n" +
"\t{c} Clear\n" +
"\t{x} Exit, advance to the next command without waiting for input\n" +
"\n" +
"\t{vpunch=10,0.5} Vertically punch screen (intensity,time)\n" +
"\t{hpunch=10,0.5} Horizontally punch screen (intensity,time)\n" +
"\t{punch=10,0.5} Punch screen (intensity,time)\n" +
"\t{flash=0.5} Flash screen (duration)\n" +
"\n" +
"\t{audio=AudioObjectName} Play Audio Once\n" +
"\t{audioloop=AudioObjectName} Play Audio Loop\n" +
"\t{audiopause=AudioObjectName} Pause Audio\n" +
"\t{audiostop=AudioObjectName} Stop Audio\n" +
"\n" +
"\t{m=MessageName} Broadcast message\n" +
"\t{$VarName} Substitute variable";
}
public virtual List<TextTagToken> Tokenize(string storyText)
/// <summary>
/// Processes a block of story text and converts it to a list of tokens.
/// </summary>
public static List<TextTagToken> Tokenize(string storyText)
{
List<TextTagToken> tokens = new List<TextTagToken>();

35
Assets/Fungus/Thirdparty/FungusLua/Resources/Types/FungusTypes.txt vendored

@ -1,38 +1,37 @@
{
"registerTypes" : [
"Fungus.AnimatorVariable",
"Fungus.AudioSourceVariable",
"Fungus.Variables.AnimatorVariable",
"Fungus.Variables.AudioSourceVariable",
"Fungus.Block",
"Fungus.BooleanVariable",
"Fungus.Variables.BooleanVariable",
"Fungus.Character",
"Fungus.ColorVariable",
"Fungus.Variables.ColorVariable",
"Fungus.Command",
"Fungus.CommandInfoAttribute",
"Fungus.FacingDirection",
"Fungus.FloatVariable",
"Fungus.Variables.FloatVariable",
"Fungus.Flowchart",
"Fungus.FungusPrefs",
"Fungus.LuaEnvironment",
"Fungus.LuaUtils",
"Fungus.GameObjectVariable",
"Fungus.IntegerVariable",
"Fungus.Label",
"Fungus.MaterialVariable",
"Fungus.Variables.GameObjectVariable",
"Fungus.Variables.IntegerVariable",
"Fungus.Commands.Label",
"Fungus.Variables.MaterialVariable",
"Fungus.MenuDialog",
"Fungus.ObjectVariable",
"Fungus.Variables.ObjectVariable",
"Fungus.PODTypeFactory",
"Fungus.PortraitState",
"Fungus.Utils.PortraitState",
"Fungus.SayDialog",
"Fungus.SpriteVariable",
"Fungus.StringVariable",
"Fungus.Variables.SpriteVariable",
"Fungus.Variables.StringVariable",
"Fungus.Task",
"Fungus.TextureVariable",
"Fungus.TransformVariable",
"Fungus.Variables.TextureVariable",
"Fungus.Variables.TransformVariable",
"Fungus.Variable",
"Fungus.Vector2Variable",
"Fungus.Vector3Variable"
"Fungus.Variables.Vector2Variable",
"Fungus.Variables.Vector3Variable"
],
"extensionTypes" : [
"Fungus.LuaExtensions"
]
}

4
Assets/Fungus/Thirdparty/FungusLua/Scripts/Components/LuaUtils.cs vendored

@ -430,9 +430,9 @@ namespace Fungus
return conversationManager.DoConversation(conv);
}
public void SetSayDialog(ISayDialog sayDialog)
public void SetSayDialog(SayDialog sayDialog)
{
SayDialog.activeSayDialog = sayDialog;
SayDialog.ActiveSayDialog = sayDialog;
}
#endregion

2
Assets/Fungus/Thirdparty/FungusLua/Scripts/Interfaces/ILuaUtils.cs vendored

@ -85,6 +85,6 @@ namespace Fungus
/// Sync the active say dialog with what Lua thinks the SayDialog should be
/// </summary>
/// <param name="sayDialog"></param>
void SetSayDialog(ISayDialog sayDialog);
void SetSayDialog(SayDialog sayDialog);
}
}

6
Assets/Fungus/Thirdparty/FungusLua/Scripts/Utils/FungusPrefs.cs vendored

@ -9,8 +9,10 @@ namespace Fungus
/// Wrapper class for PlayerPrefs that adds the concept of multiple save slots.
/// Save slots allow you to store multiple player save profiles.
/// </summary>
public class FungusPrefs
public static class FungusPrefs
{
#region Public methods
/// <summary>
/// Deletes all saved values for all slots.
/// </summary>
@ -106,5 +108,7 @@ namespace Fungus
{
return slot.ToString() + ":" + key;
}
#endregion
}
}

242
Assets/FungusExamples/DragAndDrop/DragAndDrop(EventSystem).unity

@ -8,25 +8,25 @@ SceneSettings:
m_PVSPortalsArray: []
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: .25
smallestHole: 0.25
backfaceThreshold: 100
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 6
serializedVersion: 7
m_Fog: 0
m_FogColor: {r: .5, g: .5, b: .5, a: 1}
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: .00999999978
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 3
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: .5
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
@ -37,15 +37,12 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
--- !u!127 &3
LevelGameManager:
m_ObjectHideFlags: 0
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
--- !u!157 &4
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 5
serializedVersion: 7
m_GIWorkflowMode: 1
m_LightmapsMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
@ -56,19 +53,25 @@ LightmapSettings:
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 3
serializedVersion: 4
m_Resolution: 1
m_BakeResolution: 50
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AO: 0
m_AOMaxDistance: 1
m_Padding: 2
m_CompAOExponent: 0
m_CompAOExponentDirect: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 0
m_DirectLightInLightProbes: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 1024
m_LightmapSnapshot: {fileID: 0}
m_ReflectionCompression: 2
m_LightingDataAsset: {fileID: 0}
m_RuntimeCPUUsage: 25
--- !u!196 &5
NavMeshSettings:
@ -76,15 +79,15 @@ NavMeshSettings:
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentRadius: .5
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: .400000006
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
accuratePlacement: 0
minRegionArea: 2
cellSize: .166666657
cellSize: 0.16666666
manualCellSize: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &19757133
@ -157,8 +160,10 @@ Canvas:
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &19757137
RectTransform:
m_ObjectHideFlags: 0
@ -168,11 +173,12 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 245689044}
- {fileID: 2096462795}
m_Father: {fileID: 0}
m_RootOrder: 7
m_RootOrder: 8
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
@ -215,7 +221,7 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
propertyPath: m_RootOrder
value: 4
value: 5
objectReference: {fileID: 0}
- target: {fileID: 100000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
propertyPath: m_Name
@ -225,6 +231,10 @@ Prefab:
propertyPath: useEventSystem
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
propertyPath: hoverCursor
value:
objectReference: {fileID: 2800000, guid: 22eb050bacf8c401ca8503e24bff3570, type: 3}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
m_IsPrefabParent: 0
@ -255,15 +265,16 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 349486055}
m_Father: {fileID: 19757137}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -166, y: 63}
m_SizeDelta: {x: 185, y: 65}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &245689045
MonoBehaviour:
m_ObjectHideFlags: 0
@ -284,11 +295,11 @@ MonoBehaviour:
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: .960784316, g: .960784316, b: .960784316, a: 1}
m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1}
m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: .100000001
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
@ -318,6 +329,12 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
@ -382,14 +399,14 @@ Camera:
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438}
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: .300000012
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 1
@ -401,10 +418,12 @@ Camera:
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: .0219999999
m_StereoSeparation: 0.022
m_StereoMirrorMode: 0
--- !u!4 &268187672
Transform:
m_ObjectHideFlags: 0
@ -412,8 +431,9 @@ Transform:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 268187667}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -.0500000007, y: -.540000021, z: -10}
m_LocalPosition: {x: -0.05, y: -0.54, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
@ -468,9 +488,10 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_RootOrder: 1
--- !u!1 &349486054
GameObject:
m_ObjectHideFlags: 0
@ -497,6 +518,7 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 245689044}
m_RootOrder: 0
@ -504,7 +526,7 @@ RectTransform:
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &349486056
MonoBehaviour:
m_ObjectHideFlags: 0
@ -517,7 +539,13 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
@ -526,6 +554,7 @@ MonoBehaviour:
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
@ -546,7 +575,7 @@ Prefab:
m_Modifications:
- target: {fileID: 400000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2}
propertyPath: m_LocalPosition.x
value: 2.99000001
value: 2.99
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2}
propertyPath: m_LocalPosition.y
@ -574,26 +603,26 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2}
propertyPath: m_RootOrder
value: 2
value: 3
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2}
m_IsPrefabParent: 0
--- !u!1 &591590528
--- !u!1 &591590528 stripped
GameObject:
m_PrefabParentObject: {fileID: 100000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
m_PrefabInternal: {fileID: 1373034542}
--- !u!114 &591590529
--- !u!114 &591590529 stripped
MonoBehaviour:
m_PrefabParentObject: {fileID: 11400000, guid: 0e6bcf37a2876432fa58eff8888bf177,
type: 2}
m_PrefabInternal: {fileID: 1373034542}
m_Script: {fileID: 11500000, guid: cc03961113fa349c09cb06ef2911013d, type: 3}
--- !u!1 &606394391
--- !u!1 &606394391 stripped
GameObject:
m_PrefabParentObject: {fileID: 100000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2}
m_PrefabInternal: {fileID: 442175927}
--- !u!58 &606394392
--- !u!58 &606394392 stripped
CircleCollider2D:
m_PrefabParentObject: {fileID: 5800000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b,
type: 2}
@ -635,14 +664,15 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 9
--- !u!1 &1081858233
m_RootOrder: 10
--- !u!1 &1081858233 stripped
GameObject:
m_PrefabParentObject: {fileID: 100000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, type: 2}
m_PrefabInternal: {fileID: 2135880372}
--- !u!114 &1081858236
--- !u!114 &1081858236 stripped
MonoBehaviour:
m_PrefabParentObject: {fileID: 11400000, guid: 4d55f86cf3b124c8fb1158da26ffa96d,
type: 2}
@ -691,9 +721,10 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_RootOrder: 4
--- !u!1001 &1373034542
Prefab:
m_ObjectHideFlags: 0
@ -703,11 +734,11 @@ Prefab:
m_Modifications:
- target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
propertyPath: m_LocalPosition.x
value: 3.18000007
value: 3.18
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
propertyPath: m_LocalPosition.y
value: -3.1500001
value: -3.15
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
propertyPath: m_LocalPosition.z
@ -731,7 +762,7 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
propertyPath: m_RootOrder
value: 5
value: 6
objectReference: {fileID: 0}
- target: {fileID: 100000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
propertyPath: m_Name
@ -752,21 +783,6 @@ Prefab:
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
m_IsPrefabParent: 0
--- !u!115 &1447151998
MonoScript:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
serializedVersion: 4
m_Script:
m_DefaultReferences: {}
m_Icon: {fileID: 0}
m_ExecutionOrder: 0
m_ClassName: SetActive
m_Namespace: Fungus
m_AssemblyName: Assembly-CSharp.dll
m_IsEditorScript: 0
--- !u!1 &1597904418
GameObject:
m_ObjectHideFlags: 0
@ -800,7 +816,8 @@ MonoBehaviour:
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_AllowActivationOnMobileDevice: 0
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &1597904420
MonoBehaviour:
m_ObjectHideFlags: 0
@ -824,14 +841,15 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 8
--- !u!1 &1637100245
m_RootOrder: 9
--- !u!1 &1637100245 stripped
GameObject:
m_PrefabParentObject: {fileID: 100000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
m_PrefabInternal: {fileID: 228925351}
--- !u!114 &1637100246
--- !u!114 &1637100246 stripped
MonoBehaviour:
m_PrefabParentObject: {fileID: 11400000, guid: 0e6bcf37a2876432fa58eff8888bf177,
type: 2}
@ -863,6 +881,7 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 2096462795}
m_RootOrder: 0
@ -870,7 +889,7 @@ RectTransform:
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1966497755
MonoBehaviour:
m_ObjectHideFlags: 0
@ -883,7 +902,13 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
@ -892,6 +917,7 @@ MonoBehaviour:
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
@ -917,7 +943,6 @@ GameObject:
- 114: {fileID: 2019116683}
- 114: {fileID: 2019116680}
- 114: {fileID: 2019116669}
- 114: {fileID: 2019116670}
- 114: {fileID: 2019116677}
- 114: {fileID: 2019116676}
- 114: {fileID: 2019116675}
@ -1011,29 +1036,7 @@ MonoBehaviour:
eventHandler: {fileID: 2019116681}
commandList:
- {fileID: 2019116672}
- {fileID: 2019116670}
- {fileID: 2019116671}
--- !u!114 &2019116670
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2019116667}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1447151998}
m_Name:
m_EditorClassIdentifier:
itemId: 0
errorMessage:
indentLevel: 0
_targetGameObject:
gameObjectRef: {fileID: 0}
gameObjectVal: {fileID: 1081858233}
activeState:
booleanRef: {fileID: 0}
booleanVal: 0
targetGameObjectOLD: {fileID: 0}
--- !u!114 &2019116671
MonoBehaviour:
m_ObjectHideFlags: 2
@ -1046,7 +1049,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 6
errorMessage:
indentLevel: 0
_targetObject:
gameObjectRef: {fileID: 0}
@ -1066,7 +1068,7 @@ MonoBehaviour:
durationOLD: 0
_offset:
vector3Ref: {fileID: 0}
vector3Val: {x: .5, y: .5, z: 0}
vector3Val: {x: 0.5, y: 0.5, z: 0}
offsetOLD: {x: 0, y: 0, z: 0}
--- !u!114 &2019116672
MonoBehaviour:
@ -1080,7 +1082,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 5
errorMessage:
indentLevel: 0
commenterName:
commentText: Destroy the dragged object and scale up the target object
@ -1109,7 +1110,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 4
errorMessage:
indentLevel: 0
commenterName:
commentText: Decrease scale when drag is cancelled
@ -1125,7 +1125,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 3
errorMessage:
indentLevel: 0
commenterName:
commentText: Increase scale when drag starts
@ -1141,7 +1140,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 2
errorMessage:
indentLevel: 0
_targetObject:
gameObjectRef: {fileID: 0}
@ -1151,7 +1149,7 @@ MonoBehaviour:
stringVal:
_duration:
floatRef: {fileID: 0}
floatVal: .100000001
floatVal: 0.1
easeType: 2
loopType: 0
stopPreviousTweens: 0
@ -1161,7 +1159,7 @@ MonoBehaviour:
durationOLD: 0
_offset:
vector3Ref: {fileID: 0}
vector3Val: {x: -.25, y: -.25, z: 0}
vector3Val: {x: -0.25, y: -0.25, z: 0}
offsetOLD: {x: 0, y: 0, z: 0}
--- !u!114 &2019116677
MonoBehaviour:
@ -1175,7 +1173,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 1
errorMessage:
indentLevel: 0
_targetObject:
gameObjectRef: {fileID: 0}
@ -1185,7 +1182,7 @@ MonoBehaviour:
stringVal:
_duration:
floatRef: {fileID: 0}
floatVal: .100000001
floatVal: 0.1
easeType: 2
loopType: 0
stopPreviousTweens: 0
@ -1195,7 +1192,7 @@ MonoBehaviour:
durationOLD: 0
_offset:
vector3Ref: {fileID: 0}
vector3Val: {x: .25, y: .25, z: 0}
vector3Val: {x: 0.25, y: 0.25, z: 0}
offsetOLD: {x: 0, y: 0, z: 0}
--- !u!114 &2019116678
MonoBehaviour:
@ -1222,7 +1219,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 10
errorMessage:
indentLevel: 0
commenterName:
commentText: Do a punch rotation effect when the dragged object stops touching the
@ -1277,7 +1273,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 9
errorMessage:
indentLevel: 0
commenterName:
commentText: Do a punch position effect when the dragged object starts touching
@ -1394,7 +1389,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 11
errorMessage:
indentLevel: 0
_targetObject:
gameObjectRef: {fileID: 0}
@ -1425,11 +1419,12 @@ Transform:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2019116667}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -1.15999997, y: .340000004, z: 0}
m_LocalPosition: {x: -1.16, y: 0.34, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_RootOrder: 7
--- !u!114 &2019116690
MonoBehaviour:
m_ObjectHideFlags: 2
@ -1442,7 +1437,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 7
errorMessage:
indentLevel: 0
_targetObject:
gameObjectRef: {fileID: 0}
@ -1477,7 +1471,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 8
errorMessage:
indentLevel: 0
_targetObject:
gameObjectRef: {fileID: 0}
@ -1571,7 +1564,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 12
errorMessage:
indentLevel: 0
_targetObject:
gameObjectRef: {fileID: 0}
@ -1591,7 +1583,7 @@ MonoBehaviour:
durationOLD: 0
_amount:
vector3Ref: {fileID: 0}
vector3Val: {x: .5, y: .5, z: 0}
vector3Val: {x: 0.5, y: 0.5, z: 0}
amountOLD: {x: 0, y: 0, z: 0}
--- !u!114 &2019116696
MonoBehaviour:
@ -1618,7 +1610,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 21
errorMessage:
indentLevel: 0
cursorTexture: {fileID: 2800000, guid: 502e0c9b755f34db0b90bf78857d8a1c, type: 3}
hotSpot: {x: 0, y: 0}
@ -1684,15 +1675,16 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 1966497754}
m_Father: {fileID: 19757137}
m_RootOrder: 1
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -166, y: -157}
m_SizeDelta: {x: 185, y: 65}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2096462796
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1713,11 +1705,11 @@ MonoBehaviour:
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: .960784316, g: .960784316, b: .960784316, a: 1}
m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1}
m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: .100000001
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
@ -1747,6 +1739,12 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
@ -1804,6 +1802,10 @@ Prefab:
propertyPath: useEventSystem
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11400000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, type: 2}
propertyPath: hoverCursor
value:
objectReference: {fileID: 2800000, guid: 22eb050bacf8c401ca8503e24bff3570, type: 3}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, type: 2}
m_IsPrefabParent: 0

244
Assets/FungusExamples/DragAndDrop/DragAndDrop.unity

@ -8,25 +8,25 @@ SceneSettings:
m_PVSPortalsArray: []
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: .25
smallestHole: 0.25
backfaceThreshold: 100
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 6
serializedVersion: 7
m_Fog: 0
m_FogColor: {r: .5, g: .5, b: .5, a: 1}
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: .00999999978
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 3
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: .5
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
@ -37,15 +37,12 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
--- !u!127 &3
LevelGameManager:
m_ObjectHideFlags: 0
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
--- !u!157 &4
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 5
serializedVersion: 7
m_GIWorkflowMode: 1
m_LightmapsMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
@ -56,19 +53,25 @@ LightmapSettings:
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 3
serializedVersion: 4
m_Resolution: 1
m_BakeResolution: 50
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AO: 0
m_AOMaxDistance: 1
m_Padding: 2
m_CompAOExponent: 0
m_CompAOExponentDirect: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 0
m_DirectLightInLightProbes: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 1024
m_LightmapSnapshot: {fileID: 0}
m_ReflectionCompression: 2
m_LightingDataAsset: {fileID: 0}
m_RuntimeCPUUsage: 25
--- !u!196 &5
NavMeshSettings:
@ -76,15 +79,15 @@ NavMeshSettings:
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentRadius: .5
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: .400000006
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
accuratePlacement: 0
minRegionArea: 2
cellSize: .166666657
cellSize: 0.16666666
manualCellSize: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &19757133
@ -157,8 +160,10 @@ Canvas:
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &19757137
RectTransform:
m_ObjectHideFlags: 0
@ -168,11 +173,12 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 245689044}
- {fileID: 2096462795}
m_Father: {fileID: 0}
m_RootOrder: 7
m_RootOrder: 8
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
@ -215,12 +221,16 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
propertyPath: m_RootOrder
value: 4
value: 5
objectReference: {fileID: 0}
- target: {fileID: 100000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
propertyPath: m_Name
value: ClickableSprite1
objectReference: {fileID: 0}
- target: {fileID: 11400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
propertyPath: hoverCursor
value:
objectReference: {fileID: 2800000, guid: 22eb050bacf8c401ca8503e24bff3570, type: 3}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
m_IsPrefabParent: 0
@ -251,15 +261,16 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 349486055}
m_Father: {fileID: 19757137}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -166, y: 63}
m_SizeDelta: {x: 185, y: 65}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &245689045
MonoBehaviour:
m_ObjectHideFlags: 0
@ -280,11 +291,11 @@ MonoBehaviour:
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: .960784316, g: .960784316, b: .960784316, a: 1}
m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1}
m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: .100000001
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
@ -314,6 +325,12 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
@ -377,14 +394,14 @@ Camera:
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438}
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: .300000012
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 1
@ -396,10 +413,12 @@ Camera:
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: .0219999999
m_StereoSeparation: 0.022
m_StereoMirrorMode: 0
--- !u!4 &268187672
Transform:
m_ObjectHideFlags: 0
@ -407,8 +426,9 @@ Transform:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 268187667}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -.0500000007, y: -.540000021, z: -10}
m_LocalPosition: {x: -0.05, y: -0.54, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
@ -449,9 +469,10 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_RootOrder: 1
--- !u!1 &349486054
GameObject:
m_ObjectHideFlags: 0
@ -478,6 +499,7 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 245689044}
m_RootOrder: 0
@ -485,7 +507,7 @@ RectTransform:
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &349486056
MonoBehaviour:
m_ObjectHideFlags: 0
@ -498,7 +520,13 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
@ -507,6 +535,7 @@ MonoBehaviour:
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
@ -527,7 +556,7 @@ Prefab:
m_Modifications:
- target: {fileID: 400000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2}
propertyPath: m_LocalPosition.x
value: 2.99000001
value: 2.99
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2}
propertyPath: m_LocalPosition.y
@ -555,26 +584,26 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2}
propertyPath: m_RootOrder
value: 2
value: 3
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2}
m_IsPrefabParent: 0
--- !u!1 &591590528
--- !u!1 &591590528 stripped
GameObject:
m_PrefabParentObject: {fileID: 100000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
m_PrefabInternal: {fileID: 1373034542}
--- !u!114 &591590529
--- !u!114 &591590529 stripped
MonoBehaviour:
m_PrefabParentObject: {fileID: 11400000, guid: 0e6bcf37a2876432fa58eff8888bf177,
type: 2}
m_PrefabInternal: {fileID: 1373034542}
m_Script: {fileID: 11500000, guid: cc03961113fa349c09cb06ef2911013d, type: 3}
--- !u!1 &606394391
--- !u!1 &606394391 stripped
GameObject:
m_PrefabParentObject: {fileID: 100000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2}
m_PrefabInternal: {fileID: 442175927}
--- !u!58 &606394392
--- !u!58 &606394392 stripped
CircleCollider2D:
m_PrefabParentObject: {fileID: 5800000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b,
type: 2}
@ -616,14 +645,15 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 9
--- !u!1 &1081858233
m_RootOrder: 10
--- !u!1 &1081858233 stripped
GameObject:
m_PrefabParentObject: {fileID: 100000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, type: 2}
m_PrefabInternal: {fileID: 2135880372}
--- !u!114 &1081858236
--- !u!114 &1081858236 stripped
MonoBehaviour:
m_PrefabParentObject: {fileID: 11400000, guid: 4d55f86cf3b124c8fb1158da26ffa96d,
type: 2}
@ -677,9 +707,10 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_RootOrder: 4
--- !u!1001 &1373034542
Prefab:
m_ObjectHideFlags: 0
@ -689,11 +720,11 @@ Prefab:
m_Modifications:
- target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
propertyPath: m_LocalPosition.x
value: 3.18000007
value: 3.18
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
propertyPath: m_LocalPosition.y
value: -3.1500001
value: -3.15
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
propertyPath: m_LocalPosition.z
@ -717,7 +748,7 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
propertyPath: m_RootOrder
value: 5
value: 6
objectReference: {fileID: 0}
- target: {fileID: 100000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
propertyPath: m_Name
@ -734,21 +765,6 @@ Prefab:
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
m_IsPrefabParent: 0
--- !u!115 &1447151998
MonoScript:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
serializedVersion: 4
m_Script:
m_DefaultReferences: {}
m_Icon: {fileID: 0}
m_ExecutionOrder: 0
m_ClassName: SetActive
m_Namespace: Fungus
m_AssemblyName: Assembly-CSharp.dll
m_IsEditorScript: 0
--- !u!1 &1597904418
GameObject:
m_ObjectHideFlags: 0
@ -782,7 +798,8 @@ MonoBehaviour:
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_AllowActivationOnMobileDevice: 0
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &1597904420
MonoBehaviour:
m_ObjectHideFlags: 0
@ -806,14 +823,15 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 8
--- !u!1 &1637100245
m_RootOrder: 9
--- !u!1 &1637100245 stripped
GameObject:
m_PrefabParentObject: {fileID: 100000, guid: 0e6bcf37a2876432fa58eff8888bf177, type: 2}
m_PrefabInternal: {fileID: 228925351}
--- !u!114 &1637100246
--- !u!114 &1637100246 stripped
MonoBehaviour:
m_PrefabParentObject: {fileID: 11400000, guid: 0e6bcf37a2876432fa58eff8888bf177,
type: 2}
@ -845,6 +863,7 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 2096462795}
m_RootOrder: 0
@ -852,7 +871,7 @@ RectTransform:
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1966497755
MonoBehaviour:
m_ObjectHideFlags: 0
@ -865,7 +884,13 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
@ -874,6 +899,7 @@ MonoBehaviour:
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
@ -899,7 +925,6 @@ GameObject:
- 114: {fileID: 2019116683}
- 114: {fileID: 2019116680}
- 114: {fileID: 2019116669}
- 114: {fileID: 2019116670}
- 114: {fileID: 2019116677}
- 114: {fileID: 2019116676}
- 114: {fileID: 2019116675}
@ -954,7 +979,7 @@ MonoBehaviour:
y: -452
width: 1887
height: 1080
selectedBlock: {fileID: 2019116687}
selectedBlock: {fileID: 2019116698}
selectedCommands: []
variables: []
description: 'This scene shows how to set up a drag-and-drop
@ -992,29 +1017,7 @@ MonoBehaviour:
eventHandler: {fileID: 2019116681}
commandList:
- {fileID: 2019116672}
- {fileID: 2019116670}
- {fileID: 2019116671}
--- !u!114 &2019116670
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2019116667}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1447151998}
m_Name:
m_EditorClassIdentifier:
itemId: 0
errorMessage:
indentLevel: 0
_targetGameObject:
gameObjectRef: {fileID: 0}
gameObjectVal: {fileID: 1081858233}
activeState:
booleanRef: {fileID: 0}
booleanVal: 0
targetGameObjectOLD: {fileID: 0}
--- !u!114 &2019116671
MonoBehaviour:
m_ObjectHideFlags: 2
@ -1027,7 +1030,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 6
errorMessage:
indentLevel: 0
_targetObject:
gameObjectRef: {fileID: 0}
@ -1047,7 +1049,7 @@ MonoBehaviour:
durationOLD: 0
_offset:
vector3Ref: {fileID: 0}
vector3Val: {x: .5, y: .5, z: 0}
vector3Val: {x: 0.5, y: 0.5, z: 0}
offsetOLD: {x: 0, y: 0, z: 0}
--- !u!114 &2019116672
MonoBehaviour:
@ -1061,7 +1063,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 5
errorMessage:
indentLevel: 0
commenterName:
commentText: Destroy the dragged object and scale up the target object
@ -1090,7 +1091,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 4
errorMessage:
indentLevel: 0
commenterName:
commentText: Decrease scale when drag is cancelled
@ -1106,7 +1106,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 3
errorMessage:
indentLevel: 0
commenterName:
commentText: Increase scale when drag starts
@ -1122,7 +1121,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 2
errorMessage:
indentLevel: 0
_targetObject:
gameObjectRef: {fileID: 0}
@ -1132,7 +1130,7 @@ MonoBehaviour:
stringVal:
_duration:
floatRef: {fileID: 0}
floatVal: .100000001
floatVal: 0.1
easeType: 2
loopType: 0
stopPreviousTweens: 0
@ -1142,7 +1140,7 @@ MonoBehaviour:
durationOLD: 0
_offset:
vector3Ref: {fileID: 0}
vector3Val: {x: -.25, y: -.25, z: 0}
vector3Val: {x: -0.25, y: -0.25, z: 0}
offsetOLD: {x: 0, y: 0, z: 0}
--- !u!114 &2019116677
MonoBehaviour:
@ -1156,7 +1154,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 1
errorMessage:
indentLevel: 0
_targetObject:
gameObjectRef: {fileID: 0}
@ -1166,7 +1163,7 @@ MonoBehaviour:
stringVal:
_duration:
floatRef: {fileID: 0}
floatVal: .100000001
floatVal: 0.1
easeType: 2
loopType: 0
stopPreviousTweens: 0
@ -1176,7 +1173,7 @@ MonoBehaviour:
durationOLD: 0
_offset:
vector3Ref: {fileID: 0}
vector3Val: {x: .25, y: .25, z: 0}
vector3Val: {x: 0.25, y: 0.25, z: 0}
offsetOLD: {x: 0, y: 0, z: 0}
--- !u!114 &2019116678
MonoBehaviour:
@ -1203,7 +1200,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 10
errorMessage:
indentLevel: 0
commenterName:
commentText: Do a punch rotation effect when the dragged object stops touching the
@ -1258,7 +1254,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 9
errorMessage:
indentLevel: 0
commenterName:
commentText: Do a punch position effect when the dragged object starts touching
@ -1375,7 +1370,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 11
errorMessage:
indentLevel: 0
_targetObject:
gameObjectRef: {fileID: 0}
@ -1406,11 +1400,12 @@ Transform:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2019116667}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -1.15999997, y: .340000004, z: 0}
m_LocalPosition: {x: -1.16, y: 0.34, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_RootOrder: 7
--- !u!114 &2019116690
MonoBehaviour:
m_ObjectHideFlags: 2
@ -1423,7 +1418,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 7
errorMessage:
indentLevel: 0
_targetObject:
gameObjectRef: {fileID: 0}
@ -1458,7 +1452,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 8
errorMessage:
indentLevel: 0
_targetObject:
gameObjectRef: {fileID: 0}
@ -1552,7 +1545,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 12
errorMessage:
indentLevel: 0
_targetObject:
gameObjectRef: {fileID: 0}
@ -1572,7 +1564,7 @@ MonoBehaviour:
durationOLD: 0
_amount:
vector3Ref: {fileID: 0}
vector3Val: {x: .5, y: .5, z: 0}
vector3Val: {x: 0.5, y: 0.5, z: 0}
amountOLD: {x: 0, y: 0, z: 0}
--- !u!114 &2019116696
MonoBehaviour:
@ -1599,7 +1591,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 21
errorMessage:
indentLevel: 0
cursorTexture: {fileID: 2800000, guid: 502e0c9b755f34db0b90bf78857d8a1c, type: 3}
hotSpot: {x: 0, y: 0}
@ -1665,15 +1656,16 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 1966497754}
m_Father: {fileID: 19757137}
m_RootOrder: 1
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -166, y: -157}
m_SizeDelta: {x: 185, y: 65}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2096462796
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1694,11 +1686,11 @@ MonoBehaviour:
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: .960784316, g: .960784316, b: .960784316, a: 1}
m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1}
m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: .100000001
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
@ -1728,6 +1720,12 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
@ -1781,6 +1779,10 @@ Prefab:
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 11400000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, type: 2}
propertyPath: hoverCursor
value:
objectReference: {fileID: 2800000, guid: 22eb050bacf8c401ca8503e24bff3570, type: 3}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, type: 2}
m_IsPrefabParent: 0

35
Assets/Tests/Narrative/NarrativeTests.unity

@ -117,7 +117,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 61dddfdc5e0e44ca298d8f46f7f5a915, type: 3}
m_Name:
m_EditorClassIdentifier:
selectedFlowchart: {fileID: 1913435020}
selectedFlowchart: {fileID: 736071350}
--- !u!4 &11556238
Transform:
m_ObjectHideFlags: 1
@ -2899,7 +2899,6 @@ MonoBehaviour:
nameText: Sherlock
nameColor: {r: 1, g: 1, b: 1, a: 1}
soundEffect: {fileID: 0}
profileSprite: {fileID: 21300000, guid: 10cc2fec4b8aa4db983981588b06b591, type: 3}
portraits:
- {fileID: 21300000, guid: 10cc2fec4b8aa4db983981588b06b591, type: 3}
- {fileID: 21300000, guid: 450277e404c2d4d1e87c5bd4012283bb, type: 3}
@ -3455,7 +3454,6 @@ MonoBehaviour:
nameText: John
nameColor: {r: 1, g: 1, b: 1, a: 1}
soundEffect: {fileID: 0}
profileSprite: {fileID: 21300000, guid: 820bab66bb5a044ec961ba8ee3b045cc, type: 3}
portraits:
- {fileID: 21300000, guid: 820bab66bb5a044ec961ba8ee3b045cc, type: 3}
- {fileID: 21300000, guid: a92b08a118b7d46f59dd091acb2e4102, type: 3}
@ -3730,7 +3728,6 @@ MonoBehaviour:
- {fileID: 297056950}
- {fileID: 1049860613}
- {fileID: 813974793}
cachedPositions: []
--- !u!1 &499706539
GameObject:
m_ObjectHideFlags: 0
@ -5424,7 +5421,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &685425359
Transform:
m_ObjectHideFlags: 0
@ -6466,26 +6463,9 @@ MonoBehaviour:
Culture=neutral, PublicKeyToken=null
targetComponentFullname: UnityEngine.Component[]
targetComponentText: WriterAudio
targetMethod: SetAudioMode
targetMethodText: 'SetAudioMode (AudioMode): Void'
methodParameters:
- objValue:
typeAssemblyname: Fungus.WriterAudio+AudioMode, Assembly-CSharp, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
typeFullname: Fungus.WriterAudio+AudioMode
intValue: 0
boolValue: 0
floatValue: 0
stringValue:
colorValue: {r: 0, g: 0, b: 0, a: 0}
gameObjectValue: {fileID: 0}
materialValue: {fileID: 0}
objectValue: {fileID: 0}
spriteValue: {fileID: 0}
textureValue: {fileID: 0}
vector2Value: {x: 0, y: 0}
vector3Value: {x: 0, y: 0, z: 0}
variableKey:
targetMethod: OnInput
targetMethodText: 'OnInput (): Void'
methodParameters: []
saveReturnValue: 0
returnValueVariableKey:
returnValueType: System.Void
@ -7413,7 +7393,6 @@ MonoBehaviour:
- {fileID: 1968482742}
- {fileID: 1336986580}
- {fileID: 1754947673}
cachedPositions: []
--- !u!4 &825247592
Transform:
m_ObjectHideFlags: 0
@ -10356,7 +10335,6 @@ MonoBehaviour:
nameText: Somebody
nameColor: {r: 0.2352941, g: 0.2352941, b: 0.2352941, a: 1}
soundEffect: {fileID: 0}
profileSprite: {fileID: 21300000, guid: 10cc2fec4b8aa4db983981588b06b591, type: 3}
portraits:
- {fileID: 21300000, guid: 10cc2fec4b8aa4db983981588b06b591, type: 3}
portraitsFace: 0
@ -10477,7 +10455,6 @@ MonoBehaviour:
nameText: TestCharacter
nameColor: {r: 1, g: 1, b: 1, a: 1}
soundEffect: {fileID: 0}
profileSprite: {fileID: 21300000, guid: 5b776e5296df54952a07a367943f5c7c, type: 3}
portraits:
- {fileID: 21300000, guid: 5b776e5296df54952a07a367943f5c7c, type: 3}
- {fileID: 21300000, guid: 820bab66bb5a044ec961ba8ee3b045cc, type: 3}
@ -13702,7 +13679,6 @@ MonoBehaviour:
nameText: Character Name
nameColor: {r: 1, g: 1, b: 1, a: 1}
soundEffect: {fileID: 0}
profileSprite: {fileID: 21300000, guid: 450277e404c2d4d1e87c5bd4012283bb, type: 3}
portraits:
- {fileID: 21300000, guid: 450277e404c2d4d1e87c5bd4012283bb, type: 3}
- {fileID: 21300000, guid: c779e34c6eb8e45da98c70cf2802a54c, type: 3}
@ -17982,7 +17958,6 @@ MonoBehaviour:
nameText: Test Character
nameColor: {r: 1, g: 1, b: 1, a: 1}
soundEffect: {fileID: 8300000, guid: 0cdfebb6349aa4b72a1d34c47935faf8, type: 3}
profileSprite: {fileID: 0}
portraits: []
portraitsFace: 0
setSayDialog: {fileID: 0}

8
Assets/Tests/UI/Editor/TextTagParserTests.cs

@ -16,10 +16,8 @@ public class TextTagParserTests
[Test]
public void TextTagParser_Parser()
{
var textTagParser = new TextTagParser();
// Parse an example string, generate correct sequence of tags
List<TextTagToken> tokens = textTagParser.Tokenize("Words " +
List<TextTagToken> tokens = TextTagParser.Tokenize("Words " +
"{b}bold test{/b}" +
"{i}italic test{/i}" +
"{color=red}color test{/color}" +
@ -181,10 +179,8 @@ public class TextTagParserTests
[Test]
public void TextTagParser_AudioWaitBug()
{
var textTagParser = new TextTagParser();
// Parse an example string, generate correct sequence of tags
List<TextTagToken> tokens = textTagParser.Tokenize("Play sound{audio=BeepSound}{w=1} Play loop{audioloop=BeepSound}{w=3} Stop{audiostop=BeepSound}");
List<TextTagToken> tokens = TextTagParser.Tokenize("Play sound{audio=BeepSound}{w=1} Play loop{audioloop=BeepSound}{w=3} Stop{audiostop=BeepSound}");
int i = 0;
Assert.That(tokens[i].type == TokenType.Words);

39
ProjectSettings/ProjectSettings.asset

@ -500,7 +500,44 @@ PlayerSettings:
WebGL::emscriptenArgs:
WebGL::template: APPLICATION:Default
additionalIl2CppArgs::additionalIl2CppArgs:
vectorPropertyNames: []
vectorPropertyNames:
- Android::VR::enabledDevices
- Metro::VR::enabledDevices
- N3DS::VR::enabledDevices
- PS3::VR::enabledDevices
- PS4::VR::enabledDevices
- PSM::VR::enabledDevices
- PSP2::VR::enabledDevices
- SamsungTV::VR::enabledDevices
- Standalone::VR::enabledDevices
- Tizen::VR::enabledDevices
- WebGL::VR::enabledDevices
- WebPlayer::VR::enabledDevices
- WiiU::VR::enabledDevices
- Xbox360::VR::enabledDevices
- XboxOne::VR::enabledDevices
- iOS::VR::enabledDevices
- tvOS::VR::enabledDevices
Android::VR::enabledDevices:
- Oculus
Metro::VR::enabledDevices: []
N3DS::VR::enabledDevices: []
PS3::VR::enabledDevices: []
PS4::VR::enabledDevices:
- PlayStationVR
PSM::VR::enabledDevices: []
PSP2::VR::enabledDevices: []
SamsungTV::VR::enabledDevices: []
Standalone::VR::enabledDevices:
- Oculus
Tizen::VR::enabledDevices: []
WebGL::VR::enabledDevices: []
WebPlayer::VR::enabledDevices: []
WiiU::VR::enabledDevices: []
Xbox360::VR::enabledDevices: []
XboxOne::VR::enabledDevices: []
iOS::VR::enabledDevices: []
tvOS::VR::enabledDevices: []
cloudProjectId:
projectName:
organizationId:

Loading…
Cancel
Save