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


C# LuaFunction.Push方法代码示例

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


在下文中一共展示了LuaFunction.Push方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例4: CallLuaFunction

 void CallLuaFunction(LuaFunction func)
 {
     func.BeginPCall();
     func.Push(listener);
     func.PCall();
     func.EndPCall();
 }
开发者ID:yuisunn,项目名称:UnityCrazy,代码行数:7,代码来源:TestDelegate.cs

示例5: GetUIEffect

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


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