Inheritance: UnityEngine.UI.MaskableGraphic, ISkeletonComponent, IAnimationStateComponent, ISkeletonAnimation
Exemplo n.º 1
0
    static int set_OnPostProcessVertices(IntPtr L)
    {
        try
        {
            Spine.Unity.SkeletonGraphic obj = (Spine.Unity.SkeletonGraphic)ToLua.CheckObject(L, 1, typeof(Spine.Unity.SkeletonGraphic));
            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.SkeletonGraphic.OnPostProcessVertices' can only appear on the left hand side of += or -= when used outside of the type 'Spine.Unity.SkeletonGraphic'"));
            }

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

            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Exemplo n.º 2
0
    static int Update(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                Spine.Unity.SkeletonGraphic obj = (Spine.Unity.SkeletonGraphic)ToLua.CheckObject <Spine.Unity.SkeletonGraphic>(L, 1);
                obj.Update();
                return(0);
            }
            else if (count == 2)
            {
                Spine.Unity.SkeletonGraphic obj = (Spine.Unity.SkeletonGraphic)ToLua.CheckObject <Spine.Unity.SkeletonGraphic>(L, 1);
                float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
                obj.Update(arg0);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: Spine.Unity.SkeletonGraphic.Update"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Exemplo n.º 3
0
 void HandleRendererReset(SkeletonGraphic g)
 {
     if (OnReset != null)
     {
         OnReset();
     }
     CollectBones();
 }
Exemplo n.º 4
0
        public static SkeletonGraphic NewSkeletonGraphicGameObject(Spine.Unity.SkeletonDataAsset skeletonDataAsset, Transform parent)
        {
            SkeletonGraphic graphic = AddSkeletonGraphicComponent(new GameObject("New Spine GameObject"), skeletonDataAsset);

            if (parent != null)
            {
                graphic.transform.SetParent(parent, false);
            }
            return(graphic);
        }
Exemplo n.º 5
0
        public static SkeletonGraphic NewSkeletonGraphicGameObject(SkeletonDataAsset skeletonDataAsset, Transform parent)
        {
            SkeletonGraphic skeletonGraphic = AddSkeletonGraphicComponent(new GameObject("New Spine GameObject"), skeletonDataAsset);

            if (parent != null)
            {
                skeletonGraphic.transform.SetParent(parent, worldPositionStays: false);
            }
            return(skeletonGraphic);
        }
        /// <summary>Create a new GameObject with a SkeletonGraphic component.</summary>
        /// <param name="material">Material for the canvas renderer to use. Usually, the default SkeletonGraphic material will work.</param>
        public static SkeletonGraphic NewSkeletonGraphicGameObject(SkeletonDataAsset skeletonDataAsset, Transform parent, Material material)
        {
            var sg = SkeletonGraphic.AddSkeletonGraphicComponent(new GameObject("New Spine GameObject"), skeletonDataAsset, material);

            if (parent != null)
            {
                sg.transform.SetParent(parent, false);
            }
            return(sg);
        }
Exemplo n.º 7
0
        public static SkeletonGraphic AddSkeletonGraphicComponent(GameObject gameObject, Spine.Unity.SkeletonDataAsset skeletonDataAsset)
        {
            SkeletonGraphic graphic = gameObject.AddComponent <SkeletonGraphic>();

            if (skeletonDataAsset != null)
            {
                graphic.skeletonDataAsset = skeletonDataAsset;
                graphic.Initialize(false);
            }
            return(graphic);
        }
Exemplo n.º 8
0
        public static SkeletonGraphic AddSkeletonGraphicComponent(GameObject gameObject, SkeletonDataAsset skeletonDataAsset)
        {
            SkeletonGraphic skeletonGraphic = gameObject.AddComponent <SkeletonGraphic>();

            if (skeletonDataAsset != null)
            {
                skeletonGraphic.skeletonDataAsset = skeletonDataAsset;
                skeletonGraphic.Initialize(overwrite: false);
            }
            return(skeletonGraphic);
        }
Exemplo n.º 9
0
        void OnEnable()
        {
            if (skeletonRenderer == null)
            {
                skeletonRenderer = GetComponent <SkeletonRenderer>();
            }
            if (skeletonGraphic == null)
            {
                skeletonGraphic = GetComponent <SkeletonGraphic>();
            }
            if (skeletonAnimation == null)
            {
                skeletonAnimation = skeletonRenderer != null?skeletonRenderer.GetComponent <ISkeletonAnimation>() :
                                        skeletonGraphic != null?skeletonGraphic.GetComponent <ISkeletonAnimation>() :
                                            GetComponent <ISkeletonAnimation>();
            }
            if (skeletonComponent == null)
            {
                skeletonComponent = skeletonRenderer != null?skeletonRenderer.GetComponent <ISkeletonComponent>() :
                                        skeletonGraphic != null?skeletonGraphic.GetComponent <ISkeletonComponent>() :
                                            GetComponent <ISkeletonComponent>();
            }

            if (skeletonRenderer != null)
            {
                skeletonRenderer.OnRebuild -= HandleRendererReset;
                skeletonRenderer.OnRebuild += HandleRendererReset;
            }
            else if (skeletonGraphic != null)
            {
                skeletonGraphic.OnRebuild -= HandleRendererReset;
                skeletonGraphic.OnRebuild += HandleRendererReset;
                canvas = skeletonGraphic.canvas;
                if (canvas == null)
                {
                    canvas = skeletonGraphic.GetComponentInParent <Canvas>();
                }
                if (canvas == null)
                {
                    positionScale = 100.0f;
                }
            }

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

            CollectBones();
        }
Exemplo n.º 10
0
        static bool CanvasNotSetupForTintBlack(SkeletonGraphic skeletonGraphic)
        {
            Canvas canvas = skeletonGraphic.canvas;

            if (!canvas)
            {
                return(false);
            }
            var requiredChannels =
                AdditionalCanvasShaderChannels.TexCoord1 |
                AdditionalCanvasShaderChannels.TexCoord2;

            return((canvas.additionalShaderChannels & requiredChannels) != requiredChannels);
        }
Exemplo n.º 11
0
 static int UpdateMesh(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         Spine.Unity.SkeletonGraphic obj = (Spine.Unity.SkeletonGraphic)ToLua.CheckObject <Spine.Unity.SkeletonGraphic>(L, 1);
         obj.UpdateMesh();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemplo n.º 12
0
 static int Rebuild(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Spine.Unity.SkeletonGraphic obj  = (Spine.Unity.SkeletonGraphic)ToLua.CheckObject <Spine.Unity.SkeletonGraphic>(L, 1);
         UnityEngine.UI.CanvasUpdate arg0 = (UnityEngine.UI.CanvasUpdate)ToLua.CheckObject(L, 2, typeof(UnityEngine.UI.CanvasUpdate));
         obj.Rebuild(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemplo n.º 13
0
 static int Initialize(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Spine.Unity.SkeletonGraphic obj = (Spine.Unity.SkeletonGraphic)ToLua.CheckObject <Spine.Unity.SkeletonGraphic>(L, 1);
         bool arg0 = LuaDLL.luaL_checkboolean(L, 2);
         obj.Initialize(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemplo n.º 14
0
 static int GetLastMesh(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         Spine.Unity.SkeletonGraphic obj = (Spine.Unity.SkeletonGraphic)ToLua.CheckObject <Spine.Unity.SkeletonGraphic>(L, 1);
         UnityEngine.Mesh            o   = obj.GetLastMesh();
         ToLua.PushSealed(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemplo n.º 15
0
 static int AddSkeletonGraphicComponent(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.GameObject        arg0 = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));
         Spine.Unity.SkeletonDataAsset arg1 = (Spine.Unity.SkeletonDataAsset)ToLua.CheckObject <Spine.Unity.SkeletonDataAsset>(L, 2);
         Spine.Unity.SkeletonGraphic   o    = Spine.Unity.SkeletonGraphic.AddSkeletonGraphicComponent(arg0, arg1);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemplo n.º 16
0
 static int NewSkeletonGraphicGameObject(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Spine.Unity.SkeletonDataAsset arg0 = (Spine.Unity.SkeletonDataAsset)ToLua.CheckObject <Spine.Unity.SkeletonDataAsset>(L, 1);
         UnityEngine.Transform         arg1 = (UnityEngine.Transform)ToLua.CheckObject <UnityEngine.Transform>(L, 2);
         Spine.Unity.SkeletonGraphic   o    = Spine.Unity.SkeletonGraphic.NewSkeletonGraphicGameObject(arg0, arg1);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemplo n.º 17
0
    static int get_startingAnimation(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonGraphic obj = (Spine.Unity.SkeletonGraphic)o;
            string ret = obj.startingAnimation;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index startingAnimation on a nil value"));
        }
    }
Exemplo n.º 18
0
    static int set_OverrideTexture(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonGraphic obj  = (Spine.Unity.SkeletonGraphic)o;
            UnityEngine.Texture         arg0 = (UnityEngine.Texture)ToLua.CheckObject <UnityEngine.Texture>(L, 2);
            obj.OverrideTexture = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index OverrideTexture on a nil value"));
        }
    }
Exemplo n.º 19
0
    static int set_unscaledTime(IntPtr L)
    {
        object o = null;

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

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonGraphic obj = (Spine.Unity.SkeletonGraphic)o;
            UnityEngine.Texture         ret = obj.mainTexture;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index mainTexture on a nil value"));
        }
    }
Exemplo n.º 21
0
    static int get_timeScale(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonGraphic obj = (Spine.Unity.SkeletonGraphic)o;
            float ret = obj.timeScale;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index timeScale on a nil value"));
        }
    }
Exemplo n.º 22
0
        // OnEnable applies the overrides at runtime, and when the editor loads.
        void OnEnable()
        {
            if (skeletonGraphic == null)
            {
                skeletonGraphic = GetComponent <SkeletonGraphic>();
            }

            if (skeletonGraphic == null)
            {
                Debug.LogError("skeletonGraphic == null");
                return;
            }

            skeletonGraphic.Initialize(false);
            SetCustomMaterialOverrides();
            SetCustomTextureOverrides();
        }
Exemplo n.º 23
0
    static int get_AnimationState(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonGraphic obj = (Spine.Unity.SkeletonGraphic)o;
            Spine.AnimationState        ret = obj.AnimationState;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index AnimationState on a nil value"));
        }
    }
Exemplo n.º 24
0
    static int get_IsValid(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonGraphic obj = (Spine.Unity.SkeletonGraphic)o;
            bool ret = obj.IsValid;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index IsValid on a nil value"));
        }
    }
Exemplo n.º 25
0
    static int set_startingAnimation(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonGraphic obj = (Spine.Unity.SkeletonGraphic)o;
            string arg0 = ToLua.CheckString(L, 2);
            obj.startingAnimation = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index startingAnimation on a nil value"));
        }
    }
Exemplo n.º 26
0
    static int set_timeScale(IntPtr L)
    {
        object o = null;

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

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonGraphic obj = (Spine.Unity.SkeletonGraphic)o;
            Spine.Unity.MeshGenerator   ret = obj.MeshGenerator;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index MeshGenerator on a nil value"));
        }
    }
Exemplo n.º 28
0
    static int get_SkeletonDataAsset(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonGraphic   obj = (Spine.Unity.SkeletonGraphic)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"));
        }
    }
Exemplo n.º 29
0
        void Reset()
        {
            skeletonGraphic = GetComponent <SkeletonGraphic>();

            // Populate material list
            if (skeletonGraphic != null && skeletonGraphic.skeletonDataAsset != null)
            {
                var atlasAssets = skeletonGraphic.skeletonDataAsset.atlasAssets;

                var initialAtlasMaterialOverrides = new List <AtlasMaterialOverride>();
                foreach (AtlasAssetBase atlasAsset in atlasAssets)
                {
                    foreach (Material atlasMaterial in atlasAsset.Materials)
                    {
                        var atlasMaterialOverride = new AtlasMaterialOverride {
                            overrideEnabled = false,
                            originalTexture = atlasMaterial.mainTexture
                        };

                        initialAtlasMaterialOverrides.Add(atlasMaterialOverride);
                    }
                }
                customMaterialOverrides = initialAtlasMaterialOverrides;
            }

            // Populate texture list
            if (skeletonGraphic != null && skeletonGraphic.skeletonDataAsset != null)
            {
                var atlasAssets = skeletonGraphic.skeletonDataAsset.atlasAssets;

                var initialAtlasTextureOverrides = new List <AtlasTextureOverride>();
                foreach (AtlasAssetBase atlasAsset in atlasAssets)
                {
                    foreach (Material atlasMaterial in atlasAsset.Materials)
                    {
                        var atlasTextureOverride = new AtlasTextureOverride {
                            overrideEnabled = false,
                            originalTexture = atlasMaterial.mainTexture
                        };

                        initialAtlasTextureOverrides.Add(atlasTextureOverride);
                    }
                }
                customTextureOverrides = initialAtlasTextureOverrides;
            }
        }
Exemplo n.º 30
0
    static int set_skeletonDataAsset(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Spine.Unity.SkeletonGraphic   obj  = (Spine.Unity.SkeletonGraphic)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"));
        }
    }