static int _m_RemoveChildren(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); FairyGUI.GTreeNode gen_to_be_invoked = (FairyGUI.GTreeNode)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)) { int _beginIndex = LuaAPI.xlua_tointeger(L, 2); int _endIndex = LuaAPI.xlua_tointeger(L, 3); gen_to_be_invoked.RemoveChildren(_beginIndex, _endIndex); return(0); } if (gen_param_count == 2 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)) { int _beginIndex = LuaAPI.xlua_tointeger(L, 2); gen_to_be_invoked.RemoveChildren(_beginIndex); return(0); } if (gen_param_count == 1) { gen_to_be_invoked.RemoveChildren( ); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to FairyGUI.GTreeNode.RemoveChildren!")); }
static int __CreateInstance(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); try { if (LuaAPI.lua_gettop(L) == 1) { xc.ui.ugui.TweenCircleAnchoredPosition __cl_gen_ret = new xc.ui.ugui.TweenCircleAnchoredPosition(); translator.Push(L, __cl_gen_ret); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to xc.ui.ugui.TweenCircleAnchoredPosition constructor!")); }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 1) { DCET.Model.CoroutineLockQueueType gen_ret = new DCET.Model.CoroutineLockQueueType(); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to DCET.Model.CoroutineLockQueueType constructor!")); }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 1) { XLua.CSObjectWrap.DCETModelSessionIdleCheckerComponentLoadSystemWrap gen_ret = new XLua.CSObjectWrap.DCETModelSessionIdleCheckerComponentLoadSystemWrap(); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to XLua.CSObjectWrap.DCETModelSessionIdleCheckerComponentLoadSystemWrap constructor!")); }
static int _m_UrlEncode_xlua_st_(RealStatePtr L) { try { { string str = LuaAPI.lua_tostring(L, 1); string __cl_gen_ret = HttpRequest.UrlEncode(str); LuaAPI.lua_pushstring(L, __cl_gen_ret); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 1) { XLua.CSObjectWrap.XLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapFairyGUIStageWrapWrapWrapWrap gen_ret = new XLua.CSObjectWrap.XLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapFairyGUIStageWrapWrapWrapWrap(); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to XLua.CSObjectWrap.XLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapFairyGUIStageWrapWrapWrapWrap constructor!")); }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 1) { UnityEngine.Behaviour __cl_gen_ret = new UnityEngine.Behaviour(); translator.Push(L, __cl_gen_ret); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Behaviour constructor!")); }
static int __CreateInstance(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); try { if (LuaAPI.lua_gettop(L) == 1) { HttpRequest __cl_gen_ret = new HttpRequest(); translator.Push(L, __cl_gen_ret); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to HttpRequest constructor!")); }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 1) { CutSceneManager gen_ret = new CutSceneManager(); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to CutSceneManager constructor!")); }
static int _m_ToString(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.Ray gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked); int gen_param_count = LuaAPI.lua_gettop(L); if(gen_param_count == 1) { string gen_ret = gen_to_be_invoked.ToString( ); LuaAPI.lua_pushstring(L, gen_ret); translator.UpdateUnityEngineRay(L, 1, gen_to_be_invoked); return 1; } if(gen_param_count == 2&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)) { string _format = LuaAPI.lua_tostring(L, 2); string gen_ret = gen_to_be_invoked.ToString( _format ); LuaAPI.lua_pushstring(L, gen_ret); translator.UpdateUnityEngineRay(L, 1, gen_to_be_invoked); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Ray.ToString!"); }
static int _m_Equals(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.Quaternion gen_to_be_invoked; translator.Get(L, 1, out gen_to_be_invoked); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 2 && translator.Assignable <object>(L, 2)) { object _other = translator.GetObject(L, 2, typeof(object)); bool gen_ret = gen_to_be_invoked.Equals( _other); LuaAPI.lua_pushboolean(L, gen_ret); translator.UpdateUnityEngineQuaternion(L, 1, gen_to_be_invoked); return(1); } if (gen_param_count == 2 && translator.Assignable <UnityEngine.Quaternion>(L, 2)) { UnityEngine.Quaternion _other; translator.Get(L, 2, out _other); bool gen_ret = gen_to_be_invoked.Equals( _other); LuaAPI.lua_pushboolean(L, gen_ret); translator.UpdateUnityEngineQuaternion(L, 1, gen_to_be_invoked); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Quaternion.Equals!")); }
static int _m_SetLookRotation(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.Quaternion gen_to_be_invoked; translator.Get(L, 1, out gen_to_be_invoked); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 2 && translator.Assignable <UnityEngine.Vector3>(L, 2)) { UnityEngine.Vector3 _view; translator.Get(L, 2, out _view); gen_to_be_invoked.SetLookRotation( _view); translator.UpdateUnityEngineQuaternion(L, 1, gen_to_be_invoked); return(0); } if (gen_param_count == 3 && translator.Assignable <UnityEngine.Vector3>(L, 2) && translator.Assignable <UnityEngine.Vector3>(L, 3)) { UnityEngine.Vector3 _view; translator.Get(L, 2, out _view); UnityEngine.Vector3 _up; translator.Get(L, 3, out _up); gen_to_be_invoked.SetLookRotation( _view, _up); translator.UpdateUnityEngineQuaternion(L, 1, gen_to_be_invoked); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Quaternion.SetLookRotation!")); }
internal object[] popValues(RealStatePtr L,int oldTop) { int newTop=LuaAPI.lua_gettop(L); if(oldTop==newTop) { return null; } else { ArrayList returnValues=new ArrayList(); for(int i=oldTop+1;i<=newTop;i++) { returnValues.Add(GetObject(L,i)); } LuaAPI.lua_settop(L,oldTop); return returnValues.ToArray(); } }
public static int DelegateConstructor(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Type type = getType(L, translator, 1); if (type == null || !typeof(Delegate).IsAssignableFrom(type)) { return(LuaAPI.luaL_error(L, "delegate constructor: #1 argument must be a Delegate's type")); } translator.PushAny(L, translator.GetObject(L, 2, type)); return(1); } catch (Exception e) { return(LuaAPI.luaL_error(L, "c# exception in delegate constructor: " + e)); } }
public static int DelegateCall(RealStatePtr L) #endif { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); object objDelegate = translator.FastGetCSObj(L, 1); if (objDelegate == null || !(objDelegate is Delegate)) { return(LuaAPI.luaL_error(L, "trying to invoke a value that is not delegate nor callable")); } return(translator.methodWrapsCache.GetDelegateWrap(objDelegate.GetType())(L)); } catch (Exception e) { return(LuaAPI.luaL_error(L, "c# exception in DelegateCall:" + e)); } }
static Type getType(RealStatePtr L, ObjectTranslator translator, int idx) { if (LuaAPI.lua_type(L, idx) == LuaTypes.LUA_TTABLE) { LuaTable tbl; translator.Get(L, idx, out tbl); return tbl.Get<Type>("UnderlyingSystemType"); } else if (LuaAPI.lua_type(L, idx) == LuaTypes.LUA_TSTRING) { string className = LuaAPI.lua_tostring(L, idx); return translator.FindType(className); } else { return null; } }
public T Cast <T>() { var L = luaEnv.L; var translator = luaEnv.translator; #if THREAD_SAFE || HOTFIX_ENABLE lock (luaEnv.luaEnvLock) { #endif push(L); T ret = (T)translator.GetObject(L, -1, typeof(T)); LuaAPI.lua_pop(luaEnv.L, 1); return(ret); #if THREAD_SAFE || HOTFIX_ENABLE } #endif }
internal void createFunctionMetatable(RealStatePtr L) { LuaAPI.lua_newtable(L); LuaAPI.xlua_pushasciistring(L,"__gc"); LuaAPI.lua_pushstdcallcfunction(L,metaFunctions.GcMeta); LuaAPI.lua_rawset(L,-3); LuaAPI.lua_pushlightuserdata(L, LuaAPI.xlua_tag()); LuaAPI.lua_pushnumber(L, 1); LuaAPI.lua_rawset(L, -3); LuaAPI.lua_pushvalue(L, -1); int type_id = LuaAPI.luaL_ref(L, LuaIndexes.LUA_REGISTRYINDEX); LuaAPI.lua_pushnumber(L, type_id); LuaAPI.xlua_rawseti(L, -2, 1); LuaAPI.lua_pop(L, 1); typeIdMap.Add(typeof(LuaCSFunction), type_id); }
static int _m_FileMD5_xlua_st_(RealStatePtr L) { try { { string _filePath = LuaAPI.lua_tostring(L, 1); string gen_ret = DCETRuntime.MD5Helper.FileMD5( _filePath); LuaAPI.lua_pushstring(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _e_TestEvent(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); int __gen_param_count = LuaAPI.lua_gettop(L); Tutorial.DrivenClass __cl_gen_to_be_invoked = (Tutorial.DrivenClass)translator.FastGetCSObj(L, 1); try { System.Action __gen_delegate = translator.GetDelegate <System.Action>(L, 3); if (__gen_delegate == null) { return(LuaAPI.luaL_error(L, "#3 need System.Action!")); } if (__gen_param_count == 3) { System.IntPtr strlen; System.IntPtr str = LuaAPI.lua_tolstring(L, 2, out strlen); if (str != System.IntPtr.Zero && strlen.ToInt32() == 1) { byte op = System.Runtime.InteropServices.Marshal.ReadByte(str); if (op == (byte)'+') { __cl_gen_to_be_invoked.TestEvent += __gen_delegate; return(0); } if (op == (byte)'-') { __cl_gen_to_be_invoked.TestEvent -= __gen_delegate; return(0); } } } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } LuaAPI.luaL_error(L, "invalid arguments to Tutorial.DrivenClass.TestEvent!"); return(0); }
static int __CreateInstance(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); try { if (LuaAPI.lua_gettop(L) == 1) { translator.Push(L, default(UnityEngine.DrivenRectTransformTracker)); return 1; } } catch(System.Exception __gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + __gen_e); } return LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.DrivenRectTransformTracker constructor!"); }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 2 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)) { string _configKey = LuaAPI.lua_tostring(L, 2); var gen_ret = new UnityEngine.RemoteConfigSettings(_configKey); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.RemoteConfigSettings constructor!")); }
public static int ImportGenericType(RealStatePtr L) { try { int top = LuaAPI.lua_gettop(L); if (top < 2) { return(LuaAPI.luaL_error(L, "import generic type need at lease 2 arguments")); } ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); string className = LuaAPI.lua_tostring(L, 1); if (className.EndsWith("<>")) { className = className.Substring(0, className.Length - 2); } Type genericDef = translator.FindType(className + "`" + (top - 1)); if (genericDef == null || !genericDef.IsGenericTypeDefinition()) { LuaAPI.lua_pushnil(L); } else { Type[] typeArguments = new Type[top - 1]; for (int i = 2; i <= top; i++) { typeArguments[i - 2] = getType(L, translator, i); if (typeArguments[i - 2] == null) { return(LuaAPI.luaL_error(L, "param need a type")); } } Type genericInc = genericDef.MakeGenericType(typeArguments); translator.GetTypeId(L, genericInc); translator.PushAny(L, genericInc); } return(1); } catch (System.Exception e) { return(LuaAPI.luaL_error(L, "c# exception in xlua.import_type:" + e)); } }
public bool TryDelayWrapLoader(RealStatePtr L, Type type) { if (loaded_types.ContainsKey(type)) return true; loaded_types.Add(type, true); LuaAPI.luaL_newmetatable(L, type.FullName); //先建一个metatable,因为加载过程可能会需要用到 LuaAPI.lua_pop(L, 1); Action<RealStatePtr> loader; int top = LuaAPI.lua_gettop(L); if (delayWrap.TryGetValue(type, out loader)) { delayWrap.Remove(type); loader(L); } else { Utils.ReflectionWrap(L, type); #if NOT_GEN_WARNING #if !XLUA_GENERAL UnityEngine.Debug.LogWarning(string.Format("{0} not gen, using reflection instead", type)); #else System.Console.WriteLine(string.Format("Warning: {0} not gen, using reflection instead", type)); #endif #endif } if (top != LuaAPI.lua_gettop(L)) { throw new Exception("top change, before:" + top + ", after:" + LuaAPI.lua_gettop(L)); } foreach (var nested_type in type.GetNestedTypes()) { if ((!nested_type.IsAbstract && typeof(Delegate).IsAssignableFrom(nested_type)) || nested_type.IsGenericTypeDefinition) { continue; } TryDelayWrapLoader(L, nested_type); } return true; }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 2 && translator.Assignable <FairyGUI.GObject>(L, 2)) { FairyGUI.GObject _owner = (FairyGUI.GObject)translator.GetObject(L, 2, typeof(FairyGUI.GObject)); FairyGUI.GearDisplay2 gen_ret = new FairyGUI.GearDisplay2(_owner); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to FairyGUI.GearDisplay2 constructor!")); }
static int _m_LoadPrefab(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityMMO.ResMgr gen_to_be_invoked = (UnityMMO.ResMgr)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if(gen_param_count == 4&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.Action<UnityEngine.GameObject>>(L, 4)) { string _path = LuaAPI.lua_tostring(L, 2); string _storePrefabName = LuaAPI.lua_tostring(L, 3); System.Action<UnityEngine.GameObject> _callBack = translator.GetDelegate<System.Action<UnityEngine.GameObject>>(L, 4); gen_to_be_invoked.LoadPrefab( _path, _storePrefabName, _callBack ); return 0; } if(gen_param_count == 3&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING)) { string _path = LuaAPI.lua_tostring(L, 2); string _storePrefabName = LuaAPI.lua_tostring(L, 3); gen_to_be_invoked.LoadPrefab( _path, _storePrefabName ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return LuaAPI.luaL_error(L, "invalid arguments to UnityMMO.ResMgr.LoadPrefab!"); }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 1) { translator.Push(L, default(UnityEngine.TextGenerationSettings)); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.TextGenerationSettings constructor!"); }
static int _m_GetInstance_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); { XLuaFramework.ResourceManager gen_ret = XLuaFramework.ResourceManager.GetInstance( ); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
public static int XLuaPrivateAccessible(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Type type = getType(L, translator, 1); ; if (type == null) { return LuaAPI.luaL_error(L, "xlua.private_accessible, can not find c# type"); } Utils.MakePrivateAccessible(L, type); return 0; } catch (Exception e) { return LuaAPI.luaL_error(L, "c# exception in xlua.private_accessible: " + e); } }
void pushPrimitive(RealStatePtr L, object o) { if (o is sbyte || o is byte || o is short || o is ushort || o is int) { int i = Convert.ToInt32(o); LuaAPI.xlua_pushinteger(L, i); } else if (o is uint) { LuaAPI.xlua_pushuint(L, (uint)o); } else if (o is float || o is double) { double d = Convert.ToDouble(o); LuaAPI.lua_pushnumber(L, d); } else if (o is IntPtr) { LuaAPI.lua_pushlightuserdata(L, (IntPtr)o); } else if (o is char) { LuaAPI.xlua_pushinteger(L, (char)o); } else if (o is long) { LuaAPI.lua_pushint64(L, Convert.ToInt64(o)); } else if (o is ulong) { LuaAPI.lua_pushuint64(L, Convert.ToUInt64(o)); } else if (o is bool) { bool b = (bool)o; LuaAPI.lua_pushboolean(L, b); } else { throw new Exception("No support type " + o.GetType()); } }