Browse Source

Renamed RunLua to LuaScript

master
chrisgregan 9 years ago
parent
commit
882b6ef65e
  1. 4
      Assets/Fungus/Lua/Resources/Prefabs/LuaScript.prefab
  2. 0
      Assets/Fungus/Lua/Resources/Prefabs/LuaScript.prefab.meta
  3. 18
      Assets/Fungus/Lua/Scripts/Editor/LuaScriptEditor.cs
  4. 4
      Assets/Fungus/Lua/Scripts/Editor/LuaScriptEditor.cs.meta
  5. 4
      Assets/Fungus/Lua/Scripts/Editor/MenuItems.cs
  6. 10
      Assets/Fungus/Lua/Scripts/LuaScript.cs
  7. 0
      Assets/Fungus/Lua/Scripts/LuaScript.cs.meta
  8. 5
      Assets/FungusExamples/Lua/Narrative.unity
  9. 20
      Assets/Tests/Lua/FungusTests.unity
  10. 28
      Assets/Tests/Lua/LuaTests.unity

4
Assets/Fungus/Lua/Resources/Prefabs/RunLua.prefab → Assets/Fungus/Lua/Resources/Prefabs/LuaScript.prefab

@ -10,7 +10,7 @@ GameObject:
- 4: {fileID: 449874} - 4: {fileID: 449874}
- 114: {fileID: 11472914} - 114: {fileID: 11472914}
m_Layer: 0 m_Layer: 0
m_Name: RunLua m_Name: LuaScript
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -47,7 +47,7 @@ MonoBehaviour:
repeatEveryFrame: 1 repeatEveryFrame: 1
hasFailed: 0 hasFailed: 0
executeMethods: 2 executeMethods: 2
fungusScript: {fileID: 0} luaEnvironment: {fileID: 0}
luaFile: {fileID: 0} luaFile: {fileID: 0}
luaScript: luaScript:
runAsCoroutine: 1 runAsCoroutine: 1

0
Assets/Fungus/Lua/Resources/Prefabs/RunLua.prefab.meta → Assets/Fungus/Lua/Resources/Prefabs/LuaScript.prefab.meta

18
Assets/Fungus/Lua/Scripts/Editor/RunLuaEditor.cs → Assets/Fungus/Lua/Scripts/Editor/LuaScriptEditor.cs

@ -11,8 +11,8 @@ using UnityEngine;
namespace Fungus namespace Fungus
{ {
[CustomEditor(typeof(RunLua))] [CustomEditor(typeof(LuaScript))]
public class RunLuaEditor : Editor public class LuaScriptEditor : Editor
{ {
private readonly DropDownControl<Type> m_ComparerDropDown = new DropDownControl<Type>(); private readonly DropDownControl<Type> m_ComparerDropDown = new DropDownControl<Type>();
@ -32,7 +32,7 @@ namespace Fungus
protected List<TextAsset> luaFiles = new List<TextAsset>(); protected List<TextAsset> luaFiles = new List<TextAsset>();
public RunLuaEditor() public LuaScriptEditor()
{ {
m_ComparerDropDown.convertForButtonLabel = type => type.Name; m_ComparerDropDown.convertForButtonLabel = type => type.Name;
m_ComparerDropDown.convertForGUIContent = type => type.Name; m_ComparerDropDown.convertForGUIContent = type => type.Name;
@ -69,20 +69,20 @@ namespace Fungus
public override void OnInspectorGUI() public override void OnInspectorGUI()
{ {
var fungusInvoke = (RunLua)target; var fungusInvoke = (LuaScript)target;
EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginHorizontal();
EditorGUILayout.PrefixLabel(new GUIContent("On Event")); EditorGUILayout.PrefixLabel(new GUIContent("On Event"));
fungusInvoke.executeMethods = (RunLua.ExecuteMethod)EditorGUILayout.EnumMaskField(fungusInvoke.executeMethods, fungusInvoke.executeMethods = (LuaScript.ExecuteMethod)EditorGUILayout.EnumMaskField(fungusInvoke.executeMethods,
EditorStyles.popup, EditorStyles.popup,
GUILayout.ExpandWidth(false)); GUILayout.ExpandWidth(false));
EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal();
if (fungusInvoke.IsExecuteMethodSelected(RunLua.ExecuteMethod.AfterPeriodOfTime)) if (fungusInvoke.IsExecuteMethodSelected(LuaScript.ExecuteMethod.AfterPeriodOfTime))
{ {
DrawOptionsForAfterPeriodOfTime(fungusInvoke); DrawOptionsForAfterPeriodOfTime(fungusInvoke);
} }
if (fungusInvoke.IsExecuteMethodSelected(RunLua.ExecuteMethod.Update)) if (fungusInvoke.IsExecuteMethodSelected(LuaScript.ExecuteMethod.Update))
{ {
DrawOptionsForOnUpdate(fungusInvoke); DrawOptionsForOnUpdate(fungusInvoke);
} }
@ -158,7 +158,7 @@ namespace Fungus
serializedObject.ApplyModifiedProperties(); serializedObject.ApplyModifiedProperties();
} }
private void DrawOptionsForAfterPeriodOfTime(RunLua script) private void DrawOptionsForAfterPeriodOfTime(LuaScript script)
{ {
EditorGUILayout.Space(); EditorGUILayout.Space();
script.executeAfterTime = EditorGUILayout.FloatField(m_GUIExecuteAfterTimeGuiContent, script.executeAfterTime = EditorGUILayout.FloatField(m_GUIExecuteAfterTimeGuiContent,
@ -176,7 +176,7 @@ namespace Fungus
} }
} }
private void DrawOptionsForOnUpdate(RunLua script) private void DrawOptionsForOnUpdate(LuaScript script)
{ {
EditorGUILayout.Space(); EditorGUILayout.Space();
script.executeAfterFrames = EditorGUILayout.IntField(m_GUIExecuteAfterFramesGuiContent, script.executeAfterFrames = EditorGUILayout.IntField(m_GUIExecuteAfterFramesGuiContent,

4
Assets/Fungus/Lua/Scripts/Editor/RunLuaEditor.cs.meta → Assets/Fungus/Lua/Scripts/Editor/LuaScriptEditor.cs.meta

@ -1,6 +1,6 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 28e6892c983f34f42a3d6d03b5d199e7 guid: 8b84800ca6a0e4a86b651c01e3857c77
timeCreated: 1455233798 timeCreated: 1459507008
licenseType: Free licenseType: Free
MonoImporter: MonoImporter:
serializedVersion: 2 serializedVersion: 2

4
Assets/Fungus/Lua/Scripts/Editor/MenuItems.cs

@ -20,10 +20,10 @@ namespace Fungus
SpawnPrefab("Prefabs/LuaBindings", false); SpawnPrefab("Prefabs/LuaBindings", false);
} }
[MenuItem("Tools/Fungus/Create/Run Lua", false, 2002)] [MenuItem("Tools/Fungus/Create/Lua Script", false, 2002)]
static void CreateFungusInvoke() static void CreateFungusInvoke()
{ {
SpawnPrefab("Prefabs/RunLua", false); SpawnPrefab("Prefabs/LuaScript", false);
} }
[MenuItem("Tools/Fungus/Create/Lua File", false, 2100)] [MenuItem("Tools/Fungus/Create/Lua File", false, 2100)]

10
Assets/Fungus/Lua/Scripts/RunLua.cs → Assets/Fungus/Lua/Scripts/LuaScript.cs

@ -14,7 +14,7 @@ namespace Fungus
{ {
[Serializable] [Serializable]
public class RunLua : MonoBehaviour, IRunLuaConfigurator public class LuaScript : MonoBehaviour, ILuaScriptConfigurator
{ {
[Flags] [Flags]
public enum ExecuteMethod public enum ExecuteMethod
@ -116,7 +116,7 @@ namespace Fungus
} }
// Cache a descriptive name to use in Lua error messages // Cache a descriptive name to use in Lua error messages
friendlyName = GetPath(transform) + ".RunLua"; friendlyName = GetPath(transform) + ".LuaScript";
Execute(ExecuteMethod.Start); Execute(ExecuteMethod.Start);
@ -323,11 +323,11 @@ namespace Fungus
public float TimeExecuteStartAfter { set { executeAfterTime = value; } } public float TimeExecuteStartAfter { set { executeAfterTime = value; } }
public float TimeExecuteRepeatFrequency { set { repeatEveryTime = value; } } public float TimeExecuteRepeatFrequency { set { repeatEveryTime = value; } }
public bool TimeExecuteRepeat { set { repeatExecuteTime = value; } } public bool TimeExecuteRepeat { set { repeatExecuteTime = value; } }
public RunLua Component { get { return this; } } public LuaScript Component { get { return this; } }
#endregion #endregion
} }
public interface IRunLuaConfigurator public interface ILuaScriptConfigurator
{ {
/// <summary> /// <summary>
/// If the assertion is evaluated in Update, after how many frame should the evaluation start. Defult is 1 (first frame) /// If the assertion is evaluated in Update, after how many frame should the evaluation start. Defult is 1 (first frame)
@ -355,7 +355,7 @@ namespace Fungus
/// </summary> /// </summary>
bool TimeExecuteRepeat { set; } bool TimeExecuteRepeat { set; }
RunLua Component { get; } LuaScript Component { get; }
} }
} }

0
Assets/Fungus/Lua/Scripts/RunLua.cs.meta → Assets/Fungus/Lua/Scripts/LuaScript.cs.meta

5
Assets/FungusExamples/Lua/Narrative.unity

@ -627,7 +627,7 @@ GameObject:
- 4: {fileID: 519026841} - 4: {fileID: 519026841}
- 114: {fileID: 519026840} - 114: {fileID: 519026840}
m_Layer: 0 m_Layer: 0
m_Name: RunLua m_Name: LuaScript
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -653,7 +653,7 @@ MonoBehaviour:
repeatEveryFrame: 1 repeatEveryFrame: 1
hasFailed: 0 hasFailed: 0
executeMethods: 2 executeMethods: 2
fungusScript: {fileID: 0} luaEnvironment: {fileID: 0}
luaFile: {fileID: 0} luaFile: {fileID: 0}
luaScript: "fungus.setsaydialog(saydialog)\nfungus.setmenudialog(menudialog)\n\nfunction luaScript: "fungus.setsaydialog(saydialog)\nfungus.setmenudialog(menudialog)\n\nfunction
start()\n fungus.say \"Select an option\"\n\n fungus.menu(\"Option A\", optiona)\n start()\n fungus.say \"Select an option\"\n\n fungus.menu(\"Option A\", optiona)\n
@ -1788,6 +1788,7 @@ MonoBehaviour:
- key: menudialog - key: menudialog
obj: {fileID: 1851713324} obj: {fileID: 1851713324}
component: {fileID: 1851713325} component: {fileID: 1851713325}
boundTypes: []
--- !u!4 &1265440902 --- !u!4 &1265440902
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

20
Assets/Tests/Lua/FungusTests.unity

@ -1066,7 +1066,7 @@ GameObject:
- 4: {fileID: 116891409} - 4: {fileID: 116891409}
- 114: {fileID: 116891410} - 114: {fileID: 116891410}
m_Layer: 0 m_Layer: 0
m_Name: RunLua m_Name: LuaScript
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -2486,7 +2486,7 @@ GameObject:
- 4: {fileID: 448016417} - 4: {fileID: 448016417}
- 114: {fileID: 448016418} - 114: {fileID: 448016418}
m_Layer: 0 m_Layer: 0
m_Name: RunLua m_Name: LuaScript
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -2869,7 +2869,7 @@ GameObject:
- 4: {fileID: 508615589} - 4: {fileID: 508615589}
- 114: {fileID: 508615590} - 114: {fileID: 508615590}
m_Layer: 0 m_Layer: 0
m_Name: RunLua m_Name: LuaScript
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -2923,7 +2923,7 @@ GameObject:
- 4: {fileID: 511430245} - 4: {fileID: 511430245}
- 114: {fileID: 511430246} - 114: {fileID: 511430246}
m_Layer: 0 m_Layer: 0
m_Name: RunLua m_Name: LuaScript
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -4244,7 +4244,7 @@ GameObject:
- 4: {fileID: 851718692} - 4: {fileID: 851718692}
- 114: {fileID: 851718693} - 114: {fileID: 851718693}
m_Layer: 0 m_Layer: 0
m_Name: RunLua m_Name: LuaScript
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -7479,7 +7479,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!114 &1647235603 --- !u!114 &1647235603
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -7527,7 +7527,7 @@ GameObject:
- 4: {fileID: 1652835881} - 4: {fileID: 1652835881}
- 114: {fileID: 1652835882} - 114: {fileID: 1652835882}
m_Layer: 0 m_Layer: 0
m_Name: RunLua m_Name: LuaScript
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -8580,7 +8580,7 @@ GameObject:
- 4: {fileID: 1845639738} - 4: {fileID: 1845639738}
- 114: {fileID: 1845639739} - 114: {fileID: 1845639739}
m_Layer: 0 m_Layer: 0
m_Name: RunLua m_Name: LuaScript
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -9265,7 +9265,7 @@ GameObject:
- 4: {fileID: 2049586852} - 4: {fileID: 2049586852}
- 114: {fileID: 2049586853} - 114: {fileID: 2049586853}
m_Layer: 0 m_Layer: 0
m_Name: RunLua m_Name: LuaScript
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -9593,7 +9593,7 @@ GameObject:
- 4: {fileID: 2090444089} - 4: {fileID: 2090444089}
- 114: {fileID: 2090444090} - 114: {fileID: 2090444090}
m_Layer: 0 m_Layer: 0
m_Name: RunLua m_Name: LuaScript
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0

28
Assets/Tests/Lua/LuaTests.unity

@ -188,7 +188,7 @@ GameObject:
- 4: {fileID: 113453956} - 4: {fileID: 113453956}
- 114: {fileID: 113453957} - 114: {fileID: 113453957}
m_Layer: 0 m_Layer: 0
m_Name: RunLua m_Name: LuaScript
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -226,7 +226,7 @@ MonoBehaviour:
repeatEveryFrame: 1 repeatEveryFrame: 1
hasFailed: 0 hasFailed: 0
executeMethods: 2 executeMethods: 2
lua: {fileID: 0} luaEnvironment: {fileID: 0}
luaFile: {fileID: 0} luaFile: {fileID: 0}
luaScript: 'fungus.assert(dummycollection.stringList[1] == "hi") luaScript: 'fungus.assert(dummycollection.stringList[1] == "hi")
@ -317,7 +317,7 @@ GameObject:
- 4: {fileID: 305346651} - 4: {fileID: 305346651}
- 114: {fileID: 305346652} - 114: {fileID: 305346652}
m_Layer: 0 m_Layer: 0
m_Name: RunLua m_Name: LuaScript
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -354,7 +354,7 @@ MonoBehaviour:
repeatEveryFrame: 1 repeatEveryFrame: 1
hasFailed: 0 hasFailed: 0
executeMethods: 2 executeMethods: 2
lua: {fileID: 0} luaEnvironment: {fileID: 0}
luaFile: {fileID: 0} luaFile: {fileID: 0}
luaScript: "-- Test the timeout works in fungus.waitfor\nlocal value = false\n\nfunction luaScript: "-- Test the timeout works in fungus.waitfor\nlocal value = false\n\nfunction
fn()\n return value\nend\n\nt = fungus.time()\nfungus.waitfor(fn, 1)\nfungus.assert fn()\n return value\nend\n\nt = fungus.time()\nfungus.waitfor(fn, 1)\nfungus.assert
@ -565,7 +565,7 @@ GameObject:
- 4: {fileID: 681659774} - 4: {fileID: 681659774}
- 114: {fileID: 681659775} - 114: {fileID: 681659775}
m_Layer: 0 m_Layer: 0
m_Name: RunLua m_Name: LuaScript
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -602,7 +602,7 @@ MonoBehaviour:
repeatEveryFrame: 1 repeatEveryFrame: 1
hasFailed: 0 hasFailed: 0
executeMethods: 2 executeMethods: 2
lua: {fileID: 0} luaEnvironment: {fileID: 0}
luaFile: {fileID: 0} luaFile: {fileID: 0}
luaScript: '-- Test storing persistant data luaScript: '-- Test storing persistant data
@ -778,7 +778,7 @@ GameObject:
- 4: {fileID: 1124932172} - 4: {fileID: 1124932172}
- 114: {fileID: 1124932173} - 114: {fileID: 1124932173}
m_Layer: 0 m_Layer: 0
m_Name: RunLua m_Name: LuaScript
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -815,7 +815,7 @@ MonoBehaviour:
repeatEveryFrame: 1 repeatEveryFrame: 1
hasFailed: 0 hasFailed: 0
executeMethods: 2 executeMethods: 2
lua: {fileID: 0} luaEnvironment: {fileID: 0}
luaFile: {fileID: 0} luaFile: {fileID: 0}
luaScript: '-- Test time functions and time scaling luaScript: '-- Test time functions and time scaling
@ -934,7 +934,7 @@ GameObject:
- 4: {fileID: 1309386183} - 4: {fileID: 1309386183}
- 114: {fileID: 1309386184} - 114: {fileID: 1309386184}
m_Layer: 0 m_Layer: 0
m_Name: RunLua m_Name: LuaScript
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -971,7 +971,7 @@ MonoBehaviour:
repeatEveryFrame: 1 repeatEveryFrame: 1
hasFailed: 0 hasFailed: 0
executeMethods: 2 executeMethods: 2
lua: {fileID: 0} luaEnvironment: {fileID: 0}
luaFile: {fileID: 0} luaFile: {fileID: 0}
luaScript: '-- Test if module importing via require works luaScript: '-- Test if module importing via require works
@ -1291,7 +1291,7 @@ GameObject:
- 4: {fileID: 1738134228} - 4: {fileID: 1738134228}
- 114: {fileID: 1738134229} - 114: {fileID: 1738134229}
m_Layer: 0 m_Layer: 0
m_Name: RunLua m_Name: LuaScript
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -1328,7 +1328,7 @@ MonoBehaviour:
repeatEveryFrame: 1 repeatEveryFrame: 1
hasFailed: 0 hasFailed: 0
executeMethods: 2 executeMethods: 2
lua: {fileID: 0} luaEnvironment: {fileID: 0}
luaFile: {fileID: 0} luaFile: {fileID: 0}
luaScript: '-- Test string table localisation system luaScript: '-- Test string table localisation system
@ -1388,7 +1388,7 @@ GameObject:
- 4: {fileID: 1818482579} - 4: {fileID: 1818482579}
- 114: {fileID: 1818482580} - 114: {fileID: 1818482580}
m_Layer: 0 m_Layer: 0
m_Name: RunLua m_Name: LuaScript
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -1425,7 +1425,7 @@ MonoBehaviour:
repeatEveryFrame: 1 repeatEveryFrame: 1
hasFailed: 0 hasFailed: 0
executeMethods: 2 executeMethods: 2
lua: {fileID: 0} luaEnvironment: {fileID: 0}
luaFile: {fileID: 0} luaFile: {fileID: 0}
luaScript: '-- Test if object binding works luaScript: '-- Test if object binding works

Loading…
Cancel
Save