From 882b6ef65e11e9f9c22dfa0d76e7937742fb5690 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Fri, 1 Apr 2016 11:53:40 +0100 Subject: [PATCH] Renamed RunLua to LuaScript --- .../{RunLua.prefab => LuaScript.prefab} | 4 +-- ...nLua.prefab.meta => LuaScript.prefab.meta} | 0 .../{RunLuaEditor.cs => LuaScriptEditor.cs} | 18 ++++++------ ...Editor.cs.meta => LuaScriptEditor.cs.meta} | 4 +-- Assets/Fungus/Lua/Scripts/Editor/MenuItems.cs | 4 +-- .../Lua/Scripts/{RunLua.cs => LuaScript.cs} | 10 +++---- .../{RunLua.cs.meta => LuaScript.cs.meta} | 0 Assets/FungusExamples/Lua/Narrative.unity | 5 ++-- Assets/Tests/Lua/FungusTests.unity | 20 ++++++------- Assets/Tests/Lua/LuaTests.unity | 28 +++++++++---------- 10 files changed, 47 insertions(+), 46 deletions(-) rename Assets/Fungus/Lua/Resources/Prefabs/{RunLua.prefab => LuaScript.prefab} (96%) rename Assets/Fungus/Lua/Resources/Prefabs/{RunLua.prefab.meta => LuaScript.prefab.meta} (100%) rename Assets/Fungus/Lua/Scripts/Editor/{RunLuaEditor.cs => LuaScriptEditor.cs} (92%) rename Assets/Fungus/Lua/Scripts/Editor/{RunLuaEditor.cs.meta => LuaScriptEditor.cs.meta} (76%) rename Assets/Fungus/Lua/Scripts/{RunLua.cs => LuaScript.cs} (97%) rename Assets/Fungus/Lua/Scripts/{RunLua.cs.meta => LuaScript.cs.meta} (100%) diff --git a/Assets/Fungus/Lua/Resources/Prefabs/RunLua.prefab b/Assets/Fungus/Lua/Resources/Prefabs/LuaScript.prefab similarity index 96% rename from Assets/Fungus/Lua/Resources/Prefabs/RunLua.prefab rename to Assets/Fungus/Lua/Resources/Prefabs/LuaScript.prefab index de5aca02..48fef9d1 100644 --- a/Assets/Fungus/Lua/Resources/Prefabs/RunLua.prefab +++ b/Assets/Fungus/Lua/Resources/Prefabs/LuaScript.prefab @@ -10,7 +10,7 @@ GameObject: - 4: {fileID: 449874} - 114: {fileID: 11472914} m_Layer: 0 - m_Name: RunLua + m_Name: LuaScript m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -47,7 +47,7 @@ MonoBehaviour: repeatEveryFrame: 1 hasFailed: 0 executeMethods: 2 - fungusScript: {fileID: 0} + luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: runAsCoroutine: 1 diff --git a/Assets/Fungus/Lua/Resources/Prefabs/RunLua.prefab.meta b/Assets/Fungus/Lua/Resources/Prefabs/LuaScript.prefab.meta similarity index 100% rename from Assets/Fungus/Lua/Resources/Prefabs/RunLua.prefab.meta rename to Assets/Fungus/Lua/Resources/Prefabs/LuaScript.prefab.meta diff --git a/Assets/Fungus/Lua/Scripts/Editor/RunLuaEditor.cs b/Assets/Fungus/Lua/Scripts/Editor/LuaScriptEditor.cs similarity index 92% rename from Assets/Fungus/Lua/Scripts/Editor/RunLuaEditor.cs rename to Assets/Fungus/Lua/Scripts/Editor/LuaScriptEditor.cs index 908629e9..ab112e11 100644 --- a/Assets/Fungus/Lua/Scripts/Editor/RunLuaEditor.cs +++ b/Assets/Fungus/Lua/Scripts/Editor/LuaScriptEditor.cs @@ -11,8 +11,8 @@ using UnityEngine; namespace Fungus { - [CustomEditor(typeof(RunLua))] - public class RunLuaEditor : Editor + [CustomEditor(typeof(LuaScript))] + public class LuaScriptEditor : Editor { private readonly DropDownControl m_ComparerDropDown = new DropDownControl(); @@ -32,7 +32,7 @@ namespace Fungus protected List luaFiles = new List(); - public RunLuaEditor() + public LuaScriptEditor() { m_ComparerDropDown.convertForButtonLabel = type => type.Name; m_ComparerDropDown.convertForGUIContent = type => type.Name; @@ -69,20 +69,20 @@ namespace Fungus public override void OnInspectorGUI() { - var fungusInvoke = (RunLua)target; + var fungusInvoke = (LuaScript)target; EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(new GUIContent("On Event")); - fungusInvoke.executeMethods = (RunLua.ExecuteMethod)EditorGUILayout.EnumMaskField(fungusInvoke.executeMethods, + fungusInvoke.executeMethods = (LuaScript.ExecuteMethod)EditorGUILayout.EnumMaskField(fungusInvoke.executeMethods, EditorStyles.popup, GUILayout.ExpandWidth(false)); EditorGUILayout.EndHorizontal(); - if (fungusInvoke.IsExecuteMethodSelected(RunLua.ExecuteMethod.AfterPeriodOfTime)) + if (fungusInvoke.IsExecuteMethodSelected(LuaScript.ExecuteMethod.AfterPeriodOfTime)) { DrawOptionsForAfterPeriodOfTime(fungusInvoke); } - if (fungusInvoke.IsExecuteMethodSelected(RunLua.ExecuteMethod.Update)) + if (fungusInvoke.IsExecuteMethodSelected(LuaScript.ExecuteMethod.Update)) { DrawOptionsForOnUpdate(fungusInvoke); } @@ -158,7 +158,7 @@ namespace Fungus serializedObject.ApplyModifiedProperties(); } - private void DrawOptionsForAfterPeriodOfTime(RunLua script) + private void DrawOptionsForAfterPeriodOfTime(LuaScript script) { EditorGUILayout.Space(); script.executeAfterTime = EditorGUILayout.FloatField(m_GUIExecuteAfterTimeGuiContent, @@ -176,7 +176,7 @@ namespace Fungus } } - private void DrawOptionsForOnUpdate(RunLua script) + private void DrawOptionsForOnUpdate(LuaScript script) { EditorGUILayout.Space(); script.executeAfterFrames = EditorGUILayout.IntField(m_GUIExecuteAfterFramesGuiContent, diff --git a/Assets/Fungus/Lua/Scripts/Editor/RunLuaEditor.cs.meta b/Assets/Fungus/Lua/Scripts/Editor/LuaScriptEditor.cs.meta similarity index 76% rename from Assets/Fungus/Lua/Scripts/Editor/RunLuaEditor.cs.meta rename to Assets/Fungus/Lua/Scripts/Editor/LuaScriptEditor.cs.meta index 56159ecf..6e1b0b5e 100644 --- a/Assets/Fungus/Lua/Scripts/Editor/RunLuaEditor.cs.meta +++ b/Assets/Fungus/Lua/Scripts/Editor/LuaScriptEditor.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 28e6892c983f34f42a3d6d03b5d199e7 -timeCreated: 1455233798 +guid: 8b84800ca6a0e4a86b651c01e3857c77 +timeCreated: 1459507008 licenseType: Free MonoImporter: serializedVersion: 2 diff --git a/Assets/Fungus/Lua/Scripts/Editor/MenuItems.cs b/Assets/Fungus/Lua/Scripts/Editor/MenuItems.cs index 5f7cbe84..c0315388 100644 --- a/Assets/Fungus/Lua/Scripts/Editor/MenuItems.cs +++ b/Assets/Fungus/Lua/Scripts/Editor/MenuItems.cs @@ -20,10 +20,10 @@ namespace Fungus SpawnPrefab("Prefabs/LuaBindings", false); } - [MenuItem("Tools/Fungus/Create/Run Lua", false, 2002)] + [MenuItem("Tools/Fungus/Create/Lua Script", false, 2002)] static void CreateFungusInvoke() { - SpawnPrefab("Prefabs/RunLua", false); + SpawnPrefab("Prefabs/LuaScript", false); } [MenuItem("Tools/Fungus/Create/Lua File", false, 2100)] diff --git a/Assets/Fungus/Lua/Scripts/RunLua.cs b/Assets/Fungus/Lua/Scripts/LuaScript.cs similarity index 97% rename from Assets/Fungus/Lua/Scripts/RunLua.cs rename to Assets/Fungus/Lua/Scripts/LuaScript.cs index 99eacb32..5635fe38 100644 --- a/Assets/Fungus/Lua/Scripts/RunLua.cs +++ b/Assets/Fungus/Lua/Scripts/LuaScript.cs @@ -14,7 +14,7 @@ namespace Fungus { [Serializable] - public class RunLua : MonoBehaviour, IRunLuaConfigurator + public class LuaScript : MonoBehaviour, ILuaScriptConfigurator { [Flags] public enum ExecuteMethod @@ -116,7 +116,7 @@ namespace Fungus } // Cache a descriptive name to use in Lua error messages - friendlyName = GetPath(transform) + ".RunLua"; + friendlyName = GetPath(transform) + ".LuaScript"; Execute(ExecuteMethod.Start); @@ -323,11 +323,11 @@ namespace Fungus public float TimeExecuteStartAfter { set { executeAfterTime = value; } } public float TimeExecuteRepeatFrequency { set { repeatEveryTime = value; } } public bool TimeExecuteRepeat { set { repeatExecuteTime = value; } } - public RunLua Component { get { return this; } } + public LuaScript Component { get { return this; } } #endregion } - public interface IRunLuaConfigurator + public interface ILuaScriptConfigurator { /// /// 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 /// bool TimeExecuteRepeat { set; } - RunLua Component { get; } + LuaScript Component { get; } } } diff --git a/Assets/Fungus/Lua/Scripts/RunLua.cs.meta b/Assets/Fungus/Lua/Scripts/LuaScript.cs.meta similarity index 100% rename from Assets/Fungus/Lua/Scripts/RunLua.cs.meta rename to Assets/Fungus/Lua/Scripts/LuaScript.cs.meta diff --git a/Assets/FungusExamples/Lua/Narrative.unity b/Assets/FungusExamples/Lua/Narrative.unity index b1797200..e4eca926 100644 --- a/Assets/FungusExamples/Lua/Narrative.unity +++ b/Assets/FungusExamples/Lua/Narrative.unity @@ -627,7 +627,7 @@ GameObject: - 4: {fileID: 519026841} - 114: {fileID: 519026840} m_Layer: 0 - m_Name: RunLua + m_Name: LuaScript m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -653,7 +653,7 @@ MonoBehaviour: repeatEveryFrame: 1 hasFailed: 0 executeMethods: 2 - fungusScript: {fileID: 0} + luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: "fungus.setsaydialog(saydialog)\nfungus.setmenudialog(menudialog)\n\nfunction start()\n fungus.say \"Select an option\"\n\n fungus.menu(\"Option A\", optiona)\n @@ -1788,6 +1788,7 @@ MonoBehaviour: - key: menudialog obj: {fileID: 1851713324} component: {fileID: 1851713325} + boundTypes: [] --- !u!4 &1265440902 Transform: m_ObjectHideFlags: 0 diff --git a/Assets/Tests/Lua/FungusTests.unity b/Assets/Tests/Lua/FungusTests.unity index c1c1fbb8..b9af531c 100644 --- a/Assets/Tests/Lua/FungusTests.unity +++ b/Assets/Tests/Lua/FungusTests.unity @@ -1066,7 +1066,7 @@ GameObject: - 4: {fileID: 116891409} - 114: {fileID: 116891410} m_Layer: 0 - m_Name: RunLua + m_Name: LuaScript m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -2486,7 +2486,7 @@ GameObject: - 4: {fileID: 448016417} - 114: {fileID: 448016418} m_Layer: 0 - m_Name: RunLua + m_Name: LuaScript m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -2869,7 +2869,7 @@ GameObject: - 4: {fileID: 508615589} - 114: {fileID: 508615590} m_Layer: 0 - m_Name: RunLua + m_Name: LuaScript m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -2923,7 +2923,7 @@ GameObject: - 4: {fileID: 511430245} - 114: {fileID: 511430246} m_Layer: 0 - m_Name: RunLua + m_Name: LuaScript m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -4244,7 +4244,7 @@ GameObject: - 4: {fileID: 851718692} - 114: {fileID: 851718693} m_Layer: 0 - m_Name: RunLua + m_Name: LuaScript m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -7479,7 +7479,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!114 &1647235603 MonoBehaviour: m_ObjectHideFlags: 0 @@ -7527,7 +7527,7 @@ GameObject: - 4: {fileID: 1652835881} - 114: {fileID: 1652835882} m_Layer: 0 - m_Name: RunLua + m_Name: LuaScript m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -8580,7 +8580,7 @@ GameObject: - 4: {fileID: 1845639738} - 114: {fileID: 1845639739} m_Layer: 0 - m_Name: RunLua + m_Name: LuaScript m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -9265,7 +9265,7 @@ GameObject: - 4: {fileID: 2049586852} - 114: {fileID: 2049586853} m_Layer: 0 - m_Name: RunLua + m_Name: LuaScript m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -9593,7 +9593,7 @@ GameObject: - 4: {fileID: 2090444089} - 114: {fileID: 2090444090} m_Layer: 0 - m_Name: RunLua + m_Name: LuaScript m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 diff --git a/Assets/Tests/Lua/LuaTests.unity b/Assets/Tests/Lua/LuaTests.unity index 7afc69d2..14b40b98 100644 --- a/Assets/Tests/Lua/LuaTests.unity +++ b/Assets/Tests/Lua/LuaTests.unity @@ -188,7 +188,7 @@ GameObject: - 4: {fileID: 113453956} - 114: {fileID: 113453957} m_Layer: 0 - m_Name: RunLua + m_Name: LuaScript m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -226,7 +226,7 @@ MonoBehaviour: repeatEveryFrame: 1 hasFailed: 0 executeMethods: 2 - lua: {fileID: 0} + luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: 'fungus.assert(dummycollection.stringList[1] == "hi") @@ -317,7 +317,7 @@ GameObject: - 4: {fileID: 305346651} - 114: {fileID: 305346652} m_Layer: 0 - m_Name: RunLua + m_Name: LuaScript m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -354,7 +354,7 @@ MonoBehaviour: repeatEveryFrame: 1 hasFailed: 0 executeMethods: 2 - lua: {fileID: 0} + luaEnvironment: {fileID: 0} luaFile: {fileID: 0} 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 @@ -565,7 +565,7 @@ GameObject: - 4: {fileID: 681659774} - 114: {fileID: 681659775} m_Layer: 0 - m_Name: RunLua + m_Name: LuaScript m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -602,7 +602,7 @@ MonoBehaviour: repeatEveryFrame: 1 hasFailed: 0 executeMethods: 2 - lua: {fileID: 0} + luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: '-- Test storing persistant data @@ -778,7 +778,7 @@ GameObject: - 4: {fileID: 1124932172} - 114: {fileID: 1124932173} m_Layer: 0 - m_Name: RunLua + m_Name: LuaScript m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -815,7 +815,7 @@ MonoBehaviour: repeatEveryFrame: 1 hasFailed: 0 executeMethods: 2 - lua: {fileID: 0} + luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: '-- Test time functions and time scaling @@ -934,7 +934,7 @@ GameObject: - 4: {fileID: 1309386183} - 114: {fileID: 1309386184} m_Layer: 0 - m_Name: RunLua + m_Name: LuaScript m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -971,7 +971,7 @@ MonoBehaviour: repeatEveryFrame: 1 hasFailed: 0 executeMethods: 2 - lua: {fileID: 0} + luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: '-- Test if module importing via require works @@ -1291,7 +1291,7 @@ GameObject: - 4: {fileID: 1738134228} - 114: {fileID: 1738134229} m_Layer: 0 - m_Name: RunLua + m_Name: LuaScript m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -1328,7 +1328,7 @@ MonoBehaviour: repeatEveryFrame: 1 hasFailed: 0 executeMethods: 2 - lua: {fileID: 0} + luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: '-- Test string table localisation system @@ -1388,7 +1388,7 @@ GameObject: - 4: {fileID: 1818482579} - 114: {fileID: 1818482580} m_Layer: 0 - m_Name: RunLua + m_Name: LuaScript m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -1425,7 +1425,7 @@ MonoBehaviour: repeatEveryFrame: 1 hasFailed: 0 executeMethods: 2 - lua: {fileID: 0} + luaEnvironment: {fileID: 0} luaFile: {fileID: 0} luaScript: '-- Test if object binding works