Example #1
0
        private void RefreshPanel()
        {
            //左侧列表
            EDLayout.CreateVertical("box", position.width, position.height, () =>
            {
                //编辑界面切换
                EDLayout.CreateHorizontal("box", position.width, 40, (() =>
                {
                    EDButton.CreateBtn("决策层", 100, 20, (() => { ShowDec = true; SaveJson(); showNodeEditor.Clear(); }));

                    EDButton.CreateBtn("行为层", 100, 20, (() => { ShowDec = false; SaveJson(); showNodeEditor.Clear(); }));

                    DrawSelNodePremise(position.width - 200, 40);
                }));

                //界面刷新
                EDLayout.CreateHorizontal("box", position.width, position.height - 40, (() =>
                {
                    if (ShowDec)
                    {
                        DrawDecTreeList();
                    }
                    else
                    {
                        DrawBevTreeList();
                    }
                }));
            });

            //右侧节点
            RefreshRightPanel();
        }
Example #2
0
        private void DrawSkillData(float width, float height)
        {
            EDLayout.CreateScrollView(ref dataPos, "", width, height, (float wid, float hei) =>
            {
                for (int i = 0; i < SelSkill.Data.Count; i++)
                {
                    EDLayout.CreateVertical("GroupBox", wid * 0.9f, 55, (float wid01, float hei01) =>
                    {
                        int selIndex           = i;
                        SkillDataJson dataJson = SelSkill.Data[i];

                        //时间信息
                        EDLayout.CreateHorizontal("box", wid01, 25, (float wid02, float hei02) =>
                        {
                            //作用时间
                            object timeValue = dataJson.Time;
                            EDTypeField.CreateTypeField("作用时间:", ref timeValue, typeof(double), 220, 25);
                            dataJson.Time = double.Parse(timeValue.ToString());

                            //持续时间
                            object continueTimeValue = dataJson.ContinueTime;
                            EDTypeField.CreateTypeField("持续时间:", ref continueTimeValue, typeof(double), 220, 25);
                            dataJson.ContinueTime = double.Parse(continueTimeValue.ToString());

                            //间隔时间
                            object gapTimeValue = dataJson.GapTime;
                            EDTypeField.CreateTypeField("间隔时间:", ref gapTimeValue, typeof(double), 220, 25);
                            dataJson.GapTime = double.Parse(gapTimeValue.ToString());
                        });

                        //技能枚举
                        EDLayout.CreateHorizontal("box", wid01, 25, (float wid02, float hei02) =>
                        {
                            //技能类型
                            dataJson.Type = (SkillType)EditorGUILayout.EnumPopup("技能类型:", dataJson.Type, GUILayout.Width(220), GUILayout.Height(25));

                            //技能作用类型
                            dataJson.UseType = (SkillUseType)EditorGUILayout.EnumPopup("作用类型:", dataJson.UseType, GUILayout.Width(220), GUILayout.Height(25));

                            //数据类型
                            dataJson.DataType = (SkillDataType)EditorGUILayout.EnumPopup("数据类型:", dataJson.DataType, GUILayout.Width(220), GUILayout.Height(25));
                        });

                        //数据
                        object data = dataJson.Data;
                        EDTypeField.CreateTypeField("数据:", ref data, typeof(String), 220, 20);
                        dataJson.Data = data.ToString();

                        EDButton.CreateBtn("删除数据", wid01, 20, () => {
                            SelSkill.Data.RemoveAt(selIndex);
                        });
                    });
                }

                EDButton.CreateBtn("添加数据", wid * 0.9f, 25, () => {
                    SelSkill.Data.Add(new SkillDataJson());
                });
            });
        }
Example #3
0
 private void OnGUI()
 {
     EDLayout.CreateHorizontal("box", position.width, position.height, (float weight, float height) =>
     {
         DrawSkillList(200, height);
         DrawSkill(770, height);
         DrawAnimList(230, height);
     });
 }
Example #4
0
        private void DrawAnimList(float width, float height)
        {
            if (SelSkill == null)
            {
                return;
            }
            EDLayout.CreateVertical("", width, height, (float wid, float hei) =>
            {
                if (SelSkill.AnimClips.Count != 0)
                {
                    EDLayout.CreateScrollView(ref animPos, "box", wid, hei * 0.7f, (float wid01, float hei01) =>
                    {
                        //动画列表
                        for (int i = 0; i < SelSkill.AnimClips.Count; i++)
                        {
                            int selIndex = i;
                            if (CheckAnimatorHasClip(SelAnim, SelSkill.AnimClips[i].AnimName))
                            {
                                EDLayout.CreateHorizontal("box", 210, 30, (float wid02, float hei02) =>
                                {
                                    EDTypeField.CreateLableField(string.Format("动画名:{0}", SelSkill.AnimClips[i].AnimName), "", wid02 * 0.7f, hei02);
                                    EDButton.CreateBtn("删除动画", wid02 * 0.3f, hei02, () => {
                                        SelSkill.AnimClips.RemoveAt(selIndex);
                                        UpdateAnimClipsTime();
                                    });
                                });
                            }
                            else
                            {
                                SelSkill.AnimClips.RemoveAt(selIndex);
                                UpdateAnimClipsTime();
                            }
                        }
                    });
                }

                //添加动画
                if (RunningClip.Count == 0)
                {
                    return;
                }
                List <string> showClips = new List <string>();
                for (int i = 0; i < RunningClip.Count; i++)
                {
                    showClips.Add(RunningClip[i].name);
                }
                EDButton.CreateBtn("添加动画", 180, 25, () => {
                    EDPopMenu.CreatePopMenu(showClips, (string str) =>
                    {
                        SkillAnimJson animJson = new SkillAnimJson();
                        animJson.AnimName      = str;
                        SelSkill.AnimClips.Add(animJson);
                        UpdateAnimClipsTime();
                    });
                });
            });
        }
 private void OnGUI()
 {
     EDLayout.CreateVertical("box", position.width, position.height, () =>
     {
         //界面刷新
         EDLayout.CreateHorizontal("box", position.width, position.height - 20, (() =>
         {
             DrawEntityJsonList();
         }));
     });
 }
Example #6
0
        private void OnGUI()
        {
            EDLayout.CreateHorizontal("box", position.width, position.height, RefreshPanel);

            ProcessNodeEvents(Event.current);

            ProcessEvents(Event.current);

            curMousePos = Event.current.mousePosition;
            // if (GUI.changed)
            // {
            //
            // }

            bgGridRect = new Rect(new Vector2(position.width * 0.25f, 0), new Vector2(position.width * 0.75f, position.height));
            Repaint();
        }
Example #7
0
        private void OnGUI()
        {
            EDLayout.CreateVertical("box", position.width, position.height, () => {
                SelMap    = (MapData)EditorGUILayout.ObjectField(SelMap, typeof(MapData), true);
                CurPos    = (Vector2Int)EditorGUILayout.Vector2IntField("当前位置", CurPos);
                TargetPos = (Vector2Int)EditorGUILayout.Vector2IntField("目标位置", TargetPos);

                EDButton.CreateBtn("寻路", 100, 50, () => {
                    //Debug.LogWarningFormat("寻路({0},{1} ==> ({2},{3}))",CurPos.x,CurPos.y,TargetPos.x,TargetPos.y);
                    Path = AstarHelp.FindPath(CurPos, TargetPos, SelMap.ObstaclePos);
                    //Debug.LogWarningFormat("找到 {0} 路径点",Path.Count);
                });


                EDButton.CreateBtn("道路寻路", 100, 50, () => {
                    //Debug.LogWarningFormat("道路寻路({0},{1} ==> ({2},{3}))",CurPos.x,CurPos.y,TargetPos.x,TargetPos.y);
                    Path = AstarHelp.FindPath(CurPos, TargetPos, SelMap.ObstaclePos, SelMap.RoadPos);
                    //Debug.LogWarningFormat("找到 {0} 路径点",Path.Count);
                });

                EditorGUILayout.Space();

                if (SelMap != null)
                {
                    for (int y = TempConfig.MapSizeY - 1; y >= 0; y--)
                    {
                        EDLayout.CreateHorizontal("box", BoxSize * TempConfig.MapSizeY, BoxSize, () => {
                            for (int x = 0; x < TempConfig.MapSizeX; x++)
                            {
                                // Color showColor = GetShowTextColor(x,y);
                                // GUI.color=showColor;
                                // string pos=string.Format("{0},{1}",x,y);
                                Texture showImg = GetBoxShowImg(x, y);
                                GUILayout.Box(new GUIContent(showImg), GUILayout.Height(BoxSize), GUILayout.Width(BoxSize));
                            }
                        });
                    }
                }
            });
        }
Example #8
0
        private void OnGUI()
        {
            EDLayout.CreateVertical("box", position.width, position.height, () =>
            {
                //编辑界面切换
                EDLayout.CreateHorizontal("box", position.width, 20, (() =>
                {
                    EDButton.CreateBtn("实体请求", 100, 20, (() =>
                    {
                        SaveReqJson();
                        ShowEntityReq = true;
                    }));

                    EDButton.CreateBtn("世界请求", 100, 20, (() =>
                    {
                        SaveReqJson();
                        ShowEntityReq = false;
                    }));
                }));

                //界面刷新
                EDLayout.CreateHorizontal("box", position.width, position.height - 20, (DrawReqList));
            });
        }