Browse Source

Refactored ExecuteHandler

master
Christopher 9 years ago
parent
commit
bebf66e218
  1. 46
      Assets/Fungus/Thirdparty/FungusLua/Scripts/Editor/ExecuteHandlerEditor.cs
  2. 38
      Assets/Fungus/Thirdparty/FungusLua/Scripts/ExecuteHandler.cs

46
Assets/Fungus/Thirdparty/FungusLua/Scripts/Editor/ExecuteHandlerEditor.cs vendored

@ -42,7 +42,7 @@ namespace Fungus
var executeHandler = (ExecuteHandler)target;
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PrefixLabel(new GUIContent("On Event"));
executeHandler.executeMethods = (ExecuteHandler.ExecuteMethod)EditorGUILayout.EnumMaskField(executeHandler.executeMethods,
executeHandler.ExecuteMethods = (ExecuteHandler.ExecuteMethod)EditorGUILayout.EnumMaskField(executeHandler.ExecuteMethods,
EditorStyles.popup,
GUILayout.ExpandWidth(false));
EditorGUILayout.EndHorizontal();
@ -75,36 +75,36 @@ namespace Fungus
private void DrawOptionsForAfterPeriodOfTime(ExecuteHandler executeHandler)
{
EditorGUILayout.Space();
executeHandler.executeAfterTime = EditorGUILayout.FloatField(m_GUIExecuteAfterTimeGuiContent,
executeHandler.executeAfterTime);
if (executeHandler.executeAfterTime < 0)
executeHandler.executeAfterTime = 0;
executeHandler.repeatExecuteTime = EditorGUILayout.Toggle(m_GUIRepeatExecuteTimeGuiContent,
executeHandler.repeatExecuteTime);
if (executeHandler.repeatExecuteTime)
executeHandler.ExecuteAfterTime = EditorGUILayout.FloatField(m_GUIExecuteAfterTimeGuiContent,
executeHandler.ExecuteAfterTime);
if (executeHandler.ExecuteAfterTime < 0)
executeHandler.ExecuteAfterTime = 0;
executeHandler.RepeatExecuteTime = EditorGUILayout.Toggle(m_GUIRepeatExecuteTimeGuiContent,
executeHandler.RepeatExecuteTime);
if (executeHandler.RepeatExecuteTime)
{
executeHandler.repeatEveryTime = EditorGUILayout.FloatField(m_GUIRepeatEveryTimeGuiContent,
executeHandler.repeatEveryTime);
if (executeHandler.repeatEveryTime < 0)
executeHandler.repeatEveryTime = 0;
executeHandler.RepeatEveryTime = EditorGUILayout.FloatField(m_GUIRepeatEveryTimeGuiContent,
executeHandler.RepeatEveryTime);
if (executeHandler.RepeatEveryTime < 0)
executeHandler.RepeatEveryTime = 0;
}
}
private void DrawOptionsForOnUpdate(ExecuteHandler executeHandler)
{
EditorGUILayout.Space();
executeHandler.executeAfterFrames = EditorGUILayout.IntField(m_GUIExecuteAfterFramesGuiContent,
executeHandler.executeAfterFrames);
if (executeHandler.executeAfterFrames < 1)
executeHandler.executeAfterFrames = 1;
executeHandler.repeatExecuteFrame = EditorGUILayout.Toggle(m_GUIRepeatExecuteFrameGuiContent,
executeHandler.repeatExecuteFrame);
if (executeHandler.repeatExecuteFrame)
executeHandler.ExecuteAfterFrames = EditorGUILayout.IntField(m_GUIExecuteAfterFramesGuiContent,
executeHandler.ExecuteAfterFrames);
if (executeHandler.ExecuteAfterFrames < 1)
executeHandler.ExecuteAfterFrames = 1;
executeHandler.RepeatExecuteFrame = EditorGUILayout.Toggle(m_GUIRepeatExecuteFrameGuiContent,
executeHandler.RepeatExecuteFrame);
if (executeHandler.RepeatExecuteFrame)
{
executeHandler.repeatEveryFrame = EditorGUILayout.IntField(m_GUIRepeatEveryTimeGuiContent,
executeHandler.repeatEveryFrame);
if (executeHandler.repeatEveryFrame < 1)
executeHandler.repeatEveryFrame = 1;
executeHandler.RepeatEveryFrame = EditorGUILayout.IntField(m_GUIRepeatEveryTimeGuiContent,
executeHandler.RepeatEveryFrame);
if (executeHandler.RepeatEveryFrame < 1)
executeHandler.RepeatEveryFrame = 1;
}
}
}

38
Assets/Fungus/Thirdparty/FungusLua/Scripts/ExecuteHandler.cs vendored

@ -52,15 +52,35 @@ namespace Fungus
OnCollisionStay2D = 1 << 24,
}
[SerializeField] public float executeAfterTime = 1f;
[SerializeField] public bool repeatExecuteTime = true;
[SerializeField] public float repeatEveryTime = 1f;
[SerializeField] public int executeAfterFrames = 1;
[SerializeField] public bool repeatExecuteFrame = true;
[SerializeField] public int repeatEveryFrame = 1;
[SerializeField] public bool hasFailed;
[SerializeField] public ExecuteMethod executeMethods = ExecuteMethod.Start;
[SerializeField] protected float executeAfterTime = 1f;
public float ExecuteAfterTime { get { return executeAfterTime; } set { executeAfterTime = value; } }
[SerializeField] protected bool repeatExecuteTime = true;
public bool RepeatExecuteTime { get { return repeatExecuteTime; } set { repeatExecuteTime = value; } }
[SerializeField] protected float repeatEveryTime = 1f;
public float RepeatEveryTime { get { return repeatEveryTime; } set { repeatEveryTime = value; } }
[SerializeField] protected int executeAfterFrames = 1;
public int ExecuteAfterFrames { get { return executeAfterFrames; } set { executeAfterFrames = value; } }
[SerializeField] protected bool repeatExecuteFrame = true;
public bool RepeatExecuteFrame { get { return repeatExecuteFrame; } set { repeatExecuteFrame = value; } }
[SerializeField] protected int repeatEveryFrame = 1;
public int RepeatEveryFrame { get { return repeatEveryFrame; } set { repeatEveryFrame = value; } }
[SerializeField] protected bool hasFailed;
[SerializeField] protected ExecuteMethod executeMethods = ExecuteMethod.Start;
public ExecuteMethod ExecuteMethods { get { return executeMethods; } set { executeMethods = value; } }
[Tooltip("Name of the method on a component in this gameobject to call when executing.")]
[SerializeField] protected string executeMethodName = "OnExecute";

Loading…
Cancel
Save