예제 #1
0
    public static void ExportTimelineSkill(TimeLine.TimelineManager skill)
    {
        Skill sss = skill.gameObject.GetComponent <Skill>();

        if (sss != null)
        {
            ExportTimelineSkill(skill, "Export/Skills/Skill_" + sss.skillID + ".bytes");
        }
    }
예제 #2
0
    public static void ExportTimelineSkill(TimeLine.TimelineManager skill, string path)
    {
        Example.Skill skillData = new Example.Skill();
        List <Example.SkillAction>          skillActions     = new List <Example.SkillAction>();
        List <Example.SkillParticleEmitter> particleEmitters = new List <Example.SkillParticleEmitter>();
        List <Example.SkillEvent>           skillEvents      = new List <Example.SkillEvent>();

        TimeLine.TrackGroup[] groups = skill.GetTrackGroups();
        for (int i = 0; i < groups.Length; i++)
        {
            if (groups[i] is SkillGroup)
            {
                SkillGroup skg   = (SkillGroup)groups[i];
                Transform  Actor = skg.Actor;
                TimeLine.TimelineTrack[] tracks = skg.GetTracks();
                for (int j = 0; j < tracks.Length; j++)
                {
                    if (tracks[j] is SkillTrack)
                    {
                        SkillTrack             skt  = (SkillTrack)tracks[j];
                        TimeLine.ActorAction[] acts = skt.ActorActions;
                        for (int k = 0; k < acts.Length; k++)
                        {
                            if (acts[k] is SkillParticleEmitterItem)
                            {
                                ExportParticleEmitter((SkillParticleEmitterItem)acts[k], particleEmitters);
                            }
                            else if (acts[k] is SkillActionItem)
                            {
                                ExportSkillAction((SkillActionItem)acts[k], skillActions);
                            }
                        }
                        TimeLine.ActorEvent[] events = skt.ActorEvents;
                        for (int k = 0; k < events.Length; k++)
                        {
                            if (events[k] is SkillEventItem)
                            {
                                ExportSkillAction((SkillActionItem)acts[k], skillActions);
                            }
                        }
                    }
                }
            }
        }

        Skill skilll = skill.gameObject.GetComponent <Skill>();

        if (skilll == null)
        {
            return;
        }
        int targetMask = 0;

        foreach (var mask in skilll.targetTypes)
        {
            targetMask |= 1 << (int)mask;
        }

        skillData.Id              = ConvertSkillID(skilll.skillID);
        skillData.skillType       = skilll.skillType;
        skillData.TargetMask      = targetMask;
        skillData.SkillCD         = skilll.skillCD;
        skillData.SkillTime       = Mathf.FloorToInt(skill.Duration * 1000);
        skillData.CastingDistance = skilll.castingDistance;
        skillData.Actions         = skillActions;
        skillData.Emitters        = particleEmitters;
        skillData.Events          = skillEvents;

        var dataa = Example.Skill.SerializeToBytes(skillData);

        File.WriteAllBytes(path, dataa);

        Debug.LogFormat("Export Skill {0} to {1}", skill.name, path);
    }