Ejemplo n.º 1
0
    //Anim
    public BoneAnimConfig AddBoneAnim()
    {
        BoneAnimConfig boneAnimConfig = new BoneAnimConfig();

        AnimConfig.Add(boneAnimConfig);
        return(boneAnimConfig);
    }
Ejemplo n.º 2
0
    void DrawAnimInspector()
    {
        //  GUILayout.Label("骨骼->动画 配置:", EditorStyles.boldLabel);

        GUILayout.BeginHorizontal();
        AimBoneTransform = EditorGUILayout.ObjectField(AimBoneTransform, typeof(Transform)) as Transform;
        if (AimBoneTransform != null)
        {
            if (GUILayout.Button("添加骨骼", GUILayout.Width(200)))
            {
                BoneAnimConfig boneAnimConfig = mCustomEditor.AddBoneAnim();
                boneAnimConfig.Bonetransform = AimBoneTransform;
                boneAnimConfig.BoneName      = AimBoneTransform.name;
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.Space(5);
        GUILayout.Label("动画->Key:", EditorStyles.boldLabel);

        for (int i = 0; i < mCustomEditor.AnimConfig.Count; ++i)
        {
            DrawAnim(i);
        }
        GUILayout.Space(5);
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("保存骨骼动画Config", GUILayout.Width(200)))
        {
            mCustomEditor.saveAnimConfig();
        }
        if (GUILayout.Button("导入Config", GUILayout.Width(200)))
        {
        }
        GUILayout.EndHorizontal();
    }
Ejemplo n.º 3
0
    public List <BoneAnimConfig> ReadAnimConfig(string path)
    {
        List <BoneAnimConfig> list = new List <BoneAnimConfig>();
        string str = File.ReadAllText(path);

        string[][] array;
        GetAnimConfig(str, out array);

        for (int i = 0; i < array.Length; i++)
        {
            BoneAnimConfig AnimConfig = new BoneAnimConfig();
            AnimConfig.BoneName = array[i][0];
            mBoneInfo mBoneInfo = null;
            int       index     = 0;
            for (int j = 1; j < array[i].Length; j++)
            {
                switch (index)
                {
                case 0: mBoneInfo = new mBoneInfo(); break;

                case 1:
                    float.TryParse(array[i][j], out mBoneInfo.vctPos.x); break;

                case 2:
                    float.TryParse(array[i][j], out mBoneInfo.vctPos.y); break;

                case 3:
                    float.TryParse(array[i][j], out mBoneInfo.vctPos.z); break;

                case 4:
                    float.TryParse(array[i][j], out mBoneInfo.vctRot.x); break;

                case 5:
                    float.TryParse(array[i][j], out mBoneInfo.vctRot.y); break;

                case 6:
                    float.TryParse(array[i][j], out mBoneInfo.vctRot.z); break;

                case 7:
                    float.TryParse(array[i][j], out mBoneInfo.vctScl.x); break;

                case 8:
                    float.TryParse(array[i][j], out mBoneInfo.vctScl.y); break;

                case 9:
                    float.TryParse(array[i][j], out mBoneInfo.vctScl.z);
                    AnimConfig.BoneAimLis.Add(mBoneInfo);
                    index = -1;
                    break;

                default:
                    break;
                }
                index++;
            }
            list.Add(AnimConfig);
        }
        return(list);
    }