Browse Source

Refactored LuaStore to use ILuaStore interface

master
Christopher 9 years ago
parent
commit
7ed9eaad44
  1. 12
      Assets/Fungus/Thirdparty/FungusLua/Scripts/ILuaStore.cs
  2. 12
      Assets/Fungus/Thirdparty/FungusLua/Scripts/ILuaStore.cs.meta
  3. 2
      Assets/Fungus/Thirdparty/FungusLua/Scripts/InfoText.cs
  4. 23
      Assets/Fungus/Thirdparty/FungusLua/Scripts/LuaStore.cs

12
Assets/Fungus/Thirdparty/FungusLua/Scripts/ILuaStore.cs vendored

@ -0,0 +1,12 @@
using MoonSharp.Interpreter;
namespace Fungus
{
public interface ILuaStore
{
/// <summary>
/// A Lua table that can be shared between multiple LuaEnvironments.
/// </summary>
Table PrimeTable { get; }
}
}

12
Assets/Fungus/Thirdparty/FungusLua/Scripts/ILuaStore.cs.meta vendored

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

2
Assets/Fungus/Thirdparty/FungusLua/Scripts/InfoText.cs vendored

@ -14,7 +14,7 @@ namespace Fungus
[TextArea(20, 20)]
[SerializeField] protected string info = "";
void OnGUI()
protected virtual void OnGUI()
{
Rect rect = new Rect(0,0, Screen.width / 2, Screen.height);

23
Assets/Fungus/Thirdparty/FungusLua/Scripts/LuaStore.cs vendored

@ -11,15 +11,10 @@ namespace Fungus
/// This is useful for transferring values from one scene to another. One one LuaStore component may exist
/// in a scene at a time.
/// </summary>
public class LuaStore : LuaBindingsBase
public class LuaStore : LuaBindingsBase, ILuaStore
{
protected Table primeTable;
/// <summary>
/// A Lua table that can be shared between multiple LuaEnvironments.
/// </summary>
public virtual Table PrimeTable { get { return primeTable; } }
protected bool initialized;
protected static LuaStore instance;
@ -67,9 +62,8 @@ namespace Fungus
return true;
}
/// <summary>
/// Callback to bind this LuaStore component with the "unity" table in a LuaEnvironment component.
/// </summary>
#region LuaBindingsBase implementation
public override void AddBindings(ILuaEnvironment luaEnv)
{
if (!Init())
@ -98,5 +92,16 @@ namespace Fungus
globals["store"] = primeTable;
}
}
#endregion
#region ILuaStore implementation
/// <summary>
/// A Lua table that can be shared between multiple LuaEnvironments.
/// </summary>
public virtual Table PrimeTable { get { return primeTable; } }
#endregion
}
}
Loading…
Cancel
Save