本文整理汇总了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);
}
示例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);
}
}
示例3: DelayDo
private static IEnumerator DelayDo(LuaFunction luafun, object arg, float time)
{
yield return new WaitForSeconds(time);
luafun.call(arg);
}
示例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();
}
示例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();
}
示例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);
}
}
}
示例7: doCoroutine
private IEnumerator doCoroutine(YieldInstruction ins, LuaFunction fn)
{
yield return ins;
fn.call();
}
示例8: DelayDo
private static IEnumerator DelayDo(LuaFunction luafun,float time,params object[] args)
{
yield return new WaitForSeconds(time);
luafun.call(args);
}
示例9: _ExecuteWhen
private IEnumerator _ExecuteWhen(object instruction,LuaFunction func,object param)
{
yield return instruction;
func.call(param);
}
示例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();
}