private void DrawSkillList(float width, float height) { EDLayout.CreateScrollView(ref LeftPos, "", width, height, () => { for (int i = 0; i < Json.List.Count; i++) { SkillJson skill = Json.List[i]; EDButton.CreateBtn(skill.Id, 180, 25, () => { SelSkillChange(skill); }); } //添加技能 EDButton.CreateBtn("新建技能", 180, 30, () => { EDPopPanel.PopWindow("输入技能Id>>>>>>", (x) => { if (CheckContainSkill(x)) { Debug.LogError("技能Id重复>>>>>>>>>>>>" + x); return; } int skillId = int.Parse(x); SkillJson json = new SkillJson { Id = skillId, }; Json.List.Add(json); }); }); }); }
//选择实体改变 private void SelSkillChange(SkillJson skill) { if (skill == null) { SelSkill = null; return; } SelSkill = skill; }
private void DrawSkill(float width, float height) { if (SelSkill == null) { return; } EDLayout.CreateVertical("box", width, height, (float wid, float hei) => { //动画 if (SelAnim != null) { AnimPlayTime = EditorGUILayout.Slider("播放动画", AnimPlayTime, 0, GetTotalAnimTime()); object playScale = TimePlayScale; EDTypeField.CreateTypeField("播放动画时间倍数:", ref playScale, typeof(string), width, 25); TimePlayScale = float.Parse(playScale.ToString()); if (IsPlaying) { GUI.color = Color.red; EDButton.CreateBtn("暂停", width, 50, () => { IsPlaying = false; }); } else { GUI.color = Color.green; EDButton.CreateBtn("播放", width, 50, () => { IsPlaying = true; }); } } GUI.color = Color.white; EDTypeField.CreateLableField("技能Id:" + SelSkill.Id, "", width, 25); object value = SelSkill.DecStr; EDTypeField.CreateTypeField("技能描述:", ref value, typeof(string), width, 25); SelSkill.DecStr = value.ToString(); object triggerValue = SelSkill.TriggerTime; EDTypeField.CreateTypeField("技能触发时间:", ref triggerValue, typeof(double), width, 25); SelSkill.TriggerTime = double.Parse(triggerValue.ToString()); EDButton.CreateBtn("删除技能", 200, 50, () => { Json.List.Remove(SelSkill); SelSkill = null; }); ShowInfo = EditorGUILayout.Foldout(ShowInfo, "技能信息"); if (ShowInfo) { DrawSkillInfo(width, height * 0.3f); } GUILayout.Space(10); ShowData = EditorGUILayout.Foldout(ShowData, "技能数据"); if (ShowData) { DrawSkillData(width, height * 0.3f); } GUILayout.Space(10); ShowAudio = EditorGUILayout.Foldout(ShowAudio, "技能音效"); if (ShowAudio) { DrawSkillAudio(width, height * 0.3f); } GUILayout.Space(10); ShowEffect = EditorGUILayout.Foldout(ShowEffect, "技能特效"); if (ShowEffect) { DrawSkillEffect(width, height * 0.3f); } GUILayout.Space(10); }); }