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


C# LuaInterface.LuaFunction类代码示例

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


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

示例1: CreateDelegate

    public static Delegate CreateDelegate(Type t, LuaFunction func, LuaTable self)
    {
        DelegateValue Create = null;

        if (!dict.TryGetValue(t, out Create))
        {
            throw new LuaException(string.Format("Delegate {0} not register", LuaMisc.GetTypeName(t)));
        }

        if (func != null)
        {
            LuaState state = func.GetLuaState();
            LuaDelegate target = state.GetLuaDelegate(func, self);

            if (target != null)
            {
                return Delegate.CreateDelegate(t, target, target.method);
            }
            else
            {
                Delegate d = Create(func, self, true);
                target = d.Target as LuaDelegate;
                state.AddLuaDelegate(target, func, self);
                return d;
            }
        }

        return Create(func, self, true);
    }
开发者ID:zhangxiangsong,项目名称:some_work,代码行数:29,代码来源:DelegateFactory.cs

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

示例3: Button

        public int Button(
            int formHandle,
            string caption,
            LuaFunction clickEvent,
            int? x = null,
            int? y = null,
            int? width = null,
            int? height = null)
        {
            var form = GetForm(formHandle);
            if (form == null)
            {
                return 0;
            }

            var button = new LuaButton();
            SetText(button, caption);
            form.Controls.Add(button);
            form.ControlEvents.Add(new LuaWinform.LuaEvent(button.Handle, clickEvent));

            if (x.HasValue && y.HasValue)
            {
                SetLocation(button, x.Value, y.Value);
            }

            if (width.HasValue && height.HasValue)
            {
                SetSize(button, width.Value, height.Value);
            }

            return (int)button.Handle;
        }
开发者ID:cas1993per,项目名称:bizhawk,代码行数:32,代码来源:EmuLuaLibrary.Forms.cs

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

示例5: callFunction

 /*
  * Calls the provided function with the provided parameters
  */
 public static object callFunction(LuaFunction function,object[] args,Type[] returnTypes,object[] inArgs,int[] outArgs)
 {
     // args is the return array of arguments, inArgs is the actual array
     // of arguments passed to the function (with in parameters only), outArgs
     // has the positions of out parameters
     object returnValue;
     int iRefArgs;
     object[] returnValues=function.call(inArgs,returnTypes);
     if(returnTypes[0] == typeof(void))
     {
         returnValue=null;
         iRefArgs=0;
     }
     else
     {
         returnValue=returnValues[0];
         iRefArgs=1;
     }
     for(int i=0;i<outArgs.Length;i++)
     {
         args[outArgs[i]]=returnValues[iRefArgs];
         iRefArgs++;
     }
     return returnValue;
 }
开发者ID:rilihong,项目名称:luaplus51-all,代码行数:28,代码来源:MethodWrapper.cs

示例6: Add

 public Delegate Add(LuaFunction function)
 {
     Delegate handler = CodeGeneration.Instance.GetDelegate(this.eventInfo.EventHandlerType, function);
     this.eventInfo.AddEventHandler(this.target, handler);
     this.pendingEvents.Add(handler, this);
     return handler;
 }
开发者ID:Evangileon,项目名称:LuaInterface,代码行数:7,代码来源:RegisterEventHandler.cs

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

示例8: Action

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

示例9: SafeRelease

 private void SafeRelease(ref LuaFunction func)
 {
     if (func != null)
     {
         func.Dispose();
         func = null;
     }
 }
开发者ID:woshihuo12,项目名称:UnityHello,代码行数:8,代码来源:LuaBehaviour.cs

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

示例11: CreateTimer

 public static STimer CreateTimer(int end, LuaFunction funct)
 {
     STimer newTimer = new STimer();
     newTimer.currentTime = 0;
     newTimer.endTime = end;
     newTimer.funct = funct;
     return newTimer;
 }
开发者ID:Vbitz,项目名称:CodeCrusade,代码行数:8,代码来源:Timer.cs

示例12: add

 public static void add(string name, string uni, LuaFunction funct)
 {
     if (!table.ContainsKey(name))
     {
         table.Add(name, new Dictionary<string, LuaFunction>());
     }
     table[name].Add(uni, funct);
 }
开发者ID:Vbitz,项目名称:CodeCrusade,代码行数:8,代码来源:Hook.cs

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

示例14: InitLua

 public void InitLua()
 {
     LuaScriptMgr.Instance.DoFile(PathMod.LuaUI + this.gameObject.name);
     m_AwakeFunc = GetLuaFunction("Awake");
     m_UpdateFunc = GetLuaFunction("Update");
     m_LateUpdateFunc = GetLuaFunction("LateUpdate");
     m_FixedUpdateFunc = GetLuaFunction("FixedUpdate");
     m_LevelLoaded = GetLuaFunction("OnLevelLoaded");
 }
开发者ID:yuisunn,项目名称:UnityCrazy,代码行数:9,代码来源:LuaBehaviour.cs

示例15: Dispose

        public void Dispose(bool disposeManagedResources)
        {
            if (!beDisposed)
            {
                beDisposed = true;

                //if (_call != null)
                //{
                //    _call.Dispose(disposeManagedResources);
                //    _call = null;
                //}

                if (_add != null)
                {
                    _add.Dispose(disposeManagedResources);
                    _add = null;
                }

                if (_remove != null)
                {
                    _remove.Dispose(disposeManagedResources);
                    _remove = null;
                }

                if (self != null)
                {
                    self.Dispose(disposeManagedResources);
                }

                Clear();
            }
        }
开发者ID:zlanr,项目名称:tolua,代码行数:32,代码来源:LuaEvent.cs


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