少年修仙传客户端基础资源
client_Wu Xijin
2018-10-29 8efd04f4314e44c5b732e95163383b1911d279cb
Assets/XLua/Gen/WrapPusher.cs
@@ -16,9 +16,9 @@
    public partial class ObjectTranslator
    {
        
        class IniterAdderXLuaTestPedding
        class IniterAdderUnityEngineVector2
        {
            static IniterAdderXLuaTestPedding()
            static IniterAdderUnityEngineVector2()
            {
                LuaEnv.AddIniter(Init);
            }
@@ -26,9 +26,6 @@
         static void Init(LuaEnv luaenv, ObjectTranslator translator)
         {
         
            translator.RegisterPushAndGetAndUpdate<XLuaTest.Pedding>(translator.PushXLuaTestPedding, translator.Get, translator.UpdateXLuaTestPedding);
            translator.RegisterPushAndGetAndUpdate<XLuaTest.MyStruct>(translator.PushXLuaTestMyStruct, translator.Get, translator.UpdateXLuaTestMyStruct);
            translator.RegisterPushAndGetAndUpdate<PushAsTableStruct>(translator.PushPushAsTableStruct, translator.Get, translator.UpdatePushAsTableStruct);
            translator.RegisterPushAndGetAndUpdate<UnityEngine.Vector2>(translator.PushUnityEngineVector2, translator.Get, translator.UpdateUnityEngineVector2);
            translator.RegisterPushAndGetAndUpdate<UnityEngine.Vector3>(translator.PushUnityEngineVector3, translator.Get, translator.UpdateUnityEngineVector3);
            translator.RegisterPushAndGetAndUpdate<UnityEngine.Vector4>(translator.PushUnityEngineVector4, translator.Get, translator.UpdateUnityEngineVector4);
@@ -37,211 +34,13 @@
            translator.RegisterPushAndGetAndUpdate<UnityEngine.Ray>(translator.PushUnityEngineRay, translator.Get, translator.UpdateUnityEngineRay);
            translator.RegisterPushAndGetAndUpdate<UnityEngine.Bounds>(translator.PushUnityEngineBounds, translator.Get, translator.UpdateUnityEngineBounds);
            translator.RegisterPushAndGetAndUpdate<UnityEngine.Ray2D>(translator.PushUnityEngineRay2D, translator.Get, translator.UpdateUnityEngineRay2D);
            translator.RegisterPushAndGetAndUpdate<XLuaTest.MyEnum>(translator.PushXLuaTestMyEnum, translator.Get, translator.UpdateXLuaTestMyEnum);
            translator.RegisterPushAndGetAndUpdate<Tutorial.TestEnum>(translator.PushTutorialTestEnum, translator.Get, translator.UpdateTutorialTestEnum);
            translator.RegisterPushAndGetAndUpdate<Tutorial.DrivenClass.TestEnumInner>(translator.PushTutorialDrivenClassTestEnumInner, translator.Get, translator.UpdateTutorialDrivenClassTestEnumInner);
         
         }
        }
        
        static IniterAdderXLuaTestPedding s_IniterAdderXLuaTestPedding_dumb_obj = new IniterAdderXLuaTestPedding();
        static IniterAdderXLuaTestPedding IniterAdderXLuaTestPedding_dumb_obj {get{return s_IniterAdderXLuaTestPedding_dumb_obj;}}
        static IniterAdderUnityEngineVector2 s_IniterAdderUnityEngineVector2_dumb_obj = new IniterAdderUnityEngineVector2();
        static IniterAdderUnityEngineVector2 IniterAdderUnityEngineVector2_dumb_obj {get{return s_IniterAdderUnityEngineVector2_dumb_obj;}}
        
        int XLuaTestPedding_TypeID = -1;
        public void PushXLuaTestPedding(RealStatePtr L, XLuaTest.Pedding val)
        {
            if (XLuaTestPedding_TypeID == -1)
            {
             bool is_first;
                XLuaTestPedding_TypeID = getTypeId(L, typeof(XLuaTest.Pedding), out is_first);
            }
            IntPtr buff = LuaAPI.xlua_pushstruct(L, 1, XLuaTestPedding_TypeID);
            if (!CopyByValue.Pack(buff, 0, val))
            {
                throw new Exception("pack fail fail for XLuaTest.Pedding ,value="+val);
            }
        }
        public void Get(RealStatePtr L, int index, out XLuaTest.Pedding val)
        {
          LuaTypes type = LuaAPI.lua_type(L, index);
            if (type == LuaTypes.LUA_TUSERDATA )
            {
             if (LuaAPI.xlua_gettypeid(L, index) != XLuaTestPedding_TypeID)
            {
                throw new Exception("invalid userdata for XLuaTest.Pedding");
            }
                IntPtr buff = LuaAPI.lua_touserdata(L, index);if (!CopyByValue.UnPack(buff, 0, out val))
                {
                    throw new Exception("unpack fail for XLuaTest.Pedding");
                }
            }
         else if (type ==LuaTypes.LUA_TTABLE)
         {
             CopyByValue.UnPack(this, L, index, out val);
         }
            else
            {
                val = (XLuaTest.Pedding)objectCasters.GetCaster(typeof(XLuaTest.Pedding))(L, index, null);
            }
        }
        public void UpdateXLuaTestPedding(RealStatePtr L, int index, XLuaTest.Pedding val)
        {
            if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
            {
             if (LuaAPI.xlua_gettypeid(L, index) != XLuaTestPedding_TypeID)
            {
                throw new Exception("invalid userdata for XLuaTest.Pedding");
            }
                IntPtr buff = LuaAPI.lua_touserdata(L, index);
                if (!CopyByValue.Pack(buff, 0,  val))
                {
                    throw new Exception("pack fail for XLuaTest.Pedding ,value="+val);
                }
            }
            else
            {
                throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
            }
        }
        int XLuaTestMyStruct_TypeID = -1;
        public void PushXLuaTestMyStruct(RealStatePtr L, XLuaTest.MyStruct val)
        {
            if (XLuaTestMyStruct_TypeID == -1)
            {
             bool is_first;
                XLuaTestMyStruct_TypeID = getTypeId(L, typeof(XLuaTest.MyStruct), out is_first);
            }
            IntPtr buff = LuaAPI.xlua_pushstruct(L, 25, XLuaTestMyStruct_TypeID);
            if (!CopyByValue.Pack(buff, 0, val))
            {
                throw new Exception("pack fail fail for XLuaTest.MyStruct ,value="+val);
            }
        }
        public void Get(RealStatePtr L, int index, out XLuaTest.MyStruct val)
        {
          LuaTypes type = LuaAPI.lua_type(L, index);
            if (type == LuaTypes.LUA_TUSERDATA )
            {
             if (LuaAPI.xlua_gettypeid(L, index) != XLuaTestMyStruct_TypeID)
            {
                throw new Exception("invalid userdata for XLuaTest.MyStruct");
            }
                IntPtr buff = LuaAPI.lua_touserdata(L, index);if (!CopyByValue.UnPack(buff, 0, out val))
                {
                    throw new Exception("unpack fail for XLuaTest.MyStruct");
                }
            }
         else if (type ==LuaTypes.LUA_TTABLE)
         {
             CopyByValue.UnPack(this, L, index, out val);
         }
            else
            {
                val = (XLuaTest.MyStruct)objectCasters.GetCaster(typeof(XLuaTest.MyStruct))(L, index, null);
            }
        }
        public void UpdateXLuaTestMyStruct(RealStatePtr L, int index, XLuaTest.MyStruct val)
        {
            if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
            {
             if (LuaAPI.xlua_gettypeid(L, index) != XLuaTestMyStruct_TypeID)
            {
                throw new Exception("invalid userdata for XLuaTest.MyStruct");
            }
                IntPtr buff = LuaAPI.lua_touserdata(L, index);
                if (!CopyByValue.Pack(buff, 0,  val))
                {
                    throw new Exception("pack fail for XLuaTest.MyStruct ,value="+val);
                }
            }
            else
            {
                throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
            }
        }
        int PushAsTableStruct_TypeID = -1;
        public void PushPushAsTableStruct(RealStatePtr L, PushAsTableStruct val)
        {
            if (PushAsTableStruct_TypeID == -1)
            {
             bool is_first;
                PushAsTableStruct_TypeID = getTypeId(L, typeof(PushAsTableStruct), out is_first);
            }
         var translator = this;
         LuaAPI.xlua_pushcstable(L, 2, PushAsTableStruct_TypeID);
         LuaAPI.xlua_pushasciistring(L, "x");
         LuaAPI.xlua_pushinteger(L, val.x);
         LuaAPI.lua_rawset(L, -3);
         LuaAPI.xlua_pushasciistring(L, "y");
         LuaAPI.xlua_pushinteger(L, val.y);
         LuaAPI.lua_rawset(L, -3);
        }
        public void Get(RealStatePtr L, int index, out PushAsTableStruct val)
        {
          LuaTypes type = LuaAPI.lua_type(L, index);
            if (type == LuaTypes.LUA_TUSERDATA )
            {
             if (LuaAPI.xlua_gettypeid(L, index) != PushAsTableStruct_TypeID)
            {
                throw new Exception("invalid userdata for PushAsTableStruct");
            }
                IntPtr buff = LuaAPI.lua_touserdata(L, index);if (!CopyByValue.UnPack(buff, 0, out val))
                {
                    throw new Exception("unpack fail for PushAsTableStruct");
                }
            }
         else if (type ==LuaTypes.LUA_TTABLE)
         {
             CopyByValue.UnPack(this, L, index, out val);
         }
            else
            {
                val = (PushAsTableStruct)objectCasters.GetCaster(typeof(PushAsTableStruct))(L, index, null);
            }
        }
        public void UpdatePushAsTableStruct(RealStatePtr L, int index, PushAsTableStruct val)
        {
         if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TTABLE)
            {
             return;
         }
            else
            {
                throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
            }
        }
        
        int UnityEngineVector2_TypeID = -1;
        public void PushUnityEngineVector2(RealStatePtr L, UnityEngine.Vector2 val)
@@ -771,258 +570,6 @@
            }
        }
        
        int XLuaTestMyEnum_TypeID = -1;
      int XLuaTestMyEnum_EnumRef = -1;
        public void PushXLuaTestMyEnum(RealStatePtr L, XLuaTest.MyEnum val)
        {
            if (XLuaTestMyEnum_TypeID == -1)
            {
             bool is_first;
                XLuaTestMyEnum_TypeID = getTypeId(L, typeof(XLuaTest.MyEnum), out is_first);
            if (XLuaTestMyEnum_EnumRef == -1)
            {
                Utils.LoadCSTable(L, typeof(XLuaTest.MyEnum));
                XLuaTestMyEnum_EnumRef = LuaAPI.luaL_ref(L, LuaIndexes.LUA_REGISTRYINDEX);
            }
            }
         if (LuaAPI.xlua_tryget_cachedud(L, (int)val, XLuaTestMyEnum_EnumRef) == 1)
            {
             return;
         }
            IntPtr buff = LuaAPI.xlua_pushstruct(L, 4, XLuaTestMyEnum_TypeID);
            if (!CopyByValue.Pack(buff, 0, (int)val))
            {
                throw new Exception("pack fail fail for XLuaTest.MyEnum ,value="+val);
            }
         LuaAPI.lua_getref(L, XLuaTestMyEnum_EnumRef);
         LuaAPI.lua_pushvalue(L, -2);
         LuaAPI.xlua_rawseti(L, -2, (int)val);
         LuaAPI.lua_pop(L, 1);
        }
        public void Get(RealStatePtr L, int index, out XLuaTest.MyEnum val)
        {
          LuaTypes type = LuaAPI.lua_type(L, index);
            if (type == LuaTypes.LUA_TUSERDATA )
            {
             if (LuaAPI.xlua_gettypeid(L, index) != XLuaTestMyEnum_TypeID)
            {
                throw new Exception("invalid userdata for XLuaTest.MyEnum");
            }
                IntPtr buff = LuaAPI.lua_touserdata(L, index);
            int e;
                if (!CopyByValue.UnPack(buff, 0, out e))
                {
                    throw new Exception("unpack fail for XLuaTest.MyEnum");
                }
            val = (XLuaTest.MyEnum)e;
            }
            else
            {
                val = (XLuaTest.MyEnum)objectCasters.GetCaster(typeof(XLuaTest.MyEnum))(L, index, null);
            }
        }
        public void UpdateXLuaTestMyEnum(RealStatePtr L, int index, XLuaTest.MyEnum val)
        {
            if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
            {
             if (LuaAPI.xlua_gettypeid(L, index) != XLuaTestMyEnum_TypeID)
            {
                throw new Exception("invalid userdata for XLuaTest.MyEnum");
            }
                IntPtr buff = LuaAPI.lua_touserdata(L, index);
                if (!CopyByValue.Pack(buff, 0,  (int)val))
                {
                    throw new Exception("pack fail for XLuaTest.MyEnum ,value="+val);
                }
            }
            else
            {
                throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
            }
        }
        int TutorialTestEnum_TypeID = -1;
      int TutorialTestEnum_EnumRef = -1;
        public void PushTutorialTestEnum(RealStatePtr L, Tutorial.TestEnum val)
        {
            if (TutorialTestEnum_TypeID == -1)
            {
             bool is_first;
                TutorialTestEnum_TypeID = getTypeId(L, typeof(Tutorial.TestEnum), out is_first);
            if (TutorialTestEnum_EnumRef == -1)
            {
                Utils.LoadCSTable(L, typeof(Tutorial.TestEnum));
                TutorialTestEnum_EnumRef = LuaAPI.luaL_ref(L, LuaIndexes.LUA_REGISTRYINDEX);
            }
            }
         if (LuaAPI.xlua_tryget_cachedud(L, (int)val, TutorialTestEnum_EnumRef) == 1)
            {
             return;
         }
            IntPtr buff = LuaAPI.xlua_pushstruct(L, 4, TutorialTestEnum_TypeID);
            if (!CopyByValue.Pack(buff, 0, (int)val))
            {
                throw new Exception("pack fail fail for Tutorial.TestEnum ,value="+val);
            }
         LuaAPI.lua_getref(L, TutorialTestEnum_EnumRef);
         LuaAPI.lua_pushvalue(L, -2);
         LuaAPI.xlua_rawseti(L, -2, (int)val);
         LuaAPI.lua_pop(L, 1);
        }
        public void Get(RealStatePtr L, int index, out Tutorial.TestEnum val)
        {
          LuaTypes type = LuaAPI.lua_type(L, index);
            if (type == LuaTypes.LUA_TUSERDATA )
            {
             if (LuaAPI.xlua_gettypeid(L, index) != TutorialTestEnum_TypeID)
            {
                throw new Exception("invalid userdata for Tutorial.TestEnum");
            }
                IntPtr buff = LuaAPI.lua_touserdata(L, index);
            int e;
                if (!CopyByValue.UnPack(buff, 0, out e))
                {
                    throw new Exception("unpack fail for Tutorial.TestEnum");
                }
            val = (Tutorial.TestEnum)e;
            }
            else
            {
                val = (Tutorial.TestEnum)objectCasters.GetCaster(typeof(Tutorial.TestEnum))(L, index, null);
            }
        }
        public void UpdateTutorialTestEnum(RealStatePtr L, int index, Tutorial.TestEnum val)
        {
            if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
            {
             if (LuaAPI.xlua_gettypeid(L, index) != TutorialTestEnum_TypeID)
            {
                throw new Exception("invalid userdata for Tutorial.TestEnum");
            }
                IntPtr buff = LuaAPI.lua_touserdata(L, index);
                if (!CopyByValue.Pack(buff, 0,  (int)val))
                {
                    throw new Exception("pack fail for Tutorial.TestEnum ,value="+val);
                }
            }
            else
            {
                throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
            }
        }
        int TutorialDrivenClassTestEnumInner_TypeID = -1;
      int TutorialDrivenClassTestEnumInner_EnumRef = -1;
        public void PushTutorialDrivenClassTestEnumInner(RealStatePtr L, Tutorial.DrivenClass.TestEnumInner val)
        {
            if (TutorialDrivenClassTestEnumInner_TypeID == -1)
            {
             bool is_first;
                TutorialDrivenClassTestEnumInner_TypeID = getTypeId(L, typeof(Tutorial.DrivenClass.TestEnumInner), out is_first);
            if (TutorialDrivenClassTestEnumInner_EnumRef == -1)
            {
                Utils.LoadCSTable(L, typeof(Tutorial.DrivenClass.TestEnumInner));
                TutorialDrivenClassTestEnumInner_EnumRef = LuaAPI.luaL_ref(L, LuaIndexes.LUA_REGISTRYINDEX);
            }
            }
         if (LuaAPI.xlua_tryget_cachedud(L, (int)val, TutorialDrivenClassTestEnumInner_EnumRef) == 1)
            {
             return;
         }
            IntPtr buff = LuaAPI.xlua_pushstruct(L, 4, TutorialDrivenClassTestEnumInner_TypeID);
            if (!CopyByValue.Pack(buff, 0, (int)val))
            {
                throw new Exception("pack fail fail for Tutorial.DrivenClass.TestEnumInner ,value="+val);
            }
         LuaAPI.lua_getref(L, TutorialDrivenClassTestEnumInner_EnumRef);
         LuaAPI.lua_pushvalue(L, -2);
         LuaAPI.xlua_rawseti(L, -2, (int)val);
         LuaAPI.lua_pop(L, 1);
        }
        public void Get(RealStatePtr L, int index, out Tutorial.DrivenClass.TestEnumInner val)
        {
          LuaTypes type = LuaAPI.lua_type(L, index);
            if (type == LuaTypes.LUA_TUSERDATA )
            {
             if (LuaAPI.xlua_gettypeid(L, index) != TutorialDrivenClassTestEnumInner_TypeID)
            {
                throw new Exception("invalid userdata for Tutorial.DrivenClass.TestEnumInner");
            }
                IntPtr buff = LuaAPI.lua_touserdata(L, index);
            int e;
                if (!CopyByValue.UnPack(buff, 0, out e))
                {
                    throw new Exception("unpack fail for Tutorial.DrivenClass.TestEnumInner");
                }
            val = (Tutorial.DrivenClass.TestEnumInner)e;
            }
            else
            {
                val = (Tutorial.DrivenClass.TestEnumInner)objectCasters.GetCaster(typeof(Tutorial.DrivenClass.TestEnumInner))(L, index, null);
            }
        }
        public void UpdateTutorialDrivenClassTestEnumInner(RealStatePtr L, int index, Tutorial.DrivenClass.TestEnumInner val)
        {
            if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
            {
             if (LuaAPI.xlua_gettypeid(L, index) != TutorialDrivenClassTestEnumInner_TypeID)
            {
                throw new Exception("invalid userdata for Tutorial.DrivenClass.TestEnumInner");
            }
                IntPtr buff = LuaAPI.lua_touserdata(L, index);
                if (!CopyByValue.Pack(buff, 0,  (int)val))
                {
                    throw new Exception("pack fail for Tutorial.DrivenClass.TestEnumInner ,value="+val);
                }
            }
            else
            {
                throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
            }
        }
        
      // table cast optimze
      
@@ -1034,25 +581,7 @@
       internal static bool __tryArrayGet(Type type, RealStatePtr L, ObjectTranslator translator, object obj, int index)
      {
      
         if (type == typeof(XLuaTest.Pedding[]))
         {
             XLuaTest.Pedding[] array = obj as XLuaTest.Pedding[];
            translator.PushXLuaTestPedding(L, array[index]);
            return true;
         }
         else if (type == typeof(XLuaTest.MyStruct[]))
         {
             XLuaTest.MyStruct[] array = obj as XLuaTest.MyStruct[];
            translator.PushXLuaTestMyStruct(L, array[index]);
            return true;
         }
         else if (type == typeof(PushAsTableStruct[]))
         {
             PushAsTableStruct[] array = obj as PushAsTableStruct[];
            translator.PushPushAsTableStruct(L, array[index]);
            return true;
         }
         else if (type == typeof(UnityEngine.Vector2[]))
         if (type == typeof(UnityEngine.Vector2[]))
         {
             UnityEngine.Vector2[] array = obj as UnityEngine.Vector2[];
            translator.PushUnityEngineVector2(L, array[index]);
@@ -1100,49 +629,13 @@
            translator.PushUnityEngineRay2D(L, array[index]);
            return true;
         }
         else if (type == typeof(XLuaTest.MyEnum[]))
         {
             XLuaTest.MyEnum[] array = obj as XLuaTest.MyEnum[];
            translator.PushXLuaTestMyEnum(L, array[index]);
            return true;
         }
         else if (type == typeof(Tutorial.TestEnum[]))
         {
             Tutorial.TestEnum[] array = obj as Tutorial.TestEnum[];
            translator.PushTutorialTestEnum(L, array[index]);
            return true;
         }
         else if (type == typeof(Tutorial.DrivenClass.TestEnumInner[]))
         {
             Tutorial.DrivenClass.TestEnumInner[] array = obj as Tutorial.DrivenClass.TestEnumInner[];
            translator.PushTutorialDrivenClassTestEnumInner(L, array[index]);
            return true;
         }
            return false;
      }
      
      internal static bool __tryArraySet(Type type, RealStatePtr L, ObjectTranslator translator, object obj, int array_idx, int obj_idx)
      {
      
         if (type == typeof(XLuaTest.Pedding[]))
         {
             XLuaTest.Pedding[] array = obj as XLuaTest.Pedding[];
            translator.Get(L, obj_idx, out array[array_idx]);
            return true;
         }
         else if (type == typeof(XLuaTest.MyStruct[]))
         {
             XLuaTest.MyStruct[] array = obj as XLuaTest.MyStruct[];
            translator.Get(L, obj_idx, out array[array_idx]);
            return true;
         }
         else if (type == typeof(PushAsTableStruct[]))
         {
             PushAsTableStruct[] array = obj as PushAsTableStruct[];
            translator.Get(L, obj_idx, out array[array_idx]);
            return true;
         }
         else if (type == typeof(UnityEngine.Vector2[]))
         if (type == typeof(UnityEngine.Vector2[]))
         {
             UnityEngine.Vector2[] array = obj as UnityEngine.Vector2[];
            translator.Get(L, obj_idx, out array[array_idx]);
@@ -1187,24 +680,6 @@
         else if (type == typeof(UnityEngine.Ray2D[]))
         {
             UnityEngine.Ray2D[] array = obj as UnityEngine.Ray2D[];
            translator.Get(L, obj_idx, out array[array_idx]);
            return true;
         }
         else if (type == typeof(XLuaTest.MyEnum[]))
         {
             XLuaTest.MyEnum[] array = obj as XLuaTest.MyEnum[];
            translator.Get(L, obj_idx, out array[array_idx]);
            return true;
         }
         else if (type == typeof(Tutorial.TestEnum[]))
         {
             Tutorial.TestEnum[] array = obj as Tutorial.TestEnum[];
            translator.Get(L, obj_idx, out array[array_idx]);
            return true;
         }
         else if (type == typeof(Tutorial.DrivenClass.TestEnumInner[]))
         {
             Tutorial.DrivenClass.TestEnumInner[] array = obj as Tutorial.DrivenClass.TestEnumInner[];
            translator.Get(L, obj_idx, out array[array_idx]);
            return true;
         }