当前位置: 首页>>代码示例>>C#>>正文


C# LuaFunction.PCall方法代码示例

本文整理汇总了C#中LuaInterface.LuaFunction.PCall方法的典型用法代码示例。如果您正苦于以下问题:C# LuaFunction.PCall方法的具体用法?C# LuaFunction.PCall怎么用?C# LuaFunction.PCall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LuaInterface.LuaFunction的用法示例。


在下文中一共展示了LuaFunction.PCall方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

    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();
    }
开发者ID:RuYi51,项目名称:LuaFramework_NGUI,代码行数:28,代码来源:AccessingArray.cs

示例2: GetUIPrefab

    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);
        });
    }
开发者ID:woshihuo12,项目名称:UnityHello,代码行数:56,代码来源:GameResFactory.cs

示例3: OnCallLuaFunc

 /// <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);
 }
开发者ID:neutra,项目名称:uLuaGameFramework,代码行数:14,代码来源:LuaHelper.cs

示例4: AudioClip_PCMSetPositionCallback

 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;
 }
开发者ID:soulhez,项目名称:hugular_cstolua,代码行数:12,代码来源:DelegateFactory.cs

示例5: Action_GameObject

	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;
	}
开发者ID:Venbb,项目名称:mgame,代码行数:12,代码来源:DelegateFactory.cs

示例6: Application_LogCallback

 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;
 }
开发者ID:soulhez,项目名称:hugular_cstolua,代码行数:14,代码来源:DelegateFactory.cs

示例7: System_Reflection_MemberFilter

	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;
	}
开发者ID:Gemini2015,项目名称:uLua,代码行数:15,代码来源:DelegateFactory.cs

示例8: UIEventListener_KeyCodeDelegate

	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;
	}
开发者ID:zhlikezhz,项目名称:Game,代码行数:13,代码来源:DelegateFactory.cs

示例9: TestLuaDelegate_VoidDelegate

	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;
	}
开发者ID:neutra,项目名称:uLuaGameFramework,代码行数:12,代码来源:DelegateFactory.cs

示例10: UICenterOnChild_OnCenterCallback

	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;
	}
开发者ID:zhlikezhz,项目名称:Game,代码行数:12,代码来源:DelegateFactory.cs

示例11: UIPanel_OnClippingMoved

	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;
	}
开发者ID:zhlikezhz,项目名称:Game,代码行数:12,代码来源:DelegateFactory.cs

示例12: RectTransform_ReapplyDrivenProperties

 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;
 }
开发者ID:soulhez,项目名称:hugular_cstolua,代码行数:12,代码来源:DelegateFactory.cs

示例13: LuaBehaviours_LuaMethordGameObject

 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;
 }
开发者ID:zaojiahua,项目名称:SuperAdventure,代码行数:13,代码来源:DelegateFactory.cs

示例14: Action_string_string

	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;
	}
开发者ID:toophy,项目名称:hugular_cstolua,代码行数:13,代码来源:DelegateFactory.cs

示例15: AddClick

 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();
             }
         );
     }
 }
开发者ID:woshihuo12,项目名称:UnityHello,代码行数:18,代码来源:LuaBehaviour.cs


注:本文中的LuaInterface.LuaFunction.PCall方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。