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


C# LuaFunction.Call方法代码示例

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


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

示例1: OnCreatePanel

        IEnumerator OnCreatePanel(string name, LuaFunction func = null)
        {
            yield return StartCoroutine(Initialize());

            string assetName = name + "Panel";
            // Load asset from assetBundle.
            string abName = name.ToLower() + AppConst.ExtName;
            AssetBundleAssetOperation request = ResourceManager.LoadAssetAsync(abName, assetName, typeof(GameObject));
            if (request == null) yield break;
            yield return StartCoroutine(request);

            // Get the asset.
            GameObject prefab = request.GetAsset<GameObject>();

            if (Parent.FindChild(name) != null || prefab == null) {
                yield break;
            }
            GameObject go = Instantiate(prefab) as GameObject;
            go.name = assetName;
            go.layer = LayerMask.NameToLayer("Default");
            go.transform.SetParent(Parent);
            go.transform.localScale = Vector3.one;
            go.transform.localPosition = Vector3.zero;
            go.AddComponent<LuaBehaviour>();

            if (func != null) func.Call(go);
            Debug.LogWarning("CreatePanel::>> " + name + " " + prefab);
        }
开发者ID:huangxuping,项目名称:SimpleFramework_UGUI,代码行数:28,代码来源:PanelManager.cs

示例2: CreatePanel

        /// <summary>
        /// ������壬������Դ������
        /// </summary>
        /// <param name="type"></param>
        public void CreatePanel(string name, LuaFunction func = null)
        {
            string assetName = name + "Panel";
            string abName = name.ToLower() + AppConst.ExtName;

            ResManager.LoadPrefab(abName, assetName, delegate(UnityEngine.Object[] objs) {
                if (objs.Length == 0) return;
                // Get the asset.
                GameObject prefab = objs[0] as GameObject;

                if (Parent.FindChild(name) != null || prefab == null) {
                    return;
                }
                GameObject go = Instantiate(prefab) as GameObject;
                go.name = assetName;
                go.layer = LayerMask.NameToLayer("Default");
                go.transform.SetParent(Parent);
                go.transform.localScale = Vector3.one;
                go.transform.localPosition = Vector3.zero;
                go.AddComponent<LuaBehaviour>();

                if (func != null) func.Call(go);
                Debug.LogWarning("CreatePanel::>> " + name + " " + prefab);
            });
        }
开发者ID:yh1094632455,项目名称:StriveGame,代码行数:29,代码来源:PanelManager.cs

示例3: 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

示例4: AddClick

 /// <summary>
 /// 添加单击事件
 /// </summary>
 public void AddClick(GameObject go, LuaFunction luafunc) {
     if (go == null) return;
     UIEventListener.Get(go).onClick = delegate(GameObject o) {
         luafunc.Call(go);
         buttons.Add(luafunc);
     };
 }
开发者ID:zh423328,项目名称:RunAway,代码行数:10,代码来源:LuaBehaviour.cs

示例5: UnityEngine_Events_UnityAction

	public static Delegate UnityEngine_Events_UnityAction(LuaFunction func)
	{
		UnityEngine.Events.UnityAction d = () =>
		{
			func.Call();
		};
		return d;
	}
开发者ID:Gemini2015,项目名称:uLua,代码行数:8,代码来源:DelegateFactory.cs

示例6: Action

 public static Delegate Action(LuaFunction func)
 {
     Action d = () =>
     {
         func.Call();
     };
     return d;
 }
开发者ID:soulhez,项目名称:hugular_cstolua,代码行数:8,代码来源:DelegateFactory.cs

示例7: AddClick

 /// <summary>
 /// 添加单击事件
 /// </summary>
 public void AddClick(GameObject go, LuaFunction luafunc) {
     if (go == null) return;
     buttons.Add(luafunc);
     go.GetComponent<Button>().onClick.AddListener(
         delegate() {
             luafunc.Call(go);
         }
     );
 }
开发者ID:fanyc,项目名称:LuaFramework_UGUI,代码行数:12,代码来源:LuaBehaviour.cs

示例8: AddClick

 /// <summary>
 /// 添加单击事件
 /// </summary>
 public void AddClick(string button, LuaFunction luafunc) {
     Transform to = trans.Find(button);
     if (to == null) return;
     GameObject go = to.gameObject;
     UIEventListener.Get(go).onClick = delegate(GameObject o) {
         luafunc.Call(go);
         buttons.Add(luafunc);
     };
 }
开发者ID:xq48799220,项目名称:SimpleFramework_NGUI,代码行数:12,代码来源:LuaBehaviour.cs

示例9: ForeachChild

 /// <summary>
 /// 
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="eachFn"></param>
 public static void ForeachChild(GameObject parent, LuaFunction eachFn)
 {
     Transform pr=parent.transform;
     int count = pr.childCount;
     Transform child = null;
     for (int i = 0; i < count; i++)
     {
         child = pr.GetChild(i);
         eachFn.Call(i, child.gameObject);
     }
 }
开发者ID:soulhez,项目名称:hugular_cstolua,代码行数:16,代码来源:LuaHelper.cs

示例10: AddClick

 /// <summary>
 /// 添加单击事件
 /// </summary>
 public void AddClick(string button, LuaFunction luafunc)
 {
     Transform to = trans.Find(button);
     if (to == null) return;
     buttons.Add(luafunc);
     GameObject go = to.gameObject;
     go.GetComponent<Button>().onClick.AddListener(
         delegate() {
             luafunc.Call(go);
         }
     );
 }
开发者ID:nxminh,项目名称:SimpleFramework_UGUI,代码行数:15,代码来源:BaseLua.cs

示例11: AddClick

        /// <summary>
        /// 添加单击事件
        /// </summary>
        public void AddClick(GameObject go, LuaFunction luafunc) {
            if (go == null || luafunc == null) return;
			if (buttons.ContainsKey (go.name)) {
				Debug.LogWarning ("Already Registered :" + go.name + " click event");
				RemoveClick (go);
			}
            buttons.Add(go.name, luafunc);
            go.GetComponent<Button>().onClick.AddListener(
                delegate() {
                    luafunc.Call(go);
                }
            );
        }
开发者ID:liangxiegame,项目名称:QFramework,代码行数:16,代码来源:QLuaBehaviour.cs

示例12: CallLuaFunction

 public void CallLuaFunction(LuaFunction func, Object[] args)
 {
     try
     {
         if (args != null)
         {
             func.Call(args);
         }
         else
         {
             func.Call();
         }
         m_luaState.DoString("io.flush()");
     }
     catch (LuaException e)
     {
         PrintError(e);
     }
     catch (Exception e)
     {
         PrintError(e);
     }
 }
开发者ID:elefantstudio-se,项目名称:funked,代码行数:23,代码来源:LuaManager.cs

示例13: OnLoadAsset

        IEnumerator OnLoadAsset(string abname, string assetName, LuaFunction func) {
            // Load asset from assetBundle.
            string abName = abname.ToLower() + AppConst.ExtName;
            AssetBundleAssetOperation request = ResourceManager.LoadAssetAsync(abName, assetName, typeof(GameObject));
            if (request == null) yield break;
            yield return StartCoroutine(request);

            // Get the asset.
            GameObject prefab = request.GetAsset<GameObject>();
            if (func != null) {
                func.Call(prefab);
                func.Dispose();
                func = null;
            }
        }
开发者ID:fanyc,项目名称:LuaFramework_UGUI,代码行数:15,代码来源:ResourceManager.cs

示例14: OnComplete

 public static void OnComplete(Tweener tweener, LuaFunction func)
 {
     tweener.OnComplete(() =>
     {
         try
         {
             func.Call();
         }
         catch (Exception e)
         {
             Debug.LogError(e);
         }
         func.Dispose();
         func = null;
     });
 }
开发者ID:kensong1194717296,项目名称:FairyGUI-unity,代码行数:16,代码来源:TweenUtils.cs

示例15: Start

	// Use this for initialization
	void Start () {
        LuaScriptMgr mgr = new LuaScriptMgr();
        
        mgr.DoString(script);

        // Get the function object
        func = mgr.GetLuaFunction("luaFunc");

        //有gc alloc
        object[] r = func.Call(123456);        
        print(r[0]);

        // no gc alloc
        int num = CallFunc();
        print(num);
	}
开发者ID:neutra,项目名称:uLuaGameFramework,代码行数:17,代码来源:CallLuaFunction_02.cs


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