本文整理汇总了C#中LuaInterface.LuaFunction类的典型用法代码示例。如果您正苦于以下问题:C# LuaFunction类的具体用法?C# LuaFunction怎么用?C# LuaFunction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LuaFunction类属于LuaInterface命名空间,在下文中一共展示了LuaFunction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: 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
示例16: 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
示例17: RemoveHook
public static void RemoveHook(string _Event, LuaFunction _Function)
{
if (Events.ContainsKey(_Event.ToString()))
{
Events[_Event.ToString()].Remove(_Function);
}
if (debugHooks)
Console.WriteLine("[LuaManager] Removed hook: " + _Event);
}
开发者ID:eickegao,项目名称:MilkShake,代码行数:10,代码来源:ScriptHooks.cs
示例18: LuaEvent
//LuaFunction _call = null;
public LuaEvent(LuaTable table)
{
self = table;
luaState = table.GetLuaState();
self.AddRef();
_add = self.RawGetLuaFunction("Add");
_remove = self.RawGetLuaFunction("Remove");
//_call = self.RawGetLuaFunction("__call");
}
开发者ID:benbon,项目名称:tolua,代码行数:12,代码来源:LuaEvent.cs
示例19: OnCallLuaFunc
/// <summary>
/// pbc/pblua函数回调
/// </summary>
/// <param name="func"></param>
public static void OnCallLuaFunc(LuaStringBuffer data, LuaFunction func) {
byte[] buffer = data.buffer;
if (func != null) {
LuaScriptMgr mgr = AppFacade.Instance.GetManager<LuaScriptMgr>(ManagerName.Lua);
int oldTop = func.BeginPCall();
LuaDLL.lua_pushlstring(mgr.lua.L, buffer, buffer.Length);
if (func.PCall(oldTop, 1)) func.EndPCall(oldTop);
}
Debug.LogWarning("OnCallLuaFunc buffer:>>" + buffer + " lenght:>>" + buffer.Length);
}
开发者ID:neutra,项目名称:uLuaGameFramework,代码行数:14,代码来源:LuaHelper.cs
示例20: CreateDelegate
public static Delegate CreateDelegate(Type t, LuaFunction func)
{
DelegateValue create = null;
if (!dict.TryGetValue(t, out create))
{
Debugger.LogError("Delegate {0} not register", t.FullName);
return null;
}
return create(func);
}
开发者ID:Venbb,项目名称:mgame,代码行数:11,代码来源:DelegateFactory.cs
注:本文中的LuaInterface.LuaFunction类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论