예제 #1
0
        public static BodyPart Load(string save)
        {
            if (!save.Contains("#BODYPART#"))
            {
                // OLD Enum based BodyPart
                Old_BodyPart oldBodyPart = V_Animation.GetEnumFromString <Old_BodyPart>(save);
                return(new BodyPart((int)oldBodyPart));
            }
            string[] content = V_Animation.SplitString(save, "#BODYPART#");

            int preset = V_Animation.Parse_Int(content[0]);

            V_Animation.StringArrPushIfIndex(1, ref content, ((Old_BodyPart)preset).ToString());
            string customName = content[1];

            return(new BodyPart(preset, customName));
        }
예제 #2
0
        public static V_Skeleton_Frame Load(string save)
        {
            string[] content    = V_Animation.SplitString(save, "#SKELETONFRAME#");
            int      frameCount = int.Parse(content[0]);
            Vector3  pos        = V_Animation.Load_Vector3(content[1]);
            float    size       = float.Parse(content[2]);
            int      rot        = int.Parse(content[3]);

            V_Animation.StringArrPushIfIndex(4, ref content, "");
            string trigger = content[4];

            V_Animation.StringArrPushIfIndex(5, ref content, "");
            UVType uvType = UVType.Load(content[5]);

            V_Animation.StringArrPushIfIndex(6, ref content, "1");
            float scaleX = float.Parse(content[6]);

            V_Animation.StringArrPushIfIndex(7, ref content, "1");
            float scaleY = float.Parse(content[7]);

            V_Animation.StringArrPushIfIndex(8, ref content, "-100");
            int sortingOrder = int.Parse(content[8]);

            V_Animation.StringArrPushIfIndex(9, ref content, "0,0");
            Vector2 pivot = V_Animation.Load_Vector2(content[9]);

            V_Animation.StringArrPushIfIndex(10, ref content, "0,0");
            Vector2 v00offset = V_Animation.Load_Vector2(content[10]);

            V_Animation.StringArrPushIfIndex(11, ref content, "0,0");
            Vector2 v01offset = V_Animation.Load_Vector2(content[11]);

            V_Animation.StringArrPushIfIndex(12, ref content, "0,0");
            Vector2 v10offset = V_Animation.Load_Vector2(content[12]);

            V_Animation.StringArrPushIfIndex(13, ref content, "0,0");
            Vector2 v11offset = V_Animation.Load_Vector2(content[13]);

            return(new V_Skeleton_Frame(frameCount, pos, size, rot, trigger, uvType, scaleX, scaleY, sortingOrder, pivot, v00offset, v01offset, v10offset, v11offset));
        }
예제 #3
0
        public static UVType Load(string save)
        {
            if (!save.Contains("#UVTYPE#"))
            {
                // OLD Enum based UVType
                //Debug.LogError("OLD Enum based UVType");

                //Old_UVType oldUvType = MyUtils.GetEnumFromString<Old_UVType>(save);
                //return new UVType((int)oldUvType);

                switch (save)
                {
                case "Foot":        return(UVType.dFoot);

                case "Body_Down":   return(UVType.dBodyDown);

                case "Body_Up":     return(UVType.dBodyUp);

                case "Body_Left":   return(UVType.dBodyLeft);

                case "Body_Right":  return(UVType.dBodyRight);

                case "Head_Down":   return(UVType.dHeadDown);

                case "Head_Up":     return(UVType.dHeadUp);

                case "Head_Left":   return(UVType.dHeadLeft);

                case "Head_Right":  return(UVType.dHeadRight);

                case "Hand":        return(UVType.dHand);

                case "Sword":       return(UVType.dWeapon);

                case "Sword_InvertH":   return(UVType.dWeapon_InvertH);
                }

                return(new UVType(save, 0f, 0f, 1f, 1f, "defaultSpriteSheet", 512, 512));
            }
            string[] content = V_Animation.SplitString(save, "#UVTYPE#");

            int preset = V_Animation.Parse_Int(content[0]);

            Vector2[] uvs = V_Animation.Load_Array <Vector2>(content[1], delegate(string str) { return(V_Animation.Load_Vector2(str)); }, "#VECTOR2ARR#");
            //MyUtils.StringArrPushIfIndex(2, ref content, ((Old_UVType)preset).ToString());
            V_Animation.StringArrPushIfIndex(2, ref content, "Head_Down");
            string customName = content[2];

            V_Animation.StringArrPushIfIndex(3, ref content, "0");
            int id = V_Animation.Parse_Int(content[3]);

            V_Animation.StringArrPushIfIndex(4, ref content, "");
            string textureName = content[4];

            V_Animation.StringArrPushIfIndex(5, ref content, "1024");
            int textureWidth = V_Animation.Parse_Int(content[5]);

            V_Animation.StringArrPushIfIndex(6, ref content, "1024");
            int textureHeight = V_Animation.Parse_Int(content[6]);

            return(new UVType(uvs, customName, id, textureName, textureWidth, textureHeight));
        }