public static void ConvertSkillArt(SkillUnit.SkillArt oUnit, SkillArt unit) { oUnit.id = unit.id; oUnit.guideAction = unit.guideAction; oUnit.guideFadeTime = unit.guideFadeTime; oUnit.guidingAction = unit.guidingAction; oUnit.endAction = unit.endAction; oUnit.unitEffect = ConvertSkillArtEffect(unit.unitEffect[0].artEffect); oUnit.tipEffect = ConvertSkillArtEffect(unit.tipEffect[0].artEffect); oUnit.hitEffect = ConvertSkillArtEffect(unit.hitEffect[0].artEffect); oUnit.beginCameraAction = ConvertCameraAction(unit.beginCameraAction[0]); oUnit.moveCameraAction = ConvertCameraAction(unit.moveCameraAction[0]); oUnit.hitCameraAction = ConvertCameraAction(unit.hitCameraAction[0]); List <SkillUnit.SkillArtEffect> beginlist = oUnit.beginEffect; for (int i = 0; i < unit.beginEffect.Count; i++) { SkillUnit.SkillArtEffect Effect = new SkillUnit.SkillArtEffect(); Effect = ConvertSkillArtEffect(unit.beginEffect[i].artEffect); oUnit.beginEffect.Add(Effect); } }
private void OnEnable() { if (skillArt == null) { skillArt = new SkillArt(); } if (skillUnit == null) { skillUnit = new JSkillUnit(); } }
//根据模型类型 加载FBX private void LoadFbx() { SkillArt skillart = EditorDataContainer.currentskillAssetData.skillArt; if (allFbx == null) { allFbx = AssetUtility.GetAllFBXWithType(skillart.modelType); fbxNamelist = new List <string>(); for (int i = 0; i < allFbx.Count; i++) { fbxNamelist.Add(allFbx[i].name); } } }
public static void UseSkillArt(SkillUnit.SkillArt oart) { SkillArt art = EditorDataContainer.currentskillAssetData.skillArt; DataConvert.ConvertSkillArt(art, oart); string effectName = EditorDataContainer.GetStringById(oart.unitEffect.effect); if (art.unitEffect == null) { art.unitEffect = new List <SkillEffectUnit>(); } if (art.unitEffect.Count == 0) { art.unitEffect.Add(new SkillEffectUnit()); } art.unitEffect[0].artEffect.effectObj = AssetUtility.GetSkillEffect(art.modelType, art.modelName, effectName); string hitEffectName = EditorDataContainer.GetStringById(oart.hitEffect.effect); if (art.hitEffect == null) { art.hitEffect = new List <SkillEffectUnit>(); } if (art.hitEffect.Count == 0) { art.hitEffect.Add(new SkillEffectUnit()); } art.hitEffect[0].artEffect.effectObj = AssetUtility.GetSkillEffect(art.modelType, art.modelName, hitEffectName); if (art.tipEffect == null) { art.tipEffect = new List <SkillEffectUnit>(); } if (art.tipEffect.Count == 0) { art.tipEffect.Add(new SkillEffectUnit()); } art.tipEffect[0].artEffect.effectObj = AssetUtility.GetSkillEffect(art.modelType, art.modelName, hitEffectName); for (int i = 0; i < oart.beginEffect.Count; i++) { string beginEffectName = EditorDataContainer.GetStringById(oart.beginEffect[i].effect); art.beginEffect[i].artEffect.effectObj = AssetUtility.GetSkillEffect(art.modelType, art.modelName, beginEffectName); } }
public static void ConvertSkillArt(SkillArt oUnit, SkillUnit.SkillArt unit) { oUnit.id = unit.id; oUnit.guideAction = unit.guideAction; oUnit.guideFadeTime = unit.guideFadeTime; oUnit.guidingAction = unit.guidingAction; oUnit.endAction = unit.endAction; if (oUnit.unitEffect == null) { oUnit.unitEffect = new List <SkillEffectUnit>(); } if (oUnit.tipEffect == null) { oUnit.tipEffect = new List <SkillEffectUnit>(); } if (oUnit.hitEffect == null) { oUnit.hitEffect = new List <SkillEffectUnit>(); } if (oUnit.unitEffect.Count == 0) { oUnit.unitEffect.Add(new SkillEffectUnit()); } if (oUnit.tipEffect.Count == 0) { oUnit.tipEffect.Add(new SkillEffectUnit()); } if (oUnit.hitEffect.Count == 0) { oUnit.hitEffect.Add(new SkillEffectUnit()); } ConvertSkillArtEffect(oUnit.unitEffect[0].artEffect, unit.unitEffect); ConvertSkillArtEffect(oUnit.tipEffect[0].artEffect, unit.tipEffect); ConvertSkillArtEffect(oUnit.hitEffect[0].artEffect, unit.hitEffect); if (oUnit.beginEffect == null) { oUnit.beginEffect = new List <SkillEffectUnit>(); } oUnit.beginEffect.Clear(); for (int i = 0; i < unit.beginEffect.Count; i++) { SkillEffectUnit Effect = new SkillEffectUnit(); ConvertSkillArtEffect(Effect.artEffect, unit.beginEffect[i]); oUnit.beginEffect.Add(Effect); } }
public static SkillArt ConvertSkillArt(SkillUnit.SkillArt unit) { SkillArt oUnit = new SkillArt(); oUnit.id = unit.id; oUnit.guideAction = unit.guideAction; oUnit.guideFadeTime = unit.guideFadeTime; oUnit.guidingAction = unit.guidingAction; oUnit.endAction = unit.endAction; oUnit.unitEffect = new List <SkillEffectUnit>(); oUnit.unitEffect.Add(new SkillEffectUnit()); oUnit.unitEffect[0].artEffect = ConvertSkillArtEffect(unit.unitEffect); oUnit.tipEffect = new List <SkillEffectUnit>(); oUnit.tipEffect.Add(new SkillEffectUnit()); oUnit.tipEffect[0].artEffect = ConvertSkillArtEffect(unit.tipEffect); oUnit.hitEffect = new List <SkillEffectUnit>(); oUnit.hitEffect.Add(new SkillEffectUnit()); oUnit.hitEffect[0].artEffect = ConvertSkillArtEffect(unit.hitEffect); oUnit.beginCameraAction = new List <SkillCameraAction>(); oUnit.beginCameraAction.Add(new SkillCameraAction()); oUnit.beginCameraAction[0] = ConvertCameraAction(unit.beginCameraAction); oUnit.moveCameraAction = new List <SkillCameraAction>(); oUnit.moveCameraAction.Add(new SkillCameraAction()); oUnit.moveCameraAction[0] = ConvertCameraAction(unit.moveCameraAction); oUnit.hitCameraAction = new List <SkillCameraAction>(); oUnit.hitCameraAction.Add(new SkillCameraAction()); oUnit.hitCameraAction[0] = ConvertCameraAction(unit.hitCameraAction); oUnit.beginEffect = new List <SkillEffectUnit>(); for (int i = 0; i < unit.beginEffect.Count; i++) { SkillEffectUnit Effect = new SkillEffectUnit(); Effect.artEffect = ConvertSkillArtEffect(unit.beginEffect[i]); oUnit.beginEffect.Add(Effect); } return(oUnit); }
//加载技能特效 private void LoadEffect() { SkillArt skillart = EditorDataContainer.currentskillAssetData.skillArt; if (SkillEffectPrefabs == null) { string modelName = ""; if (skillart.model != null) { modelName = skillart.model.name; } SkillEffectPrefabs = AssetUtility.GetModelSkillEffectPrefabs(modelName); //GetAllSkillEffectPrefabs(); effectNamelist = new List <string>(); for (int i = 0; i < SkillEffectPrefabs.Count; i++) { effectNamelist.Add(SkillEffectPrefabs[i].name); } } }
//加载动作 private void LoadAnimationState(bool force = true) { SkillArt skillart = EditorDataContainer.currentskillAssetData.skillArt; string modelName = ""; modelName = skillart.modelName; RuntimeAnimatorController controller0 = AssetUtility.GetAnimationCtl(skillart.modelType, skillart.modelName, skillart.animationController); if (skillart.animationControllerObj == null && controller0 != null) { skillart.animationControllerObj = controller0; } RuntimeAnimatorController controller = skillart.animationControllerObj;// AssetUtility.GetAnimationCtl(skillart.modelType, modelName, skillart.animationController); if (force && controller == null) { Debug.Log("Error! Error animationController Not Found"); } if (controller != null) { if (force) { stateNamelist = new List <string>(); stateNamelist = MecanimAnimationUtility.GetAllStateNamesWithController(controller); } else { if (stateNamelist == null) { stateNamelist = new List <string>(); stateNamelist = MecanimAnimationUtility.GetAllStateNamesWithController(controller); } } } else if (stateNamelist == null) { stateNamelist = new List <string>(); } else if (stateNamelist != null) { stateNamelist.Clear(); } }
public SkillArt Copy() { SkillArt b = new SkillArt(); b.id = id; b.model = model; b.modelName = modelName; b.animationController = animationController; b.modelType = modelType; b.idString = idString; b.guideAction = guideAction; b.guidingAction = guidingAction; b.animationControllerObj = animationControllerObj; if (beginCameraAction != null) { b.beginCameraAction = new List <SkillCameraAction>(); for (int i = 0; i < beginCameraAction.Count; i++) { b.beginCameraAction.Add(beginCameraAction[i].Copy()); } } if (moveCameraAction != null) { b.moveCameraAction = new List <SkillCameraAction>(); for (int i = 0; i < moveCameraAction.Count; i++) { b.moveCameraAction.Add(moveCameraAction[i].Copy()); } } if (hitCameraAction != null) { b.hitCameraAction = new List <SkillCameraAction>(); for (int i = 0; i < hitCameraAction.Count; i++) { b.hitCameraAction.Add(hitCameraAction[i].Copy()); } } if (beginEffect != null) { b.beginEffect = new List <SkillEffectUnit>(); for (int i = 0; i < beginEffect.Count; i++) { b.beginEffect.Add(beginEffect[i].Copy()); } } if (unitEffect != null) { b.unitEffect = new List <SkillEffectUnit>(); for (int i = 0; i < unitEffect.Count; i++) { b.unitEffect.Add(unitEffect[i].Copy()); } } if (endEffect != null) { b.endEffect = new List <SkillEffectUnit>(); for (int i = 0; i < endEffect.Count; i++) { b.endEffect.Add(endEffect[i].Copy()); } } if (hitEffect != null) { b.hitEffect = new List <SkillEffectUnit>(); for (int i = 0; i < hitEffect.Count; i++) { b.hitEffect.Add(hitEffect[i].Copy()); } } if (tipEffect != null) { b.tipEffect = new List <SkillEffectUnit>(); for (int i = 0; i < tipEffect.Count; i++) { b.tipEffect.Add(tipEffect[i].Copy()); } } return(b); }
//绘制特效信息 public void DrawSkillArtEffect(SkillArt skillart, float width) { EditorGUILayout.BeginVertical("Box"); EditorGUILayout.LabelField("Skill ArtEffect: 特效"); //id if (skillart.idString == "") { skillart.idString = EditorDrawUtility.GetSkillStringById(skillart.id); } string id = EditorGUILayout.TextField("Id:", skillart.idString); if (id != skillart.idString) { skillart.idString = id; skillart.id = EditorDrawUtility.GetSkillIdByString(id); } //modelType int typeindex = (int)skillart.modelType; int newtypeindex = EditorGUILayout.Popup("ModelTargetType:", typeindex, Enum.GetNames(typeof(ModelTargetType))); if (newtypeindex != typeindex) { skillart.modelType = (ModelTargetType)newtypeindex; allFbx = null; LoadFbx(); } int fbxselet = -1; // GameObject fbx = AssetUtility.GetFBXWithName(EditorDataContainer.currentskillAssetData.modelName); GameObject fbx = EditorDataContainer.currentskillAssetData.skillArt.model; if (fbx != null) { if (fbxNamelist.Contains(fbx.name)) { fbxselet = fbxNamelist.IndexOf(fbx.name); } } LoadAnimationState(false); EditorGUILayout.BeginHorizontal(); GameObject NewFbx = (GameObject)EditorGUILayout.ObjectField("Model:", fbx, typeof(GameObject), true); int newselectfbx = EditorGUILayout.Popup(fbxselet, fbxNamelist.ToArray()); EditorGUILayout.EndHorizontal(); if (newselectfbx != fbxselet) { skillart.model = allFbx[newselectfbx]; skillart.modelName = allFbx[newselectfbx].name; skillart.animationController = allFbx[newselectfbx].name + "_Anim"; LoadAnimationState(); SkillEffectPrefabs = null; LoadEffect(); } else { if (NewFbx == null) { skillart.model = null; skillart.modelName = ""; skillart.animationController = ""; } else if (NewFbx != skillart.model) { skillart.model = NewFbx; skillart.modelName = NewFbx.name; skillart.animationController = NewFbx.name + "_Anim"; LoadAnimationState(); SkillEffectPrefabs = null; LoadEffect(); } } EditorGUILayout.TextField("animationControllerName:", skillart.animationController); RuntimeAnimatorController controller = AssetUtility.GetAnimationCtl(skillart.modelType, skillart.modelName, skillart.animationController); if (skillart.animationControllerObj == null && controller != null) { skillart.animationControllerObj = controller; } RuntimeAnimatorController newcontroller = (RuntimeAnimatorController)EditorGUILayout.ObjectField("AnimatorController:", skillart.animationControllerObj, typeof(RuntimeAnimatorController), true); if (newcontroller != controller) { skillart.animationController = newcontroller.name; skillart.animationControllerObj = newcontroller; LoadAnimationState(); } EditorGUILayout.LabelField("GuideAction 开始动作:"); skillart.guideFadeTime = EditorGUILayout.FloatField(" guideFadeTime:", skillart.guideFadeTime); EditorDrawUtility.DrawActionRect(" guideAction:", skillart.guideAction, out skillart.guideAction, stateNamelist); EditorDrawUtility.DrawActionRect(" guidingAction:", skillart.guidingAction, out skillart.guidingAction, stateNamelist); EditorDrawUtility.DrawActionRect(" endAction:", skillart.endAction, out skillart.endAction, stateNamelist); showBeginEffect = EditorGUILayout.Foldout(showBeginEffect, "beginEffect 起手特效:"); //EditorGUILayout.LabelField("beginEffect 起手特效:"); if (showBeginEffect) { if (skillart.beginEffect != null) { EditorDrawUtility.DrawEffectUnitList(skillart.beginEffect, beginScrollPos, out beginScrollPos, width, ref beginEffectList, effectNamelist, SkillEffectPrefabs); } else { if (GUILayout.Button("Add beginEffectList")) { skillart.beginEffect = new List <SkillEffectUnit>(); } } } showEndEffect = EditorGUILayout.Foldout(showEndEffect, "endEffect 结束特效:"); // EditorGUILayout.LabelField("tipEffect 警告特效:"); if (showEndEffect) { if (skillart.endEffect != null) { EditorDrawUtility.DrawEffectUnitList(skillart.endEffect, endEffectScrollPos, out endEffectScrollPos, width, ref endEffectList, effectNamelist, SkillEffectPrefabs); } else { if (GUILayout.Button("Add endEffectList")) { skillart.endEffect = new List <SkillEffectUnit>(); } } } showUnit = EditorGUILayout.Foldout(showUnit, "unitEffect 弹道特效:"); //EditorGUILayout.LabelField("unitEffect 弹道特效:"); if (showUnit) { if (skillart.unitEffect != null) { EditorDrawUtility.DrawEffectUnitList(skillart.unitEffect, unitEffectScrollPos, out unitEffectScrollPos, width, ref unitEffectList, effectNamelist, SkillEffectPrefabs); } else { if (GUILayout.Button("Add unitEffectList")) { skillart.unitEffect = new List <SkillEffectUnit>(); } } } showTipEffect = EditorGUILayout.Foldout(showTipEffect, "tipEffect 警告特效:"); // EditorGUILayout.LabelField("tipEffect 警告特效:"); if (showTipEffect) { if (skillart.tipEffect != null) { EditorDrawUtility.DrawEffectUnitList(skillart.tipEffect, tipEffectScrollPos, out tipEffectScrollPos, width, ref tipEffectList, effectNamelist, SkillEffectPrefabs); } else { if (GUILayout.Button("Add tipEffectList")) { skillart.tipEffect = new List <SkillEffectUnit>(); } } } showHitEffect = EditorGUILayout.Foldout(showHitEffect, "hitEffect 击中特效:"); // EditorGUILayout.LabelField("tipEffect 警告特效:"); if (showHitEffect) { if (skillart.hitEffect != null) { EditorDrawUtility.DrawEffectUnitList(skillart.hitEffect, hitEffectScrollPos, out hitEffectScrollPos, width, ref hitEffectList, effectNamelist, SkillEffectPrefabs); } else { if (GUILayout.Button("Add hitEffectList")) { skillart.tipEffect = new List <SkillEffectUnit>(); } } } showBeginCamera = EditorGUILayout.Foldout(showBeginCamera, "beginCameraAction 开始相机特效:"); //EditorGUILayout.LabelField("beginCameraAction 开始相机特效:"); if (showBeginCamera) { if (skillart.beginCameraAction != null) { EditorDrawUtility.DrawCameraActionList(skillart.beginCameraAction, beginCameraScrollPos, out beginCameraScrollPos, width, ref beginCameraList); } else { if (GUILayout.Button("Add beginCameraActionList")) { skillart.beginCameraAction = new List <SkillCameraAction>(); } } } showMoveCamera = EditorGUILayout.Foldout(showMoveCamera, "moveCameraAction 移动相机特效:"); if (showMoveCamera) { //EditorGUILayout.LabelField("moveCameraAction 移动相机特效:"); if (skillart.moveCameraAction != null) { EditorDrawUtility.DrawCameraActionList(skillart.moveCameraAction, movingCameraScrollPos, out movingCameraScrollPos, width, ref movingCameraList); } else { if (GUILayout.Button("Add moveCameraActionList")) { skillart.moveCameraAction = new List <SkillCameraAction>(); } } } showHitCamera = EditorGUILayout.Foldout(showHitCamera, "hitCameraAction 命中相机特效:"); if (showHitCamera) { // EditorGUILayout.LabelField("hitCameraAction 命中相机特效:"); if (skillart.hitCameraAction != null) { EditorDrawUtility.DrawCameraActionList(skillart.hitCameraAction, hitCameraScrollPos, out hitCameraScrollPos, width, ref hitCameraList); } else { if (GUILayout.Button("Add hitCameraActionList")) { skillart.hitCameraAction = new List <SkillCameraAction>(); } } } EditorGUILayout.EndVertical(); }