Ejemplo n.º 1
0
 public void OnSelectedIndexChanged(MoonSharp.Interpreter.Closure handler)
 {
     SelectedIndexChanged += () =>
     {
         handler.Call();
     };
 }
Ejemplo n.º 2
0
 public void OnTextEntered(MoonSharp.Interpreter.Closure handler)
 {
     TextEntered += (s) =>
     {
         handler.Call(s);
     };
 }
Ejemplo n.º 3
0
    public virtual GenericAction AddAction(string eventName, MoonSharp.Interpreter.Closure closure)
    {
        GenericAction action = new GenericAction(closure);

        EnsureEventExists(eventName);
        OnActionAdded(eventName, action);
        actions[eventName].Add(action);
        return(action);
    }
Ejemplo n.º 4
0
    public virtual void AddAction(string eventName, MoonSharp.Interpreter.Closure closure)
    {
        Action action = new Action(closure);

        actions.Add(eventName, action);
    }
Ejemplo n.º 5
0
 internal void RegisterClosure(Closure closure)
 {
     _childClosures.Add(new WeakReference(closure));
 }
Ejemplo n.º 6
0
 internal DynValue Recycle(Processor mainProcessor, Closure closure)
 {
     Type = CoroutineType.Recycled;
     return(m_Processor.Coroutine_Recycle(mainProcessor, closure));
 }
Ejemplo n.º 7
0
 // MoonSharp.Interpreter.Closure
 public void OnClick(MoonSharp.Interpreter.Closure callback)
 {
     buttonComponent.onClick.AddListener(() => callback.Call());
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Asynchronously calls this function with the specified args
 ///
 /// This method is supported only on .NET 4.x and .NET 4.x PCL targets.
 /// </summary>
 /// <param name="function">The function.</param>
 /// <param name="args">The arguments to pass to the function.</param>
 /// <returns></returns>
 /// <exception cref="System.ArgumentException">Thrown if function is not of DataType.Function</exception>
 public static Task <DynValue> CallAsync(this Closure function, params DynValue[] args)
 {
     return(ExecAsync(() => function.Call(args)));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Asynchronously calls this function with the specified args
 ///
 /// This method is supported only on .NET 4.x and .NET 4.x PCL targets.
 /// </summary>
 /// <param name="function">The function.</param>
 /// <returns></returns>
 /// <exception cref="System.ArgumentException">Thrown if function is not of DataType.Function</exception>
 public static Task <DynValue> CallAsync(this Closure function)
 {
     return(ExecAsync(() => function.Call()));
 }