public static Delegate CreateDelegate(Type t, LuaFunction func, LuaTable self)
    {
        DelegateValue Create = null;

        if (!dict.TryGetValue(t, out Create))
        {
            throw new LuaException(string.Format("Delegate {0} not register", LuaMisc.GetTypeName(t)));
        }

        if (func != null)
        {
            LuaState state = func.GetLuaState();
            LuaDelegate target = state.GetLuaDelegate(func, self);

            if (target != null)
            {
                return Delegate.CreateDelegate(t, target, target.method);
            }
            else
            {
                Delegate d = Create(func, self, true);
                target = d.Target as LuaDelegate;
                state.AddLuaDelegate(target, func, self);
                return d;
            }
        }

        return Create(func, self, true);
    }
Esempio n. 2
0
 public static Delegate AudioClip_PCMSetPositionCallback(LuaFunction func)
 {
     AudioClip.PCMSetPositionCallback d = (param0) =>
     {
         int top = func.BeginPCall();
         IntPtr L = func.GetLuaState();
         LuaScriptMgr.Push(L, param0);
         func.PCall(top, 1);
         func.EndPCall(top);
     };
     return d;
 }
Esempio n. 3
0
	public static Delegate Action_GameObject(LuaFunction func)
	{
		Action<GameObject> d = (param0) =>
		{
			int top = func.BeginPCall();
			IntPtr L = func.GetLuaState();
			LuaScriptMgr.Push(L, param0);
			func.PCall(top, 1);
			func.EndPCall(top);
		};
		return d;
	}
Esempio n. 4
0
 public static Delegate Application_LogCallback(LuaFunction func)
 {
     Application.LogCallback d = (param0, param1, param2) =>
     {
         int top = func.BeginPCall();
         IntPtr L = func.GetLuaState();
         LuaScriptMgr.Push(L, param0);
         LuaScriptMgr.Push(L, param1);
         LuaScriptMgr.Push(L, param2);
         func.PCall(top, 3);
         func.EndPCall(top);
     };
     return d;
 }
Esempio n. 5
0
	public static Delegate System_Reflection_MemberFilter(LuaFunction func)
	{
		System.Reflection.MemberFilter d = (param0, param1) =>
		{
			int top = func.BeginPCall();
			IntPtr L = func.GetLuaState();
			LuaScriptMgr.PushObject(L, param0);
			LuaScriptMgr.PushVarObject(L, param1);
			func.PCall(top, 2);
			object[] objs = func.PopValues(top);
			func.EndPCall(top);
			return (bool)objs[0];
		};
		return d;
	}
 static public Delegate Create(LuaFunction func)
 {
     if (func != null)
     {
         LuaState luaState = func.GetLuaState();
         // 是否有保存
         LuaDelegate luaDelegate = luaState.GetLuaDelegate(func);
         if (luaDelegate != null)
         {
             return(Delegate.CreateDelegate(typeof(T), luaDelegate, luaDelegate.method));
         }
         Delegate d = _Create(func, null, false);
         luaDelegate        = d.Target as LuaDelegate;
         luaDelegate.method = d.Method;
         luaState.AddLuaDelegate(luaDelegate, func);
         return(d);
     }
     return(_Create(null, null, false));
 }
Esempio n. 7
0
    public static Delegate RemoveDelegate(Delegate obj, LuaFunction func)
    {
        LuaState state = func.GetLuaState();
        Delegate[] ds = obj.GetInvocationList();

        for (int i = 0; i < ds.Length; i++)
        {
            LuaDelegate ld = ds[i].Target as LuaDelegate;

            if (ld != null && ld.func == func)
            {
                obj = Delegate.Remove(obj, ds[i]);
                state.DelayDispose(ld.func);
                break;
            }
        }

        return obj;
    }
	public static Delegate TestLuaDelegate_VoidDelegate(LuaFunction func)
	{
		TestLuaDelegate.VoidDelegate d = (param0) =>
		{
			int top = func.BeginPCall();
			IntPtr L = func.GetLuaState();
			LuaScriptMgr.Push(L, param0);
			func.PCall(top, 1);
			func.EndPCall(top);
		};
		return d;
	}
Esempio n. 9
0
	public static Delegate UIEventListener_KeyCodeDelegate(LuaFunction func)
	{
		UIEventListener.KeyCodeDelegate d = (param0, param1) =>
		{
			int top = func.BeginPCall();
			IntPtr L = func.GetLuaState();
			LuaScriptMgr.Push(L, param0);
			LuaScriptMgr.Push(L, param1);
			func.PCall(top, 2);
			func.EndPCall(top);
		};
		return d;
	}
Esempio n. 10
0
	public static Delegate UIPanel_OnClippingMoved(LuaFunction func)
	{
		UIPanel.OnClippingMoved d = (param0) =>
		{
			int top = func.BeginPCall();
			IntPtr L = func.GetLuaState();
			LuaScriptMgr.Push(L, param0);
			func.PCall(top, 1);
			func.EndPCall(top);
		};
		return d;
	}
Esempio n. 11
0
	public static Delegate UICenterOnChild_OnCenterCallback(LuaFunction func)
	{
		UICenterOnChild.OnCenterCallback d = (param0) =>
		{
			int top = func.BeginPCall();
			IntPtr L = func.GetLuaState();
			LuaScriptMgr.Push(L, param0);
			func.PCall(top, 1);
			func.EndPCall(top);
		};
		return d;
	}
Esempio n. 12
0
	public static Delegate Action_float_object(LuaFunction func)
	{
		Action<float,object> d = (param0, param1) =>
		{
			int top = func.BeginPCall();
			IntPtr L = func.GetLuaState();
			LuaScriptMgr.Push(L, param0);
			LuaScriptMgr.PushVarObject(L, param1);
			func.PCall(top, 2);
			func.EndPCall(top);
		};
		return d;
	}
Esempio n. 13
0
	public static Delegate Action_CTransport_CRequest(LuaFunction func)
	{
		Action<CTransport,CRequest> d = (param0, param1) =>
		{
			int top = func.BeginPCall();
			IntPtr L = func.GetLuaState();
			LuaScriptMgr.Push(L, param0);
			LuaScriptMgr.PushObject(L, param1);
			func.PCall(top, 2);
			func.EndPCall(top);
		};
		return d;
	}
Esempio n. 14
0
	public static Delegate UIWidget_OnPostFillCallback(LuaFunction func)
	{
		UIWidget.OnPostFillCallback d = (param0, param1, param2, param3, param4) =>
		{
			int top = func.BeginPCall();
			IntPtr L = func.GetLuaState();
			LuaScriptMgr.Push(L, param0);
			LuaScriptMgr.Push(L, param1);
			LuaScriptMgr.PushObject(L, param2);
			LuaScriptMgr.PushObject(L, param3);
			LuaScriptMgr.PushObject(L, param4);
			func.PCall(top, 5);
			func.EndPCall(top);
		};
		return d;
	}
Esempio n. 15
0
	public static Delegate Localization_LoadFunction(LuaFunction func)
	{
		Localization.LoadFunction d = (param0) =>
		{
			int top = func.BeginPCall();
			IntPtr L = func.GetLuaState();
			LuaScriptMgr.Push(L, param0);
			func.PCall(top, 1);
			object[] objs = func.PopValues(top);
			func.EndPCall(top);
			return (byte[])objs[0];
		};
		return d;
	}
Esempio n. 16
0
	public static Delegate UICamera_GetTouchCallback(LuaFunction func)
	{
		UICamera.GetTouchCallback d = (param0) =>
		{
			int top = func.BeginPCall();
			IntPtr L = func.GetLuaState();
			LuaScriptMgr.Push(L, param0);
			func.PCall(top, 1);
			object[] objs = func.PopValues(top);
			func.EndPCall(top);
			return (UICamera.Touch)objs[0];
		};
		return d;
	}
Esempio n. 17
0
	public static Delegate UICamera_ObjectDelegate(LuaFunction func)
	{
		UICamera.ObjectDelegate d = (param0, param1) =>
		{
			int top = func.BeginPCall();
			IntPtr L = func.GetLuaState();
			LuaScriptMgr.Push(L, param0);
			LuaScriptMgr.Push(L, param1);
			func.PCall(top, 2);
			func.EndPCall(top);
		};
		return d;
	}
Esempio n. 18
0
 public static Delegate LuaBehaviours_LuaMethordGameObject(LuaFunction func)
 {
     LuaBehaviours.LuaMethordGameObject d = (param0, param1) =>
     {
         int top = func.BeginPCall();
         IntPtr L = func.GetLuaState();
         LuaScriptMgr.Push(L, param0);
         LuaScriptMgr.Push(L, param1);
         func.PCall(top, 2);
         func.EndPCall(top);
     };
     return d;
 }
Esempio n. 19
0
	public static Delegate Action_Vector3_Hashtable(LuaFunction func)
	{
		Action<Vector3,Hashtable> d = (param0, param1) =>
		{
			int top = func.BeginPCall();
			IntPtr L = func.GetLuaState();
			LuaScriptMgr.Push(L, param0);
			LuaScriptMgr.PushObject(L, param1);
			func.PCall(top, 2);
			func.EndPCall(top);
		};
		return d;
	}
Esempio n. 20
0
 //    public static Delegate TestLuaDelegate_VoidDelegate(LuaFunction func)
 //    {
 //        TestLuaDelegate.VoidDelegate d = (param0) =>
 //        {
 //            int top = func.BeginPCall();
 //            IntPtr L = func.GetLuaState();
 //            LuaScriptMgr.Push(L, param0);
 //            func.PCall(top, 1);
 //            func.EndPCall(top);
 //        };
 //        return d;
 //    }
 public static Delegate Camera_CameraCallback(LuaFunction func)
 {
     Camera.CameraCallback d = (param0) =>
     {
         int top = func.BeginPCall();
         IntPtr L = func.GetLuaState();
         LuaScriptMgr.Push(L, param0);
         func.PCall(top, 1);
         func.EndPCall(top);
     };
     return d;
 }
Esempio n. 21
0
	public static Delegate CompleteHandle(LuaFunction func)
	{
		CompleteHandle d = (param0) =>
		{
			int top = func.BeginPCall();
			IntPtr L = func.GetLuaState();
			LuaScriptMgr.PushObject(L, param0);
			func.PCall(top, 1);
			func.EndPCall(top);
		};
		return d;
	}
Esempio n. 22
0
 public static Delegate RectTransform_ReapplyDrivenProperties(LuaFunction func)
 {
     RectTransform.ReapplyDrivenProperties d = (param0) =>
     {
         int top = func.BeginPCall();
         IntPtr L = func.GetLuaState();
         LuaScriptMgr.Push(L, param0);
         func.PCall(top, 1);
         func.EndPCall(top);
     };
     return d;
 }
Esempio n. 23
0
	public static Delegate UIInput_OnValidate(LuaFunction func)
	{
		UIInput.OnValidate d = (param0, param1, param2) =>
		{
			int top = func.BeginPCall();
			IntPtr L = func.GetLuaState();
			LuaScriptMgr.Push(L, param0);
			LuaScriptMgr.Push(L, param1);
			LuaScriptMgr.Push(L, param2);
			func.PCall(top, 3);
			object[] objs = func.PopValues(top);
			func.EndPCall(top);
			return (char)objs[0];
		};
		return d;
	}
Esempio n. 24
0
	public static Delegate UIToggle_Validate(LuaFunction func)
	{
		UIToggle.Validate d = (param0) =>
		{
			int top = func.BeginPCall();
			IntPtr L = func.GetLuaState();
			LuaScriptMgr.Push(L, param0);
			func.PCall(top, 1);
			object[] objs = func.PopValues(top);
			func.EndPCall(top);
			return (bool)objs[0];
		};
		return d;
	}
Esempio n. 25
0
	public static Delegate Action_string_string(LuaFunction func)
	{
		Action<string,string> d = (param0, param1) =>
		{
			int top = func.BeginPCall();
			IntPtr L = func.GetLuaState();
			LuaScriptMgr.Push(L, param0);
			LuaScriptMgr.Push(L, param1);
			func.PCall(top, 2);
			func.EndPCall(top);
		};
		return d;
	}
Esempio n. 26
0
	public static Delegate Comparison_Transform(LuaFunction func)
	{
		Comparison<Transform> d = (param0, param1) =>
		{
			int top = func.BeginPCall();
			IntPtr L = func.GetLuaState();
			LuaScriptMgr.Push(L, param0);
			LuaScriptMgr.Push(L, param1);
			func.PCall(top, 2);
			object[] objs = func.PopValues(top);
			func.EndPCall(top);
			return (int)objs[0];
		};
		return d;
	}
Esempio n. 27
0
	public static Delegate Action_CHighway_HighwayEventArg(LuaFunction func)
	{
		Action<CHighway,HighwayEventArg> d = (param0, param1) =>
		{
			int top = func.BeginPCall();
			IntPtr L = func.GetLuaState();
			LuaScriptMgr.PushObject(L, param0);
			LuaScriptMgr.PushObject(L, param1);
			func.PCall(top, 2);
			func.EndPCall(top);
		};
		return d;
	}