/// <summary> /// 绘制攻击定义列表 /// </summary> /// <param name="clip"></param> public static void DrawHitDefinitionList(AIClip clip) { GUILayout.BeginHorizontal(); GUILayout.Label("攻击定义列表:", GUILayout.Width(80)); #region copy and paste icons if (GUILayout.Button(AIFGUISKin.IconCopy, GUILayout.Width(30), GUILayout.Height(30))) { if (AIDataSelection.selectedHitData != null) { CustomClipBoard.CopyData(AIDataSelection.selectedHitData); } } if (GUILayout.Button(AIFGUISKin.IconPaste, GUILayout.Width(30), GUILayout.Height(30))) { object clipBoardObj; CustomClipBoard.GetCopyObject(out clipBoardObj); if (clipBoardObj == null) { Debug.LogError("剪切板没有内容可以粘贴"); } else { clipBoardObj = Utility.XmlDeepCloneObject(clipBoardObj); if (clipBoardObj is AiClipHitData) { clip.hitCheckList.Add(clipBoardObj as AiClipHitData); } } } #endregion if (GUILayout.Button(AIFGUISKin.IconNewItem, GUILayout.Width(30), GUILayout.Height(30))) { clip.hitCheckList.Add(new AiClipHitData()); } GUILayout.EndHorizontal(); for (int i = 0; i < clip.hitCheckList.Count; i++) { AiClipHitData hitCheck = clip.hitCheckList[i]; GUILayout.BeginHorizontal(); Color col = hitCheck == AIDataSelection.selectedHitData?Color.green:GUI.color; if (AIFUIUtility.LayoutButtonWithColor(hitCheck.name, col, 150)) { AIDataSelection.SelectedHitData(hitCheck); HitDataEditWnd.Open(hitCheck); } if (GUILayout.Button("X", GUILayout.Width(40))) { if (EditorUtility.DisplayDialog("tips", "确定删除攻击定义?", "OK")) { clip.hitCheckList.Remove(hitCheck); break; } } GUILayout.EndHorizontal(); } }
void DrawSelectedAiClipOrGroup() { GUILayout.BeginArea(new Rect(410, 0, position.width * 0.6f, position.height * 0.9f)); //selectionScrollPos = GUILayout.BeginScrollView(selectionScrollPos, true, true, GUILayout.Width(400), GUILayout.Height(position.height * 0.9f)); GUILayout.Label("当前选中"); AIClip selectedClip = AIDataSelection.selectedAiClip; AIClipGroup selectedGroup = AIDataSelection.selecteClipGroup; if (selectedClip != null) { AIFUIUtility.DrawAIClip(selectedClip, selectedGroup); GUILayout.BeginHorizontal(); GUILayout.Label("连接片断列表:", GUILayout.Width(100)); if (GUILayout.Button("添加连接", GUILayout.Width(100))) { AILink link = new AILink(); selectedClip.linkAIClipList.Add(link); AILinkEditWnd wnd = EditorWindow.GetWindow <AILinkEditWnd>(); wnd.SetData(AIDataSelection.selecteClipGroup, link); } GUILayout.EndHorizontal(); GUILayout.BeginArea(new Rect(250, 150, 500, 700)); AIFUIUtility.DrawAiEvetList(selectedClip); GUILayout.EndArea(); GUILayout.BeginArea(new Rect(450, 150, 500, 700)); AIFUIUtility.DrawHitDefinitionList(selectedClip); GUILayout.EndArea(); #region Links if (selectedClip.linkAIClipList.Count == 0) { GUILayout.Label("空列表", GUILayout.Width(300)); } else { for (int i = 0; i < selectedClip.linkAIClipList.Count; i++) { AILink ai = selectedClip.linkAIClipList[i]; GUILayout.BeginHorizontal(); //string fullClipName= if (AIFUIUtility.LayoutButtonWithColor(ai.linkToClip, AIDataSelection.IsSelectedLinkClip(ai) ? Color.cyan : Color.magenta, 150)) { AIDataSelection.SelectLinkClip(ai); AILinkEditWnd.EditAILink(selectedGroup, ai); } if (GUILayout.Button("X", GUILayout.Width(20))) { if (EditorUtility.DisplayDialog("提示", "确定要删除连接吗", "确定")) { selectedClip.linkAIClipList.Remove(ai); return; } } GUILayout.EndHorizontal(); } #region 绘制选择连接 //AILink link = curSelection.SelectedLink; //if (link != null) //{ // GUILayout.BeginArea(new Rect(300, 50, 500, 700)); // link.linkToClip = AIFUIUtility.DrawTextField(link.linkToClip, "连接目标"); // conditionListPos = GUILayout.BeginScrollView(conditionListPos, true, true, GUILayout.Width(300), GUILayout.Height(position.height * 0.6f)); // AIFUIUtility.DrawAiLinkConditions(link); // GUILayout.EndScrollView(); // GUILayout.EndArea(); //} #endregion } #endregion } else //没选中AI片断就检测时候在编辑AI组 { if (AIDataSelection.selecteClipGroup != null) { AIClipGroup clipGroup = AIDataSelection.selecteClipGroup; clipGroup.name = EditorGUILayout.TextField("Ai组名称", clipGroup.name, GUILayout.Width(300)); clipGroup.moveSpeed = EditorGUILayout.FloatField("移动速度", clipGroup.moveSpeed, GUILayout.Width(300)); clipGroup.targetType = (ETargetType)EditorGUILayout.EnumPopup("目标类型", clipGroup.targetType, GUILayout.Width(300)); AIFUIUtility.DrawAIShape(AIDataSelection.selecteClipGroup.shape); AIFUIUtility.DrawCommanAnimation(AIDataSelection.selecteClipGroup.commonAnimation, AIDataSelection.selecteClipGroup); } else if (AIDataSelection.selectedUnit != null) { AIDataSelection.selectedUnit.aiData.AiName = EditorGUILayout.TextField("AI单位名称", AIDataSelection.selectedUnit.aiData.AiName, GUILayout.Width(400)); // } } //GUILayout.EndScrollView(); GUILayout.EndArea(); }
void DrawAIUnit(UIAIDataUnit groupUnit) { AIDataUnit aiData = groupUnit.aiData; for (int groupIndex = 0; groupIndex < aiData.aiGroups.Count; groupIndex++) { AIClipGroup clipGroup = aiData.aiGroups[groupIndex]; GUILayout.BeginHorizontal(); GUILayout.Space(20); bool expandGroup = groupUnit.GetChildExpand(groupIndex); if (GUILayout.Button(expandGroup?"-":"+", GUILayout.Width(25))) { groupUnit.SetChildExpand(groupIndex, !expandGroup); } if (AIFUIUtility.LayoutButtonWithColor(clipGroup.GroupName, clipGroup == AIDataSelection.selecteClipGroup?Color.magenta:GUI.color, 170)) { AIDataSelection.SelectAIGroup(clipGroup); } if (GUILayout.Button("Add", GUILayout.Width(45))) { AIClip aiClip = new AIClip(); AIClipEditWnd wnd = EditorWindow.GetWindow <AIClipEditWnd>(); wnd.SetData(AIClipEditWnd.EditMode.Create, clipGroup, aiClip, delegate { clipGroup.aiClipList.Add(aiClip); }); } if (GUILayout.Button("X", GUILayout.Width(45))) { if (EditorUtility.DisplayDialog("警告", "确定删除动作组?", "确定")) { aiData.aiGroups.Remove(clipGroup); Repaint(); return; } } GUILayout.EndHorizontal(); if (expandGroup) { const int indentSpace = 40; #region 绘制展开的AI组片断 if (clipGroup.aiClipList.Count == 0) { GUILayout.BeginHorizontal(); GUILayout.Space(indentSpace); GUILayout.Label("空"); GUILayout.EndHorizontal(); } else { for (int i = 0; i < clipGroup.aiClipList.Count; i++) { AIClip clip = clipGroup.aiClipList[i]; GUILayout.BeginHorizontal(); GUILayout.Space(indentSpace); Color col = AIDataSelection.selectedAiClip == clip ? Color.green : GUI.color; if (AIFUIUtility.LayoutButtonWithColor(clip.NameOnUI, col, AIFGUISKin.GetStyle("button"), GUILayout.Width(150))) { AIDataSelection.SelectAIDataUnit(groupUnit); AIDataSelection.SelectAIClip(clip); } if (clip == AIDataSelection.selectedAiClip) { } if (GUILayout.Button("X", GUILayout.Width(30))) { if (EditorUtility.DisplayDialog("删除AI片断", "确定要删除?", "Yes")) { DeleteAiClipFromAiGroup(clip, clipGroup); clipGroup.aiClipList.Remove(clip); return; } } GUILayout.EndHorizontal(); } } #endregion } } }
/// <summary> /// 绘制片断时间列表 /// </summary> /// <param name="clip"></param> public static void DrawAiEvetList(AIClip clip) { GUILayout.BeginHorizontal(); GUILayout.Label("事件列表", GUILayout.Width(60)); #region copy and paste icons if (GUILayout.Button(AIFGUISKin.IconCopy, GUILayout.Width(30), GUILayout.Height(30))) { if (AIDataSelection.aiEvent != null) { CustomClipBoard.CopyData(AIDataSelection.aiEvent); } } if (GUILayout.Button(AIFGUISKin.IconPaste, GUILayout.Width(30), GUILayout.Height(30))) { object clipBoardObj; CustomClipBoard.GetCopyObject(out clipBoardObj); if (clipBoardObj == null) { Debug.LogError("剪切板没有内容可以粘贴"); } else { clipBoardObj = Utility.XmlDeepCloneObject(clipBoardObj); if (clipBoardObj is AIClipEvent) { clip.AiClipEvents.Add(clipBoardObj as AIClipEvent); } } } #endregion if (GUILayout.Button(AIFGUISKin.IconNewItem, GUILayout.Width(30), GUILayout.Height(30))) { AIEventEditWnd.OpenCreateEditor(delegate(AIClipEvent e) { clip.AiClipEvents.Add(e); }); } GUILayout.EndHorizontal(); if (clip.AiClipEvents.Count == 0) { GUILayout.Label("事件列表为空"); } else { for (int i = 0; i < clip.AiClipEvents.Count; i++) { AIClipEvent evet = clip.AiClipEvents[i]; GUILayout.BeginHorizontal(); Color col = AIDataSelection.aiEvent == evet ? Color.green : GUI.color; if (AIFUIUtility.LayoutButtonWithColor(evet.eventName, col, 150)) { AIDataSelection.SelectedAIEvent(evet); AIEventEditWnd.OpenAsEditMode(evet); } if (GUILayout.Button("X", GUILayout.Width(30))) { if (EditorUtility.DisplayDialog("警告", "确定删除事件吗", "确定", "取消")) { clip.AiClipEvents.Remove(evet); return; } } GUILayout.EndHorizontal(); } } }