Example #1
0
 static public int get_material(IntPtr l)
 {
     try {
         UISpine self = (UISpine)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.material);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #2
0
 static public int set_spineMaterial(IntPtr l)
 {
     try {
         UISpine self = (UISpine)checkSelf(l);
         UnityEngine.Material v;
         checkType(l, 2, out v);
         self.spineMaterial = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #3
0
 static public int set_spine(IntPtr l)
 {
     try {
         UISpine   self = (UISpine)checkSelf(l);
         NGUISpine v;
         checkType(l, 2, out v);
         self.spine = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #4
0
 static public int OnFill(IntPtr l)
 {
     try {
         UISpine self = (UISpine)checkSelf(l);
         System.Collections.Generic.List <UnityEngine.Vector3> a1;
         checkType(l, 2, out a1);
         System.Collections.Generic.List <UnityEngine.Vector2> a2;
         checkType(l, 3, out a2);
         System.Collections.Generic.List <UnityEngine.Color> a3;
         checkType(l, 4, out a3);
         self.OnFill(a1, a2, a3);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
    static void CreateUISpine()
    {
        Object[] selects = Selection.objects;
        foreach (Object o in selects)
        {
            SkeletonDataAsset s = o as SkeletonDataAsset;
            if (s != null && s.atlasAsset != null)
            {
                AtlasAsset a = s.atlasAsset;
                if (a.materials.Length > 0)
                {
                    Material m = a.materials [0];

                    string path = "Assets/";                    //Application.persistentDataPath;
                    path = PathUnity.Combine(path, "ABResources/Spine2D");
                    path = PathUnity.Combine(path, o.name + ".prefab");
                    GameObject g = new GameObject();
                    g.name = o.name;

                    g.AddComponent <MeshRenderer> ();
                    g.AddComponent <MeshFilter> ();

                    NGUISpine nus = g.AddComponent <NGUISpine> ();
                    nus.skeletonDataAsset = s;
                    var anims = s.GetSkeletonData(true).Animations;
                    if (anims.Count > 0)
                    {
                        nus.Reset();
                        nus.AnimationName = anims [1].Name;
                    }

                    UISpine us = g.AddComponent <UISpine> ();
                    us.spineMaterial = m;
                    us.depth         = 100;

                    GameObject newGo = PrefabUtility.CreatePrefab(path, g);
                    newGo.name = g.name;
                    GameObject.DestroyImmediate(g);
                }
            }
        }
        AssetDatabase.Refresh();
    }