EndPCall() public method

public EndPCall ( ) : void
return void
    void Start()
    {
        lua = new LuaState();
        lua.Start();
        lua.DoString(script, "AccessingArray.cs");

        int[] array = { 1, 2, 3, 4, 5};
        func = lua.GetFunction("TestArray");

        func.BeginPCall();
        func.Push(array);
        func.PCall();
        double arg1 = func.CheckNumber();
        string arg2 = func.CheckString();
        bool arg3 = func.CheckBoolean();
        Debugger.Log("return is {0} {1} {2}", arg1, arg2, arg3);
        func.EndPCall();

        //转换一下类型,避免可变参数拆成多个参数传递
        object[] objs = func.Call((object)array);

        if (objs != null)
        {
            Debugger.Log("return is {0} {1} {2}", objs[0], objs[1], objs[2]);
        }

        lua.CheckTop();
    }
示例#2
0
    public void GetUIPrefab(string assetName, Transform parent, LuaTable luaTable, LuaFunction luaCallBack)
    {
        if (mResManager == null) return;

        string tmpAssetName = assetName;
        if (GameSetting.DevelopMode)
        {
            tmpAssetName = "UIPrefab/" + assetName;
        }
        mResManager.LoadPrefab(assetName + GameSetting.ExtName, tmpAssetName, delegate(UnityEngine.Object[] objs)
        {
            if (objs.Length == 0) return;
            GameObject prefab = objs[0] as GameObject;
            if (prefab == null)
            {
                return;
            }
            GameObject go = UnityEngine.GameObject.Instantiate(prefab) as GameObject;
            go.name = assetName;
            go.layer = LayerMask.NameToLayer("UI");

            Vector3 anchorPos = Vector3.zero;
            Vector2 sizeDel = Vector2.zero;
            Vector3 scale = Vector3.one;

            RectTransform rtTr = go.GetComponent<RectTransform>();
            if (rtTr != null)
            {
                anchorPos = rtTr.anchoredPosition;
                sizeDel = rtTr.sizeDelta;
                scale = rtTr.localScale;
            }

            go.transform.SetParent(parent, false);

            if (rtTr != null)
            {
                rtTr.anchoredPosition = anchorPos;
                rtTr.sizeDelta = sizeDel;
                rtTr.localScale = scale;
            }

            LuaBehaviour tmpBehaviour = go.AddComponent<LuaBehaviour>();
            tmpBehaviour.Init(luaTable);

            if (luaCallBack != null)
            {
                luaCallBack.BeginPCall();
                luaCallBack.Push(go);
                luaCallBack.PCall();
                luaCallBack.EndPCall();
            }
            Debug.Log("CreatePanel::>> " + assetName + " " + prefab);
            //mUIList.Add(go);
        });
    }
示例#3
0
 /// <summary>
 /// pbc/pblua函数回调
 /// </summary>
 /// <param name="func"></param>
 public static void OnCallLuaFunc(LuaStringBuffer data, LuaFunction func) {
     byte[] buffer = data.buffer;
     if (func != null) {
         LuaScriptMgr mgr = AppFacade.Instance.GetManager<LuaScriptMgr>(ManagerName.Lua);
         int oldTop = func.BeginPCall();
         LuaDLL.lua_pushlstring(mgr.lua.L, buffer, buffer.Length);
         if (func.PCall(oldTop, 1)) func.EndPCall(oldTop);
     }
     Debug.LogWarning("OnCallLuaFunc buffer:>>" + buffer + " lenght:>>" + buffer.Length);
 }
示例#4
0
    private void SendHeartBeat()
    {
        if (m_luaSendHeartBeatFunc == null)
        {
            // SendHeartBeat
            return;
        }

        m_luaSendHeartBeatFunc.BeginPCall();
        m_luaSendHeartBeatFunc.PCall();
        m_luaSendHeartBeatFunc.EndPCall();
    }
示例#5
0
    public void Read(PackageIn packageIn)
    {
        if (null != readFunc)
        {
            readFunc.BeginPCall();
            readFunc.PushObject(packageIn);
            readFunc.PCall();
            readFunc.EndPCall();
        }

        //LuaManager.instance.CallFunction("Network.OnRead", packageIn);
    }
 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;
 }
示例#7
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;
	}
 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;
 }
示例#9
0
    private string GetOpcodeName(int _opcode)
    {
        if (m_luaGetOpcodeNameFunc == null)
        {
            return(string.Empty);
        }
        m_luaGetOpcodeNameFunc.BeginPCall();
        m_luaGetOpcodeNameFunc.Push(_opcode);
        m_luaGetOpcodeNameFunc.PCall();
        string t_res = m_luaGetOpcodeNameFunc.CheckString();

        m_luaGetOpcodeNameFunc.EndPCall();
        return(t_res);
    }
示例#10
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;
	}
示例#11
0
    private void DistributePacket(int _opcode, byte[] _bytes)
    {
        Debug.Log("received socket proto " + GetOpcodeName(_opcode) + " 0x" + _opcode.ToString("X4"));

        if (m_luaDistributePacketFunc == null)
        {
            // DistributePacket
            return;
        }

        m_luaDistributePacketFunc.BeginPCall();
        m_luaDistributePacketFunc.Push(_opcode);
        m_luaDistributePacketFunc.Push(new LuaInterface.LuaByteBuffer(_bytes));
        m_luaDistributePacketFunc.PCall();
        m_luaDistributePacketFunc.EndPCall();
    }
示例#12
0
    private void ReconnectEvt(bool _connected)
    {
        if (_connected)
        {
            m_pulseSendCount = 0;
        }

        if (m_luaReconnectFunc == null)
        {
            // ReconnectServer
            return;
        }

        m_luaReconnectFunc.BeginPCall();
        m_luaReconnectFunc.Push(_connected);
        m_luaReconnectFunc.PCall();
        m_luaReconnectFunc.EndPCall();
    }
示例#13
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;
	}
示例#14
0
 void CallLuaFunction(LuaFunction func)
 {
     func.BeginPCall();
     func.Push(listener);
     func.PCall();
     func.EndPCall();
 }
示例#15
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;
 }
示例#16
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;
	}
示例#17
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;
	}
示例#18
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;
	}
示例#19
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;
	}
示例#20
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;
	}
示例#21
0
 public void AddClick(GameObject go, LuaFunction luafunc)
 {
     if (!CheckValid()) return;
     if (go == null || luafunc == null) return;
     if (!mButtonCallbacks.ContainsKey(go.name))
     {
         mButtonCallbacks.Add(go.name, luafunc);
         go.GetComponent<Button>().onClick.AddListener(
             delegate()
             {
                 luafunc.BeginPCall();
                 luafunc.Push(go);
                 luafunc.PCall();
                 luafunc.EndPCall();
             }
         );
     }
 }
示例#22
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;
	}
示例#23
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;
	}
示例#24
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;
	}
示例#25
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;
	}
示例#26
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;
 }
示例#27
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;
	}
示例#28
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;
	}
示例#29
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;
	}
示例#30
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;
 }
示例#31
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;
	}
示例#32
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;
	}
示例#33
0
 //获取UI特效
 public void GetUIEffect(string effname, LuaFunction luaCallBack)
 {
     GetEffectObj(effname, (Obj) =>
     {
         if (Obj != null)
         {
             mUIEffectsList.Add(Obj);
         }
         if (luaCallBack != null)
         {
             luaCallBack.BeginPCall();
             luaCallBack.Push(Obj);
             luaCallBack.PCall();
             luaCallBack.EndPCall();
         }
     });
 }
示例#34
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;
	}
示例#35
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;
	}