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


C# SLua.LuaFunction类代码示例

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


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

    public void Init(string ip, int port, LuaFunction recvCallback)
    {
        _ip = ip;
        _port = port;
        _recvCallback = recvCallback;

        _socket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
    }
开发者ID:nottvlike,项目名称:OpenWorldGame,代码行数:8,代码来源:TcpSocket.cs

示例3: Start

	void Start () {
		svr = new LuaSvr();
		svr.init(null, () =>
		{
			self = (LuaTable)svr.start("circle/circle");
			update = (LuaFunction)self["update"];
		});
	}
开发者ID:Rubiphisto,项目名称:slua,代码行数:8,代码来源:Circle.cs

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

示例5: LoadLuaTable

        /// <summary>
        /// 加载luatable里面的request
        /// </summary>
        /// <param name="reqs"></param>
        public void LoadLuaTable(LuaTable reqs, LuaFunction groupCompleteFn)
        {
            pushGroup = true;

            foreach (var pair in reqs)
            {
                AddReqToQueue((CRequest)pair.value);
            }

            this.groupCompleteFn = groupCompleteFn;

            pushGroup = false;

            BeginQueue();
        }
开发者ID:ChaseDream2015,项目名称:hugula,代码行数:19,代码来源:LResLoader.cs

示例6: Load

    public void Load(LuaFunction func)
    {
        _callBack = func;
        if (_prefab != null)
        {
            LoadFinished();
        }

        if (_isAssetBundle)
        {
            StartLoadResource();
        }
        else
        {
            ResourceManager.Instance.StartCoroutine(StartLoadAssetBundle());
        }
    }
开发者ID:nottvlike,项目名称:OpenWorldGame,代码行数:17,代码来源:PrefabRequest.cs

示例7: CallMethod

    /**
     * Call a lua method.
     *
     * @param ref LuaFunction cFunc - The out function. If it is not null, will call it instead of look up from table by strFunc.
     * @param string strFunc - The function name.
     * @param object cParam1 - The first param.
     * @param object cParam2 - The second param.
     * @param object cParam3 - The third param.
     * @return object - The number of result.
     */
    public object CallMethod(ref LuaFunction cFunc, string strFunc, object cParam1, object cParam2, object cParam3)
    {
        if (null == m_cLuaTableOpt)
        {
            return null;
        }

        return m_cLuaTableOpt.CallMethod(ref cFunc, strFunc, cParam1, cParam2, cParam3);
    }
开发者ID:terwxqian,项目名称:2DPlatformer-SLua,代码行数:19,代码来源:YwLuaBehaviourBase.cs

示例8: DeltaConditionNode

 /// <summary>
 /// 按一定时间执行的条件节点
 /// </summary>
 /// <param name="fn">luafunction</param>
 public DeltaConditionNode(float delta,LuaFunction fn)
     : base(fn)
 {
     this.delta = delta;
 }
开发者ID:zhaoluxyz,项目名称:Hugula,代码行数:9,代码来源:DeciderNodes.cs

示例9: ConditionWaitNode

 public ConditionWaitNode(LuaFunction fn,string name)
     : base(fn,name)
 {
 }
开发者ID:zhaoluxyz,项目名称:Hugula,代码行数:4,代码来源:DeciderNodes.cs

示例10: ConditionNode

 /// <summary>
 ///  条件节点
 /// </summary>
 /// <param name="fn">条件委托 luafunction(input,output)</param>
 public ConditionNode(LuaFunction fn)
     : base()
 {
     this._fn = fn;
     _condition = null;
 }
开发者ID:zhaoluxyz,项目名称:Hugula,代码行数:10,代码来源:DeciderNodes.cs

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

示例12: LoadBundle

 /// <summary>
 /// 加载lua 打包文件
 /// </summary>
 public void LoadBundle(LuaFunction onLoadedFn)
 {
     //Debug.Log(" refresh LoadBundle ");
     StopCoroutine(loadLuaBundle(false, onLoadedFn));
     StartCoroutine(loadLuaBundle(false, onLoadedFn));
 }
开发者ID:QinFangbi,项目名称:hugula,代码行数:9,代码来源:PLua.cs

示例13: OnDestroy

 void OnDestroy()
 {
     if (onDestroyFn != null) onDestroyFn.call();
     updateFn = null;
     lua = null;
     _instance = null;
     luacache.Clear();
 }
开发者ID:yuyangame,项目名称:hugula,代码行数:8,代码来源:PLua.cs

示例14: RemoveAllEvents

 public void RemoveAllEvents()
 {
     onAllCompleteFn = null;
     onProgressFn = null;
     onSharedCompleteFn = null;
     onCacheFn = null;
     onSharedErrFn = null;
     onAssetBundleCompleteFn = null;
     onAssetBundleErrFn = null;
 }
开发者ID:tenvick,项目名称:hugula,代码行数:10,代码来源:LResLoader.cs

示例15: ClearPrefab

    public void ClearPrefab()
    {
        _prefab = null;
        _callBack = null;

        if (_dependenciesPath != null)
        {
            _dependenciesPath.Clear();
            _dependenciesPath = null;
        }
    }
开发者ID:nottvlike,项目名称:OpenWorldGame,代码行数:11,代码来源:PrefabRequest.cs


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