本文整理汇总了C#中LuaInterface.LuaFunction.BeginPCall方法的典型用法代码示例。如果您正苦于以下问题:C# LuaFunction.BeginPCall方法的具体用法?C# LuaFunction.BeginPCall怎么用?C# LuaFunction.BeginPCall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LuaInterface.LuaFunction
的用法示例。
在下文中一共展示了LuaFunction.BeginPCall方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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);
});
}
示例3: 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);
}
示例4: AudioClip_PCMSetPositionCallback
public static Delegate AudioClip_PCMSetPositionCallback(LuaFunction func)
{
AudioClip.PCMSetPositionCallback d = (param0) =>
{
int top = func.BeginPCall();
IntPtr L = func.GetLuaState();
LuaScriptMgr.Push(L, param0);
func.PCall(top, 1);
func.EndPCall(top);
};
return d;
}
示例5: Action_GameObject
public static Delegate Action_GameObject(LuaFunction func)
{
Action<GameObject> d = (param0) =>
{
int top = func.BeginPCall();
IntPtr L = func.GetLuaState();
LuaScriptMgr.Push(L, param0);
func.PCall(top, 1);
func.EndPCall(top);
};
return d;
}
示例6: Application_LogCallback
public static Delegate Application_LogCallback(LuaFunction func)
{
Application.LogCallback d = (param0, param1, param2) =>
{
int top = func.BeginPCall();
IntPtr L = func.GetLuaState();
LuaScriptMgr.Push(L, param0);
LuaScriptMgr.Push(L, param1);
LuaScriptMgr.Push(L, param2);
func.PCall(top, 3);
func.EndPCall(top);
};
return d;
}
示例7: System_Reflection_MemberFilter
public static Delegate System_Reflection_MemberFilter(LuaFunction func)
{
System.Reflection.MemberFilter d = (param0, param1) =>
{
int top = func.BeginPCall();
IntPtr L = func.GetLuaState();
LuaScriptMgr.PushObject(L, param0);
LuaScriptMgr.PushVarObject(L, param1);
func.PCall(top, 2);
object[] objs = func.PopValues(top);
func.EndPCall(top);
return (bool)objs[0];
};
return d;
}
示例8: UIEventListener_KeyCodeDelegate
public static Delegate UIEventListener_KeyCodeDelegate(LuaFunction func)
{
UIEventListener.KeyCodeDelegate d = (param0, param1) =>
{
int top = func.BeginPCall();
IntPtr L = func.GetLuaState();
LuaScriptMgr.Push(L, param0);
LuaScriptMgr.Push(L, param1);
func.PCall(top, 2);
func.EndPCall(top);
};
return d;
}
示例9: TestLuaDelegate_VoidDelegate
public static Delegate TestLuaDelegate_VoidDelegate(LuaFunction func)
{
TestLuaDelegate.VoidDelegate d = (param0) =>
{
int top = func.BeginPCall();
IntPtr L = func.GetLuaState();
LuaScriptMgr.Push(L, param0);
func.PCall(top, 1);
func.EndPCall(top);
};
return d;
}
示例10: UICenterOnChild_OnCenterCallback
public static Delegate UICenterOnChild_OnCenterCallback(LuaFunction func)
{
UICenterOnChild.OnCenterCallback d = (param0) =>
{
int top = func.BeginPCall();
IntPtr L = func.GetLuaState();
LuaScriptMgr.Push(L, param0);
func.PCall(top, 1);
func.EndPCall(top);
};
return d;
}
示例11: UIPanel_OnClippingMoved
public static Delegate UIPanel_OnClippingMoved(LuaFunction func)
{
UIPanel.OnClippingMoved d = (param0) =>
{
int top = func.BeginPCall();
IntPtr L = func.GetLuaState();
LuaScriptMgr.Push(L, param0);
func.PCall(top, 1);
func.EndPCall(top);
};
return d;
}
示例12: RectTransform_ReapplyDrivenProperties
public static Delegate RectTransform_ReapplyDrivenProperties(LuaFunction func)
{
RectTransform.ReapplyDrivenProperties d = (param0) =>
{
int top = func.BeginPCall();
IntPtr L = func.GetLuaState();
LuaScriptMgr.Push(L, param0);
func.PCall(top, 1);
func.EndPCall(top);
};
return d;
}
示例13: LuaBehaviours_LuaMethordGameObject
public static Delegate LuaBehaviours_LuaMethordGameObject(LuaFunction func)
{
LuaBehaviours.LuaMethordGameObject d = (param0, param1) =>
{
int top = func.BeginPCall();
IntPtr L = func.GetLuaState();
LuaScriptMgr.Push(L, param0);
LuaScriptMgr.Push(L, param1);
func.PCall(top, 2);
func.EndPCall(top);
};
return d;
}
示例14: Action_string_string
public static Delegate Action_string_string(LuaFunction func)
{
Action<string,string> d = (param0, param1) =>
{
int top = func.BeginPCall();
IntPtr L = func.GetLuaState();
LuaScriptMgr.Push(L, param0);
LuaScriptMgr.Push(L, param1);
func.PCall(top, 2);
func.EndPCall(top);
};
return d;
}
示例15: 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();
}
);
}
}