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


C# LuaFunction.call方法代码示例

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


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

示例1: Start

    void Start()
    {
        lua = new LuaSvr();
        self = (LuaTable)lua.start("LuaFiles/building_txt");
        //self = (LuaTable)lua.luaState.getObject("data");
        //object o = lua.luaState.getFunction("GetData").call();
        Debug.Log("table " + ((LuaTable)self[1])["name"]);

        LuaFunction dataFunction = ((LuaFunction)self["GetData"]);
        LuaTable dataTable = (LuaTable)dataFunction.call();
        LuaFunction callFunction = (LuaFunction)self["CallBack"];
        callFunction.call(222);
        //lua.luaState.getFunction("CallBack").call();
        lua.luaState.getFunction("Call").call(2);
        Debug.Log("table " + ((LuaTable)dataTable[1])["use_money"] + "   is Null " + (callFunction == null));

        LuaTable d = (LuaTable)((LuaFunction)self["GetData1"]).call();
        Debug.Log("---------------- : " + ((LuaTable)d[1])["use_money"]);
        LuaTable table2 = (LuaTable)lua.start("LuaFiles/building_txt1");

        test2 = (LuaFunction)self["test"];
        object o = test2.call(self,9,1);
        Debug.Log("add function :"+o);

        SetTransform = (LuaFunction)self["SetTransform"];
        SetTransform.call(self, tr);
        //tr.localPosition = new Vector3(2, 2, 2);
    }
开发者ID:zhaoyabo,项目名称:GameBase,代码行数:28,代码来源:TestLua.cs

示例2: 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:coder-han,项目名称:hugula,代码行数:16,代码来源:LuaHelper.cs

示例3: DelayDo

 private static IEnumerator DelayDo(LuaFunction luafun, object arg, float time)
 {
     yield return new WaitForSeconds(time);
     luafun.call(arg);
 }
开发者ID:QinFangbi,项目名称:hugula,代码行数:5,代码来源:PLua.cs

示例4: loadLuaBundle

    /// <summary>
    /// 加载lua bundle
    /// </summary>
    /// <returns></returns>
    private IEnumerator loadLuaBundle(bool domain,LuaFunction onLoadedFn)
    {
        string keyName = "";
        string luaP = CUtils.GetAssetFullPath("font.u3d");
        //Debug.Log("load lua bundle" + luaP);
        WWW luaLoader = new WWW(luaP);
        yield return luaLoader;
        if (luaLoader.error == null)
        {
			byte[] byts=CryptographHelper.Decrypt(luaLoader.bytes,DESHelper.instance.Key,DESHelper.instance.IV);
			AssetBundle item = AssetBundle.CreateFromMemoryImmediate(byts);

//            item = luaLoader.assetBundle;
#if UNITY_5
                    TextAsset[] all = item.LoadAllAssets<TextAsset>();
                    foreach (var ass in all)
                    {
                        keyName = Regex.Replace(ass.name,@"\.","");
                        //Debug.Log("cache : " + keyName);
                        luacache[keyName] = ass;
                    }
#else
            UnityEngine.Object[] all = item.LoadAll(typeof(TextAsset));
            foreach (var ass in all)
            {
                keyName = Regex.Replace(ass.name,@"\.","");
                Debug.Log(keyName + " complete");
                luacache[keyName] = ass as TextAsset;
            }
#endif
                    //Debug.Log("loaded lua bundle complete" + luaP);
//            luaLoader.assetBundle.Unload(false);
			item.Unload(false);
            luaLoader.Dispose();
        }

        DoUnity3dLua();
        if (domain)
            DoMain();

        if (onLoadedFn != null) onLoadedFn.call();
    }
开发者ID:QinFangbi,项目名称:hugula,代码行数:46,代码来源:PLua.cs

示例5: loadLuaBundle

    /// <summary>
    /// lua bundle
    /// </summary>
    /// <returns></returns>
    private IEnumerator loadLuaBundle(bool domain,LuaFunction onLoadedFn)
    {
        string keyName = "";
        string luaP = CUtils.GetAssetFullPath("font.u3d");
        WWW luaLoader = new WWW(luaP);
        yield return luaLoader;
        if (luaLoader.error == null)
        {
            byte[] byts=CryptographHelper.Decrypt(luaLoader.bytes,DESHelper.instance.Key,DESHelper.instance.IV);
            AssetBundle item = AssetBundle.CreateFromMemoryImmediate(byts);

            TextAsset[] all = item.LoadAllAssets<TextAsset>();
            foreach (var ass in all)
            {
                keyName = ass.name;
                luacache[keyName] = ass;
            }

            item.Unload(false);
            luaLoader.Dispose();
        }

        DoUnity3dLua();
        if (domain)
            DoMain();

        if (onLoadedFn != null) onLoadedFn.call();
    }
开发者ID:bobbyzhu,项目名称:hugula,代码行数:32,代码来源:PLua.cs

示例6: UnpackConfigAssetBundleFn

    /// <summary>
    /// 
    /// </summary>
    /// <param name="ab"></param>
    /// <param name="luaFn"></param>
    public static void UnpackConfigAssetBundleFn(AssetBundle ab, LuaFunction luaFn)
    {
        callBackFn = luaFn;
#if UNITY_5
        UnityEngine.Object[] all = ab.LoadAllAssets();
#else
        UnityEngine.Object[] all = ab.LoadAll();
#endif
        foreach (UnityEngine.Object i in all)
        {
            if (i is TextAsset)
            {
                TextAsset a = (TextAsset)i;
                if (callBackFn != null)
                    callBackFn.call(a.name, a.text);
            }
        }
    }     
开发者ID:QinFangbi,项目名称:hugula,代码行数:23,代码来源:FileHelper.cs

示例7: doCoroutine

    private IEnumerator doCoroutine(YieldInstruction ins, LuaFunction fn)
    {
        yield return ins;

        fn.call();
    }
开发者ID:wenhu2010,项目名称:mygame,代码行数:6,代码来源:NfSkill.cs

示例8: DelayDo

	private static IEnumerator DelayDo(LuaFunction luafun,float time,params object[] args)
    {
        yield return new WaitForSeconds(time);
		luafun.call(args);
    }
开发者ID:yuyangame,项目名称:hugula,代码行数:5,代码来源:PLua.cs

示例9: _ExecuteWhen

 private IEnumerator _ExecuteWhen(object instruction,LuaFunction func,object param)
 {
     yield return instruction;
     func.call(param);
 }
开发者ID:wlgys8,项目名称:slua_advanced,代码行数:5,代码来源:LuaCoroutine.cs

示例10: loadLuaBundle

        /// <summary>
        /// lua bundle
        /// </summary>
        /// <returns></returns>
        private IEnumerator loadLuaBundle(bool domain, LuaFunction onLoadedFn)
        {
            string keyName = "";
            string luaP = CUtils.GetAssetFullPath(Common.LUA_ASSETBUNDLE_FILENAME);
            WWW luaLoader = new WWW(luaP);
            yield return luaLoader;
            if (luaLoader.error == null)
            {
                byte[] byts = CryptographHelper.Decrypt(luaLoader.bytes, DESHelper.instance.Key, DESHelper.instance.IV);
            #if UNITY_5_0 || UNITY_5_1 || UNITY_5_2
                AssetBundle item = AssetBundle.CreateFromMemoryImmediate(byts);
            #else
                AssetBundle item = AssetBundle.LoadFromMemory(byts);
            #endif

                TextAsset[] all = item.LoadAllAssets<TextAsset>();
                foreach (var ass in all)
                {
                    keyName = ass.name;
                    SetRequire(keyName, ass);
                }

                item.Unload(true);
                luaLoader.Dispose();
            }

            if (domain)
                DoMain();

            if (onLoadedFn != null) onLoadedFn.call();
        }
开发者ID:ChaseDream2015,项目名称:hugula,代码行数:35,代码来源:PLua.cs


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