예제 #1
0
    public static void EditAILink(AIClipGroup clipGroup, AILink link)
    {
        AILinkEditWnd wnd = EditorWindow.GetWindow <AILinkEditWnd>();

        wnd.SetData(clipGroup, link);
    }
예제 #2
0
    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();
    }