diff --git a/Assets/Fungus/Thirdparty/FungusLua/Scripts/ILuaUtils.cs b/Assets/Fungus/Thirdparty/FungusLua/Scripts/ILuaUtils.cs
new file mode 100644
index 00000000..0055cee8
--- /dev/null
+++ b/Assets/Fungus/Thirdparty/FungusLua/Scripts/ILuaUtils.cs
@@ -0,0 +1,72 @@
+using UnityEngine;
+using System.Collections;
+using System.Text;
+
+namespace Fungus
+{
+ public interface ILuaUtils
+ {
+ ///
+ /// Returns a string from the string table for this key.
+ /// The string returned depends on the active language.
+ ///
+ string GetString(string key);
+
+ ///
+ /// Implementation of StringSubstituter.ISubstitutionHandler
+ /// Substitutes specially formatted tokens in the text with global variables and string table values.
+ /// The string table value used depends on the currently loaded string table and active language.
+ ///
+ bool SubstituteStrings(StringBuilder input);
+
+ ///
+ /// Performs string substitution on the input string, replacing tokens of the form {$VarName} with
+ /// matching variables, localised strings, etc. in the scene.
+ ///
+ string Substitute(string input);
+
+ ///
+ /// Find a game object by name and returns it.
+ ///
+ GameObject Find(string name);
+
+ ///
+ /// Returns one active GameObject tagged tag. Returns null if no GameObject was found.
+ ///
+ GameObject FindWithTag(string tag);
+
+ ///
+ /// Returns a list of active GameObjects tagged tag. Returns empty array if no GameObject was found.
+ ///
+ GameObject[] FindGameObjectsWithTag(string tag);
+
+ ///
+ /// Create a copy of a GameObject.
+ /// Can be used to instantiate prefabs.
+ ///
+ GameObject Instantiate(GameObject go);
+
+ ///
+ /// Destroys an instance of a GameObject.
+ ///
+ void Destroy(GameObject go);
+
+ ///
+ /// Spawns an instance of a named prefab resource.
+ /// The prefab must exist in a Resources folder in the project.
+ ///
+ GameObject Spawn(string resourceName);
+
+ ///
+ /// Use the conversation manager to play out a conversation
+ ///
+ ///
+ IEnumerator DoConversation(string conv);
+
+ ///
+ /// Sync the active say dialog with what Lua thinks the SayDialog should be
+ ///
+ ///
+ void SetSayDialog(ISayDialog sayDialog);
+ }
+}
\ No newline at end of file
diff --git a/Assets/Fungus/Thirdparty/FungusLua/Scripts/ILuaUtils.cs.meta b/Assets/Fungus/Thirdparty/FungusLua/Scripts/ILuaUtils.cs.meta
new file mode 100644
index 00000000..26c6b600
--- /dev/null
+++ b/Assets/Fungus/Thirdparty/FungusLua/Scripts/ILuaUtils.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d24a505bdb666456d84b02a983fe5bee
+timeCreated: 1473674337
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Fungus/Thirdparty/FungusLua/Scripts/LuaStore.cs b/Assets/Fungus/Thirdparty/FungusLua/Scripts/LuaStore.cs
index 7a92855e..ca90bb54 100644
--- a/Assets/Fungus/Thirdparty/FungusLua/Scripts/LuaStore.cs
+++ b/Assets/Fungus/Thirdparty/FungusLua/Scripts/LuaStore.cs
@@ -24,7 +24,7 @@ namespace Fungus
protected static LuaStore instance;
- public void Start()
+ protected virtual void Start()
{
Init();
}
diff --git a/Assets/Fungus/Thirdparty/FungusLua/Scripts/LuaUtils.cs b/Assets/Fungus/Thirdparty/FungusLua/Scripts/LuaUtils.cs
index b63312c3..ccb7f68c 100644
--- a/Assets/Fungus/Thirdparty/FungusLua/Scripts/LuaUtils.cs
+++ b/Assets/Fungus/Thirdparty/FungusLua/Scripts/LuaUtils.cs
@@ -15,7 +15,7 @@ namespace Fungus
///
/// A collection of utilites to use in Lua for common Unity / Fungus tasks.
///
- public class LuaUtils : LuaEnvironment.Initializer, StringSubstituter.ISubstitutionHandler
+ public class LuaUtils : LuaEnvironment.Initializer, StringSubstituter.ISubstitutionHandler, ILuaUtils
{
public enum FungusModuleOptions
{
@@ -71,37 +71,6 @@ namespace Fungus
protected ConversationManager conversationManager;
- ///
- /// Called by LuaEnvironment when initializing.
- ///
- public override void Initialize()
- {
- LuaEnv = GetComponent();
- if (LuaEnv == null)
- {
- Debug.LogError("No Lua Environment found");
- return;
- }
-
- if (LuaEnv.Interpreter == null)
- {
- Debug.LogError("No Lua interpreter found");
- return;
- }
-
- InitTypes();
- InitFungusModule();
- InitBindings();
- }
-
- ///
- /// Called by LuaEnvironment prior to executing a script.
- ///
- public override string PreprocessScript(string input)
- {
- return input;
- }
-
///
/// Registers all listed c# types for interop with Lua.
/// You can also register types directly in the Awake method of any
@@ -306,10 +275,40 @@ namespace Fungus
}
}
+ #region LuaEnvironment.Initializer implementation
+
+ public override void Initialize()
+ {
+ LuaEnv = GetComponent();
+ if (LuaEnv == null)
+ {
+ Debug.LogError("No Lua Environment found");
+ return;
+ }
+
+ if (LuaEnv.Interpreter == null)
+ {
+ Debug.LogError("No Lua interpreter found");
+ return;
+ }
+
+ InitTypes();
+ InitFungusModule();
+ InitBindings();
+ }
+
///
- /// Returns a string from the string table for this key.
- /// The string returned depends on the active language.
+ /// Called by LuaEnvironment prior to executing a script.
///
+ public override string PreprocessScript(string input)
+ {
+ return input;
+ }
+
+ #endregion
+
+ #region ILuaUtils implementation
+
public virtual string GetString(string key)
{
if (stringTable != null)
@@ -329,11 +328,6 @@ namespace Fungus
return "";
}
- ///
- /// Implementation of StringSubstituter.ISubstitutionHandler
- /// Substitutes specially formatted tokens in the text with global variables and string table values.
- /// The string table value used depends on the currently loaded string table and active language.
- ///
[MoonSharpHidden]
public virtual bool SubstituteStrings(StringBuilder input)
{
@@ -402,60 +396,36 @@ namespace Fungus
return modified;
}
- ///
- /// Performs string substitution on the input string, replacing tokens of the form {$VarName} with
- /// matching variables, localised strings, etc. in the scene.
- ///
public virtual string Substitute(string input)
{
return stringSubstituter.SubstituteStrings(input);
}
- ///
- /// Find a game object by name and returns it.
- ///
public virtual GameObject Find(string name)
{
return GameObject.Find(name);
}
- ///
- /// Returns one active GameObject tagged tag. Returns null if no GameObject was found.
- ///
public virtual GameObject FindWithTag(string tag)
{
return GameObject.FindGameObjectWithTag(tag);
}
- ///
- /// Returns a list of active GameObjects tagged tag. Returns empty array if no GameObject was found.
- ///
public virtual GameObject[] FindGameObjectsWithTag(string tag)
{
return GameObject.FindGameObjectsWithTag(tag);
}
- ///
- /// Create a copy of a GameObject.
- /// Can be used to instantiate prefabs.
- ///
public virtual GameObject Instantiate(GameObject go)
{
return GameObject.Instantiate(go);
}
- ///
- /// Destroys an instance of a GameObject.
- ///
public virtual void Destroy(GameObject go)
{
GameObject.Destroy(go);
}
- ///
- /// Spawns an instance of a named prefab resource.
- /// The prefab must exist in a Resources folder in the project.
- ///
public virtual GameObject Spawn(string resourceName)
{
// Auto spawn a say dialog object from the prefab
@@ -469,22 +439,16 @@ namespace Fungus
return null;
}
- ///
- /// Use the conversation manager to play out a conversation
- ///
- ///
public virtual IEnumerator DoConversation(string conv)
{
return conversationManager.DoConversation(conv);
}
- ///
- /// Sync the active say dialog with what Lua thinks the SayDialog should be
- ///
- ///
public void SetSayDialog(ISayDialog sayDialog)
{
SayDialog.activeSayDialog = sayDialog;
}
+
+ #endregion
}
}
\ No newline at end of file