예제 #1
0
    public void SkillAddSound(int index, string skillId)
    {
        LCHSkillData  skill    = GetSkill(skillId);
        var           v        = skill.subSkills[index].objs;
        int           objCount = v.Length;
        int           id       = 0;
        List <object> _list    = new List <object>();

        for (int i = 0; i < objCount; i++)
        {
            int _id = v[i].id;
            if (id <= _id)
            {
                id = _id + 1;
            }
        }
        LCHObjectData eo = new LCHObjectData();

        eo.type                  = 4;
        eo.id                    = id;
        eo.name                  = "声音-未命名";
        eo.propertys["mod"]      = "";
        eo.propertys["mod_name"] = "";


        LCHSkillData s = new LCHSkillData();

        skill.subSkills[index].objs = ArrayHelper.AddItem <LCHObjectData>(skill.subSkills[index].objs, eo);
        SaveSkill(skillId);
    }
예제 #2
0
    public int SkillAddObject(string skillId, int index)
    {
        LCHSkillData skill = GetSkill(skillId);
        var          v     = skill.subSkills[index].objs;

        int           objCount = v.Length;
        int           id       = 0;
        List <object> _list    = new List <object>();

        for (int i = 0; i < objCount; i++)
        {
            int _id = v[i].id;
            if (id <= _id)
            {
                id = _id + 1;
            }
        }
        LCHObjectData eo = new LCHObjectData();

        eo.type = 1;
        eo.id   = id;
        eo.name = "对象-未命名";
        LCHSkillData s = new LCHSkillData();

        skill.subSkills[index].objs = ArrayHelper.AddItem <LCHObjectData>(skill.subSkills[index].objs, eo);
        SaveSkill(skillId);
        return(id);
    }
예제 #3
0
    public void SkillAddObject(params object[] args)
    {
        string       skillId = (string)args[0];
        LCHSkillData skill   = GetSkill(skillId);
        var          v       = skill.objs;

        int           objCount = v.Length;
        int           id       = 0;
        List <object> _list    = new List <object>();

        for (int i = 0; i < objCount; i++)
        {
            int _id = v[i].id;
            if (id <= _id)
            {
                id = _id + 1;
            }
        }
        LCHObjectData eo = new LCHObjectData();

        eo.type = 1;
        eo.id   = id;
        eo.name = "对象-未命名";
        LCHSkillData s = new LCHSkillData();

        skill.objs = ArrayHelper.AddItem <LCHObjectData>(skill.objs, eo);
        SaveSkill(skillId);
    }
예제 #4
0
        /// <summary>
        /// Adds a new frame to the BoneAnimation.
        /// </summary>
        /// <param name="transform">The bone transform to be added.</param>
        public void Add(Vector3 position, Vector3 rotation, Vector3 scale)
        {
            Transform transform = new Transform()
            {
                Position = position,
                Rotation = rotation,
                Scale    = scale
            };

            Transforms = ArrayHelper.AddItem <Transform>(transform, Transforms);
        }
예제 #5
0
    public void SkillAddBaseCollider(params object[] args)
    {
        string        skillId  = (string)args[0];
        int           objId    = (int)args[1];
        string        bindName = (string)args[2];
        LCHSkillData  skill    = GetSkill(skillId);
        var           v        = skill.objs;
        int           objCount = v.Length;
        int           id       = 0;
        List <object> _list    = new List <object>();

        for (int i = 0; i < objCount; i++)
        {
            int _id = v[i].id;
            if (id <= _id)
            {
                id = _id + 1;
            }
        }
        LCHObjectData eo = new LCHObjectData();

        eo.type = 3;
        eo.id   = id;
        eo.name = "触发器-未命名";
        if (bindName.Length > 0)
        {
            eo.propertys["bind"] = 2;
        }
        else
        {
            eo.propertys["bind"] = 1;
        }

        eo.propertys["objid"]     = objId;
        eo.propertys["bind_name"] = bindName;
        LCHSkillData s = new LCHSkillData();

        skill.objs = ArrayHelper.AddItem <LCHObjectData>(skill.objs, eo);
        SaveSkill(skillId);
    }
예제 #6
0
    public void CreateSkill(params object[] arg)
    {
        string id     = arg[0].ToString();
        string roidId = arg[1].ToString();

#if UNITY_EDITOR
        if (this.loader.Exists(id, SkillDataType.SKILL))
        {
            EditorUtility.DisplayDialog("提示", "同id技能已经存在", "确定");
            return;
        }
#endif
        var roid = GetRole(roidId);
        roid.skills = ArrayHelper.AddItem(roid.skills, id);

        LCHSkillData skill = new LCHSkillData();
        skill.id     = id;
        skill.roleId = roidId;
        string json = JsonConvert.SerializeObject(skill);
        loader.SaveFile(id, json, SkillDataType.SKILL);
        SaveRole(roidId);
    }
예제 #7
0
        void btn_Click(object sender, System.EventArgs e)
        {
            ParameterCollection param = new ParameterCollection();

            param.ObjectType = FileSource.Attachments.Keys[0];

            if (info.Attachments == null)
            {
                info.Attachments = new ParameterCollection[]
                {
                    param
                };

                DisplayAttachment(param);
            }
            else
            {
                info.Attachments = ArrayHelper.AddItem <ParameterCollection>(param, info.Attachments);

                DisplayAttachment(param);
            }

            ReAddEnding();
        }
 /// <summary>
 /// Adds a LimbKeyFrame to this.
 /// </summary>
 /// <param name="frame">The LimbKeyFrame to be added.</param>
 public void AddFrame(LimbKeyFrame frame)
 {
     LimbFrames = ArrayHelper.AddItem <LimbKeyFrame>(frame, LimbFrames);
 }
예제 #9
0
        void ReadFBXFile()
        {
            FileStream   str    = new FileStream(txtMdlFile.Text, System.IO.FileMode.Open);
            StreamReader reader = new StreamReader(str);

            string line = reader.ReadLine();

            while (line != null)
            {
                if (line.Contains("Takes:  {"))
                {
                    while (line != null)
                    {
                        if (line.Contains("Take: \""))
                        {
                            Animation ani = new Animation();

                            string name = GetAnimationName(line);
                            ani.Name = name;
                            lstAnim.Items.Add(name);

                            int endCount = 0;

                            while (endCount < 3)
                            {
                                if (line.Contains("}"))
                                {
                                    endCount++;
                                }

                                string ident = "Model: \"Model::";

                                if (line.Contains(ident))
                                {
                                    endCount = 0;

                                    line = line.Remove(0, ident.Length + 2);

                                    line = GetBoneName(line);

                                    BoneAnimation bone = new BoneAnimation();
                                    bone.BoneName = line;

                                    while (!line.Contains("}"))
                                    {
                                        string transformationIdent = "Channel: \"Transform\" {";

                                        if (line.Contains(transformationIdent))
                                        {
                                            List <Vector3> positions = GetTransformationChanel("T", reader, out reader);
                                            List <Vector3> rotations = GetTransformationChanel("R", reader, out reader);
                                            List <Vector3> scales    = GetTransformationChanel("S", reader, out reader);

                                            int count = positions.Count;

                                            if (rotations.Count > count)
                                            {
                                                count = rotations.Count;
                                            }

                                            if (scales.Count > count)
                                            {
                                                count = scales.Count;
                                            }

                                            for (int i = 0; i < count; i++)
                                            {
                                                int pi, ri, si = 0;

                                                if (positions.Count - 1 > i)
                                                {
                                                    pi = i;
                                                }
                                                else
                                                {
                                                    pi = positions.Count - 1;
                                                }

                                                if (rotations.Count - 1 > i)
                                                {
                                                    ri = i;
                                                }
                                                else
                                                {
                                                    ri = rotations.Count - 1;
                                                }

                                                if (scales.Count - 1 > i)
                                                {
                                                    si = i;
                                                }
                                                else
                                                {
                                                    si = scales.Count - 1;
                                                }

                                                bone.Add(positions[pi], rotations[ri], scales[si]);
                                            }
                                        }

                                        line = reader.ReadLine();
                                    }

                                    ani.BoneAnimations = ArrayHelper.AddItem <BoneAnimation>(bone, ani.BoneAnimations);
                                }

                                line = reader.ReadLine();
                            }

                            animations.Add(ani);
                        }

                        line = reader.ReadLine();
                    }
                }
                else
                {
                    line = reader.ReadLine();
                }
            }

            if (animations.Count == 0)
            {
                MessageBox.Show("No animation data found.");
            }

            reader.Close();
        }