Пример #1
0
        public static SkeletonRenderSeparator AddToSkeletonRenderer(Spine.Unity.SkeletonRenderer skeletonRenderer, int sortingLayerID = 0, int extraPartsRenderers = 0, int sortingOrderIncrement = 5, int baseSortingOrder = 0, bool addMinimumPartsRenderers = true)
        {
            if (skeletonRenderer == null)
            {
                Debug.Log("Tried to add SkeletonRenderSeparator to a null SkeletonRenderer reference.");
                return(null);
            }
            SkeletonRenderSeparator separator = skeletonRenderer.gameObject.AddComponent <SkeletonRenderSeparator>();

            separator.skeletonRenderer = skeletonRenderer;
            skeletonRenderer.Initialize(false);
            int num = extraPartsRenderers;

            if (addMinimumPartsRenderers)
            {
                num = (extraPartsRenderers + skeletonRenderer.separatorSlots.Count) + 1;
            }
            Transform parent = skeletonRenderer.transform;
            List <SkeletonPartsRenderer> partsRenderers = separator.partsRenderers;

            for (int i = 0; i < num; i++)
            {
                SkeletonPartsRenderer item         = SkeletonPartsRenderer.NewPartsRendererGameObject(parent, i.ToString());
                MeshRenderer          meshRenderer = item.MeshRenderer;
                meshRenderer.sortingLayerID = sortingLayerID;
                meshRenderer.sortingOrder   = baseSortingOrder + (i * sortingOrderIncrement);
                partsRenderers.Add(item);
            }
            return(separator);
        }
    static int set_OnRebuild(IntPtr L)
    {
        try
        {
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)ToLua.CheckObject(L, 1, typeof(Spine.Unity.SkeletonRenderer));
            EventObject arg0 = null;

            if (LuaDLL.lua_isuserdata(L, 2) != 0)
            {
                arg0 = (EventObject)ToLua.ToObject(L, 2);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "The event 'Spine.Unity.SkeletonRenderer.OnRebuild' can only appear on the left hand side of += or -= when used outside of the type 'Spine.Unity.SkeletonRenderer'"));
            }

            if (arg0.op == EventOp.Add)
            {
                Spine.Unity.SkeletonRenderer.SkeletonRendererDelegate ev = (Spine.Unity.SkeletonRenderer.SkeletonRendererDelegate)arg0.func;
                obj.OnRebuild += ev;
            }
            else if (arg0.op == EventOp.Sub)
            {
                Spine.Unity.SkeletonRenderer.SkeletonRendererDelegate ev = (Spine.Unity.SkeletonRenderer.SkeletonRendererDelegate)arg0.func;
                obj.OnRebuild -= ev;
            }

            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int set_OnRebuild(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)o;
            Spine.Unity.SkeletonRenderer.SkeletonRendererDelegate arg0 = null;
            LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

            if (funcType2 != LuaTypes.LUA_TFUNCTION)
            {
                arg0 = (Spine.Unity.SkeletonRenderer.SkeletonRendererDelegate)ToLua.CheckObject(L, 2, typeof(Spine.Unity.SkeletonRenderer.SkeletonRendererDelegate));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                arg0 = DelegateFactory.CreateDelegate(typeof(Spine.Unity.SkeletonRenderer.SkeletonRendererDelegate), func) as Spine.Unity.SkeletonRenderer.SkeletonRendererDelegate;
            }

            obj.OnRebuild = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index OnRebuild on a nil value" : e.Message));
        }
    }
 static int LateUpdate(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)ToLua.CheckObject(L, 1, typeof(Spine.Unity.SkeletonRenderer));
         obj.LateUpdate();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    static int set_GenerateMeshOverride(IntPtr L)
    {
        try
        {
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)ToLua.CheckObject(L, 1, typeof(Spine.Unity.SkeletonRenderer));
            EventObject arg0 = null;

            if (LuaDLL.lua_isuserdata(L, 2) != 0)
            {
                arg0 = (EventObject)ToLua.ToObject(L, 2);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "The event 'Spine.Unity.SkeletonRenderer.GenerateMeshOverride' can only appear on the left hand side of += or -= when used outside of the type 'Spine.Unity.SkeletonRenderer'"));
            }

            if (arg0.op == EventOp.Add)
            {
                Spine.Unity.SkeletonRenderer.InstructionDelegate ev = (Spine.Unity.SkeletonRenderer.InstructionDelegate)DelegateFactory.CreateDelegate(typeof(Spine.Unity.SkeletonRenderer.InstructionDelegate), arg0.func);
                obj.GenerateMeshOverride += ev;
            }
            else if (arg0.op == EventOp.Sub)
            {
                Spine.Unity.SkeletonRenderer.InstructionDelegate ev = (Spine.Unity.SkeletonRenderer.InstructionDelegate)LuaMisc.GetEventHandler(obj, typeof(Spine.Unity.SkeletonRenderer), "GenerateMeshOverride");
                Delegate[] ds    = ev.GetInvocationList();
                LuaState   state = LuaState.Get(L);

                for (int i = 0; i < ds.Length; i++)
                {
                    ev = (Spine.Unity.SkeletonRenderer.InstructionDelegate)ds[i];
                    LuaDelegate ld = ev.Target as LuaDelegate;

                    if (ld != null && ld.func == arg0.func)
                    {
                        obj.GenerateMeshOverride -= ev;
                        state.DelayDispose(ld.func);
                        break;
                    }
                }

                arg0.func.Dispose();
            }

            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
 static int EnsureMeshGeneratorCapacity(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)ToLua.CheckObject <Spine.Unity.SkeletonRenderer>(L, 1);
         int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         obj.EnsureMeshGeneratorCapacity(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int Initialize(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)ToLua.CheckObject(L, 1, typeof(Spine.Unity.SkeletonRenderer));
         bool arg0 = LuaDLL.luaL_checkboolean(L, 2);
         obj.Initialize(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    static int SetMeshSettings(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 2);
            Spine.Unity.SkeletonRenderer       obj  = (Spine.Unity.SkeletonRenderer)ToLua.CheckObject <Spine.Unity.SkeletonRenderer>(L, 1);
            Spine.Unity.MeshGenerator.Settings arg0 = StackTraits <Spine.Unity.MeshGenerator.Settings> .Check(L, 2);

            obj.SetMeshSettings(arg0);
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int get_CustomSlotMaterials(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)o;
            System.Collections.Generic.Dictionary <Spine.Slot, UnityEngine.Material> ret = obj.CustomSlotMaterials;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index CustomSlotMaterials on a nil value" : e.Message));
        }
    }
    static int get_renderQueue(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)o;
            int ret = obj.renderQueue;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index renderQueue on a nil value" : e.Message));
        }
    }
    static int get_valid(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)o;
            bool ret = obj.valid;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index valid on a nil value" : e.Message));
        }
    }
    static int get_zSpacing(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)o;
            float ret = obj.zSpacing;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index zSpacing on a nil value" : e.Message));
        }
    }
    static int get_disableRenderingOnOverride(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)o;
            bool ret = obj.disableRenderingOnOverride;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index disableRenderingOnOverride on a nil value"));
        }
    }
    static int set_zSpacing(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)o;
            float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
            obj.zSpacing = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index zSpacing on a nil value"));
        }
    }
    static int set_separatorSlotNames(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)o;
            string[] arg0 = ToLua.CheckStringArray(L, 2);
            obj.separatorSlotNames = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index separatorSlotNames on a nil value" : e.Message));
        }
    }
    static int get_SkeletonDataAsset(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer  obj = (Spine.Unity.SkeletonRenderer)o;
            Spine.Unity.SkeletonDataAsset ret = obj.SkeletonDataAsset;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index SkeletonDataAsset on a nil value"));
        }
    }
    static int get_CustomMaterialOverride(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)o;
            System.Collections.Generic.Dictionary <UnityEngine.Material, UnityEngine.Material> ret = obj.CustomMaterialOverride;
            ToLua.PushSealed(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index CustomMaterialOverride on a nil value"));
        }
    }
    static int set_disableRenderingOnOverride(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)o;
            bool arg0 = LuaDLL.luaL_checkboolean(L, 2);
            obj.disableRenderingOnOverride = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index disableRenderingOnOverride on a nil value"));
        }
    }
    static int set_calculateTangents(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)o;
            bool arg0 = LuaDLL.luaL_checkboolean(L, 2);
            obj.calculateTangents = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index calculateTangents on a nil value"));
        }
    }
    static int get_Skeleton(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)o;
            Spine.Skeleton ret = obj.Skeleton;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Skeleton on a nil value" : e.Message));
        }
    }
    static int get_initialSkinName(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)o;
            string ret = obj.initialSkinName;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index initialSkinName on a nil value" : e.Message));
        }
    }
    static int get_separatorSlotNames(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)o;
            string[] ret = obj.separatorSlotNames;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index separatorSlotNames on a nil value" : e.Message));
        }
    }
    static int set_initialSkinName(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)o;
            string arg0 = ToLua.CheckString(L, 2);
            obj.initialSkinName = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index initialSkinName on a nil value" : e.Message));
        }
    }
    static int set_skeletonDataAsset(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer  obj  = (Spine.Unity.SkeletonRenderer)o;
            Spine.Unity.SkeletonDataAsset arg0 = (Spine.Unity.SkeletonDataAsset)ToLua.CheckObject <Spine.Unity.SkeletonDataAsset>(L, 2);
            obj.skeletonDataAsset = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index skeletonDataAsset on a nil value"));
        }
    }
    static int get_separatorSlots(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)o;
            System.Collections.Generic.List <Spine.Slot> ret = obj.separatorSlots;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index separatorSlots on a nil value" : e.Message));
        }
    }
    static int get_logErrors(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)o;
            bool ret = obj.logErrors;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index logErrors on a nil value"));
        }
    }
    static int set_renderQueue(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)o;
            int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
            obj.renderQueue = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index renderQueue on a nil value" : e.Message));
        }
    }
    static int set_valid(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)o;
            bool arg0 = LuaDLL.luaL_checkboolean(L, 2);
            obj.valid = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index valid on a nil value" : e.Message));
        }
    }
    static int set_skeleton(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonRenderer obj = (Spine.Unity.SkeletonRenderer)o;
            Spine.Skeleton arg0 = (Spine.Skeleton)ToLua.CheckObject(L, 2, typeof(Spine.Skeleton));
            obj.skeleton = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index skeleton on a nil value" : e.Message));
        }
    }
Пример #30
0
        void OnEnable()
        {
            if (skeletonRenderer == null)
            {
                skeletonRenderer = GetComponent <SkeletonRenderer>();
            }

            if (animatedSkeletonComponent == null)
            {
                animatedSkeletonComponent = GetComponent(typeof(ISkeletonAnimation)) as ISkeletonAnimation;
            }

            skeletonRenderer.OnRebuild -= HandleRendererReset;
            skeletonRenderer.OnRebuild += HandleRendererReset;

            if (animatedSkeletonComponent != null)
            {
                animatedSkeletonComponent.UpdateLocal -= UpdateLocal;
                animatedSkeletonComponent.UpdateLocal += UpdateLocal;
            }

            CollectBones();
        }