void Update() { if (mObject != null) { GFX.GfxSystem.Instance.Tick(); AnimNames = mObject.getAnimationName(); AnimNames.Sort(); AnimNames.Insert(0, "none"); if (isReadyUpdateLocater) { GameObject go = mObject.getGameObject(); if (go != null) { Transform[] actorBones = go.GetComponentsInChildren <Transform>(); foreach (Transform t in actorBones) { if (t.name.IndexOf("Locator") != -1) { LocatorNames.Add(t.name); } } } isReadyUpdateLocater = false; if (mEffects.Count != 0 && mEffects[effectIndex] != "none" && mSkill != null) { GFX.GfxSkillEffect curSkillEffect = mSkill.getSkillEffect(effectIndex - 1); if (curSkillEffect != null) { string attachPoint = curSkillEffect.getParameter("AttachPoint"); mLocatorNameIndex = LocatorNames.IndexOf(attachPoint); if (mLocatorNameIndex == -1) { mLocatorNameIndex = 0; } } } if (mSkill != null) { string curAnimateName = mSkill.getParameter("Animation"); mSkillAnimateNameIndex = AnimNames.IndexOf(curAnimateName); if (mSkillAnimateNameIndex == -1) { mSkillAnimateNameIndex = 0; } } } } }
void DisplaySkillGUI() { List <string> skillList = getCurrrentSkillList(); GUILayout.BeginHorizontal("box"); GUILayout.Label("Skill"); if (skillList.Count <= skillIndex) { skillIndex = 0; } skillIndex = EditorGUILayout.Popup(skillIndex, skillList.ToArray()); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal("box"); if (!GUILayout.Button("AddSkill")) { if (skillList[skillIndex] != "none") { if (lastSkillIndex != skillIndex) { string skillName = getCurrentSkillName(); actor.getSkill(skillName); GFX.GfxSkill curSkill = actor.Skill; if (curSkill != null) { stat = GUI_STATUS.CHECKING; refreshSkillEffectList(); string curAnimateName = curSkill.getParameter("Animation"); mSkillAnimateNameIndex = getCurrentAnimateList().IndexOf(curAnimateName); if (mSkillAnimateNameIndex == -1) { mSkillAnimateNameIndex = 0; } mBreakTime = curSkill.getParameter("BreakTime"); mHitTime = curSkill.getParameter("HitTime"); mShakeTime = curSkill.getParameter("ShakeTime"); mRepeatEffect = curSkill.RepeatEffect; mEnableRibbon = curSkill.EnableRibbon; lastEffectIndex = 0; openHitGroundEffect = curSkill.isHitGroundEffectExist(); } } lastSkillIndex = skillIndex; } } else { stat = GUI_STATUS.ADDSKILL; } if (GUILayout.Button("RemoveSkill")) { removeSkill(); } GUILayout.EndHorizontal(); switch (stat) { case GUI_STATUS.ADDEFFECT: addSkillEffect(); break; case GUI_STATUS.ADDSKILL: addSkill(); break; case GUI_STATUS.CHECKING: { showSkill(); showSkillEffect(); ShowHitGroundEffect(); GUILayout.BeginHorizontal("box"); if (GUILayout.Button("SetSkill")) { if (getCurrentSkillAnimateName() == "none") { actor.Skill.setParameter("Animation", ""); } else { actor.Skill.setParameter("Animation", getCurrentSkillAnimateName()); } actor.Skill.setParameter("BreakTime", mBreakTime); actor.Skill.setParameter("HitTime", mHitTime); actor.Skill.setParameter("ShakeTime", mShakeTime); actor.Skill.RepeatEffect = mRepeatEffect; actor.Skill.EnableRibbon = mEnableRibbon; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal("box"); bool changed = EditorGUILayout.Toggle("Play", this.isPlaying); if (changed != this.isPlaying) //if (GUILayout.Button(GetActionName())) { SetAction(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal("box"); if (GUILayout.Button("Save")) { Save(); } GUILayout.EndHorizontal(); } break; } }
void DisplaySkillGUI() { GUILayout.BeginHorizontal("box"); GUILayout.Label("Skill"); skillIndex = EditorGUILayout.Popup(skillIndex, SkillNames.ToArray()); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal("box"); if (!GUILayout.Button("AddSkill")) { if (SkillNames[skillIndex] != "none") { if (lastSkillIndex != skillIndex) { GFX.GfxSkill curSkill = GFX.GfxSkillManager.Instance.createAndParseSkillTemplate(SkillNames[skillIndex]); if (curSkill != null) { mSkill = curSkill; stat = GUI_STATUS.CHECKING; refreshSkillEffectList(); string curAnimateName = mSkill.getParameter("Animation"); mSkillAnimateNameIndex = AnimNames.IndexOf(curAnimateName); if (mSkillAnimateNameIndex == -1) { mSkillAnimateNameIndex = 0; } mBreakTime = mSkill.getParameter("BreakTime"); mHitTime = mSkill.getParameter("HitTime"); mShakeTime = mSkill.getParameter("ShakeTime"); mRepeatEffect = mSkill.getParameter("RepeatEffect"); lastEffectIndex = 0; } } lastSkillIndex = skillIndex; } } else { stat = GUI_STATUS.ADDSKILL; } if (GUILayout.Button("RemoveSkill")) { removeSkill(); } GUILayout.EndHorizontal(); switch (stat) { case GUI_STATUS.ADDEFFECT: addSkillEffect(); break; case GUI_STATUS.ADDSKILL: addSkill(); break; case GUI_STATUS.CHECKING: { showSkill(); showSkillEffect(); GUILayout.BeginHorizontal("box"); if (GUILayout.Button("SetSkill")) { if (AnimNames[mSkillAnimateNameIndex] == "none") { mSkill.setParameter("Animation", ""); } else { mSkill.setParameter("Animation", AnimNames[mSkillAnimateNameIndex]); } mSkill.setParameter("BreakTime", mBreakTime); mSkill.setParameter("HitTime", mHitTime); mSkill.setParameter("ShakeTime", mShakeTime); mSkill.setParameter("RepeatEffect", mRepeatEffect); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal("box"); if (GUILayout.Button(GetActionName())) { SetAction(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal("box"); if (GUILayout.Button("Save")) { Save(); } GUILayout.EndHorizontal(); } break; } }