private void OnGUI() { EditorGUILayout.BeginVertical(); EditorGUILayout.LabelField("输入技能id数字或id名称搜索"); id = EditorGUILayout.IntField("id数字:", id); idName = EditorGUILayout.TextField("id名称:", idName); if (GUILayout.Button("id数字搜索并应用", GUILayout.Height(40))) { if (id > 0 && EditorDataContainer.allSkillUnits.units.Count > id) { idName = EditorDataContainer.GetSkillStringById(id); DataConvert.ConvertSkillUnit(EditorDataContainer.currentskillAssetData.skillUnit, EditorDataContainer.allSkillUnits.units[id]); int curart = EditorDataContainer.currentskillAssetData.skillUnit.artId; SkillUnit.SkillArt oart = EditorDataContainer.allSkillUnits.arts[curart]; DataConvert.ConvertSkillArt(EditorDataContainer.currentskillAssetData.skillArt, oart); EditorDataContainer.UseSkillArt(oart); } } if (GUILayout.Button("id名字搜索并应用", GUILayout.Height(40))) { id = EditorDataContainer.GetSkillIdByString(idName); if (id > 0 && EditorDataContainer.allSkillUnits.units.Count > id) { DataConvert.ConvertSkillUnit(EditorDataContainer.currentskillAssetData.skillUnit, EditorDataContainer.allSkillUnits.units[id]); int curart = EditorDataContainer.currentskillAssetData.skillUnit.artId; SkillUnit.SkillArt oart = EditorDataContainer.allSkillUnits.arts[curart]; DataConvert.ConvertSkillArt(EditorDataContainer.currentskillAssetData.skillArt, oart); EditorDataContainer.UseSkillArt(oart); } } if (GUILayout.Button("Close", GUILayout.Height(40))) { Close(); } EditorGUILayout.EndVertical(); }
public static SkillAssetData MakeSkillAssetData(JSequencer sequenceer) { SkillAssetData skillart = new SkillAssetData(); Transform AffectedObject = sequenceer.TimelineContainers[0].AffectedObject; string ModelName = AffectedObject.name; List <GameObject> plist = AssetUtility.GetAllFBXWithType(ModelTargetType.Player); List <GameObject> nlist = AssetUtility.GetAllFBXWithType(ModelTargetType.NPC); skillart.skillArt.modelType = ModelTargetType.Player; bool findtype = false; for (int i = 0; i < plist.Count && !findtype; i++) { if (plist[i].name == ModelName) { skillart.skillArt.modelType = ModelTargetType.Player; findtype = true; } } for (int i = 0; i < nlist.Count && !findtype; i++) { if (nlist[i].name == ModelName) { skillart.skillArt.modelType = ModelTargetType.NPC; findtype = true; } } skillart.skillArt.modelName = ModelName; skillart.skillArt.model = AssetUtility.GetFBXWithName(ModelName); Animator Animator = AffectedObject.GetComponent <Animator>(); skillart.skillArt.animationController = Animator.runtimeAnimatorController.name; skillart.skillArt.id = EditorDataContainer.GetSkillIdByString(AffectedObject.parent.name.Split('_')[1]); if (sequenceer.TimelineContainers.Length > 0) { JTimelineBase[] lines = sequenceer.TimelineContainers[0].Timelines; for (int i = 0; i < lines.Length; i++) { JTimelineBase line = lines[i]; //动作时间线 guideaction /* if (line.LineType() == TimeLineType.Animation) * { * JTimelineAnimation aniline = (JTimelineAnimation)line; * foreach (var track in aniline.AnimationTracks) * { * if (track.name == SkillNames.ActionNames[(int)SkillNames.GuideAction.GuideAction]) * { * if (track.TrackClips.Count > 0) * { * skillart.skillArt.guideAction = track.TrackClips[0].StateName; * } * } * else if (track.name == SkillNames.ActionNames[(int)SkillNames.GuideAction.GuidingAction]) * { * if (track.TrackClips.Count > 0) * { * skillart.skillArt.guidingAction = track.TrackClips[0].StateName; * } * } * else if (track.name == SkillNames.ActionNames[(int)SkillNames.GuideAction.EndAction]) * { * if (track.TrackClips.Count > 0) * { * skillart.skillArt.endAction = track.TrackClips[0].StateName; * } * } * } * }*/ //特效时间线 begineffect if (line.LineType() == TimeLineType.Effect) { JTimelineEffect aniline = (JTimelineEffect)line; foreach (var track in aniline.EffectTracks) { if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.GuideAction]) { if (track.TrackClips.Count > 0) { skillart.skillArt.guideAction = track.TrackClips[0].StateName; } } if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.GuidingAction]) { if (track.TrackClips.Count > 0) { skillart.skillArt.guidingAction = track.TrackClips[0].StateName; } } if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.EndAction]) { if (track.TrackClips.Count > 0) { skillart.skillArt.endAction = track.TrackClips[0].StateName; } } if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.BeginEffect0] || track.name == SkillNames.EffectNames[(int)SkillNames.Effect.BeginEffect1]) { if (skillart.skillArt.beginEffect == null) { skillart.skillArt.beginEffect = new List <SkillEffectUnit>(); } skillart.skillArt.beginEffect.Add(track.TrackClips[0].effectunit.Copy()); } if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.EndEffect]) { if (skillart.skillArt.endEffect == null) { skillart.skillArt.endEffect = new List <SkillEffectUnit>(); } skillart.skillArt.endEffect.Add(track.TrackClips[0].effectunit.Copy()); } if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.UnitEffect]) { if (skillart.skillArt.unitEffect == null) { skillart.skillArt.unitEffect = new List <SkillEffectUnit>(); } if (skillart.skillUnit == null) { skillart.skillUnit = new JSkillUnit(); } skillart.skillArt.unitEffect.Add(track.TrackClips[0].effectunit.Copy()); skillart.skillUnit = track.TrackClips[0].skillunit.Copy(); } if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.HitEffect]) { if (skillart.skillArt.hitEffect == null) { skillart.skillArt.hitEffect = new List <SkillEffectUnit>(); } skillart.skillArt.hitEffect.Add(track.TrackClips[0].effectunit.Copy()); } if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.TipEffect]) { if (skillart.skillArt.tipEffect == null) { skillart.skillArt.tipEffect = new List <SkillEffectUnit>(); } skillart.skillArt.tipEffect.Add(track.TrackClips[0].effectunit.Copy()); } if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.BeginCameraAction]) { if (skillart.skillArt.beginCameraAction == null) { skillart.skillArt.beginCameraAction = new List <SkillCameraAction>(); } skillart.skillArt.beginCameraAction.Add(track.TrackClips[0].cameraAction.Copy()); } if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.MoveCameraAction]) { if (skillart.skillArt.moveCameraAction == null) { skillart.skillArt.moveCameraAction = new List <SkillCameraAction>(); } skillart.skillArt.moveCameraAction.Add(track.TrackClips[0].cameraAction.Copy()); } if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.HitCameraAction]) { if (skillart.skillArt.hitCameraAction == null) { skillart.skillArt.hitCameraAction = new List <SkillCameraAction>(); } skillart.skillArt.hitCameraAction.Add(track.TrackClips[0].cameraAction.Copy()); } } } if (skillart.skillArt.beginEffect != null) { skillart.skillArt.beginEffect.Sort(delegate(SkillEffectUnit x, SkillEffectUnit y) { return(x.artEffect.beginTime.CompareTo(y.artEffect.beginTime)); }); } /* * if (line.LineType() == TimeLineType.Particle) * { * JTimelineParticle aniline = (JTimelineParticle)line; * foreach (var track in aniline.ParticleTracks) * { * if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.BeginEffect0]|| track.name == SkillNames.EffectNames[(int)SkillNames.Effect.BeginEffect1]|| track.name == SkillNames.EffectNames[(int)SkillNames.Effect.EndEffect]) * { * if (track.TrackClips.Count > 0) * { * SkillEffectUnit unit = new SkillEffectUnit(); * unit.configure = track.TrackClips[0].EffectConfig.Copy(); * unit.artEffect.beginTime = (int)(track.TrackClips[0].StartTime*1000f); * unit.artEffect.phaseTime = (int)(track.TrackClips[0].PlaybackDuration * 1000f); * unit.artEffect.effectObj = track.TrackClips[0].Effect; * unit.artEffect.effect = EditorDataContainer.GetIdByString(track.TrackClips[0].ParticleName); * begineffect.Insert(0, unit); * } * } * * } * } * //弹道时间线 * if (skillart.skillArt.unitEffect == null) * skillart.skillArt.unitEffect = new List<SkillEffectUnit>(); * List<SkillEffectUnit> unitEffect = skillart.skillArt.unitEffect; * unitEffect.Clear(); * if (line.LineType() == TimeLineType.Trajectory) * { * JTimelineTrajectory aniline = (JTimelineTrajectory)line; * * foreach (var track in aniline.TrajectoryTracks) * { * if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.UnitEffect]) * { * if (track.TrackClips.Count > 0) * { * skillart.skillUnit = track.TrackClips[0].skillunit.Copy(); * unitEffect.Add(track.TrackClips[0].effectunit.Copy()); * } * } * } * } */ } } Debug.Log(skillart.skillArt.beginEffect.Count); return(skillart); }
public static int GetSkillIdByString(string id) { return(EditorDataContainer.GetSkillIdByString(id)); }